Main >

Viraptor's dev-log

Your mind-fluffer hopefully

Gtk# animation

on December 16th, 2007

Information for anyone, who is looking for solution to not-refreshing DrawingArea on google and is finding only questions about it :)

You shouldn’t touch DrawingArea from anything else than original gtk/glib thread. That means doing:

drawingArea.QueueDraw();
// or
drawingArea.GdkWindow.ProcessUpdates(...);
// and others

from System.Threading.Timer callback won’t do any good. Window may start updating in the first case after resizing of the window, and update only while resizing in second case, but that’s probably undefined random behaviour. Proper way to handle refreshing (as far as information from different mailing lists put together suggest) is:

uint animationTimer = GLib.Timeout.Add(
	milisecs,
	new GLib.TimeoutHandler(onAnimationTimer));
...
bool onAnimationTimer() {
  drawingArea.QueueDraw();
  return true;
}

Hope that helps if you were trying to achieve animation.

Backports repository

on May 20th, 2007

As suggested before, I’ve created an Ubuntu Feisty backport repository for mono stuff. Monodevelop & deps from Gusty is already available. Line for your sources.list is:

deb http://www.viraptor.info/repo feisty-custombackports contrib

Have fun!
I hope that mono 1.2.4 will hit that repo soon also.

Psi logs merging

on May 3rd, 2007

Did you ever change your jabber server?
Lost possibility to browse chat history?

(yes - that does sound like a bad commercial)

You can use PsiLogMerger, to resolve this. Specify translations -> for example -t msn.firsthost.com=msn.secondhost.com will update logs from secondhost only with all messages from firsthost, skipping duplicates.

Needs only ruby to run. Run with -h for usage help. Have fun.

Maildirs merging

on January 10th, 2007

Lately, I’ve run into a problem after moving hosting server from one provider to another. There were some old mails in backed-up maildirs and some new mails in current maildirs. For some reason mailutil from pine package didn’t want to transfer old mails. New mails of course had to stay, and old boxes had to me merged with all attributes saved. For some other reason perl script I’ve found didn’t work also (based on Mail::Folder::Maildir).

Fortunately fast simple hacked script using Mail::Box::Maildir worked with no problems. In case you’d like to do the same - run it with full path to source maildir in first arg and destination maildir in second:

#!/usr/bin/perl
use Mail::Box::Maildir;
use Mail::Box::Manager;
my $src = shift @ARGV;
my $dest = shift @ARGV;
my $mgr = new Mail::Box::Manager;

my $mb = $mgr->open(
folder => $src,
access => 'r',
type => 'Mail::Box::Maildir')
or die "error: $!";

my $nmb = $mgr->open(
folder => $dest,
access => 'rw',
create => 1,
type => 'Mail::Box::Maildir')
or die "error: $!";

$mb->copyTo($nmb, select => 'ALL',
subfolders => 'RECURSE');
$mgr->closeAllFolders();

C# shell

on December 21st, 2006

C-sharp shell? Great!

Although my friend, when asked whether he would like to have a shell with bindings to Java, replied “System.out.println(”NO”);”… I was playing around with different shells. Zoidberg (perl), psh (perl), zsh (almost normal), etc.

Power shell would be nice, if it didn’t try to export objects into some strange new shell language constructs (cmdlets). If the thing they wanted to achieve was similarity to shell, then normal stripping of “()” and “,”, that can be deduced from context would be enough… Of course making some namespace default for searching objects (Cssh.Something), would be appropriate. “Var” keyword from C# v.3 can also come handy.
I haven’t tried cssh yet, but I can’t wait to do it! Downloading as I write it.

Just downloaded… It’s probably NOT what you’d like to use - it’s just for files, but a good start anyway.

PowerShell port was already proposed, but author doesn’t respond to emails, so project was probably dropped. Still - it’s nice to see, that some people want to get the same things I do…

As most people shout “Yet another shell and object one? NOOOOOOOOOO!!!!!!!” while reading this, I’ll tell what I want in a real linux object shell and why I’d like it to be there:

  1. foreach(i in Interfaces) if(!i.IsAlias) echo Format(”interface {0}: {1}”, i.Name, i.Ip);
  2. echo Partitions[”/dev/hda”].Capacity
  3. echo new Ping(”10.1.1.29″).GetAverage(5)
  4. prcs = Processes.Get(”terminal-name”)
    foreach(prc in prcs) if(!Processes.Current.IsChildOf(prc)) Kill(prc);
  5. Iptables.Add(”Input”, new Iptables.SourceFilter(”127.0.0.1″), Iptables.ACCEPT)
    (even if that doesn’t seem that nice in this case - think about creating one SourceFilter (or some complex ‘pseudo-query’ object) from other sources (network monitoring?) and using it to create rules in real-time.
  6. Autocomplete objects through Reflection with tab button - easy

You know what processes are there - no need to grep ps. You get numbers you want - no need for awk. You know what was the problem, because of exceptions - no need to browse man for return code listings. You want to run commands - there are no problems with quotes in command / quotes in your command line / quotes in file arguments - there are only Strings.

PS1: I only found original post by google alerts - try it out :)
PS2: There was a c# shell - discontinued unfortunately :( But in case it disappears, I’ve got sources… in case…

GtkRegexTest

on December 3rd, 2006

New project has just been launched - “GtkRegexTest“. Name is pretty much self-explanatory. It’s a program for editing and testing regular expressions (RE / regex / regexp / whatever). It’s written in C#, developed on mono, but should also work under MS.NET without any problems.

Read the rest of this entry »

Mono-1.2.1 is out for Ubuntu

on December 3rd, 2006

If you’re using Ubuntu, then mono-1.2.1 is available already. How? Easy as 1-2-3 on edgy (and previous probably too). Add:

deb-src http://se.archive.ubuntu.com/ubuntu/ feisty universe multiverse main restricted

to /etc/apt/sources, run:

apt-get update
apt-get build-dep mono
apt-get source mono –build

And install all the .deb-s that were created. That’s all! Really.