Experiences and Experiments in Programming

 Monday, February 18, 2013

If you are using Visual Studio 2012, you probably know that an update was made available toward the end of last year. Well they have done it again! The second update to Visual Studio 2012 is available now and this update has some terrific features.

There is no way to list them all but there are a few that I think will be usable very quickly.

There are some nice updates to the Visual Studio 2012 Page Inspector. The page inspector now supports live CSS updates. Also the Page Inspector allows you to map items that were added dynamically to a page using JavaScript back to the JavaScript code that added them. You can find out more about these features at http://blogs.msdn.com/b/webdev/archive/2012/12/14/css-auto-sync-and-javascript-selection-mapping-in-page-inspector.aspx.

Some of the things I am excited about are the ASP.NET editor enhancements.

  • You get some added syntax highlighting for things like CoffeScript, JsRender and others.
  • Even better, you get Intellisense for Knockout bindings!
  • If you use LESS (and you should), we know have first class support for editing LESS files. Previously in order to get LESS editor support, you had to install Mads Kristensen’s Web Essentials 2012 extension. This is a terrific extension with other enhancements besides LESS editor support. But it is sure nice to get editor support without having need for a third party tool. By the way, if you currently have the Web Essentials 2012 extension, you need to update it to the latest version prior to installing the Visual Studio Update 2.
  • If you have consumed any services that transmit data using JSON, you will love the “JSON to .NET class” support. You can paste (using Paste Special) any JSON data from the clipboard into a C# or VB.NET code file and Visual Studio will automatically generate .NET classes inferred from the JSON!

If you are one of the many developers using OData, ASP.NET Web API now provides support for OData endpoints that support both ATOM and JSON-light formats. There are also some other enhancements to ASP.NET Web API that you will find helpful!

If you use SignalR, then you will love the SignalR template support in this update! There are now templates for creating Hubs and Persistent Connections.

The ASP.NET team had released an out-of-cycle preview of a new library to support friendly urls in Web Forms. This is now included in this update. With this update, Web Forms supports friendly urls and mobile pages!  This is terrific news for developers of Web Forms!

ASP.NET MVC has its share of updates as well including two new interesting templates: A Facebook application template and the return of the Single Page Application template. For anyone who used the pre-release versions of Visual Studio 2012, you may remember the Single Page Application template as one of the available templates for ASP.NET MVC. The team decided to remove it before final release because it was just not ready. Well, it is back! This is a terrific addition to the available MVC templates! You can find out more about the Single Page Application template here.

There are more improvements in this update as well. If you want to find out more about some of the updates you can see Scott Guthrie’s announcement.

You can download the update here: Visual Studio 2012 Update 2.

Monday, February 18, 2013 12:58:55 PM (Central Standard Time, UTC-06:00)
 Monday, September 10, 2012

WebMatrix has not been a tool that I use on a daily basis.  However, I have used it to quickly setup and deploy sites based on templates or applications from third parties (ie. DotNetNuke, BlogEngine.NET, etc.).

Last week, Microsoft released WebMatrix 2.  It has quite a number of beneficial new features which make it worth investigating (not the least of which is the support for node.js).  If you are interested in a list of new features, check out Vishal Joshi’s post.  But introducing all the new features of WebMatrix 2 is not what this post is about.

One of the features that I have used quite a bit just in the last week is the ability to test your sites in multiple mobile simulators, including iPhone and iPad.  Microsoft partnered with Electric Plum, the creators of the electric mobile simulator, to include a lite version of the simulator directly in WebMatrix.  In addition, WebMatrix also includes a Windows Phone emulator as well.  So now you can test a website in all three device formats from within WebMatrix.

WebMatrix includes the Windows Phone 7 emulator out of the box.  In order to get iPhone and iPad simulators, you must install the extensions for them, which couldn’t be easier.  This screenshot shows the run selection with the iPhone and iPad options.


In order to add the iPad and iPhone simulators, just select the “Add new…” option.  From there, just select the iPad and iPhone extensions and install them.  Once installed, you can open your site in WebMatrix and choose to run them in one or more of the different devices/browsers.

Monday, September 10, 2012 7:05:50 AM (Central Standard Time, UTC-06:00)
 Thursday, February 02, 2012

DataCookbookI was recently asked to review the book, The Windows Phone 7.5 Data Cookbook.  In order to review this book, I was provided a free copy by the publisher.  The book was written to make you an expert in areas of data access and storage in Windows Phone applications.  The book covers databinding techniques, use of local storage and corresponding ways to store data in local storage, on-device databases, consuming cloud data sources like OData, REST, and WCF, and also utilization of the MVVM pattern.  The book uses the concept of a recipe to help understand the concepts of data handling.  A recipe is a step-by-step sample which can be followed and then used as the basis for further development.

