Movin' on up

Monday, December 8, 2008, 01:28am

 

Hey everybody, how was your Thanksgiving (if you are from the US)? Mine was quite eventful. The wife and I did our annual road trip up to Port Towsend, WA to spend Thanksgiving with her family. Along the way we decided to stop through Portland and, you know, buy a house. Yes that's right, we bought a house! We've been talking about it for months now, and the Monday before Thanksgiving, we met with a realtor, spent all day driving around the city, and ended up putting in an offer on a brand new "Portland four-square" craftsman style brand new green home! We checked out a bunch of homes throughout the day and ended up picking a house already being built in the St. John's neighborhood in the North part of the city. Here's a bit of a preview:

Portland House under construction, frontPortland House under construction, living room

And when it's done it'll look a little something like this:

Portland house, Palazzo final

Pretty nice, eh? We love the San Francisco area but getting into our first home here would have been very difficult and we would have had to make a lot of compromise. We considered a ton of cities and ultimately decided on Portland. When we went we were just about sold, and spending time there really nailed it for us (obviously). We met up with our good friend Colby and his lady, Abby, who helped show us the town.

Mr. Colby Nichols

He used tricky tactics such as feeding us delicious, amazing donuts, coffee, and beer to convince us that it was the place to go. And we're glad he did! They are a couple of awesome people and we're very excited to be their neighbors.

And I must mention that if you are a nerd like me, and love nerdy computer/code books, you MUST visit the Powell's Books Tech store—it's basically the Mecca of nerd book stores, I was totally blown away and considered just moving in there. It has everything! Code books old and new, books on engineering, physics, math. It's basically like Amazon in person. And we tried a number of delicious donuts from Voodoo, including the maple bacon donuts, the Cap'n Crunch and Fruit Loops donuts, the "Miami Vice", and a few others, all of which were, without question, the best donuts I've ever eaten.

And one of the best parts is that I will continue to work with Cuban Council! My talented photographer wife is going to have to do some hard work to establish herself there when we move, so if you know anyone who needs some top notch photography, spread the good word and get in touch!

We won't be moving until probably mid-late March of 2009, so if you are a Bay Area buddy of ours and want to do some hanging out, let's get it done!

Tags

Recent Comment (of 3)

"Who's the dude with the red beard? What a gnar-face."
by Colby Nichols posted Dec 9th 2008, 15:31

 

I'm sure I can relate to a lot of people when I say that we sometimes run into problems that drive us absolutely bonkers until we solve them. Such is the day-to-day for us code nerds. Usually we can solve them relatively quickly, in a few hours, but some of them plague our existence until we figure it out. And then there's the kind that you kind of want to figure out, can't, and then they rest in the back of your head for a while. I solved one such problem just the other day, and I wanted to share it with you in case anyone has been losing sleep over the same thing.

So here's the scenario: my blog has a tag system. Who knows if it's actually useful, but I wanted to build it to keep my posts organized, and it's pretty much a proof of concept kind of thing. Not only that, but my del.icio.us bookmarks are organized into a tag system as well. The problem I wanted to solve was to be able to search my blogs and/or del.icio.us bookmarks by tag, using an 'all' or 'any' specifier so that I could, say, enter a bunch of tags separated by a space or a comma, and find all posts/links that have any of the tags I entered, or that have all of the tags I entered.

The Tables

I organized all of my tags into a table for themselves so that I can associate them to any other set of data using a many to many relationship. My tags table looks like this:

CREATE TABLE `tags` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(255) NOT NULL default '',
  PRIMARY KEY  (`id`),
  KEY `idx_name` (`name`)
)

Then my join table, the table that relates tags to my blogs, looks like this:

CREATE TABLE `blogs_tags` (
  `id` int(11) unsigned NOT NULL auto_increment,
  `blog_id` int(11) default NULL,
  `tag_id` int(11) default NULL,
  PRIMARY KEY  (`id`),
  KEY `idx_blog_id` (`blog_id`),
  KEY `idx_tag_id` (`tag_id`)
)

And my blogs table looks something like this:

CREATE TABLE `blogs` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(255) default NULL,
  `slug` varchar(255) default NULL,
  `entry` longtext NOT NULL,
  `posted` datetime NOT NULL,
  `created` datetime default NULL,
  `modified` datetime default NULL,
  PRIMARY KEY  (`id`),
  KEY `idx_slug` (`slug`)
)

The Magical Query

Once you have some blog entries, some tags, and some tagged blogs, maybe you want to search them. So the solution I finally found was a query that looks like the following. This is to search for blogs that have both 'Javascript' and 'MooTools' tags associated with them:

