Outlet ORM

30 01 2009

If you’ve ever tried to use an ORM to create a data layer in PHP, then you know its not always as easy as it seems. Not to mention if you actually have to change a relationship, you could be digging through thousands of lines of code for days. Not anymore, a friend of mine has created Outlet ORM, although in its early versions it’s well worth taking the time to learn.

I think that he does a fantastic job of explaining outlet:

“Outlet is an open source object-to-relational mapping tool for PHP.

It differs from other orm solutions for php in that it provides transparent, unobtrusive persistence. It does not require your entity objects to implement any interfaces or extend some sort of base class. It is also very lightweight, only a handful of classes and tools.

It uses an approach similar to hibernate in java, using proxy objects that save the data behind the scenes.”

From my experience so far its a fantastic tool to work with in PHP, it has definitely made my work in PHP quicker and more organized by creating objects for my database calls. It also takes care of saving/updating/deleting items for me in one easy call, EVEN if they relate to something else and need to be deleted. Great tool, check it out at http://www.outlet-orm.org.


Excel 1904/1900 Calendar. Confusing.

11 11 2008

Recently I had quite a fun experience with Excel and Mac/PC compliance. Not only that I found out something that I didn’t even know was possible in Excel. Go figure though, there’s always something weird when it comes to being platform agnostic.

I work with Excel spreadsheets on almost a daily basis, my job is to take that data within those sheets and store it into a SQL database. Usually this goes alright, minus the forumla problems and hidden columns and ceels, although I must admit I’m pretty good at finding all of Excel’s little secrets by now. Last week I was lucky enough to get the worst file I’ve had to deal with yet.

This file just needed to get into the database so that we could finish our job for the day and go home. Easier said then done about 4 hours later! To make a long story short, the Excel file happened to be opened and edited for a little bit on a Mac. The transition from PC to Mac went just fine, but somewhere along the line transferring it back to the PC, we ran into a very interesting problem.

Upon transferring the file into SQL, we were noticing that the dates would come up 1 day 4 years behind what the values actually were. After fudging around the internet I found a few sites that explained it a little more.

Excel on the Mac is defaulted to use the 1904 calendar system; where-as PC is defaulting to the 1900 calendar system. Luckily there is a place where you can change this option, it sounded like a simple fix so I clicked the office button when to excel options and changed it. Perfect! My dates were now displaying correctly, I can import this and go home!

Not so fast… Once imported to SQL, the dates would still come up 1 day 4 years back. So what was the eventual fix? There was some talk about using macro’s to adjust the date, but in reality we could either change all dates to be 1 day 4 years ahead, or we could switch the mac to using the 1900 calendar system.

By this time we didn’t know what date’s were suppose to be the real dates anymore, but finally got it worked out. I guess the lesson here is: make sure that you know what calendar system both the Mac and the PC are using before you transfer Excel files across them. You don’t want to end up with a 60 thousand line file and have to change all the dates back by hand!

Another day… Another challenge.

Digital Rights Management, If you’re going to do it do it right!

23 10 2008

I recently had my first bad experience with DRM (Digital Rights Management) software loaded on a particular game. I’m not going to mention the game or the company because first of all they aren’t at fault. The Publisher may be, but in the end it doesn’t matter, it’s more than obvious the PC gaming industry is going this direction, and you may be surprised to hear I’m okay with that, under certain conditions..

Within the past 3 months, I’ve installed my operating system three times. Unfortunately for me most games sproting this awesome new DRM software only allow you to re-install three times. There were some games that I had installed on my first OS, which i knew had the DRM, these I didnt re-install the second time i did my operating system because I knew i would run into problems and didn’t want to have to deal with it.

One game however has made me particularly upset. I purchased said game from steam, who as most of you know arleady does quite a bit to thwart the pirating of games through the steam engine. Needless to say, I ran into a DRM issue with a steam game and didn’t quite know what to think at first. So steam will already make sure I’m logged in, have purchased, and have valid files/keys/etc… Now on top of that I have to hit a DRM server to make sure that I’m not stealing their game? Thats a little overboard.

I decided that I’ll give this DRM thing a chance and went to the games website, to their support page and sent off an e-mail. Although i don’t have the exact text this is about what I said:

“<Game Company Here>,

Recently I purchased a copy of your game off of steam, since then I’ve had to re-install my OS three times, as i’ve upgraded from XP, to vista business, to ultimate. Now that I have my system at its normal running state I’m ready to start playing the game again. Is there any way i can get more DRM activations or at least be pointed in the direction to get some more?

Thank you,




I thought that it was a pretty nice e-mail, however it’s been two weeks and i havent even gotten as much as an auto reply. 

So I ask you game publishers, if you’re going to use a DRM, make it like you make your games, and spend the extra time to MAKE IT RIGHT! Let me activate/deactive my installs or at the very leasy, have a call center than is ready and willing to help me play the game which i purchased to help support your company!

Excel and C# – Easy

19 09 2008

When i was first presented with this problem, I had no idea how i was going to go about doing it, searching the internet for a little while is always my first step. Even when i get to one solution i usually keep researching to see if there is anything better, that way i at least have a few choices before I go coding in the wrong direction.

In any event, the task was to integrate a Windows Form with excel, to import data easily into another application or a database. There are a few problems with the thought of this, “how do i interact with excel” and “how do i deal with different versions?”

First lets deal with the interaction, this may not work for all version but it does with 2007 and 2003, which i can test from my laptop.

Excel is basically like using a SQL database, there are some differences on how to do things, but its easiest I found if you just import to a data table and work with the data from there, rather than trying to work through excel. (Why do that if you could just open excel anyway?) So to get it started were going to use the System.Data.OledDb assembly, make sure to add that in the “using” statements at the top.

Once we have that we want to create a new OleDbConnection:

private OleDbConnection conn;

Then down a little bit more in the constructor we want to check the version of excel they are using, i just do this by simply making a bool and basing it off of the file extension. “.xls” is 2003 and “.xlsx” is 2007, i just check that and set a string for 2007 or 2004. Once we get that out of the way we can make the connection string:

if(excelVer == "2007") {
     conn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;" + "Data Source=" + file + ";" + "Extended Properties=Excel 12.0;");
else {
     conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + file + ";" +      "Extended Properties=Excel 8.0;");

As you can see above there are two different connection strings for the respective versions of Excel. Based on what file they are using were going to want to change that connection string, so if you allow you user to change the file whenever they want in your application, you need to change this with it!

After that its as simple as SQL. Lets create a OleDbDataAdapter:

OleDbDataAdapter da = new OleDbDataAdapter("SELECT * FROM [" + worksheetName + "$]", conn);

Then we just use da.Fill(dataTable) and we can bind that to a data grid or do whatever with it! Thats it! If you need any help, just leave a comment and i’ll do what i can to get back to you!

ASP.NET 2.0 styles don’t show up in FireFox, fix!

25 08 2008

I was stuck on this problem for the majority of the day today and it was driving my crazy, i figured i would share my particular solution with everyone. Almost every place I looked up for an answer to this question had something to say about how the server is configured wrong, when i reality it had something to do with my master page!

If you cant figure out why your styles just wont show up in Firefox see if this is a fix for you too. Check the master file, make sure that you have your stylesheet linked correctly. If all is well there make sure you do NOT have a content placeholder in your header tags. For some reason if firefox can see that content placeholder in the head it will void the rest of the tags up there except for the title tag.

This just happened to be a fix for me and i hope it can help someone else!

New XNA Goal

12 08 2008

So I’ve been thinking a lot lately about developing a game within the XNA developer studio. I’ve talked with a lot of my friends about it; friends who have also taken XNA classes with me or have been involved in that type of thing. No one seems to really have the time for anything like that at the moment. So I’ve decided to take thing into my own hands, and start a personal XNA project.

With that being said I’m going to start from the beginning, with just the ideas in my head, I’ll begin with all the planning, choosing an idea, writing it out, documents. Then from there I’ll move on to development, and eventually try to get something released.

I think whats important here is ACTUALLY DOING IT. So that’s why I’m going to start small, on hour a day, one time a week. If i get more momentum, then I will increase that. If anyone would like to collaborate with me, please send me an e-mail at: wade -AT- utahairsoft -DOT- com.

XMPie, Awesome Idea

12 08 2008

I’ve been working for a company named ThomasArts for a little while now, and they have had the chance to purchase a software application called XMPie. Were currently going throught the training here at work and I have to say its quite the application. Basically, it helps the IT/Programming/Data Services department interface with the creative/designers/media department in making an advertisement.

I wish i could give more information on this software, but from what I understand there are only 10+/- of them ever purchased from Xerox, pretty neat. I guess I finally get to work on the cutting edge software, eh?