Happy Holidays!
- December 20th, 2011
- By Bert
- Write comment

Posts Tagged ‘english’

On one of what I think is the last nice days of our autumn, I wanted to do a nice photoshoot in a warm sunsetting evening light…

A little project just before Halloween was haunting in my head: a shoot based on the witch Melisande.
The evening breeze was really cold and the last few mosquitos were aggressively buzzing around trying to get a last bite before dying a cold dead. Although she was freezing, my sister was doing such a great posing and flying her broom.
At the end, we returned home frozen, red nosed and covered with mosquito-bites but I’m really satisfied with the result you can see below.
Ok, they almost got me. I received a comment here on the website, saying this
When I originally commented I clicked the -Notify me when new comments are added- checkbox and now each time a comment is added I get four emails with the same comment. Is there any way you can remove me from that service? Thanks!
I started thinking fast: I have to resolve this immediately!
I’m gonna publish this comment and excuse me for it. Of course. Ok, so I have to try to dig up that plugin that does that. I know there is one, I saw it once. I wanted to try it, that’s for sure. But did I actually install it? Hmm. Must be. Or isn’t it? What does it say again? Let me see who added it? Ehm. Wait. This is a NEW visitor with an unknown e-mail address… So he didn’t made a first comment at all. And wait, I don’t have such a plugin installed. Waaaiiitt a minute!
The URL that he’s providing, as well as his “name” has much to do with penny thingy auctions and stuff, money for sure. This is just plain spam. And they almost got me. They get smarter, oh yes! But not quite smart enough!
*marks comment as spam*
Except for being too verbose in an e-mail, I think E-mail disclaimers are pretty funny.
I got another one today.
This e-mail and any attachments may contain confidential and privileged information. If you are not the intended recipient, please notify the sender immediately by return e-mail, delete this e-mail and destroy any copies. Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal.
I say: of course I’m the intended recipient of that mail: it was sent to my address
If it is that confidential, double check the recipient.
And don’t use e-mail to start with. You never know through which servers your confidential mail was sent.
A time ago, I wrote about how you could only read GPS data from a USB GPS device from one COM port and how I managed to handle GPS data on different virtual COM ports so that the GPS data could be used in different applications.
One of these applications is one in Java that I develop myself. However, the RxTx driver I’m using is a little unstable, especially when the connection is lost and you try to re-establish the connection to the Serial Port. So I tried to find a solution and hub4com actually offers one as well. You can actually route the GPS data, read from a physical COM port, to a tcp port so that you can create a network connection to the machine and fetch the GPS data from there.
You can enable filters in hub4com and one of these filters is the telnet filter over a tcp driver. I modified the command so that it looks like this:
hub4com
--baud=9600
--route=0:All \\.\COM6
--baud=9600 \\.\CNCA0
--baud=9600 \\.\CNCA1
--baud=9600 \\.\CNCA2
--create-filter=telnet
--add-filters=0:telnet
--use-driver=tcp *23 *23 *23 *23"
This now means the following:
Start hub4com,
--baud=9600
read at speed 9600 baud,
--route=0:all
route the first specified COM port to all the others
\\.\COM6
the first specified COM port, which is the one that we’ll be reading from
--baud=9600 \\.\CNCAx
write to these virtual COM ports with speed 9600 (the –baud parameter on these three lines might be omitted since you have specified hub4com to read at that speed)
--create-filter=telnet
Create a telnet-filter so that hub4com can answer telnet-like
--add-filters=0:telnet
redirect the input from the first specified COM port (COM6 in our case) to the telnet session
--use-driver tcp *23 *23 *23 *23
this will use tcp for communication and will listen on port 23. Four concurrent telnet sessions on port 23 are possible. If you only specify one *23, only one connection at the same time will be allowed.
This now allows me to create a tcp connection on port 23 and read the NMEA data from there. Much more stable.
Now, to wrap this all up into a windows service, I run the following bat file (everything on one line) to install that service:
@RunAsSvc.exe
--install
--displayname "hub4com"
--description "Routes the GPS data from COM6 to virtual COM14, COM15 and COM16 and allows 4 telnet connections to the raw NMEA data"
--exe "C:\com0com\hub4com.exe"
--params "--baud=9600 --route=0:All \\.\COM6 --baud=9600 \\.\CNCA0 --baud=9600 \\.\CNCA1 --baud=9600 \\.\CNCA2 --create-filter=telnet --add-filters=0:telnet --use-driver=tcp *23 *23 *23 *23"
--workingdir "C:\com0com"
The service now launches on system startup and I can use multiple COM ports as well as 4 concurrent telnet sessions to the host on which the GPS is connected. telnet localhost is more stable to use in Java than RxTx (at the moment of writing)
When you want to compile your source code – Java in this case – on multiple machines, you might get into troubles when special characters are coming in. I mean, when you just type plain English, nothing’s wrong. However, when you start typing characters other than in the ASCII128 specification, you get into troubles. On the Internet, it is a known problem and thus, most websites are specifying charset=”UTF-8″ in their metadata, so that every character you see or insert, is the same on all platforms.
Now, when you create a text file on Windows, by default it’ll be in the Cp1252 encoding. When that is a Java source file that you want to build on a Ubuntu server, you come into troubles when these source files contain characters like á or è and especially Æ. Ubuntu uses UTF-8 as default encoding and you’ll end up in compile errors because the characters are converted wrongly.
This writing describes a solution to be able to build your project using maven on different platforms (Windows and Ubuntu).
To make your project platform-independent, you can choose to create UTF-8 encoded sourcefiles all the time. In Eclipse, you can find the option in the Preferences panel (Window > Preferences) under General > Workspace. Here, you can modify the Text file encoding to UTF-8.
Now, maven will build the project correctly on Ubuntu. However, it won’t build on your Windows machine anymore – since it doesn’t interpret the UTF-8 characters correctly. So we have to make sure maven starts building in UTF-8. It’s giving you a hint by displaying a warning message while building:
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
To get rid of that, we have to add some properties in the pom files, preferably the master-pom file so that you only have to specify it once. It’s described on the maven website and even more on codehouse.org. However, both solutions were not enough to solve the problem on my machine. You have to specify the encoding that will be used for the project and configure it for all plugins that matter. In fact, that would cut down to the “build” and the “resources” plugin. If you could speak of “plugin” in these cases anyway…
When only specifying project.build.sourceEncoding, maven would still display the warning, so it wasn’t sufficient:
[INFO] Building project
[INFO] task-segment: [deploy]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
...
As you can see, we’re in the resources:resources section, not in a “build” section, so that made me add a project.resources.sourceEncoding property. My adjusted master pom file thus contains:
<?xml version="1.0" encoding="us-ascii"?>
<project xmlns="...">
...
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.resources.sourceEncoding>UTF-8</project.resources.sourceEncoding>
</properties>
...
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
...
<configuration>
...
<encoding>${project.build.sourceEncoding}</encoding>
<sourceEncoding>${project.build.sourceEncoding}</sourceEncoding>
</configuration>
</plugin>
...
</plugins>
...
</build>
</project>
And that works. The project is now building on a windows as well as on an ubuntu server and interprets the source files as UTF-8 encoded text files.
A little discussion about the teacher fail that is issued at failblog.org.
The post shows this math question:

