IE 11 keeps asking to allow Active X and scripts

I’m busy with a Digital signage project. There will be a lot of mp4’s on a folder on our server. Example: 170622-nm-SO.mp4 (= this needs to be played on 22 June in the morning)

I’ve made a html page with JS, that will choose the correct mp4 on the correct time. Everything works just fine in Chrome, but in Internet Explorer 11, it keeps asking this:enter image description here

This html file will run localy at a windows10 computer. It needs to happen in IE11. I’ve tried a lot of the IE11 settings, but it keeps asking this when executing the file.

How can I solve it, that it won’t ask this ever again?

Thanks for the help!
Laurent

[![<video width="100%" autoplay l][1]][1]oop>
  <source id="filmpje" src="https//i.stack.imgur.com//192.168.100.8/Uurroosters/LokaalplanningKW/bronbestanden/default.mp4" type="video/mp4">
  Your browser does not support HTML5 video.
</video>



// Speciale versie voor KW. Hierbij is er één HTML bestand per scherm. 
// Deze werd gemaakt voor scherm 1 = SO 


  var link = "//192.168.100.8/Uurroosters/LokaalplanningKW/bronbestanden/default.mp4";
  var verkrijgDefault = false;
  var day;  
  var moment;
  var today = new Date()


  function urlExists(url, callback) {
  fetch(url)
  .then(function(status) {
    callback(status)
  })
}

// wordt niet gebruikt momenteel, werkt niet in xibo
function doesFileExist(urlToFile)
{
    var xhr = new XMLHttpRequest();
    xhr.open('HEAD', urlToFile, false);
    xhr.send();

    if (xhr.status == "404") {
        console.log("File doesn't exist");
        return false;
    } else {
        console.log("File exists");
        return true;
    }
}


  if (today.getHours()=12 && today.getHours()=17){
  moment = "av";
  console.log("av");
  }
  else{
  verkrijgDefault = true;
    console.log("bij het moment");
}


Date.prototype.yymmdd = function() {
  var mm = this.getMonth() + 1; // getMonth() is zero-based
  var dd = this.getDate();

  return [this.getFullYear().toString().substr(-2),
          (mm>9 ? '' : '0') + mm,
          (dd>9 ? '' : '0') + dd
         ].join('');
};

var date = new Date();


if (verkrijgDefault == false){

  // In this testversion, I look to a fixed file on the desktop.
  link = "170622-vm-SO.mp4"
  //link = "file://192.168.100.8/Uurroosters/LokaalplanningKW/uitvoer/170621-vm-SO.mp4"
 // link = "//192.168.100.8/Uurroosters/LokaalplanningKW/uitvoer/" + date.yymmdd() + "-" + moment + "-SO.mp4";

  }



 document.getElementById("filmpje").src= link;
 document.getElementsByTagName("video")[0].load();



Source: stackoverflow-javascript

Delete elements below some element using jQuery

I’ve next code:

$(function () {
    $('#delete-button').click(function () {
        deleteElementsBelow('#parent-container', 'element-2');
    });
    
    function deleteElementsBelow(parentContainerSelector, deleteBelowSelector) {
        var deleteOthers = false;
        $(parentContainerSelector).children().each(function () {
            var $elem = $(this);

            if (deleteOthers) {
                $elem.remove();
            } else if ($elem.hasClass(deleteBelowSelector)) {
                deleteOthers = true;
            }
        });
    }
});
#parent-container div {
    background-color: red;
    width: 20px;
    height: 20px;
    margin: 10px;
}

#parent-container div:nth-child(2n) {
    background-color: green;
}
https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js
<button id="delete-button" type="button">Delete</button> </div>

Is it possible to do action deleteElementsBelow by native jQuery API?


Source: stackoverflow-javascript

Twilio Chat typing() is not working

i’m successfully integrate the twilio chat api on javascript, however i got problem on .typing() function, it seems the typing function is not triggering the

‘typingStarted’ and ‘typingEnded’, can i have some advice?

here is my code

  var chatChannel;
  var chatClient;
  var username;

  $.post("/tokens", function(data) {
    username = data.username;
    chatClient = new Twilio.Chat.Client(data.token);
    chatClient.getSubscribedChannels().then(createOrJoinGeneralChannel);
  });

  function createOrJoinGeneralChannel() {
    // Get the general chat channel, which is where all the messages are
    // sent in this simple application
    // print('Attempting to join "general" chat channel...');
    var promise = chatClient.getChannelByUniqueName("#{params[:chat_channel]}");
    promise.then(function(channel) {
        chatChannel = channel;
        console.log("#{params[:chat_channel]} is exist");
        console.log(chatChannel);
        setupChannel();
    }).catch(function() {
        // If it doesn't exist, let's create it
        console.log("creating #{params[:chat_channel]} channel");
        chatClient.createChannel({
            uniqueName: "#{params[:chat_channel]}",
            friendlyName: 'General Chat Channel'
        }).then(function(channel) {
            console.log("Created #{params[:chat_channel]} channel:");
            console.log(channel);
            chatChannel = channel;
            setupChannel();
        });
    });
  }

  function setupChannel() {
    chatChannel.join().then(function(channel) {
      printMessage(username + ' joined the chat.');
      chatChannel.on('typingStarted', showTypingStarted);
      chatChannel.on('typingEnded', hideTypingStarted);
    });
    chatChannel.on('messageAdded', function(message) {
      printMessage(message.author + ": " + message.body);
    });
  }

  function showTypingStarted(member) {
    console.log('somebody is typing');
    $('#is_typing').html(member.identity + ' is typing...')
  }

  function hideTypingStarted(member) {
    $('#is_typing').html('');
  }

  var $input = $('#chat-input');
  $input.on('keydown', function(e) {
    if (e.keyCode == 13) {
      chatChannel.sendMessage($input.val());
      $input.val('');
    } else {
      //console.log('typing');
      chatChannel.typing();
    }
  });


