Converting Audio Files to MP3 in Nautilus

If you’re like me, you didn’t always make good decision growing up when choosing what tools you used to rip music onto you computer. I have a lot of music, much of which is a smattering of mp3, ogg, flac, wav, m4a, wma, etc. formats. Unfortunately, the stereo in my car only understands a small subset of these, so I needed an easy way to convert to mp3. It actually is pretty simple, but took some research, so here’s the steps I took using Ubuntu 12.04:

1) Install the script you need (note, all these commands should be typed into a terminal — to open this, open the launcher and type terminal, then open it):

sudo apt-get install nautilus-script-audio-convert

2) Activate it in Nautilus:

nautilus-scripts-manager enable ConvertAudioFile

Doing this will open a window, click the checkbox then close the window.

 

3) Install some extra codecs (including lame which is mp3)

sudo apt-get install lame vorbis-tools flac faac faad mplayer

That’s it, restart nautilus, then right click on an audio file (or files) and select the script:

Script Runner

 

Following this, you’ll be prompted to answer some questions, they’re pretty simple. For the second one, I selected the following:

Select items from the list_012

After that, wait for it to finish, then you can keep or remove the files you don’t want and move on with you life. Enjoy!

 

Setting up a Development Environment for Shopify Themes

I recently started looking into designing a custom theme for a Tekbell, an shop with kettlebells for sale online, running on Shopify. Turns out getting started is a bit more complicated than it should be.

Getting started, I figured my options (in order of best to worst) were thus:

  1. Find some way of setting up a local test environment to develop my theme then upload to the shop.
  2. Find some way of easily pushing updates to an online theme so I can test as I go.
  3. Use the online editor in the Shopify store admin.
  4. Code it all locally then push and pray.

Near as I can tell, there’s no longer any way to run a Shopify dev environment locally. I found docs mentioning a program called Vision, but all links for that led to dead ends and mentions of it being outdated. Giving up on that, the next best option was finding some way of pushing the changes to the server. I found two ways of doing this:

  1. The Shopify Textmate Bundle
  2. The shopify_theme command line tools

I code in vi, so buying Textmate to accomplish what should have been a pretty simple task was somewhat distasteful to me. Textmate does offer a free 30 day trial though, so I got it to test the bundle.

I ran into an issue with both tools almost immediately. It doesn’t seem possible (or documented anyways) to edit a theme that’s not installed as your store’s default theme. Well, I can’t find my cowboy coder hat, so I this seems like a terrible idea. For shopify_theme, there’s actually an outstanding pull request on Github to address this issue by specifying what theme to work on in the config, but it’s been waiting for 2 months so I’m not going to hold my breath.

So there goes those options…

Wait, let’s not give up so easily! Doing some further research in tangentially related topics, I came across mentions of a way to create a test store. That would allow me to edit an in-use theme without actually being in a production environment, therefore solving my dilemma.

To set up a test account, create an account on the partner signup page, then do this:

This creates a dummy shop with some dummy data. From here you can use the Textmate bundle or shopify_theme docs to set up them up to push the theme to this shop. This post will continue with the shopify_theme tools.

Now that you have your shop set up, things are pretty simple:

  1. gem install shopify_theme
  2. Go to https://[your store].myshopify.com/admin/api and create a new app.
  3. Create a directory on you machine where you want to keep all the theme files
  4. cd into that directory
  5. theme configure api_key password store_url
  6. theme download
  7. From here you can edit your files and push them back to the server with theme upload assets/layout.liquid or theme replace
  8. Check the docs for additional commands or just type theme help.

Enjoy and good luck with your theme!

Online Tools for Learning Spanish

This is more a list for my own reference, but it might be useful to others, feel free to make suggestions as well and I’ll update it.

Flashcard Program:

I use Anki. It’s available on Linux/Mac/FreeBSD/Windows/Android/iPhone/maemo, so there’s no excuses here. Also if you set up an account you can sync between different machines or phones.

You can also download pre-made decks from within Anki. I recommend “T’s Spanish Deck”. It seems the most intelligently constructed to me.

Translations:

http://translate.google.com/

Verb Conjugation Charts:

http://www.learnalanguage.com/learn-spanish/spanish-verbs/

Verb Conjugation Practice:

http://www.elmaeagles.com/spanish.htm

Argentine Spanish (Castellano) Slang Dictionary:

http://argentineslang.wordpress.com/

Someone should make an Anki deck for this and make it public…

Good Spanish Dictionary:

http://rae.es/rae.html – If you input a word then click the “Conjugar” button on the translation page, you can see a chart for the verb conjugations. This site is also great once you know some spanish for getting a better idea or the connotations and nuances of words as well as just get translations in Spanish.

A Swift Kick in the Joulies

Edit: As noted in the comments, I’m testing these under a situation which is not the recommended method from the Joulies company. I am, however, testing them in the real-world situation in which I would most likely use the Joulies. I wanted to add this disclaimer to be fair to the guys struggling to turn this into a company. I stand by my results, but leave you to make the decision about how well the Joulies would meet your needs for the product.

Abstract: I recently received my set of Coffee Joulies (http://www.joulies.com/) after putting some money into their Kickstarter project. Excited to review and test them out, I came up with a simple experiment. I tested the Joulies vs. an empty control mug with just hot water vs. a mug with rocks of roughly equivalent size to the Joulies. Both the Joulies and the rocks dropped roughly 30 degrees in temperature immediately and then lost steadily at the same rate. The cup with just water didn’t see the immediate drop, but lost temperature steadily. I saw no significant or noticeable difference between the rocks and the Joulies. Given that the Joulies cost $50 and the rocks cost me walking out into the front yard, I’m skeptical about the value of the Joulies.

Method:

After finding  3 mugs of identical size and shape, I went out in the yard to find a handful of rocks which closely matched the volume of the Joulies. Following this, I set all 3 mugs up on the same wooden coffee table surface. I left the mugs, rocks, and Joulies overnight to allow them to equalize to room temperature.

The following day I boiled enough water to fill all three mugs in an electric tea pot. Once finished, I began the testing. Filling the first of the three mugs (the empty one). I started my stopwatch. I measured the temperature immediately using a digital meat thermometer. My method for obtaining temperatures was thus: place the thermometer in the water in the corner opposite the handle (all mugs were oriented the same way), then watch the temperature until it flattened out and began dropping. I measured the temperature as the maximum before the drop. Typically it only wavered by a degree or so.

Thirty seconds later I poured the next mug (with the rocks) and repeated the measurement for it, I then did the same with the 3rd mug (with the Joulies). By doing it thus, I was able to measure all of the mugs at the same elapsed times. I then continued this process at intervals until reaching 1 hour.

Results:

As usual, a graph is worth a thousand words. I’ve broken them up into two different graphs to prevent distortion from having changed from measurements every 2 minutes to every 4 minutes at the 20 minutes mark.

Minutes 0-20
Results from Minutes 0-20

Minutes 20-60

No that we can see the behavior of the 3 mugs and their contents, let’s examine some claims from the Joulie website.
1) “Their polished stainless steel shells are full of a very special phase change material (an ingredient in food) that melts at 140°F. When you put them in your coffee this PCM begins melting, absorbing a LOT of heat in the process and cooling your coffee down much faster than normal.”
I can’t argue with this, they did indeed rapidly cool the hot water down. However, the rocks and the Joulies had roughly the same effect in this regard.
2) “When your coffee reaches 140°F (the perfect drinking temperature) the molten PCM [Phase Change Material] begins solidifying again, releasing all that energy back into your coffee to keep it at a comfortable and delicious drinking temperature. The more heat you feed your Joulies, the longer they’ll keep your coffee warm.”
The Joulies behaved almost identically to the rocks and as such do not seem to have had any sort of magical technology. In fact, after the initial drop, the rocks maintained a higher temperature for a longer period of time. Also worth noting, the slope of the rocks and Joulie lines were very similar, showing a large initial drop and then a steady decline.

Obviously, this is a fairly limited experiment and it would be helpful to perform with various other size containers and materials. However, I do think that it is enough to show that the Joulies are not some sort of magical material. While there may indeed be some sort of special materials inside, the effects they had were not enough to be noticeable in a real life situation, and therefore do not justify the cost of the Joulies over simply buying a more massive mug.

Edit: A friend just sent me this similar post on testing and reviewing of Joulies by Marco Arment

Edit 1/15/12: Here’s another interesting article on the subject.

Creating a Celery Periodic Task on Gondor

I’ve recently been using Gondor as a hosting platform for a business I’m starting. I needed to set up a task to update my search indexes every 30 minutes, so I thought of Celery. Asking in #gondor on freenode, I discovered that the Gondor guys had recently gotten whatever backend was needed to make Celery periodic tasks available on Gondor. They haven’t yet gotten around to documenting it fully, but it turned out to be relatively simple.

Setting up Gondor for Celery:

The Gondor docs have a great page on this. Follow the directions and you should be good. I configured my instance using Redis, so I can’t speak to using Kombu.

One note on using the settings from their docs: you’ll probably want to configure your local settings as well. I set up an if statement to detect if I was running locally or on Gondor than specified which settings to load for Redis, etc. Using platform.node is the best way I’ve found to do this (needs some modification if you’re working with more than one dev):

import platform
if platform.node().startswith('your-hostname'):
    #load your settings
else:
    #load Gondor settings

Setting up Celery for Gondor:

For the purposes of this post, I’m going to assume that you already know how to use Celery. If not, it’s not too complicated, check out the docs here. If you have Celery up and executing normal tasks locally, you’re nearly there already. Running a task periodically just requires that you register that task to run periodically. This page here documents the steps. Locally I was able to tasks running both by specifying when they should run in the settings as well as using the database scheduler, but on Gondor I had to use the database scheduler to get it working (could be error my part, I’m not sure). Look here for directions on setting up the DB scheduler. Basically, all I had to do to get this working was add this to my settings.py file:

CELERYBEAT_SCHEDULER = ‘djcelery.schedulers.DatabaseScheduler’

From this point, go into the Django admin (don’t forget to deploy first). You’ll see this section:

Depending on what you want to do here, you may have different steps, but to get a basic task running, add an Interval (pretty self explanatory) then click on “Periodic tasks.” Then click to add a periodic task, and you should see this:

If you’ve set your task up to register properly, you’ll see it listed in the Task (registered) dropdown. If it’s not there, it’s probably something to do with relative paths (read this). Once you’ve selected the task you want, named it, and set an interval, things should just start working. Gondor handles running the Celery workers and Celerybeat on their end.

Good luck and stay safe out there!