• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
Noulakaz

Noulakaz

The blog of Avinash, Christina, Anya and Kyan Meetoo.

  • Home
  • About
  • People
    • Christina & Avinash Meetoo
    • Avinash Meetoo
    • Christina Meetoo
    • Anya Meetoo
    • Kyan Meetoo
  • General
    • News
    • Mauritius
    • Politics
    • Education
    • Business
    • Travel
  • Computing
    • Apple
    • Linux
    • LUGM
    • Programming
    • Web
    • Technology
    • Knowledge Seven
  • Entertainment
    • Music
    • Movies
    • Photography
    • Sports

Technology

What is the fair use policy?

3 May 2008 By Avinash Meetoo 193 Comments

Since the rebranding, Orange in Mauritius has quietly imposed on us its fair use policy which is described as follows on the website of Mauritius Telecom:

[The Fair Use Policy] is designed to make sure your broadband service is as fast as possible and reliable whenever you are connected.

Some of our broadband customers use file sharing software and download large files like music and videos. This uses up lots of network capacity leaving less available for others. This means that the speed of your broadband service is then affected.

Am I likely to be affected by the Fair Use Policy?

If you don’t regularly use file sharing software or download large files from the internet it’s unlikely you’ll ever be affected by this policy.

What will happen if my use is very high?

If you only occasionally have very high usage, we’re unlikely to be concerned. If your usage continues to be very high, we’ll advise you if your usage is excessive. Ultimately, if your usage still remains excessive, we may have reduce the transmission speed of the service whilst we monitor your usage.

In general, this seems like a good thing. Those who continuously download too much will first be contacted by the MT personnel and if, consequently, they don’t reduce their bandwidth requirements then they’ll be penalized. This seems like the most sensible thing to do given the geographical situation of Mauritius and the limited number of Internet links we can have access to.

There are two aspects that somewhat disturb me though:

  • The Fair Use Policy has been retrofitted in our existing contracts. Is this legal? Or should have we been contacted by Mauritius Telecom to sign a new contract?
  • The Fair Use Policy system is not transparent. What happens if the son (or daughter) of one of the big-bosses of Mauritius Telecom (or a Minister) uses too much bandwidth? Will the MT technicians contact him or her? Will they have the courage to limit his/her bandwidth? I have some doubts. For the system to work (i.e. so that people do not complain), it must be 100% transparent (i.e. everyone should know what all other Internet subscribers have used as bandwidth) but this looks a lot like a privacy violation to me…

Opinion?

[Thanks to Ajay Ramjatan for initiating this whole thought process…]

Filed Under: Technology, Web

A multimedia studio for Comm students

26 April 2008 By Avinash Meetoo 24 Comments

I am happy to announce that the Mediacom Studio website, www.mediacomstudio.com, has just been created by Christina and myself.

Mediacom Studio is a state-of-the-art audio and video production facility for Communication Studies students at the University of Mauritius. The studio will be fully operational for the 2008-2009 academic year. The studio has been funded by one agency of the UNESCO to promote the development of professional journalism in Mauritius.

The project was conceived by Christina and was approved by the UNESCO in 2007.

My contribution to the whole project was to help Christina select the equipment to acquire for the studio. This was a tough exercise as we were constrained by the budget and what equipment we could order in Mauritius. Nevertheless, we managed to come up with a very balanced and functionally rich list of equipment in my opinion:

  • Apple iMac computers with Leopard, iLife ’08 and iWork ’08
  • Panasonic HDC-SD5 HD camcorders with tripod and lighting kit
  • Olympus WS-300M audio recorders with external microphone
  • Sennheiser PC151 noise canceling headsets with microphone

Initially, the students will use iMovie ’08 for video editing. This is what I use at home and I find it excellent for beginners. We have also acquired one license of Final Cut Express for those students who want to use a more professional video editing software.

For viewing their creations, the students will be able to transfer their rendered files to an Apple TV connected to a Philips LCD TV. Additionally, they’ll be able to post their movies online on www.mediacomstudio.com for discerning people like you to enjoy…

Phew.

Filed Under: Apple, Education, News, Technology

