Archive

Archive for the ‘General’ Category

Quick Reads

March 2nd, 2011 No comments

I am constantly reading some book or other and since I got a Kindle for an Christmas present (thanks Dad!); it’s got even easier to find new books and read them. I am however aware that not everyone reads and that some see a book as a hurdle rather than a joy.

If you find yourself in that state then I can suggest Quick Reads; a superb organisation that has got some amazing authors to write some sharp and quick reads to entice people into reading again.

I just got a bundle and will be reading my way through them!

Tags: ,

Create GMail Mailing List Filter

October 26th, 2010 No comments

One of my friends was having trouble filtering a mailing list today with GMail. Turns out he didn’t know that GMail makes it simple:

  • Open on of the mailing list e-mail
  • Expand the “Show Details” link.
  • Click on the “Filter messages from this mailing list” link

That’s it instant filter, then you setup the label you wish and the actions. Just one more reason why I really love using GMail!

Tags: ,

GCD Contributors Make 300,000 Comic Book Covers Available Online

October 19th, 2010 No comments

October 18, 2010 — The Grand Comics Database today announced that it has posted its 300,000th comic book cover scan.

The 300,000th cover posted to the site was Captain America #248, published by Marvel Comics in 1980, with a cover pencilled by John Byrne and inked by Joe Rubinstein.

The cover scan was uploaded by Ramon Schenk of the Netherlands, a regular contributor to the GCD.

The Grand Comics Database (GCD) is the Earth’s largest repository of indexed comic book information. In addition to its 300,000 covers, the GCD has, to date, recorded more than 600,000 individual comic books and indexed more than 140,000. More than 5,000 publishers from around the world are represented in the GCD.

The GCD is a nonprofit project of international volunteers, with the goal of documenting and indexing all printed comics for the free use of scholars, historians, researchers, and fans worldwide.

The GCD is open to all and anyone can contribute information to the project.

For further information, go to www.comics.org.

(Mike Catron is a volunteer with the GCD and is the author of this press release. To contact a board member of the Grand Comics Database, email to gcd-contact@googlegroups.com)

Tags: ,

Internet WIN

May 21st, 2010 No comments

Sometimes you come across something striking on the internet. An excellent thread on MetaFi is one of those.

Two Russian girls were dead set on going to NYC for a very suspicious job offer. A worried friend of theirs posted a question, the rest you can read for yourself.

Tags: ,

Bit Flags

February 15th, 2010 No comments

I was further discussing C ideas and this time we came across bit flags (also called bit fields). The idea behind them is conservation of memory, a boolean data type consumes 1 byte of memory but all that is really needed is a single bit. Therefore you can store several booleans in a single byte.

Here is a simple example, note that each has a specific value to ensure that each matches a single bit in the 8-bit variable:

enum options {
  option_a = 0x01,  /*   1 == 00000001 */
  option_b = 0x02,  /*   2 == 00000010 */
  option_c = 0x04,  /*   4 == 00000100 */
  option_d = 0x08,  /*   8 == 00001000 */
  option_e = 0x10,  /*  16 == 00010000 */
  option_f = 0x20,  /*  32 == 00100000 */
  option_g = 0x40,  /*  64 == 01000000 */
  option_h = 0x80,  /* 128 == 10000000 */
};

So basically we have 8 boolean flags (0 off/false, 1 on/true). We can use these by utilising bitwise operations. There is really only 3 operations that you will use regularly on bit flags so lets see them.

Switching individual/multiple options “on” (or setting value true):

options |= option_a;
/* Translates to:
  options = options | option_a;
  options = 00000000 | 00000001;
  options = 00000001;
*/
 
options = option_a | option_c | option_h;
/* Translates to:
  options = 00000001 | 00000100 | 10000000;
  options = 10000101;
*/

Equally switching options “off” (or setting false) can be done as follows (note we are using the options from above, thus a, c and h are on):

options &= ~option_a;
/* Translates to:
  options = options & ~option_a;
  options = 10000101 & ~00000001;
  options = 10000101 & 11111110;
  options = 10000100;
*/

Obviously you need a basic grasp of boolean mathematics to be able to handle this but learning the basics shouldn’t be too hard. Finally the last thing to do is check to see if a flag is “on” or “off” (again using the options from before, so c and h are “on”:

if( options & option_b ) printf("B is ON\n");
/* 10000100 & 00000010 = 00000000 .. i.e. false, so no output */
if( options & option_c ) printf("C is ON\n");
/* 10000100 & 00000100 = 00000100 .. i.e. true, so "C is ON" is outputting */

As with most things in C, once you start using and abusing it should start to fall into place. I hope that this serves as a basic introduction to bit fields.

Tags: ,

Switch to our mobile site