Gtk Pie Chart Widget

June 10th, 2008 by A R Baboon

I needed a pie chart widget for a project so I made one. I used cairo for rendering of course. This API has add_segment and remove_segment functions but I will change that to take a tree model. There are almost no options or style at this point which would obviously be important but I have got the basic outline down I think. I am considering writing an entire charting widget set. There are several packages focused on plotting but they are not presentation oriented.

Code Follows:

Read the rest of this entry »

ACM Awards

May 19th, 2008 by A R Baboon

I noticed CNN is running an footage of this year’s ACM Awards. It looks like they managed to book some high profile country music singers for the ceremony.

How South Park Ruins Things

April 26th, 2008 by A R Baboon

We taught my son that if gets a “boo-boo” all he has to do is get it kissed and everything feels all better. It has worked out really well. Instead of major crying fits he just walks up to us calmly presents the injured area and says “kiss it”. The problem is south park has some prior art on a presentation of a body part and saying “kiss it”. I almost choked on a pretzel when he fell on his bottom and requested my healing powers.

Pharoah’s Revenge

April 22nd, 2008 by A R Baboon

For those who are not familiar, there is a tradition every year when millions of Jews wake up following holiday festivities and groan in pain. Passover is a kind of fast from low density (aka leavened) food. Our systems are not designed to deal with high-density food alone. There should be a section of the haggadah dedicated to bathroom reading afterwards because you are going to be in there for a while.

St Patricks Day If the Empire Had Won

March 31st, 2008 by A R Baboon

Irish Storm Troop Well I was cruising for new feeds an I came across the flickr blog which had a nice bit of cognitive dissonance as you see above. Oh and I installed WP 2.5 and I wanted to try it out. Then I discovered that image uploads for a great many installs are broken in 2.5 including this site. I have also noticed some bugs with the editor like adding paragraphs breaks when I did not. Overall 2.5 has a far more organized than 2.3 and maintains compatibility with all the plugins that I use. I also like the plugin that fixes the image upload. I am not sure why we would need a flash based uploader anyway:

< ?php
/*
Plugin Name: No Flash Uploader
Version: 1.0
Plugin URI: http://dd32.id.au/
Description: Disables the Flash Uploader of 2.5
Author: Dion Hulse
Author URI: http://dd32.id.au/
*/
 
add_filter( 'flash_uploader', 'noflashuploader' );
function noflashuploader() {
return false;
}
 
?>

Can’t Attack McCain, Go After Obama Instead

February 18th, 2008 by A R Baboon

As yet another sign of who exactly is winning the primary election. Republican conservatives are conceiting to their obligation to now support the man standing (McCain). However, the RNC knows that the lackluster support for McCain is just not enough get out the vote. In order to even attempt to rally the base they need to make the Democrat contender seem sufficiently horrible. Time to fire up the faux-grassroots mudslinger. Sure enough, right after super-Tuesday blog traffic aimed at painting Obama as a socialist increased many fold. Comically at the same time Hillary continues to rail on Obama for not being a socialist in terms of health care plan or economics.

Presently the biggest story on these sites is a new senate bill cosponsored by Obama, Global Poverty Act. which calls our government to monitor whether we honoring promises made by president Bush in 2005 to the international community. It also calls for the development of a national strategy to deal with world wide poverty. Of course, the republican blogs have done a little name spin - “Global Poverty Tax” - and misrepresented what was being said. Not surprisingly I have not seen even one of these sites actually link to the bill itself. I will, HERE it is. Funny that a call for accountability would get so much criticism, huh. The bill describes one of the key vehicles for action on global poverty:

Mobilizing and leveraging the participation of businesses, United States and international nongovernmental organizations, civil society, and public-private partnerships.

It also reiterates the US goal in regard to poverty reduction:

