Oct 1, 2009

iPhone menace....

OK. SO it is next 12 hours (in which I slept for some 7 hours). While I was using the phone in other 5 hours (for some 30 minutes), iPhone rebooted on me 3 additional times, once in a phone call....
I am finding the device unsatisfactory and calling provider to replace it with any BB model... It is not worth my time....

Sep 30, 2009

...iPhone...

So my old Nokia wasn't enough for me. I was in a market for a new phone. I really wanted iPhone. I am so very fond of my MacBook Pro, why should be iPhone any worse...
Well wrong... I am not sure if there is same company behind both of these products. Definitely iPhone doesn't seem to be related to the manufacturer of the first one. I assume the other company is sharing a logo with the first one. I just don't understand why....
So what is wrong just 24 hours after I got my iPhone 3GS? First of all the phone just keeps on rebooting. I open contacts, go to a group and phone reboots. I open calendar application, phone reboots. I open Safari and load a page, iPhone reboots... The phone rebooted on me some 20 times or more during mere 24 hours (in which I slept 8 hours)...
Second biggest problem is that in first day of use (and let me tell that it was nothing more but normal phone usage), iPhone hung in a contact application. After 20 minutes of trying getting out from frozen application I started to look up instruction on how to reboot the iPhone. And just when I reboot it, it hung with an Apple logo screen.
I gave up and let iPhone do whatever it was doing for next 30 minutes... When I returned and nothing happened I thought that the device was broken. But I googled a way to unbrick the phone and restore it. Well it works now for 10 minutes.... Will see what will happen next.
Now, let me express my opinion on some of the features. I like the gui. Idea is great. What is not great, even very weird is how the phone is crippled. It was pretty common for me to exchange contact info via bluetooth. Well you know... With iPhone you can just forget it. I am an musician. In our band we often do some home composing and then we exchange the result. You can do your guessing... Yes, we can not exchange our creations over bluetooth. It was working for us even among different phone brands: Nokia, SonyEricson, Motorola... Now we can not exchange our data during lunch break. Weird? Well for me YEAH DAMIT!!!!
One would expect that the iPhone would be able to sync with the MacBook Pro over the bluetooth. Well one would be very stupid to expect that. Adding to this design flaw there is this another one that it is not using USB mini to charge. This means that I had to add another cable to carry with me. I just can not grasp why would the same designers who designed so many practical and useful features into MacBook Pro would do such an unpractical thing as creating a redundant cable which you have to carry around. It is pretty logical to carry USB cable to connect external hard drive. Why to add another USB cable when you already have one? Apple designers? Anyone? I just want this single answer.... And another one about bluetooth. To cripple functionality beyond usefulness is something which in my opinion goes well against the reasons why I switched to Apple. Or is Apple plain greedy and Steven decided to get any buck possible sacrificing user experience refusing to customers something every other phone maker ofers?
And the last thing which gets on my nerves. It really does. I would like to add a ringtone to a group of users. It so plain easy. I'd like to add Imperial March to my customers and Rebel Theme to my guys. Well you can guess. Not possible. More over I own the CD's with Star Wars soundtrack. So why can not I take the song I imported through the iTunes from CD I own and assign it to any contact I want. I just have to purchase ringtone. And this is nothing but greedy.
Well I give it a spin for few more days, but the way I have to battle the tool (iPhone) I wanted to use to make my life better, I just assume I return iPhone to my operator as something not worth my effort....

Sep 8, 2009

Buying software

Well, I want to have my software legal. So I was buying Adobe CS4. I decided for Premiere Premium Edition. I started looking for the prices. I wanted to support local reseller (fighting the crisis), so I looked up the price at local Adobe reseller. Well the price for the package was 1900 Euro (2717 USD) in sale. I then checked Adobe store for the price 1188 Euro (1699 USD). I still wasn't satisfied so I went shopping at pricegrabber.com and came up with a reseller price of 520 Euro (744 USD).

Well I am not sure of Adobe's sales policy and I am not sure why local sellers don't fight for better prices with Adobe. The story is the same as with the Apple. For the price of one license I can have three from the USA seller. With that high price local companies are not motivated to buy legal software. They usually don't look for better prices overseas.

I am definitely happy I am not the Adobe shareholder. If I am, I had to ask board of directors, why they don't do something to penetrate more into overseas markets and why they set the software price so high.

And I wonder why local resellers don't push Adobe to change the pricing policy. I bought the package overseas of course, so they actually lost my business.

