跳转至

2016

等时圆

最近学校老师讲了一下等时圆。先从这个题讲起:

在同一个地方向不同倾角光滑斜面用不同的初速度上滑,到达最高点所用时间相等,求最高点的轨迹是什么?

A. 直线 B. 椭圆 C. 抛物线 D. 圆

当时做这个题目的第一想法是把 x 和 y 座标表示出来:

\[ \frac{1}{2}gsin\theta{}t^2=l, y=lsin\theta, x=ycot\theta \]

然后就傻眼了,并得不到 x 与 y 的关系式。当然了可以求出几个点,强行带入二次曲线通式求解。不过想了想还是用解析几何的方法去做吧:

\[ \frac{1}{2}gsin\theta{}t^2=\sqrt{x^2+y^2}, sin\theta=\frac{y}{\sqrt{x^2+y^2}} \]

这么一代入,显然是圆。但既然这是物理题,可不可以用物理方法做呢?

可以,这就是等时圆。

啥叫等时圆?

等时圆就是,在一个光滑圆环上选择任意一点,让一个小球从这个点沿着光滑直杆到圆的最低点,无论这个点在哪里(最低点不算哈),时间都是一样的。怎么证明?

很简单:设小球与最低点连线与数值方向上夹角为\(\(\theta\)\),那么

\[ s=2Rcos\theta, \frac{1}{2}gcos\theta{}t^2=s \]

你会发现 t 与\(\(\theta\)\)无关。证明完毕。

其实也可以倒过来:从圆的最高点往各个方向下滑,到达圆周时间相等。

好了,到此为止内容都没什么,但你会想问这和前面那道题目有什么关系呢?这怎么等时圆?重力往下诶。运动可是往右上方。

Here comes the black magic :)

我们考虑向下滑到最低点的那个等时圆,在这个圆周上滑倒最低点的时间都相等。好,我们把这个图沿着竖直方向旋转 180 度形成一个球,想想这个球上每一个点到最低点时间是不是也一样?那么考虑逆过程,让小球从斜面上滑下来,我对刚才的球体再竖着切一刀,得到的平面不就是题目中那个吗?得证。

当然了最好能有动画说明,限于本人时间问题暂时不提供 ^_^

A good way to show git diff for compressed files

I have found a good way to track changes in .gz files: Add these to ~/.gitconfig:

[core]
  attributesFile = ~/.gitattributes
[diff "zip"]
  textconv = unzip -p
  binary = true
[diff "gz"]
  textconv = gzcat
  binary = true
[diff "bz2"]
  textconv = bzcat
  binary = true
[diff "xz"]
  textconv = xzcat
  binary = true
[diff "tar"]
  textconv = tar -O -xf
  binary = true
[diff "tar-bz2"]
  textconv = tar -O -xjf
  binary = true
[diff "tar-gz"]
  textconv = tar -O -xzf
  binary = true
[diff "tar-xz"]
  textconv = tar -O -xJf
  binary = true

[diff "odf"]
  textconv = odt2txt
[diff "pdf"]
  textconv = pdfinfo
[diff "bin"]
  textconv = hexdump -v -C

And these to ~/.gitattributes:

*.tar diff=tar
*.tar.bz2 diff=tar-bz2
*.tar.gz diff=tar-gz
*.tar.xz diff=tar-xz
*.bz2 diff=bz2
*.gz diff=gz
*.zip diff=zip
*.xz diff=xz

*.odf diff=odf
*.odt diff=odf
*.odp diff=odf
*.pdf diff=pdf
*.exe diff=bin
*.png diff=bin
*.jpg diff=bin

And then you can git diff for .gz files.

Codes are adapted from https://gist.github.com/RsrchBoy/11197048 and https://git.wiki.kernel.org/index.php/GitTips#Getting_a_plain-text_diff and https://gist.github.com/kbaird/2654115.

The end of senior two

Finally the end of Senior 2 arrives. I'm on the way to Senior 3. The summer vacation is rather short which is really common in China. These days I have been diving into Emacs by subscribing both emacs and emacs-devel mailing list. It contributes to my English as well. I can learn a lot of new words and expression thanks to the nice and convenient feature of looking up a word in iOS.

Exciting new software updates

