7 Awesome Ecommerce Content Marketing Examples for 2019 via @josephrobison

Looking for content marketing ideas to boost your brand? Get inspired by these seven websites doing ecommerce content marketing well.

The post 7 Awesome Ecommerce Content Marketing Examples for 2019 via @josephrobison appeared first on Search Engine Journal.

7 Awesome Ecommerce Content Marketing Examples for 2019 via @josephrobison

player.stopVideo, player.playVideo, etc. not working outside of event functions calls with youtube-api

I am trying to create a button that allows the user to click it and stop the embedded youtube video. However, whenever I try and call the player object itself to use the function player.playVideo() I get an error saying the function is not defined.

Player is globally defined and set when the Youtube API loads (just like the tutorial on their website). Function calls to playVideo work just fine when events trigger their usage, but using it outside of those simply do not work.

'''javascript
// 2. This code loads the IFrame Player API code asynchronously.
var tag = document.createElement('script');

tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

// 3. This function creates an <iframe> (and YouTube player)
//    after the API code downloads.
var player;
function onYouTubeIframeAPIReady() {
    isReady=true;
    player = new YT.Player('player', {
        height: '390',
        width: '640',
        videoId: 'M7lc1UVf-VE',
        events: {
            'onReady': onPlayerReady,
            'onStateChange': onPlayerStateChange
        }
    });
}

// 4. The API will call this function when the video player is ready.
function onPlayerReady(event) {
    playVideo();
}

// 5. The API calls this function when the player's state changes.
//    The function indicates that when playing a video (state=1),
//    the player should play for six seconds and then stop.
var done = false;
function onPlayerStateChange(event) {
    if (event.data == YT.PlayerState.PLAYING && !done) {
        setTimeout(stopVideo, 6000);
        done = true;
    }
}
function stopVideo() {
    player.pauseVideo();
}

function playVideo() {
    player.playVideo();
}

//The function that is run when the button is pressed, only in this case                      
 // stopVideo not work!
function togglePlay() {
    if(isPlaying) {
        stopVideo();
    } else {
        playVideo();
    }
}
'''

read more

No speedup using asyncio despite awaiting API response

I am running a program that makes three different requests from a rest api. data, indicator, request functions all fetch data from BitMEX’s api using a wrapper i’ve made.

I have used asyncio to try to speed up the process so that while i am waiting on a response from previous request, it can begin to make another one.

However, my asynchronous version is not running any quicker for some reason. The code works and as far as I know, I have set everything up correctly. But there could be something wrong with how I am setting up the coroutines?

Here is the asynchronous version:

import time
import asyncio

from bordemwrapper import BitMEXData, BitMEXFunctions


'''
asynchronous I/O
'''

async def data():
    data = BitMEXData().get_ohlcv(symbol='XBTUSD', timeframe='1h', 
                                  instances=25)
    await asyncio.sleep(0)
    return data

async def indicator():
    indicator = BitMEXData().get_indicator(symbol='XBTUSD', 
        timeframe='1h', indicator='RSI', period=20, source='close', 
        instances=25)
    await asyncio.sleep(0)
    return indicator

async def request():
    request = BitMEXFunctions().get_price()
    await asyncio.sleep(0)
    return request

async def chain():
    data_ = await data()
    indicator_ = await indicator()
    request_ = await request()
    return data_, indicator_, request_

async def main():
    await asyncio.gather(chain())

if __name__ == '__main__':
    start = time.perf_counter()
    asyncio.run(main())
    end = time.perf_counter()

    print('process finished in {} seconds'.format(end - start))

read more

Why I can use node.js without settiing environment variable path on windows?

I use windows10.
My node.js’s path is C:\Program Files\nodejs\node.exe and I can use node command.

But I haven’t set my environment variable path.
It does not mean just that I have not set it myself. I checked the user environment variables and the system environment variables but could not find them. (The path of npm was in the user environment variable.)

Why can I use node command without setting path?

Why I can use node.js without settiing environment variable path on windows?