Nick's Tech Blog

Pages

Friday, June 15, 2012

Cappuccino > narwhal-rhino fails to load library from "noexec" /tmp directory

Problem

When executing "jake deploy", I received the following stacktrace:
Exception in thread "main" java.lang.UnsatisfiedLinkError: /tmp/jna868211880998617115.tmp: /tmp/jna868211880998617115.tmp: failed to map segment from shared object: Operation not permitted
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1807)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1703)
at java.lang.Runtime.load0(Runtime.java:770)
at java.lang.System.load(System.java:1003)
at com.sun.jna.Native.loadNativeLibraryFromJar(Native.java:744)
at com.sun.jna.Native.loadNativeLibrary(Native.java:678)
at com.sun.jna.Native.(Native.java:106)
at com.sun.jna.NativeLibrary.(NativeLibrary.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:161)
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:247)
at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1702)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:845)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:66)
at org.mozilla.javascript.gen._usr_local_cappuccino_packages_jake_lib_jake_js_7._c_anonymous_13(Unknown Source)
at org.mozilla.javascript.gen._usr_local_cappuccino_packages_jake_lib_jake_js_7.call(Unknown Source)

Solution

The cause of this issue, is because the /tmp directory is mounted noexec on our operating system. Current workarounds exist by specifying the java.io.tmpdir JVM arg (as another executable directory).

The version of narwhal-rhino shipped with cappuccino 0.9.5 currently ignores the JAVA_OPTS environment variable.

To fix:
1. Modify the line 25 in $CAPPUCCINO_HOME/engines/rhino/bin/narwhal-rhino
from
JAVA_OPTS="-Dnarwhal.http_proxy=$http_proxy"
to
JAVA_OPTS="-Dnarwhal.http_proxy=$http_proxy $JAVA_OPTS"

2. Then a new tmpdir can be specified by setting the JAVA_OPTS env var.
E.g.
export JAVA_OPTS=-Djava.io.tmpdir=/somedir-that-is-executable

This should do the trick.

See also
https://github.com/cappuccino/cappuccino/issues/1512

Ubuntu > dragging windows to desktop sides not working

Problem

Basically, dragging windows to sides of the screen isn't readjusting the window size to half the screen.

(I later found out this feature was called "window grid".)

Solution

I'm reposting the solution, because it worked.

In the terminal...
  1. compiz --replace & disown
  2. (I then needed to logout and log back in, as none of my windows were responding)
  3. unity --reset
That should be it, windows now snap to half the screen, when dragged to the sides of the desktop.

See Also

Thursday, June 14, 2012

TIBCO > HTTP Connection automatically responds to HTTP OPTIONS method

Problem

The default HTTP Connection is automatically responding to HTTP OPTIONS methods, without being processed by my HTTP receiver (I want to be able to process these requests!).

Here is the default response:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Allow: GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS
Content-Length: 0
Date: Thu, 14 Jun 2012 08:14:35 GMT

Solution

  1. In the "HTTP Connection" Configuration tab, change the Server Type from "Tomcat" to "HttpComponent".
This should allow you to process all HTTP methods.

I'm yet to clarify whether this problem is related to Tomcat (or the HTTP Connection). Please feel free to respond if you find out!

Thursday, May 31, 2012

TIBCO > MimeParts are incorrectly parsed by the HTTP Receiver

Problem

The TIBCO ActiveMatrix BusinessWorks Administration document explains it best (last seen here)
In previous releases, when the content-type of an incoming message was "multipart/*", the first part of the message was presented as the POSTDATA. This is incorrect according to MIME specification.
Solution 
The bw.plugin.http.handleAllMimePartsAsAttachment property fixes this problem.

If this property is set to true and the top-level content-type of the incoming HTTP message is "multipart/*", then an HTTP Receiver will present all the MIME parts as attachments and the POSTDATA field will be empty. If this property is set to false (the default value), backward compatibility is maintained and the first MIME part is presented as the POSTDATA.

