페이지

2012년 9월 25일 화요일

Objective-C setter method


@property(nonatomic,retain) NSObject * exVal;

@synthesize exVal;

- (void)setExVal:(NSObject*) val {
   [exVal release]; 
   exVal = [val retain];
}




this is wrong. coz if val is equal to exVal, both exVal and val are released. and then nil retain.






- (void)setExVal:(NSObject*) val {
    [val retain];
    [exVal release];
    exVal = val;
}

this is right.


2012년 9월 11일 화요일

Big Endian, Little Endian

Big Endian, Little Endian

I sometimes got confused about these.
What is big or little?
and
What is Endian?

I will try to figure these out at this time.

------------------------
big, little : the value of byte
endian : the end of memory that occupied by the value in row.


so, Big endian means that Big value of byte is located in the end of memory.



http://en.wikipedia.org/wiki/Endianness

2012년 9월 9일 일요일

php - go to other page



<!-- go to other page by button -->
<input type="button" value="go list" onClick="location.href='simple_list.php'">

<!-- go to other page by hypertext -->
<td colspan="4" align="center"><a href="simple_insert.html"> insert </a> </td>

php - script alert, history.back


<?
if(!$id){
echo " <script> alert(' please, input id'); history.back();</script>";
exit;
}
?>

php - form



<form name="frm" method="post" action="simple_delete.php'">
<input type="submit" value="delete">
</form>


<form name="frm" method="post" action="simple_delete.php?no=<?=$_GET[no]?>'">
<input type="submit" value="delete">
</form>

<form name="frm" method="post" action="simple_pwd_chk.php?no=<?=$_GET[no]?>'">
<input type="text" name="inputPwd">
<input type="submit" value="check password">
</form>

php - DB


<?
$sql = mysql_connect("localhost","user","password") or die("sql not connected". mysql_error());
mysql_select_db("db_name");
$qry = "select * from table_name";
$result = mysql_query($qry);
{
while($rows=mysql_fetch_array($result)){
echo $rows[id];
echo $rows[name];
echo $rows[phone];
}
}
{
$db_pwd = mysql_result($result,0,0); //mysql_fetch_array 보다 빠르다}
}


mysql_free_result($result);
mysql_close($sql);
?>

iOS Layer Geometry


bounds,frame,achor point, position






masksToBounds



Layer autoresizing mask constants




CALayer geometry properties