Archivi categoria: English

Digging through the Navionics API v2

Phew, it’s been a really long time since I even looked at this blog.

So now I’m running on the same Arch Linux I’ve had for five years now, I got a surgery and I am recovering.

My mom opened her site at least, and she’s doing great. She got a FB page too. Ah, Facebook… if only Diaspora* took over the world might be a better place now.

I thought it would be really cool to embed Navionics maps on her site, since the head of nearly every post is: “how to get to that beautiful Mediterranean bay without sinking your sailboat on an underwater rock“.

Navionics did a good job documenting the API to embed a map on your website. It looks all beautiful and dandy until you try to request the key from their form, get redirected to a 404 page and receive this email:

Dear Partner,
Thanks for your interest in our Web API.

Download the Web API instructions here: http://webapiv2.navionics.com/index-api.html
Download the Terms of Service you agreed to here: http://www.navionics.com/en/web-api-terms-serviceen .
Don’t hesitate to contact us at apisupport@navionics.com for any technical questions.

Best regards
Navionics

UPDATE: to get the key you only need to request it at the email address provided above. They will check the website you intend to host the map on before giving you the key. Fair enough. If only a simple sentence (like “we’ll examine your site asap and if it looks nice by us we’ll be pleased to email you back with your API key”) was present, all the techniques I described in this post wouldn’t have been necessary.

Their ToS don’t allow you to tamper with their code: exactly what I did in this blog post. Since their business (aka: how they pay their meals) is to sell the maps they’re so kind as to give us free, I feel somehow morally obliged to respect their rules.

Yeah, it’s easy to get all moral and honest when you are given the key. This post explained how to get their maps nonetheless, because these are absolutely fantastic. We’ve been using them for years now on our GPSes.

TL;DR: this post has been voided because they need to make a living with something they’re giving away for free.

 

Annunci
Contrassegnato da tag , ,

FluxBB with PHPass

FluxBB logoAs you may know I’m a GameZoo associate and I currently mantain their servers, and the site as well.

I’m migrating the old forums, that were pretty unmaintainable, to FluxBB 1.5.0.

FluxBB is an incredibly fast and simple forum software, and it runs without hassle on nginx.

The problem with FluxBB is that it stores user passwords as SHA1 hashes, a practice that nowadays is regarded as “unsecure”.

So I edited some files and plugged in PHPass, used by Drupal, Joomla! and PHPbb among the others. It works very nicely, and it was an easy job given how easy to read is the FluxBB code.

Grab your copy of FluxBB+PHPass on my github!

BIG WARNING: that code is intended for new installations. I removed from the login.php file the code that was updating passwords from older FluxBB versions! Do not use this code to update an existing forum, unless you write your own updating method. Moreover, the password field on the database has been stretched to host 60 chars instead of 40, so it could be incompatible with old versions. No, I didn’t write any update code since it was not my goal: I am migrating data from another forum software, so I started with a clean FluxBB install.

Link: https://github.com/sevendays/fluxbb15-GZ/tree/fluxbb-1.5.0-with-PHPass

Please note: don’t pull the master branch, I’m using it for my gamezoo migration project! Pull the tag “fluxbb-1.5.0-with-PHPass” instead.

Contrassegnato da tag , ,

JPEG Recovery With Foremost: Filtering Results

Following my previous article, I’m writing my experience with foremost.

My mother had its Windows XP/Vista ravaged out by her son. She was very happy with Linux Mint until she asked me: «Where are our dog’s photos? They were stored in $randomproprietaryapplication with the extension .ads and I can’t find them».

Ooops. I wiped it. «Gimme the laptop mom, I’l, find them.»

I used foremost as follows:

foremost -v -t jpeg -i /dev/sda1 -o /media/Enermax/BKP 

According to the audit.txt file, it scanned 108GB of disk in 1 hour, and found 19517 jpegs. OMG OMG OMG.

So let’s narrow it down a bit, shall we? I made a little script that moves files bigger than a predefined size (in this case, 500000) in another directory (jpg500):

#!/bin/bash
i=0
for filename in $( ls jpg/* ); do
	filesize=$(stat -c%s "$filename")
	if [ $filesize -gt 500000 ]; then
		mv $filename jpg500
		i=$((i+1))
	fi
done
echo $i

Well, here are the statistics:

  • JPEGs bigger than 500KB: 1773, only valuable pics
  • Between 400KB and 500KB: 0
  • Between 300KB and 400KB: 0
  • Between 200KB and 300KB: 776, valuable pics
  • Between 100KB and 200KB: 1441, valuable pics
  • Between 50KB and 100KB: 0
  • Between 40KB and 50KB: 1087, here you find thumbnails and crap
  • Below 40KB: 14440, crap to be shredded

So, rule of thumb, know your target. If you want to recover pics taken with your digital camera, go for the 500KB+ files. If you want to recover everything, stay above 100KB. Below 100KB, it’s only waste.

How To Recover My Files, The Very Best Way.

0. Avoid crapware.

Say, those Winblows thingies like “ImageRecall Don’t Panic”, “WinUndelete”, “Professional Voodoo”, “I Eats Dead Files”… There is absolutely no need to throw away your money. Open source software is the answer.

«Blah blah open source, what’s so special about open source, it’s hype with no facts, developers’ dream. I need working apps, for fuck’s sake!»

Well, pal, I didn’t want to call them in, but we’re talking about the  Special Investigations Office of the United States Air Force. USAF.

They needed a piece of software capable of recovering data from an unreadable hard disk.
They made it.
They released it.
They use it to discover evidences.
They mantain it, and want it bug-free, because in courthouses every evidence must be bug-free.

So, what about a cup of shut the fuck up?

1. Always try to backup first.

That’s for sure, you always can fuck it up. No software will save you from doing something really stupid. Better said: every software allows you to do something really stupid.

Let’s talk about Windows. How many times you tried to make a dual-boot system, and how many times Windows asked to check the disk, fucking its partition table with random FAT32 partitions?

So, the very first thing you can try is to burn a LiveCD and boot from it, then copy everything you can find to an external backup disk.

From now on I’m assuming you use Ubuntu’s LiveCD.

Why Ubuntu?

Because it is widespread, it supports ntfs-3g out-of-the-box and it is easy to install new packages on it.

Well, sometimes the system complains that it can’t open the partitions. Have a look with gparted or  similar applications. Maybe the partition table is damaged.

2. Try Windows tools. LOL.

Of course, if you are using Windows® Crapware© Non-Operating Systems. You can insert the installation cd, boot from CD, press R or F8, follow instructions, be left with great disappointment in seeing that nothing has changed.

(Don’t tell me you haven’t your CD because you illegally downloaded it. That would be dumb.)

Well, of course Windows tools won’t fix a shit. I only wanted to laugh at it. Go on reading.

3. Try recovering your partition table.

It will work (at least if the disk isn’t broken) and it is relatively fast.

Let’s say you did a big beautiful disk format, and later you discovered you nuked the wrong hard disk. Duh.

Well, as soon as you didn’t write anything on that disk, you can still recover the previous partitions (and files contained in them) without much hassle.

The piece of software you need is called testdisk. Grab the .deb package for your Ubuntu LiveCd herelinkgo (mind the versions!), and install it. Then launch it on the Terminal, with “sudo testdisk“.

Most of the times you’ll have to do a “Deeper Search” to find all your partitions, and use the “P” key to see if those partitions do contain your files.

Just try to remember what your previous partition table was.
Try to find the pattern among all the partitions testdisk has found.
Verify it with “P”, see that the files are the ones you’d expect to find in those partitions.
Restore the old partition table and reboot.

If it works and the computer boots, you’re done.

4. Recover files.

Well, this is what happens if you wipe out that Microsoft crapware and install Linux, then discover that you didn’t do a backup of yourt documents/images/movies/etc.

You have 2 apps to do this job: one is photorec, installed alongside testdisk. Get the info you need about it herelinkgo, I won’t describe it deeply.

The other is foremost. The one developed by USAF’s Special Investigations Office.

Grab it herelinkgo, install it on your Ubuntu LiveCD, read the man page (man foremost).

Let’s say I want to recover all JPEG files from the partition /dev/sda1, and save them to an external disk:

sudo foremost –v –t jpeg –i /dev/sda1 –o /media/ExternalHD

5. Sneer at those who lost their files with Winblows® Certified Crapware©.

This is the most satisfying part of the process.

 

Italian version available as PDF

Come recuperare file da un hard disk danneggiato

Éire, Ireland

4.200.000 people to throw out of Europe ASAP.

What is Europe after all?

Europe = France + Germany + Italy + Spain + Austria + Portugal + useless things calling themselves countries and getting money for that :-)

“It’s democracy” they say, and France too rejected the Treaty with a referendum (then approved it in the parliament). But hell, 4.200.000 little people blocking 799.000.000… wtf…

Ah, Italy will eventually defeat France in the European Championship. Sure. We shall overcome!

Contrassegnato da tag , , ,

CONFIG_CONFIG_KMOD is not set

Today I upgraded my Gentoo kernel to 2.6.23 version, but I had this problem when emerging madwifi-ng:

 * Messages for package net-wireless/madwifi-ng-0.9.3.3:

 *   CONFIG_CONFIG_KMOD:         is not set when it should be.
 * Please check to make sure these options are set correctly.
 * Failure to do so may cause unexpected problems.
 * Once you have satisfied these options, please try merging
 * this package again.
 *
 * ERROR: net-wireless/madwifi-ng-0.9.3.3 failed.
 * Call stack:
 *                   ebuild.sh, line 1717:  Called dyn_setup
 *                   ebuild.sh, line  768:  Called qa_call 'pkg_setup'
 *                   ebuild.sh, line   44:  Called pkg_setup
 *   madwifi-ng-0.9.3.3.ebuild, line   34:  Called linux-mod_pkg_setup
 *            linux-mod.eclass, line  465:  Called linux-info_pkg_setup
 *           linux-info.eclass, line  576:  Called check_extra_config
 *           linux-info.eclass, line  475:  Called die
 * The specific snippet of code:
 *              die "Incorrect kernel configuration options"
 *  The die message:
 *   Incorrect kernel configuration options
 *
 * If you need support, post the topmost build error, and the call stack if relevant.
 * A complete build log is located at '/var/tmp/portage/net-wireless/madwifi-ng-0.9.3.3/temp/build.log'.
 *

Of course KMOD (automatic kernel module loading support) was set. Damn developers!bombabomba

So I had to:

  1. open /usr/src/linux/.config
  2. look for CONFIG_KMOD and check tiat it wass indeed set (CONFIG_KMOD=y), otherwise one should have to recompile the kernel.
  3. add a line below: CONFIG_CONFIG_KMOD=y (yes, it makes me laugh too)
  4. save & close /usr/src/linux/.config
  5. emerge madwifi-ng
  6. re-open /usr/src/linux/.config
  7. delete the previous added line CONFIG_CONFIG_KMOD=y, save and exit.

I guess the bug should be resolved by madwifi developers, but was caused by kernel developers happily removing a CONFIG_ here and there…

Skype 2 Beta + Kubuntu Gutsy + Audigy2 Platinum… IT WORKS (NOT!) (YES!)

I can’t believe it. The audio was not working anymore.

desperate videocaller without audio
The video was working fine from the beginning, however: I made a screenshot showing how desperate I was :o)

I downloaded the Feisty .deb package of Skype2.0 betalinkgo, installed it and it was NOT working, no sound, or sound the first time and then no sound at all, even Amarok wasn’t able to work after trying and I had to reboot.

I was dying of anger, I swear.

I have spent the whole day trying, tweaking, learning ALSA.

Well, I’m a perfect dumbass. If I had looked where I was meant to look the first timelinkgo, I would have been videocalling by this very morning.

Continua a leggere

Contrassegnato da tag , , , ,

error while loading shared libraries: libexpat.so.0: cannot open shared object file: No such file or directory

EDIT!!! The right way to fix this (and similar problems) is:

emerge gentoolkit
revdep-rebuild -X

It appears that the libexpat problem was caused by Gentoo developers releasing too many updates without cross-checking them.

I got this error in Gentoo, after doing an “emerge world”. I’m using an AMD64 Turion laptop.

/usr/bin/dbus-daemon: error while loading shared libraries: libexpat.so.0: cannot open shared object file: No such file or directory

dbus didn’t start, so hald couldn’t start, and finally kpowersave wasn’t able to read the battery state.

You’ll agree with me that it is pretty annoying if you have a 3h25m battery life laptop.

Here’s how I solved the problem:

1) First of all, I found the path to libexpat.so: it’s /usr/lib/libexpat.so

root@smokey# ls -l /usr/lib/libexpat* -rw-r--r-- 1 root root 250620 Oct 29 14:17 /usr/lib/libexpat.a -rw-r--r-- 1 root root    795 Oct 29 14:16 /usr/lib/libexpat.la lrwxrwxrwx 1 root root     17 Oct 29 14:17 /usr/lib/libexpat.so -> libexpat.so.1.5.2 lrwxrwxrwx 1 root root     17 Oct 29 14:17 /usr/lib/libexpat.so.1 -> libexpat.so.1.5.2 -rwxr-xr-x 1 root root 141456 Oct 29 14:17 /usr/lib/libexpat.so.1.5.2

2) As you can see, there’s no such thing as a libexpat.so.0 in /usr/lib. But there is a libexpat.so.1 referenced by libexpat.so itself. So I made a symbolic link named libexpat.so.0 pointing to libexpat.so:

root@smokey#  ln -s /usr/lib/libexpat.so /usr/lib/libexpat.so.0

bell.png Be warned: this may not be the right thing to do. I should have checked the configuration file of the dbus daemon, and changed it to reference libexpat.so instead of libexpat.so.0. But as you may guess i was pissed enough to dig deeply into crappy conf files. And what if there was another app requiring libexpat.so.0? You can never guess when a developer/mantainer will fail you.

3) Finally, fire up those lazy dbus and hald daemons:

root@smokey# /etc/init.d/dbus start  * Starting D-BUS system messagebus ... root@smokey# hald start

Tch… That was easy, man. happy And my battery is the best, you’ll never beat me in powersaving.

Contrassegnato da tag , , , , , , ,

Gentoo on a Fujitsu-Siemens S2110 Laptop

After 3 days of struggling, extensive compiling and binge drinking I managed to get Gentoo to work on my Fujitsu-Siemens s2110 laptop:

And not only work, but work fast and do everything!

This laptop has always been problematic, so I hope this guide will help many desperate owners.

Continua a leggere

Contrassegnato da tag , , , , , , ,

Debian And Slow Touchpad

The Problem: some touchpads are REALLY slow under Debian, you have to tap like a piano player to get the little arrow from one window to another.

And yes, this is really annoying since everything works fine with an USB mouse.

Even worse, you didn’t notice the problem with an Ubuntu installation. But you don’t want any brown hot nasty things on your precious laptop.

The solution was here. Maybe you’ve got an ALPS touchpad, not a Synaptics one! Eureka! lampadina

Wanna know what to do? Read on! happy
Continua a leggere