December 27th, 2009 | Tags: , , , ,

I’ve been looking for a way to prevent ssh brute force attacks. Although they are not particularly dangerous if you have prohibited password login (which you should have done under any circumstances), they had been spamming my log files. Asking the almighty search engine for relief, I found a number of interesting articles about attack blocker, such as DenyHost.

I’ve just installed the package on my private OsX server via MacPorts. However, it took me a while until I found the installation location of all required files. After having touched /etc/hosts.deny (the file used by denyhosts to store suspicious ips for tcp_wrappers to block them), copied /opt/local/share/denyhosts/denyhosts.cfg-dist to somewhere reasonable (e.g. /etc/denyhosts.cfg), modified it to my needs (added E-Mail etc.), I was able to test start DenyHost with:

sudo /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/denyhosts.py --config=/etc/denyhosts.cfg

I’ve got a nice email telling me that, deducing from my /var/log/secure.log some IPs were now added to hosts.deny. Furthermore, some interesting data have been stored in /opt/local/share/denyhosts/data.

However, I prefer DenyHost to be running in daemon mode and to synchronize with data collected from the cloud, so I inserted  SYNC_SERVER = http://xmlrpc.denyhosts.net:9911 into denyhosts.cfg and started DenyHost with some additional options:

sudo /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/denyhosts.py --config=/etc/denyhosts.cfg --sync --daemon

And now I feel much more comfortable now.

Related Links:

  • Share/Bookmark
December 20th, 2009 | Tags: , , ,

As NetBeans 6.8 was published today, I could not resist to updated all my Sun stuff. Suprisingly, I realized that NetBeans 6.8 comes with integrated JSF2.0 support:

NetBeans 6.8 and JSF

Now, I am giving it a try and will be reporting here any groundbreaking progress.

  • Share/Bookmark
November 14th, 2009 | Tags: , , , , , , , ,

The tutorials at http://www.gimp.org/tutorials/ are very useful. You may come to astonishing results following them. My favourite ones are

Another nice tutorial that deals with creating vintage look using The Gimp is here:

http://www.linuxjournal.com/article/6750

It focuses on more subtle filtering.

  • Share/Bookmark

Finally, Microsoft has released a free Antivirus and Antispyware Suite. It is running on my notebook with Windows Vista and I am quite confident. Actually, it has replaced the Security Suite I had been using until now.

The Suite can be downloaded for free at:

http://www.microsoft.com/Security_Essentials/

BTW, I just learned, that installing Windows Security Essentials will either disable (Vista/Win7) or remove (XP) Windows Defender. Defender is no longer required, because it is being replaced by WSE. However, you really should check if Defender is really disabled/removed. If not, do it.

  • Share/Bookmark
November 14th, 2009 | Tags: , , , , , , ,

Windows Shadowstorage is used to store some files, which can usually be removed savely. By default, the maximum size of this storage is unlimited. In case you need/want to save disk space, open cmd.exe in administrator mode and do something like:

vssadmin.exe list shadowstorage

vssadmin.exe resize shadowstorage /on=C: /for=C: /Maxsize=2GB

This limits the storage used for drive C: to 2GB.

  • Share/Bookmark
September 19th, 2009 | Tags: , , ,

I am so thrilled by Google Books – they offer complete books with expired copyright. As far as I am concerned, these old books are more charming anyway. Even better: they offer the original scans of the books (i.e. including all paintings and the original fonts) for free and legal download as PDF and some even as ePub, the appropriate format for the eBook readers of Sony.

