Developer

when is a syntax error not a syntax error

Answer: When you are doing an INSERT INTO on an Access database which is read-only.

I’ve just been doing a bit of classic ASP with MS Access back-end database. I traditionally use the RecordSet object and AddNew to insert records. But thought I’d be good on this occasion and use Jet SQL and the Command Object. Unfortuantely the script broke with error:

Microsoft JET Database Engine error ‘80040e14’
Syntax error in INSERT INTO statement.

80040e14 is a fairly generic error code, with lots of possible causes. Just give it a google!

I checked and double-checked my SQL syntax, which looked fine. Even entering it directly into the Access application showed no problem. I then wrapped the code with the On Error Next, and an error trap which reported the following variation:

Error: -2147217900 Syntax error in INSERT INTO statement.

Same description, but googling the error number revealed just a few results, this amongst them suggesting a permissions problem. Which I didn’t quite believe at first, why would the hosting provider cause the mdb file to be read-only? It is in a folder outside the webroot, if I ask them for a SQLServer account, I’m sure it will allow me to insert records!

Replacing my code with my more traditional RecordSet object, AddNew and Update commands revealed and confirmed the error…

Microsoft JET Database Engine error ‘80040e09’
Cannot update. Database or object is read-only.

If I’d stuck with my old way of doing things I’d have saved a whole load of time spent looking in the wrong places.

Posted by creacog in ASP, MS Access, 0 comments

a little fireworks CS3 bug

Well in my opinion incorrect user-interface behaviour rather than a bug. I just used Adobe’s report a bug form, but ironically my Safari crashed when I hit the submit button, so I’ve currently got no idea if this went forward.

The issue concerned is not new and not really a big deal, but I just had to process a pile of images and it bit me so many times I had to get it out of my system by writing about it…

The interpretation of the tab key within the properties panel for certain selected tools is in my opinion incorrect and is inconsistent with established convention.

Example 1: Marquee tool selected:

1. Set the style to Fixed Ratio or Fixed size
2. Double-click the marquee width property
3. Type with desired width.
4. Hit tab

At this point I’d expect the focus to tab across to the Marquee height property. But it doesn’t. It sets the focus on the marquee width property and selects it. I need to hit Tab a second time to get to the height property.

I’ve been caught by this so many times. It is impossible to learn to accommodate to this odd behaviour because in every other application I have ever used, tab takes focus to the next input field.

Example 2 : Eraser tool selected:

This shows more clearly the logic which has been implemented.

1. Double-click the value of the Size property
2. Type a new value
3. Hit tab

Again, instead of tabbing to the next input field (Edge) the focus remains at the Size property – value selected.

4. Double-click the Edge property
5. Type a new value
6. Hit tab

At this point instead of tabbing to the next field (Opacity), you tab back to the Size property!

In summary, it seems the implemented behaviour is that the first use of tab within a field-set of the properties panel always tabs to the first item of that field-set, the tab sequence is thereafter obeyed until you leave the field-set. I feel the behaviour should always be to tab from the current field to the next.

I’m a programmer rather than graphics dude and I use Fireworks infrequently. So many times I’ve typed a width, tab, then a height only to find I’ve just overwritten the width with the height – no big deal – but a tad annoying!

Posted by creacog in Adobe, Bug, CS3, Fireworks, 1 comment

install Bugzilla on a HyperVM VPS running LXAdmin

Following my quest to find a suitable VPS for my needs, it was time to get the newly released Bugzilla 3 installed and running. It did take me 3 or 4 attempts to get this right. As I’ve stated previously, I am no sysadmin, so my failures were probably simple inexperience. These are my notes to save myself some time should I need to do this again.

Note: What follows assumes a clean install of the VPS.

I had started with CentOS5. But I found that as soon as I hit the button to install LXAdmin, my VPS was rebuilt as CentOS4.4. In my first attempt and in the final stages of Bugzilla installation I felt I really needed the system to be using Apache rather than the default of lighttpd. I could not find any way of persuading LXAdmin to make this switch despite the control on the ‘server’ page of the admin user interface. I later found this support thread on the LXLabs forum, and I started again…

  1. Log-in to the HyperVM control panel
  2. Rebuild the OS
  3. Choose the centos-4-i386-afull template

We now need to get and run the LXAdmin SSE installer script (apache/bind) available from the LXLabs download centre. To do this I ssh’d into the the VPS shell as root…

wget http://download.lxlabs.com/download/lxadmin/production/lxadmin-install-master.sh

sh lxadmin-install-master.sh

Once the shell script has completed you have LXAdmin installed. You need to get yourself logged in as admin and change the password. I choose to do all my LXAdmin work through SSL:

https://yourIP:7777/

If you run ‘top’ back in the shell, you should see about 8 httpd processes running and no sign of lighttpd.

UPDATE 06/06/2007: LXAdmin have since published instructions for an ‘easy switch to Apache‘.

While in LXAdmin, we should set up a plan. I have no intention of polluting my system with any FrontPage stuff, so my basic plan has FrontPage extensions disabled. Once that’s done you might as well set-up the domain you are going to serve Bugzilla through – and a MySQL database for it – noting down the database name and password – which you’ll need later. It is important that this domain does not have FontPage extensions, as they will stuff-up the .htaccess file. Before continuing, use the “Misc Config” button to “Enable Cgi In Documentroot”.

The next step is to get some system libraries installed. These can all be installed with yum. So back to the ssh session, the following are what I installed, along with any dependencies where asked…

yum install xorg-x11
yum install xorg-x11-devel
yum install expat-devel
yum install ImageMagick-*
yum install libdbi-*
yum install gd
yum install gd-devel

At some point we’ll need to edit some config files. I haven’t used vi or emacs since I really did work with a VT200 terminal, and they are now well and truly forgotten. A simplified alternative is nano, so…

yum install nano

With that lot in-place, we are ready to actually install Bugzilla. Change directory to your web files directory and download Bugzilla…

cd /home/httpd/your.domain/httpdocs/www/
wget http://ftp.mozilla.org/pub/mozilla.org/webtools/bugzilla-3.0.tar.gz

Then use gunzip and tar to extract the files to your www folder. At this point if you are running a low memory VPS like mine (max 256MB) you might find it useful to stop Apache. (I had one of the modules fail to install because the installer ran out of memory, which I solved by stopping Apache.)

At this point follow the Bugzilla instructions for running:

./checksetup.pl –check-modules

followed by:

/usr/bin/perl -MCPAN -e ‘install **SOME_MODULE**’

Substituting **SOME_MODULE** in each case for a module listed in the report. In just-about every case, accepting the default when prompted did the job. However when GD is installed you are asked a series of questions with respect to image formats (png, jpeg etc). These are fine, but in the case of Animated GIF I found I needed to choose N, or the module would fail.

Note: Due to the low memory available to my VPS. I decided not to install or use MOD_PERL module (which I read requires 30Mb per httpd).

Next step is to establish the localconfig file as per the bugzilla configuration instructions

You should now run checksetup.pl again, this time without the –check-modules switch.

Once localconfig has been created, you need to insert the mysql user and password details you established earlier. This is where nano comes in…

nano localconfig

Once you have saved the file, run checksetup.pl yet again. This time it will connect to the database and insert the tables. It should also have sorted out the .htaccess file.

We need to check that the httpd conf files are ok. There are a couple of changes I neeeded to make…

nano /home/httpd/your.domain/conf/lxadmin.your.domain

There are two <VirtualHost> blocks in this file, one for http (port 80) the other for https (port 443). For both you need to check the <Directorary> block relating to the www folder. In my case, the only change I made was “Options +Includes +ExecCgi” became “Options +Indexes +ExecCgi” in both blocks. Save the file and exit nano.

We could at this point restart Apache. However, unless you have any intention in future of hosting a FrontPage site I would (and did) remove the line that loads the frontpage_module. To do this…

nano /etc/httpd/conf/httpd.conf

The last line in this file loads the unnecessary module, and it can be commented out by prefixing a #. Doing so will save us wasting about 10Mb of RAM.

So at this point we can restart apache…

apachectl start

Our current working directory should still be www. If we now…

./testserver.pl http://your.domain/

All should be fine. If you get an error stating that localconfig is accessible, this is probably an issue with .htaccess. If you remove the .htaccess file, then re-run checksetup.pl, a new .htaccess file will be generated. Re-test and you should be ok.

As stated above this post is really my aide-memoire. It is not a substitute for reading and understanding either your hosting documentation, or the Bugzilla guide. However I hope it is of some help.

UPDATE: For some reason after following this install, my VPS would encounter a networking problem after a random period – usually not longer than 1.5 days. The quick fix was always a re-boot. However support from vaserv decided a re-install of BIND was required – which seems to have cleared the issue properly.

