Posts

Showing posts from April, 2013

Never use defaults for any program

We had an MS build problem, which we fixed by specifying parameters explicitly: msbuild "MySolution.sln" /t:Rebuild /property:WarningLevel=0 /p:Configuration=Release /p:AllowUnsafeBlocks=true /p:Platform="Any CPU"

Fixing a problem in a dll for which you do not have source code

When you somehow want to fix a business need and there is no way out, you may have to resort to this method. I have a few links here which will be of use in that case because I had to do this recently: http://social.msdn.microsoft.com/Forums/en-US/msbuild/thread/05b3cf5d-ead3-4274-88f5-6e8cbda8e8d8/ An intriguing thing I found out that looks like valid C# gets converted into IL and gets decompiled - but when you get the source code like this, it may not compile properly, because apparently, the C# compiler does not  like many things in this decompiled code which probably is optimized out of the IL. So, you need to look at each case and work around it. You may have to use keywords like unchecked, new, etc. In some cases, you may have to explicitly cast objects (see how the code is in the decompiler and then figure out that it needs to be cast to X or Y class). If you deal with this dll being a wrapper around C++ dlls which are called from within them, the following links wil...

Handling Time Zone differences when sending dates to javascript and reading back over AJAX

First convert to string: string dateValue = lastRow.PublishDate.Value.ToLongDateString();                 string timeValue = lastRow.PublishDate.Value.ToLongTimeString(); Pass to javascript like this: String.Format("javascript:fnDoWork(new Date('{0} {1}'));",                                                                                                            dateValue,                                                                                       ...

Caching gotcha in azure

If you access a web role from different URLs do not expect the role to be able to read the cache OR the session if it was set by calling a method from a different URL/ server name even if it points to the same thing. Weird. For session I can understand - can't figure out why it does not work for memory in a dedicated cache role though. [Update] I was wrong, not working with cache because there was a condition checking for session before setting the cache value. So cache value never got set. Makes sense now.

Skip running startup tasks on Azure Emulator

http://blog.smarx.com/posts/skipping-windows-azure-startup-tasks-when-running-in-the-emulator

How to work with MemoryStream and Azure Blob Storage

http://chopapp.com/#bvgehltw The thing to remember here is that before you read the memory stream to deserialize the object, move to position 0 (front of stream). The serializer code is here: http://chopapp.com/#g8nxwk6t