09 2014 档案

摘要:In linux, you can use the ncurses library to use the terminal as a text buffer: move the cursor around, and write text. It can also draw windows and o... 阅读全文
posted @ 2014-09-30 15:42 zmiao 阅读(108) 评论(0) 推荐(0) 编辑
摘要:Using write and read system call. Following is an example:blk.h:#include #include #include #include #include #include struct data{ char s[20]; i... 阅读全文
posted @ 2014-09-30 13:54 zmiao 阅读(132) 评论(0) 推荐(0) 编辑
摘要:要说明的是,在删除文件的时候,我并没有实现文件块区以及i节点的清除操作,众所周知,那样很耗时,和很多实现一样,我只是记录了一些信息,表示这个文件块或者inode字段是可以随时覆盖的。 阅读全文
posted @ 2014-09-29 06:29 zmiao 阅读(120) 评论(0) 推荐(0) 编辑
摘要:转自here我一向坚持的原则,那就是任何东西的根本性的,本质上的原理以及背后的思想都是及其简单的,所谓的复杂性都是优化与策略化的扩展带来的,正如TCP一样,UNIX的文件系统也不例外!我们必须知道,什么是最根本的,什么是次要的。对于UNIX文件系统,最根本的就是其布局以及其系统调用接口,一个处在最低... 阅读全文
posted @ 2014-09-28 15:05 zmiao 阅读(269) 评论(0) 推荐(0) 编辑
摘要:To modify an existing session with "keep alives" to maintain your connection follow the steps below:Open the PuTTy application and navigate to theOpti... 阅读全文
posted @ 2014-09-27 04:15 zmiao 阅读(249) 评论(0) 推荐(0) 编辑
摘要:In UNIX, tar is the most useful tool to compress files (just like zip in Windows.)To compress, input: tar -cvzf file.tar.gz inputfile1 inputfile2to u... 阅读全文
posted @ 2014-09-26 16:51 zmiao 阅读(175) 评论(0) 推荐(0) 编辑
摘要:problem is like this:Input is an int array: -> 10, 85, 96, 80, 93, 54, 3, 26, 4, 37Output is an integer, in this example, you should return 3 (because... 阅读全文
posted @ 2014-09-26 13:59 zmiao 阅读(133) 评论(0) 推荐(0) 编辑
摘要:When a file name is deleted from the directory tree, the file name's connection to the inode number is severed. If the file name is the last "link" to... 阅读全文
posted @ 2014-09-25 13:53 zmiao 阅读(165) 评论(0) 推荐(0) 编辑
摘要:Make your first OS. (MikeOS).check out here 阅读全文
posted @ 2014-09-25 06:29 zmiao 阅读(90) 评论(0) 推荐(0) 编辑
摘要:callback is nothing but passing the function pointer to the code from where you want your handler/ callback to be invoked.check here 阅读全文
posted @ 2014-09-23 07:09 zmiao 阅读(118) 评论(0) 推荐(0) 编辑
摘要:FUSE is particularly useful for writing [ vritual ] file system. Unlike traditional filesystem that essentially save data to and retrive data from dis... 阅读全文
posted @ 2014-09-20 15:48 zmiao 阅读(125) 评论(0) 推荐(0) 编辑
摘要:Java is strictly pass-by-value. which means, when you pass a variable to a method, the method will just make a copy of that varible and use that copy,... 阅读全文
posted @ 2014-09-20 08:58 zmiao 阅读(222) 评论(0) 推荐(0) 编辑
摘要:Is it possible to write a swap method in java? these two variables will be primitives.It's not possible, without any objects or arrays. (Java passes s... 阅读全文
posted @ 2014-09-20 08:48 zmiao 阅读(137) 评论(0) 推荐(0) 编辑
摘要:the /tmp folder of linux will be cleaned every time when you reboot.Well, actually, It doesn't "delete on reboot"; it only exists in RAM in the first ... 阅读全文
posted @ 2014-09-20 08:08 zmiao 阅读(152) 评论(0) 推荐(0) 编辑
摘要:BFS (Bridth First Search) can be implemented by a queue.Procedure is like this: (Q is Queue)1, Put 1 in Q : ->1 (front) 2, Read the front of Q (which ... 阅读全文
posted @ 2014-09-20 04:07 zmiao 阅读(162) 评论(0) 推荐(0) 编辑
摘要:check here.Basically the compiler will insert unused memory into a structure so that data members are optimally aligned for better performance. 阅读全文
posted @ 2014-09-19 04:28 zmiao 阅读(106) 评论(0) 推荐(0) 编辑
摘要:任何东西的根本性的,本质上的原理以及背后的思想都是及其简单的,所谓的复杂性都是优化与策略化的扩展带来的。 阅读全文
posted @ 2014-09-18 11:25 zmiao 阅读(112) 评论(0) 推荐(0) 编辑
摘要:http://www.cprogramming.com/tutorial/shared-libraries-linux-gcc.htmlBasically, 2 steps: 1) make the lib. 2) put the lib in /usr/lib and ldconfig (upda... 阅读全文
posted @ 2014-09-17 07:39 zmiao 阅读(95) 评论(0) 推荐(0) 编辑
摘要:check here.tip: 当使用remove方法时,index后边的元素要自动前移。Nothing special. 阅读全文
posted @ 2014-09-16 16:26 zmiao 阅读(81) 评论(0) 推荐(0) 编辑
摘要:Arrays in Java are of fixed size that is specified when they are declared. To increase the size of the array you have to create a new array with a lar... 阅读全文
posted @ 2014-09-16 16:20 zmiao 阅读(134) 评论(0) 推荐(0) 编辑
摘要:It's per-process. Once your process exits, the allocated memory is returned to the OS for use by other processes (new or existing).To answer your edit... 阅读全文
posted @ 2014-09-16 06:56 zmiao 阅读(126) 评论(0) 推荐(0) 编辑
摘要:These are two different concepts, you cannot compare them. What the difference between the skunk and the moonlight?Null pointer is a special reserved ... 阅读全文
posted @ 2014-09-16 05:28 zmiao 阅读(180) 评论(0) 推荐(0) 编辑
摘要:1) Allocate a chunk of memory big enough to satisfy the request, and return a pointer to it.2) Remember which chunks of ram are in use and which aren'... 阅读全文
posted @ 2014-09-15 13:49 zmiao 阅读(107) 评论(0) 推荐(0) 编辑
摘要:FUSE: File system in USErspace.So what is a file system?A file system maps file paths to file contents and metadata.Metadata includes modification tim... 阅读全文
posted @ 2014-09-11 14:18 zmiao 阅读(162) 评论(0) 推荐(0) 编辑
摘要:The power button activates the power supply in the PC, sending power to the motherboard and other components.The PC performs a power-on self-test (POS... 阅读全文
posted @ 2014-09-11 08:47 zmiao 阅读(272) 评论(0) 推荐(0) 编辑
摘要:if I want to repeat "hello" four times as a new string-> "hellohellohellohello". I can:return new String(new char[4]).replace("\0", "hello") 阅读全文
posted @ 2014-09-10 17:59 zmiao 阅读(487) 评论(0) 推荐(0) 编辑
摘要:Refresh + Power 阅读全文
posted @ 2014-09-10 10:41 zmiao 阅读(135) 评论(0) 推荐(0) 编辑
摘要:http://www.papervisions.com/implementing-system-call-in-minix-os/ 阅读全文
posted @ 2014-09-09 09:15 zmiao 阅读(118) 评论(0) 推荐(0) 编辑
摘要:String text=new Scanner(File('input.txt')).useDelimiter("\\A").next();java version! 阅读全文
posted @ 2014-09-07 14:12 zmiao 阅读(136) 评论(0) 推荐(0) 编辑
摘要:Simple idea: just use a TIMEOUT, if no answer after a certain seconds, just re-deliver! 阅读全文
posted @ 2014-09-06 15:00 zmiao 阅读(121) 评论(0) 推荐(0) 编辑
摘要:- parent of all the drivers and servers- when a driver or server dies, RS collects it.- RS checks a table for action to take, e.g: restart it.- RS als... 阅读全文
posted @ 2014-09-06 14:57 zmiao 阅读(197) 评论(0) 推荐(0) 编辑
摘要:One efficient way to compute the GCD of two numbers is to use Euclid's algorithm, which states the following: GCD(A, B) = GCD(B, A % B) GC... 阅读全文
posted @ 2014-09-05 10:17 zmiao 阅读(142) 评论(0) 推荐(0) 编辑
摘要:System.out.println(""+ 1/2);得不到0.5,只能得到0.要想打印出浮点数,必须除数和被除数至少有一个是浮点数,像这样:System.out.println(""+ 1/2.0);就可以了。 阅读全文
posted @ 2014-09-04 16:29 zmiao 阅读(186) 评论(0) 推荐(0) 编辑
摘要:A patch captures the changes of two different files (oldfile and newfile). Given the oldfile and the patch, one can use the patch program to create th... 阅读全文
posted @ 2014-09-03 03:44 zmiao 阅读(219) 评论(0) 推荐(1) 编辑
摘要:Even though the UNIX system introduces a number of innovative programs and techniques, no single program or idea makes it work well. Instead, what mak... 阅读全文
posted @ 2014-09-01 17:22 zmiao 阅读(184) 评论(0) 推荐(0) 编辑
摘要:使用 vi 来编辑一个文件。当您键入 vi 时,在 inode 表中找到 inode 编号之后,才允许您打开该 inode 。在 vi 的编辑会话期间,更改了该 inode 中的某些属性,当您完成操作并键入 :wq 时,将关闭并释放该 inode 。通过这种方式,如果两个用户试图对同一个文件进行编... 阅读全文
posted @ 2014-09-01 11:32 zmiao 阅读(132) 评论(0) 推荐(0) 编辑