Posted by creacog in Bugzilla, HyperVM, LXAdmin, vps, 0 comments

hunting a vps

I’ve been a New Media developer (RIA developer in modern speak) for a fair few years. Despite a period of Web-Application development, I’ve so far managed to avoid any serious sysadmin. However I now have a number of different applications I’d like to run on-line (the likes of WordPress, Bugzilla, Drupal and others), and keep them live 24/7. None of them are high-traffic, and while I have machines at home that I could run them from, for the sake of the planet, my electricity bill, as well as the temperature, and noise in my flat, I didn’t want them running here 24/7. So the quest was on to find a VPS, and do so without breaking the bank.

Obviously Googling on VPS Hosting will return loads of potential providers. Following are my notes against those I gave further examination and my final choice.

Hostway

I’ve been with Hostway for what seems like for-ever, both through my last ‘permanent’ employment, and my more recent years with my own company. My main site is hosted there via a windows shared hosting account. It is relatively in-expensive, and has served me well over the years. However it doesn’t allow me the flexibility I feel I now need. Their VPS solutions start at £39.95 / month, which is way too expensive for me. (The value of VPS with respect to my requirements is far less than that.)

MediaTemple

I was quite interested in MediaTemple. A number of prominent respected bloggers are hosted by them, and they seem very much oriented to serving freelance designers and techies of my ilk. Their “Grid-Service” is a step up from a shared service – but not quite VPS. This service allows multiple domains and one-click install of loads of applications, and includes SVN pre-installed. They are US based, and at $20/month the current £:$ ratio makes the pricing pretty good – especially compared with my Hostway web-share. The fear-factor for me was the mysterious GPU measurement. I have read some bad press out there (although I think they’ve fixed most of the mysql issues that were the root of most complaints).

I suspected that my chances of getting Bugzilla to run in that environment, may be problematic. (It is not the most straight forward install in the world.) Admittedly I didn’t get around to asking them the question.

An alternative for which I’m sure I would have had no trouble installing Bugzilla is their “dedicated-virtual” at $50/month (20Gb disk 256Mb Ram, 1Tb bandwidth) seemed worth a look and good value compared with Hostway’s VPS. However I really wanted the server based in the UK if at all possible.

WebFusion

I had a look at WebFusion. Starting at £19.95/month for “VPS value” seemed worth investigating. I’m generally happy with 123-reg (part of the same group). However I’ve had a bad experience with WebFusion in the distant past. Since they were bought out by Pipex I thought they’d be worth a fresh look. A cursory glance shows that pre-installed software is quite old – PHP4, MySQL 3.23.58. A quick google-around revealed a couple of complaints of poor support, and an unresponsive VPS over a prolonged period of time. These complaints made me somewhat less interested.

ByteMark

Following a thread in the WAUK mailing list, a colleague made a valued recommendation for ByteMark.

You essentially start with a 150MB (RAM) machine, 10GB disk, 50GB traffic at £15/month but can grow it if you need to. The machines are in the UK (helps with things like data protection).

This is for a plain VPS. I’m not a sysadmin (nor do I wish to be one), and while I can cope with Apache config, I’d be a complete newbie as regards DNS and email etc, so thought I’d really need/benefit from a control panel. The only black mark against using ByteMark for this is that I’d need help finding and installing such a control panel.

CheapVPS

I chanced upon CheapVPS. Normally a name like that would deter me immediately. But I thought it worth a punt, with the pricing for an entry level Linux plan:

128Mb ram
5Gb disc
150Gb band
£4.75 / month

The server is in the UK. It is implemented with HyperVM which allows you to install the LXAdmin control panel which itself includes an application installer for a load of stuff including WordPress 2.1, Drupal 5.1 etc.

After playing around with it for a few days, I got a couple of plain sites, a test WordPress site and Bugzilla running. I am pretty happy with progress so far. I’ll follow up later with a post on installing Bugzilla into this system, as it did take me 3 attempts to get it right.

Posted by creacog in Hosting, HyperVM, LXAdmin, vps, 5 comments

new SWFObject (1.5)

As you will know from my earlier post, I generally consider using SWFObject to be best practice for embedding Flash in a web page. It has recently been updated to version 1.5: Release note.

It is probably also worth noting that while the present is SWFObject, the future will be SWFFix. Lead by Geoff Stearns (SWFObject) and Bobby van der Sluis (UFO).

