<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3435125723568721085</id><updated>2011-11-28T08:38:30.510+08:00</updated><category term='Qt'/><category term='KDE'/><category term='转载'/><category term='文本编辑器'/><category term='planetKDE'/><category term='图形界面'/><category term='输入法'/><category term='数据结构'/><title type='text'>Blue Blazer</title><subtitle type='html'>Achieve perfection by constant effort and creative will.&lt;br&gt;
Code every day, no matter what...</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://qiacat.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3435125723568721085/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://qiacat.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Wang Hoi</name><uri>http://www.blogger.com/profile/10292518120201202624</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/__wNRAxUWzAo/SfPsoYnYA8I/AAAAAAAAALo/7kQva2_IM8Y/s1600-R/avatar.php%3Fgravatar_id%3Dbdada60af0164d1623bbe46638bbcd20'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>12</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3435125723568721085.post-7598097603096074965</id><published>2009-04-25T12:55:00.008+08:00</published><updated>2009-04-30T18:52:42.762+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='转载'/><title type='text'>One man fight</title><content type='html'>&lt;div class="commentbody"&gt;&lt;div class="md"&gt;&lt;p&gt;从www.reddit.com转载而来：) 受到了鼓舞&lt;br /&gt;&lt;/p&gt;&lt;p&gt;There are many successful one man software projects. I can think of many - you don't have to look very far. For example, Resourcer was made by one guy: Doug McKenna. I believe the game Glider Pro was written by one guy. Woz wrote the BASIC interpreter for the Apple I. I've done one person projects myself to deliver application software before many times.&lt;/p&gt;  &lt;p&gt;My advice is that you don't just demand more people. &lt;span style="font-weight: bold;"&gt;Get their requirements&lt;/span&gt; and &lt;span style="font-weight: bold;"&gt;make a realistic plan&lt;/span&gt; of how you can complete the project by yourself. By "get their requirements" you need to have a good understanding of not only what the software needs to do, but what an acceptable solution might look like. Is it OK to use open source third party libraries in your solution? Whether they will allow this will make a big difference in how long it will take.&lt;/p&gt;  &lt;p&gt;Come up with at least a&lt;span style="font-weight: bold;"&gt; high level design&lt;/span&gt; for the software/system. &lt;span style="font-weight: bold;"&gt;Decompose it into parts&lt;/span&gt;. &lt;span style="font-weight: bold;"&gt;Identify those parts that you know how to write and those where you are going to have to gain additional expertise. Make an estimate as to how long it will take&lt;/span&gt; to make each part. At this stage, your estimate should consist of &lt;span style="font-weight: bold;"&gt;two numbers&lt;/span&gt;. &lt;span style="font-weight: bold;"&gt;The earliest you think it could be finished&lt;/span&gt; if everything goes right and &lt;span style="font-weight: bold;"&gt;the latest it could be finished in the 90% worst case scenario&lt;/span&gt;. For parts of the project you know well, your estimates will be a little tighter. For parts of the project that you don't know well, your estimates will have to be looser. Budget time to get up to speed with any technology you don't know. Be a little generous with yourself here. If you do the project by yourself, it is actually a blessing because you will gain new skills by working in areas outside your normal expertise.&lt;/p&gt;  &lt;p&gt;&lt;span style="font-weight: bold;"&gt;Make a list of any things you might need to buy in order to do the project. &lt;/span&gt;This could be computers, other equipment, software libraries, tools, etc. You might want to shop around for third party libraries to solve some of your problems. For example, let's say you decided to use XML in your project, you might need to shop around for an XML parser. Make sure it meets your technical AND business requirements. For example, can you use LGPL stuff in your project? How about GPL? If you go commercial - do you have the budget? Does the vendor require a royalty? These are just some of the questions.&lt;/p&gt;  &lt;p&gt;Next, &lt;span style="font-weight: bold;"&gt;plan a proposed team that could complete the project&lt;/span&gt;. Your company might prefer to use contractors for this if they do not want the burden of additional full time employees. You probably will need at least one test engineer. This person could be a contractor. Speaking of quality, you need to understand their quality requirements. This will probably be driven by who the customer is and how critical the system is. If your bosses are non-technical, be prepared to answer why betty the office manager can't do your testing or why the users can't just test the system when it is deployed. Explain that while both of these things might have some value, those ideas basically mean that you are testing the software yourself which has risks because programmers tend to get myopic and have a difficult time testing their own code.&lt;/p&gt;  &lt;p&gt;You need to &lt;span style="font-weight: bold;"&gt;have a plan for deploying the solution&lt;/span&gt;. If it replaces an existing solution, then the deployment plan will be more complex.&lt;/p&gt;  &lt;p&gt;Then when you propose it to your bosses, lay out the various scenarios. One where you do everything yourself, then another where maybe it is just you and a test engineer, and then maybe a third solution where you bring in some additional developer(s) who have specific skillsets that complement yours. Explain to them that the benefit of this third solution is that they don't have to pay you to learn technology X where X is important for a specific reason and you don't know X already. If you want to do a great job, you could estimate the costs of each of these solutions for them.&lt;/p&gt;  &lt;p&gt;Also, keep your team as small as possible. If you are hiring developers, make sure they pass a code test. An easy way to do this is to setup a clean machine with just the development environment, pick a topic like Poker and give your candidate a printout of the rules, and ask him to write a program to sort poker hands. It doesn't have to be poker - it could be anything like that. This is the simplest way I know not to hire a complete bozo. Be aware that you might have to interview ten people to find one that is not a bozo. Having a degree - even a PhD - or having worked for a big name company does not mean they know how to program.&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3435125723568721085-7598097603096074965?l=qiacat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qiacat.blogspot.com/feeds/7598097603096074965/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://qiacat.blogspot.com/2009/04/blog-post_25.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3435125723568721085/posts/default/7598097603096074965'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3435125723568721085/posts/default/7598097603096074965'/><link rel='alternate' type='text/html' href='http://qiacat.blogspot.com/2009/04/blog-post_25.html' title='One man fight'/><author><name>Wang Hoi</name><uri>http://www.blogger.com/profile/10292518120201202624</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/__wNRAxUWzAo/SfPsoYnYA8I/AAAAAAAAALo/7kQva2_IM8Y/s1600-R/avatar.php%3Fgravatar_id%3Dbdada60af0164d1623bbe46638bbcd20'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3435125723568721085.post-4633599078066330274</id><published>2009-04-17T18:24:00.004+08:00</published><updated>2009-04-19T14:56:55.656+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='KDE'/><title type='text'>期中考试结束了</title><content type='html'>庆祝中期考试结束，今天给Ark加入了lzma支持 ：）&lt;br /&gt;&lt;a href="http://tukaani.org/xz/"&gt;http://tukaani.org/xz/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;由于Ark有libarchive插件，我其实只需要支持解压纯的.xz和.lzma了。。&lt;br /&gt;&lt;br /&gt;KDE目前从核心库到应用程序都支持lzma压缩算法了。&lt;br /&gt;kdelibs （KXzFilter）， kdebase， ark...&lt;br /&gt;&lt;br /&gt;.xz, .lzma, .tar.lzma&lt;br /&gt;&lt;br /&gt;PS1:&lt;br /&gt;lzma是libarchive的可选依赖，自己编译下libarchive也可以命令行做这种事情了：&lt;br /&gt;tar cfa aabb.tar.lzma abcde/&lt;br /&gt;&lt;br /&gt;PS2:&lt;br /&gt;测试了一下，压缩时间、解压时间、压缩率都优于gz、bzip2，缺点是内存占用很吓人，大一点的文件一般都占用几百MB内存，我压kernel src时候居然要占用650多MB，看了一下代码发现他的最大内存占用阀值＝所有内存／3&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3435125723568721085-4633599078066330274?l=qiacat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qiacat.blogspot.com/feeds/4633599078066330274/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://qiacat.blogspot.com/2009/04/blog-post.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3435125723568721085/posts/default/4633599078066330274'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3435125723568721085/posts/default/4633599078066330274'/><link rel='alternate' type='text/html' href='http://qiacat.blogspot.com/2009/04/blog-post.html' title='期中考试结束了'/><author><name>Wang Hoi</name><uri>http://www.blogger.com/profile/10292518120201202624</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/__wNRAxUWzAo/SfPsoYnYA8I/AAAAAAAAALo/7kQva2_IM8Y/s1600-R/avatar.php%3Fgravatar_id%3Dbdada60af0164d1623bbe46638bbcd20'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3435125723568721085.post-7186186733578782447</id><published>2009-04-08T19:42:00.011+08:00</published><updated>2009-04-08T21:38:28.137+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='KDE'/><category scheme='http://www.blogger.com/atom/ns#' term='planetKDE'/><category scheme='http://www.blogger.com/atom/ns#' term='图形界面'/><title type='text'>Ribbon UI , Korat UI</title><content type='html'>Hello, i've hesitated to put this blog post on KDE, afraid being told this is a crazy idea.Finally i'm open for challenges, at least this post shows an idea.&lt;br /&gt;&lt;br /&gt;Plasma is maturing, more widgets have been added. As a result it enables some other possiblites.&lt;br /&gt;&lt;br /&gt;Recently i've seen the beauty of Ribbon UI in Office 14  and Windows 7.&lt;br /&gt;And  googling the Ribbon UI on Linux, found two implementations:&lt;br /&gt;GTK# version in Mono:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://lh5.ggpht.com/__wNRAxUWzAo/SdybMBlAVZI/AAAAAAAAAKE/NIVDj4pFWpQ/gtk_ribbon.png"&gt;&lt;img style="cursor: pointer; width: 350px; height: 211px;" src="http://lh5.ggpht.com/__wNRAxUWzAo/SdybMBlAVZI/AAAAAAAAAKE/NIVDj4pFWpQ/gtk_ribbon.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;It seems to be (maybe intended to be) 1-1 copy of M$'s Ribbon UI,  where's their creativities?&lt;br /&gt;&lt;br /&gt;Vtk designer's menustrip:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://lh3.ggpht.com/__wNRAxUWzAo/SdybMWc9zEI/AAAAAAAAAKM/uzN2uidZ7t0/s800/MSD2.jpg"&gt;&lt;img style="cursor: pointer; width: 441px; height: 266px;" src="http://lh3.ggpht.com/__wNRAxUWzAo/SdybMWc9zEI/AAAAAAAAAKM/uzN2uidZ7t0/s800/MSD2.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Looks OK ,and that's all. It's just bigger icons on a bar.....&lt;br /&gt;&lt;br /&gt;Not satisfied with the above two, i'm writing my own:&lt;br /&gt;&lt;br /&gt;My Korat::MenuBar's Features:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Adaptive layout according to width (use own greedy relaxing algorithm), similar to M$'s Ribbon UI.&lt;/li&gt;&lt;li&gt;Users are very easy to wrap their graphics widgets to be adaptive layoutable. You just need to provide only three other functions (typedef QList&lt;int&gt;&lt;int&gt; WeightList;):&lt;ul&gt;&lt;li&gt;   QList&lt;weightlist&gt; availableWidths();&lt;br /&gt;&lt;/weightlist&gt;&lt;/li&gt;&lt;li&gt;   qreal getWidth(const WeightList &amp;amp;);&lt;/li&gt;&lt;li&gt;   void adjustWidth(const WeightList &amp;amp;);&lt;/li&gt;&lt;/ul&gt;&lt;/int&gt;&lt;/li&gt;&lt;li&gt;Use plasma extensively: theme, palette, Plasma::IconWidget, Plasma::LineEdit etc....,&lt;/li&gt;&lt;/ul&gt;Pics comming....&lt;br /&gt;Widest：&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://lh5.ggpht.com/__wNRAxUWzAo/SdycrAOM0JI/AAAAAAAAAKU/fnE2S7Dp4PY/s912/korat-large.png"&gt;&lt;img style="cursor: pointer; width: 532px; height: 168px;" src="http://lh5.ggpht.com/__wNRAxUWzAo/SdycrAOM0JI/AAAAAAAAAKU/fnE2S7Dp4PY/s912/korat-large.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Medium:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://lh5.ggpht.com/__wNRAxUWzAo/SdydJXaTKOI/AAAAAAAAAK8/8zNtqx2JfIo/korat-medium.png"&gt;&lt;img style="cursor: pointer; width: 415px; height: 116px;" src="http://lh5.ggpht.com/__wNRAxUWzAo/SdydJXaTKOI/AAAAAAAAAK8/8zNtqx2JfIo/korat-medium.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Narrow:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://lh5.ggpht.com/__wNRAxUWzAo/SdycrvJ2f5I/AAAAAAAAAKk/e8BNXCOXfvA/korat-small.png"&gt;&lt;img style="cursor: pointer; width: 319px; height: 285px;" src="http://lh5.ggpht.com/__wNRAxUWzAo/SdycrvJ2f5I/AAAAAAAAAKk/e8BNXCOXfvA/korat-small.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Too narrow, scroll button appears:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://lh5.ggpht.com/__wNRAxUWzAo/Sdycrv4iL-I/AAAAAAAAAKs/M8kqGMe00P4/korat-scroll.png"&gt;&lt;img style="cursor: pointer; width: 259px; height: 370px;" src="http://lh5.ggpht.com/__wNRAxUWzAo/Sdycrv4iL-I/AAAAAAAAAKs/M8kqGMe00P4/korat-scroll.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Also i'm thinking of bringing more powers and beauties of plasma and graphics model/view to normal widget based application, so i start a Korat UI project(plan):&lt;br /&gt;&lt;br /&gt;Its goal is to provide a normal QWidget - Korat::MainWindow,&lt;br /&gt;which correctly provide a view on a QGraphicsWidget - Korat::MainWindowGraphics&lt;br /&gt;&lt;br /&gt;Feature plan of Korat::MainWindow:&lt;ol&gt;&lt;li&gt;Fully QGraphicsWidget based, goes deeper on the way that Plasma::Dialog do, correctly manage the layout for you (handle spacing, margins, theme change etc...),   It's auto themed according to your plasma theme, provide animated layout(Kinetic ?), and other animation effects.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Integrate KRunner into the main window. Application and its plugins can provide its own krunner plugin, the main window manage/merge them, To quickly search this application's actions, help info, quickly tag the document etc... anything that krunner can do. (You can see from my above pics, there's a filter button and a lineedit besides the tabbar, that's it).&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Ribbon like menubar as i mentioned above, but merge the application and its plugins' sub actions( maybe need to extend kde's xml gui somehow )&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Provide optional Drawers on four corners of central graphics widget, optional Docks on four edges of central graphics widget. Manage their position,size,layout to ease your programming .&lt;br /&gt;&lt;/li&gt;&lt;li&gt;A statusbar(notification area) on bottom.&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;The Korat::MainWindow's base architecture is done and the Ribbon like Menubar is nearly finished (some scrolling bugs not fixed yet).&lt;br /&gt;&lt;br /&gt;Future plan:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;brainstorm and implement the Drawer, Dock, StatusBar.&lt;/li&gt;&lt;li&gt;Port(hack) my own version of KJots to use this UI, since it's one of my favourite KDE application, so it deserves to have a beautiful and easy to use GUI.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Experiment XML Gui support.&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;Source code  under trunk/playground/base/plasma/widgets/koratbar&lt;br /&gt;&lt;br /&gt;Thanks for reading, finally a pic for "korat“ , kudos for plasma developers.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/__wNRAxUWzAo/Sdyfw3hMy1I/AAAAAAAAALI/Hvrq40qqkdQ/s1600-h/korat-cat-facts.jpg"&gt;&lt;img style="cursor: pointer; width: 275px; height: 312px;" src="http://2.bp.blogspot.com/__wNRAxUWzAo/Sdyfw3hMy1I/AAAAAAAAALI/Hvrq40qqkdQ/s400/korat-cat-facts.jpg" alt="" id="BLOGGER_PHOTO_ID_5322304521530821458" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3435125723568721085-7186186733578782447?l=qiacat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qiacat.blogspot.com/feeds/7186186733578782447/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://qiacat.blogspot.com/2009/04/ribbon-ui-korat-ui.html#comment-form' title='41 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3435125723568721085/posts/default/7186186733578782447'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3435125723568721085/posts/default/7186186733578782447'/><link rel='alternate' type='text/html' href='http://qiacat.blogspot.com/2009/04/ribbon-ui-korat-ui.html' title='Ribbon UI , Korat UI'/><author><name>Wang Hoi</name><uri>http://www.blogger.com/profile/10292518120201202624</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/__wNRAxUWzAo/SfPsoYnYA8I/AAAAAAAAALo/7kQva2_IM8Y/s1600-R/avatar.php%3Fgravatar_id%3Dbdada60af0164d1623bbe46638bbcd20'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/__wNRAxUWzAo/SdybMBlAVZI/AAAAAAAAAKE/NIVDj4pFWpQ/s72-c/gtk_ribbon.png' height='72' width='72'/><thr:total>41</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3435125723568721085.post-5304221179376406412</id><published>2009-03-31T20:31:00.004+08:00</published><updated>2009-04-01T19:55:58.735+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='KDE'/><title type='text'>Portable Meta-Information again...</title><content type='html'>&lt;h3 class="post-title entry-title"&gt;&lt;span style="font-weight: normal;"&gt;Sth. about &lt;/span&gt;&lt;a style="font-weight: normal;" href="http://qiacat.blogspot.com/2009/03/portable-meta-information-again.html"&gt;Portable Meta-Information storage with File Forks/Resource Forks.&lt;/a&gt; &lt;/h3&gt;    &lt;div class="date-tab"&gt; &lt;/div&gt; &lt;p&gt;Portable meta-information has been discussed twice recently on planetkde:&lt;br /&gt;&lt;a href="http://www.kdedevelopers.org/node/3923"&gt;http://www.kdedevelopers.org/node/3923&lt;/a&gt;&lt;br /&gt;&lt;a href="http://zwabel.wordpress.com/2009/03/29/portable-meta-information/"&gt;http://zwabel.wordpress.com/2009/03/29/portable-meta-information/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Portable meta information can be thought as File's meta information is not stored centrally (they may still be indexed in a central database to optimize query).&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;It introduces some benefits:&lt;br /&gt;&lt;/p&gt;&lt;p&gt;1. You can transfer the files around without loose the meta informations, I only concern move files locally now.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;2. When you re-install your system or your central database broken, as long as your files are still there, their meta information aren't lost.&lt;/p&gt;&lt;p&gt;3. Everything is file, as long as we standardlize the file format, apps/libraries needn't to learn nepomuk query, manipulate database to perform basic meta info operation (like backup, remove etc....)&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;My thought is realistic:&lt;br /&gt;&lt;b&gt;1. Will nepomuk really be more usable with portable/distributed stored meta information ?&lt;/b&gt;&lt;br /&gt;I don't know much of nepomuk's server implementations, afaik it seems use a central database to index/store these information, so I've a question to ask : when user move his file to another local folder, will the file's meta information get lost , updated later(next time to index) or updated instantly (use inotify )? The first result(lost) is totally un acceptable, the second is OK, but nepomuk's value/power will be limited, the third is good, just stick to central storage.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;2. How to implement it ?&lt;/b&gt;&lt;br /&gt;someone has suggested to use side-car file, other suggested xattr.&lt;br /&gt;There is a &lt;b&gt;seems better&lt;/b&gt; way to implement it : file forks/resource forks (not process fork),&lt;br /&gt;http://en.wikipedia.org/wiki/Fork_(filesystem)&lt;br /&gt;http://en.wikipedia.org/wiki/Resource_fork&lt;br /&gt;It's invented by Apple , store text file's encoding, applications' icon ...&lt;br /&gt;&lt;br /&gt;Quote:&lt;br /&gt;&lt;i&gt;Apple's HFS, and the original &lt;/i&gt;&lt;a href="http://en.wikipedia.org/wiki/Apple_Macintosh" title="Apple Macintosh" class="mw-redirect"&gt;&lt;i&gt;Apple Macintosh&lt;/i&gt;&lt;/a&gt;&lt;i&gt; file system &lt;/i&gt;&lt;a href="http://en.wikipedia.org/wiki/Macintosh_File_System" title="Macintosh File System"&gt;&lt;i&gt;MFS&lt;/i&gt;&lt;/a&gt;&lt;i&gt;, were designed to allow a file to have a &lt;/i&gt;&lt;a href="http://en.wikipedia.org/wiki/Resource_fork" title="Resource fork"&gt;&lt;i&gt;resource fork&lt;/i&gt;&lt;/a&gt;&lt;i&gt; to store &lt;/i&gt;&lt;a href="http://en.wikipedia.org/wiki/Metadata_%28computing%29" title="Metadata (computing)" class="mw-redirect"&gt;&lt;i&gt;metadata&lt;/i&gt;&lt;/a&gt;&lt;i&gt; that would be used by the system's &lt;/i&gt;&lt;a href="http://en.wikipedia.org/wiki/Graphical_user_interface" title="Graphical user interface"&gt;&lt;i&gt;graphical user interface&lt;/i&gt;&lt;/a&gt;&lt;i&gt; (GUI), such as a file's icon to be used by the Finder or the menus and dialog boxes associated with an application.&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;It tightly bonded/embed to a file unlike side-car file, but also bypass the size limit of xattrs(Extended File Attributes), the size limit is the largest file you can create, and you can also assign serveral meta info file to one file.&lt;br /&gt;This is a practise proof method,but only modern filesystem support it:&lt;br /&gt;Only Apple's HFS, Microsoft's NTFS, Solaris's ZFS has full support.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;And extensively used by Apple(store all sorts of metadata) and Microsoft(store its system backup related infomation, security control info).&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Something need to mention, that Mac OS X's unix command line utilities (cp, mv, ....) can handle file with resource/file forks correctly. And Microsoft name it alternate data stream (&lt;i&gt;ADS&lt;/i&gt;).&lt;br /&gt;&lt;/p&gt;&lt;p&gt;You can refer their dev docs to see how they design the api.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Oops the main linux file system, ext2/3/4, XFS, JFS... doesn't support it well.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;3. Is it possible/hard to implement it under linux ?  (you can skip the following paragraphs if you're not interested in implementing such things in kernel)&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;In my personal opinion, not hard indeed, i want :) and asume it to be implemented in VFS level (so all sorts of filesystem beneath this level gain support).&lt;br /&gt;The simplest way is to add a "dentry" to each "general inode", that from the filesystem's view(not user visible), a regular file can be associated with a "directory" too, all metadata files resides under that "directory".&lt;br /&gt;like this:&lt;br /&gt;/home/xx/xxx/a.jpeg ----&gt; nepomuk.xml&lt;br /&gt;&lt;/p&gt;&lt;p&gt;                                          user.encoding&lt;br /&gt;&lt;/p&gt;&lt;p&gt;                                          user.img.source.url&lt;/p&gt;&lt;p&gt;....&lt;br /&gt;And make getfattr/setfattr related system call to lookup that dentry too, this method also remains backward compatible with xattrs (Extended file attributes), but remove the size limit put on them.&lt;/p&gt;&lt;p&gt;Or we can add new system call like getfmeta/setfmeta ....&lt;br /&gt;&lt;br /&gt;Of course, we need more analysis/profiling to say sth. on the memory/time performance.&lt;br /&gt;:) Just make a predication, the extra memory requirement it introduces(an extra "dentry" pointer) is affordable, and there's no/very subtle extra time needed by open/write ..regular system call, and it will be &lt;b&gt;fast&lt;/b&gt; than create side-car files, since we needn't to create/open the side-car files from user space and pollute a directory with side-car file per data file, kernel handles it ..&lt;/p&gt;&lt;p&gt;Also need some security concerns.&lt;br /&gt;&lt;br /&gt;Anyway, to implement portable meta information, i think we need support from underline library/filesystem/architecture.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;4. This method's disadvantages:&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;a.We have no POSIX standard to define the API, and Apple's HFS, Microsoft's NTFS and Solaris's ZFS use different api for similar functionalities. We may need to abstract the api to make KDE cross platform.&lt;/p&gt;&lt;p&gt;b.No major filesystems under linux provide file forks / resources forks support now. Need to implement it or make feature requirement.&lt;/p&gt;&lt;p&gt;c.We can't directly associate a xml as a file's meta info, since xml is not an appendable format, data corruption may happens when we update this file's meta info while user eject the source disk, suddenly power goes off ,etc.......... These problems need to be solved if we want to support portable/distributed meta information.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;---------------------------------------------------------------------------------------&lt;br /&gt;&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt;Thanks for reading..&lt;/p&gt;&lt;br /&gt;Regards,&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3435125723568721085-5304221179376406412?l=qiacat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qiacat.blogspot.com/feeds/5304221179376406412/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://qiacat.blogspot.com/2009/03/portable-meta-information-again.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3435125723568721085/posts/default/5304221179376406412'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3435125723568721085/posts/default/5304221179376406412'/><link rel='alternate' type='text/html' href='http://qiacat.blogspot.com/2009/03/portable-meta-information-again.html' title='Portable Meta-Information again...'/><author><name>Wang Hoi</name><uri>http://www.blogger.com/profile/10292518120201202624</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/__wNRAxUWzAo/SfPsoYnYA8I/AAAAAAAAALo/7kQva2_IM8Y/s1600-R/avatar.php%3Fgravatar_id%3Dbdada60af0164d1623bbe46638bbcd20'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3435125723568721085.post-4091052370856705560</id><published>2009-03-30T12:52:00.007+08:00</published><updated>2009-03-31T13:16:17.779+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='KDE'/><category scheme='http://www.blogger.com/atom/ns#' term='图形界面'/><title type='text'>Amarok2 + XEmbed</title><content type='html'>修补了Amarok2编码检测的bug.........&lt;br /&gt;Amarok2可以像千千静听那样显示歌词了，&lt;br /&gt;感谢Sanfanling的IrcShow-X，So cool&lt;br /&gt;把IrcShow-X通过XEmbed集成进了amarok2的Context View,&lt;br /&gt;理论上可以将符合XEmbed规范的任意窗口(甚至Firefox, Openoffice)嵌入到Amarok2中去 ：）&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/__wNRAxUWzAo/SdBSoUceoAI/AAAAAAAAAII/KFFPf5E66hQ/s1600-h/amarok.png"&gt;&lt;img src="http://2.bp.blogspot.com/__wNRAxUWzAo/SdBSoUceoAI/AAAAAAAAAII/KFFPf5E66hQ/s400/amarok.png" alt="" id="BLOGGER_PHOTO_ID_5318842012560957442" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/__wNRAxUWzAo/SdBSn1R7oRI/AAAAAAAAAIA/dBEKU7BHPcw/s1600-h/amarok-search.png"&gt;&lt;img src="http://1.bp.blogspot.com/__wNRAxUWzAo/SdBSn1R7oRI/AAAAAAAAAIA/dBEKU7BHPcw/s400/amarok-search.png" alt="" id="BLOGGER_PHOTO_ID_5318842004195221778" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Amarok2中的Dolphin文件浏览器 ：）&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/__wNRAxUWzAo/SdBSoVhK7dI/AAAAAAAAAIQ/mQ6JPIAGjLE/s1600-h/dolphin.png"&gt;&lt;img src="http://2.bp.blogspot.com/__wNRAxUWzAo/SdBSoVhK7dI/AAAAAAAAAIQ/mQ6JPIAGjLE/s400/dolphin.png" alt="" id="BLOGGER_PHOTO_ID_5318842012849073618" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Google在Chrome里声称的“安全”的沙盒技术也是基于这个原理，&lt;br /&gt;每个Tab是单独的进程，浏览器进程也是独立出来的，&lt;br /&gt;Linux下的实现每个Tab通过XEmbed或其他组件技术？嵌入到浏览器中，&lt;br /&gt;而浏览器通过Socket或dbus等IPC手段控制Tab,&lt;br /&gt;这样任何个Tab挂掉或被恶意脚本“攻陷”都理论上不会挂掉/影响浏览器进程，&lt;br /&gt;而浏览器进程挂掉的话，各个Tab就自动变成单个单个的窗口：）&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3435125723568721085-4091052370856705560?l=qiacat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qiacat.blogspot.com/feeds/4091052370856705560/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://qiacat.blogspot.com/2009/03/amarok2-xembed.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3435125723568721085/posts/default/4091052370856705560'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3435125723568721085/posts/default/4091052370856705560'/><link rel='alternate' type='text/html' href='http://qiacat.blogspot.com/2009/03/amarok2-xembed.html' title='Amarok2 + XEmbed'/><author><name>Wang Hoi</name><uri>http://www.blogger.com/profile/10292518120201202624</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/__wNRAxUWzAo/SfPsoYnYA8I/AAAAAAAAALo/7kQva2_IM8Y/s1600-R/avatar.php%3Fgravatar_id%3Dbdada60af0164d1623bbe46638bbcd20'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/__wNRAxUWzAo/SdBSoUceoAI/AAAAAAAAAII/KFFPf5E66hQ/s72-c/amarok.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3435125723568721085.post-7676905766565627428</id><published>2009-03-25T13:08:00.003+08:00</published><updated>2009-03-25T13:30:30.110+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='KDE'/><category scheme='http://www.blogger.com/atom/ns#' term='planetKDE'/><category scheme='http://www.blogger.com/atom/ns#' term='图形界面'/><title type='text'>Gnome global menu in KDE4</title><content type='html'>Hello, i've implement gnome's global menu in Bespin's XBar.&lt;br /&gt;Now xbar users can get global menu both for GTK and Qt4 applications.&lt;br /&gt;Pics comming....&lt;br /&gt;Gnome's Epiphany web browser:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://lh6.ggpht.com/__wNRAxUWzAo/ScnA1hMK6sI/AAAAAAAAAGI/q-xXpLQQZaA/s720/gtk-globalmenu.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 720px; height: 450px;" src="http://lh6.ggpht.com/__wNRAxUWzAo/ScnA1hMK6sI/AAAAAAAAAGI/q-xXpLQQZaA/s720/gtk-globalmenu.png" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;KOffice2's Krita application:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://lh4.ggpht.com/__wNRAxUWzAo/ScnA2Cia5EI/AAAAAAAAAGQ/Zky3u4hMhm0/s720/krita-gnomemenu.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 720px; height: 450px;" src="http://lh4.ggpht.com/__wNRAxUWzAo/ScnA2Cia5EI/AAAAAAAAAGQ/Zky3u4hMhm0/s720/krita-gnomemenu.png" border="0" alt="" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3435125723568721085-7676905766565627428?l=qiacat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qiacat.blogspot.com/feeds/7676905766565627428/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://qiacat.blogspot.com/2009/03/gnome-global-menu-in-kde4.html#comment-form' title='18 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3435125723568721085/posts/default/7676905766565627428'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3435125723568721085/posts/default/7676905766565627428'/><link rel='alternate' type='text/html' href='http://qiacat.blogspot.com/2009/03/gnome-global-menu-in-kde4.html' title='Gnome global menu in KDE4'/><author><name>Wang Hoi</name><uri>http://www.blogger.com/profile/10292518120201202624</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/__wNRAxUWzAo/SfPsoYnYA8I/AAAAAAAAALo/7kQva2_IM8Y/s1600-R/avatar.php%3Fgravatar_id%3Dbdada60af0164d1623bbe46638bbcd20'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/__wNRAxUWzAo/ScnA1hMK6sI/AAAAAAAAAGI/q-xXpLQQZaA/s72-c/gtk-globalmenu.png' height='72' width='72'/><thr:total>18</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3435125723568721085.post-877589185225635198</id><published>2009-03-22T19:54:00.003+08:00</published><updated>2009-03-22T20:53:07.507+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='KDE'/><category scheme='http://www.blogger.com/atom/ns#' term='planetKDE'/><category scheme='http://www.blogger.com/atom/ns#' term='输入法'/><category scheme='http://www.blogger.com/atom/ns#' term='图形界面'/><title type='text'>kimpane applet, ask for review</title><content type='html'>I just dumplicate the mail and add some more pics :)&lt;br /&gt;Moved to kdereview/plasma/applets/&lt;br /&gt;&lt;br /&gt;It's mainly an applet for input methods, so that persons use difference input methods can share the same user interface and the unified systemsettings input method configure integration.&lt;br /&gt;And also include a standalone application and a control module for systemsettings now.&lt;br /&gt;&lt;br /&gt;Its main features:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Multiple backend support, currently support SCIM and IBus(1.1.0+ version)&lt;/li&gt;&lt;li&gt;Able to float out and embbed into panel dynamically, The floating statusbar(a qwidget) is just a view on the same qgraphicswidget.&lt;/li&gt;&lt;li&gt;Skin support:&lt;ol&gt;&lt;li&gt;You can choose the skin to follow current plasma theme, then it will auto switch skin when user change plasma theme.&lt;/li&gt;&lt;li&gt;Use custom theme, support install theme from Get Hot New Stuff &lt;/li&gt;&lt;li&gt;Internally use javascript to layout svg, enable the abilities to do adaptive svg layout and "theme" the layout.&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;KCModule based configure, config pages for ui, backends are combined to one dialog.&lt;/li&gt;&lt;li&gt;Provide a standalone version with floating statusbar only if you don't want to add the applet to panel.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Its design is simple, just provide a dbus service for input methods&lt;br /&gt;Backends(SCIM,IBus, fcitx ...) &lt;--------&gt;dbus&lt;----------&gt;kimpanel (org.kde.impanel)&lt;br /&gt;communicate by signals only.&lt;br /&gt;&lt;br /&gt;Currently the above features are finished,  Except:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Only one kcmodule for ui now, haven't provide kcmodule for backend,&lt;/li&gt;&lt;li&gt;The kcmodule is working, but lack help text, theme auto preview , other eyecandies........&lt;/li&gt;&lt;li&gt;The extra two themes are only make for horizontal statusbar and horizontal candidate window layout only, but default theme fully working.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;And it's also stable now, no crashes in my everyday use.&lt;br /&gt;&lt;br /&gt;The backend need to be configured before test this applet,  see backend/scim/README and backend/ibus/README&lt;br /&gt;You can even mix use SCIM and IBus for different types of programs(eg. scim for qt, IBus for xim and gtk), but you still have the same user interface&lt;br /&gt;and can't tell the difference without looking at their logo icon.&lt;br /&gt;&lt;br /&gt;I'd like to include it in KDE 4.3 but it will be soft freeze is in early April,&lt;br /&gt;So i think i have to ask for review now.&lt;br /&gt;&lt;br /&gt;Pics comming&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://lh6.ggpht.com/__wNRAxUWzAo/ScYjJuDtDQI/AAAAAAAAAEw/KxDWXcM3ADI/panel-skin.png"&gt;&lt;img style="cursor: pointer; width: 188px; height: 85px;" src="http://lh6.ggpht.com/__wNRAxUWzAo/ScYjJuDtDQI/AAAAAAAAAEw/KxDWXcM3ADI/panel-skin.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://lh6.ggpht.com/__wNRAxUWzAo/ScYmyG3Lt5I/AAAAAAAAAFA/S48v3WJ8xPY/s800/eng.png"&gt;&lt;img style="cursor: pointer; width: 800px; height: 508px;" src="http://lh6.ggpht.com/__wNRAxUWzAo/ScYmyG3Lt5I/AAAAAAAAAFA/S48v3WJ8xPY/s800/eng.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://lh6.ggpht.com/__wNRAxUWzAo/ScYjJobhW4I/AAAAAAAAAEo/hF0zSKDEmSE/s800/settings.png"&gt;&lt;img style="cursor: pointer; width: 800px; height: 500px;" src="http://lh6.ggpht.com/__wNRAxUWzAo/ScYjJobhW4I/AAAAAAAAAEo/hF0zSKDEmSE/s800/settings.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://lh4.ggpht.com/__wNRAxUWzAo/ScYjInRrwDI/AAAAAAAAAEQ/ycZE0Sn494Q/s800/1.png"&gt;&lt;img style="cursor: pointer; width: 800px; height: 500px;" src="http://lh4.ggpht.com/__wNRAxUWzAo/ScYjInRrwDI/AAAAAAAAAEQ/ycZE0Sn494Q/s800/1.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://lh4.ggpht.com/__wNRAxUWzAo/ScYjJGMhsKI/AAAAAAAAAEY/oGag_wPK8Ks/def.png"&gt;&lt;img style="cursor: pointer; width: 603px; height: 342px;" src="http://lh4.ggpht.com/__wNRAxUWzAo/ScYjJGMhsKI/AAAAAAAAAEY/oGag_wPK8Ks/def.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3435125723568721085-877589185225635198?l=qiacat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qiacat.blogspot.com/feeds/877589185225635198/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://qiacat.blogspot.com/2009/03/kimpane-applet-ask-for-review.html#comment-form' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3435125723568721085/posts/default/877589185225635198'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3435125723568721085/posts/default/877589185225635198'/><link rel='alternate' type='text/html' href='http://qiacat.blogspot.com/2009/03/kimpane-applet-ask-for-review.html' title='kimpane applet, ask for review'/><author><name>Wang Hoi</name><uri>http://www.blogger.com/profile/10292518120201202624</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/__wNRAxUWzAo/SfPsoYnYA8I/AAAAAAAAALo/7kQva2_IM8Y/s1600-R/avatar.php%3Fgravatar_id%3Dbdada60af0164d1623bbe46638bbcd20'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/__wNRAxUWzAo/ScYjJuDtDQI/AAAAAAAAAEw/KxDWXcM3ADI/s72-c/panel-skin.png' height='72' width='72'/><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3435125723568721085.post-2873771836210595696</id><published>2009-03-08T10:59:00.005+08:00</published><updated>2009-03-08T18:51:17.172+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='KDE'/><category scheme='http://www.blogger.com/atom/ns#' term='planetKDE'/><title type='text'></title><content type='html'>As my first post,  first say hello to everyone :)&lt;br /&gt;&lt;br /&gt;Want a fancy input method user interface?&lt;br /&gt;Want to put it inside your panel ?&lt;br /&gt;&lt;br /&gt;I'm currently writing a plasma applet for input method, which enables different input methods (scim etc..) to share same unified user interface under KDE.&lt;br /&gt;Its main features are there and with a &lt;span style="font-weight: bold;"&gt;fully working&lt;/span&gt; scim backend.&lt;br /&gt;Have a look at some pics:&lt;br /&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/__wNRAxUWzAo/SbJBWoBveuI/AAAAAAAAACA/26SVF43aRpw/s1600-h/2.png"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 132px;" src="http://2.bp.blogspot.com/__wNRAxUWzAo/SbJBWoBveuI/AAAAAAAAACA/26SVF43aRpw/s320/2.png" alt="" id="BLOGGER_PHOTO_ID_5310378767580887778" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/__wNRAxUWzAo/SbJBW6UdxlI/AAAAAAAAACI/7mN8xdYtAYo/s1600-h/3.png"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 124px;" src="http://1.bp.blogspot.com/__wNRAxUWzAo/SbJBW6UdxlI/AAAAAAAAACI/7mN8xdYtAYo/s320/3.png" alt="" id="BLOGGER_PHOTO_ID_5310378772491257426" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/__wNRAxUWzAo/SbJBWYYEdnI/AAAAAAAAABw/tqiLZbxpCqg/s1600-h/1.png"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 84px;" src="http://2.bp.blogspot.com/__wNRAxUWzAo/SbJBWYYEdnI/AAAAAAAAABw/tqiLZbxpCqg/s320/1.png" alt="" id="BLOGGER_PHOTO_ID_5310378763379570290" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/__wNRAxUWzAo/SbJBWdtDRaI/AAAAAAAAAB4/5Nl1oWU4FsM/s1600-h/01.png"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 155px; height: 320px;" src="http://1.bp.blogspot.com/__wNRAxUWzAo/SbJBWdtDRaI/AAAAAAAAAB4/5Nl1oWU4FsM/s320/01.png" alt="" id="BLOGGER_PHOTO_ID_5310378764809749922" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul style="text-align: left;"&gt;&lt;li&gt;Not a new input method, user interface only.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;DBus-based, signal only backend&lt;-&gt;user interface communicate&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Svg themed, currently theme according to your plasma theme.&lt;/li&gt;&lt;li&gt;Layout to try to make the icon as large as possible under certain size.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Can expand/collapse from an applet to widget.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;Its user interface is modern and highly integrated to KDE, which give you better user experience when typing text.&lt;br /&gt;And it also break the situation which we only have gtk based input method now whose user interface is designed without concern KIG, KDE integration ...&lt;br /&gt;&lt;br /&gt;The source code is under playground/base/plasma/applets/kimpanel&lt;br /&gt;If you're a CJK person whom use input method a lot, have a try ！&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3435125723568721085-2873771836210595696?l=qiacat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qiacat.blogspot.com/feeds/2873771836210595696/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://qiacat.blogspot.com/2009/03/as-my-first-post-first-say-hello-to.html#comment-form' title='23 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3435125723568721085/posts/default/2873771836210595696'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3435125723568721085/posts/default/2873771836210595696'/><link rel='alternate' type='text/html' href='http://qiacat.blogspot.com/2009/03/as-my-first-post-first-say-hello-to.html' title=''/><author><name>Wang Hoi</name><uri>http://www.blogger.com/profile/10292518120201202624</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/__wNRAxUWzAo/SfPsoYnYA8I/AAAAAAAAALo/7kQva2_IM8Y/s1600-R/avatar.php%3Fgravatar_id%3Dbdada60af0164d1623bbe46638bbcd20'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/__wNRAxUWzAo/SbJBWoBveuI/AAAAAAAAACA/26SVF43aRpw/s72-c/2.png' height='72' width='72'/><thr:total>23</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3435125723568721085.post-7790049864329400575</id><published>2009-03-02T12:33:00.003+08:00</published><updated>2009-03-02T21:44:38.322+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Qt'/><category scheme='http://www.blogger.com/atom/ns#' term='图形界面'/><title type='text'>使用Xrender加速异形窗体的绘制</title><content type='html'>异形窗口一般是采用图片作背景，形状不是规则的方形窗口。&lt;br /&gt;不少程序为了追求漂亮的外观都会实现它，如windows media player等软件。&lt;br /&gt;而图像的Alpha值是和透明度相关的，采用部分半透明的背景能够能加提升视觉效果。&lt;br /&gt;&lt;br /&gt;在Qt中实现异形窗体一般采用setMask()，&lt;br /&gt;实现透明也有setWindowOpacity()，&lt;br /&gt;但这并不是最高效的方式。&lt;br /&gt;&lt;br /&gt;而直接使用窗口管理器的接口来设置背景透明度却不能得到一个各部分透明度不同的控件（窗口）背景。&lt;br /&gt;&lt;br /&gt;直接与Xlib打交道是一种解决方法。&lt;br /&gt;&lt;br /&gt;其实Qt提供了一个简便的方法来供您使用，&lt;br /&gt;如果你有支持复合(Composite)的窗口管理器，如(compiz或者kwin)，&lt;br /&gt;就可以去除不必要的控件闪烁，并获得显著的性能提升。&lt;br /&gt;&lt;br /&gt;首先要这样初始化你的程序。&lt;br /&gt;&lt;br /&gt;int main(int argc, char *argv[]) {&lt;br /&gt;&lt;code&gt;bool argbVisual=false;&lt;br /&gt;&lt;span style="COLOR: rgb(255,0,0)"&gt;Display *dpy = XOpenDisplay(0); // 打开显示接口&lt;/span&gt;&lt;br /&gt;if (!dpy) {&lt;br /&gt;qWarning("Cannot connect to the X server");&lt;br /&gt;exit(1);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;int screen = DefaultScreen(dpy);&lt;br /&gt;Colormap colormap = 0;&lt;br /&gt;Visual *visual = 0;&lt;br /&gt;int eventBase, errorBase;&lt;br /&gt;&lt;br /&gt;if (&lt;span style="COLOR: rgb(255,0,0)"&gt;XRenderQueryExtension(dpy, &amp;amp;eventBase, &amp;amp;errorBase)&lt;/span&gt;) {&lt;br /&gt;int nvi;&lt;br /&gt;XVisualInfo templ;&lt;br /&gt;templ.screen = screen;&lt;br /&gt;templ.depth = 32;&lt;br /&gt;templ.c_class = TrueColor;&lt;br /&gt;&lt;span style="COLOR: rgb(255,0,0)"&gt;XVisualInfo *xvi = XGetVisualInfo(dpy, VisualScreenMask &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,0,0)"&gt;VisualDepthMask &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,0,0)"&gt;VisualClassMask, &amp;amp;templ, &amp;amp;nvi);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;for (int i = 0; i &lt; style="color: rgb(255, 0, 0);"&gt; XRenderPictFormat *format = XRenderFindVisualFormat(dpy,&lt;br /&gt;&lt;span style="COLOR: rgb(255,0,0)"&gt;xvi[i].visual);&lt;/span&gt;&lt;br /&gt;if (&lt;span style="COLOR: rgb(255,0,0)"&gt;format-&gt;type == PictTypeDirect &amp;amp;&amp;amp; format-&gt;direct.alphaMask)&lt;/span&gt; {&lt;br /&gt;&lt;span style="COLOR: rgb(255,0,0)"&gt;visual = xvi[i].visual;&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,0,0)"&gt;colormap = XCreateColormap(dpy, RootWindow(dpy, screen),&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,0,0)"&gt;visual, AllocNone);&lt;/span&gt;&lt;br /&gt;argbVisual=true;&lt;br /&gt;break;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;if (argbVisual == true) {&lt;br /&gt;qWarning("Found ARGB visual. Starting app...");&lt;br /&gt;}&lt;br /&gt;else {&lt;br /&gt;qWarning("Couldn't find ARGB visual... Exiting.");&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,0,0)"&gt;QApplication app(dpy, argc, argv,&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,0,0)"&gt;Qt::HANDLE(visual), Qt::HANDLE(colormap)); // 最关键的一行&lt;br /&gt;&lt;span style="COLOR: rgb(0,0,0)"&gt;return app.exec();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;然后在你要渲染的Widget的paintEvent里面这样做：&lt;br /&gt;&lt;br /&gt;// 也可以用png，这里用的是svg格式背景&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;code&gt;&lt;span style="COLOR: rgb(255,0,0)"&gt;&lt;span style="COLOR: rgb(0,0,0)"&gt;QSvgRender *render = new QSvgRenderer(QLatin1String("my_background.svg"));&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&lt;span style="COLOR: rgb(255,0,0)"&gt;&lt;span style="COLOR: rgb(0,0,0)"&gt;void Widget::paintEvent(QPaintEvent *e)&lt;br /&gt;{&lt;br /&gt;QPainter p(this);&lt;br /&gt;p.setRenderHint(QPainter::Antialiasing);&lt;br /&gt;p.setClipRect(e-&gt;rect());&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;code&gt;&lt;span style="COLOR: rgb(255,0,0)"&gt;&lt;span style="COLOR: rgb(0,0,0)"&gt;&lt;br /&gt;p.save();&lt;br /&gt;&lt;span style="COLOR: rgb(255,0,0)"&gt;// QPainter使用混合扩展模式中的源覆盖模式，很重要！不然会得到白色背景&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,0,0)"&gt;p.setCompositionMode(QPainter::CompositionMode_Source);&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;code&gt;&lt;span style="COLOR: rgb(255,0,0)"&gt;&lt;span style="COLOR: rgb(0,0,0)"&gt;// 使用“透明”颜色来填充&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;code&gt;&lt;span style="COLOR: rgb(255,0,0)"&gt;&lt;span style="COLOR: rgb(0,0,0)"&gt;背景&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;span style="COLOR: rgb(255,0,0)"&gt;&lt;span style="COLOR: rgb(0,0,0)"&gt;&lt;span style="COLOR: rgb(255,0,0)"&gt;p.fillRect(rect(), Qt::transparent);&lt;/span&gt;&lt;br /&gt;p.restore();&lt;br /&gt;&lt;br /&gt;//也可以不用一个QPixmap cache,直接在Widget上画，Qt有Backing store(类似于double buffer)来避免闪烁，使用cache好处是只需要在resizeEvent()那里更新cache就好了。&lt;br /&gt;&lt;span style="COLOR: rgb(255,0,0)"&gt;cache.fill(Qt::transparent);&lt;/span&gt;&lt;br /&gt;QPainter p(&amp;amp;cache);&lt;br /&gt;p.setRenderHint(QPainter::Antialiasing);&lt;br /&gt;&lt;span style="COLOR: rgb(255,0,0)"&gt;renderer-&gt;render(&amp;amp;p);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;p.end();&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,0,0)"&gt;p.drawPixmap(0, 0, cache);&lt;/span&gt;&lt;br /&gt;if (iconShown) {&lt;br /&gt;p.drawPixmap(20, 20, icon);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;现在的Widget就是一个以my_background.svg为背景，各个部分有不同透明度的控件了，&lt;br /&gt;并且渲染得到了显卡的加速:)&lt;br /&gt;&lt;br /&gt;需要更详细完善的例子，可以参考KRunner的源代码:&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&lt;a href="http://websvn.kde.org/trunk/KDE/kdebase/workspace/krunner/krunnerapp.cpp?view=markup"&gt;http://websvn.kde.org/trunk/KDE/kdebase/workspace/krunner/krunnerapp.cpp?view=markup&lt;/a&gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&lt;a href="http://websvn.kde.org/trunk/KDE/kdebase/workspace/krunner/krunnerdialog.cpp?view=markup"&gt;http://websvn.kde.org/trunk/KDE/kdebase/workspace/krunner/krunnerdialog.cpp?view=markup&lt;/a&gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&lt;span style="COLOR: rgb(255,0,0)"&gt;&lt;span style="COLOR: rgb(0,0,0)"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;code&gt;&lt;span style="COLOR: rgb(255,0,0)"&gt;&lt;span style="COLOR: rgb(0,0,0)"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3435125723568721085-7790049864329400575?l=qiacat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qiacat.blogspot.com/feeds/7790049864329400575/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://qiacat.blogspot.com/2009/03/renderalpha.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3435125723568721085/posts/default/7790049864329400575'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3435125723568721085/posts/default/7790049864329400575'/><link rel='alternate' type='text/html' href='http://qiacat.blogspot.com/2009/03/renderalpha.html' title='使用Xrender加速异形窗体的绘制'/><author><name>Wang Hoi</name><uri>http://www.blogger.com/profile/10292518120201202624</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/__wNRAxUWzAo/SfPsoYnYA8I/AAAAAAAAALo/7kQva2_IM8Y/s1600-R/avatar.php%3Fgravatar_id%3Dbdada60af0164d1623bbe46638bbcd20'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3435125723568721085.post-2948001334406005202</id><published>2009-02-26T13:12:00.001+08:00</published><updated>2009-03-02T13:03:52.193+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='KDE'/><category scheme='http://www.blogger.com/atom/ns#' term='输入法'/><category scheme='http://www.blogger.com/atom/ns#' term='图形界面'/><title type='text'>漂亮的输入法前端界面</title><content type='html'>对scim呆板的界面厌烦了，对gtk不怎么感冒。&lt;br /&gt;想要一个漂亮的能和系统主题相适应的输入法面板。&lt;br /&gt;&lt;br /&gt;于是自己写了一个:）&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;支持透明，支持采用Svg来作皮肤。KDE4 下面根据当前桌面(Plasma)主题自动换皮肤、和文字配色方案。还能根据你是否启用桌面效果调整外观。&lt;/li&gt;&lt;li&gt;图形界面和后端是分开的，将来支持ibus也是可以做到的。&lt;/li&gt;&lt;li&gt;简洁小巧，图形界面程序只有68k大，scim后端支持程序只有176k大小。&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;默认Oxygen主题下效果&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/__wNRAxUWzAo/SaoWqZzIk4I/AAAAAAAAABg/yMSxVmnZC6s/s1600-h/snapshot2.png"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 102px;" src="http://2.bp.blogspot.com/__wNRAxUWzAo/SaoWqZzIk4I/AAAAAAAAABg/yMSxVmnZC6s/s320/snapshot2.png" alt="" id="BLOGGER_PHOTO_ID_5308080028545225602" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Clean Blend主题下效果&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/__wNRAxUWzAo/SaoWqYSc9jI/AAAAAAAAABo/IwMk8H-iKR4/s1600-h/1235836672261102.png"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 140px;" src="http://2.bp.blogspot.com/__wNRAxUWzAo/SaoWqYSc9jI/AAAAAAAAABo/IwMk8H-iKR4/s320/1235836672261102.png" alt="" id="BLOGGER_PHOTO_ID_5308080028139714098" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3435125723568721085-2948001334406005202?l=qiacat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qiacat.blogspot.com/feeds/2948001334406005202/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://qiacat.blogspot.com/2009/02/blog-post_25.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3435125723568721085/posts/default/2948001334406005202'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3435125723568721085/posts/default/2948001334406005202'/><link rel='alternate' type='text/html' href='http://qiacat.blogspot.com/2009/02/blog-post_25.html' title='漂亮的输入法前端界面'/><author><name>Wang Hoi</name><uri>http://www.blogger.com/profile/10292518120201202624</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/__wNRAxUWzAo/SfPsoYnYA8I/AAAAAAAAALo/7kQva2_IM8Y/s1600-R/avatar.php%3Fgravatar_id%3Dbdada60af0164d1623bbe46638bbcd20'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/__wNRAxUWzAo/SaoWqZzIk4I/AAAAAAAAABg/yMSxVmnZC6s/s72-c/snapshot2.png' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3435125723568721085.post-2515125995412229625</id><published>2009-02-23T14:29:00.000+08:00</published><updated>2009-02-23T18:04:08.118+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='文本编辑器'/><category scheme='http://www.blogger.com/atom/ns#' term='数据结构'/><title type='text'>简单文本编辑器的数据结构</title><content type='html'>先说vim和emacs吧。&lt;br /&gt;vim文本存储采用的是链表，每个节点代表一行。&lt;br /&gt;emacs采用的是间隙缓冲区(Gap buffer)，如： abcd&lt;span style="font-weight: bold;"&gt;&lt;span style="font-style: italic;"&gt;I&lt;/span&gt;____&lt;/span&gt;efg    &lt;span style="font-weight: bold; font-style: italic;"&gt;I&lt;/span&gt;是光标，这样在光标处插入删除就变得很快速，缺点是当光标移动距离过大时需要移动大量数据。&lt;br /&gt;&lt;br /&gt;这两种方法各有优点，但是有没有更好的方法呢？&lt;br /&gt;&lt;span style="font-size:100%;"&gt;&lt;a href="http://www.cs.unm.edu/%7Ecrowley/papers/sds/sds.html" target="_blank" class="l" onmousedown="return clk(0,'','','res','2','')"&gt;&lt;em&gt;Data Structures&lt;/em&gt; for &lt;em&gt;Text Sequences&lt;/em&gt;&lt;/a&gt;&lt;br /&gt;介绍了Piece Table方法，就是使用两个缓冲区，一个只读，一个只能做尾部附加操作。&lt;br /&gt;只读缓冲区的数据是原始文件，用户每次修改添加的数据记录在附加缓冲区中。&lt;br /&gt;然后使用链表来表示当前文档：每个链表的节点有三个域：哪个缓冲区，起始偏移，长度。&lt;br /&gt;插入操作最多让链表长度加2，删除操作最多让其长度加1。&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;这样链表长度是编辑次数的函数，而不是文档长度。&lt;br /&gt;&lt;/span&gt;不妨设编辑次数为 m ， 文本长度为 n，插入操作的长度为p，来分析复杂度，容易得：&lt;br /&gt;时间复杂度：从上次临近位置插入 O(1)，随机位置插入O(m)，删除时间复杂度同插入。获得某个位置字符O(m)，获得长度为l的字符串O(m+l)，遍历所有字符O(n)。&lt;br /&gt;内容占用：约等于S(n+mp)，因为以前插入的内容会被一直保留在附加缓冲区中。&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;可以看到大部分操作的时间复杂度是与长度无关的&lt;/span&gt;，并且只读缓冲区可以根本不载入到内存中来，这样可以支持编辑非常大的文件（几百MB）。&lt;br /&gt;&lt;br /&gt;如果采用平衡树而不是链表来表示节点的话，固定位置，随机位置插入/删除时间复杂度变为O(log m),&lt;/span&gt;&lt;span style="font-size:100%;"&gt;获得某个位置字符O(log m)，获得长度为l的字符串O(log (m) +l)，遍历所有字符O(n)，但是这样实现（撤销/重做等操作）耗费更多内存，实现起来麻烦，并且一般需要用户交互的文档编辑软件的编辑次数不会太多（用户经常就会存盘，也不可能连续几小时编辑）。&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;因此这样的数据结构才是最适合简单文本编辑器使用的。&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.cs.unm.edu/%7Ecrowley/papers/sds/sds.html" target="_blank" class="l" onmousedown="return clk(0,'','','res','2','')"&gt;&lt;em&gt;&lt;/em&gt;&lt;/a&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3435125723568721085-2515125995412229625?l=qiacat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qiacat.blogspot.com/feeds/2515125995412229625/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://qiacat.blogspot.com/2009/02/blog-post_22.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3435125723568721085/posts/default/2515125995412229625'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3435125723568721085/posts/default/2515125995412229625'/><link rel='alternate' type='text/html' href='http://qiacat.blogspot.com/2009/02/blog-post_22.html' title='简单文本编辑器的数据结构'/><author><name>Wang Hoi</name><uri>http://www.blogger.com/profile/10292518120201202624</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/__wNRAxUWzAo/SfPsoYnYA8I/AAAAAAAAALo/7kQva2_IM8Y/s1600-R/avatar.php%3Fgravatar_id%3Dbdada60af0164d1623bbe46638bbcd20'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3435125723568721085.post-1351795141360951128</id><published>2009-02-20T12:04:00.000+08:00</published><updated>2009-02-20T12:16:22.713+08:00</updated><title type='text'>第一贴</title><content type='html'>&lt;span style="font-weight: bold;"&gt;为什么弄个博客：&lt;br /&gt;&lt;/span&gt;记录下我的行动与想法，和大家分享。&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;主要内容：&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Qt/KDE 应用开发相关&lt;/li&gt;&lt;li&gt;Linux 应用相关&lt;/li&gt;&lt;li&gt;最新最酷的东东的转载/翻译/评论&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;不会包括的内容：&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;政治，广告&lt;/li&gt;&lt;/ul&gt;欢迎与我交流，可以在帖子下面写上您的评论或给我发邮件：）&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3435125723568721085-1351795141360951128?l=qiacat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://qiacat.blogspot.com/feeds/1351795141360951128/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://qiacat.blogspot.com/2009/02/blog-post.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3435125723568721085/posts/default/1351795141360951128'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3435125723568721085/posts/default/1351795141360951128'/><link rel='alternate' type='text/html' href='http://qiacat.blogspot.com/2009/02/blog-post.html' title='第一贴'/><author><name>Wang Hoi</name><uri>http://www.blogger.com/profile/10292518120201202624</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/__wNRAxUWzAo/SfPsoYnYA8I/AAAAAAAAALo/7kQva2_IM8Y/s1600-R/avatar.php%3Fgravatar_id%3Dbdada60af0164d1623bbe46638bbcd20'/></author><thr:total>0</thr:total></entry></feed>
