Tuesday, 3 April 2018

How ssh work and generate ssh public key and private key?


Source: https://wiki.cdot.senecacollege.ca/wiki/OPS335_Lab_1


Generate key:


$ ssh-keygen


You will have id_rsa.pub and id_rsa

Send id_rsa.pub to server admin or paste into server you need to ssh.

Monday, 2 April 2018

Đọc Nhanh, Hiểu Sâu, Nhớ Lâu Trọn Đời​ Atsushi Innami [JOEN REVIEW]



Đọc Nhanh, Hiểu Sâu, Nhớ Lâu Trọn Đời​ Atsushi Innami

Các ý chính mà mình nắm:
Tác giả cuốn sách tâm sự:
Tôi có một câu được đăng tải liên tục trên web Wani Bookout thuộc WaniBooks là: "Thần sách chỉ ngụ trong một câu nói". Tôi lên kế hoạch chọn lấy một câu tôi ấn tượng nhất từ mỗi cuốn sách. Dù là cuốn nào cũng nhất định có một câu mà bạn thấy ấn tượng nhất, hãy chọn ra câu ấy.


Monday, 18 December 2017

call soap webservice from php or consume asmx service

I'm using a method using SoapClient class in a php page to call a web service in an asp.net site.

$myParams = array('intA' => 1, 'intB' => 2);

$client = new SoapClient("http://www.dneonline.com/calculator.asmx?WSDL");
$result = $client->Add($myParams);
var_dump($result);


The SoapClient class provides a client for » SOAP 1.1, » SOAP 1.2 servers. It can be used in WSDL or non-WSDL mode.
 SoapClient {
/* Methods */
public mixed __call ( string $function_name , string $arguments )
public SoapClient ( mixed $wsdl [, array $options ] )
public string __doRequest ( string $request , string $location , string $action , int $version [, int $one_way = 0 ] )
public array __getFunctions ( void )
public string __getLastRequest ( void )
public string __getLastRequestHeaders ( void )
public string __getLastResponse ( void )
public string __getLastResponseHeaders ( void )
public array __getTypes ( void )
public void __setCookie ( string $name [, string $value ] )
public string __setLocation ([ string $new_location ] )
public bool __setSoapHeaders ([ mixed $soapheaders ] )
public mixed __soapCall ( string $function_name , array $arguments [, array $options [, mixed $input_headers [, array &$output_headers ]]] )
public SoapClient ( mixed $wsdl [, array $options ] )
}

Wednesday, 25 October 2017

how to hide ajax requests from firebug console

we use an image attach to body tag
masoffer_order_info = {
  transaction_id: '',
  offer_id: '',
  transaction_time: , // 1447388224436
  signature: '',
  /*transaction_discount: 100000, */
  traffic_id: Cookies.get('mp_traffic_id'),
  
  products: [
   $value)
        {
            $i++;
            //if ($key == 'totalSanPham') continue;
            $product3 = $value;
     ?>
     {
        id: '',
        sku: '',
        url: 'http://myphamchonam.com',
        price: ,
        name: '',
        category: '',
        category_id : ,
        status_code: 0,
        quantity: 
    }
      
     
      
    
  ]
};

}


var MasOffer = {
    transaction: function (x) {
        var y = JSON.stringify(MasOffer.parseTransaction(x));
        var url = 'https://static.masoffer.net/img/oid/' + x.offer_id + '/?data=' + encodeURIComponent(y);

        var oImg = document.createElement("img");
        oImg.setAttribute('src', url);
        oImg.style.width = '1px';
        oImg.style.height = '1px';
        oImg.style.position = 'fixed';
        oImg.style.top = '0';

        document.body.appendChild(oImg);
    },
    parseTransaction: function (z) {
        var products = z.products;
        products.forEach(function(product, index){
            try {
                products[index] = MasOffer.parseProduct(product);
            }
            catch(err) {
                console.log(err.message);
            }

        });
        return z;
    },
    parseProduct: function (p) {
        if (p.category_id !== undefined) {
            p.category_id_raw = p.category_id;
            p.category_id = 1;
        }
        return p;
    }
};
var interval;
interval = setInterval(function(){
    if (typeof masoffer_order_info !== "undefined") {
        clearInterval(window.interval);
        MasOffer.transaction(masoffer_order_info)
    }
}, 2000);


Friday, 12 August 2016

my sourcetree refresh continuously

In my case,
some programs save file or create new file in git continuoly so it make sourcetree refresh continuously.

Example: crontab alway run to save files. so try removing crontab.

Wednesday, 10 August 2016

Tuesday, 9 August 2016

common used functions in testing cakephp 3x

Command line

  ./vendor/bin/phpunit tests/TestCase/Model/Table/UsersTableTest

vendor/bin/phpunit   tests/TestCase/Controller/SettingsControllerTest.php

vendor/bin/phpunit   tests/TestCase/Controller/UsersControllerTest.php --coverage-html webroot/coverage  --whitelist src/Controller/UsersController.php