Skip to main content

Ralsina.Me — Roberto Alsina's website

New 24-hour app coming (not so) soon: foley

First a short ex­pla­na­tion:

24-hour apps are smal­l, self­-­con­tained projects where I in­tend to cre­ate a de­cen­t, use­ful ap­pli­ca­tion in 24 hours. The con­cept is that:

  1. I will think about this app a lot for a while

  2. I will de­sign it in my head or in writ­ten notes

  3. I will code, from scratch, for 24 hours.

  4. That's not one day, re­al­­ly, but 24 hours of work. I can't work 24 hours straight any­­more.

The last time around this did­n't quite work as I in­tend­ed, but it was fun and ed­u­ca­tion­al (for me at least ;-) and the re­sult­ing app is re­al­ly not bad!

So, what's fo­ley go­ing to be? A note-­tak­ing app aimed at stu­dents and con­fer­ence pub­lic.

In your last geeky con­fer­ence, did you no­tice ev­ery­one is us­ing a com­put­er?

And what are they tak­ing notes on? Vi? Kwrite? OpenOf­fice? What­ev­er it is they use, it's not meant to be used for this pur­pose.

So, what will fo­ley do dif­fer­en­t? I don't quite know yet, but I have some ideas:

  1. A strong time­­line ori­en­­ta­­tion. Ev­ery para­­graph will be dat­ed.

  2. Twit­ter/I­­den­ti­­ca sup­­port. Want to live­blog your notes? Just click.

  3. Mul­ti­me­­dia in­­­cor­po­rat­ed in the time­­line.

    • We­b­­­cam/Au­­­dio record­ing synced to your notes?

    • Im­ages im­­­port­ed and added in the time­­­line?

    • At­­­tach files to the time­­­line? (Use­­­ful for slides?)

  4. If pro­vid­ed with a PDF of slides, at­­tach each slide to the right mo­­ment in the time­­line

  5. Easy web pub­­lish­ing: find a way to put this on a we­b­­page easy and quick (s­in­­gle-click pub­­lish­ing is the goal)

I have on­ly thought about this for about 10 min­utes, but I see po­ten­tial here.

The bad news is... I have a ton of pay­ing work to do. So this will prob­a­bly on­ly hap­pen in Jan­u­ary. How­ev­er, I want­ed to post it so I can take in­put while in this plan­ning phase.

So, any ideas?

Making a unique application using python and DBUS

No, not unique in the sense "o­h, this app is a spe­cial snowflake", but unique in the sense "y­ou can on­ly run one copy of this ap­pli­ca­tion".

I tried googling for it and I al­ways found the same an­swer, "use dbus, try to own the name, if it ex­ists al­ready, then a copy is al­ready run­ning".

What I could not find is one work­ing ex­am­ple of this, or at least not some­thing con­ve­nient­ly la­beled "here is how you do a unique ap­pli­ca­tion us­ing dbus and python".

So, here is how you do a unique ap­pli­ca­tion us­ing dbus and python:

Sup­pos­ing your ap­pli­ca­tion is called uRSSus (mine is):

session_bus = dbus.SessionBus()
try:
    session_bus.get_object("org.urssus.service", "/uRSSus")
    # This is the second copy, make the first one show instead
    # TODO: implement
except dbus.DBusException: # No other copy running
    # This will 'take' the DBUS name
    name = dbus.service.BusName("org.urssus.service", bus=session_bus)
    # Now, start your app:
    window=MainWindow()
    object = UrssusServer(window,name)
    :
    :
    :
    etc, etc

And that's it. No, it's not hard, but since the DBUS docs seem to be... rather they seem al­most not to be some­times, ev­ery lit­tle bit may help.

DBUS-reactor, or AsusOSD must die!

How to write a tiny python app (less than 50 lines) that re­acts to events on the DBUS bus­es. For ex­am­ple, dis­play­ing a no­ti­fi­ca­tion when you press one of your key­board­s' spe­cial keys.

Read all about it

I knew not doing it was smarter, or how HTML5 and Qt do my work for me.

I wrote a while ago a RSS pro­gram called uRSSus. I ex­pect I am the on­ly us­er of it be­cause it has some prob­lems (all of them my fault ;-) but I re­al­ly like it.

