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.

Wednesday, July 20, 2011

The function parameter for javascript Array.Sort

I guess If you are reading this you already know that javascript's Array.sort function can take a function parameter.

Did yo ever wander what exactly should this function return ?

well its simple:
This function (which should take two elements from your array) f(e1,e2) should return:
  • any negative number to indicate that its first parameter should appear before (have a smaller index) the second parameter in the sorted array .
  • zero if you are indifferent to the order in which those two elements will appear in the sorted Array
  • any positive number to indicate that its first parameter should appear after (have a larger index) the second parameter in the sorted array .
Using this info you could even sort mixed type arrays and do multilevel sorting (e.g. sort by date and alphabetically within the date).


Sunday, June 05, 2011

CodeSign error: code signing is required for product type 'Application' in SDK 'iOS 4.3'

I have been getting this error myself and found this helpful post:


but since I am using xcode 4 I wanted to add the guidelines for doing the same on xcode 4 so here goes:
1. on the project navigator (left most gray icon that looks like a folder) click your app
2. on the main pane that opens click "build Settings" at the top
3. scroll down the main pane until you reach "Code Signing Identity" and go on and
select the right code signing identity.

Eyal

 
Clicky Web Analytics