Archive for category Computer Science

Google Picasa Face Recognition In the Gutter

Google’s Picasa web service has an excellent new person tagging and face recognition features. Some times it gets a little confused. The above example, which is particularly comical, is one of the extreme examples. Most of the bogus faces are close ups of ears. I do really like these features (when they are working). I was primarily using tags for people so this removes a lot of work.

The social enhancements have a long way to go yet. There a whole bunch of sharing cases that are not covered.

, , , ,

1 Comment

ACM Awards

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.

, , ,

No Comments

St Patricks Day If the Empire Had Won

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;
}
 
?>

, , , ,

2 Comments

Google Bubbles, Bubbles, Bubbles

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.

, , , , , , ,

No Comments

Inkscape’s New Capabilities

I dabble in graphic design and I of course love OSS applications because of the enthusiasm and practicality that is typical of their design. Inkscape started as a fork from Sodipodi by a group of programmers who were bent on C++. I personally was fine with this because the main Sodipodi author brought his personal politics into the project website and sample art. After sinking a load of time into converting the Sodipodi core to C++ from C, Inkscape started to develop some new features. Sodipodi quickly became the “Popular People’s Front” of one and Inkscape took off like wild fire. Inkscape is hands down easier to use than any other professional vector graphics software I have ever used including Illustrator.

Inkscape 0.46 nightly Screen

For the second summer in a row now Inkscape has benefited from the Google Summer of Code. However this year there were some very significant features that resulted. I have been using a pre-release of Inkscape with these features on a new website for Fairmount Printers and I am very impressed.

The new docking system improves MS Windows window focusing issues. The bitmap to path tool seems much faster although the SIOX selection is not fixed yet. They have added a number of raster filters so you don’t have to switch back and forth from The GIMP or Photoshop. They have a lot of aesthetics to work on in the Effect area though. Text manipulation has not been improved much on the surface yet. You still have to adjust letter spacing and manual kerning from key combos.

I saved the best for last. Inkscape can now import PDF directly which means that it can import a large number of formats indirectly. The resultant SVG is surprising cohesive. For those who have tried to open a PDF or PS file intended for a printer before you will be pleasantly surprised.

, , , , ,

No Comments

After Burned Out, Engineering Positions Available

They have had me on after burners so long at work I often cannot remember simple things when asked. That being said we are hiring. And I am seeing to it personally that I get decent help. If you think you have the right stuff for cutting edge aerospace software engineering (CS or CompE) bring it on. Honestly the work we do is really Advanced Technology stuff. You need many years of experience, you just need to be someone who eats, breaths, and shee this stuff and then come back for seconds. That being said don’t bother if you are not a solid C programmer.

, , , ,

3 Comments

BF Racing Passes to Urban Challenge Qualifying Round

Ben Franklin Racing Team

Congratulations are in order to the Ben Franklin Racing Team for being selected to go to the qualifying round (and beyond) for the DARPA Urban Challenge in October. This thing was put together in a year and it seams safe enough to drive itself effectively now and at relatively high speeds. It can distinguish lanes and intersection markings, differentiate and circumnavigate obstacles, and make k-turns. If you have time, check out the videos on their website. I understand the next phase will include turbo boost and super pursuit mode :)

, , , , , , , , ,

No Comments

Bullet-Proofing C and C++ Without Draconian Verbosity

Many, many bugs can be found through static analysis, however, the present state of analysis tools is pretty poor. Often we have two options. Either we shut off many of the warnings or we add so much verbosity to the code that readability suffers. The verbosity is ok when you are working small projects but as soon as you pass the 15 k SLOC mark you need to consider a different strategy. Blanket safety netting is common but again it tends to obscure the semantics of the code. Also things like over zealous casting can be very very dangerous. I have developed over a long period of time a set of techniques that allow static checking while still minimizing the added verbosity. I will list a few here.

The most well known and perhaps oldest (by heritage) static checker is probably SPLint. SPLint really does find quite a few issues and I recommend using it. The problem is that it is also a fire hose of false positives. I have found a number of options to make the false positives more manageable:

splint +unixlib -D__USE_POSIX -exportlocal -nullassign \
  -fcn-macros -onlytrans -boolops +ptrnegate -paramuse -retvalint \
  +boolint +floatdouble -macroredef -nullret -elseif-complete \
  -aliasunique -allimponly -predboolptr -retvalother -globstate \
  +matchanyintegral -nullpass

The other method to appease SPLint is to insert tags in your code attributing symbols in statements. For example /*@fallthrough@*/ tells splint you did indeed intend to let a case statement fall through. This kind of annotation is great for communicating to your teammates as well. However an abundance of these annotations will quickly pollute your code and there is no way to customize (i.e. #define) these annotations. Check out the following example of the prototype of free from the SPLint manual:

void free( /*@only@*/ /*@out@*/ /*@null@*/ void *ptr );

So SPLint is asking that you attribute everything at the expense of readability. Fortunately, there is another way that has many additional benefits. I have found that GCC can work effectively hand and hand with SPLint.

The good folks at GCC have provided the ability to add functional attributions to declarations. The syntax is __attribute__(( attribute_info )) where “attribute_info” is replaced by the attribute name and potentially an argument list. These attributes are used by GCC for its own static analysis but also to optimize your code. Much like const and volitile these attributes tell GCC that your code will be constrained such that the optimizer can be more or less aggressive. SPLint seems to respect these attributes even though I have found no such language in the documentation. The following are some convenience macros I frequently use:

#ifdef __GNUC__
#define UNUSED __attribute__ ((unused))
#define DEPRECATED __attribute__ ((deprecated))
#ifndef PURE // means - produces no side effects (by modifying shared globals)
#define PURE __attribute__ ((pure))
#endif
#ifndef NORETURN // means - exit is always called from this function
#define NORETURN __attribute__ ((noreturn))
#endif
// 'archetype' is one of printf, scanf, strftime or strfmon
#define FMT_FUNC( archetype, fmt_str_idx, first_varg_idx ) \
  __attribute__ ((format( archetype, fmt_str_idx, first_varg_idx )))
#define NONNULL_ARGS(arg_indexes...) __attribute__((nonnull( ##arg_indexes )));
#else
#define UNUSED
#define DEPRECATED
#define PURE
#define NORETURN
#define FMT_FUNC( archetype, fmt_str_idx, first_varg_idx )
#define NONNULL_ARGS(arg_indexes...)
#endif

GCC actually is capable of a great deal of static analysis if you enable the right options. The warnings are a lot more reasonable, so I have gotten into the practice of disabling a check in SPLint if it is enabled in GCC (see listing above). The following is a list of GCC arguments that enable full analysis and checking.

-g -Wall -Wdeclaration-after-statement -Wnested-externs -Wextra -O2

The O2 (optimization level 2) is not a mistake. Level 2 needs to be on in order to enable flow analysis within GCC. The “declaration-after-statement” restriction is because SPLint chokes hard on any declarations after the beginning of a block body code (even though it is in C99).

Ok I think this post is long enough. There are more techniques but they will have to come in subsequent posts.

, , , , , , , , , , ,

No Comments

Making the World a Little More Connected

I have sent a new version of LookOut to addons.mozilla.org (AMO). Of course I am still waiting for them to approve the last version I submitted. This new version fixes a metadata reading bug and added RTF decoding/decompression. It would be nice if the RTF could be viewed inline but at least it is accessible. TNEF encapsulated RTF and HTML body text (as opposed to an explicit attachment) will now show as attachments named body_part_#.rtf or body_part_#.html. Until the AMO folks get around to it you will find the LookOut 1.2 xpi in the project website.

Enjoy,
Aron

, , , , , , , ,

12 Comments

Emacs Tweaks – TAGS

Tags are an index of the definition of symbols in your source files. They allow you to quickly navigate your source files and to find what symbols exist. Originally they were designed for Vi probably because navigation is so poor there that you need navigational aids. Emacs has a number of integrated tag functions that many people just don’t know about. Many other IDEs have implemented this feature since through a series of context menu’s and hovers but fail to capture the basics that are covered so well in Emacs. However Emacs needs a little tweaking in order to take full advantage of capabilities. They are listed below.

More Productive Key Bindings
The following lisp gibberish allows you to search for the definition of the symbol under the mouse pointer and a way to search for all the uses of that symbol in your code. In Emacs you can return to the jumping point by pressing Alt-* (default key binding). I use XEmacs (which is superior) but you can put this in your .emacs file as well.

^^^^ .xemacs/init.el ^^^^

;;;;;;;;;;;;;;;;;
;; Tags setup
;;;;;;;;;;;;;;;;;

(defun tags-search-tag-at-point (tagname &optional file-list-form)
  "*Find tag whose name contains TAGNAME.
Identical to `find-tag' but does not prompt for tag when called interactively;
instead, uses tag around or before point."
  (interactive (if current-prefix-arg
		   '(nil nil)
		 (list (find-tag-tag "Search tag: ") nil)))
  (tags-search tagname file-list-form))

;; Find definition of the tag under the pointer
;; This nicely parallels M-*, which pops the tag stack.
(global-set-key '(control *) 'find-tag-at-point)

;; Find uses/calls of the tag under the pointer
;; This nicely parallels M-, , which cycles through the search results.
(global-set-key '(control ,) 'tags-search-tag-at-point)

;; Search and replace all uses of a tag
;; This nicely parallels M-%, which is the normal search and replace.
(global-set-key '(control %) 'tags-query-replace)

;; Complete the name of a symbol using the tag table
(global-set-key '(meta return) 'tag-complete-symbol)

Fancy Ways to Building Tag Files
The following is a shell script template that you can use to find which files have changed and only reindex as needed. Replace project_dir and src_dir as needed.

^^^^ make_tags.sh ^^^^

#!/bin/sh

function build_tags () {
  tag_file="$1"
  target_dir="$2"
  file_pattern="{*.[ch],Makefile}"
  if [ -e "$tag_file" ]; then
    files=`find "$target_dir" -maxdepth 1 -name '*.[ch]' -cnewer "$tag_file" -print`
    echo $files
    if [ "$files" ]; then
      etags -f "$tag_file" "$target_dir"/*.[ch]
    fi
  else
    etags -f "$tag_file" "$target_dir"/*.[ch]
  fi
}

TAGS_DIR="$HOME/project_dir/tags"

if [ ! -e "$TAGS_DIR" ]; then
  mkdir -p "$TAGS_DIR"
fi

build_tags "${TAGS_DIR}/src_dir1.tags" "$HOME/project_dir/src_dir1"
build_tags "${TAGS_DIR}/src_dir2.tags" "$HOME/project_dir/src_dir2"
build_tags "${TAGS_DIR}/usr_include.tags" "/usr/include"
build_tags "${TAGS_DIR}/usr_include_sys.tags" "/usr/include/sys"
build_tags "${TAGS_DIR}/usr_include_GL.tags" "/usr/include/GL"

# make tags for src_dir1 which depends on src_dir2
cat "${TAGS_DIR}/src_dir1.tags" "${TAGS_DIR}/src_dir2.tags" \
    "${TAGS_DIR}/usr_include.tags" "${TAGS_DIR}/usr_include_sys.tags" \
    "${TAGS_DIR}/usr_include_GL.tags" > "$HOME/project_dir/src_dir1/TAGS"

#make tags for src_dir2
cat "${TAGS_DIR}/src_dir2.tags" \
    "${TAGS_DIR}/usr_include.tags" "${TAGS_DIR}/usr_include_sys.tags" \
    "${TAGS_DIR}/usr_include_GL.tags" > "$HOME/project_dir/src_dir1/TAGS"

^^^^^^^^^^^^

, , , , , , , ,

No Comments

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