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값 재사용방법

  1. DECLARE @minidentval TYPE
  2. DECLARE @nextidentval TYPE
  3. DECLARE @count INT
  4. SELECT @count = COUNT(*) FROM [Table_name]
  5. SELECT @minidentval = MIN($IDENTITY) FROM [Table_name]
  6. IF @minidentval = IDENT_SEED('[Table_name]')
  7. SELECT @nextidentval = MIN($IDENTITY) + IDENT_INCR('[Table_name]')
  8. FROM [Table_name] t1
  9. WHERE $IDENTITY
  10. BETWEEN IDENT_SEED('[Table_name]')
  11. AND @count AND NOT EXISTS (SELECT * FROM [Table_name] t2
  12. WHERE t2.$IDENTITY = t1.$IDENTITY + IDENT_INCR('[Table_name]'));
  13. ELSE SELECT @nextidentval = IDENT_SEED('[Table_name]')

Javascript로 브라우저 확인방법



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

  1. <html>
  2. <head>
  3. <title>mobile</title>
  4. <script type="text/javascript">
  5. function detectmob() {
  6. if( navigator.userAgent.match(/Android/i)|| navigator.userAgent.match(/webOS/i)
  7. || navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i)
  8. || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/BlackBerry/i)
  9. || navigator.userAgent.match(/Windows Phone/i)
  10. )
  11. {
  12. return true;
  13. }
  14. else
  15. {
  16. return false;
  17. }
  18. }
  19. if(detectmob())alert('this is mobile web browse');
  20. else alert('this is pc web browse');
  21. /* 또는
  22. var isMobile = {
  23. Android: function() {
  24. return navigator.userAgent.match(/Android/i);
  25. },
  26. BlackBerry: function() {
  27. return navigator.userAgent.match(/BlackBerry/i);
  28. },
  29. iOS: function() {
  30. return navigator.userAgent.match(/iPhone|iPad|iPod/i);
  31. },
  32. Opera: function() {
  33. return navigator.userAgent.match(/Opera Mini/i);
  34. },
  35. Windows: function() {
  36. return navigator.userAgent.match(/IEMobile/i);
  37. },
  38. any: function() {
  39. return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
  40. }
  41. };
  42. */
  43. </script>
  44. </head>
  45. <body>
  46.  
  47. </body>
  48. </html>