martes, 29 de octubre de 2013

Introducing geol

Hi!

Don't you hate it when developers are working in disparate platforms and people commit changes that rewrite the whole file (even though they only changed a couple of lines) because they changed the EOL format of the file? (And don't you curse on Microsoft, as usual, for it?) Well, I do hate it.... a lot.... specially when I have to merge stuff and I find this awful conflicts in files that don't show up as groups of lines but as whole files replaced (which makes it cumbersome to find out what the changes were from each branch that you are merging).

I have fallen in love with git. It's so flexible that it seems like it's made of rubber. Taking advantage git's features I noticed I could create a tool that rebuilt branches correcting the EOL problems in the history to make it consistent to a single EOL format... and so geol was born (just a few days ago).

It's fairly simple to set up. You just init a repo, add a remote (the repository you want to "correct") and start it. You will have to use a file where geol holds the equivalents of each changeset between the original and the corrected repo.

I'm giving it a round of tests with one of our projects (which is a little large) and it seems to do the job fairly well.... if you want to give it a round of tests, let me know how it goes.

jueves, 29 de agosto de 2013

Why is plasma desktop hitting cups every once in a while?

Hi!

I had noticed on gkrellm that there was a process nagging with traffic on the loopback interface hitting cups. I'm running kubuntu 13.04.

