Tuesday, April 10, 2007
Shameful
Ouch. I tried to convince myself that the decision to allow the 15 to give interviews was part of a cunning strategy. Then I saw this post. I am utterly appalled.
Monday, April 09, 2007
Twenty miles from London, along the Thames, you will find a field opposite an island in the river. The field contains a monument erected by the American Bar Association. In the field next to it there is a memorial garden to John F Kennedy commemorating his role in the civil rights movement. Why on earth, you may imagine, are there American monuments in fields by the Thames? There are no other monuments. There is nothing to commemorate anything British.
Perhaps an important figure in American history was born there? Nope. The site is far more important to the American people than that. On that unmarked island in 1215 something was written down that more than 500 years later became the fifth amendment of the American Bill of Rights. “No freeman shall be taken, imprisoned . . . or in any other way destroyed . . . except by the lawful judgment of his peers, or by the law of the land. To no one will we sell, to none will we deny or delay, right or justice.”
Contrast this with the way we seem to have taken it for granted and allowed our freedoms to be eroded. At least the guys mentioned in the article are doing something about it.Tuesday, April 03, 2007
| Your Personality Profile |
You are elegant, withdrawn, and brilliant. Your mind is a weapon, able to solve any puzzle. You are also great at poking holes in arguments and common beliefs. For you, comfort and calm are very important. You tend to thrive on your own and shrug off most affection. You prefer to protect your emotions and stay strong. |
Monday, March 26, 2007
BEGIN
FOR source_rec IN (SELECT * FROM all_objects a)
LOOP
BEGIN
INSERT INTO t1
(col1
,col2
,col3)
VALUES
(source_rec.owner
,source_rec.object_name
,source_rec.subobject_name);
EXCEPTION
WHEN OTHERS THEN
--log error using PLVISION
plvexc.recngo;
END;
END LOOP;
END;
Another option is to use the EXCEPTIONS INTO clause of ENABLE constraint:
DECLARE
l_exc_count INTEGER;
BEGIN
--Disable unique constraint
EXECUTE IMMEDIATE 'ALTER TABLE t1 DISABLE CONSTRAINT UNQ_CONST1';
--Copy data (inc duplicates) from source table
INSERT INTO t1 (SELECT * FROM t2);
--The EXCEPTIONS table can be created using $ORACLE_HOME/rdbms/admin/utlexcpt.sql.
EXECUTE IMMEDIATE 'ALTER TABLE t1 ENABLE CONSTRAINT UNQ_CONST1 EXCEPTIONS INTO EXCEPTIONS';
--If constraint is violated it will still be disabled at this point
SELECT COUNT(1) INTO l_exc_count FROM t3;
IF l_exc_count > 0
THEN
--Copy invalid rows to errors table
EXECUTE IMMEDIATE 'CREATE TABLE errors_tab as SELECT * FROM t1,exceptions e where t1.rowid=e.row_id';
DELETE FROM t1
WHERE ROWID IN (SELECT minrid
FROM (SELECT object_id
,MIN(e.row_id) minrid
FROM EXCEPTIONS e
,t_dups t
WHERE t.ROWID = e.row_id
GROUP BY object_id));
END IF;
END;
Cool new feature in Oracle 10gR2 is the LOG ERRORS clause
Comment at asktom had the following:
insert /*+ APPEND */ into t select * from t2
LOG ERRORS REJECT LIMIT UNLIMITED;
Further details here
Thursday, March 22, 2007
The Devil's Kitchen: 50 Reasons Why The Independent Hasn't Got A Clue
The Devil's Kitchen: 50 Reasons Why The Independent Hasn't Got A Clue
I particularly like number 28
Friday, March 16, 2007
Record Exists
/*
Note that the following shows three ways of checking if a record exists which have very similar response times, one way (implicit cursor) which is bad, and a fifth way
( select count(*) ) which is a VERY BAD THING and will result in broken fingers for anyone found using it!
*/
SET VERIFY OFF
@ssoo
DECLARE
/* Different approaches to answering "at least one?" */
CURSOR empcur
IS
SELECT employee_id
FROM employee_big WHERE department_id = &&secondparm;
v NUMBER;
b BOOLEAN;
BEGIN
plvtmr.set_factor (&&firstparm);
plvtmr.capture;
FOR i IN 1 .. &&firstparm
LOOP
BEGIN
SELECT employee_id INTO v FROM employee_big
WHERE department_id = &&secondparm;
b := TRUE;
EXCEPTION
WHEN NO_DATA_FOUND THEN b := FALSE;
WHEN TOO_MANY_ROWS THEN b := TRUE;
END;
END LOOP;
PLVtmr.show_elapsed ('Implicit');
plvtmr.capture;
FOR i IN 1 .. &&firstparm
LOOP
OPEN empcur;
FETCH empcur INTO v;
b := empcur%FOUND;
CLOSE empcur;
END LOOP;
PLVtmr.show_elapsed ('Explicit');
plvtmr.capture;
FOR i IN 1 .. &&firstparm
LOOP
SELECT COUNT(*) INTO v
FROM employee_big WHERE department_id = &&secondparm;
b := v > 0;
END LOOP;
PLVtmr.show_elapsed ('COUNT');
/* Ohio OUG Contributions.... */
plvtmr.capture;
FOR i IN 1 .. &&firstparm
LOOP
SELECT COUNT(1) INTO v
FROM employee_big WHERE department_id = &&secondparm
AND ROWNUM <> 0;
END LOOP;
PLVtmr.show_elapsed ('COUNT ROWNUM<2'); department_id =" &&secondparm);"> @atleastone 1000 20
Implicit Elapsed: .45 seconds. Factored: .00045 seconds.
Explicit Elapsed: .12 seconds. Factored: .00012 seconds.
COUNT Elapsed: 2.21 seconds. Factored: .00221 seconds.
COUNT ROWNUM<2> @atleastone 20000 20
Implicit Elapsed: 8.06 seconds. Factored: .0004 seconds.
Explicit Elapsed: 2.46 seconds. Factored: .00012 seconds.
COUNT Elapsed: 42.21 seconds. Factored: .00211 seconds.
COUNT ROWNUM<2 Elapsed: 2.42 seconds. Factored: .00012 seconds.
EXISTS Elapsed: 2.63 seconds. Factored: .00013 seconds.
* /
END;
/
Thursday, March 08, 2007
Tuesday, February 20, 2007
Mr Eugenides: Menteurs
Mr Eugenides: Menteurs
Tuesday, February 13, 2007
Bad science - Gillian McKieth gets fisked
"McKeith is a menace to the public understanding of science. She seems to misunderstand not nuances, but the most basic aspects of biology - things that a 14-year-old could put her straight on. She talks endlessly about chlorophyll, for example: how it's "high in oxygen" and will "oxygenate your blood" - but chlorophyll will only make oxygen in the presence of light. It's dark in your intestines, and even if you stuck a searchlight up your bum to prove a point, you probably wouldn't absorb much oxygen in there, because you don't have gills in your gut. In fact, neither do fish. In fact, forgive me, but I don't think you really want oxygen up there, because methane fart gas mixed with oxygen is a potentially explosive combination. Future generations will look back on this phenomenon with astonishment."
hat tip to Tom Coates and the poor little greek boy.
Wednesday, November 29, 2006
Tuesday, September 05, 2006
Stuff I find useful
Visual Studio 2005
Cygwin - Free unix style utilities such as grep, xwindows client etc.
SQL Developer - Free ide from Oracle. Extensible plug-in architecture.
Firefox - Much better browser than Internet Explorer. Configurable.
CruiseControl.Net Continuous integration tool
Enterprise Architect - UML tool
Textpad/UltraEdit32 - Text editors, UltraEdit has more features but textpad is more lightweight.
Refactor! - Refactoring addin for Visual Studio
FXCop Code analysis tool
NUnit - Unit testing tool for .Net
Quest Code Tester for Oracle(previously known as QUTE)
SharpDevelop 2.0 - Open Source IDE for .Net (C#,VB and Boo). It includes a tool for converting VB to C# and vice versa.
Oracle Developer Tools - Addin for Visual Studio
Tuesday, April 18, 2006
Troubleshooting automated builds with CruiseControl.Net, PVCS and MSBuild
The tool is fairly well documented using a wiki. As with many wikis though, some parts of the documentation receive more attention than others. This caused me a few problems as we are using an old version of PVCS for source control and the PVCS docs are a bit thin. I got it working after a bit of trial and error and subsequent browsing of other areas of the site for different source control providers gave some tips that appear to be common to all source providers, so a common section would have been useful.
Installation was fairly simple and I proceeded to set up a simple test project:
<sourcecontrol type="pvcs">
<!--client executable-->
<executable>X:\VM\Win32\Bin\pcli.exe</executable>
<!--PVCS Database-->
<project>S:\PVCS Databases</project>
<subproject>/LIBRARY/.Net/NullableDateTimePicker</subproject>
<workingDirectory >C:\development\LIBRARY\.Net\NullableDateTimePicker</workingDirectory>
<!--<recursive >true</recursive>-->
<autoGetSource >True</autoGetSource>
<labelOrPromotionName >shared_DEV</labelOrPromotionName>
</sourcecontrol>
This configuration did not work and I had to investigate a bit more how it works. What seems to happen is that CruiseControl issues a succession of pcli commands and use the output from each to build further batch files for use by the next command. On my system, these batch files were saved to my temp directory:
C:\Documents and Settings\myname\Local Settings\Temp
When the next command attempted to use the file as input, the directory name was not escaped so the embedded spaces caused it to fail. I worked around this by setting my TEMP and TMP environment variables to point to C:\agtemp\temp this allowed me to proceed to the next step.
Now that the pcli commands were succesfully running, I had to change a source file in order to trigger the build. When I did this, I noticed that the pcli command produced by CruiseControl only got changed files when I had assumed that it would get all files in the project. This does make sense as the structure in PVCS does not neccesarily map directly to the .Net project structure. You are supposed to already have all the source code available in your working directory before starting CruiseControl which then just gets subsequent modifications before performing the build. If you need to get all of it then you can do a get for a specific label or promotion group by adding a </labelorpromotionname> element whose value corresponds to your label or promotion group.
Finally, I wasn't getting any executables even though the build was reported as succesful. This was another mistaken assumption on my part as I thought that it would automatically call MSBuild for the project. I added an MSBuild task to the project and configured it to call my solution file which then resulted in a shiny new dll in the release folder.
Thursday, April 13, 2006
Automating builds with PVCS and MSBuild
REM -aworkpath Path to place workfiles in. Overrides default workspace for project
REM -bpprojpath path to base project to use when resolving references, required when -a or -o specified
REM -prDBpath to PVCS database
REM -z recursive flag, operate on specified project and all sub-projects
REM -gPromotionGroup get files with specified promotion group or higher
REM entity project to operate on
x:\vm\win32\bin\pcli get -bp"/Billing/Source" -gGBDEV -pr"X:\VM\vmdevint" -aH:\gettest -z "/Billing/Source"
REM cd to workpath
cd H:\gettest
REM
REM C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\msbuild /logger:EmailLogger,"C:\EmailLogger\bin\Release\EmailLogger.dll";To=buildmanager@tempuri.org;From=buildmanager@tempuri.org;Subject=BuildLog:%DATE%;Host=mail.tempuri.org Billing.sln
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\msbuild Billing.sln
Friday, March 31, 2006
Photos
Most of the UK print shops (Jessops, SupaSnaps etc.) have some online ordering and photo-sharing facilities, however they often have limits on the amount of time that photos will be kept for and/or storage limits. Also, the bulk upload facilities often rely on ActiveX controls which is a pain if you use Firefox as your browser or a non-Windows OS such as Linux.
I have finally settled on photobox.co.uk. The browser based bulk upload tool is a java applet so it works on linux and they also allow you to upload files by FTP. There is an initial storage limit of 200 Mb but this increases by 50Mb for each order placed.
Friday, March 24, 2006
Finally resurrecting this blog
del.icio.us is a much better alternative.