NSIS tip: To use(define) absolute path of working directory on compile time.

In brief, use !execute and !define command

And include following lines in your nsis script.

!execute 'cmd /c echo !define CWD "%CD%" > cwd.nsi'
!include cwd.nsi

That's it.

In general, you can use import/define any environment variable. For example, 

!execute 'cmd /c echo !define CWD "%CD%" > cwd.nsi'
!execute 'cmd /c echo !define PATH "%PATH%" >> cwd.nsi'
!execute 'cmd /c echo !define ComSpec "%ComSpec%" >> cwd.nsi'

Note) Be careful to use >> (appending redirection operator) from second line. Single redirection operator in first line makes cwd.nsi truncated.

Enjoy!



strftime results by various locales in Windows

/-
 * localetest.cpp
 *
 *  Created on: 2011. 5. 21.
 *      Author: stania
 *-
#include <iostream>
#include <ctime>
using namespace std;
int main(int argc, char* argv[])
{
       const char* localeStrings[] = { "", "aus", "australia", "aut", "austria", "bel", "belgium",
              "bra", "brazil", "can", "canada", "china", "chn", "pr china", "pr-china",
              "cze", "czech", "dnk", "denmark", "fin", "finland", "fra", "france", "deu",
              "germany", "grc", "greece", "hkg", "hong kong", "hong-kong", "hun",
              "hungary", "iceland", "isl", "irl", "ireland", "ita", "italy", "jpn",
              "japan", "kor", "korea", "mex", "mexico", "nld", "holland", "netherlands",
              "nzl", "new zealand", "new-zealand", "nz", "nor", "norway", "pol", "poland",
              "prt", "portugal", "rus", "russia", "sgp", "singapore", "svk", "slovak", "esp",
              "spain", "swe", "sweden", "che", "switzerland", "twn", "taiwan", "tur", "turkey",
              "gbr", "britain", "england", "great britain", "uk", "united kingdom",
              "united-kingdom", "usa", "america", "united states", "united-states", "us"};
       time_t ltime;
       struct tm *thetime;
       time (&ltime);
       thetime = localtime (&ltime);
       for (size_t i = 0; i < sizeof(localeStrings) / sizeof(char**); ++i)
       {
              setlocale(LC_TIME, localeStrings[i]);
              char buf[1024];
              strftime(buf, 1024, "%x %X", thetime);
              cout << buf << "\t: " << localeStrings[i] << endl;
       }
}
2011-05-21 오전 11:43:34   :
2011-05-21 오전 11:43:34   : aus
2011-05-21 오전 11:43:34   : australia
2011-05-21 오전 11:43:34   : aut
2011-05-21 오전 11:43:34   : austria
21.05.2011 11:43:34  : bel
21.05.2011 11:43:34  : belgium
21.05.2011 11:43:34  : bra
21.05.2011 11:43:34  : brazil
21.05.2011 11:43:34  : can
21.05.2011 11:43:34  : canada
21.05.2011 11:43:34  : china
21.05.2011 11:43:34  : chn
21.05.2011 11:43:34  : pr china
21.05.2011 11:43:34  : pr-china
21.05.2011 11:43:34  : cze
21.5.2011 11:43:34   : czech
21.5.2011 11:43:34   : dnk
21.5.2011 11:43:34   : denmark
21.5.2011 11:43:34   : fin
21.5.2011 11:43:34   : finland
21/05/2011 11:43:34  : fra
21/05/2011 11:43:34  : france
21.05.2011 11:43:34  : deu
21.05.2011 11:43:34  : germany
21.05.2011 11:43:34  : grc
21.05.2011 11:43:34  : greece
21.05.2011 11:43:34  : hkg
21.05.2011 11:43:34  : hong kong
21.05.2011 11:43:34  : hong-kong
2011.05.21. 11:43:34 : hun
2011.05.21. 11:43:34 : hungary
2011.05.21. 11:43:34 : iceland
21.5.2011 11:43:34   : isl
21.5.2011 11:43:34   : irl
21.5.2011 11:43:34   : ireland
21/05/2011 11:43:34  : ita
21/05/2011 11:43:34  : italy
2011/05/21 11:43:34  : jpn
2011/05/21 11:43:34  : japan
2011-05-21 오전 11:43:34   : kor
2011-05-21 오전 11:43:34   : korea
2011-05-21 오전 11:43:34   : mex
2011-05-21 오전 11:43:34   : mexico
21-5-2011 11:43:34   : nld
21-5-2011 11:43:34   : holland
21-5-2011 11:43:34   : netherlands
21-5-2011 11:43:34   : nzl
21-5-2011 11:43:34   : new zealand
21-5-2011 11:43:34   : new-zealand
21-5-2011 11:43:34   : nz
21.05.2011 11:43:34  : nor
21.05.2011 11:43:34  : norway
21.05.2011 11:43:34  : pol
21.05.2011 11:43:34  : poland
21.05.2011 11:43:34  : prt
21.05.2011 11:43:34  : portugal
21.05.2011 11:43:34  : rus
21.05.2011 11:43:34  : russia
21.05.2011 11:43:34  : sgp
21.05.2011 11:43:34  : singapore
21.05.2011 11:43:34  : svk
21. 5. 2011 11:43:34 : slovak
21/05/2011 11:43:34  : esp
21/05/2011 11:43:34  : spain
21/05/2011 11:43:34  : swe
21/05/2011 11:43:34  : sweden
21/05/2011 11:43:34  : che
21/05/2011 11:43:34  : switzerland
21/05/2011 11:43:34  : twn
21/05/2011 11:43:34  : taiwan
21/05/2011 11:43:34  : tur
21/05/2011 11:43:34  : turkey
21/05/2011 11:43:34  : gbr
21/05/2011 11:43:34  : britain
21/05/2011 11:43:34  : england
21/05/2011 11:43:34  : great britain
21/05/2011 11:43:34  : uk
21/05/2011 11:43:34  : united kingdom
21/05/2011 11:43:34  : united-kingdom
5/21/2011 11:43:34 AM      : usa
5/21/2011 11:43:34 AM      : america
5/21/2011 11:43:34 AM      : united states
5/21/2011 11:43:34 AM      : united-states
5/21/2011 11:43:34 AM      : us

