2016年2月26日 星期五

eb, aws, install, error

from:https://forums.aws.amazon.com/thread.jspa?threadID=164348



Make a virtual environment for the EB CLI:

sudo pip install virtualenv
cd ~
virtualenv eb-env

Activate the virtualenv and install awsebcli:
pip install awsebcli

Check that eb now works: 
eb --version

Deactivate and add eb to your path:
deactivate
source ~/eb-env/bin/eb




Error

Traceback (most recent call last):
  File "/usr/local/bin/eb", line 5, in <module>
    from pkg_resources import load_entry_point
  File "build/bdist.macosx-10.10-intel/egg/pkg_resources/__init__.py", line 3141, in <module>
  File "build/bdist.macosx-10.10-intel/egg/pkg_resources/__init__.py", line 3127, in _call_aside
  File "build/bdist.macosx-10.10-intel/egg/pkg_resources/__init__.py", line 3154, in _initialize_master_working_set
  File "build/bdist.macosx-10.10-intel/egg/pkg_resources/__init__.py", line 640, in _build_master
  File "build/bdist.macosx-10.10-intel/egg/pkg_resources/__init__.py", line 941, in require
  File "build/bdist.macosx-10.10-intel/egg/pkg_resources/__init__.py", line 828, in resolve



2016年2月22日 星期一

nodejs promise Q, Bluebird , async

bluebird

Async is a library for managing asynchronous operations that is not based on the use or design of promises.

================  1  file write nest ===============

fs.writeFile('./'+foldername+'/'+plist.filename, generatePlistContect(plist), function (err) {
   if (err)
       return console.log(err);
   console.log('Hello World > helloworld.txt');


fs.writeFile('./'+foldername+'/'+html.filename, generateHtmlContect(html), function (err) {
   if (err)
       return console.log(err);
   console.log('Hello World > helloworld2.txt');

console.log('going to index');
res.render('index', { title: foldername+" is created in basic" });
});
});


================  2  file write promise ===============

var Promise = require("bluebird");
var fs = Promise.promisifyAll(require("fs"));

fs.writeFileAsync('./'+foldername+'/'+plist.filename, generatePlistContect(plist))
.then(function(){
        return fs.writeFileAsync('./'+foldername+'/'+html.filename, generateHtmlContect(html))
    }).then(function(){
    res.render('index', { title: foldername+" is created in promise" });
    }).catch(function(error){
    res.render('index', { title: error });
});
================  3  file write parallel ===============
var Promise = require("bluebird");
var fs = Promise.promisifyAll(require("fs"));

var pro = [];

pro.push(fs.writeFileAsync('./'+foldername+'/'+plist.filename, generatePlistContect(plist)))
pro.push(fs.writeFileAsync('./'+foldername+'/'+html.filename, generateHtmlContect(html)))

Promise.all(pro).then(function() {
     res.render('index', { title: foldername+" is created in promise_parallel" });
}).catch(function(error){
     res.render('index', { title: error });
});



Cannot install applications because the certificate is not valid

Cannot install applications because the certificate is not valid


http://xxx/abc.plist

->

https://xxx/abc.plist

平台 research


Kontena 

Kontena is an open-source system for deploying, managing, scaling and monitoring containerized applications across multiple hosts on any cloud infrastructure.


2016年2月21日 星期日

web socket

Differences between socket.io and web sockets



// ============== /node/app.js  ============
var server = require('http').createServer(app);

var io = require('socket.io').listen(server);


io.on('connection', function(client){
    console.log('Client connected...');

    client.on('join', function(data) {
        console.log(data);
        client.emit('messages', 'Hello from server');
    });

    client.on('messages', function(data) {
          console.log("here message");
          console.log("data: "+data);
           client.emit('broad', data);
           client.broadcast.emit('broad',data);
    });

});


server.listen(3001);
// ==========================================




// ==============  client side.html  ============

         <script src="https://code.jquery.com/jquery-1.10.2.js"></script>
        <script src="https://cdn.socket.io/socket.io-1.4.5.js"></script>


        <form id="form" id="chat_form">
            <input id="chat_input" type="text">
            <input type="submit" value="Send">
        </form>


<script>
   var socket = io.connect('http://localhost:3001');
   socket.on('connect', function(data) {
       socket.emit('join', 'Hello World from client');
   });

       socket.on('messages', function(data) {
               alert(data);
       });

       socket.on('broad', function(data) {
               console.log("broad: "+data);
       });

$('form').submit(function(e){

console.log("form submit22222");
    e.preventDefault();
    var message = $('#chat_input').val();
    socket.emit('messages', message);
console.log("form submit33333 :"+message);
});
</script>

// ==========================================

2016年2月19日 星期五

css animation keyframe fade in


.svg-wrapper {
    -webkit-animation: fadein 2s; /* Safari and Chrome */
}

@-webkit-keyframes fadein { /* Safari and Chrome */
    from {
        opacity:0;
    }
    to {
        opacity:1;
    }
}




<div class="svg-wrapper">
   <div class="text">HOVER</div>
</div>

css animation keyframe

from: http://www.w3schools.com/cssref/css3_pr_animation-keyframes.asp

CSS Syntax

@keyframes animationname {keyframes-selector {css-styles;}}

Property Values

ValueDescription
animationnameRequired. Defines the name of the animation.
keyframes-selectorRequired. Percentage of the animation duration.
Legal values:
0-100%
from (same as 0%)
to (same as 100%)
Note: You can have many keyframes-selectors in one animation.
css-stylesRequired. One or more legal CSS style properties





把 animation 設定檔放到 css 內
 forward, backward, infinite
div {
    width: 100px;
    height: 100px;
    background: red;
    position :relative;
    -webkit-animation: mymove 5s forwards; /* Chrome, Safari, Opera */ 
    animation: mymove 5s forwards;
}

keyframe 設定檔
/* Chrome, Safari, Opera */ 
@-webkit-keyframes mymove {
    0%   {top: 0px;}
    25%  {top: 200px;}
    75%  {top: 50px}
    100% {top: 100px;}
}

/* Standard syntax */
@keyframes mymove {
    0%   {top: 0px;}
    25%  {top: 200px;}
    75%  {top: 50px}
    100% {top: 100px;}
}