塞纳河

傍晚在塞纳河边散步,看到一个小酒吧,想着河边来瓶啤酒很有格调。跟服务员讲要local啤酒。店员问ipa可以不?那很好啊。付完钱一尝,不对啊。一看这是ipa soda。

soda

平装书

新买了一本书,偶然看到印刷日期是下订单后一天。搜了下发现亚马逊平装书很多都是按订饭按需印刷的。

book

PITT

今天算是正式的离开Pittsburgh了,觉得应该写些什么。在匹兹堡生活了两年吧,期间认识了许多人,经历了许多事,而我应该也有了很大变化吧。最初磕磕碰碰一路到美国,辗转到oakland,在Tennyson 下车,期间种种历历在目。

– Jul 27, 2014

梅尔伍德二百二十二号,六零六室。许多人在这里相识,许多故事在这里发生。

2012年8月10日,我从北京国际机场起飞,一路辗转芝加哥 - 纽约,最后乘火车抵达匹兹堡。来途并不顺利,而一开始的生活有美好,但也有许多沮丧。今天来美两年整,这两年基本都是在pitt度过的。而这个城市也从陌生,到熟悉,直至最后变成像一种家乡一样的存在。在那里,我认识了很多朋友,经历很多事情,有快乐,有忧愁,有居丧,也有过踌躇满志,那里有多少个辗转反侧的夜晚啊。我有许多改变,我跟朋友说,我逐渐学会了如何生活 - 更加热情的享受生活的美。 …

PITT.雨.夜

<audio controls class=“audio_controls "

preload="metadata"

style="
	
	"
data-info-title="2014年7月27日凌晨,录于梅尔伍德二百二十二号,六零六室。"
<source src="pitt.rain.night.m4a"
	>

Your browser does not support the audio element

FIXING TIM

Name: Fixing TIM Source Code: github.com/cadmuxe/biovis Publish: Fixing TIM: Identifying Functional Mutations in Protein Families through the Interactive Exploration of Sequence and Structural Data Reword: Best Visualization Award in the IEEE BioVis Contest 2013 Keywords:Tech: Python, C, Qt, OpenGL, and MySql

It is a bioinformatics visualization tool that blend spatial and non-spatial information. The tool helps bio-researchers visually mining, analyzing protein data and  identifying protein mutations across family structural models.

Python as the main language and C for extensions, Qt provide the GUI, OpenGL for 3D rendering.

Read more

TRAFFIC SIMULATION

Name: Traffic Simulation (Spring, 2013) Tech: Python, PyGame(Rendering)

This is inspired by the Nav2Nav Project.

I participated in the Nav2Nav project at GISLab, ISchool, Unversity of Pittsburgh. Nav2Nav system try to improve safety by enable communication between Navigation Systems. The mission of my team is feasibility study of the system which is achieved by simulation.

After the Nav2Nav project, I wrote this project to practice some ideas. The core idea is that, each entity(vehicle) have it’s own vision and logical. It can “see” other cars and roads, then reaction to outside environment. This design give the system the ability to simulate accident. Imagine, a driver can not see other cars because a barrier(a building), then it may have a accident.  The road network can be generated from real map, it can calculate the traffic lane automatically(the number of lanes depending on  the attribute of map info. or a default value).

Read more

PALS

Name: PALS (09/2013-04/2014) Tech: PHP, PostGIS, Javascript, Node.js, Socket.js, handlebars.js, OpenLayers, JQuery

This project mainly contain two parts: web system and a data tool.

The web system part, is to integrate three components(PAM- a personalized accessibility map, SoNavNet - a social navigation network and PNS - pedestrian navigation service) into one system. The purpose of  the new system is to provide a service oriented system which means our system needs to be loosely coupled, and modules should be self-contained.

Read more

DTR

Name: DTR - Distributed information indexing and retrieving (December, 2013) Source Code: github.com/cadmuxe/DTR

It is a distributed system. The system can index and retrieve documents by distributing the calculation and storage into different machines; and the calculation node can join and left the system at anytime.

The system contain one MainServer and at least one ComputationNode which automatically started by the MainServer. And ComputationNode that running on different computers can join into the system. The index data will distribute on all the ComputationNodes, and for all data they will have several duplicated copies(in the implementation the duplicated number is 3).

