<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"><channel><title>/var/log/mind - Latest Comments</title><link xmlns="http://www.w3.org/2005/Atom" rel="http://api.friendfeed.com/2008/03#sup" href="http://disqus.com/sup/all.sup#forumcomments-754da7dc" type="application/json"/><link>http://var-log-mind.disqus.com/</link><description>Dhananjay Nene’s free (as in free speech) opinions on all things related to Software Engineering</description><language>en</language><lastBuildDate>Thu, 26 Feb 2009 09:16:44 -0000</lastBuildDate><item><title>Re: 2009 is not a prime number. A python program to compute factors.</title><link>http://blog.dhananjaynene.com/2009/01/2009-is-not-a-prime-number-a-python-program-to-compute-factors/#comment-6654691</link><description>I hope you people realize how inefficient the code you've written is... After you've divided out all the 2's from the number, you still try to find out if it is divisible by 4,6,8,10,12... If nothing else, you should only do trial division by odd numbers. Or even better, if you can afford the memory cost, generate first a list of all prime numbers below sqrt(n), and then do trial division by those only...</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jaime</dc:creator><pubDate>Thu, 26 Feb 2009 09:16:44 -0000</pubDate></item><item><title>Re: Java : the perpetually undead language</title><link>http://blog.dhananjaynene.com/2008/12/java-the-perpetually-undead-language/#comment-4930463</link><description>Boss!! and Bossess!!!! Please use perl for everything. Perl is ultimate for any purpose. Python is slow (even with psycho, pypy) and Java is over verbose. (But Java is faster)&lt;br&gt;&lt;br&gt;Check modperl before u make a comment about enterprise software. Most companies I am dealing with use modperl for enterprise applications. Perl is unbeatable. &lt;br&gt;&lt;br&gt;Also, WxPerl takes off recently. Till recently, I was waiting for a Tk plugin in browsers to embed graphic applications in a server page for perl (just like swing application put in JSP using plugin). But, DOJO, AJAX stumped me and made me feel -----&amp;gt; "No need of Java any more for anything"&lt;br&gt;&lt;br&gt;and finally::::::::::::"There is nothing that you can't do in Perl" ----&amp;gt; "I can challenge any one in the world for a better program in perl"&lt;br&gt;&lt;br&gt;Love,&lt;br&gt;Ignaci</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Ignaci</dc:creator><pubDate>Tue, 06 Jan 2009 03:02:54 -0000</pubDate></item><item><title>Re: 2009 is not a prime number. A python program to compute factors.</title><link>http://blog.dhananjaynene.com/2009/01/2009-is-not-a-prime-number-a-python-program-to-compute-factors/#comment-4884107</link><description>Yes, and I needed to know.  What is the smallest prime factor?&lt;br&gt;I guessed around:  7&lt;br&gt;&lt;br&gt;(Also, your "copy to clipboard" links don't work for me).</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">deeptext</dc:creator><pubDate>Sun, 04 Jan 2009 18:08:19 -0000</pubDate></item><item><title>Re: 2009 is not a prime number. A python program to compute factors.</title><link>http://blog.dhananjaynene.com/2009/01/2009-is-not-a-prime-number-a-python-program-to-compute-factors/#comment-4856588</link><description>There are supposed to be tab indentations.  Not sure how to keep the tabs in a post</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Gerry B</dc:creator><pubDate>Fri, 02 Jan 2009 19:45:00 -0000</pubDate></item><item><title>Re: 2009 is not a prime number. A python program to compute factors.</title><link>http://blog.dhananjaynene.com/2009/01/2009-is-not-a-prime-number-a-python-program-to-compute-factors/#comment-4856575</link><description>I just wrote this code (works in python 3.0 with the special "//" for division of integers).  This code is much faster and will find your prime factors.  I take advantage of the fact that 30=2*3*5, so any primes above 30 must be 1,7,11,13,17,23,or 29 modulo 30, otherwise the number would be divisible by 2,3 or 5.  Here is the function:&lt;br&gt;&lt;br&gt;def pfast(x):&lt;br&gt;	remder = x&lt;br&gt;	outcat="1"&lt;br&gt;	while 1:&lt;br&gt;		if remder%2==0:&lt;br&gt;			outcat=outcat+"*2"&lt;br&gt;			remder=remder//2&lt;br&gt;		else:&lt;br&gt;			break&lt;br&gt;	while 1:&lt;br&gt;		if remder%3==0:&lt;br&gt;			outcat=outcat+"*3"&lt;br&gt;			remder=remder//3&lt;br&gt;		else:&lt;br&gt;			break&lt;br&gt;	while 1:&lt;br&gt;		if remder%5==0:&lt;br&gt;			outcat=outcat+"*5"&lt;br&gt;			remder=remder//5&lt;br&gt;		else:&lt;br&gt;			break&lt;br&gt;	while 1:&lt;br&gt;		if remder%7==0:&lt;br&gt;			outcat=outcat+"*7"&lt;br&gt;			remder=remder//7&lt;br&gt;		else:&lt;br&gt;			break&lt;br&gt;	while 1:&lt;br&gt;		if remder%11==0:&lt;br&gt;			outcat=outcat+"*11"&lt;br&gt;			remder=remder//11&lt;br&gt;		else:&lt;br&gt;			break&lt;br&gt;	while 1:&lt;br&gt;		if remder%13==0:&lt;br&gt;			outcat=outcat+"*13"&lt;br&gt;			remder=remder//13&lt;br&gt;		else:&lt;br&gt;			break&lt;br&gt;	while 1:&lt;br&gt;		if remder%17==0:&lt;br&gt;			outcat=outcat+"*17"&lt;br&gt;			remder=remder//17&lt;br&gt;		else:&lt;br&gt;			break&lt;br&gt;	while 1:&lt;br&gt;		if remder%19==0:&lt;br&gt;			outcat=outcat+"*19"&lt;br&gt;			remder=remder//19&lt;br&gt;		else:&lt;br&gt;			break&lt;br&gt;	while 1:&lt;br&gt;		if remder%23==0:&lt;br&gt;			outcat=outcat+"*23"&lt;br&gt;			remder=remder//23&lt;br&gt;		else:&lt;br&gt;			break&lt;br&gt;	while 1:&lt;br&gt;		if remder%29==0:&lt;br&gt;			outcat=outcat+"*29"&lt;br&gt;			remder=remder//29&lt;br&gt;		else:&lt;br&gt;			break&lt;br&gt;	c=0&lt;br&gt;	while 1:&lt;br&gt;		top = remder**0.5+1&lt;br&gt;		c=c+30&lt;br&gt;		if c&amp;gt;top:&lt;br&gt;			return outcat+"*"+str(remder)&lt;br&gt;		while 1:&lt;br&gt;			if remder%(c+1)==0:&lt;br&gt;				outcat=outcat+"*"+str(c+1)&lt;br&gt;				remder=remder//(c+1)&lt;br&gt;			else:&lt;br&gt;				break&lt;br&gt;		while 1:&lt;br&gt;			if remder%(c+7)==0:&lt;br&gt;				outcat=outcat+"*"+str(c+7)&lt;br&gt;				remder=remder//(c+7)&lt;br&gt;			else:&lt;br&gt;				break&lt;br&gt;		while 1:&lt;br&gt;			if remder%(c+11)==0:&lt;br&gt;				outcat=outcat+"*"+str(c+11)&lt;br&gt;				remder=remder//(c+11)&lt;br&gt;			else:&lt;br&gt;				break&lt;br&gt;		while 1:&lt;br&gt;			if remder%(c+13)==0:&lt;br&gt;				outcat=outcat+"*"+str(c+13)&lt;br&gt;				remder=remder//(c+13)&lt;br&gt;			else:&lt;br&gt;				break&lt;br&gt;		while 1:&lt;br&gt;			if remder%(c+17)==0:&lt;br&gt;				outcat=outcat+"*"+str(c+17)&lt;br&gt;				remder=remder//(c+17)&lt;br&gt;			else:&lt;br&gt;				break&lt;br&gt;		while 1:&lt;br&gt;			if remder%(c+23)==0:&lt;br&gt;				outcat=outcat+"*"+str(c+23)&lt;br&gt;				remder=remder//(c+23)&lt;br&gt;			else:&lt;br&gt;				break&lt;br&gt;		while 1:&lt;br&gt;			if remder%(c+29)==0:&lt;br&gt;				outcat=outcat+"*"+str(c+29)&lt;br&gt;				remder=remder//(c+29)&lt;br&gt;			else:&lt;br&gt;				break</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Gerry B</dc:creator><pubDate>Fri, 02 Jan 2009 19:42:37 -0000</pubDate></item><item><title>Re: 2009 is not a prime number. A python program to compute factors.</title><link>http://blog.dhananjaynene.com/2009/01/2009-is-not-a-prime-number-a-python-program-to-compute-factors/#comment-4856552</link><description>Blame it on google .. it got me the other link first :) and of course the fact that I wanted to get it done quickly. :)</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">dnene</dc:creator><pubDate>Fri, 02 Jan 2009 19:40:21 -0000</pubDate></item><item><title>Re: 2009 is not a prime number. A python program to compute factors.</title><link>http://blog.dhananjaynene.com/2009/01/2009-is-not-a-prime-number-a-python-program-to-compute-factors/#comment-4856443</link><description>You didn't see my prime factorization code, then? &lt;a href="http://wj32.wordpress.com/2007/12/08/prime-factorization-sieve-of-eratosthenes/" rel="nofollow"&gt;http://wj32.wordpress.com/2007/12/08/prime-fact...&lt;/a&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">wj32</dc:creator><pubDate>Fri, 02 Jan 2009 19:28:39 -0000</pubDate></item><item><title>Re: 2009 is not a prime number. A python program to compute factors.</title><link>http://blog.dhananjaynene.com/2009/01/2009-is-not-a-prime-number-a-python-program-to-compute-factors/#comment-4856290</link><description>[i for i in factor(int(sys.argv[index]))]&lt;br&gt;should be just list([factor(int(sys.argv[index])))</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">audax</dc:creator><pubDate>Fri, 02 Jan 2009 19:10:36 -0000</pubDate></item><item><title>Re: 2009 is not a prime number. A python program to compute factors.</title><link>http://blog.dhananjaynene.com/2009/01/2009-is-not-a-prime-number-a-python-program-to-compute-factors/#comment-4856214</link><description>sorry I just realized I am using Python 3.0, which changed the rule for division compared to old Python.  Now, to get what you did, the division sign is // and not simply /</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Gerry B</dc:creator><pubDate>Fri, 02 Jan 2009 19:02:48 -0000</pubDate></item><item><title>Re: 2009 is not a prime number. A python program to compute factors.</title><link>http://blog.dhananjaynene.com/2009/01/2009-is-not-a-prime-number-a-python-program-to-compute-factors/#comment-4855886</link><description>How do you get Python to do more than 18 decimal places of accuracy in a division?  When I try your algo I get the following factors:&lt;br&gt;&lt;br&gt;[1037468051.0, 863693, 7, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 29]</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Gerry B</dc:creator><pubDate>Fri, 02 Jan 2009 18:30:31 -0000</pubDate></item><item><title>Re: 2009 is not a prime number. A python program to compute factors.</title><link>http://blog.dhananjaynene.com/2009/01/2009-is-not-a-prime-number-a-python-program-to-compute-factors/#comment-4854908</link><description>I could've .. just chose n**0.5 instead of sqrt(n). Thats already in the code.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">dnene</dc:creator><pubDate>Fri, 02 Jan 2009 17:07:43 -0000</pubDate></item><item><title>Re: 2009 is not a prime number. A python program to compute factors.</title><link>http://blog.dhananjaynene.com/2009/01/2009-is-not-a-prime-number-a-python-program-to-compute-factors/#comment-4854470</link><description>why dont you keep the limit variable to like sqrt(n).That can be the highest factor other than itelsf&lt;br&gt;&lt;br&gt;regards,&lt;br&gt;Varun</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">varun thacker</dc:creator><pubDate>Fri, 02 Jan 2009 16:32:49 -0000</pubDate></item><item><title>Re: Will Rails go the Struts 1 way ?</title><link>http://blog.dhananjaynene.com/2008/12/will-rails-go-the-struts-1-way/#comment-4730994</link><description>I would think that rails would dominate in the merging ... though there are some positives to be taken from the merb codebase ....</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">dipankarsarkar</dc:creator><pubDate>Mon, 29 Dec 2008 15:54:10 -0000</pubDate></item><item><title>Re: Will Rails go the Struts 1 way ?</title><link>http://blog.dhananjaynene.com/2008/12/will-rails-go-the-struts-1-way/#comment-4632426</link><description>"I really cannot imagine easily merging two frameworks and have the best of both of them be reflected in the result "&lt;br&gt;&lt;br&gt;Merb, to put it as simply as possible, is a pluggable, unopinionated, not-as-mature, but definitely usable version of Rails.&lt;br&gt;&lt;br&gt;It isn't a merger of equals, Merb is being consolidated into Rails 3. I'm expecting Rails to support ORMs other than AR out of the box and to also support templating languages other than ERb out of the box (hopefully adding Haml). They're going to add a consistent API plugins and crap don't outdated with every point release.&lt;br&gt;&lt;br&gt;Basically, it's going to have Rails try to cater to everything, which goes against the DHH's original vision. It's annoying, but there's no way I'm going to stop coding in Ruby - I've gotten too used to it. Besides, the move was to unify the existing Ruby community and to not confuse newcomers.&lt;br&gt;&lt;br&gt;So, um. Yeah. What I was going to say before I got sidetracked is that no, merging them is not going to be as difficult as you might think as the two have much in common as it is (workflow-wise, not code-wise).</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">lowell</dc:creator><pubDate>Fri, 26 Dec 2008 02:05:20 -0000</pubDate></item><item><title>Re: Will Rails go the Struts 1 way ?</title><link>http://blog.dhananjaynene.com/2008/12/will-rails-go-the-struts-1-way/#comment-4616589</link><description>There are more similarities between Rails/Merb than S1 and WW/S2.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Caligula</dc:creator><pubDate>Wed, 24 Dec 2008 19:17:48 -0000</pubDate></item><item><title>Re: Java : the perpetually undead language</title><link>http://blog.dhananjaynene.com/2008/12/java-the-perpetually-undead-language/#comment-4370327</link><description>I agree with you totally. There are people, companies and corporate who's survive because of Java. I admit, I've been lured by python, scala, groovy and all other languages which offer you syntactic nirvana, but none of them address issues that are so important to me and my customer who's day to day business depends on software. Imagine in case of some ( god forbid  ) medical emergency you wanted money from ATM and you couldn't get it because some program written in fancy language crashed. I rather have an unproductive, ugly language on whom people can trust their money and lives with.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">ranjan</dc:creator><pubDate>Fri, 12 Dec 2008 13:44:23 -0000</pubDate></item><item><title>Re: A twitter feed in gmail : Write a google gadget</title><link>http://blog.dhananjaynene.com/2008/12/a-twitter-feed-in-gmail-write-a-google-gadget/#comment-4366966</link><description>awesome!!!</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">David Weller</dc:creator><pubDate>Fri, 12 Dec 2008 10:33:37 -0000</pubDate></item><item><title>Re: A twitter feed in gmail : Write a google gadget</title><link>http://blog.dhananjaynene.com/2008/12/a-twitter-feed-in-gmail-write-a-google-gadget/#comment-4357817</link><description>Not sure why its happening, but its happening for me as well. Shall need to&lt;br&gt;investigate.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">dnene</dc:creator><pubDate>Thu, 11 Dec 2008 23:52:22 -0000</pubDate></item><item><title>Re: Java : the perpetually undead language</title><link>http://blog.dhananjaynene.com/2008/12/java-the-perpetually-undead-language/#comment-4347778</link><description>My examples were all cross platform, but I agree that there may be reasons (a big one for me being the pain of deploying cross-platform binaries vs. jars or html/js).</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Tom</dc:creator><pubDate>Thu, 11 Dec 2008 22:15:07 -0000</pubDate></item><item><title>Re: Java : the perpetually undead language</title><link>http://blog.dhananjaynene.com/2008/12/java-the-perpetually-undead-language/#comment-4347464</link><description>Java in on track to becoming COBOL, and nobody wants to be a COBOL programmer, do they?  Like C++ before it, Java will wane and plateau and eventually be relegated to legacy usage.  Ruby seems likely to take over, but it, too, will go away for the next thing.  But, it's not like it's going to happen tomorrow.  I just think that Java Developers need to accept that Java will go away and something else will be where Java is now, and they ought to get on the stick to learn it.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Dave</dc:creator><pubDate>Thu, 11 Dec 2008 21:51:42 -0000</pubDate></item><item><title>Re: A twitter feed in gmail : Write a google gadget</title><link>http://blog.dhananjaynene.com/2008/12/a-twitter-feed-in-gmail-write-a-google-gadget/#comment-4339625</link><description>Great post here, I am learning to decipher basic code, but the fact that you link to yours is just great.  I installed, but it did not ask me for user name and password, so it's blank.  Any ideas?</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Chef Tony</dc:creator><pubDate>Thu, 11 Dec 2008 21:16:06 -0000</pubDate></item><item><title>Re: Java : the perpetually undead language</title><link>http://blog.dhananjaynene.com/2008/12/java-the-perpetually-undead-language/#comment-4335981</link><description>Your description of the cake is extremely well done. You've managed to comment on the underlying issues as well in a concise and effective fashion. Nicely put.&lt;br&gt;&lt;br&gt;On a separate note, Python is an upstart that is older than Java.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">dnene</dc:creator><pubDate>Thu, 11 Dec 2008 17:51:15 -0000</pubDate></item><item><title>Re: Java : the perpetually undead language</title><link>http://blog.dhananjaynene.com/2008/12/java-the-perpetually-undead-language/#comment-4335643</link><description>To be direct, it's hard and partially impossible to compare those two languages because they're on different markets.&lt;br&gt;&lt;br&gt;Nevertheless, Java has lost the bleeding edge: it has a stable market share on enterprise software but otherwise it's just catching up with the more advanced languages these days for the sake of the illusion that "Java evolves too. Really!".&lt;br&gt;&lt;br&gt;It doesn't and it doesn't need to evolve; IMHO Java 1.4 delivered pretty much what you ever wanted from Java. The enterprise guys can get their comfy security without awkward adaptations of generics, closures and rest of the stuff that is copied from elsewhere. But you don't seem to get the interesting jobs with Java skills anymore and it's not the number one language if you want to learn new stuff. That's bad because if you're not riding on the wave that drives the new stuff you're being obsoleted. First slowly, then at once.&lt;br&gt;&lt;br&gt;What Java has to do to survive is not technical. Technically, Java is good enough (or, not bad enough). But as it's the market leader on enterprise software it must reinvent itself on that very same market before some of the new languages come and eat the cake that currently belongs to Java. It could take five years, even less if Java doesn't fight back. On the other hand, if Java has already reinvented a new cake at that time, it's going to continue to lead the market to a new direction in the future.&lt;br&gt;&lt;br&gt;And the name of the cake seems to be "secure, reliable, and not too smart enterprise solutions". By "not too smart" I mean something that can be practically averaged over dozens of developers. Python is smart because one whizbang Python hacker can rewrite and obsolete much of the Java stuff in one corporation, but they couldn't easily find a replacement for him when things turn boring. "Not smart" means low contribution rates per developer but lots of interchangable developers. The Java way. But with a new toolbox.&lt;br&gt;&lt;br&gt;By the way, Python isn't an upstart: it's older than Java.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">yason</dc:creator><pubDate>Thu, 11 Dec 2008 17:33:06 -0000</pubDate></item><item><title>Re: Java : the perpetually undead language</title><link>http://blog.dhananjaynene.com/2008/12/java-the-perpetually-undead-language/#comment-4334245</link><description>I appreciate your approach to this ongoing subject.  While the sport in me enjoys language feature vs. language feature debates, the pragmatic professional understands that comfort pays the bills.  Customers want to be comfortable with their decisions.  Well written.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jamie McIlroy</dc:creator><pubDate>Thu, 11 Dec 2008 16:18:38 -0000</pubDate></item><item><title>Re: Java : the perpetually undead language</title><link>http://blog.dhananjaynene.com/2008/12/java-the-perpetually-undead-language/#comment-4333651</link><description>If we have access to such a rich english language why do we then end up confusing the middle aged and the dead ? This entire argument of then valuing only the youth which generally is the most vibrant and exciting stage substantially underemphasises the contributions that we make to society when in our middle ages.&lt;br&gt;&lt;br&gt;I understand that some liberty can indeed by taken with the language and would assume that "dead" could cover cases where severe reduction in capabilities and importance into a vegetative state is near imminent. But java is not dead by that standards. I just think it is middle aged and has a long life ahead of it though all the excitement seems to be getting distributed amongst the newer kids on the block (often quite rightly so).</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">dnene</dc:creator><pubDate>Thu, 11 Dec 2008 15:46:57 -0000</pubDate></item></channel></rss>