KeyLimeTie Blog

Create a Web Layout with Adobe Photoshop

By Brian Pautsch – 10/24/2006. Posted to Thoughts.

Learn step by step how to create a web layout with Adobe Photoshop.
Really amazing and useful for web design beginners.

http://www.13dots.com/index.php?categoryid=33&p2_articleid=65

Free Photoshop-compatible Plugins

By Brian Pautsch – 10/22/2006. Posted to Thoughts.

Free Photoshop-compatible Plugins

http://thepluginsite.com/resources/freeps.htm

Gartner: Five reasons why offshore deals go bust

By Brian Pautsch – 10/18/2006. Posted to Thoughts.

Over the past few years, I have worked with companies that have used offshore resources to work on part of or complete projects. I also have been "hands on" with some of the projects and in my experience, it rarely works.

I was recently in a meeting discussing the possibility of offshoring some work. Since I have been down this road all too many times, I voiced my opinion. Most people also didn't like the idea and I took it upon myself to gather some facts. Now I know there are arguments for both sides, but when I was browsing the web I came across a study by Gartner Inc.

If you're not familiar with Gartner Inc., they are pretty much the authority on gathering, analyzing and reporting statistical data in an unbiased manner. Companies all over the world utilize Gartner's services to gather data on pretty much anything...and because they are so thorough, it's not cheap.

The 5 high level reasons are:
1. Unrealized cost savings
2. Loss of productivity
3. Poor commitment and communications
4. Cultural differences
5. Lack of offshore expertise and readiness

Click here read the entire article

The 18 Mistakes That Kill Startups

By Brian Pautsch – 10/16/2006. Posted to Thoughts.

I found this great article on the "18 Mistakes That Kill Startups", by Paul Graham.

I have been a part of several start ups, some successful, some not so successful.
A lot of the points Paul makes I have seen first hand.
I learned a few really good things from his article.

http://paulgraham.com/startupmistakes.html

21,600 Developers Email Addresses found with Google Code Search

By Brian Pautsch – 10/12/2006. Posted to Thoughts.

A few days ago, I blogged about how to find database credentials using Google Code Search.
Here's another interesting search:

Google Code Search supports regular expressions...try:

^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$

21,600 results with is probably at least 30,000 email addresses.

How to Add a WinForm DataGridView Header CheckBox

By Brian Pautsch – 10/10/2006. Posted to Code Snippets.

A recent project required that we figure out how to add a "Select All" checkbox to the header column header of a DataGridViewCheckBoxColumn Windows Forms. After searching the web for possible solutions, it became clear that the actual control cound not be added dynamically. The best approach we could find was to paint a checkbox image into the header and respond to the DataGridView's "ColumnHeaderMouseClick" event. Here's the solution in detail:

Download source code



1. Create a Resource File and add in the two attached images. When I dragged them in, they were renamed to “_checked” and “_unchecked”.

2. Declare a “Select All” private variable.
1privatebool _selectAll = false;
3. Wherever you bind your DataGridView (I did in Page_Load for this example), add in the checkbox column (unless you already have it in your design view).

1private void Form1_Load(object sender, EventArgs e)
2{
3    try
4 { 5 //Bind XML dataset to DataGridView
6 DataSet ds = new DataSet(); 7 ds.ReadXml(_xmlFilePath); 8 dataGridView1.DataSource = ds.Tables[0]; 9 //Add the checkbox column
10 dataGridView1.Columns.Insert(0, 11 new DataGridViewCheckBoxColumn()); 12 } 13 catch (Exception ex) 14 { 15 MessageBox.Show("Exception: " + ex.ToString()); 16 } 17}
4. Create the CellPainting Event.

1privatevoid dataGridView1_CellPainting(object sender, 
2    DataGridViewCellPaintingEventArgs e)
3{
4    //Is this the checkbox column header?
5 if (e.RowIndex == -1 && e.ColumnIndex == 0) 6 { 7 try
8 { 9 //Erase the cell
10 using (Brush backColorBrush = 11 new SolidBrush(e.CellStyle.BackColor)) 12 { 13 e.Graphics.FillRectangle(backColorBrush, e.CellBounds); 14 } 15
16 //Draw 1 bottom line...
17 e.Graphics.DrawLine(Pens.DarkGray, e.CellBounds.Left, 18 e.CellBounds.Bottom - 1, e.CellBounds.Right, e.CellBounds.Bottom - 1); 19 //Draw 2 top lines...
20 e.Graphics.DrawLine(Pens.DarkGray, e.CellBounds.Left, 21 e.CellBounds.Top, e.CellBounds.Right, e.CellBounds.Top); 22 e.Graphics.DrawLine(Pens.White, e.CellBounds.Left, 23 e.CellBounds.Top + 1, e.CellBounds.Right, e.CellBounds.Top + 1); 24 //Draw right line...
25 e.Graphics.DrawLine(Pens.DarkGray, e.CellBounds.Right - 1, 26 e.CellBounds.Top, e.CellBounds.Right - 1, e.CellBounds.Bottom); 27 //Draw left line...
28 e.Graphics.DrawLine(Pens.White, e.CellBounds.Left, 29 e.CellBounds.Top, e.CellBounds.Left, e.CellBounds.Bottom); 30
31 //Get the image from the resource file
32 Image imgChecked = (Image)Resource1._checked; 33 Image imgUnchecked = (Image)Resource1._unchecked; 34
35 //Determine paint coordinates
36 int X = e.CellBounds.Left + 37 ((e.CellBounds.Width - imgChecked.Width) / 2) - 1; 38 int Y = e.CellBounds.Top + 39 ((e.CellBounds.Height - imgChecked.Height) / 2) - 1; 40
41 //Draw checkbox in header
42 if (_selectAll) 43 e.Graphics.DrawImage(imgChecked, X, Y); 44 else
45 e.Graphics.DrawImage(imgUnchecked, X, Y); 46
47 //Set event as handled
48 e.Handled = true; 49 } 50 catch
51 { 52 //Handle exception
53 } 54 } 55}
5. Handle the Select All click event.

1privatevoid dataGridView1_ColumnHeaderMouseClick(object sender, 
2    DataGridViewCellMouseEventArgs e)
3{
4    if (e.ColumnIndex == 0)
5    {
6        _selectAll = !_selectAll;
7        for (int i = 0; i < dataGridView1.Rows.Count; i++)
8        {
9            dataGridView1.Rows[i].Cells[0].Value = _selectAll;
10        }
11    }
12}

Find Database Credentials with Google Code Search

By Brian Pautsch – 10/5/2006. Posted to Thoughts.

I was messing around with Google Code Search today and decided to see if people were dumb enough to publish web.config files with their private database credentials.

Yep...there are a few out there. Check out this example:

http://google.com/codesearch?hl=en&lr=&q=database+file%3A%22web.config%22&btnG=Search

Google Code Search

By Brian Pautsch – 10/4/2006. Posted to Thoughts.

Today, Google announced "Google Code Search":
http://www.google.com/codesearch

"It's a site that simplifies how software developers search for programming code to improve existing software or create new programs."

The Basic Search is OK, but you really need to check out the Advanced Search.
Here's you can specify a few things, most importantly the language.

In the example below, I search for "PayPal" in C# code.



Results return in code snippet format. Check out result #11...that's some amazing code!



Click into each result and the entire code file is displayed with links to related project files.

Photos on Flickr

More Photos »

Search Blog


Get Email Updates

Like what you read here at KeyLimeTie? Sign up for our email list!

Subscribe