programing

lyc - Linux Yamaha receiver control (over serial / RS232 interface)

Yamaha RX-V3800 and some older models like DSP-AX1 are great AV-Receiver, but unfortunately they have no control / web interface to manage it from outside. With a USB-Serial adapter connected to the reciver RS-232 interface, a computer or router and lyc you can control the reciver. In addition, a web interface can be created with wlyc to provide a web access to all network devices like PC, smartphone or tablet.

GitHub repository
https://github.com/panticz/lyc

Download binary
http://dl.panticz.de/lyc/i386/lyc - i386 compiled
http://dl.panticz.de/lyc/ar9132/lyc - Atheros AR9132 (TP-LINK TL-WR1043ND / TL-WDR4300 router)

HowTo compile and run
1. download lyc.c and Makefile
2. compile with: make
3. set up USB Serial adapter http://www.panticz.de/USB-Serial-adapter
4. run command:
./lyc input dvd
./lyc volume up

Run on OpenWrt router
1. download sources
2. comile with
make mips
4. copy lyc to OpenWRT router:
scp lyc root@OPENWRT_IP:/root/lyc
5. login to root@YOUR_OPENWRT_IP
6. download wlyc (OpenWrt wget can not access https, use http redirection)
wget -q http://dl.panticz.de/wlyc/wlyc -O /www/cgi-bin/wlyc
chmod 755 /www/cgi-bin/wlyc
7. Open im broser:
http://OPENWRT_IP/cgi-bin/wlyc
Example: http://ROUTER_IP/cgi-bin/wlyc?p1=input&p2=dvd

cros-compile script for OpenWRT
http://dl.panticz.de/lyc/compile_openwrt_ar9132.sh

http://raw.githubusercontent.com/panticz/lyc/master/lyc.c - lyc source code
<?php
$URL="https://raw.githubusercontent.com/panticz/lyc/master/lyc.c";
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 "

";
?>

https://raw.githubusercontent.com/panticz/lyc/master/rxvx700.h - Yamaha RS232 codes
<?php
$URL="https://raw.githubusercontent.com/panticz/lyc/master/rxvx700.h";
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 "

";
?>

https://raw.githubusercontent.com/panticz/lyc/master/Makefile - Makefile
<?php
$URL="https://raw.githubusercontent.com/panticz/lyc/master/Makefile";
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 "

";
?>

Links
http://mark.jerde.org:13780/v1/comp/rxv2400/
http://linuxmce.org/
http://forum.linuxmce.org/index.php?topic=5759.0
http://www.remotecentral.com/cgi-bin/mboard/rc-touch/thread.cgi?849
http://www.omei.de/

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

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

Compile Docky with Stacks under Ubuntu

<?php
$URL="http://www.panticz.de/sites/default/files/Docky/compile.docky.stacks.sh.txt";
echo "

Quick install (go Applications > Accessories > Terminal and put this line into):

";
echo "wget $URL -O - | bash -";
echo "

Script code:

";
echo "

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

";
?>

Install Docky Stacks (already compiled)
http://www.panticz.de/Download-and-install-Docky-Stacks-under-Ubuntu

Links
http://wiki.go-docky.com/index.php?title=Installing
http://www.omgubuntu.co.uk/2010/06/stacks-for-docky-looks-like-a-dream-works-like-one-too/

Magento product back button

<?php
$URL="http://www.panticz.de/sites/default/files/magento/back-button/styles.css";
echo $URL;
echo "

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

";

$URL="http://www.panticz.de/sites/default/files/magento/back-button/back-button.view.phtml";
echo $URL;
echo "

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

";
?>

mkdir -p ./app/design/frontend/default/default/template/catalogsearch/
cp ./app/design/frontend/base/default/template/catalogsearch/result.phtml ./app/design/frontend/default/default/template/catalogsearch/result.phtml
<?php
$URL="http://www.panticz.de/sites/default/files/magento/back-button/result.phtml.diff";
echo $URL;
echo "

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

";
?>

mkdir -p ./app/design/frontend/default/default/template/page/
cp ./app/design/frontend/base/default/template/page/1column.phtml ./app/design/frontend/default/default/template/page/
<?php
$URL="http://www.panticz.de/sites/default/files/magento/back-button/1column.phtml.diff";
echo $URL;
echo "

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

";
?>

Links
http://www.mxperts.de/zuruck-button-fur-die-produktansicht/

PHP

Supported Versions
http://php.net/supported-versions.php

show PHP information
php -i

list loaded PHP modules
php -m

enable PHP Module
php5enmod amqp
/etc/init.d/apache2 reload

Show includes
php --ini

Run PHP built-in web server
php -S 192.168.1.100:8080 -t /var/www/

PHP syntax check
php -l FILE.php

# define parameter
php -d date.timezone="Europe/Berlin" -f

Error reporting
# report all errors except notices