Thursday, July 22, 2010

Substitute \001 in FIX messages using SED

sed 's/\x01/|/g' /var/log/trail.log

I don't know why \001 is not working in SED.

Friday, July 16, 2010

Thursday, July 15, 2010

John Burroughs

“I still find each day too short for all the thoughts I want to think, all the walks I want to take, all the books I want to read, and all the friends I want to see.”
John Burroughs

Wednesday, July 14, 2010

Yesterday in MySQL query

SELECT * FROM table
WHERE date = CURDATE() - INTERVAL 1 DAY;

Monday, July 12, 2010

Taskkill

Ends one or more tasks or processes. Processes can be killed by process ID or image name.


Kill a process based on its window's name:


taskkill /fi "windowtitle eq TASOS"

Friday, July 9, 2010

MSSQL Perl Ubuntu

Ok what I need to do is probably setup a connection using UnixODBC ....
Then i can use that connection to connect to the MS SQL Server .....
which has ODBC compatibility mode enabled ......

1) Install the two packages "odbcinst1" and "libct1" with your
favourite package manager.  Now you have installed UnixODBC and
FreeTDS, respectively.

2) You have to tell FreeTDS about the MS SQL Server it should connect
to: Edit /etc/freetds/freetds.conf (with your favourite editor) and go
to the bottom of the file and copy/modify one of the entries names
MyServer to get something like this:

# Business Data
[BData]
host = 192.168.1.10
port = 1433
tds version = 8.0

where the name in square brackets, "BData", is something you have to
tell ODBC about later on, the "host" line is the DNS name or the IP
number (which is what I used above) of the box running MS SQL Server,
"port" is default for MS SQL Server 1433 and shouldn't have to be
changed unless you have done something funky on your MS SQL Server
installation, and for "tds version" 8.0 corresponds to SQL Server
2000.  (See http://www.freetds.org/userguide/tdshistory.htm for more
on versions.)

If you have more that one server you can add another block.

3) Tell UnixODBC where to find the FreeTDS driver and give it a name:
If /etc/odbcinst.ini does not include a block named "FreeTDS" copy the
content of /usr/share/doc/libct1/examples/odbcinst.ini to
/etc/odbcinst.ini to let UnixODBC know about the FreeTDS driver.
/etc/odbcinst.ini should now look something like this:

[FreeTDS]
Description     = FreeTDS 0.61-5 Deb
Driver          = /usr/lib/odbc/libtdsodbc.so
Setup           = /usr/lib/odbc/libtdsS.so
FileUsage       = 1
CPTimeout       = 5
CPReuse         = 5

where "FreeTDS" is the driver name.  

In this file you can also define ODBC drivers for MySQL, generic ODBC,
etc.

4) Make a named ODBC definition, with a specified FreeTDS database:
Edit /etc/odbc.ini and add a block looking something like this:

[BDataTDS]
Description     = Not That Important Data Server, FreeTDS connection
Driver          = FreeTDS
Servername      = BData
Database        = BigApplicationDB

where "BDataTDS" is the ODBC name to give to your application on the
Ubuntu box (e.g. Open Office), "Description" is just that, "Driver" is
the name defined in /etc/odbcinst.ini (in step 3), "Servername" is the name
defined in /etc/freetds/freetds.conf (in step 2), and "Database" is
the database you want to connect to on the MS SQL Server.

If you want to connect to more than one database, add another block
here.  If it is on the same MS SQL Server you use the same
"Servername", if it is a different one, you have to add another block
in step 2.

5) Try connection to the database, using the the unixODBC tool isql:

isql -v BDataTDS  

Look at http://www.freetds.org/userguide/ for more in depth help!


Thursday, July 8, 2010

Crack the Code in Cyber Command’s Logo

In reference to Crack the Code in Cyber Command’s Logo:

At Solaris command prompt:


echo -n "USCYBERCOM plans, coordinates, integrates, synchronizes and conducts activities to: direct the operations and defense of specified Department of Defense information networks and; prepare to, and when directed, conduct full spectrum military cyberspace operations in order to enable actions in all domains, ensure US/Allied freedom of action in cyberspace and deny the same to our adversaries." | md5sum
9ec4c12949a4f31474f299058ce2b22a  -

Or using Perl:

#!/usr/bin/perl

use Digest::MD5 qw(md5 md5_hex md5_base64);

$Code = "9ec4c12949a4f31474f299058ce2b22a";

$ClearText = "USCYBERCOM plans, coordinates, integrates, synchronizes and conducts activities to: direct the operations and defense of specified Department of Defense information networks and; prepare to, and when directed, conduct full spectrum military cyberspace operations in order to enable actions in all domains, ensure US/Allied freedom of action in cyberspace and deny the same to our adversaries.";

$Digest = md5_hex($ClearText);

print "\nClear Text: \"$ClearText\"\n\n";

print "Code  : $Code\n\n";

print "Digest: $Digest\n";

__END__