2013 年文章归档
共 42 篇文章
Rails的image_tag和image_path的使用
Rails的image_tag和image_path的使用 Rails 的 pipline,思想很好,不少细节考虑细致入微,但结构设计的跟屎一样,稍微脱离“小而简”的项目就没法好好工作了,没法说了。 #md5的fingerprint http://guides.rubyonrails.org/asset_pipeline.html 具有pipline的好处。但是,发现有些图片没有生成指纹,为啥? 因为路径。 In regular views you can access images in the assets/images directory like this: <%= image_ta…
2013-11-11 21:25 · Ruby_and_Rails
RBENV AND CAPISTRANO 问题和解决
capistrano碰到rbenv 碰到的主要麻烦: Bundler not working with rbenv, could not find [gem] http://stackoverflow.com/questions/9602806/bundler-not-working-with-rbenv-could-not-find-gem 几个解决方法: # 配置capistrano set :default_environment, { 'PATH' => "$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH" } #使用 capistrano-rben…
2013-11-11 21:12 · Ruby_and_Rails
Android_嵌入chrome浏览器
不想做App,想嵌入浏览器,比如chrome浏览器。 其他网友也有类似的期望,Use Chrome as render engine for Android webview android app developer,比如这些: http://jimbergman.net/webkit-version-in-android-version/ http://www.giantflyingsaucer.com/blog/?p=1331 http://stackoverflow.com/questions/14537083/use-chrome-as-render-engine-for-andro…
2013-11-09 21:44 · Android_IOS
Html的marquee标签使用
marquee移动的时候,位移是1个像素。 这种单像素移动,在大屏幕上就会有问题了,大颗粒的像素,移动的时候,有闪烁感,看起来很不舒服。只好调到极慢的速度。 <marquee> ... </marquee> 移动属性的设置 ,这种移动不仅仅局限于文字,也可以应用于图片,表格等等 鼠标属性 onMouseOut=this.start() ........鼠标移出状态滚动 onMouseOver=this.stop() .........鼠标经过时停止滚动 方向 <direction=#> #=left, right ,up ,down <marquee direction=left>从右向左移…
2013-11-09 21:43 · js_css_html_xml_nodejs
Git仓库迁移而不丢失log的方法
Git仓库迁移而不丢失log的方法 要求能保留原先的commit记录,应该如何迁移呢? 同时,本地已经clone了原仓库,要配置成新的仓库地址,该如何修改呢? #1 建立新仓库 1). 从原地址克隆一份裸版本库,比如原本托管于 GitHub。 git clone --bare git://github.com/username/project.git 2). 然后到新的 Git 服务器上创建一个新项目,比如 GitCafe。 3). 以镜像推送的方式上传代码到 GitCafe 服务器上。 cd project.git git push --mirror git@gitcafe.com/use…
2013-11-09 21:40 · git_and_git_flow
RubyOrRails_使用技巧_收集
# link_to not working in script/console include ActionController::UrlWriter #自定义时间和日期的格式,用来调用 在environment.rb你可以自定义时间和日期的格式 [Time::DATE_FORMATS, Date::DATE_FORMATS].each do |obj| obj[:dots] = "%m.%d.%y" end 在视图中就可以用了 Created: <%= @my_object.created_at.to_s(:dots) %> #返回do 。。。。end这个块的处理结果 (有时候为了省事和省…
2013-11-09 14:39 · Ruby_and_Rails
CSS_备忘笔记
属性和值选择器 下面的例子为 title="W3School" 的所有元素设置样式: [title=W3School] { border:5px solid blue; } 属性和值选择器 - 多个值 下面的例子为包含指定值的 title 属性的所有元素设置样式。适用于由 空格分隔 的属性值:如"this is en message" [title~=hello] { color:red; } 下面的例子为带有包含指定值的 lang 属性的所有元素设置样式。适用于由 连字符分隔 的属性值:如"this-is-en-message" [lang|=en] { color:red; } CSS …
2013-11-09 14:33 · js_css_html_xml_nodejs
Android 只开启一个Activity实例,launchMode详解,resume时如何得到Intent参数
在一个Activity中,多次调用startActivity()来启动另一个Activity,要想只生成一个Activity实例,方法有两种。 方法一:设置起动模式 一个Activity有四种启动模式:standard, singleTop, singleTask, singleInstance。 standard: 标准模式,一调用startActivity()方法就会产生一个新的实例。 singleTop: 如果已经有一个实例位于Activity栈的顶部时,就不产生新的实例,而只是调用Activity中的newInstance()方法。如果不位于栈顶,会产生一个新的实例。 singleT…
2013-09-11 07:41 · Android_IOS
虚拟机安装android系统-how-to-install-android-in-virtualbox
#virtualbox #下载的文件1G多,安装完了几乎8G了,所以分配空间还是要注意大点儿 #wifi可以跳过,因为其自动会走虚拟机的网络 #问题 * 本版本鼠标不能很好使用,所以还是触屏最合适 这里的安装指南: http://www.howtogeek.com/164570/how-to-install-android-in-virtualbox/ 9 9 9 - 9 9 9
2013-09-10 14:51 · Android_IOS
Rails Asset Pipeline 资源管线(笔记)
Rails Asset Pipeline 资源管线(笔记) 细节小记: # Search Paths in assets The default locations are: app/assets/images and the subdirectories javascripts and stylesheets in all three asset locations, but these subdirectories are not special. Any path under assets/* will be searched. 也就是说,在assets目录下的任何第一层目录,都可作为…
2013-09-09 23:18 · Ruby_and_Rails
Rails源码阅读(11)Rails使用bundle保持多机器环境gem版本的一致性
Rails源码阅读(11)Rails使用bundle保持多机器环境gem版本的一致性 ====rails3==== 文件conf/book.rb require 'rubygems' # Set up gems listed in the Gemfile. ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) require 'rubygems' #这个ruby1。9后已经不需要了 …
2013-09-05 19:21 · Ruby_and_Rails · write_a_rails
Rails_Gemfile_Bundle_是否需要指定gem的版本_多机器运行环境一致问题_Gems版本保持一致
Rails_Gemfile_Bundle_是否需要制定gem的版本_多机器运行环境一致问题_Gems版本保持一致 Rails目录下有两个文件,Gemfile和Gemfile.lock Gemfile中,很多gem都指定了版本,但也有些麽有指定版本。 所以问题出来了: 为什么有些指定,有些不指定。 那些没有指定版本的gem包,安装后,到底装的什么版本? 部署多台服务器,这些gems包能保持版本一致么? 先了解下rubygems的版本规范,可以看 这里 ,或者查找下pessimistic version constraint 或者 semantic_versioning。 这样就知道,Gemfi…
2013-09-05 15:34 · Ruby_and_Rails
centos_Error: Protected multilib versions_解决方法
centos_Error: Protected multilib versions_解决方法 yum install libc.so.6 Loaded plugins: fastestmirror, refresh-packagekit Repository base is listed more than once in the configuration Repository updates is listed more than once in the configuration Repository extras is listed more than once in the con…
2013-08-23 14:40 · linux_unix
Linux下的yum命令详解(朝花夕拾)
yum是干什么的 使用redhat,fedora的linuxer肯定都为rpm著名的dependency hell而头疼(这也是所有基于rpm发行版都有的问题)。foo is needed by bar,bar is needed by foo。要装卸个软件,还得辛辛苦苦地梳理清楚所有依赖性问题,rpm的几个搜索站点成了时常光顾的场所,如果不幸碰到循环依赖,那就只有干瞪眼的分了。 有时加个--nodeps参数,倒是眼不见,心不烦,但这样装上的软件,你能保证正常使用吗,这样卸载软件,你能保证不影响其它软件工作吗,恐怕谁也不能 给出肯定的答案。每到这时,帽子们只有看着debian的 apt暗自羡…
2013-08-11 16:10 · linux_unix
centos_添加EPEL软件仓库_以及epel源配置
Ubuntu下面更新,安装,管理软件非常方便,移入centos麻烦事情就来了。 但是centos是大部分服务器的选择,那就得好好学咯。 一个好的方法就是利用epel。 epel介绍: 官网介绍 。 EPEL( http://fedoraproject.org/wiki/EPEL ) 是由 Fedora 社区打造,为 RHEL 及衍生发行版如 CentOS、Scientific Linux 等提供高质量软件包的项目。装上了 EPEL,就像在 Fedora 上一样,可以通过 yum install package-name,随意安装软件。 安装 EPEL : * RHEL 4(centos 4)…
2013-08-11 15:52 · linux_unix
Git_Error_fatal: git-pull cannot be used without a working tree
#Error fatal: /usr/local/libexec/git-core/git-pull cannot be used without a working tree. 注意,不是git版本问题,有些文章的解释是错误的。 #原因 在bare仓库执行git pull操作 bare库,本身只作为仓库使用,而不作为工作区使用,即is not a working tree。 #解决方法: - 不用解决。 参考: http://stackoverflow.com/questions/8565828/troubleshooting-git-pull A bare repository does…
2013-08-11 00:30 · git_and_git_flow
Git-Server_需求_搭建_软件
Git-Server_需求_搭建_软件 #需求 Git的特点,正常情况下,本不用server。 但为了权限管理的方便,配置等,需要git-server。 #软件 gitosis这个比较老,已经不会继续维护了。 gitolite,这个是当前比较流行的。 这两个很多地方是相似的,因为后者本身就是追随和优化前者而来。 gitosis vs gitolite? 这里有比较和讨论 The main difference is that gitosis is now obsolete, and not actively maintained anymore. #搭建 搭建gitolite。 任何时候,还…
2013-08-11 00:09 · git_and_git_flow
Ubuntu_ImageMagick_安装和问题
#安装 1. sudo apt-get install libjpeg62 (not sure if this is required or just dev is enough) 2. sudo apt-get install libjpeg62-dev 3. 卸载以前所有和imagemagick相关的包, 如: sudo aptitude purge imagemagick, 卸载libmagick9等 4. install libperl-dev sudo aptitude install libperl-dev 5. install rmagick svn co https://ww…
2013-08-09 23:48 · Ruby_and_Rails
用UncaughtExceptionHandler处理意外异常
UncaughtExceptionHandler接口用来捕获运行时未被程序捕获异常. 用处: # 某些特殊情况下的异常处理以及线程重新load,从而成为”永远存在“的线程。 # 友好退出,善后处理,比如保存游戏币等 使用: Java代码 try { Thread caughtableThread = new Thread(new Task()); caughtableThread.setUncaughtExceptionHandler(new SimpleUncaughtExceptionHandler()); caughtableThread.start(); } catch (Excep…
2013-08-09 16:04 · Java_about · Android_IOS
TabHost_新的Activity仍然持有Tab_Tab内跳转新的Activity
TabHost_新的Activity仍然持有Tab_Tab内跳转新的Activity 问题: TabHost内的一个页面例如tab3,如果startActivity跳入新页面,则新页面是没有Tab栏的。而很多需求和蹩脚的产品非得这么搞(而且tab栏居然不能是样式不变的)。 解决方法: 用ActivityGroup,以LocalActivityManager(而这个类已经被deprecated了, 参考这里 官方文档)来管理当前的页面的显示和历史页面的切换。 其他问题: Tab内很多页面跳转,有些如果不作处理,又会跳出本Tab。 比如tab3的页面A,跳入页面B,跳入页面C,C此时已经和页面A…
2013-08-04 17:15 · Android_IOS