Review: mplayer

Mplayer is the best media player there is. It just is. One just downloads it and it just works, no codecs installation, no registry shit, nothing. It can navigate with the arrow keys (up/down, left/right, pgup/pgdn), it can open unfinished downloads, and can repair/redo their index and navigate while the file is still downloading - awesome. It's very lightweight.

It can play almost anything, no matter how broken it is. It comes with a console tool called mencoder that can encode stuff. It's very hard to use, but it works. It has a GUI for windows and mac os x.

The problem is that the development is a bit forsaken. Sometimes the GUI crashes, there a few bugs, the integration with the OS is not that perfect (I had issues with Vista effects and Mac OS X graphics cards switching)

I just found that the MplayerX (+GUI) is available in the App Store, perfect. The GUI is very slick.

Verdict: highly recommended.

Rename Mac OS X applications

Suppose you would like to have firefox 3, 4 and now 5 simultaneously. Unfortunately renaming applications is not possible via Finder.

Suppose you have firefox3 installed. Do the following:

$ cd /Applications
$ mv Firefox.app "Firefox 3.app"

Then install firefox4 and do that

$ mv Firefox.app "Firefox 4.app"

Install firefox5 and then:

$ mv Firefox.app "Firefox 5.app"

Now you would have all three versions:

$ ls -a | grep Firefox
Firefox 3.app
Firefox 4.app
Firefox 5.app
$

The even show up correctly in Applications tab:

(I messed up in renaming and Firefox 4 is actually Firefox4)

Note: unfortunately you cannot launch them simultaneously since Firefox has a mechanism to check if it is already running.

Why is java development so windows oriented?!

I'm using a macbook. Obviously I'm using Mac OS. Not so obviously actually - recently I saw a few people using Windows 7 on a macbook.

JDK. Developing java applications on a Mac OS is not so straightforward as it is on windows. When you start on Windows, the first thing you do is download the JDK - that's easy. On Mac OS you don't have a real JDK, you have Java for Mac OS X. It's not the same. It's always late. Using SoyLatte they made a darwin port called openjdk6 that is a lot more like a real JDK. With JavaSE 7 it's even worse - there are binaries for Windows, on Mac OS one has to build it manually which is not that easy.

Eclipse. Then there's Eclipse. Thank god - there's an Eclipse.dmg that is pretty easy to install. But (there's always a but), the shortcuts are a bit changed. Alt+Shift+X becomes ⌘+⌥+X. There's also the speed issue - Eclipse is not as fast on Mac OS as it seems on a Windows machine.

Browsers. One major setback is that if one does front-end, one needs Internet Explorer to test. Otherwise QAs come and kick one's ass because something doesn't work on IE6 for example. I hate Internet Explorer. Not only IE6, all of them.

Configuration. In my project I have:

File file = new File(element.replace("file:", ""));

my Windows-using colleagues have

File file = new File(element.replace("file:/", ""));

The good thing is that since Mac OS is unix-based I have the settings that are closer to the Ubuntu we deploy our production on.

I don't know - maybe I should buy a new Macbook with a fast SSD with a lot more juice into it than the one I have now (a two-year-old one that hasn't been reinstalled since). Now there's the question - should I buy the 13" or the 15"?

P.S. The things are getting a lot better. OpenJDK6 port is pretty mature (I use it), OpenJDK7 port is coming soon. Apple donated it's JavaSE port to Oracle, so soon Java's download page would feature a .dmg file, which will be awesome.

Still I think developing java apps on a macbook is a bit harder than on a Windows machine. I wouldn't go back to Windows because of the awesome hardware and because the OS is so much better for anything else.

Review: Global Delight's Boom - boost mac's volume

Sometimes some youtube clips, movies or podcast have their audio recorded really low. My Macbooks' sound is not really strong, so when I listen to such a video I struggle to catch the speech - especially when I'm in the shower.