Again: They provide the full scans! You will experience the original charm, even though you will probably read them on some screen. I have already figured out some really beautiful ones I shall read in the near future:

  • Edgar Allan Poe: “The poetical works of Edgar Allen Poe” with so wonderful, really, wonderful drawings … enhancing Poe’s gloomy stories in a way that I have never experienced from any concurrent printing
  • Familiar Lecture on Botany”: Also of minor scientific interest (taxonomy has been completely shook up since genetic analysis took over), it is still of great aesthetic value to me. Another nice example: “British Zoology
  • An essay on archery”: I really don’t know where to find such a in-depth monograph on such a topic. If it wasn’t digitized, I wonder when this knowledge would have been lost
  • The Travels and Researches of Baron Humboldt”: Alexander von Humboldt was a great German explorer. He was the first to explore and describe South America (and Venezuela in particular) not from the master-and-slave, but from the human view. The people of Venezuela are still thankful for his work. Here, however, is some of his important work, again, with breathtaking drawings
  • etc.

Apart from the personal joy one might experience when being offered such a huge library, the sheer fact that this knowledge is now available for each and everybody is, to me, another real revolution.

Again: I am thrilled …

  • Share/Bookmark

There are several approaches to determine a location (in terms of longitude and latitude) from an address and vice versa (latter is referred to as “reverse geocoding”). A quick research with Google unveiled following interesting APIs and web-services (fully sufficient for my needs, yet, incomplete and far from exhausting). I will focus here on

  1. Google Maps-API (Recommended for PHP and JavaScript …)
  2. Geonames.org-API (Recommended for Java, C#/.NET, VB/.NET …)
  3. Android (Android only)
  4. iPhone (iPhone only)

Google Maps-API

Particularly useful if you need to carry out implementation in PHP or JavaScript. Google’s API provides a class which is solely dedicated to the task of geocoding: GClientGeocoder. You could make use of it embedding it within your application making it a client site geocoder. With this API, “Reverse Geocoding” is possible too.

They may be cases, where you do not want or just cannot make use of client site geocoding (e.g. absence of Javascript, performance, etc.). Here you may the HTML Geocoding web service of Google. You may choose between XML, KML, CSV, and JSON response – of which latter is particularly useful for the communication between Google and mobile devices. All you need to do is to create a string like

$Address = 'Germany, Frankfurt, Friedberger Landstrasse 20';
$myString = 'http://maps.google.com/maps/geo?q=' . $Address . '&output=xml&key=' . $GoogleApiKey;'

where $Address is, of course, the (relatively) free format address and $GoogleApiKey is a key you need to obtain from Google in order to get access to its services.

Here is a strategy for a PHP implementation. It is based on send the Client URL (cURL) Library shipped with PHP. In particular, you could implement the following sequence in order to send the request and retrieve the response:

  1. Initialize a cURL session with the curl_init() function: $csession = curl_init()
  2. $csession is a state machine. You need to set some of its parameters with the curl_setopt(…) command: Set CURLOPT_RETURNTRANSER to TRUE, CURLOPT_HEADER to 0, CURLOPT_FOLLOWLOCATION to 1 and CURLOPT_URL to the above mentioned $myString. Example: curl_setopt($csession, CURLOPT_RETURNTRANSFER, TRUE)
  3. Finally, use curl_exec() to carry out the request: $response = curl_exec($csession); curl_close($csession)

Now, what you get here is some data stored in $response. You may access them using PHP’s SimpleXMLElement class: $xml = new SimpleXMLElement($response) and then accessing the XML elements by e.g. $xml->Response->Status->code or explode(',',$xml->Response->Placemark->Point->coordinates).

A good implementation of this strategy in form of a PHP class can be found here.

Geonames.org

Geonames provides a web interface and an API in form of a standard web service interface to access its geocoding service. This very fact – the use of a web service interface – makes it particularly interesting for all languages. However, I would like to advise to make this the choice if using .NET languages and Java, since these languages have developed an excellent workflow of referring to web services by using IDEs like Visual Studio and Eclipse, respectively. BTW, JSON format is also provided ;-)

And since web services are so common, I won’t give any details here dealing with the implementation. Just refer to the web service documentation of Geonames.org and the list of web services provided by Geonames.org.

