Posts

Showing posts from February, 2012

Tune Up Paging with vmtouch

A nice tool I came across recently ‘vmtouch’ which is used to help you manage what data is in memory.  Its great when failing over from one machine to another where there is no active memory profile already.
To get started download vmtouch from here http://hoytech.com/vmtouch/vmtouch.c
Then compile with the following gcc -Wall -O3 -o vmtouch vmtouch.c
To find out how much of your /bin directory is in the file system cache run
./vmtouch /bin
You will see something similar to this
       Files: 91      Directories: 1   Resident Pages: 512/2115  2M/8M  24.2%          Elapsed: 0.002669 seconds
If I want to check how much of mysqld is in the cache
./vmtouch  /usr/libexec/mysqld            Files: 1      Directories: 0   Resident Pages: 671/1886  2M/7M  35.6%          Elapsed: 0.00029 seconds
Say you want to check how much of your mysql indexes are in cache this is two examples
./vmtouch  /var/lib/mysql/xcart/xcart_products.MYI            Files: 1      Directories: 0   Resident Pages: 5309/5309  20M/20M  100%  …

Removing Connections Between Nodes in Message Broker via Java API

import java.io.File;
import java.io.IOException;
import com.ibm.broker.config.appdev.MessageFlow;
import com.ibm.broker.config.appdev.FlowRendererMSGFLOW;

public class LoadMessageFlow
{
    public static void main(String[] args)
    {
        File oMsgFlowFile = new File("/root/ibm/myflow.msgflow");

        MessageFlow oMessageFlow = FlowRendererMSGFLOW.read(oMsgFlowFile);

        MQInputNode oNode1 = (MQInputNode) oMessageFlow.getNodeByName("Node1");
        MQOutputNode mNode2 = (MQOutputNode) oMessageFlow.getNodeByName("Node2");
        oMessageFlow.disconnect(oNode1.OUTPUT_TERMINAL_OUT, oNode2.INPUT_TERMINAL_IN);
    }
}

Read Symantec Backup Exec Job Report XML Files

'----------------------------------------------------
' Basic Routine to Read / Parse XML Job Reports created
' by Symantec Backup Exec.

Dim serverName, backupJobFile, el, jobName, startDateTime, endDateTime, jobStatus
Dim fso,XMLDoc

Set fso = CreateObject("Scripting.FileSystemObject")

backupJobFile ="c:\xml\m.xml"

Set xmlDoc = CreateObject("Msxml2.DOMDocument")

xmlDoc.load(backupJobFile)

Set el = xmlDoc.getElementsByTagName("machine_name")
serverName = el.item(0).Text

Set el = xmlDoc.getElementsByTagName("name")
jobName = Replace(el.item(0).Text,"Job name: ","")

Set el = xmlDoc.getElementsByTagName("start_time")
startDateTime = Replace(el.item(0).Text,"Job started: ","")

Set el = xmlDoc.getElementsByTagName("end_time")
endDateTime = Replace(el.item(0).Text,"Backup completed on ","")

