歪楼

从Firefox的查看元素>查看器入手,发现有搞头。然后又谷歌查阅了些资料,发现我想的方法对firefox浏览器的依赖性太强,最多也就能做成firefox的一个插件。 简要记下我原来的思路: html源文档,用word打开的话,就可以自动去除所有的<tag>,当然也可以用perl写些正则表达式,所以搞到html源文档就有搞头。 百度文库啊,豆丁啊,刀客88啊,什么的,表面上好像把源文档藏的好好的,但是只要用firefox查看下元素,他们就怂了,穿什么色的内裤都看的一清二楚。 然后,成也萧何败也萧何,不想太依赖firefox。 所以,作罢。 不过也有些小收获,可以做些小的恶作剧。 比如下图一,和下图二的恶作剧: (图一,恶搞的是百度文库的每个考试试卷文档,还不算太歪) (图二,恶搞的是文章。。。~~话说人家劈人家的腿与你何干? ~~话说我没有节操又与他们劈不劈腿何干?)

May 12, 2014 · datewu

第七章FLOW3d铸造模具热循环分析

文章已丢失 :(

May 8, 2014 · datewu

想写个cms

updated at 2014/2/16 坑太大,挑战太多,挑战失败,放弃啦 :) 看完Ruby On Rails tutorial,感觉热血沸腾。 来吧,少年,来写个CMS吧。 model 数据库设计 generate 生成model schema数据模型: 1 2 3 4 5 6 rails g model App \ title:string icon:binary descript:text \ get_url:string hits:integer downloaded:integer score:decimal \ version:string require_os_version:string author:references rails g model Author name:string descript:text website:string populate 填充假数据,便于测试。 faker gem 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 #db/seed.rb 30.times do |n| ne = Faker::App.author dt = Faker::Lorem.paragraph we = Faker::Internet.url Author.create!(name: ne, descript: dt, website: we ) end users = Author.order(:created_at).take(17) 50.times do users.each do |u| te = Faker::App.name dt = Faker::Hacker.say_something_smart gu = Faker::Internet.url hs = Faker::Number.number(5) dd = Faker::Number.number(4) se = Faker::Commerce.price vn = Faker::App.version rn = "android 1.6+ | ios 6.0+" u.apps.create!(icon: nil, title: te, descript: dt, get_url: gu, hits: hs, downloaded: dd, score: se, version: vn, require_os_version: rn) end end 数据录入 手动/人工录入 form表单 机器抓取 nokogiri gem UI/static_pages_controller controller 新建controller ...

December 23, 2013 · datewu

连接数据库

跟着rails tutorial 学习rails框架时,遇到了db链接的问题 问题 1 2 3 4 5 rake db:create failed PG::ConnectionBad: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"? Google之后发现是database.yml配置文件没有加上host:localhost配置项。 过一会,发现PATH没有包含psql命令。 1 2 3 4 5 6 7 vi ~/.bash_profile #添加下面一行内容 export PATH="/Applications/Postgres.app/Contents/Versions/9.4/bin:$PATH" exit ## or echo export PATH="/Applications/Postgres.app/Contents/Versions/9.4/bin:$PATH" >> ~/.zshrc 终于rake db:migrate 成功。 附录 附上database.yml(production环境使用heroku环境变量) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 default: &default adapter: postgresql encoding: unicode # For details on connection pooling, see rails configuration guide # http://guides.rubyonrails.org/configuring.html#database-pooling pool: 5 development: <<: *default host: localhost database: xxx_development test: <<: *default host: localhost database: xxx_test production: <<: *default database: xxx username: xxx password: <%= ENV['xxx_xxx_PASSWORD'] %>

November 7, 2013 · datewu