I wanted to know what process it was.... I tried with netstat in and endless loop, ntop seemed like a litle too much for what I needed (though I'll take a closer look later on, seems like a very interesting tool), nethogs, lsof... the process just seemed to hide every time. So what is a man to do then? How about making myself show up as cups to see who is causing the trouble? Perhaps I could make it "hold" for a while till I could see with netstat what process it was.

So, first, stopped cups:

$ sudo /etc/init.d/cups stop
[sudo] password for antoranz:
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service cups stop

Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the stop(8) utility, e.g. stop cups


No wonder there.... then, how will I make the process stall? How about a little nc magic? I could use it as bait and see who gets hooked on. So let's start listening on port 631 and wait to see what happens:

$ sudo nc -l 631
POST / HTTP/1.1
Content-Length: 244
Content-Type: application/ipp
Host: localhost:631
User-Agent: CUPS/1.6.2 (Linux 3.8.0-29-generic; i686) IPP/2.0
Expect: 100-continue

@bGattributes-charsetutf-8Httributes-natural-languagees-coBrequesting-user-namantoranz#
                                                                                       printer-typeDrequested-attributes
                                                                                                                        printer-nameD
printer-stateDprinter-state-messageD                                                                                                 printer-infoD
                                    printer-type



Can't really tell what it is but the process is waiting so let's see what netstat has to say for us:

$ sudo netstat -ntp | grep 631
tcp        0      0 127.0.0.1:59971         127.0.0.1:631           ESTABLECIDO 2992/plasma-desktop
tcp        0      0 127.0.0.1:631           127.0.0.1:59971         ESTABLECIDO 7217/nc        



Plasma desktop. Now, and getting back on the topic, why is plasma desktop hitting cups so often?

viernes, 16 de agosto de 2013

RMS, why did you skip the i?

Hello, everybody.

Today I had an epiphany. Why did RMS skip the i from "is" in GNU? I mean, he named it GNU after he fiddled with all the letters to make it a recursive acronym. Like GNU stands for GNU's Not UNIX (G N U, GNU, see? And I use the capitals in UNIX, aren't I a nice guy?). Great... but why did he choose to skip the I? I think it would have given him a lot of more possibilities and not end up with GNU. I have no problems with it, I can pronounce it like g-nu or ñu (I'm a native spanish speaker, keep that in mind), but it's been a pain for people since the beginnings of time.

What would have happened had he kept the I? Some possibilities like GINU or MINU, I find them interesting.... but then it hit me like a brick. How about had he chosen the L? Wouldn't that have been lovely? Just adding an x and we would have saved ourselves a lot of infighting.

Cheers!

jueves, 2 de mayo de 2013

Just published a GPS Parsing library

Hi!

Just wanted to let you know (as if you cared that much) that I just released a GPS Parsing library (based on NMEA 0183) for Java.

The way to use it is fairly simple. It can be used to read from Readers so files or streams is no different.

The parser can notify of events as they are read from GPS output by using listeners.

A simple example would be this:

aaahhhhh.... just take a look for yourself: FileAnalyzerTwoListeners.java

Well... hope you find it useful. It's released under the terms of MPL 2.0.

And most importantly, repo is here.

Cheers!

viernes, 9 de noviembre de 2012

[OT] Music - Cracking multiple voices with mixed measures

Hi!

Music and mathematics go hand in hand... and being an engineer just makes this relation clearer.

Having a strong background in mathematics makes some of the problems you find in music a little easier... like, wanna try me at intervals?

Then, I quit music (at least active playing to perform in public) some years ago but my brother is heavy on studying percussion at Maracaibo's Conservatory.

Yesterday he asked me to help him understand how to play a section of a two-voice piece for Marimba that had mixed measures.

In general, things like playing a binary measure along with a ternary measure (like eighths and eighths triplets) is not much of a problem.... but then you can get to face more complicated situations like the one he has facing. It was something like this:




Now, let me explain how you can mathematically (and reliably) go against this problem.

First, you have to study the voices separately and find the biggest measure that can break up all the notes of each voice and how many of each there are in the section you are trying to study.

For the upper voice, the biggest measure would be the half-note-in-a-tripplet and there are 3 of them in the section of our interest. That was easy.

For the lower voice, the biggest measure that can break up both eighths and quarters would be one eighth and there are 8 of them in the section of interest.

Continue doing this for as many voices as necessary but that's enough for our example.

Next step would be to find the Least Common Multiple of 3 and 8*. It's 24. This number will be the number of microbeats** you have to use at the same time for all voices involved in order to be able to fit all the notes in those two voices in one exact unequivocal fashion. Now you go back to study each voice separately based on the 24 microbeats for the whole section.

Upper voice has 3 half notes in a triplet so if you divide the 24 microbeats between the 3 notes this means each half-note will take up 8 microbeats so they will start on the 1st, 9th (1+8) and 17th (9+8) microbeats.

Lower voice length is made up of 8 eighths, remember? If the section we are studying will be measured with the same 24 microbeats, that means that each eighth in the lower voice will take up 3 microbeats (there are 8 eights in the section and so 24 / 8 = 3). Then that means that the first hit (remember it's a marimba) will be on the 1st microbeat, next on the 4th (1+3), quarter note starts on the 7th (4+3) microbeat and lasts for 6 microbeats, next eighths will start on the 13th (7+6) and 16th (13+3) microbeats and the final quarter note will start on the 19th (16+3) microbeat and will take up 6 microbeats which will complete the length we are studying.

So, having the upper voice written as an M and the lower voice as a B, the voices are played together like this:

  M               M               M
|-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-|
  B     B     B           B     B     B


I bolfaced the bar's quarter beats to make it clearer. That will do.

Another example, in the Biguine Caline from Klaynjans' Suite Antillaise for Guitar (a suite that I definitely love) you get to see something like this (voices separated for clarity):

So, we follow the same set of rules.

First voice, the biggest measure that can break it all up would the the eighth in a triplet and there are 6 of them in the section.

Second voice, the biggest measure that can break it all up would be the sixteenth and there are 8 of them in the section.

Now, the LCM for 6 and 8 would be 24 (again). So 24 microbeats it will be. Now, separate analysis again.

First voice has 6 notes the same length each in 24 microbeats. That's 4 microbeats for each one.

Second voice is 8 sixteenths in 24 microbeats, that means that it's 3 microbeats per each sixteenth and that means that the final resolution is like this:

  M       M       M       M       M       M
|-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-|
  B                 B     B           B


That will do.

Hope it was clear enough.

If you think you've got it, try to break this problem:

Solution should be like this:

35 microbeats:

  M                   M         M                             M
|-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-|
  B                                         B             B


And if you nailed that one, then add another voice like this:

If you can break that one (and I won't give any tips) then I don't think you will have problems cracking mixed measures ever again.

* as a matter of fact, you could use any other common multiple so you could just multiply them all but that will lead to higher numbers than necessary, like if you are working with 6 and 9 (too easy one example to try this method but the way to solve it still works this way) which will lead to 54 if you just multiply them but then 18 (their LCM) would have sufficed.

** microbeats will have a relation to a certain length for the section you are studying but that could be a little difficult to write on sheet paper (for example, here each microbeat will correspond to a tripleted sixteenth) so I'd recommend not to try to write it down in real music notation but keep it for your studying time.

domingo, 21 de octubre de 2012

Java GPS library release

Hi!

It's been a while since I wrote my last post... not that I've had something great to talk about.

Among other things,  recently I laid my hands on a GPS USB dongle that I wanted to play around with for a project research.







It's either that my hand is large... or the dongle is small or a combination of both.

After getting output from it right after I plugged it in with putty/minicom/etc I started to look around for a java library that could take care of handling messaging. Not that I spent too much time looking around. I found this:

http://sourceforge.net/projects/javagps/

Unfortunately the last release is a little dated (like 10 years dated) and doesn't give me the kind of feedback I was expecting....

And so, what is a developer to do in these cases? That's right, sit down and code something of his/her own... and so I did.

I have just released version 0.02 of my brand new GPS library... it's still miles away from something really useful but I think the basics are pretty much laid down. Go grab it and, if you have corrections/recommendations, start sending patches. I'll be glad to merge them.

https://code.launchpad.net/~eantoranz/+junk/gps

It's released under the terms of Affero GPLv3 and it's even got a couple of examples inside (I think that's a first-timer for me). Requirements: log4j.

Cheers!

martes, 7 de febrero de 2012

I need something close to debian with up-to-date KDE

Hi!

I just read the news that Canonical will pull the plug (kind of) from Kubuntu. Kubuntu will go on as a community project and the only person who was getting paid to work on it will have to do other tasks. So.... I've been a very happy (ok, ok... mostly happy) kubuntu user for the last... what? 6 years? But why? Cause I like KDE and Kubuntu provides the latest version of the environment (with PPAs we're talking about almost inmediate availability of the last stable versions).

So I'd like to move into a real rolling release like debian testing but then the KDE version is a little behind, isn't it? Then what can I use instead?

Thanks for your feedback?

PS A little behind? Is that 4.6? Sigh. So.... I know some people will complain because I'm complaining instead of giving debian a hand with KDE to bring it up to date, right? So were can I give a little help for starters?