My blog has moved! Redirecting...

You should be automatically redirected. If not, visit http://mindsiview.wordpress.com/ and update your bookmarks.

Showing posts with label windows. Show all posts
Showing posts with label windows. Show all posts

Wednesday, October 01, 2008

Tracking Stolen Laptops

Recently there's been a lot in the news about people recovering their stolen laptops through remote tracking (i.e. NY victim uses remote to nab theft suspect). Several companies provide commercial products for tracking lost laptops including products like Computrace Lojack for Laptops and CyberAngel. There are also open source solutions such as Adeona, created by the University of Washington.

After reading about Adeona in Technology Review, I tested it and am impressed with the results. The software runs on Linux, Windows, and Macs. It uses a cryptographic key and password combination to access information. And, if you have a Macbook, Adeona can use the iSight camera to snap a picture of culprit. When connected to the web, Adeona periodically records information such as internal/external ip, the network access point, and router information. The software sends the encrypted results to the OpenDHT distributed storage service. You retreive the information by installing the Adeona retrieval software on another PC and using the cyrptographic key and password.

Adeona's setup is simple. I've been running it for a few days now and it's working beautifully. If you're looking for a simple solution and don't want to spend a lot of money, check out Adeona.

Monday, September 18, 2006

Installing Eventum on Windows XP

A few weeks ago I posted and entry about installing the MySQL Eventum project on Mac OS X. Having successfully created an Eventum test environment on my Mac, I needed to install a production instance of it on a Windows XP VMware server. As it turns out, this process can prove rather difficult unless you follow the steps below.

Step 1: Install Apache 2.0

Installing Apache 2.0 is fairly straightforward. It is important to note that as of this post, the current version of PHP (5.1.6) does not yet support Apache 2.2. Save yourself some grief and load Apache 2.0.

Step 2: Install MySQL 5.0

Installing MySQL is the simplest of all the steps. No special configuration needs to be done. I would recommend installing the MySQL Tools also.

Step 3: Install PHP 5.1.6

I'm embarrassed to say that this turned out to be the most difficult step of the process...that is until I realized that this PHP version does not run with Apache 2.2. After installing PHP, you will need to modify the following:

  • httpd.conf. This file is found in your Apache folder. Add the following lines to the end of the file:
    # PHP
    LoadModule php5_module d:/php5.1.6/php5apache2.dll
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php .php-source .phps
    PHPIniDir "c:/php5.1.6" (or whatever directory you loaded php in)
    
  • php.ini. This file is found in your PHP folder. Add a doc_root line. It should look something like the following:
    doc_root ="C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"
    
    Take the ";" (denotes a comment in PHP) from in front of the following lines:
    extension=php_gd2.dll
    extension=php_mysql.dll
    extension=php_mysqli.dll
    
If any of these lines do not exist, add them.

Step 4: Install Eventum

After you download Eventum, unzip it to the htdocs folder of your Apache installation. To start the installation process, go to your browser and type the URL of the Eventum site in the address line. It should look something like this: "//localhost/eventum-1.7.1/".

Once the installation is complete modify the following line in the config.inc file (found in the Eventum directory):

from

@define("APP_COOKIE_DOMAIN", APP_HOSTNAME);

to

@define("APP_COOKIE_DOMAIN", NULL);

Best of luck! Let me know if you have any problems with this. R

Monday, January 03, 2005

Windows Service Article

A few months ago I sent one of my blog entries "Running Java Applications as a Windows Service" to the Borland Developer Network. Click here for the article.

Friday, June 11, 2004

Running Java Applications as a Windows Service

Introduction

