본문 바로가기

전체 글

[펌] Git - SVN Crash Course Git - SVN Crash Course Welcome to the Git version control system! Here we will briefly introduce you to Git usage based on your current Subversion knowledge. You will need the latest Git installed; There is also a potentially useful tutorial in the Git documentation. This page is not maintained anymore! The up-to-date version of this tutorial is the GitSvnCrashCourse page at the Git wiki. The co.. 더보기
항목 26: 변수 정의는 늦출 수 있는 데까지 늦추는 근성을 발휘하자 변수(사용자 정의 타입) 정의시 지불하게 되는 비용 변수의 정의부에서 생성자 호출 비용 변수가 유효범위 벗어날 때 소멸자 호출 비용 정의된 변수의 미사용시 비용 //-------------------------- // 정의된 변수가 미사용되는 경우 (예외 발생시) // 1. 객체의 생성 비용 // 2. 객체의 소멸 비용 //-------------------------- std::string encryptPassword( const std::string& password ) { using namespace std; string encrypted; if (password.length() < MinimumPasswordLength) { throw logic_error("Password is too short.. 더보기
[ Refactoring ] Split Temporary Variable 루프 안에 있는 변수나 collecting temporary variable도 아닌 임시 변수에 값을 여러 번 대입하는 경우에는, 각각의 대입에 대해서 따로따로 임시변수를 만들어라. double temp = 2 * (_height + _width); System.out.println (temp); temp = _height * _width; System.out.println (temp); final double perimeter = 2 * (_height + _width); System.out.println (perimeter); final double area = _height * _width; System.out.println (area); * collecting temporary variable =.. 더보기
[VirtualBox] /usr/lib/virtualbox/VirtualBox tingcobell@tingcobell:~> VirtualBox /usr/bin/VirtualBox: line 72: /usr/lib/virtualbox/VirtualBox: 허가 거부 /usr/bin/VirtualBox: line 72: exec: /usr/lib/virtualbox/VirtualBox: cannot execute: 성공 tingcobell@tingcobell:~> cd /usr/lib/virtualbox/ tingcobell@tingcobell:/usr/lib/virtualbox> sudo chmod 755 VirtualBox 열쇠글: tingcobell@tingcobell:/usr/lib/virtualbox> VirtualBox VirtualBox: Error -10 in SUPR3.. 더보기
[ Refactoring ] Introduce Explaing Variable 복잡한 수식이 있는 경우에는, 수식의 결과나 또는 수식의 일부에 자신의 목적을 잘 설명하는 이름으로 된 임시변수를 사용하라. if ( (platform.toUpperCase().indexOf("MAC") > -1) && (browser.toUpperCase().indexOf("IE") > -1) && wasInitialized() && resize > 0 ) { // do something } final boolean isMacOs = platform.toUpperCase().indexOf("MAC") > -1; final boolean isIEBrowser = browser.toUpperCase().indexOf("IE") > -1; final boolean wasResized = resize > 0;.. 더보기
[ Refactoring ] Replace Temp with Query Method 어떤 수식의 결과값을 저장하기 위해서 임시변수를 사용하고 있다면, 수식을 뽑아내서 메소드로 만들고, 임시변수를 참조하는 곳을 찾아 모두 메소드 호출로 바꾼다. 새로 만든 메소드는 다른 메소드에서도 사용될 수 있다. double basePrice = _quantity * _itemPrice; if (basePrice > 1000) return basePrice * 0.95; else return basePrice * 0.98; if (basePrice() > 1000) return basePrice() * 0.95; else return basePrice() * 0.98; ... double basePrice() { return _quantity * _itemPrice; } 동기 임시변수는 그것이 사용되는.. 더보기
[ openfire ] 친구초대 버그 수정. openfire 서버에서 자기 자신을 초대하는 버그(?)가 있어 수정을 해야 합니다. 문제) 메신져 클라이언트에서 자기 자신을 초대(?) 웅? 왜? 그래서 다음과 같이 수정하였습니다. IQRosterHandler.java for (org.xmpp.packet.Roster.Item item : packet.getItems()) { if (item.getSubscription() == org.xmpp.packet.Roster.Subscription.remove) { removeItem(cachedRoster, packet.getFrom(), item); } else { /** * 자기 자신을 초대 못하게 정의함. */ if (sender.getNode().equals(item.getJID().getNode(.. 더보기
[ 케릭터 렉사 ] 게임중에 렉으로 인해서...... 저의 케릭은 렉사..ㅡㅜ 더보기