Advertise here!

Steal This Color Scheme

A lot of times when I’m playing around trying to come up with web pages, I have a hard time coming up with (and often horrible taste in) color schemes. I’m trying to learn to follow some simple guidelines of either tying similar fonts/colors/sizes to become the same, and for things that I want to contrast to really contrast. [A good source of these guidelines, very simply described, is The Non-Designer's Design Book]

In any case, if you find a site that you love, and you want to see their color scheme, this handy site will be just what the doctor ordered. It extracts the colors used by the site and in it’s stylesheets and presents them to you in their full hexadecimal glory to… borrow.

Posted at 6pm on 07/28/05 | Posted in | 1 responses | read on

Google Sitemap generation with Rails

Tristan at IP Angels, has a nice little post on generating Google sitemaps with Ruby on Rails. The post gives a great example of generating a sitemap for a blog. I can’t get access to the latest Typo snapshot to create a patch yet, but here’s what I think it would look like to add this into Typo.

First, edit the xml_controller.rb to add a new action, sitemap.

def sitemap
    @headers['Content-Type'] = 'text/xml; charset=utf-8'
    @articles = Article.find(:all, :conditions => 'published=1', :order => 'created_at DESC')
  end

Next, create a sitemap.rxml file in app/views/xml.

xml.instruct! :xml, :version=> '1.0', :encoding => 'UTF-8'
xml.urlset( :xmlns => 'http://www.google.com/schemas/sitemap/0.84') do
  # First entry is the main entry to the site
  xml.url do
    xml.loc server_url_for(:controller => "articles")
    xml.changefreq 'daily'
    xml.priority '0.9'
  end

  for entry in @articles
    xml.url do
      xml.loc article_url(entry, false)
      xml.changefreq 'weekly'
      xml.priority'0.5'
    end
  end
end

And remember, I just whipped this up without trying it.  So..

"Beware of bugs in the above code; I have only proved it correct, not tried it" - Donald E. Knuth

Posted at 3pm on 07/18/05 | Posted in , , , | 3 responses | read on

It Isn't "Zero Deploy"

Patrick Peak has written up an article with his thoughts after attending a presentation by David Geary about Rails. In the presentation David said that Rails was “zero deploy time”.

The quote is misleading, and Patrick was mislead. Rails is not zero deploy, it’s “zero compile”. The difference is that you can edit a file in development and reload your browser to get the changes – there’s no intermediate compilation. The Java world has on-the-fly compilation of JSPs and some can even do .java – but the fact remains there’s a an intermediate compilation step, and that not every Java developer has the environment or toolset to do that on-the-fly compilation (or probably more likely, most don’t).

Patrick went on to assume all sorts of bad practices were common amongst rails programmers, but we’ll just be nice and say that he was mislead by the quote and be done with the whole affair. (He also erroneously noted that there’s nothing like Ant for Ruby. First, Ant isn’t particularly language-specifc. Beyond that, Rake is an excellent tool for Ant-like tasks that uses Ruby code as declarations – not XML).

Rails deployment is probably remarkably similar to any other language. You work in development mode locally, test your changes, and eventually push the changes to the server. A good discussion of this is written up by Jamis Buck.

I’m looking forward to see the release of the “release manager.” It’s certain to make it easier to practice good deployment techniques with Rails.

Update: It appears that this has also been commented on by DHH, Dave Thomas, and the original Ant (and Tomcat) author himself, James Duncan Davidson (who also goes into details about how he and Mike Clark of Pragmatic Automation fame deploy their rails app.)

Posted at 7pm on 07/15/05 | Posted in , , , | no responses | read on

Invalid CSS with Ruby Syntax Highlighter

I regularly use Carl Drinkwater’s Ruby Syntax Highlighter for my postings containing Ruby code. When I was checking my site for valid XHTML and CSS I noticed that I had a few problems coming from the generated HTML and the CSS snippet he provides.

I’ve emailed Carl to let him know, but in the meantime, if you use his syntax highlighter you should change the CSS provided to be:

<style>
.keyword { font-family: monospace; color: #8B0000; }
.constant, .attribute, .global, .class, .module { 
    font-family: monospace; color: black;
}
.string { font-family: monospace; color: #00008B; }
.ident, .method { font-family: monospace; color: #006400; }
.number, .char { font-family: monospace; color: #888800; }
.comment { font-family: monospace; color: purple; }
.symbol { font-family: monospace; color: #884400; }
.regex { font-family: monospace; color: #808080; }
.punct { font-family: monospace; color: black; }
.escape, .interp, .expr {
    font-family: monospace; color: black; background-color: #dddddd; 
}
</style>

The original CSS he provides uses named colors which are not standard.

I also noticed some invalid XHTML being produced but now that I go back and check his site, it seems to be working fine. It might just have been my desktop blogging software or Typo (I’d bet the blog software over this) that re-interpreted the HTML and mangled it to be invalid.

Just for reference, the problems I was seeing were end span tags in all caps, and class attribute values being unquoted on some span tags.

Posted at 6pm on 07/13/05 | Posted in , | no responses | read on

Older posts: 1 2 3 4