2010-06-11

Plenty of things happen that are almost blog worthy but just don't have the substance for a full post. For the most part, this is what microblogging is for. However, there are somethings that are too big for a posting on identi.ca. So what is a Jez to do?
Why, have a fun filled frolicking Friday feature fest, of course. The idea is simple: aggregate the little things into one post. Booyah!

Jezra.net


Recently, I've make two changes to my blog, only one of which you the viewer will actually experience.

  1. the blog code has been updated to allow me to write using the Markdown format. I'm actually using PHP Markdown written by Michel Fortin. From a visitor's standpoint, this doesn't really do much, but it certainly makes it easier for me to compose a new posting.

  2. images in blog postings will now be utilizing lightbox, a javascript library for presenting "click to view larger image" images in a pleasant way. There is actually a lightbox2 that I should be using, but I'm happy with the way things are working right now.

Code


heybuddy, the Python identi.ca client, has a new stable release: 0.0.7 "Glens Falls". The biggest feature of this release is probably the inclusion of avatars. Go get it!

In December of 2009, there was a thread in the Linux Outlaws forum about coding a "crap alert" in various programming languages. I wrote the alert in Python and then ported the code to Vala. Recently I cleaned up the Vala code, compiled the code to run on my N810 and made an application package for Maemo. Hopefully the compiled app will also run on an N900, but I don't have one to test on. hint hint

Here is the Vala code:

/* compile using
valac --pkg hildon-1 --pkg gstreamer-0.10 --pkg gtk+-2.0 crapalert.vala -o crapalert

* or 

valac -D TESTBUILD --pkg hildon-1 --pkg gstreamer-0.10 --pkg gtk+-2.0 crapalert.vala -o crapalert

*/

using Gtk;
using Gdk;
using Gst;
using Hildon;
public class CrapAlert:Hildon.Program 
{
    bool is_playing;
    Element playbin;
  bool is_fullscreen;
  Hildon.Window window;
    construct{
        
    }
    public CrapAlert()
    {
            #if TESTBUILD
            string resources Path.build_filename(Environment.get_current_dir(),"Resources",null);
            #else
            string resources Path.build_filename("/","usr","share","crapalert");
            #endif
        
        /* set some variables for later use */
        is_playing false;
        is_fullscreen=false;
        //where is the image for the app?
        string image_src Path.build_filename(resources,"crapalert.png",null);
        string icon_src Path.build_filename(resources,"icon.png",null);
        stdout.printf("image_scr: %s\n",image_src);
        //where is the audio file?
        string audio_src Path.build_filename(resources,"crapalert.wav",null);
        stdout.printf("audio_scr: %s\n",audio_src);
        /* create a gstreamer playbin */
        playbin Gst.ElementFactory.make("playbin""player");
        //set the uri of the playbin to the audio file source
        playbin.set_property("uri""file://" audio_src);
        //get the bus of the playbin
        var bus playbin.get_bus();
        //tell the bus to watch for signals from the playbin
        bus.add_signal_watch();
        //connect "message" signals to a function
        bus.message.connectplayer_message );

        /* build the interface */
        // create a new window
        window new Hildon.Window();
        // connect the delete_event so we can quit the app
        window.destroy.connect( (w)=> { 
            quit(); 
            } );
        window.key_press_event.connect( (w,e)=> {
          check_event(e);
        } );
        // we need a button box to hold the image
        Gtk.Button button new Gtk.Button();
        
        //connect the button to the play_audio function
        button.clicked.connect( (w)=>{ 
            play_audio(); 
            }  );
        //create an image from the image_src
        Gtk.Image image new Gtk.Image.from_file(image_src);
        //add the image to the button

        button.set_image(image);
        //add the button to the window
        window.add(button);
        //set the window icon
        window.set_icon_from_fileicon_src )
        //show the app
        window.show_all();
    }

    public void run()
    {
        //start gtk
        Gtk.main();
    }
    
    private void quit()
    {
        playbin.set_state(Gst.State.NULL);
        Gtk.main_quit();
    }
    
    public void play_audio()
    {
        //are we already playing?
        if(!is_playing)
        {
            is_playing true;
            //make the playbin play
            playbin.set_state(Gst.State.PLAYING);
        }
    }
    
    private void player_message(Message message)
    {
        // check for the end of stream message from the playbin
        var message.type;
        if (== Gst.MessageType.EOS )
        {
            playbin.set_state(Gst.State.NULL);
            is_playing=false;
        }
    }
  private void check_event(EventKey event) {
    if (event.keyval==65475) {
      toggle_fullscreen();
    }
  }
  private void toggle_fullscreen() {
    if (is_fullscreen) {
      window.unfullscreen();
      is_fullscreen=false;
    }else{
      window.fullscreen();
      is_fullscreen=true;
    }
  }
}

public static void main(string[] args)
{
    //init gtk and gstreamer
    Gtk.init(ref args);
    Gst.init(ref args);
    //make a new instance of the crapalert
    CrapAlert ca new CrapAlert();
    //run the crap alert
    ca.run();
}

Here is the crapalert running on my N810. If anyone is interested in the installable binary, it is available at http://www.jezra.net/downloads/crapalert-0.2.deb.


Technology


About two weeks ago, my telephone answering machine died. To be honest, it had been one cassette in the grave for a very long time. Anyway, a short trip to a local thrift store and $6 later; I had taken the leap for the 80s right into the 90s with a digital answering machine/cordless phone combination. That's right, a push button phone. How tech is that?

A few days after connecting my new phone, I received an invitation to Google Voice and I thought I should try out the service. I will be doing a proper review in a month or two when I have had time to properly use Google Voice.

Speaking of speaking, I've been trying to set up a Mumble server and I could use some help testing the machine with someone far away. If you can install Mumble v1.2.2, have a microphone, and live more than 4000 miles from the San Francisco Bay Area, contact me. Actually, if you can install Mumble 1.2.2 then you should contact me.

Now quit reading, and go do something.

Comments
Name:
not required
Email:
not required (will not be displayed)
Website:
not required (will link your name to your site)
Comment:
required
Please do not post HTML code or bbcode unless you want it to show up as code in your post. (or if you are a blog spammer, in which case, you probably aren't reading this anyway).
Prove you are human by solving a math problem! I'm sorry, but due to an increase of blog spam, I've had to implement a CAPTCHA.
Problem:
1 minus 1
Answer:
required
subscribe
 
2016
2015
2014
2013
2012
2011
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008