I played a round with Google’s API to translate languages.
I ended up making a test page.

It is under the link Demos upper right corner of the page.

This text has been translated using this test page.

The Norwegian text:

Jeg lekte rund med Google sitt API for å oversette språk.
Jeg endte opp med å lage en test-side.

Den ligger under linken Demoer oppe til høgre på siden.

Denne teksten er oversatt ved hjelp av denne test-siden. 🙂

## Standard Deviation

Standard deviation is a measurement for the variations from the mean, for a set of values. You usually use small sigma as a sign for standard deviation.
I was asked to create a solution which got measurements from BAC (HP) within a certain amount of time.
They wanted to display these values, the mean and recommended values for the thresholds (red/yellow) in a graph. I then thought I could create this by calculating the standard deviation.
These values were supposed to be measured within a “normal stability period”.
They wanted to calculate the recommended thresholds in which to set in BAC.

This is the formula for the standard deviation:

I used curl and BAC OpenApi to get the values from BAC.
I created a generic query, which got all the Monitors and transactions from BAC.
This query then created a «Select form», where you could choose which transaction you wanted to analyze.

When you choose the transaction, there is a query to the OpenApi with Curl and you get the timestamp and response for a given amount of time.
I parse this data and puts the values in different array’s.

I then get the sum of all the values in the response array.
I then get the amount of measurements in the response array, by using count(\$array_response) in php.
I then get the mean from this array by using the formula:

I then have to take each values in the array_respons minus the mean and exp in 2.
I then needed to take the square root of the sum of these values.
This value is the standard deviation.

sample php code:
(median_svar is the mean of the array)

foreach ( \$array_response as \$value ) {
\$median_row=(\$value/1000)-\$median_svar;
\$expo+=(\$median_row*\$median_row);
}
\$median_endvalue=sqrt(\$expo/\$antall_svar);

The standard deviation is \$median_end_value.

Using Chebyshev’s inequality, I calculated the recommended thresholds for yellow and red in BAC.
I also took some considerations in the calculation of these thresholds by checking the
relation between the mean and the standard deviation.

Chebyshev’s inequality:

At least 50% of the values are within ?2 standard deviations from the mean.

At least 75% of the values are within 2 standard deviations from the mean.

At least 89% of the values are within 3 standard deviations from the mean.

At least 94% of the values are within 4 standard deviations from the mean.

At least 96% of the values are within 5 standard deviations from the mean.

At least 97% of the values are within 6 standard deviations from the mean.

At least 98% of the values are within 7 standard deviations from the mean.

## Sanntid / Realtime Bus-schedule in Oslo area for mobile devices

I wanted a easy and fast realtime buss-schedule for the Oslo area.

I wanted it to have theese features:

Very small, Fast, Search for buss-stop, Able to sort, colors for delayed busses etc and Able to store the final search in favourites

I found the url from trafikanten.no they use to give you the information about the stations in xml format.

I then parse this information and displays it to the webpage.

The startpage ended up looking like this:

Here you can search for the stop place.

When you find your buss-stop, you can click on the link and get the realtime, planned schedule and the end station for the actual buss.

You can here filter the direction or the actual end station.

You can test the application here:

Just enter this url in your mobil browser:

http://www.nosoft.no/route

(There is some minor details/bugs left… 🙂

## Linear regression

Linear regression is often used to predict the further development of random values.
I wished to be able to se the development of an x-y scatter plot and to display it in a graphical view.
I also wanted to be able to see the most likely development in to the future of this scatter plot.
I used this formula to find the slope of the straight line, which will tell me how the development will be.

I need two array’s. One for X and one for Y.

example:

\$x=array(1,2,3,4);
\$y=array(1,2,3,4);

(They need to contain the same amount of plots)
Looking at the formula, I need the mean for X and the mean for Y.
I also need to get the X value and the Y value for any given position (Xi and Yi).

Since you need the two arrays to contain the same number of plots, you can create a check for this.

example:

\$n = count(\$x);
if (\$n != count(\$y)) {
echo «The arrays does not contain the same amount of plots!»;
}

I first get the mean of each array:
(This is X and Y with a line over it.)

\$x_snitt=(array_sum(\$x)/\$n);
\$y_snitt=(array_sum(\$y)/\$n);

I then create a for-loop, which will parse the X-array and the Y-array and calculate the value over and under the equation.

for(\$i = 0; \$i < \$n; \$i++) {

//calculate the value for the position in the arrays

\$line_over=((\$x[\$i]-\$x_snitt)*(\$y[\$i]-\$y_snitt));

\$line_under=((\$x[\$i]-\$x_snitt)*(\$x[\$i]-\$x_snitt));

//Adding the values to mid_sum_top og mid_sum_bottom

\$mid_sum_top+=\$line_over;

\$mid_sum_bottom+=\$line_under;

}

I’ve now got the values over and under the equation.
I now need to calculate the slope for the regression line.

\$b=(\$mid_sum_top/\$mid_sum_bottom);

I now want to find out where the regression line, cross Y.
I use this formula :

\$intercept=\$y_snitt-(\$b*\$x_snitt);

You now have the values to creat a formula/array wich can show you the linear regression of the scatterplot.

(Linear regression line, is supposed to cross the median point of the scatterplot and the intercept point.)

You can put the code in a function which return the results e.g. in a array.

In this demo, a random scatterplot is created and the simple linear regression is calculated and shown:

You can press [F5] to create a new picture.

## Graphing the search in logs

I got this idea a little while ago….

There where several unit’s, who wanted to know how many errors/instances occurred of a certain type in the log files on a middleware platform. This was because they wanted to detect and correlate errors/instances with problems they had on their application, communicating thru the middleware platform.

I therefore created a website, where you could specify the search whit a regular expression. This is possible thru an Admin site.

Here you can create, modify and delete different searches.
You specify the search with a regular expression and the title for the graph.
Each search created, creates a graph which is displayed on a site like the picture below.

The search sends a request to a log server, where I’ve created an interface which then parses the log files and sends back the granulated information from the log file.

I then create a graph for each search, displaying the granularity within 1 minute.

## Analysing Value chains

A company have increased the focus on monitoring the whole value chain, instead of single components in the chain. This has lead to a more complex analysis of problems regarding the uptime measurements for that value chain.

They use BAC from HP to monitoring the transactions in the value chain.

I therefore created a site, which contains:

• Information of all the systems in that company and the communication between those systems.
• Information of all registered servers in that company and linking them to the system they belong to.
• Information of all Application Operation contracts for the systems.
• Incident’s created in BAC and linking them to actual system.
• Problems created in BAC and linking them to actual systems.
• Information about the value chains and Transactions in the value chains.
• And more…

There is a report defined in BAC, which lists the value chains and the transactions the company wants to monitor and keep a focus on.

I import this report each morning to my system. The users get’s a possibility to analyse the value chains from my sites.

You get a page containing all value chains and transactions linked to these value chains.

To the left, you get the value chains (green) and the transactions (light blue) and the uptime is listed to the right with the date on top of the list.

If you move your mouse pointer over the value chain name, you get information in an Ajax window listing the systems involved in that value chain. If you move the mouse pointer over the transaction name, you get information in an Ajax window listing the systems involved in that transaction and an explanation of what the transactions does. If you move your mouse pointer over the measurements with values lower than the defined SLA, you get information about Incidents created in that day-period for systems in the transaction.

You are also able to click on this information to drill down deeper, getting more information.

You can also on the site shown above, click on a link to analyze the value chain.

You then get the page shown below.

• Trends for the value chain
• A gantt diagram for the releases that month, of applications which can have an effect on the value chain.
• Graph which shows the number of incidents each day for that value chain.
• A list of the incidents the actual month for the value chain.
• You also get a graph showing the Linear regression and the possible outcome for the SLA the actual month.
• You also get information explaining the trends in the value chain.

We have several different environments running Tibco Business Works.

When you deploy the ear-file created in another environment, you get the settings for that environment.

This was a problem, since it leads to a lot of manual work.

I first created a script which demanded a config-file, using Tibco’s appManage.

This worked fine, but there was still som work needed being done moving files to the servers containing the scripts. I therefore created a website, where you could deploy the application, update it and perform a rollback to older versions if the new one fails.

The result is shown in the picture below.

You are here able to choose environment, ear file, config file and a additional config file for a spesific application.

To the right you have the red rollback button. When you press this, you are asked to choose environment. You then get this site, where you choose which ear- and config-file you want to roll back to.

(And yes.. I have not used a lot of time on the desing, since I have to much to do already 🙂 )

## TIBCO – Business Connect search GUI

In the product which is bundled with the TIBCO Business Connect software, we discovered that the sql’s became slower and slower when you tried to search in the default search GUI.

Each search took for about 2-5 minutes. When you wanted to see the details for the transactions you found in your search, you had to wait for 2-5 minutes for each transaction.

We discovered that there was a bug in the code leading to full table scan in the Oracle database, but was not able to get a fix for this error from Tibco.

I therefore wrote a new search GUI, using php, oracle and java.

I manly reused the API I created for the Tibco BC view described in another post.

I added extra features like access login with roles, the possibility to generate statistics and the possibility to choose environment (prod, test and development).

The search which took 2-5 minutes, now just takes 2-4 seconds.

## Tibco B2B

I’ve worked for a while with B2B-communication for Telenor.
They use software based on TIBCO and ebXML.

To get a better overview over the transactions running thru the TIBCO platform and detecting the trouble areas, I chose to create a GUI which could show me the status of important areas.

I created a page using JpGraph, Ajax, Java and PHP.
The reason why I created a java class, was because the support between Oracle and PHP is not good enough.
So I created an API against the repository for the B2B application.

Here is the result:

Confidential data is scrambled in the picture.
You can se the number of orders which has completed, failed and is pending.
You can also click on the messages in the box to the left, to get further information about the orders.

In the «blue» circle, you can see the share of orders which has failed and completed for each business partner.
In the circle/pie down to the left, you can se the percentage of the total amount of order (within the last hour), which has failed or is pending customer/Telenor.
In the circle/pie down to the right, you can se the percentage for each partner who has errors in they’re orders.

If there is too many pending or failed orders within an hour, the left marrow will turn red.
You will also get a message on the screen explaining what the possible cause to the error situation is.

The images on the site is reloaded in the background using Ajax.

Tools I’ve used to create the site:

JpGraph – For graphing
PHP – coding
Java – coding and API

## Running VPN on Ubuntu linux

Tested with ubuntu 7.10

Unpack the VPN client (Cisco-VPN-Client..) to a temporary place.
su to root

run vpn_install
(Choose to install in default folders.)
Copy the profile (*.pcf) to the catalogue
Kopier inn profilene (*.pcf) i katalogen /etc/opt/cisco-vpnclient/Profiles/
To start the VPN you enter /etc/init.d and run vpnclient_init start
(You should create a automatic startup-script in rc3.d)

You can now create a Shell script.
A simple example, where I’m using two profiles.

#!/bin/bash

clear
echo «»
echo «»
echo «»
echo «Hvilken VPN vil du koble opp mot?»
echo «»
echo «1. Fra hjemmekontor»
echo «2. Fra kontornett»
echo «»
printf «Svar:»

1)
echo «Connecting from home office…..»
vpnclient connect Hjemmekontor
;;

2)
echo «Connectiong from office…..»
vpnclient connect kontornett

;;

*)
echo «Error. (choose 1 or 2)»
sleep 3
exit 1
;;
esac

exit 0

Sample on a profile:

[main]
Description=Drift fra hjemmekontor
Host=vpnhost.com
AuthType=1
GroupName=Drift_Ekstern
GroupPwd=
enc_GroupPwd=ksdjlksdjlkdsjkdsjlkdjfksdjlksjfdkj
EnableISPConnect=0
ISPConnectType=0
ISPConnect=
ISPPhonebook=
ISPCommand=
NTDomain=
EnableBackup=0
BackupServer=
EnableMSLogon=1
MSLogonType=0
EnableNat=1
TunnelingMode=0
TcpTunnelingPort=10000
SendCertChain=0
PeerTimeout=90
EnableLocalLAN=0
CertStore=0
CertName=
CertPath=
CertSubjectName=
CertSerialHash=00000000000000000000000000000000

Install the ICA client en.linuxx..
Unpack it into a temporary folder and install it.
Choose default values..

Check to see if the plugin is added to firefox by running:
ls -ltr /usr/lib/firefox/plugins

You are supposed to see npica.so -> /usr/lib/ICAClient/npica.so
If it does not exist, you just create a symlink manually.
ln –s /usr/lib/ICAClient/npica.so npica.so

SW packages (use Google 😉 ):
en.linuxx86.tar.gz
VPN_profil.pcf (You already have a pcf file on your WIN client. Use that file.)
Cisco-VPN-Client-Linux-x86-4.8.01.0640.tar.bz2