Server(Android phone SSHDroid)
1. Install ssh srever in the android phone (Download SSHDroid app from playstore)
2. Switch on the wifi in the phone
3. Open SSHDroid and click start service
Client (computer putyy)
4. Switch on the wifi in the pc
5. Open putyy and enter the server ip and port number
condition: both the devices connected to same wifi network.
6. Once the connection is established it will prompt for username:root password:admin (default credentials)
7. Now check the working by giving 'date' 'cal' commands
In case if you get 'Network error connection refused'
check the ip and port which should be as given by server username@ipaddress:port
further you can enabling the putyy through firewall (which is optional):
Go to Control Panel\System and Security\Windows Firewall\Allowed apps
>allow another app
>browse
>putty.exe
And now it should work properly.
type 'exit' to terminate the connection
Dec 24, 2017
Dec 23, 2017
Accessing the saved wifi password in windows using netsh
Open command prompt by typing 'cmd' in run or win+R and type 'cmd'
> netsh wlan show profiles
>netsh wlan show profiles name=karnatakapg0 key=clear
Now you can see the password being listed in key content
> netsh wlan show profiles
>netsh wlan show profiles name=karnatakapg0 key=clear
Now you can see the password being listed in key content
Sep 21, 2017
Creating a shape file of points from lat long data in postgres sql postgis
MyTable has fields like slno,longitude,latitude
We have to combine longitude,latitude and make another field say 'geom' of type 'public.geometry'
in order to do that first create field 'geom' and execute the following statement.
UPDATE MyTable
SET geom = (SELECT ST_GeomFromText('POINT('||longitude||' '||latitude||')'))
Now that you have PSQL table Open it in QGIS software as vector layerand save as .shape file.
We have to combine longitude,latitude and make another field say 'geom' of type 'public.geometry'
in order to do that first create field 'geom' and execute the following statement.
UPDATE MyTable
SET geom = (SELECT ST_GeomFromText('POINT('||longitude||' '||latitude||')'))
Now that you have PSQL table Open it in QGIS software as vector layerand save as .shape file.
Aug 1, 2017
importing .csv to postgresql
First create the table with column names and sizes in accordance with .csv
Run The SQL:
COPY my_table FROM 'C:\Users\Administrator\Desktop\wrd78.csv' DELIMITER ',' CSV;
OUTPUT Meaage:
ERROR: invalid input syntax for integer: "userName"
CONTEXT: COPY my_table, line 1, column userName: "userName"
********** Error **********
ERROR: invalid input syntax for integer: "userName"
SQL state: 22P02
Context: COPY my_table, line 1, column userName: "userName"
Reason: .csv file has data at ‘userName’row which is character should have been integer.
Solution: Delete the particular row (Mostly it is the column names not data)
Run The SQL Again:
OUTPUT Meaage:
Solution: right click on 'my_table' > sequrity >edit >add> Enter the obj name to select as Everyone
And give all the permission to 'Everyone'
Run The SQL:
Query returned successfully: 14523 rows affected, 161 msec execution time.
Run The SQL:
COPY my_table FROM 'C:\Users\Administrator\Desktop\wrd78.csv' DELIMITER ',' CSV;
OUTPUT Meaage:
ERROR: invalid input syntax for integer: "userName"
CONTEXT: COPY my_table, line 1, column userName: "userName"
********** Error **********
ERROR: invalid input syntax for integer: "userName"
SQL state: 22P02
Context: COPY my_table, line 1, column userName: "userName"
Reason: .csv file has data at ‘userName’row which is character should have been integer.
Solution: Delete the particular row (Mostly it is the column names not data)
Run The SQL Again:
OUTPUT Meaage:
Solution: right click on 'my_table' > sequrity >edit >add> Enter the obj name to select as Everyone
And give all the permission to 'Everyone'
Run The SQL:
Query returned successfully: 14523 rows affected, 161 msec execution time.
Jun 16, 2017
Project facets problem arises when importing maven project into eclipse IDE
why project facets problem arises when importing maven project into eclipse IDE
and how to resolve it.
file>import>maven>existing maven project
rightclick on project>properties>project facets
uncheck java and dynamic web module
rightclick on project>maven>update poject
The best solution is to include plugin in to the POM before importing
Example:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.1</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin>
which makes java 1.8 as facet.
and how to resolve it.
file>import>maven>existing maven project
rightclick on project>properties>project facets
uncheck java and dynamic web module
rightclick on project>maven>update poject
The best solution is to include plugin in to the POM before importing
Example:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.1</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin>
which makes java 1.8 as facet.
Jun 15, 2017
Creating and running the maven as a stand alone application in windows
A.Installing maven
1.Download maven standalone package at https://maven.apache.org/download.cgi
2.unzip on to a prefered location
3.copy the path of the bin say D:\installedSoft\apache-maven-3.3.9-bin\apache-maven-3.3.9\bin
4.create environment variable (USER variable) M2_HOME = D:\installedSoft\apache-maven-3.3.9-bin\apache-maven-3.3.9\bin
5.copy the M2_HOME user variable to the system variable path=%M2_HOME%;
B.Install java JDK
1.create JAVA_HOME and copy to path
C. Check installation and run demo project
1. check the version by executing >> mvn --version in the command line
you should get:
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T22:11:4
7+05:30)
Maven home: D:\installedSoft\apache-maven-3.3.9-bin\apache-maven-3.3.9
Java version: 1.8.0_65, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_65\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows server 2008", version: "6.0", arch: "amd64", family: "dos"
2.Creating a Project by executing
>> mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
3.Build the Project
First change directory to the place where project is generated usually
>> CD C:\Users\Administrator\my-app
>> mvn package
Now that the maven has compiled and created the exucutable jar in the new target folder.
4.Run the application
>> java -cp target/my-app-1.0-SNAPSHOT.jar com.mycompany.app.App
OUTPUT:
Hello World!
1.Download maven standalone package at https://maven.apache.org/download.cgi
2.unzip on to a prefered location
3.copy the path of the bin say D:\installedSoft\apache-maven-3.3.9-bin\apache-maven-3.3.9\bin
4.create environment variable (USER variable) M2_HOME = D:\installedSoft\apache-maven-3.3.9-bin\apache-maven-3.3.9\bin
5.copy the M2_HOME user variable to the system variable path=%M2_HOME%;
B.Install java JDK
1.create JAVA_HOME and copy to path
C. Check installation and run demo project
1. check the version by executing >> mvn --version in the command line
you should get:
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T22:11:4
7+05:30)
Maven home: D:\installedSoft\apache-maven-3.3.9-bin\apache-maven-3.3.9
Java version: 1.8.0_65, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_65\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows server 2008", version: "6.0", arch: "amd64", family: "dos"
2.Creating a Project by executing
>> mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
3.Build the Project
First change directory to the place where project is generated usually
>> CD C:\Users\Administrator\my-app
>> mvn package
Now that the maven has compiled and created the exucutable jar in the new target folder.
4.Run the application
>> java -cp target/my-app-1.0-SNAPSHOT.jar com.mycompany.app.App
OUTPUT:
Hello World!
Jun 9, 2017
How to setup a HTTPS server
Microsoft Windows [Version 6.0.6002]
Copyright (c) 2006 Microsoft Corporation. All rights reserved.
C:\Users\Administrator>cd %JAVA_HOME%
C:\Program Files\Java\jdk1.8.0_65>cd bin
C:\Program Files\Java\jdk1.8.0_65\bin>keytool -help
Key and Certificate Management Tool
Commands:
-certreq Generates a certificate request
-changealias Changes an entry's alias
-delete Deletes an entry
-exportcert Exports certificate
-genkeypair Generates a key pair
-genseckey Generates a secret key
-gencert Generates certificate from a certificate request
-importcert Imports a certificate or a certificate chain
-importpass Imports a password
-importkeystore Imports one or all entries from another keystore
-keypasswd Changes the key password of an entry
-list Lists entries in a keystore
-printcert Prints the content of a certificate
-printcertreq Prints the content of a certificate request
-printcrl Prints the content of a CRL file
-storepasswd Changes the store password of a keystore
Use "keytool -command_name -help" for usage of command_name
Generating own SSL RSA key using java keytool
C:\Program Files\Java\jdk1.8.0_65\bin>keytool -genkey -alias tomcat -keyalg RSA
Enter keystore password: abc@123
Re-enter new password: abc@123
What is your first and last name?
[Unknown]: raghavendra B A
What is the name of your organizational unit?
[Unknown]: srh
What is the name of your organization?
[Unknown]: srh
What is the name of your City or Locality?
[Unknown]: bangalore
What is the name of your State or Province?
[Unknown]: karnataka
What is the two-letter country code for this unit?
[Unknown]: in
Is CN=raghavendra B A, OU=srh, O=srh, L=bangalore, ST=karnataka, C=in correct?
[no]: yes
Enter key password for
(RETURN if same as keystore password):
Output:
the file will be generated at the location C:\Users\Administrator as .keystore
If you want to specify the location and name during the process then use -keystore filename
example:
C:\Program Files\Java\jdk1.8.0_65\bin>keytool -genkey -alias tomcat -keyalg RSA
-keystore C:\Users\Administrator\Desktop\mykey
Apache Tomcat 8 configuration in server.xml
<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystoreFile="C:\Users\Administrator\Desktop\SRHSSLKey"
keystorePass="baikadi@99"/>
Used https://www.opinionatedgeek.com/codecs/htmlencoder for encoding the above code snippet
Checking the working of HTTPS
https://localhost:8443/
Copyright (c) 2006 Microsoft Corporation. All rights reserved.
C:\Users\Administrator>cd %JAVA_HOME%
C:\Program Files\Java\jdk1.8.0_65>cd bin
C:\Program Files\Java\jdk1.8.0_65\bin>keytool -help
Key and Certificate Management Tool
Commands:
-certreq Generates a certificate request
-changealias Changes an entry's alias
-delete Deletes an entry
-exportcert Exports certificate
-genkeypair Generates a key pair
-genseckey Generates a secret key
-gencert Generates certificate from a certificate request
-importcert Imports a certificate or a certificate chain
-importpass Imports a password
-importkeystore Imports one or all entries from another keystore
-keypasswd Changes the key password of an entry
-list Lists entries in a keystore
-printcert Prints the content of a certificate
-printcertreq Prints the content of a certificate request
-printcrl Prints the content of a CRL file
-storepasswd Changes the store password of a keystore
Use "keytool -command_name -help" for usage of command_name
Generating own SSL RSA key using java keytool
C:\Program Files\Java\jdk1.8.0_65\bin>keytool -genkey -alias tomcat -keyalg RSA
Enter keystore password: abc@123
Re-enter new password: abc@123
What is your first and last name?
[Unknown]: raghavendra B A
What is the name of your organizational unit?
[Unknown]: srh
What is the name of your organization?
[Unknown]: srh
What is the name of your City or Locality?
[Unknown]: bangalore
What is the name of your State or Province?
[Unknown]: karnataka
What is the two-letter country code for this unit?
[Unknown]: in
Is CN=raghavendra B A, OU=srh, O=srh, L=bangalore, ST=karnataka, C=in correct?
[no]: yes
Enter key password for
(RETURN if same as keystore password):
Output:
the file will be generated at the location C:\Users\Administrator as .keystore
If you want to specify the location and name during the process then use -keystore filename
example:
C:\Program Files\Java\jdk1.8.0_65\bin>keytool -genkey -alias tomcat -keyalg RSA
-keystore C:\Users\Administrator\Desktop\mykey
Apache Tomcat 8 configuration in server.xml
<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystoreFile="C:\Users\Administrator\Desktop\SRHSSLKey"
keystorePass="baikadi@99"/>
Used https://www.opinionatedgeek.com/codecs/htmlencoder for encoding the above code snippet
Checking the working of HTTPS
https://localhost:8443/
Apr 18, 2017
How to keep multiple instance of tomcat running
There are two ways in which one can make use of a software one by using
1.installer (where some software helps in deploying files in appropriate places and modifying environment variables)
Microsoft Windows application uses MSI (Microsoft software installer)
Red hat based Linux uses YUM utility
Debian based Linux variant say Ubuntu uses APT utility
"But the major problem using installer is, there is no flexibility for the user to change it to suit his or her requirement"
so here comes the second way of using a software
2.Archived
Instead of downloading the installers just down load .zip .tar type software package and unpack it. now you can customize it.
1. Download Tomcat from here & unzip to any location.
2. Go to \Conf folder and take the backup of all the files (It is good practice to have the backup of original files before making any changes)
3. we are going to edit web.xml and change 'listings' param-value 'false' to 'true'.
<servlet>
<servlet-name>default</servlet-name>
<servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
<init-param>
<param-name>listings</param-name>
<param-value>true</param-value>
</init-param>
</servlet>
4. Edit server.xml if you want to run multiple instances of tomcat simultaneously connecting to different port you can do it by changing 8080 to some other value.
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
5. Edit tomcat-users.xml and give the user name password for 'manager-gui' role (uncomment if commented).
<role rolename="manager-gui"/>
<user username="admin" password="admin" roles="manager-gui"/>
6.Add the environmental variable 'JAVA_HOME' for Development of Java based application
or 'JRE_HOME' for just running the application purpose.
My computer - Properties -Advanced system settings - Environment variables
Ex:
variable name: JAVA_HOME
variable value: C:\Program Files\Java\jdk1.8.0_73
7. Now start the tomcat by double clicking on startup.bat
check at http://localhost:8080
8.Now stop the tomcat by double clicking on shutdown.bat
1.installer (where some software helps in deploying files in appropriate places and modifying environment variables)
Microsoft Windows application uses MSI (Microsoft software installer)
Red hat based Linux uses YUM utility
Debian based Linux variant say Ubuntu uses APT utility
"But the major problem using installer is, there is no flexibility for the user to change it to suit his or her requirement"
so here comes the second way of using a software
2.Archived
Instead of downloading the installers just down load .zip .tar type software package and unpack it. now you can customize it.
1. Download Tomcat from here & unzip to any location.
2. Go to \Conf folder and take the backup of all the files (It is good practice to have the backup of original files before making any changes)
3. we are going to edit web.xml and change 'listings' param-value 'false' to 'true'.
<servlet>
<servlet-name>default</servlet-name>
<servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
<init-param>
<param-name>listings</param-name>
<param-value>true</param-value>
</init-param>
</servlet>
4. Edit server.xml if you want to run multiple instances of tomcat simultaneously connecting to different port you can do it by changing 8080 to some other value.
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
<role rolename="manager-gui"/>
<user username="admin" password="admin" roles="manager-gui"/>
or 'JRE_HOME' for just running the application purpose.
My computer - Properties -Advanced system settings - Environment variables
Ex:
variable name: JAVA_HOME
variable value: C:\Program Files\Java\jdk1.8.0_73
7. Now start the tomcat by double clicking on startup.bat
check at http://localhost:8080
8.Now stop the tomcat by double clicking on shutdown.bat
Subscribe to:
Posts (Atom)