Set el = xmlDoc.getElementsByTagName("engine_completion_s…

New Features in WebSphere MB v8

A list of some new features in websphere Message Broker v8 Better support for Microsoft Integration via the .NET Compute node and access to COM objectsSupport for CLR based .NET languages including  C#, VB.NET.Support for DFDL which now allows your message flow to parse a variety of other data formats.Support for WS-ReliableMessaging (Web Services Reliable Messaging)Create message flows dynamically from your programs with a new command apiRecord, edit and replay messagesImproved activity logging to easily understand broker behaviorEasy to use browser based web administration interface.

Creating a simple Alert / Success Message with ASP.NET/VB using Bootstrap

In your AddContact.aspx page use something like the following

      <div class="row-fluid">
            <div class="span6">
                <h2>New Contact</h2>
            </div>
            <div class="span6">
                <asp:Label ID="AlertWindow" Visible="false" CssClass="alert alert-success" runat="server"></asp:Label>
            </div>
        </div>

And in your AddContact.aspx.vb code use something similar to this.  Basically set the message for the alert window, make the alert window visible and set the approprate css style.  You can make this  alot cleaner with a set of classes to implement bootstrap for ASP.NET.  So this is just an example.

    ......
    ......
    AlertWindow.Visible = True
    Try
        ......
        sSQLQuery = "INSERT INTO......"
        ......
        AlertWindow.Text = "New Contact Added Succes…

Comparison of business integration software

While this may not be 100% up to date its a useful start if you wish to compare the various business integration and business process automation software available on the market.

http://en.wikipedia.org/wiki/Comparison_of_business_integration_software

Using Linux / gcc / gsoap to call MBT SoapInput Node in Message Flow

Firstly download, configure, compile and install gsoap

Step 1: get up and running
mkdir gsoap
wget http://sourceforge.net/projects/gsoap2/files/gSOAP/gSOAP%202.7.16%20stable/gsoap_2.7.16.zip/download
cd /root/gsoap/gsoap-2.7
yum install byacc
yum install bison
yum install flex
./configure
./make
./make install

Step 2: Setup working folder and create stubs from remote wsdl via URL. Note I'm just using plain old C and not C++.

mkdir ./OrderService

wsdl2h -c -o OrderService.h http://83.71.23.20:7800/acmeOrders/WADDR/ProcessOrders?wsdl
soapcpp2 -c OrderService.h
Step 3: Create your test C client using your fav editor (mine vi) #include "soapH.h" #include "OrderServiceSOAP.nsmap"
main() {    struct soap *soap = soap_new();    struct _ns1__submitPORequest  request;    struct _ns1__submitPOResponse response;
   request.partNo="1234";    request.partQuantity=1;    request.personName.firstName="Trevor";    request.personName.lastName="Trevor";    request…

Using Soap Client Library for C++ to Access IBM Message Broker Message Flow via SoapInput Node

SQLData offers a SOAP client library which allows you to access web services using  C/C++ code.  With a few lines of code you can easily access a web service exposed from a SoapInput Node on Websphere Message Broker.

Here is a short example, the trick is to store the parameters you wish to pass to the Web Service Method in two arrays, the first array in this instance pParams stores the parameter names as they appear in the WSDL e.g. partNo etc, note that parameters which have a nested structure within the WSDL, they must appear similar e.g. address.zipCode.  In the second array you store the values. Place a NULL at the end of each array.

Here goes, compiled with Visual Studio 2008, Soap Client Library for C++ 3.6, IBM Message Broker 7.0, Message Broker Toolkit 7.0 and MQ 7.1

#include <windows.h>
#include <tchar.h>
#include "SoapClientApi.h"
#include "exportdef.h"
#include "stringdef.h"


#define DEBUG_MODE_ON 1
#define DEBUG_MODE_OFF 0


int WMB_submitPO(…

Using ServiceMix to Poll Folder for files

xbean in ServiceMix to poll a particular folder for incoming orders, pass them on to service OrderProcess, move a copy to archive folder and delete original from inbox.

<?xml version="1.0"?>
<beans xmlns:f="http://servicemix.apache.org/file/1.0"
   xmlns:tut="http://www.servicemix.org/ns/jbi"
   xmlns:sm="http://servicemix.apache.org/config/1.0">
   <f:poller
      service="tut:orderfilePoller"
      endpoint="pollEndpoint"
      file="${file.poll.folder}"
      targetService="ex:orderProcess"
      period="${file.poll.period}"
      deleteFile="${file.poll.delete}"
      archive="${file.poll.archive}"
      recursive="${file.poll.recursive}" />

   <bean id="propertyConfigurer"  class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
      <property name="location">
         <value…

Easy to use - Bootstrap, from Twitter

Image
I like simplicity, in particular when it comes to UI design, its nice to have a clean, simple, less is more approach.

Recently I came accross bootstrap from twitter and its all of the above.

When you need to design a system that does not require a flashy front end this is ideal. Best about components like this is that they allow you to spend more time on the actual functionality or problem the solution is acutally solving.

Check it out here

http://twitter.github.com/bootstrap/index.html


ULTRAESB - Poll a directory for a file with a specific pattern and upload it with an authenticated HTTP PUT

<u:proxy id="file-proxy">
    <u:transport id="file">
        <u:property name="url" value="file:///hunt/pixmania/orders/incoming"/>
        <u:property name="fileNamePattern" value=".*\.pxml"/>
        <u:property name="startDelay" value="1000"/>
        <u:property name="repeatInterval" value="1000"/>
        <!--<u:property name="concurrent" value="true"/>-->
        <!--<u:property name="cronExpression" value="0 * * ? * MON-FRI"/>-->
        <u:property name="moveAfterProcess" value="/hunt/pixmania/orders/processed"/>
        <u:property name="moveAfterFailure" value="/hunt/pixmania/orders/failed"/>
        <u:property name="moveTimestampFormat" value="yyyy_MM_dd_'T'HH_mm_ss.SSSSZ"/>
    </u:trans…

Implement Observer Design Pattern in C# - Real World Example Brokers watching company Share Price

using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;

namespace ShareManager
{
    abstract class Shares
    {
        private string _companysymbol;
        private double _shareprice;
        private List<ShareHolder> _shareholders = new List<ShareHolder>();

        public Shares(string companysymbol, double shareprice)
        {
            this._companysymbol = companysymbol;
            this._shareprice = shareprice;
        }

        public void Watch(ShareHolder shareholder)
        {
            _shareholders.Add(shareholder);
        }

        public void Detach(ShareHolder shareholder)
        {
            _shareholders.Remove(shareholder);
        }

        public void Notify()
        {
            foreach (ShareHolder shareholder in _shareholders)
            {
                shareholder.Update(this);
            }

            Console.WriteLine("");
        }

        public double SharePrice

Basic Parallel Reduction in C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleReduceApplicationTest
{
    class Program
    {
        public class ReduceSimple
        {
            delegate T Func<T>(T arg0, T arg1);

            T Reduce<T>(T[] input, T seed, Func<T> r)
            {
                T result = seed;
                foreach (T e in input)
                    result = r(result, e);
                return result;
            }

            public void CheckReduce()
            {
                int[] nums = new int[] { 1, 2, 5, 10, 1 };
                int sum = Reduce(nums, 0, (x, y) => x + y);
                int min = Reduce(nums, int.MaxValue, (x, y) => x < y ? x : y);
                int max = Reduce(nums, int.MinValue, (x, y) => x > y ? x : y);
                Console.WriteLine("Total Value=" + sum);
                Console.WriteLine("Max Value=" + max);
                Console.WriteLine(…