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


------=_Part_12_21424854.1424891476173
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/\">
   <soapenv:Header/>
   <soapenv:Body>
      <get:GetFileByName>
         <get:dDocName>Test.txt</get:dDocName>    <get:revisionSelectionMethod>LatestReleased</get:revisionSelectionMethod>
         <get:rendition>primary</get:rendition>
         <get:extraProps>
            <get:property>
               <get:name>soapResponseType</get:name>
               <get:value>Multipart/Related</get:value>
            </get:property>
         </get:extraProps>
      </get:GetFileByName>
   </soapenv:Body>
</soapenv:Envelope>
------=_Part_12_21424854.1424891476173
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Content-ID: test.log

Hello

------=_Part_12_21424854.1424891476173--

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.


   1 
import java.io.BufferedInputStream;
   2 
import java.io.BufferedOutputStream;
   3 
import java.io.FileOutputStream;
   4 
import java.io.IOException;
   5 
import java.io.InputStream;
   6 
import java.util.Properties;
   7 
 
   8 
import javax.activation.DataHandler;
   9 
import javax.mail.Session;
  10 
import javax.mail.internet.MimeBodyPart;
  11 
import javax.mail.internet.MimeMessage;
  12 
import javax.mail.internet.MimeMultipart;
  13 
import javax.mail.internet.PreencodedMimeBodyPart;
  14 
 
  15 
import org.apache.axis.utils.StringUtils;
  16 
import org.apache.commons.httpclient.Header;
  17 
import org.apache.commons.httpclient.HeaderElement;
  18 
import org.apache.commons.httpclient.HttpClient;
  19 
import org.apache.commons.httpclient.HttpException;
  20 
import org.apache.commons.httpclient.HttpMethod;
  21 
import org.apache.commons.httpclient.NameValuePair;
  22 
import org.apache.commons.httpclient.methods.PostMethod;
  23 
 
  24 
import com.sun.mail.util.LineInputStream;
  25 
 
  26 
public class UCMDownloader {
  27 
 
  28 
        public static void main(String[] args) {
  29 
                HttpClient client = new HttpClient();
  30 
                PostMethod method = new PostMethod(
  31 
                                "http://www.oracle.com:16200/_dav/cs/idcplg");
  32 
                long start = System.currentTimeMillis();
  33 
                String fileName = "Test.txt";
  34 
 
  35 
                try {
  36 
 
  37 
                        method.addRequestHeader("SOAPAction",
  38 
                                        "\"http://www.stellent.com/GetFile/\"");
  39 
 
  40 
                        MimeMessage message = new MimeMessage(
  41 
                                        Session.getDefaultInstance(new Properties()));
  42 
                        MimeMultipart mp = new MimeMultipart();
  43 
 
  44 
                        // Create the first body part
  45 
                        StringBuffer requestXML = constructRequest(fileName);
  46 
                        long requestSize = requestXML.length();
  47 
                        MimeBodyPart rootPart = new PreencodedMimeBodyPart("8bit");
  48 
                        rootPart.setContentID("rootContent");
  49 
                        rootPart.setDataHandler(new DataHandler(new RequestXmlDataSource(
  50 
                                        requestXML.toString())));
  51 
 
  52 
                        mp.addBodyPart(rootPart, 0);
  53 
 
  54 
                        message.setContent(mp);
  55 
                        message.saveChanges();
  56 
 
  57 
                        String cType = message.getHeader("Content-Type")[0];
  58 
                        int idx = cType.indexOf("boundary");
  59 
                        int boundryLength = 0;
  60 
                        if (idx != -1) {
  61 
                                boundryLength = cType.substring(idx + 9).length();
  62 
                        }
  63 
 
  64 
                        long contentLength = (boundryLength * 2) + 2 + requestSize + 6;
  65 
 
  66 
 
  67 
                        method.setDoAuthentication(true);
  68 
                        method.setRequestBody(requestXML.toString());
  69 
 
  70 
                        method.addRequestHeader("Content-Length",
  71 
                                        String.valueOf(requestXML.length()));
  72 
                        method.addRequestHeader("Content-Type", "text/xml;charset=UTF-8");
  73 
                        method.getParams().setParameter("http.socket.timeout",
  74 
                                        new Integer(0));
  75 
 
  76 
                        // send the request
  77 
                        int status = client.executeMethod(method);               
  78 
                       
  79 
                        // process the response
  80 
                        contentLength = getContentLength(method);
  81 
                       
  82 
                        String boundary = getBoundary(method);
  83 
                        if (boundary != null) {
  84 
                                // Boundary foe each Body Part
  85 
                                boundary = "--" + boundary;
  86 
                        }
  87 
 
  88 
                        BufferedInputStream bin = new BufferedInputStream(
  89 
                                        method.getResponseBodyAsStream());
  90 
                        LineInputStream lin = new LineInputStream(bin);
  91 
 
  92 
                        boolean rootBoundaryEncountered = false;
  93 
                        boolean attachmentBoundaryEncountered = false;
  94 
 
  95 
                        String line = null;
  96 
                        long readSoFar = 0;
  97 
                        while ((line = lin.readLine()) != null) {
  98 
                                readSoFar += line.length() +2; // 2 for \r\n
  99 
                                if (line.equals(boundary)) {
 100 
                                        if (!rootBoundaryEncountered) {
 101 
                                                // boundary for root body part
 102 
                                                rootBoundaryEncountered = true;
 103 
                                                continue;
 104 
                                        } else { // root bodypart already read so we are ready to
 105 
                                                                // read next body part
 106 
                                                attachmentBoundaryEncountered = true;
 107 
                                        }
 108 
                                } else if (line.length() == boundary.length() + 2
 109 
                                                && line.startsWith(boundary) && line.endsWith("--")) {
 110 
                                                // End of response
 111 
                                        line = null;
 112 
                                        break;
 113 
                                } else if (!StringUtils.isEmpty(line)) {
 114 
                                        System.out.println(line);
 115 
                                        // header part and SOAP XML goes here
 116 
                                } else { // the attachment content always follows the blank line
 117 
                                        if (attachmentBoundaryEncountered) {
 118 
                                                // save the attachment content into file
 119 
                                                saveAttachment(bin, boundary, contentLength, readSoFar);
 120 
                                                break;
 121 
                                        }
 122 
                                }
 123 
                        }
 124 
 
 125 
                } catch (HttpException e) {
 126 
                        e.printStackTrace();
 127 
                } catch (IOException e) {
 128 
                        e.printStackTrace();
 129 
                } catch (Exception e) {
 130 
                        e.printStackTrace();
 131 
                } finally {
 132 
                        long end = System.currentTimeMillis();
 133 
                        System.out.println("Time taken for [" + fileName + "]: "
 134 
                                        + (end - start));
 135 
                        // release any connection resources used by the method
 136 
                        method.releaseConnection();
 137 
                }
 138 
        }
 139 
 
