Custom Domain Names On Heroku Via Namecheap

I currently have domains mixed between GoDaddy (Ugh), iWantMyName (Impressive), and Namecheap (Not bad, not great).

Just as a quick note for those of you wanting to set up custom domain names for Heroku on a domain name registered via Namecheap.

  • Make sure the DNS is under Namecheap’s control, unless you want to roll it yourself.

  • Select the domain you want to set up.

  • Left Menu: “URL Forwarding” under Host Management

  • Set the “IP ADDRESS/URL” of both “@” and “www” to be “proxy.heroku.com.” Never forget the period at the end. Don’t forget to set the Record Type as CNAME “(Alias)”.

namecheap-heroku.png
  • Wait, up to 24 hours. Usually faster.

And done. Quite simple. On GoDaddy? Ugh. I don’t want to encourage using such a trashy UI.

Homebrew (Mac) Installation

Homebrew is an up and coming successor to Fink and MacPorts. Although a bit generically named, it works quite well for a lot of the things I muck around with these days, which tend to have that web development smell to it.

It used to be that I had to get a git binary, then grab homebrew from github, then uninstall the git through the binary, and then install git through homebrew. Then, the fun would begin.

Now, it’s even more streamlined. Just grab the installer gist from the README.md page, and it should work. Although, I couldn’t get it to work and I was in a hurry, so I just grabbed the master tarball, and just physically moved the resulting /bin, /Library, and README.md.

Note: This probably worked for me because I already did everything else that was in the install script earlier, such as chmod’ing the /usr/local folder, as well as adding /usr/local/bin to the path.

Hooray for adhering to POSIX standards (Reference here: This is an awesome read, by the way, if you ever had any questions about why directories were as such in a Linux/BSD setting.).

brew install git
brew install ruby
brew install stuff

More on how brew affects Ruby on Rails installations later.

Chrome/Chromium Bug – Copy X From Bottom

Chrome:Chromium Bug - Copy X From Bottom

First load is okay. After reloading the page, I get a large chunk of HTML copied a second time. Notice that the highlighted section is what gets duplicated.

I think it’s somehow copying and pasting x characters from bottom. This makes very little sense, because no other website is having this issue in Chromium. Safari/Firefox loads this page just fine.

EDIT (2009/12/23): Looks like one of the newer build has fixed this. Hooray!

Hard Work: Not Very Glamorous

Regardless if you’re in a corporate job or a startup as a developer, you’re sitting in front of the computer.

The problem occurs when you start to fantasize about what you’re actually doing.

I’m not running around hacking a Gibson (a joke I probably wouldn’t have been able to make without a certain friend of mine) or creating Synapse (are you getting these jokes?).

Really, it’s about the daily devotion to the craft of code monkeying. Day in and day out, without fail, to keep pushing those magical characters.

And it starts again today.

Git, GitHub and Social Coding

via Video: Tom Preston-Werner, Chris Wanstrath and Scott Chacon — Git, GitHub and Social Coding.

While I don’t use GitHub for my projects, most of the rubygems and other code bases exist on GitHub. I guess there are the few that are still on Google Code and even fewer on SourceForge.

The video, not only being extremely informative for someone who doesn’t know anything about git (but would like to know more), was a very nice overview of what I’ve been learning in the past couple months. (Especially more so the past couple of weeks.)

What I find awesome is that (at least Chris specifically) had a very personal problem he wanted to fix with version control systems (Subversion, in his case) and supporting tools (Bugzilla, in his case).

Sidenote: Chris’s presentation images are just hilarious. One comment: SVN could have been the lighthouse, not the “house”. The whole centralized repository idea?

You Deleted Your Cookies? Think Again

I tweeted this nine days ago:

I didn’t know Flash stored so much info. http://bit.ly/S6e1v And that emptying my browser cache doesn’t do anything.

Just now, there is a story on Wired on this subject:

Defenders of behavioral ads say that privacy shouldn’t be a concern since cookies really identify a browser, not a person. Moreover, they argue that users would prefer to have relevant ads. Targeted Behavioral Ads could also help save online journalism.

You Deleted Your Cookies? Think Again | Epicenter | Wired.com.

It’s good to see that Wired is covering this story. It’s not necessarily 100% bad that Flash does this, and I really hope that the general blogosphere doesn’t make a fuss about it. The more the people on the Internet learn about the way the web works, the better. Remember the cookie paranoia of the ’90s? Let’s not live through that again…

"technicalpickles-jeweler requires git (>= 1.1.1, runtime)"

In this error statement:

$ sudo gem install technicalpickles-jeweler -s http://gems.github.com ERROR: Error installing technicalpickles-jeweler: technicalpickles-jeweler requires git (>= 1.1.1, runtime)

This is not talking about your git binary version, which at the time of this writing is 1.6.3.3. It’s talking about your git gem.

So just do a nice:

$ sudo gem install git

And you’re off. Rock on.

Now to go mess with actual rubygems problems…

For GetMyTweets Users

I needed a very very very simple Twitter plugin for wordpress, just to show my latest tweet. I found GetMyTweets to be just simple enough. Then I started to get some warnings, and reflexively hit the Google.

But to my surprise, doing a query on “getmytweets” on google got me this:

Picture 5

I recently had a couple of warnings with the GetMyTweets wordpress plug-in. These weren’t the same warnings, but you’ll get the gist of it:

Warning: XMLReader::open()
 [function.XMLReader-open]: php_network_getaddresses:
 getaddrinfo failed:
 Name or service not known in
 /blah/getMyTweets.php on line 38

Warning: XMLReader::open(

http://twitter.com/statuses/user_timeline/joshkim.xml?count=1)

 [function.XMLReader-open]: failed to open stream:
 No such file or directory in /blah/getMyTweets.php on line 38

Warning: XMLReader::open() [function.XMLReader-open]:
 Unable to open source data in /blah/getMyTweets.php on line 38

Warning: XMLReader::read()
 [function.XMLReader-read]: Load Data before trying to read in
 /blah/getMyTweets.php on line 39

(Note to self: Fix <pre><code> later. Sorry about that, to everyone who got this post multiple times.)

Obviously, the problem is with being unable to grab the xml provided by Twitter. Due to it’s ridiculous open architecture, I don’t blame Twitter when it chokes now and then (and not as much as it did when the whole Fail Whale was in vogue). For now, I just decided to hide it. Just append the following at the top of getMyTweets.php, just like with any other PHP warnings.

ini_set("display_errors", 0);

I’m fine with this fix, because I made the title for “Recent Tweets” link up to my twitter page anyway.

Now back to Rails.

PostgreSQL, Ruby, and Rails: WIN

This is a follow-up to my post: PostgreSQL, Ruby, and Rails: I Quit.

So I finally have a working machine with the following installed and ready to rock:

  • Ruby and Rails: From MacPorts

    • Tip: Don’t forget: “source ~/.profile”
    • Do not touch /etc/profile, even though Robby said so. (Although, I’d like to ask why he said to modify /etc/profile…) Everything else in that walkthrough is awesome.
      • /etc/profile is read-only. I really didn’t want to change this, and I even went and looked into /etc/paths.d. Don’t. You don’t need to.
    • Why not use the native Ruby that was shipped with Apple? That’s for another time.
  • Passenger(mod_rails) and PassengerPanes

    • My problem was after installing Ruby and Rubygems through MacPorts, I didn’t update the $PATH.
      • You do not need to create symbolic links (“ln”) at all. Just make sure to “source ~/.profile” after you’re done messing with the PATH variable in it.
    • PassengerPanes is amazing. Use it, and love it if you’re doing any testing on your mac before capistrano’ing the whole thing on a test server.
  • Git

    • Simple installation as “git-core” on MacPorts. I didn’t have any problems with this one.
  • PostgreSQL

    • MacPorts again. Makes sure to also install pgAdmin3, a nice GUI for PostgreSQL.

Which Gem? How To Install It?

If you go to the RubyForge page, you’ll see two gems. I still don’t understand why the releases were named with the “rb-” prefix (maybe to distinguish that it’s a ruby gem). Regardless, there are two gems listed “pg” and “postgres”.

Although “postgres” seems to be more out of date, this is the one that you’re going to want for the near future. Eventually, you’ll be wanting the “pg” gem. If you read some of the news, you’ll see that they’re also working on making sure that it works with Ruby 1.9.

Following yet another great walkthrough, you’re going to want to install it in this manner on an Intel Mac (if you installed PostgreSQL through MacPorts).

sudo env ARCHFLAGS="-arch i386" \
  gem install postgres -- \
  --with-pgsql-lib=/opt/local/lib/postgresql83 \
  --with-pgsql-include=/opt/local/include/postgresql83

PostgreSQL with Rails

Now that PostgreSQL is talking with Ruby, now let’s make Rails talk with it.

In config/database.yml, make sure the adaptor is set to “postgresql”, like so.

development:
adapter: postgresql
encoding: unicode
database: projectname_development
pool: 5
username: username
password: password

That was taken from the generated database.yml, which is done this way when you start your rails project.

rails projectname -d postgresql

My Thanks and Apologies

Thank you to all the blogs I’ve visited over and over again through Google queries. Some information was outdated (and at one point, this will also be outdated), but that’s how it is with anything web development, especially anything to do with Rails it seems. The speed at which this community keeps innovating continues to surprise me, and makes me happy that I made that choice to go with Rails (even though I struggled through it from time to time).

This doesn’t mean I’m done. Oh no, now I have to actually design, test, and develop on the stack I’ve created. I’m sure I’ll be sitting in on the Rails IRC room a couple times.

My apologies for not having a more complete walkthrough, although, I hope the links I’ve included will help out more. If you have any questions, just leave a comment, and I’ll try to help.

Now to keep on hackin’.