Monday, April 29, 2013

Finding breaking changes in Adobe Cordova for PGB users

I have encountered a problem with Phonegap Build where some of my code stopped running.
Turns out there was a breaking change:


Before Cordova 2.2.0, the Connection object existed at: navigator.network.connection.
To match the spec, this was changed to navigator.connection in 2.2.0.
navigator.network.connection was left in place but was deprecated and was removed in 2.3.0.

I was not able to find any single place to read about such breaking changes.
see my Q to the people at phonegap build here:
http://community.phonegap.com/nitobi/topics/phonegap_version_upgrade_checkup_list_for_pgb_users

Eventually I ended up with the following Google search:


site:docs.phonegap.com ("API Changes" || "API change")

I hope this will help some one else.
If you know of a better way to keep track of breaking API changes - please leave a comment.

Monday, February 25, 2013

echoing bash and mysql commands when running in "batch mode"

I was working on doing some migrations on a Linux machine.

Those migrations required me to execute some Unix commands (using a bash script file) and running some SQL statements to make some changes to my MySql DB.

The entire set of commands was to be called from the console after executing a script -t 2>~/mylog.time -a ~/mylog.script command so that the execution output would be saved to a file.

The problem was that the log file did not show the actual commands that where executing, only their output and on the MySql script not even the output was displayed.

So I was looking fro something like the old dos "Echo On" command.

After doing some reading I found the following:
As the first command within my bash script (after the #!/bin/bash) I added the command set -vx.

  •  -v Prints shell input lines as they are read. 
  •  -x Print command traces before executing command. (so that variables names are replaced with their values). 
To disable this echoing set +vx at the end of the bash script.

As previously stated, in my shell script I also wanted to execute some SQL statements on my DB.

So I created a do_sql.sh file that had the following single line:
mysql -u rewardy --password=mypass --database=mydb --default-character-set=utf8.

Redirecting of stdin to this file like ./do_sql.sh < sql_statements.sql got the statements in sql_statements.sql to execute on the DB but I didn't even see the output of the SQL commands (and obviously not the commands themselves either).

To make this work I modified the file do_sql.sh by adding two parameters at the end of the original line: mysql -u rewardy --password=mypass --database=mydb --default-character-set=utf8 -vvv -t


  • -vvv Causes the echoing I wanted
  • -t      forces printing to use the same formatting as used on interactive console sessions
I hope this helps.

Tuesday, December 27, 2011

Installing nodeJS on debian lenny.

This article describes what I did to compile and install nodejs on debian lenny running at linode.


The following is not directly related to node.js but happened while I was working on this installation so here, maybe it will help someone:

For some reason, apt-get did not properly work for me,
the first thing was that I did not have curl installed but tring to install it did not work.

to make a long (very long) story short, turns out I was unable to install curl because I had a problem with the PGP keys for the debian archives.

This comment was the one that led my to:
aptitude install debian-keyring debian-archive-keyring.
following this fix and a successful apt-get update I was able to run
apt-get install curl

so, to get build and install node.js you run the following commands:

apt-get install python
apt-get install curl build-essential openssl libssl-dev

cd /usr/local/src
wget http://nodejs.org/dist/v0.6.6/node-v0.6.6.tar.gz
tar -xzvf node-v0.6.6.tar.gz
cd node-v0.6.6
./configure
make
sudo make install

There, you should now have node.js installed.
create yourself a folder for the scripts you plan to write.

if you need access to mysql from your scripts I recommend you use npm (node package manager) :

npm find mysql
npm install mysql

please note that this will install the mysql modules under node_modules folder under the current directory so that you can use mysql=require('mysql') in your scripts.

good luck and enjoy.

Wednesday, November 16, 2011

Reserved share names on ReadyNAS

Did you happen to try and create a share on your readNAS and get the following error:


Invalid name or illegal characters detected in name. Name is limited to alpha-numeric, underscore _, dash -, dollar sign $, and period characters, andmust start with an alpha character. Name cannot contain ''-snap'' and name cannot be used by an existing user account.


Turns out the reason is that some names are just "reserved"
from the post here:

it seems to be the case with "sys" and from personal experience its also the same with "mysql".

and:

says that "images" is also reserved.


Monday, October 10, 2011

Lock, Lock - Who is there? ...

I have been trying to rename a table on a mysql DB and kept getting:


Error Code: 1192
Can't execute the given command because you have active locked tables or an active transaction

I used
SHOW FULL PROCESSLIST

and was able to reduce it to only 2 lines (one of which is the one trying to run the rename).

then I used kill with the id of the other connection and now I have only my own connection.
but still

Error Code: 1192
Can't execute the given command because you have active locked tables or an active transaction

show open tables returns an empty results set.

Finally I gave up.
restarted the mysql service and the rename worked just fine.

 
Clicky Web Analytics