Category Archives: Hack

My Karma tests are failing in IE on my Jenkins and I don’t know why

We had a small problem I would like to share today. We have Windows 2012 R2 with Jenkis as one of means to build our stuff (I know, W2012 man… others in our company use different CI systems and there was also some other reason for W2012 R2, but if I had the choice I would definitely pick some newer OS).

Some days ago, our IE tests started to fail. The reason from Jenkis : Timeout. Wait, what? We didn’t changed anything in the build and test process!!! Indeed there were code changes but no one touched the build pipeline.

After short investigation, the reason to this was quite simple (as always) :
It seems like there was some update that changed IE or touched it’s settings and it wanted me to confirm security setting when I ran tests from my account.

Something like this :
ie 11 security settings

OK, let’s suppose that IE timeouted for the same reason on Jenkins job. But Jenkins runs as service, as special privileged Local System Account. How can I run IE like this account?

This link helped :

You need to :

  1. download PsExec from this URL :
  2. execute this command : psexec -s -i “%programfiles%\Internet Explorer\iexplore.exe”
  3. IE will open
  4. make IE happy
  5. close it
  6. never touch it again

The tests should be good again 🙂
Thanks to the author of aforementioned blog for this time saver.

How to run StyleCop as opt-in feature with msbuild from command line

The tool :

So everyone knows wonderful tool from Microsoft, named StyleCop. StyleCop is a tool that runs against C# code (not against IL assemblies – already build code) and based on rules saved either per machine, or per project (we will show us how to save them per project) gives you feedback , if you violated some of these rules. StyleCop started on codeplex (MS take on similar portal like github) and currently moved to GitHub – If you see closely, on GitHub we have two projects :

We will go down the free path and take a look at first option. There are two plugins I will speak about today :

(please note that in StyleCop repo there is a note about recommendation to use Roslyn based StyleCop from repo)

So, you can add NuGet StyleCop.MSBuild package and now running msbuild from command line will trigger analysis. Which is what we want on CI server, but not for builds from Visual Studio. You can try to run build from VS and see what happens.

How to turn off StyleCop.MSBuild for VS builds :

After some search on the interwebz I found out, that there is a property StyleCopEnabled in StyleCop.MSBuild.Targets that is set to true if nothing is specified, which we need to set to false as default. So you need to edit your .csproj (or any other .proj file) and insert


in some PropertyGroup.

This will enable you to do following thing :

  • run msbuild to trigger just plain old build
  • run msbuild  /p:StyleCopEnabled=true to pass parameter to msbuild that will do the analysis after the build.

If you guess that the first will be “used” when building from VS and second to get analysis on your CI server, you are right 🙂

And if you questioned yourself, “why not to pass  /p:StyleCopEnabled=false” from VS build, then AFAIK from VS also in 2017 we cant just pass parameters to msbuild. Shame, I know.

How to filter particular TypeScript errors in build result

Hi interwebz.
I just want to share this short poor man’s fix when migrating TypeScript to filter out some particular errors in TypeScript build.

Why the hell you (might) need it?

So what would be the common use case , why to bother mask/mute errors on build? Compile is the first test our code need to undergo, like first pass of “unit tests”.

Our situation : currently we have a lot of .js files that let’s say most of the time worked and we need to iterate on way to migrate fully from JavaScript only to TypeScript only. So we rename .js to .ts and then we ran into errors like (among others) :

  1. error TS2365 Operator ‘>=’ cannot be applied to types ‘string’ and ‘number’.
  2. error TS2365 Operator ‘==’ cannot be applied to types ‘string’ and ‘number’.
  3.  error TS2345 Argument of type ‘number’ is not assignable to parameter of type ‘string’.

Yes indeed these are against the “logic” of TypeScript – bring types to JavaScript. But I know I want it there for some short timespan. Just to test. I don’t want to wade through 1500 same errors I know I will have to fix, but among them TypeScript also tells me big and real problems, but buried under many same errors about types.

