Nov 23 2010

The Learning Library

I’ve always been a book lover. I have a private collection of Ruby, Perl, and Java books, amongst other topics, that would make a public library jealous. In fact, I recently moved and was surprised that that the bulk of the items boxed up where books. I’ve been making the trend of moving my library to ebooks. I was an early adopter of the Amazon Kindle, I still use my first generation Kindle. Here are some books in my collection, which I’ve use as reference.

I’ve even dedicated a blog post to a few of my favorite books, such as the following.


Dec 31 2009

TechKnow Year In Review 2009

It is that time of year where we reflect on the accomplishments of the passing year and look forward to the one to come. Here is a window into the past year in technology through this year’s popular posts on TechKnow Juixe.

Top Favorites

Fav Tutorial

Memorable Quotes

Twitter

Twitter Conversations

Year in Review


Nov 25 2009

Quotable DHH 2009

David Heinemeier Hansson, commonly referred as DHH, is a polarizing programmer with a self professed fucking potty-mouth. He is opinionated and uncensored. He is a world renowned hater, he hates big enterprise software, large startup valuations, and apple pie. The web development framework he fashioned after himself is as opinionated and know-it-all as he is. From Wikipedia…

Hansson is known for the crude and brutal way he expresses his opinions; both online and in real life. One of the main criticisms of Hansson has been about his and his company’s arrogance. Hansson, however considers these criticism unfounded and in fact he openly acknowledges and embraces the arrogant claim made for him.

Over the last year I have collected a few choice quotes from DHH’s keynotes, blog posts, and twitter updates covering a range of topics such as programming, enterprise sotware, and company valuations.

Constraints drive innovation and getting your idea out in the wild in two months instead of six will likely do you a world of good. A month or two out the gates, you’ll have a pretty good idea of whether you “got something” or not.
Entrepreneurs, Angels, and the cost of launch

The best frameworks are in my opinion extracted, not envisioned. And the best way to extract is first to actually do.
Why there’s no Rails Inc

Lines of code by itself doesn’t really mean that much to me. What you’re able to express in those lines mean a lot, though. So if you’re able to write the same piece of functionality in 10 lines instead of 100 lines you’ve made huge strides in simplicity. That’s part of the argument for why Ruby is a more pleasant language to work with than say Java or C#.
Talking Rails 2.0 with David Heinemeier Hansson

This is a snowflake… Your application is not one of them. For most of the time, for most of the people what they do is not unique. You are not special
Quote from DHH on ROR

In the beginning, there was no Rails, there was only Basecamp. After working on Basecamp for a while, though, I eyed the option of giving all the generic pieces a life of their own. But even then, I continued to work on Basecamp first. Which meant that all the functionality of Rails came as extractions of a real application, not of a “what somebody might need some day” fantasy, so prevalent in framework design.
Ask 37signals: The genesis and benefits of Rails

I’m certainly of no illusions that Rails is perfect nor that Ruby is a speed daemon.
Twitter trouble

When you work with open source and you discover new requirements not met by the software, it’s your shining opportunity to give something back. Rather than just sit around idle waiting for some vendor to fix your problems, you get the unique chance of being a steward of your own destiny. To become a participant in the community rather than a mere spectator.
Twitter trouble

Scaling is the act of removing bottlenecks. When you remove one bottleneck (like application code execution), you tend to reveal another (like database queries). That’s natural and means you’re making progress.
Twitter trouble

Requiring X years of experience on platform Y in your job posting is, well, ignorant. As long as applicants have 6 months to a year of experience, consider it a moot point for comparison. Focus on other things instead that’ll make much more of a difference.
Years of Irrelevance

One of the easiest ways to shoot down good ideas, interesting policies, or worthwhile experiments is by injecting the assumption that whatever you’re doing needs to last forever and ever.
Optimize for Now

PHP scales down like no other package for the web and it deserves more credit for tackling that scope.
The Immediacy of PHP

Bitching is such a succinct form of expression. It doesn’t require or usually entail deep analysis. It’s the easiest way to write something “interesting”.
Bitching is the killer app for Twitter

