Friday, 8 April 2011

Can't connect to local MySQL server through socket mysql.sock

You may be getting this error after an update or install or mysql server.

there are lots of different suggestions on how to fix this on the web, most of them will not work.. what will work is killing the mysqld process then restarting it..

to do this, do the following:

ps -A

this will list all processes, find the id of any mysql processes, then in shell type:

kill 11514 (where 11514 is ps id)

run ps -A again and check there is no mention of mysql anywhere..

now run "service mysqld start"

this should start mysql and create the mysql.sock file you had issues with earlier..

hope it fixed it for you,

Paul

Tuesday, 5 April 2011

Rake create and migrate test databases

here is your answer:

rake environment RAILS_ENV=test db:create

rake environment RAILS_ENV=test db:migrate

cheers,

Paul

Thursday, 3 March 2011

The bundled mysql.rb driver has been removed from Rails 2.2

So.. been trying to get a legacy rails app working and had this error..

after googling for a while, most people got this fixed using a gem install mysql -- --with command, or by copying an installed dll to the ruby bin directory.

However, what fixed it for me was:

sudo apt-get install libmysql-ruby

if you stumbled upon this, i hope it helped!

Paul

Wednesday, 2 February 2011

nltk corpora/ xx cannot be found

You may have just installed nltk and want to try a demo such as:[python]

>>> import nltk
>>> nltk.stem.porter.demo()


you may receive the error: "resource corpora/ not found"
this can be fixed by using the dltk package downloader

open your shell
start python
then type the following:[python]
>>>import nltk
>>>nltk.download()

this will open the nltk downloader where you can download everything you need.
fixed!

Monday, 3 January 2011

PyYAML on Windows 7 64 bit (Python NLTK) PyYAML python required not found in registry

Catchy blog title huh?

So, I needed to use the Natural Language Toolkit. (http://www.nltk.org/)

To do this, following their instructions, you will need to download the following items:

NLTK: http://nltk.googlecode.com/files/nltk-2.0b9.win32.msi, http://nltk.googlecode.com/files/nltk-2.0b9.win32.exe

The problem is, when python installs it does not enter any registry keys. Then, when you try to install 
PyYAML, you will get the following error:

PyYAML python 2.6 required not found in registry

To fix this we need to enter the correct values in the windows registry. Follow these steps to do that:

click the start button, type "regedit", and click ok to open regedit. Enter the keys below:

To add a new key, navigate, in this case to HKEY_CURRENT_USER\Software\ then right click software and choose new->key then type the name

You dont need to add values unless they are shown below:
[HKEY_CURRENT_USER\Software\Python]
[HKEY_CURRENT_USER\Software\Python\Pythoncore]
[HKEY_CURRENT_USER\Software\Python\Pythoncore\2.6]
[HKEY_CURRENT_USER\Software\Python\Pythoncore\2.6\InstallPath] 
Value: C:\Python26
[HKEY_CURRENT_USER\Software\Python\Pythoncore\2.6\PythonPath]
Value: C:\Python26;C:\Python26\Lib\;C:\Python26\DLLs\

next time you try to install PyYAML it will detect the python installation, problem solved..

go mad ...

Saturday, 11 December 2010

Set Python Environment Variable - Windows 7

Unlike when you install ruby, when you install python on windows 7 the environment variable is not set. This means that you will have to put the full path of your python installation in to the command line to execute any commands.

To set the path of your python installation in an environment variable follow these steps:

click the start buttong

right click computer and select properties

click "advanced system settings" on the left

the system properties windows should open

make sure the "advanced" tab is selected

click the environment variables button at the bottom of the tab

you will see a window open split in to 2 windows "user and system variables"

click new on the top one (user variables)

click new and enter "Path" as the variable name

"C:\Python26;C:\Python26\DLLs;C:\Python26\Lib;C:\Python26\Lib\lib-tk" (without the quotes) for variable value

switch the path to wherever your python installation is. done, reopen the command prompt and when you type python you should see details of the installed version.

enjoy

Wednesday, 1 December 2010

SQL Server Management Studio Express Windows 7

If, like me you were searching for an installation of SQL Server Management studio express for windows 7 and got an error along the lines of

"this program is not supported by your operating system"

then this is the installation you need:

http://www.microsoft.com/downloads/en/details.aspx?familyid=5D76230D-580D-4874-8C7D-93491A29DB15&displaylang=en

have fun

Paul