A quick and dirty module to add json-encoded annotations to your model.
- -Kilometeranzeige 2012
- - - - --
-
- Mai, Tempelhof, 35 km -
- Mai, RTF Havelrunde, 120 km -
- Juni, Sprockhövel - Duisburg, 90 km -
- Juni, Duisburg - Lünen, 110 km -
- Juli, Montalivet, 82 km -
- Juli, Montalivet, 21 km -
- Juli, Montalivet, 93 km -
- Juli, Montalivet, 89 km -
- August, Tempelhof, 42 km -
Summe: 682 km
-Go Your Own Way
- - - - -Good ol’ times. NOFX covers Fleetwood Mac.
+twei55.github.io
+Web Developer, Rubyist, Environmental Scientist, Dad.
++
+
- - - - Welcome to GitHub Pages.Encoding Issue When Migrating From Rails 2.3 to Rails 3.2
- - - - -I thought, I had a basic understanding of how character encoding works. Nonetheless I get frequently confronted with a new issue that drives me crazy. This time it was the different behaviour of Ruby 1.9.2 and 1.8.7, in particular when getting strings with special characters from a MySQL database (we have a few of them in German).
- -I am migrating an application running on Rails 2.3.8 to Rails 3.2.2, using Ruby 1.9.2 instead of 1.8.7 and the improved mysql2 instead of the old mysql gem.
+This automatic page generator is the easiest way to create beautiful pages for all of your projects. Author your page content here using GitHub Flavored Markdown, select a template crafted by a designer, and publish. After your page is generated, you can check out the new gh-pages
branch locally. If you’re using GitHub Desktop, simply sync your repository and you’ll see the new branch.
I have some data in a MySQL database that was - more or less accidentally - encoded in latin-1. I imported this data from my production database into my development database using mysqldump.
++
- Designer TemplatesMy Rails 2.3.8 application displayed special characters from this data correctly within a HTML page, whereby the Rails 3.2.2 application doesn´t.
+We’ve crafted some handsome templates for you to use. Go ahead and click 'Continue to layouts' to browse through them. You can easily go back to edit your page before publishing. After publishing your page, you can revisit the page generator and switch to another theme. Your Page content will be preserved.
-I checked the whole encoding chain, database configuration and application settings, and set all encodings and charsets to UTF-8. Nonetheless the problem remained.
++
- Creating pages manuallyThe solution was to set the flag –default-character-set correctly when exporting the data from the production database with mysqldump (data only):
+If you prefer to not use the automatic generator, push a branch named gh-pages
to your repository to create a page manually. In addition to supporting regular HTML content, GitHub Pages support Jekyll, a simple, blog aware static site generator. Jekyll makes it easy to create site-wide headers and footers without having to copy them across every page. It also offers intelligent blog support and other advanced templating features.
1
- |
|
+
+ Authors and ContributorsYou can @mention a GitHub username to generate a link to their profile. The resulting <a>
element will link to the contributor’s GitHub Profile. For example: In 2007, Chris Wanstrath (@defunkt), PJ Hyett (@pjhyett), and Tom Preston-Werner (@mojombo) founded GitHub.
After importing the data the following way, everything went fine:
++
- Support or Contact1
- |
|
Having trouble with Pages? Check out our documentation or contact support and we’ll help you sort it out.
+ + -Nevertheless I have not yet discovered why the behaviour of Rails 3.2.2 / Ruby 1.9.2 is different from Rails 2.3.8 / Ruby 1.8.7 in this case.
-Radiant CMS & Friendly_id
- - - - -I use Radiant CMS for some applications, still running on Rails 2.3.x and wanted to make use of friendly_id in one of my models within a Radiant extension. So I added the following lines to my Gemfile:
- -1 -2 - |
|
Next step is to run the friendly_id generator, which returned an error:
- -1 -2 - |
|
My solution to this problem was to copy the folder GEM_PATH/friendly_id/generators/friendly_id to RAILS_ROOT/lb/generators.
- -Afterwards I added a line to script/generate:
- -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 - |
|
UPDATE: -The easiest way to get around this issue is to copy create_slugs.rb to your migration and friendly_id to your lib/tasks folder.
-Ruby Singleton Logger
- - - - -I have been working on a module lately that parses a XML file structure into a hash and writes it to a database. The module includes some classes and methods and I needed a central logger class.
- -I created a class that inherits from Ruby´s Logger class.
- -1 -2 - |
|
I decided to make this class a Singleton. Singleton is a design pattern that restricts instantiation of a class to only one instance that is globally available. This can e.g. be done by simply including the Singleton Module.
- -1 -2 -3 - |
|
I wanted this class to be able to either log to STDOUT or a file. The standard way to do this, is to pass the log device to the Logger class during instantiation. The problem is that the singleton module creates the singleton instance before it is actually needed, called eager instantiation. In order to tell the singleton instance to which log device it should log to, we need to set a member variable in the initialize method. Secondly we need a method to reassign the log device.
- -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 - |
|
I could now use the logger methods from everywhere in my code, e.g.:
- -1
- |
|
In order to make things a little bit shorter, I added an additional method to the module:
- -1 -2 -3 - |
|
Logging can now been done from everywhere by calling:
- -1
- |
|
How to Get Rid of Bundle Exec
- - - - -1
- |
|
Kilometeranzeige 2011
- - - - --
-
- Mai, Werder-Fohrde, 50km -
- Mai, Flughafen Tempelhof, 35km -
- Juli, Tour de Gironde I, 80 km -
- Juli, Montalivet - Carcans Plage - Montalivet, 75 km -
- Juli, Tour de Gironde II, 85 km -
- Juli, Tour de Gironde III, 90 km -
- August, Flughafen Tempelhof, 45km -
- September, BRC Semper Oderbruch, 123km -
Summe: 583 km
-How to Ssh Into Your Pogoplug
- - - - -I recently had to fix something on my pogoplug attached harddrive. When attaching it to my Mac the hdd was read-only, so I decided to attach it to the pogoplug again and try it using ssh.
- -To enable SSH, login to http://my.pogoplug.com, navigate to the Settings page, select Security Settings, and from the main pane, enable SSH for your Pogoplug. Choose your own SSH password.
- -Open up a terminal and login:
- -1
- |
|
Go to hdd (in my case):<
- -1
- |
|
Have fun!
-La Femme D´argent
- - - - -Nice trip back with Air´s “La Femme D´Argent” from the “Moon Safari” album (1998).Live! All time classic!
- - - -