All odds are not created equal.
Startup School 2008

Often the simplest idea in the world, like treating your customers nicely, while still asking for money for what you do, can work. And you can build great businesses like that.
Startup School 2008

Forgoing sleep is like borrowing from a loan shark. Sure you get that extra hours right now to cover for your overly-optimistic estimation, but at what price? The shark will be back and if you can’t pay, he’ll break your creativity, morale, and good-mannered nature as virtue twigs.
Sleep deprivation is not a badge of honor

What separates programmers who are 10x more effective than the norm is not that they write 10x as many lines of code. It’s that they use their creativity to solve the problem with 1/10th of the effort. The creativity to come up with those 1/10th solutions drops drastically when I’m tired.
Sleep deprivation is not a badge of honor

Software development is rarely a sprint, it’s a marathon. It’s multiple marathons, actually. So trying to extract 110% performance from today when it means having only 70% performance available tomorrow is a bad deal. You end up with just 77% of your available peak. What a bad trade.
Sleep deprivation is not a badge of honor

I’ve always been a jealous person. I’ve always wanted things that others had. Skills they possessed. Authority they held. Success they enjoyed. But instead of feeling sorry for myself and growing spiteful of others, I found it to be the best motivation to imitate, adopt, and strive for the same rewards.
Productive Jealousy

Don’t let growth be your primary yardstick of success.
Finding the natural size for your company

How about you turn your perceived weakenesses into strengths. Embrace your constraints, work with limited budget of your own money and write less software.
It doesn’t have to be all or nothing with a startup

Average environments begets average work.
Average environments begets average work

No one can be a rock star without a great scene.
Average environments begets average work

So if you want your team to excel, quit thinking about how you can land a room full of rock stars and ninjas. Start thinking about the room instead!
Average environments begets average work

Do you value effort over effect?
Average environments begets average work

Humans are incredibly eager to live down to low expectations.
Average environments begets average work

Are you finding the root causes for your daily grind or does the wheels just keep spinning on the same issues?
Are you finding the root cause?

Aesthetics is a feature in itself.
There’s no shame in looking good

There’s absolutely no pleasing everyone. You can’t and shouldn’t try to make everyone love you. The best you can do is make sure that they’re hating you for the right reasons.
Work on what you use and share the rest

My core philosophy about open source is that we should all be working on the things that we personally use and care about. Working for other people is just too hard and the quality of the work will reflect that. But if we all work on the things we care about and then share those solutions between us, the world gets richer much faster.
Work on what you use and share the rest

I think the days of the traditional San Francisco startup approach are numbered. It’ll be flushed down the drain along with CDO’s and zero-down mortgages.
How did the web lose faith in charging for stuff?

Of all the terms I hate with a passion, “professional” would probably rank above “enterprise” and just below “potty mouth”.
@dhh

Speaking of presentations. I’d much rather we banished kung-fu kittens and went with beautiful women for the filler stock art. Works in ads!
@dhh

You’re bound to upset, offend, or annoy people when you’re not adding heavy layers of social sugarcoating.
I’m an R rated individual

Nothing is sacred in Rails, everything is up for debate.
Rails 3 and the Real Secret to High Productivity

When an advertiser is claiming something to be an “all-new” car/soap/computer/camera it usually means exactly the opposite. It actually hardly even means new, at best it’s most commonly just “marginally-new” or “just-a-few-tweaks-new”.
There’s nothing new about all-new

Focusing on just the newness of something is usually a pretty weak selling point.
There’s nothing new about all-new

Ideas on their own are just not that important. It’s incredibly rare that someone comes up with an idea so unique, so protectable that the success story writes itself. Most ideas are nothing without execution.
I had that idea years ago!

Just because you thought of a site to share photos with friends wouldn’t have made you Flickr.
I had that idea years ago!

Why does the idea of work have to be so bad that you want to sacrifice year’s worth of prime living to get away from it forever? The answer is that it doesn’t. Finding something you to love to work on seems to be a much more fruitful pursuit than trying to get away from the notion of work altogether.
Early retirement is a false idol

If you come to the realization that work in itself isn’t evil, you can stop living your life as a waterfall-planned software project too. No need to divide your timeline on earth into the false dichotomies of Sucky Work Era and Blissful Retirement Era.
Early retirement is a false idol

There’s nothing like the look of beautiful Ruby code in the morning. Gracefully colored by TextMate and rendered in Bitstream Vera pt 12.
@dhh


Nov 18 2009

Favorite Programming Quotes 2009

When I am not coding I am reading about code. Here is a short list of memerable programming quotes I read over the past year about the science and art of software development. Over this last year, my interest and reading habits have been related to software development, team leadership, and entrepreneurship and this quotes reflects those topics.

What we learned over several years is that the registry in the data center is an evil, evil thing.
Sriram Krishnan

No code is faster than no code.
Merb Core Tenent

Rails is the best framework for the 80/20 rule out there. It will get you 80% there faster than any framework, but it will fight you tooth and nail for the remaining 205.
Ezra Zygmuntowicz

Software: do you write it like a book, grow it like a plant, accrete it like a pearl, or construct it like a building?
Jeff Atwood

I will not break my back or my sanity on Windows troubleshooting any more.
Jamis Buck

Premature parameterization is the square root of all evil.
Sean McGrath

If you can’t be a chick magnet, be a porn magnet.
Zed Shaw

Piracy is a natural state of affairs for users with lots of time and no money.
Jeff Atwood

Every time DRM prevents legitimate playback, a pirate gets his wings.
Nathan Bowers

What ruby does offer is a more intuitive way of coding. Its form is simple. It’s full of grace. Ruby is succinct. It’s not the messiah of languages though it attracts many messiah-figures and their fanboy prototypes.
Renae Blair

I do believe I have post-traumatic Java syndrome.
Renae Blair

The thesis explicit in Crockford’s book (JavaScript: The Good Parts) and implicit in Conway’s (Perl Best Practices) is that the best way to use a language is to carve out a subset of its functionality that is superior to the whole smorgasbord you have on offer. It’s how people use natural languages, and it’s how a lot of good programmers use programming languages as well.
Giles Bowkett

Frameworks like Rails make you fast, and Sinatra makes even Rails look slow.
Giles Bowkett

The goal is not to establish a far-off goal and find a way to hit it, but to establish a series of tiny, immediate goals that keep you forever moving forward. Aristotle argued that virtue was mostly a matter of having good habits; Lao-Tzu tells us that the voyage of a million miles starts with a single step. So the key is to get moving and keep moving.
Giles Bowkett

Instead of charging the going rate of $250, we decided to charge $350. Why not? I figured we could establish ourselves as having the premium product simply by charging a premium. In the absence of additional information, consumers often use prices to judge products.
Joel Spolsky

That’s another flaw with performance-based rewards: They are easy for one of your competitors to top.
Joel Spolsky

Longevity is a big part of credibility.
Jason Calacanis

People’s reputations are made in the bad times more than the good times.
Jason Calacanis

If you can’t sell your product, it’s not a product–it’s a hobby.
Jason Calacanis

I fear — as far as I can tell — that most undergraduate degrees in computer science these days are basically Java vocational training.
Alan Kay

Agile is not just about speed.
Jack Milunsky

I can’t choose whether someone is offended by my actions. I can choose whether I care.
Martin Fowler

Would you pay $100 an hour for an untrained accountant? Because if your consulting rate is $100 an hour and you do your own accounting, that’s exactly what’s happening.
Chris Wanstrath

So, what does it mean for teaching and learning programming when the solution to every beginner problem is available on the Internet?
Cay Horstmann

One of my most productive days was throwing away 1000 lines of code.
Ken Thompson

Deleted code is debugged code.
Jeff Sickel

Good software architects are like condoms… bad software architects are like Viagra.
Sidan

Nobody hates software more than software developers.
Jeff Atwood

Not all liquidity events are created equal.
Brandon Watson

Not all code needs to be a factory, some of it can just be origami.
_why

If you program and want any longevity to your work, make a game. All else recycles, but people rewrite architectures to keep games alive.
_why

I think Ruby is the next best thing after sliced bread and Common Lisp.
ivanstojic

