AJAX Guide !

Johnson compiles a useful list of Ajax resources. It contains resource for PHP/Java/ASP.net.

[Edited: Oct 13th, 2006]
And here we go to hack an Ajax website.

  • Using ‘Firebug’ (and extension to FireFox) you can discover ajax calls, stack trace of errors, etc;
  • Using ‘chickenfoot’ provides a programming environment within the browser (ie. simulation of user clicks, etc;)

~ Ankit

Forcing Download on Web page

Here I’m explaining how to create a webpage that offers download on button click event, instead of showing a direct link to the download file. The following C# piece of code when inserted in button click event on ASP.net web page, gives you an effect of dynamic download, hiding download URL.

HTTP requests and responses travel along with lot of headers, just like meta-data for the request/response. Here is the list of some of them, Response Headers. Following example makes use of them. The method implemented here is just for the sake of example, and not to be used on Web Servers. Problem here is we are reading one byte, writing to response and flushing the response again-n-again. Here for every single byte, a packet is created and sent to the client, creating packet flood! Using a buffer of at least 1000 bytes before flushing is recommended.

Response.Clear();
String fileNameToSend = “downloadTest.txt”;

//Make sure following file exists and it’s size is less than 2KB.
FileInfo file = new FileInfo( “C:test.txt” );
String value = “attachment; filename=”" + fileNameToSend + “”";
Response.ContentType = “application/octet-stream” ;
Response.AddHeader(“Content-length: “, file.Length.ToString());
Response.AddHeader(“Content-Disposition”, value );
FileStream fs = null ;
try {
   fs = File.OpenRead(“C:test.txt”);
   BinaryReader br = new BinaryReader(fs);
   while (true)
   {
       // EOF exception to exit loop, not a good way!
       Response.Write((char)br.ReadByte());
       System.Threading.Thread.Sleep(5);
       Response.Flush();
   }
}
catch {}
finally
{
   if (fs != null )
      fs.Close();
}
Response.End();

What more you can do with this?

  • allow users to download only one file at a time,
  • limit bandwidth for specific users, etc.

~ ankit

Windows Live !

Besides providing free domains with Office Live, they have entered into active competition against Google. Google started giving free domain-email hosting, Google/Hosted for small companies on there servers with GMail, here comes Microsoft with … Windows Live™ Custom Domains.

More @ ideas.live.com. Lots of stuff under the brand name “Live”.

  • Live Shopping — Find the products you’re looking for, read review, recommend.
  • Live Mail Desktop Beta — One place to see e-mail from multiple accounts. I guess this is possible with Outlook 2007.
  • Live Expo Beta — Expo is an online social marketplace where you can exchange goods/ideas or information with anyone you choose. Just like Google Base.
  • Live Favorites — now that your Internet Explorer Favorites can travel with you.

Pumping new services over-n-over. Now the question is who will survive. One thing is clear that this competition has given lots of free stuff to users. The online world is being better, simpler and effortless. The old tradition in which you have to buy a service is changed. This is actually Web 2.0!

Frankly speaking, before buying anything search well for it!

~ ankit