posts by tag

site (31)
Introducing the new Portfolio

Finally. It’s done. And here it is.

I’ve been wanting to do this ever since I cleaned up this site, but kept putting it off because I knew it would be a job. Don’t get me wrong, I enjoy this stuff, but toward the end I just wanted to finish it. It’s bitter sweet I suppose.

The design will remind you of this site, but that was intentional. There are plenty of subtleties that make each of them their own, but overall they both have that left justified, white column, right-hand sidebar feel. Plus the colors are nearly the same. Again, it was intentional.

The part that I may have enjoyed the most about this whole process was getting rid of that last little bit of slop from the old portfolio (if you’d even call it that) that I had on this site. I removed like 12 actions, 2 models (and hence, 2 database tables), and tons of views and helpers. It felt good. I left it alone during the last cleanup because I knew I would be back in here once I finished the new portfolio.

Why Is There Still a Portfolio Tab?

Rather than eliminate the portfolio section entirely, I’ve decided to integrate the new portfolio using REST (courtesy of ActiveResource), so it’ll just automatically update itself. I didn’t go crazy or anything, though. I’m more-or-less just giving a brief listing of the projects and photos. However, I did put a notice at the top of every portfolio page to alert those ghostly internet wanderers that there’s a new sheriff portfolio in town.

IE Blows

And like always, IE drove me nuts. I think I’ve got most of the kinks worked out, but I’m sure there are plenty I’ve yet to discover. Probably the biggest annoyance during this whole process was the non-support for alpha-transparency in .png images. I think that’s all I used, so initially, IE6 looked ridunculous to say the least. The fix I’m using has a hard time catching every CSS background-image (especially concerning the response of an Ajax call), but it’s better than nothing. I’ve decided to let the petty stuff slide for now, but let me know if you see anything major.

RSS Feeds

There’s a project feed and a photo feed (which I’ve also linked up at the top of this site). Oh, and the feeds don’t give you per image descriptions, just per photo/project descriptions. And for a photo you’ll get the image itself in the feed and for a project you’ll get the first of many screenshots. But again, no image descriptions in either case. So to see everything you may have to click over to the site itself. Boo hoo.

If you’re seeking more details, I’ve posted the new portfolio as a project within itself. I believe there are 16 screenshots and I explain a little bit about each one. Check it out if you’re so inclined.

Over the next few weeks you should see a flood of content as I try to get caught up. I think I previously had 10-12 projects here, so I at least have that many right off the bat. Then there are a few that I’ve been neglecting for a while.

So that’s it. Feel free to post your thoughts. Goodnight.

Site updates

I spent the last day or two upgrading this site to run the latest and greatest Rails 2.0.2. Obviously, I didn’t want to upgrade without using what made me want to upgrade in the first place, so there I was, yet again, rewriting my code to be much leaner and meaner. This is probably the largest refactor I’ve done in terms of restructuring, but it desperately needed to happen.

Briefly, here are the (noteworthy) changes:

  • fixes/modifications for Rails 2.0.2 compatibility
  • complete revamp of the code base, now supporting a RESTful design
  • posts are now located at /posts/:id instead of /posts/:year/:month/:day/:permalink (sorry to break your bookmarks)
  • archives now act like real archives (you can no longer get to posts for December of 2007 by visiting /posts/2007/12, instead try /archives/2007/12 – the same goes for tags: /archives/tag/:name)
  • removed “featured project” from home page
  • added popular tags and recent comments in place of “featured project” on home page
  • removed popular tags from sidebar and increased del.icio.us bookmarks to show 12 instead of 8
  • implemented a new API module used to cache del.icio.us bookmarks and flickr photos (still have more changes to do there)
  • added an admin namespace to replace inline editing (feels much cleaner to me)
  • rearranged/removed several controllers/actions to make more sense

That’s basically it. Most of the changes were behind the scenes, except for the new addition to the home page. The only section that didn’t receive any attention was the portfolio. And that’s because I’m working on a new portfolio that will eventually let me get rid of the half-assed effort I have now. When I’m finished with it, it will be its own beast and live at its own (sub)domain.

UPDATE

I added support to map the old URLs, as well as the new ones. So bookmarks (like there are any) should still work.

Upgraded syntax highlighting

I’ve been wanting to upgrade the syntax highlighting on this site for some time now. It’s perfect for Ruby, but it lacks support for other languages. Particularly, though, Rails’ view code looks horrible. It parses everything between the slashes, <td/>...</tr> for example, as a regex.

the solution

Enter Ultraviolet. To quote the site, “it is able to produce html output for all the syntaxes in Textmate’s repository.” Which is a ton. It also supports themes, line numbers, and has xhtml output. Here are a couple of examples…

# xhtml output for Ruby on Rails, 
# with line numbers, using the blackboard theme:
html = Uv.parse(text, "xhtml", "ruby_on_rails", true, "blackboard")

# xhtml output for ERB (view) templates in Rails, 
# without line numbers, using the sunburst theme:
html = Uv.parse(text, "xhtml", "html_rails", false, "sunburst")

It’s pretty cool. Chris was kind enough to show his implementation for syntax highlighting, but I needed to make a minor modification to the regexp to support code.[language] instead of only code.ruby. Here’s the Ultraviolet version:

require 'uv'

def colorize_code
  r = RedCloth.new(self[:body] || '')
  self[:body_html] = r.gsub(/<code.(\w+)>\s(.*?)<\/code.\1>/m) do
    lang, code = $1, $2
    html = "<notextile>" + Uv.parse(code, "xhtml", lang, true, "sunburst") + "</notextile>"
  end.to_html
end

I enjoy the line numbers, but by default they’re included with each line of code—to copy and paste means to remove each line number. If you care about that, here’s a way to create your own line numbers so that the code and line numbers are separated.

require 'uv'

def colorize_code
  r = RedCloth.new(self[:body] || '')
  self[:body_html] = r.gsub(/<code.(\w+)>\s(.*?)<\/code.\1>/m) do
    lang, code = $1, $2
    html   =  Uv.parse(code, "xhtml", lang, false, "sunburst")
    result =  "<notextile><pre class=\"lines\">"
    result << (1..code.split("\n").size).to_a.join("\n")
    result << "</pre>#{ html }</notextile>"
  end.to_html
end

Then just do a float:left; on the .lines CSS class, and viola, your line numbers are separate from your code. There’s one more thing to make note of, though. As horrible as this sounds, you may want to use an inline style on the pre tag in place of the CSS class. The reason is because of how the code will look when it goes out to an RSS reader. What it’s doing is putting an extra pre block with just the line numbers above your code, but the CSS makes it appear beside it. Personally, I found style="float:left;padding-left:10px;" to work well.

ultraviolet in production

So the implementation is pretty easy, but here’s where things get difficult and very annoying. This is also why I’m not currently using Ultraviolet (in production) yet. You see, Ultraviolet indirectly requires the use of the (what is supposed to incredible) Oniguruma regular expression library, which isn’t packaged with Ruby until Ruby 1.9 (but is available as a gem).

I installed the gem without any problems on my machine; however, I could not for the life of me get it working on DreamHost. I freeze my gems, but the problem is that it had to be installed and frozen from the server and not my local machine. Since I’m on Windows (blah) in development, the oregexp.c file was compiled for an mswin32 environment, which is not the case in production. Apparently that matters. I have very little experience modifying environment variables and .bash_profile and all the other jazz I found online, so I was a little timid to go further than I’d be able to fix.

unfortunate conclusions

After a couple (or few?) hours of hacking at things I didn’t really know how to hack, I ended up back at the beginning: using the plain old syntax gem. What a great feeling it is to waste hours of my personal time.

I considered extending the syntax library to satisfy me for the time being (mainly for view templates), but I haven’t decided yet if I want to get into that or not. But definitely not today. I’m burnt out on syntax highlighting.

In the end, Ultraviolet is an awesome syntax highlighting library, and you should think about using it. Unfortunately for me, I was unable to get it working on DreamHost thanks to Oniguruma, but maybe (if you actually know what you’re doing) it’ll go better for you. Good luck!

Spam is extremely annoying

After 529 comments spam-free, it finally happened (3 comments worth). With this new release I changed the spam protection to use a different method, but alas, it has failed me. So the myth that you can stop spam via CSS is false. I should have known better than to fool with something that was working perfectly.

For the record, I just may hate spam more than anything else in my life—it’s so frustrating.

Revamped and absolutely positioned

A long time ago I decided I wanted this site to represent my interests, creativity, and expertise. I believe I’ve yet to achieve that until now. So, to that end, I’m unveiling yet another redesign. As you’ll notice, I’ve kept a few things from the last design (mainly the colors), but I believe it’s more aesthetically pleasing and somewhat easier to navigate.

Relocating the posts

The first order of business was to relocate the posts. Having the posts basically make up the site made me feel a bit guilty if I didn’t post frequently. Also, I began to realize how uncomfortable it was having the posts blatantly hog the site’s entrance. It didn’t quite hold true to what I wanted the site to represent, so good riddance to that idea.

Just the right width

I finally decided to ignore the 800×600 screen resolution. The last design had a fluid center column, which dealt with smaller resolutions quite nicely. However, a maximized browser on a wide screen monitor was horrendous. Google Analytics told me quite a few visitors have wide screens (and one or two, if any, used 800×600). For this design, I chose a width for each section (left, center, right), and it just so happened to be 900+ pixels. Oh well. Anyone still sporting an 800×600 resolution probably wouldn’t realize the horizontal scroll bar, anyway.

Web designer’s curse

Of course, I could come up with a ton of reasons for another redesign, but none of that really matters. A lot of people can recognize when a site goes stale and needs a new look. But to a web designer, his/her personal site goes stale much quicker than any other. It’s rather bitter sweet. I love the refreshed feeling of a new design, but quite frankly, a new design is a lot of work and a lot of time. However, it can’t be ignored until a new design is realized, hence, the curse.

Lately, I’ve been asked on several accounts to show prior work (read: portfolio), so in that regard, it feels more appropriate to put a little more emphasis on the portfolio and past experience. This is a far cry from anything professional, but I’d say it’s a step in that direction.

Say goodbye to categories

Chris was right. The categories and tags were overlapping. So I dug deep and somehow found the strength to remove the categories! Actually, you just can’t see them anymore. All of the helpers and methods are still there, and I’m still associating categories with my posts… you know, just in case. Did you think I was that crazy??? It’s definitely less redundant, and all I have to do is get used to the less-dressed left sidebar (say that three times fast) and not add anymore useless information.

