Sunday, February 24, 2013

How to set up a wireless connection in Windows

This article describes how to set up a Wireless connection to a LAN in Windows and then connecting to internet using a Broadband (PPPoE) connection.

First of all make sure that WLAN, LAN and ADSL indicators are blinking in your wireless router. If not, restart the wireless router. Sometimes restarting the modem will also be required. If so first restart the Modem and then the wireless router.

Also make sure that the Wireless button in your laptop is switched on.

Then open, “Control Panel\Network and Internet\Network and Sharing Center” and click on “Set up a new connection or network” option.


Then select the “Connect to the Internet” option and click next.

    
Select “Create new connection” option and click next.


Now select Wireless to create a wireless connection.


Now you can connect to the LAN using this connection. But this will not get you connected to the internet and for that you have to create another Broadband (PPPoE) connection.


To create a Broadband (PPPoE) connection follow steps up to "Create new connection". Then instead of selecting Wireless, you have to select Broadband (PPPoE)


You will be prompted to fill the ISP information. Here you have to add the ISP username password and suitable name for the connection. Then press connect.


Now you are connected to the LAN through the wireless connection and you are connected to internet via the Broadband (PPPoE) connection.




Few short cut keys (hot keys) for Windows, Chrome and Microsoft One Note


Here are few short cut keys (hot keys) for Windows, Chrome and One Note which I find useful.

Windows Hot Keys

Win+Home
Clear all but the active window
Win+Space        
All windows become transparent
Shift+Win+Left/Right    
Move the window to the monitor
Win+T
Focus and scroll through items on the taskbar
Win+B
Focuses the System Tray icons
Ctrl+Shift+Enter
Open as Administrator
Ctrl+Shift+N
New Folder
F2
Rename
Alt+Left/Right
Go previous folder or next folder
Shift + F10
Right Click Menu
\
Types the \ in Google search box

Chrome Hot Keys

Ctrl+N
New window
Ctrl+T
New tab
Ctrl+Shift+Enter
Opens the selected link in a new tab
Ctrl+Shift+T
Reopens the last tab you've closed
Ctrl+Tab
Next tab
Ctrl+W
Closes the current tab or pop-up
F10
Opens the Chrome menu
Ctrl+Shift+B
Toggles the bookmarks bar on and off
Ctrl+Shift+Delete
Opens the Clear Browsing Data dialog
Esc
Stops the loading of your current page
Ctrl+F
Opens the find bar
Ctrl+G or F3
Finds the next match
Ctrl+Shift+G, Shift+F3
Finds the previous match
Ctrl+D
Saves your current webpage as a bookmark
Ctrl+H
History page
Ctrl+J
Downloads page
Alt+D
Focus the address bar

One Note Hot Keys

Ctrl+M
Open new window
Ctrl+Shift+O
Numbered list
Ctrl+Shift+L
Bulleted list
Ctrl+Shift+F,Up,Down
Select Font
Ctrl+Shift+P,Up,Down
Select Size
Alt+I,P
Insert Picture
Alt+I,F
Insert File
Ctrl+Tab
Traverse Tabs

Eclipse Hot Keys

Ctrl+Shift+E
Switch to editor
Alt+Shift+Q,P
Package viewer

Monday, February 11, 2013

Back propagation neural network Java example source code

This example implements a multi-layer neural network, which will behave as an XOR gate after being trained using the back propagation algorithm.



The network has only two layers, the input layer and the output layer. It does not have any hidden layers. The input layer consist of two neurons and the output layer consist of only one neuron


You can find the NeuralNetwork.jar in the following link which includes the complete source code, compiled classes and images.
After downloading the jar file you can run the application by executing the following command.

java -classpath NeuralNetwork.jar com.neural.network.main.AppMain



First press Train button to calculate the weights. A message will be displayed saying you have successfully trained and the weights will get populated to the weight text boxes.

Afterwards you can select input values using the x1 an x2 combo boxes and Press Run button to test whether the neural network produces the correct output.



Saturday, February 9, 2013

Javascript validation in struts when using < sx : submit > to submit a form

Key here is to use the 'beforeNotifyTopics' attribute of the . In the value of this
attribute you have to specify the name of the javascript method that sould be called.

For example,

< sx : submit value="submit" targets="mainContentDiv" showloadingtext="false"
indicator="loadingImage"
beforenotifytopics="/beforeQuestionnaireSubmit"
id="submitQuestionnaireButton" / >


Then you have to add the javascript method that should do the validation in the following way

dojo.event.topic.subscribe("/beforeQuestionnaireSubmit", function(event, widget) {
var btn = dojo.byId("submitQuestionnaireButton");
btn.disabled = true;

var validationSuccess = true;
for(var i = 1; i < isanswered =" false;" j =" 0;" isanswered =" true" isanswered =" true" classname = "normal" classname = "normal" validationsuccess =" false;" classname = "highlight" classname = "highlight" validationsuccess ="=" disabled =" false;" cancel =" true;" name="'global.enquete.allanswer'/">");
}
});

Call a Struts 2 action using a javascript and load the response to a div

A common problem that Struts 2 frame work users face is how to call a Struts 2 action using a java script and load the response to a div, specially when you are not using Struts dojo tags. So by using the following function you can achieve this easily. 

Note: You should include this function at the top most parent page.

dojo.require("dojo.io.IframeIO");
dojo.require("dojo.dom");

function sendToTarget(submitUrl , formId , divId, parameter1, parameter2){
          dojo.require("dojo.io.IframeIO");
          dojo.io.bind({
                    url:submitUrl,
                    formNode: dojo.byId(formId),
                    mimetype: "text/html",
                    transport: "IframeTransport",
                    preventCache: true,
                    multipart: true,

                    content:{
                              urlParameter1: parameter1,
                              urlParameter2: parameter2
                    },

                    load: function(type, data, evt) {
                              var divDisplay = dojo.byId(divId);
                              data = data.body.innerHTML;
                              divDisplay.innerHTML = data;
                    }, 

                    error: function(type, errObj){
                              alert("error " + errObj.message);
                    }
          });
}

Enable TCP/IP remote connections for SQL server and give user permission

1)  Open Microsoft SQL Server Management Studio and create a new user Security -> Logins -> New Login


2)  Grant privileges to the newly created user


3)  Right click server instance and go to Server Properties and make sure that remote connections are allowed to this server.


4)  Now open up SQL Server Configuration Manager


5)  In SQL Server Services make sure the SQL Server is running


Note: Some times when you select SQL Server Services, right hand side shows an error server threw an exception [0x80010105]. Solution for this is, go to Services and scroll down to Windows Management Instrumentation service and Restart it. Now when you close and reopen the Server Configuration Manager, you will see the full list of SQL Server Services.

6)  Next select Protocols for the server instance and make sure the TCP/IP is enabled


7)  Finally go to TCP/IP properties. In localhost(in this instance IP9) and in IP All, remove all dynamic ports and add default port 1433 as TCP port



Access SQL server through Eclipse IDE

This article explains how to make a connection to SQL server database through Eclipse IDE and view/manipulate data in Database Development perspective.

1)  First of all you have to download the database driver. In my case since I am using SQL Server 2008 R2, I should use sqljdbc4.jar  and depending on the server version the jar can change to sqljdbc.jar

2)  Then you have to add the driver definition in Eclipse preferences.
Go to Window -> Preferences -> Data Management -> Connectivity -> Driver Definitions -> Add

Select driver template



Select driver jar file


Fill in the properties


3)  Then open up the Database Development perspective




4)  Next, right click Database Connections create new connection. Select the connection profile for SQL Server, give a name for the connection and press next



Specify the driver and connection details


Here you can select the driver that we defined in step 2 and before testing the connection make sure the Remote connection via TCP/IP is enabled for SQL server and user has the permission for the connection.

You can refer to the article Enable TCP/IP remote connections for SQL server and give user permission for more details on this.

If you select Use Integrated Authentication, the connection will use windows authentication. But this will require sqljdbc_auth.dll and little bit more configurations which will not be covered in this article.

5)  So finally you can test and finalize the connection. After creating the connection you can view and manipulate table data in the SQL Server databases.