Wed
Apr 30
2008

Upgrading to WordPress 2.5 on BlueHost

WordPress 2.5 was released last month. Why can’t we upgrade using Fantastico? It turns out BlueHost has started their own Fanastico competitor called SimpleScripts. I doubt we’ll be seeing any new Fantastico updates. While Fantastico has had WordPress 2.5 scripts for at least three weeks, BlueHost’s tech support claims they are waiting on Fantastico to release updated scripts. This is the first problem.

The second problem is the recommended migration procedure here and here. It involves FTP clients and pulling database configuration bits from php files. This does not leave a good first impression of a product that is supposed to provide one-click installation and upgrades.

I ended up using the Wordpress Automatic Upgrader Plugin. I still needed to use an FTP client to install the plugin but now I am not dependent on Fanastico or SimpleScripts. This plugin downloads the latest files directly from WordPress so updates should be available as soon as WordPress releases them. I encountered two problems while upgrading to 2.5:

  • The plugin created backups but provided the wrong link to download them. I had to use the FTP client to download them manually. I believe this is because I have installed WordPress into a wordpress\ subfolder rather than into the root.
  • The plugin did not reactivate my plugins. I had to reactivate them manually.

On the positive side, SimpleScripts appears to be a more polished product compared to Fantastico.

Tue
Apr 29
2008

Reset Sequence From Table

This procedure will lookup the maximum value used in a table then set the sequence to this value + 1. Based on code from from http://www.psoug.org/reference/sequences.html.

CREATE OR REPLACE PROCEDURE reset_sequence (
seq_name IN VARCHAR2, startvalue IN PLS_INTEGER) AS
 
cval   INTEGER;
inc_by VARCHAR2(25);
 
BEGIN
  EXECUTE IMMEDIATE 'ALTER SEQUENCE ' ||seq_name||' MINVALUE 0';
 
  EXECUTE IMMEDIATE 'SELECT ' ||seq_name ||'.NEXTVAL FROM dual' INTO cval;
 
  cval := cval - startvalue + 1;
 
  IF cval = 0 THEN
    RETURN;
  ELSIF cval < 0 THEN 
    inc_by := ' INCREMENT BY ' || ABS(cval);
  ELSE
    inc_by := ' INCREMENT BY -' || cval;
  END IF; 
 
  EXECUTE IMMEDIATE 'ALTER SEQUENCE ' || seq_name || inc_by;
 
  EXECUTE IMMEDIATE 'SELECT ' ||seq_name ||'.NEXTVAL FROM dual' INTO cval;
 
  EXECUTE IMMEDIATE 'ALTER SEQUENCE ' || seq_name || ' INCREMENT BY 1';
 
END reset_sequence;
/
 
CREATE OR REPLACE PROCEDURE reset_sequence_from_table (
seq_name IN VARCHAR2, column_name IN VARCHAR2, table_name IN VARCHAR2) AS
 
cval   INTEGER;
 
BEGIN
 
  EXECUTE IMMEDIATE 'SELECT MAX(' || column_name ||') FROM ' || table_name 
  INTO cval;
 
  IF (cval IS NULL) THEN
    cval := 1;
  ELSE
    cval := cval + 1;
  END IF;
 
  RESET_SEQUENCE(seq_name, cval);
 
END reset_sequence_from_table;
/

Setup some test data to verify the proc:

DROP sequence mytable_seq;
DROP TABLE mytable;
 
CREATE TABLE mytable ( id NUMBER );
CREATE sequence mytable_seq;
 
INSERT INTO mytable VALUES (1);
INSERT INTO mytable VALUES (2);
INSERT INTO mytable VALUES (3);
INSERT INTO mytable VALUES (4);
INSERT INTO mytable VALUES (5);
INSERT INTO mytable VALUES (6);
INSERT INTO mytable VALUES (7);
INSERT INTO mytable VALUES (8);
INSERT INTO mytable VALUES (9);
INSERT INTO mytable VALUES (10);
 
SELECT mytable_seq.NEXTVAL FROM dual;
SELECT mytable_seq.NEXTVAL FROM dual;
SELECT mytable_seq.NEXTVAL FROM dual;
SELECT mytable_seq.NEXTVAL FROM dual;
SELECT mytable_seq.NEXTVAL FROM dual;
SELECT mytable_seq.NEXTVAL FROM dual;
SELECT mytable_seq.NEXTVAL FROM dual;
SELECT mytable_seq.NEXTVAL FROM dual;
SELECT mytable_seq.NEXTVAL FROM dual;
 
COMMIT;

A test:

exec reset_sequence_from_table('MYTABLE_SEQ', 'ID', 'MYTABLE');
 
-- should return 11 because mytable has a record with id 10
SELECT mytable_seq.NEXTVAL FROM dual;
Sun
Apr 6
2008

Canon Elph on Steroids

The open source project CHDK has built firmware enhancements for many of Canon’s compact cameras. Some features:

- RAW support
- Extra fast/slow shutter speeds
- In-camera scripting language
- DOF calculator
- AutoISO based on focal length
- Exposure bracketing
- Live histogram
- Highlight clipping indicators
- Detailed battery level indicator
- Teathered shooting
- Loads from SD card on power-up (no permanent changes to firmware)

Some first impressions… The UI is organized but far from user friendly. Lightroom cannot open the RAW files. At high shutter speeds the flash power was too high and there was no flash compensation. I ended up holding a white envelope in front of the flash. I tried taking some high speed photos with the new firmware on my Canon SD500. The best photo was taken with the stock firmware. The high speed shutter wasn’t needed for this shot – the focus and timing were more important. These photos were taken in daylight with no additional lighting beyond the flash.

Canon SD500 with CHDK (1/4000s)
Water drops with SD500 and CHDK firmware (1/4000)

Canon SD500 (1/60s)
Water drops with Point and Shoot

Nikon D40 (1/500s)
Water drops with SLR

I think I will keep it on my camera for the extra information on the display and the scripting. A few links: installing, download, usage, more usage info

© 2009 Brian Low. All rights reserved.