Nginx Access Denied 403

Ran into a 403 error serving up a dynamic PHP script with a non-standard ending. My nginx config correctly passed it to PHP FPM however, the extension needs to be added to security.limit_extensions in the php fpm config.

http://ffct.cc/solving-nginx-php-fpm-access-denied-issue/

jQuery Tools Tooltip Positioning Fix

I started using jQuery Tool’s Tooltip today and ran into a position problem. When using bottom center the tooltip would position offscreen when the target was too close to the edge of the browser.

The following ticket notes include a proposed patch

To quickly update the minified version with the proposed fix replace

g=="left"&&(f-=i);return{top:e,left:f}}

with

g=="left"&&(f-=i); if(f<0){f=0}if(f+c.width()>$(window).width()){f=$(window).width()-c.width()} return{top:e,left:f}}

Trying to clone an uncloneable object of class stdClass

Ran into the following error recently:

PHP Fatal error: Trying to clone an uncloneable object of class stdClass in /wp-includes/cache.php

Adding the following to the PHP config fixed the error

; Adding for wp-e-commerce plugin
zend.ze1_compatibility_mode = Off

The ze1_compatiblity_mode is removed in PHP 5.3 so in that case I needed to wrap the clone calls with

function clone_it($data)
{
if(get_class($data) != ‘stdClass’)
return clone $data;
else
return unserialize(serialize($data));
}

Upgrading Ec2 Instance

Okay here’s the steps to upgrade an existing Ec2 EBS instance to a larger box

1) Right click on the instance and select Create Image (EBS AMI). This will take a few minutes
2) Go to your snapshots and right click on the new snapshot you just made select Create Volume from Snapshot
3) Create your new EC2 (larger) Instance.
4) Stop your new EC2 instance
5) Go to volumes, right click on your volume from step 2 and attach it to the new EC2 instance (/dev/sda1)
6) Detach the volume auto assigned to the new EC2 Instance
7) Start your new EC2 instance

Setting up Blazeds ( Tomcat ) on Amazon Ec2 à la Ubuntu

We’ll throw in some lamp and phpmyadmin in too for good mesure. These are the steps I recently used to setup an Ec2 box for some dev…

Step 1: Java

#See if we have it already
javac
sudo apt-get install sun-java6-jdk
#if no repo add it...
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update
# and try again
sudo apt-get install sun-java6-jdk

Step 2: Tomcat

sudo apt-get install tomcat6 tomcat6-admin tomcat6-common tomcat6-user tomcat6-docs tomcat6-examples
sudo /etc/init.d/tomcat6 start
#modify user rights so you can use the webadmin gui
sudo pico /etc/tomcat6/tomcat-users.xml
sudo /etc/init.d/tomcat6 restart

#And if we want to autostart tomcat...

sudo pico /etc/init.d/tomcat

Insert the following
# Tomcat auto-start
# description: Auto-starts tomcat
# processname: tomcat
# pidfile: /var/run/tomcat.pid

export JAVA_HOME=/usr/lib/jvm/java-6-sun

case $1 in
start)
sh /usr/local/tomcat/bin/startup.sh
;;
stop)
sh /usr/local/tomcat/bin/shutdown.sh
;;
restart)
sh /usr/local/tomcat/bin/shutdown.sh
sh /usr/local/tomcat/bin/startup.sh
;;
esac
exit 0

Now issue
sudo chmod 755 /etc/init.d/tomcat

sudo ln -s /etc/init.d/tomcat /etc/rc1.d/K99tomcat
sudo ln -s /etc/init.d/tomcat /etc/rc2.d/S99tomcat

Step 3: Blazeds

Copy up the blazeds WAR (assuming you’ve already downloaded blazeds on your localmachine)

scp -i ~/pathto/YOURPEM.pem blazeds.war ubuntu@someelasticip
sudo /etc/init.d/tomcat6 restart

Step 4: LAMP

tasksel --list-task
sudo tasksel install lamp-server

Step 5: phpmyadmin

sudo apt-get install phpmyadmin

Add the following line to /etc/apache2/apache2.conf:
Include /etc/phpmyadmin/apache.conf

sudo /etc/init.d/apache2 restart

Extra Credit: Xuggler for kicks

uname -m (verify which version of linux 32/64)

wget http://com.xuggle.s3.amazonaws.com/xuggler/xuggler-3.4.FINAL/xuggle-xuggler.3.4.1012-x86_64-unknown-linux-gnu.sh
mv xuggle-xuggler.3.4.1012-x86_64-unknown-linux-gnu.sh xuggle-xuggler.sh
chmod a+x ./xuggle-xuggler.sh
sudo ./xuggle-xuggler.sh

sudo pico /usr/share/tomcat6/bin/catalina.sh
add
export XUGGLE_HOME=/usr/local/xuggler
export LD_LIBRARY_PATH=$XUGGLE_HOME/lib:$LD_LIBRARY_PATH
export PATH=$XUGGLE_HOME/bin:$PATH

Streaming Thinkorswim's CNBC video feed on Mac

I was a bit disspointined to find that when I moved to Mac, I lost the video stream within thinkorswim. To stream the video on Mac a few simple steps are required

1) Install VLC
2) Click on the icon to run the video externally (lower right corner)

Pentaho Kettle Scheduled Task: Windows

To run a Spoon/Kettle job from the command line (convenient for creating a scheduled task) use the following syntax:

kitchen.bat /rep:”REPOSITORY NAME” /job:”JOB NAME” /dir:/LOCATION /user:USER_NAME /pass:PASSWORD /level:Basic

Replace /job: with /file: to run a job from a file if you’re not using a repository.

Warehouse Dashboard Architecture

If Flex has a sweet spot, dashboards would be it. The technology provides a richness that makes engaging UIs very easy to implement.

For those evaluating possible solutions, I’m showcasing a simple architecture for a data warehouse / dashboard project. This particular architecture encapsulates the extract / transform so those are the only steps (simple SQL=>CSV) that need to be recreated for each environment (client) that has different source systems.

Warehouse Dashboard Architecture

Flex OLAP Take Two

After running some OLAP benchmarks it was obvious that a more scalable OLAP solution was needed.

After some quick searching and downloading, I’ve wired up a scalable Flex OLAP UI.

I downloaded and setup Mondrian from Pentaho for my OLAP server. Mondrian supports XMLA making integration easy.

I found a few Flex projects interfacing to OLAP via XMLA. The most robust appears to be Grebulon by the guys over at Sherlock Informatics

Mondrian setup required a few tweaks, as I’m running Java 6:

Added the following JARs
axis.jar
commons-discovery-0.2.jar (removed commons-logging)
jaxrpc.jar
wsdl4j-1.5.1.jar
xalan.jar

Also set the following parameters in tomcat
-Djavax.xml.soap.MessageFactory=org.apache.axis.soap.MessageFactoryImpl
-Djavax.xml.soap.SOAPConnectionFactory=org.apache.axis.soap.SOAPConnectionFactoryImpl
-Djavax.xml.soap.SOAPFactory=org.apache.axis.soap.SOAPFactoryImpl
-Djavax.xml.transform.TransformerFactory=org.apache.xalan.processor.TransformerFactoryImpl

Using the FoodMart as a reference, the setup was very straight forward.

I had to download the Grebulon source as the .swcs had hardcoded in a few references (PivotGrid) to the FoodMart datasource.

Commercially, I’d check out FlexMonster too 🙂