The 360 Gallery. node + couchdb + awesome pictures

December 22nd, 2010
Categories: coding, nodejs, projects, thoughts about the web

Panorama Gallery Here: The 360 Gallery

A few weeks ago I started see http://occip.it/ links in my twitter stream. I always clicked on the links when I saw a new one and thought that there were some very interesting photos being posted. But that was it, I only got to look through a few that were in my stream, and perhaps if I remembered to run a search on twitter once in a while I would see a few more. I wanted a better way to browse them. Then Josh Fraser tweeted: “i really hope @occipital makes a gallery of all their pubic panos”. Why wait? Introducing The 360 Gallery.

A few of my choices of how to build this gallery were based on using new tech. I’m not new to CouchDB, but I havent played around with views as much as I should have in the past. I’ve been writing a few things in node in the past month, but nothing web facing so I wanted to see what if any frameworks were available and if they are any good. And thanks to the AppSumo bundle last month I have some Linode hosting that I’m trying out as well (so far so good).

Getting some Data

So from what I can tell there is not public list of panoramas from Occipital. That’s ok because most people tweet them. In fact once they tweet the image using the Occipital 360 Panorama App then the image is also posted to yfrog or twitpic depending on the user’s choice. To get a list of images I tried to use the streaming track api from Twitter, however there are limitations on their allowed characters. (Their track search parser must not be very feature complete compared to search.twitter.com) I ended up having to ditch that and poll from the search once a minute for any new occip.it links, a little regex later and I have all the data need. I store the data + original tweet in couchdb. It’s great to work with an API that speaks JSON, a scripting language that is JS, and a DB that speaks JSON, flows together very easy.

CouchDB

CouchDb makes apps like this very simple to setup. Couch is a JSON document store that allows you to write views using Map Reduce functions written in Javascript. Then you can query those views(there are plenty of query options). After creating the view I wanted to proxy access to the view query with nodejs. I setup a route in express (more about express later). I did this to expose only a subset of the available query possibilities. You can see my recent feed for yourself The last integer in the url is the page number, super easy to setup in node:

I didnt want to host my own couchdb. I could but why should I? I picked Cloudant, only because I’ve used them before and already have an account. CouchOne is also a very good option for CouchDB hosting (several core committers to the couchdb project work there) A quick test with siege shows that Node + CouchDb should hold up ok. (I think Cloudant does some caching on top of views which keeps them faster.)

Siege shows a fairly consistent response without adding any further optimization. It could be a lot faster if I cached the results locally on the node server.

So lets cache some of those calls locally.

Since there are only a couple of requests this node app accepts we can cache the response it in memory.

Now look at the response time, that’s better just over 10 times faster on average.

Notice I handle fewer concurrent requests now, not because I cant, but because the server is responding so fast that many concurrent requests arent ever happening (at least with running siege from my laptop). Also those response times are over the net, so I’m really happy with them.

So all of the360gallery.com just uses those few simple JSON calls to nodejs/couchDB over XHR. This made the site easier to write, and provided a simple way to add paging. Overall I really like CouchDb and views. I already like JavaScript so Node.js is very promising even if it lacks some maturity. There are many unfinished libraries and frameworks… but some promising ones are emerging.

A few notes

I dont like the way the Connect or ExpressJS handles static files. The paths get all messy and a there doesnt seem to be a very well thought out file structure for projects in general. I’m hoping to work on this. Also, I never thought I would have said this, but I missed django like templates express has several options and maybe I need to look around more but I wasnt happy with what was available so I used my own solution. Any ideas?

Nginx does a great job is usual. Did really mention it but it worked out very well. If you are setting up to Nginx + node this tutorial can be helpful. There is plenty of info out there for node + nginx.

I used the twitter @anywhere JS lib for the site, and I don’t really like it. The lib seems heavy and has a lot of requests back to twitter. I might be replacing it. Anyone have thoughts about @anywhere?

I would like to see more structure to the espressjs framework (or any nodejs web framework) even it isn’t strictly enforced some norms that everyone expects and relies on would be nice. Any suggestions for using a web framework in node?

