Linux software RAID

# create software raid
apt-get install -y mdadm parted --no-install-recommends

# view discs
lshw -short -c disc

# old
for DEV in sda sdb; do
umount /dev/${DEV}1
parted /dev/${DEV} -s rm 1
#parted /dev/${DEV} -s rm 2
#dd if=/dev/zero of=/dev/${DEV} bs=1M count=1
parted /dev/${DEV} -s mklabel msdos
parted /dev/${DEV} -s mkpart primary 1 256G
#parted /dev/sda -s mkpart primary 256G 128G
done

# new
for DEV in /dev/sd{a..b}; do
parted ${DEV} -s rm 1
parted ${DEV} -s mklabel msdos
parted ${DEV} -s mkpart primary 2048s 100%
parted ${DEV}

Fedora

# list groups
sudo dnf grouplist -v
MATE Desktop (mate-desktop-environment)
Minimal Install (minimal-environment)
Web Server (web-server-environment)

# additional repo
rpm -ivh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm

# install MATE desktop
dnf install @mate-desktop-environment -y
systemctl set-default graphical.target

# install applications
sudo dnf install -y ansible lxc* eclipse libreoffice smartmontools terminator docker thunderbird firefox

# Fedora PXE install
mkdir -p /var/lib/tftpboot/fedora/17

wget ftp://ftp.uni-kl.de

Compile IPFire (on 32bit system)

sudo apt-get install -y git
#sudo apt-get install -y git-core gcc g++ realpath make patch bzip2 byacc python-urlgrabber bison gawk texinfo

sudo apt-get install -y git-core g++ realpath patch make python-urlgrabber bison gawk texinfo autoconf screen
# byacc
wget http://mirrors.kernel.org/ubuntu/pool/universe/b/byacc/byacc_20130925-1_i386.deb
dpkg -i byacc_20130925-1_i386.deb

git config --global color.ui auto

# check out source
git clone git://git.ipfire.org/ipfire-2.x.git

ln -sf /bin/bash /bin/sh

cd ipfire-2.x/
./make.sh downloadsrc
./make.sh gettoolchain

Java: Add autocompletion to a (editable) JComboBox

1. Download this source code and add to your Java project:
http://www.orbital-computer.de/JComboBox/source/AutoCompletion.java

2. Add folowing code to enable autocompletion for your JComboBox:
AutoCompletion.enable(yourComboBox);

For further information about JComboBox and AutoCompletion see:
http://www.orbital-computer.de/JComboBox/
https://today.java.net/pub/a/today/2007/07/19/adding-auto-completion-to-swing-comboboxes.html

Create Oracle 10 XE Xen DomU domain

# download debian 32 bit domU installer
wget http://ftp.debian.org/debian/dists/squeeze/main/installer-i386/current/images/netboot/xen/initrd.gz -O /tmp/initrd.gz
wget http://ftp.debian.org/debian/dists/squeeze/main/installer-i386/current/images/netboot/xen/vmlinuz -O vmlinuz

# create lvm for domU
lvcreate --name oracle-disk --size 16G vg1
lvcreate --name oracle-swap --size 16G vg1

# create domU config for installation
cat < /etc/xen/oracle
kernel = '/tmp/vmlinuz'
ramdisk = '/tmp/initrd.gz'
vcpus = '2'
memory = '2048'
root = '/dev/xvda2 ro'
di

Compile extundelete

DIST=$(lsb_release -cs)
echo "deb http://archive.ubuntu.com/ubuntu/${DIST} restricted main multiverse universe" > /etc/apt/sources.list.d/${DIST}.list
apt-get update
sudo apt-get install -y extundelete

#
# old
#
# install apps
sudo apt-get -y install build-essential e2fslibs-dev

# download
wget http://kent.dl.sourceforge.net/project/extundelete/extundelete/0.2.0/extundelete-0.2.0.tar.bz2 -P /tmp

# extract
tar xjf /tmp/extundelete-0.2.0.tar.bz2 -C /tmp

# compile
cd /tmp/extundelete-0.2.0
./configure
make
# make install

# restore files
/tmp/extundelete-0.2.0/src/ex

Magento: Redirect to product in specific language

# create a new file ./getProductEn.php
<?php
require '../../app/Mage.php';

try {
$app = Mage::app('gb');

// check sku
$sku = $_GET['sku'];
if(!empty($sku)) {
// filter char in sku
$sku = preg_replace("/[^a-zA-Z0-9-\s]/", "", $sku);

// get product by sku
$product = Mage::getModel('catalog/product')->loadByAttribute('sku', $sku);

if($product != null) {
header('Location: '. $product->getProductUrl() .

Magento: featured items

./app/design/frontend/default/default/template/catalog/product/featured.phtml
<?php
$URL="http://www.panticz.de/sites/default/files/magento/featured/featured.phtml";
echo "

";
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $URL);
echo htmlspecialchars(curl_exec($c));
curl_close($c);
echo "

";
?>

Create cms page
Admin > CMS > Pages > Add new page
Page Title: featured
URL Key: featured
Content: {{block type="featured/featured" name="product_featured" as="product_featured" template="catalog/product/featured.phtml"}}

view on other page
<?php
$URL="http://www.panticz.de/sites/default/files/magento/featured/featured.view.phtml";
echo "

";
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $URL);
echo htmlspecialchars(curl_exec($c));
curl_close($c);
echo "

";
?>

Links
http://inchoo.net/ecommerce/magento/featured-products-on-magento-frontpage/