Wednesday, December 23, 2009

This could be good or catastrophic

(Emphasis Mine)
Microsoft patents anatomically correct avatars: "Accurate avatars will facilitate online honesty"

"The new systems include provisions for sensing physical data (via pedometers, cameras, or health information repositories like Microsoft HealthVault) psychological characteristics (including levels of alertness or mood changes) and even demographic information like "education level, geographic location, age, sex, intelligence quotient, socioeconomic class, occupation, marital/relationship status, religious belief, political affiliation, etc."
"Physical data that reflect a degree of health of the real person can be linked to rewards of capabilities of a gaming avatar, an amount of time budgeted to play, or a visible indication," reads the summary. "Thereby, people are encouraged to exercise."

I think I am scared by the implications of this - only time will tell.
I can see evil lurking. Can You?

Monday, December 14, 2009

Finally we are catching up with plumbers and builders

Cash offer sees Citrix staff bring their own computers to work
The company initiated an employee-owned IT programme earlier this year. Citrix offers $US2,000 to employees to buy their own work/home PC under the scheme, dubbed ‘Bring Your Own Computer (BYOC)’. The stipulation: The computer must have a minimum three-year support and maintenance contract.

BTW yes I do think I can choose my own PC better than a head office IT person. As long as this is an annual 'tools allowance' I would be the first to sign up.

How the other half thinks (tune in next year)

Think Like a Developer & Designer Series
The “Think Like A...” series is a collection of topics presenting a developer's point of view and a designer's point of view on what goes into making a WEB 2.0 website. The purpose of this series is to help developers understand and appreciate a designer's viewpoint on creating a website, and on the flip side, to help designers understand and appreciate a developer’s viewpoint on creating a website.

Wednesday, November 25, 2009

Oracle VS SQL debug

Can you spot the difference?




            || CHR(9) || 'PATAL_REFNO');
                 || CHR(9) || TO_CHAR(c1.PATAL_REFNO) );

Thursday, November 12, 2009

Why Oracle Sux

v_First VARCHAR2(20) := NULL;
v_Second VARCHAR2(20) := '';
v_Third VARCHAR2(20) := 'Something';
v_Blank VARCHAR2(2) := '';
v_Junk VARCHAR2(2) := '&~';
-- you need to run the following once, on it's own to make DBMS_OUTPUT.PUT_LINE work
-- what a shame there is no PRINT statement like a real database

-- proving NVL does not work with '' as the value
IF NVL(v_First,'')  = '' THEN DBMS_OUTPUT.PUT_LINE ( 'NULL = "" Works'); END IF;
IF NVL(v_Second,'') = '' THEN DBMS_OUTPUT.PUT_LINE ( '"" = "" Works'); END IF;
IF NVL(v_Third,'') <> '' THEN DBMS_OUTPUT.PUT_LINE ( 'Something != "" Works'); END IF;
-- proving NVL does not work with a variable containing ''
IF NVL(v_First,v_Blank)  = v_Blank THEN DBMS_OUTPUT.PUT_LINE ( 'NULL = Blank Works'); END IF;
IF NVL(v_Second,v_Blank) = v_Blank THEN DBMS_OUTPUT.PUT_LINE ( '"" = Blank Works'); END IF;
IF NVL(v_Third,v_Blank) <> v_Blank THEN DBMS_OUTPUT.PUT_LINE ( 'Something != Blank Works'); END IF;
-- proving that Oracle is junk, as other <> '' values do the trick
IF NVL(v_First,v_Junk)  = v_Junk THEN DBMS_OUTPUT.PUT_LINE ( 'NULL = Junk Works'); END IF;
IF NVL(v_Second,v_Junk) = v_Junk THEN DBMS_OUTPUT.PUT_LINE ( '"" = Junk Works'); END IF;
IF NVL(v_Third,v_Junk) <> v_Junk THEN DBMS_OUTPUT.PUT_LINE ( 'Something != Junk Works'); END IF;
NULL = Junk Works
"" = Junk Works
Something != Junk Works


Wot - me biased?

SQL Server - Oracle FAQ: "SQL Server"

Possibly the most xenophobic piece of community written drivel I have ever seen.

Thursday, October 29, 2009

ViewState 101

TRULY Understanding ViewState - Infinities Loop
ViewState is a very misunderstood animal. I would like to help put an end to the madness by attempting to explain exactly how the ViewState mechanism works, from beginning to end, and from many different use cases, such as declared controls vs. dynamic controls.

Wednesday, October 21, 2009

I wish I had written this

Five Simple Database Design Errors You Should Avoid

Clear, concise and on the money.

This article covers:

(1) Common Lookup Tables
(2) Check Constraint conundrum
(3) Entity-Attribute-Value Table
(4) Application Encroachments into DB design
(5) Misusing Data values as Data Elements

Monday, October 05, 2009

Fun with triggers

What Happened:
1) Insert occurs - fires insert trigger (value 10)
2) Insert trigger updates record (value = 20) - fires update trigger
3) Update trigger updates record (value = 30) this does NOT fire a recursive call to the trigger
4) Update trigger writes hist record
5) Original insert trigger writes hist record
Hmmm interesting....


