Posts

sourcetree can't revert merge

Sourcetree is pretty bad when it comes to reverting a merge. So you might have to use the terminal and type out the following field.


git revert -m 1 HEAD






tf working with tf.decode_csv

In the documentation it says, convert csv file into tensor. Not really sure what it means by tensor. Anyways, here is some example working with the codes :-

tensorflow : working with tf.data.TextLineDataset

Here is a simple example of working with tf.data.TextLineDataset





Angular5 post seems to be posting null values to webapi core controller

Getting Angular5/6 HttpClient to post JSON object to a WebAPI (.Net Core) seems to be passing null value to your simple/complex model for example, EmployeeModel.

 There are alot of component you need to get right. Key changes include:-


a) CORS Setup - In your WebApi's Startup.cs you need to configure CORS correctly.  Please have a look at code below, i have configure my CORS to accept any methods and any header.


app.UseCors(option => option.WithOrigins("*").AllowAnyMethod().AllowAnyHeader());

The complete code snippet is shown here.


b) Header - You need to configure 'Content-Type' wth application/json in your HTTP POST calls and not forgetting the subscribe() method call - to execute method now. :)




constheaders = newHttpHeaders().set('Content-Type', 'application/json; charset=utf-8'); this.http.post(APPLICATION_HOST + '/user/save', "{name:'jeremy', username : 'wooo'}", {headers :headers}).subscribe(data=> {���…

angular reactiveform, templateform and dynamicform

Yeap if you have the feeling these are all different methods used in constructing forms, then you're right.

ReactiveForm - uses reactive style to work with form. It would uses reactive way to monitor, track interaction with the forms. To work with this you need to use FormGroup to create a series of control for your form or just FormGroup an individual element to tied to your HTML control.


Please take a look at this to get an idea of how reactive form works.



TemplateForm - uses the model and HTML approach whereby HTML tags are binded to a model

DynamicForm - an approach that lets you create forms dynamically and faster by using ReactiveForm and cleverly using OO strategy to make sure questions are rendered dynamically.






Tensorflow quick example for using DNNRegressor for house prediction analysis

A quick and dirty code to run orchid classifier using tensorflow deep learning classifier

Parsing json giving unexpected token o error

Was getting this weird issue. If you do get this, the solution is don't parse your JSON, as it is already in JSON form


using Mssql server on docker

First of all, please ensure you install docker toolbox.

Once you have done that, ensure you run the following command. If you  setup your command prompt to use docker, if not please follow the instruction here.

Step 1

SET ACCEPT_EULA=Y
SET SA_PASSWORD=P@ssword01
SET MSSQL_PID=Developer

Run docker

docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=P@ssword01" -p 1433:1433 -d microsoft/mssql-server-linux:latest

Please note: ensure to use double quote for windows, other wise it would not work.

if you face any issues, please run docker log to get the latest runtime messages

.netcore project appeared not to be running with thread exited

Image
If you encounter this issue, the fix is pretty straight forward. Just configure your project NOT to use IIS Express. Instead configure it to use whatever program name and output type to "Console App".



That's it.