Microsoft Virtual PC 2007: FAIL!

Yesterday I had a need to create a virtual image of Windows XP Pro to do some testing against a USB device.  I downloaded and installed Virtual PC 2007 and created a guest running XP Pro.  I plugged in the USB device and nothing happened.  After a quick web search I was able to confirm that Virtual PC has no USB support.

I then downloaded the trial of VMWare Workstation.  Installing XP Pro was a much easier, simple and faster experience than installing it in Virtual PC.  USB support is built in and very intuitive.

Does anyone know if Microsoft is still working to innovate with Virtual PC or have they conceeded to VMWare?  I know which one I’m using from now on….

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Learning About Django Templates

I was working on a template last night to handle a generic view. I started by going into the console (managey.py shell) to poke around at the model I wanted to use. From that session, I copied the following snippet to use in the template.

project.projectimage_set.all()[0].image.url

I added this to the template and it looked like this.

{% for project in object_list %}
<div class="project">
   <div class="project-image">
      <img src="{{ project.projectimage_set.all()[0].image.url }}" alt="" />
   </div>
   <div class="project-info">
      {{ project.name }}
      {{ project.link|urlize }}
      {{ project.description }}
   </div>
</div>
{% endfor %}

When running the template I received the error: “Could not parse the remainder: (0)”. I hadn’t seen this before and searched Google to get the answer. It didn’t look good on the first search. The answer was repeated in different results, originating from a Google group. The answer given (and I’m paraphrasing) was “Django templates don’t use Python code. You’re doing it wrong. Go write a template tag or custom method.” I read through the link a few times and couldn’t find the answer I wanted to hear. I figured this was common, and I thought a web framework for people with deadlines would not require me to write too much code to get to a property.

I went back to the documentation and looked around and still didn’t find anything that showed me how to access the properties further down on the related model so I went back to Google. This time I found an answer!

I’m not going to put on like I know what’s going on here. I can think about how somewhere underneath in the template language there’s an implementation of __getattr__, but I didn’t go and research it. It’s almost 0200 and sleep is calling. Because it was difficult for me to find, I thought I would just post this and maybe it would help the next guy stumble upon removing the () and [ ].

Here is the working code:

{% for project in object_list %}
<div class="project">
   <div class="project-image">
      <img src="{{ project.projectimage_set.all.0.image.url }}" alt="" />
   </div>
   <div class="project-info">
      {{ project.name }}
      {{ project.link|urlize }}
      {{ project.description }}
   </div>
