I have already lost my colors when moving to Lion on my Terminal.app, the same happened when I moved to Mountain Lion, but oh surprise, the fix I found out for Lion didn’t work for Mountain Lion, because in Mountain Lion there is no xterm-color available as a choice of terminal type. The solution I found was to manually edit the configuration options of Terminal.app and so far it seems to work.

You will need (most probably) XCode installed in order to edit the config file which is a plist. You can find the config file in ~/Library/Preferences/com.apple.Terminal.plist. Since the ~/Library folder has been hidden since Lion, your best bet is to open up terminal and type:

open ~/Library/Preferences

which will open the Preferences folder in Finder and you can just find the config file and open it.

Before doing any edits you should quit Terminal, as it saves its settings on exit and it will override any changes you do.

To add the xterm-color option you’ll have to go to Root > Window Settings locate the name of your default theme (in my case that’s Pro) expand it and find the TerminalType key. Now just change the key to xterm-color, save the file and launch Terminal.

As I’ve always strived to automate my home, as much as I can. Although I can’t still turn the lights on and off, I’m capable of controlling my TV, my set-top-box and my multimedia PC with my iPhone. And the problem with the lights is not so much of “impossible” but rather I don’t feel like tearing down my laws to run cables. I actually managed to write an app for a friend to turn his garden lights on and off with his iPhone.

For that purpose, having my TV remote is essential! Unfortunately, after I upgraded my iPhone 3Gs to 4s, the Samsung Remote app started crashing on each launch. Here’s how I managed to get it working:

  1. Turn off Wi-Fi and cellular data
  2. Start Samsung TV
  3. Go into Demo Play
  4. Turn back on your Wi-Fi
  5. Hit refresh
  6. Select a TV from the list
This seemed to work for me, even after I restarted the App.


Since WordPress updated their iOS app to include location for posts, it came to my attention that it is fairly easy to add location to your posts – and it works nicely with the “Quick Photo” feature of the iOS WordPress app.

Unfortunately after I installed the WordPress GeoLocation plugin OnSwipe’s iPad theme stopped working for me. After some digging it turned out it is because Geolocation is overwriting the default alias of $ of jQuery which was breaking OnSwipe.

Here is how to fix that:

  1. Go to your admin panel
  2. Go to Plugins -> Editor
  3. In the drop-down Select plugin to edit choose “Geolocation”
  4. From the file list Plugin Files (just underneath the drop-down) select geolocation/geolocation.php
  5. Find in the code the function add_google_maps (use your browser’s search function and look for “function add_google_maps”)
  6. Find the line that reads: var $j = jQuery.noConflict(); either comment it out by prepending two slashes in front of it or delete it
  7. In its place add the following: $j = jQuery;
  8. Click Update File

This should fix OnSwipe and at the same time allow your visitor to view the location tag of your posts!

Ubuntu 11.10 is out! So the package manager prompted me to upgrade from Ubuntu 11.04 and so I did. The upgrade process took several hours, but mainly because I wasn’t paying attention and I didn’t take immediate action of different prompts regarding the upgrade process.

I decided to keep all of my config file modifications hoping that would give me less headache at the end. Nevertheless, I got several problems after I booted in my new shiny Oneric Ocelot (Ubuntu 11.10’s codename).

  1. I couldn’t go past the login screen – the solution was simple – for some reason my ~/.Xauthority file was owned by root:root – I simply deleted the file and that fixed it
  2. I didn’t get any sound in Unity, but only in Unity as it turns out, as aplay was playing sound just fine. The sound preferences’ Hardware tab was also completely empty. I deleted the ~/.pulse folder and re-logged and I could re-configure my sound. Sound was back on!
I’ll keep this post updated if I come across more problems, and hopefully their solutions.

When I upgraded to Lion suddenly my colorful SSH prompts on remote linux machines became dull and black and white. It took me some time to figure out what was going out, so at first I edited my Ubuntu .bashrc file and uncommented force_color_prompt=yes. But this didn’t seem right. So after some digging I found the problem – in Snow Leopard Terminal.app by default was identifying itself as xterm-color, but now in Lion it is xterm-256color, which the remote Ubuntu did not recognize. So to fix it without changing anything on the remote machines, do the following:

  1. Open Terminal.app Preferences
  2. Go to the Settings tab
  3. In your default theme go to the Advanced tab
  4. On the first line Declare terminal as: select xterm-color, instead of the default xterm-256color
  5. Reopen Terminal.app and voilà – the colored SSH command prompt is back!

Честит празник (на патерица) на всички, които могат да прочетат това.

От няколко години насам, по случай 24 май, много се чепка темата за кирилицата, шльокавицата и произвдните им азбуки, които средностатистическия българин употребява.

“Младите”, които използват компютри са упреквани, че си развалят езика и нямат правопис. Често се набедяват популярните програми – фейсбук, скайп (я вижте как хубаво изглеждат тия търговски марки написани на кирилица) и т.н.. Но дали те са причината?

Определено не!

И двата софтуера имат “меню на български”. А именно “менюто на български” е причината да пишем на латиница. Разгледайте обявите за телефони от преди няколко години – като част от “екстрите” на телефоните неотменно присъства “меню на български”. В 2011 почти всички телефони имат въпросното меню и способ да се пише на кирилица, но до преди няколко години това определено не беше така.
Същото се отнася и за компютрите – голяма част от софтуерните програми нямат “меню на български”, а до преди излизането на Уиндоус Виста, дори и сносна кирилица нямаше! Тази по БДС не се брои! Защо? Ами защото за някой, който тепърва започва да работи с компютър не може да намери БДС еквивалента на клавиатурата, защо такъв няма, защото държавата е допуснала да се продава в рамките на държавата продукт, който не отговаря на националните изисквания, а именно – не поддържа националния стандарт за клавиатурна подредба с обозначение на клавишите на кирилица. От тук всеки започва да ползва подредбата ЯВЕРТЪ – тук поне буквите ги има, а тази подредба я има поне от края на 80-те години! Т.е. проблема с БДС подредбата на клавиатурата не е от вчера. И така хем няма клавиатура с БДС, хем няма фонетична подредба в най-масовата операционна система! От там, започва да се ползва и латинската азбука за писане на български.

