<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-144805460541353359</id><updated>2011-07-31T17:19:17.664+02:00</updated><category term='C++'/><category term='OpenOffice'/><category term='gpg'/><category term='Web services'/><category term='Java'/><category term='hardware'/><category term='Eclipse'/><title type='text'>Seb's Tec-Bites</title><subtitle type='html'>Seb's information about technologies, esp. in the environment of software design and development.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://tecbites.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://tecbites.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Seb</name><uri>http://www.blogger.com/profile/06553111406739261461</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>38</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-144805460541353359.post-923661787320167270</id><published>2010-10-25T05:53:00.002+02:00</published><updated>2010-10-25T07:10:14.089+02:00</updated><title type='text'>Ubuntu Karmic Koala and VLC</title><content type='html'>It's been some time since I last posted here .. nothing happened to me that's interesting for a broader audience, it seems ... Well, I found something.&lt;br /&gt;
&lt;br /&gt;
On my notebook, I am forced to use nothing more current than ubuntu Karmic Koala (9.04), because KMS+old intel graphics doesn't really work - see more below. Luckily, many of the packages are still being updated (including firefox), but one is missing for me ... a current version of vlc aka video lan client. So, I had to compile it. Only took about 30mins of CPU time ;)&lt;br /&gt;
&lt;br /&gt;
There are no packages on launchpad for vlc/karmic, so I offer them for download, if anyone is interested. This is not an apt repository, but just a folder with .deb files. I compiled them from the lucid sources from &lt;a href="https://launchpad.net/~ferramroberto/+archive/vlc"&gt;Ferramosca Roberto's LffL VLC&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
To install, download the files from &lt;a href="http://www.tecbites.de/ubuntu/karmic/vlc"&gt;http://www.tecbites.de/ubuntu/karmic/vlc&lt;/a&gt;, and use the following to install:&lt;br /&gt;
&lt;pre&gt;sudo dpkg -i libmtp8_1.0.2-1ubuntu1_i386.deb
sudo dpkg -i vlc_1.1.4.1-1~lffl~lucid~ppa1_i386.deb \
 vlc-data_1.1.4.1-1~lffl~lucid~ppa1_all.deb \
 libvlc5_1.1.4.1-1~lffl~lucid~ppa1_i386.deb \
 libvlccore4_1.1.4.1-1~lffl~lucid~ppa1_i386.deb \
 vlc-nox_1.1.4.1-1~lffl~lucid~ppa1_i386.deb
&lt;/pre&gt;These are the packages you need, at least - some of the plugins may be handy, the -dev packages you probably won't need.&lt;br /&gt;
Oh, they are called lucid because I compiled them from the ppa launchpad lucid dsc sources ... I should fix this, and the maintainer name also ;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Just for information - my experiences with ubuntu, old intel graphics (82852/855GM), kernel based mode setting (KMS) and XVideo acceleration were quite free of successes.&lt;br /&gt;
Depending on the distribution and the current update state, &lt;br /&gt;
* KMS+XVideo is not supported (and not planned to be supported, I believe)&lt;br /&gt;
* nomodeset+XVideo either doesn't work, or crashes the X11 server&lt;br /&gt;
My experiences with opensuse were similar, so, it appears to be something the old hardware has to live with (IBM Thinkpad X40).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/144805460541353359-923661787320167270?l=tecbites.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tecbites.blogspot.com/feeds/923661787320167270/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=144805460541353359&amp;postID=923661787320167270' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/923661787320167270'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/923661787320167270'/><link rel='alternate' type='text/html' href='http://tecbites.blogspot.com/2010/10/ubuntu-karmic-koala-and-vlc.html' title='Ubuntu Karmic Koala and VLC'/><author><name>Seb</name><uri>http://www.blogger.com/profile/06553111406739261461</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-144805460541353359.post-6125619175740308424</id><published>2009-12-05T13:39:00.002+01:00</published><updated>2009-12-06T09:41:11.890+01:00</updated><title type='text'>Qt 4.6.0 on AVR32 and it’s bugs: Error: symbol `.L987' is already defined</title><content type='html'>&lt;p&gt;Qt 4.6.0 is out – there is only one source archive now, “-everywhere-“, which includes the linux embedded version also. I tried to build it for the avr32 embedded system; but, a nice compiler error prohibited it.&lt;/p&gt;&lt;h4&gt;Error: Symbol `.L987' is already defined&lt;/h4&gt;&lt;h2&gt;&lt;/h2&gt;&lt;div&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;compiling painting/qbrush.cpp
{standard input}: Assembler messages:
{standard input}:5426: Error: symbol `.L987' is already defined
{standard input}:5544: Error: symbol `.L1012' is already defined
{standard input}:6236: Error: symbol `.L1129' is already defined
{standard input}:6353: Error: symbol `.L1154' is already defined
make: *** [.obj/release-shared-emb-avr32/qbrush.o] Fehler 1&lt;/pre&gt;&lt;/div&gt;&lt;h4&gt;Googling it&lt;/h4&gt;&lt;p&gt;This error is usually based on using “inline” and “asm” statements in combination – see &lt;a title="http://archives.devshed.com/forums/development-94/new-assembler-message-symbol-is-already-defined-1269938.html" href="http://archives.devshed.com/forums/development-94/new-assembler-message-symbol-is-already-defined-1269938.html"&gt;http://archives.devshed.com/forums/development-94/new-assembler-message-symbol-is-already-defined-1269938.html&lt;/a&gt;, e.g. It looks like an internal compiler error, but is usually a coding error.&lt;/p&gt;&lt;blockquote&gt;  &lt;p&gt;“This is not a gcc bug, you cannot declare a label in an inline-asm that is going to be exposed.”&lt;/p&gt;&lt;p&gt;“Is there a reference of some sort? I was unable to find one with google.”     &lt;br /&gt;
”No, just a general rule as inline-asms will be copied when inlined or cloned. What is happening here is clon(n)ing is happening so we generate two copies of that function.”&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;So, there is some inline method that contains assembler code – the code is duplicated b/c of the inline interpretation – and thus, the assembler labels are duplicated.&lt;/p&gt;&lt;h4&gt;Different Compiler?&lt;/h4&gt;&lt;p&gt;I do not think that Nokia explicitly inserted the inline+asm-combination. It is probably some gcc optimization. Unfortunately, it is not possibly to use a different compiler than the one provided by atmel in “buildroot-avr32-2.3.0” (&lt;a title="http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4401" href="http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4401"&gt;http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4401&lt;/a&gt;)&lt;/p&gt;&lt;p&gt;  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;p&gt;Using built-in specs.
Target: avr32-linux-uclibc
Configured with: /avr32/buildroot-avr32-v2.3.0/toolchain_build_avr32/gcc-4.2.2/configure --prefix=/avr32/buildroot-avr32-v2.3.0/build_avr32/staging_dir --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --target=avr32-linux-uclibc --enable-languages=c,c++ --enable-__cxa_atexit --enable-target-optspace --with-gnu-ld --with-gmp=/avr32/buildroot-avr32-v2.3.0/toolchain_build_avr32/gmp --with-mpfr=/avr32/buildroot-avr32-v2.3.0/toolchain_build_avr32/mpfr --enable-shared --disable-nls --enable-threads --disable-multilib --enable-sjlj-exceptions --disable-libmudflap --disable-libssp --with-build-time-tools=/avr32/buildroot-avr32-v2.3.0/build_avr32/staging_dir//bin
Thread model: posix
gcc version 4.2.2-atmel.1.1.3.buildroot.1&lt;/p&gt;&lt;/pre&gt;&lt;/p&gt;&lt;h4&gt;Change Optimisation Level&lt;/h4&gt;&lt;p&gt;So, we have to find a way to avoid the above error. If it is an optimization problem, let’s just use some other one.&lt;/p&gt;&lt;p&gt;goto src/gui, patch Makefile, add –O to the end of CXXFLAGS, call make .obj/release-shared-emb-avr32/qbrush.o, and it runs through – now, you can remove the –O again, and compile the rest of it.&lt;/p&gt;&lt;p&gt;Alternatively, remove the @ in the beginning of CXX = …, call make, get the avr32-linux-uclibc-g++ statement, and add –O there.&lt;/p&gt;&lt;p&gt;Using –O3 does not work – then, the inlining is done even more often, resulting in triple definitions (or rather duplicate errors about duplicate defintions).&lt;/p&gt;&lt;p&gt;No idea where the error stems from, but at least, Qt 4.6.0 now compiles.&lt;/p&gt;&lt;h4&gt;package/qtopia4/qtopia4.mk&lt;/h4&gt;&lt;p&gt;Btw … to get that far, a few more changes are necessary. Those are, in short, in package/qtopia/qtopia4.mk:&lt;/p&gt;&lt;div&gt;  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;QTOPIA4_VERSION:=4.6.0
QTOPIA4_CAT:=zcat
QTOPIA4_SOURCE:=qt-everywhere-opensource-src-$(QTOPIA4_VERSION).tar.gz
QTOPIA4_TARGET_DIR:=$(BUILD_DIR)/qt-everywhere-opensource-src-$(QTOPIA4_VERSION)&lt;/pre&gt;&lt;/div&gt;&lt;div&gt;and you have to remove all the mouse driver statements – I have no idea how those are configured, now … most of them compile automatically, I may still be missing the tslib driver&lt;/div&gt;&lt;div id="codeSnippetWrapper"&gt;  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;### Mouse drivers
# remove all of them for Qt460
ifeq ($(BR2_PACKAGE_QTOPIA4_MOUSE_PC),y)
[...]
QTOPIA4_CONFIGURE += -no-mouse-qvfb
endif
&lt;/pre&gt;&lt;br /&gt;
&lt;/div&gt;&lt;h4&gt;Fixing 4.5.x Colour Depths&lt;/h4&gt;&lt;div&gt;The previous version(s), 4.5.x, had a bug concerning a code optimisation that relied on non-aligned access – OK for i386 and followers, not OK for many other systems. Some were explicitly excluded, avr32 was not. The bug triggered when converting bitmaps between 24 and 16 bit colour depth, e.g., when connecting via vnc, or when using certain display depths directly.&lt;/div&gt;&lt;div&gt;See &lt;a href="http://www.avrfreaks.net/index.php?name=PNphpBB2&amp;amp;file=viewtopic&amp;amp;t=79740"&gt;http://www.avrfreaks.net/index.php?name=PNphpBB2&amp;amp;file=viewtopic&amp;amp;t=79740&lt;/a&gt; about fixing qt_blend_argb24_on_rgb16() in qblendfunctions.cpp.&lt;/div&gt;&lt;div&gt;Seems that fix is in 4.6.0, at least.&lt;/div&gt;&lt;h4&gt;PS: QtScript&lt;/h4&gt;&lt;p&gt;I get a compile error in QtScript – some problem with pthread_getattr_np:&lt;/p&gt;&lt;div id="codeSnippetWrapper"&gt;  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;compiling ../3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp
../3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp: In function 'void* QTJSC::currentThreadStackBase()':
../3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp:682: error: 'pthread_getattr_np' was not declared in this scope

