Archive for January, 2008

Breaker Bay Flickr Photo Published on Schmap

Saturday, January 26th, 2008

One of my photos published on Flickr

The Pinnacles at Breaker Bay,
has been published in the fourth edition of the Schmap Wellington Guide.

MySQL Commands

Friday, January 25th, 2008

MySQL commands I use but can never remember:

  • Logon> mysql –user=userame –password=password
  • Create a database> create database richard_projects character set utf8;
  • Explain> explain select * from projects
  • Alter Table> alter table PROJECTS add primary key (ID);
  • Add Foreign Key> alter table`USER_ROLE` add foreign key(`USER_ID`) references `USER`(`ID`) on delete cascade on update cascade;
  • Create Index> create index USER_PASSWORD on USER(PASSWORD);
  • Create Unique Index> create unique index CATEGORY_NAME on CATEGORY(NAME);
  • Insert> insert into CATEGORY VALUES (6, ‘Food’,'Generic Food Category’);
  • Update> update CATEGORY set NAME=’Other’ ,DESCR =’Other’ where NAME=’Food’;
  • Delete> delete from CATEGORY where NAME=’Food’;

User Management

Add a user with both remote and local access:

  • Grant>GRANT ALL PRIVILEGES ON *.* TO ‘richard’@'localhost’ IDENTIFIED BY ‘password’ WITH GRANT OPTION;
  • Grant>GRANT ALL PRIVILEGES ON *.* TO ‘richard’@'%’ IDENTIFIED BY ‘password’ WITH GRANT OPTION;

References

MySQL 5 Reference Manual Online

W3Schools SQL Quick References

Linking to New Zealand Legislation

Saturday, January 12th, 2008

The web page Public Access to Legislation - Creating links to the New Zealand Legislation website gives information on how to link to New Zealand Legislation.

The legislative documents are identified by:

  • the information type (Act, Regulation, Bill, SOP)
  • the legislation type or category (public, local, members, government, imperial etc)
  • the year
  • the number, padded with initial zeros to 4 digits. For Bills, the number will also include the Bar number and split letter (if applicable).

And a legislative document can currently be linked to in the following ways:

In the same way that I want to link to photo sharing sites from within my web application there will be occasions when I want to link to legislation, standards and regulation documents.

For example in the context of a web based building project it could be useful to link to the Building Act 2004 Table of Content which gives an overview of the individual sections of the Building Act.

This is useful as a general reference but there will be occasions where I want to show a provision in a specific context relevant to the project. For example a building project needs to be issued with a building consent which can lapse after a period of time.

When showing the status of a project which has not yet started building it would be useful to indicate if its building consent is about to expire and if it is then link to the relevant provision to clarify the situation.

Currently there are two simple ways of linking to the specific provision, open it in the same page or open it in a new page.

Both of these approaches are a bit rough for todays modern Ajax-based web applications which would ideally take a smoother approach. I.e. take just the relevant content and slide it into the page at the required location, in this case inserting just the following:

“A building consent lapses and is of no effect if the building work to which it relates does not commence within—
(a) 12 months after the date of issue of the building consent; or
(b) any further period that the building consent authority may allow.”

This Ajax insertion can be achieved by first using a customized HTML reader which extracts the relevant content from the original provisions page.

The simpler display rendered by the customized HTML reader would also be more appropriate for a mobile phone based web application.

Note that in January 2008, as part of the PAL Project, a new site for accessing New Zealand legislation will be available.

The PAL Project stores the legislation documents as XML fragments that are combined for publication as HTML and PDF. It is likely that the documents will also be available as XML.

If the XML document is available then it should be simpler to access the content of the specific provisions when using the customized HTML reader discussed above.

A further simplification would be to provide a REST based web service for accessing the provisions. This would allow the content of the provision “Lapse of Building Consent” to be accessed via a URI similar to the following http://www.legislation.govt.nz/act/public/2004/se/072se52.xml.

Linking to Photo Sharing Sites

Saturday, January 5th, 2008

I have users with photos published on photo sharing sites such as Flickr, Fotopic, ImageShack, Livejournal, Photobucket, Picasaweb, SmugMug, Webshots and others.

What I want to do is provide these users with the ability to link these published photos to projects managed by our web application. Within our application only the published URL to the image would be stored.

The Flickr API, with its support for REST, is the ideal site to use as a proof of concept. At least one other site, 23 also implements the Flickr API, making it easy to support both 23 and Flickr.

The Ajax based Flickr Related Tag Browser provides a good example of how to use the Flickr API to browse and select photos by tag. Within our application a user wold browse their Flickr account and search by photo album, tag or date to retrieve specific photos which would illustrate the project site itself, tasks to be accomplished, problems associated with a task or as visual confirmation that a task had been completed.

As an example I have two projects that I am about to start.

  • The first is to widen a driveway, add a front gate and landscape the front garden to link in with the new driveway and gate.
  • The second is to complete the garage at the back of the property, which includes adding a couple of rooms that will link up with the existing studio kitchen and main room.

The photos for these two different projects I have tagged gate and garage respectively on my Flickr account.

The default Flickr web pages that open for

  • http://www.flickr.com/photos/richard3kbo/tags/gate/ and
  • http://www.flickr.com/photos/richard3kbo/tags/garage/

by themselves give good overviews of the two different project sites.

Linking specific photos to project tasks helps illustrate and clarify these tasks.

Using photos published on Flickr and similar sites allows our users to continue using the photo sharing sites they are used to and which have more features for image processing and sharing than our site.