N.B. Do not check the Parse Post Method Data field on the HTTP Receiver process starter when this property is set to true. This causes an error to be thrown.
Development
  1. Simply add the following line to your <designer_home>/<version%gt;/properties.cfg file (create it, if it doesn't already exist).
    1. bw.plugin.http.handleAllMimePartsAsAttachment=true
  2. Restart Designer
Runtime (N.B. I haven't tested this yet, feedback warmly welcomed!)
  1. At run time, append it to the deployed .tra file.
See also:
https://www.tibcocommunity.com/thread/13797?tstart=1425

Thursday, September 29, 2011

Ubuntu > Display notifications over the screensaver

I'm currently playing around with notifications, and I'm trying to "keep" notifications displayed above the screensaver, so that I can see if I've got new mail or an IM from afar, without having to unlock my pc.

Basically the opposite problem to these:
http://www.jwz.org/xscreensaver/faq.html#popup-windows
http://www.google.com/search?q=notifications+over+screensaver+ubuntu

I'm using a command similar to the following, to display messages with an infinite timeout:
Code:

$ notify-send -t 0 -i info "You've got mail" "mailbox (123)"

Currently notifications get displayed temporarily "above" the xscreensaver, but eventually xscreensaver will "raise" itself above the notification (e.g. after a minute or two).

Here are my options, as I see it currently:

1) Download the xscreensaver's source code, modify it to prevent it raising itself above the notifications, build and install it (painful... I've managed to build it from the source, but I don't know what I should be modifying.)

2) Write my own custom screensaver (not really path I want to take, when I already have a notification and screensaver framework).

Are there any other (easier) options I've missed? Can anyone help?

(There's an argument that nothing should be displayed over the top of screensavers... )

Some context:
Ubuntu 11.04
Unity
notification-daemon/natty uptodate 0.5.0-2ubuntu1 (better functionality than notify-osd - i.e. click to close, vertical stacking, customisation...)
xscreensaver/natty uptodate 5.12-0ubuntu3 (more customisable than gnome-screensaver).

See also:

The same question, posted on the ubuntu forums:
http://ubuntuforums.org/showthread.php?p=11292893#post11292893

Traceback to a thread, on customising notify-osd notifications:
http://www.webupd8.org/2011/05/configurable-notifyosd-bubbles-for.html#dsq-comment-199829486

Another alternative to notification-daemon and notify-osd is avant-window-navigator 
http://maketecheasier.com/2-ways-to-make-ubuntu-notification-more-user-friendly/2011/05/21

Unfortunately, this is the closest solution I've found to notifications whilst the screensaver is running (checkGmail lights up the scroll lock key on the keyboard).
http://ubuntuforums.org/showthread.php?t=1564412

Wednesday, September 28, 2011

Ubuntu > Compiling package/s from source

Just putting together a quick "cheatsheet" for compiling and installing a package from it's source code.

Start here: (it's all here and it's very simple...)
https://help.ubuntu.com/community/CompilingSoftware
https://help.ubuntu.com/community/CompilingEasyHowTo

Pre-requisites:
sudo apt-get install build-essential checkinstall

Optional - to assist in retrieving the source code:
sudo apt-get install cvs subversion git-core mercurial

By convention, put source code under here (extract the source if it's in a zip, tar.gz, etc):
/usr/local/src

From the root of the source code:
./configure

Resolve any missing dependencies:
sudo apt-get build-dep <package>
apt-file search <your-missing-file.h>


Build the code:
sudo make

Package the code into a *.deb:
sudo checkinstall

Install the code directly:
sudo make install

Clean up:
sudo make clean
sudo make distclean


Thats it, nothing ground breaking. Please let me know if there's anything else I've missed.

See also:
http://www.gnu.org/software/make/manual/make.html#Complex-Makefile

Monday, September 26, 2011

Fedora > libfontconfig.so.1: cannot open shared object file: No such file or directory

Problem

Received the following exceptions (seperately) when attempting to run a java program on Fedora 15 amd64.

/lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
...
libstdc++.so.5: cannot open shared object file: No such file or directory
...
Exception in thread "main" java.lang.UnsatisfiedLinkError: /some/directory/libmawt.so: libXext.so.6: cannot open shared object file: No such file or directory
...
libfontconfig.so.1: cannot open shared object file: No such file or directory


and so on.

Solution

Obviously a couple of dependencies were missing. To find out which package/s you need to install to fix a missing dependency, use "yum provides <missing_file>".
e.g.
# yum provides libfontconfig.so.1
fedora/metalink |  21 kB     00:00    
jenkins |  951 B     00:00    
updates/metalink |  12 kB     00:00    
fontconfig-2.8.0-3.fc15.i686 : Font configuration and customization library
Repo        : fedora
Matched from:
Other       : libfontconfig.so.1

Then install the packages...
e.g.
# yum install fontconfig

Repeat for all missing files.