Posts

Showing posts from September, 2011

Medical Alert

The Center for Disease Control has issued a medical alert about a highly contagious, potentially dangerous virus that is transmitted orally, by hand, and even electronically. This virus is called Weekly Overload Recreational Killer (WORK). If you receive WORK from your boss, any of your colleagues or anyone else via any means whatsoever - DO NOT TOUCH IT!!! This virus will wipe out your private life entirely. If you come in contact with this WORK, you should immediately take at least two of your friends to the nearest "Biological Anxiety Relief" (BAR) centre to take at least one of the following antidotes: "Work Isolating Neutralizer Extract" (WINE), "Radioactive UnWORK Medicine"(RUM), "Bothersome Employer Elimination Rebooter"(BEER), "Vaccino Offico Depression Killing Antigen"(VODKA) and continue its dosage till WORK is eliminated from your system completely. Please forward this message to all your friends and save their lives.

How to avoid POSTDATA resend warning

POSTDATA resend warning is a common problem when developing web applications. Before discussing about the solution, let's know what is the problem actually and when it arises. About the problem : We see this warning when we try to revisit a page that has accepted POSTDATA using browser's history mechanism. Usually we do it by browser's BACK button or refreshing a page. When a page in browser history requested with POST method, the browser thinks this POSTDATA is important to process this page. So, it asks the user if he wants to send the POSTDATA again or not. Different browsers show this warning differently. For example, the images below shows how Firefox and Internet Explorer show this warning. POSTDATA resend warning in Mozilla Firefox POSTDATA resend warning in Internet Explorer Now, If the user accepts the confirmation, the page is reloaded with previously sent data using POST method; otherwise some browsers don't take any action and some shows a "Webp

Some Birthday Wishes

Another Year  I am wishing you another year Of laughter, joy and fun, Surprises, love and happiness, And when your birthday's done, I hope you feel deep in your heart, As your birthdays come and go, How very much you mean to me, More than you can know.           -By Joanna Fuchs Perfect Birthday On your birthday I wish you much pleasure and joy; I hope all of your wishes come true. May each hour and minute be filled with delight, And your birthday be perfect for you!           -By Joanna Fuchs Birthday Appreciation Each year your birthday reminds me That I really want to say I am very glad I know you; I think of you each day. I hope you enjoy your birthday, All the pleasures it has in store, And because I appreciate you, I hope you have many more!           -By Joanna Fuchs Birthday Blessings Instead of counting candles, Or tallying the years, Contemplate your blessings, As your birthday nears. Consider special people Who love you, and who care, An

Multiple Worksheets, Borders, and Images

Few months back I was searching for the php code that creates excel file, which has got the content in multiple worksheet. I couldn't get any help from the net. Today just going through the PEAR Modules, I came across this script. This script generates excel file with multiple worksheets. <?php require_once 'Spreadsheet/Excel/Writer.php'; $workbook = new Spreadsheet_Excel_Writer(\"example4.xls\"); $worksheet =& $workbook->addWorksheet();\n $worksheet->writeNote(1, 0, \"Invoice For New Customer 1\"); $worksheet->setRow(0, 50); //$worksheet->insertBitmap(0, 0, \"logo.bmp\", 0, 0); $left =& $workbook->addFormat(array(\"Left\" => 2)); $right =& $workbook->addFormat(array(\"Right\" => 2)); $number =& $workbook->addFormat(array(\"NumFormat\" =>'$####.00')); $worksheet->write(1, 1, \"Client Name:Shakeel Shrestha\"); $worksheet->write(2,

Extracting Information Using XPath

