Showing posts with label documents. Show all posts
Showing posts with label documents. Show all posts
Tuesday, March 10, 2015
Documents List API Best Practices Handling errors and exponential backoff
We have recently added a new section to the Google Documents List API documentation, titled Handling API errors. A number of developers in the forum have asked what to do when certain requests cause errors, and this documentation responds to their general need for better information.
This new documentation details all errors and the scenarios that cause them. We strongly recommend that both new and advanced Google Documents List API developers read the section thoroughly.
An important technique described in the new docs is exponential backoff. Exponential backoff helps clients to automatically retry requests that fail for intermittent reasons. For example, an application might make too many requests to the API in a short period of time, resulting in HTTP 503 responses. In cases like this, it makes sense for API clients to automatically retry the requests until they succeed.
Exponential backoff can be implemented in all of the Google Data API client libraries. An example in Python follows:
We strongly recommend developers take about 30 minutes and update applications to use exponential backoff. For help doing this, please read the documentation and post in the forum if you have any questions.
This new documentation details all errors and the scenarios that cause them. We strongly recommend that both new and advanced Google Documents List API developers read the section thoroughly.
An important technique described in the new docs is exponential backoff. Exponential backoff helps clients to automatically retry requests that fail for intermittent reasons. For example, an application might make too many requests to the API in a short period of time, resulting in HTTP 503 responses. In cases like this, it makes sense for API clients to automatically retry the requests until they succeed.
Exponential backoff can be implemented in all of the Google Data API client libraries. An example in Python follows:
import random
import time
def GetResourcesWithExponentialBackoff(client):
"""Gets all of the resources for the authorized user
Args:
client: gdata.docs.client.DocsClient authorized for a user.
Returns:
gdata.docs.data.ResourceFeed representing Resources found in request.
"""
for n in range(0, 5):
try:
response = client.GetResources()
return response
except:
time.sleep((2 ** n) + (random.randint(0, 1000) / 1000))
print "There has been an error, the request never succeeded."
return None
We strongly recommend developers take about 30 minutes and update applications to use exponential backoff. For help doing this, please read the documentation and post in the forum if you have any questions.
![]() | Vic Fryzel profile | twitter | blog Vic is a Google engineer and open source software developer in the United States. His interests are generally in the artificial intelligence domain, specifically regarding neural networks and machine learning. Hes an amateur robotics and embedded systems engineer, and also maintains a significant interest in the security of software systems and engineering processes behind large software projects. |
Tuesday, January 13, 2015
XPS Documents Alternative to PDF

An XML Paper Specification (XPS) is a document format that you can use to share documents with others. Except few dissimilarities, it is exactly similar to a PDF document. More than a year back, I discussed about PDF file and Ive also discussed about how to create PDF file. Today Id like to talk about XPS.
Applies to:
- Windows 7
- Windows 8
- Windows 8.1
Though XPS is also available with Windows Vista since 2006, still this is not a popular way of sharing documents due to the widely accepted PDF documents. PDF is being used for a long time. Thousands of tools (either Premium, Freeware, Shareware or even Open Source) are available throughout the web for handling PDF documents.
You should notice, PDF viewer is available with any smart phone, tablet, laptop or desktop. It is supported by any operating system. But XPS is not so cheap. Its exclusive for Windows Vista or Above. And thats why it is not a widely accepted medium of sharing documents.
While most of the people even dont know about XPS document, I really enjoy storing my files in xps format. Believe me- this is safe too! Because a Windows XP user cant open your XPS file normally. You can easily store your information in XPS format and upload these to internet!
How to Create XPS Document?
If you can create PDF documents, then creating XPS is nothing serious for you. But if you dont know how to create PDF, then first you should read this. This will help you to be familiar with the necessary steps.
By the way Im showing you how to create XPS documents. Follow the steps below:
- Press Ctrl + P from any program you want to create PDF from.
- Create Printer > Choose Microsoft XPS Document Writer.
- Hit on the Print Button.
- Name the file and choose the destination where it should be printed.
- Finally hit the Save Button. Your file is ready.
Note: Look at the Save as Type in step 4. You can choose either .xps or .oxps.
How to View XPS Document?
To view XPS document, you have XPS Viewer with Windows 7. And in Windows 8 or 8.1, you have XPS Viewer and Windows Reader. Without XPS viewer, you cant open this type of file.
How to Use XPS Document?
I never recommend to use XPS document for sharing files with others. Because you know XPS is still unknown or unavailable to most of the people. In case of sharing files, PDF is better. But while sharing an exclusive file, XPS is a better choice for sure.
You can store your personal information through xps files. You can also upload those files online. This works like printed papers. Like printed files, XPS file doesnt allow you to change the contents easily. So you can protect your contents from alteration or overwriting.
After reading this article, hopefully you got a better idea about XPS Dcoment, XPS Document Writer and XPS Viewer. Still if you have any query just knock me. Im ready to reply to your comments . . . :)
Stay with Marks PC Solution to get more interesting IT topics!
Subscribe to:
Posts (Atom)
