Tuesday, May 23, 2017

Chrome Settings Page Gets Material Make Over

Google has updated Chrome settings page with Material Design.

Navigational Menu
Google has added link to each of the section in the settings as menu under the hamburger icon.
Clicking the hamburger icon reveals this navigational menu items.

People Section
Under the people section, the user who currently signed in is shown with option to sign out. Also you can manage the other people or accounts.

Appearance Section
Appearance section focus on the appearance of the chrome browser. You can customize the theme, font etc.

You many wonder where the option to clear browser history/cache or cookies are hidden. These options are hidden under Advanced section.

View or Remove Cookies or selective cookies
You can view all the cookies created in your browser with the navigation from the 'Content Settings'.
Click the 'Content Settings' items. You can see various content settings options like Cookie, Location, Camera, Javascript, Flash etc.

Click the 'Cookies' item. You can see all the cookies created and option to view each cookie content and remove all or individually.

You can also search for cookies created by specific web site.

Clear Browsing Data
Click the Clear history, cookies, cached and more options. You will have option to select what content you want to clear.

Wednesday, April 12, 2017

Enable/Disable Google Chrome Update in Windows

If you are a administrator who would like to update windows policy to disable the automatic update of Google Chrome on windows or if you are a user who would like to enable the Google Chrome updates disabled by the administrator, follow the steps to enable/disable the Google Chrome updates
Step 01. Go to Windows Start Button on the left bottom and Click on Run.
Step 02. Type in regedit on the run.

Step 03. go to HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Update

Step 04. Double Click on the UpdateDefault
Step 05. Change the value to 0 or 1. [ 0 - Disable Update, 1- Enable Update]
Step 06. Restart your Chrome Browser and try to update again.

Tuesday, April 11, 2017

Adsense Ads Not Showing on Website or Blog

The First Consideration

When you come to the AdSense forum and simply state "my ads don't show, why is this?" ... nobody can answer you.  

Why?  Because nobody will know
  • if your account is approved at all
  • if it is approved in the first or second stage of the review process
  • if your code is entered properly
  • if your account is a host account or standard (full) account ("Host" accounts show as Host accounts in red in the upper part of the page)
  • if your account is a host account that was approved for blogger, for ad mob, for youtube, or for use on some other partner site
  • if your AdSense account is showing any messages or notices
  • if the site you put the ads on is the site you applied with
  • if the site you put the ads on is already disabled (this can happen if you purchased a new domain or bought a website from someone)

So if you would like help in answering the question of why the ads might not be showing up, you'll need to provide a lot more information than just saying "why can't I see ads on my site".  Provide as much information as you can when posting your question (using the above as a reference when deciding what information you need to give).

In the meantime, some of the following information can help you troubleshoot through some of the possible reasons on your own.  Please take time to read the following information. If none of the following information helps, open a question of your own (or add to your own question if you already posted one).

There are several reasons why ads may not show on your site.

1. You applied for Adsense using YouTube or AdMob

If you have an approved Adsense account that you obtained by applying through AdMob or your YouTube channel, you won't be able to use Adsense anywhere except host URLs.

(a) Since AdMob is only for displaying AdSense in mobile apps, you need to upgrade your account to use it on a website. You "should" be able to link it directly to your YT channel though.

Upgrade to display on a website following instructions in this link: https://support.google.com/adsense/answer/2534771?hl=en&ref_topic=2811251&rd=1

(b) If you applied through your YT channel then you can only display ads on YouTube unless you are approved for an account upgrade.

YouTube: If you have signed up for AdSense via a YouTube account and you’d like to show ads on other host domains, then you’ll need to provide us with a top-level domain. At this time there's no possibility of monetizing other hosted properties for AdSense accounts created via YouTube without upgrading the account by providing a top-level domain.

To request an account upgrade you need a top level domain (you can't submit a blogspot or other subdomain URL for an upgrade request).
So basically that means you can't show AdSense on a blogger url without first submitting a domain to get your account upgraded.
See the instructions here: https://support.google.com/adsense/answer/2534771?hl=en&ref_topic=2811251&rd=1 

2. You applied for AdSense using a blogspot (Blogger) URL and are trying to show ads on your own domain (or a custom domain on Blogger).

If you have a hosted adsense account through blogger, then you need to request an upgrade to your account before ads will display on your own/custom domains.

Follow these instructions here: https://support.google.com/adsense/answer/2534771?hl=en&ref_topic=2811251&rd=1

3. You applied for a Host account upgrade by submitting the URL and placing the ad codes, but no ads show up.

That's probably because the upgrade isn't approved yet. During the upgrade process, your website/blog will go through the same review process as if you were applying for a new Adsense account, so it can take anywhere from a few days, to a couple of weeks for Adsense to complete the review. If they approve your upgrade request, ads will begin showing, and you'll receive an approval mail. If they don't approve it, you should receive an email notice saying the upgrade was not approved. In that case, no ads will show. 

4. Your AdSense PIN was issued, but you haven't received or entered it, and it has been SIX (6) MONTHS since the first PIN was issued.

In this case, ads will not begin showing until you complete the PIN Process and enter your PIN -note that it can take up to 48 hours after entering your PIN/verifying your address before the ads display, so be patient. (See: https://support.google.com/adsense/answer/157667?hl=en&vid=1-635792076383490765-1595138867)

5. The AdSense Code

(a) The Adsense code is not correct in the page.  In some types of templates, even if you copied the correct code from your AdSense account and pasted it into your website/blog as required, the code will be corrupt when you save the edit. This is a matter of the template or blogging platform, and you'll need to take steps to correct it.

Wordpress.com: you cannot place Adsense code on Wordpress.com hosted sites, not even if they have a custom domain. Wordpress doesn't allow it, and the codes will not enter correctly.
Wordpress.org: if you are not using the official Adsense-Wordpress plugin and have placed the code manually, check to make sure it is not corrupt. Some templates will do funky stuff with the ad code (most often what we see is line breaks at the end of each line of Adsense ad code - you'd need to remove those. To install the official plugin if you want to try it see:  https://support.google.com/adsense/answer/3380627?hl=en&vid=1-635792076383490765-1595138867

Blogger: if you are trying to paste the AdSense code into the <head> or after the <body> tag of the template's html you'll get errors. Paste the ad code into an html gadget for blogger (layout page, + New Ad Unit, paste code, position gadget), OR use an Adsense Gadget (layouts page, +New Ad Unit, Adsense Gadget), OR use the earnings tab of your blog to place ads in the sidebar and posts.

Other web builders: if you are using a website builder provided by your hosting company (like Godaddy's web builder, or Yahoo Site Builder) then  you should ask for help at the support center for the product you are using. Unless one of the volunteers in the Adsense forum has used these other products, it isn't likely any of us can provide much help with specific products.

(b)  There are too many AdSense ad codes in the page. AdSense allows a maximum of 3 AdSense ad units per page. If you try to put more than that (i) it violates policy and is a cause for warning or disabled accounts (ii) not all of the ads might display or (iii) none of the ads may display. Make sure you only have 3 Adsense ad units on a page.  (You may also use 3 Link Units (or "link ads"), but these are not the same text ad units, so make sure you haven't confused the codes.)

6. Your Adsense account was approved, but ads aren't showing.

You may still only be approved for Stage 1 of the approvals process.  Check the approval email that you received from Adsense.

If it says to place the code on your site, then you'd only be in the first stage of the approvals process. When you place the ad code, an ad won't show up. Not until they complete the second review. Placing the ad code allows them to continue with the second part of the review.

That  can take anywhere from a few days to a few weeks (depending on how much traffic the site has) after you put the code on your site.

When they complete that part of the review, you'll receive another email that says whether your site is approved or not.

7. You have a fully approved non-host Adsense account that's showing ads on other websites, but not showing on your new website.

Your new domain or website may already be disabled from serving adsense ads. This can happen when you purchase a domain or website. The previous owner may have used AdSense and had the site/domain disabled at that time either for a policy violation or invalid activity.  There are very few ways to correct this. If you earn enough to qualify for direct contact with Adsense staff, then you can use the "contact us" link in the AdSense help center, or in your AdSense account. You can explain the situation and ask them to review your new site.  If you have no contact with staff, there will likely be no way to get AdSense ads to show up on it.

In order to prevent this happening, check any domain or website you intend to purchase before paying out money for it. Use these tools (I use both because it's a good way to confirm it if both tools show a site as disabled/banned).

The AdSense Sandbox:  http://ctrlq.org/sandbox/
Isbanned: http://www.isbanned.com/ 

8. Your site may be written in an unsupported language. Languages not supported by AdSense may not use Adsense ads on them. Please refer to the language list: https://support.google.com/adsense/answer/9727?hl=en

9. Check the troubleshooter for reasons why ads might not show: https://support.google.com/adsense/answer/1208336?hl=en

Thursday, July 30, 2015

How I resolved Network Adapter(WIFI) issue after Window 10 Upgrade

I was one of the lucky ones like you to upgrade my laptop with the official Windows 10 on the day of release (07/29).

A little icon on the system tray popped up with the message Windows 10 is ready to install when I turned on my laptop in the morning. I wanted to give a try so I went ahead and followed the on screen instruction for the upgrade. The upgrade was very smooth. I didn't even have to take backup. The upgrade utility took care of everything to keep all my personal data and as well the applications installed already.

I was happy to see the new start menu and features in new OS. Even more happy to see  all my data after first login. My happiness didn't last longer. When I opened chrome to see how things over the internet. I got the "Unable to connect to Internet".  Oh! did I forget to connect to my wifi? Oh No.. I don't see any wifi access points? Oh Hell No.. I don't have an option to set up wireless network.

I was all over the internet looking for solution. Updated the driver quite few times and nothing worked. With the tiring and sad mood, I wanted to get rid of new OS (Windows 10). Luckily Windows 10 had an option to downgrade to previous version of OS i.e. Windows 8.1(The options is available in the Upgrade and Security) section. (Downgrade Windows 10).

Downgrade from windows 10 to 8.1 was smooth again. To my surprise my wifi network configured automatically post downgrade. Voila... This time my internet connection worked in Windows 8.1.

My ego pushed me to upgrade to Windows 10 again. But this time I did little bit home work and research and listed down the possible roadblocks for the network issue in Windows 10.
I came up with the following list
  • Firewall
  • VPN (Virtual Private Network)

Unfortunately I had installed the clients for both firewall (Symantec antivirus) and VPN (Cisco VPN Client). I uninstalled these softwares before attempting to upgrade again. I restarted the windows 8.1 after uninstalling the antivirus and VPN client and upgraded to Windows 10. To my surprise this time I got the wireless network configured automatically and I am connected to my default WIFI router.
Everything works like charm...... I reinstalled the antivirus in Windows 10 and no issues.

Tuesday, March 10, 2015

Download attachments from SOAP web service- streaming of contents

SOAP Client for Downloading Attachments - Streaming

We have seen uploading of larger data files using SOAP with attachments in the previous post(Upload attachments using SOAP). We will see how to download/stream larger files from SOAP web service.

Java Mail API Problem
The SOAP web service client for downloading attachments we will be discussing uses the MimeMessage structure but we will avoid using the JAVA MAIL package as it is not efficient while downloading the contents. If you use MimeMessage java api to get the MimeBodyPart then you'll be in trouble as MimeMessage loads the entire content as byte array into memory for calculating the size and number of MimeBodyParts. So we will avoid using it for larger files if you have small JVM memory.

How to stream larger files
The memory intensive operation can be avoided using our own custom code to parse the response from the SOAP web service. 

The following example shows the SOAP message response with the attachments. This example is for Oracle UCM's GetFileByName operation. 

The SOAP response message package is constructed using the  Multipart/Related  media type. The structure of the response stream is as follows:
  1. The primary SOAP message must be carried in the root body part of the Multipart/Related structure. Consequently the type parameter of the Multipart/Related media header will always equal the Content-Type header for the primary SOAP 1.1 message, i.e., text/xml.
  2. Referenced MIME parts must contain either a Content-ID MIME header.
Content-Type: multipart/related; type="text/xml"; start="rootContent"; boundary="----=_Part_12_21424854.1424891476173"
SOAPAction: "http://www.stellent.com/CheckIn/"
Content-Length: 1818

Content-Type: text/xml; charset=UTF-8
Content-Transfer-Encoding: 8bit
Content-ID: rootContent

<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:get=\"http://www.stellent.com/GetFile/\">
         <get:dDocName>Test.txt</get:dDocName>    <get:revisionSelectionMethod>LatestReleased</get:revisionSelectionMethod>
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Content-ID: test.log



As you can see above the response stream starts with boundary (------=_Part_12_21424854.1424891476173). Each MimeBodyParts are separated by boundary. The content of each MimeBodyPart starts after blank line. The blank line is used to seperate the headers and content of each MimeBodyPart. Using apache LineInputStream we read each line until we encounter the blank line for the attachment content. Once the blank line preceeding the attachment body is read we will switch back to BufferInputStream for efficiency. Don't forget to ignore the boundary line which indicates the end of response and exclude it from writing into the file.

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import javax.activation.DataHandler;
import javax.mail.Session;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
import javax.mail.internet.PreencodedMimeBodyPart;
import org.apache.axis.utils.StringUtils;
import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.HeaderElement;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpMethod;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.methods.PostMethod;
import com.sun.mail.util.LineInputStream;
public class UCMDownloader {
        public static void main(String[] args) {
                HttpClient client = new HttpClient();
                PostMethod method = new PostMethod(
                long start = System.currentTimeMillis();
                String fileName = "Test.txt";
                try {
                        MimeMessage message = new MimeMessage(
                                        Session.getDefaultInstance(new Properties()));
                        MimeMultipart mp = new MimeMultipart();
                        // Create the first body part
                        StringBuffer requestXML = constructRequest(fileName);
                        long requestSize = requestXML.length();
                        MimeBodyPart rootPart = new PreencodedMimeBodyPart("8bit");
                        rootPart.setDataHandler(new DataHandler(new RequestXmlDataSource(
                        mp.addBodyPart(rootPart, 0);
                        String cType = message.getHeader("Content-Type")[0];
                        int idx = cType.indexOf("boundary");
                        int boundryLength = 0;
                        if (idx != -1) {
                                boundryLength = cType.substring(idx + 9).length();
                        long contentLength = (boundryLength * 2) + 2 + requestSize + 6;
                        method.addRequestHeader("Content-Type", "text/xml;charset=UTF-8");
                                        new Integer(0));
                        // send the request
                        int status = client.executeMethod(method);               
                        // process the response
                        contentLength = getContentLength(method);
                        String boundary = getBoundary(method);
                        if (boundary != null) {
                                // Boundary foe each Body Part
                                boundary = "--" + boundary;
                        BufferedInputStream bin = new BufferedInputStream(
                        LineInputStream lin = new LineInputStream(bin);
                        boolean rootBoundaryEncountered = false;
                        boolean attachmentBoundaryEncountered = false;
                        String line = null;
                        long readSoFar = 0;
                        while ((line = lin.readLine()) != null) {
                                readSoFar += line.length() +2; // 2 for \r\n
                                if (line.equals(boundary)) {
                                        if (!rootBoundaryEncountered) {
                                                // boundary for root body part
                                                rootBoundaryEncountered = true;
                                        } else { // root bodypart already read so we are ready to
                                                                // read next body part
                                                attachmentBoundaryEncountered = true;
                                } else if (line.length() == boundary.length() + 2
                                                && line.startsWith(boundary) && line.endsWith("--")) {
                                                // End of response
                                        line = null;
                                } else if (!StringUtils.isEmpty(line)) {
                                        // header part and SOAP XML goes here
                                } else { // the attachment content always follows the blank line
                                        if (attachmentBoundaryEncountered) {
                                                // save the attachment content into file
                                                saveAttachment(bin, boundary, contentLength, readSoFar);
                } catch (HttpException e) {
                } catch (IOException e) {
                } catch (Exception e) {
                } finally {
                        long end = System.currentTimeMillis();
                        System.out.println("Time taken for [" + fileName + "]: "
                                        + (end - start));
                        // release any connection resources used by the method
        public static StringBuffer constructRequest(String fileName) {
                StringBuffer request = new StringBuffer();
                                + "   <soapenv:Header/>\r\n"
                                + "   <soapenv:Body>\r\n"
                                + "      <get:GetFileByName>\r\n"
                                + "         <get:dDocName>"+ fileName +"</get:dDocName>\r\n"
                                + "         <get:revisionSelectionMethod>
                                + "         <get:rendition>primary</get:rendition>\r\n"
                                + "         <get:extraProps>\r\n"
                                + "            <get:property>\r\n"
                                + "               <get:name>soapResponseType</get:name>\r\n"
                                + "               <get:value>Multipart/Related</get:value>\r\n"
                                + "            </get:property>\r\n"
                                + "         </get:extraProps>\r\n"
                                + "      </get:GetFileByName>\r\n"
                                + "   </soapenv:Body>\r\n"
                                + "</soapenv:Envelope>");
                return request;
        public static String getBoundary(HttpMethod httpMethod) {
                Header h = null;
                String boundary = null;
                h = httpMethod.getResponseHeader("Content-Type");
                if (h != null) {
                        HeaderElement[] elements = h.getElements();
                        for (HeaderElement element : elements) {
                                String name = element.getName().toUpperCase();
                                if (name.startsWith("MULTIPART/")) {
                                        NameValuePair parameter = element
                                        if (parameter != null) {
                                                boundary = parameter.getValue();
                return boundary;
        public static long getContentLength(HttpMethod httpMethod) {
                Header h = null;
                String contentLen = "0";
                h = httpMethod.getResponseHeader("Content-Length");
                if (h != null) {
                        contentLen = h.getValue();
                long contentLength = Long.valueOf(contentLen).longValue();
                return contentLength;
        public static void saveAttachment(BufferedInputStream responseStream,
                String boundary, long totalBytes, long totalBytesRead) {
                try {
                        if (responseStream != null) {
                                BufferedOutputStream out = new BufferedOutputStream(
                                                new FileOutputStream(
                                byte data[] = new byte[4096];
                                int bytesread = -1;
                                boolean boundaryEndHit = false;
                                int boundaryEnd = boundary.length()+6;
                                System.out.println("Attachment Starts Here ========= ");
                                while ((bytesread = responseStream.read(data)) != -1) {
                                        totalBytesRead += bytesread;
                                        if (totalBytesRead <= (totalBytes -
                                                boundaryEnd)) {
                                                out.write(data, 0, bytesread);
                                        } else if (totalBytesRead > (totalBytes -
                                                boundaryEnd)) {
                                                out.write(data, 0, bytesread -
                                                        (int) (totalBytesRead -
                                                                (totalBytes - boundaryEnd)));
                } catch (Exception e) {

The example was tested with 10 concurrent thread each downloaded 160MB of file from web service and the JVM memory utilization was mere 20MB.