browse by category or date

With the current trend of SOI (Service Oriented Architecture), it is very common for Web Application to use Web Service in their back-end. Since the back-end processing is implemented as a Web Service, the Front-End (UI Layer) must convert the data into XML-text before sending it for processing.

This conversion from a data-type to xml text, then back to its original data-type, will introduce a pitfall that will plunge many developers into a runtime error. Learning from my past mistakes, I come up with these points that hopefully will save you from experiencing a runtime error (read, an unpleasant call from your customer explaining the problem):

  1. Always check your data before conversion. VB.Net has these functions to help you: IsDBNull(), IsNothing(), IsNumeric(). Use them wisely.
  2. Always initialize a variable before assigning a value.
  3. Try-Catch is there not for nothing.

To illustrate above points, I’ll make a few examples here:

Bad Code:

  Dim i as Integer
  i = Cint(myDataSet.Tables("MyTable").Row(0).("MyValue"))
  ProcessMyVariable(i)

Better Code:

  Dim i as Integer = 0
  If IsNumeric(myDataSet.Tables("MyTable").Row(0).("MyValue")) Then  
      i = Cint(myDataSet.Tables("MyTable").Row(0).("MyValue"))
  End If
  ProcessMyVariable(i)

Best Code:

  Dim i as Integer = 0
  Try
      If myDataset.Tables.Contains("MyTable") Then
          If myDataSet.Tables("MyTable").Rows.Count > 0 Then
              If IsNumeric(myDataSet.Tables("MyTable").Row(0).("MyValue")) Then  
                  i = Cint(myDataSet.Tables("MyTable").Row(0).("MyValue"))
              End If
          End If 
      End If 
  Catch e as Exception
  End Try
  ProcessMyVariable(i)

Care to add more?

About Hardono

Howdy! I'm Hardono. I am working as a Software Developer. I am working mostly in Windows, dealing with .NET, conversing in C#. But I know a bit of Linux, mainly because I need to keep this blog operational. I've been working in Logistics/Transport industry for more than 11 years.

I like Foxit Reader very much. It’s fast, small and give you pretty much everything you need for a PDF Reader. Although they have the Linux version, I don’t really like it because I don’t seem to be able to automatically open a PDF file with a single click from Nautilus (although I already set ReaderLinux as the default Application).

Before we proceed, I am assuming you already have Wine up & running, and have installed the Windows version of Foxit Reader. What we need to do next is to associate the PDF file to Foxit Reader through Wine in Nautilus (or other File Manager that you have). If you have not install Wine, you could read the tutorial HERE.

After you have Wine up and running, download the Windows version of Foxit Reader HERE. Install it using the default settings.

First save the following script as foxit.sh in your home directory

#!/bin/bash
# Purpose: To convert Linux-style filename to Windows-style to pass as an argument
# to wine when starting Foxit Reader
Filename="z:"${1//\//\\}
#assuming you use the default installation folder for Foxit in Wine
App='eval wine "C:\Program Files\Foxit Software\Foxit Reader\Foxit Reader.exe" "'$Filename'"'
$App

Use foxit.sh as the Default Application for PDF File (select any PDF file in Nautilus, Right-Click -> Properties -> Open With -> Click [+ Add] Button -> Browse for foxit.sh located in your home folder.

Voila! Foxit Reader is now the default application for your PDF documents.

(Disclaimer: This post was based on 64-bit Ubuntu Gutsy Gibbon and Foxit Reader 2.1 Build 2023)

Download foxit.sh

About Hardono

Howdy! I'm Hardono. I am working as a Software Developer. I am working mostly in Windows, dealing with .NET, conversing in C#. But I know a bit of Linux, mainly because I need to keep this blog operational. I've been working in Logistics/Transport industry for more than 11 years.

Possibly relevant:

I am officially leaving Windows realm, and forced myself into the unfamiliar territory of Ubuntu Linux. Here are the list of things that I must get them running immediately, or my life will suffer :P.

  1. E-Donkey Client. You can use aMule for connecting to ED2K network
  2. BitTorrent Client. Azureus have a version that runs in Ubuntu. But emulating uTorrent through Wine also not bad.
  3. PeerGuardian for Linux. We have MoBlock, but it doesn’t offer a GUI interface. I believe a GUI development is in progress.
  4. Integrated Development Environment (IDE). So far I’m sticking myself to Eclipse for Java. WxGlade for my Python Form Designer. And Eric for Python.
  5. and many more … (frankly there are thousands of pages out there offering help on running Ubuntu)

About Hardono

Howdy! I'm Hardono. I am working as a Software Developer. I am working mostly in Windows, dealing with .NET, conversing in C#. But I know a bit of Linux, mainly because I need to keep this blog operational. I've been working in Logistics/Transport industry for more than 11 years.

Possibly relevant: