<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>sort &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://wordpress.com/tag/sort/</link>
	<description>Feed of posts on WordPress.com tagged "sort"</description>
	<pubDate>Sun, 07 Sep 2008 08:46:47 +0000</pubDate>

	<generator>http://wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA[Face Recognition of Photos in Google Picasa 3]]></title>
<link>http://amnesiablog.wordpress.com/2008/09/03/face-recognition-of-photos-in-google-picasa-3/</link>
<pubDate>Tue, 02 Sep 2008 23:56:28 +0000</pubDate>
<dc:creator>eunmac</dc:creator>
<guid>http://amnesiablog.wordpress.com/2008/09/03/face-recognition-of-photos-in-google-picasa-3/</guid>
<description><![CDATA[This Tuesday Google is set to launch facial recognition in it&#8217;s photo managment software accor]]></description>
<content:encoded><![CDATA[<p>This Tuesday Google is set to launch facial recognition in it's photo managment software according to cnet (<a href="http://news.cnet.com/8301-13580_3-10026577-39.html?tag=nl.e703">here</a>).<br><br>Why is this important? Firstly Picasa (<a href="http://picasa.google.com/">here</a>) is still the best photo managment desktop software on the market (and it's free). I've been using it for a few years, have tried all the competitor products and it wins hands down every time. Note: It's not as social as Flickr - so I use them both.</p>
<p><a href="http://www.amnesia.com.au/blogimages/FaceRecognitionofPhotosinGooglePicasa3_8BD6/image.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="131" alt="image" src="http://www.amnesia.com.au/blogimages/FaceRecognitionofPhotosinGooglePicasa3_8BD6/image_thumb.png" width="233" border="0"></a><br><em>Picasa3 will find and sort all the photos of the same person.</em></p>
<p><strong>Facial recognition:</strong> I have about 18,000 digital photos sitting on my drive at home. Picasa handles them all nicely - but sorting, tagging etc is a nightmare. Finding a photo of someone is a manual process - this will hopefully correct that. The idea - tag one photo of a person and Picasa will do the rest. It's apparently not perfect - but this will be a huge jump for Picasa.<br><br><a title="http://picasa.google.com/" href="http://picasa.google.com/">http://picasa.google.com/</a></p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[FF13 Influenced by identity, terrorism and immigration]]></title>
<link>http://fantasyqelen.wordpress.com/?p=9</link>
<pubDate>Sun, 31 Aug 2008 14:36:38 +0000</pubDate>
<dc:creator>fantasyqelen</dc:creator>
<guid>http://fantasyqelen.wordpress.com/?p=9</guid>
<description><![CDATA[Final Fantasy’s latest main title; 13 is no different. The running main theme in 13 is identity. F]]></description>
<content:encoded><![CDATA[<p>Final Fantasy’s latest main title; 13 is no different. The running main theme in 13 is identity. From what we already know, the main antagonist, “Lightning”, will be suffering from some sort of memory loss and in turn she will be trying ...<br>www.finalfantasyseries.net</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Heroes Wanted: Dead or Alive]]></title>
<link>http://heroesioxez.wordpress.com/?p=10</link>
<pubDate>Sun, 31 Aug 2008 12:09:57 +0000</pubDate>
<dc:creator>heroesioxez</dc:creator>
<guid>http://heroesioxez.wordpress.com/?p=10</guid>
<description><![CDATA[I’m not really sure if today is some sort of holiday to honor our heroes but the main section of t]]></description>
<content:encoded><![CDATA[<p>I’m not really sure if today is some sort of holiday to honor our heroes but the main section of the Philippine Star has its editorial regarding heroes in our midst. It mentioned that it is Ramon Magsaysay’s 101th anniversary today. ...<br>crisn.wordpress.com</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Drame familial à Brossard:  Un jugement dangereux!]]></title>
<link>http://richard3.wordpress.com/?p=1141</link>
<pubDate>Fri, 29 Aug 2008 17:24:28 +0000</pubDate>
<dc:creator>Richard3</dc:creator>
<guid>http://richard3.wordpress.com/?p=1141</guid>
<description><![CDATA[À la page 12, du Journal de Montréal d&#8217;aujourd&#8217;hui, un article de David Santerre, repr]]></description>
<content:encoded><![CDATA[<p>À la page 12, du Journal de Montréal d'aujourd'hui, <a href="http://www.canoe.com/infos/societe/archives/2008/08/20080829-084800.html" target="_blank">un article de David Santerre</a>, repris par le site Canoê, mentionne que le tribunal a accordé un montant d'environ 80,000$ à une famille, pour les souffrances qu'elle a endurée depuis un drame familial, survenu sur la rive sud de Montréal.</p>
<p>Revoyons les faits.  Le 22 avril 2002, la gardienne des enfants du couple composé de Martin Brossard et de Liliane de Montigny, se rend au domicile familial, de la rue Booker, à Brossard.  Elle y voit le corps de Martin, balançant au bout d'une corde, dans le salon.  Les policiers, appelés sur place, découvrent les corps de Liliane, étranglée dans une chambre, et des deux fillettes du couple, Claudia, 4 ans, et Béatrice, 18 mois, noyées dans la baignoire.  L'article révèle que plus tard, des membres de la famille de Liliane, soit son père Marcel, et ses soeurs Karen et Sandra, logeaient une poursuite de 730,000$ contre la succession de Martin Brossard pour dommages, souffrances pour eux et les victimes, et les frais funéraires.  Suite à la décision de la Cour supérieure, de leur octroyer 70,000$, les poursuivants en ont appelé, parce que le jugement ne condamnaient la succession ni à des dommages punitifs, ni pour les souffrances infligées aux victimes, ni au paiement des frais funéraires, selon ce que rapporte l'article.</p>
<p>La seule décision que la Cour d'appel a modifié, par rapport au jugement original de la Cour supérieure, c'est l'allocation d'une somme supplémentaire de 11,102$, pour les frais funéraires.  L'article résume les raisons évoquées par la Cour d'appel, dans son jugement.</p>
<p>Pour ma part, je suis porté à dire qu'il s'agit là d'un jugement dangereux.  À mes yeux, les événements n'impliquaient que Martin Brossard, son épouse et ses enfants.  Compte tenu que Brossard était majeur, et que rien n'indique qu'il n'était pas sain d'esprit, au moment des événements, je ne vois pas en quoi la succession de Brossard aurait à payer quelque somme que ce soit à des membres de la famille de Liliane.  À moins, évidemment, que les membres de la succession de Brossard, visés par la poursuite, aient eu un quelconque lien avec les gestes.  S'il était prouvé, par exemple, que Martin avait subi des pressions, de la part de ces personnes, pressions qui auraient pu déboucher sur les événements tragiques.  Sinon, pourquoi poursuivre la succession de Martin Brossard?</p>
<p>Bien sûr, on ne connaît pas toute l'histoire.  Est-ce que des discussions, entre les deux familles, se seraient soldées par une discorde, au niveau des frais funéraires?  Est-ce que le famille de Martin Brossard a fait preuve de mépris, de suffisance, ou d'autres types de comportements reprochables, envers celle de Liliane de Montigny?  Est-ce à croire, d'un autre côté, que la famille de Brossard n'a subi aucun préjudice, n'a vécu aucune souffrance, suite à ces événements?  Le cas échéant, pourquoi ne poursuivent-ils pas à leur tour?</p>
<p>Malgré mon respect pour les deux familles en cause, ici, je persiste à croire que ce genre de jugement ouvre toute grande la porte à beaucoup d'abus.  Imaginez, vous pourriez être poursuivis parce que votre fils de 18 ans ou plus, ou votre frère, majeur, a commis un geste disgracieux envers quelqu'un.  Il me semble qu'un adulte est le seul responsable de ses propres gestes, et que l'on peut poursuivre les membres de la famille d'un individu jugé coupable dans le seul cas où celui-ci est mineur, ou encore lorsqu'il est prouvé qu'il n'est pas responsable de ses gestes.  Qu'on me corrige si j'ai tort, mais un tel jugement pourrait faire en sorte que toute victime d'un vol, d'une agression sexuelle, ou d'un autre crime, pourrait poursuivre la famille du prévenu, une fois celui-ci trouvé coupable.  Cela fait en sorte que l'on pourrait même être poursuivi en justice, suite à des gestes commis par des membres de sa famille, et ce même si l'on a pas de contacts directs avec ceux-ci.</p>
<p>Un jugement dangereux, à mes yeux.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Sort the files and folders - про сортировку в файндере]]></title>
<link>http://nikvdnx.wordpress.com/?p=84</link>
<pubDate>Mon, 25 Aug 2008 13:24:48 +0000</pubDate>
<dc:creator>nikvdnx</dc:creator>
<guid>http://nikvdnx.wordpress.com/?p=84</guid>
<description><![CDATA[вообщем нужно будет еще порыться в плистах файндера и ]]></description>
<content:encoded><![CDATA[<p>вообщем нужно будет еще порыться в плистах файндера и пасфайндера.<br><br />
<br><br />
сортировка папок и файлов зависит от алфавита. например, в русской локале, чтобы сделать папки впереди файлов нужно сделать <strong>подчеркивание</strong>:<br><br />
<br></p>
<blockquote><p>ищем System/Library/CoreServices/Finder.app/Contents/Resources/ru.lproj/InfoPlist.strings<br><br />
<br><br />
/* Localized versions of Info.plist keys */<br><br />
<br><br />
/* Bundle information */<br><br />
CFBundleName = "Finder";<br><br />
<br><br />
/* General kind strings */<br><br />
"Folder" = "_Папка";<br><br />
"Volume" = "Том";<br><br />
"Burn Folder" = "Новая папка записи";<br>
</p></blockquote>
<p><br><br />
<em>спасибо коммьюнити http://community.livejournal.com/ru_mac/</em></p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Hot News... beyond Monday Blues ]]></title>
<link>http://rarehitlerphotos.wordpress.com/?p=9</link>
<pubDate>Mon, 25 Aug 2008 02:02:43 +0000</pubDate>
<dc:creator>goldenera2020</dc:creator>
<guid>http://rarehitlerphotos.wordpress.com/?p=9</guid>
<description><![CDATA[

 

 

King of Mystery-tHe mYsTic KinG !!
 
Genetic material from outer space found in a meteori]]></description>
<content:encoded><![CDATA[<div><em></em></div>
<div><em></em></div>
<p> </p>
<div><em></em></div>
<p> </p>
<p><em><span style="color:#0000ff;"></p>
[caption id="attachment_12" align="alignleft" width="448" caption="King of Mystery-tHe mYsTic KinG !!"]<img class="size-full wp-image-12" src="http://rarehitlerphotos.wordpress.com/files/2008/08/hitler-480_preview1.jpg" alt="King of Mystery-tHe mYsTic KinG !!" width="448" height="640" />[/caption]
<p> </p>
<div><em><span style="color:#0000ff;"><img class="aligncenter size-full wp-image-10" src="http://rarehitlerphotos.wordpress.com/files/2008/08/nazi_flag_3751.jpg" alt="" width="375" height="281" />Genetic material from outer space found in a meteorite in Australia may well have played a key role in the origin of life on Earth, according to a study to be published Sunday. European and US scientists have proved for the first time that two bits of genetic coding, called nucleobases, contained in the meteor fragment, are truly extraterrestrial. Previous studies had suggested that the space rocks, which hit Earth some 40 years ago, might have been contaminated upon impact. Both of the molecules identified, uracil and xanthine, "are present in our DNA and RNA," said lead author Zita Martins, a researcher at Imperial College London. RNA, or ribonucleic acid, is another key part of the genetic coding that makes up our bodies. These molecules would also have been essential to the still-mysterious alchemy that somehow gave rise, some four billion years ago, to life itself. "We know that meteorites very similar to the Murchison meteorite, which is the one we analysed, were delivering the building blocks of life to Earth 3.8 to 4.5 billion years ago," Martins told AFP in an interview. Competing theories suggest that nucleobases were synthesised closer to home, but Martins counters that the atmospheric conditions of early Earth would have rendered that process difficult or impossible. A team of European and US scientists showed that the two types of molecules in the Australian meteorite contained a heavy form of carbon - carbon 13 - which could only have been formed in space. "We believe early life may have adopted nucleobases from meteoric fragments for use in genetic coding, enabling them to pass on their successful features to subsequent generations," Martins said.</span></em></div>
<div><em><span style="color:#0000ff;"> </span></em></div>
<p> </p>
<div><em><span style="color:#0000ff;"> </span></em></div>
<p> </p>
<p><em><span style="color:#0000ff;"> </p>
<p></span></em></p>
<p></span></em> </p>
<p> </p>
<p> </p>
<p><em><span style="color:#0000ff;">If so, this would have been the start of an evolutionary process leading over billions of years to all the flora and fauna - including human beings - in existence today. The study, published in Earth Planetary Science Letters, also has implications for life on other planets. "Because meteorities represent leftover materials from the formation of the solar system, the key components of life - including nucleobases - could be widespread in the cosmos," said co-author Mark Sephton, also at Imperial College London.</span></em></p>
<p> </p>
<p> </p>
<p>.....................................................................................................................................................</p>
<p><em><span style="color:#0000ff;">There also is a strong possibility of having a close MASS encounter of the 3rd-4th kind in the recent future. Millenium will start with a new trouble. A trouble in accordance to our development, communication and complexity in almost all the aspects of our lives....</span></em></p>
<p><em><span style="color:#0000ff;">                                                                                                   </span></em></p>
<p><em><span style="color:#0000ff;">                                                                                                             <img class="alignnone size-full wp-image-11" src="http://rarehitlerphotos.wordpress.com/files/2008/08/a1909_2_1_-329x252.jpg" alt="" width="329" height="252" /></span></em></p>
<p><em></em> </p>
<p><em><span style="color:#0000ff;">Some even talk about a possible link</span></em></p>
<p><em><span style="color:#0000ff;">NAZI--&#62;Hitler--&#62;ALieN--&#62;Agharta Vs Shambala--&#62;Shangri-La--&#62;KoNNecTioN !!</span></em></p>
<p><em></em> </p>
<p><em><span style="color:#0000ff;">                                        </span><span style="color:#ff0000;">----------------&#62;&#60;-----------------&#62;&#60;---------------------&#62;&#60;--------------</span></em></p>
<p><em></em> </p>
<div><em><span style="color:#0000ff;">       </span></em></div>
<div><em><span style="color:#0000ff;"> </span></em></div>
<p> </p>
<div><em><span style="color:#0000ff;"> </span></em></div>
<p> </p>
<p><em><span style="color:#0000ff;"> </p>
<p></span></em></p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Khảo sát thuật toán sắp xếp nhanh nhất]]></title>
<link>http://ilivevn.wordpress.com/?p=41</link>
<pubDate>Fri, 22 Aug 2008 20:35:38 +0000</pubDate>
<dc:creator>noob</dc:creator>
<guid>http://ilivevn.wordpress.com/?p=41</guid>
<description><![CDATA[Một trong những nhiệm vụ thông thường nhất của máy tính là sắp xếp dữ liệ]]></description>
<content:encoded><![CDATA[<p class="MsoNormal">Một trong những nhiệm vụ thông thường nhất của máy tính là sắp xếp dữ liệu nhằm phân tích và xử lý lượng dữ liệu đó. Đã có rất nhiều thuật toán nhằm tìm ra cách thức đơn giản nhất và nhanh nhất thực hiện nhiệm vụ này. Trong phạm vi bài báo này, chúng ta sẽ cùng khảo sát thời gian thực hiện của một số thuật toán xắp xếp đơn giản, một vài thuật toán đã được giới thiệu trong giáo trình toán rời rạc 1 + 2 của chúng ta. <span> </span></p>
<p><!--more--></p>
<p><strong>Sắp xếp nổi</strong> <strong>bọt</strong> - Sắp xếp nổi bọt là một thuật toán rất phổ biến, nhưng kô phải lựa chọn tốt nhất</p>
<p><strong>Sắp xếp chèn - </strong>Sắp xếp chèn tỏ ra hữu dụng trong một vài trường hợp, đặc biệt khi nó được sử dụng làm nền cho thuật toánk hác</p>
<p><strong>Sắp xếp trung điểm - </strong>Thuật toán sắp xếp trung điểm được cho là một thụât toán cổ điển nổi tiếng vì sự tối ưu mã nguồn cao</p>
<p><strong>Sắp xếp theo danh sách đa kết nối</strong> - có vẻ đây là phương pháp nhanh nhất, nhưng chỉ trong vài trường hợp đặc biệt</p>
<p><strong>Sắp xếp giảm dần</strong> - Nếu bạn chỉ học một thuật toán sắp xếp, học sắp xếp nhân.</p>
<p align="center"><strong>Thời gian thực nghiệm</strong></p>
<p>Dữ liệu để kiểm tra thời gian thực nghiệm được sinh ra bởi thuật toán sinh số ngẫu nhiên. Điều này cho phép mỗi thuật toán sắp xếp phải làm việc trên các số ngẫu nhiên đồng nhất. Thời gian cuối cùng sẽ là giá trị trung bình của 10 lần chạy khác nhau.</p>
<p>Thực nghiệm này được thực hiện trên bộ vi xử lý Pentium 3 Ghz. Kô có chương trình nào chạy đồng thời trong thời gian thí nghiệm, ngoại trừ Windows XP<strong></strong></p>
<p align="center">Bubble Sort</p>
<p align="center"><strong>Sắp xếp nổi bọt</strong></p>
<p>Sắp xếp nổi bọt là một thuật toán đơn giản và rất dễ viết mã, nhưng nó là một thuật toán khá lâu đời và nhiều khi kô thích hợp với các ứng dụng số lớn. Khi chúng ta tăng gấp đôi số lượng đơn vị cần sắp xếp, thời gian sắp xếp sẽ tăng lên bốn lần. Nếu con số đó tăng lên là 10, thời gian sắp xếp sẽ tăng lên 100. Kết quả thực nghiệm được cho dưới đây:</p>
<p>Sort 10,000      Sort 100,000<br />
Random Numbers    Random Numbers<br />
Time        0.366 sec.       36.702 sec.</p>
<p align="center"><strong>Insertion Sort</strong></p>
<p align="center"><strong>Sắp xếp chèn</strong></p>
<p>Sắp xếp kiểu chèn tuần tự được mô tả giống như cách bạn có thể sắp xếp các quân bài cùng chất. Bạn chọn lấy một quân bài, so sánh nó với quân bài bên cạnh và đặt nó vào vị trí phù hợp.</p>
<p>Cho dù sắp xếp chèn cũng là một thuật toán có thời gian xử lý tăng gấp bốn khi số đơn vị tăng lên gấp đôi, xắp xếp chèn tuần tự cũng có vài ưu điểm so với sắp xếp nổi bọt.</p>
<p>1) Thuật toán này tỏ ra vượt trội với danh sách nhỏ ( ít hơn 30 thành tố )</p>
<p>2) Thuật toán chèn là nền tảng cho thuật toán xắp xếp giảm dần ( Shell sort ). Khi bạn học sắp xếp chèn, sắp xếp Shell là một thuật toán bổ sung quan trọng</p>
<p>3) Sắp xếp chèn thực hiện rất nhanh cho mảng gần như đã được sắp xếp. Nó rất hữu hiệu cho đợt sắp xếp cuối cùng sau khi đã thực hiện xắp xếp nhanh ( Quicksort )</p>
<p>4) Các máy tính hiện đại đều có bộ nhớ đệm có thể truy cập nhanh hơn các bộ nhớ thông thường. Mỗi khi Insertsort thực hiện sắp xếp một phần của mảng, phần đó sẽ được lưu vào bộ nhớ đệm của máy tính và làm giảm thời gian thực hiện sắp xếp</p>
<p>Sort 10,000      Sort 100,000<br />
Random Numbers    Random Numbers<br />
Time        0.055 sec.       5.392 sec.</p>
<p align="center"><strong>Multiple Link List Sort</strong></p>
<p align="center"><strong>Xắp xếp các danh sách liên kết đa chiều</strong></p>
<p>Sắp xếp các danh sách liên kết đa chiều chỉ có hiệu quả với các dữ liệu và điều kiện tính toán nhất định, cho dù vậy, vẫn có những sự tương hợp với tốc độ thực hiện kết quả của nó. Trong những điều kiện cho phép, đây sẽ là thuật toán xắp xếp nhanh nhất. MLLsort là một phép xắp xếp các địa chỉ cần tính toán. Với mỗi số được xắp xếp, thuật toán sẽ so sánh giá trị của số đó và đưa ra vị trí phù hợp trong danh sách đã được xắp xếp</p>
<p>Tiến trình này có vẻ giống với cách thức xắp xếp trong trò chơi lắp ráp các khối hình. Bạn chọn ngẫu nhiên một đối tượng, so sánh nó với các đối tượng khác trên tổng thể toàn bức tranh, và đặt mẩu ảnh đó vào vị trí phù hợp. Sau đó chọn một đối tượng thứ hai và lặp lại quá trình trên. Mỗi phần chỉ cần thực hiện một lần, và sau khi bạn kết thúc việc chọn các phần khác nhau đặt vào các vị trí phù hợp, trò chơi sẽ kết thúc.</p>
<p>Thuật toán MLLS chạy trong thời gian tuyến tính ( kô phải log(n) hay log(log(n))). Đó là lý do đôi lúc nó là thuật toán sắp xếp nhanh nhất.</p>
<p>Sort 1,000,000    Sort 10,000,000<br />
Random Numbers     Random Numbers<br />
Time        0.127 sec.        1.230 sec.</p>
<p><strong><br />
</strong></p>
<p align="center"><strong>Median-of-three Quicksort</strong></p>
<p align="center"><strong>Sắp xếp trung điểm</strong></p>
<p>Quicksort là thuật toán sinh xắp xếp thông thường nhất. Quicksort có thể làm việc trên bất kì kiểu dữ liệu nào. Nó còn đòi hỏi một số ít hơn các bộ nhớ được cấp phép so với MLLsort</p>
<p>Quicksort có điểm yếu là khó viết mã. Tuy vậy, cái nghèo nhất của Quicksort là làm chậm thời gian xắp xếp với một số kiểu dữ liệu - nhiều khi là một phần dữ liệu. Nếu Quicksort được viết mã theo phương pháp thông thường, nó sẽ chạy với khoảng thời gian là N*(Log(N)), và có thể chạy lâu hơn các thuật toán N*log(N) khác như Heapsort hay Merge Sort</p>
<p>Cách làm việc của Quicksort các bạn có thể tham khảo trong sách Toán rời rạc</p>
<p>Theo dõi kết quả bảng dưới đây, biến "MinGroup" đại diện một khối đơn vị thuật toán lựa chọn để xắp xếp.</p>
<p>&#60;- - - - - - - - Sort 1,000,000 Elements - - - - - - - -&#62;<br />
MinGroup  MinGroup  MinGroup  MinGroup  MinGroup  MinGroup  MinGroup<br />
= 20      = 40      = 50      = 60      = 70      = 80     = 100<br />
Time   0.186     0.178     0.176     0.178     0.181     0.177    0.178 sec.</p>
<p>&#60;- - - - - - - - Sort 10,000,000 Elements - - - - - - - -&#62;<br />
MinGroup  MinGroup  MinGroup  MinGroup  MinGroup  MinGroup  MinGroup<br />
= 20      = 40      = 50      = 60      = 70      = 80     = 100<br />
Time   2.163     2.112     2.097     2.089     2.097     2.094    2.111 sec.</p>
<p align="center">
<p align="center">
<p align="center"><strong>Shell Sort</strong></p>
<h1 style="text-align:center;">Sắp xếp vớI độ dài bước giảm dần</h1>
<p>Nếu bạn chỉ học một loại thuật toán sắp xếp, hãy tập trung vào Shell sort. Viết mã Shell sort dễ dàng hơn viết mã Quicksort và nó cũng nhanh gần như Quicksort</p>
<p>Shellsort có nguồn gốc từ Insertion Sort. Khi chạy chương trình, nếu bạn làm vịêc với số lượng đối tượng nhỏ, nó hoàn toàn giống với Insertsort. Nhưng nếu bạn làm việc với số lớn, nó sẽ là sự mở rộng của Insert Sort. Shell sort phá các mảng thành các phần nhỏ hơn đúng theo " Inserion sort"</p>
<p>---------------------------------------------------------------<br />
RandNbrs &#124; A &#124; B &#124; C &#124; D &#124; A &#124; B &#124; C &#124; D &#124; A &#124; B &#124; C &#124; D &#124; A &#124; B &#124; C &#124; D &#124;<br />
---------------------------------------------------------------<br />
Index(Pos) 1   2   3   4   5   6   7   8   9   10  11  12  13  14  15  16</p>
<p>Ví dụ, cho rằng bạn đang sắp xếp 16 thành tố và đặt cờ kí hiệu A ( flag ) vào các giá trị 1,4,13. Thuật toán sẽ chia cả mảng thành các phần có kích cỡ là 4. Lúc này nó sẽ làm việc như là sắp xếp chèn. 3 vị trí tiếp theo thuật toán sẽ sử dụng tới các số đánh dấu "B", "C", "D". Khi tiến trình kết thúc, mảng sẽ được sắp xếp một cách hoàn thiện.</p>
<p>Bảng kết quả thời gian thực nghiệm</p>
<p>&#60;- - - - - - Sort 1,000,000 Elements - - - - - -&#62;<br />
Use 1, 3, 7,      Use 1, 4, 13,     Use 1, 8, 23,<br />
for "Gaps"        for "Gaps"        for "Gaps"<br />
Time    0.337 sec.        0.422 sec.        0.297 sec.</p>
<p>&#60;- - - - - - Sort 10,000,000 Elements - - - - - -&#62;<br />
Use 1, 3, 7,      Use 1, 4, 13,     Use 1, 8, 23,<br />
for "Gaps"        for "Gaps"        for "Gaps"<br />
Time    4.389 sec.        6.858 sec.        3.997 sec.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[SPVM: Yves Francoeur en a "plein son casque"; moi aussi, mais pas pour les mêmes raisons!]]></title>
<link>http://richard3.wordpress.com/?p=1128</link>
<pubDate>Fri, 22 Aug 2008 00:00:27 +0000</pubDate>
<dc:creator>Richard3</dc:creator>
<guid>http://richard3.wordpress.com/?p=1128</guid>
<description><![CDATA[&#8220;Lève-toi debout, comporte-toi comme un général, montre-nous le chemin.&#8220;
C&#8217;est ]]></description>
<content:encoded><![CDATA[<p>"<span style="color:#ff0000;">Lève-toi debout, comporte-toi comme un général, montre-nous le chemin.</span>"</p>
<p>C'est en ces termes que Yves Francoeur, président de la Fraternité des policiers et policières de Montréal (FPPM) s'est adressé au chef du Service de police de la ville de Montréal, Yvan Delorme, du moins si l'on se fie à <a href="http://www.canoe.com/infos/quebeccanada/archives/2008/08/20080821-051401.html" target="_blank">un article du Journal de Montréal, signé Mélanie Brisson</a>, et repris par le site Canoë.  Je ne saurais dire si le chef Delorme a eu l'air d'un agent socio-communautaire, depuis les événements de Montréal-Nord, ce que lui reproche le président du FPPM, parce que je ne l'ai pas suivi, mais si je puis dire une chose, c'est qu'avant de blâmer leur chef sur la place publique, les policiers devraient commencer par se regarder dans le miroir.  Je m'explique.</p>
<p>De par sa déclaration, le président du FPPM demande à son chef un comportement digne d'un organisme paramilitaire.  C'est d'ailleurs la hiérarchie militaire que l'on retrouve, au demeurant, dans la plupart des services de police.  Or, nommez-moi un général qui a déjà commandé des troupes syndiquées, vous!  Avez-vous déjà vu un militaire porter autre chose que son uniforme, dans le seul but de faire des moyens de pression?  Les policiers du SPVM, comme ceux de partout ailleurs, sont syndiqués, et suivent les consignes de leur exécutif syndical, lorsque celui-ci le leur demande.  C'est la raison pour laquelle les policiers patrouillent en jeans, et revêtent une casquette rouge; ceux-ci sont en négociation pour le renouvellement de leur convention collective.</p>
<p>On ne peut pas diriger des troupes qui ne sont pas entièrement dédiées à leur mission, sinon le bordel prend assez rapidement, merci.  Or, que voit-on, au SPVM?  Des policiers en jeans, avec des calottes rouges (excellente cible pour un tireur isolé, dans une émeute, en passant), qui se mettent en formation, pour affronter des émeutiers, et ce seulement après que le bordel soit bien pris (encore la faute des boss, évidemment!).  Je dirais que cela ressemble presque... à une manifestation!  Surtout depuis que la taille des agents ne fait plus partie des critères d'embauche.  On leur aurait mis une casquette des Expos, au lieu de leur calotte rouge, et on aurait dit la foule qui sortait du stade olympique, après un match!  Si Yves Francoeur prétend que les policiers sont "tannés d'avoir l'air fou", quelqu'un devrait lui renouveler la mémoire, et lui dire que c'est eux, qui ont commencé!</p>
<p>Si les policiers veulent avoir le soutien de leur chef, je crois que ce serait une bonne idée si les policiers offraient d'abord du soutien à leur chef, en commençant par porter l'uniforme qui leur est désigné.  Après tout, comment peut-on imposer le respect aux contrevenants si l'on ne l'applique pas soi-même envers ses supérieurs?  Peut-être que les paroles du chef Delorme se veulent, elles aussi, des moyens de pression envers les policiers, afin qu'ils prennent leur travail un peu plus au sérieux.  Peut-être que les policiers sont tannés d'avoir l'air fou, mais selon eux, est-ce que les contribuables ne sont pas tannés, eux aussi, de tenter de croire qu'ils sont protégés par des policiers qui agissent en fonction de leur convention collective?</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[If I only had opposable thumbs I could help put all this stuff away]]></title>
<link>http://omwoman.wordpress.com/?p=272</link>
<pubDate>Sat, 16 Aug 2008 15:28:37 +0000</pubDate>
<dc:creator>omwoman</dc:creator>
<guid>http://omwoman.wordpress.com/?p=272</guid>
<description><![CDATA[Guess how I am spending my weekend?

My goal this week was to stop by the apartment every day and mo]]></description>
<content:encoded><![CDATA[<h4>Guess how I am spending my weekend?</h4>
<p><a href="http://omwoman.files.wordpress.com/2008/08/dsc00005.jpg"><img class="alignnone size-medium wp-image-271" src="http://omwoman.wordpress.com/files/2008/08/dsc00005.jpg?w=300" alt="" width="300" height="225" /></a></p>
<p>My goal this week was to stop by the apartment every day and move a few things.  So, in the pouring rain all week we moved a whole bunch of my stuff.  Now the fun part, sorting it all out and finding a home for it here at the house.  Luckily some of it has been already put away.</p>
<p>This is supposed to be exciting, but I am so overwhelmed at this point.   I want to join Boo, take refuge and take a long cozy quiet nap.</p>
<h4><a href="http://omwoman.files.wordpress.com/2008/08/dsc00002.jpg"><span style="color:#000000;text-decoration:none;"><img class="alignnone size-medium wp-image-273" src="http://omwoman.wordpress.com/files/2008/08/dsc00002.jpg?w=300" alt="" width="300" height="225" /></span></a></h4>
<h4><em>But if they put all this stuff away where will I nap? </em></h4>
<p><a href="http://omwoman.files.wordpress.com/2008/08/dsc00004_2.jpg"><img class="alignnone size-medium wp-image-274" src="http://omwoman.wordpress.com/files/2008/08/dsc00004_2.jpg?w=300" alt="" width="300" height="225" /></a></p>
<p>Guess it's time to stop procrastinating.....</p>
<p>Oh and I forgot to tell you....We were notified by the town yesterday that we have e-coli in the water (icky- ick-ick).  Authorities state the water ban probably won't be lifted until Monday!  Fun weekend, so in between unpacking boxes we are boiling H20.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Nuttede Hipsters / Cute Hipsters]]></title>
<link>http://pocolindo.wordpress.com/?p=20</link>
<pubDate>Sat, 16 Aug 2008 11:12:10 +0000</pubDate>
<dc:creator>pocolindo</dc:creator>
<guid>http://pocolindo.wordpress.com/?p=20</guid>
<description><![CDATA[
[Th1]
Ugle hipsters
Super fine og lækre bomuldshipsters med det sødeste uglemotiv.
Størrelse Lar]]></description>
<content:encoded><![CDATA[<p><a href="http://pocolindo.files.wordpress.com/2008/08/th3.jpg"></a><a href="http://pocolindo.files.wordpress.com/2008/08/th1.jpg"><img class="alignnone size-medium wp-image-22" src="http://pocolindo.wordpress.com/files/2008/08/th1.jpg?w=300" alt="" width="300" height="225" /></a></p>
<p><strong>[</strong>Th1<strong>]</strong></p>
<p><strong>Ugle hipsters</strong><br />
Super fine og lækre bomuldshipsters med det sødeste uglemotiv.<br />
Størrelse Large<br />
Pris: 25DKK</p>
<p><strong>Hooting Hipsters<br />
</strong>The finest cottonhipsters with cute owls.<br />
Size large<br />
Sold at: $5</p>
<p><a href="http://pocolindo.files.wordpress.com/2008/08/th2.jpg"><img class="alignnone size-medium wp-image-23" src="http://pocolindo.wordpress.com/files/2008/08/th2.jpg?w=300" alt="" width="300" height="225" /></a></p>
<p><strong>[</strong>Th2<strong>]</p>
<p>Hipsters med søde hjerter</strong><br />
Perfekt gave til én du holder af.<br />
Størrelse Large<br />
Pris: 25DKK</p>
<p><strong>Cute heart hipsters<br />
</strong>Perfect present for the one you love.<br />
Size Large<br />
Sold at: $5</p>
<p><a href="http://pocolindo.files.wordpress.com/2008/08/th3.jpg"><img class="alignnone size-medium wp-image-24" src="http://pocolindo.wordpress.com/files/2008/08/th3.jpg?w=300" alt="" width="300" height="225" /></a></p>
<p><strong>[</strong>Th3<strong>]</strong></p>
<p><strong>Storehovedet hunde hipsters<br />
</strong>Super søde gule hipsters med hundemotiv.<br />
Størrelse Large<br />
Pris: 25DKK</p>
<p><strong>Hipsters with big headed hounds<br />
</strong>Cute yellow hipsters with dog motive.<br />
Size Large<br />
Sold at: $5</p>
<p><a href="http://pocolindo.files.wordpress.com/2008/08/th41.jpg"><img class="alignnone size-medium wp-image-27" src="http://pocolindo.wordpress.com/files/2008/08/th41.jpg?w=300" alt="" width="300" height="225" /></a></p>
<p><strong>[</strong>Th4<strong>]</p>
<p>Frugt Hipsters<br />
</strong>Sunde og skønne hipsters.<br />
Størrelse Large<br />
Pris: 25DKK</p>
<p><strong>Fruity Hipsters<br />
</strong>Healthy and comfortable hipsters.<br />
Sixe Large<br />
Sold at: $5</p>
<p><a href="http://pocolindo.files.wordpress.com/2008/08/th5.jpg"><img class="alignnone size-medium wp-image-26" src="http://pocolindo.wordpress.com/files/2008/08/th5.jpg?w=300" alt="" width="300" height="225" /></a></p>
<p><strong>[</strong>Th5<strong>]</strong></p>
<p><strong>Hunde Hipsters</strong><br />
Søde med hunde i 3 farver.<br />
Størrelse Large<br />
Pris: 25DKK</p>
<p><strong>Dog Hipsters<br />
</strong>Cute with dogs in 3 colors.<br />
Size Large<br />
Sold at: $5</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Comando sort]]></title>
<link>http://ivanix.wordpress.com/?p=131</link>
<pubDate>Fri, 15 Aug 2008 03:41:38 +0000</pubDate>
<dc:creator>Nix</dc:creator>
<guid>http://ivanix.wordpress.com/?p=131</guid>
<description><![CDATA[Falando ainda sobre comandos&#8230; no post anterior, conhecemos o comando echo e os operadores de r]]></description>
<content:encoded><![CDATA[<p>Falando ainda sobre comandos... no post anterior, conhecemos o comando echo e os operadores de redirecionamento.</p>
<p>O arquivo que criamos com o comando echo foi o cad_povo.txt... e depois, utilizamos o comando cut para recortar colunas desse arquivos!</p>
<p>Só que, ao usar o comando cut para recortar o arquivo cad_povo.txt, a saída do comando ficou na tela! Assim como quando conhecemos o cut, tivemos que chamar o diretor prá dar uma olhada na lista de usuários do sistema...</p>
<p>Então, deixar a saída somente na tela, pode não ser interessante! Se a listagem de usuários for grande... o diretor vai ficar um pouco estressado, e vai querer nos cortar da equipe! =/</p>
<p>A solução, é enviar a saída do comando para um arquivo que o diretor depois pode imprimir!</p>
<p>Pegando o exemplo do /etc/passwd, vamos cortar novamente a primeira coluna deste arquivo para termos a lista de nomes... e aí, em seguida, vamos jogar a lista em um arquivo chamado usuarios.txt:</p>
<p><strong># cut -d : -f 1 /etc/passwd &#62; usuarios.txt</strong></p>
<p>Só relembrando sobre os operadores de redirecionamento... vejam que usei o &#62;; isso quer dizer que, se esse arquivo já existir, ele apaga o conteúdo primeiro, e, se não existir, cria o arquivo!</p>
<p>Vejamos como ficou esse arquivo:</p>
<p><strong># cat usuarios.txt<br />
root<br />
daemon<br />
bin<br />
sys<br />
sync<br />
</strong><br />
Vejam que nesse arquivo, tem apenas a coluna 1 do arquivo original que era o /etc/passwd com os nomes dos usuários cadastrados na máquina!</p>
<p>Mas um detalhe, esse arquivo não está em ordem! Para isso, vamos colocar em ação, o comando sort, que vai nos ajudar a ordenar esse arquivo que criamos:</p>
<p><strong># sort usuarios.txt<br />
backup<br />
bin<br />
daemon<br />
games<br />
gnats<br />
</strong><br />
Vejam que ele ordenou o arquivo... porém a saída do comando está na tela, então, temos que redirecionar o arquivo organizado para outro arquivo:</p>
<p><strong># cat usuarios_ordenados.txt<br />
backup<br />
bin<br />
daemon<br />
games<br />
gnats<br />
</strong><br />
Uma opção interessante desse comando, é o reverso, ou seja, ou seja, ordenar de trás para frente!</p>
<p>Por exemplo, mostrar a listagem de usuários de Z-&#62; A e não de A -&#62; Z:</p>
<p><strong># sort -r usuarios.txt<br />
www-data<br />
uucp<br />
sys<br />
sync<br />
sshd</strong></p>
<p><strong></strong>É isso, pessoas... assim como outros comandos no Linux, o sort tem outras opções que não foram comentadas aqui... para se aprofundar mais:</p>
<p><strong># man sort</strong></p>
<p>Até o próximo post! :D</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[PSF Community Awards go to Georg Brandl ampBrett Cannon]]></title>
<link>http://pythonyutoj.wordpress.com/?p=3</link>
<pubDate>Mon, 11 Aug 2008 07:21:08 +0000</pubDate>
<dc:creator>pythonyutoj</dc:creator>
<guid>http://pythonyutoj.wordpress.com/?p=3</guid>
<description><![CDATA[The latest recipients of the Python Software Foundation Community Awards are Georg Brandl and Brett ]]></description>
<content:encoded><![CDATA[<p>The latest recipients of the Python Software Foundation Community Awards are Georg Brandl and Brett Cannon in recognition of their significant contributions to the Python community. Congratulations and thanks<br />
www.python.org</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Manila Sky]]></title>
<link>http://mwarner6.wordpress.com/?p=32</link>
<pubDate>Sun, 10 Aug 2008 16:30:09 +0000</pubDate>
<dc:creator>mwarner6</dc:creator>
<guid>http://mwarner6.wordpress.com/?p=32</guid>
<description><![CDATA[There is so much going on in our subconscious that we&#8217;ll never comprehend.
I was cleaning out ]]></description>
<content:encoded><![CDATA[<p>There is so much going on in our subconscious that we'll never comprehend.</p>
<p>I was cleaning out my file cabinet today, throwing away burned CDs and emptying out manila folders to be reused (save a tree!). I estimated I was tossing about 20 discs - and then I counted. Exactly 20. (That's not the point - only anecdotal). Then I had about that many manila folders I'd emptied out, and I was erasing their labels, since I always write them in pencil. Once I got to sorting them according to tab position, a strange thing occurred to me. </p>
<p>Usually when I start a project, I try to grab a folder that seems to be the minority of the three tab positions to choose from, so it can be easily found among the other projects in my current "irons in the fire" box. What I realized among these past projects (and some were only potential clients), was that the ones occupying the tabs on the right were great clients/projects that went well and I enjoyed. The centered tabs were so-so projects and/or so-so clients that I wasn't in love with or it didn't go smoothly for some reason. The far-left tabs were for projects that never came to fruition. oooOOOOOooooo...</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[How to sort an array by using STL?]]></title>
<link>http://weseetips.wordpress.com/?p=328</link>
<pubDate>Sun, 10 Aug 2008 14:08:51 +0000</pubDate>
<dc:creator>Jijo.Raj</dc:creator>
<guid>http://weseetips.wordpress.com/?p=328</guid>
<description><![CDATA[
Today I&#8217;ll tell a story&#8230; Its interesting!
Once upon a time, there lived a C++ Padawan. ]]></description>
<content:encoded><![CDATA[<p><img class="alignnone size-medium wp-image-11" src="http://weseetips.wordpress.com/files/2008/03/icon_description.jpg?w=166" alt="" width="166" height="32" /></p>
<p>Today I'll tell a story... Its interesting!</p>
<p>Once upon a time, there lived a C++ <a title="Padawan" href="http://starwars.wikia.com/wiki/Padawan" target="_blank">Padawan</a>. One day, <span style="color:#0000ff;">he want to sort an array.</span> He knows that <span style="color:#0000ff;">STL have std::sort() function</span>. But he <span style="color:#0000ff;">want to sort an array</span>, <span style="color:#0000ff;">not </span>an <span style="color:#0000ff;">STL container</span>. What a fool he is? <span style="color:#0000ff;">Native array's don't have iterators.</span> So <span style="color:#0000ff;">how could he call the std::sort() function?</span> Well, he is clever - <span style="color:#0000ff;">he created a vector,</span> <span style="color:#0000ff;">copied </span>his <span style="color:#0000ff;">array to vector,</span> then he <span style="color:#0000ff;">called the sort() function.</span> After sorting, he copied the data back to array.</p>
<p>The End!</p>
<p><img class="alignnone size-full wp-image-332" src="http://weseetips.wordpress.com/files/2008/08/sort.jpg" alt="" width="510" height="274" /></p>
<p><span style="color:#0000ff;">But now he is ashamed of what he did.</span> Because <span style="color:#0000ff;">now he realize</span> that he <span style="color:#0000ff;">can use std::sort()</span> directly <span style="color:#0000ff;">on native array too</span>! But how?</p>
<p><img class="alignnone size-medium wp-image-12" src="http://weseetips.wordpress.com/files/2008/03/icon_howcanidoit.jpg?w=220" alt="" width="220" height="32" /><br />
You can use array pointers direclty in STL algorithms. They act like iterators itself. Have a look at the code snippet.</p>
<pre>// Integer array with 10 items.
int Array[10] = { 9,3,2,4,0,6,7,8,1,5 };

// Sort them.
std::sort( Array, Array + 10 );</pre>
<p><img class="alignnone size-medium wp-image-18" src="http://weseetips.wordpress.com/files/2008/03/icon_note.jpg?w=94" alt="" width="94" height="32" /><br />
Well, Can you guess - who was that C++ trainee? It was me. ;)</p>
<p><img class="alignnone size-medium wp-image-51" src="http://weseetips.wordpress.com/files/2008/03/beginnerseries.jpg?w=215" alt="" width="215" height="32" /><br />
Targeted Audience - Beginners.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Q10057: A min-summer night's dream]]></title>
<link>http://bluefintuna.wordpress.com/?p=514</link>
<pubDate>Sat, 09 Aug 2008 04:33:19 +0000</pubDate>
<dc:creator>Bigtuna</dc:creator>
<guid>http://bluefintuna.wordpress.com/?p=514</guid>
<description><![CDATA[// Accepted !!
// you have to use qsort 



#include &lt;stdio.h&gt;
#include &lt;cstdlib&gt;
#inclu]]></description>
<content:encoded><![CDATA[<blockquote><p>// Accepted !!</p>
<p>// you have to use<em> qsort </em></p></blockquote>
<p><!--more--></p>
<p>[sourcecode language='java']<br />
#include <stdio.h><br />
#include <cstdlib><br />
#include <algorithm></p>
<p>using namespace std;</p>
<p>int ar[1000002];</p>
<p>int compare_ints(const void* a, const void* b)<br />
{<br />
    int* arg1 = (int*) a;<br />
    int* arg2 = (int*) b;<br />
    if( *arg1 < *arg2 ) return -1;<br />
    else if( *arg1 == *arg2 ) return 0;<br />
    else return 1;<br />
}</p>
<p>int main()<br />
{<br />
    int n;<br />
    while(scanf("%d",&n) == 1)<br />
    {<br />
        for(int i = 0; i < n; i++)<br />
            scanf("%d",&ar[i]);</p>
<p>        qsort(ar, n, sizeof(int), compare_ints);</p>
<p>        if(n % 2 == 0)<br />
        {<br />
            printf("%d ",ar[n/2-1]);<br />
            int c = 0;<br />
            for(int i = n/2-1; i >= 0; i--)<br />
            {<br />
                if(ar[i] == ar[n/2-1])<br />
                    c++;<br />
                else<br />
                    break;<br />
            }</p>
<p>            for(int i = n/2; i < n; i++)<br />
            {<br />
                if(ar[i] == ar[n/2])<br />
                    c++;<br />
                else<br />
                    break;<br />
            }</p>
<p>            printf("%d %d\n", c, ar[n/2]-ar[n/2-1]+1);<br />
        }<br />
        else<br />
        {<br />
            printf("%d ",ar[n/2]);<br />
            int c = 0;<br />
            for(int i = n/2; i >= 0; i--)<br />
            {<br />
                if(ar[i] == ar[n/2])<br />
                    c++;<br />
                else<br />
                    break;<br />
            }</p>
<p>            for(int i = n/2+1; i < n; i++)<br />
            {<br />
                if(ar[i] == ar[n/2])<br />
                    c++;<br />
                else<br />
                    break;<br />
            }</p>
<p>            printf("%d %d\n", c, 1);<br />
        }<br />
    }</p>
<p>    system("PAUSE");<br />
    return EXIT_SUCCESS;<br />
}<br />
[/sourcecode]</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Clean your body]]></title>
<link>http://normblog.wordpress.com/?p=963</link>
<pubDate>Fri, 08 Aug 2008 10:30:29 +0000</pubDate>
<dc:creator>SpottedByNormannCopenhagen</dc:creator>
<guid>http://normblog.wordpress.com/?p=963</guid>
<description><![CDATA[
Saturday august 9th 10.00-4.00pm CET, Sort of Coal is visiting our Flagship Store. Drop by and get]]></description>
<content:encoded><![CDATA[<p><a href="http://normblog.files.wordpress.com/2008/08/sort-of-coal-21.jpg"></a><a href="http://normblog.files.wordpress.com/2008/08/sort-of-coal-22.jpg"><img class="alignnone size-full wp-image-964" src="http://normblog.wordpress.com/files/2008/08/sort-of-coal-22.jpg" alt="" width="500" height="214" /></a><br />
Saturday august 9th 10.00-4.00pm CET, <a title="http://www.sortofcoal.dk/index3.html" href="http://" target="_blank">Sort of Coal</a> is visiting our <a href="http://www.normann-copenhagen.com/#menuId=4_1" target="_blank">Flagship Store</a>. Drop by and get a taste of coal grissini &#38; water and clean your inner body.... Enjoy!</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Ordinare gli elementi di una ListBox]]></title>
<link>http://visualand.wordpress.com/?p=97</link>
<pubDate>Tue, 05 Aug 2008 14:31:07 +0000</pubDate>
<dc:creator>raccontastorie</dc:creator>
<guid>http://visualand.wordpress.com/?p=97</guid>
<description><![CDATA[A poche ore dal rilascio di My Diary, con mezz&#8217;ora di esclusiva attenzione verso questo proble]]></description>
<content:encoded><![CDATA[<p>A poche ore dal rilascio di My Diary, con mezz'ora di esclusiva attenzione verso questo problema, sono riuscito a formulare la procedura per l'ordinamento (<em>sorting</em>) degli elementi (<em>items</em>) all'interno di una <em>ListBox1</em>. Ricordo sempre che il tutto è testato sul Visual Studio 2008.</p>
<p>La procedura è stata provata con molte combinazioni differenti di insieme di elementi TESTUALI, dando sempre esito positivo, con grande sorpresa del sottoscritto.<br />
Resta da gestire la situazione di lista numerica (per assurdo!) e la gestione di una lista di record, e non di singoli elementi. Vedrò cosa riuscirò a fare.</p>
<p>Bando alle ciance, ecco la procedura per l'ordinamento degli elementi di una lista ListBox:</p>
<blockquote><p><code><br />
Private Sub ordineLista()</code></p>
<p>Dim contatore As Integer</p>
<p>contatore = ListBox1.Items.Count - 1</p>
<p>Dim elem1, elem2 As Object<br />
Dim succ As Integer</p>
<p>For reorder = 0 To contatore - 1<br />
For var = 0 To contatore - 1<br />
elem1 = ListBox1.Items.Item(var)<br />
succ = var + 1<br />
elem2 = ListBox1.Items.Item(succ)<br />
If elem1 &#62; elem2 Then<br />
ListBox1.Items.Item(var) = elem2<br />
ListBox1.Items.Item(succ) = elem1<br />
End If<br />
Next var<br />
Next reorder</p>
<p>End Sub
</p></blockquote>
<p>Ovviamente questa  procedura andrà ad arricchire la prossima versione di My Diary.</p>
<p>Ci tengo anche a dire che OVUNQUE io abbia cercato risultavano esserci procedure pre-esistenti che, probabilmente, non si posso utilizzare con l'SDK dei dispositivi portatili con WinCE</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Fredensborg Kommune - Hegn - hvad er et hegn]]></title>
<link>http://tobiedk.wordpress.com/?p=314</link>
<pubDate>Sun, 03 Aug 2008 21:01:51 +0000</pubDate>
<dc:creator>Tobias</dc:creator>
<guid>http://tobiedk.wordpress.com/?p=314</guid>
<description><![CDATA[Det er jo i virkeligheden et ret godt spørgsmål - altså hvordan definere man et hegn?
Det er ogs]]></description>
<content:encoded><![CDATA[<p>Det er jo i virkeligheden et ret godt spørgsmål - altså hvordan definere man et hegn?<br />
Det er også fint at beskrive det på en kommunes hjemmeside, men måske de skulle overveje en ansættelse af en kommunikationsmedarbejder?</p>
<p>Her er i hvert fald Fredensborg kommunes svare på hvad et hegn er:</p>
<blockquote><p>Hegnet er en del af naboskabet, en fælles sag. Naboerne må som hovedregel selv bestemme, hvordan hegnet mellem deres ejendomme skal se ud. Hvis man ikke kan blive enig med sin nabo, skal man bruge reglerne i hegnsloven.</p>
<p>Et hegn kan have mange udformninger. Det kan være en hæk, en række træer der tilsammen danner et hegn, et plankeværk, raftehegn, trådhegn, en mur eller andet.</p>
<p>For at det er et hegn i hegnslovens forstand, skal hegnet have hegnsfunktion.</p>
<p>Der skal være tale om et fælleshegn eller et eget hegn. Hegnssynssager vedrører normalt rejsning af nyt hegn, ombytning, ændringer, vedligeholdelse eller beskadigelser.</p></blockquote>
<p>Kilde: Fredensborg Kommune - Hegn - hvad er et hegn<br />
Blev i klogere?</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Funkysort - a basic but infinitely customizable sorter]]></title>
<link>http://davidhilton.wordpress.com/?p=44</link>
<pubDate>Thu, 31 Jul 2008 08:52:57 +0000</pubDate>
<dc:creator>davidhilton</dc:creator>
<guid>http://davidhilton.wordpress.com/?p=44</guid>
<description><![CDATA[How many times have you needed to sort a file based on random or arbitrary criteria?  Well, probabl]]></description>
<content:encoded><![CDATA[<p>How many times have you needed to sort a file based on random or arbitrary criteria?  Well, probably not too frequently, and even if you have the need, you should be able to write one in less time than it takes to find a base.  But let's ignore that.</p>
<p>One solution might be to do some fancy-schmancy operation on the file, such that your data is preserved, but an alphabetical sort will give you your desired order, after which point you can remove whatever processing you did to it.</p>
<p>That sounds like it would be painful.  Or fun, if you have enough time or a stroke of genius.</p>
<p>At any rate, a friend of mine recently was faced with an interesting dilemma, where he needed to sort a file based on some unusual criteria.  Here are the basics of his problem.  He forgot the last few characters in a password, but he was fairly sure they were letters and lower-case numbers.  So, he wanted to prioritize the the order in which he checked the 15 million combinations (62^4).</p>
<p>I whipped something together quick and dirty in C++.  It is not the most efficient, but it handled his 300M file in ~4 minutes while using 1 gig of ram.  As I said, it is quick and dirty, although I am especially surprised that it took up that much space in memory, especially considering that it was using std::sort, a modified quicksort.</p>
<p>At any rate, I've changed a few things in order to imitate more closely the unix sort's behavior.  In order to sort, just define whatever criteria you want to in the funky_summer function.</p>
<p>[sourcecode language='cpp']<br />
// originally made for a friend so he could sort a file peculiarly<br />
// done on Wed, 30 July, 2008<br />
// by David Hilton, posted at davidhilton.wordpress.com</p>
<p>#include <fstream><br />
#include <iostream><br />
#include <vector><br />
#include <string></p>
<p>using namespace std;</p>
<p>vector<string> data;</p>
<p>// The all-important comparator - customize this<br />
int funky_summer(string str) {<br />
  int tmp = 0;<br />
  for(int i=16; i<str.length(); i++) {<br />
    tmp += str.at(i);<br />
    if(isupper(str.at(i)))<br />
      tmp+=1000;<br />
  }<br />
  return tmp;<br />
}</p>
<p>bool funky_string_comparator(string s1, string s2) {</p>
<p>  int s1value = funky_summer(s1);<br />
  int s2value = funky_summer(s2);</p>
<p>  return s1value < s2value;<br />
}</p>
<p>void die(string error) {<br />
  cerr<<error<<endl;<br />
  exit(0);<br />
}</p>
<p>void read_data(string name) {<br />
  ifstream fin(name.c_str());<br />
  string buf;</p>
<p>  if(!fin.is_open())<br />
    die("File does not exist: " + name);</p>
<p>  while(!fin.eof()) {<br />
    fin>>buf;</p>
<p>    if(buf.length() > 0)<br />
      data.push_back(buf);<br />
  }<br />
}</p>
<p>void output_sort() {<br />
  vector<string>::iterator i;<br />
  for( i = data.begin(); i != data.end(); i++ ) {<br />
    cout << *i << endl;<br />
    // to help debug the funky_summer function<br />
    //cerr << funky_summer(*i) << "\t" << *i << endl;<br />
  }<br />
}</p>
<p>void print_help() {<br />
  cerr<<"The funky sorter has similar behaviour to sort.  It takes lines, compares them,"<<endl<br />
      <<"and outputs them.  To use the funky sorter, define your own sorting operator by"<<endl<br />
      <<"directly modifying the source data."<<endl<<endl<br />
      <<"  funkysorter datatosort"<<endl<br />
      <<"  funkysorter datatosort > datatowrite"<<endl<<endl;<br />
}</p>
<p>int main(int argc, char ** argv) {</p>
<p>  if(argc != 2) {<br />
    print_help();<br />
    exit(0);<br />
  }</p>
<p>  read_data((string)argv[1]);</p>
<p>  stable_sort(data.begin(), data.end(), funky_string_comparator);</p>
<p>  output_sort();<br />
}<br />
[/sourcecode]</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Custom Sorting for ListBox in C#]]></title>
<link>http://gfaraj.wordpress.com/?p=45</link>
<pubDate>Thu, 31 Jul 2008 07:22:33 +0000</pubDate>
<dc:creator>gfaraj</dc:creator>
<guid>http://gfaraj.wordpress.com/?p=45</guid>
<description><![CDATA[Applying a custom sort to a Windows Forms ListBox is not a trivial task. One would think setting the]]></description>
<content:encoded><![CDATA[<p>Applying a custom sort to a Windows Forms <em>ListBox</em> is not a trivial task. One would think setting the <strong>Sorted</strong> property to <strong>true</strong> and implementing the <em>IComparable</em> interface in the item class would be enough. Well, it's not that simple. Custom sorting a <em>ListBox</em> requires a new implementation of the whole sorting algorithm, by deriving <em>ListBox</em> and overriding the protected <strong>Sort</strong> method. The following code illustrates how you would override <strong>Sort</strong> and implement a quicksort algorithm that sorts the items according to their <em>IComparable</em> implementation. Don't forget that <strong>Sort</strong> is only called when the <strong>Sorted</strong> property goes from <strong>false</strong> to <strong>true</strong>.</p>
<pre class="code"><span style="color:blue;">protected override void </span><span style="color:#020002;">Sort</span>()
{
    <span style="color:#020002;">QuickSort</span>(0, <span style="color:#020002;">Items</span>.<span style="color:#020002;">Count </span>- 1);
}

<span style="color:blue;">private void </span><span style="color:#020002;">QuickSort</span>(<span style="color:blue;">int </span><span style="color:#020002;">left</span>, <span style="color:blue;">int </span><span style="color:#020002;">right</span>)
{
    <span style="color:blue;">if </span>(<span style="color:#020002;">right </span>&#62; <span style="color:#020002;">left</span>)
    {
        <span style="color:blue;">int </span><span style="color:#020002;">pivotIndex </span>= <span style="color:#020002;">left</span>;
        <span style="color:blue;">int </span><span style="color:#020002;">pivotNewIndex </span>= <span style="color:#020002;">QuickSortPartition</span>(<span style="color:#020002;">left</span>, <span style="color:#020002;">right</span>, <span style="color:#020002;">pivotIndex</span>);

        <span style="color:#020002;">QuickSort</span>(<span style="color:#020002;">left</span>, <span style="color:#020002;">pivotNewIndex </span>- 1);
        <span style="color:#020002;">QuickSort</span>(<span style="color:#020002;">pivotNewIndex </span>+ 1, <span style="color:#020002;">right</span>);
    }
}

<span style="color:blue;">private int </span><span style="color:#020002;">QuickSortPartition</span>(<span style="color:blue;">int </span><span style="color:#020002;">left</span>, <span style="color:blue;">int </span><span style="color:#020002;">right</span>, <span style="color:blue;">int </span><span style="color:#020002;">pivot</span>)
{
    <span style="color:blue;">var </span><span style="color:#020002;">pivotValue </span>= (<span style="color:#2b91af;">IComparable</span>)<span style="color:#020002;">Items</span>[<span style="color:#020002;">pivot</span>];
    <span style="color:#020002;">Swap</span>(<span style="color:#020002;">pivot</span>, <span style="color:#020002;">right</span>);

    <span style="color:blue;">int </span><span style="color:#020002;">storeIndex </span>= <span style="color:#020002;">left</span>;
    <span style="color:blue;">for </span>(<span style="color:blue;">int </span><span style="color:#020002;">i </span>= <span style="color:#020002;">left</span>; <span style="color:#020002;">i </span>&#60; <span style="color:#020002;">right</span>; ++<span style="color:#020002;">i</span>)
    {
        <span style="color:blue;">if </span>(<span style="color:#020002;">pivotValue</span>.<span style="color:#020002;">CompareTo</span>(<span style="color:#020002;">Items</span>[<span style="color:#020002;">i</span>]) &#62;= 0)
        {
            <span style="color:#020002;">Swap</span>(<span style="color:#020002;">i</span>, <span style="color:#020002;">storeIndex</span>);
            ++<span style="color:#020002;">storeIndex</span>;
        }
    }

    <span style="color:#020002;">Swap</span>(<span style="color:#020002;">storeIndex</span>, <span style="color:#020002;">right</span>);
    <span style="color:blue;">return </span><span style="color:#020002;">storeIndex</span>;
}

<span style="color:blue;">private void </span><span style="color:#020002;">Swap</span>(<span style="color:blue;">int </span><span style="color:#020002;">left</span>, <span style="color:blue;">int </span><span style="color:#020002;">right</span>)
{
    <span style="color:blue;">var </span><span style="color:#020002;">temp </span>= <span style="color:#020002;">Items</span>[<span style="color:#020002;">left</span>];
    <span style="color:#020002;">Items</span>[<span style="color:#020002;">left</span>] = <span style="color:#020002;">Items</span>[<span style="color:#020002;">right</span>];
    <span style="color:#020002;">Items</span>[<span style="color:#020002;">right</span>] = <span style="color:#020002;">temp</span>;
}</pre>
]]></content:encoded>
</item>

</channel>
</rss>
