Sorting
-How fast can we sort
-It depends on model:)
the model is of what you can do with the elements
e.g
Quicksort θ(nlgn)
Heapsort θ(nlgn)
merge sort θ(nlgn)
insertion sort θ(n2)
so, can we do better than θ(nlgn)?
Continue reading MIT Algorithms (3)
All posts by Cocoa
Swift and Objective-C tweak supporting
With increment of swift, it's not ridiculous that using swift when you do some jailbreak development. If the tweak can get a better UI and I can code easier, there is no reason to refuse swift.
But one thing we should care about is that, Xcode 6 (and later) will link swift's dylib something like @rpath/libswiftDarwin.dylib.
That means if you didn't put those dylib files into a directory named `Frameworks` which right under your executable file's directory, it will just crash when you try to launch them.
Continue reading Swift and Objective-C tweak supportingHUD Time Release!
感觉iOS上的音量、亮度HUD显示的时间略长,于是果断写了个插件来控制HUD的dismiss延时。
你可以在Bigboss和我的Cydia源 ( http://apt.[data deleted].com ) 中找到它。
由于使用了Swift,必须包含Swift-ObjectiveC的dylib,故体积稍大,2.3MB左右。不过是挺不错的UI,衷心谢谢SpringySlider和它的作者!
Continue reading HUD Time Release!磁盘权限错误导致launchd高CPU占用
本来想安静地在某弹幕网站上看看「入門⭐︎道場ルノ」,结果风扇一直以最高速转,一看活动监视器才发现launched的CPU占用达到了80%以上,还有几个进程的CPU使用也在30%到40%之间。
按直觉先kill掉几个进程试试,先拿opendirectoryd开刀。kill之后果然CPU使用率立刻降下来了。可是过了一会儿之后opendirectoryd又出现了,launchd的CPU占用又飙到80%以上。
Continue reading 磁盘权限错误导致launchd高CPU占用Here's to the crazy ones
Here's to the crazy ones: the misfits, the rebels, the troublemakers, the round pegs in the square holes, the ones who see things differently.
They are not fond of rules. They have no respect of status quo. You can quote them, disagree with them, glorify or vilify them. About the only thing you can't do, is ignore them, because they change things. They push human race forward.
Some may see them as the crazy ones. We see genius,because the people who are crazy enough to think they can change the world ... are the ones who do.
自己实现的dd工具
闲来无聊,想仿照一下dd这个ctl,结果还遇到了malloc的一些问题。
malloc: *** error for object 0x100105438: incorrect checksum for freed object - object was probably modified after being freed.*** set a breakpoint in malloc_error_break to debug
打印出0x100105438的内容,一看,原来是ofdev所在的地址,但是我并没有free掉ofdev啊,而且为什么会checksum错误呢?非常奇怪的现象。
现在的处理办法是 : 在用过ifdev和ofdev之后,把这两个字符串清空,就可以一切正常。
C语言指针的一个困惑
暂且是大概明白了可能的原因,不过今天已经没时间继续研究了,就先把代码贴上来吧。
(目前的考虑是和栈有关)
Continue reading C语言指针的一个困惑
MIT Algorithms (2)
1) Divide and conquer
1. Divide
divide the problem (instance) into one or more subproblems
2. Conquer
conquer each problem recursively
3. Combine
2) Merge sort
1. divide into 2 halves
2. recursively sort each subarray
3. to combine the solution
4. merge
Continue reading MIT Algorithms (2)
MIT Algorithms (1)
1) f(n) = O(g(n))
It means there are consts C > 0, n > 0 such that 0 <= f(n) <= c * g(n) for sufficiently large n.
f(n) = Ω(g(n))
It means there are consts C > 0, n > 0 such that 0 <= c * g(n) <= f(n) for sufficiently large n.
O notation, less than or equal to.
Ω notation, greater than or equal to.
Θ notation, less than or equal to AND greate than or equal to.
2) Macro convention
A set in a formula represnts on anonymous function in that set.
3) big O is upper bounds
O notation, less than or equal to.
Continue reading MIT Algorithms (1)
使用LLDB+debugserver调试程序 via USB
最近因为越狱开发,需要用LLDB+debugserver调试iOS上的系统程序,可惜没有Wi-Fi环境,但想到之前写过一篇SSH over USB的blog,于是考虑到通过USB来实现这个需求也是没问题的。