&lt;/pre&gt;&lt;br /&gt;
&lt;/div&gt;&lt;p&gt;Interestingly, the code does take care of uclibc 0.9.xx:&lt;/p&gt;&lt;div id="codeSnippetWrapper"&gt;  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #cc6633"&gt;#if&lt;/span&gt; defined(__UCLIBC__)
&lt;span style="color: #008000"&gt;// versions of uClibc 0.9.28 and below do not have&lt;/span&gt;
&lt;span style="color: #008000"&gt;// pthread_getattr_np or pthread_attr_getstack.&lt;/span&gt;
&lt;span style="color: #cc6633"&gt;#if&lt;/span&gt; __UCLIBC_MAJOR__ == 0 &amp;amp;&amp;amp; \
(__UCLIBC_MINOR__ &amp;lt; 9 || \
(__UCLIBC_MINOR__ == 9 &amp;amp;&amp;amp; __UCLIBC_SUBLEVEL__ &amp;lt;= 30))
&lt;span style="color: #cc6633"&gt;#define&lt;/span&gt; UCLIBC_USE_PROC_SELF_MAPS 1
&lt;span style="color: #cc6633"&gt;#include&lt;/span&gt; &amp;lt;stdio_ext.h&amp;gt;
&lt;span style="color: #0000ff"&gt;extern&lt;/span&gt; &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; *__libc_stack_end;
&lt;span style="color: #cc6633"&gt;#endif&lt;/span&gt;
&lt;span style="color: #cc6633"&gt;#endif&lt;/span&gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;/div&gt;&lt;p&gt;Oops, there are two different Collector.cpp:    &lt;br /&gt;
3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp    &lt;br /&gt;
3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp&lt;/p&gt;&lt;p&gt;One does define UCLIBC_USE_PROC_SELF_MAPS etc. as a workaround for uclibc 0.9.30, the other doesn’t – another bugreport to Nokia.&lt;/p&gt;&lt;p&gt;Just add -no-script to the configure options, for the moment.&lt;/p&gt;&lt;p&gt;Just a short note - I published both problems as Qt bug reports: &lt;a href="http://bugreports.qt.nokia.com/browse/QTBUG-6550"&gt;QTBUG-6550&lt;/a&gt; and &lt;a href="http://bugreports.qt.nokia.com/browse/QTBUG-6551"&gt;QTBUG-6551&lt;/a&gt; &lt;br /&gt;
&lt;p&gt;Have fun with it …   &lt;br /&gt;
Sebastian&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/144805460541353359-6125619175740308424?l=tecbites.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tecbites.blogspot.com/feeds/6125619175740308424/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=144805460541353359&amp;postID=6125619175740308424' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/6125619175740308424'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/6125619175740308424'/><link rel='alternate' type='text/html' href='http://tecbites.blogspot.com/2009/12/qt-460-on-avr32-and-its-bugs-error.html' title='Qt 4.6.0 on AVR32 and it’s bugs: Error: symbol `.L987&amp;#39; is already defined'/><author><name>Seb</name><uri>http://www.blogger.com/profile/06553111406739261461</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-144805460541353359.post-7229290540536464924</id><published>2009-09-18T22:13:00.003+02:00</published><updated>2009-09-22T09:18:33.101+02:00</updated><title type='text'>Single to Dual/Multi Core with Windows XP (ACPI HAL)</title><content type='html'>&lt;h3&gt;&lt;/h3&gt;&lt;h4&gt;Introduction&lt;/h4&gt;Sometimes, people have the problem that their Windows XP is running as a “single core” system, only, although there are two or more cores installed. This can usually be seen in the task manager, where performance shows only a single graph, although “one diagram per CPU” is selected.&lt;br /&gt;
I talk about cores here, the same applies to multiple processors. Those are usually used on servers, though, where few people would start “fixing” the HAL.&lt;br /&gt;
&lt;h4&gt;&lt;/h4&gt;&lt;h4&gt;Hardware Abstraction Layer – HAL&lt;/h4&gt;The reason is usually, that the normal ACPI HAL (Hardware Abstraction Layer) has been installed which does not support more than one core. In theory, XP recognises when a new CPU is installed, re-checks, and installs the correct hal. This does not always work, though. &lt;br /&gt;
The usual HALs are&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Standard PC &lt;/li&gt;
&lt;li&gt;ACPI PC &lt;/li&gt;
&lt;li&gt;ACPI Uni-Processor (UP) &lt;/li&gt;
&lt;li&gt;ACPI Multi-Processor (MP) &lt;/li&gt;
&lt;li&gt;MPS Multi-Processor (APIC) &lt;/li&gt;
&lt;/ul&gt;(&lt;a href="http://support.microsoft.com/?scid=kb%3Ben-us%3B309283&amp;amp;x=10&amp;amp;y=9"&gt;http://support.microsoft.com/?scid=kb%3Ben-us%3B309283&amp;amp;x=10&amp;amp;y=9&lt;/a&gt;)&lt;br /&gt;
Especially in the context of virtual machines running under SUN VirtualBox, this does not work. When a windows XP system is installed with only one core active, and more core(s) is/are added later on, the CPU “id” does not change … no redetection is done, the other cores are not recognised. Another reason may be that the “ACPI PC” is not the same as “ACPI UP”, and only ACPI UP is able to support, and thus detect, more than one CPU. In the case of VirtualBox, the situation may also be caused on the IO-APIC not being enabled on install. According to SUN, XP Uniprocessor with IO-APIC is slower than without.&lt;br /&gt;
Officially, there is no way to upgrade the HAL. You can downgrade it, though, which is not a good idea … there is no way back.&lt;br /&gt;
&lt;h4&gt;Using devcon.exe: Forced HAL Upgrade&lt;/h4&gt;I found a very interesting post about the “devcon.exe”, a tool provided by MS as “the command line version of the device manager”, and its application to the HAL switch problem.&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;The Post:      &lt;br /&gt;
&lt;a href="http://www.nforcershq.com/forum/updating-the-hal-for-multiprocessor-support-t70331.html"&gt;http://www.nforcershq.com/forum/updating-the-hal-for-multiprocessor-support-t70331.html&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;Download devcon.exe:      &lt;br /&gt;
&lt;a href="http://support.microsoft.com/?scid=kb%3Ben-us%3B311272&amp;amp;x=13&amp;amp;y=11" title="http://support.microsoft.com/?scid=kb%3Ben-us%3B311272&amp;amp;x=13&amp;amp;y=11"&gt;http://support.microsoft.com/?scid=kb%3Ben-us%3B311272&amp;amp;x=13&amp;amp;y=11&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;The post describing the forced hal upgrade:      &lt;br /&gt;
&lt;a href="http://www.nforcershq.com/forum/updating-the-hal-for-multiprocessor-support-t70331.html" title="http://www.nforcershq.com/forum/updating-the-hal-for-multiprocessor-support-t70331.html"&gt;http://www.nforcershq.com/forum/updating-the-hal-for-multiprocessor-support-t70331.html&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;The important stuff:&lt;br /&gt;
Just execute the following commands in a cmd.exe shell …&lt;br /&gt;
&lt;div id="codeSnippetWrapper"&gt;&lt;pre id="codeSnippet" style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;devcon sethwid @ROOT\ACPI_HAL\0000 := +acpiapic_mp !acpiapic_up
devcon update c:\windows\inf\hal.inf acpiapic_mp&lt;/pre&gt;&lt;br /&gt;
&lt;/div&gt;Of course, this may completely break your system. Make backups, find out beforehand how to restore, etc. Using a virtual box system, this is easy, just make a snapshot and restore if the upgrade does not work.&lt;br /&gt;
After running devcon, you reboot the system; after the reboot, XP re-detects all hardware, and the requests another reboot. This may change some of the hardware names, especially the LAN connection may get the number 2.&lt;br /&gt;
&lt;h4&gt;&lt;/h4&gt;&lt;h4&gt;Hidden Devices&lt;/h4&gt;You can use the show-hidden trick of the device manager to display the old devices and remove them: &lt;a href="http://support.microsoft.com/?scid=kb%3Ben-us%3B315539&amp;amp;x=14&amp;amp;y=11" title="http://support.microsoft.com/?scid=kb%3Ben-us%3B315539&amp;amp;x=14&amp;amp;y=11"&gt;http://support.microsoft.com/?scid=kb%3Ben-us%3B315539&amp;amp;x=14&amp;amp;y=11&lt;/a&gt;&lt;br /&gt;
&lt;div id="codeSnippetWrapper"&gt;&lt;pre id="codeSnippet" style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;set devmgr_show_nonpresent_devices=1
start devmgmt.msc&lt;/pre&gt;&lt;br /&gt;
&lt;/div&gt;&lt;h4&gt;Switching the HAL&lt;/h4&gt;Once you get a ACPI MP hal, you can switch it to whatever you like using the device manager. Just select “new driver” for the “Computer” device.&lt;br /&gt;
&lt;h3&gt;Doing it manually&lt;/h3&gt;Before I found the post by “hedrums” above, I tried to do it manually. Interestingly, none of the files is locked by windows. They are loaded so early and completely in the boot process that they are no longer “needed” (used) in a running system, and can just be replaced.Yet, I never managed to copy and rename the files correctly. &lt;br /&gt;
Afterwards, by comparing the file sizes between the used versions (in system32) and the restore/backup versions (in ServicePackFiles\i386), I recognised the following:&lt;br /&gt;
• ntoskrnl.exe == ntkrnlmp.exe (2,04MB)    &lt;br /&gt;
• ntkrnlpa.exe == ntkrpamp.exe (1,93MB)     &lt;br /&gt;
• hal.dll == halmacpi.dll (131kB)&lt;br /&gt;
So, by copying the three files ntkrnlmp.exe, ntkrnlmp.exe and halmacpi.dll to system32 and renaming them to ntoskrnl.exe, ntkrnlpa.exe and hal.dll, respectively, you may be running an ACPI MP hal. I have not tried this, though.&lt;br /&gt;
Alternatively, using the correct ACPI UP files (whichever they are), you may get a UP system that, in turn, is automatically able to detect the multicore and again, install the correct drivers …&lt;br /&gt;
&lt;a href="http://lh6.ggpht.com/_JdRjQOBe9RE/SrPq91SzzSI/AAAAAAAABaQ/MUnm6DBkuY0/s1600-h/ACPI%5B4%5D.png"&gt;&lt;img alt="ACPI" border="0" height="367" src="http://lh6.ggpht.com/_JdRjQOBe9RE/SrPq-kMUsLI/AAAAAAAABaU/8G9sKPdfppE/ACPI_thumb%5B2%5D.png?imgmax=800" style="border: 0px none; display: inline;" title="ACPI" width="475" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h4&gt;Hardware.Info&lt;br /&gt;
&lt;/h4&gt;I now found a tool that does the same stuff, a bit more comfortable: &lt;br /&gt;
&lt;a href="http://www.hardware.info/en-US/news/ym2cmZqYwp2a/Problems_updating_to_a_dualcore_CPU_Not_anymore/"&gt;http://www.hardware.info/en-US/news/ym2cmZqYwp2a/Problems_updating_to_a_dualcore_CPU_Not_anymore/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/144805460541353359-7229290540536464924?l=tecbites.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tecbites.blogspot.com/feeds/7229290540536464924/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=144805460541353359&amp;postID=7229290540536464924' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/7229290540536464924'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/7229290540536464924'/><link rel='alternate' type='text/html' href='http://tecbites.blogspot.com/2009/09/single-to-dualmulti-core-with-windows.html' title='Single to Dual/Multi Core with Windows XP (ACPI HAL)'/><author><name>Seb</name><uri>http://www.blogger.com/profile/06553111406739261461</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/_JdRjQOBe9RE/SrPq-kMUsLI/AAAAAAAABaU/8G9sKPdfppE/s72-c/ACPI_thumb%5B2%5D.png?imgmax=800' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-144805460541353359.post-7392771230754868190</id><published>2009-09-12T11:22:00.003+02:00</published><updated>2009-09-13T10:40:57.225+02:00</updated><title type='text'>Ubuntu Display Manager</title><content type='html'>&lt;strike&gt;&lt;/strike&gt;  &lt;br /&gt;
Just some notes about the display manager(s) on Ubuntu I found out over time, and about their startup settings.&lt;br /&gt;
The display manager – that’s usually gdm, the gnome d.m.; alternatively kdm on kubuntu/kde, or even the good old xdm when using a lightweight desktop. In any case, it’s usually started to show a user login screen ;)&lt;br /&gt;
&lt;h4&gt;Text mode&lt;/h4&gt;It is often practical to boot into text only mode – at least, when you know a bit about linux. I’m not talking about removing gdm forever (&lt;tt&gt;apt-get remove gdm&lt;/tt&gt; or &lt;tt&gt;update-rc.d -f gdm remove&lt;/tt&gt; do this), but to use text mode in certain situations – including when you know your Xorg or gdm setup to be broken. Or, when you really want to save battery power ;)&lt;br /&gt;
The gdm startup allows this by putting &lt;tt&gt;text&lt;/tt&gt; into the kernel command line. If this parameter is found, &lt;tt&gt;/etc/init.d/gdm&lt;/tt&gt; just exits again. This can be achieved by:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;stop the bootup in the grub menu, then      &lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;press “e” to edit the wanted entry &lt;/li&gt;
&lt;li&gt;use the cursor keys to select the “kernel” line &lt;/li&gt;
&lt;li&gt;press “e” again to edit the line &lt;/li&gt;
&lt;li&gt;go to the end of the line and add “text” &lt;/li&gt;
&lt;li&gt;press return to leave the line editing &lt;/li&gt;
&lt;li&gt;press “b” to boot the edited entry &lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;create a grub entry for text mode      &lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;tt&gt;sudo gedit /boot/grub/menu.lst &lt;/tt&gt;&lt;/li&gt;
&lt;li&gt;copy the first real boot entry (that starts with “title”) into another one below &lt;/li&gt;
&lt;li&gt;change the title – append “text mode” or such &lt;/li&gt;
&lt;li&gt;add “text” to the end of the “kernel” line &lt;/li&gt;
&lt;li&gt;next time you boot the system, you can select the text mode and have tun. &lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;This also disallows to start the gdm via the init script later on, because the entry is part of the kernel command line that cannot be changed. Yet, starting &lt;tt&gt;gdm&lt;/tt&gt; directly achieves the same result.&lt;br /&gt;
By the way: I have not hardly anything about this on the web. Of course, you just need to look into /etc/init.d/gdm … the only post I found referring to this is &lt;a href="https://bugs.launchpad.net/ubuntu/+source/gdm/+bug/294980"&gt;https://bugs.launchpad.net/ubuntu/+source/gdm/+bug/294980&lt;/a&gt;&lt;br /&gt;
&lt;h4&gt;gdm, kdm and xdm&lt;/h4&gt;Ever wondered how the various display managers that can be installed on (k)ubuntu stay out of each others hair?&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;each of them may be added to the runlevels &lt;/li&gt;
&lt;li&gt;when starting, they each check whether they are the “preferred display manager” via /etc/defaults &lt;/li&gt;
&lt;li&gt;if no, they exit; if yes, the one that should starts. &lt;/li&gt;
&lt;/ul&gt;This way, it should not be possible to start more than one display manager – which you usually don’t want to. Opensuse, on the other hand, uses just one rc-script which decides which dm to start.&lt;br /&gt;
&lt;h4&gt;sysv-rc-conf&lt;br /&gt;
&lt;/h4&gt;As a side note – I never know how to edit the /etc/rc.d?/scripts. This changed over time, mainly because of the linux standard base (LSB), I believe. The current command-line tool is &lt;i&gt;update-rc.d&lt;/i&gt; which is not really nice to use.&lt;br /&gt;
But, the package &lt;b&gt;sysv-rc-conf&lt;/b&gt; contains a textmode ui tool of the same name which seems to be usable, at least.&lt;br /&gt;
&lt;br /&gt;
There is also chkconfig and insserv as I know from opensuse; yet, their packages refuse to install on Jaunty due to some sysv-init package conflicts. Probably because ubuntu migrated from sysvutils to sysvinit-utils. Or rather to &lt;i&gt;upstart&lt;/i&gt;, where sysvinit-utils only contains some utilities.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/144805460541353359-7392771230754868190?l=tecbites.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tecbites.blogspot.com/feeds/7392771230754868190/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=144805460541353359&amp;postID=7392771230754868190' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/7392771230754868190'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/7392771230754868190'/><link rel='alternate' type='text/html' href='http://tecbites.blogspot.com/2009/09/ubuntu-display-manager.html' title='Ubuntu Display Manager'/><author><name>Seb</name><uri>http://www.blogger.com/profile/06553111406739261461</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-144805460541353359.post-6561250436074621813</id><published>2009-09-12T08:16:00.003+02:00</published><updated>2009-09-14T15:12:06.538+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Web services'/><title type='text'>Webservices with Axis2/Java - the simple POJO way</title><content type='html'>&lt;p&gt;&lt;/p&gt; &lt;p&gt;There are many ways to create web services in Java; the most common implementation, nowadays, is using &lt;a class="external text" title="http://ws.apache.org/axis2" href="http://ws.apache.org/axis2" rel="nofollow"&gt;Apache Axis2/Java&lt;/a&gt; and a servlet container such as &lt;a class="external text" title="http://tomcat.apache.org" href="http://tomcat.apache.org/" rel="nofollow"&gt;Apache Tomcat&lt;/a&gt; or &lt;a class="external text" title="http://www.eclipse.org/jetty/" href="http://www.eclipse.org/jetty/" rel="nofollow"&gt;Jetty&lt;/a&gt;. &lt;br&gt;On the Axis2 web site, there are a number of tutorials and explanations of the various concepts; yet, somehow, I'm missing a description of the "most easy way" of creating a web service. That's why I write it here. The tutorials are based on using the provided &lt;tt&gt;build.xml&lt;/tt&gt; files instead of explaining &lt;i&gt;how to do it&lt;/i&gt;. This makes it very hard to work in a different context. &lt;/p&gt; &lt;h2&gt;A POJO in an .aar &lt;/h2&gt; &lt;p&gt;Axis2 is able to "interpret" any &lt;i&gt;Plain Old Java Object (POJO)&lt;/i&gt; as a web service, given the right hints. A Pojo is just a java class with some public method(s). &lt;/p&gt; &lt;h3&gt;A POJO &lt;/h3&gt; &lt;div id="codeSnippetWrapper"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;package&lt;/span&gt; tecbites.ws;&lt;br&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Echo {&lt;br&gt;  &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; String echo(String input) {&lt;br&gt;    &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; input;&lt;br&gt;  }&lt;br&gt;}&lt;/pre&gt;&lt;br&gt;&lt;/div&gt;
&lt;p&gt;To tell Axis2 that this is a web service, you need additionally &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;a services.xml that defines this class as a POJO RPC web service 
&lt;li&gt;an echo.aar that contains (at least) the &lt;tt&gt;services.xml&lt;/tt&gt; in the &lt;tt&gt;META-INF&lt;/tt&gt; directory, and usually, the web service code (.class file(s)). &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;services.xml &lt;/h3&gt;
&lt;div id="codeSnippetWrapper"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&amp;lt;service name=&lt;span style="color: #006080"&gt;"Echo"&lt;/span&gt; scope=&lt;span style="color: #006080"&gt;"application"&lt;/span&gt; &amp;gt;&lt;br&gt;  &amp;lt;description&amp;gt;&lt;br&gt;   Tecbites Echo POJO web service&lt;br&gt;  &amp;lt;/description&amp;gt;&lt;br&gt;  &amp;lt;messageReceivers&amp;gt;&lt;br&gt;    &amp;lt;messageReceiver mep=&lt;span style="color: #006080"&gt;"http://www.w3.org/2004/08/wsdl/in-only"&lt;/span&gt;&lt;br&gt;       &lt;span style="color: #0000ff"&gt;class&lt;/span&gt;=&lt;span style="color: #006080"&gt;"org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"&lt;/span&gt;/&amp;gt;&lt;br&gt;    &amp;lt;messageReceiver mep=&lt;span style="color: #006080"&gt;"http://www.w3.org/2004/08/wsdl/in-out"&lt;/span&gt;&lt;br&gt;       &lt;span style="color: #0000ff"&gt;class&lt;/span&gt;=&lt;span style="color: #006080"&gt;"org.apache.axis2.rpc.receivers.RPCMessageReceiver"&lt;/span&gt;/&amp;gt;&lt;br&gt;  &amp;lt;/messageReceivers&amp;gt;&lt;br&gt;  &amp;lt;parameter name=&lt;span style="color: #006080"&gt;"ServiceClass"&lt;/span&gt;&amp;gt;tecbits.ws.Echo&amp;lt;/parameter&amp;gt;&lt;br&gt;&amp;lt;/service&amp;gt;&lt;/pre&gt;&lt;br&gt;&lt;/div&gt;&lt;pre&gt;&lt;/pre&gt;Put this file into META-INF. &lt;br&gt;&lt;a id="creating_an_.aar_-_jar" href="http://www.blogger.com/post-edit.g?blogID=144805460541353359&amp;amp;postID=6561250436074621813" name="creating_an_.aar_-_jar"&gt;&lt;/a&gt;&lt;br&gt;
&lt;h3&gt;creating an .aar - jar &lt;/h3&gt;One way to create an .aar is just using the jar-tool that is part of the JDK. Using the following folder structure: &lt;br&gt;
&lt;div id="codeSnippetWrapper"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;tecbites/ws/&lt;br&gt; Echo.class&lt;br&gt;META-INF/&lt;br&gt; services.xml&lt;/pre&gt;&lt;br&gt;&lt;/div&gt;, a jar can just be created that is named &lt;tt&gt;echo.aar&lt;/tt&gt;. Check that the jar/aar does not contain the files in a subdirectory named echo!. &lt;br&gt;
&lt;div id="codeSnippetWrapper"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;javac tecbites/ws/Echo.java&lt;br&gt;jar cf echo.aar .&lt;/pre&gt;&lt;br&gt;&lt;/div&gt;&lt;a id="creating_an_.aar_-_build.xml" href="http://www.blogger.com/post-edit.g?blogID=144805460541353359&amp;amp;postID=6561250436074621813" name="creating_an_.aar_-_build.xml"&gt;&lt;/a&gt;&lt;br&gt;
&lt;h3&gt;creating an .aar - build.xml &lt;/h3&gt;
&lt;p&gt;Another way of creating an .aar is using build.xml, the same as creating any other .jar. See the following example: &lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="color: #800000"&gt;xml&lt;/span&gt; &lt;span style="color: #ff0000"&gt;version&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="1.0"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;encoding&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="UTF-8"&lt;/span&gt;?&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;project&lt;/span&gt; &lt;span style="color: #ff0000"&gt;name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="tecbites.echo"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;default&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="aar"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;basedir&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="."&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;   &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;target&lt;/span&gt; &lt;span style="color: #ff0000"&gt;name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="build"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;javac&lt;/span&gt; &lt;span style="color: #ff0000"&gt;debug&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="true"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;srcdir&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="."&lt;/span&gt; &lt;span style="color: #ff0000"&gt;destdir&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="."&lt;/span&gt; &lt;span style="color: #ff0000"&gt;failonerror&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="true"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;br&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;target&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;   &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;target&lt;/span&gt; &lt;span style="color: #ff0000"&gt;name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="aar"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;depends&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="build"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;property&lt;/span&gt; &lt;span style="color: #ff0000"&gt;name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="aar"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="echo.aar"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;br&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;delete&lt;/span&gt; &lt;span style="color: #ff0000"&gt;file&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="${aar}"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;failonerror&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="false"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;br&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;jar&lt;/span&gt; &lt;span style="color: #ff0000"&gt;destfile&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="${aar}"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;manifest&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br&gt;      &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;attribute&lt;/span&gt; &lt;span style="color: #ff0000"&gt;name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Built-By"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Tecbites http://tecbites.blogspot.com/"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;br&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;manifest&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;fileset&lt;/span&gt; &lt;span style="color: #ff0000"&gt;dir&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="."&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br&gt;      &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;include&lt;/span&gt; &lt;span style="color: #ff0000"&gt;name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="**/*.class"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;br&gt;      &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;include&lt;/span&gt; &lt;span style="color: #ff0000"&gt;name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="META-INF/**"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;br&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;fileset&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;jar&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;target&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;project&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br&gt;&lt;/div&gt;
&lt;p&gt;Just run &lt;tt&gt;ant&lt;/tt&gt;. You have got &lt;a class="external text" title="http://ant.apache.org/" href="http://ant.apache.org/" rel="nofollow"&gt;ant&lt;/a&gt; installed, have you? &lt;/p&gt;
&lt;h3&gt;Deployment &lt;/h3&gt;
&lt;p&gt;The installation of an Axis2 webapp and the deployment of an .aar is explained quite well &lt;a class="external text" title="http://ws.apache.org/axis2/1_5/installationguide.html" href="http://ws.apache.org/axis2/1_5/installationguide.html" rel="nofollow"&gt;on the site&lt;/a&gt;. Just a short version here, based on Tomcat6: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;download the Axis2 webapp 
&lt;li&gt;deploy (copy) the &lt;tt&gt;axis2.war&lt;/tt&gt; into &lt;tt&gt;webapps/&lt;/tt&gt; of a servlet container (tomcat, jetty, jboss, glassfish, ...) &lt;/li&gt;&lt;/ul&gt;And start the servlet container. Then, copy the &lt;tt&gt;echo.aar&lt;/tt&gt; into the &lt;tt&gt;webapps/axis2/WEB-INF/services&lt;/tt&gt; directory (the servlet container should automatically unpack &lt;tt&gt;axis2.war&lt;/tt&gt; into &lt;tt&gt;axis2/&lt;/tt&gt; &lt;br&gt;If you need additional jars or java code you don't want to pack into the .aar itself, there is space in &lt;tt&gt;axis2/WEB-INF/lib&lt;/tt&gt; (for the jars) and &lt;tt&gt;axis2/WEB-INF/classes&lt;/tt&gt; (for any &lt;tt&gt;package/name/Class.class&lt;/tt&gt; files). &lt;br&gt;Usually, Axis2 is configured for "hot deployment". This means that any .aar copied newly into the services directory of a running server is directly deployed as a new web service. There is also "hot update" which is usually disabled, but can be enabled in &lt;tt&gt;axis2/WEB-INF/conf/axis2.xml&lt;/tt&gt;. Then, the .aars are automagically reloaded when replaced. Of course, any code in lib/ or classes/ is not. &lt;br&gt;By the way - it should also be possible to deploy the web service by copying the unjared folder structure into a subdirectory of the services dir, thus creating &lt;tt&gt;webapps/axis2/WEB-INF/services/Echo/META-INF/services.xml&lt;/tt&gt; etc. &lt;br&gt;&lt;a id="Testing" href="http://www.blogger.com/post-edit.g?blogID=144805460541353359&amp;amp;postID=6561250436074621813" name="Testing"&gt;&lt;/a&gt;&lt;br&gt;
&lt;h3&gt;Testing &lt;/h3&gt;
&lt;p&gt;The web service should then be visible on &lt;a class="external free" title="http://localhost:8080/axis2/services/listServices" href="http://localhost:8080/axis2/services/listServices" rel="nofollow"&gt;http://localhost:8080/axis2/services/listServices&lt;/a&gt; (replace port 8080 with the correct one of your servlet container installation). There, you can see all deployed services and list their methods. &lt;br&gt;The &lt;tt&gt;WSDL&lt;/tt&gt; can be accessed via &lt;a class="external free" title="http://localhost:8080/axis2/services/EchoService?wsdl" href="http://localhost:8080/axis2/services/EchoService?wsdl" rel="nofollow"&gt;http://localhost:8080/axis2/services/EchoService?wsdl&lt;/a&gt;. &lt;br&gt;Axis2 supports a part of REST, named POX - Plain Old XML documents over http. This allows to call the web service via &lt;a class="external free" title="http://localhost:8080/axis2/services/EchoService/echo?input=Good%20Morning" href="http://localhost:8080/axis2/services/EchoService/echo?input=Good%20Morning" rel="nofollow"&gt;http://localhost:8080/axis2/services/EchoService/echo?input=Good%20Morning&lt;/a&gt;. A web page should be returned reading &lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ns:echoResponse&lt;/span&gt; &lt;span style="color: #ff0000"&gt;xmlns:ns&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="http://ws.tecbites"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ns:return&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;Good Morning&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;ns:return&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &lt;br&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;ns:echoResponse&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br&gt;&lt;/div&gt;
&lt;p&gt;By the way - the following error message when accessing &lt;a class="external free" title="http://localhost:8080/axis2/services/EchoService" href="http://localhost:8080/axis2/services/EchoService" rel="nofollow"&gt;http://localhost:8080/axis2/services/EchoService&lt;/a&gt; means the service is working correctly: ;) &lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;p&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;soapenv:Reason&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;soapenv:Text&lt;/span&gt; &lt;span style="color: #ff0000"&gt;xml:lang&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="en-US"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br&gt;   The endpoint reference (EPR) for the Operation not found &lt;br&gt;   is /axis2/services/EchoService and the WSA Action = null&lt;br&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;soapenv:Text&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;soapenv:Reason&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;/pre&gt;&lt;br&gt;&lt;/div&gt;&lt;pre&gt;&lt;/pre&gt;
&lt;h2&gt;Direct POJO deployment &lt;/h2&gt;
&lt;p&gt;There is also the description of deploying the POJO .class file directly into a specially configured axis2 directory. In the &lt;tt&gt;axis2/WEB-INF/conf/axis2.xml&lt;/tt&gt;, there is usually a line reading &lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #008000"&gt;&amp;lt;!--POJO deployer , this will alow users to drop .class &lt;/span&gt;&lt;br&gt;&lt;span style="color: #008000"&gt;  file and make that into a service--&amp;gt;&lt;/span&gt;&lt;br&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;deployer&lt;/span&gt; &lt;span style="color: #ff0000"&gt;extension&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=".class"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;directory&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="pojo"&lt;/span&gt; &lt;br&gt;  &lt;span style="color: #ff0000"&gt;class&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="org.apache.axis2.deployment.POJODeployer"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br&gt;&lt;/div&gt;This should allow to deploy the ws by copying &lt;tt&gt;tecbites/ws/Echo.class&lt;/tt&gt; into the &lt;tt&gt;pojo&lt;/tt&gt; directory. In the context of the jetty servlet container inside the &lt;a class="external text" title="http://sourceforge.net/apps/trac/gsn/" href="http://sourceforge.net/apps/trac/gsn/" rel="nofollow"&gt;Global Sensor Networks (GSN)&lt;/a&gt; project, I was unable to get this to run. &lt;br&gt;&lt;a id="JAXWS_.40WebService_annotations" href="http://www.blogger.com/post-edit.g?blogID=144805460541353359&amp;amp;postID=6561250436074621813" name="JAXWS_.40WebService_annotations"&gt;&lt;/a&gt;&lt;br&gt;
&lt;h2&gt;JAXWS @WebService annotations &lt;/h2&gt;
&lt;p&gt;The JAXWS standard allows to "create" web services by annotating the class with the &lt;a class="external text" title="http://java.sun.com/javaee/5/docs/api/javax/jws/WebService.html" href="http://java.sun.com/javaee/5/docs/api/javax/jws/WebService.html" rel="nofollow"&gt;&lt;tt&gt;@WebService&lt;/tt&gt;&lt;/a&gt; tag. In the axis2+service.xml context, this is not necessary, but supported. &lt;br&gt;Yet, this is helpful when the web service class contains public methods that should &lt;i&gt;not&lt;/i&gt; be accessible as web service methods. &lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;p&gt;&lt;span style="color: #0000ff"&gt;package&lt;/span&gt; tecbites.ws;&lt;br&gt;&lt;span style="color: #0000ff"&gt;import&lt;/span&gt; javax.jws.WebService;&lt;br&gt;&lt;span style="color: #0000ff"&gt;import&lt;/span&gt; javax.jws.WebMethod;&lt;/p&gt;&lt;p&gt;@WebService&lt;br&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Echo {&lt;br&gt;  &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; String echo(String input) {&lt;br&gt;    &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; input;&lt;br&gt;  }&lt;br&gt;  @WebMethod(exclude=true)&lt;br&gt;  &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #008000"&gt;/*static*/&lt;/span&gt; String helper(String input) { &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; input; }&lt;br&gt;}&lt;/p&gt;&lt;/pre&gt;&lt;br&gt;&lt;/div&gt;&lt;a id="Note" href="http://www.blogger.com/post-edit.g?blogID=144805460541353359&amp;amp;postID=6561250436074621813" name="Note"&gt;&lt;/a&gt;
&lt;h2&gt;Side note &lt;/h2&gt;
&lt;p&gt;You might think I'm working for the Apache project, the way I propose their products/projects here. No, I'm not, it's just a fact that "they" are developing open source Java projects for many purposes, from development support (log4j, ant, ...) over utilities (commons, ...) to enterprise technologies (tomcat, axis2). &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/144805460541353359-6561250436074621813?l=tecbites.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tecbites.blogspot.com/feeds/6561250436074621813/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=144805460541353359&amp;postID=6561250436074621813' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/6561250436074621813'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/6561250436074621813'/><link rel='alternate' type='text/html' href='http://tecbites.blogspot.com/2009/09/webservices-with-axis2java-simple-pojo.html' title='Webservices with Axis2/Java - the simple POJO way'/><author><name>Seb</name><uri>http://www.blogger.com/profile/06553111406739261461</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-144805460541353359.post-5779096562140721516</id><published>2009-09-12T08:11:00.001+02:00</published><updated>2009-09-12T08:13:26.991+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Eclipse'/><title type='text'>Eclipse Galileo 3.5.0 as packages for Ubuntu Jaunty</title><content type='html'>&lt;div id="globalWrapper"&gt;
&lt;div id="column-content"&gt;
&lt;div id="content"&gt;
&lt;div id="bodyContent"&gt;
&lt;a href="http://www.blogger.com/post-edit.g?blogID=144805460541353359&amp;amp;postID=5779096562140721516" id=".7EYogarine" name=".7EYogarine"&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;

~Yogarine &lt;/h2&gt;
The eclipse packages delivered with ubuntu are usually very, very old (3.2.x on jaunty).
This is mainly due to the rule of debian that everything(!) needs to be compiled by the
maintainers. Also, they use a completely different Java compile setup than the eclipse
developers - gcj (which is &lt;i&gt;really open source&lt;/i&gt;) instead of Sun JDK.
&lt;br /&gt;
I just found someone who maintains the eclipse-provided binaries as a set of packages for ubuntu jaunty.
&lt;br /&gt;
&lt;a class="external free" href="https://edge.launchpad.net/%7Eyogarine/+archive/eclipse" rel="nofollow" title="https://edge.launchpad.net/~yogarine/+archive/eclipse"&gt;https://edge.launchpad.net/~yogarine/+archive/eclipse&lt;/a&gt;
&lt;br /&gt;
Quite easy to install and use - just note that the JEE tools are inside eclipse-wtp (web tools project).
&lt;br /&gt;
It may be that there is stability problem ... I had one crash so far ... no idea whether this was related
to the packages or the Java setup itself on my system (it was somewhere in the subversion-&amp;gt;libsvnjavahl-&amp;gt;libapr stuff).
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;script type="text/javascript"&gt;
if (window.runOnloadHook) runOnloadHook();
&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/144805460541353359-5779096562140721516?l=tecbites.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tecbites.blogspot.com/feeds/5779096562140721516/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=144805460541353359&amp;postID=5779096562140721516' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/5779096562140721516'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/5779096562140721516'/><link rel='alternate' type='text/html' href='http://tecbites.blogspot.com/2009/09/eclipse-galileo-350-as-packages-for.html' title='Eclipse Galileo 3.5.0 as packages for Ubuntu Jaunty'/><author><name>Seb</name><uri>http://www.blogger.com/profile/06553111406739261461</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-144805460541353359.post-6682159831084988585</id><published>2009-07-14T10:50:00.003+02:00</published><updated>2009-07-14T10:58:15.435+02:00</updated><title type='text'>Wisdoms of the day</title><content type='html'>&lt;ul&gt;&lt;li&gt;Wenn du den Kaffee nicht aufschüttest, läuft er nicht durch&lt;/li&gt;   &lt;li&gt;tar cf file.tar --- "cowardly refusing to create empty archive." &lt;br/&gt; Has saved a lot of archives when typing tar cf instead of tar xf ...&lt;/li&gt; &lt;li&gt;Ever found a good editor for this blog system?&lt;/li&gt; &lt;li&gt;Why am I the only person unable to create a debugging environment for the AVR32?&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/144805460541353359-6682159831084988585?l=tecbites.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tecbites.blogspot.com/feeds/6682159831084988585/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=144805460541353359&amp;postID=6682159831084988585' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/6682159831084988585'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/6682159831084988585'/><link rel='alternate' type='text/html' href='http://tecbites.blogspot.com/2009/07/wisdoms-of-day.html' title='Wisdoms of the day'/><author><name>Seb</name><uri>http://www.blogger.com/profile/06553111406739261461</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-144805460541353359.post-8220879181155768333</id><published>2009-07-06T15:40:00.001+02:00</published><updated>2009-07-06T15:40:49.914+02:00</updated><title type='text'>Using module_param_call for Linux kernel module parameters</title><content type='html'>&lt;p&gt;My first foray into linux kernel programming – writing a module to drive an external buzzer, using the high resolution timer. Not my first action on the linux kernel, though: &lt;a title="http://www.lm-sensors.org/changeset/3613/i2c/trunk" href="http://www.lm-sensors.org/changeset/3613/i2c/trunk"&gt;http://www.lm-sensors.org/changeset/3613/i2c/trunk&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Found a nice feature that is not yet well documented.&lt;/p&gt;  &lt;blockquote&gt;   &lt;pre&gt;ushort enabled =0;
module_param(enabled, ushort, &lt;br /&gt;    S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH);
MODULE_PARM_DESC(enabled, &amp;quot; Enabled or not&amp;quot;);&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
  &lt;li&gt;Defines a module parameter that can be set on insmod &lt;/li&gt;

  &lt;li&gt;giving it rights (S_*** equals 0664 aka rw-rw-r-- in this case) allows to set the value via &lt;tt&gt;/sys/module/modulename/parameters/parameter&lt;/tt&gt; for both reading and writing &lt;/li&gt;

  &lt;li&gt;Unfortunately, the module is not notified when the value is set. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a title="http://lwn.net/Articles/85443/" href="http://lwn.net/Articles/85443/"&gt;http://lwn.net/Articles/85443/&lt;/a&gt; only says: &lt;em&gt;“It is worth noting, however, that there is no mechanism for notifying a module that one of its parameters has been changed”.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Well, there is a method. &lt;strong&gt;module_param_call&lt;/strong&gt;. Or rather a macro. It’s hard to find anything about it on the web, the only(?) source currently are the linux kernel source files … especially &lt;tt&gt;include/linux/moduleparam.h&lt;/tt&gt; and &lt;tt&gt;kernel/params.c&lt;/tt&gt;.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;pre&gt;static int param_set_buzzer_enabled(const char *val, 
  struct kernel_param *kp);
unsigned int buzzerenabled = 0;
module_param_call(buzzer_enabled, param_set_buzzer_enabled, param_get_int,
    &amp;amp;buzzer_enabled, 0664);
MODULE_PARM_DESC(buzzer_enabled, &amp;quot; Buzzer enabled? default: 1 (yY)&amp;quot;);&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;When the value is queried, the pre-defined method param_get_int is called which directly accesses the &lt;tt&gt;(&amp;amp;)buzzer_enabled&lt;/tt&gt; value. When the value is set, the spezial method param_set_buzzer_enabled is called. Of course, it is also possible to do it another way, e.g., to create a read-only parameter which does not have a variable backing.&lt;/p&gt;

&lt;p&gt;The role of the &lt;tt&gt;param_set_buzzer_enabled&lt;/tt&gt; method is best passed to one of the predefined methods – in this case, &lt;tt&gt;param_set_bool&lt;/tt&gt;:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;pre&gt;static int param_set_buzzer_enabled(const char *val, struct kernel_param *kp)
{
  int hr;

  // 1yY 0nN
  hr = param_set_bool(val, kp);
  if (hr!=0) {
    printk(&amp;quot;Unable to set buzzer_enabled to value '%s'\n&amp;quot;, val);
    return hr;
  }
  // do the job, here ;-)
  printk(&amp;quot;New value: %d\n&amp;quot;, buzzer_enabled);
  return 0;
}&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;tt&gt;val&lt;/tt&gt; is &lt;tt&gt;char*&lt;/tt&gt;, always – in some cases, special care needs to be taken of trailing newlines produced by &lt;tt&gt;&amp;quot;echo 0 &amp;gt; /sys/...&amp;quot;&lt;/tt&gt;. At least some implementations of the conversion routine (using &lt;tt&gt;simple_strtol&lt;/tt&gt;) fail in this case – &lt;tt&gt;&amp;quot;echo –n 0&amp;quot;&lt;/tt&gt; needs to be used, then.&lt;/p&gt;

&lt;p&gt;I’d say, far easier to use than defining your own kobject instances, attributes and files, and place them in the appropriate &lt;tt&gt;/sys/&lt;/tt&gt;-folders. By the way – the macro used above, &lt;tt&gt;module_param&lt;/tt&gt;, does nothing else than calling the other one with the correct &lt;tt&gt;param_set_##type&lt;/tt&gt; methods based on the given type (ok, I admin, &lt;tt&gt;module_param_named&lt;/tt&gt; also participates).&lt;/p&gt;

&lt;p&gt;Yours, 
  &lt;br /&gt;Sebastian&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/144805460541353359-8220879181155768333?l=tecbites.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tecbites.blogspot.com/feeds/8220879181155768333/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=144805460541353359&amp;postID=8220879181155768333' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/8220879181155768333'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/8220879181155768333'/><link rel='alternate' type='text/html' href='http://tecbites.blogspot.com/2009/07/using-moduleparamcall-for-linux-kernel.html' title='Using module_param_call for Linux kernel module parameters'/><author><name>Seb</name><uri>http://www.blogger.com/profile/06553111406739261461</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-144805460541353359.post-1153124549260215064</id><published>2009-03-15T14:04:00.003+01:00</published><updated>2009-03-15T14:13:18.844+01:00</updated><title type='text'>UPnP via python</title><content type='html'>&lt;h1&gt;Controlling your DSL Router via UPnP&lt;/h1&gt;
When I was looking for a commandline tool to create port mappings on my broadband/DSL router, I detected the &lt;b&gt;miranda.py&lt;/b&gt; script on &lt;a href="http://www.sourcesec.com/2008/11/07/miranda-upnp-administration-tool/"&gt;http://www.sourcesec.com/2008/11/07/miranda-upnp-administration-tool/&lt;/a&gt;.

I needed some functionality not yet provided by the script, namely, the possibility of passing arguments to host send commands. Usually, the script asks nicely for all required arguments; this is hard to automate. Using the patch provided below, a command such as 
&lt;pre&gt;host send 0 WANConnectionDevice WANIPConnection AddPortMapping ssh2 0 192.168.32.32  1  22  80.80.80.80 tcp  22&lt;/pre&gt;
is now possible.
This also allows bash scripting:
&lt;pre&gt;
cat &amp;lt;&amp;lt;EOF | miranda.py -s ~/.miranda/struct_data.mir
host get 0
host send 0 WANConnectionDevice WANIPConnection AddPortMapping ssh2 0 192.168.32.32  1  22  80.80.80.80 tcp  22
EOF
&lt;/pre&gt;

I also fixed a nondescript exception message when no host had yet been loaded/found.

Have fun with it,&lt;br&gt;
yours,&lt;br&gt;
&lt;em&gt;Sebastian&lt;/em&gt;&lt;br&gt;

&lt;pre&gt;
--- miranda.py.orig 2009-03-15 13:51:03.000000000 +0100
+++ miranda.py 2009-03-15 13:58:37.000000000 +0100
@@ -1065,11 +1065,15 @@
    #Send SOAP requests
    index = False
    inArgCounter = 0
-
-   if argc != 6:
+   
+   #sbr: allow to pass arguments to the call
+   numReqArgs = 6
+   if argc &lt; numReqArgs:
     showHelp(argv[0])
     return
+   # number of arguments in addition to the send cmd
    else:
+    extraArgs = argc-numReqArgs
     try:
      index = int(argv[2])
     except:
@@ -1078,7 +1082,12 @@
     deviceName = argv[3]
     serviceName = argv[4]
     actionName = argv[5]
-    hostInfo = hp.ENUM_HOSTS[index]
+    try:
+     hostInfo = hp.ENUM_HOSTS[index]
+    except Exception, e:
+     print "You need to discover or load some hosts, first"
+     return
+   
     actionArgs = False
     sendArgs = {}
     retTags = []
@@ -1106,11 +1115,18 @@
      print "Are you sure you've specified the correct action?"
      return False
 
+    extraArgsUsed = 0
     for argName,argVals in actionArgs.iteritems():
      actionStateVar = argVals['relatedStateVariable']
      stateVar = hostInfo['deviceList'][deviceName]['services'][serviceName]['serviceStateVariables'][actionStateVar]
 
      if argVals['direction'].lower() == 'in':
+         if extraArgs-extraArgsUsed &gt; 0:
+      arg = argv[numReqArgs+extraArgsUsed]
+      print "Using ", arg, " for ", argName
+      sendArgs[argName] = (arg,stateVar['dataType'])
+      extraArgsUsed += 1
+         else:
       print "Required argument:" 
       print "\tArgument Name: ",argName
       print "\tData Type:     ",stateVar['dataType']

&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/144805460541353359-1153124549260215064?l=tecbites.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tecbites.blogspot.com/feeds/1153124549260215064/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=144805460541353359&amp;postID=1153124549260215064' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/1153124549260215064'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/1153124549260215064'/><link rel='alternate' type='text/html' href='http://tecbites.blogspot.com/2009/03/upnp-via-python.html' title='UPnP via python'/><author><name>Seb</name><uri>http://www.blogger.com/profile/06553111406739261461</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-144805460541353359.post-8048246418940939346</id><published>2008-02-28T12:18:00.002+01:00</published><updated>2008-02-28T13:26:43.315+01:00</updated><title type='text'>ZIM, the Desktop-Wiki - or "Taking Notes 2.0"</title><content type='html'>&lt;p&gt;
For the stuff I'm writing here, there are two important roots.&lt;br /&gt;
One is the common note taking everyone does, on paper, on computer, or on whatever medium available.&lt;br /&gt;
The other are wikis - web 2.0 knowledge management systems for sharing ideas, documentation, or notes with others in a community.&lt;br /&gt;
I tend to structure my ideas hierarchically by topic, but easy linking between pages is a must. I need simple text formatting, the possibility to link in external documents or web pages -- all features available with most wikis. Yet, a web-based solution is not very appropriate for personal notes, especially as I'm currently sitting in a hotel room w/o any network connection.&lt;/p&gt;

&lt;p&gt;Some time ago, I had a look for desktop wikis. The one I found best is &lt;b&gt;ZIM&lt;/b&gt;; since then, I've been using it for nearly all my notes about quite a bunch of topics. Even this blog page I'm writing in it, because I got used to the easy text formatting and html export, far more than the WYSIWYMG editor of this blog site (as in &lt;i&gt;What You See is What You (or your visitors) Might Get&lt;/i&gt;).
&lt;/p&gt;

&lt;p&gt;&lt;a href="http://picasaweb.google.co.uk/csbac74/Blog/photo?authkey=avVuzh__ZaI#5171966802790233154"&gt;&lt;img src="http://lh6.google.co.uk/csbac74/R8aEZ6ZstEI/AAAAAAAAACY/KSN9Lq3bBv0/s144/ZIM1.png" align="left" border="4"/&gt;&lt;/a&gt;Time to show you an image of the stuff I wrote so far, in ZIM. On the left, you can see the top-level structure of my notes, and the "usual" assortment menu items and buttons. And in the main text, you can see the image you are looking at which contains the text which ... ... ... just ignore it.
&lt;/p&gt;

I don't want to write too much about it, the you can find more information on  &lt;a href='http://pardus-larus.student.utwente.nl/~pardus/projects/zim/'&gt;Jaap's web page&lt;/a&gt;. Just an unsorted list of the features I like most ...
&lt;ul&gt;
&lt;li&gt;Stores each page in a .txt file, the directory structure reflects the note hierarchy&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;easy network sharing, backup, version control and all this stuff&lt;/li&gt;
&lt;li&gt;there is even an integration with subversion and cvs&lt;/li&gt;
&lt;li&gt;pages can be edited externally, e.g., when you just have the .txt files, but no ZIM; and reloaded later on&lt;/li&gt;
&lt;li&gt;I use it at home, at work, and on my notebook, and merge it via subversion - no problem with it.&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;works on Linux, Windows, and any other OS that supports Perl and Gtk&lt;/li&gt;
&lt;li&gt;text formatting by shortcuts, yet also by manually using the wiki format statements, and reloading the page&lt;/li&gt;
&lt;li&gt;pages can be exported to html; this is what is going to happen to this page as well when it is finished&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;keeps the directory and link structure, image embedding, and everything&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;the help is written in ZIM itself&lt;/li&gt;
&lt;li&gt;linking in both web pages and files from the current directory is as easy as typing "./document.pdf"&lt;/li&gt;
&lt;li&gt;uses CamelCase and similar features for page linking&lt;/li&gt;
&lt;li&gt;has a pane with a folder and page structure &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Anything forgotten? Quite a lot, I'm sure, have a look at the author's page, you'll find it there ;-)&lt;/p&gt;

For those of you who have seen tiddlywiki: The latter does not need a application of its own, yet has a lot of severe (IMHO) drawbacks:&lt;ul&gt;
&lt;li&gt;everything is saved in one large file which contains both the java script code (~200kB) and the notes&lt;/li&gt;
&lt;li&gt;saving takes a lot of time on a non-local drive&lt;/li&gt;
&lt;li&gt;version management, especially merging between different systems, does not really work&lt;/li&gt;
&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/144805460541353359-8048246418940939346?l=tecbites.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tecbites.blogspot.com/feeds/8048246418940939346/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=144805460541353359&amp;postID=8048246418940939346' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/8048246418940939346'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/8048246418940939346'/><link rel='alternate' type='text/html' href='http://tecbites.blogspot.com/2008/02/zim-desktop-wiki-or-taking-notes-20.html' title='ZIM, the Desktop-Wiki - or &quot;Taking Notes 2.0&quot;'/><author><name>Seb</name><uri>http://www.blogger.com/profile/06553111406739261461</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-144805460541353359.post-9003589491447195737</id><published>2008-02-28T10:34:00.002+01:00</published><updated>2008-02-28T10:40:03.827+01:00</updated><title type='text'>Another Crashed Train Information System - Linux, this Time</title><content type='html'>&lt;p&gt;
I've seen quite a bunch of crashed visitor information systems, ATMs, and similar, on my my daily what-the-f__k page &lt;a href='http://www.dailywtf.org/'&gt;http://www.dailywtf.org/&lt;/a&gt;, all of them Windows based ... now it is time to show the Linux version of it!&lt;p&gt;

&lt;p&gt;&lt;a href="http://picasaweb.google.co.uk/csbac74/Blog/photo?authkey=avVuzh__ZaI#5171636640064254994"&gt;&lt;img src="http://lh5.google.co.uk/csbac74/R8VYH6ZstBI/AAAAAAAAACA/YsCdt63F8gk/s144/Departure-Linux-500.jpg" align="left"/&gt;&lt;/a&gt;&lt;a href="http://picasaweb.google.co.uk/csbac74/Blog/photo?authkey=avVuzh__ZaI#5171636644359222306"&gt;&lt;img src="http://lh6.google.co.uk/csbac74/R8VYIKZstCI/AAAAAAAAACI/SrzJ_IRolRY/s144/Departure-Working-400.jpg" align="right"/&gt;&lt;/a&gt;As every Linux-user will recognise from the photo, there is &lt;b&gt;only one way&lt;/b&gt; to crash such a system if it is Linux-based ... &lt;b&gt;fry the harddisk&lt;/b&gt;. No blue screens, no "segmentation fault" dialogs, no kernel panics ... (no, the picture does not need to be rotated.)
&lt;br /&gt;
&lt;p&gt;On the right, you can see how the departure information should have looked like. And for the Germans among you - have a guess which major train station it happened on ;-)&lt;p/&gt;
&lt;p&gt;BTW, the ticket vending machines from the "DB" are using Windows. And, I did get my train, which is not that common, even (especially?) in Germany ...&lt;p/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/144805460541353359-9003589491447195737?l=tecbites.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tecbites.blogspot.com/feeds/9003589491447195737/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=144805460541353359&amp;postID=9003589491447195737' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/9003589491447195737'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/9003589491447195737'/><link rel='alternate' type='text/html' href='http://tecbites.blogspot.com/2008/02/another-crashed-train-information.html' title='Another Crashed Train Information System - Linux, this Time'/><author><name>Seb</name><uri>http://www.blogger.com/profile/06553111406739261461</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-144805460541353359.post-1010560253203746570</id><published>2008-02-22T14:24:00.001+01:00</published><updated>2008-02-22T14:24:20.818+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Java, PDFRenderer, and the Importance of "Order"</title><content type='html'>&lt;p&gt;There is a great Java package for displaying PDF files inside your Java application: &lt;a href="https://pdf-renderer.dev.java.net/"&gt;PDFRenderer, &lt;/a&gt;developed as part of the java.net approach (javadesktop/swinglabs). Unfortunately, the &lt;b&gt;order&lt;/b&gt; in which you do certain things is &lt;b&gt;very&lt;/b&gt; important.&lt;br/&gt;
So, you need to do the following (in the Code):&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Create the JFrame, and create and add the PagePanel from PDFRenderer&lt;/li&gt;
&lt;li&gt;Show the JFrame (&lt;code&gt;setVisible(true)&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Show the PDF page you want to show (&lt;code&gt;PagePanel.showPage(...)&lt;/code&gt;)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This seems trivial, is done this way in the samples, yet ... change the order, and the only thing you get is "no page seleceted".&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;setVisible before adding PagePanel: "no page selected"&lt;/li&gt;
&lt;li&gt;setVisible after showPage: "no page selected"&lt;/li&gt;
&lt;li&gt;adding PagePanel to a visible JFrame: "no page selected"&lt;/li&gt;
&lt;li&gt;showPage in an invisble JFrame: "no page selected"&lt;/li&gt;
&lt;li&gt;and so on ;-)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Great software, isn't it?&lt;br&gt;
By the way, it can only show pdf version 1.4 (from Acrobat/Reader 5.0), and if there is a problem, you get an exception trace to System.err, yet no way to catch the exception ... the display is running asynchronously in a thread of its own.&lt;/p&gt;

Have fun!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/144805460541353359-1010560253203746570?l=tecbites.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tecbites.blogspot.com/feeds/1010560253203746570/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=144805460541353359&amp;postID=1010560253203746570' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/1010560253203746570'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/1010560253203746570'/><link rel='alternate' type='text/html' href='http://tecbites.blogspot.com/2008/02/java-pdfrenderer-and-importance-of.html' title='Java, PDFRenderer, and the Importance of &quot;Order&quot;'/><author><name>Seb</name><uri>http://www.blogger.com/profile/06553111406739261461</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-144805460541353359.post-1959068051364877129</id><published>2008-02-22T14:11:00.000+01:00</published><updated>2008-02-22T14:12:21.839+01:00</updated><title type='text'>Getting Birthday Greetings twice a Year with Skype</title><content type='html'>&lt;p&gt;Wondering how to get birthday greetings from most of your friends more than once a year? Just change your birthday in your Skype profile regularly ...&lt;/p&gt;
&lt;p&gt;A friend of mine just did it, unintentionally, though. I got a note from Skype that he was going to have his birthday in a few days, entered it into my calender, and send him greetings on the day. Then, by coincidence, I checked his Skype profile again ... and noticed that the birthday was 10 months later, now. (To tell the truth, I noticed a mismatch between his age and the difference between his birth year, and 2008. Already wanted to post it to my favorite &lt;a href="http://thedailywtf.com/"&gt;What-the-Fork page&lt;/a&gt;.)&lt;/p&gt;
&lt;p&gt;I apologised to him, and he told me that quite some people had greeted him, so he noticed the mistake in his skype profile, and changed it. Yet there is no reason why it shouldn't work, regularly, most (Skype) friends will forget it anyway in a few months, and some will even add both (or even more ;-)) of your birth dates into their calenders ...&lt;/p&gt;

