Wednesday, 4 May 2016

Importing Bookmarks to Chrome from another Chrome installation

If you need to import your bookmarks to a new installation of Chrome, unless you log into your Chrome account, I found the task to be not so easy to find. You may need this when you switch to a new computer.

Version 50.0... on Windows 7 has 2 options when you try to import Bookmarks from the Menu Bookmarks > Import Bookmarks and configuration...:

  1. Microsoft Internet Explorer
  2. HTML Bookmarks file
The first option is quite useless, unless what you want to import are the Bookmarks and Settings from the Internet Explorer installed for the same user account as you logged in. I needed to import them from a disk from another computer, so this option is a no go.

The second option appears to be more general, but useless for my case: Chrome to Chrome.

So, the bookmarks file for Chrome on Windows 7 is installed in the file C:/Users/Your-Username/AppData/Local/Google/Chrome/User Data/Default/Bookmarks. You only need to

  1. Close Chrome.
  2. Replace your current Bookmarks file with the old one
  3. Start Chrome
The current Bookmarks are replaced with the old ones.

Saturday, 23 April 2016

Debugging module installation on Drupal 7 with NetBeans

After following Configuring NetBeans, a very informative post on Drupal, I could still not debug my module on NetBeans 8.1. My main problem was that the breakpoints set on any of my module's files appeared as broken. In order to fix this, I needed to let NetBeans know which server request calls the module's code.

The Server request


Using Chrome's "Inspect" feature on the /admin/modules page after enabling my module and submitting the form, I found out that the module installation was being initiated by a POST request to "http://.../admin/modules/list/confirm".

I had created an apache virtual site to host it. On NetBeans, I included the whole Drupal 7 web tree as the project source (var/www/drupal7), and modified the project's Run Configuration accordingly (right click on the project's name > Properties):

NetBeans Project Properties - Run Configuration
Project Properties - Run Configuration
On the Advanced... settings window, I added the following Path Mapping:
  • Server Path: http://mylocalserver.local/admin/modules/list/confirm
  • Project Path: click on the ... and browse to the directory where your module is installed: /var/www/drupal7/sites/all/modules/my_module

Project Properties - Run - Advanced Web Configuration
Project Properties - Run Configuration - Advanced...


After this, the break points set on the files under .../my_module appeared and worked just fine.

Friday, 25 March 2016

IIS Installation... no static content by default

I recently discovered that my initial installation of IIS 7.5 on Windows 7 professional didn't include basic features like serving static content... surprise!

So I reinstalled IIS following this guide on iis.net. On point number 7 of that page, it describes how to enable "Common Http Features" that are not enabled by default like: Directory browsing, or Static Content. This is the part I had missed before, I couldn't imagine that the default installation didn't include these basic features.

Thursday, 18 June 2015

Back up my laptop task... even when it's off


I changed my backup software of choice from dejadup to Back In Time a couple of months ago, hoping I could have unattended back ups of two laptops, once a month, even if the laptops were turned off when the time came.

Back In Time uses cron to schedule a task at regular intervals. The problem is, if the laptop is turned off, or suspended when the task is supposed to activate, it never runs.

To work around this problem a second task could be scheduled so that it checks whether the scheduled back up took place, and starts it when it hasn't.

The first thing to check is whether Back In Time offers any way to check the last back up... yeap!

$ backintime --last-snapshot

Back In Time
Version: 1.0.34

Back In Time comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions; type `backintime --license' for details.

INFO: Mountpoint /tmp/backintime/.../mountpoint is already mounted
SnapshotID: 20150530-212330-282
INFO: Mountpoint /tmp/backintime/.../mountpoint still in use. Keep mounted


Also, we can check the crontab:

$ crontab -l
#Back In Time system entry, this will be edited by the gui:
0 0 1 * * /usr/bin/nice -n 19 /usr/bin/ionice -c2 -n7 /usr/bin/backintime --backup-job >/dev/null 2>&1

Now, we need to extract the last date backintime should have run from the crontab.

I can't find an easy way to do this yet...


Thursday, 22 January 2015

SQL Server Express 2014 for local connections

Amazingly, the default configuration for SQLServer Express does not enable local connections. To enable them:
  1. Open the Sql Server Configuration Manager. Available at All Programs > Microsoft SQL Server ... > Configuration Tools
  2. Under SQL Server Network Configuration > Protocols for SQLEXPRESS, enable Named Pipes and TCP/IP as needed.

Oh well.

Wednesday, 10 December 2014

Installing PortaShop locally on ubuntu 14.04

These are the steps I took:
  1. Install apache2, mysql, php5 and other requirements: php5-mysql, php5-mcrypt, and php5-gd.
  2. Create a database called "prestashop" and a database user qith all permissions on it.
  3. Download the site files at: http://www.prestashop.com/en/download. Mine were "prestashop_1.6.0.9.zip"
  4. Uncompress it and copy the top directory called "prestashop" to where the web application will be stored. I'll use "/path/to/prestashop" from now on.
  5. Make sure the permissions in the directory allow the web server user "www-data" to have full access to it. As root run:
    1. chgrp -R www-data /path/to/prestashop
    2. chmod -R g+rwx /path/to/prestashop
  6. Create a new virtual host with the name "dev.prestashop.local"
    1. Add the new host name to the hosts file, adding the line "127.0.0.1  dev.prestashop.local"
    2. Copy the file /etc/apache2/sites-available/000-default.conf to /etc/apache2/sites-available/prestashop.conf
    3. Modify its content to:
    4. <VirtualHost *:80>
      
       ServerName dev.prestashop.local
      
       DocumentRoot /path/to/prestashop
      
        <Directory /path/to/prestashop >
      
         Options Indexes FollowSymLinks MultiViews
      
         AllowOverride all
      
         Require all granted
      
        </Directory>
      
        ...
      
      </VirtualHost>
      
      
  7. Reload apache, running as root: service apache2 reload
When you browse to dev.prestashop.local you should be able to pass all the compatibility tests:

PrestaShop compatibility test passed

Saturday, 15 June 2013

Java: chocking on unexpected BOM

I found myself needing to run a java application that reads its configuration from a properties file. This app extracts data from a database. From the configuration file it's supposed to read the url to connect to the database, username and password... amazingly, it would complain with a very cryptic error message:

ERROR: conect Database
java.sql.SQLException: No suitable driver found for
    at java.sql.DriverManager.getConnection(DriverManager.java:602)
    at java.sql.DriverManager.getConnection(DriverManager.java:185)


What? no driver for ""... but the url is perfectly fine in the config file:
url=jdbc:oracle:thin://@localhost:1521/xe

After modifying the sources, recompiling the package, and running the new code to get the same error message... with extra debugging data I found out the source of the problem: JAVA!!!

Amazingly, if you edit the properties file in windows with the infamous notepad++, by default, it adds a useless and unnecessary BOM that makes java choke running the application or compiling the sources.

To be fair, adding a BOM to a UTF-8 encoded file is not necessary and not recommended by the standard, but I'd expect java to be more robust...