Changing Gears, Changing Venues, Changing Jobs

Posted June 20th, 2009 in General by ryan

So I haven’t written in a while and it’s mostly due to a move 3,000 miles to take a new job in North Carolina.  The job is with a government contractor doing work very similar to a job I had worked in the past – although I’m not required to do it in a tent any more.

The job is a big change for me.  Leaving Ventyx, where I wrote mostly Windows client software using WPF, WCF and working with a large group of very experienced developers has now changed to a smaller, younger shop writing ASP.Net applications in a restrictive environment.  My new role has me working more on integrating coding standards, testing practices, security practices & pen testing, etc.  The new role should bring some new thoughts and subsequently new content here.

So as things settle down over here, the plan is to continue to spend some more time writing out some of my ideas here.

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

Spring Is Here In Sacramento

Posted March 13th, 2009 in General by ryan

Yesterday I decided to go to lunch.  Alone.  On Purpose.  It’s not that I’m anti-social.  I’m probably less anti-social than the majority of developers I have worked with.  I have been working in my cubicle during lunch trying to complete some tasks I’ve been assigned, but I’ve started feeling like I never leave my desk.  I had already worked through most of lunch when I had decided to go, so I was about an hour after the lunch rush.

So I took a break.  I walked to a deli hidden away in the middle of a few office buildings down the street.  The “Secret Deli” as we refer to it at work.  I ordered a roast beef and cheddar sandwich on a garlic roll with every vegetable on the menu and a Snapple raspberry tea.  I grabbed a Sacramento News & Review, a local newspaper-ish publication and took a seat outside.  The newspaper grabbed my attention with an article on the front page “Why Twitter Sucks”, but that’s a topic for another post.

I picked a seat outside underneath a tree, next to a water fountain that resembles a small waterfall.  The sun was bright enough to keep me warm and so I sat there eating and reading, oblivious to the world around me.  It was awesome for me to feel like I could focus on enjoying lunch.

After I finished eating, I sat underneath the tree watching the pear blossoms fall in the wind into the fountain.  The foliage around the fountain is a vibrant green, like #234F32.  It made me think about the time we spend in cubicles, surrounded by dim walls.  The weight we assume onto our shoulders when we step into this small square of solitary confinement is too great if we isolate ourselves from brain stimulation you may find in the environment around you.

I’m going to start forcing myself out of the cube more and focus on “thinking out of the box”, literally.

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

Microsoft Virtual PC 2007: FAIL!

Posted February 18th, 2009 in General, Microsoft by ryan

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

Posted January 21st, 2009 in Django, General by ryan

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

Posted January 8th, 2009 in General by ryan

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:

  • Find PI to the Nth Digit
  • Fibonacci Sequence
  • Distance Between Two Cities
  • Dijkstra’s Algorithm
  • Pig Latin
  • Post it Notes Program
  • CD Key Generator
  • FTP Program 
  • Packet Sniffer
  • Small Web Server
  • Web Bot
  • Bank Account Manager
  • Vending Machine
  • Family Tree Creator 
  • Quiz Maker
  • Image Map Generator
  • Traffic Light Application
  • Hangman
  • Magic 8 Ball
  • BlackJack (and several other card games)
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

Posted December 30th, 2008 in .Net, General, Microsoft, Python by ryan

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

Posted October 28th, 2008 in Blogs I Read, General, Linux by ryan

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]

Posted September 19th, 2008 in .Net, Microsoft, Web Design by ryan

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

Posted September 9th, 2008 in Django, Open Source, Python by ryan

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

Posted September 6th, 2008 in Uncategorized by ryan

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]
FireStats icon Powered by FireStats