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



Wednesday, March 20, 2013

Voyager 1 left Solar system for good...

 Looks like it's official now - Voyager 1 crossed the edge of Solar system! For somebody who still remembers Carl Sagan's "Cosmos" that's exciting news. I wonder how long it will keep sending...
Go Voyager Go!

Wednesday, March 6, 2013

This and that in JavaScript

 This and that in JavaScript - or self as I've seen it, is just a workaround for the fact that in JavaScript, inner function "this" is not behaving like "this" from the outer function, it points to the window object.. Yes, it's a bug, and it will be fixed in ECMA5.

To preserve outer function "this", putting "this" into local variable ("that" or "self") will allow transfer of variable from outer function to be used, by using closures.

Closure mechanism - an inner function always has access to the vars and parameters of its outer function, even after the outer function has returned.

Something like this:

<!DOCTYPE html><html lang="en">
<head></head>
<body>
<script>
 var myObject = 
{
  myProperty:'Some text here'
  myMethod:function() 
  {
   var that = this; //reference to myObject in myMethod scope 
   var innerFunction function() { // inner one
           console.log(that.myProperty); //logs 'Some text here'
           console.log(this); // logs window object to show what will happen if we don't store this into that
        }();
    }
}
myObject.myMethod(); // invoke myMethod

</script>
</body>
</html>

Debugging client side script

I was trying to debug client side code and was getting those "Breakpoint will not be hit" messages. Turn out that to allow debugging of the client side script, you need to Attach debugger to the process but before you actually do that,  click Select button on the top of the list of processes. If it on automatic, change it to Script.
 That functionality goes back to Visual Studio 2008 and it's still there in VS 2012.
 There are other ways too - debugger; in javascript code, or using Client debugging in IE or Firefox (or Chrome), but it's nice not to have to do anything extra but use VS when you want to attach to the process anyways.

Friday, February 8, 2013

ViewState and debuger

ViewState object is not great for debugging. Expanding it's properties at the run time will yield nothing useful unless you know what are you looking for.
Add this to Watches to get insight into collection of values stored in internal dictionary:

new System.Collections.Hashtable(ViewState)

Thursday, January 24, 2013

Hyphens, dash - dash, hyphens!


As a non native English speaker, I am happy when I am able to unravel another mystery from the language :) In this case, 3 different "dash" signs in the written English :)

-            hyphen
–           n-dash
 (also known as ndash or en-dash)
—         m-dash
 (also known as mdash or em-dash)

Hyphen is what we are using when words wrap at the end of a line. Other use is for the phone numbers, things that are grouped together, but not by range.

n-dash is used for ranges, either words or numbers.

m-dash is used when the sentence is going into another direction and other part of the sentence is radially different. Also, it can be used when dialog is being interrupted.

 How I got here? Html entities and correct display of those on the web page...

Here they are:

Hyphen(s): 

 0. The soft hyphen (&#173; a.k.a. “discretionary hyphen” and “optional hyphen”) is to be used for one purpose only—to indicate where a word may be broken at the end of a line.
 1. The non-breaking hyphen (&#8209; not in HTML) does just what its name implies.
 2. The hyphen character (&#8208; not in HTML) is meant to be used in place of the hyphen-minus when a hyphen is exactly the desired character.
 3. The hyphenation point (&#8231; not in HTML) is that bullet-like character you find in some dictionaries to separate syllables.

The en dash:  (&#8211;)

The em dash: (&#8212;)