#.think.in
learn.create.enjoy

VIC.NET Meeting Overview 23rd Sept 2008

September 24, 2008 17:42 by brodie

It's been a while since I've been along to a meeting (...again) mainly due to me working in Burwood while the meetings are in the city, but I managed to drag myself in (by train) and was very glad I did.

I also learnt that the Victoria Dot Net User Group (VDNUG) now has a twitter feed ... sweet!

Visual Studio Tips, Tricks and Techniques

Mahesh Krishnan ran through some of the sides he presented at the TechEd 08 in Sydney.  At first I wasn't sure what I could learn here being the hard core Visual Studio developer that I am *ahem* - but I was pleasantly surprised to learn or be reminded of several cool features in the IDE.

He's written up all his notes into a detailed blog Visual Studio Debugging Tips and Tricks

My top take-aways were ...

  • use Ctrl-'.' to automatically popup the Smart Tag menu  ... I had been using Shift - Alt - F10, or ReSharper's Alt-Enter.
  • use Ctrl - Shift - 'V' to cycle through the clipboard - hmm, should have known this Window OS feature.
  • use Ctrl - 'F3'  to go to the next occurrence of the word your cursor is on, which is much quicker than the  Ctrl - Shift - 'F' (open Find Dialog), Alt- 'F' (do the find).  Although I have been using ReSharper's Ctrl - Shift - F7 to highlight the current word.
  • use Ctrl - '/' to jump to the Find text box and open up the shell - had know idea you could do this, and is definitely worth exploring.
  • Alt - Shift - Enter - full screen mode - good for presentations
  • Debug into specific method (need SP1)
  • Debug to ignore stepping into Properties (need SP1)
  • Trace points (need SP1) - like setting breakpoints visually, you can now do the same with TracePoints.

 

He also went over macros as expected, but I've been a long time advocate of this little gem, spreading the joy everywhere I go ;-)

I still feel the best way to become more productive with Visual Studio and the entire Windows Operating System for that matter is to have a "No Mouse Day" - this will force you to use the keyboard, learn the shortcuts, and after an hour or two of pain you'll be much better off for it.

Also, do yourself a favor, and get a copy of ReSharper 4.1 installed ... try it free for a month then convince your manager you need it.  There are loads of productivity enhancements tucked away in there.

There are loads of tips out there which are easy to find, but a good place to start would be to check out Sara Ford's blog

 

Using the AJAX History Control with AJAX/Silverlight

Jordan Knight took us through a couple examples of how to use the ASP.NET AJAX History control which was packaged into .Net 3.5 SP1.  Basically the AJAX History control allows for more control when dealing with the pesky browser back button which has been the woe of many a web developer in recent times. 

His examples showed how to add history points to the browser which would record specific state values and allow the application to retrieve these values when the browser back/forward button is hit.  It was great to see a Silverlight example using the DOM Bridge which allows .Net classes to be exposed to the html page and accessed via javascript.

This functionality looks particularly useful when dealing with wizard style applications using an RIA technology such as AJAX/Silverlight.

He has a blog article which covers his talk in great detail including the Silverlight example with code and a screencast.

He also acknowledged Jonas Follesoe's blog post covering a similar example which minimizes/encapsulates the javascript involved.


Dynamically inserting dynamic scripts

June 3, 2008 15:40 by tarn

I came across this technique when I was trying to get around the cross-domain restrictions applied by modern browsers to the XMLHttpRequest object. Basically you can't do it.

This got me thinking, how does Google Maps do it? I have Google Map code in pages hosted on my domain. Somehow it's going to the Google server, from the browser, to get images. It can't be using XMLHttpRequest to do it, so how does it work?

Its seems ridiculously simple. You can reference scripts from another domain. You can use javascript to manipulate the DOM and web servers can deliver dynamic content based on a request.

So all we have to do to dynamically request a dynamic script is run some javascript that will insert a script tag with the source attribute pointing to the desired URL in the document head tag. The browser will then request the script from that URL. The server can return a script based on the request parameters provided. When the browser receives the script it will add it to the DOM.

My example here doesn't actually get the scripts off an external server or dynamically generate the script. The example has buttons that insert a script element into the head element when clicked. The script elements source attribute depends on which button is clicked, but both local script files display an alert message when loaded. 

Download Demo (> 1k)

To see this example running, just open the folder as a Website in Visual Studios and run it. I'll add a link to a live demo soon.

While this works really well, I will go into a light-weight Javascript framework I wrote that wraps round this concept and provides response, timeout and some error handling events as you would expect in most XMLHttpRequest wrappers.