For a while now I have want­ed it to have pod­cast sup­port. The thing is... that al­ways seemed like a lot of work. Sure, us­ing phonon I can cre­ate an au­dio play­er and ev­ery­thing, but...

I am us­ing a HTML wid­get to dis­play the post­s, so I would have to find a way to add the au­dio play­er to the UI and ... too much work.

So, to­day I woke up and thought... wait a minute... Qt's HTML wid­get is based on We­bkit. And We­bkit sup­ports HTM­L5. And HTM­L5 has an "au­dio" tag.

So, if I fixed uRSSus to fetch the en­clo­sure links, and added them in the database, and then added this to the post tem­plate:

<?py for enclosure in  post.enclosures: ?>
  <audio autobuffer="Yes" controls="controls" src=#{enclosure.href}></audio><br>
<?py #end ?>

Would­n't that ac­tu­al­ly work? Well, yeah!

urssus26

So there you have it, I was right not to im­ple­ment it, be­cause the eas­i­est way is to let Qt do it ;-)

Rant: Being annoying is not a way to make me your customer

I have been a cus­tomer of Fib­er­tel for my broad­band needs for sev­er­al years. Their ser­vice has not sucked bad, even if I had a few prob­lems in the past.

How­ev­er, a month ago, I de­cid­ed to switch to a com­pet­ing ser­vice for a good rea­son: it's much much much cheap­er [1]

Since I am not stupid, I can­celed late with Fib­ertel, so I would have a full month of over­lap­ping ser­vice. I thought hey, maybe I would come back if the new ser­vice sucks [2]

What hap­pened next has been in­creas­ing­ly an­noy­ing.

First Fib­er­tel called the per­son who con­tract­ed the ser­vice (not me). That's rea­son­able.

Then they called me to ask me why I was can­celling. I exlained that the oth­er ser­vice is (all things con­sid­ered) about 75% cheap­er for the same per­for­mance. I sup­pose that's rea­son­able too.

What start­ed be­com­ing less and less rea­son­able are the next 5 call­s, each of­fer­ing cheap­er rates, but still more ex­pen­sive than my new ser­vice.

What was not rea­son­able was that they start­ed call­ing to tell me tech­ni­cal­ly un­sound bull­shit to scare me in­to their ser­vice again.

What is def­i­nite­ly not rea­son­able is that they called me 6 times, even af­ter I told them to stop call­ing me in the third cal­l.

What is in­cred­i­bly stupid and an­noy­ing was that they de­cid­ed to block my in­ter­net ac­cess in or­der to show me an ad about the same of­fers I AL­READY DE­CLINED and un­til I clicked that ad I could not use the In­ter­net.

What is freak­ing nuts is that be­cause I have an ac­cess point I could­n't see the sa­tan-­damned ad, so I was left with­out in­ter­net un­til:

  • I re­­moved the ac­cess point

  • Hooked my note­­book to the ca­ble mo­­dem

  • Got re­­jec­t­ed by it

  • Hooked back the AP

  • Got the MAC from it

  • Faked my note­­books MAC

  • Clicked the Cthul­hu-pissed ads

  • Hooked back the AP

  • Un-­­faked my MAC

So, I need­ed to spend an hour do­ing this.

There­fore, dear Fib­ertel, your com­pa­ny al­so pro­vides ca­ble TV. I am pissed at you. I have de­cid­ed to buy ser­vice from Di­recTV ex­clu­sive­ly to piss you of­f.

Yup, I, who have been pay­ing you ev­ery month $230 for years, will pay you $0 next month. I could have paid you $100, but no, you had to be ass­es about it. You could­n't let me go. Well, I do not like be­ing pestered. I do not like that you act­ed like a spurned 17-year old [3]

Fib­ertel, I kin­da liked you, but my opin­ion of you has gone low­er.

Al­so, any Fib­er­tel cus­tomers out there: if you ask to can­cel the ser­vice say­ing you switch be­cause of the price, they will of­fer you 3Mbps for a year for $79. If you say no, they will of­fer you 3 free month­s.

That's a $600 sav­ing, so go ahead and take their mon­ey.


Contents © 2000-2024 Roberto Alsina