We are not alone in this, more ppl write about it here :

and also here

Solution :

So the solutions vary from custom branch of TypeScript as such to stupid grep on the command line output. And since I am on Windows 10 (my dev box) , I chose to stick with PowerShell so this is snippet that should do the job.

Lets say we want to mute TS2365 and TS2345 errors and your TS build gulp task has name someTSBuildTaskName.

PS script – output to some file :

node .\node_modules\gulp\bin\gulp.js someTSBuildTaskName --color | Select-String -NotMatch "TS2365" | Select-String -NotMatch "TS2345" | Out-File "grepts.txt"

PS script – output just to console (just drop the last part after pipe) :

node .\node_modules\gulp\bin\gulp.js someTSBuildTaskName --color | Select-String -NotMatch "TS2365" | Select-String -NotMatch "TS2345"

PS: I am calling here the gulp task without gulp installed with -g flag (global) so you can just call

gulp someTSBuildTaskName

with globally installed gulp and you are also good to go.

Found any better solution? Pls let us know in comments! 🙂

AD: you can also use this console log parser on Jenkins:

Regular Expression :


Mapping Script :

import hudson.plugins.warnings.parser.Warning

String fileName =
String line =
String category =
String message =

return new Warning(fileName, Integer.parseInt(line), "TS Error", category, message);

and plug this into your build pipeline.

Prečo Vám (možno) nejdú dáta v sieti operátora 4ka

Na Slovensku niekoľko dní späť potešil operátor 4ka svojich zákazníkov 1GB dátovým balíčkom zdarma. Super, poviete si. Vložíte SIM do telefónu, zapnete dáta a : nestane sa nič. Hľadáte problém.

A možno po pár minútach hľadania prídete na to, že váš mobil (teda min. ten môj s Androidom rady 4) nepozná operátora 4ka a teda nemá ani default nastavenia internetu.

Takže chtiac nechtiac, musíte vytvoriť nové. V podstate jediné čo potrebujete urobiť je, vytvoriť nový profil a nastaviť APN (access point name) na “internet” a profil pomenovať a uložiť a nastaviť ako aktívny. Návody ako na to nájdete tu :


How to use NuGet packages even with PowerShell projects with Visual Studio 2015

Most of developers doesn’t use PowerShell on day to day basis, but Microsoft in Visual Studio 2015 made it 1rst class citizen by making PowerShell Tools for Visual Studio 2015 plugin optional on install. (Before that, we had just optional plugin for VS 2013 and VS2012 by same author).

More on this here :

and here

and would all be good, but there is still one downside and that is :

you can’t use NuGet packages in PowerShell projects in VS2015 (at least that is how stuff works on my machine). I am really not sure, if this “feature” was introduced with VS 2015 or with NuGet 3.x, but my project worked with VS 2013 + plugin for VS2013.

On my dev box I get error like this one when trying to right clicking References and Manage NuGet Packages…:

powershell nuget error menu

and like this one using Package Manager Console :

powershell nuget error console

The problem is, that it seems like NuGet doesn’t support .pssproj projects, so however your project contains packages.config it will be ignored and you will not be able to update packages. You will have track what you installed and reinstall same version, but you will not be able to update these. Which is quite shame.

There is currently no simple solution to this but you can do these workarounds :

Solution 1 :

If you have small number of packages, install them by hand from command line with help of command line NuGet.

  • download NuGet.exe from  ,
  • cd to directory where NuGet.exe is (or if you have NuGet.exe in your PATH, you don’t need to cd),
  •  nuget install package_name -o “path_to_packages_folder_or_folder_where_to_store_packages” – which will install latest version of package you want,
  • use the package

You can indeed make a shell script for this. With this solution, the shell script will hold the information about packages you need/want to have installed.

Solution 2 :

