Welcome on panticz.de!

linux_cube

Compile IPFire

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 byacc make python-urlgrabber bison gawk texinfo autoconf screen

git config --global color.ui auto

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

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

ln -sf /bin/bash /bin/sh
./make.sh build

http://wiki.ipfire.org/de/development/git
http://wiki.ipfire.org/de/development/build

Install IpFire on SheevaPlug

# download IpFire image
wget http://downloads.ipfire.org/releases/ipfire-2.x/2.13-core67/ipfire-2.13.1gb-ext4.armv5tel-full-core67.img.gz -P /tmp/
 
# copy image to USB pen (do NOT use sdcard, i´t will not boot)
sudo su
zcat /tmp/ipfire-2.13.1gb-ext4.armv5tel-full-core67.img.gz > /dev/sdb
sync
 
# plug usb pen to SheevaPlug and connect power cable
 
# connect to terminal
sudo apt-get install cu
sudo chown uucp /dev/ttyUSB0; sudo cu -s 115200 -l /dev/ttyUSB0
 
# boot from usb
setenv bootcmd_usb 'usb start; fatload usb 0:1 0x6400000 /uImage-ipfire-kirkwood; fatload usb 0:1 0x6600000 /

JavaScript / AJAX file upload

# add this code snipset to your homepage and customize path to upload.php
<img src="http://cdn1.iconfinder.com/data/icons/metro-uinvert-dock/256/MS_Office_Upload_Center.png" id="dropzone" title="Upload">
<script src="http://raw.github.com/enyo/dropzone/master/downloads/dropzone.js"></script>
<script type="text/javascript">
var myDropzone = new Dropzone("#dropzone", {url: "upload.php"});
myDropzone.on("success", function(file) {
    location.reload();
});
</script>
 
# create upload.php on your webserver
<?php
$DIR = "upload";
if(!empty($_FILES)) {
    // move file to upload direct

Drupal: Access control

Download, extract, copy content_access directory to:
/sites/all/modules

Enable node access control:
Administration > Structure > Content types > Basic page > Access control
/admin/structure/types/manage/page/access
Check "Enable per content node access control settings"
Submit

Link
http://drupal.org/project/content_access

IpFire direct installation from network (iPXE)

iPXE command
chain http://mirror1.ipfire.org/releases/ipfire-boot/latest/gpxe.kpxe

Use Core 65 because of network kernel modules bug in 66 and 67!

more iPXE chains
http://preseed.panticz.de/ipxe/ipxe.menu.install

Links
http://wiki.ipfire.org/de/installation/pxe
http://mirror1.ipfire.org/releases/ipfire-boot/latest/
http://planet.ipfire.org/post/introduction-to-boot-ipfire-org

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 Debian Wheezy DomU

# configure domU
[ -z $DOMAIN_NAME ] && DOMAIN_NAME=wheezy
[ -z $DOMAIN_MAC ] && DOMAIN_MAC=00:10:01:01:aa:bb
[ -z $DOMAIN_RAM ] && DOMAIN_RAM=2Gb
[ -z $DOMAIN_HDD ] && DOMAIN_HDD=8Gb
 
# create domU on LVM (for image file use --dir=/root)
xen-create-image --hostname=${DOMAIN_NAME} \
--dist=squeeze --lvm=vg1 --size=${DOMAIN_HDD} --fs=ext4 --role=udev \
--memory=${DOMAIN_RAM} --swap=${DOMAIN_RAM} \
--dhcp --mac=${DOMAIN_MAC} --genpass=0 --password=t00r \
--vcpus $(cat /proc/cpuinfo | grep processor | wc -l)
 
# rename vm config
mv /etc/xen/${DOMAIN_NAME}.cfg /etc/xen/${DOMAIN_NAME

Grml iPXE Netboot

# downlaod Grml image
wget http://download.grml.org/grml32-small_2013.02.iso -O /tmp/grml32-small_2013.02.iso
 
# mount image
mount /tmp/grml32-small_2013.02.iso /mnt/ -o loop
 
# copy Grml files to tftpboot
mkdir /var/lib/tftpboot/live/grml/32-small/
cp /mnt/boot/grml32small/initrd.img /var/lib/tftpboot/live/grml/32-small/
cp /mnt/boot/grml32small/vmlinuz /var/lib/tftpboot/live/grml/32-small/
cp /mnt/live/grml32-small/grml32-small.squashfs /var/lib/tftpboot/live/grml/32-small/
 
# configure NFS
echo "/var/lib/tftpboot/live/grml/32-small    *(ro,no_root_squash,async,no_subtree_check)

Magento: Replace broken Webservicex.net currency exchange with Yahoo finance

# go to your Magento installation
cd /var/www/
 
# create Yahoofinance.php
mkdir -p ./app/code/local/JT/Directory/Model/Currency/Import/
wget http://www.panticz.de/sites/default/files/magento/CurrencyExchange/Yahoofinance.php -O ./app/code/local/JT/Directory/Model/Currency/Import/Yahoofinance.php
 
# update configuration
# (TODO): create module configuration xml
# add bevore end of the global node in ./app/etc/local.xml
 
--- /var/www/app/etc/local.xml.org	2010-07-23 13:07:49.000000000 +0200
+++ /var/www/app/etc/local.xml	2013-04-13 10:01:51.000000000 +0200
@@ -49,6 +49,16 @@
 
Syndicate content