Emtec S800 board picture

Here is a picture of the internal board of my newly aquired Emtec S800 PVR. It works on Linux but Emtec was not so kind to provide the sources of the PVR application (there are some sources of an alternative OEM – Ellion available on the net). I needed to open the box to put a resistor at the internal fan because it was too noisy.
dsc_0806.JPG

How to convert DVD iso to avi using mplayer

Here is a python script to convert an .iso of a DVD to avi and to encode it using mpeg4. It is a slightly modified version of the script found at http://lists.mplayerhq.hu/pipermail/mplayer-users/2003-April/032226.html to work with newer versions of mplayer/mencoder.

Later edit:
It seems that mplayer/mencoder know to play/convert .iso files directly so we can do:
mencoder in.iso -o /dev/null -ovc xvid -xvidencopts pass=1:bitrate=800:threads=2 -oac copy
mencoder in.iso -o out.mpeg -ovc xvid -xvidencopts pass=2:bitrate=800:threads=2 -oac copy

How to convince the SmartGWT ListGrid to automatically fetch from the server only the data it displays

Since I was looking all over the net how to do this and I only found pieces of information, here is an example:

[java]
public class OperationsGrid extends ListGrid{
OperationsGrid(){
super();
TreeGridField accNoField = new TreeGridField(“accountNo”, 150);
TreeGridField commentField = new TreeGridField(“comment”, 150);

setFields(accNoField,commentField);
setHeight100();
setWidth100();
setAutoFetchData(true);
setAlternateRecordStyles(true);
setDataSource(OperationsDS.getInstance());
setShowFilterEditor(true);
}
}
[/java]

[java]
public class OperationsDS extends DataSource{
static OperationsDS instance = null;
static OperationsDS getInstance(){
if(instance == null){
instance = new OperationsDS();
}
return instance;
}

OperationsDS(){

setDataURL(xpath);
DataSourceTextField noField = new DataSourceTextField(“accountNo”, “Account Number”, 128);
DataSourceTextField commentField = new DataSourceTextField(“comment”, “Comment”, 128);

noField.setRequired(true);
noField.setPrimaryKey(true);

setFields(noField,commentField);
setDataFormat(DSDataFormat.JSON);
setRecordXPath(“response/result”);
setClientOnly(false);
}
@Override
protected Object transformRequest(DSRequest dsRequest){
String url = null;

if(dsRequest.getOperationType().equals(DSOperationType.FETCH)){
dsRequest.setActionURL(getDataURL()+”&start=”+dsRequest.getStartRow()+”&end=”+dsRequest.getEndRow());
}
return super.transformRequest(dsRequest);
}
@Override
protected void transformResponse(DSResponse response, DSRequest request,
Object data) {
DSOperationType operationType = request.getOperationType();

if (operationType == DSOperationType.FETCH) {
JSONArray info = XMLTools.selectObjects(data, “/response/resultInfo/numTotalRows”);
Integer total = (int)Math.round(info.get(0).isNumber().doubleValue());

info = XMLTools.selectObjects(data, “/response/resultInfo/startRow”);
Integer start = (int)Math.round(info.get(0).isNumber().doubleValue());

info = XMLTools.selectObjects(data, “/response/resultInfo/endRow”);
Integer end = (int)Math.round(info.get(0).isNumber().doubleValue());

if(total != null)
response.setTotalRows(total);
if(start != null)
response.setStartRow(start);
if(end != null)
response.setEndRow(end);
} else {
super.transformResponse(response, request, data);
}

}
}
[/java]

In this example the server outputs in JSON format and returns the the current start row, current end row and total number of rows in response/resultInfo.
Basically you need to override transformRequest and transformResponse. In transformRequest you should add the start and end row to the requestURL and in transformResponse you should set the startRow, endRow, and totalRows, provided that you receive this information from your server. Also don’t forget to setAutoFetchData(true) on the grid.

Hope this helps somebody.

MySQL Java SQLException error codes enum

Because I had this problem and I could not find a list of MySQL error codes on the Internet, I’ve decided to implement my own MySQL error codes enum. It is based on MySQL 5.1.35 sources, include/mysqld_ername.h file.
Now I can do something like this:

[java]
catch (SQLException e) {
if(e.getErrorCode() == MySQLExceptionCode.ER_DUP_ENTRY.getErrorCode()){
r = Result.DUPLICATE_ACCOUNT_NO;
} else
r = Result.DATABASE_ERROR;
}
[/java]

You can find the java file here.

Cifs problem in Gentoo

If you encounter the following error when you try to mount a cifs filesystem:
CIFS VFS: cifs_mount failed w/return code = -22

try to:
#emerge mount-cifs

I did not find any indications on the net that a separate package should be installed in order to use cifs.

Later Update: same problem in ubuntu, you need to install smbfs
#apt-get install smbfs