• Fedora 22 新内核下 BCMA 43142网卡无WiFi的解决

    先说解决办法:

    sudo dnf install akmod-wl
    

    Fedora的更新一向很快,带来的问题之一就是兼容性。

    比如4.1.5的kernel下,并没有兼容bcma43142的内置driver。

    第一反应是去下载内核编译,然并卵。

    编译之后可以搜寻wifi,但是不能连接wpa2加密的wifi。

    最后灵机一动想到了那个闭源驱动的rpm源,安装之,解决。

    睡觉。

  • 撸了个node的微型web server

    |

    Github 链接在此

    (明明是全是coffee文件强行叫.js,凑表碾)


    yue.js is a tiny web server based on Node.js and CoffeeScript, supporting route, session, database (based on mongodb and is not completed yet..) and static file.

    已经实现的功能有:路由(Router),静态文件(Static File), Session相关。

    Router用了一种简单粗暴的实现,即把输入的uri解析之后拼成正则保存下来,接受请求的时候一个个正则去match。

    主要的想法是做成松散的结构,支持各种中间件,虽然现有的核心功能都是写的比较死的,但是后续的扩展方式应该是各种中间件。

    其中把对request和response的相关操作封装在了一个connection对象里,各种中间件可以给它添加属性方法之类。

    这东西其实是为了我的新版博客写的,然后新版博客是想做成spa,于是还有一堆前端的东西要写=。=

    (然而说好的函数式信徒结果写成了依赖副作用的架构)

    (以后再重构吧)

    (以后===说不定就忘记了)

  • 记一次离散作业

    |

    题目是:用C语言写出一个通用算法,用该算法求出下面哈斯图表示的任务被执行的次序。

    哈斯图

    然而是一道很简单的题。

    (然而我作死的写了两百多行c)

    (然而果然用c写东西就像拿小刀砍树能累死人)

  • 许久没发博客

    这段时间为前一阵的天真付出了代价,各种ddl轮番上阵简直醉。

    最近在看SICP和CSAPP,果然应了贪多嚼不烂这句话。买了很多书确并不能静下心来读。SICP构建树结构那一章看了两个星期仍然没有看完= =

    一直想写的web游戏引擎,也因为时间的关系一直坑在那里,徘徊在绘制直线和显示图像的边缘。

    倒是学了学coffeescript,感觉写起来和python一样如沐清风233

    (然而只是为了更新博客而更新博客么)

  • Generating Identicons by Python

    |

    If a github’s user has not upload an avatar, github will use gvatar or generate an image basing on the email(gvatar also offers this service).This kind of image called identicon.

    This code does the similar thing in a simple way,using the md5 of a string to generate an identicon.

    #英语渣表示写这段话好吃力啊= =

    example:

    input: hello world

    generated:

  • Is object-oriented programming both anti-modular and anti-parallel by its very nature? Why or why not?

    |

    (ref: http://www.quora.com/Is-object-oriented-programming-both-anti-modular-and-anti-parallel-by-its-very-nature-Why-or-why-not)

    According to a blog post from Professor Robert Harper, the CMU Computer Science department is removing the required study of O-O from the Freshman curriculum for this reason. But why?

    Jon Moter’s answer:

    While I can’t climb into Professor Harper’s brain, I figure what he’s pointing to is that OOP is a programming paradigm that’s based on state changes. You create a User object, you call methods on it, the state of the user changes, etc.

    In contrast, (pure) functional programming has no side-effects, so calling a function doesn’t cause any state change. It just returns information based on the parameters passed in.

    So if you assume the world is heading for a direction where computer code is written to run on massively parallel distributed systems, it’s far easier to design code written in a functional manner, since there is no shared state to manage. If you have hundreds or thousands of processors running on GPUs or in hardware clusters, you can distribute computations across all of them, leveraging a programming paradigm that’s better suited for that.

    I don’t think procedural and OO programming is going to magically go away any time soon, but it’s interesting that he’s starting his students thinking in terms of functional and imperative programming, rather than procedural or OO.

  • 用上了instantclick

    |

    一开始是看到谭总博客里面那纵享丝滑的像是ajax的加载

    (还有上面那个神奇的进度条)

    然后就发现了这个神奇的instantclick

    利用pjax,在鼠标放到a上的时候开始加载页面,当你点下鼠标的时候页面已经加载完毕了,这时只要替换页面的title和body,纵享丝滑~

    但是评论框比较蛋疼,因为是内嵌的script,在每次加载页面之后它并没有重置重新加载

    解决的办法是用上instantclick提供的change事件

    <script data-no-instant>
    var disqus_shortname = 'hcyue';
    InstantClick.on('change', function(isInitialLoad) {
    if (!isInitialLoad) {
    // update Disqus thread
    if (document.querySelector("#disqus_thread")) {
    if (typeof DISQUS === 'undefined') {
    var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
    dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
    } else {
    DISQUS.reset({
    reload: true,
    config: function () {
    this.page.identifier = window.location.pathname;
    this.page.url = window.location.toString();
    }
    });
    }
    }
    }
    });
    InstantClick.init();
    </script>

    判断在内容变化时页面存不存在评论框,决定是否加载远程脚本。

    改天研究一下这个instantclick,虽然纵享丝滑但是似乎毛病略多

  • hexo蛋疼升级

    |

    蛋疼的升级。。

    一开始是莫名的插件错误,让我好生看源码,看着看着发现不对啊这为什么报错只能是api问题啊

    然后到hexo.io一看,果然。。升级了3.0,还是”the API has breaking changes”的节奏

    按照文档里写的去掉版本号,npm install hexo-cli -gnpm install hexo --save ,然后发现folder又要重新出屎化,出屎化完了还要重新安装全套插件,还要重新设置环境变量。。。

    我说你一个本地跑的静态博客弄这么多api变化干嘛呢。。。

  • starsector

    |

    starsector是款好游戏。

    但是是用java开发的,可惜了。