Remove a balloon from a static Gmap: quick howto
- Get the static gmap (via Google Maps)
- If the gmap has a single result, you will get a balloon in popup on load
- To disable the balloon, add to map arguments:
&iwloc=near
Make Flash works with Chrome on Ubuntu 64 bit
- Download Chrome for Linux (64 bit .deb package)
- Install the package
- On shell type:
$ sudo bash
If you don’t have wget installed:
# apt-get install wget
# cd /opt/google/chrome/
# mkdir plugins - Get the latest experimental Flash Player “Square” on
http://labs.adobe.com/technologies/flashplayer10/square/
and then put it on Chrome plugins folder e.g.
wget http://download.macromedia.com/pub/labs/flashplayer10/flashplayer10_2_p3_64bit_linux_111710.tar.gz
- Close and restart Chrome: now Flash 10 is working.
See also:
Joomla Webform alternative: JForms
I don’t use Joomla, but sometimes a friend or a colleague of mine ask me some tips. My answer could be: in Drupal it will take 5 minutes.
Since I’m very open-minded, today instead of replying in that awkward way I try to found an alternative to a very useful module for Drupal called Webform. I’ve found a limited but working equivalent for Joomla called JForms.
Tested on:
- Joomla 1.5
- JForms version 0.7 RC1
Installation:
- Install the extension using URL installation and paste the extension link (zip file from link above).
- Create a new form (see the visual howto below) with at least one field, one button, a form title, and a Thank you page (eg. index.php)
- Save the form.
- Create a new menu item from Menu > Main Menu > JForms > Standard forms and fill the Select Form field.
Now that you’ve a form, you can use it from your site (click on menu item written created on (4) ).
If you have to link two forms together (eg. Customers -> Company), you have to use the DBList field.
- Create the Firm form
- Create the Customers form
- On Customers form add a DBList field
DB List field must have these values:
| Table name | #__jforms_9c7aa |
| Field key | id |
| Field value | hcf94 |
| Field sort | hcf94 |
- Table name is the table name (mydbprefix_jforms_9c7aa) with the placeholder #__ instead of mydbprefix_.
- Field key is id. The form select value will be set to an univocal id instead of the raw value.
- Field value: value as displayed by the user.
- Field sort: sort the list by this field.
HTML result:
<select style="width: 70px;" id="h4443_14" name="h4443[]"> <option selected="selected" value="1">Barilla</option> <option value="2">Parmalat</option> </select>
When creating a new customer, you’ll see a dropdown with a list of companies from the Company table and the two forms are connected.
See also:
- JForms
- visual howto
- http://jforms.mosmar.com/wiki/0.7/elements/dblist (partially wrong howto)
Disable autocomplete for keyup on jQuery
There’s an event I cannot handle on jQuery: the Firefox autocomplete on textarea.
If you have to use the keyup event for a string match on textarea content, you have to exclude autocompletion, that is out of keyup logic.
To do this, simply add:
$(‘#myelement’).attr(‘autocomplete’, ‘off’);
to your jQuery. Autocomplete will be disabled and the unhandled event will not fire.
See also:
Reinstalling Windows keeping GNU/Linux partition safe
Tested with:
- Windows Vista
- Ubuntu 9
- (on the same disk, different partitions)
Today I’ve to reinstall Windows. I’ve already an installation of GNU/Linux (Ubuntu) on the same disk. I have to worry? In the past, I had to say a big YES. And since I do a Windows reinstall every 2-3 years, this carry back something from previous times.
(Please skip this paragraph.)
When I was a little boy, the best processor I was dreaming was Pentium 133Mhz, PCs were assembled in my country and my days was filled with Duke Nukem 3d and Lucas Arts adventures, well in that days I had a freaking fear to lose all my precious savegames and BASIC experiments due to a disaster. I discovered a real MBR disaster several years later, with Mandrake and Windows 98.
Well, now things are easier.
- Backup your files from Windows (Lucas Arts adventures savegames too…).
- Reinstall that crappy OS that you had to have to play some games to the partition that it deserves.
- After the operation Your Master Boot Record is gone, GRUB is gone. Linux, where are you??
- Download Super Grub2 Disk.
- Take an old CD-RW (that one with the photos of your sister kitten that she loves so much), erase it and burn the bootable iso on it.
- Now follow the instruction from the website. I’ve followed these steps:
- Select Detect any OS. On the next window, select your GNU/Linux distribution, identified by the kernel version (the more recent version is usually the right).
- Now that your distro is successfully running (i.e. Ubuntu), you have to rebuild the Grub bootloader, putting it on the MBR of the disk.
- Open a shell and type:
sudo -i
grub-install /dev/sda
Where /dev/sda is the device for the disk where the two OS are. If you have doubt, use tools like gparted to inspect your disk searching for the right device identifier.
update-grub - After restart, Grub is running again! So Windows is reinstalled without even touching Ubuntu.
If you’re also interested on changing grub boot sequence order, follow this howto.
Localize date format using i18n
Tested on:
- Drupal 6.16+
- Date API 6.x-2.4
- Internationalization 6.x-1.3
Any date format is stored as system variable (on the global $conf variable).
Since Internationalization module allows to declare some system variables as Multilingual, you could add to your $conf['i18n_variables'] on settings.php these lines to use different date format for different languages:
$conf['i18n_variables'] = array( // Other variables // bla bla bla // Date variables 'date_format_long', 'date_format_medium', 'date_format_short', 'date_first_day', );
date_format variables are Long, Medium and Short date format, used in many places (including Views).
date_first_day is the first day displayed on calendars (e.g. Sunday for English, Monday for Italian).
Note that you have to save the value twice via:
http://example.com/it/admin/settings/date-time
http://example.com/en/admin/settings/date-time
And one more time:
http://example.com/it/admin/settings/date-time
After the first time, you can change format as you like without double checking.
See also:
Site off-line error after changing mysql to mysqli on Drupal
Sometimes Drupal try to access MySQL using a wrong socket, i.e. /tmp/mysql.sock.
There are two solutions: creating a symbolic link from the wrong location to the right location, or change the php.ini (es. /etc/php.ini) to point to the right socket:
mysqli.default_socket = /var/lib/mysql/mysql.sock
This solution is more reliable, since the symbolic link to socket should be recreated at any system boot on solution #1.
See also:
Disable file system check on boot
Sometimes you want to disable time-based automatic check on your filesystems on boot. To do so, you can use the tune2fs utility with the following command:
tune2fs -c0 -i0d /dev/mydev
Where /dev/mydev is your device.
See also:
How to edit a PDF file with Open Office
Some months ago I’ve looked for a decent PDF editor for Linux. Results? Only an application called PDFedit was interesenting enought.
Now, an extension (plugin) for the cross platform suite Open Office called PDF Import do the magic with a nice PDF import for Open Office Draw.
I’ve tested it on a simple PDF document (v. 1.0.1) and the result is amazing. With Open Office, you can rewrite a PDF, save it as Draw document and export the modified version as PDF format with the handy PDF conversion tool.
Since PDF is a widely used format, you can use tool like this to download documents that require some changes before print (e.g. a paper form) without awful cut-and-paste onto an editor.
Related links:
- http://sourceforge.net/projects/pdfedit/ a PDF editor for Linux / cygwin
- http://extensions.services.openoffice.org/project/pdfimport an extension to open and modify PDF with Open Office
***
Happy GNU Year to all readers, I’m glad of all of the the 100k visits of this little blog!
How to automatically translate your Drupal module
You’ve created your module. But how to translate it into different languages?
Tested with:
- Translation template extractor 6.x-3.0
- Drupal 6.x
- English default + Italian translation
Prerequisites:
- Another language active apart default (English)
- Use t() function for all translatable string, including ones on
my_funny_module.admin.inc(Administration interface).
If you use t() function correctly on your module, you can create your own translation using the handy Translation template extractor module.
- Download and install Translation template extractor module.
- Create a directory named “translations” within
my_funny_moduledirectory (your module directory) - Go to
admin/build/translate/extract - Select your module from Directory lists
- Select “Language independent template” and click “Extract”
- Save file to
my_funny_module/translationsdirectory asmy_funny_module.pot - In the same screen, select “Template file for Italiano translations” (where Italiano is your destination language)
- If you’ve already translated some strings into Italiano language, check “Include translations” to include these strings
- Click “Extract”, and save file to
my_funny_module/translationsdirectory asit.po, where “it” is the ISO 639-2 code for Italiano language - You can add information about translation changing the first part of both files (translator mail, name, etc.)
Now, when you install your module translation strings will be added automatically. If you apply some changes to these files, and in any case the first time you complete this procedure on an active module, you have to refresh translation cache. To do this, go to admin/build/translate/refresh and use Refresh strings and Update translations after you’ve checked all boxes. If problem persists (strings are not updated or you got some weird errors), try to reinstall your module.



Recent Comments