Wow.. it's lunch time Friday, and I'm setting to go home for the week already.
I managed to get away with only doing annoying stuff at work this week, so nothing interesting to report here.
Next week is going to be more interesting, as I start working on the Stargate site updates, and Stargate Street Team things.
FUN!
BFN
Friday, August 31, 2007
Tuesday, August 28, 2007
Busyness vs Postyness
I've been doing tons of stuff, just nothing worth blogging about. How sad!
Going to Pageant of the Masters today in Laguna Beach. Woot!
BFN.
Going to Pageant of the Masters today in Laguna Beach. Woot!
BFN.
Wednesday, August 22, 2007
My power is recognized!
For some reason, fans of the show think that someone besides me, creates, and monitors the results of the polls.
http://forum.gateworld.net/showthread.php?t=46382
You may now refer to me as the all powerful!
Accepting ideas for new polls.
BFN
http://forum.gateworld.net/showthread.php?t=46382
You may now refer to me as the all powerful!
Accepting ideas for new polls.
BFN
Friday, August 17, 2007
Thursday, August 9, 2007
Oracle doesn't like autoincrement
Well, it's not that it doesn't "like" it, it just doesn't do it.
Here's what I am gonna do instead, loveingly stolen from http://www.lifeaftercoffee.com/2006/02/17/how-to-create-auto-increment-columns-in-oracle/
First let’s create a simple table to play with.
SQL> CREATE TABLE test
(id NUMBER PRIMARY KEY,
name VARCHAR2(30));
Table created.
Now we’ll assume we want ID to be an auto increment field. First we need a sequence to grab values from.
SQL> CREATE SEQUENCE test_sequence
START WITH 1
INCREMENT BY 1;
Sequence created.
Now we can use that sequence in an BEFORE INSERT trigger on the table.
CREATE OR REPLACE TRIGGER test_trigger
BEFORE INSERT
ON test
REFERENCING NEW AS NEW
FOR EACH ROW
BEGIN
SELECT test_sequence.nextval INTO :NEW.ID FROM dual;
END;
/
Trigger created.
This trigger will automatically grab the next value from the sequence we just created and substitute it into the ID column before the insert is completed.
Now we’ll do some inserts:
SQL> INSERT INTO test (name) VALUES ('Jon');
1 row created.
SQL> INSERT INTO test (name) VALUES (’Bork’);
1 row created.
SQL> INSERT INTO test (name) VALUES (’Matt’);
1 row created.
SQL> SELECT * FROM test;
ID NAME
———- ——————————
1 Jon
2 Bork
3 Matt
Because the sequence is updated independent of the rows being committed there will be no conflict if multiple users are inserting into the same table simultaneously.
Later.. how do I get this value out??
BFN
Here's what I am gonna do instead, loveingly stolen from http://www.lifeaftercoffee.com/2006/02/17/how-to-create-auto-increment-columns-in-oracle/
First let’s create a simple table to play with.
SQL> CREATE TABLE test
(id NUMBER PRIMARY KEY,
name VARCHAR2(30));
Table created.
Now we’ll assume we want ID to be an auto increment field. First we need a sequence to grab values from.
SQL> CREATE SEQUENCE test_sequence
START WITH 1
INCREMENT BY 1;
Sequence created.
Now we can use that sequence in an BEFORE INSERT trigger on the table.
CREATE OR REPLACE TRIGGER test_trigger
BEFORE INSERT
ON test
REFERENCING NEW AS NEW
FOR EACH ROW
BEGIN
SELECT test_sequence.nextval INTO :NEW.ID FROM dual;
END;
/
Trigger created.
This trigger will automatically grab the next value from the sequence we just created and substitute it into the ID column before the insert is completed.
Now we’ll do some inserts:
SQL> INSERT INTO test (name) VALUES ('Jon');
1 row created.
SQL> INSERT INTO test (name) VALUES (’Bork’);
1 row created.
SQL> INSERT INTO test (name) VALUES (’Matt’);
1 row created.
SQL> SELECT * FROM test;
ID NAME
———- ——————————
1 Jon
2 Bork
3 Matt
Because the sequence is updated independent of the rows being committed there will be no conflict if multiple users are inserting into the same table simultaneously.
Later.. how do I get this value out??
BFN
strtotime in PHP doesn't work on dates before 1970
I learned a new lesson today! The PHP function strtotime does not work on dates prior to 1970.
Isn't that awesome!
Since we have super special date format from Oracle, I had to turn 23-NOV-54 into Nov 23, 1954.
I did it the long way.. don't ask me why?!
BFN
Isn't that awesome!
Since we have super special date format from Oracle, I had to turn 23-NOV-54 into Nov 23, 1954.
I did it the long way.. don't ask me why?!
$pieces = explode("-", $propRDate);Anyhow.. fun fun,
//make the month mixed case
$propRMonth=$pieces[1];
$propRMonth=strtolower($propRMonth);
//don't know why, but it doesn't work to just to ucfirst, I have to strtolower first.
$propRMonth=ucfirst($propRMonth);
//now lets make the year's 4 digit!
if (($pieces[2] > 0) and ($pieces[2] < 20)) {
//then it's 19
$propRYear="20".$pieces[2];
} else {
$propRYear="19".$pieces[2];
}
$propRDate = $propRMonth." ".$pieces[0].", ".$propRYear;
BFN
Wednesday, August 1, 2007
Restructure, Redesign, better, faster, stronger!
Today is the day, when finally, after all these months working here (jeez almost a year?!) I'm going to finalize the redesign of the database.
This redesign will allow us to properly associate movie titles with each other, and with their products (DVD's, theatrical releases, blu-ray etc).
It is a momentous occasion. Only real problem now is when the DBA checks it over.. *le sigh* Me being a developer and not a DBA means usually real DBA's think my DB's are crap.. even though they make writing a website for me real real easy!
BFN
This redesign will allow us to properly associate movie titles with each other, and with their products (DVD's, theatrical releases, blu-ray etc).
It is a momentous occasion. Only real problem now is when the DBA checks it over.. *le sigh* Me being a developer and not a DBA means usually real DBA's think my DB's are crap.. even though they make writing a website for me real real easy!
BFN
Subscribe to:
Posts (Atom)