Oct 10, 2013

Wordpress update - old jQuery warnings

With the recent Wordpress update, jQuery was also updated to version 1.10.

Blogs were now full of warning messages, somewhere along the lines of:

ATTENTION! (by Comprehensive Google Map Plugin)
Your blog/site theme or one of your plugins uses jQuery javascript library which is older than the version 1.3.0.
The Comprehensive Google Map plugin will not work with such outdated jQuery version.
The minimum jQuery requirement for Comprehensive Google Map plugin is version 1.3.0. Apologies for the inconvenience..

However, this is not true. Version 1.10.2 is greater than 1.3, but somehow it get's detected as 1.1, because silly programmers cast the version code into float. Ugh.

if (version < 1.3) { // WTF ?!?!?!?!?!
    alert(CGMPGlobal.errors.oldJquery);
    return false;
}
Unfortunately, there's not much we can do about it, other than a quick hack of removing the version check or modifying it to 1.1.

Or wait for the plugin developers to FIX THE DAMN CODE.

Like that will happen anytime soon.


Oct 5, 2013

Restore panoramas (cubic tiles) from exported Pano2VR

With this simple little script you can restore the full size cubic faces of the panorama which was exported using Pano2VR.

Pretty useful, if you deleted the original by mistake ;)

To convert the cubic projection back to equirectangular, you can also use Pano2VR, but for the input source you choose "Cubic", load all six cube faces, and export transformation.


Pano2VR's panoramas are exported as tiles in a cubic projection. The file naming scheme is as follows:
c[CUBE FACE]_l[RESOLUTION LEVEL]_[X]_[Y].jpg
for example:
c0_l0_0_0.jpg.

The most detailed resolution level is "0", so that level is used, and other tiles are disregarded.
Cube faces range from 0 to 5, and X and Y are the row and column number.

The script is written in PHP, and should be run in a CLI.

error_reporting(E_ALL);
ini_set('display_errors', 1);
ini_set('memory_limit', '2G');
date_default_timezone_set('Europe/Ljubljana');

$dir = 'tiles/';

foreach(range(0,5) as $c) {
 $i = 0;
 $tiles = array();
 $height = 0;
 do {
  $width = 0;
  $j = 0;
  do {
   $fn = fname($c,$i,$j);
   if(file_exists($fn)) {
    $tiles[$i][$j] = $fn;
    list($w, $h) = getimagesize($fn);
    $width += $w;
   }
   $j++;
  } while(file_exists(fname($c,$i,$j)));
  $j--;
  $i++;
  $height += $h;
 } while(file_exists(fname($c,$i,$j)));
 $i--;
 
 echo $width.' '.$height."\n";
 $im = imagecreatetruecolor($width, $height);
 $y = 0;
 foreach($tiles as $row) {
  $x = 0;
  foreach($row as $tile) {
   $tile = imagecreatefromjpeg($tile);
   $src_w = imagesx($tile);
   $src_h = imagesy($tile);
   imagecopy($im, $tile, $x, $y, 0, 0, $src_w, $src_h);
   $x += $src_w;
   imagedestroy($tile);
  }
  $y += $src_h;
 }
 imagejpeg($im, "$c.jpg", 70);
}

function fname($c,$i,$j) {
 global $dir;
 return "{$dir}c{$c}_l0_{$i}_{$j}.jpg";
}

Tiles

Restored cube faces

Restored panorama 



Sep 13, 2013

Embedding flash in Facebook link posts

If you want to have custom flash movies embeded in Facebook posts that link to your website, like these one from YouTube or SoundCloud:

 

It's fairly simple. 
BUT, it requires a SSL certificate, so that your website works over HTTPS, without browsers whining about security.

Here's what you do.
You've heard of OpenGraph protocol, right? Right. So, that's all there is to it. Proper metadata in the HTML of your website will instruct Facebook to include your flash movie, like this:
<meta property="og:title" content="Aljažev stolp | Triglav (2864m) | VR panorama"/>
<meta property="og:video" content="http://kafol.net/pano/aljazev-stolp/aljazev.stolp.swf"/> 
<meta property="og:type" content="movie"/>
<meta property="og:url" content="http://kafol.net/pano/aljazev-stolp/"/>
<meta property="og:image" content="http://kafol.net/pano/aljazev-stolp/preview.jpg"/>
<meta property="og:description" content="VR (virtual reality) panorama pri Aljaževem stolpu na vrhu Triglava. Panorama je posneta brez stativa."/>
<meta property="og:video:type" content="application/x-shockwave-flash" />
<meta property="og:video:width" content="400" />
<meta property="og:video:height" content="300" />


