What a good studying project: HbbTV over DVB-s

0 comments
Today I found a good project's report of a guy's final studying project which is to
"build an HbbTV application over a DVB-S signal during the FIFA 2010 World Cup event".

Here is the documentation (67 pages).

He is also using OpenCaster and free tools like DVBsnoop under Linux.
You can see how he managed to fill the DVB SI tables to handle an HbbTV application.
But now this is integrated inside OpenCaster so you just have to use them without worry.

Nevertheless enjoys this good experimentation.

Last night ... Once ... I had a dream and this is it ... (song by NightWish)

0 comments
Me again ... and last night I had an idea to improve the logging messages.
Just think about the HASH option on the FTP client console. Remember
this '#' character growing for every packet received.
Same stuff with the command WGET that shows you a graph of the current speed.


Years ago we were able to do such stuff on text consoles using again ANSI escape sequences !!

Have a look here for those ANSI sequences

So I have the dream that we can also do this within LOG4J messages ... wait'n see ...
I will have to test this. Then stay tuned and you will see a piece of Java code soon.

Colorized logging messages in Console or File using the well-known log4j

0 comments
LOG4J is being used by a lot of JAVA developers.
It is a better way of displaying debugging messages other than using the old "system.out" method.

But under LINUX, you can improve a lot those outputs. You can colorized them !!
Yeah this is true. It's not magic. You just have to remember that years ago,
we were using ANSI syntax on BBS (Bulletin Board Systems ... before the era of Internet).

Thus the trick is just to define your own log4j appender with your own class :
package com.mypackage;

import org.apache.log4j.Level;
import org.apache.log4j.Priority;
import org.apache.log4j.WriterAppender;
import org.apache.log4j.spi.LoggingEvent;

public class ANSIConsoleOrFileAppender extends WriterAppender {
 
private static final int NORMAL = 0;
private static final int BRIGHT = 1;
private static final int FOREGROUND_BLACK = 30;
private static final int FOREGROUND_RED = 31;
private static final int FOREGROUND_GREEN = 32;
private static final int FOREGROUND_YELLOW = 33;
private static final int FOREGROUND_BLUE = 34;
private static final int FOREGROUND_MAGENTA = 35;
private static final int FOREGROUND_CYAN = 36;
private static final int FOREGROUND_WHITE = 37;
private static final String PREFIX = "\u001b[";
private static final String SUFFIX = "m";
private static final char SEPARATOR = ';';
private static final String END_COLOUR = PREFIX + SUFFIX;
private static final String FATAL_COLOUR = PREFIX + BRIGHT + SEPARATOR + FOREGROUND_RED + SUFFIX;
private static final String ERROR_COLOUR = PREFIX + NORMAL + SEPARATOR + FOREGROUND_RED + SUFFIX;
private static final String WARN_COLOUR = PREFIX + NORMAL + SEPARATOR + FOREGROUND_YELLOW + SUFFIX;
private static final String INFO_COLOUR = PREFIX + NORMAL+ SEPARATOR + FOREGROUND_GREEN + SUFFIX;
private static final String DEBUG_COLOUR = PREFIX + NORMAL + SEPARATOR + FOREGROUND_CYAN + SUFFIX;
private static final String TRACE_COLOUR = PREFIX + NORMAL + SEPARATOR + FOREGROUND_BLUE + SUFFIX;
protected void subAppend(LoggingEvent event) {
this.qw.write(getColour(event.getLevel()));
super.subAppend(event);
this.qw.write(END_COLOUR);
if (this.immediateFlush)
this.qw.flush();
}
private String getColour(final Level level) {
switch (level.toInt()) {
case Priority.FATAL_INT: return FATAL_COLOUR;
case Priority.ERROR_INT: return ERROR_COLOUR;
case Priority.WARN_INT: return WARN_COLOUR;
case Priority.INFO_INT: return INFO_COLOUR;
case Priority.DEBUG_INT:return DEBUG_COLOUR;
default: return TRACE_COLOUR;
}
}
}
Then you can define your logging preferences thru this log4j.xml file in your WAR project for example under src/main/webapp/WEB-INF/classes :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">

    <appender name="CONSOLE-OUT" class="com.mypackage.ANSIConsoleOrFileAppender">
        <param name="target" value="System.out" />

        <layout class="org.apache.log4j.PatternLayout">
            <param name="conversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n" />
        </layout>
        <filter class="org.apache.log4j.varia.LevelRangeFilter">
            <param name="levelMin" value="finest" />
            <param name="levelMax" value="warn" />
        </filter>
    </appender>

    <logger name="com.mypackage">
        <level value="trace"/>   <!-- levels : TRACE < DEBUG < INFO < WARN < ERROR < FATAL -->
    </logger>

    <logger name="org.springframework">
        <level value="off"/>
    </logger>
    
    <root>
        <priority value="trace" />
         
        <appender-ref ref="CONSOLE-OUT" />
    </root>
</log4j:configuration>
Then you can see the colored output using your Jetty or Tomcat server.
You just have to be precise when you specify the level of your log message.
In fact those levels will be filtered using a threshold one.

I think we can improve the way it looks inside a single log message by putting the given parameters in bold for example (as it is done in editors using syntax highlighting)
But this will be for another blog ...
In the meantime, you can see how to code color sequences :
ANSI color codes

For the time being, ENJOY your new way of life with proper logging messages !!

OpenCaster v2.5

0 comments
For this new year, OpenCaster(tm) has been upgraded to v2.5
In this new version, you can find a new option (set by default)
in the carousel builder tool.

The tool called oc-update.sh now contains a new smart compression skill.
You can have files with .solo filename extension that will be able to be updated
in their own DSMCC module (in order to have a quick carousel's file update)

ENJOY this new option that will be useful for HbbTV services on our DTT (Digital Terrestrial Television) channels.

btw: OpenCaster manual has also been upgraded to v1.8 (file called AvalpaBroadcastServerUserManual-v1.8.pdf)
Copyright © IT pages