• New Onscreen Display Notification for Volume in Openbox

    Posted on April 10th, 2009 Andrew Barilla 6 comments

    I wanted to have an onscreen display volume control for my Openbox desktop in Archlinux. I created a script for handling my volume control which uses the notify-osd package from AUR. This is the newfangled notifications from Ubuntu. It’s nothing fancy so the notify-osd-bzr package will probably work fine as well.

    This is for alsa but with some minor mods it should work with oss.

    You can download the script here: http://exit66.com/static/vol.sh

    The format for the command is: vol.sh {up|down|mute} [-i increment] [-m mixer]

    Increment is either a percent or number just like you would pass to amixer. Defaults to 5%
    Mixer is the name of the control to change. Defaults to Master

    For example to increase the volume of PCM by 10% you would do:
    vol.sh up -i 10% -m PCM

    Let me know of any suggestions for improvements.

  • Productivity Script for Linux (and everything else)

    Posted on April 9th, 2009 Andrew Barilla No comments

    Per a mention on identi.ca about having this script in Ubuntu (or any Linux for that matter) I translated the VBScript mentioned here on Lifehacker to Python with GTK. Which also means it’s also cross platform with the right dependencies installed.

    You can download it from this link: http://www.exit66.com/static/productivity.py or copy the code from here:

    #!/usr/bin/env python
    
    from time import sleep
    import gtk
    
    message_title = "Wasting Time?"
    message_text = "Consider if this is really how I need to " .
                   "be spending my time. Continue?"
    minutes = 20
    seconds = minutes * 60
    
    class ProdBox(gtk.Dialog):
        def __init__(self):
            gtk.Dialog.__init__(self)
    
            self.ret = None
    
            self.connect("delete_event", self.delete_event)
            self.connect("destroy", self.quit)
    
            self.set_title(message_title)
            self.set_resizable(False)
            self.set_position(1)
    
            self.set_border_width(20)
    
            # Create box to pack widgets into
            self.message_label = gtk.Label(message_text)
            self.message_label.show()
            self.vbox.pack_start(self.message_label)
    
            self.hbox = gtk.HBox(False, 0)
            self.vbox.pack_start(self.hbox)
    
            # Create yes button
            self.yes_button = gtk.Button("_Yes")
            self.yes_button.set_border_width(10)
            self.yes_button.connect("clicked", self.yes)
            self.hbox.pack_start(self.yes_button, True, True, 0)
            self.yes_button.show()
    
            # Create no button
            self.no_button = gtk.Button("_No")
            self.no_button.set_border_width(10)
            self.no_button.connect("clicked", self.no)
            self.hbox.pack_start(self.no_button, True, True, 0)
            self.no_button.show()
    
            self.hbox.show()
            self.show()
    
        def delete_event(self, widget, event, data=None):
            gtk.main_quit()
            return False
    
        def yes(self, widget):
            self.ret = "yes"
            self.quit()
    
        def no(self, widget):
            self.ret = "no"
            self.quit()
    
        def quit(self, *args):
            self.hide()
            self.destroy()
            gtk.main_quit()
    
    def show_message():
        go = ProdBox()
        gtk.main()
        return go.ret
    
    if __name__ == "__main__":
        while True:
            ret = show_message()
            if ret == "yes":
                sleep(seconds)
            else:
                break
    

    Updated: I had the minutes set for testing but changed it to 20 minutes

  • Calling F# Code From Another File

    Posted on March 9th, 2009 Andrew Barilla No comments

    When creating an F# solution you might want to call code from another file. For example, I have a solution for my Project Euler code and to make it one line of code to wait for a keypress in the console I created a simple little helper function.

    #light

    module helper

    open System

    let console_pause =

        Console.ReadKey() |> ignore

    The key here is the “module” keyword.  This is what you’ll reference from the other code.  For example, this code to print out the 2000th number of the Fibonacci sequence.

    printfn “%A” ((1I, 1I)

                  |> Seq.unfold (fun (x, y) -> Some((x, y), (y, x + y)))

                  |> Seq.map (fun (x, y) -> x)

                  |> Seq.nth 1999)

    helper.console_pause

  • Project Euler in F# - Problem 1

    Posted on February 27th, 2009 Andrew Barilla No comments

    As is a common practice I’m working on solving the Project Euler problems.  The pipe operator is a great feature which results in straightforward code which to paraphrase Luca Bolognese from his presentation at PDC 2008 it’s written in the way you think.

        1 #light

        2 

        3 let sum =

        4     [1..999]

        5     |> Seq.filter (fun x-> x % 3 = 0 or x % 5 = 0)

        6     |> Seq.sum

        7 

        8 printfn "sum: %A" sum

  • My Friends’ Horse Was Attacked: Please help Hawk

    Posted on February 12th, 2009 Andrew Barilla 2 comments

    No reason to regurgitate all the details mentioned in the original article.   But my friends’ horse, Hawk, was attacked and had his tail cut off.  This is a problem because of swatting flies, balance, etc.  Apparently there are fake horse tails; only they tend to be expensive.  Any help they can get would be appreciated via a PayPal donation to helphawk@exit66.com.  You can include your address as the owners would like to thank everyone who chips in.  Any extras will go to horse related charities.

    I know alot of people won’t believe we that I know them, however, I am doing this through my domain that has been registered for 10+ years and am very easily findable.

  • Student Loan Delaying Program aka Grad School

    Posted on February 10th, 2009 Andrew Barilla 2 comments

    I just got accepted as a provisional PhD student in the Computer Science department at UCCS. After some research, the provisional is pretty standard, especially for someone like me who is going straight from BS to PhD, and means that I’m going to just have to jump through some hoops to join the fraternity of the PhD. I’m excited as this may be my springboard to jump from information systems work to some more down and dirty computer science stuff.

  • The Goat Rodeo

    Posted on February 10th, 2009 Andrew Barilla 1 comment

    I’m having lots of fun with Slacker radio and music of it’s type (like Pandora and last.fm) are definitely the future of radio.  It can replace my MP3s like XM did back when it was good.

    Here’s one of my creations, The Goat Rodeo, which is a punkabilly/psychobilly station.

    Create your own Slacker Station now

  • Martha Stewart More Popular Than Punk or Hip-Hop?

    Posted on November 12th, 2008 Andrew Barilla No comments

    In September I tuned in my XM radio only to find Fungus 53 missing from my radio and replaced with AC/DC.  In a complaint to XM I received the following reply.

    Thanks so much for taking the time to write with your comments on XM 53 Fungus.

    We recognize and appreciate the fact that Fungus and punk, ska and hardcore has loyal fans like you, but because we have limited space on our platform for music channels, we’re often faced with having   to make difficult decisions when it comes to what’s available on our channel line-up. Fungus was one of the channels that had a very loyal but also a very limited audience.

    Some of the music heard on Fungus can be heard on other XM channels including Fred (XM 44) and Ethel (XM 47).

    Again, we appreciate you being a fan of Fungus and hope you listened to enough other XM channels to stick around as a subscriber.

    Thanks again for writing and for being part of the XM Nation.

    Best regards,

    Jon

    Jon Zellner

    SVP Music Programming

    Sirius XM Radio

    The response was actually from Lou Brutus but contained not much original content other than a quote from Jon Zellner.  This change led to the cancellation of my two existing radio subscriptions and the cancellation of a scheduled install into a car we had just purchased.

    This morning even more subscribers woke to the find their favorite stations received the same fate.  I understand the combining of similar stations between XM and Sirius, but my failure to understand what they hell they’re thinking at XM Sirius has to do with the stations that have “very limited audience(s).

    So to summarize here are just some of the stations that, according to Jon Zellner, aren’t as niche as punk or old-school hip-hop, two musical genres that have been around for 30+ and 20+ years respectively:

    • Marth Stewart Radio
    • Elvis Radio (not the talented one, but Presley)
    • AC/DC Radio
    • Radio Margaritaville (Jimmy Buffett)
    • Grateful Dead Radio
    • E Street Radio (Bruce Springsteen)
    • Siriusly Sinatra
    • Met Opera Radio
    • Caliente (Latin Tropical Music)
    • Catholic Channel (in addition to the already existing Christian channel)
    • Doctor Radio
    • 6 different comedy channels
    • Oprah & Friends

    See the logic?  Cause I don’t.  Obviously, as predicted, the merger was a very bad idea.

    I’d also be curious as to how many of the artists formerlly on Fungus are still getting airplay on the other channels two months later.  If anyone has access to a database of this information let me know and I’ll dig into it.

  • My First Facebook App - Zune Profile Info

    Posted on November 8th, 2008 Andrew Barilla No comments

    I just created my first Facebook app called Zune Profile Info. It’s a simple little thing that pulls the most recently played songs from your Zune card.

  • DNS Problems At Home

    Posted on November 6th, 2008 Andrew Barilla No comments

    I’ve been getting intermittent DNS errors on my laptop while at home. Strangely enough, none of the other PCs appear to be affected. Only my laptop has this problem. To make things even stranger it happens whether I’m using wireless or not and Vista, XP or Ubuntu. I got tired of hitting refresh so much to fix this problem so I did some digging and it looks like it’s my provider’s DNS servers so I switched to OpenNIC servers and the problem seems to have resolved itself.