Tuesday, December 30, 2008

Developers Bill of Rights

I like to have a nice machine to do my development work. Do you? Here is a new proposed "Developers Bill of Rights" from CodingHorror.com

Link

Developer Ramp Up Time

Cool article on how to reduce the ramp-up time for new developers/consultants.

Link

Wednesday, November 26, 2008

CSS Color Scheme generator for the color-blind

Recently while building a sample site with Windows Azure, I found myself trying to determine the color scheme for my site. I determined that my lack of color coordination was stopping any real progress, so I went to Color Hunter to develop a color scheme for use on my site.

There are two key features that I found helpful

  1. You can choose from other popular color schemes
  2. You can upload your own picture and Color Hunter will extract the colors from the image and give you the matching colors.

If you have a minute, check it out. It is really cool and helped me sail through my CSS design phase.

Link to Color Hunter

Monday, November 24, 2008

Windows Azure PDC developer videos

I have watched a few of the PDC sessions that were really helpful for me to get started with development of Azure SDK. Here is a quick listing of some of them:

  • Watch Steve Marx write a simple app with Azure.
    link
  • Brad Calder goes a little bit more in-depth with Azure storage.
    link
  • See how NSoftware and FullArmor have utilized the Azure cloud services
    link

Windows Azure Developer Starter Guide

Recently, I started to look into development on the Windows Azure CTP platform with the release of the SDK.  I am going to write a developers guide to getting started with Azure CTP.  Let’s get started!

  • Software Requirements:
  • Once you have all the required software on your machine, you need to install the SDK and the VS plug-in. The plug-in adds a project template to VS so that you can create a project with the appropriate web and worker roles.
  • The SDK installs two main working components: The development storage service and the Azure fabric.  These two components have UI monitoring tools that allow you to view process/tracing information and service statuses.  You can manually start these services by going to your Start menu > Programs > Windows Azure SDK (but for the sake of this tutorial, wait until the next step to start the services).
  • To start up your local Azure fabric and development storage, navigate to and execute the batch file ~/Program Files/Windows Azure SDK/Samples/RunDevStore.cmd . This will build your sample projects, start the Azure fabric and dev storage and create the appropriate storage structure.  You can start one of the apps from the command line by navigating to the root folder of an app (ex. HelloWorld) and executing the runme.cmd file.
  • Lets code (dave code)!  Open Visual Studio (as Administrator) and create a new project:
    • select Cloud Services from the Visual C# project type
    • In the Templates list, select Web Cloud Service. This creates a web role.  This web role handles http requests and serves up ASP. NET pages. If you choose the template that has both web and worker role, you will see the worker role is added.  This worker role acts as a service running locally that can interact with the development storage, role manager, etc.
    • In your project, open up Default.aspx and change some text.  Hit F5 and you will see your changes in the browser.
    • Storage Client Library:  Open up the sample project title Storage Client Library, you will notice that there is a whole library of classes and methods for interacting with the development storage.  If you add this project to your solution you can debug through and see how it works.  You can utilized the exposed classes to write your own Azure apps.  See the SDK sample apps for examples on how to use the Storage Client Library. (This library is based on the ADO.NET data services.  If you have had experience with ADO.NET, you may have dealt with DataServiceContext class.  If you are interested in looking at the plumbing of the Storage Client Library, you will see plenty of ADO.NET classes leveraged.)

I hope this tutorial has been helpful for you.  Please drop me a line if you have any questions about getting started.

Wednesday, November 19, 2008

Ninja Cats

I had to share this commercial featuring ninja cat. Enjoy :-)

Ok-I must give in. Initialize(LOL cats);

cat

Monday, November 3, 2008

Microsoft Certified!

I just recently gained my MCTS Web Apps certification. What does this mean? It means I took two exams focused on using the ।NET Framework 2.0 to develop web applications. Here is my cool new logo:

Thursday, October 9, 2008

How to read disk drive information using C#

I just came across some cool C# code while preparing for the Microsoft 70-536 exam. Using the Windows Management Instrumentation (WMI), you can inspect a machine for available disk drives. Add the System.Management assembly as a reference in your project, and off you go:

ManagementScope DemoScope=new ManagementScope("\\\\enter_machine_name_here\\root\\cimv2");
ObjectQuery DemoQuery = new ObjectQuery("SELECT Size, Name FROM Win32_LogicalDisk WHERE DriveType=3");
ManagementObjectSearcher DemoSearcher = new ManagementObjectSearcher(DemoScope, DemoQuery);
ManagementObjectCollection AllObjects = DemoSearcher.Get();
foreach (ManagementObject DemoObject in AllObjects)
{
Console.WriteLine("Resource Name:" + DemoObject["Name"].ToString());
Console.WriteLine("Resource Size:" + DemoObject["Size"].ToString());
}
Console.Read();

