Pros and Cons of Python programming that every beginner must know

Python, developed by Guido van Rossum, is considered one of the major programming languages in the world that is highly popular among developers. It is a great open-source platform that covers all the major requirements of the developers that include backend web development.

However, it is not as simple to work on Python as one would like to believe. Just like other platforms or programming languages, Python has its own set of benefits and challenges that makes it a great platform for development.

Here are the major benefits of Python as the programming language followed by its challenges.

Pros of Python

  1. Beginner-friendly – Python is an ideal platform for beginners since it is easy to learn and understand. It is a great programming language that doesn’t include a lot of technicalities or big problems cause of small mistakes. It includes a few complexities that can be tried by developers with zero background in coding.
  2. Large Community – Python has a large community of developers, professionals, and students helping each other to bring out the best in the platforms. It is a great platform for beginners since they will have all the help from knowledgeable developers with years of experience.
  3. Flexibility – Python is an extremely flexible language that makes it ideal with minimum complexities and helps in keeping the worries of developers aside. It also is flexible enough for learners, developers, and users that is easy to take actions and build new features as the dynamically-types languages.
  4. Integrated Development Environment – This is another aspect that makes Python an ideal platform since it includes the IDEs and Integrated interactive shell. It makes it easier to code and run in a single place. This makes it easy for auto-complete, syntax highlighting, and automatic datatype assignment.

Cons of Python

  1. Work Environment – It is not easy to fulfill or practice Python without a work environment. However, it is essential to set up the environment which is not easy at all. Some many troubles or issues can come up while setting up such environments that can affect the programming experience for beginners. Hence, it is best to go for Python IDEs and then set up the environment using official guides.
  2. Compiler Error – This is a real thing if you don’t know how to use the IDEs properly. It can demotivate the developers while executing the code. However, Python has inbuilt features like a shell script that helps in accessing the code in the less complex process.
  3. Coding – If you are a beginner, then the worst thing that will happen is that you have no idea where to begin from. What you will code to learn the platform is something that all the developers struggle with. Ti is essential to find something that can be easy and interesting to code that can give a better understanding of what to do and what not to do while starting the first code.

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.