2 quick tips; Apex shared LOV and Autocomplete (video tutorials)

Here are 2 simple tips for Application Express. Watch the short videos for a hands-on tutorial.

1) creating a Shared LOV from a LOV in an item.

http://www.youtube.com/watch?v=oQv9DDcZt4U

This is especially useful if you created an item LOV and discover you want to use it in othet places too.

2) Create a dynamic autocomplete field.

How to create a dynamic autocomplete field.

 

One quick way to convert decimals in Excel

I frequently use the “text to columns” feature in MS Office 2007 and higher. Usually I paste csv or other delimited data in the first column, and use the Text to Column wizard to convert it to individual columns. It’s also very useful for converting decimals. Regional settings and the use of decimals can be a real pain, especially when importing data from various sources. Usually the solution is to change decimal settings in Excel, or even in your operating system (regional settings). I do not understand why there is no feature in Office to interpret a field as a number regardless of the decimal separator, but fortunately there is a workaround.

The case here is that the number value is not recognized correctly, for instance a field contains 24.67 and Excel thinks it’s not a number.

The solution is to apply the Text to columns to the erroneous column again. See what happens.

You can find the button here (I use Office for Mac, so it might look different for you):

In the example below, the point is not recognized as a decimal point. Apparently, Excel accepts only comma’s here (might be the other way around in your case).

 Select the column first.

Click the Text to Columns button, then select the “delimited” option, click next. Click next again. You’ll see this page:

Now click “Advanced…”.

Hah, I may choose a decimal and thousands separator. Change the decimal to a dot, and the thousands separator to a comma. Or again, the other way around. The trick is that you tell Excel here which character is a decimal, and not what it should be. A bit confusing, eh.

Click OK to leave the wizard. And, tad-aah:

These look like real numbers to me. Patrick vs. Excel: 1-0.

convert decimals in Excel

Tuning The Time Machine

I’ve been using the OS X Time Machine for over 2 years now, and it has proven itself to be hassle free and easy to use.

I found a few tweaks though I would like to share with you. Applying them might make your Time Machine backup even faster, and also smaller.

In the Time Machine Preferences I’ve excluded some directories for backup.

To do this, go to your Time Machine preferences and click the “Options” (or Opties, in Dutch) button:

The following screen appears:

 

As you see, I’ve added some directories which I do not need Time Machine to handle, because I take care of the backups myself.  Simply press the “+” sign button and enter a location.

Other locations only contain cachefiles, which are ok to loose in case of emergency. The most important are:

˜/Library/Caches and
/Library/Caches

This contains all the OS X cachefiles (for user data and application data). They help you speed up OS X performance, but will be rebuild when they are deleted or lost. Because this directory may contain gigabytes of data, it’s a good candidate for exclusion. I read somewhere the caches directories are already excluded by TM by default. Ah well, better be safe than sorry.

When you use Adobe Lightroom, you may also want to exclude the Lightroom Catalog Previews. The filename may have a slightly different name on your system, but it is located in your Lightroom catalog directory, probably something like:

<your lightroom catalog path>/Lightroom 2 Catalog Previews.lrdata

This file contains a preview cache for your Lightroom images, is at least hundreds of megabytes in size and changes everytime you open a file in Lightroom.

Another culprit for filling up your backup drive really quickly is iTunes’ Podcasts directory. Exclude it and it’ll save you at least a few hunderd megs.

Additionally, you can do the same for your Garageband data ( /Library/Application Support/Garageband ) and iPhoto themes ( /Library/Application Support/iPhoto ). Don’t worry, you can reinstall them from your iLife disc, if necessary.

 

Apparently… Spotify is coming for linux too.

Check this page: https://www.spotify.com/nl/download/previews/.

If you follow the instructions (I’ve copied them here for your convenience) Spotify is installed in the Linux distro of your choice. I tried with Ubuntu 11.10 and it works. You need a Premium or Unlimited account though.

