Saturday, 26 April 2014

Help visitors who arrive at your blog via a link to a deleted post

If you sometimes delete posts from your blog, then it's a good idea to provide some help to people who who arrive at your blog via links to those posts.

(Even if you don't have any links to those posts, it's likely that a search-engine somewhere will have some - and other people may have bookmarked or shared them, too.)

There are two options for doing this:



Post-specific redirects

Use these if you want to re-direct visitors who come to a particular previous post:

Go into Settings > Search Preferences, click Edit beside Custom Redirects.


Click New Redirect, to create instructions for what to do if a visitor tries to navigate to a specific post.

Put the address of the post that you want to make a re-direct for into the From field.

Put the address of the post that you want to visitors to be taken to into the To field.
For both addresses, the part you need to enter is the URL of the post from the first backslash on.  
Do not put in your blog-address
Do include the date-part of the URL and the backslash.
eg
for    http://blogger-hints-and-tips.blogspot.com/2013/01/changing-a-label-value-for-all-posts.html
use   /2013/01/changing-a-label-value-for-all-posts.html

Tick the Permanent check-box.

Click Save.

Click Save Changes.   (Yes, you need to do both Saves)


A generic page-not-found message

Use this if you do not want to set up post-specific re-directs, or if you cannot remember the URL of your deleted posts.

Go into Settings > Search Preferences, and edit the Custom Page Not Found option.

Put in some text welcoming the visitor, explaining that the page they were looking for is no longer available, and suggesting other places that they could try.

 This text can include links to other posts, so long as you hand-code them. (You might like to get code for this using the post editor).

Adding an RSS feed icon to your blog, using Feedburner

Feedburner's chicklets are used to add the standard "orange radar" button to your blog.  This lets readers to subscribe the RSS feed of your choice.   The information is targeted to Blogger users, but most of it applies to anyone who uses Feedburner.


What is a Chicklet, and why you need one:

Previously I've explained how to remove the (ugly and confusing) "Subscribe to Posts (atom)" link from your blog, and why RSS / Subscribe to Posts is important to your blog and how to create a Feedburner feed for it.

But an RSS feed is useless unless people subscribe to it.  So as well as making the feed, you also need to put something in your blog that lets your readers sign up for it.

A standard option for this is the orange square with "radar" markings on it, which many people call a "chicklet" (since it lets your viewer - the chicken? - have access to the feed you are providing).

Feedburner also has options for:
  • Using a custom icon from popular web aggregators
    I'm not sure that this is a great idea, because you don't know what feed-reader software your readers actually use, and the whole point of a feed is that you don't dictate how people see your blog.
  • Using an icon that promotes Feedburner.  This cute, but I've never seen anyone use it.

How to add a chicklet to your blog:


Log in to Feedburner, using the Google account that owns the feed.

Click on the name of the feed you want to provide a subscription tool for.

Choose the Publicize tab.

Choose the Chicklet Chooser option, from the left navigation bar.

Choose one of the options shown:  the default one is the standard-size RSS-radar-button.

Scroll to the bottom of the screen and either
  • Copy the HTML that is shown, and add it to your blog in the same way that you would add any other 3rd party HTML,

    OR  (note:  there have been some reports that the option below doesn't work any longer, as Blogger has changed but tools like Feedburner have not help up)
  • Choose Blogger from the drop down list beside "use as a widget in", and click Go

    This takes you to a Blogger screen where you can choose which blog you want to add the gadget to (if your current login has more than one), and what title to use for it. 

    When this is done, click Add Widget

    This takes you to the Design > Layout tab, where you can drag-and-drop the widget to wherever you want it.  
    (When I tried it just now, instead of the layout screen I got a "bad request" message.  However pressing Save and then View Blog brought up the blog with the gadget showing, and I was able to go back and edit the layout later on).


What your readers see:

Your readers will see an item, wherever you put it, that looks like this:

or something similar, depending on what option you chose from the Chicklet Chooser screen.

When someone clicks on one of these items, they are taken to either a screen where they choose which feed-reader software to add your site to (if you've used the first option), or to the specific feed-reader software.


Customising the widget code:

If you use the generic RSS button, then you may want to customise the widget code slightly:  It looks ugly not to have a space between the picture and the word "Subscribe" - and it's good to have the phrase "RSS" on the screen because that'ss what RSS-savvy people search for when they're looking at a website and want to find the subscribe option.  I also prefer if the subscribe action opens in a new tab/window, rather than taking the reader away from my blog.

This is quite easy to do, if you put a few line breaks in so you can see that
  • the code is actually two separate link statements
  • the first one has an image (the orange "radar bars" that it takes from Feedburner)
  • the second is a text link
  • both of them link to the RSS feed address

So it's quite easy to add a couple of extra spaces (shown as   ), change the text as I've done below, and add   target="_blank"   to both of the links
<a href="http://feeds.feedburner.com/Blogger-hints-and-tips" rel="alternate" type="application/rss+xml" target="_blank">
<img src="http://www.feedburner.com/fb/images/pub/feed-icon32x32.png" alt="" style="vertical-align:middle;border:0"/>
</a>

&nbsp; &nbsp; &nbsp;

<a href="http://feeds.feedburner.com/Blogger-hints-and-tips" rel="alternate" type="application/rss+xml" target="_blank">

Subscribe via RSS

</a>

I generally also put the option to subscribe to my blog by email and the Feedburner FeedCount item (which shows the number of subscribers) in the same area, to give people options, and to encourage them to subscribe.



Related Articles:

Using Feedburner to give your blog a Subscribe by Email option

Adding 3rd party HTML to your blog

Why RSS / Subscribe to Posts is important to your blog

How to create a Feedburner feed for your blog

Friday, 25 April 2014

Display Google Map using API V2 in android

Displaying Google Map in android using the API version 1 is deprecated now. Google introduce a lot of changes in displaying Google Map using API version 2. In this post i demonstrate how to display the Google Map using API Version 2.
Ads By Google



Step 1:
Install the Google Play Service SDK 
For displaying Map using API V2, you need the Google Play Services. So first step is to open your Android SDK manager and install the Google Play Services.

Step 2:
Add the Google Play Service as a library project into your android work-space. 
After the successful installation of Google Play Service SDK, you can find out the Google play service library project on the following location in your android SDK folder. 
                                           sdk-->Extras-->Google
Import the Google Play Services as a library project into the work-space. Don't forget to choose the options for copy the project into workspace. 
Step 3:
Add the Google play library project into your android project. 
Now you can add google play service-libraries into your project. Right click your project and choose its properties and choose the android option and click add button at the bottom of  the window. 
Step 4:
Generate the SHA-1 fingerprint Using the Java keytool. 
You need to generate the SHA-1 fingerprint using java keytool for obtaining the Map API key. Open your command prompt and type the following command. 
 keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android  
After type the above command you got the certificates figerprints. Copy the SHA-1 fingerprints.

Step 5:
Obtain the Google Map API Key using the SHA-1 Fingerprint and your application package name from the Google console. 
Login into Google console  and at the left corner of the page choose the API's under API's & auth option. Now search for Google Maps Android API V2 and change its status from off to on
Now click Credentials at the left side of the page and click the CREATE NEW KEY button. Choose Android Key option from the dialog window. Now insert your SHA-1 fingerprint and your application package name into the text area of the newly generated dialog window and click create. Now you can see the newly created API KEY for android at the top of the web page. Copy that key. 

Step 6:
Specify the Google Play Service versions in the Manifest file.
Open your android Manifest file and add new Xml tag called meta-data between the Application tag. Specify your API Key as the value for the meta-data. 
 <meta-data  
android:name="com.google.android.maps.v2.API_KEY"
android:value="Enter your API Key Here">
</meta-data>

Step 7:
Add the required permissions in manifest file
We need to specify some permissions in manifest file  for displaying the Google Map. Following are the permissions and its usage. 

android.permission.INTERNET = "used to connect to the Google Map Servers for downloading the map tiles "
android.permission.ACCESS_NETWORK_STATE= "used by the API to check the status of the connection for downloading the data"
com.google.android.providers.gsf.permission.READ_GSERVICES = "Used by the API to access Google web based services".
android.permission.WRITE_EXTERNAL_STORAGE = "Used by the API to save the Map tile data into the external storage".
android.permission.ACCESS_COARSE_LOCATION = "Used by the API to access the WiFi or mobile data to find out the device current location".
android.permission.ACCESS_FINE_LOCATION = "Used by the API to access GPS for finding the current location ".
 <uses-permission android:name="android.permission.INTERNET"/>  
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

Step 8:
Specify the OpenGL ES version in manifest. 
The google Map API V2 uses the OpenGL ES version 2 for rendering the Map on devices. 
  <uses-feature  
android:glEsVersion="0x00020000"
android:required="true"
/>

Step 9:
Add a fragment to the activity-main.xml file for display Map
 <?xml version="1.0" encoding="utf-8"?>  
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.MapFragment"/>

Since Google Map uses the Google play services, it is not possible to test the Google map app in an android virtual device. For testing this app you need to install the .apk file in a real device.

2 things i hate on Facebook Ad Manager and Power Editor

HATE! HATE!! HATE!!!
facebook ad manager
  1. You can't, under no circumstances, change the ad target url! You create an ad with website conversions objective. You create a bunch of them, the whole ad set with many different targeting options. Then you want just copy this ad set and point it to another target url. And you can't! You must click on EACH ad, then create a similar ad - only so you will be able to change ad target url.
  2. If you want hide your affiliate urls, this works ONLY if you create your ads each one new from scratch! If you create an ad with shorten url as target, then create similar ad and input as target url your next shorten url - you mean it would work? NO, damn! Facebook is smart enough to show in the ad body the original url. And it is funny enough to show the SHORTEN url, if you run with the mouse over the opriginal url. Is it not stupid?

Monday, 21 April 2014

Keep a backup copy of complicated gadget settings

This article explains why it's a good idea to keep a backup copy of settings for your gadget, in particular for HTML/Javascript gadgets that have complicated, hard-to-regenerate, code.



Blogger's backup tools let you take copies of:
  • your post-contents and (separately) 
  • your template. 

Some 3rd party backup tools (eg HTTRack) let you make backup copies of how your blog looks - including the consequences of displaying your gadgets.

But as far as i know, there is no way that you can back up the settings (ie parameters or configuration) that are stored inside the widgets on your blog.

This can be a problem if you accidentally remove a gadget, or if you have an HTML gadget and get the code wrong in it: Blogger is quite unforgiving sometimes, and the HTML/Javascript gadget editor simply removes any code that it doesn't understand.

In some cases, this isn't not a big problem  eg if you show a picture as a gadget, then it's generally easy enough to work out characteristics that you would need to enter to re-create the gadget.

But if you lose a complex gadget (eg your own customised set of subscription buttons), then re-creating it could be difficult and time-consuming.

So - for HTML/Javascript gadgets which have code which you think is complex, I recommend keeping a backup copy of the gadget code somewhere.

Personally I usually put it in a post in a private blog where I draft posts and keep the documentation for each blog - but you could use a range of other places, eg a text file on your computer or on Google Drive, or even any email message to yourself.


How to back up code from HTML/Javascript gadgets in a private blog post

Every time you edit a gadget that you want to keep a backup for, then just before you click Save:
  • Press Ctrl/a to select all the text in the gadget window.
  • Press ctrl/C to copy it
  • Switch to use Blogger in a different window
  • Open up the documentation blog, and navigate to the post where you keep the code for that gadget
  • Edit that post - or make a new one if you don't have one already.
  • Make sure that you're in Compose view, and the Options > Compose Mode setting is on "show HTML literally" (ie not on "interpret HTML")
  • Paste the gadget code into the post, and publish it.

Although this sounds tedious, it's really very quick to do. And losing complicated gadget code, even once, is a good incentive to remember to back it up every time.

Hint: Put a comment to remind yourself where to back this gadget at the top and/or bottom of the gadget code. This reduces the chance that you will forget. A comment is done in HTML like this:
<!-- DON'T FORGET TO BACK UP THIS GADGET CODE  -->


How to back up complicated non-code gadgets

If your gadget has complicated settings which aren't code, one option is to take a screen-shot and save it to your photo collection, or even just a text-file or documentation-blog post where you keep notes about what the settings are.

You won't be able to automatically restore your gadget settings from this, but it should be a good reminder of what you need to do (provided you can find the picture when you need it).

Unfortunately there's no easy way to pack up linked-list or blogroll gadgets at the moment. However making a copy of your site using HTTracker will show you the list, and what the items link to.

Or you could build your linked list code manually (using the same trick that that I recommend for getting picture code) and put it into a HTML/Javascript gadget, which is based up as described above. The code for a handcrafted linked-list gadget looks like this:
<ul>
<li>PUT THE TEXT HERE FOR YOUR FIRST LINK TEXT.</li>
<li>PUT THE TEXT HERE FOR YOUR SECOND LINK TEXT.</li>
<li>PUT THE TEXT HERE FOR YOUR THIRD LINK TEXT.</li>
<li>etc</li>
</ul>



Related Articles:

How to add a picture as a gadget in Blogger

Using the post-editor to build HTML code for gadgets

Prepare your blog-posts in private, using a documentation blog