Extracting data from Brother P-Touch Label Printer .lbx Files.

We recently had to extract barcode data from a large directory of .lbx files, which is the file format used by Brother P-Touch Label Printer software. We could have found the software, opened each file in turn and cut and pasted the data into a spreadsheet, but this didn’t seem very efficient.

Opening the files in a text editor revealed that .lbx files are actually standard zip files – if you change the extension from .lbx to .zip you can open them up to reveal two files inside – label.xml and prop.xml, both standard XML files. The contents of the label can then be found by opening the label.xml file and looking for a node called ‘pt:data’.

We wrote a quick and dirty PHP 5.2 script that extracts all the label data and displays it in a basic html table:

// Eg my_web_server_dir/data_dir/labels
$labelsDirectory = 'labels';

echo '<table>';

foreach (new DirectoryIterator($labelsDirectory) as $fileInfo) {

if ($fileInfo->isDot() || (!stripos($fileInfo->getFilename(),'lbx'))) {
continue;
}

$zip = zip_open($labelsDirectory . '/' . $fileInfo->getFilename());

do {

$entry = zip_read($zip);

if (!is_resource($entry)){
continue;
}

$entryName = zip_entry_name($entry);

if (trim((string)$entryName) != 'label.xml') {
continue;
}

$entryContent = zip_entry_read($entry, zip_entry_filesize($entry));

$xml = simplexml_load_string($entryContent);

$matches = $xml->xpath('//pt:data');

$barcode = '????';

if (isset($matches[0])) {
$barcode = $matches[0]->__toString();
}

echo '<tr><td>' . str_replace('_', ' ', str_replace('.lbx', '', $fileInfo->getFilename())) . '</td><td>' . $barcode . '</td></tr>';

} while ($entry);

}

echo '</table>';

How To Connect Phone To Mazda Mx3 via bluetooth

My friend has a reasonably new Mazda MX3.  Unfortunately she could not get her phone to connect to the Mazda’s bluetooth.  The main problem was that the Mazda bluetooth never appeared as a device on her iPhone.   She asked me to help and we followed the instructions in the manual.  The instructions for connecting a phone via bluetooth are:

  • Get your phone out and enable bluetooth
  • Navigate through the menu on the car
  • Select ‘BT Setup’ – annoying the last item in the menu
  • Select ‘Pair Device’
  • You are then offered a pin (by default 0000).
  • You should then see the car appear as a device on your phone (by default Mazda).
  • You then theoretically click on Mazda and then enter the pin.
  • You should then be connected…

The problem for us was that the Mazda never appeared as a device.   This means you can’t select it on the phone and the car just shows an ‘Err’ message during the BT setup process.   If you Google around for solutions, they all say you need to reset you whole car by disconnecting the battery or go to a dealer.  Well, who wants to do that!

The Solution

The solution we found was to setup the phone through the voice command system.   So, this is how to connect your phone to a Mazda via bluetooth.

  • Hold down the phone button on the steering wheel.
  • The car should go into ‘Listening’ mode and you then need to speak to it.
  • Say ‘Pairing options’
  • Then follow the instructions all the way through to the end which finishes with giving a name for your phone (you can make this up).  Please note – don’t give up too early (even if you think you have completed) because unless you name you phone it won’t be able to connect.

Voila – you should finally have connected your iPhone to your Mazda bluetooth.  I hope this helps someone.

How to stop Siri and voice control from lock screen on iphones

It seems to be a common problem that people want to stop accidentally making a request to Siri or using the voice control when the phone is locked. I’ve been in meetings when at least four different people have checked their iphone, launched Siri and then had their phone announce to the room ‘I’m sorry there is no match for that’.  So here is how to disable Siri and voice control from a locked iPhone.

Step 1 – Turn on Siri – Counter intuitively having Siri enabled will give you the controls you need to stop Siri and voice control being started from the lock screen. Go to Setting -> General -> Siri and toggle enable.

general_settings_to_enable_siri_and_block_it_from_lock_screenselect_sirienable_siri_to_turn_off_siri

 

 

 

Step 2 – Turn off Siri from the lock screen. Go to Setting -> Passcode -> disable Siri.

select_passcode_to_turn_off_siridisable_siri_from_locked_screen

Voila.

If you have disabled Siri completely then you won’t have this control and there isn’t a toggle  for voice control in the same way. Hope this is helpful.