5 Best Python frameworks to enhance coding experience in 2021

Python has come up as a great platform for web applications in the past few years. It has become a major choice for the developers and with several frameworks added to it, it is now becoming extremely popular in the market.

Python is also increasing in popularity with major features like functionalities, uniqueness, and general interest that have come up as relatively essential aspects. But we all know that frameworks can help in the development cycle making developers work easily on the app.

So, what are the major python frameworks that developers can use to enhance the coding experience of the developers?

1. Bottle
It is considered as a lightweight and simple micro web framework that is used to distribute the single file module. Python also has no dependencies as compared to the standard libraries. It includes several features like:

  • Templates – The framework has pythonic and fast built-in templates that support cheetah, jinja2, and mako.
  • Routing – It is a dynamic and clean URL framework that makes it easy to request function-call mapping.
  • Server – The framework includes the HTTP developer server for the fapws3, paste, cherrypy, and other WSGI HTTP server.

2. Django
This is the popular python framework that is famous for less code and better build apps. Hence, it makes Django a popular choice that is an open-source and free platform that works faster for the developers. Especially, with the application that requires flexibility and complex code that offers pragmatic designs. Several features makes Django an ideal platform such as:

  • High speed
  • Rich in features
  • Versatility
  • Secured
  • Scalability

3. TurboGears
It is a data-driven and open-source platform that is used for app development including major elements in it. The organizations are using TurboGears for several reasons since it helps in attaining direct and critical results. It also is used with database connectivities such as WebOb, Repoze, SQLAlchemy, Genshi, etc.

  • Function decorator
  • Multiple database support
  • Cross-platform OS
  • Pylon support

4. Flask
The WSGI web application framework – Flask – is a great platform that is used as an easy and quick form of development. It is a great framework that works ideally with the complex applications that use Jinja and Werkzeug as simple wrappers. It offers a robust web application that helps in development with the WSGI toolkit template.

  • Unicode based
  • Integrated support
  • Ability to plug in the ORM

5. Falcon
Another of the major Python frameworks that are extremely famous in the market is Falcon that uses the app backends and web APIS for speed development. It is also used as a top web framework that includes REST architectural style and embraces HTTP. The designers use this for a cleaner design with several other aspects like:

  • Full Unicode support
  • PyPy support
  • URI templates
  • Cython support

Credit: Techgig.com

What’s new in PHP 8 – Part 2(Breaking changes)

As mentioned in previous post What’s new in PHP 8 – Part 1(New features) : this is a major update and thus there will be breaking changes. The best thing to do is take a look at the full list of breaking changes over at the UPGRADING document.

Many of these breaking changes have been deprecated in previous 7.* versions though, so if you’ve been staying up-to-date over the years, it shouldn’t be all that hard to upgrade to PHP 8.

Consistent type errors rfc

User-defined functions in PHP will already throw TypeError, but internal functions did not, they rather emitted warnings and returned null. As of PHP 8 the behaviour of internal functions have been made consistent.

Reclassified engine warnings rfc

Lots of errors that previously only triggered warnings or notices, have been converted to proper errors. The following warnings were changed.

  • Undefined variable: Error exception instead of notice
  • Undefined array index: warning instead of notice
  • Division by zero: DivisionByZeroError exception instead of warning
  • Attempt to increment/decrement property ‘%s’ of non-object: Error exception instead of warning
  • Attempt to modify property ‘%s’ of non-object: Error exception instead of warning
  • Attempt to assign property ‘%s’ of non-object: Error exception instead of warning
  • Creating default object from empty value: Error exception instead of warning
  • Trying to get property ‘%s’ of non-object: warning instead of notice
  • Undefined property: %s::$%s: warning instead of notice
  • Cannot add element to the array as the next element is already occupied: Error exception instead of warning
  • Cannot unset offset in a non-array variable: Error exception instead of warning
  • Cannot use a scalar value as an array: Error exception instead of warning
  • Only arrays and Traversables can be unpacked: TypeError exception instead of warning
  • Invalid argument supplied for foreach(): TypeError exception instead of warning
  • Illegal offset type: TypeError exception instead of warning
  • Illegal offset type in isset or empty: TypeError exception instead of warning
  • Illegal offset type in unset: TypeError exception instead of warning
  • Array to string conversion: warning instead of notice
  • Resource ID#%d used as offset, casting to integer (%d): warning instead of notice
  • String offset cast occurred: warning instead of notice
  • Uninitialized string offset: %d: warning instead of notice
  • Cannot assign an empty string to a string offset: Error exception instead of warning
  • Supplied resource is not a valid stream resource: TypeError exception instead of warning

The @ operator no longer silences fatal errors

It’s possible that this change might reveal errors that again were hidden before PHP 8. Make sure to set display_errors=Off on your production servers!

Default error reporting level

It’s now E_ALL instead of everything but E_NOTICE and E_DEPRECATED. This means that many errors might pop up which were previously silently ignored, though probably already existent before PHP 8.

Default PDO error mode rfc

From the RFC: The current default error mode for PDO is silent. This means that when an SQL error occurs, no errors or warnings may be emitted and no exceptions thrown unless the developer implements their own explicit error handling.

This RFC changes the default error will change to PDO::ERRMODE_EXCEPTION in PHP 8.

Concatenation precedence rfc

While already deprecated in PHP 7.4, this change is now taken into effect. If you’d write something like this:

echo "sum: " . $a + $b;

PHP would previously interpret it like this:

echo ("sum: " . $a) + $b;

PHP 8 will make it so that it’s interpreted like this:

echo "sum: " . ($a + $b);

Stricter type checks for arithmetic and bitwise operators rfc

Before PHP 8, it was possible to apply arithmetic or bitwise operators on arrays, resources or objects. This isn’t possible anymore, and will throw a TypeError:

[] % [42];
$object + 4;

Namespaced names being a single token rfc

PHP used to interpret each part of a namespace (separated by a backslash \) as a sequence of tokens. This RFC changed that behaviour, meaning reserved names can now be used in namespaces.

Saner numeric strings rfc

PHP’s type system tries to do a lot of smart things when it encounters numbers in strings. This RFC makes that behaviour more consistent and clear.

Saner string to number comparisons rfc

