SubClosure

{ Don't Repeat Yourself ! }

I have been looking for some tools that can create nice looking graphical reports of my server performance over time.
There quite a few useful command line utilities available such as sar, iostats, top, etc

But today I finally found what I was looking for.
The program is called Munin and here is a nice article on how to set it up on a Debian system:

http://www.howtoforge.com/server-monitoring-with-munin-and-monit-on-debian-lenny

Here is an example  of how to access joomla session data from another php script.
This is particular useful for implementing an AMF gateway or other ajax functionality.

To access the Joomla! session variables from another script, the easiest way is to instantiate the joomla application in that script. Please note that this will only work if that script is not already using its own session.

Example Code:


define( '_JEXEC', 1 );
define( 'DS', DIRECTORY_SEPARATOR );
define('JPATH_BASE', dirname(__FILE__) );

require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );

$mainframe =& JFactory::getApplication('site');
$mainframe->initialise();

$session =& JFactory::getSession();
$user = $session->get( 'user' );

In this example I’m assuming the script is located in the main joomla directory.
If the script sits in some subdirectory you’ll have to adjust the JPATH_BASE definition.

Great news – Nathan Mische has released a Firbug Plugin for Firefox that allows us Flash and Flex developers to view decoded AMF Traffic Requests and Responses from within our browser.

Check it out here: https://addons.mozilla.org/en-US/firefox/addon/78928

The only problem at the moment – it is not very easy to find requests/responses if you have an application that is making a lot of requests simultaneously. It takes quite a bit of clicking and scrolling to find what you are looking for.

Nevertheless I’m absolutely impressed so far and I think it is a great tool. I’m very much looking forward to future developments.

This is a screenshot, that I took when running my flex password generator:

This is a bit off topic but I just came across a pretty cool animation by Fredrik Andersson called Watch Alice Bleed.

Watch Alice Bleed Animation

Description:

Watch Alice Bleed is a gore-filled stop motion animation. It opens with Alice being decapitated, and having her head fed to a dog. Then things start getting gruesome…

It can be found on vodo.net which features quite a few good free movies from creators who WANT to share their work! Movies are shared over bit torrent.

use the following command to install time zone description tables into a MySQL server on a LINUX system.

mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql

you can then run ‘SET time_zone’ queries, e.g.  SET time_zone = “Pacific/Auckland”

This is very easy to do.
Assuming the database on the remote server runs on the standard mysql port 3306, the following command will establish the tunnel.

ssh username@remoteserver -L2000:localhost:3306

If successfully logged in through ssh, you can then connect your mysql client to port 2000 on your local machine and
will be able to use the remote database just as if it was running on your local computer. The good thing – all traffic will be encrypted by ssh.

obviously the L2000 means the port to be used on your local machine and 3306 is the port that will be used on the remote machine.

Note you can also add -f paramter to the ssh call:
ssh -f username@remoteserver -L2000:localhost:3306
if you want ssh to run in the background.

ever executed shell commands that process large amounts of text data?

for example mysql mydatabase < data.sql

with data.sql being a huge file.

this cool little tool called bar can display a nice ASCII progress bar for commands

Wow – thats funny

Super Baozi vs Sushi man from sun haipeng on Vimeo.

The Email Validator’s static method validateEmail requires 3 parameters according to the Flex 3.2 API Documentation:

Parameters

validator:EmailValidator — The EmailValidator instance.
value:Object — A field to validate.
baseField:String — Text representation of the subfield specified in the value parameter. For example, if the value parameter specifies value.email, the baseField value is “email”.

I’m wondering  why it is that I have to specify the actual String value of my textfield as value parameter and then also have to specify “text” as baseField.
I would have thought as value I should specify mytextfield and as baseField “text” as it is done in all other places. I find that confusing.
But this method will only work when used like this for example:

var result:Array = EmailValidator.validateEmail( myemailvalidator , mytextfield.text , “text” ) ;

Ever had to choose a new secure password but couldn’t think of anything and ended up using the same old insecure password as always?

Well here is the solution. It comes in form of a little Unix/Linux programm, called pwgen. It automatically generates difficult passwords that are designed to be easily memorized by humans.

This Flex Application is a frontend for pwgen. You can use it to generate as many passwords as you like.

Get Adobe Flash player