June 22, 2011

Scoping the search result in Firefox

Filed under: internet Himanshu @ 3:31 pm

Do you know, in Firefox 5 it’s possible to scope the search results. For example if you suffix or prefix search text with *, results will be only from bookmarks! That’s helpful, isn’t it. And there are more such special characters that can be used to scope the search result.  More over that, combination of multiple such character is possible as well, that’s more helpful! See details here.

June 2, 2011

JavaScript, and var

Filed under: javascript — Tags: , Himanshu @ 2:16 pm

While working in my current project, I re-learned this hard way.  And I don’t want to make same mistake again, hence noting it here. Many a times you remember something better when noted somewhere.

I had created a javascript that was similar as below:

function Type1(){
    _type = "type1";
    this.show = function() { alert(_type); }
}

function Type2(){
    _type = "type2";
    this.show = function() { alert(_type); }
}

o1 = new Type1();
o2 = new Type2();

o1.show();
o2.show();

And me being ignorant about what I have written, was expecting to see two alerts once with “type1” and another with “type2”.

Case that I had was more complex , hence I took more time to understand the problem, and then note that I haven’t have “var”! The code should be as:

function Type1(){
    var _type = "type1";
    this.show = function() { alert(_type); }
}

function Type2(){
    var _type = "type2";
    this.show = function() { alert(_type); }
}

o1 = new Type1();
o2 = new Type2();

o1.show();
o2.show();

Note and Remember, “var” defines the scope of variable as local!

Separate domain and Runas

Filed under: networking,windows plateform Himanshu @ 1:45 pm

Have you ever wonder how can you run a specific application having awareness of different domain’s credentials? We have VPN setup between our different offices, and all offices are having complete separate windows domain tree. I’m in Pune office, that is having domain, which has not direct relation to our US office (e.g. it’s not welcomed in networking terms) – and believe me there is a good reason to be it that way.

While being in Pune, I needed to run an application on my machine (that is in Pune domain), with is aware that I also have valid credentials in our US office. And Runas worked well in that case as well. Runas.exe can be found in %WINDIR%\System32, checkout its short help by: %windir%\system32\runas.exe /? on command prompt.

I had used it as %WINDIR%\System32\runas.exe /netonly /user:<my US domain name>\<my username in US domain name> “<path to the application that should run within that credentials>”

Powered by WordPress