hit counter for blogger

Entries Tagged 'Uncategorized' ↓

Connect to SQL Server in Perl and in VBScript

Say my database name is Jessica_DB, my user name is jessica, and my password jessica_pwd.

Perl

To connect to Microsoft SQL Server using Perl with Win32::ODBC module

use Win32::ODBC;
my $dsn = "DSN=Jessica_DB;UID=jessica;PWD=jessica_pwd;";
my $DB  = Win32::ODBC->new($dsn);
$DB->Sql("SELECT f1, f2, f3 FROM MyTable");
$DB->FetchRow();
($f1, $f2) = $DB->Data("f1", "f2");
print "f1 = ". $f1;
$DB->Close();

VBScript

To connect to MS SQL Server using VBScript

Const adOpenStatic = 3
Const adLockOptimistic = 3
Set objConnection = CreateObject("ADODB.Connection")
Set objRecordSet = CreateObject("ADODB.Recordset")
objConnection.Open _
        "Provider=MSDASQL.1;Data Source=Jessica_DB;" & _
              "Trusted_Connection=Yes;" & _
                     "User ID=jessica;Password=jessica_pwd;"
objRecordSet.Open "SELECT * FROM MyTable", _
          objConnection, adOpenStatic, adLockOptimistic

objRecordSet.MoveFirst
Wscript.Echo objRecordSet.RecordCount

Python

To connect in Python, check out pymssql

Reflection in Inkscape, GIMP, and Photoshop

Ever wonder how to create those cool images with reflection, such as the image below? You can create them using Inkscape and GIMP, two free Open Source tools, and of course, with Photoshop. When I need to add reflection to an image quickly, I usually use Inkscape. Check it out! It’s great for making simple site logo as well.

reflection-red

InkScape

http://aqeeliz.com/2007/03/12/inkscape-tutorial-reflection/

Photoshop

http://pstutorialsblog.com/81/reflection-tutorial/

http://pstutorialsblog.com/82/3d-object-reflection-tutorial/

GIMP

http://gimp-tutorials.net/node/236

Java Games (with Greenfoot) Lesson 3: Tic-Tac-Toe Player

 In the last lesson (Lesson 2), we created the Tic-Tac-Toe Board and GameBall classes. We also added GameBall objects to the Board object. In this lesson, we will add a Player class such that a Player object interacts with GameBall objects in a meaningful way.

The game should work this way:

This game takes two players, who will take turn clicking. When the game starts, all nine cells on the board are blank. When the first player clicks at a blank cell, a Gold ball will be placed in that cell; when the second player clicks at a blank cell, a Steel ball will be placed in that cell.

  Continue reading →

Poker Hand Ranking

I got the poker hand ranking info from Poker Listings page.

Continue reading →

First C# App and Revisited Flex-PHP

This is the first blog entry for the My Learning Log category. It’s mainly for myself to keep track of what I learn but also to share with others like me the experience of playing with new technology.

  1. Create My First C# Application
  2. Run a Flex-PHP Application on my Windows Machine

To learn with me as I learn, read on. Continue reading →

test video

Startup Research

Below is the note I took on startup while taking several hours of research at Borders. There are three sections in this research report: self-assessment, interesting business ideas, networking., and money matters. Continue reading →

LearnJavaLog #1

While porting QoS perl script to Java, I tried these following Java tips:

Access to Class Members: (Sun Tutorial), Reflection Java Array (Java2s page), HashMap (Example), enum: (Sun tutorial), Naming convention, Split Text, SNMP4J open source library ( JavaDoc ), Type Conversion CharSequence Class, Regex remove duplicate white space, snmpwalk code using SNMP4j, also found Steven R Brandt’s Regex tutorial .

OReilly Head First Design Pattern

head_first_design_pattern_book

Learn SiLK Tool

Spent on July 2, 2007 to dig in into SiLK tools by reading the Analyst Handbook, creating a simple Java program(7/3/7) to call SiLK commandline programs, import SiLK soruce to KDevelop development environment(7/6/7).  Continue reading →