摘要: import tornado.httpclient as httpclientimport urllibfrom pyquery import PyQuery as pqimport torndbimport threadingurl = 'http://gmgard.us/gm'img_url = 'http://gmgard.us'static_path = 'static/img/'db = torndb.Connection(host='localhost:3306',user='ypc',password 阅读全文
posted @ 2014-04-05 19:53 ggaaooppeenngg 阅读(963) 评论(0) 推荐(0) 编辑
摘要: ptyhon句段后面都要加一个":"号 阅读全文
posted @ 2014-04-05 17:13 ggaaooppeenngg 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 一下假设我们正在写的web框架叫nice为了兼容使一些函数能够兼容http.handleFunc,比如Nice.Get("/hello",func(){return "hello"})在访问127.0.0.1:3000的时候就能看到hello。实现的方法就是,我们要为每个请求维护一个上下文,然后利用对被兼容函数的反射,自适应相应的handleFunc。然后再实现http的接口Nice.ServerHTTP(w,r)即可。好吧,我觉得这句话也没怎么说清楚。先看代码。首先,怎样才能自适应呢?怎样才能达到变参的效果呢?如果换作别的场景,做起来就很困难了,因为函 阅读全文
posted @ 2014-04-02 08:42 ggaaooppeenngg 阅读(326) 评论(0) 推荐(0) 编辑
摘要: static, checked at compile time, dynamic when asked for每个语言都有反射,我们的GO反射也很拽,不服来辩。Go语言是静态类型,所有数据的类型在编译器都是明确的,规定好了的。总之在编译的时候就决定了数据的类型的。type MyInt intvar i intvar j MyInt即使是底层存的是一个类型,声明的类型不一样,也要强制转换才能互用。另:go里面没有隐式转换,碰到类型不同只能强转。牛逼哄哄地不让你有半点越界。比如io package 里面的Reader和Writer。只要实现了Reader的read方法,就可以按照read来存var 阅读全文
posted @ 2014-03-21 15:19 ggaaooppeenngg 阅读(373) 评论(0) 推荐(0) 编辑
摘要: 来自:http://blog.csdn.net/zhuzeyu5211/article/details/8961231(1)android.app.Fragment:兼容的最低版本是android:minSdkVersion="11"因此你的应用不能兼容3.0以下的应用。可以使用标签的,这点很重要,如果是用android.support.v4.app.Fragment的话,是不能是用标签的,会抛出android.view.InflateException: Binary XML file line #7: Error inflating class fragment异常(2 阅读全文
posted @ 2014-03-16 20:47 ggaaooppeenngg 阅读(141) 评论(0) 推荐(0) 编辑
摘要: // Flashes returns a slice of flash messages from the session.//// A single variadic argument is accepted, and it is optional: it defines// the flash key. If not defined "_flash" is used by default.func (s *Session) Flashes(vars ...string) []interface{} { var flashes []interface{} key := f 阅读全文
posted @ 2014-03-11 21:08 ggaaooppeenngg 阅读(869) 评论(0) 推荐(0) 编辑
摘要: ajax 动态加载的内容,相应的js也要在回调里加载,不然之前已经写好的监听函数,其实没有绑定到后来动态加载的元素上的,所以要写成回调的形式比如:$(".getStudent").click(function(event){ console.log($(this)); var account = $(this).attr("target") $.ajax({ url: '/getStudent', type: 'POST', dataType: 'html', da... 阅读全文
posted @ 2014-03-11 21:07 ggaaooppeenngg 阅读(263) 评论(0) 推荐(0) 编辑
摘要: location.href 这个赋值以后就会页面跳转了。 浏览器缓存会记住原来的值,到时候会进行N次MD5加密,所以把明文的,和加密的分开tr 一行 td是一个数据 th是数据头$("#loginForm").submit(function(event){ event.preventDefault(); // Get some values from elements on the page: var $form = $( this ), account = $form.find( "input[name='account']" ).va 阅读全文
posted @ 2014-03-11 21:07 ggaaooppeenngg 阅读(2441) 评论(0) 推荐(0) 编辑
摘要: http://stackoverflow.com/questions/10199219/go-template-functionhttp://stackoverflow.com/questions/15209236/multiple-templates-with-funcmaphttps://groups.google.com/forum/#!topic/golang-nuts/0Q-r_EkCPgk总之解决方法就是,以首个文件的basename作为模板的名字就可以解决了。例子func TestFuncMap(T *testing.T){ //os.Chdir("controller 阅读全文
posted @ 2014-03-11 15:44 ggaaooppeenngg 阅读(2198) 评论(0) 推荐(0) 编辑
摘要: package i.work;import java.text.ParseException;import java.text.SimpleDateFormat;import java.util.Date;public class Timeformat { // 将字符串转为时间戳 public static long getTime(String user_time) { long l = 0; // 默认的时间字符串格式 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'... 阅读全文
posted @ 2014-03-06 16:02 ggaaooppeenngg 阅读(2213) 评论(0) 推荐(0) 编辑