While the book presents step-by-step examples of data handling concepts, it is not a book on beginning to develop for Windows Phone.  The book does assume some previous knowledge of XAML and C#.  It is possible to complete the examples in the book with no previous knowledge however,  because all of the code necessary for the examples is provided in the book.

The “recipe” approach to the book is easy to follow and provides a flow that I liked.  You are first introduced to a topic with a brief description.  Then you are told what prerequisites are necessary.  For example, if there are any libraries that need to be downloaded and installed. When there are additional items needed, URLs are provided to the resource.  The next step in the recipe walks through creating the necessary files and provides all of the code necessary in each file.  Once all of the code has been entered, you are told to run your project to see how it behaves.  An explanation is now provided that discusses what you did and why it worked the way it did.  Often there are links provided to Microsoft Knowledge Bases to find out more information about the resources or techniques used.  While I really like the approach of providing links to find out more information, there were times it seemed an excuse to not go into as much detail in the book.  So there are probably some recipes that will require going to the links provided to truly understand a particular technique.

Overall, the book is a great place to start.  It covers a wide range of data handling topics in a manner easily digestible to anyone at any level of experience. The addition of the section on MVVM, while not necessarily a data handling technique, is a big win for those who want to get started writing data driven applications for Windows Phone.  The depth of the examples is such that a reader will be able to understand how to use a particular technique without having to know all the technical details of the topic.  If you want a book on handling data in Windows Phone apps that will get you up to speed fast, but may require more research to become truly proficient, then The Windows Phone 7.5 Data Cookbook is a good place to start.  Chapter 2 - Isolated Storage is provided as a free download if you would like to see how the book is laid out.  You can download the sample chapter here.

Thursday, February 02, 2012 6:00:00 AM (Central Standard Time, UTC-06:00)
 Wednesday, September 21, 2011

I am going to be presenting on Using and Optimizing jQuery Selectors at the Code Project’s virtual tech summit.  The summit is on September 28th. This is a free online conference with tracks in HTML 5, CSS3, and JavaScript.  You can find the agenda at the link below:

The Code Project Virtual Tech Summit

After the conference my session will be on demand for 90 days.

Using and Optimizing jQuery Selectors
While there are many ways to accomplish a particular task in jQuery, they may not all be very efficient. In this presentation, Todd Miranda look at selectors in jQuery and how to use them in the most optimal way.

Click here to register!

Wednesday, September 21, 2011 10:12:16 PM (Central Standard Time, UTC-06:00)
 Saturday, July 24, 2010

I am really late getting this out, but since my youngest daughter tried to blind me recently, everything is behind!  If you have not heard, Walt Ritscher released Shazzam 1.3 on July 14th.  Yes, you are correct, this is great news.  Wait, some of you have not heard about Shazzam!  Well there is no time like the present to find out about it.

If you do anything with pixel shaders for WPF or Silverlight, you need Shazzam.  Shazzam is a tool that allows for the simple editing and testing of pixel shaders for WPF and/or Silverlight.  You can write your shader code in the built-in HLSL editor, then compile it and test it against sample images or video with a single click.  If your shader takes input parameters, Shazzam will build a set of controls to allow you to tweak your parameters in real time.  Once you are happy with your shader, you just copy the code generated by the tool into your project and start using it.

I have been using Shazzam since it was first released and this upgrade adds some really nice features.  For one thing, with previous versions of Shazzam, you had to provide your own copy of the tool used to compile the HLSL.  This tool is found in the DirectX SDK which is a nice size download just for one executable.  In version 1.3, this dependency has been removed!  For WPF Shaders, the new PS_3 specification is supported.  And you can tell Shazzam which specification/platform you are targeting.  There are now over 80 sample shaders included with the tool.  And 20 tutorials have been added demonstrating the who, what, when, and where of some of the most common HLSL.  From what I understand from Walt, there were a number of folks who wanted to download and install Shazzam, but their network or company policies prevented them from installing Click-Once applications.  So version 1.3 is now available as a standard installer package.

This is just the tip of the iceberg for some of the new features of Shazzam 1.3.  I would encourage you to download and install it.  If you are writing your own pixel shaders, it is a great tool to have in your hip pocket.  If you have not written any pixel shaders and have been a little intimidated by HLSL, then Shazzam is the tool to get you in the ball game!

Friday, July 23, 2010 11:07:15 PM (Central Standard Time, UTC-06:00)
 Monday, July 19, 2010

