SuiteCRM / SugarCRM 6.5 add custom javascript field validation

If you need some custom validation for a field in SuiteCRM or SugarCRM 6.5, and dont find a solution. Its not your fault, its just not well documented. After some digging in code i found a very good solution.

If you want to do a custom javascript check before the EditView is saved, just add something like the following to your vardefs.php:

    'validation' => 
    array (
      'type' => 'callback',
      'callback' => 'function(formname,nameIndex){if($("#" + nameIndex).val()!=999){add_error_style(formname,nameIndex,"Only 999 is allowed!"); return false;}; return true;}',

Then do just a “Quick Repair and Rebuild” and you are done.
I hope its easy to understand, so you can adapt it to your needs.
Easy? Yes! Easy to find out? No.
But now you know.

, , ,

Leave a comment

MD5 HMAC with VBA or VB. Visual Basic brought me back

Hi blog. Long time no see.

I searched some time for hmac md5 creation in VBA or VB, to be able to send hmac signed data with Excel,Access or Word. Eventually i found some code in the net and put them together, and now it works.
So if you want to connect to a REST webservice, that uses hmac with md5, from any Microsoft Office Program, this little functions may be useful to you.
For creating a signature the code first uses the cryptography functions of the system. The return value is a byte array, so if you want to see the md5 you have to transform that byte array in to readable md5. That is what the little helper function ByteArrayToHex() is for.

' Reference:
Public Function hash_HMACMD5(ByVal sTextToHash As String, ByVal sSharedSecretKey As String)

    Dim asc As Object, enc As Object
    Dim TextToHash() As Byte
    Dim SharedSecretKey() As Byte
    Set asc = CreateObject("System.Text.UTF8Encoding")
    Set enc = CreateObject("System.Security.Cryptography.HMACMD5")

    TextToHash = asc.Getbytes_4(sTextToHash)
    SharedSecretKey = asc.Getbytes_4(sSharedSecretKey)
    enc.Key = SharedSecretKey

    Dim bytes() As Byte
    bytes = enc.ComputeHash_2((TextToHash))

    hash_HMACMD5 = ByteArrayToHex(bytes)
    Set asc = Nothing
    Set enc = Nothing

End Function

' Referenz:
Private Function ByteArrayToHex(ByRef ByteArray() As Byte) As String
    Dim l As Long, strRet, Val As String
    For l = LBound(ByteArray) To UBound(ByteArray)
        Val = Hex$(ByteArray(l))
        If Len(Val) <> 2 Then
             Val = "0" & Val
        End If
        strRet = strRet & Val
    Next l
    ByteArrayToHex = LCase(strRet)
End Function

Use it like this:

hmac = hash_HMACMD5(“My Text i want to hash today”, “MY_TOTAL_SECRET_SECRET”)

, ,

Leave a comment

Blender: cycles renderer and CUDA in Ubuntu 12.10 on nvidia GPU

If you want to run blender ootb in ubuntu with CUDA support you will make a sad face at first.

Maybe at first you search for the preference for CUDA like its stated in the internet under “User-Preferences->System”, and dont find it. Then maybe you have a look at the addons for the cycles renderer and will see an error message stating “missing script files”. If you then try the version from debian (Step 1 and 2 in this guide) and install CUDA (Step 3), as render result you will only get a black screen, and maybe you will find the error message “error — unsupported GNU version! gcc 4.7 and up are not supported!” so cuda kernel compilation failed. So this is what step 4 in this guide is for.

Maybe this is going to change as 12.10 is still in beta, if not, follow this steps. I dont know if it also works for other Ubuntu versions as 12.04 Precise Pangolin.

There the two problems as of now are:

  • The blender in in current ubuntu packages does not support CUDA with cycles renderer.
  • CUDA needs gcc version <4.7, but on Quetzal version 4.7 is default, so CUDA fails to compile.

You need to have the proprietary nvidia drivers and some additional Packages installed:

sudo apt-get install nvidia-current build-essential gcc-4.6 freeglut3-dev

1. Download and install blender 2.63a-2 from the debian-experimental repository. As it depends on 2 packages that are newer in debian experimental, you have to download two additional packages, namely libglew1.7 and libpng15-15. Choose the right .deb package for your architecture (i386 or amd64 would be the most common depending if you are on 32 or 64 bit) from the following sites:


* Edit, libpng package changed, thx to majorkillsmurfsmrblurgle in the comments*

2. Install the packages with dpkg. For me the command is

sudo dpkg -i blender_2.63a-2_amd64.deb libglew1.7_1.7.0-3_amd64.deb \

3. Get CUDA toolkit from nvidia and install it by running the installer. Get the right package from and install it to the default location (if you change the location consider this in step 3) For Quetzal you can use the CUDA toolkit for Ubuntu 11.04

Install the toolkit with:

chmod +x
sudo ./

4. Link gcc4.6 to the CUDA installation, so it does not use the default 4.7

sudo ln -s /usr/bin/gcc-4.6 /usr/local/cuda/bin/gcc

So thats it.

, ,


mysql, umlauts and collation. Hey, o is not = ö

I came to a problem where mysql thinks that ö=o. So if your tables collation ist utf8_general_ci for example and you do

SELECT * FROM table WHERE some_field LIKE '%ö%'

You will get every row containing an “ö” but you also get every row containing an “o” (and vice versa btw).So if you really want to select the right rows you can go like this:

SELECT * FROM table WHERE some_field LIKE ('%ö%'  COLLATE utf8_bin)

Now you only get the rows containing “ö”.

Leave a comment

jQuery.load does not work in Internet Explorer sometimes, check your HTML

Searched a while to find this. If you use jQuery.load(“site”) to add dynamic data, be sure you checked the response for html errors.
In my case i did not know exactly which little mistake made the Internet Explorer not load and insert the code to my DOM, but after tidying it up with the help of HTML-Validator in Firefox, now it works.
Now i know that it was one closing div tag too much in the dynamic loaded data. IE 8 is not tolerant at this and its hard to debug if you dont know this.

, ,

Leave a comment

Disable the boot video with shaking hands on Nokia N900

I did not remember howto disable the boot video on my N900. I searched some time as most of the instructions were for using another video, not disabling, and i was not shure if just removing may end up in an unbootable device.

So to come to an end, i found how to disable the video here

You have to edit /etc/hildon-welcome.d/default.conf that it looks like this:

# filename=Hands-v32-h264.avi

Like in most Linux config files the # is for commenting the line in Maemo, too.

Leave a comment

Short note: Running git repo with gitosis on non-standard ssh port

Just a short tip. If your ssh server is on a non-standard port other than port 22, maybe 8822 there are two ways if you manage your repositories with gitosis.
You can just add the port to yur git url like:

git clone ssh://

(Note: git clone without protocol specification wont work)

or create a file ~/.ssh/config containing

Port 8822


Leave a comment


Get every new post delivered to your Inbox.

Join 155 other followers

%d bloggers like this: