Author: Sudarshan Murthy
NODE* c=first;while(c?strcmp(c->val,s):0)c=c->next;return c;
1. What does this C fragment do?
2. Ignoring the lengths of variable names and type names, can this segment be any shorter? How, or, why not?
3. As shown, the fragment has a variable declaration, a loop with one statement in its body, and a return statement outside the loop. Is it possible to rewrite the segment to contain just a loop? It is OK if the variable declaration and the return statement are made part of the loop, but the loop body should be empty. It is also OK if the code gets slightly (but not significantly) longer. If it can be done, how? If it cannot be done, why not?
My take in another week or so. I rate these questions Easy.
Monday, September 26, 2011
Friday, September 16, 2011
Bring Tellico to this decade
Author: Sudarshan Murthy
I recently learned about Tellico, an application to catalog pretty much any collection. It includes templates to record details of books, audios, videos, stamps, coins, and other common kinds of collections and it can connect to many popular data sources such as Amazon, IMDB, and PubMed. Tellico is released under GPL.
To me, the best part of Tellico is its committed author, Robby Stephenson: He has actively maintained Tellico since its inception in 2002. And, he even lists alternatives to Tellico right on the Tellico page. Kudos Robby.
I can't comment on Tellico's usability (because I haven't used it enough), but judging by the screenshots, I see it can be quite useful in managing household collections. For example, my wife should be able to use Tellico instead of the MS Excel workbook she currently uses to catalog and track our household items. (Before you ask, my designated role at home is to move items around such that the catalog becomes unreliable.)
But, Tellico's age shows, and here is how.
I recently learned about Tellico, an application to catalog pretty much any collection. It includes templates to record details of books, audios, videos, stamps, coins, and other common kinds of collections and it can connect to many popular data sources such as Amazon, IMDB, and PubMed. Tellico is released under GPL.
To me, the best part of Tellico is its committed author, Robby Stephenson: He has actively maintained Tellico since its inception in 2002. And, he even lists alternatives to Tellico right on the Tellico page. Kudos Robby.
I can't comment on Tellico's usability (because I haven't used it enough), but judging by the screenshots, I see it can be quite useful in managing household collections. For example, my wife should be able to use Tellico instead of the MS Excel workbook she currently uses to catalog and track our household items. (Before you ask, my designated role at home is to move items around such that the catalog becomes unreliable.)
But, Tellico's age shows, and here is how.
Thursday, September 15, 2011
Should the query influence clustering of search results?
Author: Sudarshan Murthy
I notice some interesting differences between Google's search results for the queries else institute and the else institute: The results for else institute (try it) are clustered nicely under the link to the institute's home page. In contrast, the results for the else institute (try it) are not clustered and it contains fewer links. Snapshots of the query results are shown at the end of this post.
Wednesday, September 14, 2011
Useful ideas, unhealthy habits, and undue credits
Author: Sudarshan Murthy (first posted at http://bit.ly/rkrcn2 on August 19, 2011)
Slashdot recently had an interesting discussion about a 13-year old employing a naturally-occurring Fibonacci pattern to improve yield from solar panels (by ~20%) compared to the yield from the traditional linear arrangement of panels.
Reading the articles linked from that discussion, the kid's experimental arrangement appears to be biased in favor of the Fibonacci pattern. For example, some shadows are apparent on the linear arrangement. Also, his panels are placed much higher than the linearly-arranged panels.
I have observed similar biases in works by other kids and it worries me a bit: The budding scientists and engineers may be doing useful and novel things (more on novelty in a bit), but they don't seem to be learning about making objective measurements, a key requirement of any science.
About novelty: What the kid has done, by his own admission, is to arrange the solar panels the way leaves on an Oak tree are arranged, and he apparently has a provisional patent on this design. This begs the questions: Is mimicking a naturally-occurring pattern patentable? Are we now awarding undeserved patents to kids as an incentive to do more?
Of course, anyone who has read scientific literature knows that biases abound in the scientific work of "adults". And, let us not even get started on the kinds of silly things that are granted patents.
Now, isn't there any way we can emancipate and empower kids so they can do better than grown ups?
Slashdot recently had an interesting discussion about a 13-year old employing a naturally-occurring Fibonacci pattern to improve yield from solar panels (by ~20%) compared to the yield from the traditional linear arrangement of panels.
Reading the articles linked from that discussion, the kid's experimental arrangement appears to be biased in favor of the Fibonacci pattern. For example, some shadows are apparent on the linear arrangement. Also, his panels are placed much higher than the linearly-arranged panels.
I have observed similar biases in works by other kids and it worries me a bit: The budding scientists and engineers may be doing useful and novel things (more on novelty in a bit), but they don't seem to be learning about making objective measurements, a key requirement of any science.
About novelty: What the kid has done, by his own admission, is to arrange the solar panels the way leaves on an Oak tree are arranged, and he apparently has a provisional patent on this design. This begs the questions: Is mimicking a naturally-occurring pattern patentable? Are we now awarding undeserved patents to kids as an incentive to do more?
Of course, anyone who has read scientific literature knows that biases abound in the scientific work of "adults". And, let us not even get started on the kinds of silly things that are granted patents.
Now, isn't there any way we can emancipate and empower kids so they can do better than grown ups?
What motivates a Google+ user to become and remain active?
Author: Sudarshan Murthy (first posted at http://bit.ly/plzjrR on July 19, 2011)
For no apparent reason, I wondered if Google+ users who have created circles but have not set a profile picture have also created posts.
So, I conducted a straw test: I picked some users in my circles, then randomly picked users in their circles, and so on: some users with pics; some without. After following about 100 users who have created circles but have not set profile pictures, I found one user with posts. (That user had exactly one post, ironically, wondering if it is worth using Google+.)
(I also noticed users with circles and profile pics but are yet to post anything. However, there were far fewer users of that kind.)
Of course, no particular conclusion can be drawn from the straw test, but it makes me curious to know:
So, I conducted a straw test: I picked some users in my circles, then randomly picked users in their circles, and so on: some users with pics; some without. After following about 100 users who have created circles but have not set profile pictures, I found one user with posts. (That user had exactly one post, ironically, wondering if it is worth using Google+.)
(I also noticed users with circles and profile pics but are yet to post anything. However, there were far fewer users of that kind.)
Of course, no particular conclusion can be drawn from the straw test, but it makes me curious to know: