Search


Meta

Creative


Support


Leesoft

Feed™

Recent Comments

Photos

Jun
24

Ruby中常用MD5或者SHA1加密方法

Posted by » developerly
103 hits

MD5加密方式:
require ‘md5′
puts MD5.hexdigest(”)

SHA1加密方式:
require ‘digest/sha1′
puts Digest::SHA1.hexdigest(”)

Jun
16

My First AppEngine Product Released!!!!

Posted by » developerly
84 hits

My First AppEngine Product Released!

Actually this product is released by yesterday evening. But today is the announced day for this product. This is some kind of the web game. The idea is we are blind before the thousands of the informations, but try this game, you can find the internal connection from one with another!

I am still working on the clues of the game, asking friends for the testing,after that I will announce the url  to all of you.

Jun
12

Rails在模板或者helper文件中取得当前控制器的名字

Posted by » developerly
78 hits

<%=@controller.controller_name%>

Jun
12

RESTFUL风格中怎么和form_for 搭配使用

Posted by » developerly
88 hits

我在用Ruby2.0的Restful风格开发中,由于缺少文档,走了不少弯路,不过现在终于搞清楚了。简单的我就不说了,通过ruby script/generate scaffold …命令可以很方面的生成rest风格的GRUD,因为我现在是在作一个后台管理平台,希望rest生成的control能够放到admin的命空间下面。有如下几个关键点:

首先要修改该route.rb中的路由配置:

map.namespace :admin do |admin|
admin.resources :users
end

通过使用命令rake routes可以查看到所有的路径和便利函数

最大的难点是在update中与form_for配合,我是这么做的
<% form_for(:user,@user,:url=>admin_user_path(@user),:html=>{:method=>:put}) do |f| %>

<% end%>

这样就可以指定相关的path用form模拟put操作了

Jun
5

Python 函数参数的传递(转)

Posted by » developerly
80 hits

Python 中函数参数的传递是通过“赋值”来传递的。但这条规则只回答了函数参数传递的“战略问题”,并没有回答“战术问题”,也就说没有回答怎么赋值的问题。函数 参数的使用可以分为两个方面,一是函数参数如何定义,二是函数在调用时的参数如何解析的。而后者又是由前者决定的。函数参数的定义有四种形式:

1. F(arg1,arg2,…)
2. F(arg2=,arg3=…)
3. F(*arg1)
4. F(**arg1)
跳转后阅读Python 函数参数的传递(转)的完整内容

Jun
3

Accelerator:Faster The Development On Google AppEngine

Posted by » developerly
79 hits

也许是习惯了RoR下面那种通过generator自动生成网站框架。为了更好的帮助我自己秘密产品的开发。我准备顺手开发一些辅助工具来帮助组织代码什么的,我会逐渐的发布一些代码,希望最终能够整理成一个完整的工具包

generator.py 就是我用来自动生成网站框架的文件。只要使用generator.py <your appname>,就能自动生成网站框架。当然有一段日子没有用python写过东西了,所以这个文件写的相当的简陋。又由于我的主要精力会放在产品开发上,所以暂时也没有准备对这个文件做升级哈的。如果哪位大大对这个粗糙的拿不出手的东西感兴趣的话,欢迎在网站上和我留言联系。

Orz

Jun
2

Rails:使用FCKEditor

Posted by » developerly
85 hits

FCKEditor可以说是目前最好的在线HTML编辑器了。官方FCKEditor好像只支持python,php,.NET还有Java等等。不过rubyforge上有一个Fckeditor的插件。

我在公司的网络上不能在线安装这个插件,只能通过下载到本地安装了,安装方法非常简单:

  • 这里下载最新的fckeditor plug in。
  • 解压,重命名文件夹为fckeditor,并把解压好的目录放到rails应用的vendor/plugins目录下
  • 在rails app目录下面执行rake fckeditor:install就安装好了
  • 在需要使用editor的文件上添加代码<%= javascript_include_tag :fckeditor %>
  • 在需要使用editor的地方添加:<%= fckeditor_textarea(”wiki”, “content”, :toolbarSet => ‘Simple’, :width => ‘100%’, :height => ‘320px’ )%>
    其中wiki是这个page的对象

就可以使用了。

Jun
2

Code ‘OneEyeCat’:Using GAE To Host

Posted by » developerly
81 hits

Yesterday, I have blogged a post saying that I am going to transfer my current project from Ruby to AppEngine. Strange thing is that, the hit number of this post is very high. So it means the google appengine is really hot.

Let’s turn back to my “secrete” project. I named it as “OneEyeCat”, I promise it as a very cool online service provided. But I will not tell you what it is now. During the development of this project. I will share all my experiences of using GAE. Hoping this can enjoy you all my readers of this site.