NotionCommotion
Members-
Posts
2,446 -
Joined
-
Last visited
-
Days Won
10
Everything posted by NotionCommotion
-
I have a MySQL database with the following tables: distributed_databases - id - hash_or_timestamp - bla joined_rows - id (int) - distributed_databases_id (int) - col_a (varchar(60)) - col_b (varchar(60)) - col_c int I also have multiple SQLite databases which all include the following schema, and each will have between 0 and 300 records: rows - id (int) - col_a (varchar(60)) - col_b (varchar(60)) - col_c int The application with the SQLite databases will periodically poll the main server to ensure that they contain the same data sets. How should I verify that they are the same? My current thoughts are to either store a hash of the data sets or a timestamp whenever the MySQL data is changed. Recommendations? If a hash, how should it be performed? Or maybe a totally different approach? Thanks
-
pay to download, how do I handle this?
NotionCommotion replied to simflex's topic in PHP Coding Help
So, are you inferring that ginergm is the only moral individual here? There have been previous questions asking how to implement some unethical or illegal script, and members of this forum typically offered no help. Now, if you have a legal right to sell them, they have been been very forthcoming. -
By diving into the parser, you mean the source code or something else?
-
Got a phone number?
-
Thanks Barand, but I knew the solution, but not the "why". I searched the docs and I couldn't find why it happens or were it is documented.
-
Why does the second string definition cause an error? <?php ini_set('display_errors', 1); $obj=new stdClass(); $obj->p1=123; $obj->p2=new stdClass(); $obj->p2->p21=123; $string="foo: $obj->p1"; $string="foo: $obj->p2->p21";
-
I didn't expect this to help as I thought php56u-pecl-redis.x86_64 might be independent of the php.ini settings, but it worked!
-
pay to download, how do I handle this?
NotionCommotion replied to simflex's topic in PHP Coding Help
Agreed. Instead of having PHP directly manage the download, however, you can use something like X-Sendfile, and have PHP only manage the authentication. -
Trying to make things simpler until I get it working right, I've got rid of bRPopLPush, and am simply using $rs=$redis->brpop("queue_$id",300);. Every minute, I get the following error which occurs on that line. One solution I read was to do echo 1 > /proc/sys/vm/overcommit_memory, however, it doesn't work for me. I've read elsewhere to disable persistent connections for phpredis, but I don't know how to do so. Any recommendations? Thanks
-
The while statement didn't seem to work, and the argument order in lrem needed to be changed. I am still getting quirky results. Does anything look wrong below? $redis = new \Redis(); $redis->connect('127.0.0.1', 6379); return $redis->lPush('queue_'.$guid, json_encode($data)); $id=$_GET['guid']; //Connecting to Redis server on localhost $redis = new Redis(); $redis->connect('127.0.0.1', 6379); if($rs=$redis->rpop("processing_$id")) { //Something was in the queue, but didn't get processed $rsp=[$rs,200]; } else { $rsp=[null,204]; //Maybe something else? //while (null !== $rs=$redis->bRPopLPush("queue_$id","processing_$id",300)){ //Causes error? if($rs=$redis->bRPopLPush("queue_$id","processing_$id",300)) { $rsp=[$rs,200]; //What if something goes wrong before removed from list? $redis->lrem("processing_$id", $rs, 1); //Note that order of arguments is different with redis and phpredis! } }
-
Thanks kicken, Very nice explanation. What if I added to the queue "pay kicken $1,000". I move it from one queue to another, process it, and then BOOM, I lose power. How would I prevent sending you an additional $1,000?
-
Okay, that is what I thought. Just move an element from one list to another. But why? Why not just pop it off a list and deal with it? Because it gets popped off, something goes wrong, and it is lost? That's not good, but what does moving it to another list help? Stop. I better read your response again. So, don't bother with brpoplpush, and just push and pop. Okay, I am good with that, but why does the documentation say it is not reliable to do so? Or am I misreading it?
-
Make HTTP GET request with cURL from Wowza Rest API
NotionCommotion replied to Texan78's topic in PHP Coding Help
$obj->isConnected is Boolean. While you "could" convert it to text as you are doing, 99% of the time you shouldn't, and instead should keep it as Boolean. -
Make HTTP GET request with cURL from Wowza Rest API
NotionCommotion replied to Texan78's topic in PHP Coding Help
false is displayed as an empty string. echo $obj->isConnected?'true':'false; -
Make HTTP GET request with cURL from Wowza Rest API
NotionCommotion replied to Texan78's topic in PHP Coding Help
PHP is case sensitive. $curl is not $cURL. -
Make HTTP GET request with cURL from Wowza Rest API
NotionCommotion replied to Texan78's topic in PHP Coding Help
Are you sure you are viewing the script that you think you are? If it doesn't display "make sure I am viewing the correct script", then you are not. -
Make HTTP GET request with cURL from Wowza Rest API
NotionCommotion replied to Texan78's topic in PHP Coding Help
What does this provide: <?php $url = 'http://domain.com:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/instances/_definst_/incomingstreams/ncopeland'; $cURL = curl_init(); curl_setopt($cURL, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($cURL, CURLOPT_HTTPGET, true); curl_setopt($cURL, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json;charset=utf-8', 'Accept: application/json' )); echo('make sure I am viewing the correct script'); $result = curl_exec($cURL); var_dump($result); exit; -
Make HTTP GET request with cURL from Wowza Rest API
NotionCommotion replied to Texan78's topic in PHP Coding Help
Something is different... https://www.tehplayground.com/X1l6fB03lteHFYF2 -
Any recommendations on the proper way to implement a queue? Thanks
-
Nice word!
-
Make HTTP GET request with cURL from Wowza Rest API
NotionCommotion replied to Texan78's topic in PHP Coding Help
If your intention is to add the entire reply to a DB, I think you will be better off going as an array. Use the $array= json_decode($result,true); approach. If you just wanted a few values, you can use either approach, but objects are a little more concise. Are you sure that is the output you are getting? -
Thanks requinx, Originally, I was planning on making the blocking function indefinite, and just timeout the script, but that won't work as it will never get past it to check the time.
-
In reality, I have a blocking function, and not sleep. Any workarounds?
-
Why doesn't the following script timeout and return a fatal error after 2 seconds? Thread Safety is disabled in PHP (is this what http://php.net/manual/en/ini.sect.safe-mode.php#ini.safe-mode is?) Also, instead of returning a fatal error, how can I do something else such as just die? I suppose I could use an error handler to do so, but expect there is a cleaner way. <?php echo("1\n"); set_time_limit(2); echo("2\n"); sleep(4); echo("3\n");
-
Make HTTP GET request with cURL from Wowza Rest API
NotionCommotion replied to Texan78's topic in PHP Coding Help
As requinx indicated, the two responses are the same. It doesn't matter if it is on one line or multiple. If you wanted on multiple lines for a human to better read it, but <pre> tags around it. Also, I would personally keep it as an object, but if you really want, you can make it an array. $result = curl_exec($cURL); //Returns string // why not keep it as an object? $obj = json_decode($result); echo('<pre>'.print_r($obj,1).'</pre>'); echo $obj->name; echo $obj->isConnected; // If you really want an array for some unknown reason OPTION 1 $obj = json_decode($result); $array= (array) $obj; echo('<pre>'.print_r($array,1).'</pre>'); echo $obj['name']; echo $obj['isConnected']; // If you really want an array for some unknown reason OPTION 2 $array= json_decode($result,true); echo('<pre>'.print_r($array,1).'</pre>'); echo $obj['name']; echo $obj['isConnected'];