Skip to main content

Posts

Showing posts from 2012

How to pass a Rails or Sinatra variable into JQuery.

A few days back I got a code challenge for a cool job position. For whatever reason the test was very light on Rails very heavy on JQuery, which I didn't know much about frankly. So in less than 24 hours I had to not only learn enough of it but also make it work into a modal window widget. I got it done, but it wasn't elegant at all. I clobbered it even if it worked.

The first challenge was to get information into webpage from a Rails application, I chose JSON and thought it'd be easy-peasy, but transferring a JSON object is a cross-domain script violation and most browsers won't let it pass. So I learned about JSONp which wraps the JSON object in a JQuery call-back. Lacking the easy Ruby ways of determining what things are, at first I'd no idea what the JSONP object was and just had my Rails app send JSON. Once I figured what it was, it was trivial to get Rails to do it. All I had to do was add: :callback => params[:callback] to the format property in the contr…

A Clockwork Orange

A milk bar. It left me confused. I imaged a bar, like as a night club, where under-aged kids would do drugs and drink milk. I remember hollering with glee when I saw a milk bar in Australia and suddenly got the book A Clockwork Orange in it's entirety, years after I'd read it, a bored week I spent in Princeton before shipping out to Japan. [A milk bar is what in America is called a convenience store! A place to buy milk, not a crazy night club.]

The whole confusion on the book arose from having watched or partially watched the film of the same name. In the film it's all about the 'horror-show' which is literally a visual tour of violence. Where a pack of young men meet out ultra-violence made cool, made strangely attractive, glorified not for it's meaning like wars, but for it's act, like art. The book is different, thought.

Upon realizing what a milk bar was, I got what the story is about. It's not about violence but about boredom. The kids go to the m…

Solo Travel Pt.1

"And if you can't find a loyal companion,
  travel alone..."

I slept in late. I didn't want to get up. I couldn't stay there any longer and as if to confirm it my aunt started the conversation with "I don't want to kick you out, but when --" But I cut her off. "I'm leaving today." All the stuff was packed in the car. After a year of sleeping on the floor on an air mattress, having my car stolen, recovered and broken into again, learning photography and co-directing a documentary, the time had finally come to leave. The next day, after staying one final night in Florida at my friend's apartment in Tampa, the inherent adventure of solo travel would take me over, I would wake up early the next day, ready to travel across the country, ready for a journey with an uncertain destinations. I was uncertain and ready. I put on my Princeton T-shirt to remind myself of what I had accomplished and gassed up the car and set off.


The drive was ex…

Kindle Paperwhite 3G, a crippled device

In my quest to find a good e-reader that beats my iPhone, I've tried a Nexus 7, a Kindle 3G Keyboard and a now a Kindle Paperwhite 3G. By far the most useless device is the last.

I could write a long review but there is no need. A Kindle Paperwhite 3G is the same machine as the Kindle Paperwhite WiFi, except $60 more expensive. The 3G is limited only to amazon.com and your own books. It's miniscule 2GB storage means you have to be connected to a network if you have a lot of files.

The Paperwhite also removes features the previous Kindle had, like an MP3 player, a headphone slot or the ability to read text to you (if allowed by the publisher/author). The storage is reduced from a previous 4GB to now 2GB. Though that would be plenty for most people. It also lacks speakers but that's a feature I don't miss, since the speakers weren't great to begin with. The device is much much sharper and brighter than the Kindle 3G Keyboard, but it is comparable to the Nook Glo (tho…

Advantages of Different Ruby Implementations

Some one asked me what where the advantages of JRuby lately. I had to think and that got me to this post.

JRuby
- Runs on Android
- Can be uses to pre-comple code to Java Byte code for speed and code obscurity. :thumbs up:
- Runs on a Java-Virtual-Machine server.
- Runs on any computer w/ Java (whether it has Xcode or not)

MacRuby
- Scottish.
- GUI apps that use native cocoa frame work.
- iPhone apps through Ruby Motion.

