Posts

Showing posts from 2010

Sub reports in Crystal Reports

Create DataSet with two tables with relationship. Use master table in crystal main report, and add fields from that. Add sub report using Insert menu Use sub table in data set in crystal sub report and drag fields accordingly. Right click on the sub report and select Edit Sub report Link, and select the key and foreign key to link both tables in crystal reports. http://vb.net-informations.com/crystal-report/vb.net_crystal_report_subreport.htm

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();   ...

How to Use Sessions in a Web Farm - ASP.Net

In a clustered web server, most of the time the hosts use load balancers. Such situations we can not use In Process Session variables to store our data across pages. In process works on the same thread of asp.net so it maintains in the server memory. If we use In Process we feel like our sessions get expired frequently. ASP gives us other 3 options to store our sessions. StateServer, SqlServer or custom. They are called out of process sessions. To save sessions in StateServer or Sqlserver we need our objects to be serialized. If we choose Linq To Sql the serialization of Entity classes will be more complex. The below steps can be adopt to overcome Stateserver,Sqlserver session issues 1). Make sure that we have decorate the entity classes with DataContract attribute 2). Or if you use VS, just right-click and set Serialization Unidirectional in properties 3). Helper methods to serialize using Memorystreams public static MemoryStream Serialize (T...
555 KUBIK | facade projection | from urbanscreen on Vimeo .

Free PDF generator library for C#

i TextSharp                            Download the iTextSharp library http://sourceforge.net/projects/itextsharp/ Documentation http://itextsharp.sourceforge.net/tutorial/index.html Example from SinhalaGospel.com private void GeneratePdf(int contID) { string path = ""; Document document = new Document(); try { cGospel gospel = new cGospel(); tbl_Gospel dtCont = gospel.GetContent(contID); string contentID = dtCont.ContentID.ToString(); string gospelTitle = dtCont.Gospel; string chapterID = dtCont.ChapterID.Value.ToString(); string titleID = dtCont.TitleID.ToString(); string title = dtCont.Title;                 string content = dtCont.Content; path = "../Contents/"+gospelTitle+"_"+chapterID+"_"+titleID+".pdf"; PdfWriter.GetInstance(document, new FileStream(Server.MapPath(path), Fil...

Scale Down Images in C#

1) open a file stream         FileStream fs = File.OpenRead(fullImgPath); 2) load the image         Image fullImg = Image.FromStream(fs); 3) define the new height         int thHeight = Convert.ToInt32(ConfigurationManager.AppSettings["thumbHeight"]); 4) define a callback function when thumbnail abort         Image.GetThumbnailImageAbort dummyCallback=new Image.GetThumbnailImageAbort(ThumbnailCallback); 5) set the new height and width of the image using GetThumbnailImage function         Image thumbImg = fullImg.GetThumbnailImage((int)(fullImg.Width * thHeight) / fullImg.Height, thHeight, dummyCallback, IntPtr.Zero); 6) save the thumb image         thumbImg.Save(thumbImgpath); 7) dispose         thumbImg.Dispose(); 8) the call back function implementation public static bool ThumbnailCallback() { return false; }