Friday, September 24, 2010

Update multiple records with single query, or Bundle Record Update

Actually it's a lie, it's not a single query, it's 3 queries, but it's still much more sufficient if you deal with more than 3 records to be updated with different values.

So, the problem is to run lot of update queries like:
update table_name set value_column='value1' where key_column = key1;
update table_name set value_column='value2' where key_column = key2;
...
update table_name set value_column='valueN' where key_column = keyN;

If you have N more than 3, then you should test the performance of the following approach:
1. create temporary table temp_table(k int,v varchar);
2. insert int temp_tabl values
(key1,'value1'),
(key2,'value2'),
...,
(keyN,'valueN')

3. update table_name, temp_table set
table_name.value_column=temp_table.v
where table_name.key_column=temp_table.k

For ~50 records, it works ~2 times faster, so think about it.

Как-то-так

Friday, September 3, 2010

Eclipse PDT 64Bit Windows 7 problem

This was the first thing that I thought is happening - my PDT IDE is working too slow because of incompatibility with my 64bit OS. I was 100% sure... because PDT "ate" ~80-100% of one of my 4 CPUs. I hate these moments thinking that my QuatroCore SUCKS runing java app :( ... Thanks Lord I was wrong.

Just turn the Outline view OFF and CPU back to 10-20%... too many classes , methods, properties are killing Outline view in Eclipse PDT. Don't keep it constantly open.


Wednesday, September 1, 2010

SD Card size must be at least 9MB

If you receive this error when creating new Android Virtual Device (AVD) even though you've input much more than 9MiB into "SD Card size" field... Consider following advice:

Here is some additional detail on what sizes are considered valid or invalid when generating a new AVD (set to MiB): 0-8: invalid 9-2047: valid 2047-4104: invalid 4105-6143: valid 6144-8200: invalid 8201: valid

Taken from here

Installing Android SDK

What a wonderful day is when you start learning new things...

Today was one of those, cuz I've started with Android SDK. Downloaded (for Windows) it and run "SDK Setup.exe", then wanted to create new Virtual Device (AVD) and failed, cuz "Target dropdown" was disabled and New AVD Wizard complains that is should be selected.

I've started googling, got many advices, most of them too complicated to be true for my situation. From the bottom of my "IMHO" I felt that there should be easier way, and so it was.

I've noticed the error I ignored on the first run, something about "Setup was not able to fetch smth via https"...

So the first thing you should do after downloading and running Android SDK (Windows) , go to Settings and check "Force https:// ... sources to be fetched using http:// ...", then go to "Available packages" and Refresh. There should be more options available under main Repository URL... select them and Install.

Now you have some new Targets available on the "Create new Android Virtual Device (AVD)" Wizard window.

GL & HF