house9

random code and what not

GIMP install on MAC

Don’t bother installing GIMP using MacPorts; I started this process and it ran for over an hour before I stopped the install. It has alot of dependencies and MacPorts was busy installing all of them.

Just go to http://gimp.lisanet.de/Website/Download.html and download the package for your OS version

around 75mb download but installed in minutes :)

sorting rails view with will_paginate plugin

This solution for sorting data on rails index actions does NOT use ajax. Sometimes sorting with ajax is nice but often it is not actually as user friendly; breaking the browser back button, etc…

Disclaimer 1: this code is probably using all kinds of ruby anti-patterns :) - but it is a very simple implementation and so I just went with it…

Disclaimer 2: the title of the post might be a little miss leading as you can use this with or without the will_paginate plugin. In my case I am using it with the will_paginate plugin - and I highly recommend it!

put this file in your rails lib directory /lib/sort_index.rb

in your controller code, set up the SortIndex::Config (you can have more than one if you have multiple actions that need to support sorting

then in your view code render your table headers using the sort object

Does not support the following:
  • additional attributes on the anchor tags
  • additional attributes on the table header tags
  • additional query string parameters - might add this later, would be nice for search results

Digg style css for will_paginate plugin

Just started using the will_paginate plugin for my rails application. I wanted a Flickr or Digg style applied to the paging controls, did not find anything that came ‘out 0f the box’. After a few google searches I came across this link which had an example - apparently from an older version of the README file.

here is that css for reference

.

cut back on the blog reading

I had 200+ subscriptions in my rss reader - way too many
I just cut it back to a short list. No doubt the list will start to grow again…




rails send_data fails on IE when SSL enabled

Came across a nasty issue using rails send_data with IE. Everything worked fine until the pages were running under SSL / HTTPS. Turns out the issue is with file download over SSL when the Cache-Control and Pragma html headers are set to no-cache.

The error message from IE
Internet Explorer was unable to open this site. The requested site is either unavailable or cannot be found. Please try again later.
The fix…
# before calling send_data
response.headers.delete(“Pragma”)
response.headers.delete(‘Cache-Control’)
This issue is not restricted to rails, any server side code that sets no-cache is subject to the same issue. Glad I was able to find this post.

see also kb-316431

Comments

Puneet Pandey
Thanks Rafael, your post was really helpful, as we are giving IE-8 support to our Client's customers.

- Puneet
Rafael Revi
Thanks for posting this!!!!

This is issue is gone in IE9. I replicated issue in IE7 and IE8.

Thanks again

Google Webmaster Tools Sitemap.xml issues

After uploading my sitemap.xml file to Google Webmaster Tools I received the following error message and no additional error details were included:

Error: The last attempt at downloading the Sitemap failed. The details below are representative of the last successful download.

I searched around a bit and found a forum post where someone said they get this error ’sometimes’, but after switching to use a gzip formatted sitemap.xml file the error went away

on ubuntu

gzip ./sitemap.xml

compresses the file to ./sitemap.xml.gz and deletes the sitemap.xml file by default

after uploading Google was able to process without issue

Comments

House 9
Compared to having relevant content and good structure (i.e. h1, h2, proper use of title tag, etc…) it probably is not that important.

But it can't hurt to include one and submit it to Google, Yahoo, Bing and Ask; it definitely won't hurt your page ranking.
robert
But is sitemap.xml that important?
I do not think so.. Moreover this blog mentioned below will lay more light to what I want to say..
http://www.redalkemi.com/blog/sitemapxml-the-most-overrated-search-engine-indexing-factor/