CREATE TABLE [dbo].[MainTable]
( [MainTableID] [int] IDENTITY(1,1) NOT NULL
, [TheValue] [int] NOT NULL


CREATE TABLE [dbo].[MainTable_Hist]
( [MainTable_HistID] [int] IDENTITY(1,1) NOT NULL
, [Created] [datetime] NOT NULL
, [MainTableID] [int] NOT NULL
, [TheValue] [int] NOT NULL


CREATE TRIGGER [dbo].[trgMainTable_UPD]
ON [dbo].[MainTable]

      , @ThisID AS INT

SELECT @ThisID = MainTableID
     , @ThisValue = TheValue
FROM inserted

IF ( @ThisValue < 100 )
  UPDATE dbo.MainTable
  SET TheValue = @ThisValue + 10
  WHERE MainTableID = @ThisID

  INSERT INTO [dbo].[MainTable_Hist] ( [MainTableID], [TheValue] )
  SELECT MainTableID, TheValue
  FROM Inserted

CREATE TRIGGER [dbo].[trgMainTable_INS] ON [dbo].[MainTable]
    DECLARE @ThisValue AS INT

    SELECT @ThisID = MainTableID , @ThisValue = TheValue
    FROM inserted IF ( @ThisValue < 100 )

    UPDATE dbo.MainTable
    SET TheValue = @ThisValue + 10
    WHERE MainTableID = @ThisID

    INSERT INTO [MainTable_Hist] ( [MainTableID], [TheValue] )
    SELECT MainTableID, TheValue
    FROM Inserted

INSERT INTO [MainTable] ( [TheValue] ) VALUES ( 10 )

SELECT * FROM [MainTable] ORDER BY MainTableID

MainTableID TheValue
1           30 

SELECT * FROM [MainTable_Hist] ORDER BY MainTable_HistID

MainTable_HistID Created                  MainTableID  TheValue
1                2009-10-05 14:33:02.553  1            20
2                2009-10-05 14:33:02.553  1            10

Tuesday, September 29, 2009

SQL Stupidity

So you are logged on to SQL Management studio.
The user you are logged in as has database X as the default database
Now you detach that database... and you are stuck - the connection fails, you can't do anything.


A warning would have been nice.

SOLUTION: Connect as another user and set the default database to something else then re-connect.

Thursday, July 02, 2009

Open Government and Local body data

Open Data Catalogue is an open, independent catalogue of Government and Local Body datasets

Looking to download the latest list of Primary Schools? Want to find out the average market rents for Dunedin suburbs and use these in a report? Are you interested in the boundaries of your suburb? If the answer is yes then you may find some of this information hard to come by. Even though this information should be easy to obtain it is sometimes hard to find who to talk to, where to look and worse hidden behind pay-walls and restrictive license agreements. The Open Data Catalogue is an attempt to classify where this information resides, who ‘owns’ it, what license it is distributed under and if it is free or not.

Including SPATIAL datasets

Wednesday, June 03, 2009

marriage advice for IT peeps

CIO > Why (some) IT people's marriages are from hell
With the right type of communication, and by taking small, proactive measures to demonstrate that they're thinking about their spouses, IT leaders can have happier, more satisfying marriages, says a psychoanalyst turned life coach.

Wednesday, May 27, 2009

Elegant solution for juggling windows

WinSplit Revolution: "WinSplit Revolution is a small utility which allows you to easily organize your open windows by tiling, resizing and positioning them to make the best use of your desktop real estate."

WinSplit Revolution is freeware. Some Rights Reserved.

Tuesday, May 05, 2009

Usability Testing

Usability Testing With 5 Users
The ultimate user experience is improved much more by three tests with 5 users than by a single test with 15 users

Friday, April 24, 2009

Cut 8 wires and see what happens

Bruce Perens - A Cyber-Attack on an American City

The city of Morgan Hill and parts of three counties lost 911 service, cellular mobile telephone communications, land-line telephone, DSL internet and private networks, central station fire and burglar alarms, ATMs, credit card terminals, and monitoring of critical utilities. In addition, resources that should not have failed, like the local hospital's internal computer network, proved to be dependent on external resources, leaving the hospital with a "paper system" for the day.

The rest of the article is very interesting.

Tuesday, April 14, 2009

Oracle debug - output a CRLF delimited block of text

v_crlf CHAR(2):=CHR(13) || CHR(10);

v_RemainingText:=v_Orig_Text || v_crlf ;
WHILE length(v_RemainingText) > 1 LOOP
    v_RemainingText:=substr( v_RemainingText
                           , v_crpos+2
                           , length(v_RemainingText)-(v_crpos+1)

Friday, March 13, 2009

Fun with Foreign Keys

SELECT object_name(SR.rkeyid) AS Master
     ,                AS Master_Column
     , object_name(SR.fkeyid) AS Child
     ,                AS Child_Column
     , object_name(SR.constid)AS FK_Name

FROM       sysreferences SR
INNER JOIN sys.columns   RC ON RC.Object_ID = SR.rkeyid AND RC.Column_ID = SR.rkey1
INNER JOIN sys.columns   FC ON FC.Object_ID = SR.fkeyid AND FC.Column_ID = SR.fkey1
ORDER BY object_name(SR.rkeyid)
       , object_name(SR.fkeyid)