Saturday, April 26, 2014

swissmiss | Static Happiness

swissmiss | Static Happiness: "Static Happiness

“There is no such thing as static happiness. Happiness is a mixed thing, a thing compounded of sacrifices, and losses, and betrayals.”
- John Updike"



'via Blog this'

Monday, April 21, 2014

MC vs. StarDust - Quarterfinal Ro8 - WCS Europe 2014 Season 1 - StarCraft 2 - YouTube

MC vs. StarDust - Quarterfinal Ro8 - WCS Europe 2014 Season 1 - StarCraft 2 - YouTube: ""



'via Blog this'

HouseNumbers.cpp

I'm really digging algorithms lately!
*** 1.  Street Numbers ***

A computer programmer lives in a street with houses numbered consecutively
(from 1) down one side of the street. Every evening she walks her dog by


leaving her house and randomly turning left or right and walking to the
end of the street and back. One night she adds up the street numbers of
the houses she passes (excluding her own). The next time she walks the


other way she repeats this and finds, to her astonishment, that the two
sums are the same. Although this is determined in part by her house number
and in part by the number of houses in the street, she nevertheless feels


that this is a desirable property for her house to have and decides that
all her subsequent houses should exhibit it.

Write a program to find pairs of numbers that satisfy this condition.
To start your list the first two pairs are: (house number, last number):



         6         8
        35        49

- Your program must compute 10 of these pairs of numbers.
- Your program must run no longer than a few seconds.
- Please submit your source code and the results.
#include <iostream>

using namespace std;

class HouseNumbers {

public:
  void findHouseNumbers() {
        
    long currentNum = 5;
    long currentHigh = 6;
    long lowSum = 10;
    long highSum = 6;
    long numFound = 1;

    while (numFound < 11) {

      while (highSum < lowSum) {
        currentHigh++;
        highSum += currentHigh;
      }

      if (highSum == lowSum) {
        cout << "pair " << numFound << " found : currentNum=" << currentNum;
        cout << " currentHigh=" << currentHigh << " lowSum=" << lowSum;
        cout << " highSum=" << highSum << endl;
        numFound++;
      } else {
        highSum -= currentHigh;
        currentHigh--;
      }

      lowSum += currentNum;
      currentNum++;
      highSum -= currentNum;

    }
    return;
    
  }
};


int main() {
  HouseNumbers *h = new HouseNumbers();
  h->findHouseNumbers();
}

Saturday, April 19, 2014

Thursday, April 17, 2014

BABYMETAL - いいね!- Iine! (Full ver.) - YouTube

BABYMETAL - いいね!- Iine! (Full ver.) - YouTube: ""



'via Blog this'

BABYMETAL - ヘドバンギャー!!- Head Bangya!! (Full ver.) - YouTube

BABYMETAL - ヘドバンギャー!!- Head Bangya!! (Full ver.) - YouTube: ""





AWESOME!!!

We love the Saanich Observatory!: Starry Nights Again!

We love the Saanich Observatory!: Starry Nights Again!: "3. Star-Gazing Saturday Nights this Summer!
The RASC is planning seven star-gazing evening events this summer! This is still tentative, but I expect it will be confirmed very soon. The dates on hold are July 5, 12 and 19, August 2, 9 and 16 and September 6. The plan is for a free evening event, rain or shine, with tours of the Observatory and, hopefully, viewing from the Plaskett telescope. RASC volunteers will be on hand to share their knowledge and will have their own telescopes set-up for the public to use. Stay tuned for finalized plans!
"



'via Blog this'

setuid - Wikipedia, the free encyclopedia

setuid - Wikipedia, the free encyclopedia: "The setuid and setgid bits are normally set with the command chmod by setting the high-order octal digit to 4 (for setuid) or 2 (for setgid). "chmod 6711 file" will set both the setuid and setgid bits (2+4=6), make the file read/write/executable for the owner (7), and executable by the group (first 1) and others (second 1). When a user other than the owner executes the file, the process will run with user and group permissions set upon it by its owner. For example, if the file is owned by user root and group wheel, it will run as root:wheel no matter who executes the file."



'via Blog this'

Sunday, April 06, 2014

Backtracking Algorithms

Backtracking Algorithms: "Backtracking is a refinement of the brute force approach, which systematically searches for a solution to a problem among all available options. It does so by assuming that the solutions are represented by vectors (v1, ..., vm) of values and by traversing, in a depth first manner, the domains of the vectors until the solutions are found."



'via Blog this'