Saturday, August 22, 2009

Creating a shared library on various platforms

When applications get bigger and code needs to be shared among different applications, then shared libraries sound like a great idea. To get this done, a multi platform compilation sprint race begins.

Shared libraries are libraries that are loaded by programs when they start. When a shared library is installed properly, all programs that start afterwards automatically use the new shared library. It's actually much more flexible and sophisticated than this, because ... [read more]
The library had to be compiled for Linux, Windows, Mac OS X, AIX, HP-UX, Sun OS and Solaris. Internet search engines along with compiler man pages are the best tools for the job. By looking around, I found the following links useful:

Linux:
AIX:
Mac OS X:
Sun OS, Solaris
HP-UX:
Creation of the shared lib was done for a mid-sized project. The library's build process was based on gmake for Unix and gmake and nmake on Windows. The main application's build system also needed adjustments to use the new library. This is also described in the links above.

Saturday, August 01, 2009

30 days with HTC magic: apps I installed

Its been 30 days with HTC magic. I have installed the following apps, all from the Market:

  • AK Notepad
  • AndNav2
  • Any Cut
  • Astrid Task/Todo list
  • Barcode Scanner
  • CompareEverywhere
  • Compass
  • Connectot
  • File Browser
  • GPS Status
  • Greek Input Method
  • My Maps Editor
  • My Tracks
  • Netcounter
  • Places Directory
  • Shazam
  • Text-To-Speech Library - needed by AndNav2
  • Voice Recorder

Saturday, July 25, 2009

EliteBook 8730w - OpenSuse 11.1 - Multimedia keys

To have the volume multimedia keys to work on OpenSuse 11.1 and the elitebook 8730w, you will need to configure the keys with xmodmap:

put in ~/.Xmodpap:

keycode 176=XF86AudioRaiseVolume
keycode 174=XF86AudioLowerVolume
put in .kde4/Autostart/Xmodmap-autoload:
#!/bin/sh
xmodmap ~/.Xmodmap
issue:
chmod +x .kde4/Autostart/Xmodmap-autoload
You may need to check the location of your KDE Autostart directory. This can be found in System Setttings>Personal>About me.

Sunday, July 19, 2009

femio - A python reader for Finite Element Models

femio is an application that allows you to read a Finite Element Model in one of the supported formats and provide tools and functions on the model's contents. Also, it provides the required functionality to allow the user to create tools and manipulate data. Such tools are: model statistics, model image view (screen shot), keyword removal or substitution, etc.

You can see the projects home page here: femio

Femio is based on an older project of mine: abq2img. Recently, I had the need of converting an ABAQUS input model containing *PARAMETER keywords. I used the abq2img codebase and with minimal work, I was able to achieve my goal. Based on that success, I decided to revive the project and extend its functionality and capabilities to over FEM formats.

Its main advantage is that it provides the low level parsing for FE models. This allows the user to manipulate model data while not having to parse the file and provide support for keywords. Thus creating model previews in PNG format is quite easy:


Sunday, May 24, 2009

(wireless) Kodak picture frame w820 and Linux.


2 days ago I bought a KODAK EASYSHARE W820 Wireless Digital Frame. I intended of using it to stream media from my Linux computer, preferably using its wireless capabilities. The disappointing thing is that the manufacturer only provides software for Windows.

Connection to the internet is quite easy and straight forward. Just follow the instructions in the documentation. When connected, the frame automatically checks for firmware updates and prompts to install them. I upgraded smoothly, and all of my following impressions are based on the latest firmware available: 2008.10.28.

So, I am going through the process of finding the frame's capability to interact with Linux. It seems that three methods are available: USB connectivity, RSS feeds and UPnP support. Frame settings can be reached from the touch interface and through its web UI.

USB connectivity: The frame connects to the computer with a USB cable and is automatically identified as a flash drive. Normal file operations can be performed to transfer images and videos to the internal memory.

RSS feeds: The frame connects to various RSS feeds, most notably Flikr. It also has the capability of logging into a Flickr account. Also, custom URL feeds can be accessed. The configuration of the RSS connectivity is achieved through the frames web UI. You can find the frame's IP by accessing the frame's settings from its built in touch UI.

UPnP support: The frame has a UPnP client built in. However, this is not mentioned anywhere in the documentation that accompanies the product and few references exist in the Internet. I installed mediatomb, a UPnP server, on my laptop. Then through the Network Setting on the frame, connection to my laptop was enstablished and I could access my media, both images and video.

What I find missing from connectivity options it the ability to copy media files directly from the PC, through the wireless interface, to the frame's internal memory. Also, the possibility to change any of its settings through the web interface would be greatly desired.

Tuesday, April 28, 2009

Fake road sign advertisement

Creating fake road signs is fun and quite popular on the internet. I gave it a go and I found out it is not that difficult to create one using standard tools (ex. gimp). Here is the result of my first attempt:


An advertisement of papitsa's blog.

Saturday, April 18, 2009

Blogger Tag Cloud Widget

I wanted to have a Tab Cloud in my blog. However, blogger provides only the Label widget which gives only a list of the blog's labels.

I found this blog entry , which produced something very similar to what I wanted. I modified it so that:

  • it is more to my taste
  • allows for further development and easier modifications.

You can see the resulting Tag Cloud on this blog (collumn on the right) and also in http://www.papitsa.gr/

The installation instructions can be found in the original post.




<b:widget id='Label1' locked='false' title='Tags' type='Label'>
<b:includable id='main'>
<b:if cond='data:title'>
<h2><data:title/></h2>
</b:if>
<div class='widget-content' style='text-align: center;'>
<script type='text/javascript'>
/*
Simple Blogger Tag Cloud Widget
by Raymond May Jr.
http://www.compender.com
Released to the Public Domain
Modified by Michalis Giannakidis :
o) tune parameters to my likes
o) modifications to allow more flexibility in formatting of tags and
allow further development.
*/
//Variables:
var max = 130; //max css size (in percent)
var min = 70; //min css size (...)
var showCount = 1; // show counts? 1 for yes
var minCount = 1; // what is the minimum count for a Tag to be shown? 1 for all.

//Begin code:
var range = max - min;

function labelObj() {}

//Build label Array
var lb = new Array();

var most = 1;
<b:loop values='data:labels' var='label'>
var item = new labelObj();
item.label = (&quot;<data:label.name/>&quot;);
item.url = (&quot;<data:label.url/>&quot;);
item.count = (&quot;<data:label.count/>&quot;);
lb.push(item);

if ( most &lt; &quot;<data:label.count/>&quot; ) {
most = (&quot;<data:label.count/>&quot;);
}
</b:loop>


//Labels sort, ignore case
function sortLabels(a, b) {

aa = a.label.toLowerCase();
bb = b.label.toLowerCase();
if ( aa &lt; bb ) {
return -1;
} else if ( aa &gt; bb ) {
return 1;
} else {
return 0;
}
}
lb.sort(sortLabels);


//Begin HTML output
for (x in lb) {
if(x != &quot;peek&quot; &amp;&amp; x != &quot;forEach&quot;
&amp;&amp; lb[x].count &gt;= minCount){

//Calculate textSize
var textSize = min + Math.floor((lb[x].count/most) * range);
//Show counts?
if(showCount == 1) {
var count = &quot;(&quot; + lb[x].count + &quot;)&quot;;
}else{
var count = &quot;&quot;;
}
//Output
document.write(&quot;<span style='font-size:&quot; + textSize +
&quot;%'><a href='&quot; + lb[x].url + &quot;'>&quot; + lb[x].label +
count + &quot;</a></span> &quot; );
}

}
</script>
<b:include name='quickedit'/>
</div>
</b:includable>
</b:widget>

Thursday, March 05, 2009

Determining the age of a Linux installation.


Have you ever been curious of how old your current Linux installation is?

Three indirect ways of finding this out follow:

  1. Retrieve info from the filesystem (ext2-ext3 only).

    Provided your installation has an ext[23] filesystem,
    run as root:
    dumpe2fs -h <device> |grep "Filesystem created"
    Usually, at least the boot partition is of this type.

  2. Investigate the dates of files in the root directory.

    Run the command
    ls -lu /
    This will show you the access times of the contents of the root directory. In most cases directories like /bin should be unmodified since their creation during the system install process.

  3. Investigate system log files.

    All Linux systems keep log files. They place them in the same directory, usually in /var/log/. Pick a log, like syslog or wtmp, and look the first lines of the file. A date of the log entry will be available. Note though, that most distributions rotate and compress log files periodically. In this case, you need to look up this information in the oldest log archive. Also, old log archives may be automatically deleted, so finding the installation log messages is impossible in this case.
The age of my current Gentoo installation is 3 years 9 months:

