Monthly Archives: February 2006

Smooth scrolling image list

I had someone ask me about fitting more images in a small area and the way flickr does their image scrolling came to mind. I wanted to see how hard it was to do and as it turns out it isn't hard to do at all thanks to script.aculo.us.

I'm making this as simple as I can to illustrate just how nice the new tools like script.aculo.us are.

Step 1. You need a box and some images. You will also need to know the size of the images or at least the size of the largest one. In an attempt to keep this simple I'm going to assume all the images are the same size.

Continue reading

No javascript detection

Have you ever wondered what you can do if someone doesn't have javascript turned on and it is needed on the page they are sitting at? Well here is the answer:

<html>
  <head>
    <noscript><meta http-equiv="refresh" content="0; URL=nojscript.html"/></noscript>
  </head>
  <body>
    A javascript test.
  </body>
</html>

If the user doesn't have javascript turned on they will be redirected to the page nojscript.html. It doesn't work as well as having a page in between that does the detection but if you have to do it on the page you need the javascript on this is the way to go.

Tags:

Fun with Oracle Strings

Today I needed to find a way to count the number of unique email domains in a table. I figured there was a way of getting the index of a string in another string and sure enough there is. This did the trick in Oracle:

SELECT count(1), SUBSTR(email, INSTR(email, '@', 1, 1)+1) FROM SOMETABLE GROUP BY SUBSTR(email, INSTR(email, '@', 1, 1)+1) ORDER BY count(1) DESC

The INSTR function gives you the location in a string where another string is located. See the following link for more on the INSTR function: http://www.techonthenet.com/oracle/functions/instr.php

I've always found the way Oracle handles case interesting. It looks like they are changing things a little starting with 10G: http://blogs.ittoolbox.com/database/solutions/archives/005951.asp

Tags:

JDBC + Batch updates + Non-Standard == Oracle

I recently ran into an issue where doing a large number of inserts and updates in an Oracle 8i database was taking forever. I was already using a prepared statement and commiting only after a certain number of rows. After some digging I found out that there is a special Oracle way of doing batch updates that made things a good bit faster. They do support the normal addBatch batch updates but it isn't as fast as using their special way.

Continue reading