Friday, February 10, 2017

WordPress SSL Plugins to Make Switching to HTTPS Easier

It's relatively easy to enable SSL (HTTPS) on a WordPress website. Once you've purchased or enabled your SSL certificate on your web server, in theory all you need to do is update the home and site URL (in Dashboard > Settings, or using wp-config.php) and you're done! In practice however, there can be a few stumbling blocks depending on how your site has been built and configured.

Why should you consider using SSL? Using SSL secures communication on your website using encryption, keeping traffic between web browser and web server private. Aside from the security benefits, it's also strongly encouraged by search engines. SSL has even been a ranking factor since 2014. For many years, web browsers have displayed padlocks and various icons to help users identify secure sites, these are now becoming more noticeable. SSL is an important trust factor, however if you need further convincing on why you should be using HTTPS rather than HTTP, check out a recent article on WP Tavern that reports that more than 50% of web traffic is now encrypted. They also dig into some of the current usage statistics.

In this article, I'll cover some of the popular plugins that I've come across, and been recommended by others in the WordPress community. I'll also list a few useful testing tools that have helped me when troubleshooting both client and server SSL related issues.

It's worth noting that all modern web browsers are equipped with "Developer Tools", including several that can assist with SSL and certificate problems.

Continue reading %WordPress SSL Plugins to Make Switching to HTTPS Easier%


by Chris Burgess via SitePoint

MORE by Bourn: Love More

MORE by Bourn: Love More

Spiffy Landing Page promoting an upcoming clothing range titled "MORE by Bourn". The One Pager has such a slick custom Shopify integration with AJAX in-page checkout functionality. The Instagram slider works rad too and pulls all activity with the hashtag #14ACTSOFLOVE. A lovely Landing Page with warm intentions = Most Loved.

by Rob Hope via One Page Love

28 Days of Design

28 Days of Design

Bold and striking One Pager hosting the '28 Days of Design' contest by WordPress hosting providers, Flywheel. Built on WordPress of course:) Cheers for the awesome build notes! (I'm letting this Landing Page in as it's clearly a marketing campaign on a dedicated subdomain but OPL doesn't usually list sites with link column footers)

by Rob Hope via One Page Love

Error Handling & Logging in Python

In software development, different types of errors can occur. They could be syntax errors, logical errors, or runtime errors. 

Syntax errors most probably occur during the initial development phase and are a result of incorrect syntax. Syntax errors can be caught easily when the program is compiled for execution.

Logical errors, on the other hand, are a result of improper logical implementation. An example would be a program accessing a unsorted list assuming it to be sorted. Logical errors are the most difficult ones to track.

Runtime errors are the most interesting errors which occur, if we don't consider all the corner cases. An example would be trying to access a non-existent file. 

In this tutorial, we'll learn how to handle errors in Python and how to log the errors for a better understanding of what went wrong inside the application.

Handling Exceptions in Python

Let's start with a simple program to add two numbers in Python. Our program takes in two parameters as input and prints the sum. Here is a Python program to add two numbers:

Try running the above Python program, and you should have the sum printed.

While writing the above program, we didn't really consider the fact that anything can go wrong. What if one of the parameters passed is not a number?

We haven't handled that case, hence our program would crash with the following error message:

We can handle the above issue by checking if the parameters passed are integers. But that won't solve the issue. What if the code breaks down due to some other reason and causes the program to crash? Working with a program which crashes on being encountered with an error is not a good sight. Even if an unknown error is encountered, the code should be robust enough to handle the crash gracefully and let the user know that something is wrong.

Handling Exceptions Using Try and Except

In Python, we use the try and except statements to handle exceptions. Whenever the code breaks down, an exception is thrown without crashing the program. Let's modify the add number program to include the try and except statements.

Python would process all code inside the try and except statement. When it encounters an error, the control is passed to the except block, skipping the code in between.

As seen in the above code, we have moved our code inside a try and except statement. Try running the program and it should throw an error message instead of crashing the program. The reason for the exception is also returned as an exception message.

The above method handles unexpected exceptions. Let's have a look at how to handle an expected exception. Assume that we are trying to read a particular file using our Python program, but the file doesn't exist. In this case, we'll handle the exception and let the user know that the file doesn't exist when it happens. Have a look at the file reading code:

In the above code, we have handled the file reading inside an IOError exception handler. If the code breaks down due to unavailability of the file fname, the error would be handled inside the IOError handler. Similar to the IOError exceptions, there are a lot more standard exceptions like Arithmetic, OverflowError, and ImportError, to name a few.

Multiple Exceptions

We can handle multiple exceptions at a time by clubbing the standard exceptions as shown:

The above code would raise both the IOError and NameError exceptions when the program is executed.

finally Clause

Assume that we are using certain resources in our Python program. During the execution of the program, it encountered an error and only got executed halfway. In this case, the resource would be unnecessarily held up. We can clean up such resources using the finally clause. Take a look at the below code:

If, during the execution of the above code, an exception is raised while reading the file, the filePointer would be closed in the finally block.

Logging in Python

When something goes wrong inside an application, it becomes easier to debug if we know the source of the error. When an exception is raised, we can log the required information to track down the issue. Python provides a simple and powerful logging library. Let's have a look at how to use logging in Python.

As seen in the above code, first we need to import the logging Python library and then initialize the logger with the log file name and logging level. There are five logging levels: DEBUG, INFO, WARNING, ERROR, and CRITICAL. Here we have the set the logging level to INFO, hence the INFO and above logs would be logged.

Getting the Stack Trace

In the above code we had a single program file, hence it was easier to figure out where the error had occurred. But what do we do when multiple program files are involved? In such a case, getting the stack trace of the error helps in finding the source of the error. The stack trace of the exception can be logged as shown:

If you try to run the above program, on raising an exception the following error would be logged in the log file:

Wrapping It Up

In this tutorial, we saw how to get started with handling errors in Python and using the logging module to log errors. We saw the usage of try, except and finally statements, which are quite useful when dealing with error handling in Python. For more detailed information, I would recommend reading the official documentation on logging. Also have a look at the documentation for handling exceptions in Python.

Do let us know your thoughts in the comments below.


by Roy Agasthyan via Envato Tuts+ Code

How Does the Default hashCode() Work?

In which scratching the surface of hashCode() leads to a speleology trip through the JVM source reaching object layout, biased locking, and surprising performance implications of relying on the default hashCode(). Abundant thanks to Gil Tene and Duarte Nunes reviewing drafts of this article and their very valuable insights, suggestions and edits. Any remaining errors […]

Continue reading %How Does the Default hashCode() Work?%


by Galo Navarro via SitePoint

Instagram Stories: How to Create Engaging Stories

Do you use Instagram? Wondering how Instagram stories work? To explore how to craft Instagram stories for business, I interview Sue B. Zimmerman. Instagram Stories The Social Media Marketing podcast is an on-demand talk radio show from Social Media Examiner. It’s designed to help busy marketers and business owners discover what works with social media [...]

This post Instagram Stories: How to Create Engaging Stories first appeared on .
- Your Guide to the Social Media Jungle


by Michael Stelzner via

Orsolina28

Dance, otherwise we are lost. This is the way we found ourselves a such amazing venue, surrounded by the most amazing landscape altogether dancing and deepening our inner nature.
by via Awwwards - Sites of the day