mRuby
This is 'embedded ruby' and it hasn't been released yet but from what I know:
- Very light, requires little memory and space to install.
- Gives you Ruby expressiveness where a program language like Lua could only go before.

IronRuby
Sadly semi-abandoned. This Ruby's goal was to compile on Microsoft's .Net framework.
- All those poor .Net developers doomed to MS's C++++ (C#) would be able to taste salvation in Ruby.

Rubinius
Ruby that is mostly written in Ruby. Apparently this is good for thread-safe running of multiple rubies in one mach…

Retraction – Installing Ruby 1.9 on a Mac.

Nothing is worse than having to print a retraction, one of my posts is on the lightest way of installing a new Ruby on the Mac.

Turns out the rbenv and ruby-build do indeed require Xcode. Even though the website and even some people believe it's not required, ruby-build needs a compiler. Suddenly the case for rbenv is nil, null and void. I am a bit upset that this requirement is not clear from the documentation, and its harder configuration, coupled with the need to always preface your Rails commands with 'bundle exec' and its lack of advantage of rvm in size, make rbenv a looser and I can't recommend it anymore.

I have just switched to RVM, which while it requires the behemoth of Xcode or possibly just the 'command line tools for Xcode' is a far better choice. RVM or Ruby Version Manager, allows you to create gem sets per project that then can be shared with the project itself. It's command line interface is super polished, and there is way more informatio…

Why Ruby is the perfect* teaching language.

I was reading Avdi's post on a new programming langauge designed for learning called Grace, like Skitch, LOGO and others before it, it fails. It fails because computer language designers keep looking in the wrong place. In the PDF on their presentation they discard python because it has "inconsistent method syntax" like that is a point of contention in learning a language.

Look at normal speaking languages. Are they consistent? Heck no. They're full of exeptions and irregularities. The more regular the easier it can be to learn yes, but irregularity doesn't equal difficulty. Some irregularity is expected.

The number one thing a learning language needs to be is readable. It's like the difference between html and markdown. HTML is simple, consistent and easy to understand but it's near unreadable. It's deeply nested, it's interrupted by obtrusive markup and closing tags. While markdown is eminently readable. That makes it easy to learn.

So languages…

Why Markdown is awesome

Markdown for those that don't know is a type of file encoding (extension .md) that can be easily converted to HTML. To use Markdown, you just need a text editor but some programs make using it easier by showing you the rendered output in HTML. For Windows there is the excellent Markdown Pad which is a great example of a small light program that does what it does best. And for Mac, I suggest Textmate but there are others like Mou. I haven't found a great one for Linux but once you get the hang of Markdown you don't need a specialized text editor for it, any will do. For the iphone/ipad I suggest NOCS, which I got for free on a sale and is great.

# Why is Markdown so awesome? #

1. It can be rendered easily into HTML, but also LaTex, and PDF. But that's a given right.
- It makes writing HTML easy. Especially lists. It makes it so easy I use it for writing my TODO list. I love that after you establish  the first number every dash get's converted to the next number with…

Setting up your command line on Windows

I'd been frustrated and had resigned to give up on using the command line (CLI) on Windows. Alas, the Microsoft product seemed to not have improved since I started using the command line in High School back in the 90's. Clunky and completely lacking super useful tools, like 'which' on Linux/Mac, I'd just abandoned it. I even wrote scripts in Ruby to avoid using the command line in Windows (which is not a bad idea btw). Yet today I found the missing piece. I knew that you could install Cygwin on windows to get a Linux like prompt, but cygwin is a monster of an environment and you essentially have to live inside of it to use it. But I found Gow and all is well.

First things first, the terminal or command application on windows sucks. I highly recommend using Console2, which is a portable application that is way better at giving you a command prompt than anything Windows has by default, and it's free. You can set a start-up directory in it, so you can launch it fr…

Case Study: Hiring Process Valve vs. Traditional.