Global Delight has created Boom. It costs $4.99. A software solution to such a problem - it can boost the volume up to 400% and has a system-wide equalizer:

Here's an indian presenting it: http://www.youtube.com/watch?v=MMiv-qHHeNw&feature=player_embedded#at=197.

Проблем с Infonotary Configurator 1.3.4

Репортнах следния проблем на инфонотари:

Плугинът Infonotary Configurator 1.3.4 ви за Firefox създава проблеми с Firefox за Mac OS X. Проблмът се изразява в тотално irresponsive (не мога да преведа) интерфейс браузър. Страниците не се зареждат адекватно, на линкове трябва да се цъка по няколко пъти и въпреки всичко не се зареждат. Пробвах изключване на всички плугини на firefox - открих, че проблемът е във вашия плугин.

firefox with infonotary plugin
firefox with infonotary plugin
firefox without infonotary plugin
firefox without infonotary plugin
firefox error probably related to infonotary plugin
firefox error probably related to infonotary plugin

Update: Ето комуникацията ми с Васил Бъдев (представи се като разработчик на въпросното нещо):

Здравейте,

Плугинът Infonotary Configurator 1.3.4 ви за Firefox създава проблеми с Firefox за Mac OS X. Проблмът се изразява в тотално irresponsive (не мога да преведа) интерфейс браузър. Страниците не се зареждат адекватно, на линкове трябва да се цъка по няколко пъти и въпреки всичко не се зареждат. Пробвах изключване на всички плугини на firefox - открих, че проблемът е във вашия плугин.
Версия на firefox: 3.6.10
Версия на Mac OS : 10.6.6.
Атачмънти:
Скрйншот с включен плугин (без пуснати други плугини):
Скийншот без
Грешка, която може би е свързана с плугина
firefox with infonotary plugin firefox without infonotary pluginfirefox error probably related to infonotary plugin
firefox error probably related to infonotary plugin
Date: Fri, 18 Feb 2011 12:44:39 +0200
From: Vasil Badev <v_badev_AT_infonotary.com>

Здравейте,
това вече го прочетох на вашият блог. Както писах и там, проблема според мен не е в Infonotary Configurator for Mozilla. До колкото си спомням по телефона ви обясних, че единственото което прави той след първоначалната инсталация, е да проверява стойността на extensions.infonotary-mozilla-setup.lastVersion, при всяко отваряне на нов прозорец, и ако тя съвпада с текущата му версия спира работа. Не можете да ме убедите че по този начин се чупи зареждането на всякакви станици, както и SSL връзките. Понеже при забраняване или деинсталиране на разширението не се премахват настройките които то прави, теорията че точно това чупи Firefox ми се струва още по-невероятна. Не случайно бях предложил да дойдете до офиса за да се опитам да намеря проблема, но Вие не дойдохте.

Най-вероятно проблема е във лошо работеща версия на софтуер за смарт карти или лошо настроен pcscd демон, но това не се вижда от снимките които сте дали. В самият конфигуратор има изключително малко специфичен за Mac OS X код и той се изпълнява само при първоначална инсталация. Ако имаше проблем като описаният от вас той щеше да се прояви при всичките ни клиенти, както и на нашите компютри. След като проблема е само при вас явно е някъде другаде.

П.П.
Mac-a на който реално се тества всичкият ни софтуер е с Firefox 3.6.12 и Mac OS X 10.6.6, но разширението е тествано и на Firefox 3.6.10.

Date: Fri, 18 Feb 2011 12:51:20 +0200
From: Vasil Badev <v_badev_AT_infonotary.com>

Здравейте отново,
чак сега прочетох какво сте коментирали в блога си, явно вече сте двама клиенти са точно същият проблем, но според мен той не е следствие от инсталацията на нашият add-on. Ако можете се обадете на телефона от подписа ми за да се опитам да локализирам проблема.

