Monday, April 30, 2007

Weird Images...

If my images (especially my banner logo and MCP Logo in the right column) look funny to you, it's because I've decided to go with .PNG images for this website, and you're using an old browser.  This site looks great (ha, okay maybe not great) in Firefox and IE7, but not so much in IE6.  This is because Internet Explorer 6 did not support transparency in .PNG images.  Sorry.  If it really gets on your nerves, I would upgrade to Firefox.

Combo Boxes...

Combo Boxes in .NET 2.0 in a word, weird.

As you'll no doubt notice if you've seen our TireShop application, I like to use the early databinding features of Visual Studio 2005.  They're very easy and fairly powerful.  You connect to a database, generate your DataSet based on some tables, and then you bind your controls to the dataset.  Then, when you run your application, you'll have a little navigation strip which allows you to run through all of the records in the table that you're currently bound to.  Simple enough, right? 

So this works fine if you've got a couple of text fields, maybe for a Customer table you'll have a Customer_Id, First_Name, Last_Name, Address, etc.  No problems.  Databinding works, and it works fairly well.

Later on you're building the forms for you order table and the Customer_Id is a foreign key in the Order table from the Customer table.  Obviously the best way to put this all together is with a ComboBox, setting the ValueMember to Customer_ID and the DisplayMember to [something like] Customer_Name. 

Seems easy enough, in your DataSources window you just change the field from a TextBox to a ComboBox, setup your DataSource for the ComboBox rows and everything works quite nicely.  Man, that would be nice, huh? 

Drag your ComboBox onto the Form from the DataSources window and click on the QuickTasks button (the little arrow on the top-right, I can't remember the real name) and you should see something like this -->

Check the "Use data bound items" CheckBox and the menu magically transforms to something a little more like our friend to your left <--

Now we're in business. Just choose your DataSource (in our example you would choose the Customer table) and your display (Name) and value (Id) members.  One would assume that we could set our SelectedValue to the Customer_ID from the OrderTableBindingSource and all would be well with the world.  Well, we all know what happens when we assume, right?

Okay, stick with me here.  At this point, Visual Studio has generated us an OrderTableBindingSource which is going to set the Value of our Customer ComboBox to the Customer_ID of the customer which made the order. 

We've also got a CustomerBindingSource that's filling up the ComboBox list values with a Value list of Customer_ID and a Display list of Customer_Name.  Again, we would think that when the OrderBindingSource set the Value of the ComboBox to say, 3, then the ComboBox would Display the customer's name.

F5 it and see what happens.  If your Visual Studio is my Visual Studio, then your first record will do something like Display what should be the Value of the field.  Okay, now try and navigate to the next record.  What's that??  Now it Displays what should be the Display member.  Hey, looks like it's working now, huh?  Not quite.  Try to navigate to the next item.  Nothing?  Can't do it?  Like I said, it's weird.

I remember having this problem when I was originally writing TireShop, so I opened it up and looked at the code.  Low and behold, it's setup exactly like I've instructed here!  Crazy stuff going on here...

 

del.icio.us tags: , ,

Tuesday, April 24, 2007

How I learned CIS, by a graduating Senior

Today marks one week from the day that I will take my last final in my college career.  I have learned a lot of things and I have done a lot of work, and I honestly feel like I am a better person for the process.  I do not, however, feel that College has prepared me for a "real" job in the world of Computer Information Systems, so I've taken that upon myself.

Now, I personally have worked extremely hard throughout college.  I have gone through three jobs during those four years, each a step-up from the last, and there is no point during my college career (and most of high school) that I was without employment.  A little over 2 1/2 years ago I was still working at a small gas station for $5.65/hr on weekends when I got a call from a local bank offering me a job working as their help desk.  I jumped at the chance to get my nose into the IT field for $9.00/hr. 

Now I don't want anyone to be under the illusion that some IT manager just happened to call me up and offer me a help desk job; I would estimate that I was turned down no less than 20 times by everyone from the local computer shop to the county government.  I got a break, there's no denying it, but I took full advantage of it.

I started work at the bank as a Help Desk Technician on November 14, 2005.  While riding into work that day I was rear-ended by another vehicle and ended up two hours late, but that's a story for another day, this is a story about how I learned Information Technology.  Working the help desk was the best learning experience of my life.  I won't lie either, I was good.  We were a small group; myself, three technicians, and an IT Manager.  We supported about 350 employees at 20+ branches and as you can imagine everyone was expected to be a jack-of-all-trades and (most) were a master of none.  I quickly learned skills that I could never pick up in a classroom.  I took on every responsibility I could.  I wanted to know everything.  It was not long before I was as well (or better) versed at the bank's technology than anyone else.  I would estimate that I handled an average of 100 phone calls per day and closed 90% of those trouble tickets in 5-10 minutes.

As the others began to get some free time due to my efficiency they began to start fixing some of the bigger issues that were causing us problems, and I was right there in the mix.  I learned group policy, access control lists, citrix, Unix, networking; I soaked up knowledge like a sponge.  As problems were fixed and call numbers dropped, I was left to my own devices.  I began to take the manual processes I was doing on a daily basis and start finding ways to automate them.  I downloaded AutoIt and went to work on a script that would do a custom setup on our HP Thin Clients in seconds rather than the usual 15-20 minutes.  It was that point I knew that I wanted to be a developer.

After all of this time I was finally done with all of my general studies classes in College.  It took me 2+ years to actually get to take a REAL CIS class.  I was forced to take COBOL and VBA which were still, until this semester, the only programming languages I have been formally taught.  This is a joke.  There is absolutely no reason that I should have ever been forced to take COBOL, but I digress.  I did and I learned the fundamentals of computer programming.  I was off to the races.  I took my VBA knowledge and started teaching myself VB.NET using Microsoft's Free Visual Basic Express Edition.  I thought of college as a secondary citizen.  I focused on my work and the studies I was teaching myself, and I was able to completely breeze through the next few semesters of college taking night classes.  No college class ever challenged me to think the way that I challenged myself.  Often times I was two semesters ahead of the classes I was taking.

So, I learned VB.NET and eventually the need came to replace an application at the bank that they had been using for probably a decade.  The program was what the CSR's used to print starter checks using the MICR ink cartridges.  I offered my programming services to the IT Department and QwikChex was born.  Over a period of 3 months (while still performing my Help Desk duties of course) I developed an application to print temporary checks onto check stock, keep track of users, and log all actions.  We rolled it out and it was a HUGE SUCCESS.  I knew I wanted to go into software development.

Over Christmas break between the Fall '05 and Spring '06 semesters, I checked out an MCP exam book from the campus library and studied.  On January 11, 2006, I took and passed my MCP certification test for Windows Forms using VB.NET.  On January 12, 2006 I posted my resume to Monster.com.

Over the next few months I got several calls (probably 1-2 per week) and I also became active in the local .NET Users Group trying to network with some of Nashville's big .NET guys.  During the 7 months between January and November of 2007 I probably went to at least 8 interviews and was called back for a second interview on 2 of those occasions.  One company was actually about to give me an offer when they got a new CEO who froze hiring.  My work life was quickly degrading as I was no longer satisfied with my help desk position because I was so focused on .NET Development. 

The whirlwind of disappointment in so many failed attempts at finding a new job and the extreme disappointment in the classes I was taking made these few months some of the more miserable I have had in my 22 years.  My girlfriend (of almost 5 years now) was constantly trying to make me feel better, telling me that something would come up, but I started to quit looking and told myself that I would just wait until I graduated to look for something new. 

Then in August of 2006 I got a phone call from a publishing company in Nashville that was looking for someone with my skill set (Oracle skills in fact, one of the few REALLY GOOD classes I had taken in college).  I went in for an interview and it was an instant success.  I brought some of my sample code from my Oracle class and really answered all of the questions well.  Two days later I got a call from the company offering me a really good salary (like, good for someone that already has a degree).  The problem was, they wanted me to live in the Oracle PL/SQL world, and I wanted to be in .NETsville.  After the disappointment of the past few months though, I decided to take it and see where it went.

Today, 8 months later, I'm still working at the publishing house.  I spent my first three months working on an Oracle PL/SQL conversion and when I finished it, I was asked to start developing a CRM application using C# 2005.  I quickly accepted the challenge, and that's the project I'm still working on today.

My point is this, don't expect to go to college, major in Computer Information Systems, and leave with the knowledge to start the next Microsoft.  In the end your degree is just a peice of paper that shows that you can sit through 120-132 credit hours of college courses without quitting.  Take that job working the help desk your junior year even though you want to be a developer; you need your foot in the door.  Put aside a few weeks between semesters to get that certification (you can usually get student discounts on those, btw).  Go above and beyond what you're being taught in college, because you can bet there is someone else out there who is, and that's who you may be interviewing against.

 

Friday, April 20, 2007

Non-Profit Org. Member/Donor/Charity/Event Database

I've just uploaded an Access database that my group has created for one of my final college classes.  It's basic function is to help a non-profit organization keep track of it's members, donors, specific donations, charities, and events.  The file I just uploaded is about 90% complete, we still need to create an annual report as well as a few other things, but it's coming along (and will be done by next week).  I'll post a follow-up when I upload the final version.

Thursday, April 19, 2007

BitManip v0.9 Beta Released!

BitManip I've finally just been able to post the application I was talking about the other day.  It's a program that I wrote last summer when I was working for a bank. They used it to create thumbnails of customers for their Photo ID Debit Cards. 

Just drag a box around the customer's face, click crop, click Resize (default of 300x300), save and close.

It was designed with this in mind, but it can be used for several image/photo editing tasks.  You can download it here.

Tuesday, April 17, 2007

Update on CodePlex outage...

Well, I inquired this morning about the CodePlex outage and received this warm & fuzzy personalized response :-)

 

At 3pm PDT on April 11th an operator error occurred 
that caused source control and issue tracker data on 
one of the Microsoft CodePlex servers to be accidentally 
overwritten. During the standard data recovery effort, 
a recovery backup configuration oversight was discovered 
in the routine backup process for this CodePlex server 
which is currently impacting immediate restoration of 
the data.

Note: The content in the Wiki as well as the release files
have not been affected. This current outage only affects 
projects that were hosted on TFS03.

We are working on this situation as a matter of highest
priority. All affected projects will have their source control 
and issue tracker functionality restored soon but the status 
of the source control and issue tracker data remains unknown 
at this time. We will report back with a status update within 
96 hours.

We sincerely apologize for the inconvenience this may have
caused. The necessary corrections are already in place to 
ensure this situation will not occur again.
 

Ouch.  Hate those operator errors, accidental overwrites, and especially configuration oversights in routine backup processes...


 


del.icio.us tags:

How to handle CSV's with Leading Zeros in Excel

Sitting around work today we were working on exporting some data to excel when, of course, we ran into the age-old problem of Excel dropping leading zeros on numeric fields that should be treated as text (ISBN numbers in this case).  So, if an ISBN was 0-596-00712-4 (good book by the way) it would be stored in the DB as 0596007124 and when spooled out to a CSV file and opened in Excel, the leading "0" would be decapitated leaving us with 596007124.  Not good.

After trolling through forums and newsgroups, I found this thread which helped us get to an answer:

On the third day, the Lord said, "If you want to spool numeric data to a CSV file and have Excel treat it as text, you must qualify it with an equal sign (=) and wrap it in quotes!"

So our file ends up with some entries that look like this:

="0596007124", Head First Design Patterns, O'Reilly

="0735621721", Practical Guidelines and Best Practices, Microsoft Press

And the data's accuracy was kept intact, and it was good.

No data was lost or harmed in the writing of this post...

 

del.icio.us tags: ,

Monday, April 16, 2007

CodePlex Outage???

Well, I was going to post a new application tonight, but alas, it looks like the good folks at CodePlex have blown up their Team Foundation Server.  Interesting... considering Microsoft owns CodePlex!  

Really though, I guess anyone can sit around and complain about a service that the Microsapiens provide for free.  It's actually a great service and I highly recommend it. 

Speaking of good services, while I'm without a place to post my code I'll give Microsoft some much deserved props on the application that I'm actually using to write this post, Windows Live Writer.

del.icio.us tags: , ,

Saturday, April 14, 2007

SQL For Hours Worked...

Well, here's what I've come up with so far...  It seems to work fairly well.  This code currently assumes that the employee clocks in when they start the day, and clock out when they end the day, that is, the employees do not clock out for lunch.  Now, I know this is not a normal practice, but it happens to be true for the store that I am creating TireShop for so it will work.  I do plan on working it out later to accommodate clocking in our out as many times per day as needed.

Here's the SQL:

SELECT 
emp.First_Name,
emp.Last_Name,
Employee_Hours.Hours,
emp.Pay_Rate,
emp.Pay_Rate * Employee_Hours.Hours as Gross_Pay
FROM
(SELECT
a.Employee_Id,
ROUND(CAST(DateDiff(MINUTE, a.Date_Time, b.Date_Time) AS DECIMAL) / 60, 2) as Hours
FROM
dbo.Time_Punches a,
dbo.Time_Punches b
WHERE
a.Employee_Id = b.Employee_Id
AND
DatePart(DAY, a.Date_Time) = DatePart(DAY, b.Date_Time)
AND
a.Time_Punch_Id < b.Time_Punch_Id) Employee_Hours
JOIN
dbo.Employees emp
ON Employee_Hours.Employee_ID = emp.Employee_Id;
 
Still got some work to do...

Friday, April 13, 2007

Young & Dumb...

del.icio.us tags: ,

We here at Sleash Software are green when it comes to software & database design, and so when we sometimes hit a hitch (which happens fairly often) it can sometimes be hard to get over it and keep on plugging.  One problem I'm currently working on for our TireShop application is the problem of employees clocking in and out.  I've setup the database with a table with these fields:

  • Time_Punch_Id (Identity Integer, PK)
  • Employee_Id (Integer, FK to Employee Table)
  • Date_Time (DateTime of the Clock In/Out)
  • Clock_In (Bit)
  • Clock_Out (Bit)

Our original idea was the the Time_Punch_Id would be a sequential primary key for the table, Employee_Id would identify the employee (duh) the Date_Time would be a timestamp for the transaction, and then either Clock_In or Clock_Out would be set to True (1) and, with all of that information we could generate a report for payroll purposes.

The problem with this approach is writing the SQL that will pull the relevant information from this table.  You have relationships that link a table to itself but only by Employee_Id, and then you have to decide which Clock_In field relates to which Clock_Out field.

I've thought about creating a seperate table with a sort of Clock_Id that would create a sequence number used by both the Clock_In record and the Clock_Out record, but I've never thought about it long enough to try it out.

 

I do have an idea though!

I think maybe the best way to work this out is by aggregating the records by Employee_Id and Trunc(Date_Time).  Then you could get the Clock_Out date and time minus the Clock_In date and time.  I haven't had a chance to try this out yet, but I'll work on it soon...

Tuesday, April 10, 2007

EncapsulateAll Released!


We've just released a new C# project, EncapsulateAll. This program will take a list of private variable declarations (in C#) and generate the public properties to encapsulate those fields. We wrote it because we're tired of having to use the Visual Studio 2005 refactoring engine to encapsulate our fields 1 at a time. The code is simple, but the program seems to work like it's supposed to. Check it out if you're a C# developer!

Saturday, April 7, 2007

TireShop 0.1 Alpha Released


TireShop, a program I've been writing for a small Tire Shop (Get it?) has been released as an early alpha open source project. It uses the Microsoft Permissive License (Do with it what you want).


I feel that releasing this code is the only useful thing I could do with it. I know that if another company wants me to personalize and install it for them, I'm not losing that business by opening up the source code. If anyone learns anything from it, then it was worth writing (well, that and the money that I'm being paid for it :-)

You can pick up the code here.