I was thinking how I like to be a swiss-army knife tech guy. I am studying for the LPI Linux exam, and wondered suddenly why employers don't value an "answers guy" (or gal). You know, a person you can go to with questions and problems and he (or she) can figure out or just knows the answer. Then it struck me that Valve's model kinda does that. I've been reading a lot about the company and I wish there was a case study about them. Their flat management style seems extremely effective and unfortunately unique. Being a private company, it can run its ship however it wants so Valve runs it in an interesting way. They don't hire people for particular jobs. They hire people and basically let them figure out where they can contribute the most. Desk have wheels because on a project per project basis you may be moving around forming different teams. It sounds like an Agile-dream workplace. But a key here is not the way they work but how they hire. While they look for …

The Curious Dance of the Job Seeker

So today again I've been drawn into reading another article on what should you put or not put on your resume article. Probably the umpteenth one I've read this year. You get into this self-judgmental dialog: Should I do this? Should I do that? And Oh my God I did it wrong that time!

None of that helps. I find it curious how the Job Seeker starts to makes this dance trying to present him or herself as the perfect candidate for a job. Twisting and turning, fixing a resume here, tweaking there.

But what does this accomplish? It's patently obvious to me that the process is broken because it treats people like interchangeable cogs. You need an engineer? Then only an engineer will do.

I wonder about pople like Robert McNamara who is the subject of the documentary "Fog of War" which I saw this weekend. He went from the government to working for Ford. It was clear he didn't get that job because he had "previous automobile working experience." Yet his contri…

The Sad Ecstasy of Being Right

The bitter sweet sensation, is like a drug for those that've felt the scorn of being condemned for daring to speak what others don't want to see. To cover ourselves with the knowledge of being right and comfort ourselves from that scorn is but a poor substitute.

It's easy to be right. If you've ever felt the scorn of being rejected for seeing the truth you know the seductive ecstasy of hiding behind the "I told you so." It's easy to be right. The drug-like effects comfort you in the cold loneliness. You feel vindicated, the lone-hero, the one who saw where other failed to see.

Yet it's a sad song to hear, a bitter comfort, for the real power lies in being convincing.

Lately I've heard interviews with Paul Krugman, nobel prize winning economists, about how he is mostly right about his economic predictions. I thought to myself, what a way to go for the low hanging fruit. The dare, the challenge, is to be convincing. To not just say what's right …

The Sad State of Puerto Rico

This past month has been fun. Univision declared a celebration for Puerto Rico's independence, an event that hasn't happened. And the Huffington Post shared a racist tweet from the adviser to the speaker of the Puertorrican House of Representatives.

In other news Canada has the same crime rate as Puerto Rico. No, no, I mean the BBC reports Canada has less number of murders (598) for a population of around 35 million that Puerto Rico has with just 3.5 million (around 1,000). But what's a factor of ten between friends?

Yet friends of mine on Facebook still defend Puerto Rico as if it wasn't that bad. It was bad in 1993 when I finished H.S. and we had almost 1 murder per day. Now it's at over twice that.

What's going on?

From afar you have a different perspective that from inside. But all I'm seeing is the fulfillment of trends that have been a long time going.

1. Brain Drain. This was a problem 15 years ago, but it was pretty much ignored. Now it lands with su…

Google Nexus 7 Review: A Gaming Platform

I've been doing a lot of research lately and have been getting a ton of ebooks in the process. My eyes sometimes get tired from reading on a computer and it's not as nice as reading a book, but carrying around a whole bunch of book is not great either. So when I heard Google was coming out with a new tablet I was excited. I was convinced after reading Ars Technica's glowing review.
Figuring it would pay for itself in two to three years at the rate I buy books, I ordered it and received it yesterday. And in one day I already saw all I needed to see.

Design
Flawless. But in the days of iPhones and iPads, it has to be flawless. Anything less is not even considered. The Nexus 7 resembles the first few iPhones with a glass surface bordered with a metal bevel. The back is rubberized and curves nicely in the hand. The dimples in the rubber give it a nice look and also make it pleasing to the touch, giving it a nice solid feel. There are three physical buttons: power and volume up …

And another one bites the dust.

In technology innovation is key. Innovation tends to run contrary to typical business behavior which is still based on the industrial model of create and replicate. Innovation is about discovery, research, on-going creation. Fail to do that and you'll be in trouble.

