Angular starter project

https://github.com/marioosh-net/angular-starter

Posted in Uncategorized | Leave a comment

maven: Deploying .jar to remote Maven repository by ftp

	<build>
		<plugins>
                        <!-- other plugins, skipped -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-deploy-plugin</artifactId>
				<version>2.8.2</version>
			</plugin>
		</plugins>
 
		<extensions>
			<!-- Enabling the use of FTP -->
			<extension>
				<groupId>org.apache.maven.wagon</groupId>
         		<artifactId>wagon-ftp</artifactId>
         		<version>1.0-beta-6</version>
			</extension>
		</extensions>
	</build>
 
	<distributionManagement>
		<repository>
			<id>repo-server</id>
			<url>ftp://192.168.1.253/var/maven</url>
		</repository>
	</distributionManagement>

~/.m2/settings.xml – need login/pass

	<settings>
		<servers>
			<server>
				<id>repo-server</id>
				<username>maven</username>
				<password>***</password>
			</server>
		</servers>
	</settings>

On server (need active ftp daemon working with local user login/passwords):
$ useradd -m maven
$ passwd maven
$ mkdir /var/maven
$ chown -R maven:maven /var/maven

Posted in Uncategorized | Leave a comment

sendmail: send file contents

sendmail someone@somewhere.com < somefile

Posted in Linux, Linux shell, Uncategorized | Leave a comment

Git tags

Tags
git tag -a v1.0 -m 'version 1.0' # add tag
git tag -d v1.0 # remove tag
git push origin :refs/tags/v1.0 # remove remote tag

Posted in git | Leave a comment

Eclipse SWT: javadocs link

http://help.eclipse.org/luna/topic/org.eclipse.platform.doc.isv/reference/api/index.html

Posted in Uncategorized | Leave a comment

curl: basic auth + json + post

curl --user user:pass -k -v -H "Content-Type: application/json; charset=utf-8" -X POST -d '{"text":"message"}' https://somewhere.com/rest/test

Posted in Uncategorized | Leave a comment

Android – Save / Load state Fragment

public class SomeFragment extends Fragment {
 
    public final static String OBJECT_ATTR = "object";
    Data data;
 
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
 
        /**
         * restore
         */
        if(savedInstanceState != null) {
            data = savedInstanceState.getParcelable(OBJECT_ATTR);
        }
 
        /**
         * using data
         */
        ...
    }
 
    /**
     * called when configuration change, but not on getting fragment from back-stack
     */
    @Override
    public void onSaveInstanceState(Bundle outState) {
        /**
         * save
         */
        super.onSaveInstanceState(outState);
        outState.putParcelable(OBJECT_ATTR, data);
    }
}
Posted in Android, Java | Leave a comment

Android: Install .apk from command line

adb install -r app.apk
Posted in Android | Leave a comment

Maven project from archetype – Interactive mode

mvn archetype:generate -Dfilter=org.apache.maven.archetypes:

Good ones for starting: maven-archetype-quickstart, maven-archetype-webapp

mvn archetype:generate -DarchetypeCatalog=http://repo.maven.apache.org/maven2/archetype-catalog.xml -Dfilter=org.codehaus.mojo.archetypes:

Good ones for starting: ejb-javaee6, ejb-javaee7

Posted in Java, Maven | Leave a comment

openssl: self-signed certificate + .pfx

without CA

openssl genrsa -des3 -out server.key 1024
openssl req -new -key server.key -out server.csr
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
openssl pkcs12 -passout pass:password -export -out server.pfx -inkey server.key -in server.crt

with CA

openssl req -new -x509 -extensions v3_ca -keyout ca.key -out ca.crt -days 3650
openssl genrsa -out certificate.key 1024
openssl req -new -key certificate.key -out certificate.csr
openssl x509 -req -days 365 -in certificate.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out certificate.crt
openssl pkcs12 -passout pass:password -export -out certificate.p12 -inkey certificate.key -in certificate.crt -chain -CAfile ca.crt
Posted in SSL | Tagged , , , | Leave a comment