Wednesday, February 11, 2009

wildcard regex in notepad

The general wildcard regex for notepad (simliar to % in sql) is (.*).

So to match both of these lines:

</option><option value="COM">COMPAQ ALPHA UNIX
</option><option value="DGV">DATA GENERAL AOS/VS


The regex/search value looks like:

</option><option value="(.*)">

Just don't forget to toggle search mode to "regular expression"

Monday, February 2, 2009

all changes cause syntax error, python

Problem: getting a syntax error whenever making any change to a py (python) file

Solution: stop editing py file in regular text editor, needed to edit within development environment, such as pywin

load csv to mysql from local file

LOAD DATA LOCAL INFILE '[path to your csv]'
INTO TABLE [table to import into, must be created before running with proper columns]
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
([field 1], [field 2], [field 3], [...]);

link to original article

removing carriage return/new line character in mysql

on importing a csv to mysql I saw these little black square characters, which were carriage return symbols of course. To remove these little artifacts run the following query:

update [table_name] set [field_name] = replace([field_name],'\r','');

terminal server has exceeded max number of allowed connections

if you get the error just run the following command to override the error:

mstsc -v:0.0.0.0 /f -console

(substitute ip for 0.0.0.0)

link to original article