Posts

rosyln : How to provide a nicely formatted code comment

The following codes did provide a nicely formatted comments :- // Calling codes from CodeFixer  // 

Rosyln : How to create VariableDeclaratorSyntax and SeparatedSyntaxList?

You often worked with these those objects in Roslyn. Here's how to work with some of these data constructor.

Git command to revert all current changes

This probably one of the best command for me to use this week, reset all  changes in my current branch # Revert changes to modified files. git reset --hard # Remove all untracked files and directories. (`-f` is `force`, `-d` is `remove directories`) git clean -fd

Code splitting with React - suspense

React supports code splitting by default now using Suspense as shown in the following code snippet. Awesome stuff import React , { lazy , Suspense } from 'react' ; const OtherComponent = lazy (() => import ( './OtherComponent' )); function MyComponent () { return ( < Suspense fallback ={ Loading...</ div >}> < OtherComponent /> </ Suspense > ); }  

Roslyn and syntax visualizer

Image
One of the best way to navigate and get your bearings right trying to figure out how to parse your code is with Syntax visualizer. It can be found from View->Other Windows -> Syntax Visualizer and you're good to go. On your left (black screen) is your code and on the top right, is your parsed tree. Values for each of the screen are indicated in the property screen.

cli to generate all your ngrx store / effects / etc

Here is a link that provides easy way to work with ngrx in your Angular App. https://github.com/ngrx/platform/tree/master/docs/schematics

c# the power of pattern matching and code simplication

Consider the following code :- And then with the power of pattern matching, it gets simplified into :- Walla!!

.Netcore adding ruleset for your code analysis project

Image
VS2017 might not support ruletset from the UI. But you can change that by copying your RuletSet and refererncing it from your project :- So what I've done is I added   C3.ruleset In our project and then you can see how it gets reflected in the project. You can even click on the RuleSet and make some modifications. Play around wit the filtering and whalla ..... Have fun! :)

Rosyln - adding analyzer into your .Netcore project

What if you wanna add Roslyn into your .Net Project? Ansnwer -  You can add the following into your .Net core project (exactly what you would do in my previous post ) :-      

Enabling Roslyn code analysis in your project

Image
Let's say you have created your code analysis pack from Roslyn. How do you turn it on your project? Just right click, on your project and select "Add Anaylzer".  Choose your code analyzer, in  your project (you can distribute it as part of your project as nuget). Doing this is similar to adding a piece of code as shown below in your project. Well all you need to do is edit csproj files, add this in and reload :-       That's it and you will start to see alot of squirly text in your project, depending on what you're trying to do.

rosyln build

Finally was able to work on Roslyn, compiler sdk framework. You don't need to but to build Roslyn you just need to clone it on github and then run the following commands in sequence :- a) Restore.cmd b) Build.cmd c) Test.cmd

collection of awesome streaming algorithms material

I got this from a gist and don't want to miss out on this :-

Cannot find module '@angular-devkit/core'

I was trying to run  ng g app myApp and hit this error message :- The solution is to run the following command. Please note that this happens regardless of what angular/cli version you're using from 1.6.x to 6.x.x  npm i -D @angular-devkit/core

powershell : Testing if port or computer is up

Found out a quick and dirty way to test if a computer is up is using the following script :- Notice that i am using Test-NetConnection which is readily available in Powershell.

Powershell : Invoke variable as a command

When writting powershell script, you often need to run parse your command string and then run it as any regular command. Here is how you do it, using Invoke-Expression. $portConfig = "$($port):1433" $cmd = "docker run -d -p $portConfig -v $MOUNTPATH/:$CONTAINER_MOUNTPATH/ $DOCKER_IMAGE_NAME" Invoke-Expression $cmd

react smart vs presentation component

React presentation component :- React smart component

Powershell - Invoke-sqlcmd to connect to a mssql server using different port

You might be able to use the following code to connect to an instance of sql server on a different port. Here 's how you can do it.

WebVr on Ghrome

Image
To get activate your webvr api on Chrome, please ensure you're running Chrome version 68 and  above. Please ensure you enable your WebVR option as shown below :- Please download WebVR API Emulation plug-in. Please goto https://webvr.info/samples/ and run some of the examples there.

windows - upgrading nodejs

Ok, not really sure why or how i missed this but the best way to upgrade nodejs without using an installer on windows is to : Just run the code below :- Set - ExecutionPolicy Unrestricted - Scope CurrentUser - Force npm install - g npm - windows - upgrade npm - windows - upgrade

mssql restore using tsql

To restore your Mssql BAK database, you need to use the restore command and often you need to move your mdf / ldf files to folders. How do you find out what's the mdf/ldf files in a .Bak file?