Source: stackoverflow-javascript

filtering mysql results which are dynamically loaded

I have 3 pages

  • index.php
  • fetch_pages.php
  • script.js

and a list of artists, the get page fetches the results and the script.js asks for more to dynamically load it into index php, but it loads all of the artists.

loading all the artists dynamically took me a long time and I didn’t fully understand all of the code I’ve copied to achieve this, but now as I don’t fully understand it it’s hard to play around with it, but I believe that I’ll learn along the way

what I want to do is instead of loading all the artists to load the results according to user input (if he clicks photographers load photographers, if he enters a search term to look for results LIKE what he searched for)

What I’ve tried is the $_GET method, but it posts the searchterm in the url of index.php, and when I try to use $_GET in fetch_pages.php it doesn’t see the parameter.

my question is how to $_GET the url parameter from index.php to fetch_pages.php

below is my code

index.php

<?php
// including the config file
include('config.php');
?>
<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>Setch</title>
  https://code.jquery.com/jquery-3.2.1.min.js
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
  https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js
  <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
  <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
  <link rel="stylesheet" href="css/style.css" />
</head>
<body>
  

how to access parents controller data within component in angularjs

I have been told to incorporate AngularJS’s component into my app. Before using components, I had two controllers, patentList and patentItem. When a user clicked on an item from the patent list, it would load more details on that specific patent item.

Now I have included the controllers in the components, data is failing to populate the patent item table. This is down to (I think) that the patent item is a child of patent list and I was able to access the parents data.

When I log the selected item, it shows with all properties and values.
console log of item selected

My question is, how do I access the data of parent controller now I have used components? Any help would be greatly appreciated

list-patents

<tr ng-repeat="x in $ctrl.patents">
    <td ng-click="$ctrl.select(x)"><a ui-sref="patents.list.item({id: x.id})">{{x.applicationNumber}}</a></td>
    <td ng-bind="x.clientRef"></td>
    <td ng-bind="x.currentRenewalCost">$</td>
    <td ng-bind="x.costBandEndDate"></td>
    <td ng-bind="x.renewalCostNextStage"></td>
    <td ng-bind="x.renewalDueDate"></td>
</tr>

patent-item

<tr ng-repeat="x in $ctrl.patentItem">
    <td><input type="text" ng-model="x.patentApplicationNumber"></td>
    <td><input type="text" ng-model="x.clientRef"></td>
    <td><input type="text" ng-model="x.renewalStatus"></td>
    <td><input type="text" ng-model="x.costBandEndDate"></td>
    <td><input type="text" ng-model="x.renewalCostNextStage"></td>
    <td><input type="text" ng-model="x.renewalDueDate"></td>
</tr>

app.js

var app = angular.module('myApp', ['ngRoute', 'ui.router']);

app.config(function($stateProvider, $locationProvider, $urlRouterProvider, localStorageServiceProvider) {

    app.component('patentList', {
        scope: {},
        templateUrl: "templates/patents/list/list-patents.htm",
        controller: function(loadPatentsService, loadPatentItemService) {

            var vm = this;

            vm.select = function(item) { 
               vm.patentItem = loadPatentItemService.select(item);
               console.log(item)
            }
        }
    })
});

app.component('patent', {
    scope: {},
    templateUrl: "templates/patents/list/patent-item.htm",  
    controller: function(patentTabService, loadPatentItemService) {

        var vm = this;

       //LOAD OF CODE FOR A TAB PANEL

    }
})

app.factory('loadPatentItemService', function() {

    var factory = {};

        factory.select = function(item) {
            factory.storeSelect = [];
            selectedItem = item; 
            factory.storeSelect.push(selectedItem)
            return [selectedItem];
        }      

    return factory;

})

app.factory('patentTabService', function() {

    var factory = {};

        //CODE RELATED TO THE TAB PANEL

    return factory;

});


Source: stackoverflow-javascript

Deploy the bitbucket code directly on production server

I am using the bitbucket to store our project. Now the problem is the project is very large and having more then 20k files in it. My server having FTP connection so i am not able to copy and paste the complete project code on server. So i want to direct deploy my code from bitbucket to my production server.

