Skip to main content

Posts

Nearest Neighbor Search Using KdTree

//Input should be in input.txt file //10(2.1,4.3)(3.3,1.5)(4.7,11.1)(4.9,1.6)(5.0,12.3)(5.1,1.2)(6.7,3.3)(19.2,5.4)(20.5,7.9)(100.3,52) //The first number is the number of points, n, and following it are the coordinates of the n points in ascending order of the x-coordinate. import java.util.*; import java.lang.*; import java.io.*; import java.util.StringTokenizer; class KDNode {     int axis;     double[] x;     int id;     boolean checked;     boolean orientation;     KDNode Parent;     KDNode Left;     KDNode Right;     public KDNode(double[] x0, int axis0) {         x = new double[2];         axis = axis0;         for (int k = 0; k < 2; k++)             x[k] = x0[k];         Left = Right = Parent = null;         checked = false; ...

Facebook User Authentication: Get access to user data

This is the extension of my previous article on facebook share. But, no need of prior knowledge. Proceed from here. After registering a developer account @ https://developers.facebook.com/ , create an app. Note the App-Id and don't forget to add the redirect url under the app settings section. Also add all the access permissions you would like to get from the user under Auth Dalog section. All these permissions are to be used later to retrieve corresponding data. URL pattern to implement the authentication is as follows: http://m.facebook.com/dialog/oauth?client_id=<APP-ID> &redirect_uri=<PATH- TO-TARGETTED-LOCATION> &scope=<ALL-THE-PERMISSIONS-LIKE-email,offline_access> &response_type=token Just modify the CAPITAL lettered data, and for the redirect-url no need of using quotation marks ("")

Twitter Custom Share

We can add the tweet button directly from the twitter website. But if you want a image of you wish, then it's easy to get it. <a href="http://m.twitter.com/home?status=WHATEVER-YOU-WOULD-LIKE"> <img src="SOME IMAGE, BUT KEEP IT RELEVANT" /></a> And if you are developing any application and want to implement authentication, use OAuth provided in twitter API: https://dev.twitter.com/docs/auth/oauth Note: You have to register a developer account and create a app there. For authentication use the access token generated on the app settings page.

Facebook Share (URL based)

This is the most simplest way to add a facebook share button. Use the following code as the reference(href) attribute of your anchor tag(<a>) "http://www.facebook.com/sharer.php?u=<text or url to post on wall>" You can use any image to show the share button, but be precise in selecting it, as the user should get on it easily. Consider the following sample code: <a href="http://www.facebook.com/sharer.php?u=https://thechaithanya.wordpress.com"><img src="http://www.acrnet.org/uploadedImages/Get_Involved/facebook-logo.png" alt="share on facebook"></a> If you are developing any applicetion or website and want the post to be displayed as it was posted from your app, like " via theChaithanya ", use the following code:          "http://m.facebook.com/dialog/feed?app_id=YOUR-APP-ID&link=LINK-TO-BE-POSTED&redirect_uri=PATH-TO-LOCATION-AFTER-SHARE" On successful sharing it w...

Something went wrong! How do I reset Unity or Compiz?

You can easily reset Unity or Compizusing the following commands (be careful when using these commands and only use them if you really have to!): - to reset the Unity launcher icons: unity --reset-icons - to reset Unity: unity --reset - to reset Compiz: gconftool-2 --recursive-unset /apps/compiz-1 unity --reset

Ubuntu : Disable the user switcher indicator

The user switcher indicator (or Me-User-Indicator or whatever is called) can be useful if multiple users log in on your computer but if it's just one user, you can get more space by disabling it. Presuming you've already installed the "dconf-tools" package: press ALT + F2 or open a terminal and enter: dconf-editor Then navigate to  apps > indicator-session  and uncheck the box next to "user-show-menu", then restat Unity (ALT + F2 and enter "unity --replace") or log out and log back in.

Ubuntu : Re-enable the systray (notification area)

You no longer need to whitelist Qt applications but you may still need the systray for other applications such as Shutter, Jupiter, etc. You can whitelist the systray using the following command: gsettings set com.canonical.Unity.Panel systray-whitelist "['all']" Then log out and log back in.