dumpe2fs -h /dev/hda2|grep
"Filesystem created"
dumpe2fs 1.39 (29-May-2006)

Filesystem created: Thu Jun 9 16:09:37 2005


Saturday, November 01, 2008

Αφίσα με θέμα την Οδικη Ασφάλεια

Με αφορμή μια προκήρυξη διαγωνισμού αφίσας με θέμα την Οδική Ασφάλεια από το ΓΕΣ, έφτιαξα την παρακάτω αφίσα:



η οποία έτυχε ιδιαίτερα θερμής υποδοχής από την διοίκηση της μονάδας όπου υπηρετώ.

Η αφίσα σχεδιάστηκε έχοντας σαν πρωταρχικούς στόχους την οπτική απλότητα και την άμεση αποτύπωση του μηνύματός της στον αποδέκτη.

Η απλότητα της αφίσας καταδεικνύεται από τα τρία γραφικά στοιχεία που συνθέτουν το θέμα της: το κείμενο, ένα απλό σκίτσο αυτοκινήτου και ένα σήμα του Κ.Ο.Κ. Η απλότητα επιλέχθηκε θεωρώντας ότι όταν δεν υπάρχει τίποτα που να μπορεί να αφαιρεθεί, τότε έχει επιτευχθεί ένα άριστο αποτέλεσμα.

Ακολούθως, η αμεσότητα της επικοινωνίας με τον αποδέκτη επιτυγχάνεται μέσω του κειμένου με τον τονισμό των γραμμάτων «ΠΑΥΤΕ». Η προσταχτική αυτή λέξη, μια παράλλαξη του «πάψτε», τονίζεται στο θέμα της αφίσας και συνδέει μεταξύ τους πέντε σπουδαίους παράγοντες της οδικής ασφάλειας. Μέσω των γραμμάτων της λέξης αυτής, μπορούν με ευκολία να μεταφερθούν ή να διδαχθούν στον αποδέκτη, οι κανόνες αυτοί. Αντιστρόφως, από την λέξη «ΠΑΥΤΕ», μπορεί και ο αποδέκτης μόνος του, να τους αναζητήσει.

Συμπληρώνοντας τα προηγούμενα, σκοπίμως στο θέμα της αφίσας δεν υπάρχει κάτι που να προσδιορίζει και να σχετίζεται με το σύνθημα «ΠΑΥΤΕ». Αντίθετα αυτό αφήνεται στην φαντασία του αποδέκτη ο οποίος, με βάση το θέμα της αφίσας, μπορεί να συνδέσει το «ΠΑΥΤΕ» με τους δικούς του κανόνες όπως αυτοί ταιριάζουν σε κάθε πτυχή της καθημερινότητας. Για παράδειγμα:

  • ΠΑΥΤΕ (πάψτε) να τρέχετε
  • ΠΑΥΤΕ (πάψτε) να οδηγείτε απρόσεχτα
  • ΠΑΥΤΕ (πάψτε) να οδηγείτε υπό την επήρεια αλκοόλ
  • ΠΑΥΤΕ (πάψτε) ό,τι μπορεί να οδηγήσει σε ένα τροχαίο ατύχημα
και άλλα παρόμοια.

Η αφίσα είναι μεγέθους Α3, με 300 dpi ανάλυση και μπορείτε να την βρείτε, σε πλήρη ανάλυση, εδώ.

Thursday, May 01, 2008

Remove obsolete objects form a library archive using GNU make


The build system of an application I work on, stores each compilation object in a library archive (using GNU ar). With every project build, the contents of this archive are updated with new objects from the compilation. This is achieved by running ar -cru library.a $(OBJECTS)

Moreover, the archive needs also to be updated when files (and thus their objects) are removed from the project. The most convenient phase for this to happen is during the build.

The required archive updating, can be performed with the following part in the Makefile (consider this a template, since it cannot be used as is)

Makefile


obj: $(OBJECTS)
ifneq (,$(filter-out $(OBJECTS),$(wildcard $(OBJECT_DIR)*.o)))
$(warning "Deleting unused object files...")
ifeq (ar,$(firstword $(AR)))
-$(firstword $(AR)) -d $(LIBRARY) $(filter-out $(OBJECTS),$(wildcard $(OBJECT_DIR).o))
else
$(warning $(LIBRARY) may contain obsolete objects: $(filter-out $(OBJECTS),$(wildcard $(OBJECT_DIR)*.o)))
endif
rm -f $(filter-out $(OBJECTS),$(wildcard $(OBJECT_DIR)*.o))
rm -f $(filter-out $(OBJECTS:.o=.d),$(wildcard $(OBJECT_DIR)*.d))
endif


The above assumes that you are using GNU make and GNU ar. Also, dependencies are stored per source file, along with the objects and removed with them.

With the auto removal of objects, manual update or full rebuild of the archive is unnecessary. Also, headaches and hard to track errors, coming from doubly defined functions in the archive and obsolete code being used, are avoided.

Sunday, April 27, 2008

Θεσσαλονίκη - Καλαμάτα, αναζήτηση δρομολογιού ΟΣΕ από το www.ose.gr

Στη προσπάθεια μου να μετακινηθώ μέ σιδηρόδρομο από τη Θεσσαλονίκη στην Καλαμάτα, επισκέφτηκα τον ιστοτόπο του ΟΣΕ (www.ose.gr). Η ημερομηνία του ταξιδιού μου ήταν η 12 Μαΐου 2008, ενώ η αναζήτηση των δρομολογίων έγινε στις 20 Απριλίου.

Συνάντησα τα εξής προβλήματα:


  1. Βάζοντας για αφετηρία τη Θεσσαλονίκη, δεν υπάρχει προορισμός στην Πελοπόννησο.

  2. Βάζοντας για αφετηρία τον "ΣΣ. Καλαμάτας", στην αναζήτηση προορισμού και στο γράμμα Κ δεν υπάρχει ο σταθμός του Κιάτο. Αντίθετα, τον βρίσκω στο Π (για Πάτρα)

  3. Καθώς η εύρεση επιθυμητών δρομολογίων φαίνεται αδύνατη, δοκιμάζω το Θεσσαλονίκη -> Αθήνα. Και εκεί η αναζήτηση αποτυχαίνει. Με δοκιμές βρίσκω πως δεν υπάρχουν δρομολόγια καταχωρημένα για μετά της 10 Μαΐου.


Η σελίδα του ΟΣΕ ήταν αργή και μη εξυπηρετική. Επιπλέον δεν υπάρχουν πολλά χαρακτηριστικά που υπάρχουν στις αντίστοιχες υπηρεσίες άλλων μέσων μεταφοράς.

Αργότερα έμαθα πως για να πάει κανείς με τρένο από τη Θεσσαλονίκη στην Καλαμάτα, πρέπει πρώτα να πάει Αθήνα. Από εκεί, με τον προαστιακό να φτάσει Πάτρα και κατόπιν, αφού αλλάξει και πάλι τρένο, θα κατευθυνθεί για Καλαμάτα. Μάλλον τέτοιου είδους δρομολόγια δεν μπορεί να τα χειριστεί το πρόγραμμα αναζήτησης δρομολογίων του www.ose.gr. Η τηλεφωνική υπηρεσία εξυπηρέτησης πελατών ήταν σαφώς πιο εξυπηρετική.

Tuesday, April 22, 2008

Release cvsxxdiff v1.5

cvsxxdiff version 1.5 was released today.

In this release many significant changes are introduced, as you can see from the ChangeLog. At the moment, there are no plans for a new project version with major features.

Saturday, March 29, 2008

Αποστολή SMS από τη γραμμή εντολών

Από τα πρώτα προγράμματα που έγραψα σε C ήταν το mycosmos, ένα πρόγραμμα αποστολής SMS από τη γραμμή εντολών μέσω μιας web υπηρεσίας.

Όμως ο καιρός πέρασε, η web υπηρεσία άλλαξε και το mycosmos έπαψε να δουλεύει. Έτσι τον Δεκέμβριο του 2007 το ξαναέγραψα από την αρχή, δημιουργώντας αυτή τη φορά το climycosmos.

Η έκδοση 0.4 του climycosmos είναι αρκετά πλήρης. Είναι απολύτος αυτόνομη από εξωτερικές εξαρτήσεις και πλήρως παραμετροποιήσιμη για καθημερινή χρήση. Τις παράμετρους αποτελούν:
i) ο λογαριασμός χρήστη και οι κωδικοί εισόδου μέσω του οποίου θα αποσταλεί το μήνυμα
ii) ο ονομαστικός προσδιορισμός του παραλήπτη, μέσω ενός στοιχειώδους τηλεφωνικού ευρετηρίου
Τα παραπάνω αποτελόυν ιδιαίτερα σημαντικά γνωρίσματα, απαραίτητα κατά την γνώμη μου, που δίνουν μεγάλη ευχρηστία στην εφαρμογή.