내가 사용하는 Eclipse 플러그인

// 내장된 incremental search 가 구려서 쓴다.
http://code.google.com/p/eclipse-search-tab/


// Extended VS presentation
// 이클립스 기본 테마는 UI에 좀 군살이 많은 편인데, 노트북 화면등에서 화면이 모자랄 때 쓴다.
// 속도가 VS 와 비슷해진다는 시각적 효과를 얻게된다.




// ExploreFS
// Package Explorer 에서 자바 파일이 담긴 디렉토리를 바로 열고 싶을 때 쓴다.
// 쓸 일이 그렇게 흔한 건 아니지만 자바의 패키지 특성상 탐색기에서 디렉토리 여러개 내려가기는 정말 괴로운 일이다.


Using devcon

If your laptop's backlight control is missing after restoration from suspend/hibernation, try to restart your graphic chipset or monitor in device manager (devmgmt.msc).

But if you feel annoying from opening device manager and operations with mouse, you can use devcon( http://support.microsoft.com/kb/311272 ).

Download devcon from ms website and install. Then, open "Command-line prompt" with administrator rights(FYI, ctrl+shift click on start menu icon).

First, you have to find your device Hardware ID. This information can be found in "Detail" tab in properties windows in Device Manager. For example, my graphic chipset's Hardware ID could be found in following screenshot.

Then, in your command-line prompt window, run "devcon restart *2A42*". 2A42 is substring of Hardware ID. preceding, succeeding asterisk(*) will automatically match your full Hardware ID. 


(There may be more matching devices in your system. Then, you can find another unique substring from your Hardware ID of target device to prevent innocent device from unexpected restarting)

If you can create and use batch program, feel free to use it. Because devcon will acquire admin rights, you can start the batch program without admin rights also. 





Setting TZ environment variable digest

If you're in a *nix system that timezone doesn't properly configured, you can use TZ environment variable instead of other timezone configuration tools. 

For example, if you're in KST, just set TZ as 'KST-09' which means "add -09 hrs to localtime to get Coordinated Universal Time, and timezone string is KST"

http://www.gnu.org/s/libc/manual/html_node/TZ-Variable.html

FYI, to set environment variable, refer to your shell manual.
(ex: if bash, run your command after running "export TZ=KST-09" or
run YOUR_COMMAND using "TZ=KST-09 YOUR_COMMAND")



1 2 3 4 5 6 7 8 9 10 다음


기타 링크

기타 링크의 링크들은
위의 Link 란으로
이전했습니다 >_<