Posts

Showing posts from May, 2018

Sourcetree - pulling remote branch to your local drive

Image
To pull remote branch into your sourcetree is pretty easy with sourcetree. Double click on any of the branch below :- then you will be prompted with the following screen :- Just provide a name and you will get your remote branch downloaded locally.

Git - reset all local changes and commit then sync with remote branch

If you ever need to discard local change and sync everything from the start git reset --hard origin/develop ( develop is your remote branch ) git pull origin develop  ( just funny they omit the slash here )  This is all you need. 

classifying text sentiment simple way

Once of the easiest way to classify a text sentiment is to use the following Keras code :-

A Git a day : Merge vs rebase

Image
Merge combines commit from say a master branch into a feature branch while retaining history from both branch. Rebase places new changes on top of a master branch. While the picture looks fine, all changes from feature branch are sync with master's commits. If this is the other way around, rebasing master in feature branch, then master commits will be lost. So the golden rule of using rebase is :- Is anyone looking / using this branch before we do our rebasing. We don't want to change history for master and confuse developers. If you want to use rebase, create a feature branch. Interactive rebasing - here you get to choose which histories you want to be included in the commit.

Sitecore Commerce server configuration : value cannot be null

Image
Bump into this error and i decided to disable my Sitecore from using SiteCore Commerce server.  So go into App_Config and then rename CommerceServer.Core.config to CommerceServer.Core.config_disabled. Try to refresh your browser

COM services control panel (comexp.msc)

It has been such a long time that i had to deal with COM service. The command to kick off this is called " comexp.ms c". 
Image
I find the following information is relevant when it comes to FTP over TLS, that i ripped it out of Fluent FTP site. These are the commands issued by the client to configure / setup channel to use a  TLS . Outputs coming out from console are show here. FTP Support Mapping table documenting supported FTP commands and the corresponding API.. Connection commands Command API Description USER, PASS Credentials Login with username & password QUIT Disconnect() Disconnect PASV, EPSV, EPRT DataConnectionType Passive & Active FTP modes FEAT HasFeature() Get the features supported by server SYST GetSystem() Get the server system type OPTS UTF8 ON Encoding Enables UTF-8 filenames OPTS UTF8 OFF Encoding, DisableUTF8() Disables UTF-8 filenames AUTH TLS EncryptionMode Switch to TLS/FTPS PBSZ, PROT EncryptionMode and DataConnectionEncryption Configure TLS/FTPS connection CCC PlainTextEncryption Switch to plaintext FTP PRET Automatic Pre-transfer file informatio

fluent ftp - transferring file securely

I don't think you will believe this but to transfer or upload a file securely, all you need to do with fluent ftp is the following :- I download and trace through fluent ftp code and this is as fluent as it can get. If you get "unexpected format " - this means the protocol you specified is not supported by your server. Please find out

Transfering files via FTPS

Image
WinSCP provides easy to use nuget library to work with FTP, FTPS (Secure FTP over SSL /  TLS) and SFTP (ssh over ftp) In my scenario, I am trying to transfer file via FTPS. If you need some help with the codes, download the WinSCP installer and try connecting to the server and try out the supported protocol like ssl, tls or ssh. Goto -> Session -> Generate Session URL / Code. To help you figure out the code, you can try looking at .Net assembly code tab. So this will help you resolve many of the issue trying understand how to configure your session. Some common error messages you will get includes :- "SessionOptions.Protocol is Protocol.Sftp or Protocol.Scp, but SessionOptions.SshHostKeyFingerprint is not set." - Please try out approaches above. You can always use "GiveUpSecurityAndAcceptAnyTlsHostCertificate" or "GiveUpSecurityAndAcceptAnySshHostKey".

Creating a ftp upload client

Creating a ftp client is relatively easy. I got it working with the following code snippet.  The problem i had was with parsing the url with filename before i can upload a file. Tricky...

Getting result from HttpResponseMessage

The fastest way to get json out of a HttpClient's GetAsync method is shown in code below :- var result = await response . Content . ReadAsStringAsync ();

Error : Cannot find type [Microsoft.SqlServer.Management.Smo.RelocateFile]:

Image
 I have multiple version of Microsoft.SqlServer.Management.So installed, from version 10.0, 11.0, 12.0 and 13.0. Tried adding the following text on top of my script [System.Reflection.Assembly] ::LoadWithPartialName ( "Microsoft.SqlServer.SmoExtended, Version=13.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" ) | Out-Null [System.Reflection.Assembly] ::LoadWithPartialName ( "Microsoft.SqlServer.SmoExtended, Version=13.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" ) | Out-Null And same error. Wow! Until i bump into this site  and made the following change. Powershell runs as expected. Sweet! If your path points to version 12, please change it and points to version 13 as shown above.

facebook field guide to machine learning series.

https://research.fb.com/the-facebook-field-guide-to-machine-learning-video-series/

Sitecore controller rendering simple example

Image
I think the trick to go about setting up a project for this are : a) Add reference to Sitecore.kernel and Sitecore.Mvc manually b) Create a blank project and as you add "Empty Controller", the required folders will be added for you c) Manually copy .dll to your Sitecore 9 project. Creating your controller code base  Create your controller just like how you would do it for asp.net, which means you create controller, model and view. Model  Controller  View Integrating it to the code layout in sitecore - all you need is @Html.Sitecore().Rendering

Failed to start service 'Sitecore XConnect Search Indexer - xp0.xconnect-IndexWorker

 I bump into this error earlier and for the longest time trying to figure out why this is happening. After can't get it to start .... i restarted my computer and ran the installation until it crashed and get this beautiful message. Then i edited my script to force it to continue......... Same scripts just small change. Please have a look at Line 49. Re-execute the same script again. Good luck. You might have to restart your computer a couple of times in case SOLR don't like you so much.

Sitecore rocks - unable connect to server in visual studio

After installing sitecore rocks 2.1,  still have problem connect to my local sitecore.  This is really puzzling. Turn out, there is an issue with user permission (although i ran my Visual Studio community in Administrator mode). Edit web.config and change to the following configuration.

Installing Local Development of SiteCore 9 - step by step.

Pre-requisite (version must match otherwise good luck :)  Powershell 5.0 Webdeploy 5.0 Site core main files Download and extract sitecore 9.0 files from here .) Extract this file and then (XP0 Configuration files rev.171002.zip) -this will get some json files extracted. Using powershell prompt running in Administrator mode, execute the following command :- Install-Module SitecoreInstallFramework Import-Module SitecoreInstallFramework  solr solr_6.6.2 (must match) nssm - to install solr as windows service (must) - install using chocolatey Please ensure you setup your JAVA_HOME otherwise, running it as a Window Service, otherwise you will get error. Sql server 2016 - you must have this version installed. Sitecore will not install successfully if you don't In case your script fails half way 1. Restart your solr window service 2. Delete databases the script created example xp0_Processing.Pools, xp0.ReferenceData Then re-run the script. Modify your

Predicting value from using keras mnist sample data

In this example, we use Keras to do a simple prediction. Here is the code for doing it. x_train[0]  has the value 8 and the prediction shows column 8 gives the highest probability.

simple keras classification model

The following keras script demonstrate a simple classification problem using neural network. The  neural network is made up of 3 layers and the key here is using sgd as it optimizer. The following code also give a pretty good classification sample based on the same data set. 

migrating asp.net core 1.0 to 2.0

Image
To migrate, you need code change Code change Net Core 1.0             var host = new WebHostBuilder()                 .UseKestrel()                 .UseContentRoot(Directory.GetCurrentDirectory())                 .UseStartup ().UseUrls("http://localhost:5050")                 .UseApplicationInsights()                 .Build();                         host.Run(); Net Core 2.0          BuildWebHost(args).Run();         public static IWebHost BuildWebHost(string[] args)        => WebHost.CreateDefaultBuilder(args).CaptureStartupErrors(true)          .UseStartup ()          .Build(); Nuget packages update  We need to upgrade all the nuget packages - which include Application.Insights, Microsoft.AspNetCore and EntityFramework.  Window Hosting Bundle Install Windows Hosting Bundle 2.0 and above. Potential Error that you might see are :- Method not found: 'System.IServiceProvider Microsoft.Extensions.DependencyInje

Deep RL lectures

https://sites.google.com/view/deep-rl-bootcamp/lectures