电子商务系统
restful API
问卷调查系统
考试系统
文档管理系统
爬虫系统
##############################################################
>cd D:\mysql-5.7.15-win32\bin
>mysqld -install
>mysqld --initialize
start mysql service:
>net start mysql
>net stop mysql
>mysql -u root -p 123456
#################################################################
>gem install rails -v=2.3.8
> gem sources --add http://gems.ruby-china.org/ --remove https://rubygems.org/
> gem sources -l
*** CURRENT SOURCES ***
http://gems.ruby-china.org/
> gem install rails -v=3.2.1
ERROR: Error installing rails:
invalid gem: package is corrupt, exception while verifying: undefined me
thod `size' for nil:NilClass (NoMethodError) in C:/Ruby22/lib/ruby/gems/2.2.0/cache/thread_safe-0.3.5.gem
=>delete the directory cache,errors will not appear when reexecute gem install
>rake db:migrate RAILS_ENV=test
>rake test:units
>rake test:functionals
>ruby -Itest test/unit/product_test.rb
>ruby -Itest test/unit/product_test.rb -n product_attributes_must_not_be_empty
>ruby -Itest test/unit/product_test.rb -n /attributes/
>rake spec
>rspec spec/models/product_spec.rb
>rails g scaffold Product title:string description:text image_url:string price:decimal
>rails g controller store index
>rails g session_migration
>rake db:migrate
>rails g scaffold cart
>rails g scaffold line_item product_id:integer cart_id:integer
>rails g migration add_quantity_to_line_item quantity:integer
>rails g migration combine_items_in_cart
>rails g scaffold order name:string address:text email:string pay_type:string
>rails g migration add_order_id_to_line_item order_id:integer
>rails g scaffold user name:string hashed_password:string salt:string
>rails g controller sessions new create destroy
>rails g controller admin index
>rails g model Document name:string file_type:string file_size:decimal parent_id:integer file_path:string absolute_path:string
>rake db:create RAILS_ENV=production
>rails s -e production
>bundle exec rake assets:precompile RAILS_ENV=production
##########################################################
mysql error 1045
1.create a txt file,contents as follow:
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123456');
the file named C:\mysql-init.txt。
2.execute=> D:\mysql-5.7.15-win32\bin\mysqld -nt --init-file=C:\mysql-init.txt
3.mysql -u root -p 123456
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123456');
4.restart mysql service
##########################################################
MySQL修改root密码的多种方法
方法1: 用SET PASSWORD命令
mysql -u root
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass');
方法2:用mysqladmin
mysqladmin -u root password "newpass"
如果root已经设置过密码,采用如下方法
mysqladmin -u root password oldpass "newpass"
方法3: 用UPDATE直接编辑user表
mysql -u root
mysql> use mysql;
mysql> UPDATE user SET Password = PASSWORD('newpass') WHERE user = 'root';
mysql> FLUSH PRIVILEGES;
在丢失root密码的时候,可以这样
mysqld_safe --skip-grant-tables&
mysql -u root mysql
mysql> UPDATE user SET password=PASSWORD("new password") WHERE user='root';
mysql> FLUSH PRIVILEGES;
##########################################################
gem降级=>gem update --system 1.5.3
>gem install mysql2 --platform=ruby -- '--with-mysql-dir="D:\mysql-5.7.15-win32"'
>gem uninstall activerecord-mysql2-adapter
>gem install mysql2 -v=0.3.19 -- '--with-mysql-dir="D:\mysql-5.7.15-win32"'
gem install rspec-rails -v=2.8.0
rspec-rails:activesupport requires Ruby version >= 2.2.2
Successfully installed rspec-core-2.8.0
Successfully installed diff-lcs-1.1.3
Successfully installed rspec-expectations-2.8.0
Successfully installed rspec-mocks-2.8.0
Successfully installed rspec-2.8.0
Successfully installed rspec-rails-2.8.0
gem uninstall rspec-core diff-lcs rspec-expectations rspec-mocks rspec
recursively find the specified file in the current dir
>dir /s find jquery_ujs.js
C:\Ruby22\lib\ruby\gems\2.2.0\gems\jquery-rails-3.1.4\vendor\assets\javascripts
>findstr /s /i "last_comment" *.rb
>cd C:\cygwin\home\Administrator\Depot
strftime('%Y-%m-%d %H:%M:%S')
<%= post.updated_at.to_s(:db) %>
<%= post.updated_at.localtime.to_s(:db) %>
$ find / -name "*.rb" |xargs grep info
$ find ./ -name "*view*" -type d
ActiveRecord::Base.logger
StoreController.logger.info "message"
>tasklist | findstr 3060
>taskkill /pid 3060 /F
/mswin|mingw/ =~ RUBY_PLATFORM
require 'securerandom'
SecureRandom.hex(10)
SecureRandom.base64(10)
SecureRandom.urlsafe_base64
SecureRandom.uuid
#########################################################
Rails 3 is not compatible with Ruby 2.2
ruby1.8.7+rails2.3.5
ruby1.9.3+rails3.0.8
ruby2.2.2p95+rails3.2.22
Ruby 2.2.0 and ActiveRecord 4.1.0 bug
Update to Rails 4.1.2
NoMethodError: undefined method `name' for nil:NilClass
C:/Ruby22/lib/ruby/gems/2.2.0/gems/activerecord3.2.1/lib/
active_record/associations/has_many_association.rb:79:
warning: circular argument reference - reflection
Changing Rails version from 3.2.15 to 3.2.22 fixed this for me.
the circular argument reference warning in activesupport
here is what i did to resolve that, i had the latest ruby and the gems are not compatible with that,
so after having a fight for nearly a day i switched to older ruby version using rvm from ruby-2.2.1
to ruby-2.0.0 ,again this is not an issue with ruby version but incompatibility with gems,try and
have good luck with that.
Active Support dependency warning when using Ruby 2.2.0
As of Rails 4, a Ruby version of at least 1.9.3 will be required
#########################################################
<%if true%>
<div>
hello
<%end%>
</div>
firefox没问题 IE会多个</div>
#########################################################
rails runner script/load_orders.rb
#########################################################
100m
500m
1km
5km
10km
25km
50km
bing:POI radius search algorithm
https://zh.scribd.com/presentation/2569355/Geo-Distance-Search-with-MySQL
Geo Distance Search with MySQL algorithm
#########################################################
>documents
name
file_type
file_size
parent_id
file_path
absolute_path
#########################################################
解压安装:
tar zxvf ruby-2.2.5.tar.gz
./configure --prefix=/usr/local --enable-shared --disable-install-doc --with-opt-dir=/usr/local/lib
make
sudo make install
ruby -v
sudo apt-get install -y build-essential openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev libyaml-dev libxml2-dev libxslt-dev autoconf automake libtool libmysqlclient-dev
sudo apt-get install -y curl libcurl3-dev git
sudo apt-get install libmysql-ruby
在ruby的目录ext下,需要安装一下openssl。
$ cd ruby解压安装目录/ext/openssl
$ ruby extconf.rb
$ make
No rule to make target `/include/ruby.h', needed by `ossl_ns_spki.o'
#######################################################
Add this to your Makefile in ../ext/openssl (after using ruby extconf.rb):
top_srcdir = ../.. after archdir = $(rubyarchdir)
#######################################################
$ sudo make install
/usr/bin/install -c -m 0755 openssl.so /usr/local/lib/ruby/site_ruby/2.2.0/i686-linux
installing default openssl libraries
当安装gem包时,报zlib的load error,请重新进入ruby的zlib目录下重新安装。(方法同安装openssl)
$ cd ruby解压安装目录/ext/zlib
$ ruby extconf.rb
$ make
$ sudo make install
gem install rails -v=3.2.22
>mysql安装
http://dev.mysql.com/downloads/mysql/#downloads
mysql-5.7.16-linux-glibc2.5-i686.tar.gz
首先添加mysql用户组
simon@localhost$ groupadd mysql
添加mysql用户,并指定到mysql用户组
simon@localhost$ useradd -g mysql mysql
解压缩mysql-5.7.16-linux-glibc2.5-i686.tar.gz到安装目录(/usr/local/)
simon@localhost$ cd /usr/local
simon@localhost$ sudo tar zxvf /home/simon/Downloads/mysql-5.7.16-linux-glibc2.5-i686.tar.gz
simon@localhost$ ls
创建mysql软连接mysql-VERSION-OS
simon@localhost$ sudo ln -s /usr/local/mysql-5.7.16-linux-glibc2.5-i686 mysql
simon@localhost$ cd mysql
simon@localhost$ ls
设定mysql安装目录权限,设置owner为mysql
simon@localhost$ sudo chown -R mysql .
simon@localhost$ sudo chgrp -R mysql .
执行mysql系统数据库初始化脚本
sudo bin/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data
提示mysql_install_db 命令已弃用,使用mysqld
sudo bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data
设定data目录权限,分配给mysql用户,为了mysql程序能读写data目录下的文件
simon@localhost$ sudo chown -R root .
simon@localhost$ sudo chown -R mysql data
使用mysql帐号启动mysql应用
simon@localhost$ sudo bin/mysqld_safe --user=mysql &
cannot create /var/lib/mysql/mysqld_safe.pid: Directory nonexistent
cannot touch ‘/var/log/mysql/error.log’: No such file or directory
sudo mkdir /var/lib/mysql
sudo mkdir /var/log/mysql
sudo mkdir /var/run/mysql
/var/run/mysqld/mysqld.pid ended
设置root密码
A temporary password is generated for root@localhost: :vqfNRw&9h_E
simon@localhost$ sudo bin/mysqladmin -u root password '123456'
mysql>SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123456');
登录mysql
simon@localhost$ bin/mysql -u root -p
【MySQL】查看MySQL配置文件路径及相关配置
$ which mysqld
/usr/sbin/mysqld
$ /usr/sbin/mysqld --verbose --help | grep -A 1 'Default options'
/etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf
服务器首先会读取/etc/my.cnf文件,如果发现该文件不存在,再依次尝试从后面的几个路径进行读取。
cd ~/
sudo find / -name my.cnf -type f
>The server quit without updating PID file (/usr/local/mysql/data/ubuntu.pid).
Solution 2: Remove Your MySQL Config File
If you have modified your MySQL configuration file, MySQL may not like it few versions after (MySQL is not backward compatibility friendly). It can be the problem of using an unsupported variable, or something similar. The easiest way is to remove your configuration file, and try to start the MySQL server again
Backup your MySQL configuration first.
mv /etc/mysql/my.cnf /etc/mysql/my.cnf.backup
cd /usr/local/mysql
sudo chmod -R 777 data
启动mysql
mysqld --defaults-file=/home/simon/Desktop/Depot/config/my.cnf
mysqld_safe --defaults-file=/home/simon/Desktop/Depot/config/my.cnf --user=mysql &
`require': cannot load such file -- readline (LoadError)
$ cd ruby解压安装目录/ext/readline
$ ruby extconf.rb
$ make
No rule to make target `/include/ruby.h', needed by `readline.o'.
#######################################################
Add this to your Makefile in ../ext/openssl (after using ruby extconf.rb):
top_srcdir = ../.. after archdir = $(rubyarchdir)
#######################################################
$ sudo make install
There was an error while trying to load the gem 'coffee-rails'. (Bundler::GemRequireError)
原因是缺少依赖的组件nodejs
运行sudo apt-get install nodejs 安装nodejs,再重新运行rails c即可。
在Depot外面找
sudo find / -name *.rb|xargs grep 'last_comment'
rails runner script/load_orders.rb
相关推荐
这个是我从百度文库里找的rails笔记,原文作者用清晰的语言代领初学者怎样快速入门Rails
让你的Ubuntu 快速安装 Ruby on Rails 笔记
此文档我学习Ruby on Rails技术的综合 ,有读书笔记、心得自创教程一些问题解决经验统分门别类集技术的综合 ,有读书笔记、心得自创教程一些问题解决经验统分门别类集技术的综合 ,有读书笔记、心得自创教程一些问题...
内含web敏捷开发笔记,提供word pdf两种格式下载!超值,原创!
学习笔记,是入门新手的好教材!分享给大家!
我的书 欢迎来到我的书中!
sunspot 学习笔记-安装以及使用,另外还有部分crontab插件的安装以及使用,适用与rails3
rails官网入门笔记的翻译,非常不错的rubyonrails入门教程!
rails入门
NULL 博文链接:https://citi21558541.iteye.com/blog/437132
Ruby rails_入门详细笔记(官网翻译).
本人学习ruby on rails 的开发和部署过程中的环境搭建的笔记 基本涵盖了ruby开发中用到的所有软件的安装 也给自己留个存档
有机会再试一试Rails了,只是原来接触的是2,现在已然变成了4,似乎现在的安装比原来会快些。。 Rails 4 安装 针对于安装了RVM 代码如下:gem install rails没有的话应该这样: 代码如下:sudo gem install rails安装...
一边读着《Agile Web Development with Rails》的英文电子版,一边写随笔,并且尽量写的简单明了些,对于具体的细节概念倒没有做深入的研究,所以,这一系列也是《Agile Web Development with Rails》的读书笔记...
Rails样式指南榜样很重要。 -军官Alex J. Murphy / RoboCop 小费您可以在找到本指南的精美版本,并对其导航进行了改进。 本指南的目的是为Ruby on Rails 4开发提供一组最佳... 笔记这里的一些建议仅适用于Rails 4.0+。
attache-rails, 将你的Rails 应用程序与attache服务器集成 attache 使用 attache/api 在 attache服务器上集成 Rails/ActiveRecord 集成。依赖项响应,jQuery,Bootstrap 3安装注意:如果你正从V2升级,请参阅升级...
tiny_mce, Ruby on Rails 插件( pre Rails 3.1 ),允许你轻松地将TinyMCE编辑器实现到你的应用程序中 用于 Rails的 ... 似乎如下笔记。注意 Rails 3.1用户: 针对 Rails 3.1资产中的JavaScript库的改进,不推荐使用 Ra
笔记 转换表目前是静态的,不像 php-emoji 那样自动生成。 变更日志 1.1.0(2013 年 5 月 14 日) Rails 4 支持; 在 Rails 3 和 Rails 4 上进行测试 ##Credit by Cal Henderson Port by Owen Lawson 这项工作在 ...
“开发人员的笔记本”记录了一些准则,技术和想法,这些准则,技术和想法将经典的面向对象的思想应用于Ruby on Rails应用程序。
Robin on Rails:我的知识库概述Robin on Rails是我的知识库,我可以在其中添加笔记和想法。 我试图在其他平台上构建我的网站。 最终,我回到了常规的GitHub存储库。 毕竟,我是一名软件开发人员。资料夹我将感兴趣...