Borderless designs

I used to be obsessive about borders in a design. Obsessive in the sense that I had a hard time leaving them out. I felt as though they were necessary to crisply distinguish sections of a site. I believe I’m growing out of that, now. I’ve intentionally left the borders off of my site this time1, since I was confident contrasting colors would be just as effective. While borders are nice in a lot of instances, I’m digging sites without borders more and more.

  • Example 1—slight use of borders, but overall it’s the colors that separate the content
  • Example 2—borderless for the most part
  • Example 3—very clean design (I like this version more than the redo)

1 I realize there are a few borders here and there (code snippets, the comment form, etc), but I’m mainly referring to the content containing area, and major focal points: the site header, post headings, comments, and so on.

Site updates and new additions

I recently got a little ambitious and decided to make a few changes. The most obvious is probably the post headings. I thought they blended too well with the rest of the site, and felt they should stand out a little more. So I did just that. I’ve also eliminated the 100% stretch of the post header and comment form. I don’t know why I did that, though. A matter of personal preference I suppose.

The new additions concern the portfolio section. It’s far from anything professional. It’s a quick-and-dirty approach, but I like having a space to collect a few of the sites I’ve built. That’s nothing new, but this time I’m using attachment_fu to load multiple screen shots per project. attachment_fu is awesome if you didn’t already know.

Something brand new is the photography section of the portfolio. There’s definitely nothing tricky there, I’m just pulling in some favorites from flickr (that I took, of course). I love looking at photos, even if they’re my own photos :-)

Oh, and I’m using lightbox v2 to display the screen shots and photos in the portfolio. The mootools version is slightly faster, but Rails already integrates with prototype and scriptaculous very well, so that was the route I took. As far as I know, everything looks good (and works) in all browsers (I haven’t made it to a Mac, however, but I don’t suspect any complications there).

How to automate tasks using Ruby or Rails?

I’ve yet to get the cron job to consistently execute for the flickr and delicious caching. I’ve tried several different things, but nothing seems to work. So I’ve started seeking alternatives. There are three different methods listed, but it’s not obvious to me how they might work. If I were to setup a scheduler, would I then “start” it when Rails initializes in environment.rb? Of all three options, I’m at a loss as to which one I should pursue.

Right now I’m calling refresh_api_cache via a “refresh” link that appears upon login:

def refresh_api_cache
  reload_cache(ENV['RAILS_ENV']) and redirect_to :back
end

private

def reload_cache(env)
  command = "ruby #{RAILS_ROOT}/script/custom/api_cache.rb"
  env =~ /development|test/ ? system command : exec command
end

That’s not terribly inconvenient, but it requires two things to happen (tag something in delicious or flickr and then come here and click “refresh”). I want this to be automated. Any tips on scheduling in Ruby/Rails?

Trouble sorting a hash (sort of)

Last night I removed my custom tagging system, and converted to acts_as_taggable. I’m thinking DHH’s code is probably a little bit better than mine (just a hunch). I’m also converting my tag methods to use some of the other nice things acts_as_taggable provides, such as: find_tagged_with, tag_names, and one of the reasons for this post, tags_count.

The tags to the left are now being pulled via the tags_count method, but I run into a problem. That method returns a hash where the key is the tag name, and the value is the post count (i.e. [[“rails”, 38],[“personal”, 37], ...]). That’s great and all, but I need to sort it in descending order, based on the value and not the key. So here’s what I’m doing:

def self.get_popular(options={})
  Post.tags_count(:limit => (options[:limit].to_i || 10)).invert.sort.reverse
end

The #invert method of the Hash class essentially swaps the key => value pairs to become value => key pairs. This allows me to call #sort which will then sort by the value (aka the count) rather than the key (aka the name). And at the end of this chain we have #reverse which just gives me the descending order. Seems to work, right? Well, almost.

The problem I’m having is when two tags have the same post count. It seems to then grab only one of them (the first in the alphabet?) I don’t exactly know if this is something I’m worried about fixing, but it makes me feel as though I’m not in control of the code, which I don’t necessarily like. Plus, I don’t know that I fully understand what’s happening, here. It’s ignoring the redundant values in the sort. Thoughts/ideas are welcome, even if it means a new method to get the posts-per-tag count.

post headings: inside or out?

Originally, I had the post headings flush with the center column. I liked it that way, and then during one of the five times I adjusted the column widths, I accidentally left too much padding on those headings. Once I saw it, I thought it to be a good way to make the headings stand out more. But now, I don’t know if I like it. What do you think?

Yet another redesign for rpheath.com

And here’s the real reason why I have a site (read: so I can rebuild it over and over). I’ve stripped it down to the bare essentials, and found better ways to implement what was left.

This is my first 3-column layout, although it doesn’t really feel like a 3-column layout to me. And maybe that’s a good thing. Point being, I wanted something different from previous versions, and quit making it more than it had to be. I’ve yet to supply a list of full entries up front. But it was long overdue. I’m actually satisfied with the code this time, and I refused to cut corners. Now, I feel as though it’s worth the effort to make changes and enhance what’s here.

thanks to chris scharf

