Wednesday, February 10, 2010
Google Buzz seems more like Friendfeed than Twitter
Monday, February 08, 2010
Linking data in XML and HATEOAS
There are three pages in a UI. The first page has a link to go to the second page. The second page has a link to go to the previous page as well as the third page. The third has a link to the second page and another link to the first page.
A client starts from the first page, and then through the link on that page, goes to the second page. The fact that this page has one link to the first page and another to the third page implies that the current state of the application (i.e. the interactions) is that "the client is viewing the second page". That is what it means by hypermedia as the engine of application state. It does not necessarily mean serializing application state, such as "<page>2</page>" into representations. Friday, February 05, 2010
If you forked technomancy's emacs-starter-kit, upgrade nXhtml
Tuesday, February 02, 2010
I want to use SASS, but not HAML.
The title of the post is more-or-less a verbatim quote from a coworker, as well as from an unrelated colleague of mine from a previous job. I was asked that question and, to be honest, I was a little thrown both times. I didn’t actually know why I use HAML. I guess I’d never really considered it much after I started doing everything with it. It just seemed better and more fun.
Oddly enough, I want to do Sass, but not Haml. Html isn't too hard to begin with, and I guess it's never bugged me.
What I do dislike about Haml is the indentation on a larger piece of code. When I want to shift elements around, suddenly, I'm not sure which level of indentation to put it, let alone make sure all the sub-levels are indented correctly as well. haml-mode in emacs didn't seem to help much.
This means either two things:
- web markup should be more shallow and I'm doing it wrong. Perhaps with rails helpers and partials I can compress it more to keep myself DRY.
- The very Nature of web markup is a deeply nested tree, and haml's indentation's not a right fit for it. This seems more likely, though again, it depends on the design of the page. If a page is designed to be with heterogenously abundant page elements, then this is true.
I've yet to decide on either. Perhaps I'll give Haml another shot.
CSS, on the other hand, has a fairly shallow structure. In fact, it doesn't have nested structures at all, and you have to re-declare parent tags. This lends itself to really long files that I can't keep track of. I've often wished for color variables too. SASS indentation is good here because it gives you a way to group your css together in a more compact way with hierarchy.
Hence, HTML is too deep for whitespace indentation, and hence in my opinion, not a good fit for HAML. And CSS is too shallow, and hence perfect for SASS.
So it's not that I don't want to learn HAML because it's something-new, but because it doesn't seem to fit a need I have for the markup I'm working with. SASS, on the other hand, solves a pain problem I've had with CSS.
Friday, January 29, 2010
How to add paths to your emacs shell
Actually this is probably because start-process can't find your git
executable. Try doing something like this in your Emacs configuration
(adjust the path if needed):
(setenv "PATH" (concat (getenv "PATH") ":/usr/local/git/bin"))
(setq exec-path (append exec-path '("/usr/local/git/bin")))
If you're trying to use magit in emacs, and you can't figure out why it's not recognizing your git repos, it's probably because it can't find git. And it can't find git, because it's not in the path.
Just set the path, as it's show above, and add your own directory, wherever git is being held. If you're on a mac, you can add /opt/local/bin for the rest of your utilities.
Erlang mode on Emacs
Although there are a few other editors for Erlang, I prefer to use Emacs for Erlang and its the only major reason I use Emacs for. Erlang now has an eclipse plugin too, called Erlide.
Erlang comes with the emacs mode as part of its standard distribution, so you only need to customize your emacs settings to use the erlang mode. Once you have Emacs installed (I have Carbon Emacs on my Mac OSX), create a .emacs file in your home directory (or use the one that you already have).
$ vi ~/.emacsThen insert the following lines of Lisp code into your .emacs file.
;Erlang Mode (setq load-path (cons "/usr/local/lib/erlang/lib/tools-2.6.1/emacs" load-path)) (setq erlang-root-dir "/usr/local/lib/erlang") (setq exec-path (cons "/usr/local/lib/erlang/bin" exec-path)) (require 'erlang-start)/usr/local/lib is where my Erlang is installed, and /usr/local/lib/erlang/lib/tools-2.6.1/emacs is the location where erlang.el and erlang-start.el files are, which actually define and initialize the Emacs Erlang-mode.
Update the path and version of the tools in the above code as per your installation, and enjoy the amazing features - including the Erlang shell right from Emacs.
Just something to remind me.
Thursday, January 28, 2010
A REST service description language not a good idea
Tuesday, January 26, 2010
A simple guessing game in Erlang
Lorem ipsum for images in French Maid
French Maid is just a small little javascript wrapper library that injects common behaviors into web pages using unobtrusive javascript, based on jQuery. All you ever need to do is set the attributes of html to standard html5 or microformats, and it'll give you some behavior that makes sense. I started this because while working in Sinatra and Django, there wasn't built in javascript behaviors for templates like in Rails. Turns out that was a good thing, but a bit annoying, so I wrote something to help me out.
Lorem ipsum for images is the only non-standard in there right now. When you're laying out a page, put:
And you'll get an image placeholder 200 px wide by 100 px height. There's only a few options:
This is pretty useful for having placeholder icons. I usually spend lots of time picking icons when I'm laying out a page, when I really shouldn't be.
I haven't yet made a homepage for French Maid. Figured I would when it's more mature, but hey, if you're not embarrassed when you release something, it's too late, right? So while I haven't gotten around to implementing all the microformat and html5 specifications, it's been useful so far, especially for standard pattern AJAX calls. The screenshot is from the test/example/documentation page in the project. You need Sinatra gem to run it. Then just fire up the server by running the test file, then navigate to localhost:4567 and start clicking around.
Have fun, and if you find it useful, lemme know. It'll be motivation to get a homepage up for it.
Monday, January 25, 2010
Getting a kid started with programming
I had a couple choices for him, due to some requirements:
- Something easy to install or didn't have lots of things to install
- Something with a all-in-one gaming library
- Something with some sort of community around it. 4) It'd be nice if there was a book for it.
So with those there, there was:
Ruby and HacketyHack. http://hacketyhack.heroku.com/ It also has a app framework called shoes that you can use to build both games and apps. However, since _why left, all this requires a lot of hand hold to set up.
Lua and Love. http://love2d.org/ Lua is an easy language to pick up as it's pretty minimal, and love's 2D engine is pretty fantastic. I've used it before and it's pretty easy to get started with, and plenty of examples, as well as a vibrant community.
Python and Pygame. http://www.pygame.org/news.html Pygame has all of the above, and for me, the final winner, since there was a book that walks the kid along from basic text games to the graphics part. http://inventwithpython.com/
Just in case there are those of you out there that are looking for things to help out your little programmer. Are there others you'd recommend?
Wednesday, January 13, 2010
Some of the best people are the ones you never hear about
“The superior doctor prevents sickness; The mediocre doctor attends to impending sickness; The inferior doctor treats actual sickness;” - Chinese Proverb
The bumps on the road to javascript
Sunday, January 03, 2010
The hard part about unit testing
Joe Armstrong (Erlang) once said "The problem with object-oriented languages is they’ve got all this implicit environment that they carry around with them. You wanted a banana but what you got was a gorilla holding the banana and the entire jungle."
Thursday, December 31, 2009
Bubbles and triangles
Lately, I've been looking at more information visualizations, and it's not been said enough that simple geometry is often ignored.
Often times, I'll see visualizations like this, where bubbles are employed to visually compare different records. It seems likely that people judge and compare difference in size by area. However, the artist/designer makes the mistake of mapping the data to the radius instead. This doesn't work for circles because of your old 4th grade math, stating that A = pi * r^2, where the area doesn't increase linearly as a proportion of the radius.
For the record, it's done correctly here in the visualization above, as far as I can tell.

Here, the designer decided to use triangles. If he mapped the data to the height of the triangles, that's fine, because for triangles, A = 0.5 * b * h, and hence area varies in linear proportion to height.
However, looking at Hungary, the red triangle doesn't seem quite a quarter of the black triangle.
Beyond that, for these two examples, I really see no reason to use circles or triangles. People are able to judge spatial difference much more easily, as opposed to size. It would have been far more effective to use bar charts and rectangles instead of shapes like triangles and circles. In my opinion, you only use that if the spatial x and y axis are already being used to convey other information already.
Wednesday, December 23, 2009
Practice coding faster
Monday, December 21, 2009
On to the new old thing
Ever since I quit my job at the lab 4 years ago to pursue a startup, I'd been fumbling around learning all sorts of things. And though I had determination and persistence, I simply didn't know a lot of things outside of coding. Who wants this? Why would they pay money for it? Where do you find them? How do you change your idea if it doesn't work? Going into it, I knew I didn't know anything and that I'd learn, but I also didn't know what I didn't know.
For the past year and a half, I've been with a startup that went into the YC program. So as much as I wanted to pursue my own ideas, I was advised to join up and watch other people and learn. And learn a lot I did. What to do, and what not to do. And just seeing founder from other startups helped. What their thought processes and attitudes about their line was work was. Meeting role models are easier than reading about them, I guess.
And yet, while I've been learning about things outside of code, I felt like I've been sailing downwind when it came to technical things. Sure, I'd mess around with chickens flocking (which embarrassingly, I haven't gotten back to), but for the most part, I was consumed by work. Getting the tickets done and getting better at communicating with other team members.
However, much of my creativity was sapped. It was hard to fire up the editor afterwards and explore something new. I have a whole list of things I wanted to dive into more deeply. Haskell's type system. Erlang servers. Spatial trees for Frock. Arc language. Potion language. Prof Strang's Linear Algebra lectures. Visualizations and info graphics. Mobile web apps. 3D printers. And though I've dabbled in all of the above, it's not yet been enough to satiate my cravings.
But I have learned that it's also a lesson in keeping things small and simple at first. Much kudos to those working a full time job and are able to get a side project up and running.
This blog also suffered as a result. I was afraid that the things I was learning outside of code might reveal too much about the internals of the startup I was with, so I just left nothing to chance. I simply fell out of the habit of blogging about what I've learned, and as a result I feel like my writing skills have deteriorated.
But now I've left the startup, moved to Mountain View, and I'm pursuing my own once again. It's not a secret what I'm working on, but I'd just rather talk about it in a separate post. I've also started exploring other technical topics as well, as I hinted in the last post about Potion. I'll start finishing up the backlogged technical posts.
So for those of you that still are subscribed, well, thanks for your faith. I'll be writing more, and I hope you'll be able to learn something from reading this blog as well. Have a great holiday!
Saturday, December 19, 2009
Playing with potion
For fun this morning, I cloned _why's potion and started going through the tutorial. After cloning it, I was able to compile it on my mac, and then I tried to run:
| | |
Friday, November 13, 2009
jQuery live events can only bind once
Unlike .bind(), only a single event can be bound in each call to the .live() method.
Wednesday, November 04, 2009
Tarsnap docs as an example of confusing typography
Because in 1960, the Bureau International des Poids et Mesures decided that the SI prefix G- meant 10^9.
But it means 2^30, really!
No it doesn't. Let's look at some examples:
Just a quick thought. It's pretty basic, but this was the first time I had a front-row seat demonstration of basic design principles and why they're suggested.
You can't really see it in the quotes, but if you follow the link, you'll see that the headings and text are the same size. Not only that, but the spacing between paragraphs is the same between headings and paragraphs.
That confused me and I had thought that the bolded statements was part of the text, and hence it was something the author was saying, rather than as intentioned, something we are readers would be saying as headings of different sections.
We differentiate importance and grouping by weight, size, color, and spacing. It takes a combination of these to discern what we're reading.
Thursday, October 29, 2009
You probably don't need an OLAP
select DATE(created_at) as DateOnly, count(*)
from comments
where author_id = 877081418
group by DateOnly
order by DateOnly