I can connect to the bitbucket server and make a git pull but i really want to find something to automate this.

I am looking for a easy and fast solution but i did not find anything for bitbucket, all solution seems to be designed for github…

Any service or tool for that to automate this process ?


Source: stackoverflow-php

How to convert Array to JSON

need your help about this one…
how can i convert this arrays to json code…

here’s my code:

$ch = curl_init();
// Disable SSL verification
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
// Will return the response, if false it print the response
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
// Set the url
curl_setopt($ch, CURLOPT_URL,$url);
// Execute
$result=curl_exec($ch);
// Closing
curl_close($ch);

// Will dump a beauty json :3
var_dump(json_decode($result, true));

$result = file_get_contents($url);
// Will dump a beauty json :3
var_dump(json_decode($result, true));

enter image description here


Source: stackoverflow-php

PHP if runs twice and generates duplicate records to the MySQL database

I am writing a little piece of code for the one game where users can bid and the biggest bid wins the round (like the auction). There is a 1-minute timer and when it ends, some actions occur. I will write all the details below.

Timer script:

$auctionTimer = 1;

$target_time = strtotime('+' . $auctionTimer .  'minutes', strtotime($r1['date']));
$current_time = time();
$seconds_left = $target_time - $current_time;
$minutes_left = floor($seconds_left / 60);

if (strlen($minutes_left) != 2) {
  $minutes_left = sprintf("%02d", $minutes_left);
}  

$seconds_left -= $minutes_left * 60;
$seconds_left = floor($seconds_left);

if (strlen($seconds_left) != 2) {
  $seconds_left = sprintf("%02d", $seconds_left);
}

Something is bad with the if ($current_time > $target_time && $ragr1['count'] >= 1) { check:

$stmt1 = $pdo->prepare("SELECT id, user_id, user, bid, date FROM 
    tb_auction_bids ORDER BY id DESC");
$stmt1_while = $pdo->prepare("SELECT id, user_id, user, bid, date FROM 
    tb_auction_bids");
$stmt3 = $pdo->prepare("SELECT id, user_id FROM tb_auction_winners ORDER BY 
    id DESC LIMIT 1");
$stmt11 = $pdo->prepare("SELECT id, user_id, user FROM tb_auction_bids ORDER 
    BY id DESC LIMIT 1");
$stmt12 = $pdo->prepare("TRUNCATE TABLE tb_auction_bids");

$agr1 = $pdo->prepare("SELECT COUNT(id) AS count FROM tb_auction_bids");
$agr2 = $pdo->prepare("SELECT SUM(bid) AS sum FROM tb_auction_bids");


$stmt1->execute();
$stmt1_while->execute();
$stmt3->execute();
$stmt11->execute();

$agr1->execute();
$agr2->execute();

$r1 = $stmt1->fetch(PDO::FETCH_ASSOC);
$r3 = $stmt3->fetch(PDO::FETCH_ASSOC);
$r11 = $stmt11->fetch(PDO::FETCH_ASSOC);

$ragr1 = $agr1->fetch(PDO::FETCH_ASSOC);
$ragr2 = $agr2->fetch(PDO::FETCH_ASSOC);

if ($current_time > $target_time && $ragr1['count'] >= 1) {
  $stmt9->execute(array(
    ':user_id' => $r11['user_id'],
    ':user' => $r11['user'],
    ':win' => $ragr2['sum']
  ));
  $stmt6->execute(array(
    ':win' => $ragr2['sum'],
    ':user_id' => $r1['user_id']
  ));
  while ($r1 = $stmt1_while->fetch(PDO::FETCH_ASSOC)) {
    $stmt7->execute(array(
        ':user_id' => $r1['user_id'],
        ':aukciono_id' => $r3['id'],
        ':user' => $r1['user'],
        ':date' => $r1['date'],
        ':bid' => $r1['bid']
    ));
  } to
  $stmt12->execute();
}

I guess I should not post PDO queries because the problem is not about SQL, it is about PHP. If you are not in this page (…/auction, e.g.), when the 1-minute timer ends, it does nothing at all. You have to go again to the …/auction, e.g., to get a reward. Should I use JavaScript to check if the timer ended and then execute the file?

This is how it looks like (video):
https://www.youtube.com/watch?v=_CZcnd3RTNw

Also, I get

“SQLSTATE[23000]: Integrity constraint violation: 1048 Column ‘post’
cannot be null” error and I looked into this thread:
SQLSTATE[23000]: Integrity constraint violation: 1048 Column ‘post’ cannot be null

but it did not help. The $r1['aukciono_id'] is defined also as another variables but only the $r1['aukciono_id'] gives an error.

if ($current_time > $target_time && $ragr1['count'] >= 1) { should run only once but it runs twice and generates duplicate MySQL records. Am I doing something bad with PDO or PHP? Maybe it is because of that PDO error? Help me, please.


Source: stackoverflow-php