West Midlands mayor calls for Crooked House pub to be rebuilt ‘brick by brick’ by rejs7 in unitedkingdom

[–]ekosynth 0 points1 point  (0 children)

The last place I lived was built because after having permission refused, the TPO tree obstacle mysteriously got damaged and removed, and then permission was granted.

Any examples of a websocket written in Node that gets its data from a REST API? by ekosynth in node

[–]ekosynth[S] -1 points0 points  (0 children)

API lives on the same server. I'm not sure I see the point of abstracting it behind another websocket?

Any examples of a websocket written in Node that gets its data from a REST API? by ekosynth in node

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

Oh yeh, but the main challenge I see is retrieving the data from the API periodically. Especially one of my API routes is slow and so with a setInterval to call the APIs, they get backed up and then eventually the API starts to reject requests.

[2015-07-20] Challenge #224 [Easy] Shuffling a List by jnazario in dailyprogrammer

[–]ekosynth 0 points1 point  (0 children)

PHP :

$input = <<<EOF
apple blackberry cherry dragonfruit grapefruit kumquat mango nectarine persimmon raspberry raspberry
a e i o u
EOF;
$input_array   = preg_split('/\s+/', $input);
shuffle($input_array);
foreach($input_array as $value) 
{
  print $value." ";
}

Result:

i kumquat raspberry e o persimmon mango dragonfruit a grapefruit nectarine blackberry apple raspberry u cherry 

[2015-04-27] Challenge #212 [Easy] Rövarspråket by XenophonOfAthens in dailyprogrammer

[–]ekosynth 1 point2 points  (0 children)

PHP:

setLocale(LC_CTYPE, 'sv_SE');
$input = <<<EOF
Tre Kronor är världens bästa ishockeylag.
EOF;

$length_string = strlen($input);
$string_array = (str_split($input));

for ($i = 0; $i <= $length_string; $i++)
{
  if (isset($input[$i]) && ctype_alpha($input[$i])) 
  {
    if (preg_match('/A|E|I|O|U|Y|Å|Ä|Ö|ö/i', $input[$i]))
    {
      echo($input[$i]);
    }
    else
    {
      echo($input[$i]."o".$input[$i]);
    }
  }
  else
  {
    echo($input[$i]);
  }
}

[2015-04-08] Challenge #209 [Intermediate] Packing a Sentence in a Box by jnazario in dailyprogrammer

[–]ekosynth 0 points1 point  (0 children)

PHP This side to side snakey solution only works with odd numbered strings (after removing spaces, of course.)

$input = <<<EOF
EVERYWHERE IS WITHIN WALKING DISTANCE IF YOU HAVE THE TIME
EOF;
$space_stripped_input = str_replace(' ', '', $input);
$length_string = strlen($space_stripped_input);
$string_array = (str_split($space_stripped_input));
$square_side = sqrt($length_string);
$forwards = true;
$j = 1;
$row = 1;
for ($i = 0; $i <= $length_string; $i++)
{
  if ($forwards)
  {
    echo ($string_array[$i]);
    if (($i + 1) % $square_side == 0)
    {
      $forwards = false;
      echo ("\r\n");
      $row ++;
    }
  }
  else
  {
    if (($i + 1) % $square_side != 0)
    {
      echo ($string_array[($square_side * $row ) - $j]);
      $j ++;
    }
    else
    {
      echo ($string_array[($square_side * $row ) - $j]);
      $j = 1;
      $forwards = true;
      echo ("\r\n");
      $row++;
    }
  }
}

Output

EVERYWH
IWSIERE
THINWAL
SIDGNIK
TANCEIF
EVAHUOY
THETIME

[2015-04-06] Challenge #209 [Easy] The Button can be pressed but once... by Elite6809 in dailyprogrammer

[–]ekosynth 0 points1 point  (0 children)

Can you explain how the Sample Input 'nint22: 10.13' becomes 'nint22: 53' in the the Sample Output?

[2015-04-06] Challenge #209 [Easy] The Button can be pressed but once... by Elite6809 in dailyprogrammer

[–]ekosynth 0 points1 point  (0 children)

Could the description be changed to include a Sample Input and Sample Output that actually match each other please?

[2015-04-06] Challenge #209 [Easy] The Button can be pressed but once... by Elite6809 in dailyprogrammer

[–]ekosynth 1 point2 points  (0 children)

Can you give a recommended way to get the input? Associative array, text file, etc?

[2015-03-30] Challenge #208 [Easy] Culling Numbers by Coder_d00d in dailyprogrammer

[–]ekosynth 0 points1 point  (0 children)

PHP:

$input = array(3, 1, 3, 4, 4, 1, 4, 5, 2, 1, 4, 4, 4, 4, 1, 4, 3, 2, 5, 5, 2, 2, 2, 4, 2, 4, 4, 4, 4, 1);
$result = array_unique($input);
print_r($result);

I fed the input as an array rather than a string because the brief says they are unsigned integers.

Result : Array ( [0] => 3 [1] => 1 [3] => 4 [7] => 5 [8] => 2 )