Tuesday, December 17, 2013

Using maven to create executable jar file

 To create executable jar file with maven all you need to do is to add the corresponding plugin description to your pom.xml file. Shade plugin is what we need!

<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>2.0</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <transformers>
                <transformer implementation="org.apache.maven.

plugins.shade.resource.ManifestResourceTransformer">
                  <mainClass>com.vbashur.trying.threads.App</mainClass>
                </transformer>
              </transformers>
            </configuration>
          </execution>
        </executions>
      </plugin>

Converting m/s to km/h

One of the easiest way to convert speed from m/s to km/h.
tmp = v * 4
result = tmp - (tmp * 0.1)
Where v - speed given (meters per a second)
For example: need to convert 65 m/s to km/h. 65 *4 = 260; 260 - 26 = 234 km/h. 65 m/s = 234 km/h
Let's check it! 1 m/s = 60 meters per minute = 3600 meters per hour = 3.6 km/h. Given speed is 65 m/s, 65 * 3.6 = 234 km/h. Our result is correct.