Search This Blog

Convert Mac OS X .dmg file to .iso format on Ubuntu Linux

  1. Install dmg2img:
    sudo apt-get install dmg2img
  2. Convert .dmg file to .img:
    dmg2img -i /path/to/mac.dmg -o /path/to/mac.img
  3. To mount the .img file:
    sudo modprobe hfsplus
    sudo mount -t hfsplus -o loop /path/to/mac.img /mnt
  4. To convert the .img file to .iso format:
    • Install ccd2iso:
      sudo apt-get install ccd2iso
    • Convert .img file to .iso
      ccd2iso /path/to/mac.img /path/to/mac.iso

Eclipse menus do not show up on Ubuntu Linux 13.10

Solution:
  • Edit Eclipse.desktop file:
    [Desktop Entry]
    Version=4.3.0
    Name=Eclipse
    Exec=env UBUNTU_MENUPROXY=0 /opt/eclipse/eclipse
    Icon=/opt/eclipse/icon.xpm
    Terminal=false
    Type=Application
    Categories=Utility;Application
  • Create wrapper script,  /usr/local/bin/eclipse:
    #!/bin/bash
    export UBUNTU_MENUPROXY=0
    /opt/eclipse/eclipse

英国BBC评出的最佳小说100部

BBC评出有史以来最伟大的100部小说(英国人的阅读口味很独特)

每个民族都有自己最喜爱的作家和作品。BBC最近通过民意评选选出100部英国人最喜欢的文学作品。此次评选吸引了140000人参加投票,是上次BBC组织的“百大英国伟人”投票人数的4倍。在“百大作品”的名单上,有文学典籍,也有畅销书目,但是有一点是可以肯定的,大家喜欢的作品一般都有一个好的情节构架。

狄更斯有5部作品入选名单,使他成为得票数最多的作家。紧随其次的是因为《哈利·波特》系列走红的罗琳。乔治·奥维尔的《动物庄园》和《1984》都获得了相当的票数,使其成为最受喜爱的政治小说家。而浪漫小说中得票最多的是艾米丽·伯郎蒂的《呼啸山庄》。其他得票较多的书籍还有杰弗里·阿彻的《凯恩与亚伯》和詹姆斯·乔伊斯的《尤利西斯》。当然也有一些文学巨匠落选,包括海明威、伍德毫斯和H.G.韦尔斯。在一百部作品中,66本为英国作家所著,30本为儿童文学作品,71部曾改编成电影。

