Canvas & QR-Code
I played a little with HTML 5 Canvas and QR-Code.
Using the excellent javascript library from Kazuhiko Arasé, I made an extension to draw a QR-Code in an HTML5 Canvas.
(more…)
I played a little with HTML 5 Canvas and QR-Code.
Using the excellent javascript library from Kazuhiko Arasé, I made an extension to draw a QR-Code in an HTML5 Canvas.
(more…)
Extracting information from table inside the page, and inserting into the very same page a Google Pie Chart? Easily done with jQuery!
(more…)
The next script can be usefull to list all PIDs of a given process and its childs (i.e.: threads also under Linux)
It’s quite brute-force, using /proc extensively. Most probably very Linux specific…
#!/usr/bin/perl -w
use strict;
my $pid=shift @ARGV;
# We'll first make a hash %h where:
# each key is the PID of a process
# each value is a list of the PIDs of the sub-process (direct descendant (ie: children) only, no grand child,...)
# we'll loop on all files under /proc, and take only those whose filename is a number
opendir(DIR,"/proc/") or die ("Can't list proc");
my $file;
my %h=(); # key=pid, value=list of children
while($file=readdir(DIR)) {
next unless $file =~ m/^d+$/; # only numbers
open(STAT,"/proc/$file/stat") or next; # open the stat file for this process
my $s=<STAT>;
my @f=split(/s+/,$s);
# pid: $f[0] parent PID: $f[3]
push @{ $h{$f[3]} },$f[0];
close(STAT);
}
closedir(DIR);
my @pids=();
# recursive function to add a pid and the PIDs of children, grand-children,...
sub add($) {
push @pids,$_[0];
map { add($_) } @{ $h{$_[0]} } if (defined($h{$_[0]}));
}
# print join("n", map { $_ . ':' . join(',',sort @{ $h{$_} } )} sort keys %h);
add($pid);
# output results
print join(' ',@pids)."n";
In a project that I’m working on, web pages are generated, and sent by FTP to a remote server. Some of those pages are simple HTML pages, others SHTML (i.e.: use server side include, or SSI, to include some blocks of information), and some others are PHP pages.
I’ve been in a case where a given block of code would have to be used both by SHTML and by PHP page. I can generated any code that I’d like, but the same code must be used for the PHP and SHTML blocks. In addition, it would be nice if this block, when seen directly as HTML (no PHP neither SSI parsing), would display correctly.
(more…)
I’ve undertaken a new project, which uses Hibernate, MySQL, Spring, Maven2 and a few other technologies. During this, I’ve stumbled on a bug, which I first though came from Hibernate, but later discovered to be a MySQL issue.
(more…)
MySQL v4.0 doesn’t handle encoding very well. Basically, its considering everything you send it as simple binary data. At least, it doesn’t corrupt it, but no conversion is made. I had to interact, from Perl, with a database which was populated by PHP (v4 also), and which had ISO-8859-1 data in it.
(more…)
I’ve spent a few years writing Perl without ever looking carefully at the map function, but since I’ve discovered it, I use it often. I propose here some sample usage that I’ve found usefull. I’ll also show how to use the grep function, which is quite similar in usage.
(more…)
On my machine, I have a special user account for when I want to make tests. Sometimes, I’d like to run a command under this account while I’m working in my X desktop, without switching desktop.
Please note that this article is not oriented toward people unfamiliar with Unix.
(more…)
While implementing the layout of this site in PHP, I found the tutorial on A List Apart, and wished to implement it here. However, I wanted to be able to change the column widths without having to recalculate manually the different dimensions.
(more…)
Lyceum is a blog farm written in PHP and based on Word Press. I’ve had to interat with it from Java. I won’t copy here the workarounds needed to Lyceum to be usable through XML RPC, since I’ve already added some at the Lyceum Wiki page. Thanks to the other contributors of that page, they helped me a lot.
M | T | W | T | F | S | S |
---|---|---|---|---|---|---|
« Nov | ||||||
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 |