For a few things, actually.

  1. Idea for a no admin interface (although I’m not using the authentication key, I did manage to get rid of the entire admin section).
  2. Idea to list posts not based on a limit, but on a period of time. However, if I go on another posting drought, rather than letting the site go blank, I’m using the month number as the limit of recent entries (so April would be four entries, May would be five entries, and so on).
  3. And finally, the eztime plugin. I’ve been dragging my feet on using this, and although I’m not overwhelmed with time formats here, I can see its power. Playing a bit in the console has shown me how intuitive it is—great choice of keywords.

keep an eye out

I’m not claiming that there are no bugs, so if you notice one, please let me know. Like I said before, I’ve tested it in [mac] Firefox, Flock, Safari, [windows] Firefox, Flock, IE7, IE6 (I hate the has layout problem). I’ve also mapped the old RSS feeds to the new methods, so you shouldn’t have to update your feeds—let me know if it’s not working. And that’s about it. I might post a follow-up on more details, but we’ll see how it goes.

CSS, IE, and conditional comments

I’ll start off by saying I despise Internet Explorer—all versions. I mentioned my desire for a fresh site, and so over the last couple of days (mainly the weekend) that’s what I’ve working on. I only have a few more hours left, mostly on admin-ish type features (as of now, I have no way to post, edit, delete anything). I’ll save the details for the “grand opening” post.

But I do want to express my frustrations with building the layout. First, CSS is amazing; second, IE is not. I know I could ignore IE, since hardly anybody I know uses it, but it’s tough for me to accept my site not working in certain browsers. It’s an unfortunate disease.

I’ve decided on a 3-column layout (my first ever). I wanted the side columns at a static width, while the center column (the content) was liquefied. Despite what you may think, that’s not the easiest cross-browser layout to achieve—for me, anyway. So I decided on 1 of the 10,000 ways this could be done. Everything was going as I expected it to (in Firefox). Those expectations also included the layout not working in IE6. And of course, it didn’t.

So I started writing some * html hacks, and got everything aligned to match Firefox. I finished it up, pulled in some real data, and everything looked good. I was satisfied. Then I thought, “well, I had better check IE7,” just to be sure. Lo and behold, the left column was missing entirely. I was livid. Here we go again.

I stripped out all of the * html crap and made separate CSS files: a default, one for IE6 hacks, and now, one for IE7 hacks. So currently, I’m using conditional comments to load separate style sheets. What an ugly pain. The thing that bothered me the most is how IE6 was closer to being correct than IE7. For IE6, I really only had to adjust the left hand column width a bit (and a few other things, of course), but at least I could see the column. For IE7, I had to entirely change the positioning. Once I found it and brought it back, it wouldn’t re-adjust with the fluidness of the center column; it would either gap or overlay it, which was hideous.

Based on what I know about CSS, Firefox did exactly what I expected. Both IE’s did not. Granted, my CSS may not have been ideal or I should have done it a different way, IE has done nothing in the past that would let me believe it was my fault. I expected more out of IE7, not less.

In closing, here’s the status. I’ve approved the layout in the following environments:

  • Windows: Firefox, Flock, IE6, IE7
  • Mac: Safari, Firefox, Flock

And all is well, finally. I didn’t bother with IE on a Mac, because I figured anyone with a Mac is NOT using IE. And if they are, they’re not interested in my site :-) And now I have class tonight and tomorrow night, so that will more than likely delay progress for two more days. Blah. I’ll keep you posted.

It was only a matter of time

I’m growing terribly sick of this site. To me, the design is very ugly and bland. It all started to go downhill when I began to realize (and despise) the faded/foggy look from the blend of color choices I’ve chosen. I’ve made an attempt to sharpen things up a bit, and it worked, but was nowhere near enough to bring me back as a fan of my own site.

I no longer like showing a little bit of the “Latest Post.” Really, that doesn’t do anybody any good. It’s a hassle for me, because if the post contains an ul or blockquote or h2 or whatever, I have to worry about the word count ending before the closing tag, which would throw the entire page layout off the rocker. As a fix, I just strip out all of that stuff from the main page (and the bits, as well). It’s a lame solution to something that has no benefit to begin with. There are a few other things like that, but I’ll spare you the details.

My first post on this site was sometime in August of 2006. It’s amazing how much I’ve learned since then. Compared to now, the code here is a mess. But I guess that comes with learning—old code always seems like a mess. In a way, I want to start over again on a clean slate, but as always, time is against me.

I have an idea for something simple, and now, I could probably throw it together rather quickly. I just don’t know if it’s worth it. I thought about Mephisto or a similar solution, but I like to get more experience something out of it. Plus, I enjoy going custom with my own site. I guess I’ll figure something out, and hopefully sooner than later.

A wise man once asked me...

...So you aren’t caching the API data? Hanging my head, I had to answer with a No. But I decided to look into that option, as it would remove the direct coupling of my site and the APIs, speeding things up a bit in the process. While you may or may not have noticed, the main page has been an arbitrary hit-or-miss the last couple of weeks. Sometimes it’s up, taking it’s normal 4-5 seconds to load, and other times (when the delicious response data is randomly empty) it would either hang or instantly die (hence, the direct coupling).

Yesterday after church, I finally sat down to work out the kinks. I was fed up with the slow loading and down time. Using the suggestions Chris proposed, I was able to get things going. I’ve never used the Marshal library before, so I didn’t know what to expect; but it turned out to be extremely straightforward. I also wanted to use pure Ruby (no Rails) in my script, so I had to tweak it a little.

I exported the inner-workings of the original methods that grabbed the flickr and delicious data, and put that processing in a Ruby script located in my script folder. As expected, a few things were no longer accessible, including the to_date method. I just used the Ruby libraries directly (such as Date.parse in place of to_date to convert the ISO 8601 format). And all was well.

So the script processes the API data and Marshal.dump’s it to the file system. Those previous methods now simply look for the cached file and Marshal.load it back in, rather than dealing with the API responses directly. Not only do I like this solution a lot more, I’ve cut the load time of the main page from 4-5 seconds down to < 1 second (checked against one of those web page analyzers).

So the core of all of this is working; however, I do still have a problem: automating the script to run on a 30 minute schedule. I have a cron job for this, but apparently it isn’t working. Here’s the cron:

*/30 * * * * /usr/bin/ruby ~/rpheath.com/site/script/api_cache.rb >/dev/null 2>&1

The job is listed there when I check with crontab -l, but I don’t think it’s doing anything. Once I figure that out, I’ll be good to go. Oh, and thanks to Chris for the idea.

Sharpening the dull CSS

Ever since its inception, this site has carried somewhat of a blur. I don’t know if anyone has noticed, but the combination of colors was making me feel like I needed to rub my eyes as if I just woke up. That’s a little hard on readability (even though most of you are probably coming through an RSS reader). Anyway, after class this evening, I took some time out to sharpen those dull colors just a bit. Nothing major, just a few HEX values darker in some cases. I also made a few other insignificant CSS/template changes while I was at it (such as a new comment form, clickable portfolio images, etc.). So if things are looking a little weird, you may want to refresh your browser to get rid of that dull CSS stored in your cache—just a heads up.

Having trouble going Home

I can’t seem to access the homepage. It has been acting funny over the last few days (maybe even weeks). It was up and running fine last night around 12:30 AM, but was down for an hour or two yesterday afternoon. Go figure.

I can’t blame this one on Dreamhost, but it has to be someone’s fault other than mine, right? So I think I’m going to blame net/http. Originally, I was going to blame the flickr api, but hitting it directly returns what I would expect. However, the problem is generated in the setup_flickr method, which uses net/http. That doesn’t make sense, though, and I’ll tell you why. Because I’ve been using it for over 7 months now, and I’ve never had a problem with it before—that’s why. I do have a confession to make, though. I have Rails frozen at 1.1.4. It’s somewhat old, I know, but I quit making major updates as of 6-7 months ago, so I never had the dire need to upgrade it. But that seems irrelevant, since that’s the whole point of freezing Rails: to always work with whatever version your app was built with.

The del.icio.us integration uses the Rubilicious gem, and seems to be fine; but I’m gathering the flickr data the hard way, using Net::HTTP::Get and parsing it out with REXML. So, it’s narrowed down to the setup_flickr method, since taking it out proves everything to be fine. Here’s what shows up in the logs:

Errno::ETIMEDOUT (Connection timed out - connect(2)):
    /usr/lib/ruby/1.8/net/http.rb:560:in `initialize'
    /usr/lib/ruby/1.8/net/http.rb:560:in `open'
    /usr/lib/ruby/1.8/net/http.rb:560:in `connect'
    /usr/lib/ruby/1.8/timeout.rb:48:in `timeout'
    /usr/lib/ruby/1.8/timeout.rb:76:in `timeout'
    /usr/lib/ruby/1.8/net/http.rb:560:in `connect'
    /usr/lib/ruby/1.8/net/http.rb:553:in `do_start'
    /usr/lib/ruby/1.8/net/http.rb:542:in `start'
    /app/controllers/application.rb:50:in `setup_flickr'
    /app/controllers/application.rb:49:in `each'
    /app/controllers/application.rb:49:in `setup_flickr'
    /app/controllers/application.rb:88:in `setup_layout'

Is this something I should wait out? Or do you know of any big changes to net/http that would cause me to have to hack away using a different approach? Or do you suspect something else to be the problem? I would appreciate any thoughts on this—maintaining my site is starting to feel like a part-time job.

Update (02/08/07 @ 10:04 AM): Of course everything is back now. I just needed to post about it, I guess.

I broke down and added a tag cloud

Last night (after Grey’s Anatomy—it’s a lot better than you’d think), I got the urge to build a tag cloud. Part of me saw it as useless, but part of me was still curious as to how it would represent the content. Plus, as we all know, programming is fun; so essentially there was no harm done (I wish that didn’t rhyme).

A few more site improvements

Over the weekend, I spent a little time tidying things up a bit. Honestly, I think this has been the longest run for me and a single site. It turns out, a few of the original design ideas don’t really fit anymore; namely the archives and tags. Originally, both sections had a vertical list that had nothing to prevent them from reaching the core of the earth. For the archives, I’m now letting you view titles for a specific month. And by not loading all of the archives at once, it seems to help slightly on load time. As for the tags, the same problem existed. Plus, it wasn’t feasible to have them spread 750px (or so) away from their corresponding entry count. I’m debating an optional tag cloud view, mainly for two reasons: 1) that sort of visual understanding of the common topics may be useful (I’m kind of curious as to what it might look like) and 2) a tag cloud would be a good way to practice more Ruby code, as I’ve never written one explicitly.