Sep 2, 2009

Data Recovery

I was clever enough to delete part of the data from a table in a database. It was over 2500 product images used for an eshops we operate. Historicaly it was the oldest images put into the database. It took few days to discover the disaster. And since then new data was entered into that particular table.

Luckily we found an older backup. However we couldn't just restore data from the backup to the database. We would lost new data. And I didn't want to get into comparing ids in the old and new database. It took me a while, but I found a soution.

First I created temporary database on a production server. I then loaded old backup into it. I found out that the old table structure differs in a detail from new one. Then, after few tries on a test database, I loaded data into production db, like this:


INSERT IGNORE INTO eshops_prod.product_images
SELECT i1.*, 0
FROM temp.product_images i1
LEFT JOIN eshops_prod.product_images i2 ON (i1.image_id=i2.image_id)
WHERE i2.image_id IS NULL


This quick trick saved me now....

Jul 31, 2009

Extracting all possible info about MySQL database

We need a tool which can extract all possible info about MySQL database to have it as a source for another tool which compares extracted info to an existing database and executes necessary changes. Works goes all around very well. Here is just a link to some useful information: http://code.openark.org/blog/mysql/useful-database-analysis-queries-with-information_schema

Jul 29, 2009

Debugging of MySQL stored procedures

I ran into problem earlier today with an SP. I had no clue how to find out what was wrong. I started to search for some debugger for MySQL's SPs, but found ones for a Windows only. Then I found following post. I found it most helpful: http://gilfster.blogspot.com/2006/03/debugging-stored-procedures-in-mysql.html

Jul 28, 2009

Distutils

Looking at distutils to publish some of the code I've written. So far so good. Here are my leads:
http://docs.python.org/distutils/
http://linux.com/archive/feature/118439
http://wiki.python.org/moin/Distutils/Tutorial

Jul 27, 2009

Mac OS and bluetooth proximity automatization

The colleague of mine started to look around on how to lock screen of Mac when he has to leave the computer. It is sad that there is no such easy solution for Mac as there is for WinTels. However among many interesting solutions there is one which is very intriguing - to use bluetooth enabled device to lock/unlock computer for you.
Here is a link describing the solution for Ubuntu:
http://technogra.ph/20080309/sections/downloads/blueproximity-walking-away-to-lock-your-computer/
And here are an articles focusing on Mac OS:
http://hollington.ca/technocrat/?p=44
http://www.makeuseof.com/tag/automate-your-mac-your-home-with-proximity-mac-only/
http://theappleblog.com/2009/06/11/how-to-proximity-automation/
http://mathamlin.com/speak/proximity-jacksms-applescript-mac-fun/

Jul 21, 2009

Frustrated from Lightroom

Lightroom keeps crashing on me. Whenever it is to do anything with Nikon D70 NEF format. Damn.... I dunno what to do....

Jul 20, 2009

More stored procedures in MySQL

Recently I had to do some maintenance on MySQL database for a customer. It is all for his e-commerce web site. The issue was that all brands are stored separately in a table. However there is several synchronization tools that update site's content. So it happened that we have plenty of the brand names with different casing (e.g. Panasonic and PANASONIC).

As there is few different programs talking to the database written in different programing languages I decided to centralize the functionality in the DB itself. The issue is that we are using UTF-8 names of brands and depending on a language and its version the eastern european characters are being lowercased differently.

So I made another column for storing the hash. The issue here is to have a central code for lowercasing and then hashing string (the brand name) before it is stored to the DB. For this I created following function:

CREATE FUNCTION get_brand_id (s VARCHAR(255)) RETURNS BIGINT (20)
DETERMINISTIC
BEGIN
DECLARE my_hash VARCHAR(255);
DECLARE out1 BIGINT(20);
SET my_hash = md5(lower(s));
INSERT IGNORE INTO brands SET name=s, hash=my_hash;
SELECT brand_id INTO out1 FROM brands WHERE hash=my_hash;
RETURN out1;
END


Then I needed to create hash for all existing brands. So I made following procedure:
CREATE PROCEDURE hash_brands()
BEGIN
DECLARE my_hash, my_name VARCHAR(255);
DECLARE my_brand_id BIGINT(20);
DECLARE is_done INT DEFAULT 0;

DECLARE cur CURSOR FOR
SELECT brand_id, name FROM BRANDS;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET is_done = 1;

