Sep 29, 2015

How to create MySQL/MariaDB tables which have column-names conflicting with reserved words?

Today I've running a MariaDB instance as a docker image. This image is linked to a
running Wildfly-Instance, which has a DataSource configured to connect to the linked
MariaDB-Instance.

But on the deployment of an JEE artefact, JPA tries to create the database, but the
create-Statement fails, because one column is named KEY,which is a reserved word.


To create the table manually, you can copy the create-Statement from the Wildfly-Log and
escape the keyword-column with a back-tick "`" character.

for example:
create table tt ( Col1 varchar(255), `KEY` varchar(255) );

When you restart the deployment the table must not be created.
$WILDFLY_HOME/bin/jboss-cli.sh -c --controller host:9990
Authenticating against security realm: ManagementRealm
Username: admin
Password:
[standalone@bpc:9990 /] /deployment=mydeployment.war:redeploy()





Sep 25, 2015

Making/postprocessing Screenshots on Fedora 22 system.

The repositories have more tools. One is the gnome-screenhot. 

This has some shortcuts to captures screenshots:



But here you can not process the data.

You get some more options, when you start gnome-screenshot -i: 



 Here you can select your option and after the capture you can save the screenshot.



But this doesn't let you process the picture. Here shutter ( is also in the Fedora repo ) has more advantages.

After taking the screenshot of context-menus, windows, screen or areas, you can start an editor.

There you can Crop a selection and just save the interesting area:




Here is the result. gnome-screenshot -i with a timer of 3 seconds was used to capture the Shutter editor with the menu.
When you select Crop, the screen is darkened and you can select the area. After pressing "Return/Enter" or pressing the "Crop" Button you get just the selected area  and can overwrite the image.

How to insert mutliple rows in a LibreOffice Calc-Document at once?

On my Feodra 22,I have LibreOffice 4.4.5.2 installed from the Default-Repositories.

To insert a new row in a Calc ( Excel ) Document, the INSERT-Menu has a Rows item, which
adds one row.

But when you have to add more data, it is tedious to insert row by row.

It is much easier, but I wouldn't have found this option. See here.

Just select the number of rows you like to insert in the spreadsheet and do a right-click on the
left side of the document, where the row numbers are shown.




In the context-menu click Insert Rows Above  and you get a bunch of new rows.


Sep 23, 2015

Can not access docker container with "docker exec -it /bin/bash" - Just returns the host prompt on Fedora 22

I built a new docker container as a database server with the last mariadb source on docker.io/fedora:latest.

After building and installing the software, I started the database-server.

When I wanted to access the container with the
docker exec -it <container> /bin/bash

I just fell back to the host prompt.

A
journalctl -r 

and a warning-Alert showed some SE-Linux problems.

$ docker version
Client:
 Version:      1.8.1.fc22
 API version:  1.20
 Package Version: docker-1.8.1-3.git32b8b25.fc22.x86_64
 Go version:   go1.4.2
 Git commit:   32b8b25/1.8.1
 Built:      
 OS/Arch:      linux/amd64
Server:
 Version:      1.8.1.fc22
 API version:  1.20
 Package Version:
 Go version:   go1.4.2
 Git commit:   32b8b25/1.8.1
 Built:      
 OS/Arch:      linux/amd64


After reading the Ticket 1232803, I did a

sudo dnf reinstall docker-selinux

and after the reinstallation, I could access the container again.

Sep 16, 2015

How to avoid providing user/password credentials, when updating multiple git repositories?

Git repositories are storage areas for source-code and other files to keep a history of the files.

To provide access to multiple people, these repositories are kept somewhere centrally accessible.

In my current case the SCM-Manager is used.

To get a repository you do

cd <TargetDirectory>git clone http://scm-manager.example.com/scm/git/<repo>

This is asking for credentials if the access is controlled.

Now, when you are working with multiple repositories, I often do:

for d in `ls -1`; do
cd $d
git fetch --all -t --prune
cd ..
done 

to update all repositories.
But this requests the credentials for every repository.

You can already supply the credentials during the cloning in the URL with
http://<user>:<password>@scm-manager.example.com....

But, when the password has some special characters you've got a problem.

Git has support to store the credentials:

First store a helper in the config of each repository:

for d in `ls -1`; do
cd $d;
git config credential.helper 'store --file=/<path>/.git_credentials';
git config credential.http://scm-manager.example.com.username  <username>;
cd ..;
done

The first call requests a password and the following one's use the cached credential.

$ for d in `ls -1`; do  cd $d; git fetch --all -t --prune; cd ..; done
Fetching origin
Fetching origin
Fetching origin
Fetching origin
Fetching origin
Fetching origin
Fetching origin
Fetching origin
Fetching origin
Fetching origin
Fetching origin
Fetching origin
Fetching origin
Fetching origin
Fetching origin
Fetching origin
Fetching origin
Fetching origin
Fetching origin
Fetching origin
Fetching origin
Fetching origin
$




Sep 15, 2015

How to shutdown jenkins CI-Server in a clean state.

Jenkins is a CI-Server, which can check a multitude of SCM-Repositories like ( CVS, Subversion, git with a plugin and much more with plugins ).

The  server can be started standalone with the jar-call:

HTTP_PORT=8181
export PATH=/usr/local/bin:$PATH
export JAVA_HOME=/usr/java1.7/
export JENKINS_BASEDIR=/home/jenkins
export JENKINS_HOME=$JENKINS_BASEDIR/jenkins
export JENKINS_OPTS=--httpPort=$HTTP_PORT
$JAVA_HOME/bin/java -jar $JENKINS_BASEDIR/bin/jenkins.war $JENKINS_OPTS

In the running Jenkins-Server, the configured jobs are executed.

Now you can activate a shutdown in the WEB-GUI and wait until all jobs are finished.

The other way to shut down is via the jenkins-cli.jar

$JAVA_HOME/bin/java -jar $JENKINS_HOME/war/WEB-INF/jenkins-cli.jar -s http://localhost:$HTTP_PORT safe-shutdown --username user --password pw

This call waits until jenkins has finished all jobs and shuts the server down.

Other useful commands can be fetched with

 $JAVA_HOME/bin/java -jar $JENKINS_HOME/war/WEB-INF/jenkins-cli.jar -s http://localhost:$HTTP_PORT help





Sep 2, 2015

RedHat created an OpenSource Font named Overpass

Yesterday I got the news about a new font named Overpass which was developed by RedHat.

You can get this font from http://overpassfont.org/.

I extracted the font on my Fedora 22 system under /usr/share/fonts/Overpass


ls /usr/share/fonts/Overpass/Overpass Bold Italic.ttf  Overpass ExtraLight Italic.ttf  Overpass Italic.ttf        Overpass Light.ttfOverpass_Bold.ttf         Overpass Extra Light.ttf        Overpass Light Italic.ttf  Overpass_Regular.ttf


After this: 

sudo fc-cache -f -v 

Updated the font cache and the font can be used. 

Another font is the Source Code Pro from Adobe. 
This is a monospace font designed for developers. 

Update: Today another free font Hack for Developers is available: 

http://sourcefoundry.org/hack/