Synthesis : Scott Becker

upgrade

Upgraded the blog to the latest version of Typo, and I’m now using the “modernist” theme. I still plan to make my own design, but at least it doesn’t look like a generic typo install anymore. And thanks to Typo Filters I can now do syntax highlighting on code. That blog article seems to be the only place where it’s mentioned you can do it, and not everyone seems to know about it, so there you go.

def oh(yeah)
  render :text => "sweet!"
end

Comments Off on upgrade

good to eat mountain

west the flower fries the rib a meat
domestic life beef immerses cabbage
fragrant spring onion sauce explodes cow son
slippery meat in king’s vegetables in pillar

Comments Off on good to eat mountain

SXSW Post-Mortem

I’m back from Austin. This was my first SXSW, but probably not the last. Four days of total immersion with web professionals and super stars from all over the world can start to distort reality. But it was very inspiring! I’m full of new ideas and ambitions. One mantra from the conference to remember – ideas are 1%, execution is 99%.

At any given time, 1/3rd of the attendees were gazing into their laptop screen, usually a Mac powerbook. I guess I’ll soon be joining this world minority/design majority. I’m kinda glad I didn’t have mine during the sessions. The attendees that did were often surfing the web and reading OTHER blogs rather than paying attention! It would have helped to take more notes though – my hand is forgetting how to write manually. Many people were taking notes directly into their blogs, so I’m sure multiple outlines of every session already exists on the net some where.

Networkers paradise: I met a lot of cool people – some of the blogging elite, some who don’t blog, some old friends, and more.

Comments Off on SXSW Post-Mortem

jEdit rocks

Awesome tutorials on setting up jedit for ruby on rails development.

SuperAbbrevs is an awesome plugin that gets you the Textmate style
shortcut editing abilities…

Comments Off on jEdit rocks

A little update

A quick update:

To all who want the Grid control – yeah it works, but the code is sloppy and not very Rails-ish. Too much view logic in the controller. I want to re-write it before I put anything out there with my name on it. I’ll start “Getting Real” soon, I promise!

Comments Off on A little update

Active Record Relationship Design Patterns

In the world of web applications, eventually you’ve seen it all, and you start to see the same relational patterns occur over and over. To help out the newbies, here’s a list of various relationships (in Ruby on Rails syntax) that we see all the time.

Can you think of any more common relationship patterns?

Customer Relationship Management

class Company < ActiveRecord::Base
  has_many :contacts
end

class Contact < ActiveRecord::Base
  belongs_to :company
end

E-Commerce

class Category < ActiveRecord::Base
  has_many :products
end

class Product < ActiveRecord::Base
  belongs_to :category
end

class Order < ActiveRecord::Base
  has_many :line_items
end

class LineItem < ActiveRecord::Base
  belongs_to :product
  belongs_to :order
end

Roles Based Access Control

class User < ActiveRecord::Base
  has_and_belongs_to_many :roles
end

class Roles < ActiveRecord::Base
  has_and_belongs_to_many :users
  has_and_belongs_to_many :permissions
end

class Permission < ActiveRecord::Base
  has_and_belongs_to_many :roles
end

Mailing Lists:

class MailingList < ActiveRecord::Base
  has_many :subscribers
end

class Subscriber < ActiveRecord::Base
  belongs_to :mailing_list
end

Surveys / Questionaires / Quizzes:

class Survey < ActiveRecord::Base
  has_many :questions
  has_many :responses
end

class Question < ActiveRecord::Base
  belongs_to :survey
  has_many :choices
end

class Choice < ActiveRecord::Base
  belongs_to :question
end

class Response < ActiveRecord::Base
  belongs_to :survey
  has_many :response_choices
end

class ResponseChoice < ActiveRecord::Base
  belongs_to :response
  belongs_to :question
  belongs_to :choice
end

Hierarchical Content Management:

class Page < ActiveRecord::Base
  acts_as_tree
  acts_as_list :scope => :parent
end

Blogs:

class BlogEntry < ActiveRecord::Base
  has_many :comments, :dependent => true, :order => "created_at ASC"
end

class Comment < ActiveRecord::Base
  belongs_to :blog_entry
end

Social Networking:

(from: wiki.rubyonrails.com)

class User < ActiveRecord::Base
  has_and_belongs_to_many  :users,
                           :join_table => 'users_known_users',
                           :foreign_key => 'known_user_id',
                           :association_foreign_key => 'user_id',
                           :after_add => :create_reverse_association,
                           :after_remove => :remove_reverse_association

  def known_users
    self.users
  end

  private
    def create_reverse_association(associated_user)
      associated_user.known_users << self unless associated_user.known_users.include?(self)
    end

    def remove_reverse_association(associated_user)
      associated_user.known_users.delete(self) if associated_user.known_users.include?(self)
    end
end

Any major ones I’m missing here?

Comments Off on Active Record Relationship Design Patterns

Discovering Podcasts

Podcasts are great. I only listen to them when I’m stuck in a car driving and can’t do anything else, but when you ARE doing that, it’s a great way to keep your brain active. It also allows you to fulfill your dreams of thinking about whatever you’re interested in literally ALL the time. Forget day dreaming and thinking about other aspects of life. I now think about web design and development 20% more of the day, not to mention balancing my two careers where I do just that! Oh well, this is an experiment in total immersion.

