My brother asked me to reverse words in a sentence. He accused me of cheating by not writing an actual algorithm, but here is the solution I came up in a minute.
' '.join(s.split()[::-1])
harish-macbook:~ h_divakaran$ python Python 2.7.1 (r271:86832, Jun 16 2011, 16:59:05) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> s = "how are you" >>> ' '.join(s.split()[::-1]) 'you are how' >>>
class Node
{
public int data;
public Node next;
public Node()
{
data = 0;
next = null;
}
}
class Linkedlist
{
private Node head;
public LinkedList()
{
head = null;
}
public void Add(Node n)
{
n.next = head;
head = n;
}
public void PrintList()
{
Node temp;
temp = head;
while(temp != null)
{
Console.WriteLine("{0}",data);
temp = temp.next;
}
}
public void Reverse()
{
Node temp = null;
Node newhead = null;
while(head)
{
temp = head.next;
head.next = newhead;
newhead = head;
head = temp;
}
head = newhead;
}
}
C#
public static string Reverse(string s)
{
char [] sbArray = s.ToCharArray();
int len = s.Length;
int middle = len/2;
for (int i = 0; i < middle; i ++)
{
char ch = sbArray[i];
sbArray[i] = sbArray[(len - 1) - i];
sbArray[(len - 1) -i] = ch;
}
return new string(sbArray);
}
Still C#, but using string builder
public static string Reverse(string s)
{
StringBuilder sb = new StringBuilder();
for (int i = 0; i < s.Length ; i ++)
{
sb.Append(s[s.Length - 1 - i]);
}
return sb.ToString();
}
Python
def Reverse(s):
return s[::-1]
I have been using Git a lot lately across different machines. Everytime I branch I create a tracking branch. Here is the command I use.
git branch —track version20 origin/version20
This mean local version20 will track remote version20
Very interesting rules from GoDaddy founder.
http://blogs.wsj.com/wealth/2011/06/24/a-new-billionaires-10-rules-for-success/
My favorite rule in this is number 5.
5. Be quick to decide.
“Remember what General George S. Patton said: ‘A good plan violently executed today is far and away better than a perfect plan tomorrow.’ ”
I did this a lot, searching for perfect plan, now I have come to realize executing an imperfect plan is much better than searching for the perfect plan and having no product in the end.
Here is the bigger version of the rules from Bob Parsons’ website
My facebook app peoplegraph is now in the app store.
Peoplegraph Q&A from app store.
Q. What is Peoplegraph ?
A. Peoplegraph is a Facebook app for iPad.
Q. What is the difference between other Facebook apps and Peoplegraph ?
A. Most Facebook apps for iPad are a skin over touch.facebook.com. Peoplegraph has own renderings and is a native app. There is option in Peoplegraph to access touch.facebook.com if you prefer that.
Q. Is Peoplegraph secure ?
A. Yes, all the data transfer happens between Facebook and iPad, Peoplegraph doesn’t store data or send data to any website other than Facebook.com. Peoplegraph does cache images in your iPad to improve user experience.
I published my Facebook app to app store, I am waiting for Apple to approve the app. The version I submitted is the first version of the app, I am working on adding more features. I expect to be able to release a new version of the software every month for the foreseeable future. In case you have questions about the app send me a message through Facebook. My Facebook page [click here]. Here is my linkedin page [click here].
Update:
App is now in the app store.
This is a technical blog, but still I have to acknowledge the leadership President Obama showed. Job well done Sir.

Every week WordPress releases an update, it is pretty simple to update the installation if you have the installation directory accessible through ftp. I don’t want to enable ftp on my server. Instead I converted the blog to an SVN checkout. Instructions available at http://codex.wordpress.org/Installing/Updating_WordPress_with_Subversion
Amazon posted a lengthy blog about aws outage. This blog is hosted using US East region EC2 servers. I didn’t notice the outage. Maybe too small a player to be affected. http://aws.amazon.com/message/65648/
Recent Comments
- Abhilash Divakaran on Reverse words in sentence
- JK on Facebook: creating test accounts
- Harish Divakaran on WordPress and EC2 so far
- Zach Weg on WordPress and EC2 so far
