Sunday, August 25, 2013

Reading sitemap.xml from ruby

I've recently published a sitemap_reader ruby library for reading sitemap.xml files.

It is implementing only what I needed at a time - reading a single (and small) sitemap.xml file from disk or over http.

If you need more functionality, usual mantra applies: fork, implement your feature, test and send me a pull request

Thursday, April 25, 2013

Heroku eventually available on AWS EU zone, but why now (and not 4 years ago)?

It took Heroku good 4 years since I first asked them about EU availability, but they eventually complied ;)

But I was wondering why it took them that long to give European customers location closer to home.

My first thought is, that it if they simply created an exact copy of their AWS US-EAST setup in EU availability zone, it should work fine. Then they need to update API and tools to allow users to choose region for some commands, then possibly some intermediate layer to route api requests to apropriate region, but that's it. Their support team is already around the world and available 24/7, so no need to worry about that (at least initially).

Does anybody have a good explanation?

WARNING:

They don't have Safe Harbor signed up yet, and it is not guaranteed that data will sit in EU and not be transferred to US. But apparently they are working on it hard and Safe Harbour is coming soon.

Wednesday, June 27, 2012

Affiliate system in Ruby on Rails

Ruby on Rails shines all around, but especially when you consider community of high quality developers and architects that was build around it.

There is plenty of code and gems written for it, but surprisingly not that many open source products that you could use "out of the box". For example, recently my client needed an affiliate system. My first call was to google it. Plenty of systems in php, but none in RoR. Anyone?

Tuesday, June 19, 2012

Validating non-persistent models in Rails 3

Some times it happens that we need to validate entity that is short lived and not persisted anywhere. It is very easy to do in Rails 3 - just include
include ActiveModel::Validations
in your model and that's it - you can call
object.valid?
now to test it's correctness.

keep your heroku dyno up

I have many apps that use single dyno. The problem with such apps is, that after 1h of inactivity heroku puts them to sleep, and waking up process takes from 5 to 30 seconds depending on your slug size. To avoid your first visitor wait for heroku to spin up your dyno I use uptimerobot.com that pings specified url every 5 minutes.

Monday, April 30, 2012

Installing eLance Tracker on 64bit Ubuntu 12.04 Precise Pangolin

I recently struggled with installing Elance Tracker on my new laptop. Here is what I have done to make it work.

Install i386 libs

sudo apt-get install ia32-libs
Download and install AdobeAir (latest supported version at the time was 2.6)
wget http://airdownload.adobe.com/air/lin/download/latest/AdobeAIRInstaller.bin
chmod +X AdobeAIRInstaller.bin
If it complaints about missing gnome-keyring:
sudo ln -s /usr/lib/i386-linux-gnu/libgnome-keyring.so.0 /usr/lib/libgnome-keyring.so.0
sudo ln -s /usr/lib/i386-linux-gnu/libgnome-keyring.so.0.2.0 /usr/lib/libgnome-keyring.so.0.2.0
Install Tracker
sudo dpkg -i TrackerSetup.deb

Tuesday, November 22, 2011

Customizing blogger html template and cross-site-font hack

Today I set myself a task of moving ordys'es blog to blogger. I knew, that it is not going to be easy and it wasn't.
There are no hints on what is wrong with submitted html - there is just obscure error reference code which does not help identifying an error.
For future reference and for people doing the same thing there are couple of tips:

* Blogger validates if html you pass to it is correct. The layout I was adapting had xhtml strict doctype - html tags that were not closed were causing errors.
* don't remove tag, just it's contents
* if you don't like navbar just set .navbar to display: none in css
* It seems that can't remove any of built in widgets from template (anonymous error again) - remove it in layout editor

Now general advice for people having web fonts in their layout - IE9 and Firefox (and perhaps any future versions of other browsers) rightfully try to protect copyrights of font creators. That is why cross-site-fonts are not allowed unless you add

Access-Control-Allow-Origin



http header to any font file. The other option is to embed base64 encoded font in internal css stylesheet on blogger. I have chosen that second option - the font I intended to use was hosted on heroku and I didn't have easy way to add headers when serving it.
I know, it sounds awful - with every page you download font which in my case adds 50KB to every blog page size. If you want to use this hack you don't need to base64-encode files yourself - I used fontsquirrel's font generator, chosen expert mode and ticked base64 encode.