Showing posts with label engineering. Show all posts
Showing posts with label engineering. Show all posts

Sunday, September 15, 2013

Maven notes

<!-- user defined properties in the pom.xml -->

 <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  <jdk.version>1.8</jdk.version>
  <log4j.version>1.2.17</log4j.version>
</properties>

<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.7</version>

</dependency>
</dependencies>

<build>

<plugins>

<!-- specify java version  -->

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
</plugin>

<!--download sources and javadocs -->

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
</configuration>
</plugin>

<!-- create manifest file-->

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>hr.samara.mock.StartService</mainClass>
<classpathPrefix>dependency-jars/</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>

<!-- copy dependency jars to dependency-jars folder-->

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/dependency-jars/</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>

</plugins>

<pluginManagement>
<plugins>

<!-- Ignore/Execute plugin execution -->

<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<!-- copy-dependency plugin -->
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<versionRange>[1.0.0,)</versionRange>
<goals>
<goal>copy-dependencies</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>

</build>

Install jar file to local repository

mvn install:install-file -Dfile=./mariadb-java-client-1.1.5.jar -DgroupId=org.mariadb.jdbc -DartifactId=mariadb-java-client -Dversion=1.1.5 -Dpackaging=jar


Resolving OutOfMemory Error

export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=128m"

Thursday, June 20, 2013

PKI (public key infrastructure)

Public-key cryptography is a cryptographic technique that enables users to securely communicate on an insecure public network, and reliably verify the identity of a user via digital signatures.

Sender and receiver both have pair of private and public keys.

To send encrypted message sender is using reveiver's public key.
Prior to that he can encrypt signature using his private key.

Receiver needs to decrypt message using his private key.
To decrypt signature and to authenticate the sender he is using sender's public key.




Certificate Signing Requests (CSRs)
A CSR consists mainly of the public key of a key pair, and some additional information. Both of these components are inserted into the certificate when it is signed.

Whenever you generate a CSR, you will be prompted to provide information regarding the certificate. This information is known as a Distinguised Name (DN). An important field in the DN is the Common Name (CN), which should be the exact Fully Qualified Domain Name (FQDN) of the host that you intend to use the certificate with.


Ref:

Wednesday, November 7, 2012

Port forwarding /tunneling


From wiki

Port forwarding or port mapping is a name given to the combined technique of:
  1. translating the address and/or port number of a packet to a new destination 
  2. possibly accepting such packet(s) in a packet filter (firewall)
  3. forwarding the packet according to the routing table.

The destination may be a predetermined network port (assuming protocols like TCP and UDP, though the process is not limited to these) on a host within a NAT-masqueraded, typically private network, based on the port number on which it was received at the gateway from the originating host.
The technique is used to permit communications by external hosts with services provided within a private local area network.

Examples

Windows server
Kad dodje komunikacija prema 213.186.16.227:1433 preusmjeri to na 192.168.7.27:1433
netsh interface portproxy add v4tov4 
listenport=1433 listenaddress=213.186.16.227 
connectport=1433 connectaddress=192.168.7.27

Display all port forwards::
netsh interface portproxy show all

Delete:
netsh interface portproxy delete v4tov4 
listenport=1433 listenaddress=213.186.16.227 

For putty tunneling:
http://www.codemastershawn.com/library/tutorial/ssh.tunnel.php