Tuesday, January 4, 2011

TCPDF multipage table page break in multiline cell problem

I had a problem when I was creating PDFs from HTML with TCPDF. Tables spanning multiple pages which contained cells with multiple lines ended up page breaking in the middle of the cells and causing havoc with the automatically generated table header on the next page.

You might have seen other people having this problem:
http://sourceforge.net/projects/tcpdf/forums/forum/435311/topic/3874468.
And http://www.onemoretake.com/2009/03/27/revisited-tcpdf-variable-height-table-rows-with-multicell/ created their own class to circumvent the problem.

The fix now is as nicolaasuni says in http://sourceforge.net/projects/tcpdf/forums/forum/435311/topic/3874468?message=8669584, get the latest version of TCPDF.

Alternatively, if you can't upgrade, you can use the nobr attribute which tells TCPDF not to break in the middle of a cell or other HTML tag. Usage:
<tr nobr="true">
<td>your content here</td>
</tr>


Solution found (nicolaasuni again): http://sourceforge.net/projects/tcpdf/forums/forum/435311/topic/3457446?message=7762133

Thursday, December 30, 2010

New Firebug Autocomplete annoying with jQuery

Firebug is a great tool for web developers to debug webpages.

If you have installed the latest update from Firefox' Add-ons menu and tried to write jQuery commands into the console/command line of firebug you might have run across an annoying problem.

Firebug tries to autocomplete $, $(, $(', etc. adding $ and completing ' after the next character. Basically you have to keep hitting escape or delete to write your jQuery statement.

This problem is luckily fixed in the latest beta release. It is not available through the add-on menu in Firefox, but can be downloaded directly from the Firebug website. So head over to http://blog.getfirebug.com/2010/12/22/firebug-1-6-1b2/ and download it.

Source: http://code.google.com/p/fbug/issues/detail?id=3184.

Saturday, December 18, 2010

Windows 7 middle click mouse doesn't close tabs

In Firefox on Windows 7, closing tabs by clicking on them with the middle mouse button doesn't work. You only get the Alt+Tab 'window' to switch between programs.

To fix this:
- Go to Control Panel
- Select 'Hardware and Sound'
- Select 'Mouse' under 'Devices and Printers'
- In the drop-down box for 'Wheel button' change it from 'Flip' to 'Middle-click'
- Press OK

This should now enabling closing tabs with clicking the middle mouse button.

Sound cut-off in Deus Ex 1

Playing the old classic on Windows 7 gave me some trouble with speech being cut of about 1 second before it should have finished.

Read a few places about this problem and some suggestions about changing latency to 46 or 60 (in the deusex.ini file in the deusex/system folder), but this didn't work for me.

Changing from using Direct3D Support to OpenGL as the video device did.
Here is how:
- Open 'Deus Ex Safe Mode' from start menu
- Select 'Change your 3D video device'
- Select 'show all devices'
- Select 'OpenGL Support' and press next
- Accept settings suggestion (can be changed in-game later)
Enjoy!

If this doesn't work for you, here are some forums with suggestions for how to get it to work with Direct3D:
http://www.ttlg.com/forums/showthread.php?s=&threadid=50981
http://www.ttlg.com/forums/showthread.php?t=99140 (since DeusEx runs on the Unreal rendering engine)

Saturday, November 13, 2010

Workaround for Ubuntu install hangs on forward button

Have you tried installing Ubuntu using the official guide where you create a Live/Install USB using Universal USB Installer in Windows? Did the install not continue after pressing continue when selecting language or when selecting keyboard layout?

This seems to be because of gparted/parted not being able to start. It affects installing from Ubuntu 10.4-netbook 10.10-netbook, and 10.10-desktop.

A workaround is to create the Live/Install USB in Ubuntu.

You will need two USB drives (including the one you created in windows).

Start the Live session, get a copy of the iso you put on the USB onto the computer (either from a different machine or download it). Open the startup disk creator in you Ubuntu Live session (System->Administration->Startup Disk Creator). Select the iso file and the other USB drive.
Create the startup disk. Shut down, remove the USB created in windows. Start up using the USB created in Ubuntu to boot from. Install from the USB created in Ubuntu. The forward button should now work.

Sources: A Ubuntu bug report that I cannot find again. Please tell me if you have seen it so I can give credit.

Tuesday, October 26, 2010

Check if a Zend_Db_Table_Rowset is empty

When retrieving data from the database using Zend Framework (using find or fetchAll functions) you will be presented with a Zend_Db_Table_Rowset. To check if it is empty it would seem logical to use the empty function like when checking an array. This will not work.

To check if a Zend Rowset (Zend_Db_Table_Rowset) is empty you need to use the count function. e.g.:
if(count($result) > 0) {
//Do something
}

Or using the Rowsets own count function (which does not iterate through all the elements apparently):
if($result->count() > 0) {
//Do something
}


See http://www.mail-archive.com/fw-general@lists.zend.com/msg25411.html for a discussion on the topic.

Saturday, September 25, 2010

jQuery value and text of selected option in selectbox

You often need the value and text of the selected option of a select box. $("#selectboxid").val() returns the value of the selected option and $("#selectboxid :selected").text() returns the text.

Solution found at:
http://marcgrabanski.com/articles/jquery-select-list-values