Java code for connecting MS SQL Server by using SQL Server Authentication

First of all, You will need to add a jar file to your project library as SQL Server 2000 Driver for JDBC Service. My target is SQL Server 2000, it will require the jar file called “sqljdbc4.jar”. This is not supported on Microsoft website now, you can download it here. For other versions of SQL Server, here is the link of SQL Server 2000 Driver for JDBC Service.

The following is the code for connection MS SQL Server and select some records from a testing table.

Read more

Command lines for remotely use CVS

remotely check out a project cvs -d :ext:hostname:/usa/dir/cvs/ co -d blank-paper blank-paper remotely import a project cd into the folder you want to add as a new project cvs -d :ext:hostname:/usa/dir/cvs/ import blank-doc INITIAL start remotely update cd into the folder cvs update remotely commit cd into the folder cvs commit remove a file cd … Read more

CSS for browsers to print background colors & images

Is there any css code for browsers to print out background colors? No, there is no such css code, background images and colors are ignored for browsers. So don’t rely on background colors for printing.

To let browsers print background colors and images, you need to configure your browsers option.

Read more

The problem of truncating text from SQL Server in PHP

PHP and SQL Server are a powerful combination, however sometimes data stored in a text type column is truncated for no apparent reason after 4096 characters.

I got this problem today when I want to display text data from SQL Server 2000. Apparently, I need to increase the maximum size of a text column to be returned from SQL Server by PHP. Since I have control over the Web Server. Here is how I fixed the problem.

Read more

How to write a crawler by using Java?

Actually writing a Java crawler program is not very hard by using the existing APIs, but write your own crawler probably enable you do every function you want. It should be very interesting to get any specific information from internet. To provide the code is not easy, but I searched and find the basic algorithm … Read more

Java Design Pattern Story for Proxy – A Slutty Lady

This work is translated from a foreign website which uses ancient stories to explain design patterns. 1. What is Proxy/Agent pattern? I’m too busy to response your request, so you go to my proxy. Proxy should know what the delegator can do. That is, they have the same interface. The proxy can not do the … Read more

How to select elements but exclude a string or exclude an element by using JQuery

Here is the code:

<div class="content">
    <a href="#">A</a></div>
<div class="content">
    <a href="#">B</a></div>
<div class="content">
    <a href="#">C</a></div>

Read more