I just got a G1 phone and I was playing around with google charts. Turns out they do QR bar codes. It turns out that the barcode scanner on my G1 reads the QR. So I made a greasemonkey script that adds the barcode to the bottom of every page. (After the body tag until I figure it out more)
http://deathbyescalator.com/barcode.user.js
I can now just view a site, scan it and bookmark it on my phone.
In case you have set up your db with out utf8 support by default you can change it with active record.
tables = ActiveRecord::Base.connection.execute("show tables;")
tables.each{|table|
create_table = ActiveRecord::Base.connection.execute("show create
table #{table};")
unless create_table.fetch_hash["Create Table"].include?("CHARSET=utf8")
ActiveRecord::Base.connection.execute("ALTER TABLE #{table} CONVERT TO CHARAC... <a href="/main/index/db_charsets_in_rails">[ Read more ]</a>
I am reading the perl cookbook and they are talking about some fun ways to use sort. I like that they are describing sort_by. I read some where that the concept was coded and posted in perl long ago. I wish they had a sort_by wrapper for it. anyway. I was reading that you can use an or statement in perl so if the first two are even sort it by a second value. I never thought of this in ruby.
I was asked to check a file for palindromes. Here is the code I wrote.
def find_palindromes(file)
if !file || !File.exist?(file) || !File.readable?(file)
raise "Trouble with the file"
end
words = File.open(file,"r").read
words = words.split(/\s/)
words.uniq!
palindrome = Hash.new(Arra
...
[ Read more ] I am working on a pure ruby bittorrent library. I want to use pirate bay and bittorrent to chart out how many people are downloading a file. Then I want to track a new movie and chart that against its box office/dvd sales. Depending on the movie I dont think I will see a correlation between files downloaded and box office sales. I do think that the release of the dvd will have an effect on the charts.
In other good news I think I will cha...
[ Read more ]Or How to Stall For Time Because the Site is Broken. I still have a nice fun bug where I only show this months stuff. Sure its no blogger but you know what? I built it. Other then that Duck Confit turned out well.
I was looking around for a pure ruby bit torrent lib. I found rubytorrent but the ruby forge page was not working. I would like to use event machine to create a script to download torrent files in ruby. I have started by parsing torrent files.
After reading wiki pages, c and python code I wrote a class to decode the Bencoded files. The protocol website was down. The bencode breaks down to this. l means array, d means hash, #s means bi...
[ Read more ]A new year for new unfinished projects. For example this site. For some reason I made it get the last x in a month. So the first of the month needs a post.
I have started work on a jabber bot using xmpp4r and eventmachine. Its not much of a bot yet. Its more of a queuing system. People can subscribe to different queues ran off the same bot. For example rubytalk@gmail.com us currently sending out the new links in delicious tagged with ruby or rails. Invite rubytalk@gmail.com to chat and type show queues. Then type join:#{queue name} EX join:ruby rss. You get a little welcome message letti...
[ Read more ]