PigRider Blogs

Sign In
HTML CSS Javascript Ruby on Rails C++ Java Python SQL Git Linux Others All By Author: Dingyu
Previous 1 2 3 4 5 6 Next

Use database.yml to Set Multiple Databases in a Rails Application

[Author: Dingyu]   [Sun, 2013-08-18, 15:01]   [1444 views]

Ruby on Rails

In the database.yml, the code looks like:
# MySQL.  Versions 4.1 and 5.0 are recommended.
# Install the MYSQL driver
#   gem install mysql2
# Ensure the MySQL gem is defined in your Gemfile
#   gem 'mysql2'
# And be sure to use new-style password hashing:
#   http://dev.mysql.com/doc/refman/5 ... see full article

Basic Multithreading Concepts

[Author: Dingyu]   [Thu, 2013-08-15, 14:46]   [1627 views]


Basic Multithreading Concepts
Concurrency and Parallelism
In a multithreaded process on a single processor, the processor can switch execution resources between threads, resulting in concurrent execution. Concurrency indicates that more than one thread is making progress, but the threads are not act ... see full article

Change the password in MySQL when you don't have SUPER privilege

[Author: Dingyu]   [Sun, 2013-08-11, 17:46]   [1577 views]


If you wish to change your password by yourself but you don't have the SUPER privilege, below process may help you.
Suppose that:
Your MySQL username is Nickname
Your current MySQL password is OldPassword
You wish to change your password to NewPassword 
1. Log into the MySQL
If you are logging into ... see full article

Find records with non-printable characters in T-SQL

[Author: Dingyu]   [Sun, 2013-08-11, 17:44]   [2683 views]


I know two ways to find records with non-printable characters in T-SQL. The first way, use the "like" statement to do it:
SELECT * FROM tableName
WHERE (columnName COLLATE Latin1_General_BIN2) like '%[^' + CHAR(32) + '-' + CHAR(126) + CHAR(9) + CHAR(10) + CHAR(13) + ']%'
The second way, use the "PAT ... see full article

How to Set Primary Keys Other Than :id in Rails 3 with MySQL

[Author: Dingyu]   [Sun, 2013-08-11, 17:43]   [4120 views]

Ruby on Rails SQL

In Rails 3, the primary key in a database table is very important. Rails model ActiveRecord functions, like save, destroy, update_attributes, and so on, require it to invoke callbacks. Rails 3 uses the column 'id' as a default primary key in a database table. However, in MySQL, only the primary key ... see full article

What is attr_accessor in Ruby?

[Author: Dingyu]   [Sun, 2013-08-11, 17:43]   [1370 views]

Ruby on Rails

I copied this article from a Stockflow post. Click here to see the original Stockflow post.
Let's say you have a class Person.
class Person
person = Person.new
person.name      # no method error
Obviously we never defined method name. Let's do that.
class Person
  def name
    @name      # simpl ... see full article
Previous 1 2 3 4 5 6 Next

Most Popular By This Author: