Skip to content

web - A Giant Basket That Uses Condensation to Gather Drinking Water

Designer Arturo Vittori believes the solution to the Ethiopian water shortage lies not in high technology, but in sculptures that look like giant-sized objects from the pages of a Pier 1 catalog.
His stunning water towers stand nearly 30 feet tall and can collect over 25 gallons of potable water per day by harvesting atmospheric water vapor.
[...]

source

Great idea and with a price of 550$ not expensive. Sadly, i coudln't find a campaign for fundraising some money.

Switching from Propel 1.6.9 to Propel 1.7.x and the possible bug in addMultipleJoin

I am dealing with an update of an application and we have some code inside that is using the "Propel::addMultipleJoin()" method. I know it is marked as deprecated but we are using it and it is still in there.
So we are creating a "Criteria" object and using the "addMultipleJoin". The "addMultipleJoin" method itself calls the "addJoinObject" which is calling the "equals" method of the join object (class "Join") for each already added join object. Now things starting to differ between the versions.

Version 1.7.x

The "addJoinObject" method is the following:


public function addJoinObject(Join $join)
{
    $isAlreadyAdded = false;
    foreach ($this->joins as $alreadyAddedJoin) {
        if ($join->equals($alreadyAddedJoin)) {
            $isAlreadyAdded = true;
            break;
        }
    }

    if (!$isAlreadyAdded) {
        $this->joins[] = $join;
    }

    return $this;
}

The "equals" method itself is checking the following criterias:

return $join !== null
    && $join instanceof Join
    && $this->getJoinType() == $join->getJoinType()
    && $this->getConditions() == $join->getConditions();

What have I done to debug this? I simple added the following code in "Join::equals()" right before the return statement and added a breakpoint to get the content out of it.

$joinParams = array();
$joinAsArray = array(
    'clauses' => $join->getClause($joinParams),
    'conditions' => $join->getConditions(),
    'join condition' => $join->getJoinCondition(),
    'join type' => $join->getJoinType(),
    'operators' => $join->getOperators(),
    'params' => $joinParams
);
$thisParams = array();
$thisJoinAsArray = array(
    'clauses' => $this->getClause($thisParams),
    'conditions' => $this->getConditions(),
    'join condition' => $this->getJoinCondition(),
    'join type' => $this->getJoinType(),
    'operators' => $this->getOperators(),
    'params' => $thisParams
);

Version 1.6.9

The "addJoinObject" method is the following:


public function addJoinObject(Join $join)
{
    if (!in_array($join, $this->joins)) { // compare equality, NOT identity
        $this->joins[] = $join;
    }

    return $this;
}

For your information, the class "Join" implements the magic "__toString()" method. Thats the fact why the "!in_array($join, $this->join)" is working.

public function toString()
{
    $params = array();

    return $this->getClause($params);
}

public function __toString()
{
    return $this->toString();
}

As you can see, in 1.6.9, the clauses where the base to validate if the join was already added or not. In 1.7.x, the condition (array) and the join type (e.g. "left join") are the base to validate if the join is already added or not. The problem with my statements is, that condition is always an empty array(), the join type is the same so they a marked as equal.

I digged through the changelog and each commit. Two are left, 93c6a0f and dcace44. I found a comment that is discussing this problem. So lets see. Funny sidenote, arvenil introduced this by fixing a bug (and i'm totally on his side, as long as code is inside, bugs should be fixed).

How to deal with that problem while no fix is available?
Currently, i made good process by doing the following replacement.


//broken code
$criteria->addMultipleJoin(
    array(
        array(
            MyTablePeer::COLUMN_ONE, MyOtherTable::COLUMN_TWO, Criteria::EQUAL
        ),
        array(
            MyTablePeer::COLUMN_TWO, 3, Criteria::EQUAL
        )
    ),
    Criteria::INNER_JOIN
);
//new code
$criteria->addJoin(MyTablePeer::COLUMN_ONE, MyOtherTable::COLUMN_TWO, Criteria::INNER_JOIN);
$criteria->add(MyTablePeer::COLUMN_TWO, 3, Criteria::EQUAL);

Taking the created sql statement and checking them via "EXPLAIN" is returning the same result and speed.

Update 2014-03-31

I did a pull request which got merged. Let's see if it passes the quality test and will be in the next release.

SMS Spam dank beweglicher Basisstation

In China wurden angeblich 1500 Menschen verhaftet, weil sie mit transportablen Basisstationen durch die Gegend gefahren sind.
Der Trick dabei ist, dass sich euer Telefon immer mit der Basisstation verbindet, die das stärkste Signal hat (und damit im Regefall an dichtesten dran steht). Einmal damit verbunden, wurden dann lustige Spam-Nachrichten geschickt.
Die Zahlen sind durchaus respektabel, 200 Millionen unerwünschte Nachrichten, Preise schon ab 100 britschen Pfund, Radius von einigen hundert Metern und ~ 6000 Nachrichten in 30 Minuten.
Zum Artikel.

web - Facebook Buys VR Startup Oculus for $2 Billion

Facebook is spending $2 billion to acquire Oculus, maker of Rift, a headset designed to immerse you in 3-D games and other virtual realities.

The Facebook social network is used by over 1.2 billion people across the globe, but the world is moving away from desktop web browsers — where the social network began — and towards mobile devices, including smartphones and tablets as well as a new breed of wearables devices. The company has already made a strong push onto smartphones and tablets, and in announcing the Oculus deal, it indicated that the acquisition would help push its social network into the wearable world, alongside things like Google Glass.

source

So oculus is doomed for an non add-free version and an api that extends the class "PushUsageToFaceBook" :-(.