<?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-2885969180090658174</id><updated>2012-01-25T07:29:07.563-08:00</updated><category term='images'/><category term='install'/><category term='mobile'/><category term='Country'/><category term='Mapping'/><category term='encoding'/><category term='development'/><category term='argument'/><category term='disk'/><category term='algorithms'/><category term='acts_as_modified'/><category term='branches'/><category term='firefox'/><category term='restore'/><category term='audio'/><category term='make'/><category term='baseruby'/><category term='windows xp'/><category term='remember me'/><category term='js'/><category term='stemming'/><category term='gem'/><category term='tips'/><category term='resources'/><category term='symbian'/><category term='rails'/><category term='leakage'/><category term='libxslt'/><category term='attributes'/><category term='IP'/><category term='foxmarks'/><category term='mechanize'/><category term='system'/><category term='virtualbox'/><category term='select'/><category term='group by'/><category term='mysql'/><category term='creation'/><category term='authentication'/><category term='lock'/><category term='cifs'/><category term='synchronization'/><category term='rvm'/><category term='snowball'/><category term='porter'/><category term='memory'/><category term='pointer'/><category term='compile'/><category term='gems'/><category term='root'/><category term='intrepid'/><category term='resume'/><category term='gmarks'/><category term='cascaded'/><category term='html'/><category term='busy'/><category term='associations'/><category term='gemsets'/><category term='partition'/><category term='fix'/><category term='ubuntu'/><category term='factory'/><category term='windowshare'/><category term='plugins'/><category term='distinct'/><category term='wide'/><category term='error'/><category term='compiler'/><category term='svn'/><category term='google'/><category term='ruby'/><category term='emulate'/><category term='forget'/><category term='virtualization'/><category term='url'/><category term='rubies'/><category term='wiki'/><category term='smtp'/><category term='grub'/><category term='javascript'/><category term='window title'/><category term='dirty objects'/><category term='paperclip'/><category term='gadget'/><category term='wine'/><category term='export'/><category term='sync'/><category term='modified'/><category term='console'/><category term='Apache SVN Windows'/><category term='delete'/><category term='affix'/><category term='changed'/><category term='polymorphic'/><category term='n80'/><category term='girl'/><category term='debian'/><category term='windows'/><category term='folders'/><category term='differences'/><category term='hibernation'/><category term='database'/><category term='share'/><category term='linux'/><category term='hibernate'/><category term='tricks'/><category term='extensions'/><category term='obex'/><category term='platform'/><category term='login'/><category term='cookies'/><category term='override'/><category term='document'/><category term='mount'/><category term='reset'/><category term='configure'/><category term='name'/><category term='single'/><category term='testdisk'/><category term='openssh'/><category term='null'/><category term='jquery'/><category term='mode'/><category term='bluetooth'/><category term='libxml'/><category term='sql'/><category term='scrape'/><category term='upload'/><category term='ror'/><category term='token'/><category term='command line'/><category term='model'/><category term='action_mailer'/><category term='password'/><category term='charset'/><category term='problem'/><title type='text'>BioNuc Technical</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>49</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-6325227489024927855</id><published>2011-07-07T05:16:00.000-07:00</published><updated>2011-07-07T05:25:11.971-07:00</updated><title type='text'>MySQL GROUP_CONCAT function</title><content type='html'>I knew about this MySQL function called "GROUP_CONCAT" lately and I think it is really a very useful function to use&lt;br /&gt;&lt;br /&gt;To make simple for you to understand, I will use a small example to illustrate on&lt;br /&gt;&lt;br /&gt;Consider we have a table called listings which has many to many  relationship with another table called geographies knowing that the join  table name is listings_geographies&lt;br /&gt;&lt;br /&gt;Now look at this query&lt;br /&gt;&lt;br /&gt;select listings.id, listings.display_name, geographies.name as  geography_name from listings LEFT OUTER JOIN listings_geographies ON  listings.id = listings_geographies.listing_id LEFT OUTER JOIN  geographies ON listings_geographies.geography_id = geographies.id WHERE  status = 3 GROUP BY listings.id&lt;br /&gt;&lt;br /&gt;In my example I have only two listings: the first has 3 geographies and  the second has 2 geographies. By running this command, you will get 2  records but the field called "geography_name" will have one of the three  values and not all the values&lt;br /&gt;&lt;br /&gt;What if you want to grab all the three values and add them in 1 field so  that you get 2 records but with "geography_name" field containing all  geographies names values. If you want that, then you can rely on this  nice function "GROUP_CONCAT"&lt;br /&gt;&lt;br /&gt;The above function can be re-written to be this one&lt;br /&gt;&lt;br /&gt;select listings.id, listings.display_name, GROUP_CONCAT(geographies.name  SEPARATOR ' ') as geography_name from listings LEFT OUTER JOIN  listings_geographies ON listings.id = listings_geographies.listing_id  LEFT OUTER JOIN geographies ON listings_geographies.geography_id =  geographies.id WHERE status = 3 GROUP BY listings.id&lt;br /&gt;&lt;br /&gt;That's it&lt;br /&gt;I needed this function as I was using Sphinx and I wanted to have a  query written to grab all record info with its associations in 1 record  in order to be indexed&lt;br /&gt;&lt;br /&gt;Enjoy! :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-6325227489024927855?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/6325227489024927855/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=6325227489024927855' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/6325227489024927855'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/6325227489024927855'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2011/07/mysql-groupconcat-function.html' title='MySQL GROUP_CONCAT function'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-9006368035167942403</id><published>2010-12-29T01:44:00.001-08:00</published><updated>2010-12-29T01:44:59.657-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sql'/><category scheme='http://www.blogger.com/atom/ns#' term='distinct'/><category scheme='http://www.blogger.com/atom/ns#' term='group by'/><category scheme='http://www.blogger.com/atom/ns#' term='differences'/><category scheme='http://www.blogger.com/atom/ns#' term='database'/><title type='text'>“Distinct vs Group By” SQL Talk</title><content type='html'>&lt;p&gt;I am writing this blog entry to tell people about main differences between these two instructions because any misunderstanding to the true difference between them can cause big problems&lt;/p&gt;  &lt;p&gt;That what happened to me actually    &lt;br /&gt;I didn’t not know the true difference and as always I have chosen the easy way and rely on &lt;strong&gt;Distinct&lt;/strong&gt; instead of &lt;strong&gt;Group By&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Let me show an example which I was working on    &lt;br /&gt;and that one really helped me understand the difference between these two&lt;/p&gt;  &lt;p&gt;Suppose you have a Deal which is associated with several geographies    &lt;br /&gt;Each geography has a level representing its level in the tree of geographies. The higher the level, the lower the geography exists in the tree.&lt;/p&gt;  &lt;p&gt;The objective was to get all deals in several geographies which I was given their IDS and sort them by depth/level from lowest to highest&lt;/p&gt;  &lt;p&gt;I started writing my query to be like that    &lt;br /&gt;which is wrong by the way&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;select Distinct(deals.id) from deals INNER JOIN deals_geographies ON deals.id = deals_geographies.deal_id INNER JOIN geographies ON geographies.id = deals_geographies.geography_id WHERE geographies.id IN (id1, id2, id3) ORDER BY geographies.level DESC&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;it sounds good at the beginning. If you see it right then you are facing the same problem I was facing before. So please continue reading&lt;/p&gt;  &lt;p&gt;The problem here is that inner joining will perform a Cartesian product between deals and geographies and as we have several geographies for each deal, we will get several rows for each deal&lt;/p&gt;  &lt;p&gt;When you say &lt;strong&gt;DISTINCT &lt;/strong&gt;without defining the criteria to the DB engine, it will choose any row which could get you the highest geography this deal has or it can get you the lowest geography this deal has&lt;/p&gt;  &lt;p&gt;This is an &lt;strong&gt;Ambiguous&lt;/strong&gt; Selection     &lt;br /&gt;but it is your fault that you did it that way&lt;/p&gt;  &lt;p&gt;Lets see now how &lt;strong&gt;group by&lt;/strong&gt; will solve this&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;select deals.*, MAX(geographies.level) as max_level from deals INNER JOIN deals_geographies ON deals.id = deals_geographies.deal_id INNER JOIN geographies ON geographies.id = deals_geographies.geography_id WHERE geographies.id IN (id1, id2, id3) ORDER BY max_level DESC group by deals.id&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Now I told the DB engine what should the criteria it should use to remove multiple deal rows and which row it should leave which I wanted it to be the one with the largest geography level as this is my desired condition&lt;/p&gt;  &lt;p&gt;My last conclusion is that you can use DISTINCT in one of these cases only&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;you have a 1 to 1 relation between two or several tables and thus no ambiguity will be there &lt;/li&gt;    &lt;li&gt;you only care about 1 table fields and you are just using the other table for no more but Filtration which was not the case above as I needed it for ordering &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;btw, there is a rumor I heard saying that DISTINCT is not standard SQL. Not sure of this info but you can check that yourself and maybe comment and tell me&lt;/p&gt;  &lt;p&gt;Hope this blog was useful and enlightening :)&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-9006368035167942403?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/9006368035167942403/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=9006368035167942403' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/9006368035167942403'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/9006368035167942403'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2010/12/distinct-vs-group-by-sql-talk.html' title='“Distinct vs Group By” SQL Talk'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-8321889452515361110</id><published>2010-10-05T17:21:00.001-07:00</published><updated>2010-10-05T17:21:50.817-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='resources'/><category scheme='http://www.blogger.com/atom/ns#' term='rvm'/><category scheme='http://www.blogger.com/atom/ns#' term='rubies'/><category scheme='http://www.blogger.com/atom/ns#' term='gemsets'/><title type='text'>Useful RVM resources</title><content type='html'>&lt;p&gt;I think these few resources are useful for any RVM newbie as me :)&lt;/p&gt;  &lt;p&gt;Read them in that order&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a title="http://rvm.beginrescueend.com/rvm/basics/" href="http://rvm.beginrescueend.com/rvm/basics/"&gt;http://rvm.beginrescueend.com/rvm/basics/&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a title="http://rvm.beginrescueend.com/rubies/default/" href="http://rvm.beginrescueend.com/rubies/default/"&gt;http://rvm.beginrescueend.com/rubies/default/&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a title="http://rvm.beginrescueend.com/gemsets/basics/" href="http://rvm.beginrescueend.com/gemsets/basics/"&gt;http://rvm.beginrescueend.com/gemsets/basics/&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a title="http://rvm.beginrescueend.com/rvm/best-practices/" href="http://rvm.beginrescueend.com/rvm/best-practices/"&gt;http://rvm.beginrescueend.com/rvm/best-practices/&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;For me, I made use of the first and third links although I see all of them useful but these ones helped me install and use several ruby versions with several gemsets which is why I used RVM at first place&lt;/p&gt;  &lt;p&gt;Hope I was useful   &lt;br /&gt;and happy RVM journey&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-8321889452515361110?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/8321889452515361110/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=8321889452515361110' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/8321889452515361110'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/8321889452515361110'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2010/10/useful-rvm-resources.html' title='Useful RVM resources'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-4023675893478830139</id><published>2010-10-05T17:02:00.001-07:00</published><updated>2010-10-09T18:43:23.466-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='install'/><category scheme='http://www.blogger.com/atom/ns#' term='debian'/><category scheme='http://www.blogger.com/atom/ns#' term='wide'/><category scheme='http://www.blogger.com/atom/ns#' term='rvm'/><category scheme='http://www.blogger.com/atom/ns#' term='system'/><title type='text'>Installing RVM System Wide</title><content type='html'>&lt;p&gt;&lt;span class="Apple-style-span" &gt;Today I got introduced to one very nice solution developed by Wayne E. Seguin. It is called RVM and it is recommended for ruby developers working on Debian machines.&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;span class="Apple-style-span" &gt;What is RVM ?&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;span class="Apple-style-span" &gt;Simply RVM allows users to install multiple ruby versions and switch between them easily. It also allows having multiple sets of gems for different projects easily.&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;span class="Apple-style-span" &gt;Installation Steps&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;span class="Apple-style-span" &gt;Before getting into details, I would like to say that any steps mentioned here are grabbed from these two links. I only collected parts from them and added them in an easy way&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;a title="http://rvm.beginrescueend.com/rvm/install/" href="http://rvm.beginrescueend.com/rvm/install/"&gt;&lt;span class="Apple-style-span" &gt;http://rvm.beginrescueend.com/rvm/install/&lt;/span&gt;&lt;/a&gt;&lt;span class="Apple-style-span" &gt;   &lt;br /&gt;&lt;/span&gt;&lt;a title="http://rvm.beginrescueend.com/deployment/system-wide/" href="http://rvm.beginrescueend.com/deployment/system-wide/"&gt;&lt;span class="Apple-style-span" &gt;http://rvm.beginrescueend.com/deployment/system-wide/&lt;/span&gt;&lt;/a&gt;&lt;span class="Apple-style-span" &gt;   &lt;br /&gt;&lt;/span&gt;&lt;a title="http://rvm.beginrescueend.com/rubies/installing/" href="http://rvm.beginrescueend.com/rubies/installing/"&gt;&lt;span class="Apple-style-span" &gt;http://rvm.beginrescueend.com/rubies/installing/&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;span class="Apple-style-span" &gt;from your linux console run &lt;/span&gt;&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;&lt;span class="Apple-style-span" &gt;bash &amp;lt; &amp;lt;( curl -L http://bit.ly/rvm-install-system-wide )&lt;/span&gt;&lt;/strong&gt;&lt;span class="Apple-style-span" &gt; &lt;/span&gt;&lt;/li&gt;    &lt;li&gt;&lt;span class="Apple-style-span" &gt;you now have rvm command installed here at &lt;/span&gt;&lt;strong&gt;&lt;span class="Apple-style-span" &gt;/usr/local/lib/rvm&lt;/span&gt;&lt;/strong&gt;&lt;span class="Apple-style-span" &gt; &lt;/span&gt;&lt;/li&gt;    &lt;li&gt;&lt;span class="Apple-style-span" &gt;After installation you should add this line below to your profile&lt;/span&gt;&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;&lt;span class="Apple-style-span" &gt;[[ -s "/usr/local/lib/rvm" ]] &amp;amp;&amp;amp; . "/usr/local/lib/rvm"&lt;/span&gt;&lt;/strong&gt;&lt;span class="Apple-style-span" &gt; &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" &gt;To do so, i added the line above at the end of the &lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(17, 17, 17); line-height: 18px; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;span class="Apple-style-span" &gt;/etc/profile &lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" &gt;file. But, you can add it in other places according to your needs. Read more about profiles &lt;/span&gt;&lt;a href="http://www.cyberciti.biz/faq/change-bash-profile/"&gt;&lt;span class="Apple-style-span" &gt;here&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;    &lt;li&gt;&lt;span class="Apple-style-span" &gt;then run this one &lt;/span&gt;&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;&lt;span class="Apple-style-span" &gt;source /usr/local/lib/rvm&lt;/span&gt;&lt;/strong&gt;&lt;span class="Apple-style-span" &gt; &lt;/span&gt;&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&lt;span class="Apple-style-span" &gt;Now you are ready to install any versions of Ruby and Ruby Enterprise versions available&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span class="Apple-style-span" &gt;For me, I installed Ruby 1.8.7 and its enterprise version this way&lt;/span&gt;&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;span class="Apple-style-span" &gt;rvm install 1.8.7 &lt;/span&gt;&lt;/li&gt;    &lt;li&gt;&lt;span class="Apple-style-span" &gt;rvm install ree-1.8.7 &lt;/span&gt;&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&lt;span class="Apple-style-span" &gt;That’s it  &lt;br /&gt;Hope you enjoy RVM as I hope I enjoy it as well&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-4023675893478830139?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/4023675893478830139/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=4023675893478830139' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/4023675893478830139'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/4023675893478830139'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2010/10/installing-rvm-system-wide.html' title='Installing RVM System Wide'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-12708569056674235</id><published>2010-08-27T06:54:00.001-07:00</published><updated>2010-08-27T06:54:02.703-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='token'/><category scheme='http://www.blogger.com/atom/ns#' term='debian'/><category scheme='http://www.blogger.com/atom/ns#' term='password'/><category scheme='http://www.blogger.com/atom/ns#' term='reset'/><category scheme='http://www.blogger.com/atom/ns#' term='single'/><category scheme='http://www.blogger.com/atom/ns#' term='lock'/><category scheme='http://www.blogger.com/atom/ns#' term='forget'/><category scheme='http://www.blogger.com/atom/ns#' term='root'/><category scheme='http://www.blogger.com/atom/ns#' term='grub'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='mode'/><category scheme='http://www.blogger.com/atom/ns#' term='busy'/><category scheme='http://www.blogger.com/atom/ns#' term='authentication'/><title type='text'>Forget root password of a Debian Machine &amp; resetting it</title><content type='html'>&lt;p&gt;I am writing this small post just because&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;i forgot the root password of my debian machine &lt;/li&gt;    &lt;li&gt;didn’t find a through post that list all steps in one place and had to look at several ones at a time &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;The steps are as follows&lt;/p&gt;  &lt;p&gt;I am quoting these lines from that &lt;a href="http://www.debuntu.org/recover-root-password-single-user-mode-and-grub"&gt;post&lt;/a&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Some Linux distribution, such as Ubuntu for instance, offer a specific boot menu entry where it is stated &amp;quot;Recovery Mode&amp;quot; or &amp;quot;Single-User Mode&amp;quot;. If this is your case, selecting this menu entry will boot your machine into single user mode, you can carry on with the next part. If not, you might want to read this part.&lt;/p&gt;    &lt;p&gt;Using GRUB, you can manually edit the proposed menu entry at boot time. To do so, when GRUB is presenting the menu list (you might need to press ESC first), follow those instructions:&lt;/p&gt;    &lt;ul&gt;     &lt;li&gt;use the arrows to select the boot entry you want to modify. &lt;/li&gt;      &lt;li&gt;press &lt;em&gt;e&lt;/em&gt; to edit the entry &lt;/li&gt;      &lt;li&gt;use the arrows to go to &lt;em&gt;kernel&lt;/em&gt; line &lt;/li&gt;      &lt;li&gt;press &lt;em&gt;e&lt;/em&gt; to edit this entry &lt;/li&gt;      &lt;li&gt;at the end of the line add the word &lt;em&gt;single&lt;/em&gt; &lt;/li&gt;      &lt;li&gt;press ESC to go back to the parent menu &lt;/li&gt;      &lt;li&gt;press &lt;em&gt;b&lt;/em&gt; to boot this kernel &lt;/li&gt;   &lt;/ul&gt;    &lt;p&gt;The kernel should be booting as usual (except for the graphical splash screen you might be used to), and you will finally get a root prompt (sh#).&lt;/p&gt;    &lt;p&gt;Here we are, we have gained root access to the filesystem, let's finally change the password.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;According to the above words, we should be ok and we have access to the file system. At this state you run the command “passwd” and enter the new password.&lt;/p&gt;  &lt;p&gt;If it worked with you then Thanks to the editor. If you got some problems like me, then keep reading.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Problem 1&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;After editing grub line and add the “single” keyword at the end of that line. I got it loading well until i was prompted for the root password for maintenance and give the ability to skip but by then i will be leaving runlevel 1 and entering runlevel 2 getting login/password prompt i am trying to skip.&lt;/p&gt;  &lt;p&gt;To solve this problem do the following:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Edit the grub line again and leave the keyword “single” there as before but add at the end as well these words “init=/bin/bash” &lt;/li&gt;    &lt;li&gt;exit edit mode &lt;/li&gt;    &lt;li&gt;press the button “b” while you have this modified grub line highlighted to start booting with this modified grub line &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Voila, you have now access to shell as a root. run the command “passwd” and you should be fine entering the new desired password. If you got a problem, then continue reading.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Problem 2&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Whenever i run the command “passwd” and re-enter the new password i get this error at the end&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;authentication token lock busy&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;If so, know that the problem is that you are accessing the system in read-only mode. In order to access it in read-write mode, do the following.&lt;/p&gt;  &lt;p&gt;From the shell run this command &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;mount -o remount,rw /&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;after that run “passwd” command and this time you should have the ability to enter the new password&lt;/p&gt;  &lt;p&gt;and live happily ever after&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-12708569056674235?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/12708569056674235/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=12708569056674235' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/12708569056674235'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/12708569056674235'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2010/08/forget-root-password-of-debian-machine.html' title='Forget root password of a Debian Machine &amp;amp; resetting it'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-2472093359503186726</id><published>2010-08-15T03:35:00.001-07:00</published><updated>2010-08-15T03:35:29.678-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ror'/><category scheme='http://www.blogger.com/atom/ns#' term='girl'/><category scheme='http://www.blogger.com/atom/ns#' term='development'/><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><category scheme='http://www.blogger.com/atom/ns#' term='override'/><category scheme='http://www.blogger.com/atom/ns#' term='factory'/><category scheme='http://www.blogger.com/atom/ns#' term='creation'/><title type='text'>Factory Girl in Development</title><content type='html'>&lt;p&gt;Some many developers use Factory Girl as a replacement to Fixtures and they depend on this gem in Test cases writing.&lt;/p&gt;  &lt;p&gt;But Factory Girl can be very useful also in development and can be used in order to generate a bunch of dummy data with different specs for showing your work and reviewing all its details.&lt;/p&gt;  &lt;p&gt;The problem we face is that Factory Girl can generate more records in tables that should have their data unchanged such as Countries table.&lt;/p&gt;  &lt;p&gt;For example:&lt;/p&gt;  &lt;p&gt;Factory.define :user do |f|    &lt;br /&gt;&amp;#160; f.association :country     &lt;br /&gt;end&lt;/p&gt;  &lt;p&gt;Factory.define :job do |f|    &lt;br /&gt;&amp;#160; …     &lt;br /&gt;&amp;#160; f.association :user     &lt;br /&gt;end     &lt;br /&gt;    &lt;br /&gt;Now, when we run this piece of code that generates 10 jobs     &lt;br /&gt;    &lt;br /&gt;10.times { Factory.create(:job) }     &lt;br /&gt;    &lt;br /&gt;we will get 10 countries auto-generated     &lt;br /&gt;violating the rule we wish to maintain which is having the countries table as it is     &lt;br /&gt;    &lt;br /&gt;To workaround this problem without causing any changes in the code written previously, i came up with that solution     &lt;br /&gt;    &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;class Factory    &lt;br /&gt;&amp;#160; class &amp;lt;&amp;lt; self     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; alias_method :create_original, :create     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; def create(name, overrides = {})     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; if name.to_s == 'country'     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; country = Country.first     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; return country if country     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; end     &lt;br /&gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; create_original(name, overrides)     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; end     &lt;br /&gt;&amp;#160; end     &lt;br /&gt;end&lt;/p&gt;  &lt;p&gt;The logic introduced in the above script is simply adding a layer before creation that checks if the created object of certain type and if that type is desired to not be generated, we return the first entry we have in the DB else we do the normal creation&lt;/p&gt;  &lt;p&gt;You can add this script in a file and load it in the development environment and use Factory Girl safely without fearing of generating data for tables that should remain as lookup tables&lt;/p&gt;  &lt;p&gt;Enjoy :)&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-2472093359503186726?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/2472093359503186726/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=2472093359503186726' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/2472093359503186726'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/2472093359503186726'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2010/08/factory-girl-in-development.html' title='Factory Girl in Development'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-3408711654164379874</id><published>2010-08-09T06:08:00.001-07:00</published><updated>2010-08-09T06:08:11.964-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ror'/><category scheme='http://www.blogger.com/atom/ns#' term='girl'/><category scheme='http://www.blogger.com/atom/ns#' term='polymorphic'/><category scheme='http://www.blogger.com/atom/ns#' term='associations'/><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><category scheme='http://www.blogger.com/atom/ns#' term='factory'/><title type='text'>Factory Girl &amp; Polymorphic Associations</title><content type='html'>&lt;p&gt;Suppose you have a case like that   &lt;br /&gt;    &lt;br /&gt;class Address &amp;lt; ActiveRecord::Base    &lt;br /&gt;&amp;#160; belongs_to :addressable, polymorphic =&amp;gt; true    &lt;br /&gt;end    &lt;br /&gt;    &lt;br /&gt;class Listing &amp;lt; ActiveRecord::Base    &lt;br /&gt;&amp;#160; has_one :address, as =&amp;gt; :addressable    &lt;br /&gt;end    &lt;br /&gt;    &lt;br /&gt;class Customer &amp;lt; ActiveRecord::Base    &lt;br /&gt;&amp;#160; has_one :address, as =&amp;gt; :addressable    &lt;br /&gt;end    &lt;br /&gt;    &lt;br /&gt;Now in your factories you will have something like that    &lt;br /&gt;    &lt;br /&gt;Factory.define :listing do |f|    &lt;br /&gt;&amp;#160; f.association :address    &lt;br /&gt;end    &lt;br /&gt;    &lt;br /&gt;since addressable is required, we choose it to be by default related to a customer unless else stated    &lt;br /&gt;    &lt;br /&gt;Factory.define :address do |f|    &lt;br /&gt;&amp;#160; f.association :addressable, :factory =&amp;gt; :customer    &lt;br /&gt;end&lt;/p&gt;  &lt;p&gt;right now if you tried to use the Listing Factory, you will get an address associated with dummy customer and no effect on your side   &lt;br /&gt;    &lt;br /&gt;&lt;strong&gt;How can this be fixed ?     &lt;br /&gt;&lt;/strong&gt;    &lt;br /&gt;Factory.define :listing do |f|    &lt;br /&gt;&amp;#160; f.after_build do |listing|    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; listing.address = Factory.create(:address, :addressable =&amp;gt; listing)    &lt;br /&gt;&amp;#160; end    &lt;br /&gt;end    &lt;br /&gt;    &lt;br /&gt;This was the only solution i found after searching for a while    &lt;br /&gt;which is a good solution and doesn't need a lot of work to be done&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-3408711654164379874?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/3408711654164379874/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=3408711654164379874' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/3408711654164379874'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/3408711654164379874'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2010/08/factory-girl-polymorphic-associations.html' title='Factory Girl &amp;amp; Polymorphic Associations'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-6911908762306660008</id><published>2009-10-25T05:09:00.001-07:00</published><updated>2009-10-25T05:09:00.386-07:00</updated><title type='text'>sanitize gem issue</title><content type='html'>&lt;p&gt;I have used ‘sanitize’ gem to remove HTML tags from entered text   &lt;br /&gt;the version i was using was ‘1.0.8’&lt;/p&gt;  &lt;p&gt;After using it for a while, i found an issue in it where calling   &lt;br /&gt;Sanitize.clean(“’”) will return “#39;” while quote isn’t HTML character&lt;/p&gt;  &lt;p&gt;Looking around for a reason for this issue, i found that this is a defect that was detected in older versions and that it is now fixed in version ‘1.1.0’&lt;/p&gt;  &lt;p&gt;So anyone who has this issue can simply remove his installed gem and install the latest one&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-6911908762306660008?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/6911908762306660008/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=6911908762306660008' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/6911908762306660008'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/6911908762306660008'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2009/10/sanitize-gem-issue.html' title='sanitize gem issue'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-2533106092935514558</id><published>2009-08-31T04:00:00.001-07:00</published><updated>2009-08-31T04:00:42.136-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='smtp'/><category scheme='http://www.blogger.com/atom/ns#' term='action_mailer'/><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><title type='text'>smtp 555 5.5.2 Syntax error (Net::SMTPFatalError)</title><content type='html'>&lt;p&gt;This title was part of an error message i got while dealing with action_mailer&lt;/p&gt;  &lt;p&gt;i looked everywhere for a reason for this error message and found so many reasons but none of them matched with my case&lt;/p&gt;  &lt;p&gt;So i liked to share why i got this error. Simply because i was adding no recipients to my email. I know it is very weird to send an email without having a recipient but getting this error message i much more weird and strange&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;/usr/lib/ruby/1.8/net/smtp.rb:930:in `check_response': 555 5.5.2 Syntax error. 24sm123817eyx.21 (Net::SMTPFatalError)     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; from /usr/lib/ruby/1.8/net/smtp.rb:899:in `getok'      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; from /usr/lib/ruby/1.8/net/smtp.rb:842:in `rcptto'      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; from /usr/lib/ruby/1.8/net/smtp.rb:834:in `rcptto_list'      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; from /usr/lib/ruby/1.8/net/smtp.rb:833:in `each'      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; from /usr/lib/ruby/1.8/net/smtp.rb:833:in `rcptto_list'      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; from /usr/lib/ruby/1.8/net/smtp.rb:654:in `sendmail'      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; from /usr/lib/ruby/gems/1.8/gems/actionmailer-2.3.2/lib/action_mailer/base.rb:683:in `perform_delivery_smtp'      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; from /usr/lib/ruby/1.8/net/smtp.rb:526:in `start'      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; from /usr/lib/ruby/gems/1.8/gems/actionmailer-2.3.2/lib/action_mailer/base.rb:681:in `perform_delivery_smtp'      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; from /usr/lib/ruby/gems/1.8/gems/actionmailer-2.3.2/lib/action_mailer/base.rb:523:in `__send__'      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; from /usr/lib/ruby/gems/1.8/gems/actionmailer-2.3.2/lib/action_mailer/base.rb:523:in `deliver!'      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; from /usr/lib/ruby/gems/1.8/gems/actionmailer-2.3.2/lib/action_mailer/base.rb:395:in `method_missing'      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; from test_sending_emails_in_ruby.rb:31&amp;#160; &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;this is the error message i got and it was solved when i added a recipient&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-2533106092935514558?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/2533106092935514558/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=2533106092935514558' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/2533106092935514558'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/2533106092935514558'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2009/08/smtp-555-552-syntax-error.html' title='smtp 555 5.5.2 Syntax error (Net::SMTPFatalError)'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-4759391048023438002</id><published>2009-06-29T02:00:00.001-07:00</published><updated>2009-06-29T02:00:44.814-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='memory'/><category scheme='http://www.blogger.com/atom/ns#' term='mechanize'/><category scheme='http://www.blogger.com/atom/ns#' term='leakage'/><title type='text'>Memory Leakage while using Mechanize</title><content type='html'>&lt;p&gt;I was working on a task that scrape several web pages. After running this task for a while, i found that memory taken by my process is raising forever until it was about to eat all memory available of the server.&lt;/p&gt;  &lt;p&gt;after some investigation regarding this matter, i knew that the problem was in my understanding to how mechanize agent works&lt;/p&gt;  &lt;p&gt;let me explain with an example&lt;/p&gt;  &lt;p&gt;agent = WWW::Mechanize.new   &lt;br /&gt;while(true)    &lt;br /&gt;page = agent.get(“www.example.com”)    &lt;br /&gt;end&lt;/p&gt;  &lt;p&gt;in this example, memory will be consumed because mechanize keeps history within the agent, i looked in its documentation and found that there is a parameter which is called “max_history” which when set will fix this issue i think but didn’t try&lt;/p&gt;  &lt;p&gt;also a fix to such issue, if you don’t need history is to write your code like that&lt;/p&gt;  &lt;p&gt;while(true)   &lt;br /&gt;agent = WWW::Mechanize.new    &lt;br /&gt;page = agent.get(“www.example.com”)    &lt;br /&gt;end&lt;/p&gt;  &lt;p&gt;That’s it, maybe this piece of information can be useful for someone facing this issue just like me&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-4759391048023438002?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/4759391048023438002/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=4759391048023438002' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/4759391048023438002'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/4759391048023438002'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2009/06/memory-leakage-while-using-mechanize.html' title='Memory Leakage while using Mechanize'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-1773834646819441234</id><published>2009-06-15T15:09:00.001-07:00</published><updated>2009-08-24T02:49:42.248-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='libxml'/><category scheme='http://www.blogger.com/atom/ns#' term='debian'/><category scheme='http://www.blogger.com/atom/ns#' term='gems'/><category scheme='http://www.blogger.com/atom/ns#' term='mechanize'/><category scheme='http://www.blogger.com/atom/ns#' term='gem'/><category scheme='http://www.blogger.com/atom/ns#' term='libxslt'/><title type='text'>Install Mechanize On Debian</title><content type='html'>&lt;p&gt;Installing mechanize gem on Debian should be as easy as running this command&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;gem install mechanize&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;but this won’t succeed unless you install these packages on your Debian machine&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;apt-get install libxml-dev libxslt1-dev&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Once installed, gem will be installed seamlessly&lt;/p&gt;&lt;p&gt;&lt;b&gt;Update:&lt;/b&gt;&lt;/p&gt;&lt;p&gt;if the above apt-get command didn't work with you and you got an error that package doesn't exist&lt;/p&gt;&lt;p&gt;try this new line&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;blockquote&gt;apt-get install libxml2-dev libxslt1-dev&lt;/blockquote&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;as some packages names has changed&lt;/p&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/2885969180090658174-1773834646819441234?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/1773834646819441234/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=1773834646819441234' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/1773834646819441234'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/1773834646819441234'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2009/06/install-mechanize-on-debian.html' title='Install Mechanize On Debian'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-5479177810588283134</id><published>2009-06-15T03:21:00.001-07:00</published><updated>2009-06-15T03:21:07.058-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='windowshare'/><category scheme='http://www.blogger.com/atom/ns#' term='cifs'/><category scheme='http://www.blogger.com/atom/ns#' term='share'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='windows'/><category scheme='http://www.blogger.com/atom/ns#' term='mount'/><category scheme='http://www.blogger.com/atom/ns#' term='folders'/><category scheme='http://www.blogger.com/atom/ns#' term='virtualbox'/><title type='text'>[Linux] Mounting windows folders</title><content type='html'>&lt;p&gt;Due to my new configuration which is using Windows as my default OS and Debian shell through Virtualbox, my need to have a folder shared between these two environment become a must in order to ease file sharing and exchange.&lt;/p&gt;  &lt;p&gt;At first, i depended on “shared folders” feature of VirtualBox which after a while failed as i always get a “Protocol Error” whenever i deal with files IO on that shared folder.&lt;/p&gt;  &lt;p&gt;That’s why i looked for another solution that is more stable than that one and reached to using “CIFS” as a way to mount windows shared folder on my Debian machine.&lt;/p&gt;  &lt;p&gt;The steps are very easy to be made and gives you a stable robust solution away from VirtualBox problems. i can summarize these steps as follows&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;install on your Debian machine “smbfs” package which will add this new type of mounting called “CIFS” &lt;/li&gt;    &lt;li&gt;suppose your machine IP is “192.168.1.6” and you shared a folder on it called “work” and this folder is secured to be used only with certain group which is administrators and one of these administrators is named “BioNuc” and have a certain password then your command will be&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; mount -t cifs -o username=BioNuc ‘\\192.168.1.6\work’ &amp;lt;linux-path-to-mount-on-it&amp;gt; &lt;/li&gt;    &lt;li&gt;After writing this line, you will be asked to insert your password in order to make mount process successful &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;That’s it, Enjoy sharing folders seamlessly&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-5479177810588283134?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/5479177810588283134/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=5479177810588283134' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/5479177810588283134'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/5479177810588283134'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2009/06/linux-mounting-windows-folders.html' title='[Linux] Mounting windows folders'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-6093472280327468501</id><published>2009-04-13T01:02:00.001-07:00</published><updated>2009-04-13T01:02:17.335-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='openssh'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='debian'/><category scheme='http://www.blogger.com/atom/ns#' term='windows xp'/><category scheme='http://www.blogger.com/atom/ns#' term='virtualization'/><category scheme='http://www.blogger.com/atom/ns#' term='virtualbox'/><title type='text'>Giants Alliance</title><content type='html'>&lt;p&gt;Two giants are there one called Windows and another called Linux. As i am fan of Windows Interfaces and Usability (by the way i use Windows XP) and also fan of the extreme shell power of Linux, I wished if i can exploit these two powers at the same time.&lt;/p&gt;  &lt;p&gt;The solution i found was using Windows XP as my primary OS and adding Debian version on virtual machine. You may be asking why should this solution be said when it is well known and made by some many users but actually, i made some modifications to this solution.&lt;/p&gt;  &lt;p&gt;What i did can be summarized in these following points:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;installing debian without any interface at all, just a shell no more &lt;/li&gt;    &lt;li&gt;using virtual machine shared folder technique to share a folder between my XP machine and my Linux machine &lt;/li&gt;    &lt;li&gt;installed &lt;a href="http://www.emtec.com/zoc/"&gt;ZOC&lt;/a&gt; program which is a powerful shell program that allows connecting using openssh and supports multi tabs which is very important feature not available in &lt;a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/"&gt;putty&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;installed openssh-server on debian &lt;/li&gt;    &lt;li&gt;fixed an IP for my debian machine so as to save my openssh configuration one time only without changing it each time i connect to it &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;This way, i enjoy my XP machine and whenever i need the shell of linux. i connect using openssh on my debian virtualized machine and do what i want&lt;/p&gt;  &lt;p&gt;I use this solution while developing ROR applications, i prepared the environment i use as follows&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;installed ruby, rails, mysql on my debian machine &lt;/li&gt;    &lt;li&gt;opened remote connections to mysql database so as to use MySQL Query Browser from XP machine &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Now, i open my IDE on XP machine that changes in folders place in the shared folder between two machines and i open my server from virtual machine and test apps on debian machine IP rather than my localhost&lt;/p&gt;  &lt;p&gt;This experience is great and i enjoy it so much as i feel i have the power of each environment Windows &amp;amp; Linux at the same time&lt;/p&gt;  &lt;p&gt;In order to optimize the performance of my Virtual Machine somehow, i raised the priority of these virtualized processes to ‘High’ or even ‘Realtime’. it is now better but not perfect&lt;/p&gt;  &lt;p&gt;I think in order to raise the performance significantly, i need to buy another motherboard supporting Intel VT technology. Using such technology i can move virtualization from software layer (being a process that Windows XP Scheduler deal with) to hardware layer which should improve performance as stated&lt;/p&gt;  &lt;p&gt;That’s it, i suggest you try this experience and Enjoy as i do&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-6093472280327468501?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/6093472280327468501/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=6093472280327468501' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/6093472280327468501'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/6093472280327468501'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2009/04/giants-alliance.html' title='Giants Alliance'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-4793525495694771267</id><published>2009-04-12T06:23:00.001-07:00</published><updated>2009-04-12T06:23:24.415-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='wiki'/><category scheme='http://www.blogger.com/atom/ns#' term='export'/><category scheme='http://www.blogger.com/atom/ns#' term='google'/><category scheme='http://www.blogger.com/atom/ns#' term='document'/><title type='text'>Export Google Document To WIKI STYLE Document</title><content type='html'>&lt;p&gt;the idea is simple and only needed is that you do some simple steps and you are done&lt;/p&gt;  &lt;p&gt;follow the following steps:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;save google document as HTML file&lt;/li&gt;    &lt;li&gt;view html page source and extract the html inside document body tag&lt;/li&gt;    &lt;li&gt;use this great &lt;a href="http://labs.seapine.com/htmltowiki.cgi"&gt;tool&lt;/a&gt; and add in it the html you copied and you will have the wiki style document generated&lt;/li&gt; &lt;/ul&gt;  &lt;blockquote&gt;   &lt;p&gt;That’s it, you now have the document you wrote in WIKI style. Take this text and play with it as you wish&lt;/p&gt;&lt;/blockquote&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-4793525495694771267?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/4793525495694771267/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=4793525495694771267' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/4793525495694771267'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/4793525495694771267'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2009/04/export-google-document-to-wiki-style.html' title='Export Google Document To WIKI STYLE Document'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-5481543302631071062</id><published>2009-04-11T23:52:00.001-07:00</published><updated>2009-04-11T23:52:46.470-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='disk'/><category scheme='http://www.blogger.com/atom/ns#' term='partition'/><category scheme='http://www.blogger.com/atom/ns#' term='restore'/><category scheme='http://www.blogger.com/atom/ns#' term='delete'/><category scheme='http://www.blogger.com/atom/ns#' term='testdisk'/><title type='text'>Restore Your Deleted Partition</title><content type='html'>&lt;p&gt;Yesterday, i passed through a great panic after wrongly deleting my 3 partitions. Suddenly i felt that i lost all my data forever and there is no way out of such problem.&lt;/p&gt;  &lt;p&gt;First how this problem occurred ?? actually this issue aroused from “computer management” program on my Windows XP. I opened it and choose one partition and right click and chosen delete. After confirmation, i found all 3 partitions were deleted. What a stupid application !!! i don’t know why should windows has an application that deal with such sensitive parts when not sure of its performance and reliability&lt;/p&gt;  &lt;p&gt;Anyway, after some search on the internet, i found a great application called “TestDisk”. Anyone can download this free application from &lt;a href="http://www.cgsecurity.org/wiki/TestDisk_Download"&gt;here&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;I did download it and followed this nice &lt;a href="http://www.cgsecurity.org/wiki/TestDisk_Step_By_Step"&gt;tutorial&lt;/a&gt; who showcase how this application works and how to use it safely. I did exactly as it stated and i restored my deleted partitions back again as before with nothing being lost&lt;/p&gt;  &lt;p&gt;Thanks “TestDisk” for the great application and you really deserve a donation.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-5481543302631071062?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/5481543302631071062/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=5481543302631071062' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/5481543302631071062'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/5481543302631071062'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2009/04/restore-your-deleted-partition.html' title='Restore Your Deleted Partition'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-5269003754358609942</id><published>2009-04-09T14:46:00.000-07:00</published><updated>2009-04-09T14:50:33.148-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='plugins'/><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><category scheme='http://www.blogger.com/atom/ns#' term='gems'/><title type='text'>Gems vs Plugins</title><content type='html'>Which one to use GEMS or PLUGINS?&lt;br /&gt;This was a question i always asked and i have searched on the internet for comparisons between each one and the other&lt;br /&gt;&lt;br /&gt;i can see that people prefer gems for the sake that it is the new future, it has obligatory versions other than rails plugins&lt;br /&gt;&lt;br /&gt;But as for me, i only see gems useful in these two cases&lt;br /&gt;&lt;ol&gt;&lt;li&gt;when using code provided as gem outside of Rails, maybe with some ruby application&lt;/li&gt;&lt;li&gt;if you want to share code written in gem among applications&lt;/li&gt;&lt;/ol&gt;other than that, i see plugins better and much more maintainable for each application on its own&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-5269003754358609942?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/5269003754358609942/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=5269003754358609942' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/5269003754358609942'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/5269003754358609942'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2009/04/gems-vs-plugins.html' title='Gems vs Plugins'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-7233979054078169139</id><published>2009-03-09T05:36:00.000-07:00</published><updated>2009-03-09T05:52:10.539-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='url'/><category scheme='http://www.blogger.com/atom/ns#' term='images'/><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><category scheme='http://www.blogger.com/atom/ns#' term='paperclip'/><category scheme='http://www.blogger.com/atom/ns#' term='upload'/><title type='text'>Uploading Images from URL using Paperclip</title><content type='html'>I was working on an application that gives variety to user to either upload file locally or add url of this image on the web.&lt;br /&gt;&lt;br /&gt;As i was using paperclip, i searched for a method that always such thing but didn't find such functionality available in paperclip although this is a very common task that can be found everywhere nowadays in web applications.&lt;br /&gt;&lt;br /&gt;Anyway, i found a great &lt;a href="http://almosteffortless.com/2008/12/11/easy-upload-via-url-with-paperclip/"&gt;blog post&lt;/a&gt;, that makes a workaround for such issue. the idea in this blog was sufficient enough to do all required althought i introduces new field for saving url which isn't needed all the time&lt;br /&gt;&lt;br /&gt;I thought that this can be more easily for users by adding such thing in paperclip itself. I looked at the code and find it a very small task&lt;br /&gt;&lt;br /&gt;the old code do that&lt;br /&gt;&lt;br /&gt;def has_attached_file name, options = {}&lt;br /&gt;      .&lt;br /&gt;      .&lt;br /&gt;     &lt;br /&gt;      define_method "#{name}=" do |file|&lt;br /&gt;        attachment_for(name).assign(file)&lt;br /&gt;      end&lt;br /&gt;&lt;br /&gt;      .&lt;br /&gt;      .&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;and patch adds this method, i took it as it is from blog post mentioned above and made this code as follows&lt;br /&gt;&lt;br /&gt;def has_attached_file name, options = {}&lt;br /&gt;      .&lt;br /&gt;      .&lt;br /&gt;     &lt;br /&gt;     define_method "#{name}_url=" do |file_url|&lt;br /&gt;        begin&lt;br /&gt;          file = open(URI.parse(file_url))&lt;br /&gt;          send("#{name}=", file)&lt;br /&gt;        rescue&lt;br /&gt;          #Not handled yet&lt;br /&gt;        end&lt;br /&gt;      end&lt;br /&gt;&lt;br /&gt;      define_method "#{name}=" do |file|&lt;br /&gt;        attachment_for(name).assign(file)&lt;br /&gt;      end&lt;br /&gt;  &lt;br /&gt;      .&lt;br /&gt;      .&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;and also required a file 'open_uri', the new method have same name except that it contains at the end a suffix "_url"&lt;br /&gt;&lt;br /&gt;it opens a connection and gets image as IO file and passes it to old method as before&lt;br /&gt;&lt;br /&gt;I found this a useful change, that's why i forked paperclip and made the change in it and will commit this above and send pull request to include this feature&lt;br /&gt;&lt;br /&gt;until then, the code can be found &lt;a href="http://github.com/BioNuc/paperclip/tree/master"&gt;here&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-7233979054078169139?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/7233979054078169139/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=7233979054078169139' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/7233979054078169139'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/7233979054078169139'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2009/03/uploading-images-from-url-using.html' title='Uploading Images from URL using Paperclip'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-1123004027957406976</id><published>2009-03-09T01:34:00.000-07:00</published><updated>2009-03-09T01:35:49.954-07:00</updated><title type='text'>Cascaded HTML SELECT elements using JQuery V2</title><content type='html'>This is a small update i made to the code, This code fixes a bug detected and also get rid of some duplicated code&lt;br /&gt;&lt;br /&gt;his is an update to the JS function&lt;br /&gt;&lt;br /&gt;eSpace.HTML = {&lt;br /&gt;    cascadeLists: function(parentId, childId, callbackFunction){&lt;br /&gt;        $("body").append('&lt;select style="display:none" id="' + parentId + childId + '"&gt;&lt;/select&gt;');&lt;br /&gt;      var childOptions = $('#' + childId + ' option');&lt;br /&gt;        $('#' + parentId + childId).html(childOptions);&lt;br /&gt;   &lt;br /&gt;      $('#' + parentId).change(function(){&lt;br /&gt;        var parent = $('#' + parentId)[0];&lt;br /&gt;           &lt;br /&gt;            var selectedOptionValue = '';&lt;br /&gt;            if (parent.selectedIndex &gt; -1)&lt;br /&gt;                selectedOptionValue = parent.options[parent.selectedIndex].value;&lt;br /&gt;           &lt;br /&gt;        if (selectedOptionValue == '')&lt;br /&gt;              $('#' + childId).html($('#' + parentId + childId + ' option[value=""]').clone());&lt;br /&gt;          else {&lt;br /&gt;                var childs = $('#' + parentId + childId + ' option[parent="'+selectedOptionValue+'"]');&lt;br /&gt;                if(childs.size() == 0)&lt;br /&gt;                    $('#' + childId).html($('#' + parentId + childId + ' option[value=""]').clone());&lt;br /&gt;                else&lt;br /&gt;                  $('#' + childId).html($('#' + parentId + childId + ' option[parent="' + selectedOptionValue + '"]').clone());&lt;br /&gt;          }&lt;br /&gt;   &lt;br /&gt;            $('#' + childId).trigger("change");&lt;br /&gt;           &lt;br /&gt;        if(callbackFunction != null) callbackFunction(parent.options[parent.selectedIndex]);&lt;br /&gt;        });&lt;br /&gt;       &lt;br /&gt;        $('#' + parentId).trigger("change");&lt;br /&gt;    }&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-1123004027957406976?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/1123004027957406976/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=1123004027957406976' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/1123004027957406976'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/1123004027957406976'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2009/03/cascaded-html-select-elements-using_09.html' title='Cascaded HTML SELECT elements using JQuery V2'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-9088047944925943130</id><published>2009-03-07T05:12:00.000-08:00</published><updated>2009-03-07T07:18:50.434-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='synchronization'/><category scheme='http://www.blogger.com/atom/ns#' term='foxmarks'/><category scheme='http://www.blogger.com/atom/ns#' term='firefox'/><category scheme='http://www.blogger.com/atom/ns#' term='sync'/><category scheme='http://www.blogger.com/atom/ns#' term='gmarks'/><category scheme='http://www.blogger.com/atom/ns#' term='extensions'/><title type='text'>GMarks vs Foxmarks</title><content type='html'>I have found some many friends of mine interested so much in GMarks extension to sync their bookmarks from one pc to another.&lt;br /&gt;&lt;br /&gt;As i am also interested in bookmarks sync across computers, and as i also respect google extensions and was a frequent user of Google Browser Sync until they stopped supporting such extension. I said to myself that i have to see what this extension gives&lt;br /&gt;&lt;br /&gt;Frankly speaking, using GMarks is very ugly, yes you bookmark and tag your bookmarks but the way of retrieving tagged bookmarks is very old fashioned. It takes us back to the era of Firefox 2 of adding bookmarks in folders and then whenever you look for something, you open your bookmarks and look for what you want. SO UGLY AND OLD FASHIONED way&lt;br /&gt;&lt;br /&gt;To understand why GMarks is a bad choice, lets have a look at what Firefox 3 introduced which became a de facto and also is going to be there later on in other browsers even google chrome&lt;br /&gt;&lt;br /&gt;With the arrival of Firefox3, we got rid completely of two main stupid things&lt;br /&gt;&lt;ul&gt;&lt;li&gt;searching for bookmarks in folders, they introduced tags&lt;/li&gt;&lt;li&gt;searching bookmarks then if not there, google using one of the search engines beside navigation bar&lt;/li&gt;&lt;/ul&gt;Firefox 3 focused on value, simply we should deal only with one entity whenever we open a new tab, this entity is the location bar&lt;br /&gt;&lt;br /&gt;Since you write keywords on you search engine to get you results, and since now you tag your bookmarks with keywords then we all agree that it is only keywords that matter. The new scenario became open a new tab, you are already on the location bar, write the keywords you are searching for, Firefox will list you tagged bookmarks and some other results from history.&lt;br /&gt;&lt;br /&gt;Satisified then fine take any like from this collection. if not satisified then simply hit the enter key and you will be taken to search results from the search engine you prefer&lt;br /&gt;&lt;br /&gt;Very lovely way, focusing on one position and having everything in hand for you. let's see what this GMarks did for our lovely neat scenario&lt;br /&gt;&lt;br /&gt;Now, if you want something, you go to Gmarks tab beside tools and you will find your tags, you search for the tag you want then you find your bookmarks there. Not satisfied then google and write again the same tags you were about to use. SIMPLE WASTING YOUR TIME AND DON'T EXPLOIT MULTIPLE TAGS SEARCH NOR HISTORY SEARCH&lt;br /&gt;&lt;br /&gt;simply guys, it is very stupid. Please get rid of this ugly extension right now. you are brainwashed with it. Simply use Foxmarks&lt;br /&gt;&lt;br /&gt;it don't interfere in your cycle at all. It just sync on shutdown or from time  to time as you configure it and whenever you add it from any other browser on same pc or another pc you get your bookmarks ready for you&lt;br /&gt;&lt;br /&gt;it also has this features&lt;br /&gt;&lt;ul&gt;&lt;li&gt;compatabile on many browsers, i think safari and opera&lt;/li&gt;&lt;li&gt;has web interface to use from anywhere&lt;/li&gt;&lt;li&gt;sync passwords also encrypted if you wish to&lt;/li&gt;&lt;li&gt;has a new fancy feature added which is suggesting tags from other people to you whenever you tag your bookmark&lt;/li&gt;&lt;/ul&gt;To be also honest, i must say that Foxmarks is great but you need to disable its sync from time to time and make it on shutdown because it has currently a bug that causes a slowdown to firefox on synchronizarion&lt;br /&gt;&lt;br /&gt;i wish this post can help you getting rid of your slavery to GMarks. see the light with Foxmarks instead&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-9088047944925943130?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/9088047944925943130/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=9088047944925943130' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/9088047944925943130'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/9088047944925943130'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2009/03/gmarks-vs-foxmarks.html' title='GMarks vs Foxmarks'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-6249301792448408274</id><published>2009-03-06T06:12:00.000-08:00</published><updated>2009-03-06T06:16:53.600-08:00</updated><title type='text'>Software Update Mess</title><content type='html'>Nowadays, every software application has its own update program that is run in the background waiting for any new update to occur and notify you with it.&lt;br /&gt;&lt;br /&gt;I see this is leading to more processes being run without any reason and taking time on startup and even bandwidth and cpu clocks&lt;br /&gt;&lt;br /&gt;I got rid of all these after using&lt;br /&gt;Filehippo software update program&lt;br /&gt;&lt;br /&gt;this program is very nice one, it do this update idea but all these update programs are now in one place only, i stopped firefox update, apple update and so many and whenever something new exists this update program just tell me&lt;br /&gt;&lt;br /&gt;I suggest it for anyone who hated such update programs, one for java, one for adobe reader, another for open office and so many others&lt;br /&gt;&lt;br /&gt;Hope this may be useful small tip for Windows users like me&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-6249301792448408274?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/6249301792448408274/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=6249301792448408274' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/6249301792448408274'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/6249301792448408274'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2009/03/software-update-mess.html' title='Software Update Mess'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-1012572584275549412</id><published>2009-03-05T08:00:00.000-08:00</published><updated>2009-03-05T09:55:49.986-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='js'/><category scheme='http://www.blogger.com/atom/ns#' term='jquery'/><category scheme='http://www.blogger.com/atom/ns#' term='cascaded'/><category scheme='http://www.blogger.com/atom/ns#' term='select'/><category scheme='http://www.blogger.com/atom/ns#' term='html'/><title type='text'>Cascaded HTML SELECT elements using JQuery</title><content type='html'>Many web applications at least from which i worked in demanded the existance of many select boxes stacked over each other. These HTML select boxes are used for filtering data underneath them.&lt;br /&gt;&lt;br /&gt;But the idea is that in some cases, these ones are dependent on each other. One case can be a filter for cars that starts with types, then makes then trims and so on. In some of these filters the amount of overall filters data are not so large that they can all be retrieved with page once and then JS manipulation can be used to propagate between them.&lt;br /&gt;&lt;br /&gt;I used to make this myself until i found myself fed up of doing things that should be generic. I looked for a plugin for JQUERY which i use as a JS framework in my application. Lucky me. i found one that does this cascading on two levels and then you can repeat on others until all get cascaded together.&lt;br /&gt;&lt;br /&gt;The solution i found was that &lt;a href="http://www.ajaxray.com/blog/2007/11/08/jquery-controlled-dependent-or-cascading-select-list-2/"&gt;&lt;span style="font-weight: bold;"&gt;blog post&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;the solution proposed here was very nice but i found that i need to modify it somehow to be much more elegent and complete from my opinion. You may disagree with me in some modifications and it's your right to do so. Take the code and modify it as you wish&lt;br /&gt;&lt;br /&gt;Before looking at my code, you can have a look at the post in order to be familiar with my solution.&lt;br /&gt;&lt;br /&gt;Here is the code&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;span style="font-family: Georgia,serif;"&gt;cascadeLists: function(parentId, childId, callbackFunction){&lt;br /&gt;  $("body").append('&lt;select style="display:none" id="' + parentId + childId + '"&gt;&lt;/select&gt;');&lt;br /&gt;  var childOptions = $('#' + childId + ' option');&lt;br /&gt;  $('#' + parentId + childId).html(childOptions);&lt;br /&gt;   &lt;br /&gt;  var parent = $('#' + parentId)[0];&lt;br /&gt;  if(parent.options[parent.selectedIndex].value == '')&lt;br /&gt;    $('#' + childId).html(childOptions.filter('[value=""]').clone());&lt;br /&gt;   &lt;br /&gt;   $('#' + parentId).change(function(){&lt;br /&gt;      var parent = $('#' + parentId)[0];&lt;br /&gt;           &lt;br /&gt;      var selectedOptionValue = '';&lt;br /&gt;      if (parent.selectedIndex &gt; -1)&lt;br /&gt;        selectedOptionValue = parent.options[parent.selectedIndex].value;&lt;br /&gt;           &lt;br /&gt;      if (selectedOptionValue == '')&lt;br /&gt;        $('#' + childId).html($('#' + parentId + childId + ' option[value=""]').clone());&lt;br /&gt;      else {&lt;br /&gt;        var childs = $('#' + parentId + childId + ' option[parent="'+selectedOptionValue+'"]');&lt;br /&gt;        if(childs.size() == 0)&lt;br /&gt;          $('#' + childId).html($('#' + parentId + childId + ' option[value=""]').clone());&lt;br /&gt;        else&lt;br /&gt;          $('#' + childId).html($('#' + parentId + childId + ' option[parent="' + selectedOptionValue + '"]').clone());&lt;br /&gt;      }&lt;br /&gt;   &lt;br /&gt;      $('#' + childId).trigger("change");&lt;br /&gt;           &lt;br /&gt;      if(callbackFunction != null) callbackFunction(selectedOptionValue);&lt;br /&gt;    });&lt;br /&gt;}&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;In order to use this function, you will do as this example&lt;br /&gt;&lt;br /&gt;&amp;lt;select id="parent"&amp;gt;  &amp;lt;option value="1"&amp;gt;xxx&amp;lt;/option&amp;gt;  &amp;lt;option value="2"&amp;gt;xxx&amp;lt;/option&amp;gt;&amp;lt;/select&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;select id="child"&amp;gt;  &amp;lt;option parent="1" value="1"&amp;gt;xxx&amp;lt;/option&amp;gt;  &amp;lt;option parent="1" value="2"&amp;gt;xxx&amp;lt;/option&amp;gt;  &amp;lt;option parent="2" value="3"&amp;gt;xxx&amp;lt;/option&amp;gt;&amp;lt;/select&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;just as your normal select boxes, but with additional IDs for each one of them and for the select box that have parent, each option state in its parent attribute the value of its parent&lt;br /&gt;&lt;br /&gt;One Question will be: What if i want to add dummy option such as --select-- for both selects and whenever i choose this option in parent, child should be also this dummy one. Don't worry code handles this for you. If available this will be done. As for the dummy one, don't add to it a parent and let its value = ''&lt;br /&gt;&lt;br /&gt;Now, just call the function and pass parameters:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;parent select id&lt;/li&gt;&lt;li&gt;child select id&lt;/li&gt;&lt;li&gt;callbackFunction (optional) if you wish certain function to be called on any change to parent select, this function is called and pass to this function, the value of the option which was selected. Use this value to make any extra manipulation you want to do in the HTML page&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Modification made are:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;this method depend on option sent to it in order to show empty option on child, this isn't very          nice in all cases, especially when dealing with internationalizations, in this case the data added here          will have different text from a language to another.          That's why i give you the ability to add empty option at the top of options and use it instead of generating          one myself. that way you can choose what to write in this without changing in the JS Code          The new logic is if there is an empty value option in child&lt;/li&gt;&lt;li&gt;Another option is needed is to call certain function whenever a change occurs on parent level and this function takes the          new value, this way you can do any changes that was waiting such change like loading in Ajax some changes in page&lt;/li&gt;&lt;li&gt;One last change is that i see adding a parent attribute will be better than using sub_ and parent value&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/2885969180090658174-1012572584275549412?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/1012572584275549412/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=1012572584275549412' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/1012572584275549412'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/1012572584275549412'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2009/03/cascaded-html-select-elements-using.html' title='Cascaded HTML SELECT elements using JQuery'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-427718866271089110</id><published>2009-02-19T09:30:00.000-08:00</published><updated>2009-02-19T09:31:51.493-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='null'/><category scheme='http://www.blogger.com/atom/ns#' term='argument'/><category scheme='http://www.blogger.com/atom/ns#' term='error'/><category scheme='http://www.blogger.com/atom/ns#' term='pointer'/><title type='text'>MySQL 5.1 Error with Rails 2.2</title><content type='html'>if you found yourself stuck with such error&lt;br /&gt;&lt;br /&gt;ArgumentError (NULL pointer given): &lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;(eval):3:in `each_hash' &lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;(eval):3:in `all_hashes' &lt;br /&gt;&lt;br /&gt;then this might be useful for you.&lt;br /&gt;&lt;br /&gt;Actually i don't know why it happened but i reached that this only happened between Rails 2.2 and MySQL 5.1&lt;br /&gt;when i downgraded to MySQL 5.0 everything went fine&lt;br /&gt;&lt;br /&gt;of course it will be nice from you to dig and search inside to know WHY THIS HAPPENED but if you have no time AS WAS THE CASE WITH ME, such info can help you survive&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-427718866271089110?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/427718866271089110/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=427718866271089110' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/427718866271089110'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/427718866271089110'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2009/02/mysql-51-error-with-rails-22.html' title='MySQL 5.1 Error with Rails 2.2'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-4363880328474758264</id><published>2009-02-17T03:49:00.001-08:00</published><updated>2009-02-17T03:49:42.721-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='algorithms'/><category scheme='http://www.blogger.com/atom/ns#' term='stemming'/><category scheme='http://www.blogger.com/atom/ns#' term='affix'/><category scheme='http://www.blogger.com/atom/ns#' term='snowball'/><category scheme='http://www.blogger.com/atom/ns#' term='porter'/><title type='text'>Which Stemming Algorithm To use ??</title><content type='html'>suppose you want to search for something in a full database of words, using exact matching is a solution but will miss some data you may need&lt;br /&gt;&lt;br /&gt;for example if you search for &lt;span style="font-weight: bold;"&gt;fishes&lt;/span&gt;, then document having &lt;span style="font-weight: bold;"&gt;fish&lt;/span&gt; as one of its words will be nice to retrieve them. That's why it is suggested that you use a stemmer so that words in your documents is transferred to its root making retrieval much wider than before&lt;br /&gt;&lt;br /&gt;stemmers will take &lt;span style="font-weight: bold;"&gt;fishes&lt;/span&gt; and return it to &lt;span style="font-weight: bold;"&gt;fish&lt;/span&gt; and take your search keyword and stem also then search returning documents you want&lt;br /&gt;&lt;br /&gt;there are many types of automatic stemming techniques, i found them to be one of those&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Brute Force&lt;/li&gt;&lt;li&gt;Suffix Stripping&lt;/li&gt;&lt;li&gt;Lemmatisation&lt;/li&gt;&lt;li&gt;Stochastic&lt;/li&gt;&lt;li&gt;Hybrid&lt;/li&gt;&lt;li&gt;Affix&lt;/li&gt;&lt;li&gt;Matching&lt;span style="text-decoration: underline;"&gt;&lt;span style="font-style: italic;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;This is a long list of algorithms but the question that i didn't find an answer for it was which one to choose and in which cases and why&lt;br /&gt;i didn't find a fast solution on the internet and i think to get a solution i have to dig inside papers published in that field&lt;br /&gt;&lt;br /&gt;anyway, in my two projects i was using Ruby and used in both a stemmer belonging to the Affix class&lt;br /&gt;i found two solutions one called &lt;span style="font-weight: bold;"&gt;porter&lt;/span&gt; and another called &lt;span style="font-weight: bold;"&gt;snowball&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;i tried both on a small list of &lt;span style="font-weight: bold;"&gt;116&lt;/span&gt; terms that i have in my db and results was the same except in these cases&lt;br /&gt;&lt;ul&gt;&lt;li&gt;emotionality -- emotion -- emot&lt;/li&gt;&lt;li&gt;joy -- joi -- joy&lt;/li&gt;&lt;li&gt;negativity -- neg -- negat&lt;/li&gt;&lt;/ul&gt;the first is the &lt;span style="font-weight: bold;"&gt;actual word&lt;/span&gt;, the second is &lt;span style="font-weight: bold;"&gt;porter result&lt;/span&gt;, the third is &lt;span style="font-weight: bold;"&gt;snowball result&lt;/span&gt;&lt;br /&gt;my opinion is that the result in this small sample is &lt;span style="font-weight: bold;"&gt;2 for snowball and 1 for porter&lt;/span&gt;&lt;br /&gt;BUT still i can't say which one should i use, that's why i have shown these cases here in that post to see your opinions in that matter&lt;br /&gt;&lt;br /&gt;One last point to say is that porter overstemmed &lt;span style="font-weight: bold;"&gt;negativity&lt;/span&gt; and snowball overstemmed &lt;span style="font-weight: bold;"&gt;emotionality&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I am waiting for your comments as i need to take decision and choose one to use in my new project&lt;br /&gt;&lt;span style="text-decoration: underline;"&gt;&lt;span style="font-style: italic;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-4363880328474758264?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/4363880328474758264/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=4363880328474758264' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/4363880328474758264'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/4363880328474758264'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2009/02/which-stemming-algorithm-to-use.html' title='Which Stemming Algorithm To use ??'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-4333023648667338557</id><published>2009-02-11T03:41:00.000-08:00</published><updated>2009-02-11T03:42:36.296-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='gadget'/><category scheme='http://www.blogger.com/atom/ns#' term='google'/><category scheme='http://www.blogger.com/atom/ns#' term='scrape'/><category scheme='http://www.blogger.com/atom/ns#' term='html'/><title type='text'>HTML Scrapping using Javascript ((for google gadgets))</title><content type='html'>Some friends at my company were working on doing some google gadgets. A large sum of gadgets were depending on data gathered from other websites which lack of any XML or RSS service providing this data in a direct way.&lt;br /&gt;&lt;br /&gt;Since this is a problem we will face every now and then, we started thinking about a more generic solution to use in any gadget depending on such source of data.&lt;br /&gt;&lt;br /&gt;The solution we reached was one of these three&lt;br /&gt;&lt;ol&gt;&lt;li&gt;using a scrapping service such as Dapper or Yahoo pipes to do the scrapping on behalf of us and returns a well formed XML file to use in any gadget&lt;/li&gt;&lt;li&gt;create a google app engine that we call and it scrape the data and returns XML to us&lt;/li&gt;&lt;li&gt;using JS for scrapping HTML pages&amp;nbsp;&lt;/li&gt;&lt;/ol&gt;the first and second solutions may seam the same and actually they are except that Dapper isn't that reliable as it sometimes fails due to extra load on it while google app engine was proven to survive under high request rates&lt;br /&gt;&lt;br /&gt;Anyway, i liked the third solution and said to myself lets give it a try and see if it will be performant enough or not. I thought scrapping html using JS is an easy matter that can be done easily in any google gadget but i was proven not to be like that at all. I will summerize the trials i made here starting from those who failed to the last solution that worked.&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Depending on Google Api method "_IG_FetchXmlContent". This way failed easily because it was expecting XML document and was faced with HTML Page. It gave me parse error on Doctype line. The result is &lt;span style="font-weight: bold;"&gt;FAILURE&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Depending on Google Api method "_IG_FetchContent". This way gave us the html as it is and it was time to parse it using DOM Parsers built already inside browsers. I tried doing so using Firefox browser but also got parse error because this is not a XML document but HTML one and parsers available only expects XML. The result is &lt;span style="font-weight: bold;"&gt;FAILURE&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Repeating step 2 again but after using a regular expression to take only inner HTML of body tag. DOM Parser failed on one of the comments lines present in the HTML page which may appear in&lt;br /&gt;may pages so this isn't a generic solution to be accepted. The result is &lt;span style="font-weight: bold;"&gt;FAILURE&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;Using Regular expression to get body inner html and then add this to a hidden div then using normal JS methods for traversing DOM nodes considering this Div as my root. The result is &lt;span style="font-weight: bold;"&gt;SUCCESS&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;Since, the fourth trial was successful i made a generic method that anyone can use in his gadget. this simple method will just get html and scrape based on your scrapping function. To understand what i mean, have a look at the function definition first&lt;br /&gt;&lt;br /&gt;&lt;tt&gt;scrapeHTMLBody = &lt;i&gt;function&lt;/i&gt;(url, dataHolderId, scrapeFunction){&lt;g&gt;&lt;/g&gt;}&lt;/tt&gt;&lt;br /&gt;&lt;br /&gt;as in this definition we see that the function needs some parameters&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;url&lt;/span&gt; to retrieve html from&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;dataHolderId&lt;/span&gt; the id of the hidden div that the retrieved html will be added to it&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;scrapeFunction&lt;/span&gt; a function that takes the hidden div as a root element and use JS to get data desired "every one should write his according to what he wants to retrieve"&lt;/li&gt;&lt;/ul&gt;and this is the implementation of it&lt;br /&gt;&lt;br /&gt;&lt;tt&gt;scrapeHTMLBody = &lt;i&gt;function&lt;/i&gt;(url, dataHolderId, scrapeFunction){&lt;br /&gt;      &lt;g&gt;_IG_FetchContent&lt;/g&gt;(url, &lt;i&gt;function&lt;/i&gt;(responseText){ operate(responseText, dataHolderId, scrapeFunction); });&lt;br /&gt;    }&lt;/tt&gt;&lt;br /&gt;&lt;br /&gt;&lt;tt&gt;operate = &lt;i&gt;function&lt;/i&gt;(responseText, dataHolderId, scrapeFunction){&lt;br /&gt;&amp;nbsp; &lt;i&gt;var&lt;/i&gt; body = /&amp;lt;body.*?&amp;gt;((.|\n|\r)*)&amp;lt;\/body&amp;gt;/.exec(responseText);&lt;br /&gt;&amp;nbsp; &lt;i&gt;var&lt;/i&gt; bodyData = body[1];&lt;br /&gt;&amp;nbsp; &lt;g&gt;_gel&lt;/g&gt;(dataHolderId).innerHTML = bodyData;&lt;br /&gt;&amp;nbsp; scrapeFunction(dataHolderId);&lt;br /&gt;    }&lt;/tt&gt;&lt;br /&gt;&lt;br /&gt;these two functions are used to get html page then retrieve body inner html then call the scrape function passing to it the if of the hidden div containing the html body&lt;br /&gt;it is your responsibility now to write the scrapping function desired based that this div is the root of your DOM tree&lt;br /&gt;&lt;br /&gt;this is an example of a scrapping function i defined&lt;br /&gt;&lt;br /&gt;&lt;tt&gt;scrape = &lt;i&gt;function&lt;/i&gt;(dataHolderId){&lt;br /&gt;&amp;nbsp; &lt;i&gt;var&lt;/i&gt; elements = &lt;g&gt;_gel&lt;/g&gt;(dataHolderId).getElementsByClassName('main');&lt;br /&gt;      &lt;br /&gt;&amp;nbsp; &lt;i&gt;var&lt;/i&gt; noktas = [];&lt;br /&gt;&amp;nbsp;      &lt;i&gt;var&lt;/i&gt; num = elements.length;&lt;br /&gt;&amp;nbsp;      &lt;i&gt;for&lt;/i&gt;(i=0 ; i&amp;lt;num ; i+=2) noktas.push(elements[i].childNodes[0].innerHTML);&lt;br /&gt;      &lt;br /&gt;&amp;nbsp;      &lt;i&gt;for&lt;/i&gt;(i=0 ; i&amp;lt;noktas.length ; i++){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;        &lt;i&gt;var&lt;/i&gt; e = &lt;i&gt;document&lt;/i&gt;.createElement('p');&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.innerHTML = noktas[i];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;        &lt;i&gt;document&lt;/i&gt;.body.appendChild(e);&lt;br /&gt;&amp;nbsp; }&lt;br /&gt;    }&lt;/tt&gt;&lt;br /&gt;&lt;br /&gt;That's it, i think you are ready now to use these two functions in any gadget whose data source should be scrapped&lt;br /&gt;This method should be better as here all processing is made on client machine rather than any other servers&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-4333023648667338557?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/4333023648667338557/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=4333023648667338557' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/4333023648667338557'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/4333023648667338557'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2009/02/html-scrapping-using-javascript-for.html' title='HTML Scrapping using Javascript ((for google gadgets))'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-1801497396710996629</id><published>2009-02-04T04:11:00.001-08:00</published><updated>2009-02-04T04:11:42.708-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hibernate'/><category scheme='http://www.blogger.com/atom/ns#' term='resume'/><category scheme='http://www.blogger.com/atom/ns#' term='audio'/><category scheme='http://www.blogger.com/atom/ns#' term='intrepid'/><category scheme='http://www.blogger.com/atom/ns#' term='hibernation'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><category scheme='http://www.blogger.com/atom/ns#' term='fix'/><title type='text'>Ubuntu No Audio Bug After Hibernating</title><content type='html'>Well, this was very annoying bug in Ubuntu latest version&lt;br /&gt;&lt;br /&gt;but, thanks God it was fixed on 22 Jan&lt;br /&gt;&lt;br /&gt;This is just an announcement, you can follow the ticket &lt;a href="https://bugs.launchpad.net/ubuntu/+source/linux/+bug/249714"&gt;here&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-1801497396710996629?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/1801497396710996629/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=1801497396710996629' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/1801497396710996629'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/1801497396710996629'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2009/02/ubuntu-no-audio-bug-after-hibernating.html' title='Ubuntu No Audio Bug After Hibernating'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-652724422602051958</id><published>2009-02-02T13:06:00.001-08:00</published><updated>2009-02-02T13:06:48.081-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mobile'/><category scheme='http://www.blogger.com/atom/ns#' term='bluetooth'/><category scheme='http://www.blogger.com/atom/ns#' term='obex'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='n80'/><category scheme='http://www.blogger.com/atom/ns#' term='mount'/><category scheme='http://www.blogger.com/atom/ns#' term='symbian'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>[&gt;30] Mounting my N80 mobile on Ubuntu Machine</title><content type='html'>This shall be the first episode in my long series called "&amp;gt;30" which simply means that it took more than 30 minutes. I am collecting here some of the problems that i fought with for more than 30 minutes in order not even solve it but finding a resource on the internet that can relief me from such a pain.&lt;br /&gt;&lt;br /&gt;The first episode of this series is talking about how to mount your Bluetooth device on your Ubuntu machine. I will explain such a thing on my N80 mobile and Ubuntu machine but i think anyone can use such points on any other devices and Linux machines.&lt;br /&gt;&lt;br /&gt;Before getting into the main point, i would like to state that this post might get you the solution or not. I am writing it while doing such a task and while i am writing such introduction, i actually reach to the steps needed to get out of such misery journey. But, anyone whether we reach a solution together or not, i think this post will put you on a track to continue from so you won't lose your time reading it.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Note: points highlighted in bold style are points related to my case so it should change from one case to another.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The journey starts in this post &lt;a href="http://www.siltala.net/2007/07/25/mounting-a-nokia-phone-a-little-bit-easier/"&gt;Mounting a Nokia Phone a Little Bit Easier&lt;/a&gt; which is really a nice point to start with. It states these points&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Find out your phone’s Bluetooth MAC address if you don’t know it already:&lt;br /&gt;&lt;code&gt;hcitool scan&lt;br /&gt;&lt;/code&gt;&lt;/li&gt;&lt;li&gt;Find out the OBEX FTP channel it uses&lt;br /&gt;&lt;code&gt;sdptool search FTP&lt;/code&gt;&lt;/li&gt;&lt;li&gt;Load the fuse kernel module:&lt;br /&gt;&lt;code&gt;sudo modprobe fuse&lt;/code&gt;&lt;/li&gt;&lt;li&gt;Make a suitable mount point for your phone:&lt;br /&gt;&lt;code&gt;mkdir &lt;span style="font-weight: bold;"&gt;/media/n80&lt;/span&gt;&lt;/code&gt;&lt;/li&gt;&lt;li&gt;Mount&lt;br /&gt;&lt;code&gt;obexfs -b&lt;span style="font-weight: bold;"&gt;XX:XX:XX:XX:XX:XX&lt;/span&gt; -B&lt;span style="font-weight: bold;"&gt;YY&lt;/span&gt; &lt;span style="font-family: 'Lucida Sans','Lucida Sans Unicode','Lucida Grande',sans-serif,Arial; font-weight: bold;"&gt;/media/n80&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;(where XX:XX:XX:XX:XX:XX is your phone’s MAC and YY is the OBEX channel)&lt;/li&gt;&lt;li&gt;Unmount when you’re done with your file transfers:&lt;br /&gt;&lt;code&gt;fusermount -u ~/Phone&lt;/code&gt;&lt;/li&gt;&lt;/ul&gt;the above steps depends on having some libraries installed on your pc which are obexfs and obexfs. i got them easily using apt-get. If after doing the above steps everything went well then you are done. Yes that easy but if not then continue with me to know what i did after this step.&lt;br /&gt;&lt;br /&gt;For me, i was capable of entering the mounted folder and even list files and not only this i removed a file. i thought it is time now to copy some files from my pc to the device. after using the cp command, i took no time at all and then it finished. I was sure something went wrong because i am connecting using bluetooth and things shouldn't end that fast. I used ls command to check that it was added but then it hanged for some time and stated that the folder i am inside isn't a valid one. Simple, mounting failed. I went out and entered again and ran ls command but nothing was listed. I unmounted and remounted but it sometimes shows everything or simply nothing&lt;br /&gt;&lt;br /&gt;In some cases, i run "hcitool scan" again and can't find my device even. I disable my bluetooth on the device and enable it to start working again.&lt;br /&gt;&lt;br /&gt;Anyway, it was time to search for a solution for such a problem. I found this &lt;a href="https://bugs.launchpad.net/ubuntu/+source/obexfs/+bug/135812"&gt;can't add files to mounted volume, no free space sony Z610i&lt;/a&gt; ticket. I digged inside it and read for a while and knew that they have the problem of copying files since the mounted point is stating no free space on the mounted device. They stated this is a bug and pointed to its ticket &lt;a href="http://dev.zuckschwerdt.org/openobex/ticket/31"&gt;here&lt;/a&gt;. It stated that current version of obexfs don't manage S60 3rd edition mobiles probably and found the ticked closed invalid. Looking at comments i found someone stating that this should be fixed if i used&amp;nbsp; "ObexFTP 0.22 / ObexFS 0.11" instead of the installed ones. These should be compiled as those got by apt-get are one step behind. Ok, no problem let's compile.&lt;br /&gt;&lt;br /&gt;prepare an empty folder then wget these files one by one&lt;br /&gt;&lt;ul&gt;&lt;li&gt;http://downloads.sourceforge.net/openobex/obexfs-0.11.tar.gz?modtime=1213568386&amp;amp;big_mirror=0&lt;/li&gt;&lt;li&gt;http://downloads.sourceforge.net/openobex/obexftp-0.22.tar.bz2?modtime=1213568417&amp;amp;big_mirror=0&lt;/li&gt;&lt;li&gt;http://downloads.sourceforge.net/openobex/openobex-1.3.tar.gz?modtime=1150294112&amp;amp;big_mirror=0&lt;/li&gt;&lt;/ul&gt;tar these files using tar -xzf for .gz files and -xjf for .bz2 files. Now lets install them in this order openobex then obexftp and obexfs. This order is important because each one depends on the previous one. But, before doing so, these are some libraries i needed while compiling so make sure you have them installed&lt;br /&gt;&lt;ul&gt;&lt;li&gt;python-dev&lt;/li&gt;&lt;li&gt;libfuse-dev&lt;/li&gt;&lt;li&gt;libusb-dev&lt;/li&gt;&lt;li&gt;tcl8.4-dev&lt;/li&gt;&lt;li&gt;tcl-dev&lt;/li&gt;&lt;/ul&gt;now in each folder. run "./configure" then "make" then make "install" and you should be ready to redo the steps stated above which i wrote them at the beginning of my journey.&lt;br /&gt;&lt;br /&gt;I did so but i am sorry to say that all this was useless for me. If everything went ok with you at this step then you are ready to have fun. If not then continue with me, i still have some points to state.&lt;br /&gt;&lt;br /&gt;I reached this link now &lt;a href="http://www.thinkwiki.org/wiki/How_to_setup_Bluetooth"&gt;http://www.thinkwiki.org/wiki/How_to_setup_Bluetooth&lt;/a&gt;, i noticed that there is a section for symbian mobiles that is different from other mobiles. seems that i have to continue searching but i think enough for me this night. maybe tomorrow. If you still have problems till tomorrow then wait for my next post that i wish will settle things and put an end to this misery&lt;br /&gt;&lt;div class="flockcredit" style="text-align: right; color: #CCC; font-size: x-small;"&gt;Blogged with the &lt;a href="http://www.flock.com/blogged-with-flock" style="color: #999; font-weight: bold;" target="_new" title="Flock Browser"&gt;Flock Browser&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-652724422602051958?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/652724422602051958/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=652724422602051958' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/652724422602051958'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/652724422602051958'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2009/02/mounting-my-n80-mobile-on-ubuntu.html' title='[&amp;gt;30] Mounting my N80 mobile on Ubuntu Machine'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-3737772691112773493</id><published>2008-12-15T08:36:00.000-08:00</published><updated>2008-12-15T08:37:04.478-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='emulate'/><category scheme='http://www.blogger.com/atom/ns#' term='platform'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='wine'/><title type='text'>Try Wine</title><content type='html'>Wine is a very nice thing, it is a program you can use in order to run applications dedicated for certain platforms on any other one&lt;br /&gt;&lt;br /&gt;for example i use it to run some windows application i get to use them on my linux machine, although Wine isn't fully mature yet but a large number of applications run nice on it&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-3737772691112773493?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/3737772691112773493/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=3737772691112773493' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/3737772691112773493'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/3737772691112773493'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2008/12/try-wine.html' title='Try Wine'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-358335422827420596</id><published>2008-12-12T03:38:00.001-08:00</published><updated>2008-12-12T03:44:59.803-08:00</updated><title type='text'>Personal Area Network (PAN)</title><content type='html'>Personal Area Network or shortly (PAN) is a communication network between a group of bluetooth-enabled devices (supporting PAN)&lt;br /&gt;&lt;br /&gt;this network can be used between these devices in the same manner as local area connection i.e you can use it to transfer files between two devices or even more you can use it in a twisted way to enable one device to use other device internet connection after configuring a bridge between it and WLAN network&lt;br /&gt;&lt;br /&gt;anyway it is a nice technique of communication, i liked it so much and tried to use it but i couldn't because my N80 doesn't support it. i suggest everyone to make use of this powerful facility&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-358335422827420596?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/358335422827420596/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=358335422827420596' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/358335422827420596'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/358335422827420596'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2008/12/personal-area-network-pan.html' title='Personal Area Network (PAN)'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-3850764235835167865</id><published>2008-10-05T07:20:00.000-07:00</published><updated>2008-10-05T07:31:46.288-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='window title'/><category scheme='http://www.blogger.com/atom/ns#' term='command line'/><category scheme='http://www.blogger.com/atom/ns#' term='name'/><title type='text'>How to name your command line windows??</title><content type='html'>if you are one of the people that use to open so many command line windows while working then you may have faced the problem knowing which one is opened on which task&lt;br /&gt;&lt;br /&gt;for example, suppose you have a windows doing task X and another doing Y and another doing Z and so on. all have same default name added by windows when you open a command line window. Due to these similarities you always get lost getting to the window you want in one step&lt;br /&gt;&lt;br /&gt;to get rid of this problem, use this small tip and name them with significant names using 'TITLE' command as follows&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;TITLE {{desired-name}}&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;that's it, now you can know which windows you have and select the one you desire in a fast way&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-3850764235835167865?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/3850764235835167865/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=3850764235835167865' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/3850764235835167865'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/3850764235835167865'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2008/10/how-to-name-your-command-line-windows.html' title='How to name your command line windows??'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-2713078229322666253</id><published>2008-09-23T03:43:00.000-07:00</published><updated>2008-09-23T05:34:20.316-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tricks'/><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='console'/><title type='text'>Rails Console Tips &amp; Tricks II</title><content type='html'>This is my second rails console tips &amp; tricks. if you interested in reading previous tips and tricks read my &lt;b&gt;&lt;a href="http://bionuc-tech.blogspot.com/2008/07/rails-console-tips-tricks.html"&gt;first blog post&lt;/a&gt;&lt;/b&gt; regarding that matter.&lt;br /&gt;&lt;br /&gt;This second part is about one command called "load" that is available in your Rails console. you can use this command to do many things as&lt;br /&gt;&lt;br /&gt;1. to reload any file that was loaded when starting console and don't get reloaded when using "reload!" command such as files in your lib folder. to reload any file just write&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;load "#{RAILS_ROOT}/lib/{{file_name}}"&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;2. if you faced a problem such as "MySQL has gone away" just reload environment.rb once again as follows&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;load "#{RAILS_ROOT}/config/environment.rb"&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;3. also if you want to test a bunch of code in your console not just a single line of code, and want to be able to change part in it and rerun it once again then doing so in console is very time consuming and annoying so rather than doing so, you can write this code in a file and then&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;load "{{your-ruby-file}}"&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-2713078229322666253?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/2713078229322666253/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=2713078229322666253' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/2713078229322666253'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/2713078229322666253'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2008/09/rails-console-tips-tricks-ii.html' title='Rails Console Tips &amp; Tricks II'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-1768616243939499001</id><published>2008-09-08T07:24:00.000-07:00</published><updated>2008-09-08T07:48:52.140-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='baseruby'/><category scheme='http://www.blogger.com/atom/ns#' term='compile'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><category scheme='http://www.blogger.com/atom/ns#' term='make'/><title type='text'>Ruby Make Problem</title><content type='html'>Still in my early days using Linux and trying to compile ruby 1.9 on my machine in order to move my working environment to Linux&lt;br /&gt;&lt;br /&gt;I downloaded ruby 1.9 source from &lt;a href="ftp://ftp.ruby-lang.org/pub/ruby/"&gt;ftp.ruby-lang.org&lt;/a&gt; and as stated in readMe file, i ran&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;./configure --prefix={{any-desired-path}}&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;successfully then ran&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;make&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;it took some time then i was faced with that error&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;executable host ruby is required. use --with-baseruby option.&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;What is that error? and what ruby?? i am compiling ruby how come i need it.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Anyway, i began searching for an explanation. i reached to a comment in one of the forums stating that this error can occur in these two cases&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;1. ruby isn't in the default path&lt;br /&gt;2. ruby isn't installed&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;More investigation showed that i should have any previous version of ruby installed in order to use it with that make file as follows&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;./configure --prefix={{any-desired-path}} --with_baseruby={{full-path-to-ruby-executable}}&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;then run make command once again. And it worked finally&lt;br /&gt;&lt;br /&gt;What a nice recursive world, "ruby is needed to compile ruby"&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-1768616243939499001?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/1768616243939499001/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=1768616243939499001' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/1768616243939499001'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/1768616243939499001'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2008/09/ruby-make-problem.html' title='Ruby Make Problem'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-4243006402644329094</id><published>2008-09-04T03:21:00.000-07:00</published><updated>2008-09-04T03:46:48.463-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='configure'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='compiler'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>configure: error: C compiler cannot create executables</title><content type='html'>In my first start to use ubuntu, i wanted to compile ruby on my machine&lt;br /&gt;&lt;br /&gt;i downloaded ruby source and executed configure file to generate make file&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;b&gt;./configure&lt;/b&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;i got this error&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;b&gt;C compiler cannot create executables&lt;/b&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;although i have gcc latest version installed&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;after investigating this error i found that the solution was&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;b&gt;sudo apt-get install build-essential&lt;/b&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;after doing so, everything worked fine&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-4243006402644329094?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/4243006402644329094/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=4243006402644329094' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/4243006402644329094'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/4243006402644329094'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2008/09/configure-error-c-compiler-cannot.html' title='configure: error: C compiler cannot create executables'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-5065406710026420212</id><published>2008-08-19T09:41:00.001-07:00</published><updated>2008-08-19T09:41:51.758-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='branches'/><category scheme='http://www.blogger.com/atom/ns#' term='svn'/><title type='text'>SVN Branches do HELP</title><content type='html'>&lt;blockquote&gt;&lt;br /&gt;Q: Have you heard about SVN branches ?&lt;br /&gt;A: yes i have&lt;br /&gt;&lt;br /&gt;Q: Have you used it before ?&lt;br /&gt;A: no i didn't&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;if this scenario applies on you, then let me tell you why you should deal with SVN branches. I will try to prove my concept through a small scenario introducing 3 problems you might face while using SVN and how they can be solved with or without branches&lt;br /&gt;&lt;br /&gt;Scenario&lt;br /&gt;&lt;hr align="left" width="200px" /&gt;&lt;br /&gt;suppose you are working on a project and after a while you reached a stable state at which you decided to go live. after going live, you decided to move ahead and work on the next version of your project. while working on this version, a sudden problem occurred on your server and your online version was lost.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;HOW WILL YOU RETURN IT BACK LIVE AFTER YOU STARTED DEVELOPMENT ON A NEW UNSTABLE VERSION??&lt;/b&gt; This is problem 1.&lt;br /&gt;&lt;br /&gt;hopefully you succeeded to do so, but later on, you found a bug and started fixing it but you can't leave your online version containing this bug until you finish development of the new version.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;HOW CAN YOU COPY THIS BUG FIX TO THE ONLINE VERSION??&lt;/b&gt; This is problem 2.&lt;br /&gt;&lt;br /&gt;you also succeeded doing so, now suppose that problem 1 happened once more but this time after fixing problem 2.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;HOW WILL YOU GET BACK ONLINE WHILE NO REVISION CONTAINS BUG FIXES MADE??&lt;/b&gt; This is problem 3.&lt;br /&gt;&lt;br /&gt;Without using SVN Branches&lt;br /&gt;&lt;hr align="left" width="200px" /&gt;&lt;br /&gt;In problem 1, you will start looking at the repository revisions searching for the revision number at which you decided to go live in order to check it out again on your server and return online&lt;br /&gt;accepted solution but considering the time and effort you took to do so i consider this solution a difficult one&lt;br /&gt;&lt;br /&gt;In problem 2, you will fix the bug then select from your project the altered files and copy them one by one to your server without selecting any other files related to the new version you are working on. this solution will take a lot of time and effort and some errors might be expected while selecting files&lt;br /&gt;&lt;br /&gt;In problem 3, i think you will have to work in your weekend in order to find the stable version and add it to bugs fixes that you have made&lt;br /&gt;&lt;br /&gt;After SVN Branches&lt;br /&gt;&lt;hr align="left" width="200px" /&gt;&lt;br /&gt;In problem 1, since you have created a new branch for the new version leaving your stable version as it is. all you need is to check it out again.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In problem 2, when you find a bug you will just commit all files you changed to your branch then start fixing that bug and commit the changed files then finally merge the difference between the last two revisions on branch with trunk&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In problem 3, take what is in the trunk directly&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;I think it is now clear how helpful branches can be especially in a project that is expected to change from time to time which is actually common in a large of projects&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/2885969180090658174-5065406710026420212?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/5065406710026420212/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=5065406710026420212' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/5065406710026420212'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/5065406710026420212'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2008/08/svn-branches-do-help.html' title='SVN Branches do HELP'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-3781382440384477212</id><published>2008-08-18T04:04:00.000-07:00</published><updated>2008-08-18T04:22:00.239-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='charset'/><category scheme='http://www.blogger.com/atom/ns#' term='problem'/><category scheme='http://www.blogger.com/atom/ns#' term='encoding'/><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><title type='text'>Different encoding error</title><content type='html'>if you found yourself suffering with this error&lt;br /&gt;&lt;code&gt;&lt;br /&gt;ActiveRecord::StatementInvalid: Mysql::Error: #HY000Incorrect string value&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;don't cry or check your code looking at the data you save thinking that you might have left some bad characters around causing you this misery&lt;br /&gt;&lt;br /&gt;all you need to do is to check the used database connection encoding against your db tables encoding, most probably you will find them different&lt;br /&gt;&lt;br /&gt;if so then the solution is one of these two options&lt;br /&gt;1) remove encoding field from specification and use default db encoding&lt;br /&gt;2) change the encoding of your db tables to this encoding&lt;br /&gt;&lt;br /&gt;once you do so, you will have a good life&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-3781382440384477212?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/3781382440384477212/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=3781382440384477212' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/3781382440384477212'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/3781382440384477212'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2008/08/different-encoding-error.html' title='Different encoding error'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-8874491764976964770</id><published>2008-07-22T12:15:00.000-07:00</published><updated>2008-07-22T12:53:09.291-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='dirty objects'/><category scheme='http://www.blogger.com/atom/ns#' term='acts_as_modified'/><category scheme='http://www.blogger.com/atom/ns#' term='modified'/><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><category scheme='http://www.blogger.com/atom/ns#' term='model'/><category scheme='http://www.blogger.com/atom/ns#' term='changed'/><category scheme='http://www.blogger.com/atom/ns#' term='attributes'/><title type='text'>acts_as_modified plugin</title><content type='html'>is it changed? which attributes? what are the old values? in some cases you may be asking yourself these questions when dealing with some models&lt;br /&gt;&lt;br /&gt;&lt;b&gt;When should you care about these questions?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;suppose you have a model doing an expensive operation on save. this operation is useful only if one specific attribute changed. so doing it on every save neglecting which attributes changed will degrades performance significantly&lt;br /&gt;&lt;br /&gt;&lt;b&gt;So what can you do?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;you can load model old data from database and check if that attribute has changed or not and if so do your action&lt;br /&gt;&lt;br /&gt;or&lt;br /&gt;&lt;br /&gt;you can use acts_as_modified plugin, it helps keeping modified attributes with their old values within model in order to be capable of answering your questions without doing any extra database trips&lt;br /&gt;&lt;br /&gt;&lt;b&gt;I am exited, from where can i get it?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;it depends on your rails version&lt;br /&gt;&lt;br /&gt;1. ((rails 2.1)) do nothing, dirty objects already embedded in this version&lt;br /&gt;2. ((rails r7315 and above)) install from http://svn.viney.net.nz/things/branches/acts_as_modified_edge&lt;br /&gt;3. ((ELSE)) install from http://svn.viney.net.nz/things/rails/plugins/acts_as_modified&lt;br /&gt;&lt;br /&gt;That's it, Enjoy the fun&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-8874491764976964770?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/8874491764976964770/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=8874491764976964770' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/8874491764976964770'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/8874491764976964770'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2008/07/actsasmodified-plugin.html' title='acts_as_modified plugin'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-1108273333866554</id><published>2008-07-20T04:39:00.000-07:00</published><updated>2008-07-20T04:54:29.257-07:00</updated><title type='text'>Rails Console Tips &amp; Tricks</title><content type='html'>Rails console have many useful tips that you may exploit as&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Getting out of a block of code&lt;/b&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;If you're in an indented block of code (e.g., something that should be terminated with end) and want to escape without finishing, you can use ctrl + c to get back to the top level. The current expression will be ignored and not run.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Accessing the last return value&lt;/b&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;you can use the magic variable (_) for accessing last value&lt;br /&gt;and you can then assign this value to a variable as x = _&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Rollback all database changes on exit&lt;/b&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;script/console --sandbox&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/2885969180090658174-1108273333866554?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/1108273333866554/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=1108273333866554' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/1108273333866554'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/1108273333866554'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2008/07/rails-console-tips-tricks.html' title='Rails Console Tips &amp; Tricks'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-9139231097542732098</id><published>2008-06-22T06:47:00.000-07:00</published><updated>2008-06-22T07:31:06.893-07:00</updated><title type='text'>Rails Validations &amp; Unit Tests</title><content type='html'>I was doing a new feature in an existing rails project, and after finishing that feature, i ran all tests to check that everything is fine and no failures or errors occurred after my change&lt;br /&gt;&lt;br /&gt;i ran the tests and found a failure in one of the unit tests, i opened it to see what is the problem. at this point i found in that file a function that gained my attention.&lt;br /&gt;&lt;br /&gt;before stating what is inside this function, lets have a look at the part of the model that is being tested by this function&lt;br /&gt;&lt;code&gt;&lt;br /&gt;class Feed &lt; ActiveRecord::Base&lt;br /&gt;  validates_presence_of :name&lt;br /&gt;&lt;br /&gt;  ...&lt;br /&gt;end&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;we can see in this part that name field should be present for the model to be valid, now lets look at the testing function&lt;br /&gt;&lt;code&gt;&lt;br /&gt;  f = Feed.new&lt;br /&gt;  assert !f.valid?&lt;br /&gt;  assert f.errors.invalid?(:action)&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;So, what is the point in this code? the point is that at my first look at this function, i considered it a redundant test function because it checks an already tested rails function which is the validation function.&lt;br /&gt;&lt;br /&gt;so i asked a friend of mine about his opinion, and he agreed with me that it is redundant and useless&lt;br /&gt;&lt;br /&gt;later on, i asked someone with greater experience about his opinion also in this function as it represents a class of functions found in many models checking such validations.&lt;br /&gt;&lt;br /&gt;But his opinion was different. he considered it useful and justified that by stating that this function tests the contract (which is that no feed is accepted if no name is stated) with the client, so that if someone later on changed this part in a wrong way, this test will alert us that the contract has changed. so that we reconsider our action to see if it has been really changed by the contract or by mistake&lt;br /&gt;&lt;br /&gt;i found that answer reasonable and added to me a new way of thinking towards tests which is testing the agreements rather than checking whether our code is working or not&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-9139231097542732098?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/9139231097542732098/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=9139231097542732098' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/9139231097542732098'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/9139231097542732098'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2008/06/rails-validations-unit-tests.html' title='Rails Validations &amp; Unit Tests'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-3452129104890910649</id><published>2008-06-22T06:13:00.000-07:00</published><updated>2008-06-22T06:47:16.727-07:00</updated><title type='text'>Rails: Modules &amp; Routes</title><content type='html'>I used to make a module for every set of controllers which are doing certain task or feature because this way, things become organized in a better way&lt;br /&gt;&lt;br /&gt;but something weird happened to me while trying to test a controller inside one of the modules, to see what happened i represent my case here by an example&lt;br /&gt;&lt;br /&gt;i added in routes file this snippet of code&lt;br /&gt;&lt;code&gt;&lt;br /&gt; map.resources :items do |item|&lt;br /&gt;   item.resource :rate, :controller =&gt; 'ItemActions::Rate'&lt;br /&gt; end&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;and in my controllers folder, made a folder called 'item_actions' and added inside it a file called 'rate_controller.rb', inside this file i wrote&lt;br /&gt;&lt;code&gt;&lt;br /&gt;  module ItemActions&lt;br /&gt;    class RateController &lt; ApplicationController&lt;br /&gt;      ...&lt;br /&gt;    end&lt;br /&gt;  end&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;restarted the server and run my work, everything fine and i can call the controller actions as any other controller&lt;br /&gt;&lt;br /&gt;then i opened the controller test file and inside one of its test functions, i added this code&lt;br /&gt;&lt;code&gt;&lt;br /&gt;  post :create, {:item_id =&gt; 1, :rating =&gt; 50}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;i got that error&lt;br /&gt;&lt;code&gt;&lt;br /&gt; No route to match {:controller =&gt; 'item_actions/rate', :action =&gt; 'create', :item_id =&gt; 1}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;i changed the controller to be&lt;br /&gt;&lt;code&gt;&lt;br /&gt;  class ItemActions::RateController &lt; ApplicationController&lt;br /&gt;    ...&lt;br /&gt;  end&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;but nothing changed, i am still getting that error once again, searching for a long time, i reached to a working solution which was to open routes file and change it to&lt;br /&gt;&lt;code&gt;&lt;br /&gt; map.resources :items do |item|&lt;br /&gt;   item.resource :rate, :controller =&gt; '&lt;span style="font-weight:bold;"&gt;item_actions/rate&lt;/span&gt;'&lt;br /&gt; end&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;That's it, it worked and i didn't get the error once again&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-3452129104890910649?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/3452129104890910649/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=3452129104890910649' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/3452129104890910649'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/3452129104890910649'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2008/06/rails-modules-routes.html' title='Rails: Modules &amp; Routes'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-3574350758128382868</id><published>2008-06-18T01:22:00.000-07:00</published><updated>2008-06-18T01:52:23.278-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='cookies'/><category scheme='http://www.blogger.com/atom/ns#' term='login'/><category scheme='http://www.blogger.com/atom/ns#' term='remember me'/><title type='text'>Remember User Login Via Cookies</title><content type='html'>How to persist user login via cookies if session has expired?, this is a question almost answered in most of nowadays web applications, So how can this be done?&lt;br /&gt;&lt;br /&gt;The idea is simple, and can be summarized in these simple steps&lt;br /&gt;&lt;br /&gt;  1. add a new column in your users table called login_key or remember_token or any name you prefer of type string&lt;br /&gt;&lt;br /&gt;  2. whenever user tries to login and his login is successful, add in his cookies a cookie called anything ex: remember_token and let its value be a generated random string of length around 40 characters for better security which is our token, and save this token in the db with that user&lt;br /&gt;&lt;br /&gt;  3. now add, in any action you need to check in it whether this user already in system or guest, a snippet of code that checks if the person isn't logged in whether the request has a cookie with the name choosed before and if so, check the db looking for a user having that token, if found then this user is logged in as if he did that in the normal ordinary way&lt;br /&gt;&lt;br /&gt;That's it, now you can use cookie to log user in if his session has expired. There are also some points you may need to take care of when using this technique&lt;br /&gt;&lt;br /&gt;  1. Make cookie expires after some time so that it gets created once again with new token&lt;br /&gt;&lt;br /&gt;  2. In order to provide extra security, add with that token another info about the user&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-3574350758128382868?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/3574350758128382868/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=3574350758128382868' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/3574350758128382868'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/3574350758128382868'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2008/06/remember-user-login-via-cookies.html' title='Remember User Login Via Cookies'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-7838270244124113390</id><published>2008-06-16T05:15:00.000-07:00</published><updated>2008-06-16T05:32:31.736-07:00</updated><title type='text'>ActiveRecord Association Weird Length Method</title><content type='html'>The method 'length' defined for ActiveRecord associations works in a very weird manner.&lt;br /&gt;&lt;br /&gt;consider this example&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;class User &lt; ActiveRecord::Base&lt;br /&gt;  has_many :feeds&lt;br /&gt;end&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;i was using the class and writing this snippet of code to get the count of feeds in the db&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;@user = User.find :first&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;puts @user.feeds.length&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;looking at the log, i found that the added query was&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;SELECT * FROM `feeds` WHERE (feeds.user_id = 1)&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;and not&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;SELECT count(*) AS count_all FROM `feeds` WHERE (feeds.user_id = 1)&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;so in order to get away from such weird sql statement which will exhaust a very large bandwidth getting all records to count them, use this instead&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;puts @user.feeds.count&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;or&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;puts @user.feeds.size&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;but don't use 'length' method&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-7838270244124113390?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/7838270244124113390/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=7838270244124113390' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/7838270244124113390'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/7838270244124113390'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2008/06/activerecord-association-weird-length.html' title='ActiveRecord Association Weird Length Method'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-934443787664932873</id><published>2008-05-15T07:37:00.000-07:00</published><updated>2008-05-15T08:35:07.525-07:00</updated><title type='text'>SVN Branches</title><content type='html'>Imagine working on a deployed project, and you want to add some new features and changes on the running copy.&lt;br /&gt;&lt;br /&gt;Since making new features may cause problems in the deployed project, you need to have another copy from the application and work on it freely then merge it with the running copy to apply your changes.&lt;br /&gt;&lt;br /&gt;Subversion makes this very easy, all you need to do is to create a new branch.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;So, what is a branch?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;in order to understand that, lets look at the repository location hierarichy, you will find that it is as follows&lt;br /&gt;&lt;pre&gt;--&lt;br /&gt;-- trunk&lt;br /&gt;-- branches&lt;/pre&gt;&lt;ul&gt;&lt;li&gt;trunk is the folder containing the version of the website currently deployed&lt;/li&gt;&lt;br /&gt;&lt;li&gt;branches is another folder containing some other versions, as a new edition of the application&lt;/li&gt;&lt;/ul&gt;Now, in order to do that, just run this command&lt;br /&gt;&lt;code&gt;&lt;br /&gt;svn copy ((repository-path))/((project-name))/trunk ((repository-path))/((project-name))/branches/((branch-name)) -m "Creating a private branch in order to ... bla bla bla"&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;now you are done with your branch, checkout the project from that new path, and do any changes you want freely then at the end merge with your trunk to apply your changes&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-934443787664932873?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/934443787664932873/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=934443787664932873' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/934443787664932873'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/934443787664932873'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2008/05/svn-branches.html' title='SVN Branches'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-1720574892639923471</id><published>2008-05-05T11:08:00.001-07:00</published><updated>2008-05-05T11:15:01.457-07:00</updated><title type='text'>acts_as_changed plugin farewell</title><content type='html'>i used acts_as_changed plugin since a while and i have been enjoying the idea of being capable to know which attributes has been changed in my model and to take action upon certain attributes changes&lt;br /&gt;&lt;br /&gt;and today i only tried to look at it again to know if there are any changes made in it or not but, i was shocked when i read a comment from the owner stating that it isn't plugin anymore&lt;br /&gt;&lt;br /&gt;it is now an alternative base.rb file that you can update your activerecord with if you want to enjoy the plugin functionality once again&lt;br /&gt;&lt;br /&gt;and he stated that he did so because he was facing problem in callbacks that he couldn't solve till now except through this way&lt;br /&gt;&lt;br /&gt;anyway, i hope he finds a solution for it so that we all benefit from this plugin functionality&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-1720574892639923471?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/1720574892639923471/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=1720574892639923471' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/1720574892639923471'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/1720574892639923471'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2008/05/actsaschanged-plugin-farewell.html' title='acts_as_changed plugin farewell'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-4740279924167464483</id><published>2008-04-23T08:23:00.000-07:00</published><updated>2008-04-23T08:33:23.012-07:00</updated><title type='text'>Memcache Trick</title><content type='html'>i was faced with a very weird behaviour while working with memcache-client with two memcache servers&lt;br /&gt;&lt;br /&gt;first lets look of my configuration to the client in order to explain on it&lt;br /&gt;On my first server&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;memcache_options = {&lt;br /&gt;  ((some options)&lt;br /&gt;}&lt;br /&gt;CACHE = MemCache.new memcache_options&lt;br /&gt;CACHE.servers = [((SERVER1)), ((SERVER2))]&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;On my second server&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;memcache_options = {&lt;br /&gt;  ((some options)&lt;br /&gt;}&lt;br /&gt;CACHE = MemCache.new memcache_options&lt;br /&gt;CACHE.servers = [((SERVER2)), ((SERVER1))]&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;after running both servers, i noticed that what i enter in memcache on that server isn't available to the other server&lt;br /&gt;&lt;br /&gt;Where is the problem??&lt;br /&gt;&lt;br /&gt;here it is, a very strange reason&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;CACHE.servers = [&lt;span style="font-weight:bold;"&gt;((SERVER2))&lt;/span&gt;, &lt;span style="font-weight:bold;"&gt;((SERVER1))&lt;/span&gt;]&lt;br /&gt;CACHE.servers = [&lt;span style="font-weight:bold;"&gt;((SERVER1))&lt;/span&gt;, &lt;span style="font-weight:bold;"&gt;((SERVER2))&lt;/span&gt;]&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;this is the problem, one uses SERVER1 then SERVER2&lt;br /&gt;other uses SERVER2 then SERVER1&lt;br /&gt;&lt;br /&gt;i thought that memcache client when checking for a key, he looks at the first, if not found then looks at the second then say it is a miss&lt;br /&gt;but i realized that if it isn't on the first then it doesn't look at the second&lt;br /&gt;&lt;br /&gt;That's it, just take care, cuz small things can waste your time and energy looking after their reasons&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-4740279924167464483?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/4740279924167464483/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=4740279924167464483' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/4740279924167464483'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/4740279924167464483'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2008/04/memcache-trick.html' title='Memcache Trick'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-1052947404130324077</id><published>2008-04-23T06:52:00.000-07:00</published><updated>2008-04-23T07:20:24.202-07:00</updated><title type='text'>Adding Data Through Migrations</title><content type='html'>one of the points i am always faced with while adding some migrations, is my need to add some system data as a static group for Administrators or any other.&lt;br /&gt;&lt;br /&gt;so simply i create a new migration and add the following&lt;br /&gt;ex:&lt;br /&gt;&lt;blockquote&gt;Group.create((some_attributes&gt;))&lt;/some_attributes&gt;&lt;/blockquote&gt;&lt;br /&gt;and it simply works fine, until someone later one adds a new column&lt;br /&gt;in another new migration and adds validation on that column in the Model&lt;br /&gt;&lt;br /&gt;and here the problem occurs&lt;br /&gt;my old migration throws exception because of validation added on a new column added later in another migration but Model carries code validating it&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;how to solve these problems?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;i suggest not using create at all&lt;br /&gt;but rather use new and set our attributes&lt;br /&gt;then save without validations&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-1052947404130324077?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/1052947404130324077/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=1052947404130324077' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/1052947404130324077'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/1052947404130324077'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2008/04/adding-data-through-migrations.html' title='Adding Data Through Migrations'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-8607029022763284924</id><published>2008-04-03T07:17:00.000-07:00</published><updated>2008-04-03T08:53:47.752-07:00</updated><title type='text'>Thick Models Thin Controllers</title><content type='html'>i have worked for about six months with Rails and through this time i was coding a lot in my controller which has shown to me lots of problem later on&lt;br /&gt;&lt;br /&gt;for example,&lt;br /&gt;&lt;br /&gt;i was having a Topic model and Post model, where every topic has many posts&lt;br /&gt;and in each of these two models there is a field called archive&lt;br /&gt;&lt;br /&gt;i was having a controller that changes the archive field to a certain value then pass on every post it owns and change its attribute also&lt;br /&gt;&lt;br /&gt;later on, i made another controller and in it i also changed that field in it and passed on all posts to do the same change in it&lt;br /&gt;&lt;br /&gt;this led to redundancy and duplication of code&lt;br /&gt;&lt;br /&gt;but the problem became more complicated when i wanted to change the logic of this topic and its posts replication to a new way&lt;br /&gt;&lt;br /&gt;here i have to move on my controllers and change this code in them&lt;br /&gt;&lt;br /&gt;but i have added the code that observe this change in topic attribute and apply it on all its posts inside the model, i would haven't faced this problem anymore&lt;br /&gt;and this will give me flexibility to do changes easily also&lt;br /&gt;&lt;br /&gt;so this led to the idea of having my controller thin containing the least amount of code and my model thick containing large amount of code&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-8607029022763284924?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/8607029022763284924/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=8607029022763284924' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/8607029022763284924'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/8607029022763284924'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2008/04/thick-models-thin-controllers.html' title='Thick Models Thin Controllers'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-1354649976592035764</id><published>2008-03-26T04:35:00.000-07:00</published><updated>2008-03-26T04:40:35.834-07:00</updated><title type='text'>script/console reload models</title><content type='html'>if you are one of the Rails applications developer, then you would have used this command before&lt;br /&gt;&lt;blockquote&gt;ruby script/console&lt;/blockquote&gt;&lt;br /&gt;it is very nice and gives you the ability to load your environment and try it as you wish, but what if you changed anything in the application models, you will find that the console isn't aware of these changes at all&lt;br /&gt;&lt;br /&gt;so what can you do to make him aware of your changes?&lt;br /&gt;&lt;br /&gt;here it is, just run this command in your console&lt;br /&gt;&lt;blockquote&gt;Dispatcher.reset_application!&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Now you can try the new changes you made in your models&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-1354649976592035764?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/1354649976592035764/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=1354649976592035764' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/1354649976592035764'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/1354649976592035764'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2008/03/scriptconsole-reload-models.html' title='script/console reload models'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-1817488347450291492</id><published>2008-02-27T09:53:00.000-08:00</published><updated>2008-02-27T10:16:13.790-08:00</updated><title type='text'>Unobtrusive JavaScript</title><content type='html'>While serving the internet looking for something, i found someone talking about something called 'Unobtrusive JavaScript', it was the first time for me to hear that expression so i looked for it and found that&lt;br /&gt;&lt;br /&gt;Unobtrusive JavaScript is one of the emerged paradigms in JavaScript, its main idea is to achieve more separation while working on web applications&lt;br /&gt;&lt;br /&gt;Since now, we almost reached to an agreement to separate presentation from content/structure through separation of CSS from HTML, this paradigm is greedy and wants extra separation of behaviour from structure&lt;br /&gt;&lt;br /&gt;lets look at this example to clarify things out&lt;br /&gt;&lt;blockquote&gt;&lt;#input type="text" id="date" onchange="validateDate(this);" /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;here we can see that our structure is that simple input field but it is mixed by this onchange function which shows to us what this input does on change&lt;br /&gt;&lt;br /&gt;Now, look at that one&lt;br /&gt;&lt;blockquote&gt;&lt;#input type="text" id="date" /&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;here we have only structure and no behaviour, so WHERE SHOULD WE ADD OUR BEHAVIOUR?, we should do that with javascript away from our presentation as follows&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;window.onload = function(){ //Wait for the page to load.&lt;br /&gt;    var input = document.getElementById('input');&lt;br /&gt;    input.onchange = function(){ &lt;br /&gt;       //Do something changed.&lt;br /&gt;    }&lt;br /&gt;};&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;This is the simplest illustration that i can give to this paradigm, it makes you live in a world of layers (structure, presentation, behaviour)&lt;br /&gt;&lt;br /&gt;actually, i am admired with this paradigm so much because it layered our application and thus allowed for better separation but i think one of its problems is that looking at structure won't give you a quick idea about what elements behave until you visit the behaviour layer&lt;br /&gt;&lt;br /&gt;finally, i would like to end with this nice quote from one of the articles i read about this topic&lt;br /&gt;&lt;blockquote&gt;The first rule of the unobtrusive Javascript club is don't talk about the unobtrusive Javascript club.&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;this post isn't done yet until i hear from you what do you think about this emerged paradigm and whether it should be the dominant in the following years or not&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-1817488347450291492?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/1817488347450291492/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=1817488347450291492' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/1817488347450291492'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/1817488347450291492'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2008/02/unobtrusive-javascript.html' title='Unobtrusive JavaScript'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-3603117845972271491</id><published>2008-02-27T02:34:00.000-08:00</published><updated>2008-02-27T03:53:43.728-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='IP'/><category scheme='http://www.blogger.com/atom/ns#' term='Mapping'/><category scheme='http://www.blogger.com/atom/ns#' term='Country'/><title type='text'>Ip2Country Mapping</title><content type='html'>I was working on a web application that required mapping every request to its corresponding country in order to use this data later in site statistics&lt;br /&gt;&lt;br /&gt;i searched over the internet for a solution that can do this mapping for me, i found a lot of solutions that are great to the extent that they can also get the ISP and geographical location of the request but &lt;span style="font-weight:bold;"&gt;MOST OF THEM WERE NOT FREE&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Since i was only looking for a simple solution that simply maps ip to corresponding country, i searched for free versions of these solutions which are limited but free&lt;br /&gt;&lt;br /&gt;i found this &lt;a href="http://www.maxmind.com/app/geolitecountry"&gt;Website&lt;/a&gt; that offered a nice &amp; easy solution for this issue. Although, this website has a very nice tutorial but i will explain what i did because i modified the steps provided by the website somehow&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Just do as follows&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;1. Download the CSV file that contain all mapping details&lt;br /&gt;&lt;br /&gt;2. Create a new table in your database that should carries all data needed to do&lt;br /&gt;   this mapping, you will needs these columns&lt;br /&gt;       * begin_num - FLOAT&lt;br /&gt;       * end_num - FLOAT&lt;br /&gt;              &lt;blockquote&gt;These are two magical numbers that will be used later in&lt;br /&gt;                          our mapping&lt;/blockquote&gt;&lt;br /&gt;       * ISO - VARCHAR(2)&lt;br /&gt;       * Name - VARCHAR(255)&lt;br /&gt;&lt;br /&gt;2. Import CSV file into that table but, remember to choose only 3rd, 4th, 5th, and 6th values while importing - neglect 1st and 2nd one because they are useless in our mapping&lt;br /&gt;&lt;br /&gt;3. On every request, apply this formula on the IP as follows&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;ipnum = 16777216*w + 65536*x + 256*y + z&lt;br /&gt;&lt;br /&gt;where&lt;br /&gt;&lt;br /&gt;IP Address = w.x.y.z&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;4. Use ipnum to retrieve corresponding ISO or name of country through this simple query&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;SELECT ((required-columns)) FROM ((table-name)) WHERE ((ipnum)) BETWEEN begin_num AND end_num&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;That's it, you can now map any request to the corresponding country with an accuracy reaching 98% as stated by this website&lt;br /&gt;&lt;br /&gt;Note:&lt;br /&gt;1. This query may return nothing if the IP can't be mapped and this will happen especially when using localhost&lt;br /&gt;2. Always index begin_num and end_num for better performance&lt;br /&gt;3. Always update your CSV file because it is updated every now and then on the website so keep an eye on the website to get updates&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-3603117845972271491?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/3603117845972271491/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=3603117845972271491' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/3603117845972271491'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/3603117845972271491'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2008/02/ip2country-mapping.html' title='Ip2Country Mapping'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2885969180090658174.post-3600902484172568884</id><published>2007-12-19T14:54:00.000-08:00</published><updated>2008-12-10T22:22:08.059-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Apache SVN Windows'/><title type='text'>Subversion for Apache 2.2.x On Windows Platform</title><content type='html'>In this post i will talk about how to add Subversion modules on Apache 2.2.x, the problem that i faced while doing this configuration is that SVN executables exist for previous Apache versions only, so i thought about writing this post to give fast summarized steps to prepare SVN for this version of Apache&lt;br /&gt;&lt;br /&gt;Enough talking, time to start configuring our Apache, i will do that step by step&lt;br /&gt;&lt;br /&gt;1. Choose the latest version of &lt;a href="http://httpd.apache.org/download.cgi"&gt;Apache&lt;/a&gt; 2.2.x&lt;br /&gt;&lt;br /&gt;2. Choose the latest version of &lt;a href="http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=91"&gt;SVN&lt;/a&gt;(&lt;span style="font-style:italic;"&gt;on the time of writing this post, no SVN executable was there to be used with Apache 2.2.x&lt;/span&gt;)&lt;br /&gt;&lt;br /&gt;3. Install Apache (procedures aren't included in this post) then install SVN&lt;br /&gt;&lt;br /&gt;4. Create a repository for your SVN as in that example&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt; mkdir c:\svn&lt;br /&gt; svnadmin create c:\svn\repos&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;5. Configure Apache server configuration file, you can reach this file through that path&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt; Start/All Programs&lt;br /&gt;     /Apache HTTP Server 2.0.50&lt;br /&gt;     /Configure Apache Server&lt;br /&gt;     /Edit the Apache httpd.conf Configuration File&lt;br /&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;6. Look for the part of the file that is showing loaded and unloaded Apache modules, and make sure that these two modules are loaded&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt; LoadModule dav_module modules/mod_dav.so&lt;br /&gt; LoadModule dav_fs_module modules/mod_dav_fs.so&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;7. Download the binary built against Apache 2.2.x from this &lt;a href="http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=8100&amp;expandFolder=8100&amp;folderID=91"&gt;link&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;8. Extract the archive you downloaded to a folder and then replace files in your SVN directory folder with these extracted files&lt;br /&gt;&lt;br /&gt;9. Go to (SVN directory)/bin and take the two modules&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt; mod_dav_svn.so&lt;br /&gt; mod_authz_svn.so&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;found there and copy them to (Apache directory)/modules&lt;br /&gt;&lt;br /&gt;10. Open Apache configuration file again and add these two lines&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt; LoadModule dav_svn_module modules/mod_dav_svn.so&lt;br /&gt; LoadModule authz_svn_module   modules/mod_authz_svn.so&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;in modules part after the two lines that we added previously in step 6&lt;br /&gt;&lt;br /&gt;11. Add at the end of the configuration file these lines&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_yJMcWMF46ac/R2mvoUBZHZI/AAAAAAAAAAM/bUv9svwbvs8/s1600-h/Test.JPG"&gt;&lt;img style="cursor:pointer; cursor:hand;" src="http://2.bp.blogspot.com/_yJMcWMF46ac/R2mvoUBZHZI/AAAAAAAAAAM/bUv9svwbvs8/s320/Test.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5145837156351679890" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;where the path beside the location tag is the path that you will access the SVN through it and the path beside SVNPath is the path where you installed your repository&lt;br /&gt;&lt;br /&gt;These are the required steps needed to prepare your SVN with this version of Apache, i hope i was helpful in that article and up to the point&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;For more details on how to add authentication for SVN and other details follow that &lt;a href="http://www.subversionary.org/howto/setting-up-a-server-on-windows#comment-form"&gt;link&lt;/a&gt;, where you will find other steps related to SVN preparation on Apache Server but for old versions of Apache, skip first part as we already did it and read from the part called "Securing Your Server"&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2885969180090658174-3600902484172568884?l=bionuc-tech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bionuc-tech.blogspot.com/feeds/3600902484172568884/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2885969180090658174&amp;postID=3600902484172568884' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/3600902484172568884'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2885969180090658174/posts/default/3600902484172568884'/><link rel='alternate' type='text/html' href='http://bionuc-tech.blogspot.com/2007/12/subversion-for-apache-22x-on-windows.html' title='Subversion for Apache 2.2.x On Windows Platform'/><author><name>BioNuc</name><uri>http://www.blogger.com/profile/03111606825314898406</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_yJMcWMF46ac/R2mvoUBZHZI/AAAAAAAAAAM/bUv9svwbvs8/s72-c/Test.JPG' height='72' width='72'/><thr:total>0</thr:total></entry></feed>