The next part depends on what the flash movie actually does. If it's a movie/music player that fetches media from other sources, or even an other part of your website, you'll need to configure crossdomain.xml. You put that file on the root of your website.

Here's a very liberal example, but fine for testing:
<?xml version="1.0" ?>
<cross-domain-policy>
<allow-access-from domain="*" />
</cross-domain-policy>

Jul 31, 2013

Garmin Nüvi map files

Here are the Garmin NUVI Map File Naming Conventions:

  • gmapprom.img - primary mapset, factory installed USA or Europe or other country.
  • gmapprom1.img - secondary mapset, example: North American / European units
  • gmapsupp.img - supplemental mapset, located on the Nuvi drive
  • gmapsupp.img - supplemental mapset, located on the SD card
  • gmapoem.img -  OEM mapset, user accessible, cannot be unselected from the unit via Tools/Settings/Map/Map Info
    *Note, when using the following default system maps as user maps, you'll naturally lose their default map attributes.
  • gmapbmap.img - default basemap, configurable as a supplemental map; NOT selectable and does NOT show up under installed maps (Tools/Settings/Map/Map Info) but may be visible under Tools/Settings/System/About/Basemap
  • gmaptz.img - Timezone map, configurable as a supplemental map
  • gmap3d.img - 3D Buildings map, configurable as a supplemental map
  • gmap3d1.img - secondary 3D Buildings map, configurable as a supplemental map
Now, if you're wondering which files to delete from your Nuvi drive or SD card to clear up some space, this should provide some insight.

You can easily remove/replace the primary, secondary or supplemental mapset, however you should keep the timezone map. Basemap can be deleted, however it's only around 50 MB in size.

With an SD card in the Nuvi you can fit around 4 custom maps, with the following naming conventions: gmapprom.img, gmapsupp.img. You can even use gmapbmap.img, but note that it will not be selectable from the settings.

Maps on the SD card are located in the folder Garmin.
Maps on the Nuvi drive are located in the .System folder (with a dot) or in the Map folder.

If you can't see the .System folder, you might need to change the USB mode on the Nuvi from MTP to mass storage.

You can get free maps for Garmin from OpenStreetMaps:

or from Open MTB maps (Mountanbike and Hiking):


Garmin Nüvi connected as media device - disable MTP, enable mass storage

What is MTP mode and which automotive devices use it?


Some automotive devices use Media Transfer Protocol (MTP) for connecting to your computer. MTP provides a more secure environment for the important system files on your device.
MTP connectivity requires the following:
  • Windows XP with service pack 3 or later
  • Windows Media Player 11 or later
The following devices use MTP  mode:
  • dezl 760
  • nuvi 2405 series
  • nuvi 2407 series
  • nuvi 2408 series
  • nuvi 2505 series
  • nuvi 2507 series
  • nuvi 2508 series
  • nuvi 2707 series
  • nuvi 2708 series
  • nuvi 3400 series
  • nuvi 3500 series
  • nuvi 3507 series
  • nuvi 3508 series
  • RV 760
  • zumo 350
If the above system requirements are not met, or you are using the device on a Mac, the device will connect to the computer using standard mass storage mode instead of MTP mode.
Make NUVI DIR & Files visible for Backup

1. To make all of Nuvi files visible you must unhide protected files via Win7 like any other HD.
2. Start NUVI by itself and go to Volume Screen.
3. Press the upper right hand corner of screen for 10 seconds.
4. The Developers Screen will pop up
5. Scroll down to MTP SETTINGS
6. Change from AUTO DETECT to MASS STORAGE
7. Shut down NUVI and hookup to Computer USB cable
8. Start NUVI and it should recognize it is hooked up to the computer.
9. Explorer will now see all files in ROOT directory and the .System directories.


BTW, have you backed up your Nuvi? If not, then this would be a good time to do it. Could save a lot of grief later if you have a problem.