Category: Programming

HTML5 Validator

http://html5.validator.nu/

A Web Developer’s Responsibility

How to file a good browser bug report: http://ejohn.org/blog/a-web-developers-responsibility/

10 Technical Papers Every Programmer Should Read (At Least Twice)

http://blog.fogus.me/2011/09/08/10-technical-papers-every-programmer-should-read-at-least-twice/

Netbeans 6.9.x / RVM – invalid multibyte escape: /[\x80-\xFF]/ (SyntaxError)

Problem

You have a Rails project in Netbeans 6.9.x and got a following error while trying to start WEBBrick:

1
aws/s3/extensions.rb:84: invalid multibyte escape: /[\x80-\xFF]/ (SyntaxError)

Solution

Add the following line to your /usr/local/netbeans-6.9.1/etc/netbeans.conf:

1
-J-Druby.no.kcode=true

Original bug report: http://netbeans.org/bugzilla/show_bug.cgi?id=158794

HOWTO Escape a Unicode string with Ruby

From: http://stackoverflow.com/questions/5560914/how-do-i-escape-a-unicode-string-with-ruby

Ruby 1.8.x:

1
2
3
4
5
6
7
8
9
>> multi_byte_str = "hello\330\271!"
=> "hello\330\271!"

>> multi_byte_str.inspect
=> "\"hello\\330\\271!\""

>> puts multi_byte_str.inspect
"hello\330\271!"
=> nil

Ruby 1.9

1
2
>> multi_byte_str.bytes.to_a.map(&:chr).join.inspect
=> "\"hello\\xD8\\xB9!\""

Ruby 1.8 and 1.9 – Unicode code points

1
2
>> multi_byte_str.unpack('U*').map{ |i| "\\u" + i.to_s(16).rjust(4, '0') }.join
=> "\\u0068\\u0065\\u006c\\u006c\\u006f\\u0639\\u0021"

WordPress Themes