And last but not least, I’ve finally found some time to incorporate the Syntax library. And I owe Chris Scharf for that (via his implementation)—thanks, Chris. For Textile, I had originally written a view helper to convert the text from the database at the instance of the view (to_html(content)). But after reading Chris’ post, I started using the before_save callback to save out the textilized text into another column. It’s much cleaner to say post.body and post.body_html depending on which one I need, rather than wrapping a helper around it each and every time. Plus it works nicely for Syntax, too. If you use Chris’ method, you should give credit back to him for posting how he did it. And while I’m in confession, I’ve temporarily adopted his CSS for the highlighting; I really do plan on changing it, though. In due time, I suppose.

Del.icio.us API and other

The last 7-10 days, my bookmarks (that show up here) have been about a week behind. My site was only showing up to Jan 13 or something, when I had bookmarks from Jan 18 or so. Over at my actual account everything was correct, but the API was lagging behind a few days. I contacted them to report the situation after day 2 of realizing this (and making sure nothing got updated and it was me who was behind), and they assured me that it was a known problem and would be fixed soon. It looks like it’s all back to normal now; which, for whatever reason, I’m glad about.

I use del.icio.us a lot more than I probably need to, but it’s so easy with the Firefox extension I hate to let anything remotely interesting slip away. That’s the reason I don’t just pull in all of my bookmarks for my site—they would flow through too fast and the really good ones would not have any priority, or last more than a day. So I tag the “golden nugget” bookmarks with ‘rpheath’ and pull in only those bookmarks. I feel like I get more control that way.

Dreamhost issues: Not all their fault

Yesterday was the end of a 24 hour period where my site was inaccessible. Everything connected fine (the panel, FTP, shell access, etc.), I just couldn’t access the site in the browser. And only rpheath.com was acting up. All other sites (including subdomains of rpheath.com) were working perfectly. And of course, there were no errors in the log files (with the exception of “Incomplete headers blah blah” in the crash logs). But get this: I modified my 500.html page just a bit, and when I put it on the server, it wiped it out completely (0kb). Then, you no longer got the 500.html page, but instead a blank white screen because there was no source in that file. About 2 hours later, my site turned into a directory listing, which was completely unacceptable. I tried adding index.html for the time being, just to at least get rid of the directory listing. But the transfer kept failing. Eventually, it uploaded, but again wiped out the source leaving me with a 0kb index file. I could not for the life of me figure out what was going on.

After trying several methods to FTP this index file, I finally got some direction when using FireFTP. It returned an error saying “550 index.html: disk quota exceeded.” After scratching my head (since I had 223 GB of space left), I decided to go through the panel a bit. Well, of the few users on my account, the main user had been limited to 50 MB (which said I was using 1918% of available space!), while all others didn’t have a limit set (meaning they got the full 223 GB). It turns out, if you modify email settings (which I had done), that can reflect upon your user settings as well, which I didn’t know. So I removed the limit and Dreamhost enforced the change and I was back up and running.

Dreamhost has been very helpful via their support, but that still doesn’t excuse the downtime. Things seem to be fine now, though. I guess as part of your Dreamhost troubleshooting checklist, make sure your users aren’t restricted in any way, because the errors aren’t obvious. At least they weren’t for me.

Dreamhost is driving me crazy

Out of the millions of people who read this site (well, almost), I don’t know how many run their own site, and of those people, how many host with Dreamhost. Nevertheless, I’m currently hosting with Dreamhost, and the last couple of weeks have been driving me crazy.

I don’t know if anyone has noticed, but my site has been intermittently down. I haven’t changed/uploaded anything in over a month, so it’s not me. The odd thing is, if I login to my Dreamhost panel, click to “edit” rpheath.com, not change a thing, then click the “Change fully hosted settings now” button, the site comes back alive—but only for a little bit. That, in itself, is annoying. However, lately my panel has been in and out, so sometimes I cannot get to it to “refresh” my server. There’s not much to be said on the status page, but is anyone else having Dreamhost issues lately?

Filter out html blocks using regex

A recent comment helped me realize that I completely forgot to style the pre block. So I did. Then I realized by doing so I raised a potential problem. Well, not exactly from the styling, just the fact of using the pre block in a post, where I didn’t realize this before. As you may know, I’m limiting the post text on the Home and Bits page(s) to a certain word limit. I was thinking, what If I posted a code snippet or blockquote, and the word limit just so happened to fall in between the block, preventing the tags from being properly closed? Not only would the xhtml not validate, but I’m not sure that would play well on the CSS. I’m already accounting for the missing </p> tag, but that’s easy because it could only be a </p> that’s missing, right? Wrong. It could just as easily be a pre tag or a blockquote tag.

So I thought I would dabble in some regular expression goodness and try to come up with something I could use to pull out those special blocks only on the Home and Bits page(s), where I’m not pulling the full post. Here’s what I came up with:

# application_helper.rb
# (Note: replace the "span" with "pre" - I was having issues displaying it properly)
def strip_html_blocks(text)
  text.gsub(/<span>[^<]*<\/span>|<blockquote>.*?<\/blockquote>/im,'')
end

# view
<div class="post-body">
  <%= strip_html_blocks(to_html(p.body)) %>
</div>

