PS3 Media Server on Synology DiskStation DS411+

# login as root to your DS411
ssh root@

# download lastest java
wget http://javadl.sun.com/webapps/download/AutoDL?BundleId=42723 -O /tmp/java.bin

# extract
cd /tmp
sh /tmp/java.bin

# move to right place
mv /tmp/jre1.6.0_*/ /usr/java

# get PMS
wget http://ps3mediaserver.googlecode.com/files/pms-generic-linux-unix-1.20.412.tgz -P /tmp

# extract
tar xzf /tmp/pms-generic-linux-unix-1.*.tgz

# move
mv /tmp/pms-linux-1.*/ /usr/pms

# set port to 5002
cat < /usr/pms/PMS.conf
port=5002
folders=/volume1/video
EOF

# create start script
cat < /

Install MS SQL Server JDBC Driver

# get driver
#URL=http://jaist.dl.sourceforge.net/project/jtds/jtds/1.2.5/jtds-1.2.5-dist.zip
URL=http://jaist.dl.sourceforge.net/project/jtds/jtds/1.3.1/jtds-1.3.1-dist.zip
wget ${URL} -P /tmp/
unzip /tmp/jtds-*-dist.zip -d /tmp/
sudo cp /tmp/jtds-*.jar /usr/share/java/

Eclipse > Build Path > Configure Build Path
Libraries > Add External JARs
/usr/share/java/jtds-1.2.5.jar

# fix tomcat
sudo cp /usr/share/java/jtds-1.2.5.jar /var/lib/tomcat6/webapps/builder3/WEB-INF/lib/

# Links
http://www.java-tips.org/other-api-tips/jdbc/how-to-connect-microsoft-sql-server-using-jdbc.html

nmap

scan for IPs and ports
nmap -PR -oN /tmp/nmap.out 192.168.1.0/24

search hosts
nmap -sP 192.168.1.*
nmap -PR -oN /tmp/nmap.out 192.168.1.0/24

scan for open ports
nmap -T4 -sS 192.168.1.100

get more detailed information
sudo nmap -O 192.168.1.100 -T4

scan one port
nmap -sV -P0 -p 22 -vv 192.168.1.100

LINKS
http://linuxwiki.de/nmap

Magento: Search by Product attribute

# create Output.php.search-by-attribute.diff
--- ./app/code/core/Mage/Catalog/Helper/Output.php 2010-10-06 17:13:09.000000000 +0200
+++ ./app/code/local/Mage/Catalog/Helper/Output.php 2010-10-06 17:12:45.000000000 +0200
@@ -111,6 +111,11 @@
'product' => $product,
'attribute' => $attributeName
));
+
+ if ($attributeName != "item" && $attributeName != "description" && $attributeName != "name") {
+ $attributeHtml = "" . $attributeHtml .

OpenWRT wireless

# configure wifi
uci set wireless.radio0.disabled=0
uci set wireless.radio0.channel=5
uci set wireless.@wifi-iface[0].encryption=psk2
uci set wireless.@wifi-iface[0].ssid=$(uci get wireless.radio0.macaddr | tr -d ":" | tr "a-z" "A-Z")
uci set wireless.@wifi-iface[0].key="t00r"

# enable mac filter
uci set wireless.@wifi-iface[0].macfilter=allow
#broken#uci set wireless.@wifi-iface[0].maclist="00:a1:a2:a3:a4:a5 00:b1:b2:b3:b4:b5"

# commit changes
uci commit wireless
wifi

# remove all mac addresses
uci del wireless.@wifi-iface[0].maclist

# add read allowed mac addresses

/etc/config/network

config interface loopback
option ifname lo
option proto static
option ipaddr 127.0.0.1
option netmask 255.0.0.0

config interface eth
option ifname eth0

config interface lan
option ifname "lan1 lan2 lan3 lan4"
option type bridge
option proto static
option ipaddr 192.168.2.254
option netmask 255.255.255.0

config interface wan
option ifname wan
option proto dhcp

Install Eclipse

<?php
$URL="https://raw.githubusercontent.com/panticz/installit/master/install.eclipse.sh";
echo "wget -q $URL -O - | bash -";
echo "

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

";
?>

Git plugin
# http://www.vogella.com/tutorials/EclipseGit/article.html
http://download.eclipse.org/egit/updates

WindowBuilder (Java GUI creator plugin)
http://www.eclipse.org/windowbuilder/

sudo eclipse
install new software:
http://download.eclipse.org/windowbuilder/WB/release/R201209281200/4.2/

Global settings
/usr/lib/eclipse/eclipse.ini

OPTIONAL: change editor line break to 240 char
Project > Properties
Configure Worksapece Settings
Edit
Line Wraping
Maximum line widht: 240

Links
http://www.youtube.com/watch?v=WY9QbOdWkn0 - create Java Gui Tutorial (german)
http://code.google.com/intl/de/eclipse/docs/install-eclipse-3.5.html
http://sourceforge.net/projects/shelled/

Fix unable to shutdown / reboot / logout when OpenOffice Quickstarter is active

Here is a quick fix for OpenOffice bug reported on Launchpad https://bugs.edge.launchpad.net/ubuntu/+source/openoffice.org/+bug/562027 that prevent Gnome logout if Quickstart is running.

Solution: change DocumentStoreUIEnabled in Recovery.xcu (OpenOffice) or main.xcd (Libreoffice) to false with this command

<?php
$URL="http://dl.panticz.de/libreoffice/scripts/DocumentStoreUIEnabled_false.sh";
echo "wget $URL -O - | bash -";
echo "

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

";
?>

or use Diff to path Recovery.xcu
wget -nv http://dl.dropbox.com/u/4170695/openoffice/Recovery.xcu_DocumentStoreUIEnabled.diff -O - | \
patch -p2 /usr/lib/openoffice/basis3.2/share/registry/data/org/openoffice/Office/Recovery.xcu

Optional: remove user personal Recovery.xcu files
find /home/*/.openoffice.org/ -name Recovery.xcu -exec rm {} \;

Links
https://bugs.launchpad.net/ubuntu/+source/openoffice.org/+bug/562027

Magento: Price on request / Preis auf Anfrage

# create file: default.phtml.price-on-request.diff
--- /var/www/app/design/frontend/base/default/template/checkout/cart/item/default.phtml 2010-09-30 12:19:38.000000000 +0200
+++ /var/www/app/design/frontend/default/default/template/checkout/cart/item/default.phtml 2010-09-30 12:22:33.000000000 +0200
@@ -121,11 +121,15 @@

<?php endif; ?>

+ <?php if ($_item->getPrice() > 0): ?>
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
<?p

Install PHP accelerator php APC

apt-get install -y php-apc

# configure apc
echo "apc.shm_size=128" >> /etc/php5/conf.d/apc.ini

# configure kernel shm
cat <> /etc/sysctl.conf
kernel.shmall = 134217728
kernel.shmmax = 134217728
EOF
sysctl -p /etc/sysctl.conf

# restart apache
/etc/init.d/apache2 restart

# configure magento to use apc
cp /var/www/app/etc/local.xml.additional /var/www/app/etc/local.xml.additional.org
diff ./app/etc/local.xml.additional.org ./app/etc/local.xml.additional -Naur
--- ./app/etc/local.xml.additional.org 2011-09-08 11:38:11.000000000 +0200
+++ ./app/etc/local.xml.additional