Saturday, July 16, 2011

Software Patents - My Opinion

The objective of the patent system is to protect innovations and innovators. I think the world needs to seek some other means to serve the purpose.

As I was reading the news on Microsoft demanding $15 per each Samsung android phone sold, I enjoyed some of the users' brilliant comments. This exactly shows how business are working around the patents to cripple innovation which is competition.

The below comment highlights the issue.
No, the point is that the software patent process in the states stifles competition. For instance – this is one of the supposed infringements – “One of our patents enables users to select text, see what is selected via highlighting, and expand the selection in either direction as desired. (U.S. Patent No. 6,891,551)”
So tell me how another company is supposed to “innovate” round this? How else can you select text on a smartphone? Patents were designed to cover actual physical devices and systems – and competitors could come up with a new way of doing things. Imagine if a company had a patent, not on hardware ways to make a TV screen brighter, but on the concept of TV itself? e.g. “A patent that describes a system by which a user may view images on a screen and vary the image by means of a push button remote mechanism”. Most of these software patents should never have been invented in the first place. I’ll also point out that the above MS patent was issued IN 2005!! (http://patft.uspto.gov/netacgi/nph-Parser?Sect1=PTO1&Sect2=HITOFF&d=PALL&p=1&u=%2Fnetahtml%2FPTO%2Fsrchnum.htm&r=1&f=G&l=50&s1=6,891,551.PN.&OS=PN/6,891,551&RS=PN/6,891,551) So no-one was able to select text or vary the select before then? What a load of crap. -- by  colesadam

Want to know what sarcasm means? Read the below comment
I should go patent “an item that is circular in shape that will move around and repeat in a repetitive fashion so that it may carry objects held down by Earth’s gravity across the Earth’s crust.” Has anyone patented a wheel? Why not I? -- by Cliff Porter

Saturday, July 2, 2011

How to Determine the Print Quality of the Camera Phone

I wanted to buy a camera so that I can take pictures of my son, and I was also interested in buying a new phone. I initially thought of buying a digital camera, as I was interested in taking prints, rather than just sharing/saving the digital copies. I had the impression that phone cameras do not print well. There are a lot of articles and comments on the Internet supporting this stand.

I wanted to analyze and see whether a phone with a good quality camera would fullfil both of my requirements. I rarely print photos, and a 6"x4" photo print would be enough for me.

I wanted to know what is the Mega Pixel value a phone should have to print a decent 6"x4" image.
Short answer: 5 MP would be enough.

I found some blogs/articles mentioning that the camera phone industry has hit a new level when it was able to build 5 MP cameras into phones. This I believe because 5 MP is the practical minimum needed to support some good quality prints. So, settling for anything is less than 5 MP is not advisable if someone is interested in the camera functionality of the phone.

There is an easy way to find out what is the size of a good quality print one can take with his camera phone. Consider the below example.

The standard resolution of a 5 MP camera would be 2560 x 1920 pixels.
Printing at 240 dpi would result in a nice looking photo print, but the industry standard is set as 300 dpi which is practically more than enough. (dpi = dots per inch)
Dividing the resolution of the image by 300 gives the size of the image in inches (when the image is printed in 300 dpi).
So, a picture from 5 MP camera (2560 x 1920 pixels)could produce a neat 8.53"x6.4" photo print.

Saturday, June 18, 2011

Hoping Kmail is Improved Now So that I Can Use It

I always wanted a KDE mail client for my gmail accounts for the below two reasons.

1. Support for multiple accounts
2. Better search support, at least in the local folders

I tried Kmail, first time with POP3, and the experience was confusing. Later on, I came to know that when POP3 clients don't modify the status of the mail in the server. For example, the mails read with the POP3 client, will still be marked as 'unread' in the server when accessed by another client. After knowing this, I gave Kmail another try, but using IMAP this time. Connection via IMAP actually removed this confusion, but it was so slow and painful to use. As of that time, there were a lot of people saying that the Kontact suite (thus Kmail too) was not yet ready for production. That statement indicated that Kmail was going through some serious development and gave me some hope for the future.

Though I gave up using Kmail, I still wanted to try it again due to the above two advantages. Now that an improved version of the Kontact suite has been released along with KDE 4.6.4, I am awaiting these to make it to either debian unstable (sid) to give it another try. I am excited as the release announcement specifically says that the IMAP speed has been improved, the reason why I actually quit Kmail.
Among the most noticable improvements are faster email notifications, vastly improved performance for IMAP email accounts, and ...
Lets wait until it arrives.


Wednesday, June 8, 2011

Handling Composite Keys Which are also Foreign Keys

Many-to-many relationships are usually resolved by having another junction table, which includes the keys from both sides of the relationship. This is a common scenario in database design. But things get slightly more complex when this junction table is referred by another entity.

Lets consider the below scenario:
There is a shop which purchases items in bulk, and resell them in smaller quantities. For example, they buy pens in units of Cartons and sell in smaller packs and pieces. Price of a unit varies as the measurement unit varies. A pack of pens has a different pricing (strategy) than an individual/piece of pen.
An invoice is issued for every sales which contains list of items, their relevant quantities and prices.
Lets say you came up with the following design to solve the above problem.


In the above diagram, Invoice_item_unit is more interesting as it represents a relationship between a junction table (item_unit) and an entity (Invoice). In Invoice_item_unit table, item_id and unit_id and invoice_number together form the the composite key which are actually foreign keys from other tables.

The first confusion here would be "Should item_id in Invoice_item_unit reference Item table, or Item_unit table?". It should be Item_unit, as that is what is involved in the relationship, not the original Item table.

The next confusion that may arise would be, since item_id and unit_id are from the same table, how do you define the SQL for the foreign key relationship. My emphasis is more on syntax, rather than concept. The solution is listed below.
ALTER TABLE invoice_item_unit ADD CONSTRAINT fk_item_unit_invoice_item_unit FOREIGN KEY (item_id, unit_id) REFERENCES `item_unit` (item_id, unit_id) ON DELETE RESTRICT,
 ADD CONSTRAINT fk_invoice_invoice_item_unit FOREIGN KEY (invoice_number) REFERENCES `invoice` (number) ON DELETE RESTRICT;

If you are using schema.yml of doctrine ORM to generate the database, handling the above underlined part may not be obvious at once. Here, is the solution.
  relations:
    ItemUnit:
      local: item_id
      foreign: item_id
      type: one
    ItemUnit_2:
      class: ItemUnit
      local: unit_id
      foreign: unit_id
      type: one
    Invoice:
      local: invoice_number
      foreign: number
      type: one

Update: The above was found using the reverse generation technique; create the tables and then create schema. But this approach seems problematic as doctrine in symfony 1.4 does not properly support this kind of a relationship. A better solution would be to assign a unique identifier to the item_unit table and refer that id in the invoice_item_unit table. This would work in symfony. Please refer the updated post to get a better picture on this.

Debian KDE Team Fully Focused on Getting 4.6.3 to Testing

The Debian KDE team is working fully focused on moving kde 4.6.3 from unstable (sid) repository to the testing (wheezy) repository. They have mentioned that they will not be working on bringing KDE 4.6.4 to unstable. Their priority is to finish off any remaining work on KDE 4.6.3 and move it to testing. Testing repository still is in KDE 4.4 and users have been waiting for an official major release for more than an years.

Given that KDE 4.7 beta1 is already released, if 4.6.3 is not pushed to testing before KDE upstream releases 4.7, users of the testing repository will be two three major versions behind. So, I feel that Team Debian KDE is focused on the right thing. Lets wait and see what happens.

Update:  KDE 4.6.3 entered testing repositories as of June 8, much quicker than I anticipated.

Friday, May 27, 2011

KDE 4.6.3 Will Land on Debian Unstable Within a Day or Two

For all those who are waiting for KDE 4.6.3 in unstable (sid), it will be available within this week. Since this is an upgrade 4.4 to 4.6, where 4.5 was completely skipped, and KDE is packaged in a different way now than the previous releases, expect some rough times when upgrading.

Said that, things should not be too tough since several people have already taken this upgrade path qt-kde.debian.net package maintainers might have ironed out all the glitches by now.

I hope the my long awaited kdevelop 4.2 will also be made available with this release.

Please read this before upgrading. I hope my previous experience on upgrading to 4.6.2 via qt-kde would also be useful for anyone  planning for this upgrade.

Note: KDE 4.7 beta1 has been released by the upstream meanwhile.

Sunday, May 15, 2011

Upgrade to Debian KDE 4.6.2 - Issues and Solution

I wanted to upgrade my PC to KDE 4.6.2. It had 4.5.x and sid. qt-kde.debian.net was enabled, and I knew upgrading is not going to be a tough time since so many people have reported that to be smoother than expected.

So, feeling pretty confident, and not being upgraded for 3 months, I just issued the two magical commands.
apt-get update; apt-get dist-upgrade
The upgrade did not go so smooth, it stopped at a certain point reporting some broken pacakages. Luckily it hinted that 'apt-get -f install' may do the trick. So, I followed the hint, and no errors reported after that though I noticed that some packages (konqueror, dolphin, etc) are held back without upgrading. I rebooted my PC as it was upgraded, and was very excited to log into the the new 4.6.2. To my surprise, the login manager did not list KDE as an available session. Only Default, Failsafe, and Fluxbox were listed.

Being disappointed, did some searching and found out that the qt-kde.debian.org repository explicitly mentions not to do what I exactly did above. So, the command I should have given, according to the site is
apt-get -t experimental-snapshots dist-upgrade and NOT apt-get dist-upgrade
 So it was I, being foolish and blind, messed up the system. Now, I tried to remove and re-install kdm suspecting that it might fix the mess. After removing it, it refused to re-install due to broken dependencies. I figured out a newer version was available in the official experimental repository. So, I temporarily enabled it and got kdm installed.

After beating around the bush for an hour, I logged into Debian IRC and asked for some help. My question was exactly which package should be properly configured to get KDE listed in my login manager. MoDaX answered it, and he pointed me to focus on getting kde-standard working. I knew it was a subset of kde-full. So, I decided to focus on getting kde-full installed properly.

I did not want to jumble all the repositories, so disabled the official experimental repository. Then tried the below.
apt-get install -t experimental-snapshots kde-full
 I was expecting to see some broken packages to be reported, and prepared myself for some troubleshooting. But, to my surprise, no broken packages were reported. The process went just fine. And I finally was able to login to KDE 4.6.2 without any issues.

The point is, if I just had read the release announcement before upgrading and given the correct command, I could have got it up and running without all these issues.

I hope someone who does/about to do the same mistake may find this experience useful in someway.