2018년 4월 10일 화요일

php date를 timestamp로 변경하는 소스, strtotime



php date를 timestamp로 변경하는 소스, strtotime    

$lcTodayDate = fnTodayDate("-");
$lcTodayTimestamp = strtotime($lcTodayDate);
$lcYesterday = fnDateAdd('w', -1, $lcTodayTimestamp);


2018년 4월 9일 월요일

안드로이드 서비스에서 UI에 해당하는 Toast message 출력하기


안드로이드 서비스에서 UI에 해당하는 Toast message 출력하기

서비스 )
public class MsSvcBedalDhBackgroundSvc extends Service {
    ...
}



시스템 쓰레드 )
Runnable mRun = new Runnable() {
public void run() {
try{
while( bThreadGo ){
Log.i(TAG, ">mRun : 이거를 계속 탄다.");

iLoopValue++;

Thread.sleep(iThreadInterval);

if(iLoopValue>100000)iLoopValue=0;

positionSaveProc();

} //end while
}catch(Exception e){
e.printStackTrace();
}
}
};



UI 쓰레드의 호출 )
/*
 * 변경된 위치를 저장해준다.
 */
public synchronized void positionSaveProc(){

Log.i(TAG, ">positionSaveProc : loop call start ");

String sUnitBatchExecYn = getSharePreferenceStringValue("batch_exec_yn");

//로그인을 했기 때문에 가동해준다
if(sUnitBatchExecYn.equals("Y")){

//UI Thread
Message msg = new Message();
msg.what = 0;
msg.obj = null;
handler.sendMessage(msg); 
}
}


2018년 3월 22일 목요일

자바스크립트 몇일 더한 날짜 가져오기 setDate new Date함수 이용

자바스크립트 몇일 더한 날짜 가져오기 setDate new Date함수 이용

함수 )

/*
   몇일 더한 날짜 가져오기
   @parmPM : 0(오늘), 1(내일)
   @return : 20180101
*/
function getPMDate( parmPM ){
var today = new Date();
//today.setDate(today.getDate() + 25); //25일 더하여 값을 보내줘요
today.setDate(today.getDate() + parmPM); //parmPM일 더하여 setting
var year = Number(today.getFullYear());
var month = Number(today.getMonth() + 1);
var day = Number(today.getDate());

var vl = String(year);
vl = vl + indexFnDigitTwoApply(month);
vl = vl + indexFnDigitTwoApply(day);

return vl;
}

즐거운 시간 보내세요~


자바스크립트에서의 형변환 Number, String


자바스크립트에서의 형변환 Number, String 

문자열을 숫자형으로 변환 : Number()
parseInt() 도 숫자형으로 변환해줘요

숫자를 문자열로 변환 : String() 

have a nice day~


2018년 1월 31일 수요일

자바스크립트에서 오브젝트의 위치와 사이즈 구하기 (input object etc)


자바스크립트에서 오브젝트의 위치와 사이즈 구하기 (input object etc)

object
input
textarea etc

소스 )
//object의 위치와 사이즈 구하기
function getThisAbsPosition(object){
var position = new Object;
position.x = 0;
position.y = 0;

if( object ) {
position.x = object.offsetLeft;
position.y = object.offsetTop;

if( object.offsetParent ) {
var parentpos = getThisAbsPosition(object.offsetParent);
position.x += parentpos.x;
position.y += parentpos.y;
}
}

position.cx = object.offsetWidth;
position.cy = object.offsetHeight;

return position;
}

이용 )
//new version 위치
var object = document.all.jm_keyword;
var position = getThisAbsPosition(object);
//alert("width : " + position.cx);
//alert("height : " + position.cy);
document.all.ID_POP_JIDO_MENU_WRAP.style.left = (position.x-290)+"px";
document.all.ID_POP_JIDO_MENU_WRAP.style.top = (position.y+10)+"px";


2018년 1월 5일 금요일

c# RichTextBox password *****


c# RichTextBox password *****

class )
using System;
using System.Windows.Forms;

class RichPassword : RichTextBox
{
    protected override CreateParams CreateParams
    {
        get
        {
            // Turn on ES_PASSWORD
            var cp = base.CreateParams;
            cp.Style |= 0x20;
            return cp;
        }
    }
}

-------------------------------------------------------------------

//this.rtPw = new System.Windows.Forms.RichTextBox();
this.rtPw = new RichPassword();

...

this.rtPw.Location = new Point(650, 178);
this.rtPw.Width = 180;
this.rtPw.Height = 31; 



2018년 1월 4일 목요일

시샵에서 폼(다이알로그) Form을 중앙에 위치시키고 싶을 경우 CenterScreen


시샵에서 폼(다이알로그) Form을 중앙에 위치시키고 싶을 경우 CenterScreen

ex )

private void FormLogin_Load(object sender, EventArgs e)
{
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
}