You’re on Mac OS X (somewhere around 10.7.5) and you’re using the sed command to replace characters from the latin1 or Windows-1252 character encoding with their utf8 equivalents. Unfortunately you get an error like the following:
sed: 1: "s/#/’/g ": RE error: illegal byte sequence
Luckily you’re not alone!
This happened to me while working on HamDecks, a small project that creates Mnemosyne decks to help you study for the Amateur Radio Operator exams using questions from the official ARRL Question pools. The source question pool files (Technician, General, Extra) though have some problems… There’s a lot of characters with strange/exotic encoding in the ARRL pool files that could not be imported into Mnemosyne. That’s how I got myself into this whole mess in the first place.
The stackoverflow link above makes two suggestions:
Your Mileage May Vary, but neither of those suggestions worked for me. So what did work then?
Once again, we will visit our system locale settings.
Here’s what worked for the HamDecks project:
Instead of just prefixing the sed command with LANG=C, we prefix it with LANG=C LANG_ALL=C. I’m not saying this is a silver bullet, just that it worked for me and might work for you too.
I created a munin plugin to chart the number of gears present/idle on OpenShift application node instances. The plugin was written for/tested against OpenShift Enterprise 1.2.
These charts show the number of gears present/idle on a single OpenShift application node instance. Nothing special required to set this plugin up. Just copy the script/configuration to your node and then restart the munin-node service.
This is a combined/multigraph chart showing the number of gears present on all nodes representing my “small” district. This chart is created using the munin concept of ‘loaning’ data.
Interested in trying it out yourself? The code is up on github: tbielawa/openshift-munin-plugins.
Along with the actual plugin you can find example munin server configs for creating the multigraph chart of gears across all nodes in a district.
This is an update to a previous blog post where I described how I was able to use custom fonts in my docbook -> dblatex -> pdf toolchain by switching to the XeTeX backend.
I closed that blog post with a few caveats:
I’m pleased to say that I’ve recently revisited my publishing toolchain and two of those three caveats are no longer an issue.
Through a series of unexpected clicks on the dblatex releases page I found myself looking at links to download newer versions of dblatex than I was presently using. Though the updates are not scheduled for inclusion in Fedora 17, they are (going to be) available in Fedora 18 and Fedora 19. I quickly skimmed over the changelogs and found some interesting bug fixes. Such as:
Because I’m targeting smaller book dimensions for the Virtual Disk Guide I was most interested in the first fix mentioned: the removal of hard-coded paper sizes. Unfortunately, the documentation on the official dblatex site has not been updated in quite some time. It seems that they’re still displaying an early 0.3.x release of the docs.
Wouldn’t you know it… Some kind souls out there on the Internets have actually built and host the most recent version of the dblatex documentation online! Now I’m able to get a smaller page format which is suitable for the dimension options on lulu.com without having to directly hack any of the dblatex styles. All it takes now is: <xsl:param name=”paper.type”>a5paper</xsl:param> Header and footer content receive appropriate margins automatically, too. No more fussing around!
You’re using Ruby on Rails and the Twitter Bootstrap framework. You are using the link_to ActionView helper method. The generated anchor will be visually represented in a navbar as a Bootstrap button component (via the ‘btn‘ and ‘btn-small‘ class attributes). Finally, you want to use one of those sweet Boostrap icons instead of text. It should look something like this:
I had difficulty understanding the correct way to call the link_to method to get the results I desired. Part of my failure to grok is because I’m a complete newbie to RoR, and the other part of it is because the link_to method has 4 distinct signatures that you can call it by.
After some searching around I found a couple of resources on Stack Overflow which looked promising:
However, none of those results were quite exactly what I was looking for. They did provide some useful insight into solving the problem though.
Here’s the code:
If my understanding is correct, then this approach implements the third link_to method signature: link_to(options = {}, html_options = {}) do
The options parameter we give here is a hash which is passed to the url_for method, and finally to the Route Module. It ends up returning a URL string in the form of http://yoursite/pages/new
The html_options parameter describes the attributes (other than href) which we desire present in the generated anchor. In this example we are describing an anchor with two classes: btn and btn-small. You could add additional symbols to the hash just as easily: {:class => ‘btn btn-small’, :id => ‘new-page-button’, :title => ‘Create A New Page’}
Finally, the way we’re calling link_to requires that we pass it a block to use as the generated link body (or in our case, icon). So we escape from the ERB sequence for a moment, enter the HTML which Boostrap turns into an icon, and then close the block.
Gave the Open Source Scholarship talk today with @akbutcher. It was a smash hit. We were lucky to get a lot of great promotion around the internet for this event:
I also want to give Michael Dehaan a huge thank you for his cameo today. The students loved it!
The presentation is available online: Open Source: A Guide. I was referring to it as our self documenting presentation, in that virtually everything Andrew and I touched on during the talk was linked from within the preso slides.
Thanks to all the students who came out (especially the folks who asked questions). We’re doing this for you!