發表文章

目前顯示的是有「development」標籤的文章

Microsoft SQL vs Oracle vs MySQL

Microsoft SQL Oracle MySQL Pro's 1. Stored Procedures and triggers 2. Strong Relations management 3. Strong support on the software haven't found any 1. It's FREE! 2. Minimal learning curve 3. Small foot print 4. Reasonably fast with large storages (if queries are optimized) Con's 1. Expensive license costs 1. Costly 2. Lack of support 3. Hardware intensive 4. Steep learning curve 1. Weak relations management

Save data in Swift

String array Save array let array = [ "horse" , "cow" , "camel" , "sheep" , "goat" ] let defaults = NSUserDefaults . standardUserDefaults () defaults . setObject ( array , forKey : "SavedStringArray" ) Retrieve array let defaults = NSUserDefaults . standardUserDefaults () let array = defaults . objectForKey ( "SavedStringArray" ) as ? [ String ] ?? [ String ]() Int array Save array let array = [ 15 , 33 , 36 , 723 , 77 , 4 ] let defaults = NSUserDefaults . standardUserDefaults () defaults . setObject ( array , forKey : "SavedIntArray" ) Retrieve array let defaults = NSUserDefaults . standardUserDefaults () let array = defaults . objectForKey ( "SavedIntArray" ) as ? [ Int ] ?? [ Int ]()

[PHP] get all URLs from text

Here is the way to get all URLs from text. 以下方法可以把全部連結拿出來. function findURLs($text){ $pattern = '/[-a-zA-Z0-9@:%_\+.~#?&\/\/=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%_\+.~#?&\/\/=]*)?/i'; @preg_match_all($pattern, $text, $matches); if($matches[0]){ return $matches[0]; }else{ return false; } }

[ios] Set Admob banner to appear at bottom of screen

Set Admob banner to appear at bottom of screen Set in Portrait view: bannerView_ . frame = CGRectMake ( screenWidth / 2.0 - bannerView_ . frame . size . width / 2.0 , screenHeight - bannerView_ . frame . size . height , bannerView_ . frame . size . width , bannerView_ . frame . size . height ); Set in Landscape view: bannerView_ . frame = CGRectMake ( screenHeight / 2.0 - bannerView_ . frame . size . width / 2.0 , screenWidth - bannerView_ . frame . size . height , bannerView_ . frame . size . width , bannerView_ . frame . size . height );

[Programming] Throw out a 'The Connection was reset' error after submiting (POST) form

Here are a number of reasons that may occurs error after submiting (POST) form: Too much parameter sent: Try to reduce the useless input before submit Reach the max input var: set "max_input_vars   1000" in php.ini or in PHP page Loading time too long: In particular, the values for max_execution_time and max_input_time could safely be increased. Both of these are currently set to 180 seconds, or 3 minutes Reach the max of files: Set " max_file_uploads   20" in php.ini or in PHP page Posting data too large: Set " post_max_size   28M" in php.ini or in PHP page Over memory: Set "memory_limit   128M" in php.ini or in PHP page

[PHP] to Detect if browser is mobile

Use PHP to detect if browser is mobile Mobile_Detect is a lightweight PHP class for detecting mobile devices (including tablets). It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment. Download from the following link. https://github.com/serbanghita/Mobile-Detect/tags How to use in php code require_once '../Mobile_Detect.php'; $detect = new Mobile_Detect; if($detect->isMobile() ){     // is mobile }else if($detect->isTablet()){     // is tablet }else{     // is computer } Source from: https://github.com/serbanghita/Mobile-Detect

Generate screenshots at actual device sizes on iOS, Android, OS X & Windows

圖片
Generate screenshots at actual device sizes on iOS, Android, OS X & Windows You can test your website with different size with different mobile device And test on iOS, Android, OS X & Windows. Source from:  http://www.browserstack.com/responsive

[Yii] User-friendly URLs

Creating URLs User-friendly URLs Using Named Parameters Parameterizing Routes Parameterizing Hostnames Hiding  index.php Faking URL Suffix Using Custom URL Rule Classes Complete URL management for a Web application involves two aspects: When a user request comes in terms of a URL, the application needs to parse it into understandable parameters. The application needs to provide a way of creating URLs so that the created URLs can be understood by the application. For a Yii application, these are accomplished with the help of  CUrlManager . Note:  You can specify URLs without using Yii but it is not recommended since you will not be able to easily change URLs via configuration without touching application code or to achieve application portability. 1. Creating URLs  Although URLs can be hardcoded in controller views, it is often more flexible to create them dynamically: $url = $this -> createUrl ( $route , $params ) ; where  $...