Software development from planet leuze
On this page you can find some stuff i wrote in my spare-time. Enjoy !
C++ Article: How to safely stopping threads
This article explains my idea of a generic c++ thread class.
It was published in november 2001 on the codeguru website and is still available there.
http://www.codeguru.com/cpp/misc/misc/threadsprocesses/article.php/c3747/
WIS - Who Is Serving
This is a little tool written in java. It gives you information about the web-server product running (serving) a specified web site.
I wrote it to gather some experience with the java gridbag layout and the HTTP protocol.
Usage
- Enter the url of the site you are interested in (please don't forget "http://" at start)
- If you connect thru a firewall to the internet check the "use Proxy" checkbox and enter the proxy information into the text-boxes
- Finally hit the "Start" button. The web-server product info should now be displayed in the "Server Info" text-field
In the screenshot you can see that my homepage is running on a apache web-server.
wis_src.zip - Java Source files
wis.jar - Jar file
Ad hoc SqlCommand Code-Generator
This is a little code-generator written in C#. It generates the necessary code for the needed SqlCommand and
SqlParameter objects to call a stored-procedure on a MS Sql-Server database.
I wrote it to save me the time to write boring code...
Usage
- Enter the Sql-Server instance name or click the "Refresh" button to populate the combo-box with all accessible instances.
- Enter user-name, password and the database-name
-
Enter the name of the stored procedure you want to create code for or press "Refresh" button to populate combo-box
with the names of the existing procedures in this database - Finally hit the "Generate Code" button. Copy the generated code from the text-box and paste it into your project.
- Have Fun !
Example
For the following stored-procedure
Create PROCEDURE ProcWith4Params ( @IntParam int, @VarCharParam varchar(50), @CharParam char, @BigIntParam bigint )AS BEGIN SET NOCOUNT ON; -- ... END
the code-generator will generate the following code to execute the procedure:
using (SqlConnection Con = new SqlConnection("")) //TODO specify connection-string
{
using (SqlCommand Cmd = new SqlCommand("ProcWith4Params"))
{
Cmd.CommandType = System.Data.CommandType.StoredProcedure;
SqlParameter AddedParameter = null;
AddedParameter = Cmd.Parameters.Add(new SqlParameter("@RETURN_VALUE", SqlDbType.Int, 0));
AddedParameter.Direction = ParameterDirection.ReturnValue;
AddedParameter = Cmd.Parameters.Add(new SqlParameter("@IntParam", SqlDbType.Int, 0));
AddedParameter.Direction = ParameterDirection.Input;
AddedParameter.Value = ; //TODO specify value for parameter '@IntParam'
AddedParameter = Cmd.Parameters.Add(new SqlParameter("@VarCharParam", SqlDbType.VarChar, 50));
AddedParameter.Direction = ParameterDirection.Input;
AddedParameter.Value = ; //TODO specify value for parameter '@VarCharParam'
AddedParameter = Cmd.Parameters.Add(new SqlParameter("@CharParam", SqlDbType.Char, 1));
AddedParameter.Direction = ParameterDirection.Input;
AddedParameter.Value = ; //TODO specify value for parameter '@CharParam'
AddedParameter = Cmd.Parameters.Add(new SqlParameter("@BigIntParam", SqlDbType.BigInt, 0));
AddedParameter.Direction = ParameterDirection.Input;
AddedParameter.Value = ; //TODO specify value for parameter '@BigIntParam'
Con.Open();
Cmd.Connection = Con;
TODO execute Command
}
}
CommandGenerator.zip - Visual Studio 2005 Solution