 140 
        public static StringBuffer constructRequest(String fileName) {
 141 
                StringBuffer request = new StringBuffer();
 142 
                request.append("<soapenv:Envelope
 143 
                        xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"
 144 
                        xmlns:get=\"http://www.stellent.com/GetFile/\">\r\n"
 145 
                                + "   <soapenv:Header/>\r\n"
 146 
                                + "   <soapenv:Body>\r\n"
 147 
                                + "      <get:GetFileByName>\r\n"
 148 
                                + "         <get:dDocName>"+ fileName +"</get:dDocName>\r\n"
 149 
                                + "         <get:revisionSelectionMethod>
 150 
                                LatestReleased</get:revisionSelectionMethod>\r\n"
 151 
                                + "         <get:rendition>primary</get:rendition>\r\n"
 152 
                                + "         <get:extraProps>\r\n"
 153 
                                + "            <get:property>\r\n"
 154 
                                + "               <get:name>soapResponseType</get:name>\r\n"
 155 
                                + "               <get:value>Multipart/Related</get:value>\r\n"
 156 
                                + "            </get:property>\r\n"
 157 
                                + "         </get:extraProps>\r\n"
 158 
                                + "      </get:GetFileByName>\r\n"
 159 
                                + "   </soapenv:Body>\r\n"
 160 
                                + "</soapenv:Envelope>");
 161 
 
 162 
                return request;
 163 
        }
 164 
 
 165 
        public static String getBoundary(HttpMethod httpMethod) {
 166 
                Header h = null;
 167 
                String boundary = null;
 168 
 
 169 
                h = httpMethod.getResponseHeader("Content-Type");
 170 
 
 171 
                if (h != null) {
 172 
                        HeaderElement[] elements = h.getElements();
 173 
 
 174 
                        for (HeaderElement element : elements) {
 175 
                                String name = element.getName().toUpperCase();
 176 
                                if (name.startsWith("MULTIPART/")) {
 177 
                                        NameValuePair parameter = element
 178 
                                                        .getParameterByName("boundary");
 179 
                                        if (parameter != null) {
 180 
                                                boundary = parameter.getValue();
 181 
                                        }
 182 
                                }
 183 
                        }
 184 
                }
 185 
 
 186 
                return boundary;
 187 
        }
 188 
       
 189 
        public static long getContentLength(HttpMethod httpMethod) {
 190 
                Header h = null;
 191 
                String contentLen = "0";
 192 
 
 193 
                h = httpMethod.getResponseHeader("Content-Length");
 194 
                if (h != null) {
 195 
                        contentLen = h.getValue();
 196 
                }
 197 
               
 198 
                long contentLength = Long.valueOf(contentLen).longValue();
 199 
               
 200 
                return contentLength;
 201 
        }
 202 
 
 203 
        public static void saveAttachment(BufferedInputStream responseStream,
 204 
                String boundary, long totalBytes, long totalBytesRead) {
 205 
                try {
 206 
                        if (responseStream != null) {
 207 
                                BufferedOutputStream out = new BufferedOutputStream(
 208 
                                                new FileOutputStream(
 209 
                                                                "c:\\temp\\test.txt"));
 210 
                                byte data[] = new byte[4096];
 211 
                                int bytesread = -1;
 212 
                                boolean boundaryEndHit = false;
 213 
                                int boundaryEnd = boundary.length()+6;
 214 
                               
 215 
                                System.out.println("Attachment Starts Here ========= ");
 216 
                               
 217 
                                while ((bytesread = responseStream.read(data)) != -1) {
 218 
                                        totalBytesRead += bytesread;
 219 
                                       
 220 
                                        if (totalBytesRead <= (totalBytes -
 221 
                                                boundaryEnd)) {
 222 
                                                out.write(data, 0, bytesread);
 223 
                                        } else if (totalBytesRead > (totalBytes -
 224 
                                                boundaryEnd)) {
 225 
                                                out.write(data, 0, bytesread -
 226 
                                                        (int) (totalBytesRead -
 227 
                                                                (totalBytes - boundaryEnd)));
 228 
                                        }
 229 
                                }
 230 
                               
 231 
                                responseStream.close();
 232 
                                out.close();
 233 
                        }
 234 
                } catch (Exception e) {
 235 
                        e.printStackTrace();
 236 
                }
 237 
        }
 238 
}

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