Monday, April 30, 2018

Facebook Sign-in using Clojure

In order to provide Facebook sign-in functionality you need to create a new Facebook App from this url: https://developers.facebook.com/docs/facebook-login. Provide the redirection URI that you’ll use for the App. After setting up the app you’ll get an App ID and App Secret key.



We’ll use “clj-oauth2.client” to redirect a user to the authentication page, “clj-http.client” for HTTP requests, “cheshire.core” to parse Json string in order to get keywords, “noir.respose” to provide re-directions and “compojure.core” for routing.
We’ll begin with defining a new namespace:
1
2
3
4
5
6
(ns exampleapp.routes.facebook
 (:use compojure.core)
 (:require [clj-oauth2.client :as oauth2]
           [noir.response :as resp]
           [clj-http.client :as client]
           [cheshire.core :as parse]))

In facebook namespace define an atom, facebook-user, to store Facebook user details:
1
2
(def facebook-user
  (atom {:facebook-id "" :facebook-name "" :facebook-email ""}))

Now include the App ID and App Secret key you just got after creating a new Facebook app along with the redirection URI, in the code below:
1
2
3
(def APP_ID "your app id")
(def APP_SECRET "your app secret key")
(def REDIRECT_URI "http://localhost:3000/auth_facebook")

and define an oauth2 map containing all the details required for Facebook log in:
1
2
3
4
5
6
7
8
9
(def facebook-oauth2
 {:authorization-uri "https://graph.facebook.com/oauth/authorize"
  :access-token-uri "https://graph.facebook.com/oauth/access_token"
  :redirect-uri REDIRECT_URI
  :client-id APP_ID
  :client-secret APP_SECRET
  :access-query-param :access_token
  :scope ["email"]
  :grant-type "authorization_code"})

We can use “make-auth-request” function defined in “clj-oauth2.client” library to get the redirect URI on which the user should be redirected. The user can now give access to the app we created in first step.

1
2
(resp/redirect
  (:uri (oauth2/make-auth-request facebook-oauth2)))

Note that we used noir.response/redirect function to provide the redirection.
After a Facebook user grant access to the app, we’ll get a response containing access token on the redirection URI we provided while setting up our Facebook app. We’ll use “compojure.core’s” GET to get the response:

1
2
(defroutes facebook-routes
 (GET "/auth_facebook" {params :query-params} (facebook params)))

and pass it to a function in order to get the access token and user details.
We’ll use the code below for getting access token and user details:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
(defn facebook [params]
 (let [access-token-response (:body (client/get (str "https://graph.facebook.com/oauth/access_token?"
                                                     "client_id=" APP_ID
                                                     "&redirect_uri=" REDIRECT_URI
                                                     "&client_secret=" APP_SECRET
                                                     "&code=" (get params "code"))))
       access-token (get (re-find #"access_token=(.*?)&expires=" access-token-response) 1)
       user-details (-> (client/get (str "https://graph.facebook.com/me?access_token=" access-token))
                        :body
                        (parse/parse-string))]
  (swap! facebook-user
   #(assoc % :facebook-id %2 :facebook-name %3 :facebook-email %4)
     (get user-details "id")
     (get user-details "first_name")
     (get user-details "email"))))

This article was first published on the Knoldus blog.

Wednesday, October 25, 2017

How to search or reverse search images using Google on iPhone and Android



Google has become a universal searching tool and most of us are now accustomed to terms like "let's google it" instead of "let's search it on the web". Almost everyone is aware of what Google is, there would be a very few who don't know what Google is, I mean very few! Absolutely no one! And most of us also know how to use Google to search an interesting image from Mac or Windows. But wait, is it really easy to search or reverse search an image from mobile devices? I guess it is. But not everyone is aware of how it is done. So this post is all about getting to know ways of searching or reverse searching images on Google via mobile devices.

It does not matter if you're an iOS or Android user. You might be using browsers like Chrome on your iPhone, iPad or Android devices; or maybe Safari on your Apple devices; or maybe some other browsers like Firefox, Opera, UC Browser if you're really into those kind of details. Each of these browsers consists of an option to switch to a Desktop site, let's look at some examples on Google Chrome and Safari browser.

On Safari 

  1. Visit Google and then long press on the Refresh button on the top right corner, this should open a small menu with an option to "Request Desktop Site".

  2. Select "Request Desktop Site" and Bam! You're on the desktop version of Google.

  3. Now select "Images" from the top right corner on Google web page and it will take you to the Google Image search page.

  4. Now click on the small Camera icon in the Google search box from Step 3 and you'll get an option to upload an image from your device or paste the image URL. Select "Upload an Image" option and a small menu will open giving you options to select an image from your picture gallery or the take a picture right away using your camera. Tada! Your Google image search is completed.

On Chrome
From Google Chrome mobile browser you can follow a similar kind of approach as done from Safari browser, but things get a tad easier on Google Chrome browser wherein the images can be directly searched from any webpage by just using an option from menu. But let's look into the first approach prior to moving onto the second one.

For the first approach, i.e by using Desktop site
  1. Visit Google on Chrome browser and click on the 3 dots icon on the top right corner from which you can see there's an option to "Request Desktop Site" again. Select this option.
  2. Now follow Step 2 through 4 from Safari browser tutorial as mentioned earlier. Voila! Google image search or reverse search again.
For the second approach, i.e by using Google Chrome feature
  1. Just in case you want to reverse search any image available on a webpage directly instead to first downloading and saving that image on your device and then searching or reverse searching it, long press on the image in question to get a menu like this one
  2. Select "Search Google for This image" option and you're good to go! Reverse image search on Google right from the menu option.
On Other Mobile Browsers
Similar kind of approach can be followed on any other browser if an option to request desktop site is available. Moreover, you can permanently request desktop sites by configuring it in your mobile browser settings if it is available which will save you the pain to manually requesting for a desktop site. 

Let us know if you found this tutorial helpful or if there are any other options available to reverse search an image on Google from a mobile device in the comment section below.

Saturday, March 9, 2013

How To Add A Slideshow From Picasa Web Albums To Blogger or Wordpress

Adding a Slideshow in your blog posts can always be a good option in order to present your content in a better way. Many sites offer services to make customized slideshows with a choice of "free" and "premium" services and the "free" option always have certain limitations. A better way to make a slideshow is to use Picasa Web Albums, with an added advantage of the 5GB storage provided by Google. You can also write your own slideshow code, but that would be a bit difficult.

Your slideshow will look something like this:

1. In order to make a slideshow from Google Picasa Web Album, goto the following link: https://picasaweb.google.com/home, log in to your Google account. If you don't have a Google+ profile then Picasa Web Album will open automatically but if you have a Google+ profile then you'll be redirected to your albums in your Google+ profile. In that case, a small message in a yellow box will popup at the top of the screen which will provide an option to go back to Picasa Web Album. After clicking on it, you'll be redirected to Picasa Web Album.

2. Now in order to create a slideshow, begin with uploading your photos from the upload option at the top bar.

3. After completing the upload process open the newly created album. Now on the right side bar you'll find an option of "Link to this Album." Clicking on it will display another option of "Embed Slideshow." Selecting Embed Slideshow

will popup a small window with some more options to customize your slideshow, like the one shown in the screenshot below:

4. Check the "HTML Links" option to get the HTML code of your slideshow. Copy and paste this code to the desired place. Quite Easy!

Friday, March 8, 2013

New Facebook News Feeds And How To Get It ASAP


On Thursday, Facebook unveiled its new News Feeds that offers a host of new options. The revamped version of the news feeds, inspired by mobile design of Facebook, will allow a user to adjust their feeds the way they want. It offers Multiple feeds in which a user can customize their feeds with options like friends, photos, music, following, games along with an option of a simple chronological news feed, most recent.

Although Facebook will automatically roll out this revamped version of news feed sooner or later, users can manually join the waiting list by clicking on the "Join Waiting List" button located at the bottom of this page https://www.facebook.com/about/newsfeed.

The newer version of news feeds will take away all the clutter and bring all the goodness of what is offered in Facebook mobile - bigger pictures covering 50% of the news feeds, iconized side bar, better cover design etc.

Tuesday, March 5, 2013

[New App] Opera Browser With New Webkit Rendering Engine And New Design

Get ready for the fastest browsing experience - for now the new Opera Browser has finally gone live in Google Play Store. The new Opera Browser is completely redesigned and now provides a better alternative for your default internet browser - with functions like Off-Road Mode, new Private Tab/Incognito mode, switching to desktop version of the websites, options to open new tab in background/foreground etc. The best feature that will gain users attention is the bandwidth-saving Off-Road Mode, which is designed to access websites faster in case of slow internet connection.

Unlike the previous build of Opera Browser that used Presto rendering engine this new release of Opera Browser uses a new Webkit rendering engine, the same used in Google Chrome and AOSP browser(used in custom ROMs), is touted to be the fastest rendering engine so far. This redesigned and reprogrammed version on the new Opera Browser looks elegant and goes well with the holo UI used in the newer versions of Android devices(4.1+).


Along with some common features carried by most of the other Android browsers, the new Opera Browser is definitely going to stand out when it comes to the new Off-Road Mode for slow internet connections.

Tuesday, February 26, 2013

How To Use Tor On Android

A Tor network protects you against a common form of internet surveillance known as Traffic Analysis. While browsing or using any public network you should be aware of the fact that most of the websites can access your information including, but not limited to: your current physical location, your search requests, your interests etc. So, you can use Tor Network in order to stay anonymous and prevent Traffic Analysis protocol from accessing your information. Tor for Android can also be used to access the hidden part of the internet most commonly known as Dark Net or Deep Web.

UPDATED on 12th May 2018.

Learn more about Dark Net or Deep Web:
Beginners Guide to Deep Web or Dark Net.

Accessing internet through smartphones is a very common practice nowadays, and all those who prefer flexibility use Android smartphones. In order to use Tor on your Android device, you need to download Tor for Android from Google Play Store. Although Tor for Android does not require root permission, it can provide some extra features if you have got a rooted device, Transparent Proxying being one of them.

Download Tor for Android

In order to use Tor to browse through the internet on your Android device you can either download Orweb Browser provided by "The Guardian Project" or simply use a Proxy Mobile add-on for Firefox(for Android)


Tor for Android has tons of customization in its Settings menu, which also included Tor Tethering to enable Tor Transparent Proxying for WIFI and USB Tethered Android Devices if you are planning to use your Android internet connection on other devices. Others include Node configuration, bridges, relays, reachable addresses, hidden service hosting etc.

Monday, February 25, 2013

How To Remove Time Stamp From Blogger


Removing Time Stamp from posts can be of some advantage to bloggers. There are few posts in your blog that can be included in the category of  evergreen posts - those that will never lose their worth with time. Bloggers don't want a Time Stamp(indicating when the article was posted), that appears in SERP(search engine result page), to repel any user from visiting their page. So removing the time stamp from Blogger posts can be a good move to optimize your blog for search results.

To get more tips on blog optimization, please read:

Time Stamp can be easily removed by these two methods:

Method 1
1. Open the Layout settings of your Blogger page.
2. Click on the Edit option and uncheck the Time Stamp option from "Post Page Options".


Method 2
Sometimes the default method(1) to remove Time Stamp from Blogger Posts will not work if you are using a custom template, in that case you can use this method.
1. Open Template Settings of your Blogger Page.
2. Click on Edit HTML and  then click on Expand Widget Template.
3. Now search for this code in your template and remove it.
<b:if cond='data:top.showTimestamp'>
<b:if cond='data:post.url'>
<data:post.timestamp/>
</b:if>
</b:if>
4. Now you'd want to remove the respective CSS code of Time Stamp, so search for this code in your template:
.post-timestamp

and remove the entire code that follows it within its Parentheses. The code would look something like this:
.post-timestamp { background: url("#") no-repeat scroll 0 5px transparent; float: left; padding: 2px 0px 0 30px; }

Saturday, February 23, 2013

How To Make Your Website Popular




Although the word "popular" may loom large at first, but a certain amount of knowledge will enlighten you with the fact that making a popular website is not entirely impossible and almost everyone has to start from scratch. Creating an impressive line of followers will most likely take a certain amount of hard work and dedication, but almost every internet user is impressionable, to a certain extent, when it comes to quality work and useful information.

This tutorial will guide you through the basic concepts to give you a kick start. If you wish to learn more about any of the contents in this tutorial I'd suggest you do more research of your own(on wikipedia), but this will be enough to get you off your feet and start getting somewhere.


  • SEO
  • Social Media
  • Promotions


SEO(Search Engine Optimization)


SEO consists of everything your website contains, (Domain name, Page titles, META tags, text, images, loading time and the type of content your website displays). With the popularity of search engines today, if you don't implement SEO into your website then you are instantly sticking a limit on the reach of your website. Millions of people search on Google every day for products or services they desire, advertising is becoming less and less effective as people don't just look at an advert and instantly get the desire to buy. People know what they want and when they want it, they will find it themselves, meaning that if you're not displayed on Google when they search, then they're going straight to your competition.

The niche of your website is everything. There are thousands of competing websites on the internet. If you're going to make a website, you need to make sure that you're in a position to beat your competitor. Search keywords that relate to your website/website-idea and check what results you get, who would you be competing with? Now put your search terms in quotations (i.e. "cheap laptops") and look how many search results there are. This will tell you how many websites you're competing with for that specific keyword. The aim is to find a keyword that has a little competition as possible.

To get an analysis of the competition and the searches per month of certain keywords, go to the Google Keyword Tool and type in a few keywords to check. Make sure you change the options to set your location to wherever you're from (United States, United Kingdom, China, India etc) and make sure only the "Exact Term" box is ticked on the left of the page instead of the "Broad" box to get the true results.

Now that you know what keywords are best to base your website around, it's time to start implementing those keywords into your content. The places you need to consider are:
  • The Domain - Although this doesn't have a major effect with search engines, it still has some; meaning that it could help you rank higher, faster.
  • Page Titles - Think about the content that will be on each page and what the best keywords are for that content. The title is the most effective placement for keywords.
  • META Keywords - These are becoming less and less effective in search engines, but they are still quite powerful at allowing Google to determine the identity of a website. This means that Google can easily see which keywords you want the website to be listed under and will improve your chances of listing higher. Make sure you use a selection of keywords that relate to the name of the website and the keywords that you chose using the Keyword Tool.
  • META Description - This is what search engines use to describe your listing on search results. This is also a very powerful factor in SEO, as it is has a big impact on what keywords you're listed under. This is also the first thing that people will see on your website, before they even click the link meaning that it needs to look appealing. Make sure your description is short, readable and contains your main keyword(s)
  • Headers - The use of headers in your content is vital, it's like titling your work in school. It allows search engines to identify the important content on your website. These headers are used with HTML tags. Having content headers that include the websites keyword lets search engines know that this keyword is important, again giving you a better chance of listing higher. 
  • Page Content - In order for your website to rank high, the content on the website needs to comply with a number of factors. It needs to be unique. Stealing content will dramatically lower your rankings. It needs to be updated. Having a website that doesn't change at all will let search engines know that it is in fact dead. It needs to be relevant. Make sure that you use the keywords in your content and that it's actually readable by humans.

Social Media


Again with SEO, the popularity of social mediums like Twitter, Facebook, and most importantly Google+ and YouTube is necessary.

Twitter and Facebook are probably the least effective, however they can have a massive impact on the popularity of your website if done correctly. Make sure that your pages are not only recognizable for your brand, but also contain the keywords you have researched within their content. Once you've done this you can start off by inviting your friends. The most important thing to consider when using social media is that people do not buy through Facebook. It's simply a place to raise awareness of things, so make sure that people can easily get involved with your posts and that your posts are relevant, interesting and regularly updated.

Google+ is a new social medium that Google is taking way too seriously. It's now one of the most effective social mediums in terms of SEO, it's important that you make a Google+ page that is linked to your website by using the Google+ publisher tags on your website. Again make sure that your Google+ page is SEO'd and it is regularly updated with new, relevant content.

YouTube is possibly the most beneficial form of social media in terms of driving traffic to your website. This is because you are able to directly talk to your audience and show them what you have to offer. However, YouTube videos require a bit of work to make sure they get popular.

Promotions


People love getting a bargain or better yet, free stuff. To help get your website off the ground I suggest you make a competition or a free giveaway to new registrants. Something that will get the word out about your website.
The best things to do are things like:
  • Referral competitions (Most referrals wins a prize)
  • Random giveaway to 3 lucky members on the website
  • GPT (Get paid to) i.e. Like my Facebook, Twitter and Google+ page and win a prize


Friday, February 22, 2013

[App]Top 8 Sites To Send Free SMS In India


Although sending SMS can now be considered as an old school thing in the new world of apps such as Whatsapp, Facebook Messenger, Kik Messenger etc, most of us have to use it at times no matter how much we try to avoid it, keeping in mind the deliver of that SMS will cost you an extra buck besides paying for your internet plan.



Though most of us are aware of some services that allow us to send Free SMS, but searching for the right one can be a cumbersome job. So here's a list of few of the best Free SMS services out there along with an Android Application that combines all these into a single app for your convenience.

Android App for Free SMS:
Free SMS India also allows you to schedule your SMS
Download from Google Play Store

Way2sms:
http://www.way2sms.com
160by2:
http://www.160by2.com
Site2sms:
http://www.site2sms.com
Ultoo:
http://www.ultoo.com
IndyaRocks:
http://www.indyarocks.com
FullOnSMS:
http://www.fullonsms.com
YouMint:
http://www.youmint.com
FreeSMS8:
http://www.freesms8.com

Thursday, February 21, 2013

Access Favorite Contacts With ContactsNotification


Every Android user likes to add few important contacts to their favorite list for quick access. There are a myriad of apps and widgets available in Google Play Store for this purpose, but Contacts Notification is probably the most elegant app available that can add these contacts shortcuts to the notification drawer.

Adding contacts to notification drawer has both pros and cons. As the notification drawer can be accessed from almost every app, you don't have to minimize any app for making calls to these contacts. The only disadvantage of using Contacts Notification is the space it uses in the notification drawer, which then is almost negligible so you don't have to worry about it.

Contacts Notification allows user to set up at most 6 contacts at a time. Tapping on the contact in notification drawer brings up the default contact panel from which you can make selections like call, messaging, email etc. Contacts Notification is only compatible with Android 4.0+ (i.e Ice Cream Sandwich and Jelly bean) and does not require root permission.
Download Contacts Notification from XDA