Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

About this user

Justin Williams http://www.carpeaqua.com

« Newer Snippets
Older Snippets »
3 total  XML / RSS feed 

link_to_remote not calling "complete"

<ul>
<% @items.each do |item| %>
>
<%= link_to_remote(item.name, 
{       
:url => { 
:controller => 'security', 
:action => 'add_security', 
:description => item.name, 
:symbol => item.symbol
},
:update     => {:success=>'indexFundList', :failure=>'notice'},
:position   => :bottom,
:loading    => "loading()",
:complete   => "completeAddIndexFund(request)"
})           -%>
>
<% end %>
>

Mute Remote Macintosh

Sometimes I am in bed and too lazy to get out to mute my G5. I can just grab my iBook, SSH into the G5 and run the following command:

osascript -e 'set volume output muted true'


brilliant!

Borked LoadImageFromURL Method For Compact Framework

      public static Image LoadImageFromURL(string URL) 
      { 
         HttpWebRequest request = (HttpWebRequest) HttpWebRequest.Create(URL); 
         HttpWebResponse response = null; 
         BinaryReader br = null; 
         MemoryStream stream = null; 
         request.Timeout = 10000;   // 10 Seconds 
         try 
         { 
            int tmp = ServicePointManager.DefaultConnectionLimit; 
            response = (HttpWebResponse) request.GetResponse();  // i lock up on the second method call 
       
            br = new BinaryReader((response.GetResponseStream())); 
    
            byte[] buffer = new byte[256]; 
            stream = new MemoryStream(); 
    
            int length =0; 
    
            do 
            { 
               length = br.Read(buffer,0,256); 
               stream.Write(buffer,0,length); 
            } 
            while (length >0); 

            request.Abort(); 
            request = null; 
            response.Close(); 
            response = null; 
            return (Image)new Bitmap(stream); 
             
         } 
         catch(Exception e) 
         { 
            MessageBox.Show(e.Message.ToString()); 
            return null; 
         } 
         finally 
         { 
            if (response != null) 
            { 
               response.Close(); 
               response = null; 
            } 
         } 
      } 

   }
« Newer Snippets
Older Snippets »
3 total  XML / RSS feed