Read more

MODIFY THE STACK FRAME OF C

For a long time, I’m not so clearly on the process of function call of c. Recently days, when implementing an user level preempt multi-thread library I need to change the stack. Because it begin as an project of OS course, must use setjmp and longjmp but not getcontext, setcontext. Here just to write down what I have learned.

The Structure of stack and calling process

I thought there are lots of material about the stack, here just do a briefly introduce. Here is the structure of x86-64, in fact, because I didn’t contain much detail in here, the different only is the name of register which under x86 is ebp, esp and the length of address is 4 byte but not 8 byte.

Read more

图片保存工具

上周四突然看到Dropbox新发布的javascript的api,能够快速向Dropbox保存文件。就像试一试,并且鉴于最近使用的火狐ScrapBook插件出了问题(以前能保存整个网页,现在只是保存网址,大概看了设置好像也不能做更改-_- )于是就想写个保存图片的小东西。参考Instapaper的书签代码,有了以下版本。

ps:开发阶段还没有做通用化处理,但是已经有idea啦。至于测试网站么,1024 :)

function load(){
    var d = document,
    jq=d.createElement('scr'+'ipt'),
        b = d.body,l=d.location;
    var dp=d.createElement('scr'+'ipt');
    jq.setAttribute('src',l.protocol+
        '//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js');
    dp.setAttribute('src',l.protocol+
        '//www.dropbox.com/static/api/1/dropins.js');
    dp.setAttribute('id','dropboxjs');
    dp.setAttribute('data-app-key','*******');
    b.appendChild(jq);
    b.appendChild(dp);
}
function save1024(){
var plist =$($('div#main div.tpc_content')[0]).find('input');
var files=[];
for(var i=0; i < plist.length; i++){
    files.push({'url':plist[i].src});
}
options={'files':files};
Dropbox.save(options);}
load();
save1024();
void(0)

这段代码的关键是动态加入javascript元素后,其内容会自动执行。 这段代码有一个问题是,将其保存为书签后,只有第二次点击才真正有作用。原因是为了方便选取图片元素,加载了jquery,而它需要一定时间才能载入。第二个问题是dropbox提供的api不能提供默认位置,只能选取而且不能新建文件夹。但是我的想法是能自动保存到一个地址,并且自动创建文件夹来存储图片。

所以有了第二个版本,思路是前端post图片的地址到服务器,服务器下载后上传到dropbox。这样很费流量,但是目前也只能这样了。服务器端是flask接受post数据然后传给一个专门下载上传的服务,他们通过socket通讯。

其中花费了不少时间的问题是跨域提交,起初是想在不可见iframe里面通过js进行post,后来发现instapaper是通过form来post数据的,而且这也确实简化了不少,所以有了如下代码:

function save1024(){
    f = document.createElement('iframe');
    f.setAttribute('name', 'f%s');
    f.setAttribute('allowtransparency', 'true');
    f.setAttribute('style', 'border: 0; width: 1px; height: 1px; position: absolute; left: 0; top: 0;');
    document.body.appendChild(f);
    window.frames['f%s'].document.write(
        '<html><body style=""background-color:transparent;">' +
        '<form action="http://localhost:5000/api/saver" method="post" id="form" accept-charset="utf-8">' +
        '<input type="hidden" name="data" id="data" value="">' +
        '</form>' +
        "<scr" + "ipt>function save(datas){var i = document.getElementById('data');" +
        "var f=document.getElementById('form'); i.value=datas; f.submit();}" +
        "</scr" + "ipt></body></html>"
    );
}

这段代码是插入一个透明iframe,内含一个表单和一个用来设置表单值和除法提交时间的函数,经测试能够工作(至少小量数据没问题)。

Read more

RASPBERRY PI

今天刚刚入手了Raspberry PI,Model B,手头正好还有闲余的sd卡,可以直接动手安装系统了,网站提供了几种Image,还是喜欢Arch。

on mac: df -h 查看sd卡的 filesystem路径 diskutil unmountDisk 卸载 sudo dd bs=1m if=arch.img of=sd卡路径

搞定后找不到hdmi的视频线了,不过幸好用的arch,里面已经装好了sshd了,直接登上去就ok了。

Raspberry Pi