Email: Suggestion and a idea inspired from last Peter Schiff and Joe Rogan podcast

September 4, 2017

Hello Peter Schiff,

Today I am thinking about what you said on the podcast and that Bitcoin is not backed with anything and does not have a real value (which is true), but what if Gold Money adds a service, where Bitcoin can be exchanged for gold.

Solution 1.
Gold Money cryptocurrency, which can be exchanged only for gold
– generating coins from mining and value is based on market exchange for gold
– generating coins based on the available gold, 1 gram = 1 Gold Money Coin
Solution 2
Account that can exchange Gold Money <> Bitcoin (available trough goldmoney.com)
Solution 3
Account that can exchange Gold Money <> USD, EUR… <> Bitcoin (available trough goldmoney.com)
Solution 4
Gold Money Wallet on top of Bitcoin, where each received Bitcoin is converted to gold when received and converted to Bitcoin when sent.

Thank you for your time and I hope to get your thoughts on this with reply to this email or in one of your podcasts.


Best regards,

———————————-

Ivan Gospodinow,
Web Developer,
Web Consultant,
www.2kblater.com

 

EDIT
here it is, 26 days later : https://www.youtube.com/watch?v=QzYsO7N7YRc

Dynamic sleep for infinite loops based on cpu

May 11, 2017

Based on this function http://ivangospodinow.com/php-how-to-calculate-system-processors-load-in-percent/

we are getting current cpu load.

usleep(1000000 * systemLoadInPercent() / 100);

Result: 54.3% cpu load, sleep 0.543 sec

 

The truth about Herbalife

April 11, 2017

in 25g. shake formula, 13g. sugars, 9g. protein (milk), fat 1g. (which makes about 95% of the product). So selling milk and sugar for 100 USD per kilogram is nice business don`t you think?

Why using getArrayCopy and exhangeArray ?

January 7, 2017

Because that is what php are using in ArrayObject

Monty Hall Problem in PHP

November 23, 2016
define('HAS_PRICE', true);
define('HAS_NO_PRICE', false);
$tries    = 0;
$won      = 0;
$wonFirst = 0;
$i        = 0;
$pick     = 0;

/**
 * Bottom line, you play against being wrong the first time
 */
while (++$i <= 100000) {
    $scenario = [HAS_NO_PRICE, HAS_NO_PRICE, HAS_NO_PRICE];
    /**
     * Set random scenario element to true
     */
    $scenario[mt_rand(0, 2)] = HAS_PRICE;

    /**
     * First pick - 1 in 3
     */
    $pick = mt_rand(0, 2);
    if ($scenario[$pick] === HAS_PRICE) {
        $wonFirst++;
    } else {
        $won++;
    }

    $tries++;
}

echo 'Won: ' . $won . ' from ' . $tries . ' = ' . ($won / $tries) . '% and first pick won ' . $wonFirst . ' ' . ($wonFirst / $tries) . '%' . PHP_EOL;

Won: 66780 from 100000 = 0.6678% and first pick won 33220 0.3322%

HTTP Request showing progress on background task without ajax

November 17, 2016

The idea: show progress for process that is running in the background
Execution: takes advantage of the fact that JavaScript is loaded in parallel

ignore_user_abort();
set_time_limit(3600);
session_write_close();
@ob_end_clean();
@ob_end_flush();
@header('Content-Encoding: text/html');

echo 'I am doing some very very very long job 
'; $taskId = uniqueId(); touch($taskId); echo ''; echo 'Doing it '; while (file_exists($taskId)) { echo '|'; sleep(5); } echo '
'; /** * Job done, do something else */

P.S. Dont forget to unlink the file when the background task is done

Simple as that.

How to solve VR moving ? #E3onTwitch

June 13, 2016

So, I am watching some TotalBiscuit’s E3 Snarkathon VR Killing Floor… whatever

The idea, consoles have solved the moving by having 2 sticks on the controller (I hope am right about that), so lets have 2 sticks on VR, wait this is bullshit, you will say?

Well may be, we already have the right stick by moving your head, the only question is how to make the left stick?

Do it like:

1. Make the chair you are sitting on detect movement, the way to image it like you are sitting on the left controller stick, which will move you through your experience by bending the chair in the 4 directions. YOU better add sensitivity calibration all right?

2. May be a cheaper way, using your right leg to move forward, backward, left leg moving left and right or using just one leg doing all the movement. This will allow me do lay on my couch, niceee.

 

I don’t have third solution, but think of the controller sticks when trying to solve this problem.

 

simple as that 🙂

PHP Games – Solution to The Impossible Bet

April 8, 2016

/**
 * 100 people put a number in box.
 * every one must find his box within 50 tries
 */
$allTries = 100000;
$usedTries = $allTries;
$players  = 50;
$tries    = 25;
$settings = [];
$people   = [];
for ($i = 0; $i < $players; $i++) {
    $settings[$i]  = $i;
    $people[$i]    = $i;
}

$mostPeopleWon = 0;
while (--$usedTries >= 0) {
    $boxes = $settings;
    shuffle($boxes);

    $peopleWon = 0;
    for ($p = 0; $p < $players; $p++) {

        $personBoxes = $boxes;
        $started     = false;
        $won         = false;
        for ($t = 0; $t < $tries; $t++) {
            if ($started === false) {
                $num     = array_rand($personBoxes, 1);
                $started = true;
            }

            $value = $personBoxes[$num];
            unset($personBoxes[$num]);

            if ($value === $people[$p]) {
                $won = true;
                unset($boxes[$num]);
                break;
            } elseif (!array_key_exists($value, $personBoxes)) {
                $started = false;
            } else {
                $num = $value;
            }
        }

        if($won) {
            $peopleWon++;
        } else {
            break;
        }
    }
    
    if ($peopleWon > $mostPeopleWon) {
        $mostPeopleWon = $peopleWon;
    }
    
    if ($mostPeopleWon >= $players) {
        var_dump('game won in ' . ($allTries - $usedTries) . ' games');
        exit;
    }
}

var_dump('game lost. most people won ' . $mostPeopleWon);

Zf2 Navigation Custom Active Page

October 31, 2015

Zf2 Naviagation Custom Active Page
Call in layout/view

$nav = $this->navigation('Navigation');
$pages = $nav->getContainer()->getPages();
foreach ($pages as $page) {
    if ($page->getId() == 'admin') {
            $page->setActive(true);
    }
}

Set php error_log dynamicaly in .htaccess

September 20, 2015

1. Open your .htaccess file and add this lines to be bottom.
2. Create your php.error.log file.

php_value log_errors 1
php_value error_log ./php.error.log

If your file is still empty, add in your php

error_reporting(E_ALL);

Simple as that


Warning: Use of undefined constant XML - assumed 'XML' (this will throw an Error in a future version of PHP) in /home/c2kblate/sites/ivangospodinow.com/wp-content/plugins/wp-syntaxhighlighter/wp-syntaxhighlighter.php on line 1048
 
Powered by Wordpress and MySQL. Theme by Shlomi Noach, openark.org