2014년 3월 14일 금요일

C#에서 Double, Float 변수값이 NaN인지 비교

NaN은 Not a Number의 줄임말.

Double, Float의 기본 값으로 NaN을 사용할 때 == 비교 연산자를 사용하면
false를 리턴하므로 주의가 요망됨

따라서 아래의 방법으로 비교를 해야 함

double d;
float f;

if(double.IsNaN(d) == true)
  ...

if(float.IsNaN(f) == true)
 ...

혹은

if(d.Equals(double.NaN) == true)
...

if(f.Equals(float.NaN) == true)
...

2014년 3월 9일 일요일

Raspberry Pi 팁..

네트워크 설정

출처: http://www.neil-black.co.uk/raspberry-pi-beginners-guide#.Uxxb-Pl_uzg

sudo nano /etc/network/interfaces
This will bring up the network interface configuration file in the nano text editor. The word sudo simply runs this command with super user privileges.
You can save yourself a lot of time at the Linux command prompt by using Tab to auto complete.
You should see:
iface lo inet loopback
iface eth0 inet dhcp
Change this to (your IP details maybe different depending what you got from ipconfig):
iface lo inet loopback
iface eth0 inet static
address 192.168.1.150
netmask 255.255.255.0
gateway 192.168.1.1
Use Ctrl X to exit. Hit Y when prompted to save.
Now restart the network interface to apply changes without a reboot:
sudo /etc/init.d/networking stop
Followed by (can you guess?):
sudo /etc/init.d/networking start
Now your Raspberry Pi will always have the same IP address. Try pinging it from the Windows command Prompt:
ping 192.168.1.150


2014년 3월 8일 토요일

MS-SQL에서 SELECT 결과에서 UPDATE 수행하기

출처: http://stackoverflow.com/questions/2334712/update-from-select-using-sql-server

UPDATE
    Table
SET
    Table.col1 = other_table.col1,
    Table.col2 = other_table.col2
FROM
    Table
INNER JOIN
    other_table
ON
    Table.id = other_table.id