Blog

Categories

  • No categories

SEARCH

Windy City Rails

WindyCityRails - September 11, 2010 - Attendee

Windy City Rails – the Next Step

Posted in: Programming by Steve on August 3, 2010

In my quest to become a better programmer, I have started to learn how to do some simple things in Ruby on Rails.  I have gotten to the point where I need to find others in this area that can be a mentor to me to help prod me along.

So, I have registered to attend Windy City Rails.

I hope to learn a lot there and to meet a few of the people I follow on twitter as well.

Hawks Win!

Posted in: Sports by Steve on June 9, 2010

2cyhbbn

Writing from my iPad

Posted in: General by Steve on May 26, 2010

This is my first post written directly on my iPad. This device has made our lives more interesting and has a lot uses for children. I’ve enjoyed the initial experience with the iPad and I think the rest of my family has as well. I would say the games and coloring style apps have been the most enjoyable, along with the ability to stream movies and videos.

The apps that I have installed on here are:

  • Air Video – stream video from a server directly to the iPad
  • Netflix – mandatory for video
  • Plants vs. Zombies – my wife truly enjoys this game, much to my amusement
  • Flight Control HD – I have a thing for planes
  • RadarScope – Level 2 radar at your fingertips, along with Spotter Network integration make for an awesome experience
  • X-Plane – again, an excellent flight simulator

The one thing I am surprised with is reading books. I thought that it would be different because of the backlit screen and my eyes would hurt, but I haven’t had any problems picking up the iPad to read a nice book on Python.

Overall, I am extremely happy we purchased the iPad.


UPDATE: I forgot to mention GoodReader which is an awesome app to manage documents.

How to Verify Your Stored Procedures

Posted in: Programming by Steve on May 5, 2010

One of the things I’ve been trying to do is to eliminate the unnecessary stored procedures from our project.  Currently, we have about 150 left, but a lot of them are still used.  Some of them are still left over and no longer are called from our application.  As I was building a new SQL install script, I was trying to run a script of all stored procedures in one database and create them all in a new one.  I found that some of them no longer would work because of changes we’ve made to the database that have broken these stored procedures without even knowing. 

I asked on twitter how this could be done and Argenis Fernandez (@afernandez) suggested that I look into a Powershell script to verify stored procedures still work.

After some investigation on how Powershell and SQL work together, I scraped together this script:

$server = "localhost";		# The SQL Server instance name
$database = "MyDatabase";		# The database name

# Load the SMO assembly
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO") | out-null

# Create the SMO objects
$srv = New-Object "Microsoft.SqlServer.Management.SMO.Server" $server;
$db = New-Object ("Microsoft.SqlServer.Management.SMO.Database");

# Get the database
$db = $srv.Databases[$database];

# For each stored procedure in the database
foreach($proc in $db.StoredProcedures)
{
    # NOTE: my stored procedures are all prefixed with "web_"
    if ($proc.Name.StartsWith("web_"))
	{
        $proc.TextBody = $proc.TextBody;
        $proc.Alter();
    }
}

If any error occurs, it will display which procedure name did not get altered properly.

In my application, all my stored procedures that I use in the websites are prefixed with “web_”.  This made it easy to check if the procedures used still work. 

Adding Another Piece to My Mac-universe?

Posted in: Family, Home by Steve on April 23, 2010

ipadSo after getting my first Macbook, I am again considering adding another Apple product.  This time, it’s not just for me.

The iPad looks like a wonderful device.  I can see myself using it for the web and email quite frequently on the couch and with my son (2 years old already, wow).  The app store would be wonderful for getting game for him to play.  We would be able to play videos and music for him in the car.  We are also embarking on a vacation soon and he is going on his first airplane ride. 

I am looking to minimize the inconvenience for all parties involved, including my son.  I would like to keep his attention for more than an hour watching the Muppet Show or Clone Wars and not thinking about the fact that he is flying.  The pressure changes are going to be hard enough.  Between any apps that I get and the videos, I’m hoping that instead of bringing my laptop, the iPad will be easier to bring with on the trip and take less room. 

I’ve searched and found a few toddler apps on the store, but since I don’t have an iPod or iPhone, this will be my first experience with the app store.  What apps to people with kids install?

I am still mulling over this idea, considering every bullet point before pulling the trigger.  If you have any suggestions, I’m willing to hear them.

SQL Query Madness

Posted in: Programming by Steve on April 15, 2010

I would consider myself to be pretty good with database design and queries, but this one has me stumped.

Our application allows administrators to add “User Properties” in order for them to be able to tailor the system to match their own HR systems.  For example, if your company has departments, you can define “Departments” in the Properties table and then add values that correspond to “Departments” such as “Jewelry”, “Electronics” etc…  You are then able to assign a department to users.

Here is the schema:

image

In this schema, a user can have only one UserPropertyValue per Property, but doesn’t have to have a value for the property.

I am trying to build a query that can use the PropertyValues as the filter for users.  My query looks like this (SQL Server 2005):

SELECT UserLogin, FirstName, LastName
FROM Users U
LEFT OUTER JOIN UserPropertyValues UPV
	ON U.ID = UPV.UserID
WHERE UPV.PropertyValueID IN (1, 5)

When I run this, if the user has ANY of the property values, they are returned.  What I would like to have is where this query will return users that have values BY PROPERTY.

So if PropertyValueID = 1 is of Department (Jewelry), and PropertyValueID = 5 is of EmploymentType (Full Time), I want to return all users that are in Department Jewelry that are EmployeeType of Full Time, can this be done?

I’m not sure how this can be accomplished without building dynamic SQL, so I thought I would throw this out to see what I could find.


UPDATE:

I posted this question on StackOverflow to see if there are any more ideas

http://stackoverflow.com/questions/2647570/where-clause-on-joined-table-used-for-user-defined-key-value-pairs

My First Rails Application

Posted in: Programming by Steve on April 2, 2010

After CodeMash, I decided it was time to see what the hubub was about with rails, so I picked up a Mac, a few books and a lot of beer.  The result is my first website built using rails and Heroku.  There’s not much to it right now other than my resume, but I’m looking at building a contact form as well.   So it’s not much of an application other than an HTML page rendered using rails, but at least it’s the start of something new.

stephenwright.name

stephenwright.name

 

Here’s to learning more in the coming months!

I’ve embarked on a new career

Posted in: General by Steve on April 1, 2010

I have decided that programming is no longer a viable career, so I have decided to being mentoring under Eduard Khil:

A thank you note to the City of Aurora

Posted in: Home by Steve on March 4, 2010

Thanks for the lawn maintenance.  I didn’t realize that my taxes were paying for an excellent service.  I hope to see you again next winter.

2010-03-03 17.43.28

Jerks

New Laptop – I’m a Mac

Posted in: Programming by Steve on February 1, 2010

Macbook After going back and forth between getting a Dell, HP Envy or Asus, I decided to go outside of my comfort zone and bought a Macbook.

The reason I got it was because I wanted to learn a new programming language and to see how the other side lives.  Codemash taught me that if I want to get better as a programmer, I have to widen my experiences to more than just .NET. 

So this is the first step to jump start my learning.  I hope to upgrade it so a better hard drive (SSD), more memory and to get the new Speck soft satin case (and a travel case too).  I will be blogging more about the experience of OS-X vs Windows along with attempting to learn Ruby on Rails.