Python Strings

May 31, 2008

Oh yea… i forgot to mention a Python string feature that I liked.

You can have a string with quotes without having to escape the quotes. You start and end the string with triple quotes, and quotes in the middle are fine.


“””“I like to be quoted!”. swell, right?”””

That should make life easier as long as you don’t frequently include “”” as part of your string literals.

Did some work on DvdFriend

May 31, 2008

It’s been a long time, but I finally did some work on DvdFriend.

There are now LISTS in the left column, one for Dvd and one for In Theaters. This is to bring attention to particular movies of interest. These are managed on a per-product basis in the product editor.

The product editor now has 3 checkboxes
– Show on COMING SOON – the right margin. Without this, movies would only show up if they’re have a rating. But, since I want to show some Direct to DVD movies (ie: stargate continuum), they need to show up even if they’re not rated yet.

– Also in the product editor, I added a text box so that image urls can be manually entered. This is for cases where the image doesn’t exist on amazon yet, usually theatrical releases. I have to find other image sources that I can safely use. (The “Set Image” link opens a browser that allows you to search amazon images. That’s been there all along.)

The new lists on the left aren’t very manageable yet. It’d be nice to be able to order them how I want, but I’m not that ambitious today.

Now for the bad news. In order to get that list on the left, I had to modify the CSS. Previously, everything was centered. I used absolute positioning for the list, so if you resized the window there was a very good chance the list would overlap the main page. So, I attempted to fix it, but didn’t do so 100%. The header and body aren’t lining up exactly right.

On the bright side, though, it looks MUCH better in firefox than it did before.

I changes JAY’S BLOG from a link to a navigation button so that it would render better in fire fox.

Google App Engine

May 31, 2008

I just went through the GOOGLE APP ENGINE “Getting Started” guide. Neat stuff.

The runtime is Python, which I haven’t used before. I installed python, then just used notepad to write the code.

The fun thing about python is that spacing counts. You block code by tabbing them out the same distance.

Google currently allows everyone to have 3 applications online, while they’re still in preview mode. Througout the guide, it mentions how you can use any python library for doing different types of things, but it comes with “Django” stuff already bundled. IE: Templates. (In world, a template is a master page)

The benefit of using the google app engine is that it has a bunch of stuff built in, such as a datastore. The data store is not a relational database, though they expose a GQL language, which is very sql like.

greetings = db.GqlQuery(“SELECT * FROM Greeting ORDER BY date DESC LIMIT 10”)

You can also do it programtically.

greetings = Greeting.all()
greetings.filter(“author =”, users.get_current_user())

You never actually have to create any data store objects to hold your data. That happens automatically when you save stuff. It looks to be an object database. Once you save an object of type GREETING, then you use GQL to query for types of GREETING. (I wonder what will happen as you modify GREETING)

I’m definitely not a python guy, but it was fun to play with the language a little bit. Google App Engine is trying to make development/hosting a lot faster. The SDK gives you everything you need to get started (local web server and data store), and deploying the application to production is a snap… you just execute a python script that takes care of it for you. The setup is minimal. Everything pretty much works right out of the box.

Membership Update

May 28, 2008

When you create a new profile, it sends you an email.
The details of the email are recorded in the EmailHistory table.
The activation codes and userid are stored in the Activation table.

I changed the approach slightly. The actual activation part isn’t done yet, but the plan is:
When activate via the website, you must specify Email Address, Password, and Activation code.
If you just click the link in the email (which is the easier way to go), it will pass two activation codes.


That results in an ugly url, which is swell.

The email is sent and recorded, and the activation codes are recorded. Next, I have to implement the actual activation.

Getting closer, but there are still a lot of loose ends before I can put it up.

Mvc.Net mapping / Preview 3

May 28, 2008

I said in an earlier post that I would like to have a mapping feature so that you can indicate actions via configuration rather than code. My tenative plan was to create a new subclass of Controller called MapController. It would have a method like

MapAction(string actionName)

In my login example, I’d change my action to:

which would redirect to the Home

which would render the LoginFailed view.

MapAction would do a lookup from the configuration store then do a render or RedirectToAction.

Preview 3 actually makes this a lot easier, because the acton methods now return an ActionResult object.

The subclasses of ActionResult (that I can find) are:
– ContentResult
– EmptyResult ?? (do nothing?)
– JSonResult
– RedirectResult
– RedirectToRouteResult
– ViewResult

So far, I’ve used implicitly used RedirectToRouteResult and ViewResult. (Controller has a RedirectToAction method and a View method which genereates the appropriate result object automatically).

This means that all I’d really need to do is create the appropriate type of ActionResult object and populate it from configuration. The saving is that the objects already exist; in Preview2, I would’ve had to create my own objects. (I’m glad I didn’t waste time on it, then).

Now, I’d do:
return MapAction(“LoginMembership.Success”)

It’d be neat, but I’m not in a huge rush to do it. We’ll see if it magically appears.

Preview 3

May 28, 2008

Woo hoo!

I just updated the test site to use it. Other than 1 case of me not following instructions, it went smooth.

The HTML helpers have been changed. I was using an Html.Textbox signature that’s no longer valid. Apparently, they’d rather you build the htmlAttributes collection and pass that in. For now, I merely simplified the call losing the SIZE and MAXLENGTH properties.

There’s a major change to the ACTIONS, which I like a lot. Previously, the methods were of type VOID, and you’d do things like:


Now, you change the VOID to ActionResult, and change the actions to:

return View(“Index”)
return RedirectToAction(“Logout”)

Now, rather than instructing it to do something, you’re returning an object that tells it what to do. So, now its more testable. You can write a test for the action and make sure that it returns the ActionResult that it should. Sweet.

Also, the ViewData object has changed. It used to be ViewData<T> where T is the type of the object passed to the view. That has changed to ViewData.Model<T>. This allows ViewData to provide other types of things such as…ummmm… Hang on a sec. I was really excited about that until just now. I pulled up the intellisense and didn’t get what I expected. I’ll have to look into that more, though I like the approach in intent. It is a place where a lot more things can be exposed other than just your view data object. As the framework grows, they can keep adding new things to ViewData.

Back to the grind.

Activation Codes

May 27, 2008

I’m starting to test the site pretending to be a brand new user. I want to make sure someone can sign up, get verified via an email activation code, then function. There will be two types of new users: those who aren’t associated to any families, and those who are.

You’ll be able to activate your account either by clicking the link in the email, or by typing in Email Address, Password and Activation code on the activation page. I’m pretty sure that will bet two different actions.