Thursday, December 22, 2011
JavaScript Globalization
I am leading a project that is now going to go from running in the US to running across the world over the next 6+ months.
It currently uses a lot of different tech: ASP.NET MVC3, HTML5, jQuery, jQuery UI, KnockoutJs (w/Mapping), jQuery Templates, jQuery DataTables, EF4 and a host of other home-grown and one-off type technologies.
So, I started browsing the usual suspects, especially a previously bookmarked Scott Hanselman blog post (suspiciously a 7-month-old "part 1" with no "part 2" yet *holds breath*).
Well, the most confusing part I have run across so far is how to handle JavaScript and jQuery globalization. There was one project by Microsoft that was donated/accepted/rejected by the jQuery folks (sounds familiar... jQuery Templates had the same problem) which, apparently went through a few renamings (one, two, three), the last of which was a renaming to "Globalize", total api change and removal of any dependency on jQuery (not sure if there was ever one, but didn't bother to get into it).
Confusingly, this library (not a plugin anymore) is maintained/developed by the jQuery UI team now, even though there's no dependency.
So, apparently, the supported(?), in-development code is now the "Globalize" library whose wiki is here (on the jQuery UI site, where else? ... O_o)
Hope that helps save someone else some time.
Saturday, November 19, 2011
Chain Of Responsibility Implementation
[UPDATE: I have since updated this post. Look for the block at the bottom]\
Monday, November 7, 2011
Hmm.. which one’s broken, Linq, Debugger, IDE?
So, I ran into an as of yet unsolved problem today. I don’t know if this is a Linq bug, a debugger bug, or a Visual Studio bug, but, for your viewing pleasure:
If I can figure out what’s going on, I’ll post an update
EDIT: Figured it out..
This is one of the big reasons I don’t like operator overloading…
The items inside the FilterList overrode the comparison operators, but did not handle “null” properly…
Grrr..
Thursday, November 3, 2011
CSS Transform help
I decided to try to do some fancy CSS stuff for my client website. It involves gradients, transforms and stuff like that. Anybody who's messed with that stuff knows that it's a huge pain in the butt to get it working in all the browsers, never mind one! So, here you go: http://css3generator.com/.
You're welcome :)
Wednesday, October 26, 2011
Windows Azure AppFabric Cache's Miniscule Features
Just wanted to warn/inform people who are considering using AppFabric Caching in Azure…
Here’s a list of things it won’t do:
- Regions
- Named Caches
- Allow you to get a list of cache keys currently in use
- High Availability Mode (redundant copies across machines for durability)
- No sliding window expiration
- No events for things like eviction, add/remove, etc.
- so you can’t update a local cache with events from the global cache
- You don’t get notified if something is removed, so you only know when you get “null” back from a Get()
- No Powershell integration (if you’re into that)
- No tag support (tagging is basically used for some extra metadata besides the key without pulling the whole object)
So, basically, ALL you get is a simple, Get/Set distributed cache that doesn’t even support the whole set of features you get from the basic ObjectCache in .NET 4.0
They really shouldn’t be calling it “AppFabric Cache” at all, since it doesn’t really support anything that comes with that API
I must say that I’m really disappointed
We waited a LONG time for this feature and got something that could have been coded in a month.
Bad form, Microsoft. Bad form!
Conflicts Between Versions Of Assemblies
I just upgraded a project from the Azure SDK 1.4 to SDK 1.5. I started getting the "Found conflicts between different versions of the same dependent assembly" warning on the Microsoft.ServiceBus.dll file.
I thought to myself, "Self, I've seen this before. You're just referencing the wrong copy of an assembly somewhere"
So, I checked every reference to Microsoft.ServiceBus.dll … Hmm… they're all correct. ??
I did a full rebuild… still there..
I did a super-duper clean (close the project, delete every "bin" and "obj" folder, open the project and rebuild)… nope…
Time to get medieval on this stuff… So, I opened the topmost assembly (in this case, my Web application assembly) in ILSpy. I stared looking through each and every referenced assembly until I found the culprit:
Microsoft's own Transient Fault Handling library (used for retrying database calls in Azure). Now, I've contacted the team who wrote that, hoping that they will update their NuGet package. Otherwise, I'll have to add that ugly Binding Redirect in my config file.
For now, I'll just stare at the warning for a while and hope the NuGet package gets a quick update
Thursday, October 13, 2011
Useless Properties
So, apparently the UserData property on the ASP.NET FormsAuthenticationTicket object is basically useless.
The UserData isn't persisted if you're not using cookies. So, you get no errors, no warnings, the code runs fine, it just doesn't actually persist that data.
Nice going, Microsoft!
Monday, October 3, 2011
I volunteered for Give Camp in Baltimore
Seems like a good idea. I haven't done it before, so it should be a novel experience.
I'm one of those people that always wants to be charitable, but never really gets around to it.
Helping to make a functional website for a non-profit organization over a weekend seems like a pretty good way to do it.
Oh, it turns out that my employer is one of the Corporate Sponsors of the event as well!
Tuesday, September 6, 2011
Modular JavaScript Tracing
UPDATE (2/18/2012) -- I have moved the source code to Codeplex
Much to my chagrin, I have been doing a LOT of JavaScript debugging lately. In order to handle multple "levels" of debugging information, I started using Ben Alman’s “ba-debug” javascript library (http://benalman.com/projects/javascript-debug-console-log/).
ba-debug is really nice, but it's unfortunately "global", meaning that the setLevel() method and all the messages are switched with a single global switch. After using it for a while, I decided I needed something more modular.So, I took his library and modified it heavily.
Being a fan of the .NET System.Diagnostics library, including the TraceSource/SourceSwitch objects, I decided to emulate that somewhat. result is the Trace file I’m including here.
Here’s a brief overview of how to use it.
(NOTE: When I say "module", I mean a closure/module as defined by this -- and many other-- article: www.adequatelygood.com/2010/3/JavaScript-Module-Pattern-In-Depth)
The idea is that, in some sort of module, you do this:
var _trace = new Trace('ModuleName');
_trace.debug('ItemsListView - redrawing...');
The current default level is “error” for all Trace objects.
If you want to increase that level for a particular module, you insert a line like this into your web page:
Trace.traceLevel('ModuleName', Trace.Levels.log);
Trace.setCallback(function (args) { // do something with the arguments array here. }, true, // force it 50); // give me the last 50 at most
- A method that receives an array of the arguments that were passed to the trace message (the level should be the first argument in the array). Pass null to turn it off
- Boolean on whether or not to “force” the callback. If this is true, it will always call the callback for every message. Otherwise, it will only call the callback if the browser doesn’t support the “window.console.log” method (at the very least).
- A limit to the number of messages to be given up front. Since messages could have accumulated before you call the callback, there may be a flood of messages right away when you set the callback up, so this will stop you from getting too many messages in the beginning.
Preventing accidental deployments to Azure
- <PropertyGroup>
- <PublishDependsOn>
- VerifyAzureRelease;
- $(PublishDependsOn);
- </PublishDependsOn>
- </PropertyGroup>
- <Target Name="VerifyAzureRelease" Condition="'$(Configuration)' != 'AzureRelease' Or '$(TargetProfile)' != 'Production'">
- <Error Text="Should Not Be Deploying non-AzureRelease Code" ContinueOnError="false" />
- </Target>