If for some reason you want to preserve packages.config file, than you will have to manually update latest versions of packages it contains (since update is not working). Then this file will bear the information about what packages NuGet will install/restore. If this is your way to go, you can follow these steps :

  • download NuGet.exe from  ,
  • cd to directory where NuGet.exe is (or if you have NuGet.exe in your PATH, you don’t need to cd),
  • update the packages.config file with latest version numbers from  ,
  • nuget install “path_to_packages.config\packages.config” -o “path_to_packages_folder_or_folder_where_to_store_packages”,
  • use the package

All these solutions are for for scenarios where you need NuGet packages in Packages folder (inside solution folder).

But what there is another way, if you can install chocolatey on you dev box and if you can find in chocolatey repository the package you need.

Then you can do this :

Solution 3 :

  • install Chocolatey from,
  • run “choco install package_name” (choco should also make sure your new tool will be in PATH),
  • use the package

I would suggest you will make a shell script and automate install of your packages. Again, the file that will hold the information about packages is the shell script.

And if you ask, what is the reason for all this, what NuGet package you might want to use in PowerShell project, my answer is :

Hope this helps,


Using typescript@next nightly package? Don’t rely on –save-dev to be up-to-date!

Just a small update for all you cutting edge TypeScript users.

If you are using typescript@next NPM package as showed here : you may run into the same issue as we did @ work.

If you would install TypeScript nightly as blog says like this (I modified the command, this will install typescript@next package locally and save dependency in devDependencies):

npm install typescript@next --save-dev

you would see something like this in your package.json (please note the date 20150818 suffix)

"devDependencies": {  "typescript": "^1.6.0-dev.20150818"  }

Which is OK, and also

npm update

will work, until TypeScript recently updated to version 1.7.0 which will update you to latest 1.6.0 verions, which is typescript@1.6.0-dev.20150825.

If you would delete the folder with TypeScript in node_modules and also entry in package.json and reinstall typescript@next package, then you would have this entry in package.json (if installed on 1.9.2015) :

"devDependencies": {  "typescript": "^1.7.0-dev.20150901"  }

which will again work until TS updated to 1.8.0. You can try to npm update with this file, you will be updated to latest 1.7.0.

So, what can we do about this? You might try this small “hack” :

"devDependencies": {  "typescript": "next"  }

Happy npm update-ing 😉

How to exclude some files from TypeScript build

If you are using TypeScript nightly (and only with TypeScript 1.6 up) you can use in your tsconfig.json new property exclude which will mostly be used for node_modules like this