Update (14/03/2008) : SWFObject 2 released.

Posted by creacog in Flash Platform, Flex, Javascript, XHTML/CSS, 1 comment

a shakey first few moments with 2.0.1

I had a scary first experience with the Flex Builder 2 (2.0.1) Trial on the Mac, after having commenced a project using the Beta…

Before installing, I was aware of the following bullet in the release notes

Opening old Flex projects – The Flex Builder 2.0.1 update cannot open projects that were created with pre-release versions of Flex Builder 2. Flex Builder 2 beta-level projects must be recreated in Flex Builder 2.0.1.

So I zipped a back-up copy of my project files.

On installing and launching 2.0.1, I was suprised that my existing projects seemed to open ok. But ‘cleaning’ the project had the effect of removing the html files. Additionally seemingly spurious errors were generated on compile. The first being 1023: Incompatible override.

I keep my project files on a seperate disc away from the default location. So I deleted the folder and restored just my source files from a zip and recreated the project in builder 2.0.1 – still no joy. In-fact even creating a new application project with only the default stub resulted in errors reported at lines which didn’t exist. (Similar to these reported issues on Flexcoders).

I found the issue to be primarily that the 2.0.1 Builder looks for the same workspace files as the Beta – and they aren’t compatible. The solution…

Rename the existing “Flex Builder 2” folder to “Flex Builder 2 Beta” to accurately reflect the builder that created it. (Just to ensure you can revert to using the Beta if you need to – which I thought would be a likely prospect if my experiment failed) On the Mac:

/Users/username/Documents/Flex Builder 2
becomes
/Users/username/Documents/Flex Builder 2 Beta

(Note: for Flex Builder 2 Beta to pick up it’s workspace again, you need to choose “File>Switch workspace…” from the menu. Not that you’ll want to go back to the beta, once you have 2.0.1 running properly.)

Then when launching the 2.0.1 version, the “Flex Builder 2” folder will be re-created but this time containing a 2.0.1 compatible workspace. You can then start creating projects, porting your old source files as you see fit.

All the spurious errors are now cleared, and proper html files created. So far looking good with improved performance over the beta!

Posted by creacog in Eclipse, Flex, Mac OS, 0 comments

Mac OS X batch xhtml validation

While many development tools include report generators capable of testing the validity of your xhtml site wide, they can only act on the code they are aware of. Where pages are dynamically generated using server-side scripting such as ASP / PHP etc, the only real way of testing the resulting xhtml is to test the content at run-time. The w3c validator is a handy tool for doing this, but it can become tedious to use interactively across a large number of files or test-cases. Additionally, if the site files are part of an extranet, or carry confidential information, you won’t want to be pushing the content out to a public service for validation.

An approach I use from time to time is to batch test site files on an internal network. To do this I use the following tools…

  • w3c validator
  • wget
  • awk (this is already on your system)

There is a small amount of work to do in setting up your system for this approach.

1. Install the w3c valdidator locally

Apple have produced and maintained an excellent article on how to install the validator onto your Mac OS X system. However I found a few areas which at time of writing were not accurately described…

  1. The Base code and the DTD Library downloads are gz files not tar files. This means the 2nd and 3rd lines of the instructions will not work as written. If of-course you double-click the downloaded files on the desktop, they will first expand to the tar file, then expand to a folder on the desktop. At which point will now have the following files and folders on your Desktop:
    1. sgml-lib.tar
    2. sgml-lib.tar.gz
    3. validator.tar
    4. validator.tar.gz
    5. validator-0.7.2 (folder)
    6. validator-0.7.2 2 (folder)
  2. validator-0.7.2 2 actually contains the expanded content of the sgml-lib.tar.gz file and contains a htdocs folder itself containing a sgml-lib folder.
  3. The instructions also seem to fail to inform you where to place the sgml-lib folder. It is apparent from the validator.conf sample file, that the sgml-lib folder should sit inside htdocs. So before going further. just through the finder I copied the sgml-lib folder from validator-0.2.2 2 to validator-0.7.2/htdocs/
  4. We can now pick up the instructions on the 4th line which reads “cd /Library/WebServer/Documents”. The remainder of the instructions worked fine for me on Mac OS X 10.4.7
  5. To test your completed install, paste visit: http://localhost/validator/htdocs/

2. Install Fink Commander

As part of the process of installing the validator, you have installed Fink. Fink commander provides a GUI interface to Fink, I suggest you install it as the next step.

