A few months ago I decided to get a Raspberry Pi and make a media center out of it using XBMC. I had heard great things about this kind of setup and after many hours trying to get everything up and running I must say it really is amazing. I'm using Xbian 1.0 Beta 1 on a 512mb RPI (together with Sickbeard and Transmission for true automation). I will write another post with more details about the setup and some tips to get it running smoothly but for now I just want to present a solution for a problem I recently had with Xbian.
The problem was that Xbian was refusing to play some episodes of a certain TV series. It would show the spinning "loading" icon for a little while but then a few seconds later nothing happened. I enabled debugging (System/Settings/System/Debugging > Enable debug logging) and checked the xbian log (under ~/.xbmc/temp/xbmc.log). There's a lot of information there so it's not easy to see what really matters. You can try the following to make it easier though: in your terminal, tail the log (tail -f xbmc.log). Then prepare to hit play on the problematic file but just before doing it press enter a few times in your terminal to create a bunch of empty lines. Right after doing that hit play. This will serve as a kind of marker so you know where to start looking. When the loading icon disappears (and the video doesn't play) do the same thing so that you have another marker. After that you can just scroll back and copy paste the relevant part of the log if you want.
In the log, the most interesting parts will be those that have ERROR since they'll normally indicate that something went wrong (even though not necessarily related to this problem). In my case I saw some error lines that looked suspicious:
20:42:34 T:3042451456 ERROR: COMXCoreComponent::AllocOutputBuffers component(OMX.broadcom.resize) - OMX_UseBuffer failed with omx_err(0x80001000)
20:42:34 T:3042451456 ERROR: COMXImage::HandlePortSettingChange m_omx_resize.AllocOutputBuffers result(0x80001000)
20:42:34 T:3042451456 ERROR: COMXImage::Decode HandlePortSettingChange() failed
20:42:34 T:3042451456 ERROR: COMXCoreComponent::SetStateForComponent - OMX.broadcom.resize failed with omx_err(0x80001000)
20:42:34 T:2574251072 ERROR: COMXCoreComponent::AllocInputBuffers component(OMX.broadcom.audio_decode) - OMX_UseBuffer failed with omx_err(0x80001000)
20:42:34 T:2574251072 ERROR: COMXAudio::Initialize - Error alloc buffers 0x80001000
20:42:34 T:2574251072 ERROR: OMXPlayerAudio : Error open audio output
To be honest I have no clue about what those messages actually mean. So I tried my luck in the #xbian IRC channel on freenode.net and a very nice guy pointed out that this was probably a memory issue and suggested I changed the gpu_mem setting in the config.txt (which can be found under /boot/config.txt). I checked and I had 2 lines for this setting:
This setting specifies the amount of memory that can be used by the gpu. I guess there are two because this is a generic file and the right one will be used depending on which RPI version you have. Both were set to 128 so I changed gpu_mem_512=128 to gpu_mem_512=256 and rebooted the pi. When it came back I tried playing the files again and voilá, pure joy, it just worked.
I hope this can help out someone with a similar issue. Post your findings in the comment section.
A small annoyance of Sublime Text 2 for me was the fact that it always opened files in new windows instead of reusing the existing ones (OS X only). It turns out it's quite easy to change this behavior. Here's how:
Sublime Text 2 menu > Preferences > Settings - Default
Now search for the following: open_files_in_new_window
The line will look like this:
// OS X only: When files are opened from finder, or by dragging onto the
// dock icon, this controls if a new window is created or not.
Just change "false" to "true" and you're done!
Now whenever you open a file it will reuse any existing window you already have.
Lately I have been dealing with high server load problems, both at work and on my own server so I've been reading about it and trying to understand what it means and how to debug such issues. I don't mean to lecture you on the subject on this post but I will point you to a great article that explains it in a very simple way: Understanding Linux CPU Load - when should you be worried?
After reading that you'll know a lot more about what load means and the its different types. So how do you know if your server has a sudden spike of traffic causing high load for example? You surely can't be logged in all day typing 'uptime'. You could, however, have some sort of monitoring tool that will alert you automatically. If you're dealing with a high traffic production server you most certainly have a "real" monitoring tool such as Nagios or Zabbix. If you're like me and host a small website on a small VPS then some of those solutions might be overkill.
Continue reading →
I recently had the need to configure a samba share on a linux box running Scientific Linux and I ran into a very annoying problem. I'm not going to explain all the details about how to configure the samba server and configure it (there are quite a few tutorials around for that, and I actually used Webmin which makes it very easy).
So after configuring everything, setting permissions and creating a user with simple password authentication, I was able mount the share on my mac but no contents were shown, not a single file.
Continue reading →
I'm always looking for the best tools to make my life easier. In this constant search for the best text editor for coding and general text work (xml mainly) I decided to try the amazing Sublime Text 2.
I was using TextWrangler for a while and had finally manage to get XML pretty formatting to work on it again but I was struggling to get the same experience out of Sublime Text 2. My ideal workflow is to paste some unformatted XML, press some hotkey combination and end up something pretty. Because there's always someone with with the same problem, a quick google search took me to this page where there are a couple of scripts to do just this. Read that first to get a grip on how to implement these simple scripts.
While this seemed to work pretty well I was still having some trouble with some files that weren't being formatted exactly as I expected. These scripts use the open source tidy command, which is pretty cool. However, for some reason, my XMLs (which included some CDATA elements) were not being formatted properly. So I decided to use xmllint instead, just like the TextWrangler script.
Continue reading →
TextWrangler has recently released a major update - version 4.0. A lot has changed, check out the release notes here.
One of the things that changed is the way it handles scripts and text filters. If you don't want to read through the whole thing, here's the main part:
There are two fundamental types of runnable file: "text filters", which accept the selection range (or entire document, if no selection) as input, and which return text that replaces the selection range (or document); and "scripts", which do neither. In unix-y terms, text filters accept the selection range on
STDOUT replaces the selection range.
It just happens that I use XML Tidy a lot to format xml documents in a pretty way. To do that I had a nice little script (which is just a xmllint command really) for which I assigned a shortcut (alt+cmd+p). That made my workflow pretty fast. The problem is that this script stopped working as before so it took a while to find out why but I found a thread in google groups about this issue and someone from Barebones helped find the solution. So in summary, here's what you have to do to make XML Tidy work again in TextWrangler 4.0:
Continue reading →
I recently encountered a problem when logging through SSH in to certain servers that I use for work when using my new Macbook Pro (running Lion 10.7.3).
So right after the login was completed I was getting the following message:
warning: setlocale: LC_CTYPE: cannot change locale (UTF-8)
It only happened on certain servers, for others everything would work just fine.
This caused a few problems when running some perl scripts that would complain about the locale variables not being set, even though my Terminal app was setup correctly.
To fix this I simply added the following to my ~/.bash_profile:
Let me know if that helped you by leaving a comment below!