Just pushed a cloudapp client library to github. It still needs more work but it’s midnight here now.
Posts Tagged: ruby
2
Sep 09
activerecord-ish memcached model
was hacking a plugin for rails model backed by memcached. mongodb would have been a better choice but we already have memcached running at work and chances of something new creeping in to our production servers are close to nil. anyway, this is primarily to hold model objects for ajax interactions made in a very complex UI before everything is committed to the db.
12
Apr 09
url shortener using base 62
Trying to scratch an itch one weekend, I tried to write my own URL shortener service. After all, bit.ly got $2M funding for offering such service so I went ahead and see how hard it is to create one. If you've been doing web development for sometime, this activity is trivial. The only hurdle I have was how to generate those random looking string appended at the end of the domain url. For the lazy there's always Base36 that look like the one tinyurl is using. I wanted mine to resemble is.gd so I wrote my own. Here's one I quickly wrote in ruby.
-
class B62
-
CHARS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".split('')
-
BASE = 62
-
def self.encode(value)
-
s = []
-
while value >= BASE
-
value, rem = value.divmod(BASE)
-
s << CHARS[rem]
-
end
-
s << CHARS[value]
-
s.reverse.to_s
-
end
-
-
def self.decode(str)
-
str = str.split('').reverse
-
total = 0
-
str.each_with_index do |v,k|
-
total += (CHARS.index(v) * (BASE ** k))
-
end
-
total
-
end
-
end
Hope that helps.
3
May 08
Capistrano 2.3 and Non-SCM deployment
Capistrano 2.3 now allows non-SCM deployment. So for 1-man projects without svn/git, it's easier to deploy those apps now.
7
Feb 08
Hostmonster Rails 2.0.2
Hostmonster has upgraded their Rails version from 1.2.3 to 2.0.2. Except for one app that has a missing gem, my other rails application created for 1.2.6 are running fine. Hostmonster seem to have a mongrel running somewhere but I can't get it to run from the control panel. Still using fastcgi for dispatching at the moment.
31
Jan 08
singapore.rb
I went to Singapore.rb meetup earlier tonight with Choonkeat. My first attendance and, already, I'm overwhelmed with the group's brilliance. Suddenly, I feel like a dinosaur after Jason presented what ExtJS can do.
14
Aug 07
Vlad the Deployer hits Capistrano
Vlad the Deployer is an alternative to Capistrano when deploying apps to servers. Vlad is brought to us by Ruby Hit Squad. Cool Eh?
23
Jul 07
Deploying to Remote Servers Using Capistrano
Today I stumbled upon a good guide on using Capistrano without subversion.
13
Jul 07
Trying out CakePHP
When I was evaluating PHP web frameworks that I would focus on and use on a regular basis, I didn't go with CakePHP. Instead, I went with CodeIgniter for reason that I was able make and run a sample app with CodeIgniter a few minutes after install while I was pulling hairs with CakePHP.
But not anymore. I had a pleasant experience experimenting with CakePHP over the last couple of days. It might be that I have I already know Rails which made Cake's approach fits my brain easily as Cake and Rails have lots of similarities.
Deciding which PHP framework to use on the next project will be a very hard decision to make for me. Cake's ActiveRecord implementation is better than that of CI. On the other hand, CI gives me full control of almost everything.
25
Nov 06
Rails vs Django Comparison
Scratching your head which one to use? Read this comparison document. Yes, I was even more confused after. Why can't people take sides nowadays.