Posts

Starting a Thread targeting method with parameters

Lets say you want to start a thread. How would you do it? Thread  T1 =  new   Thread ( new   ParameterizedThreadStart (SomeMethodName)); Restriction imposed by .NET is that Method which T1 targets can have only one parameter of object type. Hence, above code will work only if method signature is: public   static   void  SomeMethodName( object  o) But what if I want to invoke a method like: public   static   void  xyz ( int  a,  int  b) ??? Answer is to use delegates here and start thread as: Thread  T3 =  new   Thread ( delegate () { xyz(3, 4); }); or Thread  T3 =  new   Thread (() => xyz(3, 4));

The following module was built either with optimizations enabled or without debug information Visual Studio

Image
If you are facing this issue for long you must be on verge of banging your head or throw away your PC. There are many cause for this error. You might have tried options and may have missed a few. Following is a summary of different things that have helped me in resolving this issue (Hope it helps you out too): 1. In your Visual Studio, Go to Tools>Options>Debugging>General and check "Enable just my code as shown below" 2. If your application is configured to run using a IIS URL instead of dynamic localhost port, just ensure that IIS directory is pointing to your directory. Often while testing we make different copies of application and keep pointing application in IIS to one or the other. This actually resolved my issue. 3. Clean your solution, close VS, open again, rebuild application and try 4.Open properties of your project and ensure configuration as below: 5. Continuing from above, press advance button in Build settings below which opens a popup. Ensure, Debug I...

Delete network credential from IE

If you have mistakenly opted for "remember password" while opening sharepoint site (or any other site which opens a popup up for network credentials), then forcing IE to again start prompting for credentials is a pain unless you know the right think to do. Everywhere you will get replies to delete cookies and other files by going into IE8>Settings>Content>AutoComplete>Delete Files. But this doesn't works for network credentials as they actually get stored by windows. Instead do following: STEPS (applies to windows 7) 1. Click on start button 2. Type passwords and select Manage network passwords option from filtered list.      You will find saved URLs and passwords of saved credentials 3. Select Delete option for the saved credential you want to remove

disabling Page Cache

1. Create a new .cs file "MyHttpModule.cs"      public   class MyHttpModule :  IHttpModule     {          public   void  Dispose()         {                      }          public   void  Init( HttpApplication  context)         {            context.PostRequestHandlerExecute += new   EventHandler (context_PostRequestHandlerExecute);         }          public   void  context_PostRequestHandlerExecute( object  sender,  EventArgs  e)         {  ...

Latest Javascript framework tags

Image
Get latest javascript framework links from http://scriptsrc.net/

SocialAuth.NET - OAuth with Facebook, Yahoo, Google, Twitter & more

Image
So last time when you visited your favourite site, you were pleased to see that it allowed login through facebook also besides direct registration . This is such a convenient functionality as user tend to be lazy to fill in registration forms and then wait for email with activation link. If you are looking for implementing similar functionality in your application then you can simply use "Facebook Button" from Facebook. But what if you want to implement authentication with Yahoo, Google and MSN as well? Well there is an out of the blue easy solution to achieve it! Meet SocialAuth.NET. SocialAuth.NET is a .NET class library that can be used to implement authentication with Facebook, Yahoo, Google and MSN. Using this library is so easy, that even if you are aware of writing simple application with ASP.NET, you can easily use this library. This library provides following features: - Authentication with Yahoo, Google, Facebook, MSN, Twitter, LinkedIn, MySpace - Retrieval of user...

Connect with 32bit DSN from 64bit .NET

Recently I ran into a trouble. I was using a specific database which supported only 32bit ODBC connections. However my machine was 64bit Win7. If I connected to my 32bit DSN from Excel, I could get the data but from Visual Studio I received error :" There is an architectural mismatch". The reason was that by default my .NET communicated with 64bit driver. To force it to use, I changed my project Platform target from "ANY CPU" to "x86".. and it worked!! :)