Dave Murray Miyamasu is at it again, coding up some useful code for his ASP.NET projects. NEW! with .NET AND Java experience1
Tuesday, December 30, 2008
Developers Bill of Rights
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
- You can choose from other popular color schemes
- 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 HunterMonday, 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:
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:
- Vista or Server 2008
- Visual Studio 2008 SP1 or VS Web Express Version
- SQL Express 2005 or 2008 (if you already have a full version of SQL Server running, you must install Express as a new instance.
- .NET 3.5 SP1
- 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
Monday, November 3, 2008
Microsoft Certified!
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)
(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*
- 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!
- 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.
- 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
<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
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()
- Open file within the browser
- 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 browserResponse.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!!
Tuesday, January 22, 2008
Change Master Page styles based upon the current page
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
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
DateTime myBDay = "02/08/1982"; var AmIOldEnough = DateTime.Today >= myBDay.AddYears(25) ? true : false;