June 27, 2012

Installing ASP.NET MVC 3 and Web Platform Installer

Filed under: asp.net — Tags: , , , Himanshu @ 12:01 am

I had a problem in using the Visual Studio Install that I had in my machine, due to which I decided to re-install everything related to Visual Studio , including Visual Studio itself.  During installation procedure, I reached to the point when I was ready with base Visual Studio 2010 installed, and next step was to update system with bunch of other frameworks and patches that included ASP.NET MVC 3, Visual Studio 2010 SP1, and some other. It was making sense to me to install all together with Web Platform installer. Added everything that I wanted to install in Web Platform installer and asked it to install. It happily declared everything done. But when I tried opening the project solution, Visual Studio complaint about missing ASP.NET MVC 3.

On further investigation about why and what, surprise! ASP.NET MVC 3 actually was missing on the system! Web Platform installer was fooling me when it said “Completed everything”. Finally I found that due to Latest NuGet install on my machine, installer for MVC 3, was not able to successfully install.

Leaky Abstraction!

June 12, 2012

Transistors are also De-amplifier

Filed under: electronics — Tags: , , , Himanshu @ 1:08 pm

I’m enjoying my exploration of electronics. While understanding about different building blocks, I learnt about Transistor. And I also learnt that transistors are also called amplifiers. During learning about their amplification capability, I also realized that they are certainly amplifier but they don’t generate electricity from air (unfortunately!). They need two input voltage one at Base and another at Collector. When Base is positively charged – low voltage applied to it, they allow higher voltage applied at Collector to pass towards Emitter, and that’s how they are called amplifier.

Me being fresher in electronics, I recommend other fresher to also note that if you see through transistors from Base to Emitter they are certainly amplifiers, but if you see through Collector to Emitter, they are de-amplifiers as they don’t generate electricity from air.

June 7, 2012

SessionStorage on Safari

Filed under: html5 — Tags: , , , , Himanshu @ 10:23 am

Like everything in life has quota, Safari allots specific size to each applications that it can consume to store information in session storage. If consumption exceeds, while calling setItem it throws QUOTA error.  While creating one HTML5 based application for one of the client. I found that Safari that comes on iPad 1 built on top of AppleWebKit 531.21.10 has two reason to throw this error. First like I said on exceeding the limit and another on when an key already exists. To workaround the second case, have to write our own function that first removes item using removeItem and then SetItem

July 20, 2011

Word documents and merging two branches

Filed under: ms office — Tags: , Himanshu @ 11:46 pm

Do you create word documents? Do you send them for review to your boss? I think, answers of both of these questions will be “yes” for most people, and I’m not exception! MS Word have a good feature – Track Changes. As it’s name suggests, it  tracks the changes while document is being edited, and can show final (edited version) of the document or can show final document with highlighting changes . While changes are highlighted, they are easy to notice and can also navigation across changes easily.

But, if your boss forgot to start the change tracking, then? Well, not to worry, word can do merging of two different branches like a version control. Steps:

  1. Very important! Make sure you are having extra copy (backup) of both the documents (your copy and boss’s copy). Just in case we create mess in the process, you don’t loose your valuable information in these documents.
  2. After making sure both documents (e.g. “My Copy” and “Boss’s Copy”) are closed, open “Boss’s Copy” document in MS Word.
  3. Invoke “Save as“ operation and try and save it over “My Copy” of the document. (Notice already open document name and Save as name in the image)
  4. Word should prompt you for different available option, having one of them to be “Merge changes into existing files” (for example, as  depicted in image), select it and continue with “Save as” operation.

In the result of above, “My Copy” document will be updated as if Boss have changed the document while having “Change Track” on.

SaveAs-And-Overwrite-Me

July 5, 2011

WaitHandles’ Switch

Filed under: .net,multi-threading Himanshu @ 3:57 pm

I will say it again: “I like extension methods”. They provide great way of increase readability of the code in languages like C#.

Anyway this post is not about extension method. Have you ever needed to write code that will wait on different wait handles (WaitHandle) and execute different piece of code depending up on which handle is signaled. Here is one way to implement that:

public static void WaitSwitch(this WaitHandle[] waitHandles, params Action[] actions)
  
{
  
    waitHandles.DoEmptyOrNullArgCheck("waitHandles");
  
    actions.DoEmptyOrNullArgCheck("waitHandles");
  
    if (waitHandles.Length != actions.Length)
  
        throw new ArgumentException("length of wait handles and actions has to be same");
  
    var triggerIndex = WaitHandle.WaitAny(waitHandles);
  
    actions[triggerIndex]();
  
}
  

And then client code will become as:

(new[] { shutdownTriggeredEvent, updateAvailableEvent }).WaitSwitch(
  
    () => isShutdownRequested = true,
  
    DownloadNextUpdate
  
);
  

July 1, 2011

HTTP 404 while asp.net web forms and spring.net project

Filed under: asp.net,spring.net Himanshu @ 3:32 pm

While doing some refactoring with the project, I suddenly start getting HTTP 404, and that to for all pages that exists and was working few minutes back. I was amused to get the error, with the fact that pages existed, I could see them and feel them! After a while, I noticed that I have deleted a existing .aspx file from project which I forgot to remove from spring.net configuration file.

If you add any .aspx in Spring.Net config that do not exists, Spring.NET brings you to yellow screen with appropriate message. But not when you delete one from project and forget to remove from config file! At least not all the time.

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

January 21, 2011

Upgrading XP by SP3 on Laptop

Filed under: windows plateform Himanshu @ 7:34 pm

I was trying to apply Windows XP SP3 through windows auto updates.  Auto update repeatedly reported that it couldn’t apply SP3 update. After digging further, I found that update was failing because laptop was not on AC supply.

Two points to note:

  1. On laptop, shouldn’t apply windows update while battery powered
  2. Interesting to understand that either xp auto update do not have way to report correct problem and instead just say “Could not apply following updates”, or maybe SP3 installer is not rightly coded for auto update.
« Newer PostsOlder Posts »

Powered by WordPress