Have fun.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/144805460541353359-1959068051364877129?l=tecbites.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tecbites.blogspot.com/feeds/1959068051364877129/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=144805460541353359&amp;postID=1959068051364877129' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/1959068051364877129'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/1959068051364877129'/><link rel='alternate' type='text/html' href='http://tecbites.blogspot.com/2008/02/getting-birthday-greetings-twice-year.html' title='Getting Birthday Greetings twice a Year with Skype'/><author><name>Seb</name><uri>http://www.blogger.com/profile/06553111406739261461</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-144805460541353359.post-6649329887422038460</id><published>2008-02-18T14:18:00.005+01:00</published><updated>2008-03-13T08:21:49.111+01:00</updated><title type='text'>Migrating Windows XP from Pentium4 to Athlon64X2</title><content type='html'>&lt;p&gt;You have a running Windows XP system on an "old" Intel-based processor, Pentium 4, e.g., and you get a new computer with an AMD-based processor, an Athlon64X2 4800+, in my case. Switching the hard disks from one machine to the other is easy, of course, yet the system doesn't boot ... due to&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;different hardware access layers (HAL)&lt;/li&gt;
&lt;li&gt;different hard disk (SATA) controllers&lt;/li&gt;
&lt;li&gt;different CPUs&lt;/li&gt;
&lt;li&gt;possibly more reasons.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;But, there are solutions for everything ... even though MS says it's not possible (at least, they say it is impossible to switch CPU types when using sysprep, see &lt;a href="http://support.microsoft.com/kb/828287/"&gt;here&lt;/a&gt;).&lt;/p&gt;

&lt;h3&gt;Step 1: Backup&lt;/h3&gt;
&lt;p&gt;Save all important data. You never know what is going to happen.&lt;/p&gt;

&lt;h3&gt;Step 2: Remove Drive Letter Assignments&lt;/h3&gt;
&lt;p&gt;If you don't want to move the harddisk, but copy it instead onto another one, you need to remove all drive letter assigments. Otherwise, if your C: system is copied onto a G: drive, you will end up with a G: drive on the new system ... which does not really work.
See &lt;a href="http://www.dominok.net/en/it/en.it.clonexp.html"&gt;"Forking a XP-installation"&lt;/a&gt;: Remove all entries from the registry-key &lt;code&gt;"HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices"&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;If you use the copying approach, some more steps are necessary, especially making the hard disk bootable by makeing a rescue boot, and executing fixmbr and fixboot sucessfully. Also, the copying itself needs to be done on a third(!) system.&lt;/p&gt;

