What's Your Programming Function?
Functions are a staple of all programming languages big and small. They all share very similar syntax, but each has it’s own slang. Here I have collected examples of a handful of my favorite programming languages as a reminder to myself and as an easy primer to reference in three minutes when my attention span flips to some other task and pushes this information off the side of my brain.
When I read or think of a programming function this lyric line runs through my head: “Conjunction junction, what’s your function” – School House Rock. Does anyone else have that happen? … no … mmm … okay, must just be me then.
Javascript
PHP
<?php
/* SYNTAX
function name(variables) {
lines of code to run
}
*/
function make_robots($many) {
echo "$many Robots are being made.\n";
}
?>
Python
#/usr/bin/python
# SYNTAX:
#
# def name(variables) {
# lines of code to be run
# }
#
make_robots(many) {
printf "%s Robots are being made." % (many)
}
Perl
#/usr/bin/perl
# SYNTAX:
#
# name(variables) {
# commands to be run
# }
#
make_robots($many) {
printf "$many Robots are being made."
}
Bash Shell Script function example
Objective-C for Cocoa function example
Oh god, my head hurts from bouncing between all these languages. I'm sure I've made mistakes here so let me know if I have so I can correct them. I must go draw a picture now and forget everything related to computers.
Open Directory and .htpasswd
Fascinating! I worked on a project* once that involved a complete rewrite of the command-line utility passwd in order to keep a number of system services including a .htpasswd file in sync with users account passwords. Mac OS X Hints noted this is made simple with Mac OS X Leopard (10.5) and Open Directory.
Virtualized Xserver
Media Temple labs has a private beta for what it’s calling Xserve-Virtual . This system has been added quickly added to my MT wish list along with the Django GridContainer which, perhaps I wont need if I move over to a full-on-mirror of my development environment using a virtual OS X Server.
A virtual Mac OS X Leopard Server running on a fully loaded cluster of Xserves virtualized using Parallels Server . I want one, … or three, … yeah that should be enough …. maybe four, for symmetry.
Fedora 9 root password mismatch resolution
Having started my journey down the command-line with Fedora 3, I was excited to try out Fedora 9. The install completed with ease (the first time around) but once I logged onto the system and attempted to configure some of the system settings, my root password didn’t work.
Why? CAPS LOCK bit was set by default during the install process making a different root password.