Tuesday, 19 August 2008

Your Thoughts?

A (virtual) penny for your thoughts...

Do you like the new site Banner?
Yes (Strongly)
Yes (Half Hearted)
Indifferent
No (Nonchalantly)
No (Vehemently)
  
pollcode.com free polls

Diving into C++

My first C++ script to practice string manipulation, standard input/output and formatting. It compiles with GCC using g++ [name.c] -o [name] under linux. Note that to meet ANSI C compliances, it is necessary to use not in the preprocessor directives, hence library function calls are prefixed with 'std::'. Using the 'using namespace std;' statement removes the need to prefix iostream objects/methods with 'std::' - similar to C#.

//*******************************************************
// Copyright (c) Christopher Cross 2008
// Format Name to fit within
// confines of Envelope window
// (An example of C++ string/cin/cout manipulation)
//*******************************************************

#include
#include
#include

#define INCOME_TAX 40
#define FORENAME_LENGTH 30
#define SURNAME_LENGTH 30
#define ENVELOPE_LENGTH 15

void fitOnEnvelope(char * first, char * last);

using namespace std;

int main(void)
{
char firstName[FORENAME_LENGTH];
char lastName[SURNAME_LENGTH];

cout << "Enter First Name:" << endl;
cin.get(firstName, 15);
cin.get();
cout << "Enter Last Name:" << endl;
cin.get(lastName, 15);
cin.get();
fitOnEnvelope(firstName, lastName);
return 666;
}

void fitOnEnvelope(char * first, char * last)
{
int size = strlen(first) + strlen(last);
char border[4] = "***";

if(size < (ENVELOPE_LENGTH - 1)) //allow for \0
{
cout << setw(ENVELOPE_LENGTH)
<< setiosflags(ios::right)
<< first << " " << last << endl;
}
else
{
char abbrev[ENVELOPE_LENGTH-3]; //allow for wspace, period, \0
strcpy(abbrev, last);
cout << setw(ENVELOPE_LENGTH)
<< setiosflags(ios::right)
<< first[0] << ". " << abbrev << endl;
}
return;
}

Sunday, 3 August 2008

Hack, Anyone?

Here's an easy and pointless hack. You will need:


  • Poor quality PC speakers

  • Strong elastic band

  • No headphones nearby

You can see where this is going...



Dolby 2.0?

Saturday, 2 August 2008

Reading List

In an attempt to become more cultured I have compiled a list of books I want to read this year:


  1. One Flew Over the Cuckoo's Nest - by Ken Kesey

  2. Crime and Punishment - by Fyodor Dostoyevsky

  3. Lady Chatterly's Lover - by D.H.Lawrence

  4. Wuthering Heights (Signet Classics) - by Emily Bronte

  5. Of Mice and Men - by John Steinbeck

  6. Dr. Jekyll & Mr. Hyde - by Robert Louis Stevenson

  7. Old Curiosity Shop - Charles Dickens

  8. The Turn Of The Screw - Henry James

  9. Emma - Jane Austen

  10. The Grapes of Wrath - John Steinbeck

  11. Three Men in A Boat - Jerome K. Jerome

  12. On The Road - Jack Kerouac

  13. Alice in Wonderland - Lewis Carroll

  14. The Picture of Dorian Gray - Oscar Wilde

  15. The Communist Manifesto - Karl Marx

  16. The Time Machine - H.G. Wells

  17. The Invisible Man - H.G. Wells

  18. The Day of the Triffids - John Wyndham

  19. A Clockwork Orange - Anthony Burgess

  20. A Tale of Two Cities - Charles - Dickens

  21. Subterraneous - Jack Kerouac

  22. Death of a Salesman - Arthur Miller

  23. Treasure Island - Robert Louis Stevenson

  24. The Illiad of Homer - Homer

  25. War and Peace - Leo Tolstoy

Friday, 1 August 2008

I've Missed You Blighty

For the past 35 days I have been interralining around Europe, stopping at major cities and sleeping in cheap hostels. I have seen 1.5Gb of tourist stuff and eaten an unhealty amount of Salami and Ice Cream (although never at the same time - thats just silly). Now I am back, and I have never been so glad to be back in England. Whilst my travels were fun and educational (travelling really does broaden the mind), they were nonetheless tiring and exhaustive.

My contact with the outside world has been limited. Very limited. I had a mobile phone with a UK only SIM and a collective total of 90min of internet cafe time. Despite my undeniably unhealthy addiction to the internet and my computer I missed neither whilst away. Even being unaware of the latest headlines and tabloid playthings was of no concern to me. Now that I am back in the country (still devoid of a permenant internet connection and my computer) the usual distractions are creeping back into my daily routine.

My travel photos are available, unfortunately on Facebook only (i love flickr, but I only have time to upload to one site, and I've got fbook-only friends to please). They can be found here: Part III, Part II, Part I. But what have I actually learnt from this trip??


  • It is possible to eat Ice Creams every day for 35 days continuous and not put on weight

  • Europe is expensive

  • The Interrail pass does not always work out cheaper than buying tickets ad hoc. Hefty reservation fees soon add up, especially in Italy, Greece and on sleeper trains

  • The leaning tower of Pisa is tiny - There is nothing else to do in Pisa

  • Florence is dull and I cannot imagine it not being 'overcast'

  • The Berlin TV Tower is overprice for what it is

  • European trains sometimes have splitting carriages. Always check that you are in the correcct car before the journey.

  • Greecians are not all friendly

  • Venice, in places, smells

  • I like Oscar Wilde

  • Sleeper trains are termed sarcastically (I do not sleep well on them)

  • Prague is very much 'hyped'



Salvidor Dali, before the Prage Castle