Oct
27
2009
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
2 comments | tags: gem, image, Ruby, tweet, twitter | posted in Ruby
Oct
5
2009
From time to time I just blast tweets about software development, project planning, team dynamics, or whatever else comes to mind. Here is a synopsis of recent tweets and rants. If you want to follow the conversation follow me at techknow and/or juixe and I’ll be sure to follow back.
Software Development
- One source of conflict with human computer interactions is that they unsure of themselves, we seek answers and they seek approval.
- What modern Operating Systems need is some level of artificial intelligence subsystem which all applications can use.
- I hate when each application asks the same question, "are you sure you want to exit?" The OS should help apps to be more opinionated.
- Computers prompt us all the time for what smart defaults would do just fine. Computers lack of inteligence is wasting mine.
- Programmers have a form of groupthink, Programmer Think. This is especially true if FUD becomes dogma and design choices are not tested.
- Break Programmer Think, test all assumptions, every design choice, every implementation, every third party library, every different scenario
- If you are testing, have spent two days on a single problem, look in the log file, especially that null pointer exception, chances are that’s the problem.
- Even with all this cloud computing we still can’t forecast the weather accurately!
- First there was the web, the the web 2.0, now the perpetual web beta.
- Going gang busters don’t scale.
- Everything is beta.
Team Leadership
- If you don’t agree on paper, you are not going to agree in code.
- When you don’t take any personal responsibility and make any proper planning, it is always someone else’s fault.
- Seen it happen… Your brains cells are inverse proportional to your climb up the corporate ladder and the resources you manage.
- Each solution comes with a free can of worms!
- OH: you would make a great manager, cause you make a grumpy developer.
Product Placement
- Google can’t commit to a version number that is why everything is in beta. Beta is like a philosophy at Google, testing like a religion.
- Google’s philosophy of the meaning of life, the universe and everything else: Beta.
- This Week in Tech does ads for their ads… to promote the fact that they need to take ads.
- Apple has sold 225 million iPods to date.
- Twitter: If you build it they will come, but if they all come you will epic fail.
Questions
- What happens when someone has buggy code in their test cases, how do you test the jUnit tests for bad test logic?
- Is Mono chasing .NET’s tail lights and .NET chasing Java’s tail light and Java is chasing Ruby’s tail light, …?
- Infinite Shakespeare Theorem: What would get if you have Shakespeare hitting a typewriter keyboard for an infinite amount of time?
- All clicks being equal, is the Amazon affiliate program better than Google Adsense?
- What is your innovation quotient coefficient?
- What is your innovation quotient?
- What name/term has the most website related moniker/naming patterns? e-iComputroniiixr beta 2.0?
- Are social networking sites making you unsociable?
- Is it possible to burn the rice and still have it be under cook?
- Which do you prefer best, an uncomfortable truth or a flattering lie?
- If you can have any view from your back porch, what would it be?
1 comment | tags: apple, google, retweet softdev, tweet | posted in TechKnow