Latest Publications

For testing RESTful services – Mozilla RESTClient add-on

If you are building RESTful services you may find RESTClient add-on helpful during your tests. You can install the Mozilla add-on from this url.

Post to Twitter Tweet This Post

Ruby On Rails: Writing something to the log.

Ruby on Rails has build in features for writing to you application log file. You can directly use the logger object for this purpose.

Following line when it is executed will print “Hello world” to you log file.

logger.info 'Hello world'

You can use different log levels fatal, error, warn, info, debug .

logger.error 'Hello world'

For more information please check the documentation of Logger class.

Post to Twitter Tweet This Post

Nginx server_names_hash_bucket_size problem

Today I defined a new site on my Nginx server. This new site I defined has a long domain name.
When I tried to restart the Nginx I got the following error message.

Restarting nginx: 2010/05/03 09:25:08 [emerg] 4452#0: could not build the server_names_hash, you should increase server_names_hash_bucket_size: 32
nginx.

(more…)

Post to Twitter Tweet This Post

VirtualStream and ReadOnlySeekableStream

When you write a custom pipeline component, loading entire message into memory should be avoided. If you use Memory Stream for large files, it loads entire message into memory and you may have OutOfMemory exceptions. On the other hand, VirtualStream uses Biztalk’s buffering directory after a threshold value which is specified in object initialization.

In addition to this, default message stream can be non-seekable and you may have exception when you try to change message data postion. The solution for this to use ReadOnlySeekableStream which wraps MemoryStream by default.

As a result of these, It is a good approach to use ReadOnlySeekableStream and VirtualStream classes exposed by Microsoft.Biztalk.Streaming.dll together in your custom pipeline components.

Please check below code snippet to see how to use ReadOnlySeekableStream vith VirtualStream.

int bufferSize = 0×280;
int thresholdSize = 0×100000;
if (!inmsg.BodyPart.GetOriginalDataStream().CanSeek)
{
    Stream virtualStream = new VirtualStream(bufferSize, thresholdSize);
    ReadOnlySeekableStream seekableStream =
        new ReadOnlySeekableStream(inmsg.BodyPart.GetOriginalDataStream());
    Stream seekStream =
        new ReadOnlySeekableStream(inmsg.BodyPart.GetOriginalDataStream(),
            virtualStream, bufferSize);
    inmsg.BodyPart.Data = seekableStream;
}
inmsg.BodyPart.Data.Position = 0;

Post to Twitter Tweet This Post

Ubuntu avahi-daemon creates problem resolving FQDNs ending with .local

I have started to use .local dns extension for my local network. After changing my complete network configuration I realized that some of my Ubuntu machines can resolve the FQDNs ending with .local (Ex: testhost.digitalpains.local ) correctly.

ali@advance17:/home/ali$ ping testhost.digitalpains.local
ping: unknown host testhost.digitalpains.local
 
ali@advance17:/home/ali$ ping testhost
PING testhost.feasiblesolutions.local (192.168.7.2) 56(84) bytes of data.
64 bytes from 192.168.7.2: icmp_seq=1 ttl=64 time=1.02 ms
64 bytes from 192.168.7.2: icmp_seq=2 ttl=64 time=1.12 ms

After some research it turned out that avahi-daemon was interfering the DNS resolve process and FQDNs ending with .local extension wasn’t being resolved.

After I stopped the avahi-daemon service I was able to resolve

ali@advance17:/home/ali$ sudo stop avahi-daemon
avahi-daemon stop/waiting
 
ali@advance17:/home/ali$ ping testhost.feasiblesolutions.local
PING testhost.feasiblesolutions.local (192.168.7.2) 56(84) bytes of data.
64 bytes from 192.168.7.2: icmp_seq=1 ttl=64 time=2.05 ms
64 bytes from 192.168.7.2: icmp_seq=2 ttl=64 time=1.16 ms
64 bytes from 192.168.7.2: icmp_seq=3 ttl=64 time=4.25 ms

After reboot avahi-daemon service will start automatically. On Ubuntu Karmic edition adding the following line to you r /etc/avahi/avahi-daemon.conf file will solve the problem permanently.

AVAHI_DAEMON_DETECT_LOCAL=0

Post to Twitter Tweet This Post

Size matters, keep your BizTalk Map Project small

Whenever a map contains a scripting functoid that uses inline language like c#, BizTalk Map assembly is created in memory. The object in memory is not deleted until the Biztalk service is restarted. This means every mapping operation causes the whole assembly to be loaded into memory. That’s why we must keep maps and schemas in a different projects and keep map projects’ size small.
Another option is not to use inline scripts but it does not seem possible. Because
some of most frequently used fuctoids are inline scripts. You can check below table to see which functoids use incline scripts.

