MySQL Newbie

August 29, 2011

I am a db newbie – no, probably worse than that, I am a db troglodyte. I remember card catalogues in the library, and I was OK with them. During my nearly decade programming, I’ve pretty much always managed to find someone else to code any db access / schemas etc. So when I hit a problem I google. It’s not helpful when I don’t find anything. So possibly, this is just such an obvious MySQL basic 101 issue that it doesn’t need to be explained, but I’m putting here anyway.

I’m using MySQL Workbench and forward engineering a db schema that my kind husband helped me put together for a short contract I’m involved with. I happily connect to my local instance of the server, and tell it to execute my file.

Ooops. Here’s the offending line of code:
“CREATE INDEX `scenario_id` ON `mydb`.`question` (`scenario_id` ASC)”
And here’s the error:
Error Code: 1280. Incorrect index name ‘scenario_id’

So it seems that when you create a unique index then MySQL Workbench happily bangs “_UNIQUE” on the end of your index name (which it generated automatically), but if it is not unique, then nothing is put on the end of your index name, which is then the same as the column name, and MySQL didn’t like to execute that. So I just banged an _INDEX onto the index name and then it was happy. (It seems that any suffix will do e.g _PUTSOMETHINGHERE also works :).)

So this code is fine.
CREATE INDEX `scenario_id_INDEX` ON `mydb`.`question` (`scenario_id` ASC)

Maybe it’s just a funny with the MySQL Workbench. Please refrain from telling me I’m a db troglodyte. I know this – that’s precisely why I’m using a pretty interface and not writing SQL queries by hand.

Advertisements

Fleeing to a new TLA

September 21, 2007

I’ve left the world of GIS for a sharp slide back to the world of EFT.

Instead of being a developer and researcher immersed in open-source and encouraged to blog my adventures, I am now down and dirty in the world of moving other people’s money around. And bound by non-disclosure agreements.

So I’ll put this blog on temporary hold unless I come across cool things that are not locked down under a secrecy clause, or until I launch my very own super-duper-magnificent-take-over-the-world-cool-product-or-company. Or I might post general stuff about working half-day, or some of my more embarassing development blunders.

Or not.

Slashgeo site closing

July 5, 2007

This is very very sad.  I loved being able to just check one rss feed and get an overview of geo stories.  I’m not a geospatial professional, and probably never will be, but as a developer and researcher working in the field, this was an invaluable resource for me, and one that I checked daily.

So long, and thanks.

Piping hot

June 20, 2007

So I made my first yahoo pipe! It collates sensor web search results and hits from del.icio.us tagged with sensor web. It still needs a bit of work – I’d like to fetch rss feeds from some of the geo-bloggers out there. Anyway, here is….. my Sensor Web Pipe.

Editing in the dark

May 30, 2007

We found a cool skin for the AFIS portal called Darkness. Very nice looking, and great until you get to trying to edit. (We’re using kupu.) Then, Gack!  The text for the skin is white, and the default kupu background is also white – not such a hot idea.  Anyway, it is a known issue in the skin, we just hadn’t read the release notes – but by the time we figured there was a problem, we’d already spent some faffing around time editing out pics and logos to fit nicely in with the new scheme.   So we decided to change the background colour in kupu to a nice, dark colour to show up the text.

I googled and googled,  but couldn’t find anything useful. Eventually I searched the plone mailing lists, and came upon a wonderfully clear email about the problem.  (I didn’t keep the link, I’m afraid). Basically, you just add the following tag to the .css for the skin:

body.kupu {

background-color:  black  /* or whatever */

}

W00t! Much happiness and dark background editing.

I’m breaking the mould here, and posting about my own home techno-woes today. I finally decided to overhaul my creaking dual-boot, Windows 2K, Redhat (so old I don’t remember) into a brand-spanking shiny XP / Pick favourite Ubuntu distro here. Note that this may be waaay beyond my technical capabilities. Anyway, based on advice from our divisional Information Officer (i.e. for a dual boot, install Windows first, otherwise it @$#s up your Linux), I went ahead with my XP install.

Now my shiny new birthday pressie (Samsung SyncMaster Flatscreen) doesn’t work properly – every couple of minutes, it pops up a nasty little box saying that the resolution is not optimal, and I have to bang about with the buttons on the screen to get rid of it. So I thought – hmm, time to upgrade my video driver. And have duly spend two days searching for my video driver.

Thanks to a marvelous utility called EVEREST , I didn’t actually have to take a screwdriver to my pc case to find out what graphics card I had, but just a click of a mouse told me it was a SiS 315 Integrated (yup, that really meant a lot to me). So I searched for that, found a download, downloaded it – tried to install it, and got told it couldn’t install, as I didn’t have the driver. Checking out Control Panel -> Display properties -> Settings -> Advanced -> Adapter didn’t give me any info, as it just had some random VGA thing listed, with no properties or anything.

After much swearing, I found a forum in which the answer to almost every question was “Install the drivers for your motherboard, then try again”. So (thanks to Everest), I searched for the chipset drivers (SiS 651), found them here and installed them.  Huzzah! I now have a screen that works.  It still makes every second line fuzzy – so I’m now going to try installing the actual drivers for the monitor next.

Anyway, I’ll probably post any updates to my quest for a shiny dual-boot system on a middle-aged pc on this blog, not my usual personal ones, as I don’t think my friends are terribly interested in the ins and outs my system woes. (Plus, I’d probably have to be embarrassed if any of them realized the extent of my techno-naivete.)

We are in the process of setting up a portal site for AFIS (Advanced Fire Information System). Basically, three groups within the CSIR are involved in this project, they are ICT4EO, Remote Sensing, and the Satellite Applications Center (SAC).  There is an operational system up and running, providing fire alerts reliably to interested parties, and there is a whole lot of research around the application going on. ICT4EO, my group, has been trying to build an open-source, open-standards-compliant version of the application – our research is mainly focussed around Senosor Web Enablement middleware. Remote Sensing works on information products coming out of the remotely sensed data  – they are working on, for example, fire hazard predictions. SAC run the operational system.  So there are all these “products” within the CSIR that are called AFIS, and no real clarity on what it is, where it’s going.  To solve this, we are putting up an AFIS portal, to aggregate all the info about the system, including current and future research directions. It will be cool.

We decided to use plone as our basis for building the site. We need some sort of content management because different stakeholders must update different areas of the site, and we have worked with plone before. We needed plone 2.5.+ because we want to integrate Open Layers into the site. Ultimately, this site will be deployed on a windows machine, but while we’re developing it, it is sitting on the gentoo server run by ICT4EO.

I emerged zope and plone separately (possibly a mistake?), using zope 2.9.3, and plone 2.5.2. I used zope-config to install plone in my zope instance, and happily started it:
/etc/init.d/zope-afis start

All looked fine – but nothing was actually running. Checking the status produced:

* status: started
* Status of Zope in /var/lib/zope/zope-afis …
daemon manager not running

I tried all sorts of things, and then ran from the bin directory of my zope instance (/var/lib/zope/zope-afis/bin), using

./runzope

Which gave me a happy little error message to the effect that there was already something running on port 8080*. So I editted  the zope instance config file (/var/lib/zope/zope-afis/bin) to change the http-server port and voila! A working instance.

Except not quite – major site errors. Turns out plone 2.5.2 doesn’t like zope to be less than 2.9.6. It works beautifully now.

Summary:

1) If it doesn’t start – check that you don’t have anything else running on port 8080 before trawling the net for hours :).

2) Use at least zope 2.9.6. with plone 2.5.2.  (In fact, I came upon a newsgroup post suggesting that using zope 2.10.x wasn’t working with this plone version either – but I didn’t check that.

*Which I should have known, as it’s Tomcat, and I installed it! Doh!