Archive
Emacs: murrine_style_draw_box: assertion `height >= -1′ failed
This nasty bug has been around for over a year: Calling Emacs on Ubuntu from the console outputs
murrine_style_draw_box: assertion `height >= -1′ failed
after every action within Emacs.
The solution is simple, but has not been integrated in the Ubuntu repository yet.
Here it is:
In the file
/usr/share/themes/Ambiance/gtk-2.0/gtkrc
change
GtkRange::trough-under-steppers = 0
to
GtkRange::trough-under-steppers = 1
For details see Bug #538541, Bug #550532 and Resolving “murrine_style_draw_box: assertion `height >= -1′”
Using basic Emacs keybindings in Gnome-Terminal
Summary: Use basic Emacs keyboard shortcuts (ie navigation) in Gnome-Terminal while using the Bash shell. This post is only interesting for people familiar with Emacs.
This is so simple that I almost afraid to post it…
…One of those things that has been bothering you for years(!), but was never urgent enough to invest time figuring out how to fix…
Problem:
You’re used to Emacs shortcuts. Bash (and many other shells) support Emacs keybindings out of the box. But your default terminal comes with a stupid menu bar. So you press M-d (Emacs’ “kill-word”; for non-Emacs users: this corresponds to the key sequence Alt-d) and end up calling the “File” menu entry of the Gnome-Terminal (File is called “Datei” in German, which is my LOCAL). If you your LOCAL settings are English, you will have the same problem with the Emacs shortcut M-f (in Emacs this is “word-forward”): The Gnome-Terminal will grap the key sequence and open the “File” menu.
Solution:
- Open your Gnome-Terminal
- Edit -> Keyboard shortcuts -> DISABLE ALL MENU ACCESS KEYS (If you have German settings the menu entry is called: “Bearbeiten -> Tastenkombinationen -> Alle Menükürzel aktivieren”. Disable the checkbox..)
That’s it.
My HelloWorld script for Maven
I’m still in the learning phase of using Maven, so bare with me. Here is my script to create an executable HelloWorld-jar file using Maven (it requires the file sample-pom.xml listed after the script):
#!/bin/bash # # Description: Create a simple Java project using Maven. # # Status: Works # # Author: draptik # # Created: Mon Jun 15 21:17:24 2009 # # REQUIREMENTS # ============ # # 1. Maven # # 2. This script requires the file "sample-pom.xml"!!! # # 3. The "sample-pom.xml" file should be located in the same folder as # this script. # # USAGE # ===== # # 1. Copy this script and "sample-pom.xml" to a newly created test # folder (ie ~/tmp/maventesting/). # # 2. Run this script # # DETAILS # ======= # # This script creates a "quickstart" Maven project, then overwrites # the created pom.xml with something more sensible (including some # useful Maven plugins), and runs "java -jar <your-program>.jar". ## User settings companyName="org.foo" appName="my-app" ## Static file samplePom="sample-pom.xml" pdinfo="[PDINFO] " ## Delete old builds echo "$pdinfo" "====== REMOVING PREVIOUS BUILDS =====================" echo "$pdinfo" "rm -rf \"$appName\"" rm -rf "$appName" ## Create Maven skeleton ## ## NOTE: You can exchange the first 2 lines with: ## ## mvn archetype:create \ ## -DarchetypeGroupId=org.apache.maven.archetypes \ ## ## This will result in a warning that "archetype:create" is ## deprecated. The warning states that you should use ## "archetype:generate". This archetype is interactive by default. To ## skip the interactive part and choose the default (="quickstart") ## you have to pass the option "-Dinteractive=false" to Maven. echo "$pdinfo" "====== MAVEN CREATION ================================" echo "$pdinfo" "" mvn archetype:generate \ -DinteractiveMode=false \ -DarchetypeGroupId=org.apache.maven.archetypes \ -DgroupId="$companyName" \ -DartifactId="$appName" ## Show the diff between generated pom.xml and sample-pom.xml echo "$pdinfo" "====== DIFF BETWEEN GENERATED AND MY POM.XML ========" echo "$pdinfo" "diff -u \"$appName\"/pom.xml \"$samplePom\" " diff -u "$appName"/pom.xml "$samplePom" ## Overwrite generated pom.xml echo "$pdinfo" "====== OVERWRITING GENERATED POM.XML ================" echo "$pdinfo" "cp \"$samplePom\" \"$appName\"/pom.xml" cp "$samplePom" "$appName"/pom.xml ## Move to newly created project cd "$appName" ## Make an executable jar file echo "$pdinfo" "====== MAKING THE FINAL JAR FILE ====================" echo "$pdinfo" "mvn package" mvn package ## Move to target folder cd target ## Run the Hello-World example echo "$pdinfo" "====== TESTING THE JAR FILE ==========================" echo "$pdinfo" "java -jar $appName-1.0-SNAPSHOT.jar..." echo "$pdinfo" "If the next line does not read \"Hello World!\", something is wrong" java -jar "$appName"-1.0-SNAPSHOT.jar
Here is the file sample-pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.foo</groupId>
<artifactId>my-app</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>my-app</name>
<url>http://maven.apache.org</url>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>org.foo.App</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Creating and applying a patch file
This is a simple example shell script demonstrating how to apply a patch file.
#!/bin/sh # # Description: Simple demo of creating and # applying a patch file. # # Author: draptik # ## TODO: Make sure you don't have a directory by ## this name DEMODIR="$HOME/tmp/diff-patch-demo-draptik" ORIGDIR="$DEMODIR/original-stuff" APPLYDIR="$DEMODIR/patch-usage" # ## Cleanup before use rm -rf "$DEMODIR" mkdir "$DEMODIR" cd "$DEMODIR" # ## Create directories mkdir $ORIGDIR mkdir $APPLYDIR # ## Switch directory cd $ORIGDIR # ## Create original file (the file you want to patch) ORIGCODE="mycode.txt" echo "This is the old content" > $ORIGCODE ## Create file with your changes NEWCODE="mycode.new.txt" echo "THIS IS THE NEW CONTENT" > $NEWCODE # ## ============================ # 1. CREATE A PATCH ## ============================ # ## Make a diff between the files and save the ## result to $PATCHFILE ## ## You can use different diff options: ## "-u" (unified) ## OR ## "-c" (context). ## ## The "-u" option is specific to GNU. ## PDTODO: Write about different diff formats. PATCHFILE="patch-mycode" echo "" echo "***************************" echo "*** YOU ARE NOW IN FOLDER: \"$PWD\"" echo "*** DIFF BETWEEN\n***\t\"$PWD/$ORIGCODE\"\n*** AND\n***\t\"$PWD/$NEWCODE\":" echo "***************************" diff -u $ORIGCODE $NEWCODE | tee $PATCHFILE # ## Switch directory cd "$DEMODIR" # ## Copy the unpatched original file ($ORIGCODE) and ## the $PATCHFILE to different directory ($APPLYDIR). cp $ORIGDIR/$ORIGCODE $APPLYDIR cp $ORIGDIR/$PATCHFILE $APPLYDIR # # ## ============================ # APPLY A PATCH ## ============================ # ## Apply the patch to a copy of the original file ## ## The "--backup" option will create a file ## "$ORIGCODE.orig" as backup. ## You can drop this option. ## cd $APPLYDIR echo "" echo "***************************" echo "*** YOU ARE NOW IN FOLDER: \"$PWD\" ..." echo "*** NOW PATCHING WITH COMMAND \"patch --backup -p0 < $PATCHFILE\"..." echo "***************************" patch --backup -p0 < $PATCHFILE ## patch -p0 < $PATCHFILE # ## Show that the file has been patched correctly: cd .. echo "" echo "****************************" echo "*** YOU ARE NOW IN FOLDER: \"$PWD\"" echo "*** DIFF BETWEEN\n***\t\"$ORIGDIR/$ORIGCODE\"\n*** AND\n***\t\"$APPLYDIR/$NEWCODE\":" echo "****************************" diff -u $ORIGDIR/$ORIGCODE $APPLYDIR/$ORIGCODE
Recent Comments