Just got a piece of great news: GHC 8.0.1 is out! See the announcement [here][http://article.gmane.org/gmane.comp.lang.haskell.ghc.devel/11928].

So excited! And Emacs 25 release will be out soon. Using Emacs 25.0.94 now. Many new features available. See [this][http://puntoblogspot.blogspot.com/2016/05/emacs-251-news.html] for more information.

Recently I have finally started to use mu4e and gnus. What makes it truly great is that they integrate org, bbdb and so on.

Having a bad cold. Really annoying.

Okay, here comes the interesting links:

https://glyph.twistedmatrix.com/2015/11/editor-malware.html

http://kitchingroup.cheme.cmu.edu/blog/2016/04/07/Writing-hy-code-from-hy-code/

https://github.com/holomorph/transmission

https://github.com/bergey/org-babel-diagrams

http://ess.r-project.org/

http://projects.haskell.org/diagrams/

Tips on git shallow clone

Just learned a new tip on git shallow clone. As you know, some repository are really really large, such as emacs and linux. Cloning is slow and unstable. And there is no way to pause and resume a git clone. So I use shallow clone to clone them. But what if I want to clone other branches?

From here: http://stackoverflow.com/a/27393574/2148614

git remote set-branches origin '*'

Listen and write down subtitles of Cameron's speech

Here is the subtitle:

We meet in a week that could change the United Kingdom for ever. Indeed, it could end the United Kingdom as we know it. On Thursday, Scotland votes, of the future of our country is at stake. On Friday, people could be living in a different country with a different place in the world and the different future ahead of it. This is the decision that could break up our family of nations and rips Scotland from rest of the United Kingdom. And we must be very clear, there is no going back from this. No re-run. This is a once and for all decision. If Scots vote 'yes', the U.K. will split and we will go on separate ways forever. When people vote on Thursday, they are not just voting for themselves, but for their children and grandchildren and the generations beyond. So I want to speak very directly to the people this country today about what is at stake. I believe I speak for millions of people across England, Wales, and North Ireland and many in Scotland too who would be utterly heart-broken by the break-up of the United Kingdom, utterly heart-broken to wake up on Friday morning, to the end of the country we love, to know that Scots will no longer join with the English, welsh-man, Irish, in the army, navy, and air force. [???] U.K. white celebrations and commemorations [???] U.K.'s fourteen teams in the Olympics to the British lines. The United Kingdom, would be no more, no U.K. pension, no U.K. passports, no U.K. pound. The greatest example of the [???] in the world have ever known of openness of people of different nationalities and face coming together as one, would be no more. It would be the end of the country that lodged the enlightenment(?) and abolished the slavery and drove the industrial revolution and defeated fascism. The end of a country that people around the world respect and admire. The end of a country that all of us call home. And you know what, we built this home together. It's only become Great Britain, because of the greatness of Scotland because of the thinkers the writers the artists the leaders the soldiers and inventors that make this country what it is. It's Alexander Fleming and David Hume J.K. Rowling Andy Murray and all the millions of people who play the part in this extraordinarily success story. The Scots who let the charge on pensions and the [???] and social justice we did all this together. For the people of Scotland to walk away now, we will be like painstakingly building a home and then [???] the door and throwing away the keys. So I would say that everyone voting on Thursday, please remember this is just [???] country. This is the United Kingdom. This is our country. And you know what makes it a truly great country, it is not a [???]. It is our values. British values. Fan of freedom, justice. The values that say wherever you are whoever you are, your life has dignity and worth. The values that say we don't work on by when the people are sick. We do not ask for your credit card in the hospital. We don't turn our backs when you get old and frail. We don't turn a blind eye or cold heart to people around the world from repair and cry and for help. This is what Britain means. This is what makes our country 'Yes the greatest on Earth'! And it is why millions of us could not bear to see that country ending for good for ever on Friday. Now i know that many people across Scotland were planning to vote yes. I understand why this might sound appealing. It is the promise of something different. I also know that the people who running the 'yes' campaign painting a picture of Scotland that is better than everywhere. And they can be good painting the picture. But when something looks too good to be true, that is usually because it is. And it's my duty to be clear about the lightly consequences of a 'yes' vote. Independence, would not be a trial separation but would be a painful divorce. As a Prime Minister, I have to tell you what that would mean. It would mean we no longer share the same currency. It would mean the arm forces we built up together over centuries being splitted up for ever. It would mean our pension funds being sliced up at some cost. It would mean the borders we have would become international and may no longer be so easily crossed. It would mean the automatic support that you currently get from British embassies when you are traveling around world the that would come to end. It would mean over half of Scottish [???] suddenly from one day to the next begin provided by banks in a foreign country. It would mean the interest rates in Scotland are no longer set by the bank with England's robust ability and security that promises. And it would mean for many banks that remain in Scotland, if they ever gotten to travel, it will be Scotish taxpayers and Scottish taxpayers and loan, that will bare the costs. It would mean that we no longer pull exhausted across the whole of out United Kingdom to pay for institutions [???] national health service or our welfare system. This is what guess work, there are no question marks, no maybe this, or maybe that. The nationalists want to break up U.K. funding on pensions, the U.K. funding on health care, the U.K. funding and comprehensive protection on national security. These are the facts. This is what would happen and end to the things that we should share together. And people in Scotland must know these facts before they make this once and for all decision. And one of the consequences is not to scare [???]. It is like warning a friend about the decision that they might take that will affect the rest of their lives and the lives of their children. I [???] this because I don't want the people of the Scotland to be sold a dream that disappears. Now I know that some people say we have heard about the risks and uncertainties, but we still want change. And look, the United Kingdom is not a perfect country. The country is, of course, constantly changing and improve people's lives. No one is content when there are still children living in poverty. No one is content when there are people struggling and the young people not reaching their full potential. And yes, of course, every political party is different, but all of us, all of us, conservatives, labor, [???], nationalists, we are all on a constant mission to change our country for the better. The question is, how to you get that change. And for me, it is simple. You don't get the change you want, by ripping your country apart. You don't get change by underlying your economy and damaging your businesses and diminishing your place in the world. But you can't get real concrete change on Thursday. If you vote 'no', businesses usual is not on the [???] paper. The status clown is gone. The campaign has swepted away. There is no going back to the way things were. A vote for 'no', means real change. If we [???] that change in practical terms, with a plan and a process. If we gotta know vote on Thursday that will trigger a major unpresidentive program of devolution with the [???] powers for the Scottish [???]. Major new powers will protest spending. Some welfare services will have agreed that time table for that stronger Scottish [???], a timetable for bringing that new powers that will go ahead in frozen [???]. White paper by November put into draft [???] by January, this is the timetable that is now agreed by all the main political parties in [???]. And I am prepared to work with all the main parties to deliver this during 2015. So a 'no' vote actually means faster, fairly, safer and better change. And this is vital point. Scotland is not a observer in this fairs of this country. Scotland is shaping and changing the United Kingdom for the better. Also did they [???] at any point in the last three hundred years. And Scotland will continue to help shape the constitution of our country. And Scottish people who enjoys the [???]  without losing the U.K. pension, the U.K. pound and the U.K. passport. Real change is Scotland's for the taking. The [???] and make [???] decisions but with this security and being in the United Kingdom and with idol risks of [???] alone. It is the both well or both worse. The Scotland's identity is your [???] strong Scottish culture, strong Scottish art, and strong [???] Scotland. And in the last fifteen years, you built a strong British [???]. Not all [???] institutions but a permanent one. So the vote on Thursday, it is not about whether Scotland is a nation. Scotland is a proud strong successful nation. The vote on Thursday is about two competing nations for Scotland's future. And that's the nationalist's vision. Narrowing down, going alone, breaking all ties with the United Kingdom. Or there is the patriotic vision, they strongs Scottish nation allied to the rest of the United Kingdom with its own strong Scottish Parliament. And it's hard. And with the benefit of working together in the U.K on [???] on pensions on health care funding, currency and interest rates. It is really the best of both wills. And it's the best way to get real change and secure a better future for your children and your grandchildren which all this vital debate is all about. [Clap Drink Water] And speaking of family, there is quite simply how I feel about all of this. We're a family. The United Kingdom is not one nation. We are four nations in a single country. That could be difficult but it is wonderful. Scotland, England, Welsh, North Ireland, different nations with individual identities competing with each other, even in time in raging each other. But It still mean so much stronger together. We're a family of nations. And why should the generations of that family be forced to choose whether to identiy only with their emperor or only with London. Why should they have to choose which embassy they want to go to when they are in trouble abroad. Or pack that passport when they go to see friends, loved ones and family. A family is not a compromise or second best. It is the magical identity that makes us more together than we can ever be apart. So please, do not break this family apart. In human relations, it is almost no good thing to turn away from each other to put up walls or score new lines on the map. Why should we take one Great Britain and turn it into separate smaller nations. What is that an answer to? How will that help ambitious young people who wanna make the mock on the world. Or [???] just want security. Or the family relying on jobs that will made in the U.K. Let no one fool you, that 'yes' is a positive vision. It is about dividing people. It is about closing doors. It is about making forigners our friends and family. That is not a optimistic vision. [Clap] The optimistic vision is about our family of nations staying together. Therefore, each other in the hard times, coming through the better times, we're just pulled through the great reception together. If we're not moving forward together, the road had been longer but it is finally lead upwards. And that's why I ask you to vote 'no' to walking away. Vote 'no' & you are voting for a bigger and broader and better future of Scotland. And you are investing in the future for your children and grandchildren. So this is our message to the people of Scotland: we want you to stay. Head hard and sow we want you to stay. Please don't mix up the temporary and permanent. Please don't think I am frustrated with politics right now and I just walk out of the door and never come back. If you don't like me, I won't be here for ever. If you don't like this government, it won't last for ever. But if you leave the United Kingdom, that will be for ever. Yes, the different parts of the U.K. do not always see eye to eye. Yes we need change, we'll deliver it. But to get that change together bright future would don't need to tear our country apart. [Yeah and Clap] In two days' time, this long campaign will be to an end. And you stand on the [???] of the billing board. I hope you ask yourself this: will my family and I truly be better off? By going alone? Will we really be more save and secure? Do I really want to turn my back on the rest of Britain? And why it is that so many people across the world asking why would Scotland want to do that? Why? And if you don't know the answers of these questions, then please vote 'no'. At the end of the day, all the eyes on this campaign can be rejuiced to a single fact. We are better together. As you reach your final decision, please, please, don't let anyone tell you you can't be a pride Scot and a pribe Brit. [Clap] Please, don't lose faith in what this country is and what we can be. Don't forget what a great United Kingdom you are a part of. Don't turn you back to what is the best family in the nations in the world. And the best hope for your family in this world. So please from all of us, vote to stick together, vote to stay, vote to save our United Kingdom. Thank you. [Clap and The End].

Logo is a lisp dialect

Most of us have learnt how to use PCLogo to draw some graphics. Logo is a dialect of Lisp in fact, so most of us used a Lisp dialect at a early time! For some people, it is earlier than C++. Cool.

I'm here to share some interesting links. I do not have much time writing the blog now.

Recently I have been working on CodeFalling/MacGesture on Github. If you are interested in it, go and have a look.

Here are the links to share: https://twitter.com/PoolpOrg/status/694593152670437376 https://github.com/wellle/targets.vim http://thecodelesscode.com/case/225 https://twitter.com/zhangyuze320602/status/706457155763712000

I have done reading the biography of Steve Jobs. Great book.

Using chinese pyim

Recently i have been using tumashu's chinese-pyim. It's great to write Chinese right in Emacs. But as the personal dict is empty, this must be a hard time for me to build it. And i have found several bugs, too. After all, this project is great. I have donated some money to it.

Unix nice

I just saw this interesting tweet:

Unix系统的每个进程,都有一个nice值。这个值越大,优先级越低。然后,还有一个nice命令,每运行一次,指定进程的nice值+10。它的意思就是做人要nice,把更多的CPU时间留给别人。nice值越高,你留给自己的份额就越少。

From hereby @ruanyf.

And i didn't known that until now. Cool! The name 'nice' is nice, too.

Don't worry if you can't read Chinese. See also here and here.

Start next term tomorrow

My term starts tomorrow. Sad. Homework haven't finished. I went to Guangzhou for GDKOI thie weekend, and i haven't known the result. It should be bad. I have no confidence at all. I may write less when this term starts. The second term of Senior 2 should a hard time for me. That's all. Sorry for the laziness.

Building emacs git version with xwidgets and modules in archlinux

First you need to install these packages:

sudo pacman -S git autoconf automake gtk3 webkitgtk
git clone --depth 1 https://github.com/emacs-mirror/emacs.git (or git protocol if you like)
cd emacs
./autogen.sh all
./configure --with-xwidgets --with-x --with-x-toolkit=gtk3 --with-modules
make
cd lisp
make autoloads
make
make
make

Until you got everything ok.

Then you can just:

cd src
./emacs

And then, M-x webkit-browse-url RET: xwidget-webkit

Also, test the modules feature using syohex/emacs-qrencode: qrencode

I'm using ssh and X11 Forward to show Emacs in Mac OS X! Cool!

Screen Capturing Tips in macOS

I'm sure many people have already known this. But i haven't memorize it yet.

How to screen capture:

Shift+Command+3: Capture fullscreen.
Shift+Command+4: Capture region.
               : Press space to capture window. 
               : Hold option and drag, then
               : you will capture a region with its center in where you started dragging 
               : and one of its corners under your cursor.
Ctrl+OneOfTheTwoAbove: Capture to clipboard.
defaults write com.apple.screencapture location: Change the default location storing the images.

Apps enhancing the snapshots: Snappy and Mapture.

See more detailed here.

News

Oh StartSSL places its PKI in 360's server. You know, i hate 360. SO please beware if the website is using StartSSL. Here is the link.

And here comes the vim-tips:

You probably know that 'u' is undo. Do you know that Ctrl-R is redo?
It comes from here.

Good software engineering rules

I saw a great saying:

No code runs faster than no code.

No code has fewer bugs than no code.

No code uses less memory than no code.

No code is easier to understand than no code.

It comes from here.

And i strongly recommends this article for a better understanding of monads.

The beginning of my blog

This is the first blog here.

I am talkative deep inside, but i do not have enough opportunities to express myself. Most of the listeners can't understand me. So i would like to write something on my blog. Kinda outdated media, though. Whatever, the first step is always the hardest.

That's all. Thanks Emacs, Github Pages, Jekyll and Ruby to support this blog.