The second key is execution. Innovate but fail to deliver and you'll be in just a bad a position. New is not better than good. Deliver good even if not new and people will love you, but it has to be good.

Blackberry's company, Research in Motion (RIM) is in deep trouble right now due to both of these issues. It had a good product, so it failed to innovate. Because good is better than new, it still did well, until the competition got better. A failed tablet, a sclerotic operating system and lack of a viable app stores have seriously wounded this once titan of the industry.

Now to add insult to injury they've lost a multi-million dollar case. RIM will be a study for business schools now, but not just as a ste…

Apple be like Yoda. Be green.

Dear Apple,
Why should you reconsider your green registry pull out.
I know that innovation and the “wants of the customers” are business pressures that are hard to ignore. They want it faster, lighter, cheaper. And you so want to satisfy all that. The designers want it sleeker, cooler, svelte. 
Now is not the time to pick short term over long term. While it may seem that having products that aren’t easy to repair, recycle and take apart is what people want, like Henry Ford said:
“If I’d asked people what they wanted. They would have asked for faster horses.”
It’s easy to forget the big picture. Apple had its start catering to that tinkering vision and recently providing a mesh of engineering and design unparalleled in the world. It’s not design alone. It’s not engineering alone. It’s that alchemical combination that when it’s right it’s magical. The computer, the tool, melts away and the crafters of words, images, music, presentations, code, see only their craft, their art, their ima…

Awesome Job Interview Questions that I've been asked.

1. Where do you see yourself in five years?

2. What are your weaknesses?

3. What did you not like about your previous job?

4. So you live in [insert here]. That's far. Do you think you can make it here?


Funny stuff indeed. But it's probably karmic, apparently when I was giving interviews, I was tough.

DVD where to next?

