Posts

Using rakt on docker

Image
This is a bit confusing but i am running on windows, so this is me trying to try out rocketd contianer.
You can run docker images using rocket but that's another story.

Anyways to get started, you need to use docker to install fedora (and some other Linux distribution - ubuntu is not one of them) and install rocketd container.

dnf install rkt 76 M - that's not too bad.

To experiment it, try running a redis docker image on rocketd container.

rkt --insecure-options=image run docker://redis



Some useful command are :

rkt image list

rkt list --full - list currently running pods

rkt status

rkt enter (allows me to enter into the pods shell for exploration activities - kinda list this)

rkt fly (nobody know what this does - LOL )










git updated last commit message

If you're trying to modify git messages, then the following command comes in handy :-


git commit --amend -m "new comment message" Forces a push to  remote branch
git push --force




netcore - specifying specific assembly version to use

In Netcore you typically use PackageReference order to force a specific version of dll to be used by your project.


It might look like configuration below :-







Roslyn analyzer - Getting Could not load file or assembly … An attempt was made to load a program with an incorrect format

Bump into this issue while trying to deploy my analyzer to Visual Studio projects and i was wondering what is going on. I guess this is a problem happens across all project. My Visual Studio is running x86 while my build target x64.



D'oh... i know right. :)

The solution?

Right click on your project -> Build -> Platform Target ->  Any CPU

That's it! :)



vs2017 - getting code coverage analysis

Image
You can get lost in a 'sea of code' when it comes to writing unit test. You can be effective, if you know which code gets covered. To get this statistic, goto Test -> Analyze Code Coverage -> All Test




You should get a Code Coverage Results tab that lets you choose which code to target, drill down and write up your test cases.


js :- replacing require() with es6 import

Been working on this for quite some time, finally was able to pen this down. How do you replace 'require(some-library-file)' construct with import.


Say you have older javascript module that looks like this :-


// test.js functionHello(name) { console.log('hello' + name) }
module.exports = Hello;


Then we can import this as shown in code below :-

// main.js import*asMyHello from'./test'; import*asmfrom'mongodb'; vargreeting = MyHello('test');

The output you will be getting is : hellotest

Getting started with storybook

Imagine codepen.io, jsfiddle and now imagine you have that in your local development machine. Yeap that's pretty much what's storybook is all about. It gives you a playground to work with React, Vue, Html and etc and its pretty cool.


Get started with html,

npx -p @storybook/cli sb init --type html If you need to get stared with React, you can follow this guide here
I think the add-on gallery is pretty cool.

Some add-on ideas.

- Preview for mobile and responsive component. Not forgetting React Native support.

- See component loading and profiling loads

- Convert to actual react component -> Typescript, JS  and also with smart / dumb component features.




.netcore - (for all .net version i suppose) getting 'TestMethodAttribute' could not be found

After i create my ms test unit project, i am getting this error. I think this happens whenever you have new package references.

"'TestMethodAttribute' could not be found"

Ms Unit test project, just fail to build. So i found out that even "dotnet restore" is not working. This is due to my nuget configuration which errored and is not valid locally. So i remove it and i was able to build successfully.



sourcetree - squashing commits.

Image
First up, you gotta be 'connected/tracked/commited' intial changes to your git repo before starting.

To do squashing using sourceree, try right clicking your commit graph and then select 'rebase interactively'.




Then drag a commit over to another commit, as shown in diagram below :-






Once you're done, change your commit message accordingly and then you're good to push those changes remotely.


ms build target file - what is the purpose again?

Suppose you wanna introduce a environment build variable, you need to go through all your csproj to make modifications. With targets, you can define in a single file and it gets 'recognized' by all other csproj files.


Compilation issue "SkipNonExistentTargets"

After installing .net 2.1.0 core framework, I have this issue.

All you need to do is right click your project -> Properties -> Uncheck generate package.

Or update your VS 2017's update to the latest version.


cool nuget install cli - quick and fast way to get data

One of the cool way  to use nuget cli is "nuget get" -how many get you going to type. :)

Anyways, it gives a quick way to get some assemblies into your current folder. Not packages but current. For example, if you  run :-


nuget install System.Collections.Immutable -Version 1.3.1


You get a "System.Collections.Immutable -Version 1.3.1" folder created for you.

Msbuid : CSC : warning CS8032: An instance of analyzer be created. Could not load file or assembly 'Microsoft.CodeAnalysis, Version

I was creating analyzer for .net core project and bump into this error when i tried to use MSBuild to do my builds. No problem when i do "dotnet build".

Anyways, a workaround for this issue is to install this package into your target project. I am using 2.6.1 but other version might work for you. This also resolve messages coming from VStudio.

Install-Package Microsoft.Net.Compilers -Version 2.6.1

Roslyn - Packaging your analyzer

Update :
If you find yourself doing this, you are probably not using Extensibility template (Analyzer + VSix solution). In that case, please take some time before you go down this "rabbit hole".




There are 2 ways you can package your anaylzer as nuget package. I am assuming you are trying to deploy this as .Net standard. I specifically target Net 1.3 standard.

Analyzers are packaged differently, as we are required to place it under, \analyzer\dotnet\cs folder. 


1. csproj - you need to add this in your solution file.

(Notice i change my packagePath="" = empty string, if you deploy to .netcore project, it is all good. If you try to deploy to .net framework, you might not be able to install it.






And not forgetting - this basically omit generation of dll. If you don't do this, your analyzer will be installed as any dll package instead of anaylzer.



2. nuget (will cover this later, till then try reading it from https://roslyn-analyzers.readthedocs.io/en/latest/nuget-p…