# 1. Add this line to your list of repositories by 
#    editing your /etc/apt/sources.list
deb http://repository.spotify.com stable non-free

# 2. If you want to verify the downloaded packages,
#    you will need to add our public key
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4E9CFF4E

# 3. Run apt-get update
sudo apt-get update

# 4. Install spotify!
sudo apt-get install spotify-client-qt

Why my next phone will not be an Android.

It is now about a year ago that I got my first smartphone. It’s a HTC Legend. It’s got a reasonable sized 3.2 inch screen, a nice sturdy unibody design, and reasonable battery life. For a smartphone, that is. At first, I was as happy as a grown man can be with his new gadget. It’s true, information is but a touch at the screen away, and there are so many usefull apps out there.

Lately, however, my enthousiasm has been evaporating rapidly. Not because I got tired of those endless possibilities, but more because access to this world of information gets more and more inhibited by all the little bugs in Android. And not only the OS appears flawed,  but the device too. It’s probably underpowered in CPU, or in memory. But why bring it on the market, if it just isn’t up to the tasks it’s designed for? And who should I blame for it? Android? Or HTC? Or both?

Anyway, here’s a list of problems I’ve encountered lately. And they sum up why I will stay away from both Android and HTC the next time I choose a new phone. Which will be soon, by the way.

1. no software updates

A model which is released in februari 2010 with Android 2.1 barely gets the 2.2 update in october of the same year. Future updates? Forget it. Apparently, the support ends the moment the next model is released. Which is soon, these days. I know a type of phone which is over 3 years old and still gets major updates at the time of writing. *cough* iPhone 3g *cough*

2. Finding a GPS signal takes forever

There you are, lost in the city of your choice. Fortunately, you got this great smartphone with Google Maps and GPS. Well, not with my phone. It may take 5-10 minutes to get a signal, even with a lot of blue sky above me. But often, it’s not gonna happen. Or maybe after a reboot.

3. Spontanous reboots and crashes, almost daily

A day without a spontanous reboot is a day not lived. They should have used a blue background for that, just for nostalgia.

4. pinching and zooming on websites almost does not work

I think this is because of the slow processor, but even scrolling is laggy. Hey, I was able to scroll a webpage on my Intel 486, 15 years ago. So that’s not an excuse. Oh, and I can forget about Flash too (I’m pretty ok with that, to be honest).

5. HTC Sense interface takes too much resources and cannot be turned off

Most reviewers are enthousiastic with the Sense interface. I am not. It adds little value compared to other, much more lightweight interfaces and is pretty heavy.

6. installing of applications is restricted to limited amount of internal memory

This is typical for HTC, as far as I know. Apparently Samsung has a  better architecture at this point. Anyway, sooner or later you can’t install any more apps. Or updates of apps. And although you can install part of most apps to the SD card, the biggest memory hogs – Googles apps like Maps and Plus – can’t be installed to SD at all. Additionally, synchronization of most of or all of your apps stops working when the ‘memory is low’ icon appears in the status bar. Strange. My car still starts when the fuel gauge is on ‘reserve’.

7. Interface is slow and laggy

Every touch on the screen may take seconds. From the unlock-pattern to the “clear messages” button. When I start or stop bluetooth, the entire phone hangs for 10 seconds. Annoying!

8. no connection to internet for some apps, for no apparent reason.

Well, this was a problem I had for weeks, and now it works okay for a few days already. Odd.  Although you’d expect it to be a problem with the 3g signal, usually it happens with the wifi signal. Another great feature with wifi is that it usually picks the weakest Wifi signal in the buidling. How cool is that?

 

I know this was a bit of a rant. Sorry, it will not happen again. I also know the new Samsung Galaxy phones with Android are pretty good. Now I go and save up for an iPhone.

Optimizing Oracle SQL performance using an inline view!