以下是100部作品名单:

               1. The Lord of the Rings, JRR Tolkien 指环王,J.R.R.托尔金

               2. Pride and Prejudice, Jane Austen 傲慢与偏见,简·奥斯丁

               3. His Dark Materials, Philip Pullman 黑暗物质,菲利普·普尔曼

               4. The Hitchhiker's Guide to the Galaxy, Douglas Adams 银河系漫游指南,道格拉斯·亚当斯

               5. Harry Potter and the Goblet of Fire, JK Rowling 哈利·波特与火焰杯,J.K.罗琳

               6. To Kill a Mockingbird, Harper Lee 杀死一只知更鸟,哈珀·李

               7. Winnie the Pooh, AA Milne 小熊维尼,A.A.米尔恩

               8. Nineteen Eighty-Four, George Orwell 1984,乔治·奥威尔

               9. The Lion, the Witch and the Wardrobe, CS Lewis 纳尼亚传奇:狮子、女巫、魔衣橱,C.S.刘易斯

               10. Jane Eyre, Charlotte Brontë 简·爱,夏绿蒂·勃朗特

               11. Catch-22, Joseph Heller 第22条军规,约瑟·海勒

               12. Wuthering Heights, Emily Brontë 呼啸山庄,艾米莉·勃朗特

               13. Birdsong, Sebastian Faulks 鸟之歌,塞巴斯蒂安·福克斯

               14. Rebecca, Daphne du Maurier 蝴蝶梦(吕蓓卡),达夫妮·杜穆里埃

               15. The Catcher in the Rye, JD Salinger 麦田里的守望者,J.D.塞林格

               16. The Wind in the Willows, Kenneth Grahame 柳林风声,肯尼斯·格雷厄姆

               17. Great Expectations, Charles Dickens 远大前程,查尔斯·狄更斯

               18. Little Women, Louisa May Alcott 小妇人,露意莎·梅·奥尔柯特

               19. Captain Corelli's Mandolin, Louis de Bernieres 柯莱利上尉的曼陀林,路易斯·德·贝尔尼埃

               20. War and Peace, Leo Tolstoy 战争与和平,列夫·托尔斯泰

               21. Gone with the Wind, Margaret Mitchell 飘,玛格丽特·米切尔

               22. Harry Potter And The Philosopher's Stone, JK Rowling 哈利·波特与魔法石,J.K.罗琳

               23. Harry Potter And The Chamber Of Secrets, JK Rowling 哈利·波特与密室,J.K.罗琳

               24. Harry Potter And The Prisoner Of Azkaban, JK Rowling 哈利·波特与阿兹卡班的囚徒,J.K.罗琳

               25. The Hobbit, JRR Tolkien 霍比特人,J.R.R.托尔金

               26. Tess Of The D'Urbervilles, Thomas Hardy 德伯家的苔丝,托马斯·哈代

               27. Middlemarch, George Eliot 米德尔马契,乔治·艾略特

               28. A Prayer For Owen Meany, John Irving 为欧文·米尼祈祷,约翰·欧文

               29. The Grapes Of Wrath, John Steinbeck 愤怒的葡萄,约翰·斯坦贝克

               30. Alice's Adventures In Wonderland, Lewis Carroll 爱丽丝漫游奇境记,刘易斯·卡罗尔

               31. The Story Of Tracy Beaker, Jacqueline Wilson 崔西·贝克的故事,杰奎琳·威尔森

               32. One Hundred Years Of Solitude, Gabriel García Márquez 百年孤独,加西亚·马尔克斯

               33. The Pillars Of The Earth, Ken Follett 圣殿春秋,肯·弗雷特

               34. David Copperfield, Charles Dickens 大卫·科波菲尔,查尔斯·狄更斯

               35. Charlie And The Chocolate Factory, Roald Dahl 查理和巧克力工厂,罗尔德·达尔

               36. Treasure Island, Robert Louis Stevenson 金银岛,罗伯特·路易斯·斯蒂文森

               37. A Town Like Alice, Nevil Shute 像爱丽丝的小镇,内维尔·舒特

               38. Persuasion, Jane Austen 劝导,简·奥斯丁

               39. Dune, Frank Herbert 沙丘,弗兰克·赫伯特

               40. Emma, Jane Austen 爱玛,简·奥斯丁

               41. Anne Of Green Gables, LM Montgomery 绿山墙的安妮,L.M.蒙哥马利

               42. Watership Down, Richard Adams 沃特希普荒原,理查德·亚当斯

               43. The Great Gatsby, F Scott Fitzgerald 了不起的盖茨比,斯科特·菲茨杰拉德

               44. The Count Of Monte Cristo, Alexandre Dumas 基督山恩仇记,大仲马

               45. Brideshead Revisited, Evelyn Waugh 旧地重游(故园风雨后),伊夫林·沃

               46. Animal Farm, George Orwell 动物农场,乔治·奥威尔

               47. A Christmas Carol, Charles Dickens 圣诞颂歌,查尔斯·狄更斯

               48. Far From The Madding Crowd, Thomas Hardy 远离尘嚣,托马斯·哈代

               49. Goodnight Mister Tom, Michelle Magorian 晚安,汤姆先生,米歇尔·麦格里安

               50. The Shell Seekers, Rosamunde Pilcher 海边拾贝人,罗莎蒙德·皮尔彻

               51. The Secret Garden, Frances Hodgson Burnett 秘密花园,法兰西丝·霍森·柏纳特

               52. Of Mice And Men, John Steinbeck 人鼠之间,约翰·斯坦贝克

               53. The Stand, Stephen King 末日逼近,斯蒂芬·金

               54. Anna Karenina, Leo Tolstoy 安娜·卡列尼娜,列夫·托尔斯泰

               55. A Suitable Boy, Vikram Seth 合适郎君,维克拉姆·塞斯

               56. The BFG, Roald Dahl 吹梦巨人,罗尔德·达尔

               57. Swallows And Amazons, Arthur Ransome 燕子与鹦鹉,亚瑟·兰塞姆

               58. Black Beauty, Anna Sewell 黑美人,安娜·休厄尔

               59. Artemis Fowl, Eoin Colfer 阿特米斯奇幻历险,艾欧因·寇弗

               60. Crime And Punishment, Fyodor Dostoyevsky 罪与罚,费奥多尔·陀思妥耶夫斯基

               61. Noughts And Crosses, Malorie Blackman 圈与叉,马洛里·布莱克曼

               62. Memoirs Of A Geisha, Arthur Golden 艺伎回忆录,亚瑟·高登

               63. A Tale Of Two Cities, Charles Dickens 双城记,查尔斯·狄更斯

               64. The Thorn Birds, Colleen McCollough 荆棘鸟,考琳·麦考洛

               65. Mort, Terry Pratchett 死神学徒(碟形世界系列之4),特里·普拉切特

               66. The Magic Faraway Tree, Enid Blyton 远方的魔法树,伊妮德·布莱顿

               67. The Magus, John Fowles 大法师,约翰·福尔斯

               68. Good Omens, Terry Pratchett and Neil Gaiman 好兆头,特里·普拉切特和尼尔·盖曼

               69. Guards! Guards!, Terry Pratchett 卫兵!卫兵!特里·普拉切特

               70. Lord Of The Flies, William Golding 蝇王,威廉·戈尔丁

               71. Perfume, Patrick Süskind 香水,帕特里克·聚斯金德(台湾译名徐四金)

               72. The Ragged Trousered Philanthropists, Robert Tressell 穿破裤子的慈善家,罗伯特.特莱塞尔

               73. Night Watch, Terry Pratchett 夜巡,特里·普拉切特

               74. Matilda, Roald Dahl 玛蒂尔达(小魔女),罗尔德·达尔

               75. Bridget Jones's Diary, Helen Fielding 布雷吉特·琼斯的日记(BJ单身日记),海伦·菲尔丁

               76. The Secret History, Donna Tartt 校园秘史,唐娜·塔特

               77. The Woman In White, Wilkie Collins 白衣女人,威尔基·柯林斯

               78. Ulysses, James Joyce 尤利西斯,詹姆斯·乔伊斯

               79. Bleak House, Charles Dickens 荒凉山庄,查尔斯·狄更斯

               80. Double Act, Jacqueline Wilson

               81. The Twits, Roald Dahl 蠢特夫妇,罗尔德•达尔

               82. I Capture The Castle, Dodie Smith 我的秘密城堡,道迪·史密斯

               83. Holes, Louis Sachar 洞(别有洞天),路易斯·萨奇尔

               84. Gormenghast, Mervyn Peake 歌门鬼城(幽灵古堡),马温·皮克

               85. The God Of Small Things, Arundhati Roy 微物之神,阿兰达蒂·洛伊

               86. Vicky Angel, Jacqueline Wilson 87. Brave New World, Aldous Huxley 美丽新世界,奥    尔德斯·赫胥黎

               88. Cold Comfort Farm, Stella Gibbons 寒冷舒适的农庄,斯特拉·吉本

               89. Magician, Raymond E Feist 魔法师,雷蒙·弗斯特

               90. On The Road, Jack Kerouac 在路上,杰克·克鲁亚克

               91. The Godfather, Mario Puzo 教父,马里奥·普佐

               92. The Clan Of The Cave Bear, Jean M Auel 爱拉与穴熊族,珍·奥尔

               93. The Colour Of Magic, Terry Pratchett 魔法的颜色(碟形世界系列之1),特里·普拉切特

               94. The Alchemist, Paulo Coelho 炼金术士,保罗·科埃略

               95. Katherine, Anya Seton 凯瑟琳,安雅·西顿

               96. Kane And Abel, Jeffrey Archer 该隐和亚伯,杰弗里·阿彻

               97. Love In The Time Of Cholera, Gabriel García Márquez 霍乱时期的爱情,加西亚·马尔克斯

               98. Girls In Love, Jacqueline Wilson 恋爱的女孩,杰奎琳·威尔森

               99. The Princess Diaries, Meg Cabot 公主日记,梅格·凯博特

               100. Midnight's Children, Salman Rushdie 午夜之子,萨尔曼·拉什迪