&lt;h3&gt;Step 4: Disable intelppm.sys and/or processr.sys&lt;/h3&gt;
&lt;p&gt;There are two system services that are left untouched by Windows XP when doing a repair as we are going to do below, both responsible for Intel processors -- microcode loading, etc. Thus, either&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;disable them before shutting the old system down for the last time (services.msc, "Disable")&lt;/li&gt;
&lt;li&gt;Boot your windows XP CD into rescue console mode, and execute "disable intelppm" and/or "disable processr" (use "listsvc" for listing the services). This can also be done between steps 5 and 6, if necessary.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;Thanks to &lt;a href="http://blogs.msdn.com/virtual_pc_guy/archive/2005/10/24/484461.aspx"&gt;Ben Armstrong&lt;/a&gt; from the Virtual PC Team for this information; also see &lt;a href="http://support.microsoft.com/kb/888372/en-us"&gt;here.&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;Step 5: Repair the system&lt;/h3&gt;
&lt;p&gt;Use the XP CD to boot, select "Install", then, "Repair". Makes a clean installation of the system, yet &lt;strong&gt;keeps all software, user etc. settings, programs and data&lt;/strong&gt;. This is the main reason for doing this in the beginning, instead of a clean install. &lt;br&gt;
Make sure you have a XP CD &lt;b&gt;with&lt;/b&gt; Service Pack 2, to avoid both the trouble of reinstalling it, and any unexpected pre-SP2-behaviour ...&lt;/p&gt;
&lt;p&gt;Information about this repair can be found, e.g., &lt;a href="http://support.microsoft.com/?scid=kb%3Ben-us%3B315341&amp;x=10&amp;y=12"&gt;here.&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If you skip this step and just boot the old system on the new machine, you get a blue screen of death (BSOD) -- usually &lt;a href="http://support.microsoft.com/?scid=kb%3Ben-us%3B315341&amp;x=10&amp;y=12"&gt;"inaccessible boot device"&lt;/a&gt;, also &lt;a href="http://msdn2.microsoft.com/en-gb/library/ms795508.aspx"&gt;here&lt;/a&gt; or &lt;a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;Q314082"&gt;here.&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;Step 6: Boot the half-installed system&lt;/h3&gt;
&lt;a href="http://picasaweb.google.com/csbac74/Blog/photo?authkey=avVuzh__ZaI#5169477761868018690"&gt;&lt;img src="http://lh4.google.com/csbac74/R72soqZstAI/AAAAAAAAABc/wCkB_typvco/s144/GreenScreenOfDeath-cut-400.jpg" align="right" alt="STOP: 0x0000007E (0xC0000005, 0xBAA28750, 0xBACC342C, 0xBACC3128)"/&gt;&lt;/a&gt;
&lt;p&gt;Part of the repair process, as any other windows install process, is a reboot. If the reboot fails with a blue screen (of death, BSOD), or a green screen (yes, really, see figure), you need to do step 4 ("disable intelppm"):&lt;br/&gt; &lt;code&gt;STOP: 0x0000007E (0xC0000005, 0xBAA28750, 0xBACC342C, 0xBACC3128)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Apart from this, you need to finish the installation, including new hardware drivers (they'll have changed, anyway), and similar stuff. You should have a running system, now; otherwise, contact me with detailed questions ;-)&lt;/p&gt;

&lt;h3&gt;Step 7: Patch the system&lt;/h3&gt;
&lt;p&gt;Last thing to do: install the current MS patches. You overwrote all system files, so you are back to SP2 state ... that means about 50 patches, currently.&lt;/p&gt;

&lt;h3&gt;Step n: Have fun.&lt;/h3&gt;
As much fun as one can have with a windows system ....

&lt;h3&gt;Appendix A&lt;/h3&gt;
&lt;p&gt;As I found out later (12th March 2008), it is possible to copy the "repair" registry into into a non-booting system via the repair console (booted from CD). This is usually the first step on the way to manually copying the least recent registry from a system restore point. On the other hand, it is possible to copy c:\windows\repair\system into c:\windows\config\system, thus replacing the &lt;em&gt;system&lt;/em&gt; registry only, while keeping the rest of it, and forcing hardware re-detection on the next boot&lt;/p&gt;

&lt;p&gt;Unfortunately, this did not really work out on the one time we tried it ... the system booted, yet the second the mouse cursor appeared it re-booted.&lt;/p&gt;

&lt;p&gt;On the other hand -- if you have a system that windows is not willing to repair because it is simply not detected by the boot CD for the "repair-install", doing this surprisingly makes the CD rediscover the installation ... no idea why it wasn't found in the first place, yet it helped. Go back to Step 1, then. &lt;/p&gt;

&lt;h3&gt;Appendix B&lt;/h3&gt;
&lt;p&gt;After the finished the install on the new hardware, the installation still contains the information about all the old hardware ... from on-board network devices via ACPI to mainboard resources. There is trick to make the hardware configuration panel to &lt;a href="http://support.microsoft.com/kb/315539"&gt;show "non-available" devices&lt;/a&gt;, though, and delete the ones you surely never need again. The non-available ones have "lighter" icons.&lt;/p&gt;

&lt;ul&gt;&lt;li&gt;start a cmd shell&lt;/li&gt;&lt;li&gt;&lt;code&gt;set devmgr_show_nonpresent_devices=1&lt;/code&gt;&lt;/li&gt;&lt;li&gt;&lt;code&gt;devmgmt.msc&lt;/code&gt;&lt;/li&gt;&lt;/ul&gt;

&lt;p&gt;Just don't delete anything you might need again, and rather keep the USB stuff ... also, do &lt;b&gt;not&lt;/b&gt; delete any IDE channels, as the ones where no drive is attached, are shown as missing as well.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/144805460541353359-6649329887422038460?l=tecbites.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tecbites.blogspot.com/feeds/6649329887422038460/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=144805460541353359&amp;postID=6649329887422038460' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/6649329887422038460'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/6649329887422038460'/><link rel='alternate' type='text/html' href='http://tecbites.blogspot.com/2008/02/migrating-windows-xp-from-pentium4-to.html' title='Migrating Windows XP from Pentium4 to Athlon64X2'/><author><name>Seb</name><uri>http://www.blogger.com/profile/06553111406739261461</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-144805460541353359.post-19255260530664017</id><published>2008-02-14T10:16:00.008+01:00</published><updated>2008-02-15T19:56:09.811+01:00</updated><title type='text'>Speeding up Firefox "Tab Effect"</title><content type='html'>&lt;p&gt;There's the great plugin for Firefox called &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/4258"&gt;"Tab Effect"&lt;/a&gt; which does 3D rotation on a cube when you change tabs. No important use, yet great animation. For Windows-Users who want Linux XGLX or MacOS feeling.
Unfortunately, the switching takes time ... but there is a speedup patch:&lt;/p&gt;
&lt;a href="https://addons.mozilla.org/en-US/firefox/reviews/display/4258"&gt;
&lt;h3&gt;"How to make it faster!&lt;/h3&gt;&lt;/a&gt;&lt;address&gt;by aquanautmonkey on December 17, 2007 (rated 7) &lt;/address&gt;
&lt;p&gt;
Nice effect!
To make it faster, do the following:
&lt;ol&gt;
&lt;li&gt;Open the tab_effect-1.1-fx.xpi file in a zip archive editor (7zip, etc.)&lt;/li&gt;
&lt;li&gt;Navigate to content/javascript.js&lt;/li&gt;
&lt;li&gt;About 3/4 down the file there is this line:&lt;br&gt;
TabEffect.xpcomObj.translateToNextTab(back, 24);&lt;/li&gt;
&lt;li&gt;Set the number which is originally 24, to be something less. I put 10 and it works much faster and looks better!&lt;/li&gt;
&lt;li&gt;Install the edited add-on like you usually would.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;Editing after installation&lt;/h3&gt;
&lt;p&gt;
There is also a simple way to edit it after installation:
&lt;ul&gt;&lt;li&gt;Go into extensions\{0784CD66-62FE-4cef-ABF4-F8ED9B654ACC}\content (if the GUID is different, search for ITabEffect.xpt in the extensions dir, and go into ..\content&lt;/li&gt;&lt;li&gt;Edit javascript.js, TabEffect.xpcomObj.translateToNextTab(back, 8); (8 instead of the default 24)&lt;/li&gt;&lt;li&gt;Restart firefox&lt;/li&gt;&lt;li&gt;enjoy!&lt;/li&gt;&lt;/ul&gt;
If the graphics card is the slowing factor in your setup, this won't help you, of course ...&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/144805460541353359-19255260530664017?l=tecbites.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tecbites.blogspot.com/feeds/19255260530664017/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=144805460541353359&amp;postID=19255260530664017' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/19255260530664017'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/19255260530664017'/><link rel='alternate' type='text/html' href='http://tecbites.blogspot.com/2008/02/speeding-up-firefox-tab-effect.html' title='Speeding up Firefox &quot;Tab Effect&quot;'/><author><name>Seb</name><uri>http://www.blogger.com/profile/06553111406739261461</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-144805460541353359.post-508581251268462698</id><published>2008-02-14T08:21:00.002+01:00</published><updated>2008-02-14T08:27:26.387+01:00</updated><title type='text'>Market niches</title><content type='html'>&lt;ul&gt;&lt;li&gt;Spotted chocolate ("Kuhflecken"), with dark spots instead of white ones&lt;/li&gt;&lt;li&gt;An alarm clock that does a short "beep" or "ding" a few minutes before wakeup time, so that you are already "prepared" for the real signal, and don't need the snooze feature so often&lt;/li&gt;&lt;/ul&gt;

Any more ideas?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/144805460541353359-508581251268462698?l=tecbites.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tecbites.blogspot.com/feeds/508581251268462698/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=144805460541353359&amp;postID=508581251268462698' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/508581251268462698'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/508581251268462698'/><link rel='alternate' type='text/html' href='http://tecbites.blogspot.com/2008/02/market-niches.html' title='Market niches'/><author><name>Seb</name><uri>http://www.blogger.com/profile/06553111406739261461</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-144805460541353359.post-6474053320711228120</id><published>2008-02-13T15:43:00.006+01:00</published><updated>2008-02-13T17:04:42.109+01:00</updated><title type='text'>Loading an XML file into Java objects with Castor</title><content type='html'>A common problem:
You have a certain XML file, of a semi-fixed format. No document type definition (DTD), no XML schema definition (XSD), just some "agreed-on" XML structure.
You want to load a bunch of those files into Java, and work with them.
Best would be to transfer them into Java classes or beans.

Castor allows this - see &lt;a href="http://www.castor.org/"&gt;http://www.castor.org/&lt;/a&gt;
Install Castor 1.2, you'll need the complete version with source code; otherwise, it seems to be missing some of the dependencies, e.g., velocity-1.5.jar.
The scripts to run are found in &amp;lt;CASTOR&amp;gt;/bin as .sh and/or .bat scripts, e.g., classpath.bat/.sh which will be used in the following.

&lt;h3&gt;Step 1: Generating a schema definition&lt;/h3&gt;
Castor is able to generate an xsd file from an XML instance file. This schema might not be complete nor correct, yet it is a good starting point. Possible, you'll have to patch it, to remove nodes that have no well-known structure, or to add others that don't appear in the selected instance file.

&lt;pre&gt;
classpath.bat 
  org.exolab.castor.xml.schema.util.XMLInstance2Schema 
  input.xml [output.xsd]
&lt;/pre&gt;

If no output file is given, the schema is written to standard out.
Alternatively, you can used the class from your own code:
&lt;pre&gt;
XMLInstance2Schema instance2Schema = new XMLInstance2Schema();
Schema schema = instance2Schema.
  createSchema("input.xml");
System.out.println(schema);

// copied from XMLInstance2Schema#main
Writer dstWriter = new PrintWriter(
  new FileOutputStream("output.xsd"), true);
SchemaWriter schemaWriter = new SchemaWriter(dstWriter);
schemaWriter.write(schema);
dstWriter.flush();
&lt;/pre&gt;

Some Links:&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.castor.org/xml-faq.html#Is-there-a-way-to-automatically-create-an-XML-Schema-from-an-XML-instance?"&gt;Castor FAQ&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.nabble.com/How-to-create-XML-Schema-based-on-XML-td13400428.html"&gt;Nabble Forum
&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://castor.codehaus.org/javadoc/org/exolab/castor/xml/schema/util/XMLInstance2Schema.html"&gt;XMLInstance2Schema&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;Step 2: Patch the generated schema&lt;/h3&gt;
Often, changes to the generated schema file are necessary.
The input.xml may, for example, contain a set of nodes that are not really well-agreed on, change regularly, or are very different between different instance files. In our case, it was some html-formatted text that was just barely made xml-compatible by making sure each &amp;lt;p&amp;gt; also contained &amp;lt;/p&amp;gt; ... not even xhtml, I'd say.

So, we replaced a complex node structure
&lt;pre&gt;
{sequence}
 {element name="p"}
  {complexType}
   {all}
    {element name="i"}
     {complexType mixed="true"}
      {sequence}
      [...]
&lt;/pre&gt;
with simple
&lt;pre&gt;
{element name="p" type="xsd:anyType" /}
&lt;/pre&gt;  

Links:&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.xmlschemareference.com/schemaElement.html"&gt;XML Schema reference&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://de.wikipedia.org/wiki/XML_Schema#Beliebiger_Inhalt"&gt;Wikipedia: anyType (German)&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;Step 3: Generate the Java classes&lt;/h3&gt;
Next step, Castor generates Java classes from the schema definition. Again, this can either be done by the sourceGen.bat provided with castor, or programmatically via &lt;code&gt;org.exolab.castor.builder.SourceGeneratorMain.main(new String[] {param1, param2, ...})&lt;/code&gt;.

&lt;pre&gt;sourceGen.bat -i output-patched.xsd 
  -package my.package.name -dest src -f -types j2&lt;/pre&gt;

-f suppresses any non-fatal warnings, including the overwriting of existing files.
-types j2 uses java.util.List for collections, even List&amp;lt;Type&amp;gt; with Java 5.0 as below.

For each type Type of the schema, a my.package.name.Type java file is generated, and a my.package.name.descriptors.TypeDescriptor for Castor use.

Oh, I also put a castorbuilder.properties file into the current directory which contained
&lt;pre&gt;
# Defines the XML parser to be used by Castor.
# The parser must implement org.xml.sax.Parser.
org.exolab.castor.parser=org.xml.sax.helpers.XMLReaderAdapter

# Defines the (default) XML serializer factory to use by Castor, which must
# implement org.exolab.castor.xml.SerializerFactory; default is 
# org.exolab.castor.xml.XercesXMLSerializerFactory
org.exolab.castor.xml.serializer.factory=org.exolab.castor.xml.XercesJDK5XMLSerializerFactory

# Defines the default XML parser to be used by Castor.
org.exolab.castor.parser=com.sun.org.apache.xerces.internal.parsers.SAXParser

org.exolab.castor.builder.javaVersion=5.0
&lt;/pre&gt;

&lt;a href="http://www.castor.org/sourcegen.html"&gt;Castor Source-Generation&lt;/a&gt;

&lt;h3&gt;Step 4: Use the classes&lt;/h3&gt;
Write some code that unmarshals the XML file(s), and prints the resulting objects. toString() is not overridden, so you have to query each attribute and subnode individually.

&lt;pre&gt;
TopType top = (TopType) Unmarshaller.unmarshal(
  TopType.class, new FileReader("input.xml"));
// topType.getSubItem returns SubItem[]
for (SubItem item: topType.getSubItem()) {
  System.out.printf("SubItem id: %s; value: %s\n",
    item.getSomeId(), item.getSomeValue());
  // p is just the anyType object from above; toString(), it 
  //  prints the XML content as a fragment.
  System.out.println(item.getP());
}
&lt;/pre&gt;

Have fun with it!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/144805460541353359-6474053320711228120?l=tecbites.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tecbites.blogspot.com/feeds/6474053320711228120/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=144805460541353359&amp;postID=6474053320711228120' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/6474053320711228120'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/6474053320711228120'/><link rel='alternate' type='text/html' href='http://tecbites.blogspot.com/2008/02/loading-xml-into-java-objects-with.html' title='Loading an XML file into Java objects with Castor'/><author><name>Seb</name><uri>http://www.blogger.com/profile/06553111406739261461</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-144805460541353359.post-4436896950661024684</id><published>2007-10-25T11:48:00.001+02:00</published><updated>2008-02-12T18:05:29.597+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Unit Testing (1): Overview</title><content type='html'>First article of a series:
Use unit testing with open source Java components, in the environment of Swing UIs, J2EE server components, database access (esp. hibernate), web applications, etc.

Unit testing is an important part of Test Driven Development (TDD). Admittedly, I have mostliy ignored this topic up to now. Obviously, the overview I have over my own code was enough to detect, place and correct bugs; working with others' code, detecing errors was usually easy, leaving them to fix it ;-)

Also, I was always of the opinion that "my" projects were not applicable for Unit Testing ... complicated UIs, enterprise architectures, complex databases, J2EE deployment, etc. Luckily, others have worked on developing frameworks for most of these purposes.
&lt;h2&gt;Test-Driven Development&lt;/h2&gt;First write the tests, then the structure of the class to implemented, then run the tests. They'll fail, as there is no implementation yet.
So, do the coding, test it regularly, until the tests don't fail any longer ... finshed, sort of.&lt;t&gt;
&lt;/t&gt;&lt;h2&gt;JUnit&lt;/h2&gt;JUnit is the most-used Java testing framework. There are so many good tutorials out there, so I don't see the need to write another one. Read one or more of
&lt;ul&gt;&lt;li&gt;http://www.junit.org/&lt;/li&gt;&lt;li&gt;http://junit.sourceforge.net/&lt;/li&gt;&lt;li&gt;http://www.ibm.com/developerworks/library/j-ant/&lt;/li&gt;&lt;li&gt;http://www.torsten-horn.de/techdocs/java-junit.htm&lt;/li&gt;&lt;/ul&gt;In the following, I will use JUnit 4.4.
Version 4 changed a lot of the usage of Test Cases and such, using Java 5 annotations.
&lt;ul&gt;&lt;li&gt;http://www.frankwestphal.de/JUnit4.0.html&lt;/li&gt;&lt;li&gt;http://www.mm.informatik.tu-darmstadt.de/courses/helpdesk/junit4.html&lt;/li&gt;&lt;li&gt;http://radio.javaranch.com/lasse/2006/07/27/1154024535662.html&lt;/li&gt;&lt;li&gt;http://www.instrumentalservices.com/content/view/45/52/&lt;/li&gt;&lt;/ul&gt;I will also make use of the assertThat statement which was introduced with JUnit 4.4, because it makes much of the test code more readable, especially the error messages.
&lt;ul&gt;&lt;li&gt;http://junit.sourceforge.net/doc/ReleaseNotes4.4.html&lt;/li&gt;&lt;/ul&gt;&lt;h2&gt;Sample&lt;/h2&gt;We write a simple utility for concatenating the textual representation of list elements, with a user-defined concatenation string.
Having the list &lt;code&gt;("Hello", "world", "!")&lt;/code&gt;,  &lt;code&gt;CollectionUtils.collectionToString(list, ", ")&lt;/code&gt; should produce &lt;code&gt;"Hello, World, !"&lt;/code&gt;.

&lt;h3&gt;Unit Test for collectionToString&lt;/h3&gt;
We start with the unit test.
&lt;pre&gt;public class  CollectionUtilsTest {
@Test public void testCollectionToString() {
 final List &amp;lt;String&amp;gt; list1 = Arrays.asList("Hello", "World", "!");
 final String comma = ", ";
 final String result1 = CollectionUtils.collectionToString(list1, comma);
 // we can check the complete string
 assertEquals("Hello, World, !", result1);
 // or the items
 for (String s: list1)
   assertThat(result1, containsString(s));
 // and, all items except that last, need to be followed by ", "
 Iterator&lt;string&gt;  it = list1.iterator();
 while (it.hasNext()) {
   String s = it.next();
   if (it.hasNext())
     assertThat(result1, containsString(s+comma));
 }
}
}&lt;/string&gt;&lt;/pre&gt;
&lt;code&gt;assertEquals()&lt;/code&gt; is quite easy to understand, imported via &lt;code&gt;import static org.junit.Assert.assertEquals&lt;/code&gt;&lt;span style="font-family:Georgia,serif;"&gt;, and compares its two parameters for equality. Usually, a first parameter should be added that contains the message to print, if the two values are not equal.

&lt;h3&gt;Code for collectionToString()&lt;/h3&gt;
Of course, we also need the CollectionUtils class.
&lt;pre&gt;public class CollectionUtils {
// for the moment, we don't do anything
public static String collectionToString(List&amp;lt;?&amp;gt; list, String comma) {
 return null;
}&lt;/pre&gt;That's enough to run a unit test ... with eclipse, you just need to start either the test case class (CollectionUtilsTest above) with "Run as JUnit Test", or -- alternatively -- the whole project, which runs all unit tests in the selected package.
&lt;h3&gt;First test run&lt;/h3&gt;
&lt;pre&gt;java.lang.AssertionError: expected:&amp;lt;Hello, World, !&amp;gt; but was:&amp;lt;null&amp;lt;
...
  at sbr.jut.demo.CollectionUtilsTest.testCollectionToString(CollectionUtilsTest.java:29)
...&lt;/pre&gt;

&lt;h3&gt;Coding collectionToString&lt;/h3&gt;
&lt;pre&gt;public static String collectionToString(Collection&lt;string&gt; coll, String comma) {
StringBuilder sb = new StringBuilder();
String sComma = "";
for (String s: coll) {
  sb.append(sComma);
  sb.append(s);
  sComma = comma;
}
return sb.toString();
}&lt;/string&gt;&lt;/pre&gt;

And, now, the unit test runs through ... until we start some demonic testing ;-)

&lt;h3&gt;Special test cases&lt;/h3&gt;
Of course, null pointers and stuff need to be taken care of, especially ...
&lt;pre&gt;assertEquals("collectionToString(null, null)", "",
CollectionUtils.collectionToString(null, null));
assertEquals("collectionToString(null, null)", "",
CollectionUtils.collectionToString(Collections.EMPTY_LIST, null));
final String result2 = CollectionUtils.collectionToString(list1, "");
assertEquals("HelloWorld!", result2);
final String result3 = CollectionUtils.collectionToString(list1, null);
assertEquals("HelloWorld!", result3);&lt;/pre&gt;

Nice, we start with the first NullPointerException
&lt;pre&gt;java.lang.NullPointerException
  at sbr.jut.demo.CollectionUtils.collectionToString(CollectionUtils.java:18)
  at sbr.jut.demo.CollectionUtilsTest.testCollectionToString(CollectionUtilsTest.java:45)
...&lt;/pre&gt;, start fixing our implementation, until we end with ... no NPE!

&lt;pre&gt;public static String collectionToString(Collection&lt;string&gt; coll, String comma) {
if (coll==null)
  return "";
if (comma==null)
  comma = "";
StringBuilder sb = new StringBuilder();
...
}&lt;/string&gt;&lt;/pre&gt;

So, that is enough for the beginning ...&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/144805460541353359-4436896950661024684?l=tecbites.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tecbites.blogspot.com/feeds/4436896950661024684/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=144805460541353359&amp;postID=4436896950661024684' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/4436896950661024684'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/4436896950661024684'/><link rel='alternate' type='text/html' href='http://tecbites.blogspot.com/2007/10/unit-testing-1-overview.html' title='Unit Testing (1): Overview'/><author><name>Seb</name><uri>http://www.blogger.com/profile/06553111406739261461</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-144805460541353359.post-2649719288747000064</id><published>2007-10-21T10:06:00.000+02:00</published><updated>2007-10-21T10:53:24.188+02:00</updated><title type='text'>Java programming dynamics</title><content type='html'>A very good series of articles about Java reflection (how to access a class' members and methods by name), class loading, and bytecode manipulation can be found at the IBM pages (April '03 - June '04):
&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.ibm.com/developerworks/java/library/j-dyn0429/"&gt;Part 1: Classes and class loading&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.ibm.com/developerworks/java/library/j-dyn0603/"&gt;Part 2: Introducing reflection&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.ibm.com/developerworks/java/library/j-dyn0715.html"&gt;Part 3: Applied reflection&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.ibm.com/developerworks/java/library/j-dyn0916.html"&gt;Part 4: Class transformation with Javassist&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.ibm.com/developerworks/java/library/j-dyn0203.html"&gt;Part 5: Transforming classes on-the-fly&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.ibm.com/developerworks/java/library/j-dyn0302.html"&gt;Part 6: Aspect-oriented changes with Javassist&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.ibm.com/developerworks/java/library/j-dyn0414/"&gt;Part 7: Bytecode engineering with BCEL&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.ibm.com/developerworks/java/library/j-dyn0610/"&gt;Part 8: Replacing reflection with code generation&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;If you want to learn something about the one the reasons that make Java such a powerful languate, read it. These features are, e.g., used by JEE servers or persistence frameworks to automatically determine the methods and fields to be deployed, for accessing the Java 5 @Attributes (not in the articles, yet comparably easy), and to code or derive proxy classes for the deployed services.

Part 1:
&lt;ul&gt;&lt;li&gt;.class file format&lt;/li&gt;&lt;/ul&gt;Part 2:
&lt;ul&gt;&lt;li&gt;Hierarchy of class loaders&lt;/li&gt;&lt;li&gt;fields and methods by reflection&lt;/li&gt;&lt;li&gt;security of reflection, and how to disable it (e.g., to access private members(1))&lt;/li&gt;&lt;li&gt;reflection performance&lt;/li&gt;&lt;/ul&gt;Part 3:
&lt;ul&gt;&lt;li&gt;Using reflection for processing command line arguments
&lt;/li&gt;&lt;/ul&gt;Part 4:
&lt;ul&gt;&lt;li&gt;Inject bytecode into existing methods with javaassist&lt;/li&gt;&lt;li&gt;introduce method timing into compiled code
&lt;/li&gt;&lt;li&gt;Java Aspect Oriented Programming (AOP)&lt;/li&gt;&lt;/ul&gt;Part 5:
&lt;ul&gt;&lt;li&gt;Intercepting class loading&lt;/li&gt;&lt;li&gt;modifying class bytecode on load&lt;/li&gt;&lt;li&gt;introduce method timing into code at load time&lt;/li&gt;&lt;/ul&gt;Part 6:
&lt;ul&gt;&lt;li&gt;Code conversion&lt;/li&gt;&lt;li&gt;class mutilation made easy&lt;/li&gt;&lt;/ul&gt;Part 7:
&lt;ul&gt;&lt;li&gt;The Byte Code Engineering Library (BCEL)
(also have a look at &lt;a href="http://asm.objectweb.org/"&gt;ASM,&lt;/a&gt; also, as this library  tries to correct BCEL's deficits)&lt;/li&gt;&lt;li&gt;using "coding constructs" instead of "bytecode assembler"
&lt;/li&gt;&lt;li&gt;the verifier of BCEL&lt;/li&gt;&lt;li&gt;disassembling with BCEL and its graphical display
&lt;/li&gt;&lt;/ul&gt;Part 8:
&lt;ul&gt;&lt;li&gt;Reflection on performance&lt;/li&gt;&lt;li&gt;building a glue class
&lt;/li&gt;&lt;li&gt;improved performance of code generation vs. reflection
&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic;"&gt;Notes:
(1) I know you shouldn't do this, especially not with human men ...
&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/144805460541353359-2649719288747000064?l=tecbites.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tecbites.blogspot.com/feeds/2649719288747000064/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=144805460541353359&amp;postID=2649719288747000064' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/2649719288747000064'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/2649719288747000064'/><link rel='alternate' type='text/html' href='http://tecbites.blogspot.com/2007/10/java-programming-dynamics.html' title='Java programming dynamics'/><author><name>Seb</name><uri>http://www.blogger.com/profile/06553111406739261461</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-144805460541353359.post-2202809832170826241</id><published>2007-10-16T11:36:00.000+02:00</published><updated>2007-10-25T11:47:05.847+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Auto-Repeat of Server Calls</title><content type='html'>&lt;b&gt;Problem:&lt;/b&gt;
When doing client/server-programming, the client calls a function on the server -- EJB, RMI, Web-Services, etc., in a language such as Java.
Sometimes, the connection to the server gets lost, as the server is restarted, redeployed, network was down and up again, etc.
Then, the client's call to the server fails; after reconnecting, it should be possible to repeat the call and get the wanted result. Possibly, the reconnection will take some time, if the network has a longer "outing".

How can we ensure that the call is done in any case, even if there are transient network/deployment problems?

&lt;b&gt;Solution 1:&lt;/b&gt;
The client's Business Delegate (you have one, haven't you?) calls a "ping()" or another such method before calling the real business method on the server. If the connection is broken, catch the exception, try to reconnect, until such a ping goes through.

&lt;em&gt;Disadvantages:&lt;/em&gt;
&lt;ul&gt;&lt;li&gt;doubles the number of c/s calls&lt;/li&gt;
&lt;li&gt;if the ping succeeds, but the real call fails due to problems &lt;i&gt;in this nano second&lt;/i&gt;, you're out of luck&lt;/li&gt;&lt;/ul&gt;

&lt;b&gt;Solution 2:&lt;/b&gt;
Wrap the call to the server inside a runnable, and repeat the call until it succeeds.
Requires a language like Java, that supports runnable concepts.

Let's see ... some code, untested, out of thin air.

&lt;pre&gt;
 protected IServer mServer;

public ResultObject &lt;b&gt;businessMethod&lt;/b&gt;(final int intParam, final String stringParam)
    throws BusinessException {
 class &lt;b&gt;BusinessMethodRunnable&lt;/b&gt; implements Runnable() {
   private ResultObject result;
   public void &lt;b&gt;run&lt;/b&gt;() {
     &lt;i&gt;// do the server call itself, and store the result.&lt;/i&gt;
     result = mServer.businessMethod(intParam, stringParam);
   }
   public ResultObject &lt;b&gt;getResultObject&lt;/b&gt;() {
     return resultObject;
   }
 }

 BusinessMethodRunnable runnable = new BusinessMethodRunnable();
 &lt;i&gt;// wraps the call, to ensure successful completion&lt;/i&gt;
 callMethod(runnable);
 return runnable.getResultObject();
}

protected void &lt;b&gt;callMethod&lt;/b&gt;(Runnable runnable)
   throws BusinessException {
 &lt;i&gt;// repeat, until the loop is left with return after a successful call&lt;/i&gt;
 while (true) {
   try {
     if (mServer==null)
       &lt;i&gt;// should block until the connection has been established&lt;/i&gt;
       connectToServer();
     &lt;i&gt;// do the real call here.&lt;/i&gt;
     runnable.run();
     return;
   }
   &lt;i&gt;// a business exception needs to be passed to the calling code&lt;/i&gt;
   catch (BusinessException e) {
     throw e;
   }
   &lt;i&gt;// a runtime exception also needs to be passed to the calling code ...&lt;/i&gt;
   catch (RuntimeExceptione ) {
     throw e;
     &lt;i&gt;// alternatively:
     // throw new BusinessException("RuntimeException caught", e);&lt;/i&gt;
   }
   catch (Exception e) {
     logException(e);
     &lt;i&gt;// connection down, no resources to be freed(?)&lt;/i&gt;
     mServer = null;
   }
 }
}
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/144805460541353359-2202809832170826241?l=tecbites.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tecbites.blogspot.com/feeds/2202809832170826241/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=144805460541353359&amp;postID=2202809832170826241' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/2202809832170826241'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/2202809832170826241'/><link rel='alternate' type='text/html' href='http://tecbites.blogspot.com/2007/10/auto-repeat-of-server-calls.html' title='Auto-Repeat of Server Calls'/><author><name>Seb</name><uri>http://www.blogger.com/profile/06553111406739261461</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-144805460541353359.post-5865578258965045016</id><published>2007-10-16T11:25:00.000+02:00</published><updated>2007-10-16T11:36:44.498+02:00</updated><title type='text'>Restoring Word 95 files on Windows 95 after crash</title><content type='html'>Some of us are still using Windows 95.
(Probably none of "us", as I doubt any of those systems is able to surf the net ;-)
Mostly on machines that need it ... as nothing newer runs.
And, of course, for these systems, there is only Word 95 and companions.
Also, these machines still have floppy drives.
Not to forget -- most of the users of these systems are a bit digitally ... challenged.

Now, there is a user who thought saving files on a floppy disk would save them ... in case of a system/harddisk crash. 
Not as a backup, but for working on the file.
Well. 

As saving on a floppy takes some time, it's usually not done that often.
And computers crash.

So, we have an hours old file on a floppy, a rebooted system, and an old version of office that may or may not have auto-recovery files. And if it has those, where are they stored, if not in the working directory? Which is a floppy.

3/4 of an hour telephoning later, the file was found in c:\windows as "Sicherungskopie von ...". Rename it to .doc, and open it ... there it is.
Wait ... first, we need to explain, still via telephone, how to make windows show the extension ... otherwise, you can't change its extension.

Well, I should just send the bill for nearly an hours work ... probably the same as a new old computer for the user ;-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/144805460541353359-5865578258965045016?l=tecbites.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tecbites.blogspot.com/feeds/5865578258965045016/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=144805460541353359&amp;postID=5865578258965045016' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/5865578258965045016'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/5865578258965045016'/><link rel='alternate' type='text/html' href='http://tecbites.blogspot.com/2007/10/restoring-word-95-files-on-windows-95.html' title='Restoring Word 95 files on Windows 95 after crash'/><author><name>Seb</name><uri>http://www.blogger.com/profile/06553111406739261461</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-144805460541353359.post-2040638720296279219</id><published>2007-10-09T09:58:00.003+02:00</published><updated>2008-06-20T14:43:56.734+02:00</updated><title type='text'>Avr32 Studio and .d files</title><content type='html'>Has been some time since I wrote this, so it's high time for publishing it ...!&lt;br&gt;

There seems to be a problem with the Atmel AVR32 studio.
It is based on eclipse, to develop C/C++ software for the embedded AVR32 chips.&lt;br&gt;

The following error message is (often) given, when a project is recompiled:&lt;br&gt;
make -k all&lt;br&gt;
src/main.d:1: *** multiple target patterns.  Stop.&lt;br&gt;
Build complete for project aixC-BoxFirmware&lt;br&gt;

This usually happens when the previous build was not successful, b/c one ore more files could not be compiled.&lt;br&gt;



The reason seems to be the following line in the automatically generated Debug/src/*.d files:&lt;br&gt;
src/main.d src/main.o: ../src/main.cpp ...&lt;br&gt;
It seems, make is not really able to cope with the multiple main.d main.o: statement ...?&lt;br&gt;
The .d files are responsible for checking all file dependencies, i.e., which files need to be recompiled if one header has been changed.&lt;br&gt;

After a clean, which deletes *.d, a full build works.&lt;br&gt;

avr32-linux-gcc is called with the parameters&lt;br&gt;
-MMD -MP -MF"src/main.d" -MT"src/main.d"&lt;br&gt;
which means:&lt;br&gt;
Generated src/main.d (-MF) with the target src/main.d (-MT), for all user include files, and compile the source (-MMD), and generate phony targets for depended files (-MP).&lt;br&gt;
So, theoretically, only&lt;br&gt;
src/main.d: ...&lt;br&gt;
should appear in the src/main.d file ...&lt;br&gt;


Workarounds:&lt;br&gt;
1. Delete all .d files before recompiling&lt;br&gt;
not nice ... looses all dependency information&lt;br&gt;

2. Fix the generated .d files&lt;br&gt;
The following, a bit obscure sed command can be run inside Project/Debug to fix the .d files.&lt;br&gt;
find . -name '*.d'|xargs sed -ie 's#\.d src/[^/]\+/[^ /\.]\+\.o:#.d:#g'&lt;br&gt;
// do I need .d or .o?&lt;br&gt;


The real problem seems to be s.th. else ... the makefile itself (src/subdir.mk) has a rule for building src/main.o from src/main.cpp, and the .d file contains another rule ... strange version of make ...?&lt;br&gt;

The real problem is the inclusion of C:/home/Projekte/Avr32/aix-AVR32-libs/libserial-0.5.2/src/&lt;br&gt;
which gives the other ":" that raises the error ...&lt;br&gt;
1. use a relative path&lt;br&gt;
2. use make 3.80 ...&lt;br&gt;

This error is usually encountered in other situations:&lt;br&gt;
1. a file name contains spaces (windows makes, mostly)&lt;br&gt;
2. a file name contains : (windows again ;-)&lt;br&gt;

http://sunsite.ualberta.ca/Documentation/Gnu/make-3.79/html_chapter/make_16.html&lt;br&gt;
http://sunsite.ualberta.ca/Documentation/Gnu/make-3.79/html_chapter/make_4.html#SEC40&lt;br&gt;

Have fun,&lt;br&gt;
Sebastian&lt;br&gt;


See also&lt;br&gt;
http://www.avrfreaks.net/index.php?name=PNphpBB2&amp;amp;file=viewtopic&amp;amp;p=315323&lt;br&gt;
You've run into one of our known issues:&lt;br&gt;
Bug #5452&lt;br&gt;
Referencing external folders in managed make projects when using GNU make 3.81 causes build failures. This is caused by GNU make no longer supporting Windows-style path names. GNU make 3.80 works as expected.&lt;br&gt;

The known issues are described in the release notes, which are available on atmel.com. They are also included in the AVR32 Studio Help.&lt;br&gt;

Note that the release notes were not available on the website until quite recently, and the links in the Welcome page appear to be buggy, so I'm not blaming you for not reading them. This will be addressed for the 1.0 release.&lt;br&gt;

Run the cygwin setup.exe and try to downgrade Make to 3.80, that should help.&lt;br&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/144805460541353359-2040638720296279219?l=tecbites.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tecbites.blogspot.com/feeds/2040638720296279219/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=144805460541353359&amp;postID=2040638720296279219' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/2040638720296279219'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/2040638720296279219'/><link rel='alternate' type='text/html' href='http://tecbites.blogspot.com/2007/10/avr32-studio-and-d-files.html' title='Avr32 Studio and .d files'/><author><name>Seb</name><uri>http://www.blogger.com/profile/06553111406739261461</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-144805460541353359.post-81345303898482602</id><published>2007-09-01T10:17:00.000+02:00</published><updated>2007-09-17T16:22:34.155+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OpenOffice'/><title type='text'>Exporting hi-resolution images from OpenOffice.org Draw</title><content type='html'>I can't use OpenOffice.org at work, so I try to use it for private stuff, as far as possible. Sometimes, though, I start wondering why ...

In the my current version of OpenOffice Draw (2.0.4, updated to 2.2.1, still the same ), it is impossible to export an image in a different resolution than 96dpi. Unless one uses workarounds like eps+ghostscript, pdf, or a macro.

I loaded an foto from my camera, 2272x1704 (4 MP), added some numbers and lines, and exported it into jpg, png etc. ... and got 1016x762. With different jpeg compression qualities, of course, but no different sizes. &lt;a href="http://readlist.com/lists/openoffice.org/users/5/29094.html"&gt;Joe&lt;/a&gt; pointed me to &lt;a href="http://qa.openoffice.org/issues/show_bug.cgi?id=4499"&gt;the OO QA tracker, issue 4499&lt;/a&gt;; a short summary:

&lt;ul&gt;&lt;li&gt;the problem is known since May 2002
&lt;/li&gt;&lt;li&gt;it was closed due to a misunderstanding of the problem in July 2002
&lt;/li&gt;&lt;li&gt;reopened shortly after (OO 1.0)
&lt;/li&gt;&lt;li&gt;since then, reasons for not fixing it have been given ...
main problem: all filters need to be extended with the same functionality, thus, an extension to all the export dialogs needs to be requested, designed and implemented
&lt;/li&gt;&lt;li&gt;last post, "No promises but I try to do something for 2.3 here"&lt;/li&gt;&lt;/ul&gt;

(I just wonder why the export dialog is part of the filter, and not of the common export handling code.)

Thanks to bryancole and jbarwick, there is one workaround:

Take the following macro code, add it to OpenOffice, and run it ...
It exports the current page (with white borders) or the current selection into a given .jpg file, with manual setting of resolution and quality. 
Maybe someone has a lot of time on his/her hands and wants to write a dialog that does the same?

&lt;code&gt;Sub ExportCurrentPageOrSelection
  REM Filter dependent filter properties
  Dim aFilterData (7) As New com.sun.star.beans.PropertyValue
  Dim sFileUrl As String

' set the width and height you want
  aFilterData(0).Name  = "PixelWidth"
  aFilterData(0).Value = 1704
  aFilterData(1).Name  = "PixelHeight"
  aFilterData(1).Value = 2272
' no real idea what the logical width/height does ... and what units it is in?
' original was 140 and 98.89 ...
  aFilterData(2).Name  ="LogicalWidth"
  aFilterData(2).Value = 1704
  aFilterData(3).Name  ="LogicalHeight"
  aFilterData(3).Value = 2272
' jpeg quality
  aFilterData(4).Name  ="Quality"
  aFilterData(4).Value = 85
  
   aFilterData(5).Name  = "ColorMode"
   aFilterData(5).Value = 0
   
   aFilterData(6).Name  = "ExportMode"
   aFilterData(6).Value = 1
   
' resolution, for use when loading in another image application
   aFilterData(7).Name  = "Resolution"
   aFilterData(7).Value = 600
' the place to put it ... file:///C:/temp/image.jpg should work for Windooze
  sFileUrl = "file:///home/meself/export-1.jpg"

  REM A smart person would force this to be a Draw or Impress document
  xDoc = ThisComponent
  xView = xDoc.currentController
  xSelection = xView.selection
  If isEmpty( xSelection ) Then
    xObj = xView.currentPage
  Else
    xObj = xSelection
  End If
  Export( xObj, sFileUrl, aFilterData() )
End Sub

Sub Export( xObject, sFileUrl As String, aFilterData )
  Dim  xExporter

  xExporter = createUnoService( "com.sun.star.drawing.GraphicExportFilter" )
  xExporter.SetSourceDocument( xObject )

  Dim aArgs (2) As New com.sun.star.beans.PropertyValue
  Dim aURL As New com.sun.star.util.URL

  aURL.complete = sFileUrl
  aArgs(0).Name  = "MediaType"
  aArgs(0).Value = "image/jpeg"
  aArgs(1).Name  = "URL"
  aArgs(1).Value = aURL
  aArgs(2).Name  = "FilterData"
  aArgs(2).Value = aFilterData
  xExporter.filter( aArgs() )
End Sub&lt;/code&gt;

Note:
OpenOffice.org 2.3.0 is out now (Sept 17th, 2007), yet this problem is unchanged.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/144805460541353359-81345303898482602?l=tecbites.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tecbites.blogspot.com/feeds/81345303898482602/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=144805460541353359&amp;postID=81345303898482602' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/81345303898482602'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/81345303898482602'/><link rel='alternate' type='text/html' href='http://tecbites.blogspot.com/2007/09/exporting-hi-resolution-images-from.html' title='Exporting hi-resolution images from OpenOffice.org Draw'/><author><name>Seb</name><uri>http://www.blogger.com/profile/06553111406739261461</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-144805460541353359.post-1573137366780406875</id><published>2007-08-30T11:26:00.001+02:00</published><updated>2007-08-30T17:20:36.302+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C++'/><title type='text'>C++ String-Utils</title><content type='html'>Ever had the problem of wanting to use (s)printf to format a string into an STL/StdC++ std::string instance? 
The only thing STL says is, "use strstream", which I don't agree with ... (s)printf is easier to use once you get used to the %s stuff, and often cleaner to read.

Thus, I wrote my own method ... maybe I just used to much String.format() in Java ;-)

&lt;h3&gt;StringUtils.hh&lt;/h3&gt;
&lt;pre&gt;
#ifndef STRINGUTILS_HH_
#define STRINGUTILS_HH_

#include &amp;lt;string&amp;gt;


std::string formatString(const char* format, ...); 

#endif /*STRINGUTILS_HH_*/
&lt;/pre&gt;

&lt;h3&gt;StringUtils.cc&lt;/h3&gt;
&lt;pre&gt;
#include "StringUtils.hh"
#include "BufferUtils.hh"

#include &amp;lt;stdarg.h&amp;gt;
using std::string;

/**
 No need to be afraid about memory leaks, segfaults 
   or buffer overflows (hopefully)
 - the 2kB buffer is freed on return (destructor)
 - the std::string is instantiated &lt;it&gt;before&lt;/it&gt; the 
   buffer is freed, and returned on the stack
 - vsnprintf checks the buffer length, and the last char 
   is ensured to be a '\0'
*/
std::string formatString(const char* format, ...) {
 Buffer buffer(2048);
 va_list vl;
 va_start(vl, format);
 vsnprintf(buffer, buffer.bufferSize(), format, vl);
 buffer[buffer.bufferSize()-1] =0;
 return string(buffer);
}
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/144805460541353359-1573137366780406875?l=tecbites.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tecbites.blogspot.com/feeds/1573137366780406875/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=144805460541353359&amp;postID=1573137366780406875' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/1573137366780406875'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/1573137366780406875'/><link rel='alternate' type='text/html' href='http://tecbites.blogspot.com/2007/08/c-string-utils.html' title='C++ String-Utils'/><author><name>Seb</name><uri>http://www.blogger.com/profile/06553111406739261461</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-144805460541353359.post-1037349270573046470</id><published>2007-08-30T11:23:00.000+02:00</published><updated>2007-08-30T17:15:23.369+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C++'/><title type='text'>C++ Buffer-Utils</title><content type='html'>A common C++ problem: allocate some memory block, use it inside a function, and make sure the memory block is freed when exiting the function, even if an early return statement, an exception (or a segfault) or s.th. happens.

Best way: Create a class, allocate the memory block in the constructor and free it automatically in the destructor. Instantiate the class locally (i.e., on the stack), problem solved. 
Some conversion operators to get the mem block as char*, void* etc needed ... 

Additionally, a small method to nullify a pointer after free'ing the allocated memory with free(). Of course, when using C++, the clean way would be to use new char[] and delete[] ... yet I don't like these ones when I work with an unspecified memory block.

&lt;h3&gt;BufferUtils.hh&lt;/h3&gt;
&lt;pre&gt;
#ifndef BUFFERUTILS_HH_
#define BUFFERUTILS_HH_

#include &amp;lt;cstdlib&amp;gt;

void freeAndNull(void* &amp;amp;pBuffer);

class Buffer {
private:
 int miBufferSize;
 void* mpBuffer;
 
public:
 Buffer(int bufferSize) 
  : miBufferSize(bufferSize), mpBuffer(malloc(bufferSize)) { 
  // empty
 };
 
 ~Buffer() {
  freeAndNull(mpBuffer);
 }
 
 int bufferSize() { 
  return miBufferSize;
 }
 
 operator char*() {
  return (char*)mpBuffer;
 }

 operator void*() {
  return mpBuffer;
 }
};

#endif /*BUFFERUTILS_HH_*/
&lt;/pre&gt;

&lt;h3&gt;BufferUtils.cc&lt;/h3&gt;
&lt;pre&gt;
#include "BufferUtils.hh"

void freeAndNull(void* &amp;amp;pBuffer) {
 if (pBuffer)
  free(pBuffer);
 pBuffer = NULL;
}
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/144805460541353359-1037349270573046470?l=tecbites.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tecbites.blogspot.com/feeds/1037349270573046470/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=144805460541353359&amp;postID=1037349270573046470' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/1037349270573046470'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/1037349270573046470'/><link rel='alternate' type='text/html' href='http://tecbites.blogspot.com/2007/08/c-buffer-utils.html' title='C++ Buffer-Utils'/><author><name>Seb</name><uri>http://www.blogger.com/profile/06553111406739261461</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-144805460541353359.post-5664308995167821839</id><published>2007-08-30T10:58:00.000+02:00</published><updated>2007-08-30T11:19:20.137+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='gpg'/><title type='text'>GPG and IDEA</title><content type='html'>There are several posts and publications out there on the net about why not to use IDEA with gpg, and how to install the idea.dll plugin if you do it anyway.
Yet we did not finde any information about what to do if a certain private/public key pair wants to use IDEA only, possibly, because it was created with pgp2 compatibility.

Yet there are some easy steps to change the preferred ciphers of a key, and thus to avoid IDEA when using the key for encryption (especially encrypting to self and thus for all gpg mails that the person sends).

&lt;pre&gt;gpg --edit-key 0x12345678
pub  1024D/######## created: 2007-02-03  expires: never     usage: SC
                     trust: unknown      validity: unknown
sub  2048g/########  created: 2007-02-03 expires: never     usage: E
[ unknown] (1). user &amp;lt;mail&amp;gt;

Command&gt; showpref
[ unknown] (1). user &amp;lt;mail&amp;gt;
     Cipher: [1], CAST5, AES256, AES192, AES, 3DES, TWOFISH
     Digest: SHA1
     Compression: ZIP, Uncompressed
     Features: MDC, Keyserver no-modify&lt;/pre&gt;
the [1] stands for IDEA as the (first) preferred cipher, though it is not a known one in the current gpg installation ... otherwise, IDEA should stand there.

So, just set the prefs ... unfortunately, all of them have to be set in one command as a string ...
&lt;pre&gt;Command&gt; setpref AES256 AES192 AES CAST5 3DES SHA1 SHA256 RIPEMD160 ZLIB
BZIP2 ZIP Uncompressed MDC&lt;/pre&gt;
You can do this only with your own key, of course, and need to enter your passphrase (1). Test it, and publish the key anew to the usual key servers.
As the preferences are set per user id, and one key may contain a bunch of them, you might have to set the prefs for all user ids seperately ... I didn't try yet.

if anything breaks, use setpref w/o any parameters to reset to default values.
&lt;pre&gt;Command&gt; setpref&lt;/pre&gt;

Maybe this helps you as well, if no one else can decrypt the mails you wrote with thunderbird, enigmail and gpgp ...

(1) If you are running on windows and use German Umlauts or other diacritical characters, don't be surprised if your passphrase is not accepted in a shell, while enigmail or some other GUI accepts it ... windows cmd.exe has a different character set/code page than the windows system usually uses!

&lt;h3&gt;Graphical user interfaces for GPG&lt;/h3&gt;
BTW, some nice gpg software for windows (linux/unix has gpa, anyway).
&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.jumaros.de/rsoft/index.html"&gt;GPGShell (currently: 3.63)&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.gpg4win.org/"&gt;GPG4Win; also contains gpg2 for windows&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/144805460541353359-5664308995167821839?l=tecbites.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tecbites.blogspot.com/feeds/5664308995167821839/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=144805460541353359&amp;postID=5664308995167821839' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/5664308995167821839'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/5664308995167821839'/><link rel='alternate' type='text/html' href='http://tecbites.blogspot.com/2007/08/gpg-and-idea.html' title='GPG and IDEA'/><author><name>Seb</name><uri>http://www.blogger.com/profile/06553111406739261461</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-144805460541353359.post-9126611348563760876</id><published>2007-08-30T10:26:00.000+02:00</published><updated>2007-08-30T11:16:34.110+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hardware'/><title type='text'>A stone age NVidia card and a modern TFT</title><content type='html'>After some years, I decided to replace my 17'' CRT with a modern 19/20'' TFT.
First, had some looks on the internet for good choices, and some in a computer store. Left me with about 4 different Samsung models to choose from.
Luckily, I went to the computer store of my confidence ...
The guy asked me about my graphics card, s.th. I had not thought about.
GeForce 2 MX 200/ELSA Gladiac 311 (32MB, AGP, several years old).
"Oh, I'd recommend one of the 16:10 widescreen ones for what you do, yet, your graphics card won't do it ... 1280x1024, the default modes from that time, up to 2048x1536, but no 1400x1050 nor 1680x1050 ...
Maybe you should just get a new computer ;-)"

Well, I had a check at home ... officially, neither mode is supported (1400x1050 aka SXGA+, 1680x1050 aka WSXGA+), some sites say at least SXGA+ is supported (mainly ebay sellers ...), manuals are not really available as ELSA busted twice since.

So I just decided to try it out.

&lt;h3&gt;Setting resolution in Xorg&lt;/h3&gt;
Linux, opensuse 10.2, yast2, sax2:
Just set 1400x1050 and it worked. My eyes started running, was hard to read anything, yet it worked. Had to adjust the size and position, of course.
Set 1680x1050 and it seemed to work ... yet the Xorg log told me it was using 1600x1024 or s.th. instead. One can't have everything.

&lt;h3&gt;Rotating the screen&lt;/h3&gt;
Next question ... if I get a pivotable TFT, can I do this in Linux?
No problem ... 
&lt;a href="http://42.fht-esslingen.de/pipermail/luges/2005-November.txt"&gt;Alexander Koenig&lt;/a&gt; "told" me
&lt;pre&gt;
Section "ServerFlags"
...
  Option "RandR" "on"
EndSection

Section "Device"
....
  Option "RandRRotation" "on"
  Option "RenderAccel" "On"
EndSection
&lt;/pre&gt;
and
&lt;pre&gt;xrandr -o [left|normal|right]&lt;/pre&gt;
It just worked.

&lt;h3&gt;Setting resolution in windows&lt;/h3&gt;
Every few weeks or months, I need to boot into my windows system ... there are just a few things which don't really work on wine or vmware player.
Found a nice tool &lt;a href="http://www.entechtaiwan.com/util/ps.shtm"&gt;EnTech Taiwan PowerStrip&lt;/a&gt; that should be able to set manual timings ... didn't need it, though, as the NVidia detonator control centre(1) already has an item "manual timings".
Set it to 1400x1050, and got a virtual screen of 1400x1050, and a physical of ... no idea, a bit less.
Tried again with 84Hz instead of 85Hz ... and it just works. Seems nvidia tries to use one of the existing modes if the image(?) frequency is already known ...
Did the same with 60Hz, and with 1600x1050 ... same results, 84, 80, 60 Hz no problem, 85Hz - virtual screen as wanted, physical smaller. 

Seems I can buy the &lt;a href="http://monitor.samsung.de/article.asp?artid=659F2C8B-0F4F-4A54-9BEC-35CAE1EE7F79&amp;show=specs"&gt;Samsung 203B (2)&lt;/a&gt; after all ;-)

(1) center ;-)
(2) Sorry, German page&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/144805460541353359-9126611348563760876?l=tecbites.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tecbites.blogspot.com/feeds/9126611348563760876/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=144805460541353359&amp;postID=9126611348563760876' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/9126611348563760876'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/9126611348563760876'/><link rel='alternate' type='text/html' href='http://tecbites.blogspot.com/2007/08/stone-age-nvidia-card-and-modern-tft.html' title='A stone age NVidia card and a modern TFT'/><author><name>Seb</name><uri>http://www.blogger.com/profile/06553111406739261461</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-144805460541353359.post-7583378874652100605</id><published>2007-08-16T08:27:00.000+02:00</published><updated>2007-08-16T08:34:11.684+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C++'/><title type='text'>C++ typesafe casting</title><content type='html'>Often, C++ classes are just casted to what is needed by 
&lt;pre&gt;Subclass* sc = (Subclass)p;&lt;/pre&gt;
This can lead to unexpected program behaviour, as no error is thrown in the case the p is not an instance of Subclass*; only a bit later, the programm will surely crash.

Thus, the clean way is
&lt;pre&gt;Subclass* sc = dynamic_cast&amp;lt;SubClass*&amp;gt;(p);&lt;/pre&gt;
of course, this requires run time type information; they should be available, if libstdc++ is available, too.

