Get MAC address from file system

On Debian based Linux distributions you can get the MAC address of the respective network adapter from the filesystem like shown below: $> cat /sys/class/net/wlan0/address # WLAN adapter $> 81:82:83:4:85:86 $> cat /sys/class/net/eth0/address # LAN adapter $> 1a:1b:1c:1d:1e:1f As you can see, all adapters have their own folder under  /sys/class/net/ that contains  a address file with the corresponding MAC […]

Cherry picking

Sometimes it is necessary to merge partial changes from one branch into another. Therefor you can use cherry-picking and merge a chosen commit into the actual branch: $> git cherry-pick a686df3 [sprint-04 39f1473] FZMP-993- Download actual db 2 files changed, 88 insertions(+), 43 deletions(-) create mode 100644 tools/mina/config/deploy_db.rb  

Change config during runtime

Sometimes you need to change the Magento configuration during runtime. For example this is the way to temporarily disable the category flat tables <?php Mage::app()->getCacheInstance()->banUse(‘config’); //better switch of config cache Mage::app()->getStore()->setConfig(‘catalog/frontend/flat_catalog_category’, “0”); // … Do wired stuff … Mage::app()->getStore()->setConfig(‘catalog/frontend/flat_catalog_category’, “1”); Attention: You have to reindex categories afterwards!!!

Disable usage of flat tables for categories via code

<?php $oCategoryCollection = Mage::getModel(‘catalog/category’, array(‘disable_flat’ => true))->getCollection(); That’s it! Now the “normal” entity tables are used. That work’s because the field disable_flat decides what kind of collection is loaded in the constructor of Mage_Catalog_Model_Category: <?php class Mage_Catalog_Model_Category extends Mage_Catalog_Model_Abstract { //… /** * Initialize resource mode * * @return void */ protected function _construct() { // […]

Install Arch-Linux on a Raspberry Pi

Arch Linux is a very clean and lightweight Linux distribution. With the following steps you can install it on a SD-Card to run it on a Raspberry Pi: Get the device name (dev-path) of the SD-Card to run the operating system (see Get a list of partitions or List, partitioning and format drives) $> sudo fdisk -l […]

Simulate store to set or get store specific values

In earlier Magento versions it was quite difficult to set or read store specific values on entities. In most cases you have to set the store on the whole application instance like that: <?php Mage::app(STOREID)->setStore(STOREID); … $oProduct->setStore(STOREID); … $oCollection->setStore(STOREID); Sometimes it was even necessary to add the store  to entities or collections it-selves too. Now (at least […]

Copy SD-Card with all partitions

To copy a SD-Card to another one including all partitions yo can take the following steps: Find out the device name (f.e.: /dev/mmcblk0): see List, partitioning and format drives or see Get a list of partitions or see Get free disk space and partitions Copy the whole card to an imagefile (Backup): $> sudo dd if=/dev/mmcblk0 of=backup_pi.img bs=4M […]

Apache Cache Headers

Here are some nice Apache configuration entries that will increase your website performance. They can be placed in a .htaccess file: <IfModule mod_headers.c> ## # Add a Vary Accept-Encoding header for the compressed resources. If you # modify the file types above, make sure to change them here accordingly. ## Header unset ETag # Header set […]