Have you ever needed to run a Java class unattended on a Windows server? There are various ways to accomplish this task. By far, the best alternative is to run your Java class as a Windows service. One of the easiest tools I’ve found for turning classes into services is the open source Java Service Wrapper project from Tanukisoftware.org (http://wrapper.tanukisoftware.org/doc/english/index.html). According to their website, the Java Service Wrapper is an application which has evolved out of a desire to solve a number of problems common to many Java applications:

  • Run as a Windows Service or Unix Daemon
  • Application Reliability
  • Standard, Out of the Box Scripting
  • On Demand Restarts
  • Flexible Configuration
  • Ease Application Installations
  • Logging

In this article, we’ll focus on the first bullet point.

Note: There are three ways you can use the Java Service Wrapper. In this article we will use the WrapperSimpleApp class to launch our application.

First Things First

Following the link above, download and install the latest version the Java Service Wrapper (for Windows users it comes in a zip file). For this example, I used version 3.0.5. I extracted the file to my C: drive and it created the following directory C:/wrapper_win32_3.0.5. Since I can’t know where you are placing the files, for the rest of the article we’ll refer to the wrapper home folder as %wrapper home%.

Looking at the tree structure, you’ll see several folders including:

  • bin: contains the batch files needed to run the Java Service Wrapper and the Wrapper.exe file.
  • conf: contains the wrapper.conf file.
  • lib: contains the wrapper.dll file, wrapper.jar, and wrappertest.jar.
  • doc: contains the documentation

The bin Folder

The bin folder contains several files with a .bat.in extension. For this example, you and I are only concerned with the App.bat.in file, the InstallApp-NT.bat.in file, and the UninstallApp-NT.bat.in file. These files need to be renamed to a .bat extension.
Once you’ve done that, run the App.bat from a command line. You should see the following results:

Now that we know the test works, let’s make one of our own Java classes work.

Creating a Windows Service

The first thing we need to do is choose a Java class to turn into a service. In this example, we’re going to use a class called MultipleSocket server. The code for this class can be downloaded from CodeCentral by clicking here. Once you’ve downloaded the code, find the bdn.jar file and move it to the [wrapper folder]/bin directory.

On my PC I set up JAVA_HOME and CLASSPATH environmental variables as well as provided a path to the %JAVA_HOME%/bin folder to make it easier to run java classes from the command line. I’m going to assume that you’ve done the same thing. If you haven’t, then you’ll need to provide the full path to the java.exe file in the next examples.

Let’s test the bdn.jar file to make sure that everything’s ok. At a command prompt, type:


java -cp bdn.jar bdn.MultipleSocketServer

After you hit the enter key you should see a screen similar to this:

Note: Use Ctrl-C to exit the program.

The next thing we need to do is to modify the wrapper.conf file. As mentioned earlier, this file can be found in the %wrapper home%/conf directory. In this file we are going to make the following changes:

change:


wrapper.java.mainclass=org.tanukisoftware.wrapper.test.Main

to


wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp

add:


wrapper.java.classpath.3=bdn.jar

below:


wrapper.java.classpath.1=../lib/wrapper.jar
wrapper.java.classpath.2=../lib/wrappertest.jar

change:


#wrapper.app.parameter.1=

to


wrapper.app.parameter.1=bdn.MultipleSocketServer

change:


  wrapper.ntservice.name=@app.name@
  wrapper.ntservice.displayname=@app.long.name@
  wrapper.ntservice.description=@app.description@
 

to:


  wrapper.ntservice.name=MultipleSocketserver
  wrapper.ntservice.displayname=MultipleSocketServer
  wrapper.ntservice.description=MultipleSocketServer Test
  

And save the file.

Now let’s test our creation. At the command prompt run:


%wrapper home%/bin/App

You should see the following:

Now that we’ve tested our class, let’s turn it into a fullfledged service. At the command prompt run:


%wrapper home%/bin/InstallApp-NT.bat

You should see the following:

Let’s make sure that Windows recognizes the MultipleSocketServer class as a Service. Click on the “services” icon, found in the administrative tools option of the control panel. You should see a screen similar to this:

Notice that the MultipleSocketServer service is not started. To start it, you can select it and click start, or you can run the App.bat file again. Once you’ve started the MultipleSocketService, it will continue to run until you stop it, disable it, or run the UnistallApp-NT.bat file. Congratulations…you have just built a Java based Windows service.

Summary

The Java Service Wrapper from Tanukisoftware.org is an excellent open source set of programs that allow you to turn your Java classes into Windows services. It provides three methods for accomplishing this task. We discussed only one method here, but I encourage you to read through the documentation and experiment with the other methods as well.


The source code for MultipleSocketServer.java can be found at CodeCentral.

Technorati search