Monday, December 29, 2008

jQuery for Absolute Beginners: Video Series is a great site with many tutorials.

Here is a series of jQuery tutorials for beginners


This article sais it all.

Friday, December 26, 2008

Scrum: Ken Schwaber Talks Scrum at Google



Google Tech Talks
September 5, 2006
Ken Schwaber co-developed the Agile process, Scrum. He is a founder of the Agile Alliance and Scrum Alliance, and signatory to the Agile Manifesto. Ken has been a software developer for over thirty years. He is an active advocate and evangelist for Agile processes.
Scrum is an amazingly simple process that causes many, many changes when it is implemented. This seminar presents the basic framework of Scrum and some of the implementation issues associated with it.


Speaker:Ken Schwaber

Saturday, December 20, 2008

Transfer Visual Studio settings

I’m reinstalling Windows on my work computer and wanted to preserve all the current Visual Studio settings.

In case you didn’t know how it is done:


1. Open Visual Studio

2. Go to Tools->Import and Export Settings


3. Choose “Export selected…”


4. Choose which settings you want to export


5. Choose filename and location

6. Done :)

7. All you need to do now is to go to same menu on other VS and select import.

Sunday, November 23, 2008

Google Search Greasemonkey Script

This is a nice script that can convert your Google search page from this:


to this:


Features (From the developers page):

  • Allows you to select 1,2,3 and 4 columns of Google results. You can now use more of your screen space with less scrolling (based on the original concept of Two Column Google by Jeffrey Sharkey)
  • A background or border hue to your search results. Now configurable from the user dialogue with a simple color picker! glooble
  • Remove the Google "Sponsored Links". Like you need Google telling you where to buy stuff!
  • Result numbering. When looking at loads of results you can use this feature to quickly identify where you are and what relevance they may have (especially useful when we come to Auto-loading more results!)
  • Auto-load more results. Seen else where on This version of the scripts code has been streamlined to allow almost seamless result fetching when you approach the bottom of the screen. Never have to load the next page by hand! (based on the Definitive Google Auto Pager by Paweł Kubisz)
  • Remove the web search dialogues from your Google pages. If you use the Google Toolbar for Firefox why waste your valuable screen space when you can hide the extraneous elements away.
  • Make external Google links open in a new window/tab. Now this is configurable in your Google preferences but not with the distinction between when your searching and when your using iGoogle. Well now you can!
  • Disable Google tracking your search results. Every time you click a link in your search results, the click gets reported back to Google for their statisticians to ponder over. If you are signed in to a Google account this click will be recorded in your search history. This function allows you to disable this reporting to Google completely or add an extra "Trackless" link to each of your search results
  • Self updating when a new version of the script is available. Using the same technology seen in my other scripts you'll always be notified of updates. This feature checks every 24hours for later versions of the script. Opening the preferences will force a check there and then (although there is possible caching by FF).
  • Thumbnails for each of your results. Incorporating resources from now allows you to see a thumbnail of the home page of each of your search results. If you use this feature think about helping out with the server costs and donate!
  • favicons for each of your results. Show the sites favicon if you so choose... and, of course, they actually have one !)
  • And all of this can be configured through one simple screen. Simply click on the GoogleMonkeyR link at the top right of the page and pick your preferences.
    The original idea/concept for this wonderful preferences screen came from the Rllmuk User Ignore List script written by Jonathan Buchanan (his web site). Reading his code made me stop and look at how i wrote my own code... and then think about going back to school. Hats off!


Install it from here

* For some reason the script registers with a specific domain name, so I had to change it manually to:


Saturday, November 22, 2008

CSS Box Model (W3C and IE6)


jQuery – working with ASP.NET controls


DropDownList SelectedValue:

GET:   $('#<%=DropDownList1.ClientID%>').val();
SET: $('#<%=DropDownList1.ClientID%>')

RadioButtonList SelectedValue:


Button Enable/Disable

$('#<%=Button1.ClientID%>').attr("disabled", true/false);

Label Text

GET:  $('#<%=Label1.ClientID%>').text();
SET: $('#<%=Label1.ClientID%>').text("value_to_set");

TextBox Text

GET:  $('#<%=TextBox1.ClientID%>').val();
SET: $('#<%=TextBox1.ClientID%>').val("value_to_set")

Check Visibility

if ($('#<%=Button1.ClientID%>').is(':visible'));

Friday, November 21, 2008

jQuery Data method

I got this amazing tip from an article named “5 tips for better jQuery code”.

