Archives

Archives / 2004 / January
  • A subway musicians gives some tips to the music industry

    A subway musician gives some tips to the music industry.  [Via the Accordion Guy]

    I'm not exactly the type of person that feeds the music industry leechs's. Not because i download  files, but because the music i usually listen has already been played one or two one decades ago, so it has been already all bought. :-) Mostly 70's and 80's.

    But i think both the artists and the fans would love to eliminate the middlemen, and give most money spent on music to the artist's themselves.  I've seen it work (a lot of years ago, before the Web was hip) and i bet this could scale.

    When the greatest band ever (when i was in college i pulled 3 all nighters in a row in order to finish an operating systems project, so i could watch a Carter USM concert in a city 200Km where i lived) broke up, Fruitbat (AKA Les Carter) decided to edit and promote his band  Abdoujaparov. In the begginning he went for the honor system, he put on his web site an MP3 version of the album (i think it was .WAV, my then computer didn't had enough power to play MP3's :-)), if you wanted a CD version you would send (in advance) cash for it. When a certain threshold of money was reached he pressed a bunch of CD's (if my memory  doesn't fail the threshold was 3500 british pounds) and sent them by mail (i don't have the memory of CD Burners back then). The CD's had the same quality (the box and cover) of the ones published by the members of the recording industry, just a lot cheaper.

    I got my CD (copy number 523) a few weeks (probably a month or two) after i sent the money. It had the following note inside the CD, hand signed by the author (verbatim):

    "I hope you enjoy this CD, it is the first of many from Abdouaparov, with any luck. It has been brought to you completely without the help of the Music Industry, so a big thanks to them ;-) The shareware idea worked out really well and i will continue to do things in this way! Look out for the next release in March

    Love fruit bat"

    While searching for links for this story i found this quote on  Abdoujaparov  web site.

    "As always, funds for the pressing were raised by offering the songs for download as MP3 files and asking for a shareware (or try before you buy) fee of £4. This system has worked amazingly well in the past and I will continue to release stuff in this way as long as you support it."

    It seems his system worked for all this years,and is still in use. Four quid seems an amazingly low sum (compared to the industry prices), and yet it must be enough to live a good life. We are talking about a band that was born in 1998, it has self sustained for 6 years using shareware. Nice, good for them. Will have to check what they have been up too for all this years.

    I wish more bands did this. The fans would pay cheaper prices and would know for sure the artists got the money they well deserve.

     

  • Software Physical distribution MUST die!

    I'm in need for billing software. So i started to search the market for a cheap one (our needs are quite simple. Issue invoices and receipts. Period (some things come attached due to Portuguese legislation, we need those too). Invoicing , accounting,etc software is probably the most written software in existance. I've accounted more than 30 (that i could find) products (locally produced) mind you we are a 10 million people country in the tail of Europe). I download the ones that had demos, and saw the brochures for the other ones. After a lot of discussion we picked the less bad (haven't found a decent one, just the one that sucked the least), but i digress.

    When i went to the store to buy a copy. It was sold out. The same on all the other stores i went (some didn't even sell it).

    Why does software physical distribution still exists? (Ok.  A little over the top. if it  coexisted with an electronic distribution channel that would be fine by me). I just want to emit invoices god damnit. I don't care for the damn box, nor the damn paper manual. Email me a key, and send the invoice by mail so i can deliver to our accountant.

    Where are the allways on preachers when we need them? My DSL line is a sunk cost, at least le me use it a little.

    I guess this was my first rant, i promise the next post will be about .Net

     

     

     

  • Keeping up with Microsoft.

    My talk on Indigo apparently went well for the audience and one of my fellow RDs even said that he learned more about Indigo in my talk than at the PDC (that's because I consolidated the PDC slides and therefore have it "all at once"), but personally I was a bit unhappy with it. Didn't flow right. Two slides too much, one slide missing (I need to explain "Dialogs"). This will be fixed for the next stop in Oslo on Monday

    If Clemens is improving his presentation, by the time he gets to Lisbon, it probably has surpassed perfection itself.

    This is the third time i will get to seem Clemens live. The first in Barcelona's MS Teched 2002, where he presented Newtelligence Soap Extensions and last year in the EMEA Architects tour. He totally rocks, but i digress, all this to say that i don't care that much with avalon (mental note, next time i meet a MS evangelist, try not to provoque him by saying that avalon is a XUL copy [1] ) nor longhorn, nor winfs. For now that is. :-) 

    With the speed Microsoft is spitting Patterns & patterns books, and data application blocks into the collective we can hardly keep up (ok, ok i can't keep up. Sometimes i wished MS freezed) with the information, how will i micro care what will be released five years from now (the information that reaches my via RSS is quite enough), if with the current MS pace is issuing information, (for me) the present is allways yesterday (with luck). :-)

    But not with indigo, i await indigo with great anticipation, despite all the SOA hype i would like in the future to work with SOA architectures.

    So i can't wait for Longhorn developer preview and Clemens presentation. Actually i'm bit divided here, because if on the 9 th February i can't go to the Lisbon Longhorn Preview it's because we got a new gig we are fighting for. (getting the gig will also mean no sky trip in march oh well). Oh well i guess it's a win win situation.

    [1] [Update] When i said that avalon is a copy of XUL i was just trolling or flamebaiting, since i neither have details on avalon (saw one or two samples of XAML, nor i have studied XUL on detail). But this guy goes even further. quote ( Windows Longhorn is a demonstrably powerful and ambitious concept, but the architectural principles are hardly new. From 10,000 feet, Mozilla's architecture looks remarkably similar.)

    Freedom to innovate i guess (there i go again....)

    [Update] Frans Bouma said everything i should have said and haven't in .Net Reality Check :-)

    [Update] This will make easier to follow the Application Blocks and Patterns and practices Microsoft is going to publish in the in near term.

  • Counting semaphores in .Net

    A couple of months ago, while writing a multithreaded windows service i had the need to control how many requests of a certain type (and by type) were being served concurrently (requests were made with .Net remoting).

    Ah a classic limited resource protection pattern i thought. The problem could easily be solved with a counting semaphore a synchronization primitive defined by the venerable Edsger W. Dijkstra.

    Since .Net only provides a monitor implementation, I googled the colective in search of a .Net implementation.

    I only found this one, the implementation even respects Dijkstra original dutch terminology

    • Proberen te verlangen (wait) [P]
    • verhogen (post) to increase a semaphore [V]

    Which is why sometimes counting semaphores are called PV semaphores.

    But i digress, this was not only confusing to me (considering my non existant dutch speaking skills), but it lacked a functions that i really needed. The ability to request a semaphore and wait for no more than a certain period (timeout and and the call would fail). So i improved the code a little and now i'm giving the code back to the collective. :-)

    A semaphore semantic is quite simple. The semaphore has a counter associated.

    • When a semaphore is released (P) the counter is incremented.
    • When a semaphore is requested (V) if it's value is zero the caller is blocked until someone increments the semaphore (with a P call, sem_release in Posix syntax); if it's greater then zero the counter is decremented.

    When we wish to protect N resources, all we have to do is initialize the semaphore with value of N (a mutex can be seen as a degenerated semaphore that has been initialized with the value of 1). Everytime a resource is being consumed we call sem_wait and when it's no longer needed you can (and should) signal it's availability with a call to sem_release.

    Another use for a semaphore is to wait for a certain condition that will happen in the future and we wish to do nothing until that condition is met. This can be acomplished by initializing the semaphore with zero, then a thread (or threads) calls sem_wait (since the value is zero the call will block), when you wish to signal the thread (or one of the threads) that it can proceed it it's processing, you just have to call sem_release, the thread (or one of the threads) will awake and do it's thing.

    With a few modifications this semaphore implementation can be transformed into a barrier but that is probably something for another post.

    I don't know how the code performs under high load/high contention but it probably performs fine.

    Disclamer: This code is provided as is. No warranties are made. It works for me it may work for you. I can only say, the code has been running for a few months without any problems.

    I have decided to use wait and release instead of the Posix Syntax sem_wait and sem_release.

    If you have any suggestions of improvments i would like to hear them. :-)

    using System;
    using System.Threading;

    public class Semaphore {
       private int _count; 
       public Semaphore() : this(1) { }
       public Semaphore(int count) { _count = count; }
       public bool Wait() {
          lock(this) {
          // Wait until a unit becomes available. We need to wait
          // in a loop in case someone else wakes up before us. This could
          // happen if the Monitor.Pulse statements were changed to Monitor.PulseAll
          // statements in order to introduce some randomness into the order
           // in which threads are woken.
          while(_count <= 0)
             if (Monitor.Wait(this) == false)
                return false;
             _count--;
             return true;
          }
       }
       private int GetMilliSecondsSince(DateTime since) {
          TimeSpan t;
          t = since - DateTime.Now;
          return t.Seconds * 1000 + t.Minutes * 60000 + t.Hours * 3600000;
       }
       public bool Wait(int milliseconds) {
          DateTime begin = DateTime.Now;
          bool lockObtained = false;
          try {
             if ((lockObtained = Monitor.TryEnter(this,milliseconds)) == true) {
                // Wait until a unit becomes available. We need to wait
                // in a loop in case someone else wakes up before us. This could
                // happen if the Monitor.Pulse statements were changed to Monitor.PulseAll
                // statements in order to introduce some randomness into the order
                // in which threads are woken.
                while(_count <= 0) {
                   if (GetMilliSecondsSince(begin) > milliseconds)
                      return false;
                   if ((lockObtained= Monitor.Wait(this,milliseconds)) == false)
                      return false;
                }
                _count--;
                return true;
             } else {
                return false;
             }
          } finally {
             if (lockObtained) Monitor.Exit(this);
          }
       }
       public void Release() {
          // Lock so we can work in peace. This works because lock is actually
          // built around Monitor.
          lock(this) {
             // Release our hold on the unit of control. Then tell everyone
             // waiting on this object that there is a unit available.
             _count++;
             Monitor.Pulse(this);
          }
       }
    }

  • No task is impossible for the man who doesn't has to do it.

    When i was younger and had a lot of spare time on my hands (i can't remember if it in was my first year off college or in the last year of high school). I was a little of a paranoid virus buff, at a certain time i suspected i had a virus on my system.

    I can't recall the exact number of virus scanners i had installed on my system, perhaps (3 or 4 probably more) but there was not a single file that entered my system without being scanned by 2 or 3 scanners, i could relax this rule a little but not one file entered the system with being scanned by the fabulous f-prot antivirus and it's amazing heuristics scanner.

    I was quite sure i had gotten a virus on a file i had downloaded on a local BBS, so i fired up debug.com and wrote the smallest .COM file i could remember to act as a sacrificial lamb. I can't remember exactly what it was, but i think it consisted of a single RET, i executed it, and bingo the file got bigger. I had isolated the little bugger on my first attempt. Perhaps my moment of fame had arrived, since we already had a lisbon virus (i live in Lisbon) perhaps this one would be named after me. :-)

    I sent the file to F-Prot to be analyzed. What happened after that was amazing, i got a reply from the famous Vesselin Bontchev, he thanked the file, and indeed it contained a virus but they already had obtained a copy 1 or 2 days ago. Alas my 15 minutes of fame hadn't arrived, but what i got aftwards was much better. Free education, and with one of the best. I started making some questions about virus modus operandis and techniques, and Dr Bontchev replied. The game was afoot and the dialog had begun. The mail exchange was fun, and i learn't a lot. But after a while (for christ's sake i was ~17-18 and knew everything :-) ) the pupil had (obviously in a different dimension) surpassed the master, he was no longer asking questions, he was making suggestions.

    Apparently i wasn't completely off track, one of the suggestions (among others) i distinctly remember was to rewire Int 13h and detect malicious (while allowing legitimate ones, off course) writes (the reply was, product XXX does that (i got some of those)). Another ones, was intercepting machine code execution and interpret (in real time) it in order to detect malicious patterns. I wasn't aware of what i was suggesting, but some years later i understood that i was suggesting a complete virtualization of the operating system (and these on MS-DOS and a puny 386). Oh well it was fun while it lasted, but i was probably tearing off the patient Dr. Bontchev. So he went for the kill and said something along the lines of (i think these were his exact words) "Nothing is impossible for the man who doesn't has to do it!". Amazingly that ringed some bells, it was time for the idiot to shut up and crawl to under his rock.

    I never forgot that interaction, and everytime i ask or suggest something  to someone i ask myself "Is this impossible for someone who isn't going to do it?"

    I thought this was a nice way to start my blog.

    If you stumbled upon this and are planning to return i promise the next posts will be related to .NET. :-)