I’ve used several lightbox like plugins before, but I really liked the look and simplicity of this one: fancybox

The End

I’m impressed if you read all the way through this post. Sorry for the length, just wanted to document most of this. I’ll post a little more about the code on the site when I post all the source on github later.

Living in LA

December 21st, 2010
Categories: cities, Community, reviews

Wow, never thought ever would I say that I live in LA. But I do. Isnt a bad town; didn’t think I’d be saying that. Southern California has great weather, nice beaches and an endless list of things to do. Personally I’m a bit overwhelmed by the size of the town. Just when you think you are starting to know your part of town well, you can venture a few extra blocks and everything is new.

I’m torn about my feelings for Santa Monica. It is close to the water, that keeps the temp good in the summer, and the air fresher and cleaner throughout the year. It is safe enough to walk around (I’ve walked many time home at 2-3am without feeling unsafe at all) This said there was a shooting right outside my office while I was there. I’ve had my laptop stolen, I blame myself a lot for that one, but in any other city I have lived in my laptop wouldn’t have gotten taken.

It’s touristy. In Santa Fe there are a lot of tourists too, but not the shear volume. Tourist here include from other parts of town. Nothing wrong with the people, but the times of cafes, restaurants, and shops that tend to boom with tourists are not where I want to be. Big clothing chains, corporate coffee ( funny enough I’m in a starbucks right now), and the like are everywhere. In the main pedestrian mall (the promenade) there is hardly any independent store.

If you need or want anything though you can and will find it in LA. Looking for a type of music, entertainment, activity, group, store, anything.. you will find it somewhere here.

It’s so spread out, and I hate to be stuck in traffic. I like to drive, in fact I will go on a drive just to drive. I drive just to see town and explore (dont tell my carbon footprint) But here in LA there is so much traffic. Sometimes you can get where you are going in 10mins, other times of day that same route will take 1.5hrs. You have to plan based on where you are going and what you want to do. This has held me back some in this city. And public transit.. sucks. there are some buses, subject to the same traffic and a small metro. I’ve never been on the metro because it isnt convenient to me.

There does seem to be a growing tech community. It is different then any other I have experienced (keep in mind I’m from NM, the only other tech community I would say I know is Boulder just from hanging out there) It is a bit hard to know what the group will be like here, the quality does vary, but there are some great people in LA worth taking the time to get to know. I wish I’d have done that more, maybe in the future. There events are spread out (although Santa Monica sees a far amount of the startup events thanks to CoLoft) It hard to make it to some of the events, and I have certainly skipped event just because there were outside of Santa Monica.

I have always lived close to the mountains. There are hills here, but I wouldnt dare call them mountains. I would like to get to more outdoor activities but a combo of the drive + being busy has limited that for me. I do like that fact that you can drive up the coast and find some very interesting communities. I really like Santa Barbara It seemed like more my size town. Plus a great location but it might be too far from the airport. I have developed a big desire to travel.

That’s my review of Los Angeles, overall not as bad as I thought is might be be, bigger then I could imagine, with some shortcomings but all and all a nice place.

In the last year.

April 28th, 2010
Categories: Community, New Mexico

The first Ignite NM happened 1 year ago today.  I started working on it in Feburary 2009, and I called on everyone I knew, and they called everyone they knew just to get enough people to present.  It was a modest crowd, but a fun event.  We just held our 6th event yesterday, great turn out both in audience and speakers.  I’m so happy with how many people have enjoyed Ignite and have been a part of it in the last year.

A year ago I didnt know many people in the area, especially geeks.  So, I set out to be a part of the New Mexico web community.  I didnt know if it existed, and I didnt know if I could join.  It turns out that it did exist, kinda.  It was fledgling, and in many ways still is, but I think it better today then it was a year ago.  There are definite signs of progress. More people are getting involved and that’s encouraging.