Steam has released its first movie through its digital distribution network. Netflix streams movies directly to your computer. Hulu is the new cable. Is there a place for physical distribution?
Is Bluray dead?
The short answer is: yes it is. I used to work in the DVD industry and after getting laid-off a few years back I've been looking to re-invent myself as a writer, as a programmer and as a leader. Things easier said than done in this economy.
The sad part of this is that this digital transition was inevitable and foreseeable. Yet the studios and the vendors (I worked for a vendor) and even the retail stores all pretended that it wasn't happening, until it did. Blockbuster is no more, Hollywood Video is no more. All preventable 'deaths' if they'd moved their assents correctly.
The next thing on the chopping block is film canister delivery to movie theaters. With silver jumping in price (I'm not sure but I think it quadrupled) and silver being a huge componen…

Your not goin' to get it.

Grammar is awesome you have Johanna's Jacob's and its. Because it's is a contraction of it is. But is it Thomas' book or is it Thomas's book? You get through and thru, as in Drive-Thru which in case you're wondering was the first way ever I saw that word spelled, on the Drive-Thru at Burger King. Then there is your and you're. "Your bandanna mean's you're a hippy, Eeyore..." And honestly I had not grasped that these was the plural of this until I was in college.

But for all this confusion and cases, (it's weird yet niece, nice, and Nice but Einstein?) it's all good. The flexibility of the language allows for all of it. Until you get the grammar police. Taking perfectly understandable sentences and dubbing them wrong for not being spelled right or following the right grammar. I love that as a writer I can just claim poetic licence whenever I so want. So sanguine and it's bloody name can be in my writing blood-thirsty and not en…

What's a flame?

I just heard the Science Friday's coverage of Alan Ada's challenge of explaining a flame to an 11 year old. I want to take a gander at this, then I'll look at what the scientist say.

What's a flame?
A flame is energy. What you see is energy being released in the form of light and heat, from likely a chemical reaction. And the distinct tongues in a flame are plasma, a form of super heated air, that throws off energy (light and heat) as it cools down. In space flames are round, but when there is gravity hot air is less dense (or lighter) and gets pushed up by the colder heavier (denser) air thus the flame licks upwards and dances as different air comes in and gets 'burned' and turned into plasma. 
For all the stuff I know: what I just wrote above might actually be wrong. I've never had it explained to me. Now let's see what the scientist say.

Edit: 6-8-2012
So now the Science Friday winner has been determined, or at least a cool video was posted we got to…

The Great Gatsby

There is a new movie coming out with Leonardo DiCaprio, an adaptation of the Great Gatsby. A novel I feel a weird connection to because like Fitzgerald I too went to Princeton and saw the decadence of the very rich. A world behind closed gates, a world of cooks and servants a world so apart from my own I'd though it was make belief had I not seen it with my own two eyes.

Seeing it, I felt like a voyeur, peeking indiscreetly into someone else's intimate affairs. And in many ways that is what the novel Gatsby is about. I read it in high school and I barely remember reading it, I think I probably gave up on it and watched the film at some point. I think this book is incredibly important because it truly chronicles an important period in America's life, but it can be hard to digest as a teenager. You read about love and obsession like space travel as something interesting that has no connection to you, something that you will probably not do -- a teenager is too young to under…

My Kickstarter Project has been FUNDED!!

With the incredible graphic by my friend Brian Manning, and this quirky video I made I set out to get a Kickstarter project going to write a short eBook on Environmentalism. Originally I titled it "Why Environmentalism Fails" in the style of the book "Environmentalism is Dead" but I realized that was not what I wanted. So I re-titled it "How Environmentalism can Succeed" and set out to promote it.


My family did an all-star job at this sending my friends and family email far and wide and almost all the founding came through their work. Incredible support! I deeply awed and very grateful to them for this.

Today I wrote an update for the project and did some research and writing. Then I spent a few hours freaking out. It's such a huge job! Or at least it suddenly seemed so. By hook or by crook I will do it.

Lately I've been working on the tone of the book. I want it to be hopeful and profound. Now to create that...

Seeking inspiration I found this t…

The Fallacy of Mad Max

In the movie "Doomsday" a post-apocalypticfilm set in a Scotland that looks like a punk version of the 70's movie "The Warriors" crossed with the crazy Road Warriors from Mad Max a mo-hawked leader runs a group of crazy cannibals.

But this is utter non-sense. The fallacy here is that a cult of personality would develop at all. One where people would tattoo themselves and live in brutality and violence. The reality would be very different. You see this culture of personality would require mass media to be generated. In small groups you'd have a culture of character. People wouldn't care if you look great or if you're crazy, or punk or violent. People would seek leadership in character not in personality. People like Lincoln, Teddy Roosevelt would be the real leaders not crazy charismatic leaders. With a lack of mass-media to celebrate this individual expression, it would be the strength of character that would rule the day.

Cult of personalty is an i…

Default Audio Ubuntu 12.04

My new Ubuntu 12.04 install keeps defaulting to my HDMI audio that I don't use. I looked on how to set a default audio on Ubuntu and couldn't find a solution that was simple and elegant. Weirdly I remembered having this problem before and then I saw I could disable an audio hardware in the dialog. Now it will default to the only other audio device, the one I'm using without me having to do any weird configurations.

Windows 7 Fresh Install Procedure

My Windows 7 computer crashed last week. It had been giving me BSOD for a few days. This gave me an opportunity to start fresh with a new Windows 7 install. In re-installing I found a few thing I hadn't found before and re-visited some cool options.

Configure the BIOS Windows 7 doesn't require any fancy BIOS setting but I would recommend that you make them Hackintosh compatible now, otherwise you wont be able in the future. There are three changes you should make: set Suspend to S3, SATA to AHCI, and HPET to 64bit.

Installing Windows 7 64-bit I don't have a wired connection to my computer so I install from a DVD, then I run through this installation procedure.

Install Wireless Driver: TP-Link (from CD)Run Windows Update (several hours & restarts)Use Ninite (ninite.com) to install Microsoft Security Essentials first.Then use Ninite to install other software like for example: Chrome, Opera; Skype, Pidgin, Thunderbird; iTunes, VLC, Audacity, Spo…

Top 10 Games of All Time

1. Shadow of the Colossus 

It has an incredible atmosphere, challenging game play and deep pathos. It's hard to capture a mood with a game and this game captures it perfectly.
2. Silent Hill


I played this game in Japan while healing from a broken clavicle. The way it uses sirens and background noise to evoke dread in the player is unmatched. The game set a tone and kept it throughout. It was like diving in into my favorite horror stories. It was the first game that felt truly cinematic and the first that scared the shiatsu out of me.
3. Legend of Zelda Without complication this game rewarded exploration. By eschewing experience points it created a simple mechanic of hearts that was easy to understand and powerful. I still remember burning a tree and finding the Level 8th dungeon, before my neighbor did. 
4. Castlevania


The challenge of this game was incredible! The music was pulse-accelerating and you had to be precise, alert and on point. Its delay on the whip was fantastic becau…

The Scary Man

A black man was shot in Florida. A kid really. Wearing a hoodie, buying skittles not to far from his home. Unarmed. The man who shot him was Hispanic. Everybody is crying racism. 
I doubt it. 
Race had something to do with it I'm sure, but I don't think it's as simple as racism. I think it's from a different way of looking at the other man, a way where the man is suddenly a threat before anything else, a kind of Anton's blindness that prevents people from seeing what's in front of them. A teenager with skittles becomes a threat. A danger. A terror that has to be stopped, lethal. I, of course, don't know for sure if this is what happened in Florida a few weeks ago, since few details have come out. But I doubt the calls for racism and wonder if it is this other thing.

I'll call it the Scary Man syndrome, which is distinct from racism.

I've seen it before. My roommate in college told me an experience so bizarre at first I thought he was pulling my leg, …

H1-B1 Visa Entrapment

I've been rather bemused by the calls to increase STEM (Science Technology Engineering Math) education in this country. Mostly because I think the stress is in the wrong area. The US in my opinion doesn't need any more STEM mayors. What it needs is to have the base level of understanding in those subject areas raised across all disciplines. The fact that a simple process like global warming is misunderstood and one as complex as evolution dismissed and in danger of being taught along side creationism in many states (see teach the controversy bills) are real problems. But a shortage of engineers sounds fishy to me.

I can't put my finger on why exactly that is but I have a good intuition about this things and I'll trust it. One clue however is the H1-B1 program. In my former company we had software-engineers that were part of that program and I found something strange about it right away. The visa is owned by the company you work for not the individual: it is a hidden fo…

Browsers I use

Opera
Opera was for the longest time my favorite browser. It had tabbed browsing when that was just an idea in the back of a Firefox developer and it had a great hiding ability in the PC which made it great for work, Ctrl+H (they changed it afterwards) and it minimized to a task-bar icon, perfect for that unexpected visit to your workstation and even better, as my job was visually intensive but I could listen to whatever, it has a voice reader built-in on Windows XP. Unfortunately, Opera has more or less dropped from my the list of browsers I use with one exception: It's my default feed reader and IRCchat client.



I also use it on my Mac laptop because it allows private tabs (as opposed to the whole browser) saving screen-real-estate. Sadly on the PC it has gone from main browser to occasional special use, which is a bit sad considering Opera pioneered a huge amount of the technologies used in other browsers like: tabbed browsing, keyword searches, persistent tabs, built-in develop…

Yes that's me they're referring to.

I'll post a picture with the shirt once I get it.

The Christian Problem

I've been researching to write a book on Truth after I finish my novel. It's slow research, one can't rush philosophy or theology. So tonight on a restless night I was reading about a person that ran into trouble with his neighbor on his tiny house. I got upset. I got sad. I went through teeth-grinding frustration reading his blog post. Only words yet they got me so upset. I've been noticing this more and more lately and paying attention to them and recording them to see why they make me so upset. Like for example one of the people in my Agile Management Class, writes in such a way that I get upset, angry and furious about it and become rather arrogant with him. I'm not sure why it pisses me off so much the way he writes but I'm beginning to think I strikes me as him "being better than me" and I just want to show him his not better than me. I should say that in his writing he doesn't say he's better than me but that's how it strikes me, pr…