Tag Archives: biscuits

Are you a biscuit?

A biscuit with a spider on it
Photo by chrisinplymouth

Do you think you might be a biscuit? This is actually a common phenomenon and our boffins here at WebBiscuit have devised a simple test you can use to lay all your doubts to rest.

Are you a Biscuit? Test

Allow yourself no more than 2 hours. Calculators are allowed. Try to answer all of the questions.

  1. Have a glance in the nearest mirror. How would you describe your complexion?
    1. Clear and smooth
    2. Green and leafy
    3. Caramel and bumpy
  2. Where do you live?
    1. Under a bridge
    2. Under the stairs in a sack with lots of other things that look a lot like me
    3. In the cupboard in a little packet with lots of other things that look a lot like me
  3. In which of these social situations would you feel most comfortable?
    1. Gyrating along and singing kareoke at the top of your voice, in nothing but a leopard skin thong and cowboy hat
    2. Buried beneath a Yorkshire pudding on a lazy Sunday afternoon, smothered in gravy
    3. Snuggled up against a steaming hot cup of tea
  4. Lick yourself. Go on!
    How does it taste?
    1. Clammy and sticky, but it’s not an altogether unpleasant experience
    2. Urgh! I taste disgusting!
    3. I taste sweet and delicious!
  5. Alright. Now take a bite out of yourself. How does that taste?
    1. It tastes like burning
    2. Urgh! I still taste disgusting!
    3. A little bit of me broke off in my mouth, and it is the most wonderful taste I have ever had! I must have more! *nom nom nom*

End of test!
Okay, now score yourself 0 points for every a, 1 point for every b and 2 points for every c. Here are your results:

0 – 4 – Species unidentified. Unfortunately we can’t really tell what you are, although there is a slight chance you may be a mouldy biscuit. Look out for this test in future episodes.
5 – 9 – Brussel Sprout. I have some bad news. You’re not a biscuit. You’re a vegetable.
10 – Biscuit. Horay! Congratulations, you are a biscuit! Tell all your friends!

A tokeniser using STL

Using STL and its find functions, you can write a simple and extremely useful tokenise method.

std::vector<std::wstring> Tokenise(const std::wstring& stringToTokenise, const std::wstring& delimiters)
{
	std::vector<std::wstring> tokens;
	size_t startPos = 0; 
	size_t endPos = 0;
	std::wstring token;

	// Get the tokens
	while(startPos != std::wstring::npos)
	{
		// Find the start of the next token, beginning from the last one found
		startPos = stringToTokenise.find_first_not_of(delimiters, endPos);
		// Find the end of the next token, beginning from the one just found
		endPos = stringToTokenise.find_first_of(delimiters, startPos);

		// If a token wasn't found, don't try to extract it
		if(startPos != std::wstring::npos)
		{
			tokens.push_back(stringToTokenise.substr(startPos, endPos - startPos));
		}
	}

	return tokens;
}

Usage of this function is nice:

std::vector<std::wstring> strings = 
    Tokenise(L"Custard Creams;Jaffa Cakes;Hobnobs", L";");

This will return a vector of crumbly deliciousness:

strings[0] = L"Custard Creams"
strings[1] = L"Jaffa Cakes"
strings[2] = L"Hobnobs"

You can also specify multiple deliminators for the same result:

std::vector<std::wstring> strings = 
    Tokenise(L"Custard Creams?Jaffa Cakes!Hobnobs:)", L"?!:)");

One thing it does not do is return an empty string for cases like this:

std::vector<std::wstring> strings = 
    Tokenise(L";;", L";");

This returns an empty vector, but in a strange parallel world it could return 3 empty strings. Should it? I will need convincing.

A New Biscuit Tin

With a tear in his eye and a pocket full of biscuits, WebBiscuit has decided to finally leave home and stride out for pastures new.   Moving onto WordPress, Biscuitechnology has unfortunately been placed on the shelf to go stale.

While designing my own blogging/CMS system was fun, moving onto an established and popular technology means I can now concentrate on writing software.  Server and website maintenance is a fun but time-chomping process.  With the valuable time saved I’ll now be able to write more code, blog and eat more biscuits.  Everyone wins.

Over the next few days, I shall be migrating/retiring content from the oringinal site.

Things I need to do

  1. Find a suitable colour theme
  2. Find a good wordpress editor
  3. Become quite wordy
  4. Port over old content
  5. Redirect domains

Oh!  And here is a first for the site: you can now leave comments.  Any advice for the first points?