Spot the web RSS 2.0
# Wednesday, January 16, 2008

Dates are sometimes needed in forms a webdeveloper includes in his work. And users always try to input the date in a format which is not the right one. Date pickers can be very helpful and also eye-candy

Wednesday, January 16, 2008 2:04:42 PM (Jerusalem Standard Time, UTC+02:00)  #    Comments [0] - Trackback
Javascript
# Tuesday, January 15, 2008

For a long time I have been looking for a really easy way to create a cryptographically random string in c#.  I knew it had to be simple but I just had not spend the time to dig one up.  Specifically I was looking for a quick and easy way to get a string that was acceptable for use as a Token for session use. 

using System;
using System.Security.Cryptography;

namespace ConsoleApplication1
{
   class Program
   {
   static void Main(string[] args)
   {
      byte[] random = new Byte[128]; //Tell it how long you want it to be
      RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider();
      rng.GetNonZeroBytes(random); 
      // The array is now filled with cryptographically strong random bytes.

      Console.WriteLine(System.Convert.ToBase64String(random));
         Console.ReadKey();
      }
   }
}

Tuesday, January 15, 2008 2:56:38 PM (Jerusalem Standard Time, UTC+02:00)  #    Comments [0] - Trackback
.Net | Programming | Visual Studio
# Monday, January 14, 2008

Optimizing Symbol Resolution

How to speed up in a late binding world. Discusses the scope chain from vars to the DOM itself, and how to make sure that you don’t keep running around the chain.

JavaScript Code Inefficiencies

To make string manipulation more effience in IE:

  • Use local vars
  • Cache strings from IE objects
  • Use Array.join for concatenation

(I prefict that array.join will stick around even when it isn’t faster, just like the equivilent in Java land).

Some other thoughts:

  • Don’t use eval unless you really have too. Instead of parameterized code
  • SWITCH is costly for large sets, consider a hash table wrapped in a try/catch
  • WITH is costly due to symbol lookups everywhere, use manual iterators
  • Don’t use your own get/set accessors

IE Performance Considerations

DOM is expensive in IE, especially due to the generic nature of the platform. Also watch out for layout improvements such as hover CSS style.

HTTP Performance

Simplify and reduce:

  • Script in on JS file
  • Styles in one CSS file
  • Fewer, smaller, unscaled images
  • Simplify layout
  • Use HTTP compression (lots of detail on cache control)

Tools and Techniques

  • Developer Toolbar
  • Fiddler: HTTP traffic watching
  • Ajax View: New from MS Research. On the fly rewrite the JavaScript and add instrumentation code.
Monday, January 14, 2008 4:41:00 PM (Jerusalem Standard Time, UTC+02:00)  #    Comments [0] - Trackback
Web 2.0 | AJAX
Navigation
Archive
<January 2008>
SunMonTueWedThuFriSat
303112345
6789101112
13141516171819
20212223242526
272829303112
3456789
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2010
Guy Levin
Sign In
Statistics
Total Posts: 63
This Year: 0
This Month: 0
This Week: 0
Comments: 14
Themes
All Content © 2010, Guy Levin