Alexander Murmann's blog
Interesting - Local Search API deprecation confusion
Google deprecated their Local Search API and suggest to use the Maps API GoogleBar instead. However, as it turns out, the API GoogleBar is just a wrapper around the Local Search API, that was just deprecated. You could use the Google Places API instead, but that one is currently in developer preview only. What are we supposed to do Google? Googling it did not reveal any fully satisfying answer...
Interesting - Attaching JQuery UI Datepicker
When attaching JQuery UI's datepicker you should not use the class hasDatepicker since JQuery UI uses this class to mark DOM objects that already have a datepicker attached. So it won't attach a datepicker to elements with that class.
Interesting - Solr score sort
It is possible to sort results in Solr using any criteria you want and use the Solr score for a secondary sort. Some people thought that you were only able to use the Solr score as your primary sorting criteria.
Help - Request for PNG not working in IE7
We request a PNG via IE7 from inside Parallels, but the file doesn't get returned. The Nginx log just shows an empty line for the request. Suggestion: Look also in Nginx's error.log for the failing request. The request might be logged here and help find out what actually went wrong.
Interesting - Google Maps suggest canoeing and jet ski routes if your destination is across the ocean.
Interesting - Making ".*" in regular expressions less greedy
Sometimes .* in regular expressions matches more than we would like it too. Let's say you have a string that includes some numbers you want to extract from a string. Our string might look like this:
some text 123 more text
now we might try to use the following regular expression to get the 123.
.*([\d]+)
However, this will only get us the 3. This happens because .* will match as match as possible. Adding a ? will change this to only match what is needed.
.*?([\d]+)
Now we get the 123 as desired.
A nice toll to experiment with regular expressions is rubular.com. Rubular allows you to see the effects of your regex in combination with an example string instantly.
Help - Running my own gem server
Sarah will give a Ruby introduction class for kids at RubyConf. However, there won't be any Internet connection available, but the participants will need to install several gems.
A solution to this problem is the gem geminabox which allows you to run a server providing gems. Other users who have geminabox installed then are able to install gems from that server.
Interestings
Webtoolkit Base64 encoding is wrong
If you need to do Base64 encoding/decoding in JavaScript, you likely came across this link (as it's the #1 Google hit for: "base64 enocde javascript"):
http://www.webtoolkit.info/javascript-base64.html
This code (for encode) works just fine as long as you're only dealing with strings whose contents are plain ASCII test (no high bits set).
But this code does a UTF encode before the Base64 encode. Which means that any characters with the high-bit set will get expanded first and your Base64 encoding will be wrong. For example, if you build a SHA1 encoded string and then Base64 encode it, you'll get a resultant string that's longer than the expected 28 bytes.
Our solution was to keep Googling around until we found some JavaScript Base64 code that did not do any Unicode expansion. Here's one that does the right thing - there are more, but are hard to find:
http://nerds-central.blogspot.com/2007/01/fast-scalable-javascript-and-vbscript.html
Factory Girl after_create
You might want to use factory_girl to create an object that includes another object. If both factory methods make use of the after_create callback the child's after_create will be called before the parent's. This behavior might seem unintuitive and you should keep this in mind working with factory_girl.
Ruby Mine running focused tests from inside context
It turns out that having shoulda anywhere in your project will break running focused tests from inside a context. This will also break ii you use a plugin that comes with shoulda.
Ruby Mine commit & push
Ruby Mine's behavior when using commit together with the push option might not behave as expected. For us it merged a branch and truncated all changes that had occurred on that branch since the last update.
WebKit JS treats "export" as keyword
One of the many unused keywords in JavaScript is "export". Firefox lets you use it since it's de facto unused. However, using "export" in your JavaScript will break your code in WebKit-based browseres.
Interesting -- Tagging and Excluding of Filters in Solr Facets
You may want to use multi-select faceting to constrain the results shown for one facet but still want to see the values and counts of other facets that are not matched by your constraint. To solve this you often had to use two queries. Since Solr 1.4 you can tag and exclude filters and save the additional query.
Help -- Adding Memcached to Models
"I want to use memcached for my ActiveRecord models and am looking for recommendations on how to do this"
Of the available gems the memcached gem can be recommended. The memcached gem wraps the libmemcached client which is written in pure C. This implementation gives it a performance advantage over the memcached_client gem.
Interesting -- Backtrace in RSpec
Since version 1.2.9 RSpec per default does not print the full backtrace. Calling spec with the -b --backtrace option will print the full trace.
Interestings
gmail_smtp plugin not needed with Ruby 1.8.7
If you uses Ruby 1.8.7 or higher you can natively connect to Gmail and do not need to install a plugin as you used to with older Ruby versions .
selenium/webrat/snowleopard
Selenium uses webrat as default which causes problems under Snowleopard. Getting the latest version of Selenium and replacing the gem's JAR-file with it will solve this problem.
Ask for Help
Reloading libs in development
"How to setup Rails to reload libraries under development?"
The initializer block in environment.rb contains the line
<code>config.load_paths += %W( #{RAILS_ROOT}/extras )</code>
which is commented out by default. Here the lib folder can be added in order to have it reloaded.
Selenium with with Firefox 3.6
"How to get Firefox 3.6 to work with Selenium?"
Your need to install he latest gem for Selenium RC from gem cutter. You then need to get the latest version of Selenium and replace the gem's JAR file with the latest one you just downloaded.
Using relative picture size to crop from original image.
"I am using Paperclip and need the size of the original picture"
Paperclip::Geometry offers methods to get the image's dimensions. However, if you want to access those for a new file, the earliest you can access these is with the after_save hook. Thus you might have to save the file twice.