OPEN cur;
WHILE NOT is_done DO
FETCH cur INTO my_brand_id, my_name;
SET my_hash = md5(lower(my_name));
UPDATE brands SET
hash=my_hash
WHERE brand_id=my_brand_id;
END WHILE;
CLOSE cur;
END
Then I just neede to change unique key from name to hash field. Now I need to change couple of scripts to use my function or better to trigger insert on the brands table to use my function. Will see about that.

May 13, 2009

MySQLdb and Leoprad

After few hours of strugle, here is the right thing.
http://www.keningle.com/?p=11
Don't forget to install 32 bit MySQL not 64 bit....

Jan 29, 2009

LDAP hell (2)

So I managed to find a guide on setting up webclient for my LDAP server:
http://www.nomis52.net/?section=docs&page=samldap

LDAP hell

I decided to put all authentication/authorization into one place. There are few choices. I opted for LDAP for various reasons. I should mention that I just understand some concepts of LDAP and don't understand details of implementation. The main goal was to put authentication information for all the systems we use (shell, samba, subversion, email) into one place. Second in importance is to have an LDAP installation for test purposes. We want to implement authorisation library which could be easily extended to use different backends one of them being LDAP.
Here is a list of guides I found useful for the task:
http://times.usefulinc.com/2005/09/25-ldap
http://www.rrcomputerconsulting.com/view.php?article_id=3
http://ubuntuforums.org/showthread.php?t=640760

To configure subversion I used these:
http://www.idimmu.net/2008/01/15/Apache2-ldap-auth-on-Ubuntu-Dapper-and-Feisty
http://blogs.open.collab.net/svn/2007/03/subversion_ldap.html

Now to create a user:
smbldap-useradd -a -m -M ricky -c "Richard M" ricky
-a allows Windows as well as Linux login
-m makes a home directory, leave this off if you do not need local access. PAM will be configured to automatically create a home directory.
-M sets up the username part of their email address
-c specifies their full name
smbldap-passwd ricky

Groups can be added:
smbldap-groupadd -a groupname

Membership are easily managed through Eclipse and LDAP browser.

I wish there is a web based UI to manage users, groups and memberships. Will have to research something....

Jan 14, 2009

Linux kiosk

Yesterday I met a person who did some kiosk apps. I was quite intrigued and when returning home I started to investigate a kiosk solution based on Linux for a web application. Here is a link for the most interesting solution: http://jadoba.net/kiosks/firefox/

Jan 3, 2009

XBMC - Installation (part 1)

I bought EEE Box these days to setup a media center at home. I used XBMC Live to install it from USB key to HDD. It was a bit of pain as EEE Box won't boot up from USB key by its own. The USB key must be present at the boot. In the bios must be set that USB key should act as fictianl HDD, then in the boot menu it is possible to set the USB key as HDD to boot from.

On the next system restart the machine booted properly from USB key. On initial XBMC screen I opted for installation to HDD and all went smoothly. Afterward I changed bios settings again to boot from SATA drive and all went smoothly.

I continued with some installation maintenance as I wanted to use BlueTooth keyboard, etc...

XBMC - Automagic library update (part3)

I was wondering if there is a way to somehow automagically update a library from cron on through some other means. I keep my files on a file server in basement. It is accessible through SMB (or SAMBA). I add things to the storage many times to watch, but they don't appear in the XBMC as it needs to update library.

There is a way to initialize library update through built-in web server. It just needs to be run through curl or wget to use it in scripts:
curl 'http://xbmc:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.updatelibrary(video)'
or
curl 'http://xbmc:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.updatelibrary(music)'

There is much more commands which can be used:
http://xbmc.org/wiki/?title=WebServe...ction_commands
http://xbmc.org/wiki/?title=List_of_Built_In_Functions

XBMC - Blue Tooth Keyboard (part 2)

The next thing for my XBMC setup was to control it from the Blue Tooth keyboard I bought for a purpose a looong time ago. The keyboard is Logitech MediaBoard Pro (intended for PS3, but who cares).

My EEE Box does not have a Blue Tooth built in. I had a USB Blue Tooth dongle (BlueTake BT00009X) I used a long time ago and thought I give it a shot. On my great surprise the dongle worked on inserting it into USB slot. No any configuration necessary.

I had to ssh into XBMC machine to do next steps. The great way to find an IP address to ssh into is to look into your routers connected device - the XBMC is there as XBMCLive, or to go to the XBMC and through an USB keybord dig the IP address in an XBMC interface.

Following steps are best described in this article: https://help.ubuntu.com/community/BluetoothSetup