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 :
http://www.linuxquestions.org/questions/linux-software-2/command-line-chown-command-recursively-on-invisible-directories-840282/
http://www.arthurtoday.com/2010/09/ubuntu-cp-mv.html

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

https://www.drupal.org/project/safe_cache_form_clear

https://www.drupal.org/project/optimizedb

//Reference
http://www.globalsoftlab.com/resource/blogs/cacheform-table-grows-huge-drupal

http://www.vmdoh.com/blog/drupal-cacheform-table-eating-disk-space-heres-fix

Playing with nginx + passenger for Ubuntu Server/ Mac OSX

https://ihower.tw/rails4/installation.html
https://ihower.tw/rails4/deployment.html
http://www.robertmulley.com/tutorial/nginx-install-and-setup-mac-os-x-yosemite/

https://www.digitalocean.com/community/tutorials/how-to-install-rails-and-nginx-with-passenger-on-ubuntu

http://blog.sina.com.cn/s/blog_4a9569ce0101fnio.html

https://ruby-china.org/wiki/mac-nginx-passenger-rails

View story at Medium.com

https://www.phusionpassenger.com/documentation/Users%20guide%20Nginx.html#install_osx_homebrew

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

http://brew.sh/

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:

    nginx

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

add

server{

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…

https://www.digitalocean.com/community/questions/can-we-host-multiple-websites-in-nginx-at-localhost

https://www.ihash.eu/2014/10/edit-hosts-file-mac-os-x-10-10-yosemite/

Edit your /etc/hosts file and add the following line: 127.0.0.1 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)

http://osxdaily.com/2014/11/20/flush-dns-cache-mac-os-x/

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

https://ruby-china.org/topics/19510

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":

https://graph.facebook.com/yourappspage

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"]];
}

http://stackoverflow.com/questions/16589367/open-link-to-facebook-page-from-ios-app