blog with Vim script

April 13, 2009

… after severall exchanged emails between me and Andrei Thorp about the Vim blogging ruby script, we made some changes. So instead of the initial test for Vim compiled with +ruby message s:ErrMsg, we now have an echo.\n\nAndrei’s git (yep, they are git fans too, git rocks!) commit was calling another Vim from his machine. That was not a +ruby vim. So an error was fired upon git commits. Now we fixed it. ... Read more

Sun.com privacy

April 9, 2009

I subscrived to some mail publications from Sun Microsystems. After that, one gets the usual validation e-mail. This one states: Dear Sun Community Member, Thank you for subscribing to the following Sun Microsystems eNewsletter(s)/notifications:[…]Sun respects your email privacy and security. In order to start receiving these publications, you must first confirm your subscriptions. Please click on the url below to activate your subscription(s): https://subscriptions.sun.com/sunmailapi/Optin?id=999999999 Thank you for subscribing. We hope you find the information to be valuable. ... Read more

Shoes.rb on Github

April 7, 2009

_why posted in Shoes mailinglist that he will be moving source code to Github.com. Since I am using Git for some months, this is good news.\n\nIn short, Shoes.rb repository:\nhttp://github.com/why/shoes\nYou can clone the repository with:\ngit clone git://github.com/why/shoes.git\n\nDitz, (\“a simple, light-weight distributed issue tracker designed to work with distributed version control systems like darcs and git\“) will be used as an issue tracker. The YAML database file is included in the commits, since it becomes a project source file. ... Read more

Gmail uploadr

April 7, 2009

Update: run in Ruby 1.8.7 since Mail (mailread.rb) was removed from the Ruby 1.9.3 Standard Library. +++ title = “msg upload to gmail ruby class (imap)” date = “2008-12-04” menu = “main” +++ … moving to Google Hosted (Google Apps), there was the need to upload some thousands of e-mail messages. Since they were (mt) MediaTemple\“”) Berkeley mbox stores, I scp’d them locally (backup) and them imported them into Evolution local folders. ... Read more

the spirit that lives in the computer

April 4, 2009

“We are about to study the idea of a computational process. Computational processes are abstract beings that inhabit computers. As they evolve, processes manipulate other abstract things called data. The evolution of a process is directed by a pattern of rules called a program. People create programs to direct processes. In effect, we conjure the spirits of the computer with our spells.” Structure and Interpretation of Computer Programs

Twittershoes: programming in Shoes.rb

April 2, 2009

I have to share this piece of code, wich results look indeed nice. You’ll see in the next blog post…\n\ndef string_alert\n c = (LIMIT-@iSay.text.length)\n @remaining.style :stroke => \"#3276BA\"\n c > 10 ? (@remaining.style :stroke => orange) : (@remaining.style :stroke => red) if (c < 21)\n c > 0 ? \"#{c.to_s} chars\" : \"Too Long!\"\nend\n\n\n[update]: Twittershoes.rb is born: screenshot here

pg_upgradecluster 8.2 main

February 12, 2009

PostgreSQL 8.3 is here. After apt-get’ing it, the upgrade didn’t move the 8.2 cluster up. Having 8.2 running in a custom port, made 8.3 go use the standard 5432 port.\r\n8.3 created a main cluster.\r\n\r\nCheck ports:\r\n$ sudo netstat -anput | grep postgres\r\n\r\nCheck wich configuration files and wich versions are running:\r\n$ ps -Af | grep postgres\r\n\r\npg_upgradecluster when upgrading the existing PostgreSQL cluster, will check ports of the new and old version (check both 8. ... Read more

JSON Ruby and Smallr API

February 3, 2009

Nuno’s smallr.net API talks JSON. So what about accessing it with Ruby ?\nWell, quite easy thanks to Florian’s JSON implementation for Ruby. So:\n\n$ sudo gem install json_pure\n\nNow, just need some attention on the use of the address / (slash) just after json and before the query, or you’ll get a HTTP 301 Status Code.\nCode follows:\n\nrequire 'rubygems'\nrequire 'net/http'\nrequire 'json/pure'\n\nurl = 'http://www.google.pt/search?q=json+ruby'\nescaped_url = URI.escape(url, Regexp.new(\"[^#{URI::PATTERN::UNRESERVED}]\"))\ncall = Net::HTTP.get_response(URI.parse(\"http://smallr.net/json/?url=#{escaped_url}\"))\nres = JSON.parse(call.body)\n\nputs res['status'] # ok\nputs res['url'] # http://smallr. ... Read more

on URI Ruby escaping

February 3, 2009

URI.escape method with no options doesn’t provide a trully good escape, and i just noticed it upon the need to access an API.\n\nurl = 'http://www.ruby-lang.org'\nbad = URI.escape(url)\ngood = URI.escape(url, Regexp.new(\"[^#{URI::PATTERN::UNRESERVED}]\"))\n\nThe difference is:\n\nbad => \"http://www.ruby-lang.org\"\ngood => \"http%3A%2F%2Fwww.ruby-lang.org\"\n\n\n(via snippets.dzone => Matt Zukowski)

© 2018 | Follow on Twitter | pedro mg & Hugo