In our production environment, we have a process that runs for about 30 minutes, and may even take hours on busy days. Way too long of course!
I’ve been rewriting this function this week, and finally brought it back to a matter of minutes by using a materialized view and a more efficient query.
Still, I think nowadays most data should be available instantanious, if possible. So, a few minutes is way too long.

I have 2 tables, tabel A with 2.4 million records, materialized view B with 82000 records. The materialized view is a joined subset of 3 tables containing about 240.000 records each.

Here’s the culprit:

SELECT last_name,
   date_of_birth ,
    bsn 
  FROM mat_view
    JOIN table_a 
  ON mat_view.fk_id = table_a.fk_id
WHERE mat_view.fk2_id = :BIND

optimizing Oracle SQL performance using an inline view

Not too bad I thought. Relatively small view, Oracle knows how to handle this! The result was lots of full table scans and hash joins, and of course a high cost. After giving it some thought, I remembered the thing called inline views. Maybe they would bring Oracle to some other thoughts about the execution path.

As you see in the query below, I’ve rewritten the join with the materialized view + bind variable to a join with an inline view. I now force Oracle to first fetch a tiny subset of the materialized view. This subset is joined on foreign keys to the large table, which performs like a breeze.

SELECT last_name,
 date_of_birth ,
 bsn
 FROM
 ( SELECT * FROM mat_view WHERE fk2_id =:BIND
 ) gpl
 JOIN table_a
 ON gpl.fk_id = table_a.fk_id

Fortunately, this did the trick. Believe it or not, this query gives instantanious result, instead of in minutes. The drawback is that I needed to add some extra, quite complex clauses, so the responsetime is now about 2-3 seconds. In the end, not bad compared to the 30 minutes we started with!

You can read more about Oracle inline views here. That page also describes the subtle difference between subqueries and inline views. Also check Tom Kyte’s thoughts on the With clause, which is similar but even more powerful.

de hypocrisie van de telco’s [Dutch]

Het kan je niet ontgaan zijn, de laatste tijd klagen de telco’s in Nederland steen en been. Mobiel dataverkeer is de laatste 2 jaar flink toegenomen en als we ze moeten geloven, is dat duuuuuur.

Ik wil de ontwikkelingen in telco land niet goed praten, integendeel, maar in hoeverre zijn de hoge kosten voor de UMTS veilingen indertijd hier de oorzaak van? Volgens mij moesten de telco’s samen bijna 6 miljard euro ophoesten voor die licenties.  €400 per hoofd van de bevolking. Dat moet toch een keer betaald worden. Aan de andere kant schijnt dit (ook per hoofd van de bevolking) stukken minder te zijn dan in Duitsland, België en andere omringende landen, en daar kan het blijkbaar wel goedkoper.  Zie bijvoorbeeld dit artikeltje op Bright.

Ik kan uiteindelijk geen medelijden met de grote jongens hebben. Zij hebben altijd reclame gemaakt met hun ‘overal altijd online’, Youtube filmpje kijken in het park en videobellen met iedereen. Prachtig toch? Allemaal binnen jouw handbereik, en allemaal voor een prikkie per maand. Gratis toestelletje erbij, wij doen niet moeilijk.  Dat is het beeld wat ze zelf gecreëerd hebben. Nu mensen dat ook daadwerkelijk gaan doen, is het licht ineens aan in het kippenhok.

Hadden ze dit niet aan zien komen dan? Ik geloof er niks van, dit hadden ze moeten zien aankomen. Tegen iedereen die nu een nieuw abonnement nodig heeft zeg ik: stem met je voeten en laat je niet uitkleden. En heb je nog zo’n goedkoop abootje: wees er zuinig op. Die telefoon kan je tegenwoordig toch beter zelf kopen.

Misschien verandert er hierdoor één ding in Nederland: de beperkte dekking van open Wifi netwerken. Opvallend, in het buitenland kan je al in elk winkelcentrum, tankstation of café gratis internetten, terwijl je hier verbannen wordt naar de MacDonalds voor enige connectie met de virtuele buitenwereld.