This can also be used to determine the runtime type of a (class) pointer:
&lt;pre&gt;if (dynamic_cast&amp;lt;SubClass*&amp;gt;(p)) { ... }&lt;/pre&gt;

Unfortunately, the C++ standard does not(?) provide any method to find out about class hierarchies ...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/144805460541353359-7583378874652100605?l=tecbites.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tecbites.blogspot.com/feeds/7583378874652100605/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=144805460541353359&amp;postID=7583378874652100605' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/7583378874652100605'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/7583378874652100605'/><link rel='alternate' type='text/html' href='http://tecbites.blogspot.com/2007/08/c-typesafe-casting.html' title='C++ typesafe casting'/><author><name>Seb</name><uri>http://www.blogger.com/profile/06553111406739261461</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-144805460541353359.post-2032544879500684494</id><published>2007-08-16T08:08:00.000+02:00</published><updated>2007-08-16T08:18:26.112+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Call-by-reference in Java; StringBuilder</title><content type='html'>Objects are always passed by reference to Java functions.
Thus, any change to the objects are reflected after function return. Of course, changes to the object referencs (the variables themselves) are lost on return.
This does not apply to primitives (int, boolean, float).

Also, several classes, String, Integer, Double, Boolean, are &lt;span style="font-style:italic;"&gt;immutables&lt;/span&gt;; thus, it is impossible to change them after construction. Thus, they cannot be used for call-by-reference (demonstration).

StringBuffer, on the other hand, can nicely demonstrate this:&lt;pre&gt;
static void changeStringBuffer(StringBuffer sb) {
  sb.append(" and some more");
}
public static void main(String[] args) {
  StringBuffer sb("A text");
  changeStringBuffer(sb);
  // this one gives "A text and some more"
  System.out.println(sb.toString());
}
&lt;/pre&gt; In place of StringBuffer, often the simpler an not-thread-safe class StringBuilder can be used. 

Swapping, though, does not work:&lt;pre&gt;
public static void swap(StringBuffer a, StringBuffer b) {
  StringBuffer c = a;
  a = b;
  b = c;
}
&lt;/pre&gt; does not really do anything.

BTW ... when concatenating Strings, it is better to use StringBuilder and .append, as  &lt;pre&gt;
String s;
for (.;.;.) s += something; 
&lt;/pre&gt; is pretty inefficient; for each +=, the String's content needs to be copied into a new instance that has a bit more space at the end for "something". Results in O(n^2) "efficiency", while StringBuilder only needs to get more memory when an internal limit is reached.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/144805460541353359-2032544879500684494?l=tecbites.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tecbites.blogspot.com/feeds/2032544879500684494/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=144805460541353359&amp;postID=2032544879500684494' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/2032544879500684494'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/2032544879500684494'/><link rel='alternate' type='text/html' href='http://tecbites.blogspot.com/2007/08/call-by-reference-in-java-stringbuilder.html' title='Call-by-reference in Java; StringBuilder'/><author><name>Seb</name><uri>http://www.blogger.com/profile/06553111406739261461</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-144805460541353359.post-1934173950832098481</id><published>2007-08-16T08:01:00.000+02:00</published><updated>2007-08-16T08:44:13.645+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C++'/><title type='text'>C++Threading</title><content type='html'>&lt;a href="http://www.openscenegraph.com/svn/osg/OpenThreads/trunk/README.txt"&gt;OpenThreads&lt;/a&gt; as part of OpenSceneGraph contains a number of nice classes for working with threads in C++, using a Posix implemention (*n*x), or the Win32 or Solaris specific one.
It is also possible to compile just the three classes that the threading stuff is comprised of, combine it with the appropriate headers, and use it.

One thing is missing, though ... an implementation of the "resource acqusition by constructing" pattern. As C++ does not have a "finally" construct, the best solution to ensure a used mutex is freed in all circumstances (earlier return, exceptions, SEGV, ...) is to create a class that locks the mutex on construction and frees it on destruction, and to instantiate this class when needing the mutex (on the stack, of course, &lt;span style="font-weight:bold;"&gt;not&lt;/span&gt; with new).

&lt;pre&gt;
class  LockIt {
public:
  LockIt(Mutex&amp; mutex) : mMutex(mutex) { mMutex.lock(); }
  virtual ~LockIt() { mMutex.unlock(); }
private:
  Mutex&amp; mMutex;
};
&lt;/pre&gt;
A Mutex called mMutex is defined somewhere; then, you can use it
&lt;pre&gt;
{
LockIt(mMutex);
// work locked
}
// lock on mMutex automatically released
&lt;/pre&gt;

The thread helpers that are part of the &lt;a href="http://www.boost.org/"&gt;boost&lt;/a&gt; class library are far more powerful in this direction, they also contain various lock acquisition classes. Boost will also be part of the next release of the C++ standard ... on the other hand, it is really large (a thousand header files, if I counted right), and not that easy to use ...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/144805460541353359-1934173950832098481?l=tecbites.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tecbites.blogspot.com/feeds/1934173950832098481/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=144805460541353359&amp;postID=1934173950832098481' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/1934173950832098481'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/1934173950832098481'/><link rel='alternate' type='text/html' href='http://tecbites.blogspot.com/2007/08/cthreading.html' title='C++Threading'/><author><name>Seb</name><uri>http://www.blogger.com/profile/06553111406739261461</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-144805460541353359.post-5354191356738728341</id><published>2007-08-16T07:44:00.000+02:00</published><updated>2007-08-16T08:38:27.659+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C++'/><title type='text'>C++-Documentation: Links</title><content type='html'>&lt;h1&gt;Interesting documentation links about C++
&lt;/h1&gt;&lt;h2&gt;Tutorials
&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://tutorial.schornboeck.net/inhalt.htm"&gt;Schornboeck&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.research.att.com/~bs/bs_faq2.html"&gt;Bjarne Stroustrup's C++ Style and Technique FAQ&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.research.att.com/~bs/papers.html"&gt;Stroustrup's books (1)&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.research.att.com/~bs/3rd.html"&gt;Stroustrup's books (2)&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cpp-tutor.de/cpp/index.html"&gt;C++-Kurs (de)&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.pronix.de/pronix-6.html"&gt;Linux-Unix-Programmierung (de)&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.pronix.de/pronix-4.html"&gt;C von A bis Z (de)&lt;/a&gt;
&lt;/li&gt;&lt;/ul&gt;

&lt;h2&gt;LibStdC++
&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/"&gt;Latest Doxygen source code reference&lt;/a&gt;
&lt;/li&gt;&lt;/ul&gt;
&lt;h2&gt;Threading
&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.openscenegraph.com/svn/osg/OpenThreads/trunk/README.txt"&gt;OpenThreads, part of OpenSceneGraph&lt;/a&gt;
&lt;/li&gt;&lt;/ul&gt;

&lt;h2&gt;Resource allocation
&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.research.att.com/~bs/bs_faq2.html#finally"&gt;no finally in C++&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.research.att.com/~bs/bs_faq2.html#auto_ptr"&gt;auto_ptr in LibStdC++&lt;/a&gt;
&lt;/li&gt;&lt;/ul&gt;

&lt;h2&gt;Humor
&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.fullduplex.org/humor/2006/10/how-to-shoot-yourself-in-the-foot-in-any-programming-language/"&gt;Shoot yourself in the foot (1)&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a href="http://m5p.com/~pravn/foot.html"&gt;Shoot yourself in the foot (2)&lt;/a&gt;
&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/144805460541353359-5354191356738728341?l=tecbites.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tecbites.blogspot.com/feeds/5354191356738728341/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=144805460541353359&amp;postID=5354191356738728341' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/5354191356738728341'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/5354191356738728341'/><link rel='alternate' type='text/html' href='http://tecbites.blogspot.com/2007/08/c-documentation-links.html' title='C++-Documentation: Links'/><author><name>Seb</name><uri>http://www.blogger.com/profile/06553111406739261461</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-144805460541353359.post-1744658948257133566</id><published>2007-08-16T07:23:00.000+02:00</published><updated>2007-08-16T07:34:19.030+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='C++'/><title type='text'>java.util.ArrayList != std::list</title><content type='html'>When using "lists" in Java, ArrayList is usally the choice.
When using list contructs in C++, using std::list is usually not a good idea, as it is implemented as linked list, and therefore all indexed acesses (list[i]) take linear time, and an iteration such as
&lt;pre&gt;for (int i=0; i&amp;lt;list.size(); i++) {...}&lt;/pre&gt;
takes O(n^2)!
(Of course, one should not do this in StdC++/STL anyway, but use the iterators.)

Thus, std::vector should be used in most cases.
Only exception: regularly adding elements somewhere &lt;span style="font-style: italic;"&gt;inside &lt;/span&gt;the list, which is far more efficient in a (doubly) linked list.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/144805460541353359-1744658948257133566?l=tecbites.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tecbites.blogspot.com/feeds/1744658948257133566/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=144805460541353359&amp;postID=1744658948257133566' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/1744658948257133566'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/1744658948257133566'/><link rel='alternate' type='text/html' href='http://tecbites.blogspot.com/2007/08/javautilarraylist-stdlist.html' title='java.util.ArrayList != std::list'/><author><name>Seb</name><uri>http://www.blogger.com/profile/06553111406739261461</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-144805460541353359.post-1689839061910107326</id><published>2006-10-04T11:13:00.001+02:00</published><updated>2006-10-04T11:13:45.460+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Eclipse'/><title type='text'>Eclipse quick-fixes and such</title><content type='html'>There are many refactoring and fixing tools in the eclipse environment. It really helps to have a look at them once, and find out when and how to best use them.

