Posts

Showing posts from 2010

Create System Image in Windows 7

I am currently doing some backup and restore research for a current tasking and found this cool feature in Windows 7.  You can actually create an image of your system by going to the Control Panel->Back Up and Restore.  Once you are there, you can click on create system image and voila in (I am guessing) a few minutes you should have an image of your system.

Putting Files on the Rackspace File Cloud

Recently, I’ve been playing around with Asp.Net MVC and I (along with some friends) am creating an Asp.Net MVC application that can access files from our website. This means that files must display on the site as well as provide a way to download/upload them. I won’t give away all the details of the project but I will say this: Sharing photos is one of the driving forces for our project.  The files are only image type files( jpg, etc) The files must be uploaded by the users and stored somewhere within our system.  We don’t necessarily know at this time how much storage space we need but we think that we will need a little at first but possibly a lot more down the road. This means that the storage of these files must be scalable. The uploading of files must be controlled by our system.  Right off the bat we started our application and were uploading files to the web server with no problem.  We only did it this way to kind of prove our system model. We wer...

What is "good code"?

I was asked today to describe "good code".  Here is my response to that question: How do you define “good code”? “Good code” is code that functions. “Good code” is code that does what it’s supposed to do. After all, with so many applications in production, can most of that code be below average or “bad code”? However I am not interested in writing “good code”. I am interested in writing great code. I like writing code that does what it’s supposed to do and reads like it’s supposed to read. Great code does not make the reader ask “WTF?!” when reading it. Great code is code that all programmers aspire to write in their careers but only a persistent few ever do. Great code is based on the concepts that universities teach but professors fail to teach you how. Great code is code that is loosely coupled, highly cohesive, highly readable and as a result highly maintainable. Great code is that which is appreciated more by the developer that maintains it, than the one who creat...

Setting the default oracle database using the commandline

I am only blogging this piece because I always forget how to do it.    If you have multiple Oracle databases in your box and you want to run against the default database, it can sometimes be a challenge.  To set the default database from the command line enter the following command C:\>set db=mydatabase

Coordinating An Event

Recently I've been involved in helping with coordinating an event.  Actually I am not involved with the coordination but since I am the techy in the circle, you guessed it, I am tasked with anything and everything related to technology.  This could be something as simple as creating a word document.  Yes a word document can be considered a technology task to some at least in my circle.   I have found that helping out with these types of tasks usually brings up all kinds of ideas to mind.  I always start out very excited because I start thinking that I will create this thing to fill this need.  Unfortunately a brief search I discovered that what I need is already available.  These ideas pop-up because real people trying to do real things tend to trigger real ideas.  In this effort I realized that one of the critical things necessary for coordinating the event was to create some sort of web presence.  At first I decided to cr...

Albacore

Derek Bailey , of Los Techies , came out to talk to the Central Texas Dot Net Users group about this tool named Albacore .  I will not even attempt to summariz e the features and capabilities of Albacore .  It appears to be an awesome tool for a variety of reasons.  It does not use XML It uses Ruby and as such it is a first class citizen, unlike NAnt The syntax is extremely clean and readable. If you have to do any type of automated builds, it seems that this will save you tons of time if you use this instead of NAnt Prior to the engagement I had read Derick's article, Building .Net Systems with Ruby, Rake and Albacore , about the subject in this month's CODE magazine.  Let me tell you that the article does do the Albacore libraries justice.  The article is well written but for someone who does not know Ruby, the article went over my head. Derick did an outstanding job of taking us through all the steps in getting Albacore up an...

Web Devs Have More Fun

Lately I've been working extensively with XML, XSDs, CSS, HTML as well as JavaScript.  Why all the technologies at once, you ask.  Well I am in this XML graduate course.  The class name is XML and it covers it from every angle.  Like I said it covered pretty much every aspect of it, to include DTDs and XHTML. I've been having a blast in the past few days.  I can't believe I have been coding for so long without touching much of these technologies.  I had forgotten how much fun all these things outside of C# were. At first it was a little painful, I must admit.  The lack of familiriaty with the tools made me feel like I was handicapped at times.  I have built so much of a dependency on Visual Studio and the Plug In tools like R# that using plain text editors or other tools is quite laborious. After I got past most of that pain and became more acquainted with the languages (XSL, XPath, CSS, JavaScript), programm...

WinDirStat

Ok, so I didn't think that WinDirStat deserved it's own blog entry and I wasn't going to enter it but since I quickly exceeded my Tweet limitation.  Here it is: I discovered WinDirStat the same day I discovered one note. You can find WinDirStat at http://windirstat.info/ . If you are not using this tool you should be. WinDirStat helps you identify where your hard drive space has gone. It also has some features to help you clean it.   WinDirStat categorizes your file comsumption into nice little compartments complete with color coding to enable you to quickly see where the biggest folders are.   All the different file types are color coded against a map view so you can easily see which types of files your query area contains. The best part about WinDirStat is that it is completely free (as in free beer). Enjoy!

Wohoo! I Discovered One Note

So I am sitting at my desk today and as I am doing some research I decide that I need to take some notes.  My first thought was to pull my paper notepad and jot down some notes.   I am simple guy so I use notepad quite extensively for many simple tasks.   However, as I've gathered more and more information I have come to realized how inefficient this method of storing notes is.  For one I tend to forget where I stored something. For another I also tend to forget what I named a filed. So I though "Hey what if there was a notepad tool that could handle the management of notes for me". No not like the windows notepad.exe but like a real notepad where you could take notes on one page and save them.  Then you could come back to them, search them, re-read them, back them up, etc.  It would be extremely cool to delegate the management of files to something other than myself.  I started talking to a co-worker about it and he said "I'm sure that thi...

