Archive for February, 2012|Monthly archive page
A Minor Gotcha when using jquery.mobile in MVC4
Yesterday I was playing around with the jquery.mobile package from Nuget and found an interesting gotcha.
I had a project from the MVC4 WebAPI template (note: WebAPI doesn’t have anything to do with it). I wanted to add Mobile support to it, so I installed the jquery.Mobile.Mvc package through the package manager console. The idea was I would use the ViewSwitcher framework to create mobile views with appropriate extensions. But to my surprise my edit views started getting buttons that looked like Mobile buttons.
I also got exceptions in jquery.mobile js module like the following.
I started scratching my head wondering why was the mobile rendering kicking in when I didn’t have any mobile views created?
Turns out, that when you install jquery.Mobile.MVC or the standalone jquery.mobile nuget packages, the new MVC4 Bundling and minification functionality rolls up all the js files together in the _Layout.cshtml. As a result jquery.mobile kicks in and tries to convert everything into mobile layout.
Possible Solution
There is an easy way out.
After you have installed jQuery.mobile under the Scripts folder create a ‘Mobile’ folder and move jquery.mobile* files there.
Before After
This will ensure the regular views don’t load jQuery Mobile scripts.
Now update the _layout.Mobile.cshtml to point to the updated location for jQuery.mobile scripts
You can do the same for the css to if you want to keep a clear separation.
Hope this helps you some head scratching. To me it seems the Nuget Package should be updated. But I’ll leave the solution to the biggies
.
Rant on Visual Studio Maintenance Experience
Warning: This is a Rant. I am waiting for my new VM to finishing patching itself. So spending time ranting here.
———– BEGIN RANT ———-
Last week, the Visual Studio team released the 2011 Beta. Unfortunately a day before that I had figured out that my VS Setup was hosed enough to not allow MVC4 beta to be installed. Now I don’t usually install Beta in my dev machine but since MVC4 Beta came with a go live license and it promised to live side-by-side MVC3 I decided to go for it.
I started downloaded the complete installer and initiated the install and quickly it said that it did not find Visual Studio Installed hence couldn’t continue. I was like huh WAT!?!
Naturally I turned to the venting machine also known as Twitter.
Jon Galloway from the ASP.NET team kindly responded suggesting a possible conflict. He also suggested I post it on the official forum for better response. After a few feeble attempts at uninstalling/reinstalling I posted on the Forum @ http://forums.asp.net/p/1772359/4850404.aspx/1?p=True&t=634657393972716075
I was surprised to find there was a special Visual Studio Uninstaller, but alas it was of no use.
Microsoft used to have a registry cleaner deep buried inside their TechNet site. It was like a bazooka to eliminate all registry entries for an application listed in Add Remove programs. Obviously you could hurt yourself a lot with it (I had hurt myself once, but it had atleast ended up in me reinstalling VS only not setting up a new VM). But Microsoft got the wind of it and they have replaced it with a safer version of the software http://support.microsoft.com/kb/2438651 . Running this tool repeatedly resulted in some improvement as in the Visual Studio Installer started going to the point where it would ask which components you want to install. But hopes got dashed promptly after when it crashed saying it couldn’t continue and that none of the components were installed.
After doing it for the fifth time on the third night I gave up and started building a new VM.
———END RANT———-
——– BEGIN CHALLENGE ——
Here is my challenge to the Visual Studio team. You have been known to eat your own dogfood right? Visual Studio is built on .NET. Build an XCopy Installer that does not use the Registry, period!
All your UX changes are fine. But if I have to setup a new VM every-time a minor revision is released, you are NOT optimizing for developer happiness or presenting a good developer experience.
Beta might be too late a stage to take this challenge up. But hey, here it is!
——– END CHALLENGE ——–
Web Software Devs – Don’t build a Galloping Gertie
Woke up today morning (afternoon) to the news that Microsoft Store India’s site had been hacked and it’s plain text user passwords put up for everyone’s benefit!
Now I don’t approve of that action, but I am really appalled and flabbergasted that in 2012 we still have databases that have plain text password stored.
Being a staunch MS loyalist, first thing I did was lookup the default aspnetdb which any n00b developer would use as the starting point. Thankfully even the sample aspnetdb does not store passwords in plain text. That made me even more mad. So the danged n00b who did it, didn’t know/care about the out-of-the-box security framework available. For me this is a bloody failure of the entire s/w development process, the developer, the QA and the gawd-danged manager who managed this freaking project!!!
Going back to the title of the article if you don’t know what the Galloping Gertie was, please check this out. If your site gets hacked (and I am not asking you to build an un-hackable site just don’t present it on a platter), and it turns out your users’ email and password were compromised and they were in plain text, your creation just collapsed like the Galloping Gertie. That single civil engineering ‘mistake’ is still upheld as how not to design a suspension bridge. It happened in the 1940’s and since then there have rarely been such spectacular bridge failures. But every second month we hear how a high profile site getting hacked and plain text passwords getting dumped for everyone to see. We don’t just seem to learn from our mistakes. Instead we crib, we crib about how little time we have to build/qa/test/gather requirements or how it is the platform’s fault blah blah blah! It’s always someone else’s mistake! STOP passing the buck it’s NOT someone else’s fault!!!
Sometime back I was reading in a blog (don’t remember the exactly where probably Hanselminutes), where it was said, health of a software development process is judged by how well the management knows about the code. Yes, you heard that right, the code. Unfortunately in the last twelve years I have seen people in software development, so eager to become managers so that they don’t have to look at code, that’s its sad! It’s beyond sad actually. When you have managers who don’t care about code, you have code that’s not the best it could have been because at the lowest level either the developer is too frustrated with writing the correct code or doesn’t care because they are in a hurry to become a manager too!!!
This happened closely in heel of the Path fiasco, where a startup thought it was okay to upload the user’s entire address-book without asking and then pretended that it was a mistake. Free web, leaching out information from you in form of cookies was bad enough, now it is claimed that if a framework doesn’t stop me from reading other’s personal info it is an ‘industry-best-practice’ WTF!!! That’s like saying I built a virus because the OS allowed me to and I should be a hero!!!
Software Devs, it’s time we grew up and acted like grown ups. Take security and personal information more seriously. Be up-front about your actions to your end users, else software as a branch of engineering will be scarred irreparably!!!
Comments (1)