Functoids Inline script?
All String Functoids Yes
All Mathematical Functoids Yes
All Logical Functoids except IsNil Yes
Logical IsNil Functoid No
All Date/Time Functoids Yes
All Conversion Functoids Yes
All Scientific Functoids Yes
All Cumulative Functoids Yes
All Database Functoids No
Advanced Functoids Inline script?
Looping Functoid No
Value Mapping Flattening Functoid No
Assert Functoid No
Table Extractor Functoid No
Table Looping Functoid No
Scripting Functoid with Inline C# Yes
Scripting Functoid with Inline JScript.NET Yes
Scripting Functoid with Inline Visual Basic .NET Yes
Scripting Functoid with Inline XSLT No
Scripting Functoid with Inline XSLT Call Template No
Scripting Functoid calling External Assembly No
Nil Value Functoid No
Value Mapping Functoid No
Mass Copy Functoid No
Iteration Functoid No
Index Functoid No
Record Count Functoid No

Post to Twitter Tweet This Post

My Favorite Maven Links

Post to Twitter Tweet This Post

Mobile Telephone eavesdropping.

As the mobile phones get smarter, they became an integral part of our life and very tempting attack vector. Today I red an article Voice Encryption: 9 out of 10 Products are Worthless (Technical Description) it is a nice example of with a little bit of creativity how easily you can bypass an expensive security measure.
Author is using a product called Flexispay you can see the flash movies explaining how does the product installed and works. With an investment of 100 Euros a year, you are able too wiretap a mobile telephone less than 5 minutes.

Post to Twitter Tweet This Post

Automatic Security Updates on Ubuntu.

There are different options for automatically updating your server. At this article we will use the unattended-upgrades package.

We will start with installing the unattended-upgrades package.

kok@fhome:~$ sudo apt-get install unattended-upgrades

After installing the unattended-upgrades package we need to add  the text below to the  /etc/apt/apt.conf.d/10periodic file.

APT::Periodic::Update-Package-Lists “1″;
APT::Periodic::Download-Upgradeable-Packages “1″;
APT::Periodic::AutocleanInterval “5″;
APT::Periodic::Unattended-Upgrade “1″;

After this modification your system will install the security updates automatically. You can see the details of unattended-upgrades from the log files  /var/log/unattended-upgrades/ folder.

For more information about this subject you can check the Ubuntu wiki page.

Post to Twitter Tweet This Post

What is my problem with Biztalk FTP Adapter?

My problem is BizTalk Ftp Adapter’s inability to run in 64-bit mode… Actually, this is one of the problems of the ftp adapter but I won’t write about it in this entry, I can live with it…. :)

  • Out-of-the box Ftp Adapter receive location deletes files from the remote ftp site so it requires write permission on the remote ftp directory, but some of our customers don’t want us to delete file after we retrieve it. For example, some of our customers share same file with lots of recipients on their private ftp server and they do not want to give different ftp directories and put the same file for each recipient.
    In my company, we solved the problem by writing a simple custom ftp receive adapter for those customers who don’t give write permission on their private ftp server. Our custom FTP adapter keeps track of received file properties (like name, size, file-mask, etc.) on a custom database and before receiving a new file, it checks the database whether the file received previously or not. In addition to this, after the file is picked up,we compare CRC of the current file with previously received files’ CRCs to prevent duplicate message processing.
    If you don’t want to write your own custom adapter, You can also look for a third party adapter like /n software Ftp Adapter, which has a “never delete” mode while retrieving files.
  • We process large files in BizTalk Server 2006 R2. BizTalk retrieves files by using Ftp Receive Location and our customers also put their files to the directory by using ftp. Because of BizTalk Ftp Receive location is not aware of whether file upload is completed or not, sometimes receive location retrieves incomplete files and that cause BizTalk to fail processing those files.
    In my opinion, Ftp protocol’s lack of functionality to check whether file upload is completed or not shouldn’t be an excuse for the ftp adapter to retrieve incomplete files.
    So, I listed below some of my proposed solutions to handle incomplete file processing:
    Solution 1 : We can write a custom FTP adapter. Custom adapter checks file size before retrieving the file and if its size doesn’t change for a certain time (lets’ say 1 minute) then assumes it is uploaded completely and then process otherwise don’t process and try to retrieve file at next polling.
    Solution 2 : If the ftp server is in our control we can make customers to upload documents to the customer specific temp directories and a program which runs on the ftp server can move uploaded files from temp directories to the directories where BizTalk receive location is polling. While moving file from a temp directory on FTP server would let us have a lock on the file and so we would get a 550 error when trying to retrieve the file at this time. Receive location tries to retrieve file at next polling. Actually, I didn’t tried the solution but I expect it to work. Even it works, not my favorite.
    Solution 3 : Find a third party adapter. /n Software Ftp Adapter may be an option but I don’t know whether it provides a solution to check file completeness or not.

Last but the not least, lack of extension point of adapter framework.
We have to use the adapter as it is or we must find another adapter. We have two options; We can develop our own custom adapter or we can find a third party adapter.
I think, it would be nice if we would not write a whole new adapter and if there were some extension points which we could alter the way of adapter’s processing, by writing something like interceptors. We can intercept the processing flow of the adapter, make some validations and decide whether to let adapter to continue processing or make it stop by throwing an exception or make it skip this time and try to retrieve file at next polling.

Related Links :

Post to Twitter Tweet This Post