Friday, October 22, 2010

db update scripts

-- move all text into msgcodes
-- insert into msgcodes (id,lang_id,msgtext) select concat(id,"-event"),1,event from events;
-- insert into msgcodes (id,lang_id,msgtext) select concat(id,"-title"),1,title from events;
-- alter table events drop title;
-- alter table events drop event;

-- added code field to languages to hold two letter language code
alter table languages drop column code;
alter table languages add column code char(2) after id;
update languages set code=lcase(substring(language FROM 1 FOR 2));
alter table msgcodes change id id varchar(32);
alter table languages drop column field;
alter table msgcodes add column field varchar(32) after lang_id;
alter table msgcodes drop column fkey;
alter table msgcodes add column fkey int(10) unsigned after lang_id;
alter table msgcodes ENGINE = InnoDB;
alter table events ENGINE = InnoDB;
update msgcodes set fkey=SUBSTRING_INDEX(id,"-",1) where id REGEXP '^[0-9]+-';
update msgcodes set field=SUBSTRING_INDEX(id,"-",-1) where id REGEXP '^[0-9]+-';
alter table msgcodes add constraint deletecodes foreign key (fkey) references events (id) on delete cascade;

~/webs/db-update.sql::– move all text into msgcodes

My Emacs Files At GitHub

Wednesday, October 13, 2010

Drop down menus live from mySQL using CSS

I was preparing to entire the hazy horrible world of Java script to provide
event links from the navigation toolbar. And then! Bing! Why not use CSS? And it
works. Super. Click on the annoying advert below to take a gander …

My Emacs Files At GitHub

Monday, October 11, 2010

Finally : a good pop up translator for FireFox

I can't believe I missed this bad boy before.

Babel Translator will pop up word translations, select translations etc. Highly
customisable. Superb.

Babel Translator For Firefox

My Emacs Files At GitHub

Monday, October 4, 2010

Google Sitemap Generator

SiteMaps seems to be another way to optimsie google ratings. The link talks about googles own sitempa generator.

A site which claims to generate free sitemaps is XMLSiteMaps.

My Emacs Files At GitHub

Emacs 23, the emacs daemon and emacsclient

A recent entry to planetemacsen reminded me of a wiki entry added a good while
back which complements, or even supercedes, other methods of starting the emacs
daemon. There are a lot of solutions for running the emacs daemon when not
already running and/or using the emacsclient. I find the following solution
most convenient since there is no need to specifically start the server yourself
at any stage - it makes use of the alternate-editor option. Create a small
script and place it somewhere on your path.

# edit
exec emacsclient --alternate-editor="" -c "$@"

The ="" is the key. This tells the emacsclient code to start the daemon and then
call itself if its not already running.

The wiki entry tells you more and describes the use of the EDITOR env variable.

My Emacs Files At GitHub

Sunday, October 3, 2010

Fuzzy Search In Emacs

fuzzy.el provides a super fuzzy search capacity. Save the code linked below to somewhere on your elisp path, add the two lines below to your .emacs and now C-s (isearch-forward) will become "fuzzy" after the first miss for the item you are searching for. You can customise the "fuzzy" group to change the fuzziness. This module is part of the superb auto-complete suite - recommended.

(require 'fuzzy)

My Emacs Files At GitHub

Saturday, October 2, 2010