ikhono.net

Off to Konya 0

Posted on Saturday, July 07

I’ll be doing an internship at the Selçuk University in Konya, Turkey for the next 11 weeks.

Konya

Cove Ledge 0

Posted on Thursday, July 05

The dive site gets its name from the numerous ledges and cracks in the reef. The reef is composed mainly of hard corals including brain coral, starlet coral, smooth star coral and fragile saucer coral.

The ledge shelters green morays, hawksbill turtles and nurse sharks. Also look for the ever present large barracudas hovering in mid-water, hiding beneath the overhangs or following divers around.

Debugging output macro for C 1

Posted on Thursday, July 05

In the ISO C standard of 1999, a macro can be declared to accept a variable number of arguments. This allows you for example to define the following debugging output macro:

1
2
3
4
5
6
7
8
9
/* Print debugging output, if DEBUG is defined */
#define DEBUG

/* Debugging output macro */
#ifdef DEBUG
#define debug(...)  { (void) fprintf (stdout, __VA_ARGS__); }
#else
#define debug(...)  ((void) 0)
#endif

To use the macro in your code, simply use it like printf:


debug("The Answer to the Ultimate Question is '%d'\n", answer);

It is of course possible to achieve the same behaviour with a function, where you could wrap the call to fprintf between ifdef DEBUG and endif. But this has the overhead of calling a function, whereas the preprocessor replaces every occurrence of debug(...) by ((void) 0) if DEBUG is undefined.

Instead of defining DEBUG inside your code, you could also the -DDEBUG preprocessor option of GCC.

Englishman's Bay 0

Posted on Wednesday, July 04

Englishman’s Bay is hidden from the road by a thick cover of bush. This spectacular beach with powdery light sand leads to the deep, calm water of the sheltered bay and is one of the loveliest beaches in Tobago. It is utterly ravishing and virtually undeveloped.

Fort King George 0

Posted on Tuesday, July 03

From Fort King is one of Tobago’s best preserved historical sites. It was built by the British in the 1700s when it was also captured and occupied by the French and renamed Fort Castries.

The road leading up to the Fort, passes by Tobago’s only Hospital, leading up to the top of the hill where the Fort is located. The views from the Fort provide the visitor with spectacular views over Scarborough and further north along the coastline.

Maverick 0

Posted on Monday, July 02

The Maverick was originally called Scarlet Ibis and was previously a passenger, vehicle and cargo ferry that travelled between Trinidad and Tobago. Scarlet Ibis went into service in 1959 and was retired in 1975.

On April 7, 1997 it was scuttled by the Association of Tobago Dive Operators and now sits upright on a sandy sea bed at a depth of 30m. Before scuttling, the ship was thoroughly cleaned of oil and other pollutants, hatches and other entrapments were either removed or secured making all compartments of the ship completely accessible.

The hull and exposed decks are encrusted with red polyp octorals, tunicates, sponges and literally thousands of Atlantic thorny oysters.

Amber Scripting Language 0

Posted on Monday, July 02

While browsing EiffelZone for new Eiffel related releases, I stubled across Amber, an Eiffel-like scripting language.

The highlights of Amber are

  • Syntax and semantics somewhere between those of Ruby and Eiffel
  • Scales well to large systems, thanks to built-in support for Design by Contract
  • Concise syntax, easy to read and maintain
  • Dynamic typing

The Amber Scripting Language is still experimental. Nevertheless, the included hand-crafted examples and test cases do work. Following is the “99 Bottles of Beer” implementation of Amber:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
-- Prints the song "99 Bottles of Beer"
-- See http://99-bottles-of-beer.net/

99.down_to(1, agent(n) do
   print_line(bottles(n) & " on the wall, " & bottles(n) & ".")
   if n = 0 then
      print_line(
         "Go to the store and buy some more ... 99 bottles of beer."
      )
   else
      print("Take one down and pass it around, ")
      print_line(bottles(n - 1) & " on the wall.\n")
   end
end)

private
   bottles(n)
      is
         if n = 0 then
            "No more bottles of beer"
         elseif n = 1 then
            "1 bottle of beer"
         else
            n & " bottles of beer"
         end
      end
end

Grafton Beach 1

Posted on Sunday, July 01

Grafton beach is located in Stonehaven bay and is an attractive coarse sand beach.

Stonehaven bay is one of the three places in Tobago where the endangered giant leatherback turtle comes ashore between March and June to lay their eggs which will hatch around three months later.