3. Install wget

Using Fink Commander, download and install wget. This is a command-line utility that we will use to automate the downloading of files.

4. Create a ‘batch’ file

OK, strictly speaking not a batch file, but a text file of urls for wget to request. We must first take our list of files and process the text for form suitable urls. For this I suggest the following steps…

In the terminal window, use the following commands…

Using the terminal window, navigate to your local webroot folder.To generate a single column list of all the files within webroot we can use the command…

ls -1

We can send the output of one command directly to the next command using the pipe symbol “|”. Ultimately we wish to create a file containing full urls to the files we want to process. So the next stage is to prefix the filenames with the start of the url. We can do this by ‘piping’ the results from ls into awk. Then finally directing the output to file sourceURLs.txt which will be created up one level so as not to infect the webroot. So on one line…

ls -1 *.asp |
awk '{printf"http://localhost/validator/htdocs/check?
uri=http://www.yourdomain.com/%s\\\n",$1}'
 > ../sourceURLs.txt

Note: Currently I don’t have style sheet control on this blog. The above 4 lines should be typed into your terminal as a single line.

5. Process the urls

  1. move up one level so your working directory contains both sourceURLs.txt and the webroot folder…
    cd ..
  2. create a new folder to contain the validation reports…
    mkdir validationReports
  3. change to that directory
    cd validationReports
  4. execute wget using sourceURLs.txt to create validation reports of each page
    wget -Ei ../sourceURLs.txt
  5. The current folder now contains one html file per validated file. Open them in your browser to check the results.
Posted by creacog in Mac OS, XHTML/CSS, 2 comments

round the corner

After years of dreading having to implement in xhtml/css, a designer’s efforts laced with rounded corners, I recently went and proposed a design of my own requiring them. (Doh!)

Over the last few years a number of tried tested techniques have been established…

I’ve never really been a fan of bitmap corners typically using variants of the long-standing “sliding doors” technique. However if there is a 3d aspect to the design this would probably be the best way.

In my case I just wanted a neat rounded corner between a foreground and background. I found that Nifty Corner Cube was just the job! Released March 2006 under GNU GPL License, the third evolution of Nifty Corners, these are really easy to implement in JavaScript and degrade gracefully. We are not limited two colours as a ‘transparent’ mode allows background gradients through. My only (limited) disappointment was the loss of the rounded border of previous version. However my final design can and will live without borders.

Posted by creacog in Javascript, XHTML/CSS, 0 comments

embedding flash in html page – best practice? (SWFObject)

For a long time I simply used the html published from the Flash IDE to embed a SWF. Expecting that to be the ‘best practice’ approach. Like others I was concerned at the impact of Microsoft’s upcoming changes to IE in response to EOLAS patent issues. I was dreading either having to write my own JavaSript or research countless approaches.

With SWFObject the problem is solved. It has been around for a long time (formerly known as FlashObject) and appears to be well tried and tested. I was really pleased with how simple it is to use, how it degrades gracefully. I’ve used this on a number of projects and now consider it to be best practice. In future I’d need a very good reason not to use it.

Update (14/03/2008): SWFObject 2 released

Posted by creacog in Flash Platform, Javascript, XHTML/CSS, 2 comments

make my h1 look nice

I’ve recently been distracted from my flash ambitions back to the world xhtm/css design. One of the issue with the organisation concerned is that in print media they use what I think is a really nice font: ITC Century Light. Ideally this is what should be used for all h1 headers through this site. Obviously not many users are likely to have this font installed. The substitute font is Times New Roman which is not nearly as neat, or distinctive.

In the bad-old days we would have created GIFs for each heading and used them instead. The height of bad-practice in this new world of standards compliance and accessibility.

Prior to doing any research, I had expected use of Flash would fall foul of similar problems. Then I found sIFR. A combination of JavaScript, CSS and Flash, which at run-time replaces designated tags with a SWF containing the text rendered in your font of choice to the same dimensions. What’s better it ticks most of the accessibility boxes. I’m really pleased with how easy this was to set up, and how it gracefully degrades.

Ok I came to this late. But the current version (2.02 at time of writing) has been recently updated with bug fixes and changes relating to ELOAS. And there is a version 3 in development.

This is a good piece of work by the developers, who are looking for funding. Certainly if my client goes with this recommendation, I’ll be sending a donation.

Posted by creacog in Accessibility, Flash Platform, Javascript, XHTML/CSS, 0 comments