Wednesday, September 23, 2015

Glassfish 4.1 change admin password

./asadmin --host localhost --port 4848 change-admin-password

Glassfish 4.1 enable secure admin

./asadmin --host localhost --port 4848 enable-secure-admin
maybe you have to set the master/admin (user: admin) password (default empty password or adminadmin)

Linux install Oracle Java from cmd

1. create folder: /opt/Oracle_Java/
2. download and unzip in /opt/Oracle_Java/:
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie"  http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.tar.gz
3. add to system
sudo update-alternatives --install "/usr/bin/java" "java" "/opt/Oracle_Java/jdk1.7.0_VERSION/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/opt/Oracle_Java/jdk1.7.0_VERSION/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/opt/Oracle_Java/jdk1.7.0_VERSION/bin/javaws" 1
sudo update-alternatives --install "/usr/bin/jar" "jar" "/opt/Oracle_Java/jdk1.7.0_VERSION/bin/jar" 1 
4. configure system
sudo update-alternatives --set "java" "/opt/Oracle_Java/jdk1.7.0_VERSION/bin/java"
sudo update-alternatives --set "javac" "/opt/Oracle_Java/jdk1.7.0_VERSION/bin/javac"
sudo update-alternatives --set "javaws" "/opt/Oracle_Java/jdk1.7.0_VERSION/bin/javaws"
sudo update-alternatives --set "jar" "/opt/Oracle_Java/jdk1.7.0_VERSION/bin/jar" 

Thursday, September 17, 2015

Custom Dialog Android

public class MyCustomDialog {
    AlertDialog dialog;
    public MyCustomDialog(Context context) {
        Builder builder = new AlertDialog.Builder(context);
        builder.setCancelable(true);
        builder.setTitle(context.getString(R.string.dialogTitle));
        LayoutInflater factory = LayoutInflater.from(context);
        View mView = factory.inflate(R.layout.myCustomLayout, null);
        builder.setView(mView);
        builder.setPositiveButton(context.getString(R.string.OKButton), new OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {    
            }
        });
        dialog = builder.create();
    }
    public void showMe(){
        dialog.show();
    }
    public void closeMe(){
        dialog.dismiss();
    }
}

Friday, September 11, 2015

Fix Node npm permission sudo error

sudo chown -R $(whoami) ~/.npm
sudo chown -R $USER /usr/local/lib/node_modules

Blogspot example code block

<pre style="background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0Kit6bCBveZCI7q9DsmOIdtfJqazoKadiBEjCedYyBiwSXD04o5eczilCnuxbhJjh_FHivs5XmAHSBVVEd1K5bGYo3EYtk9pJ7KTzaYFn-IKL1YiyCWQH8NPhtBBe4WZiZdJ5oHASe3_K/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;">
CODE
</code></pre>

Add locale to ubuntu-server

sudo apt-get install language-pack-XX
or
sudo locale-gen de_DE
sudo locale-gen de_DE.UTF-8
sudo update-locale

Friday, November 11, 2011

Android: Hide the status bar

requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
Note: Must be called before adding content

Tuesday, October 18, 2011

How to draw a line through a TextView

TextView tvSubject = new TextView(context);
tvSubject.setText("Text");
tvSubject.setPaintFlags(tvSubject.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG );
Now there is a line through the text.

Tuesday, October 11, 2011

How to set the weight of a view dynamically

If you want to change the weight-attribute of a view without the need of using the XML-file, you need to specify the LayoutParams:

Long weight = 1l;   //The"weight"int 
wrapContent = LayoutParams.WRAP_CONTENT;
LayoutParams lp = new LayoutParams(wrapContent, wrapContent, weight); //Creating a
paramTextView tv = new TextView(context);tv.setLayoutParams(lp); //Using the param for the weight

Screen: Linux comment run in a new detached screen session

screen -d -S NAME -m COMMENT 

-d = detached
-S = set Name
-m = ignore the $STY environment variable