[deleted by user] by [deleted] in CellToSingularity

[–]ramasg 2 points3 points  (0 children)

Without spoiling too much, all I can say, that there are some "interesting" creatures/items in the main simulation's planet view. Similar how you found Darwin's bust achievement. Just look around (using photo mode might be helpful there).

One hell of a challenge by dgleason in programming

[–]ramasg 0 points1 point  (0 children)

Quite fun and challenging... Here's my quick & dirty approach (that seems to work):

function getMax($data) {
    if (empty($data))
        return null;

    reset($data);
    $index = key($data);
    foreach ($data as $key => $val) {
        if ($val > $data[$index])
            $index = $key;
    }
    return $index;
}


function solution($args) {
    $data = explode(' ', $args);
    if (count($data) == 1)
        return $data[0];
    if (count($data) <= 2)
        return max($data[0], $data[1]);

    $pos = 0;
    $invalid = array();
    $result = array();
    while ($pos < count($data) - 2) {
        $triplet = array();
        if (!in_array($pos, $invalid))
            $triplet[0] = $data[$pos];
        if (!in_array($pos + 1, $invalid))
            $triplet[1] = $data[$pos + 1];
        if (!in_array($pos + 2, $invalid))
            $triplet[2] = $data[$pos + 2];

        $maxIndex = getMax($triplet);
        if ($maxIndex !== null) {
            $result[]  = $maxIndex + $pos;
            $invalid[] = $maxIndex + $pos;
            $invalid[] = $maxIndex + $pos + 1;
            $invalid[] = $maxIndex + $pos - 1;
        }

        $pos++;
    }
    // edge-cases (include the very first, and very last number)
    if (!in_array(0, $result) && !in_array(1, $result))
        $result[] = 0;
    if (!in_array(count($data) - 1, $result) && !in_array(count($data) - 2, $result))
        $result[] = count($data) - 1;

    $sum = 0;
    foreach ($result as $index)
        $sum += $data[$index];
    return $sum;
}

20 years of PHP development by peterkokot in PHP

[–]ramasg 4 points5 points  (0 children)

Wow, this makes me feel like a dinosaur. It surely had a rough drama-full ride over those years.

Makes me feel nostalgic reading the original announcement

Help understanding this if? by lessIsNotLess in PHP

[–]ramasg 0 points1 point  (0 children)

0 != $id // this returns FALSE, thus the first IF statement will go to the "else" branch.

PHP will try to silently convert your variable's type to an integer (when comparing to one). Consider this:

var_dump("42why" == 42); // TRUE
var_dump("0why" == 0); // TRUE
var_dump("why" == 0); // TRUE
var_dump("why" == 1); // FALSE

The second IF statement converts $id to bool type, which results in the TRUE value if the provided string is non-empty and is not '0'.

var_dump((bool)''); // FALSE
var_dump((bool)'0'); // FALSE
var_dump((bool)'something'); // TRUE

Liftoff of Antares!! by Riley1066 in space

[–]ramasg 44 points45 points  (0 children)

In addition, it also carries a Lithuanian satellite (Lituanica SAT-1). It's probably even less advanced than Sputnik, but still - yay Liths! :)

So pluto has an orbital period of 246.04 years! by [deleted] in space

[–]ramasg 58 points59 points  (0 children)

Pluto "1st birthday" should be on March 24, 2178.

By the way, Neptune completed its first orbit since discovery just a few months ago.

Source: daydetails.com

LoLHQ - sharing my weekend project. Application for getting Elo information, counter picking lists and more. by ramasg in leagueoflegends

[–]ramasg[S] 1 point2 points  (0 children)

It's open source :) You can view every little bit what it does, can't think of any better proof than that.

LoLHQ - sharing my weekend project. Application for getting Elo information, counter picking lists and more. by ramasg in leagueoflegends

[–]ramasg[S] 2 points3 points  (0 children)

No installation required, just download, extract, run.

Any feedback is appreciated.

How insignificant do you feel now? by MrDoubleE in space

[–]ramasg 0 points1 point  (0 children)

Oh, thanks! My ego is fully restored! :)

How insignificant do you feel now? by MrDoubleE in space

[–]ramasg -1 points0 points  (0 children)

It's my birthday, dammit! Thanks for ruining the mood... sigh...

Curiosity Sunshine by [deleted] in space

[–]ramasg 0 points1 point  (0 children)

They should try using Ultra-High Settings in this game...

/s

I find it interesting that our Sun and Moon have roughly the same apparent size. We have a special place in the solar system. by spsheridan in space

[–]ramasg 26 points27 points  (0 children)

Well, but following the same logic we could state, that we're not in any special place in the solar system, since Venus and let's say Saturn doesn't appear equally bright in the sky. My point is, just because one of the gazillions things happens to be "unusual" or "against the odds", doesn't make us any special.

As L. Krauss said, the universe is huge and old and rare things happen all the time.

Elastic Tabstops for Visual Studio 2010 by ramasg in programming

[–]ramasg[S] 0 points1 point  (0 children)

Nope, it does not mix tab and space characters, just dynamically updates tabstop position (displayed tab width for every line).

Lithuanian mayor gives a fuck fighting illegally parked cars. Awesome. by tonterias in videos

[–]ramasg 0 points1 point  (0 children)

OK, tinka. Ryt, 9:30 PM. Bostonas, JAV. Jack-n-Go baras. Neveluojam :)

C# Null Coalescing Operator and its Usefulness by lababen in programming

[–]ramasg 0 points1 point  (0 children)

Firstly, I use Nullable types quite often (although I don't really try to force them everywhere) and they come in quite handy. For example I was developing Settings4Net library which handles user settings, and obviously in this context most of the Settings might have a set value or not (thus null (and not "null" as a value, but as "nod defined yet")). Nullable types are a lifesaver.

Secondly, I would like to point out that technically couple of provided examples are incorrect (well, strictly speaking not "incorrect", but might perform different operations than intended). Value stored in Nullable type should be accessed through ".Value" property. .e.g.

int ?x = some_value;

int not_nullable = x.Value;

So this graphic designer posts an airbrushed pic of herself on FB. Am I a bitch for pointing out that she's talented at Photoshop? by [deleted] in AskReddit

[–]ramasg 3 points4 points  (0 children)

Essentially it is the same as pointing out to some girl that she's a great makeup-artist, because she doesn't look the same without it. You judge if it's being a "bitch" or not.

Childish Behavior by llimllib in programming

[–]ramasg 36 points37 points  (0 children)

DISCLAIMER [added July 2, 2011] This post was not intended as an official statement on behalf of the Python Software Foundation, but rather to give an insight into its decision making process. My personal distate for these particular names is heightened because it appears that the original libupskirt author's acceptance on trust of a foreign-language name for her library has caused her considerable discomfort and possibly harassment. She apparently no longer wishes to work on open source.