Answers for my Scheme and Prolog test

7 April 2008 By Avinash Meetoo 26 Comments

Last friday, second year students following my Programming Languages class had a test on Scheme and Prolog. I asked them eight relatively straightforward questions which they had to complete in 45 minutes. I hope that most of them managed to get most of the answers right (I could see some students struggling though…) As I am a nice guy, I’m posting the questions and possible answers. I want to make it 100% clear that alternative answers (if they are correct of course) are also perfectly acceptable.

 

Question 1

[2 marks] Write as a Scheme expression. Assume that sin and tan exist as predefined functions.

My answer is

(/ (sin (* x x)) (+ 1 (tan x)))

 

Question 2

[2 marks] Complete the following Scheme predicate (one line only!) which returns true if the list l is a palindrome i.e. it is the same either read forward or backward (the list (a b c b a) is a palindrome):

(define (palindrome? l)
  (equal? l _________________________________________________))

My answer is

(reverse l)

A geekish answer would be (foldl cons ‘() l) which is how reverse in implemented in the Scheme library. foldl is what other programming languages call a reduction operation.

Incidentally, this is one of the questions I was asked when I was interviewed by Google.

 

Question 3

[2 marks] Complete the following Scheme function (one line only!) to find the last but one element of a list l. Assume that l is long enough to have a last but one element. The last but one element of (1 2 3 4) is 3 i.e. the element just before the last one in the list.

(define (last-but-one-element l)
  (__________________________________________________________))

A possible answer is simply

car (cdr (reverse l))

Notice that one can also use the list-ref function to directly access the last but one element (it is at position (- (length l) 2) as, in Scheme, the first element is at position 0 — thanks to Shrikaant for pointing this to me).

 

Question 4

[2 marks] Given the following Scheme function:

(define (f a b)
  (cond ((> a b) '())
    ((= a b) (list a))
    (else (cons a (f (add1 a) b)))))

What is the value of (f 5 10)?

The answer is obviously (for me at least)

 (5 6 7 8 9 10)

f is what is called a range function in other programming languages like Python and Ruby.

 

Question 5

[4 marks] Given the following additional Scheme function where (modulo a b) is the remainder when a is divided by b:

(define (g a)
  (foldl (lambda (p1 p2) (and p1 p2))
    #t
    (map (lambda (b) (> (modulo a b) 0))
      (f 2 (sub1 a)))))

What is function g?

A possible answer is:

g is a function that takes a positive integer, a, as parameter and returns true if that integer is a prime number and false otherwise.

It works by mapping (lambda (b) (> (modulo a b) 0)) on the list (2 3 4 … a-1) produced by the same function f as seen in Question 4. The result of this mapping is a list of boolean values (false if the number is a divisor of a). For example:

(map (lambda (b) (> (modulo 10 b) 0)) '(2 3 4 5 6 7 8 9))

produces

(#f #t #t #f #t #t #t #t)

The foldl (which is a reduction operation) then combines all those boolean values using the AND logical operator with #t as initial value. The result will be false if at least one of the numbers from 2 up to a-1 is a divisor for a. The result will therefore be true only if a is a prime number.

The reason I gave 4 marks for that question was that I knew many students would have to spend a lot of time to understand what the function really was. I did not expect them to write a detailed explanation… even though those who did that will not be penalized :-)

 

Question 6

[1 mark] The following diagram shows the Procedure Box Model of Prolog. Label the three remaining arrows correctly:

The answer is: “Fail” on the left and “Exit” and “Redo” (top to bottom) on the right.

A functor fails when Prolog cannot satisfy a query. For instance, given the only fact, boy(john)., Prolog will fail when asked boy(albert). Exit is when Prolog has managed to satisfy a query. And redo occurs when the user asks Prolog to satisfy a query that exited before (i.e. the user wants an additional answer).

 

Question 7

[4 marks] The Ackerman function is recursively defined thus:

Complete the implementation of the third case (i.e. m>0 and n>0) in Prolog by writing the four missing lines:

A(M,N,Answer) :-
  M>0,
  N>0,
  __________________________________________________________
  __________________________________________________________
  __________________________________________________________
  __________________________________________________________

A possible answer is:

A(M,N,Answer) :-
  M>0,
  N>0,
  M1 is M-1,
  N1 is N-1,
  A(M,N1,PartialAnswer),
  A(M1,PartialAnswer,Answer)

Lines 3-4 are used to calculate M-1 and N-1 using the is operator. The two last lines recursively call the Ackerman function as per the definition. Prolog is somewhat inflexible here as we are forced to invent a new variable PartialAnswer to hold what is “returned” by A(M,N-1).

Here also, I gave four marks, but in retrospect I should have given less because the complexity was much less than the previous question. I guess this is what is called “points cadeau” (gift marks…)

 

Question 8

[3 marks] What is a closure?

A possible answer is:

A closure is a function that is evaluated in an environment containing one or more variables. I spent around 15-20 minutes explaining closures to my students when I showed them this diagram by Peter Van Roy:

Consider this higher-order function in Scheme:

(define (addn n)
  (lambda (x) (+ n x)))

addn is a function which takes a parameter n and returns a function which takes any x and adds n to it. For instance, addn can be used as such:

(define one 1)
(define increment (addn one))

and consequently increment can be used as a normal function even though the variable one might be out of scope. It is as if the addn has internally memorized the value of the variable one. This capability for a function (which is code) to remember values is what makes a closure.

A closure is therefore behavior (the body of the function) as well as state (the memorized variables). Hence, it is an object in the object-oriented sense. In classical OO languages, an object can have a set of behaviors (a set of methods). This is easy to implement using a closure with one of the variables becoming a behavior selector and the function being just a massive cond statement (similar to a switch) which does different things depending on the value stored in the behavior selector.

 

Conclusion

A colleague remarked that this test was cool as it tested programming skills and also whether the student had really acquired important concepts. I also think that this is a cool test (and I would love to have had one like this when I was a student – I reckon I would have done really well…) I just hope that my 187 students have found it interesting too.

Now I only have to correct the 187 answer sheets… Hell!

Filed Under: Education, Programming, Technology

  • « Go to Previous Page
  • Page 1
  • Interim pages omitted …
  • Page 73
  • Page 74
  • Page 75
  • Page 76
  • Page 77
  • Interim pages omitted …
  • Page 139
  • Go to Next Page »

Primary Sidebar

Our Personal Websites

Avinash Meetoo
Christina Meetoo
Anya Meetoo
Kyan Meetoo

Archives

  • May 2025 (2)
  • April 2025 (4)
  • January 2025 (3)
  • December 2024 (2)
  • November 2024 (2)
  • October 2024 (3)
  • September 2024 (7)
  • August 2024 (1)
  • July 2024 (1)
  • June 2024 (2)
  • May 2024 (3)
  • January 2024 (2)
  • December 2023 (1)
  • October 2023 (1)
  • September 2023 (4)
  • August 2023 (3)
  • July 2023 (1)
  • June 2023 (4)
  • May 2023 (1)
  • April 2023 (1)
  • March 2023 (5)
  • February 2023 (1)
  • December 2022 (1)
  • November 2022 (1)
  • October 2022 (4)
  • August 2022 (4)
  • July 2022 (3)
  • June 2022 (5)
  • May 2022 (5)
  • January 2022 (3)
  • December 2021 (2)
  • November 2021 (1)
  • October 2021 (1)
  • September 2021 (4)
  • August 2021 (2)
  • July 2021 (14)
  • May 2021 (2)
  • April 2021 (4)
  • March 2021 (9)
  • February 2021 (2)
  • January 2021 (1)
  • October 2020 (1)
  • September 2020 (1)
  • August 2020 (2)
  • July 2020 (5)
  • June 2020 (3)
  • May 2020 (5)
  • April 2020 (6)
  • March 2020 (2)
  • February 2020 (2)
  • January 2020 (2)
  • October 2019 (1)
  • September 2019 (2)
  • July 2019 (2)
  • June 2019 (1)
  • May 2019 (3)
  • April 2019 (2)
  • March 2019 (1)
  • February 2019 (1)
  • January 2019 (3)
  • December 2018 (1)
  • October 2018 (3)
  • August 2018 (2)
  • July 2018 (2)
  • June 2018 (1)
  • May 2018 (2)
  • April 2018 (1)
  • February 2018 (1)
  • December 2017 (1)
  • October 2017 (1)
  • September 2017 (1)
  • August 2017 (1)
  • July 2017 (1)
  • May 2017 (4)
  • April 2017 (3)
  • March 2017 (4)
  • February 2017 (5)
  • January 2017 (3)
  • October 2016 (1)
  • September 2016 (1)
  • August 2016 (4)
  • July 2016 (1)
  • June 2016 (1)
  • March 2016 (3)
  • February 2016 (3)
  • January 2016 (1)
  • December 2015 (1)
  • November 2015 (2)
  • September 2015 (1)
  • August 2015 (3)
  • March 2015 (1)
  • December 2014 (1)
  • November 2014 (4)
  • October 2014 (1)
  • March 2014 (2)
  • February 2014 (3)
  • December 2013 (1)
  • October 2013 (1)
  • September 2013 (1)
  • August 2013 (1)
  • July 2013 (1)
  • June 2013 (2)
  • May 2013 (1)
  • March 2013 (3)
  • January 2013 (2)
  • December 2012 (3)
  • November 2012 (4)
  • September 2012 (3)
  • August 2012 (2)
  • July 2012 (3)
  • June 2012 (2)
  • May 2012 (1)
  • April 2012 (2)
  • February 2012 (1)
  • January 2012 (4)
  • December 2011 (2)
  • November 2011 (1)
  • October 2011 (4)
  • September 2011 (2)
  • August 2011 (1)
  • July 2011 (2)
  • June 2011 (4)
  • April 2011 (7)
  • March 2011 (2)
  • February 2011 (1)
  • January 2011 (3)
  • November 2010 (3)
  • October 2010 (1)
  • September 2010 (2)
  • August 2010 (4)
  • July 2010 (2)
  • June 2010 (1)
  • May 2010 (3)
  • April 2010 (4)
  • March 2010 (3)
  • February 2010 (3)
  • January 2010 (5)
  • December 2009 (2)
  • November 2009 (3)
  • October 2009 (1)
  • September 2009 (5)
  • August 2009 (3)
  • July 2009 (1)
  • June 2009 (3)
  • May 2009 (2)
  • April 2009 (7)
  • March 2009 (12)
  • February 2009 (10)
  • January 2009 (5)
  • December 2008 (4)
  • November 2008 (11)
  • October 2008 (6)
  • September 2008 (7)
  • August 2008 (3)
  • July 2008 (8)
  • June 2008 (6)
  • May 2008 (5)
  • April 2008 (7)
  • March 2008 (6)
  • February 2008 (3)
  • January 2008 (6)
  • December 2007 (11)
  • November 2007 (10)
  • October 2007 (7)
  • September 2007 (9)
  • August 2007 (3)
  • July 2007 (7)
  • June 2007 (8)
  • May 2007 (14)
  • April 2007 (11)
  • March 2007 (18)
  • February 2007 (14)
  • January 2007 (15)
  • December 2006 (16)
  • November 2006 (10)
  • October 2006 (7)
  • September 2006 (8)
  • August 2006 (8)
  • July 2006 (6)
  • June 2006 (4)
  • May 2006 (13)
  • April 2006 (10)
  • March 2006 (11)
  • February 2006 (7)
  • January 2006 (14)
  • December 2005 (8)
  • November 2005 (6)
  • October 2005 (7)
  • September 2005 (2)
  • August 2005 (6)
  • July 2005 (2)
  • June 2005 (6)
  • May 2005 (15)
  • April 2005 (12)
  • March 2005 (3)
  • February 2005 (8)
  • January 2005 (3)
  • December 2004 (1)
  • November 2004 (2)
  • October 2004 (2)
  • September 2004 (3)
  • August 2004 (3)
  • July 2004 (3)
  • June 2004 (3)
  • May 2004 (6)
  • April 2004 (10)
  • March 2004 (12)
Creative Commons License This work is licensed by Avinash Meetoo under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License.