Friday, March 22, 2013

Describe a table on the Salesforce.com platform


Set fieldSet = Contact.SObjectType.getDescribe().fields.getMap().keyset();
List fieldList = new List();
fieldList.addAll(fieldSet);
fieldList.sort();
System.debug(String.join(fieldList, ','));

Wednesday, October 19, 2011

Hexidecimal Words

Looking for a easily recognizable and memorable hex sequence?
Look no further.

cat /usr/share/dict/words | egrep ^[abcdefsilo]*$

For example:

sidesaddle
51DE5ADD1E

false
FA15E

Output below the fold.

Saturday, October 1, 2011

Dissecting a bootloader

I am sick of bootloaders being mysterious and inaccessible, so I have decided to take a closer look at mine.

Thursday, August 25, 2011

Color indexing not supported.

I'm going to start documenting the solutions to errors I encounter while programming when I feel the error is likely to be encountered by others. So, anyhow, this is the first one.

When trying to compile the GLUT redbook examples, you may get the following runtime error:
craigp@liasson> make && ./aaindex.bin
gcc -Wall -I/lusr/X11/include -I/lusr/include -o aaindex.bin -L/lusr/X11/lib -L/lusr/lib -lglut -lGLU -lGL -lpthread -lm aaindex.c
X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 128 (GLX)
Minor opcode of failed request: 26 (X_GLXMakeContextCurrent)
Serial number of failed request: 49
Current serial number in output stream: 49
What was happening in my case was that the system dose not support color indexing mode. Change the following line
glutInitDisplayMode (GLUT_SINGLE | GLUT_INDEX);
to
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGBA);
I'm not exactly sure where to view the capabilities of X11 or if it is possible to enable color indexing mode at all without root access. The header states
/*
* Initialization functions, see fglut_init.c
*/
. . .
FGAPI void FGAPIENTRY glutInitDisplayMode(unsigned int displayMode);
. . .
so if you absolutely must know, that may be the place to start looking.

Friday, August 12, 2011

Sphere inversion versus spherical reflection

A reflection in a spherical mirror is not exactly the sphere inversion (1), but it is awfully close (2).

Friday, August 5, 2011

Degenerate fun


Thinking about how homogenous coordinates degenerate to lower dimensions. For one dimension, you can scale and shift points on a number line. For zero dimensions, you get the identity matrix. I wonder if it's rotation all the way up, or if there are better ways to view the higher level transformations that open up in larger matrices.

Sunday, July 24, 2011

Buffalo Wings

250mL flour
10mL salt
5mL pepper
3mL cayenne
3mL paprika

1 egg
250mL milk

1000mL chicken
1500mL oil

100mL hot sauce
15mL margarine