PYou want to make sophisticated queries of your XML data without parsing the document node by node. Solution: Use XPath XPath is available in SimpleXML <?php $s=simple_load_file('address-book.xml'); $emails=$s->xpath('/address-book/person/email'); foreach($emails as $email){ //do something with $email } ?> And in DOM <?php $dom=new DOMDocument; $dom->load('address-book.xml'); $xpath=new DOMXPath($dom); $email=$xpath->query('/address-book/person/email'); foreach($emails as $email){ //do something with $email } ?> As your XML files become increasingly complex and your parsing desires grow, using XPath is easier than filtering the data inside a foreach. PHP has an XPath class that takes a DOM object as its constructor. You can then search the object and receive DOM nodes in reply. SimpleXML also supports XPath, and it's easier to use because it's integrated into the SimpleXML object. DOM supports XPath

CELEBRATING GOOD FRIDAY IN OFFICE :: THE MAGIC ABOUT MOMOMAGIC

Aja kaha jane ko khaja ko lagi? Rajeev said. Malai ta chowmein khana man lageko cha, I said. You mean you wanted to go to Dragon, he said. But is too congested he added. Lets go to MomoMagic, down to Harihar Bhawan. Since no one had ever been there before, we all agreed to go there. We reached MomoMagic in few minutes, no other customers were there. Menu was in the table under. But I saw the beverage menu first before the main menu. Royal Stag....I said looking at the menu. Then everybody got interested towards that menu. The talk started about the different drinks. Since I don't drink and don't know about it, I was quite. Loven....try garne ko, Rajeev said. Uttam was in delima. Garne bhaye gardem, Uttam added. We order our khaja, two buff chowmein, two momo and one chips chilli. Although we had ordered our khaja, everyone was quite interested to drink and the talk was started again. Tuborg kham na ta, Akash said. Khane?....khane bhane kham na ta. We ordered two Tuborg. Soon al

Currency Conversion With foxrate.org's XML-RPC API

Foxrate.org provides XML-RPC API to convert the currency from one to another. I needed it for a project to convert from Euro to Pound and vice-versa. I had once read about such a work in roshanbh.com.np so I finally thought to follow the same API. After searching for some days, I came up with some code but had some problem for which I couldn't get any help. At last our friend from college, Sanjeev, added last two lines of code to make it run. Thanks Sanjeev. <?php require_once('lib/xmlrpc.inc');//initialize client $xmlrpc_client=new xmlrpc_client('/rpc','www.foxrate.org',80); $xmlrpc_client->setDebug(3);//turn on debugging mode //construct the request (xml-rpc message) $xmlrpc_msg=new xmlrpcmsg('foxrate.currencyConvert', array(new xmlrpcval('USD','string'), new xmlrpcval('EUR','string'), new xmlrpcval(1,'double'))); //send the request $xmlrpc_resp=$xmlrpc_client->send($xmlrpc_msg); //working

Some Reality

Whenever you find the key to success, someone changes the lock. To Err is human, but to forgive is not a COMPANY policy. The road to success??.. Is always under construction. Alcohol doesn't solve any problems, but if you think again, neither does Milk. In order to get a Loan, you first need to prove that you have ability to repay back. All the desirable things in life are either illegal, expensive or fattening. Since Light travels faster than Sound, people appear brighter before you hear them speak. Everyone has a scheme of getting rich?.. Which never works. If at first you don't succeed?. Destroy all evidence that you ever tried. You can never determine which side of the bread to butter. If it falls down, it will always land on the buttered side. Anything dropped on the floor will roll over to the most inaccessible corner. 42.7% of all statistics is made on the spot. As soon as you mention something?? If it is good, it is taken?. If it is bad, it happens. He who

Some Information about database indexes

Guidelines to create indexes The characteristics of data and the usage of the data in the environment in which it is defined ascertains the columns to build the index. The usefulness of the index is directly related to the percentage of rows returned from a query. Low percentage or high selectivity are more efficient. Creating indexes on the frequently searched column is more useful and efficient. Indexes can be best created on the following columns. Primary Keys Foreign Keys or columns that are frequently used in joining tables. Columns that are searched for range of key values. Columns that are accessed in sorted order. An index is not needed for the following columns. A column that is infrequently referenced in a query. A column that contains lots of duplicate values. A column that contains bitmaps, text or images. Clustered Index  A clustered index is the one in which the order of the values in the index is the same as the order of the data stored in the table. The index is

Nepali Chunker

Image
Final Project Summary Gandaki College of Engineering And Sciences, Pokhara, Nepal Chunker is the system that finds the phrases present in the tagged sentence depending on some POS (Parts of Speech) rules. This is the part of the Natural Language Processing which is useful to find the syntactical structure of the sentence. This system was a part of Nepali Parser that was outsourced to Gandaki   College   of   Engineering   and   Sciences   by   Madan   Puraskar   Pustakalaya (www.madanpuraskar.org), a non profit organization working on Nepalinux (www.nepalinux.org) and other Nepali language related software. The Chunker in this context takes some tagged input sentence and then performs chunking or finding the relation between words or between phrases and represents them  in parenthesized notation.    The system operates on the basis of certain rules.  The input sentence should be given in Unicode value of the word following a slash and then the tag of the word in capital En