This is a great way to associate any amount of data with any element on the page, here is a small example:

    <title>jQuery Data() method</title>
    <script src="scripts/jquery/jquery-1.2.6.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function() {
            //create meaningless list
            for(var i=0;i < 10;i++)
                $("#list").append("<li>" + i + "</li>");
            var prevSum = 0;
            //will show the pwr of index and sum with all previous items
            $("#list li").each(function(indx, obj)
                prevSum = prevSum + indx;
                //attach data to each list item
                $(this).data("Data", {pwr: indx*indx, sum: prevSum });
                //Show it
                $(this).html($(this).html() + ": pwr=" + $(this).data("Data").pwr + ",sum=" + $(this).data("Data").sum);
    <ul id="list">
            <!--the items will be added here -->



The interesting part is that the data is not shown in the source code…

jQuery Array Iteration – $.each

jQuery $.each can be used in order to iterate over an array:

$(document).ready(function() {
    var arr = [ "a", "b", "c", "d", "e" ];
    $.each(arr,function(index, item)
        $('#list').append($( "<li>" + item + " at " + index +"</li>" ));

You should have a <ul> with id=list for this code to work:

<ul id="list">
    <!--the items will be added here -->

The result is:


Here is the entire code:

    <title>jQuery Array Iteration</title>
    <script src="scripts/jquery/jquery-1.2.6.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function() {
            var arr = [ "a", "b", "c", "d", "e" ];
            $.each(arr,function(index, item)
                $('#list').append($( "<li>" + item + " at " + index +"</li>" ));
    <ul id="list">
            <!--the items will be added here -->

Important to note that this is not the same as $(‘DOMElement’).each().



Friday, November 14, 2008

Doing something while UpdatePanel is updated

<script type="text/javascript">
// Get the instance of PageRequestManager.
 var pageReq = Sys.WebForms.PageRequestManager
 // Add initializeRequest and endRequest
 // Called when async postback begins
 function pageReq_InitializeRequest(sender, args) {
 // Called when async postback ends
 function pageReq_EndRequest(sender, args) {

Tuesday, November 4, 2008

SQL Server – inserting multiple rows with one statement

This is a nice trick:

INSERT INTO tblTable (rowName1, rowName2)
SELECT 'val1', 'val2'
SELECT 'val3', 'val4'
SELECT 'val5', 'val6'

This code will insert 3 rows into the table.

Tuesday, October 21, 2008

Cleanup time

I have decided to clean my hard drive lately, here are some things I did:

Deleted the Vista SP1 installation files (they are only needed if you plan to remove SP1, which I don’t)

  1. Open cmd.exe with Administrators rights
  2. type “vsp1cln”

Disabled hibernate (this is desktop, don’t need it…)

  1. cmd.exe again
  2. type “powercfg -h off”

Got 10 GB back :)

Monday, September 29, 2008

How to delete a Windows Service

In command line write

sc delete "Some Service Name"

Friday, August 29, 2008

Visual Studio - how to restore missing templates


DevEnv.exe /installvstemplates

The file is located (for vs2005) at:

C:\Program Files\Microsoft Visual Studio 8\Common7\IDE

Tuesday, August 12, 2008

How do you know you are going to have a bad day....


ASP.NET Custom Error pages

A great explanation about where and how errors can be caught in ASP.NET application and how to build custom error pages.


Saturday, August 2, 2008



New ideas as mash-ups

When presenting an original idea to others - it can be presented as a mash-up of couple of well known ideas.

Cloverfield = Blair Witch Project + Godzilla

LinkedIn = Facebook + Business Contacts

It will not cover all the nuances of your idea, but it will give your listeners some anchor to relate to that idea, which gives you a good start point.



Thursday, July 24, 2008

jQuery - Thickbox

Conditional statement for IE6

<!--[if lt IE 7]>
  <link rel="stylesheet" type="text/css" media="screen" href="other.css" />

lt - means "less then" - will link another css only for browsers less then IE7

Track mouse with jQuery


    $('p').html("X Axis : " + e.pageX + " | Y Axis " + e.pageY);



Saturday, July 19, 2008

ASP.NET: Retrieve data from a web page


ASP.NET: Custom Error Pages


ASP.NET: Extract data from a SQLDataSource to a DataTable


1. Dim dv As New System.Data.DataView  
2. Dim dt As New System.Data.DataTable  
3. dv = mySQLDataSource.Select(DataSourceSelectArguments.Empty)  
4. dt = dv.ToTable()

ASP.NET: Use C Sharp and VB.NET in the same project



Persisting data in a web app by using frames


Say you have your main page, which is just a frameset. All the navigation occurs within that frameset, such that going from page1 to page2 merely updates the frame's url, it doesn't re-create the host page. This leaves the host page intact, including it's JavaScript state. Therefore, you could have a JavaScript variable persist data between pages.

    <title>My App</title>
    <script language="javascript" type="text/javascript">
      var _javaScriptVar = null;
      <frame src="Page1.aspx" id="mainFrame">


You could then reference this variable from your child pages via the DOM:

window.parent._javaScriptVar = "someValue";



Jump between braces in Visual Studio

Put your cursor before or after the brace (your choice) and then press Ctrl+].


Wednesday, June 25, 2008

GridView ObjectDataSource Paging

Took me a lot of time to figure it out...

First, paging doesn't seem to work when ObjectDataSource Select function returns SqlDataReader so it returns DataView now.

The code looks like this:

   1: [DataObjectMethod(DataObjectMethodType.Select)]
   2:     public static DataView GetRows(int statusid, int experienceid, string submitter, string idsid, string SortExpression)
   3:     {
   5:         StringBuilder strSql = MainSelectSql(idsid, statusid, experienceid, submitter, SortExpression);
   7:         SqlConnection connection = Connection.GetConnection();
   8:         SqlCommand command = new SqlCommand(strSql.ToString(), connection);
   9:         command.CommandType = CommandType.Text;
  10:         SqlDataAdapter adapter = new SqlDataAdapter(command);
  12:         //connection.Open();
  13:         DataTable dt = new DataTable();
  14:         adapter.Fill(dt);
  15:         connection.Close();
  16:         int totalRecords = dt.Rows.Count;
  18:         DataView dw = new DataView(dt);
  20:         return dw;
  21:     }


The GridView has to have its "AllowPaging" set to true and PageIndexChanging method looks like this:

   1: protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
   2: {
   3:     GridView gv = (GridView)sender;
   4:     gv.PageIndex = e.NewPageIndex;
   5:     gv.DataBind();
   6: }


Also can change the page size in properties...

Saturday, June 21, 2008

SQL Server 2005- OVER() partition

This will be useful for GridView pagination:

An aggregate functions can be added to any SELECT (even without a GROUP BY clause) by specifying an OVER() partition for each function.

This means that this code:

   1: select 
   2:     o.customerID, o.productID, o.orderDate, o.orderAmount, t.Total
   3: from 
   4:     Orders o
   5: inner join 
   6:    (
   7:     select customerID, sum(orderAmount) as Total from Orders group by customerID
   8:    ) 
   9:   t on t.customerID = o.customerID
can be replaced with:
   1: select customerID,  productID, orderDate, orderAmount, 
   2:       sum(orderAmount) OVER (Partition by CustomerID) as Total
   3: from Orders


Monday, June 9, 2008

jQuery Selectors - How to Get Anything You Want

Great articles from Learning  jQuery blog:

How to Get Anything You Want - part 1

How to Get Anything You Want - part 2

Firefox popup blocker blocks ctrl-V from Google Reader

Found the solution on Google Groups (Google Reader Help):

1. In a Firefox window, enter "about:config" in the address bar.
2. In the "Filter" field, type "popup_maximum".
3. One preference, called "popup_maximum" appears; double-click the
"value" number.
4. Enter a new, appropriately large value. I used 2000, just to be on
the safe side.

Sunday, June 1, 2008

SQL - substring and charindex


   1: SELECT
   2:     substring(IdeaText,1,
   3:         charindex('//', IdeaText)
   4:     ) as part1
   5: FROM tblIdeas




Saturday, May 31, 2008

CSS Div overlay



Using jQuery to directly call ASP.NET AJAX page methods


   1: public partial class _Default : Page 
   2: {
   3:   [WebMethod]
   4:   public static string GetDate()
   5:   {
   6:     return DateTime.Now.ToString();
   7:   }
   8: }
   1: <html>
   2: <head>
   3:   <title>Calling a page method with jQuery</title>
   4:   <script type="text/javascript" src="jquery-1.2.6.min.js"></script>
   2:   <script type="text/javascript" src="Default.js">
   5: </head>
   6: <body>
   7:   <div id="Result">Click here for the time.</div>
   8: </body>
   9: </html>
   1: $(document).ready(function() {
   2:   // Add the page method call as an onclick handler for the div.
   3:   $("#Result").click(function() {
   4:     $.ajax({
   5:       type: "POST",
   6:       url: "Default.aspx/GetDate",
   7:       beforeSend: function(xhr) {
   8:         xhr.setRequestHeader("Content-type", 
   9:                              "application/json; charset=utf-8");
  10:       },
  11:       dataType: "json",
  12:       success: function(msg) {
  13:         // Replace the div's content with the page method's return.
  14:         $("#Result").text(msg.d);
  15:       }
  16:     });
  17:   });
  18: });