SELECT
    GROUP_CONCAT(tags.name) AS tag_list,
    blogs.id,
    blogs.name
FROM
    blogs
    LEFT JOIN blogs_tags ON (blogs.id = blogs_tags.blog_id)
    LEFT JOIN tags ON (blogs_tags.tag_id = tags.id)
GROUP BY
    blogs.id
HAVING
    FIND_IN_SET('Javascript', tag_list)
    AND FIND_IN_SET('MooTools', tag_list)

I had put together most of the query a while ago, but finally figured out the GROUP_CONCAT function and the 'HAVING' part. It's definitely a beefy query. Not only is it a 3-table JOIN, but it also uses a temporary table, and I believe the 'HAVING' part is evaluated after the entire table is scanned anyway. But after clocking this query, along with breaking the query into 2 and timing that, this way takes about 2/3 the times that the 2 queries together take. The above is an 'all' style query, to switch to 'any', just with the 'AND' to an 'OR' and you're set.

And I can easily apply this to my delicious links by sucking them into a local 'links' table by placing a cURL request to the delicious API like so:

<?php

$url = 'https://{username}:{password}@api.del.icio.us/v1/posts/all/';

$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($curl);
curl_close($curl);

?>

Be careful when testing though, them Delicious folks are pretty conservative with their request throttling. Just cache the result and you're solid. I then parse the resulting XML, make a bunch of inserts into 'links' and 'links_tags' tables and I can search away. The original idea was to make a little app for myself on my site where I could search my links. That is until the Delicious plugin implemented basically the same thing.

And that's it! Go nuts with your tags searching, or any other many-to-many relationships. Please ask questions if you have any, and let me know if you might know of any other spiffier methods.

P.S. The tattoo is finally done! I will post some pictures once it heals up. Yipee!


Obama is my home boy

Monday, October 27, 2008, 11:36pm

 

As you Americans know, the big presidential election is barely a week away and, though it's been talked to death, and though I know most of you have your choices set, I wanted to take some time and voice my opinion to the digital world.

Barack Obama and John McCain

With this seemingly endless war in Iraq, recent troubles with the economy, and the severely disappointing and selfish leadership we've experienced in the last 8 years, the potential impact of our choice in this election is gigantic! And I personally have had my decision set to Barack Obama for quite a while now. There are people who try to push off the anti-McCain "more of the same" phrase saying that McCain is not Bush, but there are enough similarities between the two and it is a close enough race to make me almost pee my pants and look into Canadian citizenship.

One of the characteristics McCain seems to share with Bush is this sort of "act now, ask questions later" approach. This became apparent to me when the two candidates were discussing the use of nuclear energy in the debates. McCain attacked Obama for claiming to want to "look into" using nuclear energy, where McCain seems to want to act now. Of course we would want to act cautiously before using one of the most dangerous materials in the world! I feel that McCain wants to solve problems, while Obama want to solve them without making new ones.

The other thing that bothers me about McCain is his choice in Sarah Palin as a running mate. We can all argue about Palin's experience and whatever, but I think just about everyone can agree that she is not the best choice for Vice President. The problem that I have is that I feel she was chosen mostly for the fact that she is a woman. I think there was so much hype around Barack Obama and Hillary Clinton, that McCain had to do something to stir things up and draw some attention his way. While I can understand that a large part of campaigning is advertising and image, I find this insanely irresponsible! Forget if McCain dies, if elected, Palin will hold the second highest position in the entire country!

For me, Barack Obama has the vision, charisma, and the type of leadership we need to turn ourselves around from the last 8 years. It's certainly a wake up call when the simple fact that Obama can speak so eloquently is almost enough to win my vote! I feel I'm on the same page with a lot of his beliefs. I love that he wants to push for alternative energy research which will help save our planet, save money and create jobs. I love that he's not a former military officer and wants to use diplomacy to solve our issues. I love that he's open-minded to new solutions to old problems.

And I know that it's superficial, but I'm a designer at heart, and I have to be honest and say that one of the things that drew my attention to Obama early on is the beautiful design for Barack's campaign—not only internally but from designers from all over the world. As an adult, I can only remember 3 presidential elections, only 2 of which I could vote in, but I don't remember ever seeing such an immense creative reaction to a politician. It's truly inspiring!

I was basically a coin toss between Clinton and Obama at one point, and then I visited his website. The use of Gotham is phenomenal! And there are countless other examples of amazing artwork done in the name of Obama, 2 in particular come from a couple of artists that I've followed for a long time, and who do some awesome work. Here is San Francisco-based Scott Hansen's Progress poster:

Barack Obama - Progress

And Shepard Fairey's' Hope poster (posted in the window of my home, thanks to Upper Playground):

Barack Obama - Hope

No on Proposition 8!

Regardless of what your choice is for the presidential election, we Californians have a ridiculous proposition to vote on this upcoming election—Proposition 8. Proposition 8 seeks to deny homosexual couples the right to marry in California. I'm stunned that this is even being voted on. You would think that after the women's right struggle, and then the struggle for civil rights, that we would get it! Everyone is free in America! Right? No! We are voting on a basic right! Why? Some religions don't like it! But wait, there's separation of church and state, right? Yes. Let's vote!

Regardless of what anyone votes, this will be a right someday, this is just a matter of how much fight we are creating for everyone. But regardless, we have to vote! And I think one important thing that people forget is that when they vote, they are voting for everyone. People make their voting decisions based on their own opinions (of course), but we have to remember that they still affect other people's lives. In this case, if you don't agree with gay marriage, this does not affect you! Because you will never be involved in a same sex marriage! If you're worried about tradition being tarnished, don't even fret—Britney Spears herself took care of that years ago. So please, don't be selfish. If there's anything that should be encouraged in this world it's love, so do the right thing.

This ends my political rant. Feel free to send me your comments, try to argue with me, whatevs, but go forth and vote next Tuesday!

Tags

Recent Comment (of 3)

"i'm totally inviting you to my gay wedding."
by sarah posted Oct 29th 2008, 15:18

The girl's on a roll

Wednesday, October 22, 2008, 08:46pm

 

I believe I mention my wife an average of about 14.2 times per blog entry because, you know, I love her a whole bunch. I'm not sure if I mentioned it here, but she took the plunge into her own full time photography business at the end of August this year and she's been doing fantastic!

My baby

Can't resist them brown eyes...

She's been into photography for several years now, getting steadily more and more passionate about it and becoming more and more talented, and she finally turned in her 3 month notice (yes, my lady is extremely considerate) and went full steam ahead, basically working 2 jobs for her last few months at her day job. She has now been in it, working hard, kicking ass and taking names (and photos) for the last 2 months all on her own, and I can't tell you how proud I am of her!

As if that wasn't enough, she already has her very first gallery show coming up in November! She partnered up with her friend Colleen and their show has a "vibrant color" theme dubbed "Chromatic" at Surface Gallery in Bakersfield, California.

Chromatic - Surface Gallery

I believe they're showing about 20 pieces each and the show will be going for 2 months staring November 7th. We'll be heading down to Bakersfield for the opening party, so if you're in the area make sure you come check it out! Here's the info:

November 7, 2008 5-8 p.m.
The Surface Gallery
1703 20th St.
Bakersfield, CA. 93301

Hope to see you there, the little lady has earned buttloads of high fives!


Aliens Vote

Monday, October 13, 2008, 01:11pm

 

We've got an election right around the corner, and the Cubanos decided to launch a site called Aliens Vote. The site aims to (sort of) give a voice to the millions of resident aliens in the U.S. by asking who their choice would be for the upcoming election.

Aliens Vote

We're very excited to see the outcome of the whole thing, even more so because about half of the company is alien and we work with a network of freelancers from all over the world. So if you are an alien in the U.S. tell us what you've got to say, or have any friends who are, pass the word along.

This entry can't end without any nerd stuff, so here goes! This was my very first project in the Python web framework, Django that is in production. We are good pals with the folks over at Media Temple, who sponsored the project (and just underwent a pretty slick re-design by the way) and gave us use of one of their brand new Django Grid Containers and it was nice, easy, and fantastic to use.

(mt) Media Temple - Django Container

The most exposure I've had to a web framework has been with CakePHP, and using Django has been a nice breath of fresh air. Though I've just skimmed the surface with Django (and Python), it seems to be organized in a much more intuitive way, extremely flexible and portable, the command line stuff is very helpful, it comes built-in with loads of support without seeming too bloated, and I'm a HUGE fan of the DRY principle (Don't Repeat Yourself) behind the whole thing. It was definitely challenge to jump into because Django has a lot of conventions that I'm unfamiliar with, and I also don't have the background in Python that I do with PHP, so I found myself flipping through a lot of reference for simple stuff like splitting strings, etc. I'm excited to jump into my next Django project and I'm sure I'll post more about it, but if you've been considering it, I definitely recommend it!