So there you have it. The to_html method just converts the textile text to html before passing it to the strip_html_blocks method. Afterall, I would need those tags to show up. I’m far from knowing regex well, but this seems to work in all of my situations. And it is forgiving if you have multiple blocks with text in between, meaning it won’t suck out everything between the first open tag and last closing tag. For instance, say you had:

<p>Here are some words.</p>
<blockquote>
  <p>Here is a quote</p>
</blockquote>
<p>Here are some words in between.</p>
<blockquote>
  <p>Here is another quote</p>
</blockquote>
<p>And more text.</p>

Passing this text into the strip_html_blocks method would return (forgiving):

<p>Here are some words.</p>
<p>Here are some words in between.</p>
<p>And more text.</p>

Instead of (non-forgiving):

<p>Here are some words.</p>
<p>And more text.</p>

But by all means, if you see a fault somewhere please let me know. Like I said, I’m hardly a regex programmer. They’re always so easy once it works. Oh, and the .*? would not work inside of the pre tags. It was not forgiving at all, so that’s a workaround. Anyway, this took me a lot longer than it probably should have, so I thought I would post it in case someone else has a similar situation and want’s to remove a html block using regex.

IE :hover support for non-links

It simply doesn’t exist. A highly desirable pseudo-class, and IE doesn’t support it. But it doesn’t deny it either. You see, when IE finds something it doesn’t support, it returns UNKNOWN. For instance, p:first-child in IE would return p:unknown, since IE doesn’t support :first-child. Naturally, you would expect it to do the same for :hover since it doesn’t support that, either. But it doesn’t. It recognizes the :hover, but doesn’t do anything with it unless it’s a link. Since IE does support behaviors, though, I believe you can use .htc or .hta files to attatch to specific elements through CSS, and change the behavior to whatever your little heart desires. But I’ve never done this and probably never will. I’ve yet to be in a situation where there was an extreme need for the :hover class.

Anyway, this spawns from my attempt (or lack thereof) to apply hovering effects to the Flickr images on my site. It took literally 1 minute to do in Firefox (img:hover). After all, it’s a fair and simple thing to want and based on what we know about CSS, a fair and simple thing to achieve. The intuition I’ve gained from writing CSS is acknowledged by the intuition of Firefox when reading CSS. IE is awkward, ugly, and annoying. Once it works in IE, FF tells me I’m wrong. So, there I am… hacking away in the stylesheet (refusing to use onmouseover for this) until I come back to Earth. Who cares if it doesn’t work in IE? I don’t use IE and those that do probably don’t pick up on how things like that add to a design, anyway. I’ve done it before, I just don’t have the perfect combination right now. I’m tired of having to hack for IE when the solution is so simple everywhere else. For now (and unless mandatory), I think I’ll surrender to IE by simply ignoring its crudeness.

Making some needed improvements

As I stated in my previous post, I’ve been looking into some optimization options for my site. Things like page caching especially drew my attention, but then I realized something. If I step back to a design standpoint and think logically, I noticed a lot of unecessary things going on. Before I continue, I should mention I didn’t make any vast improvements on the slow API request issue, but I since converted my del.icio.us integration into a much easier solution: the rubilicious gem. It’s slightly faster and much cleaner. I tried going back to the flickr gem (since I’m running a frozen version of Rails now), but kept getting “Invalid API Key (Key has expired),” or something along those lines. Both of my developmental API keys for Flickr are, in fact, active. But it looks like I’m not the only one with this problem. Needless to say none of those solutions worked for me.

Back to what I was saying. Since the APIs bog down the site, are they really needed? Well, no, but that wasn’t an option. However, it isn’t needed on every page. I’d say some people read my posts in a feed reader. In that case, if they feel compelled to comment, they probably do a CTRL + click (or a mouse-wheel click) to open a new tab (assuming those who comment DO NOT use IE, which may or may not be accurate) and go directly to the entry. This is much faster for those people. I can see putting popular tags and categories in a common layout for convenience, but it boiled down to a design decision, and I simply didn’t want to. There’s a link to search available in the footer throughout, so that’s close enough.

Finally, I didn’t like the two column layout. So while I was motivated enough to make some adjustments to the code, as usual, I made some adjustments to the CSS. I like the open feel of an entry consuming a page. After all, aside from people like me, most visit sites to read/view content. That’s much easier to do when it’s the only thing drawing your attention. So, I’ve rolled out version 2 instead of starting over. It’s a little out of character, I know, but I’m proud of myself.

Too busy to post

Most of my posting is done while at work. Sometimes, if it’s a longer post, I’ll throw it in a Writeboard and finish it up later. Even so, I end up posting it at work. Lately, I’ve been so swamped with tasks, I feel as if I don’t have the time to post. It’s not a bad thing, though. This may strike you as strange, but I usually don’t even eat my lunch at noon anymore. Sometimes it’s not until 1:30 or 2:00 pm. I feel like there is just too much going on and I’m never at a solid stopping point. I don’t know if it’s me or what, but I cannot stop in the middle of something. If it takes me an extra two hours, so be it. Anyway, maybe if I had the no admin interface like some people we know I would be more inclined to post—it would be much less effort. I’ve spent more time on the admin side of this site than ever before, but it’s still a login protected area usually requiring a visit to at least two (or three) pages after the login. Oh well, we can’t all have those clever ideas ;) We just have to be inspired and move on.

Can you do me a favor?