</div>
{% endfor %}
[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Sample Project Ideas

A few years ago I found a list on the internet of 10 things to do when learning a new programming language.   I thought it was interesting and shared it with my coworkers at the time.  A couple of weeks ago, one of my former coworkers contacted me and asked me for the list.  The site has since disappeared and I could not find the same information, but by coincidence I saw a link in an RSS feed recently for a similar idea.  The list is titled Martyr2′S Mega Project Ideas List! and it contains 150 different project ideas organized into 10 categories. 

A sample of the ideas includes:

There are many more great ideas and maybe these will give you something to use next time you want to explore a new language.
[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Debugging IronPython In Visual Studio

I’ve been getting to know IronPython a little lately and one of the first things I wanted to know was how to debug IronPython in an IDE.  Since I use Visual Studio 2008 at work, I thought it would be a good start.  I searched Google and found a text representation of the steps involved over at Harry Pierson’s blog.

I found it pretty simple to do and somewhat useful for longer scripts.  It will be nice in the future to have first class support for IronPython in Visual Studio 2010.

You should have IronPython 2.0 Final and Visual Studio 2008 Professional or Better* installed to complete this demo.

Create a python file to debug:

1
2
3
4
5
6
7
8
#debug.py
class Foo:
def __init__(self, name=None):
    self.name = name
 
if __name__ == "__main__":
    f = Foo("LVS")
    print f.name

From Visual Studio, open the IronPython executable (ipy.exe). If it doesn’t do so for you, add the ipy.exe as an existing project.

From the Solution Explorer, right-click on Properties and set the Command Arguments property.  Use “-D” to tell ipy.exe to create debugging output, “-i” to start an interactive session at the end of debugging and add the full path to the script you made before.

Properties Dialog

Properties Dialog

Click Ok.

Open the script you created earlier in Visual Studio and place breakpoints as desired.

Adding a Breakpoint

Adding a Breakpoint

Run the script in debug mode (F5).

If you added the “-i” argument in step 3, after the last breakpoint is released it will launch an interactive session for you.  You will be able to inspect your script at this point, much like the immediate window in Visual Studio.

Interactive Console

Interactive Console

* I tried this in the Visual Studio 2008 Team Developer Edition and the Visual Studio Express Edition.  The Express Editions do not work as they don’t allow you to open the ipy.exe as a solution item. Sorry “hobbyists”, we’ll see if the Express sku’s of Visual Studio 2010 will target IronPython / IronRuby.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

CodeWeaver Cross Over Pro ~ Free Today Only

I caught this scoop from Nolan’s blog this morning…

The company that makes the commercial version of WINE that allows you to install windows apps natively on mac or linux is giving their product away for free for 24 hours.  Here’s an article explaining it at length:

And here is the site to get the serial # and product.


[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Designing An Intranet With Sharepoint [External Reference]

A collegue (really a mentor) of mine knows Sharepoint like nobody’s business and she posted an interesting article this week about when moving to Sharepoint, there is a shift in the mindset how you look at and classify information.  It’s a quick point with a list of good references and I think it’s a good primer before jumping into Sharepoint.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Code Quality & Patch Quality

This was a great talk where Malcolm Tredinnick spelled out what he’s looking for in Django patches and what to avoid if you don’t want your patch tossed out.  Although his talk was targeting the Django project, he really dispensed good advice for anyone maintaining software regardless of project, language or platform.  The room was completely packed!  All of the chairs and couches we’re filled and people were sitting on the floor and standing at the sides of the room.

You’re doing it wrong if:

• the word “print” is in your patch
• you don’t have a test (fail before, pass afterwards)
• you think “PEP 8″ is an energy drink (PEP 8 is the style guide for python)
∘ make your patch look like django style code

Create patches by running diff from the top of the repository to get all changes.  The svn add command works locally even if you don’t have rights to commit to the repository so files you add will be added to the patch.

“Code style is opinionated and yours doesn’t matter!”

What he’s saying here makes sense in any open source project.  There’s a style defined and you should not deviate from it no matter how much you like your own special coding habits.  You might get away with minute changes, but don’t push it.

“Read the contributing document.”

This seems to be simple and common sense.  Skipping over information someone has left for you is a recipe for confusion.

Some tips given on comments:
• comments should last
• comments should be correct
• comments should explain they “why”, we can already read the how in the code.

Some general tips:
• Fix problems and not symptoms!
• Research is not a four letter word.
• The crowd is smarter than you

And what I believe was his last advice for the talk (at least I stopped taking notes after this) was to contribute and keep contributing.  Even when your patches don’t get in, don’t get discouraged.

It was a good talk and the first time I had heard Malcolm speak.  He was very informative and encouraging.  Overall I liked it and it was one of my favorite talks besides James Bennett and Cal Henderson.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

DjangoCon Update 1

I’m sitting next to the creator of python and listening to the History of Django talk.  It’s very interesting to see how the Django framework morphed into what we know it today.

Jacob Kaplan-Moss and Guido Van Rossum just had an interesting side discussion about how Django should do things, making it easier to run on Google App Engine.  After seeing Guido’s talk, the latest backend changes to allow a non rdbms database and the side conversation, I think there will be many exciting developments in Google App Engine in the next year.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Blogging From DjangoCon

I’m here at the GooglePlex sitting a row away from the stage and enjoying the atmosphere.  It’s a great vibe here.  This does feel different than the Microsoft conferences I have been to.  Some observations so far is that the crowd seems a little younger for the most part and there is a comfortable atmosphere.  Of course there’s free food and drinks, free wifi, a great stage and screen for the presentations and the audio is flawless.  The only complaint I have thus far is the uncomfortable plastic daycare chairs.

Earlier I attended Guido’s App Engine keynote (blog post to follow later), and I’m now attending the High Performance Django talk.  I will try to make a post for each talk I attend.

Custom Ice Cream
Custom Ice Cream

Check back soon…

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

End Of July Update

I’m going to DjangoCon 2008!

Am I still writing a blog – yes!  See, what had happened was…  I was moving right along until I saw these basic-apps.  I love reading source code so I grabbed the source and started reading through them.  I switched gears and decided to try implementing a few of them into working blog.  So far it’s still coming along nice and I’m learning a lot.  It’s very addicting to learn and make progress.

I also recently launched PaiWaterOasis.com, a water delivery business in Okinawa, Japan.  This site is built on Django and MySql and is deployed at SliceHost.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]