Shame on me, I had almost forgotten this software, SourceHighlightIDE, an IDE for GNU Source-Highlight, that I hadn't even released version 0.2! Well, this software still lives :-) and I've just released version 0.3, which, besides many improvements to the GUI, can now handle the new debug output of Source-Highlight.
Wednesday, February 25, 2009
SourceHighlightIDE 0.3
Pubblicato da
betto
a
8:50 PM
0
commenti
Etichette: source-highlight, sourcehighlightide
Tuesday, February 17, 2009
Compiling Qt with MinGW in MSYS
Since I wanted to port some Qt4 applications (I always developed under Linux) in Windows, I downloaded from the trolltech site the Qt libraries for Windows (already compiled) which come with a minimal MinGW compiler to build windows applications. This was the first time I was using mingw, since I've always used cygwin instead.
The Qt installation comes with a start menu item called Qt Command Prompt, which sets all the environment variables for you in order to start building Qt applications.
I tried to build a Qt tutorial example with qmake in msys, and here comes the bad surprise: the Makefiles generated by qmake contains windows paths (e.g., for calling the moc compiler), which the Unix shell does not understand. Here's a screenshot with the error:
C:\Qt\4.4.3\bin/moc.exe -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I'c:/Qt/4.4.3/include/QtCore' -I'c:/Qt/4.4.3/include/QtCore' -I'c:/Qt/4.4.3/include/QtGui' -I'c:/Qt/4.4.3/include/QtGui' -I'c:/Qt/4.4.3/include' -I'c:/Qt/4.4.3/include/ActiveQt' -I'debug' -I'.' -I'c:/Qt/4.4.3/mkspecs/default' -D__GNUC__ -DWIN32 cannonfield.h -o debug/moc_cannonfield.cppI then asked on the nice qtcentre forum, and they pointed me to this blog post where they says it's a well known problem, and that recently Qt can be used also from msys (since qmake will generate Unix shell paths). What wasn't clear to me was that you must recompile Qt libraries yourself to make it work also from msys.
make[1]: C:Qt4.4.3bin/moc.exe: Command not found
make[1]: *** [debug/moc_cannonfield.cpp] Error 127
That's what I've done, downloading the sources of Qt and compiling the libraries from msys.
IMPORTANT: I wasn't able to compile the Qt libraries with the standard MinGW distribution; I had to use the MinGW that comes with Qt installation (i.e., the file qt-win-opensource-4.4.3-mingw.exe).
I did this procedure:
- Set some environment variables (assuming that you unzip the sources in C:\qt-win-opensource-src-4.4.3:
export QTDIR=/c/qt-win-opensource-src-4.4.3/
export PATH=/c/qt-win-opensource-src-4.4.3/bin:$PATH
export QMAKESPEC=$QTDIR/mkspecs/win32-g++ - then you can run configure.exe (this will create the qmake binary and all the Makefiles)
- now run make and wait for about 3 hours!
Couldn't reserve space for cygwin's heap...
Now, if no other errors take place, you'll have your compiled Qt libraries, and binaries, that generate the right Makefiles.
By removing the previous Makefiles, running qmake again (this time it will generate Unix paths to executables), and then make, everything works fine, and you can build qt applications from the comfortable Unix shell: indeed, now, the moc invocation command line is:
C:/qt-win-opensource-src-4.4.3/bin/moc.exe -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I'c:/qt-win-opensource-src-4.4.3/include/QtCore' -I'c:/qt-win-opensource-src-4.4.3/include/QtCore' -I'c:/qt-win-opensource-src-4.4.3/include/QtGui' -I'c:/qt-win-opensource-src-4.4.3/include/QtGui' -I'c:/qt-win-opensource-src-4.4.3/include' -I'c:/qt-win-opensource-src-4.4.3/include/ActiveQt' -I'debug' -I'.' -I'c:/qt-win-opensource-src-4.4.3/mkspecs/win32-g++' -D__GNUC__ -DWIN32 lcdrange.h -o debug/moc_lcdrange.cpp
Pubblicato da
betto
a
9:30 AM
5
commenti
Sunday, January 04, 2009
Backup Linux installation with Partimage
I wanted to try a Mandriva installation on my laptop, but I had run out of space: I'm using most of the time a Kubuntu, but I also have a partition with Sabayon in it, and I didn't want to lose it completely. I thought that this might be the time to try partimage, which I had always heard about.
Previously, I had been using cp for cloning a partition, but I wanted to try something new :-) Moreover, partimage has the advantage, with respect to the dd command, to copy only data from the used portions of a partition, and this can save a lot of space (besides compressing the partition image itself).
It was pretty easy to do the cloning! Partimage has a neat text interface, and here are the screenshots (I chose an external usb driver for saving the image):
Pubblicato da
betto
a
6:39 PM
0
commenti
Etichette: linux
Thursday, January 01, 2009
Happy New 2009!
Pubblicato da
betto
a
12:21 PM
0
commenti
Friday, December 26, 2008
Nokia 6630 and Internet Connection in Linux
Finally, I managed to connect to the Internet with my Nokia 6630 in Linux Kubuntu; it's not that I had troubles before: it's just that I had never had to connect with the cellphone, and I must admit that I quite appreciated that it was really easy and straightforward to this :-)
Actually, first I had tried with the bluetooth way and thanks to many documentation found on the web, I succeeded, though the procedure might not be trivial. However, in that case, I noticed that the connection was not reliable and not very fast. So I decided to buy a (quite expensive for what it does) USB cable (it's just a usb cable... why does it cost 20 euros?!).
Well, with USB the procedure is even more trivial: you just connect it and you'll see that dmesg happily reports this:
[ 149.162045] usb 3-2: new full speed USB device using uhci_hcd and address 2Isn't it nice? It correctly detects the modem and creates a device for it!
[ 149.207194] usb 3-2: configuration #1 chosen from 1 choice
[ 149.461122] cdc_acm 3-2:1.8: ttyACM0: USB ACM device
[ 149.463589] usbcore: registered new interface driver cdc_acm
[ 149.463594] /build/buildd/linux-2.6.24/drivers/usb/class/cdc-acm.c: v0.25:USB Abstract Control Model driver for USB modems and ISDN adapters
ll /dev/ttyACM0So you'll just have to configure your dialup tool using that specific modem. In particular I use kppp, and I have a TIM connection, so I created a new modem using /dev/ttyACM0 and setting as INIT 2 string the following one:
crw-rw---- 1 root dialout 166, 0 2008-12-24 17:28 /dev/ttyACM0
AT+cgdcont=,"ip","ibox.tim.it"and as for the telephone number *99# (username and password are not used, so you can use dummy ones). Here are some screenshots:
Pubblicato da
betto
a
10:34 AM
0
commenti
Monday, December 22, 2008
PhpBibliography 0.6
The new release of PhpBibliography is out!
First of all, this release fixes a very bad bug, discovered by Ezio Bartocci: in the merge authors procedure, the system did not check whether the two authors were exactly the same (i.e., the same id), and this used to lead to the removal of the author as the final step of the procedure, which was really bad. This is now fixed in this new release.
Concerning new functionalities:
- a procedure for trying to detect duplicate papers is now available (it can also use the SOUNDEX algorithm); this will present possible duplicate papers, and let the user select those that are actually duplicate ones;
- as for the main page, it is now possible to group papers also according to the years (an example can be found at my home page);
- by default, papers are ordered by descending year, so that the most recent papers are shown first (this should be the most common wanted behavior);
- a modification timestamp is automatically added to papers, and this timestamp is used as a sorting criterion when showing papers (the papers most recently modified are shown first)
- another desirable feature is now available: when listing papers in administration mode (i.e., when you're logged), a direct edit/delete link is always shown;
- each paper can be now marked as private, meaning that that specific paper will be shown only to logged users;
- as for the DBLP import procedure, this was improved: when there is a cross reference (typically concerning the proceeding book where the paper was published), which is separate from the paper's own bibitem, the system will merge the two bibitems, so that the resulting inserted paper will contain all the information.

The user specifies a non-numeric year
and the system checks it as soon as it leaves that field.The same holds for instance for the title, but this time it's just a warning (since you can have two papers with the same title, e.g., one can be an extended version):
Pubblicato da
betto
a
7:38 PM
0
commenti
Etichette: php, phpbibliography
Saturday, November 15, 2008
GNU Source-Highlight 2.11
Here's the new release of GNU Source-Highlight.
From the low level point of view, the algorithm for finding the best matching regular expression was optimized; The strategy used by source-highlight is to select the first matching rule
- with empty prefix (or prefix containing only space characters, i.e., spaces or tabs) or
- with the smallest prefix.
As for end-user stuff, in C++ and Java, types used in variable and parameter definitions are now highlighted, see the example below.
/*
This is a classical Hello program
to test source-highlight with Java programs.
to have an html translation type
source-highlight -s java -f html --input Hello.java --output Hello.html
source-highlight -s java -f html < Hello.java > Hello.html
or type source-highlight --help for the list of options
written by
Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite
*/
package hello;
import java.io.* ;
/**
* <p>
* A simple Hello World class, used to demonstrate some
* features of Java source highlighting.
* </p>
* TODO: nothing, just to show an highlighted TODO or FIXME
*
* @author Lorenzo Bettini
* @version 2.0
*/
public class Hello {
int foo = 1998 ;
int hex_foo = 0xCAFEBABE;
boolean b = false;
Integer i = null ;
char c = '\'', d = 'n', e = '\\' ;
String xml = "<tag attr=\"value\">ä</tag>", foo2 = "\\" ;
public static void main( String args[] ) {
// just some greetings ;-) /*
System.out.println( "Hello from java2html :-)" ) ;
System.out.println( "\tby Lorenzo Bettini" ) ;
System.out.println( "\thttp://www.lorenzobettini.it" ) ;
if (argc > 0)
String param = argc[0];
//System.out.println( "bye bye... :-D" ) ; // see you soon
}
}
Probably the main novelty is the possibility of specifying a line range, or multiple line ranges: only the lines in the input source that are in that range are actually in the output (--line-range). It is also possible to specify the sorrounding "context", i.e., the number of lines not in range that are put in the output anyway (--range-context); the context itself can be formatted with its own style. Finally, a range separator string can be specified, e.g., "..." (--range-separator). For instance, the following command
source-highlight -s java -f htmlgenerates the following output (note the gray lines of context)
--line-range="12-18","29-34" --line-number
--range-context=3 --range-separator="<...>"
-i test.java -o test_linerange_sep.html
<...>
00009:
00010: or type source-highlight --help for the list of options
00011:
00012: written by
00013: Lorenzo Bettini
00014: http://www.lorenzobettini.it
00015: http://www.gnu.org/software/src-highlite
00016: */
00017:
00018: package hello;
00019:
00020: import java.io.* ;
00021:
<...>
00026: * </p>
00027: * TODO: nothing, just to show an highlighted TODO or FIXME
00028: *
00029: * @author Lorenzo Bettini
00030: * @version 2.0
00031: */
00032: public class Hello {
00033: int foo = 1998 ;
00034: int hex_foo = 0xCAFEBABE;
00035: boolean b = false;
00036: Integer i = null ;
00037: char c = '\'', d = 'n', e = '\\' ;
<...>
Tiziano Muller wrote a configuration file for bash_completion, for source-highlight (thank you Tiziano).
Finally, two new language definitions were added: one for xorg configuration files, and one for the Scala programming language (thanks to Dean Wampler), here are some examples:
# xorg.conf (xorg X Window System server configuration file)
#
# This file was generated by dexconf, the Debian X Configuration tool, using
# values from the debconf database.
#
Section "Files"
EndSection
Section "InputDevice"
Identifier "Synaptics Touchpad"
Driver "synaptics"
Option "SendCoreEvents" "true"
Option "Device" "/dev/psaux"
Option "Protocol" "auto-dev"
Option "SHMConfig" "on"
Option "HorizEdgeScroll" "0"
Option "MinSpeed" "0.5" # touchpad speed when moving slowly
Option "MaxSpeed" "2.0" # touchpad speed when moving fast
Option "AccelFactor" "0.10"
Option "CircularScrolling" "on"
Option "EdgeMotionMinSpeed" "0.5"
EndSection
Section "InputDevice"
Driver "wacom"
Identifier "stylus"
Option "Device" "/dev/input/wacom"
Option "Type" "stylus"
Option "ForceDevice" "ISDV4" # Tablet PC ONLY
EndSection
Section "Device"
Identifier "Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller"
Driver "intel"
BusID "PCI:0:2:0"
# Option "NoDRI"
EndSection
Section "Screen"
Identifier "Default Screen"
Device "Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller"
Monitor "Generic Monitor"
DefaultDepth 24
SubSection "Display"
Modes "1440x900"
EndSubSection
EndSection
Section "ServerLayout"
Identifier "Default Layout"
Screen "Default Screen"
InputDevice "Generic Keyboard"
InputDevice "Configured Mouse"
# Uncomment if you have a wacom tablet
# InputDevice "stylus" "SendCoreEvents"
# InputDevice "cursor" "SendCoreEvents"
# InputDevice "eraser" "SendCoreEvents"
InputDevice "Synaptics Touchpad"
EndSection
// Example Scala file for source-highlight.
case class Point(x: Double, y: Double)
abstract case class Shape { def draw(): Unit = println(this) }
case class Circle(center: Point, radius: Double) extends Shape
case class Rectangle(lowerLeft: Point, height: Double, width: Double) extends Shape
import scala.actors._
import scala.actors.Actor._
object ShapeDrawer extends Actor {
def act() {
loop {
receive {
case s: Shape => s.draw()
case "exit" => { println("exiting..."); exit }
case x: Any => println("Error: Unknown message! " + x)
}
}
}
}
ShapeDrawer.start()
ShapeDrawer ! Circle(Point(0.0,0.0), 1.0)
ShapeDrawer ! Rectangle(Point(0.0,0.0), 2, 5)
ShapeDrawer ! 3.14159
ShapeDrawer ! "exit"
// Output:
// => Circle(Point(0.0,0.0),1.0)
// => Rectangle(Point(0.0,0.0),2.0,5.0)
// => Error: Unknown message! 3.14159
// => exiting...
Pubblicato da
betto
a
1:26 PM
0
commenti
Etichette: source-highlight





.jpg)