От скоро имаме и фонетична подредба, заложена системно в по-новите версии на уиндоус, но това не означава, че навика отмира трудно – даже напротив. В един момент започва да става дразнещо да превключваш от кирилица на латиница и обратно. А това се налага често, понеже всички интернет адреси са на латиница!

Заключенията, кой е виновен за слабата грамотност оставям на вас.

Извинете ме за правописните грешки, но за мен езика е средство, а не самоцел.

It took me two days to figure out how to initialize a new child record from within the parent model, I hope this helps someone:

I’m using devise for authentication and authorization and using devise built-in controllers. My User model has a child Contact model (Contact belongs_to :User) which contains the user’s names and contact information. I preferred not to initialize the content model on new registration in the view (what’s the point of MVC philosophy if you don’t follow it?).

The solution (in Ruby on Rails 2.3.11) is the after_initialize callback

class User < ActiveRecord::Base
  has_one :contact, :dependent => :destroy
  accepts_nested_attributes_for :contact, :allow_destroy => true

  # Devise modules will go here

  attr_accessible :contact_attributes

  def after_initialize
    self.build_contact if self.contact.nil?

and voilà! Your Contact model will be initialized and thus shown in the view when you use f.fields_for :contact

Merry Christmas from Puffy – the destroyer of worlds!

Merry Puffmas

In my line of work as a web designer/developer I’ve learned to silently detest Internet Explorer, especially version 6, so today I decided to check out the analytics of my web sites, how much of the visitors would I be cutting off if I decide to drop IE6 support for the future. I checked several sites – totally different audience, markets, etc. All showed about the same result – 7% of all total visitors were using IE6, and IE6 was the least used of the IE family. Except for one site which had about 9.6%, but it was targeted at the wider Bulgaria population – demographics that I presume has mostly outdated hardware running XP’s.

I was delighted to see kirichkov.com’s demographics – IE was third, after Firefox and Chrome, with just about 11%! IE6 accounts for just 1.5% of the visits! Yes! This site looks awful in IE6, and NO! I don’t care, if you’re visiting with IE6 you’ll see a friendly greeting informing you that kirichkov.com does not support IE6 and the visitor should upgrade! Also the dominant OS of the visitor is … Linux! Even more joy for my web designer heart! But then again I’m not really surprised, given that 65% of the visits start at my article for ZoneMinder on Ubuntu 10.04!

I surely hope that sometime soon I can get back to my ZoneMinder project and present to you part 2 of the series that will turn the video server into a CCTV terminal!

What you need:

  1. The Ubuntu mini CD
  2. A linux and ZoneMinder-supported capture card
  3. A PC

Let’s start!

  1. Install Ubuntu
  2. After the base system is installed install ssh (always good to have) and ZoneMinder

    user@ubuntu:~$ sudo apt-get install openssh-server zoneminder

  4. Add the www-data user to the ‘video’ group to access the video streams from the web interface:

    user@ubuntu:~$ sudo usermod -a -G video www-data

  5. Make Apache automatically start the ZoneMinder web interface and restart Apache:

    user@ubuntu:~$ sudo ln -s /etc/zm/apache.conf /etc/apache2/sites-enabled/001-zoneminder
    user@ubuntu:~$ sudo service apache2 restart

  6. At this point you should be able to open ZoneMinder’s web interface by pointing your browser to http://IP-OF-ZONEMINDER-SERVER/zm/
  7. Download Cambozola to be able to view the live streams from any Java enabled browser in case the Flash viewer does not work for you:

    user@ubuntu:~$ wget http://www.charliemouse.com:8080/code/cambozola/cambozola-latest.tar.gz
    user@ubuntu:~$ tar -zxvf cambozola-latest.tar.gz
    user@ubuntu:~$ sudo cp cambozola-0.76/dist/cambozola.jar /usr/share/zoneminder/

    Please note: As of writing this cambozola version 0.76 is the latest one, hence if you get a newer version you should change to the respective directory.

  8. It’s time to add your cameras – it’s best to first read ZoneMinder’s defining a monitor documentation
  9. In the very likely event that you get black/blank screen when you try to view the live feed from your camera, then you should change your maximum allowed amount of shared memory and restart Apache and ZoneMinder:

    user@ubuntu:~$ sudo echo "256000000" > /proc/sys/kernel/shmmax
    user@ubuntu:~$ sudo service apache2 restart
    user@ubuntu:~$ sudo service zoneminder restart

    How to calculate that magic number (256000000 in my case) is discussed in this thread in the ZoneMinder’s forums. It’s best to read it and calculate the amount yourself, as this is highly dependent on the cameras that you intend to use.
    In order to add the change permanently you’ll need to edit /etc/sysctl.conf and add a line kernel.shmmax = 256000000 to it.
    If you are still getting no image you should check your cameras and how you set them and experiment with the Device format and Capture palette.

  10. You’re all set!

It might be a good idea to slightly tweak some configuration options. You can do that from the Web Interface’s options menu – it is located in the upper right corner, just below the load/disk-usage monitor and it took me quite a while to find it.

  1. Options -> Image -> OPT_CAMBOZOLA set to TICKED
  2. Options -> Image -> STREAM_METHOD set to mpeg

I plan to implement also a Live View monitor so stay tuned for the next HOWTO.