Posts

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.msc". 

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 CommandAPIDescriptionUSER, PASSCredentialsLogin with username & passwordQUITDisconnect()DisconnectPASV, EPSV, EPRTDataConnectionTypePassive & Active FTP modesFEATHasFeature()Get the features supported by serverSYSTGetSystem()Get the server system typeOPTS UTF8 ONEncodingEnables UTF-8 filenamesOPTS UTF8 OFFEncoding, DisableUTF8()Disables UTF-8 filenamesAUTH TLSEncryptionModeSwitch to TLS/FTPSPBSZ, PROTEncryptionMode and
DataConnectionEncryptionConfigure TLS/FTPS connectionCCCPlainTextEncryptionSwitch to plaintext FTPPRETAutomaticPre-transfer file informationTYPE AUploadDataType and
DownloadDataTypeTransfer data in ASCIITYPE …

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.