2007/11/30

[C++] Finding Square Root without using sqrt()

不用 sqrt 函式自己寫開根號的 code

http://www.dreamincode.net/code/snippet244.htm

[cpp]
/* Code written by Sanchit Karve
A.K.A born2c0de
Contact Me at born2c0de AT hotmail.com

20 August, 2005

*/




#include
#include

using namespace std;


float sqroot(float m)
{
float i=0;
float x1,x2;
while( (i*i) <= m )
i+=0.1;
x1=i;
for(int j=0;j<10;j++)
{
x2=m;
x2/=x1;
x2+=x1;
x2/=2;
x1=x2;
}
return x2;
}

int main()
{
cout << "Enter a Number:";
int no;
cin >> no;
cout << "Square Root using sqroot()= " << sqroot(no) < << "Square Root using sqrt() = " << sqrt(no);

return 0;
}

[/cpp]

2007/11/23

Visual Studio 2005 更換 Project 位置後問題

移動 VS 2005 Project 檔案位置後

無法正常執行可能原因是因為檔案位置改變

導致中斷點失敗

說明在這裡 http://msdn2.microsoft.com/zh-tw/library/h6aesyw2(VS.80).aspx

可能解決方法有三種

1.
工具 -> 選項 -> 偵錯 -> 一般 -> 取消[原始程式檔必須完全符合原始版本]

2.
偵錯 -> 刪除所有中斷點

3.
在中斷點上按右鍵選位置

或是

打開中斷點視窗(偵錯 -> 視窗 -> 中斷點),同樣在中斷點按右鍵選位置

一個一個修改[檔案]位置



選取[允許原始程式碼與原始版本不同]

2007/11/22

2007/11/11

上班族新修練3:迎戰外在環境劇變之敏銳力(Power of Agility)

http://news.yam.com/view/mkmnews.php/384975

上班族新修練2:創造十倍的溝通熱力之上台說話技巧

http://news.yam.com/view/mkmnews.php/384974

上班族新修練:先處理心情,再處理事情(顧客抱怨管理)

http://blog.career.com.tw/managing/communication_content.aspx?na_id=274&na_toolid=405

11件事人生中必做的事,張忠謀線上告訴你

http://news.yam.com/view/mkmnews.php/544445

開拓社交圈的行動方案

http://news.yam.com/view/mkmnews.php/460169

新手上路必修5堂課 別當老闆的眼中釘

http://tw.news.yahoo.com/marticle/url/d/a/071003/25/lpeg.html?type=old

夜貓上班族,精力衝衝衝 (想睡怎麼辦?)

http://tw.news.yahoo.com/marticle/url/d/a/071003/25/lped.html?type=old

精準管理,資訊吸收超效率

http://tw.news.yahoo.com/marticle/url/d/a/071003/25/lpec.html?type=old

2007/11/06

Note of controlling SVN(Subversion)

1. Create repository:

Subversion provides two options for the type of underlying data store that each repository uses.
See the comparison in here or http://svnbook.org/


shell> mkdir /home/svn/repos
shell> svnadmin create --fs-type fsfs /home/svn/repos



The Subversion Repository, Defined in here


conf

A directory containing repository configuration files.

dav

A directory provided to mod_dav_svn for its private housekeeping data.

db

The data store for all of your versioned data.

format

A file that contains a single integer that indicates the version number of the repository layout.

hooks

A directory full of hook script templates (and hook scripts themselves, once you've installed some).

locks

A directory for Subversion's repository lock files, used for tracking accessors to the repository.

README.txt

A file whose contents merely inform its readers that they are looking at a Subversion repository.



2. Import data:

See the "Planning Your Repository Organization" to decide how to organize your projects with respect to repositories.
Your first decision is whether to use a single repository for multiple projects, or to give each project its own repository, or some compromise of these two.


shell> svn import /home/svn/tmp/ file:///home/svn/repos/ -m "Initial Import"



3. Show repository:


shell> svn list -v file:///home/svn/repos/
shell> svnlook info --revision 1 /home/svn/repos/
shell> svnlook tree /home/svn/repos/ --show-ids



4. Invoking server

shell> svnserve -d --listen-port 3690 -r /home/svn




Reference:
http://www-128.ibm.com/developerworks/cn/java/j-lo-apache-subversion/index.html
http://svnbook.red-bean.com/en/1.4/index.html

Using GATOS on My "ATI Technologies Inc Rage 128 RF/SG AGP" card

Using GATOS on My "ATI Technologies Inc Rage 128 RF/SG AGP" card

gatos-conf

RAM on Card: 32Mb
Gatos will Probe RAM
864kb for PAL/SECAM
Gatos autodection
NTSC North/South American Cable (CATV)

舊 BIOS 使用 Ubuntu 無法關機 (無法開啟APM, ACPI)

舊 BIOS 使用 Ubuntu 無法關機 (無法開啟APM, ACPI)

開啟 ACPI:
在 grub/menu.lst 的 kernel 加上 acpi=force

開啟 APM:
在 /etc/modules 加上 apm power_off=1

擇一即可。

2007/11/05

Tor (anonymity network)

http://www.torproject.org/
http://en.wikipedia.org/wiki/Tor_%28anonymity_network%29

Tor (The Onion Router) is a free software implementation of second-generation onion routing – a system enabling its users to communicate anonymously on the Internet.

2007/11/04

上班就是這樣?

1.never do job at non-duty time

上班的時候 就是做事
下班的時候 完全不會去想碰上班在做的事

2.quiet listening

你跟我說的這些我都知道 可是我還是會安靜地聽完
因為這樣可以消耗上班的時間

3.non-last status

當你發現你不是最菜的時候 你所受的壓力會大幅減少
而且會覺得相當的輕鬆 尤其是最菜的傢伙快到30歲的時候

4.future mirror

跟資深人員共事過後 你會希望(或害怕)未來像這位員工一樣的好...(或壞)

5.long-used devices

希望公司願意花錢買一套新的鍵盤跟滑鼠發給我用
也希望當試用期結束後把桌上的CRT換成LCD

6.discounting sales

感謝公司讓我喝便宜的可口可樂 我不會奢望有提供免費的
但是可以順便提供一下公仔和日文雜誌的折扣販賣服務嗎?

7. early-waked freak

當我說我晚上11點半睡覺 早上7點半起床的時候
請不要用很驚訝的表情問說我家是不是種田的...

想加薪升遷 四大撇步

http://pro.udnjob.com/mag2/hr/storypage.jsp?f_ART_ID=31430

應徵的最好時機

6 7 8月因為學生的畢業潮 工作會比較難找 價錢會比較普通

到了9 10月後談價錢對應徵方是較好的 因為公司會急著找人補需要有人來做的職位

11月之後公司真的就是用挑的再挑應徵者

隔年的過年前又會有一波離職潮 大家都想要換份好的工作

12月到隔年的2月 又是一個找工作的高峰期 價錢是看應徵方的資歷而定 各談各的

沒有普遍的行情