March 5, 2013 8:03pm
Correct setup for iCloud in Windows 8 Mail

From the link

youremail@me.com

imap.mail.me.com port 993 With SSL

smtp.mail.com port 587 No SSL

Outgoing requires authentication

Use same username for incoming and outgoing mail.

March 5, 2013 3:03pm
AngularJs currency filter with no $ sign

March 4, 2013 4:18pm
AngularJs, Json.Net, and the $type property

We use the Json.Net serializer in our project and while performing a post that deserializes into a derved class we would also serilization exceptions. We enabled Json.net to emit the $type property so this should be working without problems. Opening up Firebug we quickly realized that the $type property was missing from the request, what gives?

Digging in a bit further it appears that for some reason AngularJs was stripping any property that has a $ sign in the name.  Looking further into the source the problem is in the toJsonReplacer function.

The reason this happens is so Angular doesn’t accidentally post angularjs ($$hashkey for instance) properties to the backend, but in this case we need the $type property to go along so Json.Net remains happy.

This can easily be accomplished by replacing the default transformRequest function on the $httpProvider.

Now Angular is happy and Json.net is happy!

February 26, 2013 4:04pm
AngularJS directive for currency that adds +/- classes to the element

February 6, 2013 3:18pm
Unknown (to me) .net framework gem - TextInfo

A source Description of “REGULAR SAVINGS”

            TextInfo textInfo = new CultureInfo(“en-US”false).TextInfo;

            depositProduct.Description = textInfo.ToTitleCase(share.Description.ToLower());

Using TextInfo
Turns it into “Regular Savings”
.net framework and msdn once again to the rescue.

January 25, 2013 6:57pm
Tug

Tug

January 8, 2013 7:37am
Microsoft Lync wants to use the OC_KeyContainer_emailaddress keychain prompt

I ran into this issue yesterday and after a quick google the answer was found, archived here for my own knowledge.

From the answer:

gnomehole replied on 
March 28, 2012
Fixed my own problem… in case anyone else runs into this.
I removed the keychains from my keychain access app, but even though they did not show there were still physical key files in the folder userid/Library/Keychains
Deleting the OC_KeyContainer files allowed Lync to start back up again and create a new one.

January 4, 2013 1:18pm
Why does VS2012 always check out the sln when opening it?

This explains why whenever anyone opens up a solution they automatically check out the file with no changes.

December 19, 2012 9:26am
Bug Hunt: Always use radix in parseInt()

Is the bug valid?

Yesterday we received a bug report that one of our text fields were defaulting to 00 when the user enters in 08 or 09.  Confused as to what could be causing this I fired up my various browsers and iOS simulator and was not able to duplicate the problem.

The Code

Looking at the code it was something like this:

   1: var num = $(this).val(), //val() would be "08" or "09"
   2:     theInt = parseInt(num);

Nothing seems out of the ordinary and everything is working correctly.  What could possibly be happening?  From there I started spinning up older versions of iOS5 and android.  Bam, the bug presents it self and is easily reproducible.

Debugging

Next up I wanted to figure out what the heck could be going on, so now the code morphed to the following.

   1: var num = $(this).val(),
   2:     theInt = parseInt(num);
   3:  
   4: alert(num); //alerts "08"
   5: alert(theInt); //alerts 0

Well it looks like we found our problem, parseInt() is some how behaving differently depending on the version of the browser, but why?

To the google!

After a few searches I soon smacked my head and said, darn it I forgot the radix!  The radix specifies which numeral system to use when parsing the number.  But why does it work correctly in new browsers but incorrectly in older ones?  Well after a bit more research I found this blurb on mozilla

ECMAScript 5 Removes Octal Interpretation

The ECMAScript 5 specification of the function parseInt no longer allows implementations to treat Strings beginning with a 0 character as octal values. ECMAScript 5 states:

The parseInt function produces an integer value dictated by interpretation of the contents of the string argument according to the specified radix. Leading white space in string is ignored. If radix is undefined or 0, it is assumed to be 10 except when the number begins with the character pairs 0x or 0X, in which case a radix of 16 is assumed. If radix is 16, number may also optionally begin with the character pairs 0x or 0X.

This differs from ECMAScript 3, which discouraged but allowed octal interpretation.

Since many implementations have not adopted this behavior as of 2011, and because older browsers must be supported, always specify a radix.

The key part is that in older browsers when no radix was specified the radix would default to 8, while in new browsers the radix is assumed to be 10.

The Fix

Well since we now know the problem we can easily fix the code to look something like this:

   1: var num = $(this).val(),
   2:     theInt = parseInt(num, 10);

Now the script works correctly on new and older browsers and we no longer have the undesired behavior we had previously.

 

December 7, 2012 8:13am
Building TypeScript in Web Applications

The one thing I failed to mention with the AngularBanking demo application is how do we get the TypeScript files to build during a build of the application.

  1. Well the first part is simply installing the plugin from the TypeScript site.
  2. Unload and edit your web application project and add the following snippet to the BeforeBuild <target/>
   1: <?xml version="1.0" encoding="utf-8"?>
   2: <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   3:   <!-- snip -->
   4:   <Target Name="BeforeBuild">
   5:     <Message Text="Compiling TypeScript files" />
   6:     <Exec Command="&amp;quot;$(PROGRAMFILES)\Microsoft SDKs\TypeScript\0.8.1.1\tsc&amp;quot; -target ES5 @(TypeScriptCompile ->'&quot;%(fullpath)&quot;', ' ')" />
   7:   </Target>
   8:   <Target Name="AfterBuild">
   9:   </Target>
  10: </Project>

Once you reload your project your TypeScript files will build along with your web application and you will get your JavaScript files your application relies on each time.

Also the AngularJs demo has been updated on github.

Liked posts on Tumblr: More liked posts »