howto

warning: Creating default object from empty value in /data/web/1/000/027/003/273448/htdocs/panticz.de/modules/taxonomy/taxonomy.pages.inc on line 33.

Fix grub on btrfs partition

# mount the btrfs root subvolume
mount /dev/sda1 /mnt -o subvol=/

# (optional) set the default subvolume
btrfs sub set @ /mnt

mount /proc /mnt/proc --bind
mount /dev /mnt/dev --bind
mount /sys /mnt/sys --bind

chroot /mnt

grub-install /dev/sda
update-grub /dev/sda

# activate first partition
fdisk -l /dev/sda

Magento: Add upload field to contact form

wget -q http://dl.panticz.de/magento/contact_attachment/form.phtml.diff -O - | patch -p2 \
/var/www/app/design/frontend/default/default/template/contacts/form.phtml

--- /var/www/app/design/frontend/default/default/template/contacts/form.phtml.org	2013-11-11 17:35:28.000000000 +0100
+++ /var/www/app/design/frontend/default/default/template/contacts/form.phtml	2013-11-12 16:20:06.000000000 +0100
@@ -28,7 +28,7 @@
 <div class="page-title">
     <h1><?php echo Mage::helper('contacts')->__('Contact Us Form') ?></h1>
 </div>
-<form action="<?php echo $this->getFormAction(); ?>" id="contactForm" method="post">
+<form action="<?php echo $this->getFormAction(); ?>" id="contactForm" method="post" enctype="multipart/form-data"> 
     <div class="fieldset">
         <h2 class="legend"><?php echo Mage::helper('contacts')->__('Contact Information') ?></h2>
         <ul class="form-list">
@@ -68,6 +68,13 @@
                     <textarea name="comment" id="comment" title="<?php echo Mage::helper('contacts')->__('Comment') ?>" class="required-entry input-text" cols="5" rows="3"><?php echo $this->getRequest()->getParam('message');?></textarea>
                 </div>
             </li>
+            <li>
+                <label for="attachment"><?php echo Mage::helper('contacts')->__('Attachment') ?></label>
+                <div class="input-box">
+                    <input name="MAX_FILE_SIZE" type="hidden" value="2000000" />
+                    <input name="attachment" id="attachment" class="input-text" type="file" />
+                </div>
+            </li>
         </ul>
     </div>
     <div class="buttons-set">

wget -q http://dl.panticz.de/magento/contact_attachment/IndexController.php.diff -O - | patch -p2 \
/var/www/app/code/core/Mage/Contacts/controllers/IndexController.php

--- /var/www/app/code/core/Mage/Contacts/controllers/IndexController.php.org	2013-11-11 17:44:06.000000000 +0100
+++ /var/www/app/code/core/Mage/Contacts/controllers/IndexController.php	2013-11-13 11:34:56.000000000 +0100
@@ -91,7 +91,40 @@
                 if ($error) {
                     throw new Exception();
                 }
+
+                $fileName = '';
+                if (isset($_FILES['attachment']['name']) && $_FILES['attachment']['name'] != '') {
+                    try {
+                        $fileName       = $_FILES['attachment']['name'];
+                        $fileExt        = strtolower(substr(strrchr($fileName, "."), 1));
+                        $fileNamewoe    = rtrim($fileName, $fileExt);
+                        $fileName       = preg_replace('/\s+', '', $fileNamewoe) . time() . '.' . $fileExt;
+ 
+                        $uploader       = new Varien_File_Uploader('attachment');
+                        $uploader->setAllowedExtensions(array('jpg', 'png', 'bmp', 'gif', 'pdf', 'zip', 'rar'));
+                        $uploader->setAllowRenameFiles(false);
+                        $uploader->setFilesDispersion(false);
+                        $path = Mage::getBaseDir('media') . DS . 'contacts';
+                        if(!is_dir($path)){
+                            mkdir($path, 0777, true);
+                        }
+                        $uploader->save($path . DS, $fileName);
+ 
+                    } catch (Exception $e) {
+                        $error = true;
+                    }
+                }
+
                 $mailTemplate = Mage::getModel('core/email_template');
+                if($fileName != '') {
+                    $attachmentFilePath = Mage::getBaseDir('media'). DS . 'contacts' . DS . $fileName;
+                    if(file_exists($attachmentFilePath)){
+                        $fileContents = file_get_contents($attachmentFilePath);
+                        $attachment   = $mailTemplate->getMail()->createAttachment($fileContents);
+                        $attachment->filename = $fileName;
+                    }
+                }
+
                 /* @var $mailTemplate Mage_Core_Model_Email_Template */
                 $mailTemplate->setDesignConfig(array('area' => 'frontend'))
                     ->setReplyTo($post['email'])

wget -q http://dl.panticz.de/magento/contact_attachment/Mage_Contacts.csv.diff -O - | patch -p2 \
/var/www/app/locale/de_DE/Mage_Contacts.csv

--- /var/www/app/locale/de_DE/Mage_Contacts.csv.org	2013-11-13 15:57:34.000000000 +0100
+++ /var/www/app/locale/de_DE/Mage_Contacts.csv	2013-11-13 11:40:11.000000000 +0100
@@ -15,5 +15,6 @@
 "Send Emails To","Sende E-Mails an"
 "Submit","Absenden"
 "Telephone","Telefon"
+"Attachment","Anhang"
 "Unable to submit your request. Please, try again later","Fehler beim Übertragen der Anfrage. Bitte versuchen Sie es später noch einmal."
 "Your inquiry was submitted and will be responded to as soon as possible. Thank you for contacting us.","Ihre Anfrage wurde übertragen. Wir werden diese umgehend bearbeiten und uns gegebenenfalls mit Ihnen in Verbindung setzen. Vielen Dank!"

Links
http://www.blog.magepsycho.com/adding-upload-field-in-contact-form-and-send-as-attachment/
http://www.magentocommerce.com/boards/viewthread/440759/

Linpack under Ubuntu / Linux

wget -q --no-check-certificate https://raw.githubusercontent.com/panticz/installit/master/install.linpack.sh -O - | bash -

#!/bin/bash

URL=http://registrationcenter.intel.com/irc_nas/3914/l_lpk_p_11.1.2.005.tgz

# download
wget ${URL} -O /tmp/l_lpk.tgz

# extract
tar -xzf /tmp/l_lpk.tgz -C /tmp/

# copy linpack to /usr/share directory
cp -a /tmp/linpack_11.1.2/benchmarks/linpack/ /usr/share/

# create soft links to executables
ln -sf /usr/share/linpack/runme_xeon64 /usr/sbin/
ln -sf /usr/share/linpack/xlinpack_xeon64 /usr/sbin/

# adjust path in runme_xeon64
sed -i s'|./xlinpack_$arch lininput_$arch|/usr/sbin/xlinpack_$arch /usr/share/linpack/lininput_$arch|g' /usr/sbin/runme_xeon64

# get CPU info
CPU=$(cat /proc/cpuinfo | grep "model name" | tail -1)
COUNT=$(cat /proc/cpuinfo | grep processor | wc -l)
echo "CPU : $CPU"
echo "COUNT : $COUNT"

# OPTIONAL: configure parameter
# export MKL_DYNAMIC=false
# export OMP_NUM_THREADS=4

# run
runme_xeon64

Links
http://software.intel.com/en-us/articles/intel-math-kernel-library-linpack-download - Intel LINPACK Download
http://www.roylongbottom.org.uk/linpack%20results.htm

Check / Update DDNS

wget http://dl.panticz.de/endian/checkddns -O /etc/cron.d/checkddns

0 * * * *     /sbin/checkddns.sh YOUR_HOSTNAME.dyndns.org
1

wget http://dl.panticz.de/endian/checkddns.sh -O /sbin/checkddns.sh

#!/bin/bash

if [ ! -z $1 ]; then
	URL=$1
else
	echo "Hostname missing"
	echo "Usage: $0 YOUR_HOSTNAME.dyndns.org"
	exit 1
fi

IP_DNS=$(ping -c 1 YOUR_HOSTNAME.dyndns.org | head -1 | cut -d"(" -f2 | cut -d")" -f1)
IP_LOCAL=$(ifconfig | grep inet | tail -2 | head -1 | cut -d":" -f2 | cut -d" " -f1)

ping -c 1 ${URL} > /dev/null
if [ $? -gt 0 -o "${IP_DNS}" != "${IP_LOCAL}" ]; then
	echo "Update Dynamic DNS..." 
	/usr/local/bin/setddns.pl
fi
1

chmod u+x /sbin/checkddns.sh
/etc/init.d/fcron restart

Install docky, gnome-do, gnome-shell and zeitgeist

# install gnome-do
sudo add-apt-repository ppa:do-core/ppa
sudo apt-get update
sudo apt-get install gnome-do

# install zeitgeist
sudo add-apt-repository ppa:zeitgeist/ppa
sudo apt-get update
sudo aptitude install zeitgeist

# install gnome-shell
sudo add-apt-repository ppa:ricotz/testing
sudo apt-get install gnome-shell
gnome-shell --replace

# Links
http://wiki.go-docky.com/index.php?title=List_of_helpers
https://addons.mozilla.org/de/thunderbird/addon/72199 - Docky Unread Count (Thunderbird extension)

Configure Terms and Conditions in Magento (AGBs)

install Market Ready Germany module
http://www.panticz.de/magento_market-ready-germany

Edit condition
Admin Panel > CMS > Static Blocks
click on "AGB"
edit Content

click on "Widerrufsbelehrung"
edit Content
[ Save Block ]
 
 
 
 
 
#### OLD ###
 
# ToDo
# create Terms and Conditions for EVERY language in shop
 
<strong>Create condition</strong>
Admin Panel > Sales > Terms and Conditions
[ Add New Condition ]
Terms and Conditions Information
Condition Name: AGBs
Status: Enabled

GWT + MySQL + Netbeans Demo

# INFO
url : jdbc:mysql://localhost:3306/Bible
user: gwt-examples
pass: password
 
# create database and user
mysql -u root -p
create database Bible;
CREATE USER 'gwt-examples' IDENTIFIED BY 'password';
grant all on Bible.* to 'gwt-examples'@'%' identified by "password";
#grant all on Bible.* to 'gwt-examples'@'192.168.1.10' identified by "password";
#grant all on Bible.* to 'gwt-examples'@'localhost' identified by "password";
commit;
quit;
 
# get gwt examples 
cd ${HOME}
svn checkout http://gwt-examples.googlecode.com/svn/trunk/ gwt-examples
 
# fill database
wget http://ken
Syndicate content