[255044 views]

[]

Odi's astoundingly incomplete notes

New entries

Code

back | next

Graphical remote session

If you need a complete graphical remote desktop session to a linux machine from a Windows machine with Cygwin:
XWin :0 -clipboard &
DISPLAY=:0.0 ssh -f -Y username@linuxbox gnome-session
or
DISPLAY=:0.0 ssh -f -Y username@linuxbox startkde
More information at freedesktop.org


posted on 2005-12-15 12:35 UTC in Code | 0 comments | permalink

Thoughts on Linux Thoughts

An interaction designer's take on "Linux on the desktop" made it to Slashdot. While his initials statements about laziness and fear of the users to switch are probably true he misses some important points.

In my opinion Linux has never been competing with Windows to become a dominant desktop OS. Linux runs on anything from cell phones, PDAs, watches over laptops, desktop computers, servers, to clusters, big iron and main frames. Linux for the desktop is just one usage pattern and not its primary goal.

Nobody wants anybody to make a switch. I don't give a dime if YOU use Linux or Windows. It is YOUR choice, because YOU must know what you like and what is best for you. Linux is there. You may use it - freely. If you don't, nobody is angry.

There is no point in having the same user experience under Linux than under Windows. Why would I want to switch then? For the name? I am VERY happy that Linux has a significantly different user experience than Windows. Because I think that Windows' user experience sucks a great deal. Yes, I am sure.

We don't need a VB clone to create portable applications. Java, .NET/mono, Tcl/Tk, GTK all allow for portable applications today.

About his statement about controls: All modern object models allow for reuse of such components. Be it DCOM on Windows, or KParts for KDE or CORBA for Gnome, jar libraries for Java. Also the POSIX principle of small, focussed, flexible tools encourage reuse.

Fragmentation: Diversity is good - not bad. It gives you choice. WIth Windows you don't have a choice. The UNIX world has always consisted of dozens to hundreds of OS variants. And almost all applications can run on any of them.

Software installation: The "central installation architecture that all applications must use" already exists and I use it daily: portage (emerge). Other distros have apt or rpm.

posted on 2005-11-02 20:09 UTC in Code | 1 comments | permalink
Hello,
Thanks for sharing information!

The missing piece

I just discovered that there is a new function included in JDK 1.5 that I have been missing for several years in other languages. The function quoteReplacement of the Matcher class escapes a String suitable for litteral inclusion in a regular expression. This function is absolutely necessary if one wants to create a regular expression dynamically from possibly untrusted (user) input. I have not seen such a function in PERL (why does PERL not have an official website, BTW?), JavaScript or PHP yet.

posted on 2005-11-01 14:15 UTC in Code | 0 comments | permalink

Split-views in Eclipse

I just discovered that Eclipse 3.1 finally supports split-views (split-editors). The support is independent of the Editor (file format). So it works wether you are editing XML or Java or properties files. Just click Window > New Editor and place the new editor whereever you like.split editor

posted on 2005-09-09 09:24 UTC in Code | 0 comments | permalink

Many-to-Many without join-table

EJB3 lets you define many-to-many associations. It requires that the two entities be joined via a join-table. Of course many-to-many relationships are also possible without a join table. This is the case for two tables joined on non-unique columns. Take the two entities Address and City for instance. (This model is not in 3rd normal form):
In Switzerland there are cities with the same zip code. And in certain cases it makes sense to join Address with City just on the zip column. This is a many-to-many relation.

When you want to map such a relation to EJB you need a join table. In this case a join table can easily be created as a view:
CREATE VIEW Address_City AS SELECT A.id AS address_id, C.id AS city_id FROM Address A, City C WHERE A.zip = C.zip
This view can then be used in the EJB3 annotations:

@ManyToMany
@JoinTable(table=@Table(name="Address_City"),
joinColumns=@JoinColumn(
name="address_id",
referencedColumnName="id",
insertable=false,
updatable=false),
inverseJoinColumns=@JoinColumn(name="city_id",
referencedColumnName="id",
insertable=false,
updatable=false)
)



posted on 2005-09-08 12:04 UTC in Code | 0 comments | permalink

Rotating a video file with mencoder

My digital camera can shoot movies as well. Sometimes I shoot a movie in portrait format. Of course it needs to be rotated to view it on a screen. The camera does not provide a possibility to rotate the movie. So I need a software solution. Using mencoder it is as easy as: mencoder -nosound -ovc lavc -vf rotate=0 original.mpg -o rotated.mpg

posted on 2005-09-04 16:45 UTC in Code | 1 comments | permalink
Is it actually possible to losslessly rotate an MPEG encoded video? I know it is possible with JPEG. But I fear that motion compensation in MPEG could effectively prevent that.

JSTL adventures

Using JSTL in a simple Servlet container like Tomcat can be trickier  than you might think. You do not only have to find the right Jar file that contains the JSTL. You also have to get the taglib definition in your JSP right.

There are two versions of JSTL: 1.0 and 1.1. What they don't tell you: you somehow get both versions in the same JAR file when you use JSTL 1.1! They only differ in the taglib definition line in your JSP. You will notice this if you use c:out with an expression as the value. This is not allowed in 1.0 but it is valid in 1.1.

You can get the JAR File from
The taglib definition in your JSP should be:


posted on 2005-08-16 17:23 UTC in Code | 0 comments | permalink

Default platform encoding

Quite bad when you rely on it - especially in protocols between machines. And I always forget how to determine it.

posted on 2005-08-15 17:53 UTC in Code | 0 comments | permalink

Log4J Properties Template

As I tend to forget the config file format for Log4J let me post this template here:
log4j.rootCategory=DEBUG, C
# log categories
log4j.logger.org.apache=ERROR

# stdout
log4j.appender.C=org.apache.log4j.ConsoleAppender
log4j.appender.C.layout=org.apache.log4j.PatternLayout
log4j.appender.C.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
log4j.appender.C.Target=System.out

# single file
log4j.appender.F=org.apache.log4j.FileAppender
log4j.appender.F.layout=org.apache.log4j.PatternLayout
log4j.appender.F.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
log4j.appender.F.File=server.log

# rotating log files
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
log4j.appender.R.File=server.log
log4j.appender.R.MaxFileSize=100KB
log4j.appender.R.MaxBackupIndex=3

posted on 2005-08-15 13:03 UTC in Code | 0 comments | permalink

UML for the poor

I quite like the ArgoUML editor. (It can directly be used via Java Webstart.) It is useful when reviewing existing code and refactoring.

posted on 2005-08-12 16:39 UTC in Code | 0 comments | permalink
back | next