• 16ago
    Categories: Programming Commenti disabilitati

    A small example of javascript and css to achieve the stretch effect of a background image in website design. It's very simple and it does not require any library; yet it won't work with IE6 ("and who cares?" I'd say...)

    Source code:stretch_bg.tar.gz

    Stretch background script

    Stretch background script

  • 16ago
    Categories: Hardware & Software Commenti disabilitati

    Two small steps to fix the problems had in suspending and resuming, which can be noticed using Fedora on many Sony VAIO:

    1. System hangs after suspend/hybernate
    2. The keyboard is not responding after resume/thaw

    1. Avoid hang
    UPDATE 2010/12/13: As of Fedora 14,  a built in script will deal with the deactivation and subsequent reactivation of problematic modules. It's name is /usr/lib/pm-utils/sleep.d/75modules.

    It only needs to be setup by creating a configuration file:
    sudo nano /etc/pm/config.d/modules

    If you wish to know how to identify the problematic modules, fedoraproject wiki is the place to go. In my case SD card reader turned out to be the cause of the hang, so I specified the following content:

    SUSPEND_MODULES="sdhci-pci"
    export SUSPEND_MODULES
    2. Rebind keyboard

    Recently a kernel parameter was introduced to rebind keyboard after resume, putting the word end to this long term bug. So all you have to do is (UPDATE 2012/04/18 for grub2)

    sudo nano /etc/default/grub

    and append  atkbd.reset to the kernel line, like this:

    GRUB_CMDLINE_LINUX="... atkbd.reset"
    Don't forget to run grub2-mkconfig. Consequently, the system will take care of resetting the driver on resume.

    Sources:
    http://thesopebocks.com/2009/07/26/running-a-script-on-suspend-and-wake-fedora/
    https://bugs.launchpad.net/ubuntu/+source/linux/+bug/59867/comments/102

  • 21giu
    Categories: Hardware & Software Commenti disabilitati

    There is a script which allows to bind ACPI events to backlight intensity, so that Fn+F5/Fn+F6 will work. Thing, this one, that doesn't happen out of the box. Not only, the resource offers a wide coverage of common problems of Sony Vaio Z-Series laptops and Ubuntu, but still were appliable to my setup.

    Link: LCD brightness controll with the acpi_create_nv_event script

    Tags: ,
  • 29mar
    Categories: Hardware & Software Commenti disabilitati

    1) Retrieve localhost interface
    $ ifconfig vmnet1 | grep "inet "
    inet XXX.XXX.XXX.YYY  netmask 255.255.255.0  broadcast XXX.XXX.XXX.255

    2) Configure VM Settings > Network Adapter > Network Connection: NAT

    3) Add entry in C:\Windows\System32\drivers\etc\hosts
    XXX.XXX.XXX.YYY        fedorahost

    4) Be aware that not all ports are opened on the host machine. For instance, access to weblogic default port (7001) should be enabled:
    sudo iptables -I INPUT -p tcp --dport 7001 -j ACCEPT

    5) It might be useful to restart the HTTP server on the host machine. Then, browse to  http://fedorahost

  • 25feb
    Categories: Blurbs Commenti disabilitati

    I firmly believe that internet is one of the few, last independent media in my country, Italy. The sentence against a bunch of Google executives for hosting a video that shown violence against a down guy, is another step forward toward regime.
    This is not an ethical or privacy problem as it is passed for. It's unacceptable to ask pre-emptive control of the uploaded medias by the company or worse, by some "parliament" organs.
    Of course, it should not be in the funniest videos; but as soon as Google was notified, the video was removed and here end their duty.
    Furthermore, it's crucial that documents that show uncivil behaviors are exposed to the critics of the public attention.
    Because you would expect WE (internet users) judge it as wrong and immoral and WE take consciousness of the situation that surround us.
    Depicting our own country as "il bel paese", "lo paise du sole" ("The beautiful country", "The country of sunshine" (slang)) sure hasn't helped us to face problems yet.googleitalia

    Tags: ,
  • 15feb
    Categories: Hardware & Software Commenti disabilitati

    Project hamster

    Project hamster

    A nice gnome applet for time tracking. It was not immediate to find so maybe worth reporting.

    Link: http://live.gnome.org/ProjectHamster

    Tags: ,
  • 16dic
    Categories: Hardware & Software Commenti disabilitati

    Problem is the 4GB maximum file size limit of FAT32. As this thread states:

    dd if=/dev/hda | gzip -c | split -b 2000m - system_drive_backup.img.gz.

    will create chunks of 2MB each. Then, to restore:

    cat system_drive_backup.img.gz.* | gzip -dc | dd of=/dev/hda

    Tags: ,
  • 15dic
    Categories: Hardware & Software Commenti disabilitati

    Could happen that 1024MB RAM is too few for a virtual machine, and an intensive guest process (more then 2h of elaboration) runs out of memory. But if raising the vm RAM quantity doesn't change a thing, if it runs out of memory when the system has memory, then there is another problem. And here is the solution.
    Basically, adding the following lines

    MemTrimRate=0
    sched.mem.pshare.enable = "FALSE"
    mainMem.useNamedFile = "FALSE"
    prefvmx.minVmMemPct = "100"

    to the virtual machine configuration (mine is ~/vmware/[machine-name]/[machine-name].vmx), will result in faster memory allocation... et voilà!

  • 28ott
    Categories: Hardware & Software Commenti disabilitati

    VMWare 7 features:

    http://www.vmware.com/products/workstation/new.html

    Features hardware accelleration in virtualized graphic adapter using Microsoft WDDM driver. That was the most acceptable solution instead of using WARP, anyway.. kudos to them.

    Download (need to have an account)

    http://downloads.vmware.com/d/info/desktop_downloads/vmware_workstation/7_0

    It is a 30-day evaluation of VMWare Wotkstation. VMWare player will keep running after that time.

    Screenshot (No Gimp here :P)

    Windows 7 with aero in a host operating system Fedora 11

    Windows 7 with Aero in a host operating system Fedora 11

  • 12gen
    Categories: Programming Commenti disabilitati

    Field definition. Here are the form field definitions; in this case they are inserted in a form alter hook.
    UPDATE 2010/2/16: Note that every combobox is linked onblur with the next one and on focus with the previous one.
    UPDATE 2010/4/12: Download the source code .

    1. function module_form_alter(&$form, $form_state, $form_id) {
    2. if($form_id == "target_form_id") {
    3. $form['field_parent']=array(
    4. '#type' => 'textfield',
    5. '#title' => t('Parent'),
    6. '#autocomplete_path' => 'autocomplete/parent',
    7. '#attributes' => array('onblur' => 'parentSelected($(this));')
    8. );
    9.  
    10. $form['field_child']=array(
    11. '#type' => 'textfield',
    12. '#title' => t('Child'),
    13. '#autocomplete_path' => 'autocomplete/child',
    14. '#attributes' => array('onfocus' => 'parentSelected($("#edit-field-parent"));'),
    15. );
    16. }
    17. }

    Client side script. When a value for the parent textfield is selected, the available values for the child textfield are restricted in a range (this is why they are linked, right). This is done altering the autocomplete path of the child

    1. function parentSelected(parent) {
    2. // Get the url from the child autocomplete hidden form element
    3. var url = $("#edit-field-child-autocomplete").val();
    4. // Alter it according to parent value
    5. url = url.replace(/\?q=autocomplete(.*)/, "?q=autocomplete/child")+"/"+parent.val();
    6. // Recreate autocomplete behaviour for the child textfield
    7. var input = $('#edit-field-child').attr('autocomplete', 'OFF')[0];
    8. recreateAutoComplete(input, url);
    9. }
    10.  
    11. function recreateAutoComplete(input, url) {
    12. $(input).unbind();
    13. var acdb = new Drupal.ACDB(url);
    14. $(input.form).submit(Drupal.autocompleteSubmit);
    15. new Drupal.jsAC(input, acdb);
    16. }

    The menu hook. The parent textfield is defined like a normal autocomplete callback, while the child's one accept a parameter from the url.

    1. function module_menu(){
    2. $items['autocomplete/parent'] = array(
    3. 'title' => 'Parent textfield autocomplete',
    4. 'page callback' => 'module_autocomp_parent',
    5. 'access callback' => TRUE,
    6. 'access arguments' => array('access content'),
    7. 'type' => MENU_CALLBACK
    8. );
    9.  
    10. $items['autocomplete/child'] = array(
    11. 'title' => 'Child textfield autocomplete',
    12. 'page callback' => 'module_autocomp_child',
    13. 'page arguments' => array(2,3),
    14. 'access callback' => TRUE,
    15. 'access arguments' => array('access content'),
    16. 'type' => MENU_CALLBACK
    17. );
    18. }

    Autocomplete callback. The autocomplete callback for the child is enabled to receive as first parameter the value specified in the parent textfield

    1. function module_autocomp_child($parentValue, $childValue) {
    2. }