Feemo

I have recently checked in a new project into code google. The project name came out of a play on words File Mover but since fimo would make the i sound kind of strange in my opinion. I changed the spelling to two e's instead so that the i could only be pronounced one way. Anyway, the concept behind Feemo is simple - to allow me to perform tedious repeatable folder manipulation tasks quickly and easily. I was recently inspired by Martin Fowler's talk on Domain Specific Languages(DSL) and therefore I decided to create it in a way that the DSL can specify the instructions and then the FeemoRunner can take over and process them. If you are interested in something like this, take a look at the project. Currently it is not ready for delivery it still has quite a way to go before it can be used but I project that I can get enough going to perform some of the basic operations like processing the clean folder commands and move folder commands in the very near future. I am also enr...

Developing with C# 2008 Express Part 1

So not everyone can afford to shell out the money for the professional version of Visual Studio. That should not stop anyone from pursuing their passion or even satisfying their curiosity of developing in the dot net world. Recently a friend requested that I coach him on learning C# and OOP for a program that he wants to write. He has been programming, but his experience is mostly with a procedural language of some sort, classic VB and VBA I believe. He does not have Visual Studio Professional so he decided to go with C# 2008 Express Edition. Just so that I could coach him appropriately, I figured that we both needed to develop in the same environment. That way we could both work on the same project. This is mostly because C# Express projects cannot be opened by professional editions of Visual Studio and vise versa. You normally have to port over your projects manually from one to the other. You do this enough times and it becomes somewhat of a pain. Therefore we decided to stick with ...
I found a totally cool gem today. We found the following command on the website http://forums.virtualbox.org/viewtopic.php?p=33678 . Scenario: when cloning a VDI (virtual box image) image you may want to use that VDI image as the base for an additional image Symptoms: A hard disk with UUID {23a663ea-a1a1-a2ea-9a34-1368b30ea813} or with the same properties ('D:\VBOX\VDI\XP_Work_Template_20GB.vmdk') is already registered. Example: You have an image with MYAPP 1.02. Now you want an image with MYAPP 1.03 but you still want to keep your copy of 1.02. You now will have a problem with mounting both images on the same box since they both have the same UUID. To resolve this issue run the following from the command line. In our case we had to first navigate to C:\program files\sun\virtual box\ then we ran it. Replace mydisk.vdi with the full path to your actual vdi file you need a UUID for. c:\>VBoxManage internalcommands setvdiuuid mydisk.vdi

Navigating a Folder and Its Subfolders

A colleague recently discovered how to navigate a folder using recursion (in C#). He took me back in time when I wrote a function that would delete any given folder. The application was coded as a simple console program in C++. You basically entered what folder you wanted to delete and it would delete it. The program was just a proof of concept... sort of a demo for someone who needed to know how to navigate the folder in C++. In this case the objective was to show how to delete a folder and it's subfolders. The funny thing is someone deleted most of their C:\ drive when they entered "C:\\" at the prompt that read "Enter the dir path...". Here is a link to the full post. Notice the last two entries by t_rex and *ClownPimp. http://cboard.cprogramming.com/cplusplus-programming/40209-deleting-folders-sub-folders.html I see why people distribute licenses and disclaimers with any of their software. I am glad it was not a PHD candidate's hard drive.

Accepting PayPal Payments on your Website

How to Accept Paypal Payments on Your Website Introduction Recently I helped out in creating a simple website for an upcoming re-union. The reunion consists of several events - one of which is semi-formal gathering. This gathering requires reservations of a local ball room and as such the website needs to do more than just inform the guests. It must also provide a way to accept payments and book them directly. Since PayPal is a popular type of online payment and can also collect all the necessary information, it is ideal for this type of transaction. PayPal provides the capability to link your website directly to the PayPal allowing your patrons to purchase whatever product you setup through PayPal . This eleminitates the need for you to do any real programming or worse hiring some expensive web developement . Since I accomplished this small feat I've had many requests on how to do this, so I have decided to print the instructions and share them with the world. Those instruc...

Using Windows API from C#

Recently a function in our application stopped working for some reason. We were using the WMI with the .Net Framework 3.5 in C# to determine the amount of freespace on a floppy diskette. For some reason after we upgraded from .Net framework 1.1 and from XP SP2 to XP SP3 the function stopped working. We tried searching alternatives and determining the cause to no avail. Our project lead suggested we attemp to use the Windows API directly instead. If that were to fail then there would not be much else to do. To our surprise accessing the Windows API worked. Below is the sample code. This is only a sample of how you can still leverage the API directly to work around issues from time to time. //This is the WindowsApi.cs file using System; using System.Runtime.InteropServices; namespace MAT.Common.Utils { public class WindowsApi { [DllImport("Kernel32")] public static extern bool GetDiskFreeSpace( [MarshalAs(UnmanagedType.LPStr)]string lp...

Tips for resolving a bug

In a perfect world there would be little need for debugging. Unit tests would be in place for all existing code and whenever a spot was missed a test would simply be added to cover the whole. In the real world or at least the world that I work in there is much legacy code. There also other things that affect system functionality such as system complexity - our app is close to two million lines of code, familiarity with the system, developer experience. These things require the developers to follow a structure format when resolving new bugs. Here are some tips that I came up with and passed down to my team. The steps don’t have to be done in the exact order but they should be done prior to sending the ticket up for code review. 1. Duplicate the error If you can’t duplicate the error don’t move beyond this step. At this point do whatever you have to do see the error for yourself in your box. Do not even think about fixing code that will work in theory. I have been bitten by ...