This RFC fixes the very strange case in PHP where 0 == "foo" results in true. There are some other edge cases like that one, and this RFC fixes them.

Reflection changes

A few reflection methods have been deprecated:

  • ReflectionFunction::isDisabled()
  • ReflectionParameter::getClass()
  • ReflectionParameter::isCallable()

You should now use ReflectionType to get information about a parameter’s type:

$reflectionParameter->getType()->allowsNull();

If the type is a single type, ReflectionParameter::getType() returns an instance of ReflectionNamedType, which you can get its name from and whether it’s built-in:

$reflectionParameter->getType()->getName();
$reflectionParameter->getType()->isBuiltin();

If the type is a union type however, you’ll get an instance of ReflectionUnionType, which can give you an array of ReflectionNamedType like so:

$reflectionParameter->getType()->getTypes();

Checking whether a type is a union or not can be done with an instanceof check:

if ($reflectionParameter->getType() instanceof ReflectionNamedType) { 
    // It's a single type
}

if ($reflectionParameter->getType() instanceof ReflectionUnionType) {
    // It's a union type
}

Next up, three method signatures of reflection classes have been changed:

ReflectionClass::newInstance($args);
ReflectionFunction::invoke($args);
ReflectionMethod::invoke($object, $args);

Have now become:

ReflectionClass::newInstance(...$args);
ReflectionFunction::invoke(...$args);
ReflectionMethod::invoke($object, ...$args);

The upgrading guide specifies that if you extend these classes, and still want to support both PHP 7 and PHP 8, the following signatures are allowed:

ReflectionClass::newInstance($arg = null, ...$args);
ReflectionFunction::invoke($arg = null, ...$args);
ReflectionMethod::invoke($object, $arg = null, ...$args);

Stable sorting rfc

Before PHP 8, sorting algorithms were unstable. This means that the order of equal elements wasn’t guaranteed. PHP 8 changes the behaviour of all sorting functions to stable sorting.

Fatal error for incompatible method signatures rfc

From the RFC: Inheritance errors due to incompatible method signatures currently either throw a fatal error or a warning depending on the cause of the error and the inheritance hierarchy.

Other deprecations and changes

During the PHP 7.* development, several deprecations were added that are now finalised in PHP 8.

What’s new in PHP 8 – Part 1(New features)

PHP 8 is here! It was released on November 26, 2020. You can download it here. It’s a new major version, which means that it will introduce some breaking changes, as well as lots of new features and performance improvements.

Besides breaking changes, PHP 8 also brings a nice set of new features such as the JIT compiler, union types, attributes, and more. Let’s start with what’s new in php 8, it’s quite a list!

New features Explained:

Union types rfc

Given the dynamically typed nature of PHP, there are lots of cases where union types can be useful. Union types are a collection of two or more types which indicate that either one of those can be used.

public function foo(Foo|Bar $input): int|float;

Note that void can never be part of a union type, since it indicates “no return value at all”. Furthermore, nullable unions can be written using |null, or by using the existing ? notation:

public function foo(Foo|null $foo): void;

public function bar(?Bar $bar): void;

JIT (Just in Time compiler) rfc

The JIT — just in time — compiler promises significant performance improvements, albeit not always within the context of web requests. The JIT compiler is sort of a middle ground between compilation and interpretation. It will compile and cache some sections of code at runtime so that the compiled version can be used instead of the interpreted version. This could lead to huge performance gains for PHP, but with some caveats. Generally, JIT compilers mostly benefit CPU-intensive applications, such as 3D rendering or large mathematical computations. If you’re using PHP for web applications, you may not see a substantial performance boost by enabling the JIT compiler.

The nullsafe operator rfc

If you’re familiar with the null coalescing operator you’re already familiar with its shortcomings: it doesn’t work on method calls. Instead you need intermediate checks, or rely on optional helpers provided by some frameworks:

$startDate = $booking->getStartDate();

$dateAsString = $startDate ? $startDate->asDateTimeString() : null;

With the addition of the nullsafe operator, we can now have null coalescing-like behaviour on methods!

$dateAsString = $booking->getStartDate()?->asDateTimeString();

Named arguments rfc

Named arguments allow you to pass in values to a function, by specifying the value name, so that you don’t have to take their order into consideration, and you can also skip optional parameters!

function foo(string $a, string $b, ?string $c = null, ?string $d = null) 
{ /* … */ }

foo(
    b: 'value b', 
    a: 'value a', 
    d: 'value d',
);

Attributes rfc

Attributes, commonly known as annotations in other languages, offers a way to add meta data to classes, without having to parse docblocks. As for a quick look, here’s an example of what attributes look like, from the RFC:

use App\Attributes\ExampleAttribute;

#[ExampleAttribute]
class Foo
{
    #[ExampleAttribute]
    public const FOO = 'foo';
 
    #[ExampleAttribute]
    public $x;
 
    #[ExampleAttribute]
    public function foo(#[ExampleAttribute] $bar) { }
}
#[Attribute]
class ExampleAttribute
{
    public $value;
 
    public function __construct($value)
    {
        $this->value = $value;
    }
}

Note that this base Attribute used to be called PhpAttribute in the original RFC, but was changed with another RFC afterwards.

Match expression rfc

You could call it the big brother of the switch expression: match can return values, doesn’t require break statements, can combine conditions, uses strict type comparisons and doesn’t do any type coercion.

It looks like this:

$result = match($input) {
    0 => "hello",
    '1', '2', '3' => "world",
}; 

Constructor property promotion rfc

This RFC adds syntactic sugar to create value objects or data transfer objects. Instead of specifying class properties and a constructor for them, PHP can now combine them into one.

Instead of doing this:

class Money 
{
    public Currency $currency;
 
    public int $amount;
 
    public function __construct(
        Currency $currency,
        int $amount,
    ) {
        $this->currency = $currency;
        $this->amount = $amount;
    }
}

You can now do this:

class Money 
{
    public function __construct(
        public Currency $currency,
        public int $amount,
    ) {}
}

New static return type rfc

While it was already possible to return selfstatic wasn’t a valid return type until PHP 8. Given PHP’s dynamically typed nature, it’s a feature that will be useful to many developers.

class Foo
{
    public function test(): static
    {
        return new static();
    }
}

New mixed type rfc

Some might call it a necessary evil: the mixed type causes many to have mixed feelings. There’s a very good argument to make for it though: a missing type can mean lots of things in PHP:

  • A function returns nothing or null
  • We’re expecting one of several types
  • We’re expecting a type that can’t be type hinted in PHP

Because of the reasons above, it’s a good thing the mixed type is added. mixed itself means one of these types:

  • array
  • bool
  • callable
  • int
  • float
  • null
  • object
  • resource
  • string

Note that mixed can also be used as a parameter or property type, not just as a return type.

Also note that since mixed already includes null, it’s not allowed to make it nullable. The following will trigger an error:

// Fatal error: Mixed types cannot be nullable, null is already part of the mixed type.
function bar(): ?mixed {}

Throw expression rfc

This RFC changes throw from being a statement to being an expression, which makes it possible to throw exception in many new places:

$triggerError = fn () => throw new MyError();

$foo = $bar['offset'] ?? throw new OffsetDoesNotExist('offset');

Inheritance with private methods rfc

Previously, PHP used to apply the same inheritance checks on public, protected and private methods. In other words: private methods should follow the same method signature rules as protected and public methods. This doesn’t make sense, since private methods won’t be accessible by child classes.

This RFC changed that behaviour, so that these inheritance checks are not performed on private methods anymore. Furthermore, the use of final private function also didn’t make sense, so doing so will now trigger a warning:

Warning: Private methods cannot be final as they are never overridden by other classes

Weak maps rfc

Built upon the weakrefs RFC that was added in PHP 7.4, a WeakMap implementation is added in PHP 8. WeakMap holds references to objects, which don’t prevent those objects from being garbage collected.
Take the example of ORMs, they often implement caches which hold references to entity classes to improve the performance of relations between entities. These entity objects can not be garbage collected, as long as this cache has a reference to them, even if the cache is the only thing referencing them.

If this caching layer uses weak references and maps instead, PHP will garbage collect these objects when nothing else references them anymore. Especially in the case of ORMs, which can manage several hundreds, if not thousands of entities within a request; weak maps can offer a better, more resource friendly way of dealing with these objects.
Here’s what weak maps look like, an example from the RFC:

class Foo 
{
    private WeakMap $cache;
 
    public function getSomethingWithCaching(object $obj): object
    {
        return $this->cache[$obj]
           ??= $this->computeSomethingExpensive($obj);
    }
}

Allowing ::class on objects rfc

A small, yet useful, new feature: it’s now possible to use ::class on objects, instead of having to use get_class() on them. It works the same way as get_class().

$foo = new Foo();

var_dump($foo::class);

Non-capturing catches rfc

Whenever you wanted to catch an exception before PHP 8, you had to store it in a variable, regardless whether you used that variable or not. With non-capturing catches, you can omit the variable, so instead of this:

try {
    // Something goes wrong
} catch (MySpecialException $exception) {
    Log::error("Something went wrong");
}

You can now do this:

try {
    // Something goes wrong
} catch (MySpecialException) {
    Log::error("Something went wrong");
}

Note that it’s required to always specify the type, you’re not allowed to have an empty catch. If you want to catch all exceptions and errors, you can use Throwable as the catching type.

Trailing comma in parameter lists rfc

Already possible when calling a function, trailing comma support was still lacking in parameter lists. It’s now allowed in PHP 8, meaning you can do the following:

public function(
    string $parameterA,
    int $parameterB,
    Foo $objectfoo,
) {
    // …
}

As a sidenote: trailing commas are also supported in the use list of closures, this was an oversight and now added via a separate RFC.

Create DateTime objects from interface

You can already create a DateTime object from a DateTimeImmutable object using DateTime::createFromImmutable($immutableDateTime), but the other way around was tricky. By adding DateTime::createFromInterface() and DatetimeImmutable::createFromInterface() there’s now a generalised way to convert DateTime and DateTimeImmutable objects to each other.

DateTime::createFromInterface(DateTimeInterface $other);

DateTimeImmutable::createFromInterface(DateTimeInterface $other);

New Stringable interface rfc

The Stringable interface can be used to type hint anything that implements __toString(). Whenever a class implements __toString(), it automatically implements the interface behind the scenes and there’s no need to manually implement it.

class Foo
{
    public function __toString(): string
    {
        return 'foo';
    }
}

function bar(string|Stringable $stringable) { /* … */ }

bar(new Foo());
bar('abc');

New str_contains() function rfc

Some might say it’s long overdue, but we finally don’t have to rely on strpos() anymore to know whether a string contains another string.

Instead of doing this:

if (strpos('string with lots of words', 'words') !== false) { /* … */ }

You can now do this

if (str_contains('string with lots of words', 'words')) { /* … */ }

New str_starts_with() and str_ends_with() functions rfc

Two other ones long overdue, these two functions are now added in the core.

str_starts_with('haystack', 'hay'); // true
str_ends_with('haystack', 'stack'); // true

New fdiv() function pr

The new fdiv() function does something similar as the fmod() and intdiv() functions, which allows for division by 0. Instead of errors you’ll get INF-INF or NAN, depending on the case.

New get_debug_type() function rfc

get_debug_type() returns the type of a variable. Sounds like something gettype() would do? get_debug_type() returns more useful output for arrays, strings, anonymous classes and objects.

For example, calling gettype() on a class \Foo\Bar would return object. Using get_debug_type() will return the class name.

A full list of differences between get_debug_type() and gettype() can be found in the RFC.


New get_resource_id() function pr

Resources are special variables in PHP, referring to external resources. One example is a MySQL connection, another one a file handle.

Each one of those resources gets assigned an ID, though previously the only way to know that id was to cast the resource to int:

$resourceId = (int) $resource;

PHP 8 adds the get_resource_id() functions, making this operation more obvious and type-safe:

$resourceId = get_resource_id($resource);

Abstract methods in traits improvements rfc

Traits can specify abstract methods which must be implemented by the classes using them. There’s a caveat though: before PHP 8 the signature of these method implementations weren’t validated. The following was valid:

trait Test {
    abstract public function test(int $input): int;
}

class UsesTrait
{
    use Test;

    public function test($input)
    {
        return $input;
    }
}

PHP 8 will perform proper method signature validation when using a trait and implementing its abstract methods. This means you’ll need to write this instead:

class UsesTrait
{
    use Test;

    public function test(int $input): int
    {
        return $input;
    }
}

Object implementation of token_get_all() rfc

The token_get_all() function returns an array of values. This RFC adds a PhpToken class with a PhpToken::tokenize() method. This implementation works with objects instead of plain values. It consumes less memory and is easier to read.

Variable syntax tweaks rfc

From the RFC: “the Uniform Variable Syntax RFC resolved a number of inconsistencies in PHP’s variable syntax. This RFC intends to address a small handful of cases that were overlooked.”

Type annotations for internal functions externals

Lots of people pitched in to add proper type annotations to all internal functions. This was a long standing issue, and finally solvable with all the changes made to PHP in previous versions. This means that internal functions and methods will have complete type information in reflection.

ext-json always available rfc

Previously it was possible to compile PHP without the JSON extension enabled, this is not possible anymore. Since JSON is so widely used, it’s best developers can always rely on it being there, instead of having to ensure the extension exist first.

Breaking changes

As mentioned before: this is a major update and thus there will be breaking changes. The best thing to do is take a look at the full list of breaking changes over at the UPGRADING document. We will discuss about Breaking changes in next part.

Python is the most preferred programming language in 2020

Programming languages play a vital role in a programmer’s life to help build a great career, especially when the software world is full of thousands of programming languages. As a matter of fact, more than 50 programming languages have been added in this year’s Code Gladiators event, an annual coding competition by TechGig, to give programmers the ability to work in their preferred programming language.

Here is the key takeaway –

– Python is clearly the programming language that rules the hearts of more than 50% of software programmers.

– The charm of Java is imperishable even when a lot of new programming languages are emerging every day. Java is the second most-preferred programming language among coders.

– C and C++ have proved that old is always gold. 12% of the poll respondents have voted for these.

– JavaScript was on quite a hype in recent year but still, it has to go a long way to top the preferred language list.

– Ruby, PHP, and C# are no more able to lure a large number of programmers.

– Even when backed by Apple, Swift has failed drastically to win the hearts of programmers.

To get a clear picture of the poll responses, please refer to the image below.

Top 6 programming languages you should learn that will get you job in Year 2020

As technology updates, there are new coding languages created every year to keep up with the rapid developments. Yes, there are specific roles and jobs that require you to learn a particular language, but most jobs and companies require a wide understanding and knowledge of languages.

Knowledge of multiple languages lets you apply for your preferred jobs, ask for a better pay pack from your employer, and overall turns you into a versatile developer. Here are some programming languages that you should learn in 2020.

JavaScript

For developers working on server-side and client-side programming, JavaScript is a popular coding language. What makes JavaScript a one-hit-wonder is its high speed, regular updates, and its compatibility with other programming languages.

Python

Easy to learn with a well-structured code, Python is the most popular coding language amongst the developers. Python is largely used in Machine Learning, web and desktop applications, and GUI applications. Since it offers a large variety of open-source libraries, application development becomes extremely easy with Python.

Kotlin
Declared by Android as its official language, Kotlin interoperates with Java, making Android development faster and easier. Due to its strong tooling support, Google will soon be promoting Kotlin more than Java. Most apps that run on Java are being rewritten in Kotlin and thus, it becomes essential to learn this language in 2020.

Java
Java has been the most popular programming language for server-side applications for almost 24 years now. Java is an object-oriented programming language and is the most preferred language for developing platform-independent and robust applications. Easier to learn and manage, this language requires no hard infrastructure and is easier to learn than other languages, such as C++ or C.

Go
A fairly new programming language, Go is the fastest growing language on GitHub, expected to replace languages like Java and C++. Owing to it solving issues like slow compilation, Go is the fifth most preferred language among developers, according to a survey by Stack Overflow.

C#
Even a basic knowledge of C# opens the doors of opportunities for you as a developer. Generally used for developing mobile apps, games, and enterprise software, the language was developed by Anders Hejlsberg led Microsoft and team. C# is a lot similar to Java and for people with basic knowledge about C, C++, or Java, learning C# can turn out as a cakewalk.

Having a thirst for learning as many programming languages as possible can be seen in every aspiring developer and coder. Learning languages according to their popularity and the career growth associated with them can help you reach the height of success you deserve, in the near future.

How To Remove Category From Your WordPress URLs

Categories are a very important feature of any WordPress website. They are very helpful to maintain or browse a website. They tell you what’s related to what and they give your visitors a good way to browse your site. But sometimes they are not serving your URL structures. Then what should you do?

Don’t worry guys we have are here to help. Today we are going to show how to fix this. Meanwhile you may also interested in 20 Reasons Why You Should Use WordPress For Your Website

So, there are different ways to achieve the same and we are going discuss them one by one.  Just remember that if you have a fresh WordPress installation then set up permalinks as you want. But if you are changing permalinks structure on a live website, do properly, redirect old URLs to new ones to avoid loses.

Remove Category from WordPress URLs with a Dot

  1. Go to Settings -> Permalinks.
  2. Select Custom Structure and put /%category%/%postname%/ there.
  3. Assign a dot to the Category base field and save the change.

The below picture will help you to understand.

Please remember that providing dot to Category base in settings is a must. As leaving it blank will use the default value. Visit a post after saving settings and check the URL, it won’t have the category base now. While this trick currently works, there’s no assurance that it will work in the future as well.

Remove Category From Your URLs with .htaccess

RewriteRule ^category/(.+)$ http://www.yourwebsite.com/$1 [R=301,L]

You can also add this code to your .htaccess file through FTP rather than using a dot. Add the code before the closing </IfModule> tag in the file and it will remove the category slug from WordPress permalink.

What if I am using Yoast SEO Plugin

The current version of SEO by Yoast plugin has discontinued the option of category removal from URLs. The last version had the option in the Advanced menu of plugin settings. The websites, who are using Yoast for a long time, still have their URLs without the category base.

If you’ve installed Yoast plugin on your fresh WordPress website, check the post URLs as well. While we’re not sure, the feature might be still there and working silently. Else there are other plugins as well to remove category slug.

Removing Category from Slug using a Plugin.

The plugin ‘Remove Category URL’ is much popular and has additional advantages too. You can try the plugin if your website is older than 6 months. It will redirect the old category permalinks to the new ones, which is better for SEO. Also, you don’t need to configure anything or modify a file. Get the WordPress official plugin URL here.

Although you can always write a function for the functionality it makes the site slower. At last, all easy methods to remove the category slug from URLs are there. Do let us know in the comment section which one do you prefer.

 

How to know That Your WordPress Site is Hacked

1.Sudden Drop in Website Traffic

If you look at your Google Analytics reports and see a sudden drop in traffic, then this could be a sign that your WordPress site is hacked.

There are many malware and trojans out there that hijack your website’s traffic and redirect it to spammy websites. Some of them don’t redirect logged in users which allows them to go unnoticed for a while.

Another reason for the sudden drop in traffic is Google’s safe browsing tool, which might be showing warnings to users regarding your website.
Each week, Google blacklists around 20,000 websites for malware and around 50,000 for phishing. That’s why every blogger and business owner needs to pay serious attention to their WordPress security.

You can check your website using the Google’s safe browsing tool to see your safety report.

2. Bad Links Added to Your Website

One of the most common signs among hacked WordPress sites is data injection. Hackers create a backdoor on your WordPress site which gives them access to modify your WordPress files and database.

Some of these hacks add links to spammy websites. Usually these links are added to the footer of your website, but they really could be any where. Deleting the links will not guarantee that they will not come back.

You will need to find and fix the backdoor used to inject this data into your website. See our guide on how to find and fix a backdoor in a hacked WordPress site.

3. Your Site’s Homepage is Defaced

This is probably the most obvious one as it is clearly visible on the homepage of your website. Most hacking attempts do not deface your site’s home page because they want to remain unnoticed for as long as possible.

However, some hackers may deface your website to announce that it has been hacked. Such hackers usually replace your homepage with their own message. Some hackers may even try to extort money from site owners.

4. You are Unable to Login to WordPress

If you are unable to login to your WordPress site, then there is a chance that hackers may have deleted your admin account from WordPress.

Since the account doesn’t exist, you would not be able to reset your password from the login page. There are other ways to add an admin account using phpMyAdmin or via FTP. However, your site will remain unsafe until you figure out how a hacker got into your website.

5. Suspicious User Accounts in WordPress

If your site is open to user registration, and you are not using any spam registration protection, then spam user accounts are just common spam that you can simply delete.

However, if you don’t remember allowing user registration and notice new user accounts in WordPress, then your site is probably hacked.

Usually the suspicious account will have administrator user role, and in some cases you may not be able to delete it from your WordPress admin area.

6. Unknown Files and Scripts on Your Server

If you’re using a site scanner plugin like Sucuri, then it will alert you when it finds an unknown file or script on your server.

You need to connect to your WordPress site using a FTP client. The most common place where you will find malicious files and scripts is the /wp-content/ folder.

Usually, these files are named like WordPress files to hide in plain sight. Deleting these files immediately will not guarantee that these files will not return. You will need to audit the security of your website specially file and directory structure.

7. Your Website is Often Slow or Unresponsive

All websites on internet can become victims of random denial of service attacks. These attacks use several hacked computers and servers from all over the world using fake ips. Sometimes they are just sending too many requests to your server, other times they are actively trying to break into your website.

Any such activity will make your website slow, unresponsive, and unavailable. You will need to check your server logs to see which ips are making too many requests and block them.

It is also possible that your WordPress site is just slow and not hacked. In that case, you need to follow our guide to boost WordPress speed and performance.

8. Unusual Activity in Server Logs

Server logs are plain text files stored on your web server. These files keep record of all errors occurring on your server as well as all your internet traffic.

You can access them from your WordPress hosting account’s cPanel dashboard under statistics.

These server logs can help you understand what’s going on when your WordPress site is under attack. They also contain all the ip addresses used to access your website which allows you to block suspicious ip addresses.

9. Failure to Send or Receive WordPress Emails

Hacked servers are commonly used for spam. Most WordPress hostingcompanies offer free email accounts with your hosting. Many WordPress site owners use their host’s mail servers to send WordPress emails.

If you are unable to send or recieve WordPress emails, then there is a chance that your mail server is hacked to send spam emails.

10. Suspicious Scheduled Tasks

Web servers allow users to set up cron jobs. These are scheduled tasks that you can add to your server. WordPress itself uses cron to setup scheduled tasks like publishing scheduled posts, deleting old comments from trash, and so on.

A hacker can exploit cron to run scheduled tasks on your server without you knowing it.

11. Hijacked Search Results

If the search results from your website show incorrect title or meta description, then this is a sign that your WordPress site is hacked.

Looking at your WordPress site, you will still see the correct title and description. The hacker has again exploited a backdoor to inject malicious code which modifies your site data in a way that it is visible only to search engines.

12. Popups or Pop Under Ads on Your Website

These types of hacks are trying to make money by hijacking your website’s traffic and showing them their own spam ads for illegal websites. These popups do not appear for logged in visitors or visitors accessing a website directly.

They only appear to the users visiting from search engines. Pop under ads open in new window and remain unnoticeable by users.

4 Reasons Why Java is Still #1

It’s the end of 2016, which means that we’ve now finished the “20 Years of Java” celebrations. Actually, although the announcement about Java (and the HotJava browser, which did not enjoy quite the same success) was made publicly on May 23rd, 1995, the first official release of the JDK was on January 23rd, 1996. You could justifiably claim that Java is only now turning twenty. There have been numerous retrospectives on Java, but I thought what would be interesting to look at is the success of Java in its twentieth year.

It’s difficult to accurately measure the popularity of programming languages, but one of the generally accepted surveys is the TIOBE index. This tracks language references through a variety of search engines as well as Google Blogs, Wikipedia and even YouTube. (In writing this entry I learnt something new, which is that TIOBE is actually an acronym for “The Importance Of Being Ernest,” the play by Oscar Wilde. Not sure what that has to do with programming languages, but there you go.).

Looking back at the results over the last fifteen years Java has consistently been either number one or two. Java has jostled for position with C, which was consistently the most popular before Java was launched (how things change: back in 1986 Lisp was number two and Ada was number three). TIOBE have also just announced that Java is their “Programming Language of the Year” for 2015. A great achievement, especially as it was also given the award ten years ago.

As another measure of popularity, Oracle frequently likes to quote the statistic that there are nine million Java developers in the world. If you want a chuckle check out this JAXenter article, which gives some details of how they got to this number. Regardless of the details I think we can all agree there are literally millions of Java developers around the world.

The question to ask is why does Java continue to be so popular? I think there are a number of reasons for this; let’s just highlight four:

1. Practicality
James Gosling has described Java as a “blue collar” programming language. It was designed to allow developers to get their job done with the minimum of fuss, whilst still enabling developers to pick up someone else’s (or even their own) code at a later date and understand what it’s supposed to do. Sure, you can write unreadable code in Java, just as you can in any language, but with good coding conventions it is more readable than many other languages.

2. Backwards compatibility
Sun and subsequently Oracle have made huge efforts to ensure that code written for one version of Java will continue to run unchanged on newer versions. Although this hasn’t always been the case (assertions in Java SE 1.4, enumerations in Java SE 5) and it has sometimes led to implementations that could have been better without compatibility (generics) it is a very compelling feature for developers. There’s nothing worse than taking code that works and having to change it to make it work on a newer version of the platform. That’s just wasted time.

3. Scalability/Performance/Reliability
With over twenty years and thousands of man-years of development, Java is a rock-solid platform that performs on a level that can match or even exceed that of native code (thanks to some of the optimisations made by the JVM using dynamic rather than static code analysis). When it comes to scalability, just look at some of the large enterprises using Java: Twitter (who moved off Ruby-on-Rails to the JVM because RoR wouldn’t scale), Spotify, Facebook, Salesforce, eBay and, of course, Oracle. Hadoop, Cassandra and Spark, the basis of most big data projects, are either written in Java or Scala and run on the JVM. If you want scalability and performance, Java and the JVM is an obvious choice.

4. Freshness
To me this is the big one. Looking at the TIOBE graph there is a significant upswing in Java popularity since October 2014, which is shortly after the launch of JDK 8. JDK 8 was a big change for developers using Java because of the introduction of Lambda expressions and the streams API. Suddenly Java developers could do things in a more functional way without having to learn a whole new language like Scala. These features also make it potentially much simpler to take advantage of multi-core/multi-processor machines without having to write lots of complex and potentially error prone multi-threaded code. With project Jigsaw scheduled for delivery in JDK 9 we’ll see modularity make big enterprise applications much easier to build, deploy and maintain. There are already plans for new language features, like value types, in JDK 10.

I look forward to seeing Java being awarded Programming Language of the Year in another ten years’ time.

15 Common WordPress Errors With Solutions

We all love WordPress, but sometimes it can drive us crazy! Whether its the dreaded white screen of death, an unknown PHP error coming from a plugin or server issues causing our site to crash, it’s never fun. But whenever WordPress decides to act up, don’t worry yourself at all – there is always a solution as you’re going to learn in this post. Get ready to have fun because you and me are going to solve 15 common WordPress errors. So without further ado, let’s start with the most common WordPress error.

1. Internal Server Error

Almost every WordPress user I know has encountered the internal server error at least once. It’s quite annoying because, unlike many common WordPress errors, the internal server error does not tell you what you need to fix. This can be frustrating since the error can be a result of several reasons as you’ll see below.

Internal Server Error Causes:

Some of the possible causes for the Internal Server error are the following:

  • Corrupted plugin functions
  • Corrupted theme functions
  • Corrupted .htaccess
  • Exhausted PHP memory limit

Internal Server Error Solutions:

This error can easily send a beginner into panic mode but worry not, here are some solutions.

a. Edit .htaccess file
Since the internal server error is mainly a result of a corrupted .htaccess file, login into your WordPress root directory via File Manager (or FTP) and rename your .htaccess file to .htaccess.old. Refresh your browser to see if you solved the error. If the error disappeared, go to Settings -> Permalinks and click on the Save Changes button to reset your .htacess and flush write rules. If this does not work, perhaps you need to check your plugins.

b. Deactivate all plugins
A plugin you just installed could be the problem, but that’s great because you know what to uninstall or delete. Other times, this WordPress error may crop up as a result of an old plugin (or several plugins that are incompatible). You won’t know for sure if the problem is your plugins unless you deactivate the plugins.

c. Change Themes
If the problem was not the plugins, perhaps your theme is. Switch to the Twenty Twelve theme and reload your website. If you’re still seeing the error, perhaps you need to upgrade some of your WordPress folders.

d. Repair the wp-admin and wp-includes folders
By this point, you’ve probably solved this WordPress error. But if this is not the case, try replacing your wp-admin and wp-includes folders with newer ones from a fresh WordPress install.

e. Increase your PHP memory Limit
If everything else fails, you have to get down and dirty and mess with a few things on your server. The internal server error can be frustrating, so I don’t expect anything to stop you. Here is a great guide on increasing PHP memory by the good guys at WordPress.If you like taking shortcuts, fire up your code editor and create a text file named php.ini. Inside this file, add this code:

memory=64MB

Save and upload the file to the /wp-admin/ folder. If increasing your PHP memory solves the problem, talk to your web host to put a finger on what is exhausting your memory. It could be anything from broken theme functions to poorly designed plugins among other things. Your web host will furnish you with information from your server logs.

2. Auto-Update Failed

WordPress now comes with an auto-update feature that takes care of security, minor bugs and such like things. The feature is pure genius at work. It’s great but sometimes it fails. Considering the auto-update feature does not require any human input, how do you tell when the update fails? You will see one of the following:

  • A PHP error message
  • A blank white screen (Also known as the white screen of death – WSOD)
  • A warning that says the update failed

Update Failed Causes:

  • Internet connection problems during auto-update
  • Broken connection with main WordPress files
  • Incorrect file permissions

Update Failed Solution:

Update your WordPress website manually. If you don’t know where to start, please check out this Updating WordPress – Manual Update post at WordPress Codex.

3. Syntax WordPress Error

My analysis showed that this is a very common WordPress error among people who add code snippets to their WordPress sites. When you encounter this error, you will usually notice something like:

Parse error - syntax error, unexpected $end in /public_html/your_site/wp-content/themes/your-theme/functions.php on line 38

This error needn’t stress you out for it tells you exactly where to find the problem.

Syntax Error Cause:

Many a time, the syntax error is caused by some missing or unexpected character(s) in the problematic file. Most of the time caused by someone less experienced trying to edit the code in a theme or plugin but it could also occur when you’ve installed a new theme or plugin that contains the error.

Syntax Error Solutions:

a. Educate yourself on pasting code snippets into WordPress
As a WordPress beginner, you have a long (but fun) way to go as far as learning WordPress development is concerned. There is no hurry though, so take your time. If you encountered this WordPress error after adding code snippets into your WordPress website, you need to learn more about pasting code snippets into WordPress or you will cause more damage.

b. Fix the affected code
If this WordPress error occurred after updating a plugin or pasting some code from the web, you know exactly where to look. The problem is you can’t fix your code via Appearance -> Editor (or Plugins -> Editor) since the syntax error locks you out of your website.This doesn’t auger well with most beginners, so they freak out. But don’t be, you can easily edit your WordPress files via FTP or File Manager in your cPanel. Find the affected file and fix the code either by removing it or rewriting it correctly.

c. Try a different theme or plugin
If the error began when you activated a new theme or plugin then it’s most likely an error in that theme or plugin. So you might want to find an alternative one or contact the developer so they can fix the error. In some cases you might not be able to log into WordPress in which case you might have to delete the plugin or theme via FTP.

4. Error Establishing A Database Connection

Of the common WordPress errors, this is pretty self-explanatory. The error lets you know something broke the connection to your WordPress database.

Database Establishing Error Causes:

  • wp-config.php error
  • Problems with your hosting provider
  • You’ve been hacked! And here I was thinking this particular WordPress error is no big deal.

Database Establishing Error Solutions:

a. Edit your wp-config.php file
Access your wp-config.php file via File Manager or FTP and confirm if the database name, host, username and password are correct. If you’re stuck or don’t know what to do first, consider teaching yourself a few things about editing wp-config.php files.

b. Fix issues with your web host
If your wp-config.php is looking right and this WordPress error is still a problem, you should talk to your WordPress hosting provider. They will be able to tell you whether the server is down or your database was shut down for exceeding its quota. If they tell you everything looks good on their end, it is time to implement some WordPress security on your site.

c. Scan your website to determine if it’s compromised
Hackers don’t sleep. No, they don’t. You can fall victim to a hacker anytime, especially if you don’t know how to secure your WordPress website. To ensure your website hasn’t been hacked, scan it using a tool such as Sucuri Sitecheck. If you get bad news, just stay calm and check out this my site was hacked post over at WordPress Codex.

5. Briefly Unavailable For Scheduled Maintenance Error

1, 2, 3… Break time over, let’s try and understand why you’re getting this not-so-brief WordPress error. Oh, by the way, it shouldn’t trouble you at all since it’s quite easy to solve. But first, let’s look at the causes.

Scheduled Maintenance Error Causes:

  • Your WordPress update failed because some things are beyond your control
  • The .maintenance file was not deleted after the update for one reason or another

Scheduled Maintenance Error Solutions:

Are you having fun? Do you feel you can solve the above errors if/when they crop up? If you can, let’s move on to WordPress error number six (6).

6. Email Password Retrieval Does Not Work

The main cause for this is forgetfulness. Perhaps you should try some memory enhancing diet and exercises ? Kidding aside…we all forget even the most important of things such as passwords, usernames and email addresses? As it were, you forgot your password and were forced to use the “Lost Your Password” page. The problem is you never received the reset link via email. You decide to try again after checking your spam folder but still, no link.

Password Retrieval Error Cause:

For some reason your WordPress installation just won’t send you the link…the cause could be a mystery! But the main problem isn’t why you aren’t receiving your password but how can you actually reset your password easily and quickly? We’ll, below are a couple solutions.

Password Retrieval Error Solutions:

a. Reset your WordPress via phpMyAdmin
This is the more technical of the two solutions I’ll present you with.

  1. Login into your cPanel and navigate to phpMyAdmin under Databases
  2. Select your database (Your web host will help you can’t find your database)
  3. Navigate to wp_users and click on Browse
  4. Go to your username and click on Edit
  5. Enter a new value (your new password) into user_pass
  6. Choose MD5 from the drop-down menu that’s under Function
  7. Click Go button at the bottom to save your changes

b. Edit your functions.php file
And now for a slightly less technical method. The functions.php file is responsible for many a thing on your WordPress website. If your email password retrieval is giving you a hard time:

  1. Navigate to “../wp-content/themes/your_live_theme/” using FTP or File Manager and download the functions.php file.
  2. Open the file in your code editor and add the following code:
    wp_set_password('DesiredNewPassword', 1);

    Replace DesiredNewPassword with your new passowrd. Number one (1) in the code is your user ID number in the wp_users table.

  3. Save and upload functions.php
  4. When you can login into your website, eliminate the code (download functions.php, delete code and upload it back to your theme folder)

7. HTTP Error 403 – Forbidden

If you get “You are not authorized to view this page. (403 error)” message when trying to login into your WordPress website, you’ve encountered one of the most common WordPress errors – the HTTP Error 403.

HTTP 403 Error Cause:

  • Problems with Directory Indexes if your blog is hosted on a Windows server

HTTP 403 Error Solution:

Add index.php to the Directory Indexes. You can solve this WordPress error easily by adding index.php to the Directory Indexes. Just go to your Control Panel -> Web Options -> Directory Indexes and add index.php.

8. Sidebar Below Content Error

I was quite perplexed when I first encountered this WordPress error. I was so convinced my theme was completely toast that I contemplated changing it altogether. However, I summoned Google spiders and a few seconds later, I realized this was just one of the most common WordPress errors. This realization took away all the worrying. A few more clicks and scrolls, I found the causes.

Sidebar Below Content Error Causes:

  • HTML errors – sometimes you might forget to close a few div elements
  • CSS errors – Other times, you might accidentally use disproportionate widths that end up messing up your entire layout

Sidebar Below Content Error Solutions:

a. Close all div elements
In most cases, pen div elements are responsible for this error. Close all open div elements and eliminate extra div elements that pushes the sidebar outside the wrap element. Use a tool such as W3 Validator to check if your HTML code could be the cause of this error.

b. Fix your CSS
Improper width ratios will mess up your layout in turn placing your sidebar below the content area. You need to keep things in proportion. For instance, if your main container is 920px in width, allocate 620px to your content and 250px to your sidebar. Leave the remaining 50px to margins and what not. Just keep things proportional. Another thing, be careful when using the float property.

9. WordPress Admin Displaying Improperly

Have you ever logged into WordPress only to find your WP Admin Dashboard all over the place? What I mean it the links are arranged improperly because the dashboard is rendering without CSS.

Admin Display Error Causes:

  • Proxy and Firewalls that black CSS files
  • Corrupted admin menu plugins

Admin Display Error Solutions:

a. Ensure you’re not behind a proxy or firewall
If you’re behind a proxy or firewall (maybe you’re accessing your website from work), try accessing your dashboard elsewhere without proxies or firewalls. You can also try purging your firewall and proxy cache and see if that works.

b. Update/Deactivate admin menu plugins
If you are getting this error after installing a plugin such as Lighter Menus and Admin Drop Down Menu for your admin menu , try updating (re-installing) it. If this WordPress error persists, deactivate the plugin.

10. Connection Timed Out Error

If your WordPress website lives on an overburdened shared server, you will see this WordPress error more often than not. The following problems are responsible for this error.

Time Out Error Causes:

  • Heavy plugins
  • Theme function errors
  • Exhausted PHP memory limit

Time Out Error Solutions:

  • Deactivate the plugins you installed recently or reset your plugins folder
  • Increase your PHP memory limit
  • Switch to the Twenty Twelve theme to determine if the problem lies in your theme

11. Warning: Cannot Modify Header Information – Header Already Sent By

This is yet another common WordPress error that troubles many WordPress users, especially beginners. If you do encounter this error, you will usually see something similar to this:

Warning: Cannot modify header information - Header already sent by (Output started at /blog/wp-config.php:34)

That last part (Output started at /blog/wp-config.php:34) tells you exactly where your error is stemming from.

Cannot Modify Header Error Cause:

  • Presence of white (blank) spaces in the affected file (in our case above, that would be wp-config.php)

Cannot Modify Header Error Solution:

You’ll need to remove the blank spaces. To get rid of this WordPress error:

  1. Download the affected file (e.g. wp-config.php) via File Manager or FTP
  2. Open the file in your favorite editor (e.g. Notepad++)
  3. Remove all spaces before the first <?php (The first <?php should be in the first line)
  4. Remove all spaces after the closing ?>
  5. Save your file

12. The Plugin Won’t Delete Error

Some plugins (and you want to stay clear of such plugins) come with hidden files that become a pain in the neck when you want to delete the plugin. This is a good reason to only download plugins (and themes for that matter) from reputable websites you trust. The problem is you can’t delete the plugin via WordPress Admin and even if you delete the plugin’s folder via File Manager (or FTP), the plugin still appears. Magic? No. Here is the…

Delete Plugin Error Cause:

  • The plugin came with hidden or nested files

Delete Plugin Error Solutions:

a. Obtain plugins from trusted sources
Don’t go picking up plugins from all over the place. If you would like to purchase a well-coded plugin, go with reputable sources such as CodeCanyon or WPExplorer. If you’re after free plugins, check out WordPress plugin repository. Prevention is better than cure, right?

b. Deleting the plugin using Secure Shell (SSH)
This solution will only work if you have SSH access to your WordPress site. This is what to do. Login into your blog using SSH and navigate to “../wp-content/plugins/“. Use the Is -aI command to list all your folders, and finally delete the problematic plugin using the rm (folder name) command.

13. WordPress Posts Returning 404 Error

It is frustrating to access every part of your WordPress website but the posts. Every time you visit a single post, you get a 404 error page – and it’s a great pain because posts are the bones and flesh of any WordPress blog.

404 Error Page Cause:

  • Problem with your permalink settings

404 Error Page Solutions:

a. Save your permalinks
This WordPress error is easy to resolve so don’t panic – you readers will be able to read your posts in no time. Just go to Settings -> Permalinks and hit the Save Changes button.

b. Fix your .htaccess file
If fixing your permalinks does not solve this error, it is time to edit your .htaccess file manually. Navigate to your WordPress root directory and download the .htaccess file. If it doesn’t exists, create a blank text file and save it as .htaccess. Add the following code to the .htaccess file:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Save and upload the .htaccess to the same location.

14. WordPress Memory Exhausted Error

You know you’ve encountered this error when you see the white screen of death or this error message:

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 2348617 bytes) in /home/username/public_html/your_site/wp-includes/plugins.php on line 36

Memory Exhausted Error Cause:

  • A plugin or script is eating up your memory

Memory Exhausted Error Solution:

The easiest answer is to simply increase your allocated memory. To do this, open your wp-config.php file (which is found in your website’s root directory) and add the following code:

define ('wp_memory_limit', '64M');
NOTE: You don’t have to download the file (or any other file) when using the File Manager. You can edit the files right in the File Manager. Talk to your web host if you cannot find the edit option.

15. Fatal Error Undefined Function is_network_admin

I’ve decided to end this post with a simple but very common WordPress error.

Undefined Function is_network_admin Fatal Error Cause:

  • Failed auto-update

Undefined Function is_network_admin Fatal ErrorSolution:

Further Assistance/Resources

If we weren’t able to solve your error or your specific error wasn’t mentioned in this post you can find a list of really great resources below with some more solutions to common WordPress errors and their fixes. If you still can’t find a solution you could always try contacting your webhost to see if they can assist you! WPEngine has been there for us on more then one occasion when we couldn’t fix the issue ourselves!

Conclusion

Here we are. We just revealed 15 most common WordPress errors and showed you how to solve them. We hope this post will come in handy when you encounter a WordPress error. Bookmark this resource (you will most likely need it at some point – although we hope you don’t) and please tell us how you fix common WordPress errors on your website, especially if you have a better and quicker solution to one of the common WordPress errors.