Friday, December 12, 2008

Robocopy to the rescue

This is a typical situation. I have been trying to find a tool that can solve a problem I have of syncronizing my web files properly. Without any luck. Until today. And the worst part: The solution was already installed as part of windows and has been that way for ages.

Enter Robocopy.

This is a command line file copier that as standard copares files in two directories and copies newer files over. Recursively as well. Nothing revolutionary in this. But here comes the good parts: It can purge extra files for you - typically web pages not used anymore. It can also save your parameters to a job that can be rerun. Very practical for automated builds.

So is there something this wonder cannot do? Yes... Do the sync over FTP. That would be nice. Maybe there is some other tool out there...

Wednesday, November 26, 2008

Adventures in Flash and Python

The last couple of weeks I have been making a nice little Flash application, a questionnaire, for a government project. One of the features of the questionnaire was the ability to print out results based on the answers given.

In order to do pretty printing of the results, I used the awesome AlivePDF library to generate PDFs for the user to print. Neat stuff. It was a bit dodgy to get it up and running - especially because you cannot force a download from your Flash file. Instead the library uses a neat little trick of generating the PDF content in the Flash and then posting the content to another web-page that converts the post to a download-file. Pretty neat stuff.

Included with the library is a PHP script that does that little trick, and I managed to get it up and running. Especially AFTER I discovered that the reason it did not work was that my IE8 beta just didn't accept what was going on. Not even in compat mode. So I had to use Firefox. Discovering that I had to go there was a stroke of luck.

All that out of the way. Or so I thought. Because suddenly things got spicy. Clearing the solution with operations revealed the fact that they had no PHP running anywhere, so could I please make it work with Python? Yes, of course... Because I know Python (NOT). But how hard can it be? The PHP script is only 10 lines of code for crying out loud!

So I got my feet wet in Python. The language itself does not seem that hard, but getting to know the environment and how to test was not easy. But I managed to bang out a Python script that does what the doctor ordered. And only 'round 100 times slower than a real Python haX0r. :P

So if you ever need to use Python and AlivePDF, here is the script. It is missing any kind of error handling code, and may not work in all scenarios. And I will probably not be able to fix it for you. But knock yourself out.

  1: #!/usr/bin/env python
  2: 
  3: import sys, cgi
  4: import cgitb; cgitb.enable()
  5: 
  6: query = cgi.FieldStorage()
  7: dict = {}
  8: for param in query.qs_on_post.rsplit("&"):
  9: 	parsplit = param.rsplit("=")
 10: 	dict[parsplit[0]] = parsplit[1]
 11: 
 12: 
 13: print "Content-Type: application/pdf"
 14: print "Content-Length: " + query.headers["content-length"]
 15: print "Content-disposition:" + dict["method"] + "; filename='" + dict["name"] + "'"
 16: print
 17: print query.file.read()

Wednesday, April 30, 2008

It must be a sign, but an undeciferable one

How come that the day GTA4 should have arrived in my mail, the postal delivery people in my region decides to go on a strike. So I am left out of the party even though I had done my duty and pre-ordered the game. Luckily they are showing Chelsea-Liverpool CL semi on Viasat TV6 which I can watch for free with the digital tuner in my new TV.

Nothing as cruels as this happens without a reason. So. What is there to learn? Never pre-order a game? Could be. With Halo 3 I got a fair warning getting to pay more than I had to - even though Coolshop has a pricing guarantee. Never covet a game so much that your belly hurts? Actually I am still looking more forward to Rock Band than I had to GTA4. But the last couple of days the GTA fever got to me too.

Bottom line. I am angry, hurt and confused. And I don't know why...

Tuesday, April 29, 2008

Installing on consoles

One of the reasons that I have ditched PC gaming in favor of console gaming is that it is just much easier. I mean, buy the game, put the disc in the drive, off you go. Can't get better than that. But in the next gen game things have changed somewhat. Sometimes when i put the disc in my 360 I need a title update. So an installer has been downloaded, runs and reboots either the game or the console. Usually this doesn't take long and you are back in the action.

This is all well and dandy but the other day when I wanted to try out the Gran Turismo 5 Demo, oops, PROLOGUE, on the PS3, I got a nasty surprise. Not only did the game need an update of the PS3 core system - which took a couple of minutes - but before starting the game proper it needed to install to the harddrive... WTF?! Seriously. I was treated with a non-progress bar teling me how the install went. Five minutes later it read somewhere between 5 and 10% complete, so I decided that I really needed to get back to work instead of this.

Now I don't own a PS3, so I don't know if this pain is something every PS3 owner needs to endure before every game experience. What I do know is that it is the most mind numbingly stupid thing I have experienced on a console. Not only have they ruined the slot-in-and-play experience that makes consoles such a joy. They have introduced onto the user the ardurous task of disk management. Good grief. And for what? Reducing load times. Bullcrap. I have no hard stats on this, only a gut feeling. But apart from the odd elevator experience, load times are not that much worse in this gen. Developers need to get clever in order to alleviate this until we get a new portable media with almost instant load times. With this moves, Microsofts seemingly troubling decision of making the hard drive optional on the 360 suddenly seems like a wise defense against developer zeal.

