2013년 11월 7일 목요일

Cocos touch 웹 브라우저 열기


URL 문자열을 생성
NSString* url = [NSString stringWithFormat:@"https://itunes.apple.com/us/app/unsemalu/id730788250?ls=1&mt=8"];

NSURL 객체 생성
NSURL* fortune = [NSURL URLWithString:url];

브라우저 열기
[[UIApplication sharedApplication]openURL:fortune];

자주 삭제되는 Row의 Identity값 재사용방법

DECLARE @minidentval TYPE
DECLARE @nextidentval TYPE
DECLARE @count INT
SELECT  @count = COUNT(*) FROM [Table_name]
 
SELECT  @minidentval = MIN($IDENTITY) FROM [Table_name]
IF @minidentval = IDENT_SEED('[Table_name]')
     SELECT @nextidentval = MIN($IDENTITY) + IDENT_INCR('[Table_name]')
FROM [Table_name] t1
     WHERE $IDENTITY
BETWEEN IDENT_SEED('[Table_name]')
AND @count AND NOT EXISTS (SELECT * FROM [Table_name] t2
WHERE t2.$IDENTITY = t1.$IDENTITY + IDENT_INCR('[Table_name]'));
ELSE SELECT @nextidentval = IDENT_SEED('[Table_name]')

Javascript로 브라우저 확인방법



자바스크립트로 브라우저 확인하는 방법입니다.

<html>
 <head>
  <title>mobile</title>
   <script type="text/javascript">
   function detectmob() { 
     if( navigator.userAgent.match(/Android/i)|| navigator.userAgent.match(/webOS/i)
    || navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i)
    || navigator.userAgent.match(/iPod/i)   || navigator.userAgent.match(/BlackBerry/i)
    || navigator.userAgent.match(/Windows Phone/i)
      )
   {
        return true;
      }
    else 
   {
     return false;
     }
   }
   if(detectmob())alert('this is mobile web browse');
   else alert('this is pc web browse');
   /* 또는
   var isMobile = {
    Android: function() {
        return navigator.userAgent.match(/Android/i);
    },
    BlackBerry: function() {
        return navigator.userAgent.match(/BlackBerry/i);
    },
    iOS: function() {
        return navigator.userAgent.match(/iPhone|iPad|iPod/i);
    },
    Opera: function() {
        return navigator.userAgent.match(/Opera Mini/i);
    },
    Windows: function() {
        return navigator.userAgent.match(/IEMobile/i);
    },
    any: function() {
        return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
    }
   };
   */
</script>
</head>
<body>

</body>
</html>