If you are looking for a good video security surveillance system look look no further than Zoneminder. It's free, open source and the features are excellent. Below is a step by step recipe for installing with Fedora 9 Live CD. It will take approximately 30 minutes to get up and running. For video surveillance capture cards that are certified to work with Linux and Zoneminder try Bluecherry. Zoneminder works great with multiple security camera types including day/night surveillance cameras, ip surveillance cameras and pan-tilt-zoom security surveillance cameras. Often, some of the vendors specializing in security equipment or surveillance equipment will run specials on capture cards and cameras.
Zoneminder works great for home security surveillance or office video security surveillance. This video surveillance server has all the features of the expensive surveillance packages including video motion detection, video masking (removing areas that aren't important), video zones, video triggering, etc. You don't even need a powerhouse computer as a video server.
You can also monitor the surveillance server from over the internet and watch what's going on while you are away! For a sample video of what this system is capable of, watch a sample here.
1 Install Fedora 9 LiveCD
Tell it to remove all partitions
Manually select Hostname to be whatever name you want
Time Zone (Select New York) and uncheck UTC
Select Root Password
Finish and reboot
On bootup
Disable Firewall
Disable SELinux
Enable Network Time Protocal
Create user name and password
Reboot
2 Open terminal
Log in as root (su)
type yum -y install mysql-server ; yum -y insall zoneminder
gedit /etc/httpd/conf.d/zoneminder.conf and remove or add # in front of line indicated and save
Go to services and select, start and save httpd, sshd, mysqld
3 Download and install webmin http://prdownloads.sourceforge.net/webadmin/webmin-1.390-1.noarch.rpm
4 Open firefox and go to localhost:10000
Log in as root (root here, not su)
Go to services->MySQL
Under MySQL databases click create db and name it zm Don't select anything other than the name
Click on the zm database you created.
Select execute sql and browse from local file to /usr/share/zoneminder/db/zm_create.sql
5 Go to terminal as root and type service zoneminder restart
6 Go to Firefox, to to localhost/zm and it should be ready to go.
Wednesday, August 20, 2008
Saturday, August 16, 2008
Java Netbeans Tutorial
Netbeans Java Basics.
This guide is based on Netbeans 6. To use Netbeans you will have to have Java installed plus Netbeans. Any projects produced with Netbeans will run on any computer with any O/S that has java installed. This currently includes cell phones, computers, pocket pc, etc.
To install Netbeans, go to http://java.sun.com/javaee/downloads/index.jsp and choose the full install including Netbeans. This will install java and all of the basic Netbeans plugins.
After installation, start Netbeans. We will develop a basic calculator with multiple forms. This will use many of the skills necessary to develop basic applications.
When open, start a new project. Select file->new project, JAVA and Desktop Application. This will allow development of a general gui type Java Application. Give it a name, (ie FirstApp) and select finish.
A blank project will appear. This is actually a complete java application as it is. Try it. Near the top find the Green Triangle which says Run Main Project. It will compile and run a complete java application with a blank page. You will notice a standard menu and other familiar features already built into the basic java application. Close this and we will add some more to it.
On the left side of the screen is the development portion of the app. The block shown with File and Help is the main screen (called mainPanel). This is the screen that will open by default with your java application. We can add other screens (called jFrames or java Frames) to this to allow the user to have other options.
First, let's add some items to the mainPanel and see what happens. On the right side of the screen is the Palette. This is a selection of many pre-build components such as buttons, check boxes, etc to build familiar and easy to use applications. For this demo we will always use Swing components.
Now grab a Swing Controls Button and place it anywhere on the mainPanel. It is named by default jButton1. Java sees this button as having 2 parts, a variable name and a text label. First let's rename the variable name to something meaningful. Right click jon jButton1 and change the variable name to addButton. This can be anything you want but it's helpful to use something meaningful. Now java sees the variable name as addButton but the user still sees jButton1.
Let's change that and tell it to do something. Double click on jButton1. This is where we will change the text label and tell java what to do with it. A screen comes up labeled Set Action. Under Action, select Create New Action. By Action's Method will will add something that will tell us what the button does. Type openAdditionFrame. Under attributes change the Text to Add. The tool tip is helpful. This is where you add a hover-over baloon to tell the user what this button does. We'll use this. By tool tip type This button opens the addition frame.
When you click OK, it opens a new screen with lots of code. This all of the background code to make the java app worki. The curser is automatically placed near code labeled openAdditionFrame. This is the method we named earlier. We won't worry about any code now. On the upper left there are two tabs, Source and Design. Source is where you can view and edit any code with the project and Design is working on the GUI.
Go back to Design. Now lets compile and run what we have so far. Click the Green Triangle to perform this. We see our old familiar application come up with the Add button. The button does nothing yet but we can verify our application frequently by compiling and running.
Now we want to make the Add button open a separate screen (called a jFrame) where we will make a basic addition calculator.
We need to first create the second frame. While we are in Design mode on the right side of the screen select Swing Windows->Frame. Drag on top of the mainPanel. Now on the left side of the screen there are 3 tabs labeled Navigator, Projects and Inspector. Click Inspector. This will show us all of the files contained in our project. We should see FrameView, mainPanel, menuBar, and statusPanel and jFrame1. This is the second window we just added. Right click and change the variable name to addFrame.
Now we're ready to add some code. On the left side of the screen double click mainPanel. This brings our opening panel back up. Make sure to be in design mode (upper left of mainPanel). Now double click on the Add button we created.
This brings back the code editor. We will have some code like:
@Action
public void openAdditionFrame() {
}
This is called a method. A method begins with an open brace { and ends with a closed brace }. In between is we add the code to make things happen.
Now add the following code to make the method look like:
@Action
public void openAdditionFrame() {
addFrame.setBounds(400,400,400,400); //This opens the addFrame Frame to the position and size //indicated
mainPanel.setVisible(false); //This hides (not closes) the mainPanel
addFrame.setVisible(true); //This opens the addFrame Frame to the size indicated
} //above
//Anything with double slashes at the beginning are comments. Java ignores this.
Now click the Green Triangle to test. It should open the main panel. Now when you select the Add button another blank window should open. Close everything and return to the editor.
Now select the Inspector tab on the left. Again it will highlight the files included in this application. Double click on addFrame. It will bring up a blank window (frame) similar to the mainPanel except there is no menubar at the top.
From the Palette select Swing Controls->Text Field. Drag 3 of these in a culumn onto the addFrame.
The will be automatically named textField1 -3. Change the variable names. The one on the top will be no1TextField, the middle one will be no2TextField and the bottom will be no3TextField. Now you can edit the default text. In textField1 and textField2 put 1 as the default. Leave the sumTextField blank. Size each of them so they are the same. Now drag a label beside each text field. Name the top one Number 1, the middle one Number 1 and the buttom one Sum.
This will allow the user to input 2 numbers and we will calculate the sum and place that value in the bottom field.
Now we will add 3 action buttons. Drag 3 buttons over. Double click each to add a new action and change the default text on each button. Name the action and text Add, Clear and ReturntoMain.
We're ready to add some code here.
The add button is where the meat of our application lies. Double click on it to get to the code editor.
It will open up like:
@Action
public void add() {
}
Now we have to start adding some code. A few things first. All java (and C, C++ and C#) statements end with a ;. You will get an error if each statement isn't ended properly. Also regardign variables. The most common variables are String (text values), int (integer or whole numbers), and double (numbers with a decimal).
Also, java treats all values in a text field as text regardless of what you put there. If you want to value to be used with an integer or double variable it has to be converted.
In between the braces, declare 3 variables:
double no1;
double no2;
double sum;
Now when we select the Add button we want java to read the value in no1 and no2, internally add them and place the sum in sum.
To read in no1 and no2 add the following code:
no1=Double.parseDouble(no1TextField.getText());
no2=Double.parseDouble(no2TextField.getText());
This is kind of a mouthfull but here's what's happening.
First we're reading the text value (get) in no1TextField with the statement “no1TextField.getText()”
Next we are parsing (converting) it from a text value to a double value with Double.parseDouble(...)
Now we are storing the value of each of these text fields in the variables no1 and no2. So again, we read in a text value, convert it to a double and store it to no1. If we wanted a text value, such as name we wouldn't have to convert anything.
Now we will add:
sum=no1+no2;
This tells java to add the two converted values together and store them internally into the variable sum. Next we must send this internal value out to the sumTextField. First, remember though that all textField values MUST BE TEXT. So now we have to convert the double value sum to text and post it (set) to the sumTextField. Type:
sumTextField.setText(Double.toString(sum));
Here we are converting the double value sum to string with Double.toString(sum). We are then posting the string value into the sumTextField.
Both of these examples are compound statements where we are doing 2 things in1 statement (reading value and converting) or (converting and posting). This is a little confusing at first but more efficient.
Now the method should look like:
@Action
public void add() {
double no1;
double no2;
double sum;
no1=Double.parseDouble(no1TextField.getText());
no2=Double.parseDouble(no2TextField.getText());
sum=no1+no2;
sumTextField.setText(Double.toString(sum));
}
Click the Green Triangle to test it out.
Now the Add button on the mainPanel takes us to the addFrame. On the addFrame the add button works as we would expect by reading in the top 2 numbers and putting the sum in the sum box.
Now we'll work on the Clear and Return buttons.
Double click the clear button. The method will come up. We want to clear the values in the 3 boxes to start a new calculation. The method should read:
@Action
public void clear() {
no1TextField.setText("");
no2TextField.setText("");
sumTextField.setText("");
}
This simply puts a blank character “” in the textField. You could have replaced them with any number you wanted.
Now for the return button. This will close this frame and take us back to the mainPanel.
Double click on ReturntoMain and make the method say:
@Action
public void ReturntoMain() {
addFrame.setVisible(false);
mainPanel.setVisible(true);
}
This hides the current addFrame and makes the mainPanel visible again.
Now Click the Green Triangle to compile and run. All should work as expected.
One other thing. Java variable names are case sensitive, so no1 and No1 aren't the same variable.
This is a simple example but demonstrates several things to get going.
This guide is based on Netbeans 6. To use Netbeans you will have to have Java installed plus Netbeans. Any projects produced with Netbeans will run on any computer with any O/S that has java installed. This currently includes cell phones, computers, pocket pc, etc.
To install Netbeans, go to http://java.sun.com/javaee/downloads/index.jsp and choose the full install including Netbeans. This will install java and all of the basic Netbeans plugins.
After installation, start Netbeans. We will develop a basic calculator with multiple forms. This will use many of the skills necessary to develop basic applications.
When open, start a new project. Select file->new project, JAVA and Desktop Application. This will allow development of a general gui type Java Application. Give it a name, (ie FirstApp) and select finish.
A blank project will appear. This is actually a complete java application as it is. Try it. Near the top find the Green Triangle which says Run Main Project. It will compile and run a complete java application with a blank page. You will notice a standard menu and other familiar features already built into the basic java application. Close this and we will add some more to it.
On the left side of the screen is the development portion of the app. The block shown with File and Help is the main screen (called mainPanel). This is the screen that will open by default with your java application. We can add other screens (called jFrames or java Frames) to this to allow the user to have other options.
First, let's add some items to the mainPanel and see what happens. On the right side of the screen is the Palette. This is a selection of many pre-build components such as buttons, check boxes, etc to build familiar and easy to use applications. For this demo we will always use Swing components.
Now grab a Swing Controls Button and place it anywhere on the mainPanel. It is named by default jButton1. Java sees this button as having 2 parts, a variable name and a text label. First let's rename the variable name to something meaningful. Right click jon jButton1 and change the variable name to addButton. This can be anything you want but it's helpful to use something meaningful. Now java sees the variable name as addButton but the user still sees jButton1.
Let's change that and tell it to do something. Double click on jButton1. This is where we will change the text label and tell java what to do with it. A screen comes up labeled Set Action. Under Action, select Create New Action. By Action's Method will will add something that will tell us what the button does. Type openAdditionFrame. Under attributes change the Text to Add. The tool tip is helpful. This is where you add a hover-over baloon to tell the user what this button does. We'll use this. By tool tip type This button opens the addition frame.
When you click OK, it opens a new screen with lots of code. This all of the background code to make the java app worki. The curser is automatically placed near code labeled openAdditionFrame. This is the method we named earlier. We won't worry about any code now. On the upper left there are two tabs, Source and Design. Source is where you can view and edit any code with the project and Design is working on the GUI.
Go back to Design. Now lets compile and run what we have so far. Click the Green Triangle to perform this. We see our old familiar application come up with the Add button. The button does nothing yet but we can verify our application frequently by compiling and running.
Now we want to make the Add button open a separate screen (called a jFrame) where we will make a basic addition calculator.
We need to first create the second frame. While we are in Design mode on the right side of the screen select Swing Windows->Frame. Drag on top of the mainPanel. Now on the left side of the screen there are 3 tabs labeled Navigator, Projects and Inspector. Click Inspector. This will show us all of the files contained in our project. We should see FrameView, mainPanel, menuBar, and statusPanel and jFrame1. This is the second window we just added. Right click and change the variable name to addFrame.
Now we're ready to add some code. On the left side of the screen double click mainPanel. This brings our opening panel back up. Make sure to be in design mode (upper left of mainPanel). Now double click on the Add button we created.
This brings back the code editor. We will have some code like:
@Action
public void openAdditionFrame() {
}
This is called a method. A method begins with an open brace { and ends with a closed brace }. In between is we add the code to make things happen.
Now add the following code to make the method look like:
@Action
public void openAdditionFrame() {
addFrame.setBounds(400,400,400,400); //This opens the addFrame Frame to the position and size //indicated
mainPanel.setVisible(false); //This hides (not closes) the mainPanel
addFrame.setVisible(true); //This opens the addFrame Frame to the size indicated
} //above
//Anything with double slashes at the beginning are comments. Java ignores this.
Now click the Green Triangle to test. It should open the main panel. Now when you select the Add button another blank window should open. Close everything and return to the editor.
Now select the Inspector tab on the left. Again it will highlight the files included in this application. Double click on addFrame. It will bring up a blank window (frame) similar to the mainPanel except there is no menubar at the top.
From the Palette select Swing Controls->Text Field. Drag 3 of these in a culumn onto the addFrame.
The will be automatically named textField1 -3. Change the variable names. The one on the top will be no1TextField, the middle one will be no2TextField and the bottom will be no3TextField. Now you can edit the default text. In textField1 and textField2 put 1 as the default. Leave the sumTextField blank. Size each of them so they are the same. Now drag a label beside each text field. Name the top one Number 1, the middle one Number 1 and the buttom one Sum.
This will allow the user to input 2 numbers and we will calculate the sum and place that value in the bottom field.
Now we will add 3 action buttons. Drag 3 buttons over. Double click each to add a new action and change the default text on each button. Name the action and text Add, Clear and ReturntoMain.
We're ready to add some code here.
The add button is where the meat of our application lies. Double click on it to get to the code editor.
It will open up like:
@Action
public void add() {
}
Now we have to start adding some code. A few things first. All java (and C, C++ and C#) statements end with a ;. You will get an error if each statement isn't ended properly. Also regardign variables. The most common variables are String (text values), int (integer or whole numbers), and double (numbers with a decimal).
Also, java treats all values in a text field as text regardless of what you put there. If you want to value to be used with an integer or double variable it has to be converted.
In between the braces, declare 3 variables:
double no1;
double no2;
double sum;
Now when we select the Add button we want java to read the value in no1 and no2, internally add them and place the sum in sum.
To read in no1 and no2 add the following code:
no1=Double.parseDouble(no1TextField.getText());
no2=Double.parseDouble(no2TextField.getText());
This is kind of a mouthfull but here's what's happening.
First we're reading the text value (get) in no1TextField with the statement “no1TextField.getText()”
Next we are parsing (converting) it from a text value to a double value with Double.parseDouble(...)
Now we are storing the value of each of these text fields in the variables no1 and no2. So again, we read in a text value, convert it to a double and store it to no1. If we wanted a text value, such as name we wouldn't have to convert anything.
Now we will add:
sum=no1+no2;
This tells java to add the two converted values together and store them internally into the variable sum. Next we must send this internal value out to the sumTextField. First, remember though that all textField values MUST BE TEXT. So now we have to convert the double value sum to text and post it (set) to the sumTextField. Type:
sumTextField.setText(Double.toString(sum));
Here we are converting the double value sum to string with Double.toString(sum). We are then posting the string value into the sumTextField.
Both of these examples are compound statements where we are doing 2 things in1 statement (reading value and converting) or (converting and posting). This is a little confusing at first but more efficient.
Now the method should look like:
@Action
public void add() {
double no1;
double no2;
double sum;
no1=Double.parseDouble(no1TextField.getText());
no2=Double.parseDouble(no2TextField.getText());
sum=no1+no2;
sumTextField.setText(Double.toString(sum));
}
Click the Green Triangle to test it out.
Now the Add button on the mainPanel takes us to the addFrame. On the addFrame the add button works as we would expect by reading in the top 2 numbers and putting the sum in the sum box.
Now we'll work on the Clear and Return buttons.
Double click the clear button. The method will come up. We want to clear the values in the 3 boxes to start a new calculation. The method should read:
@Action
public void clear() {
no1TextField.setText("");
no2TextField.setText("");
sumTextField.setText("");
}
This simply puts a blank character “” in the textField. You could have replaced them with any number you wanted.
Now for the return button. This will close this frame and take us back to the mainPanel.
Double click on ReturntoMain and make the method say:
@Action
public void ReturntoMain() {
addFrame.setVisible(false);
mainPanel.setVisible(true);
}
This hides the current addFrame and makes the mainPanel visible again.
Now Click the Green Triangle to compile and run. All should work as expected.
One other thing. Java variable names are case sensitive, so no1 and No1 aren't the same variable.
This is a simple example but demonstrates several things to get going.
Monday, August 4, 2008
Reducing Energy Consumption
Here's my new blog about Reducing Energy Consumption at Home, Work and at Travel.
http://reducingenergy.blogspot.com/
http://reducingenergy.blogspot.com/
Tuesday, November 27, 2007
Google Basic or GB
Anyone reading my previous post about Google developing a cross platform application development language will appreciate this additional thought:
Google should develop Google Basic or GB for application development. It should be platform independent and have a rich IDE including easy to easy GUI development. The ease of use of VB.net should be considered.
Although many developers discount VB as a "true" programming language, it is arguably the easiest to learn, fastest to develop and would be the most popular "general purpose" language for Google Basic.
Currently Linux is a very popular o/s but novice devlopers struggle to find an easy way to fully utilize the system because of the lack of an easy development platform.
In typical Google fashion, the GB development could even take place on-line with the compiled version downloaded to the client PC.
The best scenario would include Google developing a new virtual machine like java that would be open source. In fact GB could simply be a front end for java with the easier language and development of Basic.
There was even an attempt at this by SUN called Project Semplice but it was short lived
Google should develop Google Basic or GB for application development. It should be platform independent and have a rich IDE including easy to easy GUI development. The ease of use of VB.net should be considered.
Although many developers discount VB as a "true" programming language, it is arguably the easiest to learn, fastest to develop and would be the most popular "general purpose" language for Google Basic.
Currently Linux is a very popular o/s but novice devlopers struggle to find an easy way to fully utilize the system because of the lack of an easy development platform.
In typical Google fashion, the GB development could even take place on-line with the compiled version downloaded to the client PC.
The best scenario would include Google developing a new virtual machine like java that would be open source. In fact GB could simply be a front end for java with the easier language and development of Basic.
There was even an attempt at this by SUN called Project Semplice but it was short lived
Monday, November 26, 2007
Google Compiler
I have read a lot about the speculation of Google developing their own operating system. This, to date, has just been rumor.
I frankly see more benefit in Google developing their own compiler and IDE. If they are truly going to make their mark in the corporate world, it isn't from a Google O/S nor is it with Google Apps. They need a way to get developers to use their development suite.
It should have the ease of use of VB but be a true cross platform app. Mono is an attempt at this but falls terrible short. And it is, bottom-line, a way to utilize a Microsoft product on Linux.
I am not anti-Microsoft but am pro-open source. I have benefited a lot from open source and from Linux. Unfortunately there is no easy way for a beginner to develop apps on Linux.
Let's face it, the Microsoft Visual Studio products are VERY well done from the user level. I can have someone developing a simple VB app in minutes. There is just nothing out there to compare with the ease of use of this development suite. But it is make for Microsoft products.
Python is a very easy language to get started with and grow with but there are no easy GUI development tools. There needs to be tight integration like in the Visual Studio.
If Google REALLY wants to get into Microsoft's pocket, it is by developing a product that is as cross-platform as c++ or java with the ease of use as the Visual Studio suite.
Then see how fast Corporate America runs to Google for their other services.
See my next blog post about Google Basic, or GB!
It should have the ease of use of VB but be a true cross platform app. Mono is an attempt at this but falls terrible short. And it is, bottom-line, a way to utilize a Microsoft product on Linux.
I am not anti-Microsoft but am pro-open source. I have benefited a lot from open source and from Linux. Unfortunately there is no easy way for a beginner to develop apps on Linux.
Let's face it, the Microsoft Visual Studio products are VERY well done from the user level. I can have someone developing a simple VB app in minutes. There is just nothing out there to compare with the ease of use of this development suite. But it is make for Microsoft products.
Python is a very easy language to get started with and grow with but there are no easy GUI development tools. There needs to be tight integration like in the Visual Studio.
If Google REALLY wants to get into Microsoft's pocket, it is by developing a product that is as cross-platform as c++ or java with the ease of use as the Visual Studio suite.
Then see how fast Corporate America runs to Google for their other services.
See my next blog post about Google Basic, or GB!
Subscribe to:
Posts (Atom)