September 2011
29 posts
4 tags
When we have a bank holiday for a celebration of atheism, when the official...
– Anonymous Register reader
7 tags
The Way to see by Faith, is to shut the Eye of Reason.
– Benjamin Franklin (via rushpoint)
2 tags
Useful Unicode Characters
TABLE.gridded
{
border-collapse: collapse;
} /*TABLE.gridded*/
TABLE.gridded > TBODY > TR > TH
{
border: 2px solid;
border-color: #C0C0C0;
padding: 0.25em;
} /*TABLE.gridded TH*/
TABLE.gridded > TBODY > TR > TD
{
border: 1px solid;
border-color: #C0C0C0;
padding: 0.25em;
} /*TABLE.gridded TD*/
Here are some useful characters that can be used in Unicode...
4 tags
It is only a slight exaggeration to say that every good comment in a program...
– Charles Simonyi (via guillermonkey)
Oh, and this guy was responsible for a lot of the code written at Microsoft. Any questions?
2 tags
5 tags
Why Can’t Java Be More Like Python?
Sure, I’m spoiled by programming-language choice. And I appreciate that a lot of the complexities of Java arise from
the desire to root out potential programming errors as early as possible—at compile time, if possible, rather than run time;
the need for backward compatibility with code written for older versions of Java.
But I still can’t help considering the fact that the Java Language...
3 tags
Symbolic Signal Names
Python’s signal module defines names for the standard POSIX signals. It would be nice to be able to use these in reverse: that is, if a piece of code gets a signal, to show the symbolic name of the signal, rather than a number, to the user.
Here’s how to create a dictionary of such code-to-name mappings:
import signal
SignalName = {}
for Name in dir(signal) :
# collect symbolic names for all...
9 tags
Fuck Time Zones
underwhelmed:
Everyone should just use GMT
Programming for “US Eastern Standard Time” vs “Eastern Standard Time” including all the fucking little changes that have happened along the way, AND building in the flexibility to change it when lawmakers decide to move across time zones is a bag of dicks.
I’ll see you at zero one hundred, buddy
Unfortunately, people’s daily rhythms get quite upset...
4 tags
Disable Right Click
codes-and-tutorials:
Click here for the code.
You simply paste the code under your “<body>” tag. If it doesn’t work, try your “<head>” tag.
If someone tries to right click it will say “Function Disabled!”.
If you want to change what it says look for this part of the code:
If you want to keep it “silent”, look for this code:
You only have to erase: “alert(message);
...
7 tags
Showing Local Time On A Web Page
It always annoys me when websites show times in their time zone rather than mine. Some sites let you configure what time zone they use when showing pages to you, but why bother? The user’s browser is running on the user’s own system, which already has a time zone configured, why not simply use that? Here’s what should happen:
The server stores all dates/times in UTC.
All date/time information...
4 tags
Operator Precedence In C
Operators in the same grouping have the same precedence.
TABLE.gridded
{
border-collapse: collapse;
} /*TABLE.gridded*/
TABLE.gridded > TBODY > TR > TH
{
border: 2px solid;
border-color: #C0C0C0;
padding: 0.25em;
} /*TABLE.gridded TH*/
TABLE.gridded > TBODY > TR > TD
{
border: 1px solid;
border-color: #C0C0C0;
padding: 0.25em;
} /*TABLE.gridded...
2 tags
It’s hard to make a man understand something when his livelihood depends on him...
– Upton Sinclair
5 tags
For-Loops
The standard C-style for-loop (also available in languages like C++ and Java) looks like this:
for (initialization; termination_condition; step) { … } /*for*/
For example, if you had an array of 10 integers:
int arr[10];
you might print them out as follows:
for (unsigned int i = 0; i < 10; ++i)
{
printf("arr[%d] = %d\n", i, arr[i]);
} /*for*/
A couple of notes:
...
6 tags
Yo Microsoft,
bastardslacks:
Could you have made porting six-month-old code over to your new frameworks any more of a fevernightmare?
… oh, you could have?
Bitch.
Why Windows is not a fit platform for software development
10 tags
2 tags
6 tags
He who knows and knows he knows—
He is wise; follow him.
He who knows, and...
– old Arab proverb
2 tags
8 tags
4 tags
7 tags
Functional Versus Procedural
Just to be sure there’s no confusion, let me define my terms here:
Functional means that you write an expression (which could be defined as a function) that returns a value.
Procedural means that you write a statement, or a sequence of statements (which could be defined as a procedure) which has some effect on the machine state (alter the values of variables or whatever).
If I have to choose...
7 tags
Emacs Versus VIM
I first encountered a full-screen text editor in my first year at University, which was 1979. It was a locally-developed application, built on top of the text-editing-oriented programming language TECO.
Later, in the 1980s, I discovered Unix systems, but for many years I considered them inferior to the DEC systems I was familiar with, particularly VAX/VMS. But when I had to use them, the standard...
4 tags
4 tags
Android-Related Development Utilities
Here are a couple of Python scripts I wrote to make it easier to do development for Android:
apitizer uses the Sun javap command to decompile and display the contents of .jar files. I use it to compare the contents of various versions of the Android libraries against the Google documentation, because the latter is sometimes incorrect.
new-android-project is a wrapper around Google’s android...
4 tags
Errors In Java Language Spec, 3rd Edition
Section 5.1.10, pages 89-90:
5.1.10 Capture Conversion
Let G name a generic type declaration with n formal type parameters A1
… An with corresponding bounds U1 … Un. There exists a capture
conversion from G<T1 … Tn> to G<S1 … Sn>, where, for 1 ≤ i ≤ n :
If Ti is a wildcard type argument (§4.5.1) of the form ? then Si is a
fresh type variable whose...
4 tags
Coding Horror: Separating Programming Sheep from... →
eddieatthegov:
The main stumbling block? Forming a coherent mental model of what the computer might be doing. Even if your initial model is off, it seems you go on to do well at programming. People without a model in mind programmed very poorly, and got even worse as the subject matter grew more complex.
4 tags
4 tags
Android Sample Code
The following sample Android apps are available from my GitHub area:
3D Compass, which uses the orientation sensor and OpenGL to render an arrow that always points north, regardless of how you hold your device
Memory Hog, which lets you allocate large amounts of memory to force background tasks to be killed (useful to test that your apps cope gracefully with this)
ObjViewer, which loads and...
2 tags
Wikis I Have Contributed To
The Blender 3D: Noob to Pro Wikibook, particularly sections on
3D geometry
2.5x user interface
2.5x scripting
Inside DVD-Video Wikibook
The Waikato Linux User Group (contributions)
android-dls.com (contributions)
codecodex.com (seems to be defunct, however some of my contributions are still accessible via archive.org)