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.

, , ,


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

Finally the trouble with my HVR-1300 under Linux and mythtv seem to be over

I got my mythtv backend running for years now, but since mythtv switched to S2-API, the mythtv backend failed to lock to channels. Some other DVB applications had these problems, too, like kaffeine. I quickly found which patch had to be reverted to get it working again. Without knowing what i did, but it did work, so it was ok for me. Darron Broad was a big help at that time for getting everything in a good shape.

A few weeks ago i bought a dvb-t stick as i was tired of recompiling. A Terratec Cynergy T-Stick RC (MKIII) (Device ID:0097) as i thought it should work out of the box … well that was a mistake. The first i bought was defect. I switched it for a new one, it works some time and then stops working until you switch your PC off and on again. It is known, but no fix in sight. So it was from pest to cholera.

Now finally Devin Heitmueller found the real bug for the HVR-1300, HVR-3000 and HVR-4000 (as far as i can judge this, he seems to know what he is doing in contradiction to me). If that patch gets into the kernel i finally do not need to recompile the kernel after every update. Thanks Devin for that finding. I dont mind the DVB penstick if the HVR patch gets into the kernel.
The “pest” seems to be cured, i now still have my “cholera” lying around, but maybe sometimes someone finds a cure for that, too. I also got a Pinnacle 7010iX lying around here that is known to have no linux support at this time. Maybe i can use it in 10 Years when there is no more DVB-T 😉

A Final thought:
Although you hear a lot of “linux supports more hardware than windows” you see that “supports” does not mean “does work” in every case. Its not the linux developers fault in most cases, its just the manufacturer that dont help in driver development. But searching the web before buying not always leads to the correct hardware. I bought the Terratec as they seem to support linux a little bit, at least, and after years with my HVR-1300 and patching the kernel everytime was unhappy about hauppauge not helping in getting that card to work.

Now the patch is in the kernel since version 3.0. In ubuntu oneiric (11.10) i can now run a stock kernel as of linux-image-3.0-7. Thanks,thanks, thanks.

Leave a comment

It works! HP Laserjet 1000 + Windows 7 = driver problem, virtualbox + ubuntu + cups = the solution

Recently my sister bought a new laptop as her old PC with Win 2k on it gets ready for a museum.
She asked me to find drivers for her HP Laserjet 1000 for Win7 because she did not find a way to get it working. I neither had success with finding drivers. There are some people saying the Vista driver works for them and others saying the XP driver work, but i did not find a confirmation and can not confirm it myself.
She prints only seldom so a new printer would not make much sense as the Laserjet is fully functional. And my sister is fine if printing is not as comfortable because of this seldom usage, so i had the idea to make the Laserjet working by an indirection over CUPS and i can tell you: It works.

Here are the shortened steps:

  • Get Virtualbox from:
  • Install Virtualbox on your Windows 7 machine
  • Add a new Virtual Machine in Virtualbox for your Ubuntu installation
  • Add an USB Filter in Virtualbox for your printer to this Virtual Machine
  • Install Ubuntu Server 10.04 in a virtual machine (I had chosen Ubuntu 11.04*1 Server, but there is some script missing so i would suggest 10.04) . Install it with “CUPS” in the software selection.
  • Install “foo2zjs”. This is needed for the Laserjet 1000. on the ubuntu command line its a simple sudo apt-get install foo2zjs
  • Make remote configuration of CUPS possible with sudo cupsctl --remote-admin
  • Configure CUPS through the webinterface now reachable from your Windows browser on port 631. URL for your browser should look something like http://YOURVIRTUALMACHINE:631
  • As driver for your Laserjet choose the foomatic foo2zjs driver
  • Now if you are able to get your first test page printed from the web interface you are ready on the linux side
  • Add a new Printer in Windows, choose “Network Printer”, URL for the printer should look like http://YOURVIRTUALMACHINE:631/printers/HP_Laserjet_1000 You can copy the url from your Webinterface. If you copy and paste it, be sure you copy the http link not the https one
  • As Printer Driver choose “generic->MS Publisher Imagesetter”
  • Print a test page from your windows machine.

Additional notes:
My sister has to start the VM before she switches on/connects the printer. If you have an idea about that, leave me a comment.
Its no big problem cause starting the VM is just a double click on the VM image. You may start it headless if you dont like to get a window or even start it on system boot. I leave this as an exercise for you 😉

I had some problems in Ubuntu 11.04 to install the printer driver for the Laserjet 1000 and tested some things, but dont know which one was the necessary step, so i list them here in random order:

These two come from The getweb command did not work for me as described in the wiki, and i copied some files to other places, but do not know if this helped, or was just needless.


Quick find: firessh, ssh client as firefox plugin

I found a nice firefox plugin, that is a ssh client for firefox written in javascript.
Really nice. I now dont need to install putty on some of the windows computers.

Leave a comment

%d bloggers like this: