Tuesday, April 5, 2016

The App Every Writer Needs Is 50% Off

The app every writer needs is 50% off

If you’re a writer, you’re probably already familiar with the way that every piece usually starts as a jumbled pile of garbage in a Word doc. And in that other Word doc. And in a few notes somewhere on your desktop. And in a couple of emails that are…somewhere in your inbox. Luckily, there’s a better way, and it doesn’t involve setting your laptop on fire. Get Scrivener 2 for just $22.50—a savings of 50%—at SitePoint Shop.

A favorite among professional writers, Scrivener 2 makes sense of your scribbles, notes, outlines, and more, whether you’re writing a script, an article, or a novel. It’s a project management tool and word processor in one that lets you storyboard your project, keep your notes and research (even web articles) within reach, and edit to your heart’s content. And, of course, retrieve your earlier, better edit whenever you want.

Don’t set your laptop on fire. Save 50% on Scrivener 2 instead. Get Scrivener 2 for just $22.50 at SitePoint Shop.

Continue reading %The App Every Writer Needs Is 50% Off%


by SitePoint Offers via SitePoint

How to Work With PDF Documents Using Python

I really admire Portable Document Format (PDF) files. I remember the days when such files solved any formatting issues while exchanging files due to some differences in Word versions, or for other reasons.

We are mainly talking about Python here, aren't we? And we are interested in tying that to working with PDF documents. Well, you may say that's so simple, especially if you have used Python with text files (txt) before. But, it is a bit different here. PDF documents are binary files and more complex than just plaintext files, especially since they contain different font types, colors, etc.

That doesn't mean that it is hard to work with PDF documents using Python, it is rather simple, and using an external module solves the issue.

PyPDF2

As we mentioned above, using an external module would be the key. The module we will be using in this tutorial is PyPDF2. As it is an external module, the first normal step we have to take is to install that module. For that, we will be using pip, which is (based on Wikipedia):

A package management system used to install and manage software packages written in Python. Many packages can be found in the Python Package Index (PyPI).

You can follow the steps mentioned in the Python Packaging User Guide for installing pip, but if you have Python 2.7.9 and higher, or Python 3.4 and higher, you already have pip!

PyPDF2 now can be simply installed by typing the following command (in Mac OS X's Terminal):

pip install pypdf2

Great! You now have PyPDF2 installed, and you're ready to start playing with PDF documents.

Reading a PDF Document

The sample file we will be working with in this tutorial is sample.pdf. Go ahead and download the file to follow the tutorial, or you can simply use any PDF file you like.

Let's now go ahead and read the PDF document. Since we will be using PyPDF2, we need to import the module, as follows:

import pypdf2

After importing the module, we will be using the PdfFileReader class. So, the script for reading the PDF document looks as follows:

More Operations on PDF Documents

After reading the PDF document, we can now carry out different operations on the document, as we will see in this section.

Number of Pages

Let's check the number of pages in sample.pdf. For this, we can use the getNumPages() method:

In this case, the returned value will be 1.

Page Number

Let's now check the number of some page in the PDF document. We can use the method getPageNumber(page), Notice that we have to pass an object of type page to the method. To retrieve a page, we will use the getPage(number) method, where number represents the page number in the PDF document. The argument number starts with the value 0.

Well, I know when you use getPage(number) you already know the page number, but this is just to illustrate how to use those methods together. This can be demonstrated in the following script:

Go ahead, try the script. What output did you get?

We know that in sample.pdf (the file we are experimenting with), we only have one page (number 0). What if we passed the number 1 as the page number to getPage(number)? In this case, you will get the following error:

This is because the page is not available, and we are using a page number out of range (does not exist).

Page Mode

The PDF page comes with different modes, which are as follows:

/UseNone Do not show outlines or thumbnails panels
/UseOutlines
Show outlines (aka bookmarks) panel
/UseThumbs
Show page thumbnails panel
/FullScreen
Fullscreen view
/UseOC
Show Optional Content Group (OCG) panel
/UseAttachments
Show attachments panel

In order to check our page mode, we can use the following script:

In the case of our PDF document (sample.pdf), the returned value is none, which means that the page mode is not specified. If you want to specify a page mode, you can use the method setPageMode(mode), where mode is one of the modes listed in the table above.

Extract Text

We have been wandering around the file so far, so let's see what's inside. The method extractText() will be our friend in this task.

Let me show you the full script to do that, as opposed to what I was doing above in showing you only the required script to perform an operation. The script to extract a text from the PDF document is as follows:

I was surprised when I got the following output rather than that in sample.pdf:

This is most likely due to a font issue, such that the character codes map to other values. So it is sometimes an issue with the PDF document itself, as the PDF document might not contain the data required to restore the content.

I thus tried another file, which is a paper of mine: paper.pdf. Go ahead and replace sample.pdf in the code with paper.pdf. The output in this case was:

But, where is the rest of the text in the page? Well, actually the extractText() method seems not to be perfect, and some improvements need to be made. But, the goal here is to show you how to work with PDF files using Python, and it seems some improvements need to be made in the domain.

Conclusion

As we can see, Python makes it simple to work with PDF documents. This tutorial just scratched the surface on this topic, and you can find more details on different operations you can perform on PDF documents on the PyPDF2 documentation page


by A. Ahmed via Envato Tuts+ Code

2016 Make Me Pulse

opl-small

Incredible interactive One Pager by digital agency, Make Me Pulse, wishing you a successful 2016. The effects are mind blowing and an excellent reference to how far we've gone since Flash died.

by Rob Hope via One Page Love

How to Work With WordPress Term Meta: Term Metadata API

5 Reasons to use PeopleImages for your One Page website photos

opl-peopleimages-logoThis weeks RSS and website sponsor is the excellent resource for Stock Photos, PeopleImages.

PeopleImages is founded by Danish born Yuri Arcurs, who has been the world’s top selling stock photographer for the last four years!

We’re going to list 5 reasons why they should be your go-to resource for quality Stock Imagery.


1 – Massive catalog

There is no doubt Unsplash has become an excellent free resource for stock photos. Unfortunately with free comes huge usage and almost every good image there is seen on several different websites and blog posts.

PeopleImages has over 350 000 images in their growing collection.


2 – Updated daily by a dedicated team

Speaking of a growing collection, these were the photoshoots added just today. It’s the 4th of April and there are already 22 shoots added this month to PeopleImages:

Our team just keeps on growing here at PeopleImages, and we’re proud to say that we now count a full time staff of over 100 people that have come together to share a vision of perfection and dedication. Our staff of 20 full time photographers are constantly on the lookout to create new images and concepts, and they have made it their mission to take the road less traveled, go the extra mile and never shoot something they would not use themselves.

peopleimages-today


3 – Browsing Experience: Speed and Preview Size

I’ve spent over 5 years browsing Stock Photo sites and haven’t experienced one that comes close to how fast the images load on PeopleImages. The hosting is world class and the framework is custom coded to delivery content like lightening.

The image preview sizes are also great to experience the image properly, not to mention extra relevant info on thumbnail hover:

peopleimages-search


4 – Advanced Filters

peopleimages-filtersEasily my favorite feature. The misconception with Stock Photography is that the images are all overly “polished” and “fake” but sometimes that is the brief from your client.

It’s great to know PeopleImages has got you covered with a ‘Model Rating’ slider. The slider ranges from “Authentic” to “Good Looking” to “Very Model”. This really helps finding natural looking people.

Other options include age, whitespace, ethnicity, color and much more.
 
 


5 – Focus on People

Finding excellent images of real natural-looking people is extremely difficult to find on free stock photo sites. This is of course the primary focus of PeopleImages, they’ve targeted this niche and fully delivered. Images of people within your One Page website creates direct association with your reader – which enhances emotion. This no doubt helps increase conversion for signups or sales.

peopleimage-footer

Choosing the right image is an absolute game-changer for a lasting first impression for your product or brand.

Visit PeopleImages.com and find that next image for your website.


by Rob Hope via One Page Love

3 Instagram Analytics Tools for Marketers

ag-instagram-analytics-560

Is your business ready for Instagram’s algorithm? Looking for tools to analyze your Instagram engagement? Tracking engagement will help you serve quality content that keeps you at the top of the Instagram feed. In this article you’ll discover three tools to track and evaluate how people respond to your content on Instagram. Instagram’s Feed Algorithm [...]

This post 3 Instagram Analytics Tools for Marketers first appeared on .
- Your Guide to the Social Media Jungle


by Ana Gotter via

How to Customize Your Social Media Inbox on Your Smartphone

kh-social-media-inbox-560

Do you need to continuously monitor your social accounts? Worried you’re missing important comments or posts? By combining social media apps on your smartphone, you can create a notifications system tailored to your unique needs. In this article you’ll discover how to use your smartphone as the ultimate social media inbox. There are tips and [...]

This post How to Customize Your Social Media Inbox on Your Smartphone first appeared on .
- Your Guide to the Social Media Jungle


by Kristi Hines via