Skip to main content

Posts

Showing posts from March, 2012

Flickr and OAuth

What is Flickr? I think you landed on this page because you know what Flickr is, so let’s come to the point and discuss about the API. Why am explaining? Although each and everything, about API, is well documented on Flickr website here , I'm just trying to explain the whole process by dividing it into small parts. Old Authentication API The current Flickr authorization scheme is not the first one it used. In the early days of Flickr, users granted the power to an app to act on their behalf by giving  the apps their Flickr username and password. Doing so meant that in order to revoke  an app’s permission, users would have to change their Flickr password. Of course, doing that would also instantly revoke permissions of other third-­party apps with knowledge of the user’s password. The new authorization scheme is meant to correct obvious problems with the old scheme. Why should you as a user have to use your Flickr password for anything other than your dealings with Flickr?

Different File Transfer Protocols

TFTP : Trivial File Transfer Protocol (TFTP) is a simple protocol to transfer files. It has been implemented on top of the User Datagram Protocol (UDP) using port number 69. TFTP is designed to be small and easy to implement, therefore, lacks most of the features of a regular FTP. TFTP only reads and writes files (or mail) from/to a remote server. It cannot list directories, and currently has no provisions for user authentication. In TFTP the connection is opened and the file is sent in fixed length blocks of 512 bytes. Each data packet contains one block of data, and must be acknowledged by an acknowledgment packet before the next packet can be sent. A data packet of less than 512 bytes signals termination of a transfer. It is often used by servers to boot diskless workstations, X-terminals, and routers. Due to its simple design, TFTP could be implemented using a very small amount of memory. It is therefore useful for booting computers such as routers which may not hav

Java NetBeans : submit button not working when press Enter?

Today, I noticed that my form is not getting submitted while using keyboard Enter button to submit it. Then I searched over that and found different solutions and sharing them with you : 1) If your form is only having one button and that’s only submit button then use the      following line in your code: this.getRootPane().setDefaultButton(submitButton); I have used this line in constructor. It would work and your submit button will be automatically get focused. 2) If you have more than one button, as in my case there are three buttons, above solution will not work. Because, on any given Window a single button can be designated as the “Default Button”. The default button is noticeable by the darker border around the button. The default button can be activated by using the Enter key, even when it doesn’t have focus. When your focus is on another button and you press enter even then only submit button is working not the one you have pressed. So in this case

phpExcelReader uses and problems?

If you will search over internet about excel reader in PHP at the end you would be redirected to the following this link only. It’s well written code but there are also some problems in that. Some documentation is missing. In this post we are going to discuss how to use phpExcelReader and which type of problems you could face. Download :  1) You can download the original library from here . 2) Mine one(with bug fixes) is available here . Go there, Click on File menu then download it. How to use : 1)  In the package itself example2.php is a very good example of using excel reader. 2)  Beginners can have a look at following example <?php             ini_set("display_errors",1);             error_reporting(E_ALL ^ E_NOTICE);             require_once 'phpExcelReader/Excel/reader.php';                                     $data = new Spreadsheet_Excel_Reader();             $data->read("files/1331184203.xls")

isset() vs array_key_exists()

isset() :  Determine if a variable is set and is not NULL .  If a variable has been unset with unset() , it will no longer be set. isset() will return FALSE if testing a variable that has been set to NULL . Also note that a NULL byte ( "\0" ) is not equivalent to the PHP NULL constant. If multiple parameters are supplied then isset() will return TRUE only if all of the parameters are set. Evaluation goes from left to right and stops as soon as an unset variable is encountered.  array_key_exists() : Checks if the given key or index exists in the array. array_key_exists() returns TRUE if the given key is set in the array. key can be any value possible for an array index. Example: $a =array (‘language’ => ‘PHP’, ‘author’ => null); isset ( $a [ 'language' ]);                       // true array_key_exists ( 'language' , $a );   // true   isset ( $a [ 'author' ]);                         // false arr