October 2006 - Posts

Firing Atlas UpdatePanels from a Flash movie
Thu, Oct 26 2006 1:02 PM
Technorati tags: , , ,

A friend of mine asked me about how to solve the following problem:

He has a Flash movie in which he can call javascript but needs to trigger an Atlas (or rather ASP.NET Ajax... sigh) UpdatePanel. In his code-behind he wants to load a different user-control based on the button that was clicked in his Flash movie.

I cooked him up a solution that generates a single line of javascript which he can copy/paste in his Flash movie and use to trigger the UpdatePanel.

The magic happens by implementing the IPostBackEventHandler interface. I created a simple control that implements this interface and exposes an event that gets called so that external observers can be notified when a postback occured:

   1:  public class RaisePostbackProxy : Control, IPostBackEventHandler
   2:  {
   3:      public event EventHandler<NewPostBackEventArgs> HandlePostback;
   4:      
   5:      public void RaisePostBackEvent(string eventArgument)
   6:      {
   7:          
   8:      }
   9:  }
 

I added this control to my aspx page and wired the HandlePostback event, now I can be notified when the user clicks any link or button in the flash movie and load the appropriate usercontrol by looking at the Argument property of the NewPostBackEventArgs parameter.

I have created a sample solution demonstrating this (very simple) approach. The solution can be downloaded here.

Hope this helps somebody.

.csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }
by Waseem Sadiq | with no comments
Filed under: , , ,
Google code-search
Thu, Oct 5 2006 10:02 AM

As developers we often need to look up code-samples or ways to use a certain class. There have been a few offerings in this arena, for example krugle, koders and o'reilly code search (and a few others). Now Google has weight in with their own offering called google code search. Quite interesting to see Google actually doing this since they undoubtfully have one of the biggest (if not the biggest) full-text databases out there.

It seems that at present they are only indexing a bunch of open-source projects (from the FAQ):

We're crawling as much publicly accessible source code as we can find, including archives (.tar.gz, .tar.bz2, .tar, and .zip), CVS repositories and Subversion repositories.

The number one use of Google search when wearing the developer hat, in my opinion, seems to be searching for error messages though. I would love to see Google crunching code-related error-messages, or even better, maybe even a dedicated error message search engine? :-)

The product is still in a very early stage of development so keep an eye on it. This might just become my homepage at the office when this product matures.

Technorati tags: , ,