(more on this here :


   "compilerOptions": {
   "out": "../../built/local/tsc.js",
   "sourceMap": true
   "exclude": [

More on exclude property here :

How to make CKEditor load just like a frame but show upper command buttons when maximized to fullscreen

Here is my small take on what is needed in lots of apps that have limited real estate on the screen. To load some (in my case CKEditor) editor with hidden chrome, buttons that are either shared for several editors, or each editor has its own set, you name it. There are limitless possibilities of what your client would like to have/see/use.

My sample is loading CKEditor with hidden build in controls and using own buttons. Once in fullscreen the editor will fill the screen and we can also show controls.

Here is the sample repo :

and here you can see directly the result :

Feel free to reuse, enjoy.

Ako zohnať mobilný internet s objemom 11200MB za 7€ na 28 dní na Slovensku bez viazanosti

Nevdojak mi pri hľadaní vhodného internetu do mobilu napadla nasledovná zákerná kombinácia. Možno nieje vhodná pre Vás, je to samozrejme len jedna z možností.

Takže, za predpokladu, že si môžete dovoliť zmeniť číslo na Tesco Mobile ktorú vlastne prevádzuje O2 SK alebo máte 2 SIM mobil, môžeme uvažovať nasledovne (dopredu Vás ale upozorňujem na 60+1 tarfikáciu na všetky čísla, ako hlavná karta pre volania do iných sietí je Tesco nevhodné, každopádne Tesco volania do O2 považuje mimo Tesco sieť no paradoxne za volania z O2 do Tesco zaplatíte ako do vlastnej siete – áno uplatňuje sa 13c za hovor do 60min, potom Vám sieť sama položí – aby Vás chránili pred “náhodným” vytočením čísla vo vrecku napr, že by ste ale platili 13c za min * 60 min = 7,8€ alebo do vyčerpania kreditu pri volaní mimo O2, to ich až tak nepáli 🙂 ) :

Kúpite si Tesco Mobile SIM, spárujete si SIM kartu s tesco club card = volania do Tescso Mobile zadarmo plošne + dôležitejšia časť – 2 násobný kredit, ktorý musíte minúť do 1 mesiaca a nemôžete si kúpiť napr internetový balíček, ale môžete ho použiť na telefonáty, SMS, MMS alebo…. Internet na dnes – 400MB dát na celý deň za 0,5€. (bohužiaľ momentálne si neviete aktitovať internetový balíček 500MB za 5€ z bonusového kreditu, Tesco vám proste vezme z vašich peňazí a bonusového kreditu sa nedotkne, super logické)

And here comes the fun part :
Povedzme, že si dobijete 7€ (aj cez internet, hocijakou platobnou kartou), máte vlastných 7€ + 7€ grátis na mesiac od Tesca. Aktivujete si internet na dnes (žiadna SMS, proste len zapnete dáta na mobile) – na 1 deň teda máte 400MB plnou rýchlosťou (v prípade O2 je to momentálne umelý strop 14,4Mbit/s, umelý preto, lebo 3G má aj nadstavby ktoré O2 nechce použiť/nemá kúpené , whatever – bohužiaľ musím poopraviť toto tvrdenie, podľa cenníka O2 aj Tesco je rýchlosť pri dennom internete len 8Mbit/s) a potom obmedzenie 16kb/s resp. podľa meraní mobilmanie trochu viac. 7€ grátis miniete za 14 dní, vlastných 7€ za druhých 14 dní. Ak nechcete, nemusíte si niektorý deň internet aktivovať, to je na vás. Každopádne hranica je polnoc, večer o 22 sa vám ho aktivovať asi neoplatí (myslím).

Ak teda počítam, že prenesiete 400MB denne, to je povedzme +-8h nonstop sťahovania na plnej rýchlosti, za deň sa 400MB teda preniesť dá, 28*400 = 11200MB = 10,9375GB na 28 dní.

Všetky ceny a podmienky sú aktuálne ku dňu napísania tohto článku, teda 3.1.2014.

Enjoy 😉

PS: asi by bolo vhodné spomenúť nejaké +- takže povedzme že :


  • nieste viazaní,
  • podľa dobitia si sami regulujete koľko netu a na koľko ho budete mať/chcete,
  • môžete si aktivovať net len na deň, keď sa vám to oplatí/hodí (pozor ale na mesačný limit extra kreditu)


  • za predpokladu hromadného použitia to asi sieť O2 dlho nevydrží a prídu regulácie,
  • musíte si kúpiť 2 SIM mobil alebo mať len mobil na net,
  • otravná SMS denne o aktivácii,
  • žena nebudeš poďakovať ak budete večne s mobilom v ruke,
  • dáta nemáte na “1 šup”, ale po 400MB/deň


Tento extra kredit benefit by sa dal chápať/použiť podobne ako benefit v Telekome po dobití Easy, ak si dobijete menej ako 10€ , máte 500MB na 7 dní, ak viac, máte 1GB na 14 dní. V Tescu však máte extra kredit/teda net aj za menej ako 10€.


Môžete použiť aj kombináciu Internet na deň za extra kredit, potom balíček za 5€ s 500MB a potom spomalenie na 30 dní. Získate viac času online. (celkom zaujímavý je fakt, že O2 je ochotné dať na Tescu cenu za 500MB len 5€ ak na svojej vlajkovej Fér ho má za 6€, bizňis no)