installing Oracle SQL Developer on OS X Lion/Mountain Lion

Last week I installed OS X Lion, which was great fun. I’m not going to say it is revolutionary, but it certainly has some nice improvements. One particular issue often mentioned on the internet, is that some software stops working on OS X Lion or Mountain Lion.

I needed Oracle SQL Developer, so downloaded the installer from Oracle Technet. To my surprise, it wouldn’t start. It would be very inconvenient if SQL Developer would be broken under OS X for me! After some research I found that OS X Lion does not have a Java Runtime, and SQL Developer does need one.

You might want to check your log files too. I found that SQL Developer generated a whopping 30 gigabytes of logfiles when it couldn’t find the java runtime.

Installing is simple. Go to your terminal, enter java -version and press enter. Voila, OS X asks if you want to install the JRE. Of course you want to! Press Yes and you’re all set to go. Enjoy.

creating an iso from a disk in OS X

When you quickly want to create an ISO image from a CD or DVD disk, simply do the following:

  1. insert the disk in your optical drive (yeah, I know this is obvious!)
  2. open the Disk Utility (Schijfhulpprogramma in Dutch)
  3. Go to Folder in the menu (Archief in Dutch)
  4. Then select New > Image from “<diskname>” (Nieuwe > Schijfkopie van “<schijfnaam>” in Dutch)
  5. Choose the options “Dvd/cd-master” with encoding “None” (Schijfkopiestructuur and Codering in Dutch). Save it to your Desktop (default location), and give a name, for instance DiskImage
  6. The Disk Utility will create a DiskImage.cdr at your desktop. Grab a coffee, there’s plenty of time.
  7. Now we will convert it to an image, with some help from the command prompt.
  8. Open a terminal window. Type Command+Space, then type Terminal, and press enter.
  9. In the terminal window, type the following commands:
cd ~/Desktop
hdiutil makehybrid -iso -ov DiskImage.iso DiskImage.cdr

This will take a few minutes, again. When it is finished, you may close the terminal.

If you foresee that you will need this disk in a Windows environment, you might want to consider making a joliet hybrid.

To do this, change the command above to the following:

cd ~/Desktop
hdiutil makehybrid -iso -joliet -ov DiskImage.iso DiskImage.cdr

You’re done! Now you have created an iso image of your disk. You can write it to a  recordable at a later time, or open it directly bij doubleclicking the file. This works in both OS X and Ubuntu Linux. Windows has no built-in solution for opening .ISO files.

A classic example of over-engineering your software

Sometimes I encounter a typical example of what I call “over-engineering”. Someone has been enthusiastically designing a webpage, and added a few business rules too many.

The example below could have been funny if the consequences weren’t so dangerous.

I was creating an account on the Vodafone 360 site. When I provided my password, I noticed they had a “password security indicator”. I was also pleased to see that I entered an extremely safe password; 4 out of 4!!
Then I got this message:

how not to restrict a password

It says, my password is restricted to digits and characters only. And apparently, only capitals too. Isn’t that odd? It severely restricts me in providing a safe password, and it violates every guideline ever created about passwords.

Shouldn’t any designer who thinks of such a rule shouldn’t be fired on the spot? I mean, what was he thinking?  The password strength isseriously reduced by limiting the allowable characters. The math is simple: a single character can be any key on your keyboard; digits, lowercase letters, uppercase letters, and symbols. A total of, let’s say 100 characters.

A one-character password can have a hundred combinations. A two-character password already a hundred times hundred (100²), or 10.000 combinations. And a three-character password 100³ combinations, summing up to 1 million. If I apply the restriction on this site, I can use 27+10=37 characters. 37³ =  a maximum of 50653 combinations. Or 20 times less!

By using this site you acknowledge the use of cookies (which are mostly harmless, btw) More information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below you are agreeing to these settings.

Close