PigRider Blogs

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

Basic Ruby on Rails Concepts

[Author: Dingyu]   [Tue, 2013-09-10, 15:29]   [3368 views]

Ruby on Rails

Basic Ruby on Rails Concepts
Why Ruby on Rails ? 
1) for fast developing websites
2) DRY Principal(Don’t Repeat Yourself)
3) convention over configuration
4) scaffolding
5) pure Object oriented concepts
6) less coding
7) easy understanding of coding
8) follows MVC architecture
9) using library and g ... see full article

Basic Object-Oriented Programming Concepts

[Author: Dingyu]   [Tue, 2013-08-20, 13:05]   [1634 views]


Basic Object-Oriented Programming Concepts
Class vs. Object
Many people get confused by the difference between class and object. The difference is simple and conceptual. A class is a template for objects. A class defines object properties including a valid range of values, and a default value. A cla ... see full article

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

[Author: Dingyu]   [Sun, 2013-08-18, 15:01]   [1470 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]   [1663 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

Python glob module

[Author: ming.lian]   [Wed, 2013-08-14, 20:16]   [1809 views]


Python glob is for finding the pathnames matching the pathname pattern accroding to the rules used by the Unix shell.
if you want to grab all the .txt files under C drive, you can do this:
import glob
list = glob.glob(r'c:/*.txt')
print list
and it will return a list that contains all the txt files. ... see full article

Print Beautiful JSON with Python

[Author: ming.lian]   [Mon, 2013-08-12, 20:42]   [2044 views]


>>> import json
>>> print(json.dumps(data))  # No indention
{"status": "OK", "count": 2, "results": [{"age": 27, "name": "Oz", "lactose_intolerant": true}, {"age": 29, "name": "Joe", "lactose_intolerant": false}]}
>>> print(json.dumps(data, indent=2))  # With indention
  "status": "OK",
  "count" ... see full article

MySql: add auto-increment feature to a column in Ruby on Rails

[Author: ming.lian]   [Sun, 2013-08-11, 17:47]   [3814 views]

Ruby on Rails SQL

In ruby on rails, if you need to set a column with auto-increment, you have to execute a SQL command in your model.
Alter table Tablename modify column ColumnName int(11) auto_increment; ... see full article

Create MySQL composite primary key in Ruby On Rails

[Author: ming.lian]   [Sun, 2013-08-11, 17:47]   [2459 views]

Ruby on Rails SQL

MySql默认是以primary key作为clustered index,如果没有primary key的话,就以第一个unique index column作为clustered index,不需要单独建clustered index。
但是Ruby on Rails默认以自动生成的id作为primary key。所以如果你不想用自动生成的id作为primary key,则需要在ruby on rails里手动声明primary key。
create_table :table_name, :id => false do |t|
  t.integer :column_1 ... see full article

Common Git Commands

[Author: ming.lian]   [Sun, 2013-08-11, 17:46]   [2035 views]


新建项目流程 选择generate my own code
#git init
#git remote add origin username@pigrider.com:/GitRepository/pigRiderDev/pigRiderTools.git
#git fetch
#git branch --track master origin/master
#git checkout master
或者用  git checkout --track -b master origin/master 来代替上面两条命令
#git init
#g ... see full article

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

[Author: Dingyu]   [Sun, 2013-08-11, 17:46]   [1604 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
Previous 1 2 3 4 5 6 7 8 Next

Recent Most Popular Blogs: