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

Monday, 1 November 2010

cannot be performed on a file with a user-mapped section open

So..

I installed TortoiseSVN, when i tried to add a folder to a repository i had created with VisualSVN i kept getting the error:

"cannot be performed on a file with a user-mapped section open"

After googling around i could not find good answers to this, but I did mananged to fix the problem, heres how:

When attempting to add the folder again, I started windows process manager through task manager so that i could watch what tortoiseSVN process were running when the error occured..

I then allowed those through windows firewall and it worked fine. If you have a similar problem I hope that sorts it!

Paul

Friday, 1 October 2010

Delete duplicate rows sql server

Hi, here is a not to common task since you of course should not really end up with duplicate rows in a table, but, knowing that

 "The man who makes no mistakes does not usually make anything. ~Edward Phelps" 

 if you do end up with duplicates, then here is how to solve the problem. This SQL will delete the first occurrence of the duplicate entries. 

To change it so that it deletes the last entry, you would replace Min with Max.

DELETE FROM table_with_duplicates 
WHERE id IN ( 
     SELECT bad_rows.id from table_with_duplicates AS bad_rows 
     INNER JOIN ( 
           SELECT column_1, column_2, Min(id) AS min_id FROM table_with_duplicates 
           GROUP BY column_1, column_2 HAVING COUNT (*) > 1
      ) AS good_rows 
     ON good_rows.column_1 = bad_rows.column_1 
     AND good_rows.column_2 = bad_rows.column_2 AND good_rows.min_id <> bad_rows.id 
)