Gilad Lavian's Blog

In Development

Browse by Tags

All Tags » Code Better (RSS)
Code Snippet RW (Response.Write)
Code Snippet For Response.Write   Ok, this code snippet must be the oldest trick in the book, but still I think it will help to developers how doesn't know about it.   1. Create a file name rw.snippet 2. Copy this XML code and save it. 3. From the tools menu in VS, select "Code Snippets manager". 4. Select import, and point it to the saved file. 5. To use the snippet write rw in the code editor. 6. Enjoy!   <?xml version="1.0" encoding="utf-8" ...
Parsing DateTime formats
A few ways to handle dates in application: try { //Tells the parser to expect a he-IL (culture) date format DateTime dateParse = DateTime .Parse( "28/02/2008" , new CultureInfo ( "he-IL" )); //Tells the parser to expect a date with specific date format DateTime dateParseExact = DateTime .ParseExact( "28/02/2008" , "dd/MM/yyyy" , null ); //Tells the parser to expect a date with specific date format //with exact hours, minutes and seconds DateTime dateTimeParseExact...
LINQ to SQL Classes
One can only wish everybody to speak LINQ! The following solution demonstrate how to query database tables with object relational data classes. For this example you need to download and install the AdventureWorks Database provided by Microsoft. First, create a new console project: Open the "Server Explorer", click on the "Connect to Database" button: Select the Microsoft SQL Server: The next step is to connect to your AdventureWorks Database Server, from the "Add Connection"...
Cool trick with TAB in Visual Studio for auto completing code blocks
I found a cool trick for auto completing some code blocks. Personally, I find it very convenient while i'm in hyperspace speed coding. Its called snippets and its built-in in Visual Studio, and you can create one yoursefe. When you start a new "try" block, after finishing to write "try", immediately press TAB button, it will auto complete to: try { } catch ( Exception ) { throw ; } When you start a new condition block, "if (2 > 1)", and after you add the "else"...
SCRUM - Power to the people !
Recently, I attended in the last lecture by ALM (meeting group) about SCRUM . I must say, at first, I didn't hooked up with the idea, and its seems like a wonderful world who's not connected to the reality. I finally consolidate my opinion about this method, which looks like a' lot of fun after all ! Its seems like a best practice for dynamic and cool environment. Here's some reasons that makes the different for me: The fun in the entire process - project life cycle. The team developers deciding...
Visual Studio shortcuts keys
You 2 can become a visual studio shotrcut keys GURU ! http://www.dofactory.com/ShortCutKeys/ShortCutKeys.aspx Mister Miagi once said: Rule number one, breathe in and... breathe out ! Rule number two, first learn rule number one...
A ballad for my Check-In files - Source Safe
Yesterday Yesterday, All those Check-ins seemed a waste of pay. Now my source files have all gone away. Oh I believe in yesterday. Suddenly, There's not half the files there used to be, And there's a milestone hanging over me. The Source Safe crashed so suddenly. I pushed something wrong What it was I could not say. Now all my data's gone and I long for yesterday-ay-ay-ay. Yesterday, The need for SourceSafe seemed so far away. I knew my data was all here to stay, Now I believe in yesterday. Credits...
Ajax.NET Using PageMethods
This is great article for using Ajax.NET PageMethods. By using PageMethods we can call Server Side Code function directly from the client and get some results returned from Server. http://www.singingeels.com/Articles/Using_Page_Methods_in_ASPNET_AJAX.aspx
ASP.NET OutputCache + OutputCache Profiles
In many projects i built, i used the OutputCache to improve WebSites performance and scalability. OutputCache is a powerful tool for increasing WebSites performance. When using OutputCache, the IIS saves a new version for the specific requested Page in memory. The next time we request the same Page, the IIS will serve us the rendered Page from memory, there for not process the page again. We can also set some conditions for the cache version like: when to cache it, how, and for how long (Duration...
Ajax.NET - Independent updating UpdatePanel control
The problem: When trying to update one UpdatePanel (up1) control next to another UpdatePanel (up2) control, one influences the other and there both triggered. The solution: Adding Attribute UpdateMode="Conditional" to the UpdatePanel control that you don’t wish to update when triggering the next UpdateControl. Now they will not trigger each other. < asp : UpdatePanel ID ="UpdatePanel1" runat ="server"> < ContentTemplate > < table width ="400" cellpadding ="0" border ="1" cellspacing...
netvibes.com Rocks !
Look at this site... i have only one word, amazing! This is the way a website should look like..., this guys thought on everything. I love the user experience when trying to open a menu and the way there organized, The number of features in the menu and the way they expand. Check it out... http://www.netvibes.com/
Transform an XML to HTML - StringReader
Here is a great way to transform an XML string returned from DB Query to a HTML using DataGrid/List... The xml represent by the StringReader, witch implements a TextReader that reads from a string. Then loaded to DataSet (by ds.ReadXML), and finally binds to the DataGrid. //Supposed this is the text returning from DB... string xml = "<rows><row id='1'><name>Gilad</name><address>Burla</address>" + "<country>Israel</country><...