Thursday, October 2, 2008

Where does my stuff come from?

If you have ever wondered where the casing from your cell phone was made, or how much of an impact throwing away a juice box makes on environment, this video is for you. I found Story of Stuff linked on Damien Rice’s MySpace page. The website shows a very well done video explanation of where “stuff” comes from. Not only where it comes from, but we should think twice about using that stuff.

SPOILER WARNING: This video is not a I-feel-so-guilty-I-am-going-to-live-in-a-shack-in-the-woods kind of presentation. It was produced to let everyday people know that there is a story behind our large amounts of stuff. It does not just appear magically on the shelves at Kroger.

Link: Story of Stuff

Saturday, August 30, 2008

Soccer is a google Beta - Football is a Microsoft release (Process vs Result)

Here is an interesting article about how American Football embodies American result-driven, instant gratification mentality, and how Soccer is quite the opposite.
(This article chronicles a Twitter 'tweet thread'...and no I am not going to join Twitter)
Fill in the blanks, everybody: Soccer is ____. Football is _____. Football is American because ____.
Read the article on Buzzmachine

Monday, July 14, 2008

Lessons in managing (from a developers prospective)

If you are feeling stressed about the deadline of your project, it is natural to feel the urge to crack the whip and be on your teammates backs. However, after my recent experience in which I was responsible for making sure our code was delivered on time, I have learned that micro-managing others is not a good approach.

If you are a developer, it is more than likely you know the feeling of having someone watching your every move. I don't know about others, but I don't like it. As a professional, I make every effort to make the most of my time. Having someone telling me to work faster only works the first two or three time....then it becomes bothersome.

So, if you are feeling like you are becoming "that guy" who is micromanaging your employees, try to re-align your outlook with these few guidelines*

  1. Challenge yourself to find a 20/80 balance. Use 20% of your time to manage others, and 80% of your time to accomplish your tasks. Take the focus off of making sure your employees are completing your work, and make sure you complete yours!
  2. Communicate your concerns/fears to your superior. If you are feeling too stressed out to deal with all the issues/blocks, or you don't think you can meet the deadline: TALK TO YOUR SUPERIOR! It is their job to make sure you get your job done.
  3. Following my previous point, don't release your frustration on those below you. Release your burdens upwards, not downward. Those below you will just feel depressed if you unload on them. Those above you can actually help you overcome those issues.

I hope you find this helpful!

*Thanks to Jeff Hunsaker for sharing his wisdom and experience

Friday, June 27, 2008

Star Wars Telnet

If you have a few minutes and an internet connection, then you might be interested in watching the famed motion picture, Star Wars! .....in your command prompt window ;-)

  • Start
  • Run...
  • type this into the command prompt: telnet towel.blinkenlights.nl
  • Enjoy!

Monday, June 16, 2008

IE (5.5,6,7,8) version testing de-mystified

As a result of recently passing the 70-528 exam, I decided to start sharing my vast knowledge of ASP.NET with the world (ha). Ok, so really I just wanted to test my abilities by responding to some forum posts on www.asp.net/forums. I have made some good suggestions (IMO) and have sent some links to people with some ideas on how to overcome their problem.

One post that I made recently was in regards to a question about how to best test different versions of IE when dealing with UI issues, such as CSS and javascript. I posted some links about some solutions I have come up with over my 2 years of web development.

  • IE 6 VPC: This is a great tool for any developer who already utilizes Microsoft Virtual PC 2007. As we all know, you cannot install two versions of IE on your machine at once. But, if you have two instances of WinXP running on your machine, you can have a different version in each one! Once you have MS VPC 2007 installed, you can run the VPC on your local machine, and test your web app with both your local machines version of IE(7 or 8), and the VPC (IE6)
    Download Virtual HD here.
  • IE Developer Toolbar & IE7PRO: If you are running IE7 and want to see the DOM, CSS, javascript, generated source, etc, then you need to download these tools. IE Developer Toolbar was developer for IE by the IE team. This tool allows you to click on UI elements, and see source HTML information. You can navigate through the dom visually and do a lot of other cool things. The other tool is IE7Pro. It allows you to have many useful pieces of functionality that you don't get from IE7 out of the box. Improved tabbed browsing functionality, view generated source, and many more useful features that you might miss if you have been using Firefox recently.
  • IETesterThis tool shows a side by side comparison of how a web page renders. You can choose the rendering engines all the way back to IE5.5 up to the new beta IE8. If you use this tool extensively, send me your feedback as I am curious to hear what others think of it.
    Download IE Tester Here

Ok, that is about it for IE testing utilities. Hope this helps you out!

Monday, April 14, 2008

Google CHARTS api

In case you may need a simple charting solution, Google offers a great API for simple charts. Check it out below: All this took was an <img> tag with the source pointing to Google's chart api. http://chart.apis.google.com/chart?cht=
<img src="http://chart.apis.google.com/chart?cht=p3&chd=t:60,30,10&chs=450x100&chl=Code|Dave|Code!" />

