Thursday, June 12, 2008
PureMVC Documentation
Anyways. I just wanted to point out that PureMVC has some of the best documentation I've ever seen. I printed out the pdf of the Framework overview, double sided to conserve paper, and it has exactly one page of written text and one page of diagrams per section, so you get the text about the view, and on the facing page, all the UML.
The little things make me happy.
Wednesday, April 16, 2008
Regular Expressions
Monday, April 07, 2008
Internet Explorer 7, Clears and Floats?
firstinstead of
second
first second
Anyone run into this before? I'm not css problem savvy enough to know what to Google for. I ended up just putting br's with a "clear: both" class on them in between rows, but it's not as clean as it was before.
Friday, March 14, 2008
PyCon 2008: Collaborative Notes?
Thursday, March 06, 2008
Grails Date Trick
class Person{and you're struggling to figure out a way to get stuff into it without explicitly creating a date and converting strings or integers into it, Grails provides a handy (yet not documented?) set of properties for you. In our example, I could set birthday_year, birthday_month, birthday_day, birthday_hour, etc.. I found this by digging in the scaffolded views and figuring out how they render the
String Name
Date Birthday
}
Sunday, March 02, 2008
Font choices, anyone?
Just another css developer's link. I'm on a roll here.
Saturday, March 01, 2008
Color Scheme Generator by WellStyled
Lorem Ipsum Dolor Sit Amet
Friday, February 29, 2008
Gotcha: Grails Auto Recompile Doesn't Do GSP
Wednesday, February 27, 2008
Gotcha: Grails Capitalization
Thursday, February 14, 2008
Acegi on Grails Tutorial
So, neither the information on the Plugin Page for the Acegi Security Plugin, nor the info in the acegi tutorial actually work completely. Here's a real tutorial for doing this. (Step 6 is where the existing documentation fails)
Step 1. Install Grails
Step 2. Download the Acegi Security Plugin. (I downloaded version 0.2 it as a zip file, to %GRAILS_HOME%/plugins/)
Step 3. Create a new Grails Project, and cd into the new project folder:
grails create-app SecurityTutorial
cd SecurityTutorial
Step 4. Add the Acegi Security Plugin. Note that you can install plugins by name using some lookup service, but the Acegi plugin won't be found.
grails install-plugin %GRAILS_HOME%/plugins/grails-acegi-0.2.zip
Step 5. Installing the Acegi Plugin will add some new scripts to your project:
- create-auth-domains [PersonDomainName] [AuthorityDomainName: this creates the domain model needed by the plugin, Person, Authority, and RequestMap classes, login and logout controllers, as well as the login view. You can give optional names as arguments to replace Person and Authority.
- generate-manager: creates the scaffolding controllers to add new Person, Authority, and RequestMap object in your database
- generate-registration: create a register and captcha controller, as well as matching views, and an emailer service.
Run each of these commands.
grails create-auth-domains
grails generate-mapper
grails generate-registration
Step 6. Setup BootStrap.groovy to contain some sample data, as follows:
// ProjectFolder/grails-app/conf/Bootstrap.groovyclass BootStrap {
def init = { servletContext ->
// get a AcegiSecurity AuthenticateService
def authenticateService = new AuthenticateService()
// use it to create an encoded password
def md5pass = authenticateService.passwordEncoder("pass")
// Create two sample users
// NB: you must specify all the Person attributes, otherwise
// Grails will fail quietly to add these to the database
def user_root = new Person(username:"root",
userRealName:"Root User",
passwd:md5pass,
enabled:true,
email:"root@example.com",
email_show:true,
description:"Desc").save()
def user_admin = new Person(username:"admin",
userRealName:"Admin User",
passwd:md5pass,
enabled:true,
email:"admin@example.com",
email_show:false,
description:"Desc").save()
// Add some sample Roles, add the users to those roles
def role_superuser = new Authority(description:"Superuser",
authority:"ROLE_SUPERUSER")
role_superuser.addToPeople(user_root)
role_superuser.save()
// See AcegiConfig.groovy, at the bottom, there's a defaultrole
// setting, you must make one to allow registration to work.
def role_user = new Authority(description:"User Role",
authority:"ROLE_USER")
role_user.addToPeople(user_admin)
role_user.addToPeople(user_root)
role_user.save()
// Create some Request Maps
new Requestmap(url:"/captcha/**",
configAttribute:"ROLE_SUPERUSER").save()
new Requestmap(url:"/register/**",
configAttribute:"ROLE_USER").save()
}
def destroy = {
}
}
We also have to edit the RegisterController.groovy to fix a bug.
// ProjectFolder/grails-app/controllers/RegisterController.groovy // Line # 159-161
person.save(flush:true)
def parMap =['j_username':person.username,'j_password':params.passwd]
// change this line:
// redirect(controller:'login',action:'../j_acegi_security_check',params:parMap)
// to this:
redirect(controller:'login',action:"auth")
Step 7. Run the application
grails run-app
Step 8. Play around. Notice that you when you try to go to the register controller, it asks for a login, then, since you're already logged in, the register controller just shows you your info with a redirect(action "show"). Go delete the RequestMap for the register url, make sure you logout, then try again. See how the captcha is broken? Go remove the captcha RequestMap, and try again.
Thankyou Markmail

Tuesday, January 15, 2008
It's not easy being dorky
o.O
Wednesday, January 09, 2008
Rock Band is Awesome
Anyways, the fun stuff for you: I made a list of the music videos for the standard Rock Band songlist. (At least all of the ones I could find) Here's the html and rss feed from my del.icio.us account, and here's the list (not in any particular order):
-
You Tube - Van Halen- Won't Get Fooled Again (Live 1993)
You Tube - The Killers - When You Were Young
You Tube - welcome home - coheed and cambria
You Tube - Pixies - Wave Of Mutilation
You Tube - Bon Jovi - Wanted Dead Or Alive
You Tube - Stone Temple Pilots Vaseline, Vasoline
You Tube - Aerosmith - Train Kept a Rollin'
You Tube - bowie, tokyo 1978: suffragette city
You Tube - The Clash - Should I stay or should I go
You Tube - Weezer - Say It Ain't So
You Tube - Beastie Boys- Sabotage
You Tube - Iron Maiden: Run to the Hills
You Tube - The Strokes - Reptilia
You Tube - Black Sabbath - Paranoid
You Tube - R.E.M. - Orange Crush
You Tube - The Police - Next To You (Hamburg 1980)
You Tube - Mountain - Mississippi Queen - 1970
You Tube - The Hives - Main Offender
You Tube - Foo Fighters - Learn To Fly
You Tube - Nirvana - In Bloom
You Tube - Garbage - I Think I'm Paranoid
You Tube - Deep Purple - Highway Star
You Tube - OK Go - Here It Goes Again
You Tube - Nine Inch Nails - The Hand That Feeds
You Tube - The Outlaws - Green Grass & High Tides - Part One
You Tube - Queens Of The Stone Age - Go With The Flow
You Tube - The Rolling Stones Gimme Shelter
YouTube - Boston - Long Time (11/13/06 at Boston Syphony Hall)
YouTube - Molly Hatchet - "Flirtin' With Disaster"
YouTube - Faith No More: Epic
YouTube - Metallica- Enter Sandman
YouTube - Don't Fear the Reaper - Blue Oyster Cult
YouTube - Kiss - Detroit Rock City
YouTube - FALL OUT BOY: Dead On Arrival
YouTube - Red Hot Chili Peppers - Dani California
YouTube - Radiohead - Creep
YouTube - Smashing Pumpkins - Cherub Rock
YouTube - Hole - Celebrity Skin: Video
YouTube - Ramones - Blitzkrieg Bop
YouTube - Soundgarden - Black Hole Sun
YouTube - The Sweet - Ballroom Blitz
YouTube - Jet - Are you gonna be my girl ?
YouTube - Yeah Yeah Yeahs - Maps
Friday, December 07, 2007
Documentation stuck in the 90's
Tuesday, November 20, 2007
Fuel! Cell! Consumer! Model! ....!!!!
I'm almost embarrassingly excited about this.
Last night, I saw this IMHO awful commercial with the most amazing ending ever - a fuel cell car that will be commerically available!