There seems to be some folks who are still having problems installing the Windows Phone 7 Beta Tools if they had a previous version installed.  One of the tricks is to make sure it is done in the right order so that any and all dependencies are addressed.  So while this order may differ for you, I am hoping that sharing my experience will help others.

  1. I started, as many did, by simply going through Control Panel (CP) and selecting to uninstall the Windows Phone 7 Developer Toolkit.  Well, I didn’t have any more luck than most.  The uninstaller seemed to be trying to install instead of uninstall.
  2. I then headed to my Program Files folder and found the Microsoft Visual Studio 2010 Express for Windows Phone CTP – ENU folder.  Mine was located at “C:\Program Files (x86)\Microsoft Visual Studio 10.0\Microsoft Visual Studio 2010 Express for Windows Phone  CTP – ENU”.  In this folder, I right-clicked the vs_setup.msi and selected uninstall from the context menu.
  3. Next I uninstalled “Windows Phone 7 tools addin for Visual Studio 2010” via the CP.
  4. Then I uninstalled “Visual Studio 2010 Express Prerequisites x64-ENU” via the CP.
  5. Next on the list was to uninstall “XNA Game Studio 4.0 Windows Phone Extensions” via the CP.
  6. After that, I uninstalled “XNA Game Studio 4.0” via the CP.
  7. At this point I did my first reboot in the process.  After reboot, “Windows Phone Developer Toolkit” no longer showed up in the CP program list.
  8. I uninstalled “Windows Phone Developer Resources” via the CP.
  9. Then I uninstalled “Windows Phone Emulator x64 – ENU” from the CP.  This is a step many forget if they can get everything else uninstalled.  You have to uninstall the emulator or the new tools will try to use the existing emulator.
  10. Now, I uninstalled “Expression Blend 4 Add-in Preview 2 for Windows Phone” via the CP.  Keep in mind that you may not have all of these options depending on what you installed in the first place.
  11. I then uninstalled “Expression Blend SDK Preview 2 for Windows Phone” also via the CP.
  12. I rebooted here for the second time.
  13. After this reboot, I noticed that there were still some remnants of the XNA Studio and extensions.  So I ran the XNA Cleanup Tool.  The download for the tool and the list products it removes can be found at Aaron Stebner’s blog.  I ran it twice.  The first time I specified “Windows Phone Developer Tools” as the product.  The next time I specified “XNA Game Studio 4.0” as the product.  Both runs exited with 0.
  14. After running the cleanup tool I figured I might need to reboot for good measure so my third reboot.
  15. After this reboot, I installed the Beta tools with no problems.

I hope this helps anyone else who may still be having problems getting the Beta tools installed.

Monday, July 19, 2010 10:30:22 AM (Central Standard Time, UTC-06:00)
 Tuesday, July 13, 2010

Recently after installing some updates, I noticed that my computer kept waking from sleep at midnight.  This was especially frustrating when the machine was in sleep mode in my bag.  When I opened the computer the next day, the batter would be dead and the machine will have hibernated.

I found a command line tool to configure power settings.  I would not think you would normally use this tool to modify your power settings, but there are some interesting switches that can be helpful in my situation.  I am sharing them here as much for anyone else’s benefit as for my own lack of memory!

This switch will display information about the last event that woke the computer from the sleep state.  I found that sometimes this would not give me any useful information.  Not sure why it would give more information on some events than others, but it is still useful.
Example: powercfg -lastwake

This switch returns a list of devices that meet the query criteria passed as flags to the switch.  There are some really useful flags that can be used here.  The one that I wound up using to get the information I needed was wake-armed.  This flag lists the devices that are currently configured to wake the computer from any sleep state.  There are flags that allow you to list devices that are configured to wake the computer from various levels of sleep.
Example: powercfg –devicequery wake-armed

In my case, I ran the –lastwake switch to see what caused the previous wake.  This didn’t give me any information on the day I checked it.  But when I ran the –devicequery switch, I noticed that my network card had been reset to wake the computer.  I could have used the –devicequery switch to disable wake on that device, but instead I went into the device manager and disabled wake on the network card.  Problem fixed.

Hopefully this will help someone else solve a similar problem sooner!

Tuesday, July 13, 2010 9:35:14 AM (Central Standard Time, UTC-06:00)
Who Am I - Todd Miranda
MVP Visual Developer - ASP/ASP.NET
On this page....
<December 2019>
Aggregate Me!
RSS 2.0 | Atom 1.0 | CDF
Contact me
Send mail to the author(s) E-mail