Sunday, December 18, 2011

Votator : A polling website using the Condorcet Method

I have relaunched the website www.votator.com. It used the Condorcet Method with Schulze dropping. I find that it is the best and most fair technique to count vote.

I have made many improvement compared to the original website. Votator now support login and can now invite your friend to participate privately to your poll. There is no better way to make a quick group decision. ☺

Friday, November 18, 2011

Integer Math

Here is some C code to calculate the Greatest Common Divisor and the Least Common Multiple of an array of number. I hope you enjoy.


 /*  
 Copyright (c) 2011, Louis-Philippe Lessard  
 All rights reserved.  
 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:  
 Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.  
 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation
 and/or other materials provided with the distribution.  
 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
 */  
 unsigned gcd( unsigned a, unsigned b );  
 unsigned gcd_arr(unsigned * n, unsigned size);  
 unsigned lcm(unsigned a, unsigned b);  
 unsigned lcm_arr(unsigned * n, unsigned size);  
 int main()  
 {  
      unsigned test1[] = {8, 9, 12, 13, 39, 7, 16, 24, 26, 15};  
      unsigned test2[] = {2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048};  
      unsigned result;  
      result = gcd_arr(test1, sizeof(test1) / sizeof(test1[0]));  
      result = gcd_arr(test2, sizeof(test2) / sizeof(test2[0]));  
      result = lcm_arr(test1, sizeof(test1) / sizeof(test1[0]));  
      result = lcm_arr(test2, sizeof(test2) / sizeof(test2[0]));  
      return result;  
 }  
 /**  
  * Find the greatest common divisor of 2 numbers  
  * See http://en.wikipedia.org/wiki/Greatest_common_divisor  
  *  
  * @param[in] a First number  
  * @param[in] b Second number  
  * @return greatest common divisor  
  */  
 unsigned gcd( unsigned a, unsigned b )  
 {  
  unsigned c;  
  while ( a != 0 )  
  {  
    c = a;  
    a = b%a;  
    b = c;  
  }  
  return b;  
 }  
 /**  
  * Find the least common multiple of 2 numbers  
  * See http://en.wikipedia.org/wiki/Least_common_multiple  
  *  
  * @param[in] a First number  
  * @param[in] b Second number  
  * @return least common multiple  
  */  
 unsigned lcm(unsigned a, unsigned b)  
 {  
   return (b / gcd(a, b) ) * a;  
 }  
 /**  
  * Find the greatest common divisor of an array of numbers  
  * See http://en.wikipedia.org/wiki/Greatest_common_divisor  
  *  
  * @param[in] n Pointer to an array of number  
  * @param[in] size Size of the array  
  * @return greatest common divisor  
  */  
 unsigned gcd_arr(unsigned * n, unsigned size)  
 {  
      unsigned last_gcd, i;  
      if(size < 2) return 0;  
      last_gcd = gcd(n[0], n[1]);  
      for(i=2; i < size; i++)  
      {  
           last_gcd = gcd(last_gcd, n[i]);  
      }  
      return last_gcd;  
 }  
 /**  
  * Find the least common multiple of an array of numbers  
  * See http://en.wikipedia.org/wiki/Least_common_multiple  
  *  
  * @param[in] n Pointer to an array of number  
  * @param[in] size Size of the array  
  * @return least common multiple  
  */  
 unsigned lcm_arr(unsigned * n, unsigned size)  
 {  
      unsigned last_lcm, i;  
      if(size < 2) return 0;  
      last_lcm = lcm(n[0], n[1]);  
      for(i=2; i < size; i++)  
      {  
           last_lcm = lcm(last_lcm, n[i]);  
      }  
      return last_lcm;  
 }  

Monday, September 05, 2011

Software Defined Radio - Radio420x

I have been working during the last few month on a high performance Software Defined Radio RF front-end called Radio420X. I am pleased to announce that the performance are awesome and that the product is now available for order. Check it out : http://nutaq.com/en/products/view/+nutaq-radio420x

Friday, March 11, 2011

GTD - day schedule

This is a typical day of a stress free "Getting Things Done" user. ☺

Saturday, March 05, 2011

Getting Things Done: The Art of Stress-Free Productivity

I have recently discovered the GTD philosophy (Getting Things Done). It has helped me live a stress-free life and increase my productivity. It really do works!

You will learn more about GTD at http://pespmc1.vub.ac.be/Papers/GTD-cognition.pdf and http://en.wikipedia.org/wiki/Getting_Things_Done.

I have my own flow chart to process incoming request and information. It is based on the one suggested by GTD but with a few added tweak. I though I'd share it with you.