As you may know by now, I’ve added a verification field to the comments to try and filter out the spam that will inevitably try to attack this site. I have tested this to no end, and I cannot find anything wrong with it. However, I have recieved a few complaints that the comments are not going through, even with the required fields correctly filled in. I can’t seem to ever have this happen to me when testing. Here are the basic rules:

  1. The Name, Comment, and Image-text fields are required.
  2. The Image reads “ruhuman” and it is case insensitive.
  3. The site field is not required, and you do not have to put “http://” in front of your site.

So, that’s the gist of it. Pretty straight forward. About the favor, if you are reading this, can you leave a comment (even if it is one word) just to make sure everything is working ok? If you do get errors, and are unable to submit the comment, please email me: rpheath “at” gmail “dot” com. Thanks for helping out.

Note: Also, the Name, Site (if entered) and Image-text fields should store cookies. If those fields are not filled in upon return, please let me know.

Comment spam is ruining my life

The wedding site has been getting blasted with comment spam. I’ve had over 50 random Viagra and Rx comments today alone. In light of this, I’m taking steps toward preventing comment spam on this site. More than likely it’s a temporary solution, but I wanted to get something up quickly. It’s driving me crazy.

I made a disgustingly ugly verification image to prove that you aren’t an automated POS. I know this is by far the worst method to take toward preventing this, but I don’t have the time (right now) to implement a sophisticated spam filter. In order to keep it somewhat user friendly, I’m now storing cookies for your name, site and verification fields. So, you’ll only have to enter it once. I don’t know if that’s a good thing, but I couldn’t ask you to enter it everytime you want to comment. It’s bad enough I’m doing it at all, but that would be much, much worse.

Do you know if storing the verification in a cookie has any drawbacks? If so, please let me know. Oh, and I tested this for about 5-10 minutes and it seems to be working fine. If you come across any bugs, you can email me – rpheath “at” gmail “dot” com. Thanks, and I’m sorry for the annoying solution.

Note: the verification word is “ruhuman” just in case it isn’t clear.

What about the 'no data' view?

I believe it was the Getting Real PDF book from 37Signals that mentioned designing for 3 states; or, as they like to call it, the “Three State Solution.” It’s funny, because I fell right into the predictions they made. I totally ignored the blank view. I pumped this site up with data while designing, just to make sure everything would fit nicely, but I never really thought about the first impression the site gives when there is only one post, one category, two tags and no comments. It’s quite bland. I find myself wanting to shove some more stuff in the database in order to “bulk up” the site a little more.

This design was so sparatic, though. I never really gave it my complete attention. Had this been a project for work, or perhaps something more than my own site (where there were users and the users had accounts), I would have been more prone to think about all facets of the design (including the blank view).

All in all, I don’t know what I would have done differently had I remembered the blank view, but it’s an interesting thought.

What a pain that was

I’ve had this site ready to deploy since Wednesday/Thursday last week, but have been unable to do so because of the issues I’ve been having with my server. Actually, the site itself has been done for a long time, but I wanted to touch up a few things, and never got around to it until last week. So, once I was back into the swing of things, I wanted to get it uploaded by the end of the day on Thursday. Being the good worker that I am, I tried to do it over lunch, and had no luck.

Initially, it worked. But I had my password wrong for the database, so it crashed out on me. I changed that, restarted my processes, refreshed the browser… nothing. It made it to the 120 second mark when FastCGI times out. I thought, ok, must be something going on with Dreamhost. I tried again later, still didn’t work. It’s now time to hit the forums/blogs/wiki’s and so on. I even emailed Dreamhost support about the issue (they didn’t help).

To make a long story short, I tried everything under the sun. I was surprised that I found at least 10 different solutions to the EXACT same problem I was having, the only difference was none of them worked for me. Eventually, I gave up on fixing it, and followed Chris’ path. Everything works, but don’t be surprised if something is a little screwy (although I’m not sure why it would be).

I'm feeling much better now

Here I am… home again. I’m feeling good about the move back to rpheath.com, but I can’t say that it’s not the same feeling I get each and every time I rebuild my site. There are always more things that I want to do, and each time I start those changes, I realize that I’m ready for some new CSS as well, which then leads to a scratch and rebuild. I’m usually not so pattern-like, but I can’t change (or fight off) my urgencies.

I wanted to add del.icio.us and flickr, because I think it will help me keep the site a little longer. There are other things I do online besides post, and that’s part of it. So, indirectly, I’ll do better at maintaining the site by reflecting my other distractions from work.

As far as the design goes, this is my first (almost) white site. In the beginning, I was struggling to find a simple design, which was all that I wanted. Taking some advice from a friend, I did something against what I would normally do: no background, no borders, and limited colors. Then, as time moved on, it started to grow on me. Little touches here and there added just enough color and character to satisfy me. I thought if I left room for improvement, I won’t have to rebuild the site, I’ll be able to improve/change the design up a little bit. There’s nothing like leaving room than going all white. The point is, I’m happy now, but don’t be surprised when I mix it up a little, and bring some color back.

In conclusion to my 10th intro post, I hope to update this site a lot more than the last few. As always (for me), having a site that I like to visit, gives me that extra motivation to post. Soon I’ll be able to add a small portfolio of all this crapola. But that doesn’t rank very high on my list.

2008 by Ryan Heath | Get In Touch

flickr

DesolateInfinityLooking upDazedBlurred