The official goal of United States foreign assistance is: `To help build and sustain democratic, well-governed states that respond to the needs of their people, reduce widespread poverty and conduct themselves responsibly in the international system.’.

[sarcasm] Oh that sounds very out of line. [/sarcasm]

Rubinium Candidate Round-up

January 18th, 2008 by A R Baboon

BSG Candidates, Democrats

After hearing Obama and Thompson on NPR All Things Considered last night I felt the need to post some of my observations. You can really tell why Doug and I gravitate toward Thompson and Obama respectively. Both men project a distinct air of honesty about them. The responses to assertions that their lack of spin may be used against them were classic. Referring to the last debate, Obama said jokingly “yeah, maybe I should have answered that my greatest weakness is I help old ladies across the street.” In his interview Thompson jabbed “some people are more interested in style than substance [...] there is plenty of people for them to vote for too.

BSG Candidates, Republicans

Obama and Thompson were both asked about a now inevitable economic stimulus package. Oddly enough both of them had a rather similar response which contrasts with their competitors. They said we should consider a one-time infusion of money into the economy by tacking it on to an existing vehicle. Tacking it on to an existing vehicle allows us to avoid potential pork and minimize bureaucratic skimming. Thompson was also prompted to mention not doing anything, which is where I personally lean right now.

I am actually pulling for Romney on the Republican side. It is time for them to know how we Dems felt with Kerry as our nominee. Actually comically enough he is pretty much like Kerry with an R. I did not make this video, but it sums:

DMS to Decimal By Request

January 17th, 2008 by A R Baboon

This is a function from my library that can be used to decode a degrees-minutes-seconds (DMS) string to a decimal degrees.
Enjoy.

/* ------------------------------
   Function: geo_dms_to_deg
     Parse a degrees-minutes-seconds (DMS) value string into a double floating
     point in degrees.
 
   Parameters:
     str     - [in]  string containing an angle in DMS
     end_ptr - [out] a pointer to the character following the last in the DMS
     packed  - [in]  boolean whether to expect the DMS to lack delimiters
     value   - [out] value in degrees
 
   Returns:
     true on success, false on failure
   ------------------------------ */
int geo_dms_to_deg( const char *str, const char **endptr, int packed, double *value ) {
  int d = -1, m = -1, s = -1, pos = 0;
  char ps[20] = "", *ps_ptr;
  float p = 0.0, fraction;
 
  if( packed ) {
    char format[64] = "";
 
    pos = strspn( str, "0123456789" );
    if( pos < 5 || pos > 7 )
      return( 0 );
 
    snprintf( format, 64, "%%%dd%%2d%%2d%%n", pos - 4 );
    if( sscanf( str, format, &d, &m, &s, &pos ) != 3 )
      return( 0 );
  } else if( sscanf( str, "%d:%d:%d.%[0123456789]%n", &d, &m, &s, ps, &pos ) == 4 ) {
    p = 0.0;
    fraction = 0.1;
    for( ps_ptr = ps; *ps_ptr != '\0'; ps_ptr++ ) {
      p += (*ps_ptr - '0')*fraction;
      fraction *= 0.1;
    }
  } else if( sscanf( str, "%d:%d:%d%n", &d, &m, &s, &pos ) == 3 ) {
    /* empty */
  } else if( sscanf( str, "%d:%d%n", &d, &m, &pos ) == 2 ) {
    s = 0;
  } else if( sscanf( str, "%d%n", &d, &pos ) == 1 ) {
    s = 0;
    m = 0;
  } else {
    return( 0 );
  }
  if (d < 0) return 0;
  if (m < 0 || m >= 60) return 0;
  if (s < 0 || s >= 60) return 0;
 
  *endptr = &str[pos];
 
  if( value )
    *value = d + m/60.0 + (p + (float)s)/3600.0;
 
  return( 1 );
}

Google Bubbles, Bubbles, Bubbles

December 14th, 2007 by A R Baboon

YouTube Bubbles Google has added a feature to YouTube for navigation of related videos. Video bubbles are placed by attraction. If it works like our algorithm at work for displaying networks and flow graphs here’s the general idea behind the algorithm. Node Auto Place Videos with a higher relation ranking have bubbles which are assigned a higher attraction. There is a certain amount of built-in repulsion to space all bubbles out. Then position is determined by summing all positions of other bubbles weighted by the attraction and repulsion values. Ok, so it is a bit more complicated than that when you consider all the optimizations weighting functions but thats the starting point.

Dos2unix in Emacs, Sometimes Macros Are Nice

November 30th, 2007 by A R Baboon

No CRLF
This is just a generic search and replace. Really you could make a macro for any search and replace you do on a regular basis.

;;; A interactive function for replacing all dos
;;; carriage returns (^M) with Unix 
;;; line feeds in a selected buffer. 
(defun dos2unix (buffer)
  "Automate M-% C-q C-m RET C-q C-j RET"
  (interactive "b buffer to convert" )
  (goto-char (point-min))
  (while (search-forward (string ?\C-m) nil t)
    (replace-match "" nil t)))

Bad Behavior has blocked 62 access attempts in the last 7 days.