Lorenz Cuno Klopfenstein

News

Command for year counting in LaTeX

Just a short note that could turn out to somebody somewhere: I'm by no means a LaTeX expert, but I like to use it for almost any text document I need to write. Since TeX is based on simple text files you can churn out text without having to think about the visual aspect of the document, but only its structure. Moreover, since every source file is just text, it is perfectly suited to be used with source control tools like Mercurial and such.

Apart from that, LaTeX can be extremely painful to work with: its syntax is quite obscure, documentation mostly lacking and it is based on hundreds of additional packages which on their own aren't documented very well, can conflict between themselves and sometimes don't work very well. However, after a couple of minutes of hammering on the TeX source, you usually get what you were looking for.

This is one of those cases: I wanted a simple command to compute the amount of years passed between a given (past) year and today. For instance, given the year 2004 as parameter, the command should generate (2011-2004) “7 years”. This enables you to compute the age or the elapsed time of a date and ensuring that the count is always updated when you recompile the document.

Again, I'm no LaTeX expert and the following command might be very very wrong. It works though, so that's what I put together:

\newcommand{\yearssince}[1]%
    {\count1=\year \advance\count1 by -#1 \the\count1 \xspace{}}

The yearssince command essentially stores the current year in the count1 variable. It subtracts the parameter (which must be an integer year number) and the writes the resulting number. As simple as that. You can use the command like so:

I have been programming in C++ for at least \yearssince{2004} years.
Posted on Thursday, June 30, 2011
Tagged as LaTeX
433 Views
0 comments posted
Woohoo, OnTopReplica 3.3!

It's been a long time, but I've been finally able to fix some of the issues of OnTopReplica and pushed out version 3.3 this evening.

spacer

So, what are the new features?

  • First of all, a brand new Spanish translation. Thanks you very much Raúl!
  • OnTopReplica now can attempt to restore the last cloned window on start up: this works by storing the cloned window's title, class and handle on shutdown. When enabled (check the Advanced menu) it will try to guess a window to clone. This is (and cannot) be 100% exact, but it appears to be working in most cases.
  • All “side panels” now open in a separate modal window instead of being embedded in the main form itself. This simplifies the code and makes the application more reliable.
  • Brand new settings panel that features some basic settings (and will be expanded in the future).
  • Improved command-line parameters.
  • Improved main window behavior: opacity, taskbar grouping and other issues have been fixed.
  • Ton of small bugfixes and improvements.

Perhaps most importantly, the code looks way better and I feel I don't have to be ashamed as much as before for putting the source code on CodePlex. However, one of the regressions caused by the code clean-up is that the main form is displayed in the ALT+TAB window list. I haven't been able to fix the issue in a reliable way for now.

Anyway, you can download the installer or the standalone executable if you want to try it out.

I hope you enjoy the new release. As usual, I'm eagerly waiting for any feedback and bug report. Let me know!

I already have a list of new features that are coming up for the next release (hopefully). spacer

Posted on Monday, April 04, 2011
Tagged as OnTopReplica
696 Views
4 comments posted
A couple of months with WP7

I've been using a Windows Phone 7 device since last December, more specifically an LG E900 Optimus 7 phone.

spacer

So far the experience has been overwhelmingly positive: I was quite confident that the system would be both cool looking and usable, but the final result has convinced me in almost every aspect and I would absolutely suggest it to everybody.

More...

Posted on Thursday, March 17, 2011
Tagged as Hardware Reviews Windows Phone 7
803 Views
2 comments posted
Setting up GStreamer and .NET on Windows

spacer During the last months I have been working a lot with the GStreamer framework and Mono, running on Linux. The experience has been quite pleasant (mostly) and I really like how GStreamer is designed and its incredible extensibility.

A couple of weeks ago I decided to test GStreamer on Windows, which sounded strange but nonetheless feasible. In fact, the ossbuild project publishes recent GStreamer packages which can be easily installed on Windows and they work perfectly well. Not all plugins are available still, but the core framework works great.

Then I noticed there actually is a .NET binding for GStreamer among the ossbuild packages. Using GStreamer via .NET on Windows? Blasphemy!

More...

Posted on Tuesday, February 22, 2011
Tagged as dotnet Windows GStreamer Multimedia
1949 Views
13 comments posted
Feldschlösschen spoof ad

What can you do on a nice clear day of Christmas holidays at your grandma's place with a Canon 7D and some film equipment? Right, the first stupid thing that comes to your mind.

spacer

Well, that's exactly what my brother and I did. Watch our nonsense spoof ad for the swiss Feldschlösschen beer!

Huh, makes no sense, does it? spacer

spacer

Posted on Friday, January 28, 2011
Tagged as Film Fun Beer
757 Views
3 comments posted
NHibernate and ASP.NET Website Projects

A small issue I ran into yesterday was about getting NHibernate to run inside an ASP.NET “Website project” without using any external assemblies to store my domain objects and their mapping files.

The underlying problem is that those “Website projects” are stored as simply editable code files and are dynamically recompiled by the ASP.NET process on the web server, instead of being pre-compiled and then deployed as in a “Web application project”. This may or may not be easier to work with, depending on your project. Anyhow, it is your only choice if you're using Visual Studio Web Developer Express like me. Now, since ASP.NET is recompiling your code automatically, you have no means to include your NHibernate mapping files (*.hbm.xml) as embedded resources. Moreover, you won't be able to refer to the assembly built by ASP.NET (which contains your domain classes), because the assembly name will be generated more or less randomly.

A possible solution to this problem is to simply put your domain classes, and their mapping files, into a separate assembly, compile it and then add it as a reference to the website. This however is a clunky process: it requires you to use another instance of Visual Studio (in its Express edition) to edit the external library and you are slowed down by having to recompile and relink the parts each time. Fortunately, this blog post pointed me to an easier and more elegant solution.

More...

Posted on Thursday, December 02, 2010
Tagged as ASP.NET NHibernate
21289 Views
5 comments posted
Cooking by Dummies

My current flatmate Saverio and I recently started a cooking blog, since we both like to cook and write — in our eyes — witty stuff (results may vay). It's aptly named “Cooking by dummies” since none of us is much more than an amateur. But we keep trying.

spacer

We've written down a couple of recipes in the last month and plan on doing more. I recently also bought “Cooking for Geeks”, so there's a lot of stuff we plan on posting.

If you read Italian and like cooking, check out our blog!

Posted on Wednesday, November 10, 2010
Tagged as Blog
505 Views
1 comments posted
Version 3.2 is out!

spacer

The new version of OnTopReplica is out (get the installer) with a couple of new features and some bug fixes.

First of all, some annoying bugs have been corrected (involving window resizing, chrome enabling/disabling, etc.), which is nice. I also tried to reduce the amount of memory required by the app (which is still higher than I'd like) and to improve start-up time. New features include the following:

Size/Position restore: had been removed in an earlier version, but is now back. spacer OnTopReplica will remember its last position and size when it is closed and will restore it when started again. Can be enabled through the “Resize” menu. I'll rearrange the menus sometime in the future.

Position lock: there always was an option to dock OnTopReplica in one corner of the screen. This time though I added position “locking”. When enabled, the window will automatically dock again in the screen corner you picked after you move or resize it.

And most importantly, Command Line Scripting! You can launch OnTopReplica with the /help parameter to get a list of available parameters. This opens up a lot of nice scripting scenarios. It is still impossible to interact with a running instance of the application, but that is coming too.

Hope you enjoy it. spacer In the meantime, I switched to CodePlex to track issues and feature requests, so head there if you'd like to submit an idea (or write a comment).

Posted on Saturday, October 16, 2010
Tagged as OnTopReplica
559 Views
0 comments posted
A simple NSIS installer with user execution level

As I wrote last time, I recently switched OnTopReplica's installer from ClickOnce to a custom NSIS installer. In doing so I was voluntarily dropping a lot of nice features of ClickOnce (user-level installation, simple interface, automatic updating and Visual Studio integration) for a set of features I had to implement on my own. It worked out surprisingly well, so here's what I've done.

More...

Posted on Wednesday, October 06, 2010
Tagged as Programming Windows NSIS Installer
25678 Views
29 comments posted
Preparing beautiful hand-drawn presentations

My housemate and I spent the last week preparing our presentations for the public revealing of the project we've been working on the past months: openBOXware. The project is an open system for set-top-boxes that can be extended by third-party addins to add more media source, applications and so on.

Last week (on September 16-17th to be exact) we had to give a hands-on course about the framework, some kind of crash course introduction to Mono, C#, Qt and our development environment. This enormous task could only be tackled successfully with nice slideshows of course! Instead of preparing the usual walls of text (which kill off the audience in a matter of seconds), we went for a slightly less formal look and a bit of humour (or at least we tried).

We took a couple of university owned tablet PCs (they are OURS now) and started drawing: after some time we gathered the skill to draw things that resembled the intended objects and to write text that somebody could actually read! Then we started a drawing marathon that lasted days and days (ending a couple of hours before the first presentation, with heavy repercussions on our sleeping rhythm). But the result looked quite satisfying and nobody fell asleep (or we didn't notice, anyway).

These are the tablets we used: a pair of not completely new HP Compaq 2710p PCs. More about the drawing process just below.

spacer

More...

Posted on Thursday, September 23, 2010
Tagged as Presentation openBOXware Windows Journal
2433 Views
139 comments posted
1234next
spacer
spacer spacer spacer spacer
spacer spacer
gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.