Nevertheless, I simply must mention some very interesting thing about this provider: It does not only return simple (reverse) geocoding data, but it also offers web service methods like findNearbyWikipedia (which returns a list of wikipedia entries) and findNearByWeather (which returns a weather station with the most recent weather observation). This surplus is really worth considering this service for your implementation.

Android

Since Android is a project by Google, it is somehow related to the last section. However, the approach describes in the last section is a very general one while this one is recommended for Android mobile implementation.

The base class android.location is provided by the Android SDK. The specialized android.location.Geocoder is just what is needed for all sort of geocoding. It is possible to carry out both, geocoding and reverse geocoding. This is particularly powerful in combination with android.location.LocationManager, which can be used to determine the current location using the cell phones GPS device, and android.location.Location to store the time-dependent location.

Instead of going into the coding details here, I would like to give some good references you may find useful:

You should be able to create your own implementation from this input.

iPhone

Apple, too, has implemented a very good framework to cope with the GPS capabilities of its iPhone. It comes with its Core Services and is called “Core Location”. Apple’s developer pages are so exhausting that no further details are needed here. The above mentioned link to the “Core Location” framework leads to a page with many source examples, however, you need to be member of the apple developer community in order to access them.

There is a very good geocoding example @ cloudmade.com that shows how to make use of Apple’s API. You should take this as your starting point.

  • Share/Bookmark
August 22nd, 2009 | Tags: , , ,

Having got warm with the portable eBook reader by Sony, I can now say that my favoured free software to interact with the reader is calibre. Beside having a great tagging capability and the fact that it gathers information about an ebook from nothing but e.g. an ISBN, it also retrieves information from RSS and ATOM newsfeeds to convert them into the ePub format (incl. pictures (!!!)) and send them to the device.

This is really amazing, since I can now read my favoured news, blogs and what-so-ever using my reader.

I guess the digital revolution has just begun and wonder where we are going to be in the year 2020 …

  • Share/Bookmark
August 6th, 2009 | Tags: , , , , ,

When trying to get MPICH2 working on two Debian Lenny machine, I ran into a problem. Actually, /etc/hosts was misconfigured. It was necessary to turn

127.0.1.1    myMachine.myDomain    myMachine

which caused heavy problems when trying to connect from a slave node to the master node using

mpd –host [masterhost] –p [masterport] &

on the slave into

192.168.1.39    myMachine.myDomain    myMachine

which was the actual IP address given to that machine by my DHCP server. I had to repeat this for all nodes using the appropriate IP of the node.

I figured out this problem by reading chapter “Troubleshooting MPDs -> Debugging host/network configuration” of the mpich2-installationguide.pdf – which is worth reading anyway. I learned that running into trouble in such a situation, the command

mpdcheck

or even

mpdcheck -l

is a great tool, since it determines potential host of network configuration problems. There is plenty of debugging information in that manual, so you should always give it a try before searching the internet.

So here is what I did in order to build MPICH2 from scratch:

  1. First, I configured ssh in such a manner, that I was able to logon to any host without using I password. In order to achieve this condition, I created a secret key using ssh-keygen and copied the public key to all slaves. I did not use an empty passphrase, but I started ssh-agent in order to enable quite logon
  2. I got the source from the MPICH2 project homepage and unzip/tar-ed to some temporary directory
  3. cd there and build it using ./configure –prefix=/opt/mpich2 . (However, I preferred building MPICH2 using the Intel Compilers, thus, I set environmental variables CC and CXX: export CXX=icpc && export CC=icc . This step is, of course, not necessary if you build MPICH2 using GNU Compilers)
  4. make && sudo make install
  5. Next, I copied the whole /opt/mpich2 directory to the slave nodes calling scp -r /opt/mpich2 sascha@myslavenode
  6. The PATH and the LD_LIBRARY_PATH must contain the paths to /opt/mpich2/bin and /opt/mpich2/lib
  7. 4. and 5. was  carried out for all nodes, i.e. all nodes had the mpich2 directory physically on their HDs and the paths were set as of 5.
  8. Next, ~/mpd.conf needs to be created. This file contains a list of hosts to be connected to (for example, refer to my mpd.conf file)
  9. On the master, I executed mpdboot -n 2 -f ~/mpd.hosts which establishes connection between 2 hosts for 6 processors (see mpd.conf)
  10. I used mpdringtest 10000 and mpdtrace -l and mpiexec -n 6 hostname respectively in order to validate the connection
  11. Finally, I ran mpdallexit on one machine in order to kill the whole ring