The best way to market yourself is to be remarkable.
Chad Fowler

I rather raise nerds than raise gangsters.
The RZA

Not having a clear goal leads to death by a thousand compromises.
Mark Pincus

Chase the vision, not the money.
Tony Hsieh

Those that say it can’t be done, shouldn’t interrupt those that are actually doing it.
Michael Arrington

What it comes down to is that Rails developers are just that: Rails developers. They’re not software developers, at least not most of them. … Their framework dictates how their systems are designed instead of the problems the systems are designed to solve.
Samuel Tesla

If you are single and you want to do startups, stay single. Stay single for a while, startups can be all consuming 24/7 suck you dry.
Steve Blank

You can’t build everything and there is no more a killer feature. Everyone has a different killer feature.
Matt Mullenweg

I am the unhappiest WordPress user in the world, I think it sucks.
Matt Mullenweg

The biggest motivation is not the money but the impact.
Matt Mullenweg

If I’m on the titanic I want to be steering.
Matt Mullenweg

You don’t want to be the site that people should use, you want to be the site they can’t stop using.
Roelof Botha

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
Martin Golding

One man’s feature is another man’s complexity.
Juixe TechKnow


Oct 27 2009

Download Twitter Profile Images Using Ruby

Recently, I gave myself the small task of going through all my Twitter retries and downloading each profile image from each Twitter user that replied to me. To access my Twitter replies I used the Twitter Ruby Gem. I am using Twitter gem version 0.4.1.

The script is small and pretty concise that it can speak for itself. I use my Twitter credential to log on and query for the 40 most recent replies. For each reply download the user’s profile image.

require 'rubygems'

gem 'twitter', '=0.4.1'

require 'twitter'
require 'open-uri'
require 'find'

twitter = Twitter::Base.new(username, password)
replies = twitter.replies(:count => 40)

replies.each do |status|
  user = status.user
  image_url = user.profile_image_url
  image_name = image_url.match(/([\w_]+).(\w\w\w)$/)
  file_path = "profile/#{image_name[1]}.#{image_name[2]}"

  # Did I already download this image?
  unless File.exists?(file_path)
    File.open(file_path, 'w') do |output|
      # Download image
      open(image_url) do |input|
        output << input.read
      end
    end
  end  
end

Oct 8 2009

Jamming with Ruby YAML

When working with Ruby, the library/class I use and abuse most often is YAML. YAML stands for YAML Ain’t Markup Language and it is a versatile human friendly data serialization format. It is easier to use and understand than JSON.

A YAML file is much like a Java properties file in that is used to store name/value pairs. YAML is more powerful than simple Java properties file but that is a good way to think of it to begin with. Here is a example of a simple YAM file used to store user name and password.

user: juixe-username
pass: juixe-password

The above YAML snippet can go into a file, typically with a yml extension. To load the YAML file in ruby you can do it in with following Ruby code.

require 'yaml'

yml = YAML::load(File.open('userinfo.yml'))
puts yml['user'] # juixe-username

Just replace userinfo.yml with the name and path of your YAML file. The object that is loaded from the YAML file is a regular Ruby hash object so you can iterate through all the name/value pairs like the following.

require 'yaml'

yml = YAML.load_file 'userinfo.yml'
yml.each_pair { |key, value|
  puts "#{key} = #{value}"
}

What makes YAML files more powerful than a regular Java properties file is that you can complex object collections, structures, or hierarchies. For example, imagine that I want to log into a series of Twitter accounts and get their most recent at replies. I can keep a collection of twitter account usernames and passwords in a YAML file much like the following.

juixe:
 user: juixe-user
 pass: juixe-pass
techknow:
 user: techknow-user
 pass: techknow-pass

Here is the sample Ruby code that can be used to iterate through each user account from the YAML file.

require 'yaml'

yml = YAML.load_file 'userinfo.yml'
yml.each_key { |key|
  username = yml[key]['user']
  password = yml[key]['pass']

  puts "#{username} => #{password}"
  # login ...
}

You build more complex data structures than this using YAML, but this should be enough to get you going.