Proportional navigation

Proportional navigation is a guidance law used in some form or another by most homing air target missiles. It is based on the fact that two vehicles are on a collision course when their direct Line-of-Sight does not change direction. PN dictates that the missile velocity vector should rotate at a rate proportional to the rotation rate of the line of sight and in the same direction.

An = N' * L' * V

Where An is the acceleration perpendicular to missile velocity vector, N’ is the proportionality constant (dimensionless), L’ is the line of sight rate, and V is the velocity.

For example, if the line of sight rotates slowly from north to east, the missile should turn to the right by a certain factor faster than the LOS-rate. This factor is called the Navigation Constant K_nav.

Proportional Navigation

via Proportional navigation – Wikipedia, the free encyclopedia.

Using command line arguments in Python in IDLE.

I’m not a big fan of integrated development environments (IDEs), but they can be nice to help people get introduced to a new language, or even to programming in general. Processing and Arduino wouldn’t be as easy for new people to use if they didn’t have a decent IDE.

Most useful scripts accept command line arguments to configure their behavior, but sometimes it is difficult to set command line parameters from within an IDE. I was recently working on a python project with a friend living in Florida, new to the world of programming, so I showed him how to use Python’s IDLE interface, a nice IDE for Python work. Unfortunately, there is no way to set command line arguments from IDLE, so our scripts weren’t working in the IDE. I found a way to manually set the command line arguments if a Python script is run from IDLE, but doesn’t interfere if the script is run from the console.

To use, insert this code right after the start of your main-line code, right before you do your parsing and validation of the input parameters. Be sure that the specified arguments below match what your program is expecting.


try:
    __file__
except:
    sys.argv = [sys.argv[0], 'argument1', 'argument2', 'argument2']

Tab completion and symlinked directories

Tab Completion is a very useful and time saving features of most modern command line interpreters. When you try to tab complete a symlinked directory, by default in BASH, it won’t put a trailing slash, even if the directory name is un-ambiguous. Example:

Normal directory:
$ cd Pic<tab>
$ cd Pictures/

Symlinked directory:
$ cd Pic<tab>
$ cd Pictures<tab>
$ cd Pictures/

Solution:
To tweak your shell to treat symlinked directories the same as regular directories for the purposes of tab completion, you can add these two lines to your ~/.inputrc file:

set mark-directories On
set mark-symlinked-directories On

QuickCG

When working with Java or (I presume) .NET, there is a standard, built-in way to do 2-dimensional graphics, such as drawing pixels or shapes on a blank canvas. These built-in graphics systems are very nice for displaying your own custom charts or graphs of the data being worked with, for example, plotting the lifetime of a human trying to escape from velociraptors.

QuickCG Screenshot

When programming in C or C++, there isn’t a standard way to do graphics, at least none that I am aware of. During my final semester at the University of Minnesota, I took a robotics class that required us to program the robots in a C++ environment. The robots we were using all had SICK laser scanners, and we wanted to plot the raw laser-data so that we could ensure that everything was working correctly.

While trying to find a decently simple way to make 2D drawings from C/C++, we discovered a very simple graphics library called QuickCG, which is a very thin wrapper around the standard SDL (Simple DirectMedia Layer) libraries. This package (actually it’s only a source and header file) includes examples and good documentation on the project website, and is extremely easy to use.

more »

28 Aug 2008, 7:01am

by Layne

leave a comment

How to avoid DNS leakage in Firefox

You’ve been there before. Work. Grandma’s house. The coffee shop wifi. The neighbor’s unsecured access point. Places where you want to use a web proxy to hide you web traffic from the local authorities. With the newer versions of OpenSSH, which can be used as a Socks5 proxy server, you can even encrypt your web traffic back to your home computer.

One issue remains, that of your DNS queries. If your DNS requests are still going out locally, your local administrators can still see what webpages you are visiting. With firefox, there is an easy way to ensure that your DNS requests go out over the proxy connection.

Quick Tutorial:
Go to “about:config”, and set “network.proxy.socks_remote_dns” to “true”.

Long Tutorial:
Avoid Firefox DNS Leak – MetroPipe WIKI

27 Aug 2008, 7:15am

by Layne

leave a comment

NMAP Dragon

Found at the end of the configuration of the NMAP source code package:


 (  )   /\   _                 (     
    \ |  (  \ ( \.(               )                      _____
  \  \ \  `  `   ) \             (  ___                 / _   \
 (_`    \+   . x  ( .\            \/   \____-----------/ (o)   \_
- .-               \+  ;          (  O                           \____
                          )        \_____________  `              \  /
(__                +- .( -'.- <  . - _  VVVVVVV VV V\                 \/
(_____            ._._: <_ - <- _  (--  _AAAAAAA__A_/                |
  .    /./.+-  . .- /  +--  - .     \______________//_              \_______
  (__ ' /x  / x _/ (                                  \___'          \     /
 , x / ( '  . / .  /                                      |           \   /
    /  /  _/ /    +                                      /              \/
   '  (__/                                             /                  \
             NMAP IS A POWERFUL TOOL -- USE CAREFULLY AND RESPONSIBLY

An MD5 sum of my very own

In the course of my job, I have a small hardware testing program that I am in charge of maintaining and making improvements on. Since the test software is used to interact between two pieces of hardware, it’s pretty important that both units have the same software running. While the Subversion $Revision$ keyword substitution works reasonably well most times, when I make a series of changes without committing the changes, I can have multiple versions of the executable with the same $Revision$ value. I needed a better way to easily allow end-users to tell two versions apart. My solution was to compute the MD5 checksum of the executable, and display that as part of the help menu.
more »

9 Jun 2008, 6:10am

by Layne

leave a comment

Polyglot

In the context of computing, a polyglot is a computer program or script written in a valid form of multiple programming languages, which performs the same operations or output independently of the programming language used to compile or interpret it.

Generally polyglots are written in a combination of C which allows redefinition of tokens with a preprocessor and a scripting programming language such as Lisp, Perl or sh.

The two most commonly used techniques for constructing a polyglot program are to make liberal use of languages which use different characters for comments and to redefine various tokens as others in different languages. Often good use is made of quirks of syntax. These are demonstrated in this public domain polyglot written in ANSI C, PHP and bash:

#define a /*
#< ?php
echo "\010Hello, world!\n"// 2> /dev/null > /dev/null \ ;
// 2> /dev/null; x=a;
$x=5 // 2> /dev/null \ ;
if (($x))
// 2> /dev/null; then
return 0;
// 2> /dev/null; fi
#define e ?>
#define b */
#include
#define main() int main()
#define printf printf(
#define true )
#define function
function main()
{
printf "Hello, world!\n"true/* 2> /dev/null | grep -v true*/;
return 0;
}
#define c /*
main
#*/

Polyglot (computing) – Wikipedia, the free encyclopedia

2 Oct 2007, 7:11am

by Layne

leave a comment

Producing Open Source Software

Karl Fogel has written an excellent guide to managing and open source project. The experience is based on his experience with the Subversion source code repository project, and includes a lot of good advice. It pretty good reading, but is about 860 KB worth of text.

This book is meant for software developers and managers who are considering starting an open source project, or who have started one and are wondering what to do now. It should also be helpful for people who just want to participate in an open source project but have never done so before.

The reader need not be a programmer, but should know basic software engineering concepts such as source code, compilers, and patches.

Prior experience with open source software, as either a user or a developer, is not necessary. Those who have worked in free software projects before will probably find at least some parts of the book a bit obvious, and may want to skip those sections. Because there’s such a potentially wide range of audience experience, I’ve made an effort to label sections clearly, and to say when something can be skipped by those already familiar with the material.

Producing Open Source Software

Blinkenlights

Blinkenlights is a hacker’s neologism for diagnostic lights on old mainframe computers and modern network hardware. The Jargon File gives the following etymology:

“This term derives from the last word of the famous blackletter-Gothic sign in mangled mock German that once graced about half the computer rooms in the English-speaking world.”

Blinkenlights – Wikipedia, the free encyclopedia

Text Form:

ACHTUNG!
ALLES TURISTEN UND NONTEKNISCHEN LOOKENPEEPERS!

DAS KOMPUTERMASCHINE IST NICHT FÜR DER
GEFINGERPOKEN UND MITTENGRABEN! ODERWISE IST EASY
TO SCHNAPPEN DER SPRINGENWERK, BLOWENFUSEN UND
POPPENCORKEN MIT SPITZENSPARKSEN.

IST NICHT FÜR GEWERKEN BEI DUMMKOPFEN. DER
RUBBERNECKEN SIGHTSEEREN KEEPEN DAS COTTONPICKEN
HÄNDER IN DAS POCKETS MUSS.

ZO RELAXEN UND WATSCHEN DER BLINKENLICHTEN.

Blackletter-Gothic Rendered Form:

Das Blinkenlichten