My favorite podcasts:

Venture Voice: This is the model by which interview-style podcasts should emulate – Greg Galant has a professional, polished interview style which makes you forget this is a Podcast and not NPR. He’s also got one of the more unique accents our there (atleast to my Florida ears), and seems to be able to get interviews with anybody who’s anybody in the tech and venture capital worlds. Listen here for inspiring stories from people in the trenches building new companies right now.

Ruby on Rails Podcast: The web development framework which continues to kick ass has its own Podcast, hosted by Geoffrey Grosenbach of TopFunky.net, author of the nuby on rails blog, the Sparklines, Gruff, and pure-CSS graphing libraries for Ruby, and lots of other helpful stuff. This Podcast interviews the who’s who in the RoR world, where the creators and big users of RoR get together and feel good about Rails.

Boagworld.com – A couple of funny brits hang out and talk web design. Each show focuses on a specific aspect of the biz. They go off on tangents here and there, but I’ve already learned some interesting tidbits from the couple shows I’ve listened to so far. And I’m getting better at imitating british accents at the same time!

Web 2.0 – A couple of funny americans hang out and talk web 2.0. They also conduct interviews. In show 7, Jason Calcanis of Weblogs, Inc. basically turns the interview around and asks the interviewers a lot of the questions. It’s funny. This is another show to hear interviews from the who’s who of the web.

I also plan to check out the Audible Ajax podcast, since they just interviewed Thomas Fuchs of Script.aculo.us, and the newly discovered Duct Tape Marketing podcast, since they conducted yet another interview of Jason Fried. Although, I don’t know how much more Jason Fried interviews I can take. I like the guy and his company, but I’ve already heard the gospel many times, plus I regularly read Signal vs Noise and peruse the 37signals website. How much new information could their POSSIBLY be?!

Never the less, I can’t resist, and I will probably download these new interviews at Duct Tape and Web 2.0 just in case there is anything new or inspiring in them.

Comments Off on Discovering Podcasts

google maps api

I started messing around with the Google Maps API today. Seeing all these “mash-ups” has convinced me that it must not be that hard, and it isn’t!

One thing you quickly discover is that google doesn’t supply you with a built-in way to translate an address into lat/long coordinates – the input they accept in order to plot points on the map.

So, I search for ways to do that, and find an article by John Resig that shows how to use perl to create a proxy to GeoCoder.us. That was exactly what I needed, except I needed it in C#. I bet if I searched harder, I could’ve found something, but it was pretty quick to whip it up myself, so here’s the code to do it:

double geoLat;
double geoLong;

// Address of Google
string address="1600 Amphitheatre Parkway,  Mountain View CA 94043";

string url = "http://rpc.geocoder.us/service/rest?address=";

XmlTextReader reader = new XmlTextReader(url + address);
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(reader);

XmlNodeList gPoints = xmlDoc.GetElementsByTagName("geo:Point");

geoLat = Double.Parse(gPoints[0]["geo:lat"].InnerText);
geoLong = Double.Parse(gPoints[0]["geo:long"].InnerText);

Comments Off on google maps api

up and away

Sweet, I’ve finally managed to upgrade to the latest Typo release (2.6.0) and move this blog to Dreamhost. I just couldn’t get my sites to stay up on Textdrive, so unfortunately I’m having to move away. I really like TxD, with the cool hacker culture, the active forums and direct association with rails, but I just found them to be too unreliable. More often than not I would go to my sites and find them down, or getting a random error. I realize its a challenge in a shared hosting environment, with lots of developers trying random things, but I haven’t been having these issues at Dreamhost, so here we are.

Comments Off on up and away

up down up down

My textdrive websites (including this blog ) have been going down as much as they have been staying up. For no reason, whatsoever. As you can imagine, this is immensely frustrating. At some point in the past I setup Daedalus to detect the absence of a lighttpd process and restart it, but i realized today that the daedalus process wasn’t setup as a cron job, so it wasn’t running, thus my lighttpd instances weren’t getting restarted. I’ve been restarting them manually lately, whenever i discover the sites are down, which seem to pretty much daily. Why lighttpd suddenly ceases to run, I have no idea. I have lighttpd setup as a cron job to start every time the server boots, but this apparently insures nothing. Add to that the fact that the server – Pendrell – seems to cycle all the time, and goes down a lot. It was down yesterday. Now that Daedalus is cron’d, hopefully things we’ll be up a bit more!

We’ll I got a second account at Dreamhost, because A – they are cheaper, B – they support rails, C – why not, they had a sale. I have followed their instructions and got rails up and running. One thing that puzzles me though, despite the fact that my sites are running in production mode on Dreamhost, it seems like it is reloading everything on every request. (Unlike lighttpd on textdrive, i dont have to start any process, you just drop the right files in the directory, give the public folder execute permissions, and you’re off to the races.) BUT, is it caching anything? Keeping any ruby processes alive? If I change a file, i dont have to stop/start, it simply sees the change. And seems a bit slower than textdrive, like its reloading every time. But this contradicts the idea of production mode, where things are supposed to be cached. Is there a way to get things caching in memory, and boost the speed a bit? I hope someone can enlighten me.

Comments Off on up down up down