Wikipedia had this to say about the Honda FCX Clarity:
In 15 November 2007 at the Greater Los Angeles Auto Show, Honda unveiled the FCX Clarity, the first production model, and announced that the car would be available for lease beginning in the summer 2008. Initial availability will be limited to the Southern California market, with availability expanding as hydrogen fueling stations become available...
...The new FCX utilizes several interesting new features. The new V Flow fuel cell stack can operate at temperatures as low as −30 °C. This is achieved by allowing the gas to flow vertically in the fuel cell stack. The tanks can store up to 5 kg (171 litres) of hydrogen at a pressure of 350 atmospheres, thanks to the new hydrogen absorption materials used. This allows a longer range of up to 350 miles (570 km)...
...To support the hydrogen fuel-cell technology, Honda also introduced the Home Energy Station (HES). This home solution can convert natural gas to electricity, heat and hydrogen to refuel fuel-cell vehicles. This allows consumers to refuel vehicles with hydrogen at home, important until hydrogen stations become widespread. Alternatively, the hydrogen can be used in the HES's built-in hydrogen fuel cell, providing up to 5 kW of normal or backup electricity and/or hot water for the home.
Apparently there are 20 already-leased 2002 prototypes, some of which are here in New York. What especially excites me is that they've come up with with a home refueling solution! With a range up to 350 miles that sounds like it might be a practical enough solution to make up for the lack of hydrogen fuel infrastructure.
I wish mass production might get started sooner than 2018..
Thursday, November 15, 2007
Best Gaming News All Year
Wednesday, September 26, 2007
Toscawidgets Forms: Passing Compound Widgets
Say you have some Widget like this:
form = Form('FormName',
children=[
FieldSet('FieldSetName',
children=[
TextField('TextFieldName')])
])
and displayed in your template like this:
${ form.display(**form_args)}
then you can pass values into it from your controller like so:
def controller(self):
return dict(form=form,
form_args={'value':{
'FieldSetName':{ 'TextFieldName':
'Desired TextField Value'}}})
I guess it's pretty obvious in retrospect, in fact, the compound Form outputs something much like this (minus the outside dictionary), and those values can be passed right back into the Compound Form again. Perhaps, had I been actually using a Model, or gotten more sleep, this all would have been more natural - but hopefully this helps someone else.
Hint: If you're overriding templates, be sure that you're still passing the right values in to fetch the children arguments, i.e.:
${section.display(value_for(section), **args_for(section))}
Monday, September 24, 2007
Aardvark: Must have Firefox Extension
Today, I'd like to mention Aardvark. It's super useful for isolating parts of the page for easy printing, and quite easy to use, once you learn the keystrokes. I use it all the time for printing out comics and lolcats for posting on my cubical walls.
Gotcha: Toscawidgets and Mochikit
<link for=\"css in tg_css\" replace=\"css.display()\">
<link for=\"js in tg_js_head\" replace=\"js.display()\">
Now, if you're silly, like me, and don't really pay attention, you just include it, without looking too hard at your master template, which includes these lines by default:
<link for=\"css in tg_css\" replace=\"ET(css.display())\">
<link for=\"js in tg_js_head\" replace=\"ET(js.display())\">
As soon as you put the widget in your controller:
from toscawidgets.widgets.mochikit import mochikit
class Root(controllers.RootController):
@expose("genshi:mumapp.templates.sections")
def info(self):
return dict( form = InformationForm,
js = mochikit )
You start to get funny Genshi errors, mine was "AttributeError: 'Stream' object has no attribute 'tag'" which prompted me to try various combinations of adding ET() and HTML() to my templates, when the problem was that Toscawidgets cleans that whole ET/Genshi issue up and breaks when you leave them in.
So, long story short, add the site template and remove the conflicting lines from your master template. (Though, if you are mixing Toscawidgets and Turbogears widgets, you'll have to do something like what's outlined here.)