Όλες οι παράμετροι του προγράμματος ορίζονται από τον χρήστη και αποθηκεύονται σε ένα αρχείο κειμένου με όνομα .climycosmos.ini Η μορφή του αρχείου είναι εξαιρετικά απλή και ξεκάθαρη:


[Default]
username: 69XXXXXXXX
password: XXXXXXXX

[account2]
username: 69XXXXXXXX
password: XXXXXXXX

[Phonebook]
contact1: 69XXXXXXXX
contact2: 69XXXXXXXX
contact3: 69XXXXXXXX

Μέσω αυτής της παραμετροποίησης καθίσταται δυνατή η αποστολή μυνημάτων από τη γραμμή εντολών με τις ελάχιστες δυνατές παραμέτρους, πχ:
climycosmos -t contact1 -m "Γεια σου". 
Ασφαλώς το σύνολο των παραμέτρων μπορούν να περάσουν και άμεσα από την γραμμή εντολών.

Το climycosmos διανέμεται δωρεάν, κάτω από την GPLv2 άδεια χρήσης.

Tuesday, March 25, 2008

Office decoration using origami

My interest in origami folding, found some usage as means of office decoration. Some nice examples are given in the photographs that follow.

Roses



Bird (flying parrot) over Chamaedorea


Birds hanging from the ceiling


This technique creates quite a good result and a pleasant environment. The existence of moving decorations that one can even play with, give joy. Also, the addition of colors in the working place is great!

Tuesday, March 11, 2008

Report compilation total time using GNU make


When working constantly on the same application, it is very useful to have an idea of the time it takes to compile. Having this information allows you to plan your work ahead, compare machines, developing environments, etc.

I have put together this Makefile, to print the total compilation time. It requires gmake and the UNIX shell utilities date, bc, echo and printf.


Makefile


# Time expressed as the seconds of the year. More portable than seconds since
# the epoch: `date +%s'
COMPILE_START_TIME := $(shell date +\(%j\*24\*60\*60+%H\*60\*60+%M\*60+%S\))
COMPILE_CURRENT_TIME = `date +\(%j\*24\*60\*60+%H\*60\*60+%M\*60+%S\)`


# Print the time difference between Tcurrent and Tstart. This function can be
# used after any target, as shown in the form: (see example)
# $(call print_timer,$(COMPILE_CURRENT_TIME),$(COMPILE_START_TIME))

# args: Tcurrent = $(1), Tstart = $(2)
define print_timer
@CT=$(1) && \
printf "Compilation total time: %.2d:%.2d (min:sec)\n" \
`echo "($$CT - $(2))/60" | bc` \
`echo "($$CT - $(2))%60" | bc`
endef


all: target

target:
@echo "Compiling for 2 seconds ..." && sleep 2 && echo Done
$(call print_timer,$(COMPILE_CURRENT_TIME),$(COMPILE_START_TIME))


Using this Makefile and running make, produces the following output:


Compiling for 2 seconds ...
Done
Compilation total time: 00:02 (min:sec)

Sunday, March 09, 2008

Folding paper for fun and office decoration

A few months ago I became interested on paper folding as a hobby. I searched the web for origami diagrams. Following the instructions I found, I created some of my own.

I showed them around and after motivation from a colleague, I used these paper foldings to decorate my office space. I hanged some of the from the ceiling using a fishing rod. I chose shapes of birds to hand and placed them on top of plants. The result was quite good and other people came and asked me to fold them some shapes to have on their desks.

An incomplete list of the shapes I have folded:

Pencil holder

Pencil holder origami

Candy dish
Candy dish origami

Swan

Swan origami

Rose
Rose origami

I folded flying parrots and a cranes to hang for decoration from the ceiling. Pictures will be included on a later post.

Saturday, February 16, 2008

xkcd webcomic

Το xkcd είναι ένα ενδιαφέρον webcomic. Ο συγγραφέας του το περιγράφει σαν "a webcomic of romance, sarcasm, math, and language". Η θεματολογία του είναι αρκετά προσφιλής για ανθρώπους που ασχολούνται με υπολογιστές (compiler complaint) και την τεχνολογία γενικότερα.

Thursday, June 15, 2006

Initialize my blog

date: Thu Jun 15 20:31:46 EEST 2006
Initialize my blog.