solidity

function pay(address wallet) external payable {

  wallet.transfer(msg.value);


tronbox console

//sending 1TRX
tronbox(development)>Contract.deployed().then(function(instance){return instance.pay(wallet1, {from:wallet2, callValue:1e6})});



블로그 이미지

시간을 거스르는자

ytkang86@gmail.com

,

출처: http://clien-achive.blogspot.kr/2017/01/uplus-tvg-iptv-omvs.html

uplus tvg iptv에서 omvs 주소 추출시 체크포인트 몇가지

 

제가 약 일주일에 걸쳐서 삽질을 하면서 쉽게 놓칠수 있는 포인트 몇가지를 알리고자 합니다

정말 이것때문에 시간이 오래 걸렸네요

 

일단 제 최종 구성 환경은

 

벽단자 == iptime n8004r (최신펌웨어) == igmp스위칭허브 == iptv, igmp스위칭허브 == nas, igmp스위칭허브 == PC

 

지금은 PC에서 omvs 아주 잘 작동합니다

지금부터 포인트를 하나씩 짚어보겠습니다

 

타사 인터넷회선 등 여러가지 변수가 있을수 있으므로 아래 포인트가 절대적인 것은 아닙니다만

일단 아래 사항부터 챙겨보시라는 의미에서 써보겠습니다

 

omvs의 기본적인 사용법은 알고 오셨다는 가정하에서...

 

1. omvs는 반드시 관리자 권한의 cmd하에서 실행한다

 - 기본중의 기본

 

2. 네트워크 어댑터가 여러개 일때는 반드시 물리적 어댑터를 빼놓고 전부 '사용 안함'으로 변경한다

 - 분명 omvs -i 옵션으로 잘 지정했는데도 안되서 보니 논리 어댑터(루프백이나 기타 가상화 어댑터)가 간섭을 일으켜서 오작동

 - 전부 끄고 omvs -i 0 으로 편안하게 진행하시면 됩니다

 

3. 윈도우 기본 방화벽 및 백신 방화벽은 반드시 끈다

 - 방화벽 켜놓으면 trying to save rdp://.... 만 나오면서 저장은 안됨

 

딱 요 세가지만 지켜주심 되지 싶습니다

다른건 다 자주 언급되는 내용이고 2번은 생각도 못하고 있었는데 이게 제일 큰 복병이었습니다

 

아래 내용도 종종 언급되는데 저한테는 적용 안된 내용들입니다.

 

1. iptime은 omvs가 잘 안된다 : X

 - 처음에 주소가 전혀 안 따지니 공유기탓을 하면서 asus 모델로 변경했으나 동일증상 발생

 

2. 공유기 맥 주소를 uplus에서 제공한 공유기 맥으로 교체해야 한다 : X

 - 역시 변경하나 안하나 동일

 

3. 중간에 스위칭 허브를 쓴다면 igmp지원 모델로 교체해야 한다 : O

 - 이거 지원 안하면 네트워크 마비되고 난리나죠

 

4. pc를 공유기에 직접 꽂아야 한다 : X

 - 보시다시피 주렁주렁 문어발 구성에서도 잘 작동합니다



'분류없음' 카테고리의 다른 글

How to send TRON in tronbox console with solidity  (0) 2019.02.14
[cpp] std::move는 단지 캐스팅일 뿐이라고?  (0) 2017.02.08
Same string but different length  (0) 2016.10.28
JIT vs Interpreter  (0) 2016.10.25
git pushed merge cancel  (0) 2015.04.13
블로그 이미지

시간을 거스르는자

ytkang86@gmail.com

,


std::move가 단지 캐스팅일 뿐이라니?

일단, move 구현을 보자

template<typename _Tp> inline typename std::remove_reference<_Tp>::type&& move(_Tp&& __t) { return static_cast<typename std::remove_reference<_Tp>::type&&>(__t); }

move가 무엇을 하는지 자세히 보니,

static_cast<typename std::remove_reference<_Tp>::type&&>(__t);

진짜 캐스팅뿐이다. 그렇다. source object가 없어지거나 그런거 아니다.

뭐 값을 대입시킬 객체에는 rvalue reference를 넘겨서 메모리주소를 그대로 전달한다고 치고,


이시점에서 궁금한건 오로지하나,

"뭐지? 그럼 기존 객체는 어떻게 없어지는거야?"

알고보니, 그 답은 rvalue reference 생성자와 대입연산자에 있었다.

rvalue reference 생성자와 대입연산자에서는 source object의 메모리 주소를 dest object에 주고

source object는 nullptr처리하거나 하는것이다.

대표적인 예가 std::string 이다.

assign(basic_string&& __str) { this->swap(__str); return *this; }

보면, source와 dest를 swap하고 있다. 따라서 string을 move시켜보면 move당한 놈은 "" 빈스트링을 갖게된다.

그럼 한번 테스트해볼까? 내가 만든 클레스를 move시킨면 어떻게되는지?

repl.it: https://repl.it/FbVT/0

code:

#include <iostream>
#include <stdlib.h>

class TestMe {

public:
TestMe(){ i = nullptr; }
void set(int& k){ i = &k; }
int get(){ return *i; }
void plus(){ (*i)++; }

private:
int* i;
};

int main()
{
        int test1 = 1;
        TestMe t1;
        t1.set(test1);

TestMe t2(std::move(t1));

t2.plus();
std::cout << "t1: " << t1.get() << std::endl;
std::cout << "t2: " << t2.get() << std::endl;

t1.plus();
std::cout << "t1: " << t1.get() << std::endl;
std::cout << "t2: " << t2.get() << std::endl;   

   return 0;

result:

 t1: 2
 t2: 2
 t1: 3
 t2: 3

아마도 이 결과로부터 유추할수있는건, 

std string처럼 swap같은건 없고 메모리는 일단 복사가되었는데 source object에 대한 후처리는 없다는 것이다. 

따라서 default move constructor가 어떻게 작동하는지 이해하고, 맘에 안든다면 직접 구현해야한다.



References

1) std::string source

2) std::remove_reference

3) What are rvalues, lvalues, xvalues, glvalues, and prvalues?


블로그 이미지

시간을 거스르는자

ytkang86@gmail.com

,

when you are comparing string from DB and Excel or CSV or .. file,

then, Just try to change file encode type to UTF-8.

or

try to match encoding type between two strings.

블로그 이미지

시간을 거스르는자

ytkang86@gmail.com

,

JIT vs Interpreter

분류없음 2016. 10. 25. 19:33

http://www.differencebetween.net/technology/difference-between-jit-and-interpreter/

JIT방식은 그 코드 block이 사용(호출)될때 machine code로 변환해서 사용하고 이미 한번 machine code로 변환한것은 캐싱해두었다가 변환하는 과정없이 실행한다.

Script언어의 Interpreter방식은 미리 컴파일된 함수들을 가지고 있고, code를 line by line으로 해석해서 이 함수들에게 던져준다. 

'분류없음' 카테고리의 다른 글

[cpp] std::move는 단지 캐스팅일 뿐이라고?  (0) 2017.02.08
Same string but different length  (0) 2016.10.28
git pushed merge cancel  (0) 2015.04.13
[encoding] javascript write to csv  (0) 2015.04.11
APNS python failure and feedback  (0) 2015.04.06
블로그 이미지

시간을 거스르는자

ytkang86@gmail.com

,

git reset --hard HEAD^

git push -f origin develop

'분류없음' 카테고리의 다른 글

[cpp] std::move는 단지 캐스팅일 뿐이라고?  (0) 2017.02.08
Same string but different length  (0) 2016.10.28
JIT vs Interpreter  (0) 2016.10.25
[encoding] javascript write to csv  (0) 2015.04.11
APNS python failure and feedback  (0) 2015.04.06
블로그 이미지

시간을 거스르는자

ytkang86@gmail.com

,

see: https://stackoverflow.com/questions/21177078/javascript-download-csv-as-file/23786965#23786965

key point is \uFEFF


version 1.

var encodedUri = 'data:text/csv;charset=UTF-8,\uFEFF'+encodeURI(comma_data);

var link = document.createElement("a");

link.setAttribute("href", encodedUri);

var name = 'gem_use.csv';

if (key == 'container_get') {

    name = 'gem_get.csv';

}

link.setAttribute("download", name);

link.click();


version 2. (<table></table> to excel file)

usage: tablesToOneExcelSheet(tables, sheets, today+filename, 'Excel');(tables => table element id list, sheet => name list of each table)

* Should use Blob to enable large file size.

var tablesToOneExcelSheet = (function() {
var uri = 'data:application/vnd.ms-excel;base64,'
, tmplWorkbookXML = '<'+'?xml version="1.0"?><'+'?mso-application progid="Excel.Sheet"?><Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">'
+ '<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office"><Author>NM</Author><Created>{created}</Created></DocumentProperties>'
+ '<Styles>'
+ '<Style ss:ID="Currency"><NumberFormat ss:Format="Currency"></NumberFormat></Style>'
+ '<Style ss:ID="Date"><NumberFormat ss:Format="Medium Date"></NumberFormat></Style>'
+ '</Styles>'
+ '{worksheets}</Workbook>'
, tmplWorksheetXML = '<Worksheet ss:Name="{nameWS}"><Table>{rows}</Table></Worksheet>'
, tmplCellXML = '<Cell{attributeStyleID}{attributeFormula}><Data ss:Type="{nameType}">{data}</Data></Cell>'
, base64 = function(s) { return window.btoa(unescape(encodeURIComponent(s))) }
, format = function(s, c) { return s.replace(/{(\w+)}/g, function(m, p) { return c[p]; }) }
return function(tables, wsnames, wbname, appname) {
var ctx = "";
var workbookXML = "";
var worksheetsXML = "";
var rowsXML = "";

for (var i = 0; i < tables.length; i++) {
if (!tables[i].nodeType) tables[i] = document.getElementById(tables[i]);
for (var j = 0; j < tables[i].rows.length; j++) {
if(i>0 && j==0) {
continue;
}
rowsXML += '<Row>';
for (var k = 0; k < tables[i].rows[j].cells.length; k++) {
var dataType = tables[i].rows[j].cells[k].getAttribute("data-type");
var dataStyle = tables[i].rows[j].cells[k].getAttribute("data-style");
var dataValue = tables[i].rows[j].cells[k].getAttribute("data-value");
dataValue = (dataValue)?dataValue:tables[i].rows[j].cells[k].innerHTML;
var dataFormula = tables[i].rows[j].cells[k].getAttribute("data-formula");
dataFormula = (dataFormula)?dataFormula:(appname=='Calc' && dataType=='DateTime')?dataValue:null;
ctx = { attributeStyleID: (dataStyle=='Currency' || dataStyle=='Date')?' ss:StyleID="'+dataStyle+'"':''
, nameType: (dataType=='Number' || dataType=='DateTime' || dataType=='Boolean' || dataType=='Error')?dataType:'String'
, data: (dataFormula)?'':dataValue
, attributeFormula: (dataFormula)?' ss:Formula="'+dataFormula+'"':''
};
rowsXML += format(tmplCellXML, ctx);
}
rowsXML += '</Row>';
}
}

ctx = {rows: rowsXML, nameWS: "Data"};
worksheetsXML += format(tmplWorksheetXML, ctx);

ctx = {created: (new Date()).getTime(), worksheets: worksheetsXML};
workbookXML = format(tmplWorkbookXML, ctx);
window.URL= window.URL || window.webkitURL;
var blob = new Blob([workbookXML], {type: 'application/vnd.ms-excel;base64'});
var blobUrl = window.URL.createObjectURL(blob);

var link = document.createElement("A");
// link.href = uri + base64(workbookXML);
link.href = blobUrl;
link.download = wbname || 'Workbook.xls';
link.target = '_blank';
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
})();


'분류없음' 카테고리의 다른 글

[cpp] std::move는 단지 캐스팅일 뿐이라고?  (0) 2017.02.08
Same string but different length  (0) 2016.10.28
JIT vs Interpreter  (0) 2016.10.25
git pushed merge cancel  (0) 2015.04.13
APNS python failure and feedback  (0) 2015.04.06
블로그 이미지

시간을 거스르는자

ytkang86@gmail.com

,

https://github.com/djacobs/PyAPNs

Problem 1. Push notification Failed right after sending invalid token

APNS uses socket to send notification object. and if it use invalid token, that connection will be disconnected. you can overcome this by re-generating APNs Object.

But there is one more problem. If you use for loop with same APNs Object, and there is an invalid token, the tokens right after sending invalid token will be failed. 

So, there is an option named enhanced=True, it will check each tokens if it succeeded. and It uses non-blocking ssl socket, and check error using another thread. So I think there is no critical waiting. In the function "_resend_notification_by_range" It sends only notifications after invalid token.

They also provide "send_notification_multiple" function. This function doesn't check error and discard all tokens after invalid token.


Issue 1. FeedbackConnection

https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/CommunicatingWIthAPS.html#//apple_ref/doc/uid/TP40008194-CH101-SW3

- connection method and how many tokens you can receive?

they use socket. and It reads data using streaming until there is no data. see below


Once you are connected, transmission begins immediately; you do not need to send any command to APNs. Read the stream from the feedback service until there is no more data to read.

... 

The feedback service’s list is cleared after you read it. Each time you connect to the feedback service, the information it returns lists only the failures that have happened since you last connected.


'분류없음' 카테고리의 다른 글

[cpp] std::move는 단지 캐스팅일 뿐이라고?  (0) 2017.02.08
Same string but different length  (0) 2016.10.28
JIT vs Interpreter  (0) 2016.10.25
git pushed merge cancel  (0) 2015.04.13
[encoding] javascript write to csv  (0) 2015.04.11
블로그 이미지

시간을 거스르는자

ytkang86@gmail.com

,