occasionally useful ruby, ubuntu, etc

10Aug/090

Web server output generation design patterns

There are several styles of content generation that I know of so far...I'm reviewing them because I'm looking to see if there could be something better.

Flat-file

Example: plain ol' PHP

PHP, at its simplest, doesn't have any separation at all -- you can, if you choose, have all the programming/form-processing logic in the same file that renders the output to the browser.  While simple, if you're creating a full website, this can be cumbersome and confusing.

Filed under: musing Continue reading
9Aug/092

phew

Migrated from Slicehost to Rackspace Cloud (which is basically the same company). Should save me $10 a month! Moving databases and service configurations over is a pain, though.

19Jul/090

Design pattern/flow for building a website

So here's how I normally do things:

  1. Do as much of the models as possible in this first pass, skipping validation but including schema stuff
  2. Stick a couple things into the controllers that I think I'll need
  3. Build out some of the views, giving them some basic styles
  4. Revisit the models to add validation, helper methods
  5. Build out the rest of the views, give them real styles
  6. Muse about specs, then give up before starting
  7. Put more stuff into the controllers
  8. Iterate on random components until you're done

Needless to say, I'm getting to the point where my lack of organization kills my mini-projects before I hit step 4, sometimes even sooner than that.  So I'm going to try a slightly more...conventional (or widely suggested, at least) approach:

  1. Create controllers with just enough information so that your pages will display.  No setting variables yet or other logic!
  2. Fill out the views with as much HTML and fake data as you need.  Site have a sign-in page?  Leave a link to "force sign-in" the user that simply sets them to an authenticated state.  All it should do is set a session variable
  3. Spec out the models.  Don't check for validation yet, just check for core functionality, i.e. there is a User table, the first user has a name of Foo and email of bar@baz.com, etc.
  4. Fill out your model code so that the specs pass -- this includes migrations with sample data (these can be removed in a later migration).
  5. Spec out your controllers/views.
  6. Fill out your controllers/views so they pass specs.
  7. Do the rest of the little things that need doing, like validation, error messaging, authentication, styling, etc.
  8. Revel in having finished a project.

Hopefully I'll get further than step 3 this way! I'm going to try to focus more on content/frontend instead of getting bogged down in the backend, and I want to actually write specs.

Any comments/suggestions?

Filed under: musing, ruby No Comments
25Apr/0910

Vostro (1400) + Ubuntu 9.04 + sound issues

Another Ubuntu upgrade, another sound configuration that doesn't work out of the box.  This is what I had to do for Ubuntu 8.10, that also worked for this version:

$ sudo vim /etc/init.d/alsa-utils

Around line 364, replace this

[ "$TARGET_CARD" = "all" ] && log_action_end_msg_and_exit "$EXITSTATUS"
exit $EXITSTATUS
;;
stop)

EXITSTATUS=0
TARGET_CARD="$2"

with

[ "$TARGET_CARD" = "all" ] && log_action_end_msg_and_exit "$EXITSTATUS"
exit $EXITSTATUS
;;
stop)
 ifconfig wlan0 down
ifconfig eth0 down
 EXITSTATUS=0
TARGET_CARD="$2"

Then restart.  In 9.04 I also had to go through my volume control panel and make sure nothing was turned all the way down or muted.  I think I had to unmute the master volume and turn PCM Playback (under HDA Intel) up.

Please comment if this helps you!

UPDATE April 29th, 2009: I also had to reinstall flash in order to get sound working in Firefox again.

19Apr/092

XSLT is a giant pain

Some of you may be aware that XML+XSLT 1.0 can be rendered directly by modern browsers (even IE6!), which led me to thinking that it may be a good idea to give it a try and see how good or bad it was.

Tagged as: , Continue reading
18Apr/095

Announcing: Ramastic, a skeleton for Ramaze

This is something I've been working on since slightly before my original call for suggestions a while back.  It's not done yet (I'd say it's somewhere around 75% done) but I want to get it out there before I totally lose steam on it.  There are a few inline styles I was planning on removing, but haven't gotten around to, so...apologies.  If you find it of use, please leave a comment.

And yes, it doesn't look that great.  But I'm expecting you to restyle everything anyway and possibly blow away the templates entirely in your instantiation of the skeleton.

Now, without further ado, here are features and screenshots:

Features/requirements

Screenshots

Repository

Github.

Thanks for looking!

Filed under: ramaze, ruby 5 Comments
8Apr/092

Ideas Needed for Mr. Bones skeleton built on Ramaze

If I were to make a skeleton using Mr. Bones that was built on Ramaze, what would people like to see in it?  It's for my use first, but the community's use a close second if I can generalize it enough.  I was thinking along the lines of openid support, having a decent home page and logged-in-user gateway, appropriate nav-bars, haml+sass, jquery+ui, etc....thoughts?  What do you find yourself doing at the beginning of every website project that you'd like to not have to repeat every time you start a project?

Filed under: idea, ramaze, ruby, web 2.0 2 Comments
2Apr/090

re-"require"-ing: how's the speed?

What this is about

So I like the design that, when you need a particular library in your code, you require it in right there in the method/class (JIT library-loading, so to speak), even if it means the require directive will get executed more than once. Running through irb you can tell that calling require twice on the same library is usually much faster the second time, but how much faster?
Read on for benchmarks!

Filed under: ruby Continue reading
31Mar/090

Starting new projects

So I know I'm not the only dev who does this, but I tend to start a lot of projects -- and not finish them. I'm coming up with a checklist of things that I want to make sure I do before getting involved in any new projects.

Read on for some of the initial questions you should ask yourself, and what to do next.

Filed under: musing Continue reading
10Mar/090

Nifty easy screencast software

Not necessarily the easiest or the best, but it certainly looks cool and could very much have a niche to call its own. It's called uTIPu.

Check it out. Someday I'll create a screencast for something useful.