Spotted: New version of the jquery-json plugin.

December 15, 2009 by Reboot · Leave a Comment 

http://code.google.com/p/jquery-json/

Changes in Version 2.0

  • The code has been re-written. It is now easier to read and follow; less of a mish-mash.
  • Support for native JSON has been included. This means that if you are using a browser that supports JSON.stringify, it will be used. Also evalJSONand secureEvalJSON will use JSON.parse if available.
  • Changes were made in the JSON output to move in line with the JSON object standard. This means 2.0 is not backwards compatible with the previous versions.
  • toJSON now renders like compactJSON used to and compactJSON does not exist anymore. As per the JSON object standard, needless spaces are now removed. This makes it less readable; if someone wants to send me a prettyJSON patch, it will be welcome.
  • Differences between output when JSON.stringify is available and when it is not could exist. I am unable to test all strings. Be aware when testing your apps.

Conditional Unique Index (on the PersonName in HR-XML)

December 14, 2009 by Reboot · Leave a Comment 

Using a HR-XML schema as a database schema in Oracle, an “only 1 current name (or birthname) allowed per person” restriction on the PersonName table can be implemented by using the following code snippet:

create or replace function SingleCurrentName(
       NameTypeCode in varchar2,
       PersonID in varchar2
       )
return varchar2
DETERMINISTIC
  as
  begin
      if ( NameTypeCode = 'currentname' or NameTypeCode = 'birthname')
      then
          return PersonID || '/' || NameTypeCode;
      else
          return null;
      end if;
  end SingleCurrentName;

-- Create personname unique index
create unique index personnames_idx_1 on personnames( singlecurrentname(nametypecode,personid) );

-- Test unique index, should PASS
declare
   v_personid varchar2(36);
begin
   v_personid := get_formatted_guid;
   insert into persons (personid) values (v_personid);

   insert into personnames (personnameid, personid, nametypecode, formattedname)
   values (get_formatted_guid, v_personid, 'currentname', 'John Doe');

   insert into personnames (personnameid, personid, nametypecode, formattedname)
   values (get_formatted_guid, v_personid, 'birthname', 'John Doe');

   insert into personnames (personnameid, personid, nametypecode, formattedname)
   values (get_formatted_guid, v_personid, 'alias', 'John Doe');

   insert into personnames (personnameid, personid, nametypecode, formattedname)
   values (get_formatted_guid, v_personid, 'alias', 'John Doe');
end;
-- Test unique index, should FAIL
declare
   v_personid varchar2(36);
begin
   v_personid := get_formatted_guid;
   insert into persons (personid) values (v_personid);

   insert into personnames (personnameid, personid, nametypecode, formattedname)
   values (get_formatted_guid, v_personid, 'currentname', 'John Doe');

   insert into personnames (personnameid, personid, nametypecode, formattedname)
   values (get_formatted_guid, v_personid, 'currentname', 'John Doe');

   insert into personnames (personnameid, personid, nametypecode, formattedname)
   values (get_formatted_guid, v_personid, 'alias', 'John Doe');

   insert into personnames (personnameid, personid, nametypecode, formattedname)
   values (get_formatted_guid, v_personid, 'alias', 'John Doe');
end;

Implementation based on the following link:
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1249800833250
which also has nice comments on other solutions, e.g. without a function or by using a trigger.

External HD FAIL, again …

December 12, 2009 by Reboot · Leave a Comment 

This, unfortunately, is not the first time an external HD from Western Digital has let me down. But I can’t get a grasp on why this darn thing is failing. The weird part is that it is passing the diagnostic tests. However if I attempt to transfer a large file from it, it freezes. It also grinds to a halt when I perform a thorough check-disk (i.e. “chkdsk g: /r“).

Any thoughts on why this problem occurs is greatly appreciated.

Test Option: EXTENDED TEST
Model Number: WDC WD1001FALS-00J7B1
Unit Serial Number: WD-WMATV3927131
Firmware Number: 05.00K05
Capacity: 1000.20 GB
SMART Status: PASS
Test Result: PASS
Test Time: 03:08:47, December 13, 2009

From Blog
From Blog