来源:人人网郗戈

Recipes

Algorithm complexity Big O notation

Design patterns in Java API


Creational patterns

Abstract factory (recognizeable by creational methods returning the factory itself which in turn can be used to create another abstract/interface type)

Builder (recognizeable by creational methods returning the instance itself)

Factory method (recognizeable by creational methods returning an implementation of an abstract/interface type)

Prototype (recognizeable by creational methods returning a different instance of itself with the same properties)

Singleton (recognizeable by creational methods returning the same instance (usually of itself) everytime)


Structural patterns

Adapter (recognizeable by creational methods taking an instance of different abstract/interface type and returning an implementation of own/another abstract/interface type which decorates/overrides the given instance)

Bridge (recognizeable by creational methods taking an instance of different abstract/interface type and returning an implementation of own abstract/interface type which delegates/uses the given instance)

  • None comes to mind yet. A fictive example would be new LinkedHashMap(LinkedHashSet, List) which returns an unmodifiable linked map which doesn't clone the items, but uses them. The java.util.Collections#newSetFromMap() and singletonXXX() methods however comes close.

Composite (recognizeable by behavioral methods taking an instance of same abstract/interface type into a tree structure)

Decorator (recognizeable by creational methods taking an instance of same abstract/interface type which adds additional behaviour)

Facade (recognizeable by behavioral methods which internally uses instances of different independent abstract/interface types)

Flyweight (recognizeable by creational methods returning a cached instance, a bit the "multiton" idea)

Proxy (recognizeable by creational methods which returns an implementation of given abstract/interface type which in turn delegates/uses a different implementation of given abstract/interface type)



Behavioral patterns

Chain of responsibility (recognizeable by behavioral methods which (indirectly) invokes the same method in another implementation of same abstract/interface type in a queue)

Command (recognizeable by behavioral methods in an abstract/interface type which invokes a method in an implementation of a different abstract/interface type which has been encapsulated by the command implementation during its creation)

Interpreter (recognizeable by behavioral methods returning a structurally different instance/type of the given instance/type; note that parsing/formatting is not part of the pattern, determining the pattern and how to apply it is)

Iterator (recognizeable by behavioral methods sequentially returning instances of a different type from a queue)

Mediator (recognizeable by behavioral methods taking an instance of different abstract/interface type (usually using the command pattern) which delegates/uses the given instance)

Memento (recognizeable by behavioral methods which internally changes the state of the whole instance)

Observer (or Publish/Subscribe) (recognizeable by behavioral methods which invokes a method on an instance of another abstract/interface type, depending on own state)

State (recognizeable by behavioral methods which changes its behaviour depending on the instance's state which can be controlled externally)

Strategy (recognizeable by behavioral methods in an abstract/interface type which invokes a method in an implementation of a different abstract/interface type which has been passed-in as method argument into the strategy implementation)

Template method (recognizeable by behavioral methods which already have a "default" behaviour definied by an abstract type)

Visitor (recognizeable by two different abstract/interface types which has methods definied which takes each the other abstract/interface type; the one actually calls the method of the other and the other executes the desired strategy on it)

File signatures or file magic bytes (numbers)

Convert SSL certificates between CRT, DER and PEM

openssl x509 -in mycert.crt -out mycert.der -outform DER
openssl x509 -in mycert.crt -out mycert.pem -outform PEM
openssl x509 -in mycert.der -inform DER -out mycert.pem -outform PEM

Ubuntu: import ssl certificate

sudo cp my_ca.crt /usr/share/ca-certificates/my_ca.crt
sudo echo "/usr/share/ca-certificates/my_ca.crt" >> /etc/ca-certificates.conf
sudo update-ca-certificates

Ubuntu Linux on Samsung N150/N210/N220 Netbook: how to adjust brightness

Installed Lubuntu 13.10 on my old Samsung N220 laptop, everything is ok except the screen is dark. And could not find the fn key to adjust the brightness. Tried install samsung-tools:
sudo add-apt-repository ppa:voria/ppa
sudo apt-get install samsung-tools
then use the Fn+F5 you can turn on/off the screen. However, still cannot adjust the brightness.
Searched around and found the following commands can turn screen bright/dark:
  • To turn it bright:
    sudo setpci -s 00:02.0 F4.B=CC
  • To turn it dark:
    sudo setpci -s 00:02.0 F4.B=50
Where CC and 50 are the brightness values. To check the current brightness value:
lspci -s 00:02.0 -xxx | grep f0: | awk '{print $6}'

With the above commands, it is possible to write a script to adjust the brightness and bind it to key combination.