Let us revisit the issue of the game requiring a specific system version before playing. In my book this is also somewhat unsettling. It stresses the feeling that the PS3 system was not finished from the get go. But worse, can you trust Sony not to let this slip the other way so that you cannot play an older game on a newer system revision? You have to wait for the devs to put out an update for the game. Potentially rendering some unplayable for an uncertain amount of time.

All in all this is not the way to go. Not only did Sony mark the wrong date in the calendar for the next-gen party. They showed up unprepared, sloppily dressed. They didn't bring anything to the bar and all their exclusive friends are doing good business in other circles. Now they are acting obnoxious. No wonder the hard-core gaming audience has moved to another room to party. People who bought the system to play games are really getting thrashed with the short end of the stick. The system is really only attractive as a home theater system. And that is quite a different party.

Sunday, April 20, 2008

Caught on film

Razu came by the other day and caught me for an interview for Microsoft. I think the result is actually quite good. See for yourselves, and please do comment.

The Real Story

Friday, March 28, 2008

Do YOU see ANY connection?

How can something so good be free?!?!

I have long been wanting to take a look at the Umbraco open source .NET CMS system, and now I finally have had the opportunity to do so in conjunction with the website I am creating for my new buddies at GamingSchool. I must say that what I see amazes me. I have had some experience with CMSes in the past. I used SiteCore contracting for AlphaSolutions. Currently I am using CompositeCMS for the Clubzone.es site that I took over from another company.

Umbraco blows them both out of the water - effortlessly. Moreover Umbraco is free while the others cost huge amounts of money!

So here is a little list of pros and cons of Umbraco that I have discovered so far.

Less is more.

Umbraco may not be as fully featured as the other CMS'es. Just my guess though, haven't studied it properly. But it is so smooth to use that anyone can figure it out. And it does pack a lot of punch under the hood for developers.

Seamless install

When I had to set up CompositeCMS for Clubzone, I had to install it on my machine to get it running. Furthermore it doesn't run on Vista. So I cannot run it on my dev machine making local development impossible and debugging a pain. Getting a test version of the site running on my test server took several days of tampering to get it somewhat aligned with my build cycle. This is just plain annoying.

When I ran SiteCore it took "only" a day to get it up and running on my dev machine, but this was with the help of a long time SiteCore developer by my side. Even he hated doing it because he knew it sucked.

Umbraco comes in two flavous - install and zipped. I like the latter. Unzip. Tell IIS where'z'at. Set permissions correctly (got me at least once). Go to /install and complete a wizard. Bang - good to go. Making a test version of the site is even easier as you just copy the files over and don't have to do the 2 minute "install" part.

Great .net integration

When you want to make the more complicated stuff you use Macros in Umbraco. These can be either XSLT scripts or .NET user controls. I have always loathed XSLT for being the over-complicated non-compiled write only language that it is. So I use .NET user controls, and making them for Umbraco is so very easy that it makes you want to jump up and down with joy.

ASP.NET AJAX IN THE BOX

Now this is both a pro and a con. I am very divided on ASP.NET AJAX. Having used it extensively for "StryBergs Blå Bog", I got a love/hate relationship with it (save that one for another post). I prefer some of the more lightweight JS libraries out there - MooTools and JQuery rank highly right now. Since ASP.NET AJAX and these libraries does not go together well - if at all - I am forced to use ASP.NET AJAX. I hate that. I want a choice. I thorughly understand why this might not be very easy to do - but thats what I would like.

The pro is that you can just go ahead and use it. Drop the AjaxControlToolkit in and you're all set.

documentation?

Now this is always the achilles heel of all open source projects. And it is no different with Umbraco. Niels Hartvig - Mr. Umbraco - has even gone to the lengths of adding an easy way of writing books on the web site for everybody. But still the documentation is a cluttered half assed mess in disarray. The main source of info is in the forums. A classic. The forums are reasonably good. But could somebody please explain to me why all links on Google searches for forum posts give a "page not found"? Seems like they have reorganized their forum breaking every link in the process. Meh...

Pure "luck" that Umbraco is easy to pick up on. But it takes a while to get into developing Macros and stuff.

Just in on their blog is that Niels and newcomer Per will be focusing on improving documentation. Wise decision.

concluding thoughts

So... I may have more to add. But time is running out on me. (It is a quarter past 1 and Halfdan wakes me up at around 6).

Anyways: Check up on Umbraco. You won't regret it. I am not getting kickbacks. It's really true! ;-)

Technorati Tags:

Friday, February 22, 2008