It took Marie 10 minutes to saw a board into 2 pieces. If she works just as fast, how long will it take her to saw another board into 3 pieces?
The student answer is "20 minutes".
The answer is considered to be wrong by the teacher, who corrects it using the rule of thee:
1 piece = 5 minutes,
2 pieces = 10 minutes,
3 pieces = 15 minutes
and thus, according to the teacher, in 20 minutes Marie will have 4 pieces.
Of course, Marie isn’t creating two pieces, one by one, in ten minutes but is rather sawing one cut in ten minutes. To obtain 3 pieces, you need two cuts, thus 2x 10 minutes. Sure it was supposed to be a question about the rule of three. But it wasn’t one.
However. It seems very hard to understand this. I spoke to two people who both had troubles solving this problem. One was thinking about the rule of three and indeed proved the teacher correct… until I pointed out the real work is creating one cut rather than one piece of wood – he picked it up immediately, although he made the remark that this question lacks information and thus can’t be solved easily.
The second person however, still didn’t got it. After a long and bizarre explanation from his side, he came to this conclusion:
And thus, both student and teacher are right, depending on how you approach the problem.
I pointed out that he’s assuming a lot of things. First of all, you need a board that is a perfect square, preferably a cube. Then, you need to saw perfectly in the middle to obtain two equal parts, which can be cut in half the time. But when it isn’t a square, you’re end of story, because you can saw the perpendicular part in less then half the time. Or more, depending on which side you’re sawing.
So that leaves us with another possibility: suppose Marie is just cutting of some corners. Then she’s finished in 2 minutes. Or 3. Or 1.5. Undefined.
And that’s the point my second correspondent tells me … the question lacks information and thus just can’t be solved.
But hey, it’s probably me. I might not be good enough in maths to solve this complex primary school maths problem.