This started just as a thank you post talking about the ways I’ve grown in the last year, and become a part of something in New Mexico.  But I want to say for anyone that is on the fence, if you are unsure about reaching out, Do It!  I’ve put a fair amount of time into Ignite and other local projects in the last year, the rewards are amazing. And most times it’s all in the people you meet. For the time that you invest, you’ll see good returns.  Not ready to start your own thing, volunteer to help with an existing event.  Find something you think you could help with and bring that idea to the organizers, 9 times out of 10 they will invite you in with open arms.  Want to start something?  Talk to existing groups, get their perspective and most likely also their help in promoting it.  But find a way to get involved, trust me it is well worth it.

So overall, it has been a great year.  and I’m looking forward to see what the next year will bring.  And thanks to everyone that’s been a part of the last year!

A Firehose.

April 21st, 2010
Categories: fail, Notes, thoughts about the web, Uncategorized

The real-time web loves the word firehose.  I’m not completely sure where the word started being used in relation to streaming data, but the first time I cared was with Twitter.  The Twitter firehose, all the updates from everyone in real-time, the full stream.  It seemed like everyone wanted it, few people needed it, and even fewer got it.  Some every interesting things were built and bought (summize / now search.twitter.com)  Now every company offers a firehose, right?  Well some do.  WordPress pushes all their updates in realtime via xmpp or pubsubhubbub.  And you can even purchase the full feed.  Others have stepped forward with streams of data, Myspace for example.

So what exactly is a firehose.  It goes beyond being a real-time push stream of data.  If you just had my twitter stream in real-time would you call that a firehose, hardly.  Firehose is all public data, the full thing.

As the Twitter Api says:

Returns all public statuses. The Firehose is not a generally available resource. Few applications require this level of access.

Now I’m starting to see more people say “we got a firehose!” when they dont have anything close.

First, Yahoo. See the Read Write Web Article (which shows they didnt look or didnt care, just repeat the Yahoo Press release)

The first sentence makes it clear that it is not a firehose:

The Updates Firehose API gives developers access to the full, real-time Yahoo! Updates index and allows developers to search, filter and combine Updates data using YQL.

That’s right, the full firehose to query.  What?  It isnt push, it isnt a full stream of data, it isnt even close.  Instead this is just a combination of several APIs from yahoo into one endpoint.  That’s cool for what that is worth, but that isnt real-time and it isnt streaming.

Second Spinn3r.  From their site:

Spinn3r listens to a new Twitter firehose API which is a sample of the full Twitter feed.

Again, if it isnt the full stream it isnt the firehose.  That’s like firefighters showing up with a garden hose. (likely the api method they use)

I’m glad to see that we have gotten more streams of real-time data on the web.  I’m glad to see some companies providing a firehose of their content, even if they charge for it.  The ability to build  some of the next large scale ideas depends on that.  Just dont crowd the search results with overusing the term, use it correctly.

Domain names + Unicode = Punycode

April 13th, 2010
Categories: Notes, thoughts about the web

I Saw.

I saw a unicode symbol of a white star enclosed in a black circle the other day, in a domain name.  So last night I set out to see unicode characters in a domain name for myself.  I started at my favorite Registrar name.com.  Some of the country code domains they sell allow unicode characters.

I Bought.

So I chose ⤷.ws  the .ws was the cheapest option coming in at $14.5o, and as you no doubt know .ws is the TLD for Government of Samoa.  First thing that I notice while setting up my DNS was that domain showed up as “xn--2ri.ws”.  What is that all about?  Well, although I really kinda hoped that the internet had progressed to the point where we can all handle unicode, it hasn’t.  So in order to implement Internationalized Domain Names or IDNs, we still use Ascii.  How?

I Wikipedia’d.

Punycode is a means to represent a larger character set (unicode) with a smaller more restrictive character set (ascii).  Do to some security concerns around spoofing urls many browser will show the punycode that represents the unicode domain in the address bar, although some do this selectively such as safari.  Many countries are retrictive on the allowed characters, usually ascii + their countries language, but there are some that have just allowed them all (thanks Samoa).  So my new url shorten is in place, http://⤷.ws