The three project solution

Ayende just brought up the issue of project structuring, and his experience was so similar to mine that it cannot be a coincidence.

In my old job I spent a lot of time trying to "do things properly". Splitting up into a lot of logical assemblies, promoting reuse by having special helper assemblies and so on. The result was a huge amount of lugggage that each application had to carry around. When we deployed a simple windows service or console program, it consisted of 9 or 10 assemblies. And don't get me started on versioning all of these, because we were very methodical there too. It sort of worked, but only because we had build a very rigid CI monster controlled by a horde of NAnt scripts that no one - even me who wrote most of them - could figure out after two months away from them.

Today I consider that a learning experience, and I go for the "three project solution". Ayende says two, but I think having a third is worth the hassle. Especially when you create solutions that have different application components in a workflow.

The three projects goes a little something like this:

  • Application.Core : Holds all the logic and data for the solution. I split up classes in a logcal folder/namespace structure. As I favor using MVC pattern a lot, it usually holds Model, Controller, DataAccess and Helper folders.
  • Application.Core.Test: A test library for the core lib, same structure as the Core.
  • Application.<Type>: This is the application itself. The type can be Website, ConsoleApp, Service or whatever it is that I am creating. If there are more apps, there usually is, they get their own projects. All application projects have as shallow code as is can - usually only the View parts of the MVC structure.

I find that it reduces friction both when developing, but especially when deploying. Only two assemblies to deploy. No inter version dependency nightmares and so on. Simple and smooth.

Monday, February 04, 2008

Mass Salvation

Nordic Game Jam is over, and as last year, it was a hoot and a holler! Man, we had fun! I was lucky to get a great team. crew_highFour programmers, four game desginers/artists/sound engineers and a great idea. So we managed to get a full a full game up and running on the XBox using XNA in only one and a half day.

The game is called "Mass Salvation" and in accordance with the theme for the Jam, which was Taboo, is about religions. The "back story" is that it is the day before judgement day, actually 1 minute and 30 before, and humanity is a mess. Everybody is atheists and now reckognize their mistake. You take the role as a religious leader and have to convert as many followers to your cause and send them to the sweet afterlife in style.

It is played using a controller geometry wars style by up to four players. You are playing short rounds (1:30), and the pace is frantic. You can pick up and play the game right away, but as you play more, you will learn how to use the rally point to your advantage as well as different strategies for grabbing followers. So the gameplay has several levels of skill.

Below is a video of the mayhem. I will post a link to a downloadable version of the game soon. Just have to repackage it and make a ccgame version as well. So stay tuned!

Tuesday, January 29, 2008

OMG! It Rocks!

Not that I had any doubts about it. But I just tried Rock Band today, playing the guitar and drums. Man, it is fun. Why, didn't I sing? Dunno. Next time. Playing the drums was just as muc fun as I had imagined. The guitar takes a bit getting used to. It is much more sturdy and heavier than the GH guitars and has a much different feel. But it actualy feels more like playing a real guitar than GH does, much more than I had thought. Is there a flipside?! Yes, the version I have access to here two months prior to launch is a PS3 version - so no achs for me for the time being. Darn it.

Sunday, January 06, 2008

XNA Tweener library

My second open source project is live now at Codeplex - and it has a release and everything! Check it out here.

The project is a Tweener library for XNA making it easy to create animations for your games. I was inspired by the Tween class in ActionScript although it is not a direct port. All the cool easing functions from Robert Penner that you know and love are of course there, ported from the js code. So the release is functional.xnatweener

I am actually quite pleased with myself for doing this, because it has been short and focused work. The first code was created this Thursday - this was the basic Tweener class and the first ported equation as well as a very basic demo. Today (technically yesterday) i squeezed in the rest of the work, adding stuff to the Tweener class and the last equations. Then I spend some time polishing up the demo so it would look cool - getting to know my own library in the progress.

Best of all: I didn't create the library alongside a specific other project. This made it easy to focus on not making all kind of proprietary stuff and KISS. I am pleased with the result, and will use it in my games. But i find that I lack some of the fancy dynamic features from JS lacking in C# which could have made the class so much cooler - but I have some slick ideas for making it rock even more.

The project is made on Codeplex, and having tried both Codeplex and SourceForge now - I will say that Codeplex really whips the llamas a**. Or at least SF's. When I made the d20Sharp project on SF it took me ages to get up and running properly. With Codeplex it literaly took 5 minutes. And the interface on Codeplex is much better and more intuitive than the one at SF, and I won't even begin on the features... I would like the Codeplex interface for my own projects - I know it is somehow based on TFS but I haven't checked out the product as I know it is way out of my league at Gosuman pricewise. If there were a hosted licensed version out there I would probably consider it.

Anyway - download the library and take it for a cruise. Then tell me what you think. Then I will improve it.

kick it on DotNetKicks.com