Date: Fri, 18 Feb 2011 13:14:29 +0200
From: mihail stoynov
Още веднъж: имайте предвид, че не желая да ви убеждавам в каквото и да било. Грешката наистина може да е във всичко и вероятно сте прав, тъй като познавате съответния плугин, но е непрофесионално да отричате грешка без анализ.
Вчера свалих файърфокс 3.6.13 и сега изтествах с включен плугин. Проблемът не се наблюдава, което може би показва, че сте прав. pcscd демона го включвам само като работя със сертификата, иначе ми държи по 10-20 процента от cpu-то постоянно и се принудих да включвам/изключвам ръчно, което е досадно. Надявам се няма да кажете сега, че това също се наблюдава само при мен 🙂 Ако проблемът се появи, ще ви пиша допълнително.
Отново с най-добри намерения,
Михаил Стойнов
Date: Fri, 18 Feb 2011 15:36:40 +0200
From: Mihail Stoynov

Здравей,
Отново се случи - виж атачмънта. Вече не съм сигурен в това каква е причината.

Date: Fri, 18 Feb 2011 16:08:57 +0200
From: Vasil Badev <v_badev_AT_infonotary.com>

Здравейте,
Apple ползват много стара версия на pcscd, която проверява какви четци са включени пет пъти в секунда (подробности тук -http://ludovicrousseau.blogspot.com/2010/08/ram-and-cpu-improvements-in-pcsc-lite.html). На това се дължи и натоварването.

Проблема само при включено устройство ли се наблюдава?
Може ли да ми изпратите изхода от следните команди в терминал с включен четец:
ps ax | grep pcscd | grep -v "grep pcscd"
ls -l /usr/libexec/SmartCardServices/drivers
ls -l /etc/readers.conf
ls -l /Library/LaunchDaemons/org.opensc.pcscd.autostart
/Library/OpenSC/bin/opensc-tool -i
/Library/OpenSC/bin/opensc-tool -l
/Library/OpenSC/bin/opensc-tool -n
/Library/OpenSC/bin/pkcs15-tool -D
pcsctest

Терминала се намира в Application/Utilites. Всяка команда трябва да я копирате и да я поставите в терминал и след това да натиснете Enter.

Date: Sat, 19 Feb 2011 22:16:55 +0200
From: mihail stoynov

Проблемът го има и с изключен четец.

Забележка: спирам пускам pcscd със launchctl:

launchctl (un)load -w /Library/LaunchDaemons/org.opensc.pcscd.autostart

Резултати от командите в атачмънта
Date: Mon, 21 Feb 2011 12:55:49 +0200
From: Vasil Badev <v_badevA_AT_infonotary.com>

Здравейте,
Ако при изключен add-on проблема не се проявява не знам какво да предложа освен да дойдете до нашият офис с компютъра и тук да се опитам да намеря къде е проблема.

Ако се прояви и при изключен add-on може ли да пробвате да обновите софтуера за картата и четеца.
За смарт картата първо ще трябва да деинсталирате SCA със sudo /Library/OpenSC/bin/opensc-uninstall след това инсталирайте последната версия от http://www.opensc-project.org/files/opensc/OpenSC-0.12.0-10.6.dmg. За четеца си инсталирайте актуалният драйвер на HID Global от http://www.hidglobal.com/drivers/omnikey/ifdokccid_mac_10.6_i386-3.0.2.dmg.

В новата версия на opensc няма файл /Library/LaunchDaemons/org.opensc.pcscd.autostart, така че няма да можете да спирате и пускате ръчно по същият начин.

Date: Mon, 21 Feb 2011 15:08:13 +0200
From: mihail stoynov

Здравейте,
Ще изчакам да видя дали проблемът ще се окаже хроничен.
Ако не мога да спирам и пускам ръчно pcscd, не бих ъпдейтнал, защото понякога тъпия демон скача до 50% cpu и си стои така. Имам нужда да мога да спирам/пускам ръчно.

Още нещо: другите ползватели на тоя демон как свикват с натоварването? Ако това нещо стои постоянно, лаптопът ми постоянно ще върти вентилатора на 6000 оборота и ще е доста горещ

Date: Mon, 21 Feb 2011 17:44:41 +0200
From: Vasil Badev <v_badev_AT_infonotary.com>

По принцип демона се стартира в момента в който включите четеца. Повечето ни клиенти не са се оплаквали от подобен проблем, така че или не са забелязали или не се проявява при всички. На нашата тестова машина pcscd не натоварва процесора повече от 1-2%, но до преди малко на него нямаше инсталиран четец на OmniKey. Сложих му техният драйвер и един четец с карта и ще го наблюдавам тези дни.

П.П.
Ако не искате да обновите OpenSC (стартовият скрипт е от него), може да сложете новата версия на драйвера на OmniKey. В момента сте с 2.6.4, а актуалната версия е 3.0.2.

How do you run windows when your primary OS is not Windows (need help)

My laptop is a Macbook. It runs Mac OS X. While the OS is awesome, it's not the most popular one. This would mean that there's software that is only made for Windows. And it's software that is custom, specific and generally cannot be changed for another software [running on OS X].

There is however one piece of software which even though it runs on OS X, I want on Windows. And that is Microsoft Office. MS Office for Mac OS X sucks. The ribbon interface is so ugly on Mac, the menus so different. And it deleted one of my presentations (while presenting it !!!). Don't even get me started on OpenOffice, iWork and all the copycats. When everyone around you is using MS Office, you have to use it too. Period.

So we agreed that I need Windows

The most common thing to do is get a virtual machine. I was using VMWare Fusion with one Windows XP and one Windows 7 installation for quite a while. The problem is the HDD. It just can't keep up with both machines (the host and the virtual). While stopping the swapping in the virtual machine can help, it doesn't fix the problem. And I have the fastest plate hdd available - 7200 rpm, a lot of cache. Also getting a lot of RAM also helps considerably - I have 4GB but the issue with the HDD remains.

I went to the competition

People said that VirtualBox and Parallels would do the job better. I tried VirtualBox for a day. Importing failed due to hardware inconsistencies and even while loading it just made the host os unresponsive. So I guess the competition doesn't do the thing better. What next?

What about remoting?

Using a dedicated machine that stays somewhere and logging on it only when needing windows could do the job. This means I have to buy an extra machine. Remoting would mean that I would need net constantly. And Remote Desktop for Mac is pretty bad. I could always switch to TeamViewer (also available for my phone), but it is not the best either. Also copying stuff while using my phone's 3G is not viable if the stuff is in the hundreds of megabytes scale.

What about SSD?

While the classic HDDs are good for working on serial pieces of data, SSDs shouldn't have the problem working in parallel with 2 streams of data. I have a friend who bought 50GB OCZ drive and he says his machine now went supersonic (a lot faster). The drive was like 130 euros. I can't work with 50GB. 128GB could maybe do the job but it's going to be tough. And buying a bigger one would be very expensive. Also I haven't asked how does this drive behave with a VM. It's important to do so.

And no I would NOT install Windows

...or get a Windows laptop. No way. No BootCamp either.

Conclusion: I need help

This problem would be relevant for everyone using any OS that is not Windows. So, people-not-using-windows, PLEASE HELP ME decide what to do.

Install Snow Leopard (Mac OS X 10.6) from USB and restore only user files from Time Machine

Install Mac OS X 10.6 from a USB memory stick.

Here’s a tutorial on how to install Mac OS X from a USB stick.

Restore only user data from Time Machine

So now comes the restoring. I wanted a clean install – the last installation was pretty messed up.

Now is the time to say that I have a Time Machine for backing up stuff. I didn’t want to restore any system stuff, neither I wanted to restore users and their settings. I just wanted to restore ~/Desktop, ~/Documents, ~/Downloads, ~/MyFiles.

This came out to be VERY HARD.

When installing the OS, the installer asks for a Time Machine, but I said NO, cause I was afraid that it would restore more than I wanted it to.

After the installation was complete I launched Time Machine and tried to go back. I had the snapshots but couldn’t restore them because the owner of the files no longer existed.

With a lot of manual copying I managed to move the data back to my harddrive. Now I had to fix the permissions. Using Mac OS X for that could prove to be impossible.

The console

Going to the console helped a lot.

First to change the owner of a directory:

$ sudo chown -R mstoynov Desktop/
$ sudo chown -R mstoynov Documents/
$ sudo chown -R mstoynov Downloads/
$ sudo chown -R mstoynov MyFiles/

Some of the operations may fail with:

chown: Desktop/web/UC.class: Operation not permitted

The problem most probably resides in some flags being set up. Most probably uchg.

To see whether any files have uchg anywhere in a directory, I did:

$ ls -lOR Desktop/ | grep uchg
-rwxrwxr-x  1 502   staff  uchg   4228 29 Мар  2003 GrandeProjecto.jpx
-rwxrwxr-x  1 502   staff  uchg   1676 18 Авг  2003 GrandeProjecto.jpx.local
-rwxrwxr-x  1 502   staff  uchg    832 29 Мар  2003 GrandeProjecto.jpx.local~

To fix the uchg flag, I did:

sudo chflags -R nouchg Desktop/

Then again chown is required.

That’s it. Now my data is once more mine.

Chown the data on the time machine

The same problem with permissions exists in the time machine. There fixing them is not so easy – to many symlinks and too many directories owned by root. Also I don’t know whether I should remove uchg from anywhere. So fixing all that is not that simple. If I figure it out – I’ll share the knowledge.

Install Snow Leopard (Mac OS X 10.6) from a USB

Mac OS X 10.6 image is 6.3 GB. Using a normal DVD does not work.

Since I’m lazy to go out and buy a dual-layer dvd (8.5 GB max), I decided to use a USB flash to install the new OS.

This is a good guide on how to do that: http://www.maciverse.com/install-os-x-snow-leopard-from-usb-flash-drive.html.

The only problem is that I didn’t actually use a USB stick, but this:

Kingston MicroSD HC 8GB. It comes with 2 different SD adapters, and what is very cool – a very tiny USB adapter. It’s the smallest USB I’ve ever seen.

I bought this for my phone, but came out to be very handy. By the way I highly recommend this Kingston memory.

So the problem with this memory is that it took roughly 2 hours for the Mac OS X 10.6 image to burn (I can’t say burn in this case, right?), while in the tutorial they say it took them only 20 minutes. The memory went pretty hot also – it was working hard for a couple of hours.

I wanted a clean install so I erased the hdd first.

Everything else went like a charm.

iReport 3.0.0 on Mac OS. How to make it work?

iReport is a gui for designing jrxml (the actual reports) files for JasperReports. It is supposed to work on any platform.

We’re using 3.0 instead of 3.5 because 3.5 is based on Netbeans.

I’m trying to work with it on Mac OS (it was extremely slow in the virtual machine, something to do with java I guess).

First:

chmod u+x iReport.sh

…because it’s not executable.

But then it gave me a weird error:

comp:iReport-3.0.0 user$ ./iReport.sh
-bash: ./iReport.sh: /bin/bash^M: bad interpreter: No such file or directory

Google said it’s because of the problem with newline in different platforms. In linux it’s LF (\n)(line feed). In windows it’s CRLF (\r\n) (carriage return, line feed).

So this ^M character appearing in the error is actually the left-out CR.

How to fix it? Wikipedia says:

tr -d '\r' < inputfile > outputfile

This works. But then the next error. iReport.sh calls bin/startup.sh.

The same thing for it.

That’s it. Why was the shell script in a dos format only god can tell.

Note that iReport on a Mac should be in a place whose path does not involve spaces. Here’s a solution for that too.

Macbook, the mac way of doing things.

After having a Dell Inspiron for a year (search ‘dell’ in the blog) and having issues with stability (battery died in less than a year, the power charger blew up, it started falling apart, heating up) I decided it’s time for a change. I wanted something very sturdy and then saw the new aluminum body Macbook. So I thought this was it.

I now have it for 6 months and I’m pretty happy with it. Battery takes up to 4 hours, usually 2.5h. The body is exceptionally strong. It' doesn’t heat as much although when Firefox goes berserk (100% processor time) it does heat up.

Switching to Mac OS took some time, but still a lot less than expected. There’s always a windows on a virtual machine, but I rarely use it. Mac OS is really nice to play with. And a lot faster than the vista I had on the dell (search vista in the blog).

I’m not an Apple fan for so many reasons, but they made a pretty stable and usable laptop. That’s my initial experience.

While in the states I saw the new one, with the only major difference being a battery they claim could support the laptop for 7 hours. I don’t believe it, but even 5 would be very nice. Especially for 9-hour over-Atlantic-ocean flights.

How to set up networks and dhcp on vmware (on Mac and other OSs)

How to do networking with VMWare Workstation or VMWare Fusion?

For clarity, let's assume that the host (the machine running vmware fusion or vmware workstation) has the ip of 192.168.0.10.

On every virtual machine there are three options:
Bridged (VM becomes visible to other machines beside the host. It has an IP like 192.168.0.11).
Nat (VM is visible only to the host, there is internet).
Host only (VM is visible only to the host, but no internet).

Do ipconfig or ifconfig.
vmnet8 is for NAT.
vmnet1 is for host-only.
These are whole networks for virtual machines. If nat is chosen, then the VM would be supplied an IP from the vmnet8 pool.

DHCP.
If 'bridged' is chosen, then the administrator of 192.168.0.1 must assign an address to the VM.
if 'nat' or 'host-only' is chosen, then:
(I'll describe how to do this on a mac):

goto:

$cd /Library/Application Support/VMware Fusion

stop vmware networking:

$sudo ./boot.sh --stop

Let's suppose vmnet8 is 172.16.57.1 and vmnet1 is 172.16.163.1.

I would like to change the network from 172.16.57.1 to 172.16.16.1 and I would like to specify a virtual machine with a specific IP.

We're still in /Library/Application Support/VMware Fusion

Then:$ grep 172.16.57 *locations:answer VNET_8_HOSTONLY_HOSTADDR 172.16.57.1

Then all files in the list must be changed.Then we go into /Library/Application Support/VMware Fusion/vmnet8/

Then the same: 

$ grep 172.16.57 *dhcpd.conf:subnet 172.16.57.0 netmask 255.255.255.0 {dhcpd.conf:    range 172.16.57.128 172.16.57.254;dhcpd.conf:    option broadcast-address 172.16.57.255;dhcpd.conf:    option domain-name-servers 172.16.57.2;dhcpd.conf:    option netbios-name-servers 172.16.57.2;dhcpd.conf:    option routers 172.16.57.2;nat.conf:ip = 172.16.57.2nat.conf:# or ip = 172.16.57.2/24

All of them must be changed.

If a specific VM must have a specific IP we go to:/Library/Application Support/VMware Fusion/vmnet8/dhcpd.conf and we add the following:(get the mac from the VM (ipconfig, ifconfig eth0))

host myhost {    hardware ethernet 00:0C:29:B2:C9:69;    fixed-address 172.16.16.16;}

Then to renew the ip (ipconfig /release, ipconfig /renew for windows):sudo ifconfig vmnet downsudo ifconfig vmnet up

The last thing is to start the vmware networking:sudo ./boot.sh --start

Then to renew the ip inside the VM (ipconfig /release, ipconfig /renew for windows):sudo ifconfig vmnet downsudo ifconfig vmnet up