Tuesday, April 8, 2008

Geek Speak > Not as cool as you may think

I came across this article today on Google Reader. It teaches a great lesson for any deveoper who interacts directly with non-technical users/clients.
Much like the elusive African dancing monkey who does a fantastic version of the Electric Slide to confuse their natural enemies; developers have the ability to sway entire debates in their favor by confusing their enemies with technical jargon. After all, who can argue with someone when they have no clue what the other person is talking about?

Monday, February 25, 2008

Save server memory with Response.TransmitFile()

So, two common tasks that I encounter when sending files to the browser:
  1. Open file within the browser
  2. Open "file download" dialog box

I used to use the Response.Write() method, but recently came across the Response.TransmitFile() method. This method directly writes the file to the HTTP response stream and saves you from hogging up memory on the server.

1) Open file within the browser
Response.ContentType = "application/pdf";
//write file to the browser without saving file in server memory
Response.TransmitFile("c:\docs\pdfs\test1_1.pdf");
Response.End();
2) Open "file download" dialog box
Response.ContentType = "application/pdf";
//add 'attachment' header to open 'file download' dialog box
Response.AddHeader("content-disposition", "attachment; filename=test1_1.pdf");
//write file to the browser without saving file in server memory
Response.TransmitFile("c:\docs\pdfs\test1_1.pdf");
Response.End();

Some other types of "write" methods that exist in the System.Web.HttpResponse class are

  • BinaryWrite()- use this method to output a file that is stored in a Base64 string format
    Response.BinaryWrite(Convert.FromBase64String(EncodedDocument));
  • WriteFile()-use this method if you desire for the file to be stored in memory, or if the file is already in memory. This method is expensive because it stores the file object in memory, then transmits to the client.
  • Write() -there are a few overloads for the type of objects that Write() can send to the client. It is a flexible method and TransmitFile() or BinaryWrite() may better fit your specific needs

Thursday, February 14, 2008

Indiana Jones Trailer!!

The fourth installment of Indy! http://gizmodo.com/356366/indiana-jones-iv-trailer-makes-us-wet-our-pants

Tuesday, January 22, 2008

Change Master Page styles based upon the current page

In ASP.NET, a common practice is to create a master page, and expose content regions to the .aspx pages to hold page-specific content. One way that you can dynamically change the Masterpage content (i.e. add/remove asp controls, change style values) is to determine the actual page name (xyz.aspx) that is going to be displayed.
string filePath = Context.Request.FilePath;
string pageName = filePath.Substring(filePath.LastIndexOf('/') + 1);
//pageName will now hold the name of the file requested


Once we figure out which page is being requested, we can handle the behavior.

For example, if the page "NoBorderTables.aspx" should set all the tables to have no border, you can execute some code like this:
 protected void Page_Load(object sender, EventArgs e)
        {
            
            if(!IsPostBack)
            {
                string filePath = Context.Request.FilePath;
                string pageName = filePath.Substring(filePath.LastIndexOf('/') + 1);
                
                switch(pageName.ToLower())
                {
                    case "NoBorderTables.aspx":
                         foreach (Table t in this.Page.Controls)
                         {
                           t.BorderStyle = BorderStyle.None;
                         }
                         break;
                 )
             )
         }
                    

Friday, January 18, 2008

Gridview - Delete a row

So, I recently developed an ASP:Gridview to display a list of documents. I was having some problems accessing the datakey of the row that the "delete" button resided in. I looked around a bit, and I found a resolution on the asp.net forums. It turns out that the GridViewDeleteEventArgs object contains the current row index. The DataKeys of the gridview are stored in the same order of the row indexes. You can access the DataKey (which in my case was the document ID number) by getting the GridView.DataKeys[e.RowIndex].

Codebehind event handler for when "delete" button is clicked notice how the event handler event args type is set to "GridViewDeleteEventArgs"
protected void DeleteDocument(object sender, GridViewDeleteEventArgs e)
{         

        int DocID = Convert.ToInt32(this.ListOfDocumentsGridview.DataKeys[e.RowIndex].Value);

        Document.DeleteByID(DocID);

}

Monday, January 14, 2008

C# ternary if

Just to get some exposure for pretty specific searches, I wanted to give some examples of the ternary "if" statement in C#: If you would like to set a variable by an "if...else" condition, it can be done with the ternary if statement. (Notice I am also using the new .NET 3.5 "var" to declare my variable). In the example below, I want to see if I am old enough (25 yrs old) to rent a car without the "underage" fee. Is today 25 years or more from my date of birth:
DateTime myBDay = "02/08/1982";
var AmIOldEnough = DateTime.Today >= myBDay.AddYears(25) ? true : false;