Where is this guy looking illusion
Guess Tamil Poet Names
Guess these 15 tamil poet names from whatsapp empticons
[Read more…]
Picture Puzzle – can you read it
Magento Plugin for Twitter Card
What is Twitter Card?
I recently came to know about twitter cards from my brother, As such twitter allows only 140 characters to tweet, but to compete with Facebook they have launched a feature called twitter cards. Basically after adding the specific twitter meta tags to your page, twitter will give an option to expand the post, after expanding the post, user will see photo, title, description with link to your site, for example visit this funnychutkule’s twitter page. This is a great feature from twitter to promote your website and in my point of view it is a must.
To know more about types of twitter cards please visits official twitter page
I have written a small Twitter card plugin to add the twitter meta tags to your website’s product page, Click here to visit official magento connect page of this twitter card plugin.
How to install Twitter card Magento plugin from puzzlersworld?
- Login to your magento admin panel.
- Go to System->Magento Connect->Magento Connect Manage.
- You need to login again with the same credentials as in first step.
- Paste this extension key http://connect20.magentocommerce.com/community/Pw_Twittercard under Install New Extensions section and click on install.
- Confirm the installation once again, after installation you have to set your twitter username.
Reverse a link list without using another
How to reverse a link list without using another link list?
Note: Linked list is singly linked list (there is only next pointer no previous pointer).
See Solution: Reverse a link list without using another linked list
Node* reverse(Node* node) { if(node == null) return null; Node * prev = node; Node* curr = node->next; while(curr != null){ Node* tmp = curr->next; curr->next = prev; prev = curr; curr = temp; } return prev; }
Detect if there is a cycle in a linked list
How can you find if a given linked list has a cycle in it?
Note: Linked list is singly linked list (there is only next pointer no previous pointer).
See Solution: Detect if there is a cycle in the linked list
Code in C
bool isCyclePresent(Node* node){ Node* pointer1 = node; Node* pointer2 = node; while(pointer2 != null && pointer2->next!=null){ pointer1 = pointer1->next; pointer2 = pointer2->next->next; if(pointer1 == pointer2) return true; } return false; }
Find nth element from end of linked list
How to find nth element from the end of the linked list?
Or in other words Given an integer ānā, return a pointer to the n-th node from the end of the list.
Note: Linked list is singly linked list (there is only next pointer no previous pointer).
See Solution: find nth element from end of linked list
Code in C/C++
Node * getNthNodeFromLast(Node * node, int n){ Node* pointer1 = node; Node* pointer2 = node; while(pointer1 != null && n > 0){ pointer1 = pointer1->next; n--; } //List does not have n nodes, so return null if(n > 0) return null; //traverse till pointer1 becomes null while(pointer1 != null){ pointer1 = pointer1->next; pointer2 = pointer2->next; } return pointer2; }
Find middle element of linked list
How to Find the middle element of a linked list without traversing twice ?
Linked list is singly linked list(there is only next pointer no previous pointer).
See Solution: Find middle element of a linked list
Code in C/C++
Node* getMiddleElement(Node * node){ Node* pointer1 = node; Node* pointer2 = node; //traverse till pointer2 reaches end of the list or becomes null while(pointer2 != null && pointer2->next != null){ pointer1 = pointer1->next; pointer2 = pointer2->next->next; } return pointer1; }
Divide a triangle into n triangles
How to divide a triangle into n equal area triangles ?
See Solution: Divide a triangle into n triangles
Explanations :
For example to divide the triangle in the image below into 4 equal triangles, we can simply divide its base of 8cms to 4 equal parts of 2cms each and form the 4 triangles of equal area.
Swap two integer variables
How to swap two integer variables without using the third variable ?
See Solution: Swap two integer variables
Solution 1:
x = x+y; y = x-y; x = x-y;
Solution 2:
y = 2*((x+y)/2) ā (x =y);
Solution 3:
x = x^y; y = x^y; x = x^y;
Note: However solution 1 & 2 has problem of overflow doing addition of two integers might overflow. But solution 3 will not have any such problem