Win a trip! Big Omaha.

April 11th, 2010
Categories: travel

[warning that title is kinda sorta misleading... little more then kinda]

Recently a new conference has come to my attention, Big Omaha.  Their speaker list is impressive for a conference that I havent heard about (because I’m such the conference connoisseur… ok, so not really)  But I think it will be a great chance to meet a different crowd, while still getting to hear some of the speakers (and perhaps getting more time with them?)  that I have always wanted to.   Who I’m going to see:  Matt Mullenweg, Jason Fried, Gary Vaynerchuk, and mostly to meet people from the Silicon Prairie.  There seems to be several emerging technology, media, web, entrepreneur hubs. Can this be one too?

Win a trip to  Big Omaha…. umm, if you’re from NM, wanna come with me?  You still have to pay for yourself, but I’ll buy you a drink while we are there.  If we had several people, I would be willing to drive (then you dont have to pay for the travel).  Interested?  Email me or Contact me on Twitter.

Also, a shout out to Silicon Prairie News, they are doing a great job organizing / supporting / publicizing events like this and others in the area!

NMTechCal.com – Concept.

April 7th, 2010
Categories: Community, New Mexico, Notes, projects


The idea is for a central location to look for information about upcoming tech/web/design events in New Mexico (start with Santa Fe and ABQ).

  • Shared google calendar with event organizers. we all have access to enter our own info. (built in iCal feeds etc.)
  • Blog which we highlight new, and upcoming events. This is authored by event organizers, and other contributors.
  • That’s it. It think simplicity is key. But even this small step would be a big help.

If you know a group that would like to post their info, or if you would like to help by contributing to the blog, email me: mick@davidmichaelthompson.com

Calling all of New Mexico’s Tech Community

April 7th, 2010
Categories: Community, New Mexico, Notes, projects, thoughts about the web

About a year and half ago I traveled to Boulder, Co for the first time.  What I found there was a vibrant web developemnt / design community.  Here is what I mean by that.

Tech Community

In Boulder: At least a couple of events (great then 50 people) a week.  It isnt all the same people at all the events, although at the major ones you can expect the regulars, but in general a good diversity and networking / learning opportunity.  Some of these events are fun geek nights out (Ignite) some have a bit more structure in content (Boulder New Tech Meetup, generally has some demos / presentation about companies and products), some are just user groups exchanging knowledge.

Along with all these events comes many organizers.  These are people that want to give back to the community, want to see it grow, and want to be a part of it.  In Boulder I have seen many people reach out to be a part of this, and I’m starting to see more of that here in New Mexico (read as: a very good thing).

In The Land of Enchantment

Over the last year I think we have seen a good increase in geeky events in New Mexico.  NMTC, Barcamp, Webuquerque, IgniteNM, AIGA, SynerQue, ABQ Web Geeks, Several User Groups(ruby, python?), as well as others I’m sure.  One thing that I think we lack a bit, is cohesion.  Just last night I heard about 2 events that I would have been interested in attending, however I didnt hear about them in time to attend.  Part of this is trying to keep up with multiple groups and just getting lazy about doing so.  Some of it is not knowing about new groups that are just getting started.

The Solution?

There is a question mark, because this is still very open for discussion.

The first step that I’m going to take (and hopefully getting some others involved too) is to start a calendar of all NM Tech Events.  This will be administered by all the group organizers.  Have a group or are you planning an event? Contact me (mick@davidmichaelthompson.com) and I’ll set you up with access to the calendar.  This is based on a shared google calendar, and a website to display the events, and highlight some.

Step 2. Blog covering upcoming events, highlight recaps of past events, and discuss new or current groups.  I’m willing to do some of the writing, but I really want this to be a group effort (i.e. I’m looking for a bunch of other contributors)  This will all at nmtechal.com If you are interested in contributing in any way, let me know.  I want to run this very open to the community at large, everyone welcome!

Step 3. Talking with Chad Kieffer, he has the idea for a event where we actually all pull out our laptops and work on some code.  Very hands on.  I’m thinking about a “Web Project Night” at the Santa Fe Complex.  It would meet 1-2 times a month, we’d decide on some sort of small project, and try to use new tools to accomplish the goal.  Getting to work with others, build something, and try out some new things along the way.

That’s it from me.  Grow community, Grow!

JetBlue #aycj

October 10th, 2009
Categories: travel

This last month I spend 30days flying everywhere I could.  All totaled I tooke 24 flights (which includes 2 flights to get to and from Denver, which the closest Airport that JetBlue services.) at a cost of $864 (including tax on international flights, and the southwest tickets)  I visited a dozen cities, in 2 countries.  Now I wasnt the craziest All you can Jetter, but I think I still got a great deal out of the trip (value of the tickets would have been over $4000).

Why?

Why not?  Really I work on the road (easier said then done) but otherwise I got to hang out in some really fun cities, with my scenery changing near daily.  To enjoy a month on the road (rather on the air) you have to love travel.  I do, so it all worked out great.

Favorites

I really liked San Diego, which is seemed like a fun city with plenty to do, and great weather.  I appreciated Washington DC because I

had never been there and I got to see building, monuments, and places I had only known from pictures and video.  Costa Rica was the best.  Visiting Costa Rica makes me want to go back, but it also makes me want to travel the rest of the world. Because travel is awesome! There is so much more then your town, state, or country.  Explore it, Experience it.  At least that’s how I feel about it.

JB

JetBlue, is without a doubt one of the best airlines I have ever flown.  They are a step above the rest.  If you get a chance to fly them, take it.  You’ll enjoy it, and find it harder to fly other airlines after that.

Community

The other great thing about travel is meeting people.  There was a great community around the jetblue deal on twitter, all using the #aycj hashtag.  I meet some awesome people both #aycj-ers and just other travelers.  If you are traveling alone, I do recommend checking out your options in Hostels.  More then just being a cheap place to stay it helps you meet others.  In Costa Rica I spent a lot of  time with the people I met at the Hostel and the really contributed to the trip.  It’s nice have people to do things with, it really made it more fun.

Fixed: “The URI you submitted has disallowed characters.” error CodeIgniter

September 3rd, 2009
Categories: coding

UPDATE: CodeIgniter V 1.7.3 fixes this issue.

I started up a development project today after upgrading to snow leopard, and none of the codeigniter links worked.  they all said “The URI you submitted has disallowed characters.”  Why?  This hadnt happened before, same project what changed?

Snow leopard upgraded my php dev environment to 5.3 from 5.2.6  And a few things have changed since then.  Namely php bug #47229 “preg_quote should escape “-” (minus) as well” was fixed. (technically in 5.2.8)  CodeIgniter checks uri for allowed characters to prevent some bad things.  But the use preg_quote to convert the allowed list of character to something usable in a regular expression.  Now the minus “-”, or I’d call it a dash (but I know there is a longer character for that)  gets escaped in preg_quote with a backslash “\”.  That cause the expression “a-z 0-9″ to be converted to “a\-z 0\-9″ which will not work in a regex.

How to fix it. (assuming codeigniter 1.7)

1) in codeigiter system/libraries open  URI.php  line 189 you’ll find

if ( ! preg_match("|^[".preg_quote($this->config->item('permitted_uri_chars'))."]+$|i", rawurlencode($str)))

Change that to:

if ( ! preg_match("|^[".($this->config->item('permitted_uri_chars'))."]+$|i", rawurlencode($str)))

Note we removed the preg_quote().  Now in your system/application/config/config.php file  look for line 126 (unless you’ve added a lot to you config will be around there somewhere)

Change the line

$config['permitted_uri_chars'] = 'a-z 0-9~%.:_-';

to:

$config['permitted_uri_chars'] = 'a-z 0-9~%\.\:_\-';

we’re now preparing our allowed character string in the config file and skipping preg_quote.  And that’s it.  Now your uri should work