Welcome...



...All those moments will be lost in time, like tears in rain....

- soliloquy from Blade Runner


Bits and bytes do get lost, awash in the rain of data flow that is Internet. They slip away from us, never to found again... some of them will be captured here, many more will not... like tears in rain...



Friday, May 1, 2015

Removing item from dictionary in C#

  There is a method aptly named Remove:

  public bool Remove
  (
 TKey key
  )

  dict.Remove(keyId)

 It will not raise the exception if key does not exist -  handy!

  If you do want to check existence of the key anyways, it will return false if it  is unable to find a key (or unable to remove it for some other odd reason).

Thursday, April 30, 2015

Another framework

 There is a framework called Vanilla-JS. No, there is NOT :) It's a joke people!

 http://vanilla-js.com/

Sql Server user and login problem

 I run into the issue of having user and login disconnect in my local database. What happened was that I restored database from testing server, and that disconnected user and login. They both existed in database, but user was of type SQL Server user WITHOUT Login, even if that login right there.
 After lots of searching, solution that works was - DROP THE USER and Recreate User. That will give you chance to relink them (SID update) and it works. All other solutions just didn't work - I couldn't find any orphaned users, I couldn't do Alter user...
 Just recreate the user :)

Monday, December 8, 2014

When Google fails

 10 years ago, I wrote Windows Service, and I do remember I had to use instalutil.exe to install the thing and that was a pain in the neck to install it, figure out what was wrong, deinstall it and go again... I remember having a batch file to do all this.
 Turns out that there is a trick to do it easily - you use windows console app instead of windows service, and check in Main is this Environment.UserInteractive or not. That way you can attach to the process to debug it and iron out all the issues, and still have your windows service when deployed. In other words, have your cake and eat it.
 And why Google failure? You can not  search for this trick until you know it is possible. Many many people use installutil and forums and StackOverflow are full of answers to that, but to find out console app masquerading as service, you have to know about it, then you will find couple of nice blogs where this is explained.
 So back to Stanislaw Lem story - to ask proper question, you have to know most of the answer already.

Order of sections in configuration files matters

 Looks like order of sections in web.config (or app.config for that matter) matters - you can not have appSettings before configuration section, or it ConfigurationManager will not read it.

Tuesday, November 11, 2014

Fiddle, fiddler on the roof

Fiddles are scaled down environment accessible via web, used to testing, demonstration, or just to share snippets. They usually have a window split for code, markup, output... Very handy.

I've used JSFiddle a lot since it allows you to add easily many popular frameworks, like jQuery, KnockoutJS, Prototype, AngularJS and even allow you to specify how you will run your code (onReady, onLoad...).


 http://www.jsfiddle.net

It has echo API to simulate API calls.

 Then there is Plunker - it's grown up sibling. It has link to GitHub and ability to split code into multiple files. I really liked it, and my only issue is that they succumbed to Web 2.0 fad and named the site by skipping vowels, making me mistype the site name _every_single_time.

http://plnkr.co/

 But beside that unfortunate name, it's really useful tool, good for fast prototyping.

And last one I've found is SQL Fiddle:

http://www.sqlfiddle.com/


It has a list of supported databases (mySQL, SQL Server, Oracle and Postgress) that you can target. In one pane, you can create your db schema, in second pane, you can run your queries.

It supports OpenId login and accepts donations, although I couldn't find a link for donating. Looks like site is work in progress still.