Voila! I’ve got my cluster up and running now :-)

  • Share/Bookmark
July 6th, 2009 | Tags: , , , , ,

This is meant to be a walkthrough rather than a tutorial, thus, this is no good for absolute C++ / Eclipse beginners (you may get lost too soon).

Step I: Create the Shared Library

  1. File -> New -> Project
  2. C/C++ -> C++ Project
  3. Shared Library -> Empty Project (remember to give it a name. Here I use "testlib")
  4. Create a class for Testing: File -> New -> Class. Name it “TestClass“. Also create a simple public method: prototype
    void testWrite(void);
    within TestClass.h and implement something like
    void TestClass::testWrite(void) { std::cout << "From Shared Lib" << std::endl; }
    within TestClass.cpp. Remember to include iostream somewhere
  5. Only if you would like to create a 64bit build: Advanced Settings -> GCC C++ Compiler -> Miscellaneous -> All Options: Add -fPIC
  6. Ctrl+B for build. There should be no errors

Step II: Create some executable that uses the dynamic library

  1. File -> New -> Project
  2. C/C++ -> C++ Project
  3. Executable -> “Hello World C++ Project”
  4. Name it “UseDLL”
  5. Next -> Next -> “Advanced Settings”
  6. GCC C++ Compiler -> Directories ->Add (Button to the right top)
  7. Workspace -> testlib (or enter: ${workspace_loc:/testlib})
  8. Should look like this: Eclipse CDT Library 001
  9. GCC C++ Linker -> Libraries
  10. Add Library (-L): ${workspace_loc:/testlib/Debug}
  11. Add Library search PATH (-l): ${workspace_loc:/testlib/Debug}
  12. Should look like this:
    Eclipse CDT Library 002
  13. Finally select “Paths and Symbols” from the left -> References and select “testlib”:
    Eclipse CDT Library 003
  14. However, this counts for “debug”. Repeat step 10 to 13 for “release” choosing “release” from the upmost tab and replacing “debug” by “release”
  15. OK -> Finish
  16. Ctrl+B should build, however, let’s include the library and do something:
  17. From the Project Explorer, DoubleClick on UseDLL -> src -> UseCPP.cpp and include "TestClass.h"
  18. Also add two lines within main() that create the TestClass object and call its testWrite() method:
    TestClass ti;
  19. ts.testWrite();

Step III: Run (debug) the executable from within Eclipse

  1. First, you must set the environmental variable LD_LIBRARY_PATH: From the Project Explorer Tab, choose UseDLL -> Right-Click -> Debug As -> Debug Configurations
  2. Environment -> New
    Name = LD_LIBRARY_PATH
    Value = ${workspace_loc:/testlib/Debug}
  3. Apply -> Close
  4. Press “F11″ key for Debug -> Select “Use configuration specific setting” -> “Standard Create Process Launcher” -> OK
  5. Now the debug view should appear
  6. Set a break point (Ctrl+Shift+B) at the UseDLL.cpp line that contains “ts.testWrite();“:
    Eclipse CDT Library Debugging Breakpoint 004
  7. Press “F8″ to “Resume”
  8. When the above mentioned line is reached, press “F5″ to “Step Into” the method
  9. Voila! You’re within the code of you dll:
    Eclipse CDT Library Debugging - Jump into a method 005
  • Share/Bookmark
TOP

Switch to our mobile site