Monday, March 9, 2015
Making PATCH requests from App Engine
PATCH requests allow you to perform partial updates on many of our REST APIs and in most cases can save bandwidth.
If you have ever tried to do a PATCH request on an App Engine application, you probably realized that it is not possible and that the list of HTTP Methods allowed is whitelisted to the following methods only: GET, POST, HEAD, PUT and DELETE. Trying to perform a PATCH request raises the following Exception:
java.net.ProtocolException: PATCH is not one of the supported http methods: [GET, POST, HEAD, PUT, DELETE] There is a workaround to this. Most of our APIs support the X-HTTP-Method-Override header. This header can be used in a POST request to “fake” other HTTP methods. Simply set the value of the X-HTTP-Method-Override header to the HTTP method you would like to actually perform.
For example, to make a PATCH request to the Google Tasks API to update only the Notes field of a particular task you could use the following HTTP request:
POST /tasks/v1/lists/@default/tasks/TASK_ID HTTP/1.1
Host: www.googleapis.com
X-HTTP-Method-Override: PATCH
Authorization: Bearer
Content-Type: application/json
Content-Length: 31
{“Notes” : “Patch is working!”}
Which would be equivalent to this HTTP Request, which is not supported on App Engine:
PATCH /tasks/v1/lists/@default/tasks/TASK_ID HTTP/1.1
Host: www.googleapis.com
Authorization: Bearer
Content-Type: application/json
Content-Length: 31
{“Notes” : “Patch is working!”}
For instance, in an App Engine Java environment you could construct and execute this request this way:
URL url = new URL("https://www.googleapis.com/tasks/v1/" +
"lists/@default/tasks/" + TASK_ID);
HTTPRequest request = new HTTPRequest(url, HTTPMethod.POST);
request.addHeader(new HTTPHeader("X-HTTP-Method-Override", "PATCH"));
request.addHeader(new HTTPHeader("Authorization", "Bearer " +
ACCESS_TOKEN));
request.setPayload("{"Notes" : "Patch is working!"}".getBytes());
URLFetchService fetchService = URLFetchServiceFactory.getURLFetchService();
HTTPResponse response = fetchService.fetch(request); This trick can also be used if your application server is behind a firewall, behind a proxy server or in any other environment where HTTP methods other than POST might not be allowed. In that case you could use the X-HTTP-Method-Override header the same way to workaround these limitations.
You may also use our Google APIs Client library for Java or our Google APIs Client library for Python, both of which have support for PATCH requests and use the X-HTTP-Method-Override header when appropriate.
| Nicolas Garnier profile | twitter | events Nicolas joined Google’s Developer Relations in 2008. Since then hes worked on commerce oriented products such as Google Checkout and Google Base. Currently, he is working on Google Apps with a focus on the Google Calendar API, the Google Contacts API, and the Tasks API. Before joining Google, Nicolas worked at Airbus and at the French Space Agency where he built web applications for scientific researchers. |
Monday, February 16, 2015
SCAN WINDOWS FOR VIRUSES FROM UBUNTU

The first thing that comes to mind after hearing the words “antivirus scanner for Linux”
is “What? But there are practically no viruses for Linux...” Correct, but Linux is frequently used
as a server for files or mail for clients that utilize Windows systems. It can also share a hard
drive with a Redmond system. In both cases, antivirus programs can be beneficial. The
program Clam AV has been designed to scan incoming emails and search for viruses and
worms from the Internet, but it can be utilized to scan viruses in individual files and entire
directories on the hard drive (including archives). The advantages include the open code, the
fact that it is free, and the relatively short amount of time in reacting to the appearance of new
viruses (thanks to the contribution of many users). Because the use of the command line is
not user friendly for all of us, they have created a front-end program called ClamTk. It’s an
excellent front-end for updating the virus signatures and for scanning the hard drive.
http://clamtk.sourceforge.net/pdfs/clamtk-en.pdf
CLAMTK INSTALLATION - OPTICOM SOLUTIONS
by Kibui Kenneth Maina Fri May 14, 10:54 am.
So you have a dual boot system, Windows and Ubuntu. If you copy or download virused files into your machine using Ubuntu, the minute you load Windows your machine will get infected; to prevent this, Opticom Solution recommends installing an anti-virus on Ubuntu. You can also run the live Ubuntu cd, install this anti-virus and scan a virused Windows system.
clamtk Installation instructions
1.Go to the Ubuntu terminal i.e Application>Accessories>Terminal
2.In the terminal type: sudo apt-get clamtk
3.It will ask you .....(y/n) type: Y
4.Wait for the installation to complete
5.Once the installation is complete run it with root privileges to update the anti-virus (Press alt+F2) type: gksu clamtk and press enter and type the Ubuntu system password when prompted.
6.When the application starts go to help>Check for updates click to select signature updates and if you want to update the gui too, select GUI updates. Click Check for updates to finish and wait for it to complete.
You can run the anti-virus from
1. The menu option
Application>Accessories>Virus Scanner
2.Terminal option
Press (Alt+F2) then type gksu clamtk
Enjoy
__________________________________________________________________________________

Opticom cares
To advertise here,
email advert to: opticomsolns@gmail.com