Posts

Showing posts from March, 2010

Really Good Robots

Real Transformer   Big Dog RHex RiSE

Simple JQuery Slideshow

Lay all the images which are going to be used in a div <div id="slideshow"> <img src="img/img1.jpg" alt="" class="active" /> <img src="img/img2.jpg" alt="" /> <img src="img/img3.jpg" alt="" /> </div> Small CSS to change the z-index of our slides #slideshow { position:relative; height:350px; } #slideshow IMG { position:absolute; top:0; left:0; z-index:8; } #slideshow IMG.active { z-index:10; } #slideshow IMG.last-active { z-index:9; } Slideshow function written in core functions of JQuery function slideSwitch() { var $active = $('#slideshow IMG.active'); if ( $active.length == 0 ) $active = $('#slideshow IMG:last'); var $next = $active.next().length ? $active.next() : $('#slideshow IMG:first'); $active.addClass('last-active'); $next.css({opacity: 0.0}) .addClass('active') .animate({...

Random tuples from Sql Server 2005 or greater

We sometime need to show random items from our databases on users screen. Random photos of the week, random sayings and so many situations the pages look so good when there is a bunch of sticks with variety. This is nice but real good headache to solve when we have a huge list of items in the database, because randomizing at the program level using a huge list not a good idea having overhead to the memory. Simple sql will solve the issue like this SELECT TOP 10 * FROM tbl_items ORDER BY NewID() Filters out tem items randomly from table tbl_items. If you use Linq to sql as your query provider You have to use a partial class for your data context class and introduce a method to get a new Guid as follows Let DBContext be your datacontext class, Then create a new class public partial class DBContext {      public Guid NewID()      {          return Guid.NewGuid();   ...