&lt;b&gt;The most important:&lt;/b&gt;
&lt;i&gt;Strg+1&lt;/i&gt; Quickfix - shows a list of solutions when a warning (yellow line) or an error (red line) is selected.
This also works when no error/warning is shown, but &lt;i&gt;experience-based process support&lt;/i&gt; shows that, in most cases, the developer wants a certain task.

Also: Press Strg+Space to complete any "name" - variables, functions, types, imports etc. Often, this also has some nice side effects - such as automatically importing a class when the name is completed this way.

Others functions that should be looked at:
(C-Control, S-Shift, A-Alt: CS+T -&gt; "Ctrl+Shift T")

&lt;table class="wikitable"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="wikicell"&gt;&lt;b&gt;Quick fix&lt;/b&gt; &lt;/td&gt;&lt;td class="wikicell"&gt;C+1&lt;/td&gt;&lt;td class="wikicell"&gt;some of the possibilities offered &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="wikicell" colspan="3"&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="wikicell" colspan="3"&gt;&lt;i&gt;varname = value;&lt;/i&gt; // where "varname" does exist &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="wikicell"&gt;Create field "varname"&lt;/td&gt;&lt;td class="wikicell" colspan="2"&gt;create varname as a field of the current class &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="wikicell"&gt;Create local variable "varname"&lt;/td&gt;&lt;td class="wikicell" colspan="2"&gt;create varname as a local variable &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="wikicell" colspan="3"&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="wikicell" colspan="3"&gt;''varname.methodname(param); // where methodname does not exist &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="wikicell"&gt;Create Method "methodname" (in ...)&lt;/td&gt;&lt;td class="wikicell" colspan="2"&gt;create a method with the name and parameters in the appropriate class &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="wikicell"&gt;Add Parameter in methodname (and others)&lt;/td&gt;&lt;td class="wikicell" colspan="2"&gt;Adjust the the formal parameters of methodname to conform to the given actual parameters. Includes removing, adding parameters, or creating a new method with the given ones. &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="wikicell" colspan="3"&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="wikicell" colspan="3"&gt;Class errors: &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="wikicell"&gt;Organize imports&lt;/td&gt;&lt;td class="wikicell"&gt;CS+O&lt;/td&gt;&lt;td class="wikicell"&gt;remove unused or erroneous imports &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="wikicell"&gt;Implement missing methods&lt;/td&gt;&lt;td class="wikicell" colspan="2"&gt;when a class does not yet implement methods required by an interface or an abstract base class &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="wikicell" colspan="3"&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="wikicell" colspan="3"&gt;new String("Hallo"); // no variable assignment &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="wikicell"&gt;Assign statement to new local variable&lt;/td&gt;&lt;td class="wikicell" colspan="2"&gt;create a new variable (usually called "string") and assign the new object. &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="wikicell"&gt;Assign statement to new field&lt;/td&gt;&lt;td class="wikicell" colspan="2"&gt;create a new field (usually called "string")&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;

&lt;table class="wikitable"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="wikicell"&gt;&lt;b&gt;Refactoring&lt;/b&gt; &lt;/td&gt;&lt;td class="wikicell"&gt;AS+T&lt;/td&gt;&lt;td class="wikicell"&gt;Change various "bad smells" in Software &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="wikicell"&gt;Rename&lt;/td&gt;&lt;td class="wikicell"&gt;AS+R&lt;/td&gt;&lt;td class="wikicell"&gt;rename a variable, class, method across all usages; also for package names &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="wikicell"&gt;Move&lt;/td&gt;&lt;td class="wikicell"&gt;AS+V&lt;/td&gt;&lt;td class="wikicell"&gt;move a method from one class to another, adjusting the calls (esp. for moving into member field classes, and for static methods). A delegate can be left. &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="wikicell"&gt;Extract Method&lt;/td&gt;&lt;td class="wikicell"&gt;AS+M&lt;/td&gt;&lt;td class="wikicell"&gt;make a method of the currently selected code fragment. Parameters and possibly return value are automatically determined; often other places of the same code fragment are also replaced. &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="wikicell"&gt;Extract Local Variable&lt;/td&gt;&lt;td class="wikicell"&gt;AS+L&lt;/td&gt;&lt;td class="wikicell"&gt;extract a local variable from the currently selected expression. Other uses of the expression in the same context are also replaced. &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="wikicell"&gt;Inline Variable&lt;/td&gt;&lt;td class="wikicell"&gt;AS+I&lt;/td&gt;&lt;td class="wikicell"&gt;The contrary to Extract local variable. The uses of a variable are inlined. &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="wikicell"&gt;Extract Constant&lt;/td&gt;&lt;td class="wikicell" colspan="2"&gt;Extracts a constant (final static) from the currently selected value, usually a "String" &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="wikicell"&gt;Introduce Parameter&lt;/td&gt;&lt;td class="wikicell" colspan="2"&gt;Introduces another parameter the current method, and all calls of it. &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;

&lt;table class="wikitable"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="wikicell"&gt;&lt;b&gt;Source&lt;/b&gt; &lt;/td&gt;&lt;td class="wikicell"&gt;AS+S&lt;/td&gt;&lt;td class="wikicell"&gt;Source helpers &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="wikicell"&gt;Toggle Comment&lt;/td&gt;&lt;td class="wikicell"&gt;CS+7&lt;/td&gt;&lt;td class="wikicell"&gt;Comment (out) the current lines &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="wikicell"&gt;Override/Implement Methods&lt;/td&gt;&lt;td class="wikicell" colspan="2"&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="wikicell"&gt;Generate Getters and Setters&lt;/td&gt;&lt;td class="wikicell" colspan="2"&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="wikicell"&gt;Generate Constructor using Fields&lt;/td&gt;&lt;td class="wikicell" colspan="2"&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="wikicell"&gt;Generate Constructors from Superclass&lt;/td&gt;&lt;td class="wikicell" colspan="2"&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;

&lt;table class="wikitable"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="wikicell"&gt;&lt;b&gt;Surround with&lt;/b&gt;&lt;/td&gt;&lt;td class="wikicell"&gt;CS+Z&lt;/td&gt;&lt;td class="wikicell"&gt;from 3.2rc6(?) onwards, was part of "Source" before &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="wikicell"&gt;Surround with try/catch&lt;/td&gt;&lt;td class="wikicell" colspan="2"&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
 &lt;hr /&gt;  &lt;small&gt; &lt;a class="link" href="https://grosz.informatik.rwth-aachen.de:8443/tikiwiki/tiki-view_blog_post.php?blogId=9&amp;amp;postId=41"&gt;P&lt;/a&gt;&lt;/small&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/144805460541353359-1689839061910107326?l=tecbites.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tecbites.blogspot.com/feeds/1689839061910107326/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=144805460541353359&amp;postID=1689839061910107326' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/1689839061910107326'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/1689839061910107326'/><link rel='alternate' type='text/html' href='http://tecbites.blogspot.com/2006/10/eclipse-quick-fixes-and-such.html' title='Eclipse quick-fixes and such'/><author><name>Seb</name><uri>http://www.blogger.com/profile/06553111406739261461</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-144805460541353359.post-5364741381873234688</id><published>2006-10-04T11:12:00.000+02:00</published><updated>2006-10-04T11:13:07.893+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Invalid class exception</title><content type='html'>The following exception sometimes appears when working with serialization, especially in the case of EJB remote access (where Serializable classes, including Exceptions, are passed from server to client):

&lt;div dir="ltr"&gt;&lt;pre class="codelisting"&gt;java.io.InvalidClassException: org.firebirdsql.jdbc.FBSQLException;
local class incompatible:
stream classdesc serialVersionUID = 3969094886006956637,
local class serialVersionUID = -3559440527871139169
&lt;/pre&gt;&lt;/div&gt;

This is always a warning that the library versions of this class differ between server and client.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/144805460541353359-5364741381873234688?l=tecbites.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tecbites.blogspot.com/feeds/5364741381873234688/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=144805460541353359&amp;postID=5364741381873234688' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/5364741381873234688'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/5364741381873234688'/><link rel='alternate' type='text/html' href='http://tecbites.blogspot.com/2006/10/invalid-class-exception.html' title='Invalid class exception'/><author><name>Seb</name><uri>http://www.blogger.com/profile/06553111406739261461</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-144805460541353359.post-4507024388047679571</id><published>2006-10-04T11:11:00.001+02:00</published><updated>2006-10-04T11:11:42.180+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Get the messages and/or the stack trace of an exception</title><content type='html'>While
&lt;tt&gt; e.printStackTrace();&lt;/tt&gt;
always writes onto stderr, there are also ways to get the full message of an exception, including all nested exceptions.

&lt;div dir="ltr"&gt;&lt;pre class="codelisting"&gt;public static String getExceptionMessage(Throwable e) {
Throwable cause = e;
String sRet="";
do {
 sRet += "["+cause.getClass().getName() +"] ";
 sRet += cause.getMessage()+"\n";
 cause = cause.getCause();
} while (cause!=null);
return sRet;
}
&lt;/pre&gt;&lt;/div&gt;

to get the stack trace is even easier:
&lt;div dir="ltr"&gt;&lt;pre class="codelisting"&gt;public static String getExceptionStackTrace(Throwable e) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(out);
e.printStackTrace(ps);
ps.flush();
return out.toString();
}
&lt;/pre&gt;&lt;/div&gt;

In some cases, it is necessary to treat certain exceptions specially.
For example, the SQL exception that is raised in case of batch errors contains a special list for the various batch errors. The only way to get these errors is to check the type (of the nested exception), make an explicit cast, and list the batch errors manually.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/144805460541353359-4507024388047679571?l=tecbites.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tecbites.blogspot.com/feeds/4507024388047679571/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=144805460541353359&amp;postID=4507024388047679571' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/4507024388047679571'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/4507024388047679571'/><link rel='alternate' type='text/html' href='http://tecbites.blogspot.com/2006/10/get-messages-andor-stack-trace-of.html' title='Get the messages and/or the stack trace of an exception'/><author><name>Seb</name><uri>http://www.blogger.com/profile/06553111406739261461</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-144805460541353359.post-7757819053517490581</id><published>2006-10-04T11:10:00.000+02:00</published><updated>2006-10-04T11:11:00.663+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Use Beans for data encapsulation</title><content type='html'>&lt;h3&gt; Use Beans for data encapsulation&lt;/h3&gt;
Often, more than one value needs to be returned from a method. This might be especially the case with lists/collections, where each item is a tuple of various values.

Solution:
Use a simple java bean (that has nothing to do with Enterprise Java Beans, EJB) to encapsulate the values. A nested public static class can be used well for this.

A bean is defined by Sun as a class that
&lt;ul&gt;&lt;li&gt; has a default constructor (no parameters), and &lt;b&gt;either&lt;/b&gt; &lt;/li&gt;&lt;li&gt; has only public fields, &lt;b&gt;or&lt;/b&gt; &lt;/li&gt;&lt;li&gt; public getXXX and setXXX methods for all private/protected fields XXX. &lt;/li&gt;&lt;/ul&gt;
By the naming convention, a "bean property" &lt;i&gt;value&lt;/i&gt; can be either published as
&lt;tt&gt; public String value;&lt;/tt&gt;
or
&lt;tt&gt; public String getValue() {...}&lt;/tt&gt;
&lt;tt&gt; public String setValue(String value) {...}&lt;/tt&gt;

E.g., in the OPC database access, each data item contains a timestamp and a float value. In this case, setXXX methods are not necessary as the constructor does this work.

&lt;div dir="ltr"&gt;&lt;pre class="codelisting"&gt;public class OpcDataConnection ...
public static class DataItem {
  private Date mDate;
  private float fValue;
  public Date getDate { return mDate; }
  public float getValue { return fValue; }
}
...
}
&lt;/pre&gt;&lt;/div&gt;

The same Beans are also used in many other cases in Java, e.g.
&lt;ul&gt;&lt;li&gt; in jsp pages, such a bean can be directly accessed as property value dataItem.value, dataItem.date &lt;/li&gt;&lt;li&gt; such beans can be serialized and stored in an XMLEncoder &lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/144805460541353359-7757819053517490581?l=tecbites.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tecbites.blogspot.com/feeds/7757819053517490581/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=144805460541353359&amp;postID=7757819053517490581' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/7757819053517490581'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/7757819053517490581'/><link rel='alternate' type='text/html' href='http://tecbites.blogspot.com/2006/10/use-beans-for-data-encapsulation.html' title='Use Beans for data encapsulation'/><author><name>Seb</name><uri>http://www.blogger.com/profile/06553111406739261461</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-144805460541353359.post-2521683011690577602</id><published>2006-10-04T11:09:00.000+02:00</published><updated>2007-08-16T07:38:08.948+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Log4j: Tipps and Tricks</title><content type='html'>&lt;h3&gt; Rolling log files w/o overwriting&lt;/h3&gt;
When using the normal file appender, the log files grows indeterminately.
When using the rolling file appender, the existing log file (of the current day)
is overwritten on application restart.

It should be possible to
&lt;ul&gt;&lt;li&gt; use a file for each day the app is running &lt;/li&gt;&lt;li&gt; either append to the day's file, create a new file, or rename the day's file &lt;/li&gt;&lt;/ul&gt; before overwriting if the app is restarted.

&lt;a name="_Don_t_overwrite_rolling_file_on_startup"&gt;&lt;/a&gt;&lt;h4&gt; Don't overwrite rolling file on startup&lt;/h4&gt;
JBoss rolling file appender uses Append=false - this can be sensibly changed to not overwrite existing log files on startup

&lt;i&gt;Note: replace (, ), /) with the right XML parentheses.&lt;/i&gt;

&lt;div dir="ltr"&gt;&lt;pre class="codelisting"&gt;(appender name="FILE" class="org.jboss.logging.appender.DailyRollingFileAppender"\)
(errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/)
 (param name="File" value="${jboss.server.log.dir}/server.log"/)
 (param name="Append" value="true"/)

 (!-- Rollover at midnight each day --)
 (param name="DatePattern" value="'.'yyyy-MM-dd"/)
[...]
&lt;/pre&gt;&lt;/div&gt;

It also works with the properties-based file:
&lt;div dir="ltr"&gt;&lt;pre class="codelisting"&gt;log4j.appender.file.Append=true
&lt;/pre&gt;&lt;/div&gt;


&lt;a name="_Rename_files_before_startup"&gt;&lt;/a&gt;&lt;h4&gt; Rename files before startup&lt;/h4&gt; When starting an app/server always with the same script, the log file can be moved out of the way before startup.

&lt;a name="_Rename_files_on_startup"&gt;&lt;/a&gt;&lt;h4&gt; Rename files on startup&lt;/h4&gt; In the following code, the last log file is renamed to a date based pattern. Yet the pattern is based on the current date (the restart timestamp), not the original log file creation or its last entry.

To use this, the logger must not be statically initialized in the main class, but after moving the file.

&lt;div dir="ltr"&gt;&lt;pre class="codelisting"&gt;try {
String date = new SimpleDateFormat("yyyy.MM.dd-HH.mm").format(new Date());
// if log file already open, moving no longer possible ...
File file = new File(LOG4J_FILE_NAME+".log");
if (file.exists())
  file.renameTo(new File("LOG4J_FILE_NAME-"+date+".log"));
mLogger = Logger.getLogger(CurrentClass.class);
}
catch (IOException e) {...}
&lt;/pre&gt;&lt;/div&gt;

It might be possible to configure the name of the file the logger should use in the code, instead of the configuration file. This allows to set a filename manually (date pattern based) *before* the first log statement is printed and the log file thus opened.
This might also require an explicit call to the ...Configurator.

It will probably not work in combination with RollingFileAppender.

Maybe there is no way around writing an appender (derived from RollingFileAppender) of our own?


&lt;a name="_DatedFileAppender"&gt;&lt;/a&gt;&lt;h4&gt; DatedFileAppender&lt;/h4&gt; DatedFileAppender works in the same manner as the Tomcat FileLogger.
Contrary to DailyRollingFileAppender shipping with log4j, log file names generated by DatedFileAppender always contain today's date. While this distinction seems minor, it means you can reliably copy, compress, remove or manipulate a day's log file shortly after midnight. With the DailyRollingFileAppender, a day's log file is not renamed until the first message is logged some time after midnight.

&lt;a class="wiki" target="_blank" href="http://minaret.biz/tips/datedFileAppender.html"&gt;http://minaret.biz/tips/datedFileAppender.html&lt;/a&gt;

&lt;a name="_Different_log_levels_for_stdout_and_file"&gt;&lt;/a&gt;&lt;h3&gt; Different log levels for stdout and file&lt;/h3&gt; Is there a possibility of using different log levels in log4j when logging onto stdout, and when logging into a file? The PropertiesConfigurator obviously does *not* support this, yet the xml configurator does. JBoss does this in its log4j.xml.

From the log4j.dtd, no reference to such possibilities can be found.

JBoss does the following in its xml configuration file:
&lt;div dir="ltr"&gt;&lt;pre class="codelisting"&gt;(appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender")
(errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/)
(param name="Target" value="System.out"/)
(param name="Threshold" value="INFO"/)
[...]
&lt;/pre&gt;&lt;/div&gt;

This also works with the properties configuration file:
&lt;div dir="ltr"&gt;&lt;pre class="codelisting"&gt;log4j.appender.stdout.Threshold=INFO
&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/144805460541353359-2521683011690577602?l=tecbites.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tecbites.blogspot.com/feeds/2521683011690577602/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=144805460541353359&amp;postID=2521683011690577602' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/2521683011690577602'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/2521683011690577602'/><link rel='alternate' type='text/html' href='http://tecbites.blogspot.com/2006/10/log4j-tipps-and-tricks.html' title='Log4j: Tipps and Tricks'/><author><name>Seb</name><uri>http://www.blogger.com/profile/06553111406739261461</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-144805460541353359.post-5678512819715521813</id><published>2006-10-04T11:02:00.000+02:00</published><updated>2006-10-04T11:03:35.463+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Jakarte Commons Primitives (de)</title><content type='html'>Jakarta Commons Primitives enthält eine Reihe von Collections - v.a. List, Array etc. - für die primitiven Datentypen von Java. Sicherlich schneller im Zugriff bei vielen Elementen als List und entsprechende, weil die Umwandlung Klasse &lt;-&gt; primitiver Type wegfällt.

&lt;a class="wiki" target="_blank" href="http://jakarta.apache.org/commons/primitives/"&gt;http://jakarta.apache.org/commons/primitives/&lt;/a&gt;

Aus Performance-Gründen sollte man die Objekt-Kapselungen der primitiven Datentype (also Integer, Float, Double) nur verwenden, wenn es nicht anders geht - und schon gar nicht in größeren Mengen (sprich Listen, array[] etc.).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/144805460541353359-5678512819715521813?l=tecbites.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tecbites.blogspot.com/feeds/5678512819715521813/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=144805460541353359&amp;postID=5678512819715521813' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/5678512819715521813'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/144805460541353359/posts/default/5678512819715521813'/><link rel='alternate' type='text/html' href='http://tecbites.blogspot.com/2006/10/jakarte-commons-primitives-de.html' title='Jakarte Commons Primitives (de)'/><author><name>Seb</name><uri>http://www.blogger.com/profile/06553111406739261461</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
