Chris Tate-Davies

The homepage of Chris Tate-Davies

RSS Feeds

  • Home
  • About

Javascript Language Translation

Mar 18th

Posted by admin in Javascript

5 comments

On a project I am working on, I need to enable language translation. Thinking about it, turned into something quite complicated. But then I found the Google Language API which allows developers to hook into the Google Languages services.

More >

google language, translation

MySQL Incorrect String value “x/80″

Mar 18th

Posted by admin in MySQL

1 comment

MySQL Incorrect String value replication error.

We use ANT for releasing versions of our PHP applications. Its very smart and takes a lot of the problems related to releases out of the equation.

However, everytime we performed a release, our replication server would break, and I’d have to skip a load of database delta error messages with this command:

SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1

The error we received is:

Error 'Incorrect string value: 'x9CxF37x12[k...' for
column 'applied_by' at row 1' on query. Default database:
'<databasename>'.
Query: 'INSERT INTO changelog (change_number, delta_set, complete_dt,
applied_by, description)
VALUES (35, 'Main', CURRENT_TIMESTAMP, USER(),
'<database_delta_filename>')'.

I’d been getting these errors for a while.

Basically, the MySQL server was replicating the changelog table down to the slave, but for some reason it just would not accept the replicated query.

After a bit of scrummaging around, and changing field values/character sets, I discovered that in the string was “\x80″ which is a padding character as set out in http://en.wikipedia.org/wiki/ISO_8859-1 and shouldn’t be used in a string. I’m not really sure how it got there, or why, but I basically changed the “applied_by” field to be a BLOB – which is generically a VARCHAR with no character set and there fore ignores this.

MySQL, replication

Help in using Ubuntu Terminal Console

Mar 18th

Posted by admin in IT

No comments

Help in using Ubuntu Terminal Console


Remote connection

To ssh to another Lunix terminal, use this command:

ssh username@host -p port

The default SSH port is 21, but you could change it to anything, i.e. 9100

Remote teminal will prompt for your password, and job done.


File/Folder functions

cp – Copy file

cp /usr/bin/file /tmp/location

mkdir – Create directory/folder

mkdir /home/chris/newfolder

rm – Delete files in folder

rm -rf /home/chris/foldertoremove

The -rf tells Linux to remove files in the folder. This will remove all files and sub folders though, so be careful. There is no undelete.

mv – Rename a file, or move a file

mv /home/chris/index.htm /home/chris/home.htm
mv /home/chris/index.htm /home/chris/site/index.htm

The first command will rename a file, and the second will move it (effectively renaming it into another directory)

pwd – see what folder you are in

pwd
/home/chris/Desktop

 

terminal, ubuntu

Ubuntu Console commands for SVN

Mar 18th

Posted by admin in IT

No comments

Console commands in Ubuntu for use with subversion

Checkout a branch:

svn checkout url@revision path

To update your local source:

svn up

And to commit a single file:

svn ci -m "message for commit" <files>

Multiple committing is just without the <files>.


To download a revision

svn co -r 1671<remotefolder> <localfolder>
<remotefolder> could be any folder in the svn structure, i.e.
http://www.mydomain.com/svn/project/trunk/folder

Getting a list of revisions for a page (if you’re trying to find when you changed a page)

svn log -g <files>
subversion, svn, terminal, ubuntu

REGEX – Remove Letters from string

Mar 18th

Posted by admin in IT

No comments

Removing letters from a string using Regular Expressions.

Very simple. but brain bending – All I wanted to do was remove a prefix from a string.

The prefix was always letters, and I only wanted the numerical suffix returned, so though, preg_replace was my best bet.

echo preg_replace("/[a-zA-Z]*/", '', '12345MystrING67890');

This returns :

1234567890

Perfect.

regular expressions
« First...«23456»
  • Recent Posts

    • ThreadSMS – Review
    • Reading the MySQL binary log
    • Accessing the Zend_Application from a page
    • Retrieve email using regex
    • Online regex -> php tool
  • Functions

    • Register
    • Log in
    • Entries RSS
    • Comments RSS
    • WordPress.org
  • Categories

    • HTML
    • Humour
    • IT
    • Javascript
    • MySQL
    • PHP
    • Uncategorized
  • Tags

    64bit ant ASP cisco class csv dbdeploy export firefox fish-bar fonts football google language group_concat HTML import injections java jdk microsoft MySQL order by outlook PHP php. dependency PHPUnit premier league regex regular expressions replication social networking subversion svn tabindex tahoma terminal thunderbird tottenham translation trebuchet ubuntu vcard verdana vpn windows
  • Spam

    8,658
    SPAM BLOCKED
Chris Tate-Davies
RSS Feeds XHTML 1.1
PR 0