Skip to main content

Posts

Showing posts from June, 2012

Calculate effective size of the window(excluding taskbar) in Java

Yesterday, I was working with generating a graph using jfreechart library. The requirement was to show a window with graph on full screen. When i used the following code it didn't give me the desired results. Taskbar was overlapping bottom part of the screen. this.setPreferredSize(new Dimension(Toolkit.getDefaultToolkit().getScreenSize().width, Toolkit.getDefaultToolkit().getScreenSize().height)); After searching over internet i found the solution and following code snippet worked properly as per my requirements. //Calculate height of the task bar Insets scnMax = Toolkit.getDefaultToolkit().getScreenInsets(getGraphicsConfiguration()); int taskBarSize = scnMax.bottom; this.setPreferredSize(new Dimension(Toolkit.getDefaultToolkit().getScreenSize().width, Toolkit.getDefaultToolkit().getScreenSize().height-taskBarSize)); Thanks!!!!!!!!!!!! Enjoy Programming :) 

Use bit.ly API in PHP : Part2

Before going forward I assume that you had already gone through first part of the post  " Usebit.ly to create shorten urls in PHP : Part1 ". So now you have the parameters named  with username and api key .  In this part we would discuss over using bitly Applications with API.  "If you are looking to work with multiple end-users, or to pull any information on a user  level for your own account (including link history, bundle history, and/or analytics), you  will need to register an application with us to authenticate with our API." - bitly website.  So if you wanna fetch information of multiple users you have to create an application.    Follow following steps : 1) Go to bitly developer section http://dev.bitly.com/ 2) Click on "Manage My Apps" button or link. 3) Click on Advanced tab. Go to Registered OAuth applications section and click on "Register OAuth Application" link. Following screen would ...

Use bit.ly to create shorten urls in PHP : Part1

Bit.ly is the most popular service to create shorten urls. In 2010, they had announced  Version 3 of the bit.ly API. They had come with some new features like click counts,  getting bundle information, query bitly information etc... All V3 methods support identical  JSON and XML response formats. JSONP is likewise universally supported, and many  methods support an additional plain text response format. I have divided the bitly session into two parts. 1) Use bit.ly to create shorten urls in PHP : Part1 2) Use bit.ly API in PHP : Part2 Let’s start with first part. Please follow these steps: a)  Register yourself with https://bitly.com/   b)  Go to developers section : http://dev.bitly.com/   c)  On top navigation bar click on My Apps link. d)  Go to Manage My Apps->Advanced Tab  e)  Note down your  API Key (Click on Show legacy API   ...