While installing and browsing the awesome_print gem, I noticed in the examples this little beauty: require "awesome_print" ap (''.methods - Object.methods).grep(/!/) $ ruby 5.rb [ [ 0] capitalize!() String [ 1] chomp!(*arg1) String [ 2] chop!() String [ 3] delete!(*arg1) String [ 4] downcase!() String [ 5] encode!(*arg1) String [ 6] gsub!(*arg1) String [ 7] lstrip!() String [ 8] next!() String [ 9] reverse!() String [10] rstrip!() String [11] slice!(*arg1) String [12] squeeze!(*arg1) String [13] strip!() String [14] sub!(*arg1) String [15] succ!() String [16] swapcase!() String [17] tr!(arg1, arg2) String [18] tr_s!(arg1, arg2) String [19] upcase!() String ]

Published on 01/10/2013 at 22h11 under .

9679 comments

Setting up a stage server and migrating to your live server can be a pain with Wordpress. Here are a few steps you can take that can allow for a smooth and secure migration.

The first step is to create duplicate versions of the site. I prefer having two directories on the same server, say in directories like /public_html/wp_stage and /public_html/wp_live and setting up a subdomain for your stage like stage.example.com that points to the stage directory. There are a few benefits to doing things this way, which we'll see later on. If you have a separate stage server, the process will be slightly different. I'll try to address that.

You will of course have to set up your Wordpress site to be located in a different directory than the root. See this article.

If you have your Wordpress databases on the same server, and they both use the same user, you can use the Synchronise function in PhpMyAdmin (version >= 3.3) to migrate your database. With Synchronize, there are options to connect to other servers.

Straight migration of the database is not complete though, because in the database is stored the options for siteurl and home that need to be changed. If you have a subdomain set up for your stage, you can use the Wordpress Codex update_option() function to update your Wordpress environment options like this:

Place this in /wp-config.php at the end of the file, behind require_once(ABSPATH . 'wp-settings.php'); if(strpos($_SERVER['SERVER_NAME'], "stage.your_url") !== false) { // STAGE update_option('siteurl', 'http://stage.your_url.com' ); update_option('home', 'http://stage.your_url.com' ); } else { // LIVE update_option('siteurl', 'http://www.your_url.com/wp_live' ); // LIVE LOCATION update_option('home', 'http://www.your_url.com' ); }

Published on 13/09/2012 at 17h46 under . Tags

0 comments

Step 1: SSH into your server. Step 2: Create second account for SSH. You'll have to have Super User privileges $ su - $ adduser yournewuser and it will ask you to add a password etc. Step 3: Probably a good idea to logout of SSH and log back in with your new account, esp if it's your only other account. Step 4: Edit ssh_config, also as Super User $ su - $ nano /etc/ssh/sshd_config Find the line for PermitRootLogin and make it look like this: PermitRootLogin no Step 5: Restart your SSH server. On Ubuntu, this is recommended by everybody /etc/init.d/sshd restart It doesn't work for me, but this does: /etc/init.d/ssh restart

Published on 31/10/2011 at 18h29 under . Tags , ,

1322 comments

Following tutorials around the net for installing ActiveAdmin, I encountered several errors.

First was this when trying to run rails generate active_admin:install: /Users/user_name/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.4/lib/rack/backports/uri/common_192.rb:53: warning: already initialized constant WFKV_

Solution is to add gem 'rack', '1.3.3' in your Gemfile to specify your rack version and then of course run bundle install to implement the other version.

The next one was when trying to run rake db:migrate, I got a bunch of errors like this: warning: already initialized constant MAJOR

This was solved by running bundle exec rake db:migrate instead, which as I understand, effectively runs the migrate with the version of rake in your application's directory.

Finally I got this one: /Users/user_name/Sites/ruby/active_admin_example/config/initializers/session_store.rb:3: syntax error, unexpected ':', expecting $end ...sion_store :cookie_store, key: '_active_admin_example_sessio...

You should note that my application name was "active_admin_example" and this ended up being the culprit. Make sure you name your project with something not including the phrase "active_admin" or "activeadmin" or anything close to that. I'm a beginner to Rails and maybe this is an obvious bad practice when trying out new gems. It seems to be...

Hope this helps!

Published on 24/08/2011 at 18h44 under .

231 comments

Powered by Typo – Thème Frédéric de Villamil | Photo Glenn