wift: Login to WordPress from your iOS App

Swift: Login to WordPress from your iOS App

[Steps by Steps ]Migrate Drupal 7 from web hosting to google cloud platform

1)backup the mysql database in backup.sql or backup.sql.gz, notes: please clear the cache_form table first to reduct the table size which is huge(phpmyadmin / mysql workbench)

(take a look on this : why cache_form is huge)

2)backup the sites folder with files in web host

3)add database user in phpmyadmin of cloud platform in old database(could be found in setting.php in sites/default)

4)upload the backup.sql or backup.sql.gz via phpmyadmin

5)upload the sites folder via sftp to /home/your_username_folder (FTP client -> Transmit)

6)update the sites folder ownership to www-data

7)cp sites folder to /drupal

8)Finish !!! (Not Yet if you need to consider domain name)

Reference :

Drupal 7 cache_form table is too huge

After long run, the cache form table become huge,

Find it out in mysql workbench or phpmyadmin
SELECT table_name “Tables",
( data_length + index_length ) / 1024 /
1024 “Table Size in MB",
( data_free )/ 1024 / 1024 “Free Space in MB"
FROM information_schema.TABLES
where table_schema="your_database_name"
Order by (data_length + index_length) DESC;
DELETE FROM {cache_form} WHERE expire < now();

DELETE FROM drupal_e.cache_form WHERE (expire <> 0) AND (expire < UNIX_TIMESTAMP(NOW()));

////or using drupal module





Playing with nginx + passenger for Ubuntu Server/ Mac OSX





前往 Medium.com 檢視


(for osx yosemite ,install brew before install nginx+passenger)


After install nginx+passenger , you will see this in command line

Docroot is: /usr/local/var/www

The default port has been set in /usr/local/etc/nginx/nginx.conf to 8080 so that

nginx can run without sudo.

nginx will load all files in /usr/local/etc/nginx/servers/.

To activate Phusion Passenger, add this to /usr/local/etc/nginx/nginx.conf, inside the ‘http’ context:

  passenger_root /usr/local/opt/passenger/libexec/lib/phusion_passenger/locations.ini;

  passenger_ruby /usr/bin/ruby;

To have launchd start nginx at login:

    ln -sfv /usr/local/opt/nginx/*.plist ~/Library/LaunchAgents

Then to load nginx now:

    launchctl load ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist

Or, if you don’t want/need launchctl, you can just run:


1)sudo nginx  //start service , see localhost:8080 or localhost:80 will show “welcome to nginx
2) edit the /opt/nginx/conf/nginx.conf



listen 80;

server_name app_name.dev;

root /home/www/rails_project/public #point to your rail project public folder’s location

passenger_enabled on; #for rails project

passenger_app_env development; #it your project still in development setting


//if you need more domain name in localhost…



Edit your /etc/hosts file and add the following line: app1.dev app2.dev etc.dev; You should be able to access your apps by browsing to http://app_name.dev

(if using yosemite , flush dns cache)


forbbiden 403

try add index.html (with “<html>hello world</html>")in public folder, if web browser can access, it means you write a wrong root in nginx.conf


Open Facebook Page from iOS App OpenUrl

You have to use the facebook ID for the given page rather than the vanity URL. To get the pages ID, enter your page’s vanity name at the following URL and copy the value for “id":


Once you have the id, you can set up the method to check if FB is installed using the canOpenURL method and serve the appropriate content for both states:

NSURL *facebookURL = [NSURL URLWithString:@"fb://profile/113810631976867″];
if ([[UIApplication sharedApplication] canOpenURL:facebookURL]) {
[[UIApplication sharedApplication] openURL:facebookURL];
} else {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://facebook.com"]];