Learnit Training
Link

What's Django? And what can you do with it?

Als je vaker met Python hebt gewerkt, zal de naam Django je misschien wel bekend voorkomen. Django is namelijk het grootste open source web framework dat is geschreven in Python. Dit framework is relatief makkelijk in gebruik, flexibel en daarnaast zeer betrouwbaar voor bijvoorbeeld het ontwikkelen van applicaties. Dit heeft ervoor gezorgd dat Django één van de populairste frameworks is voor het maken van ondere andere webapplicaties, websites en online platforms. Lees deze blog om erachter te komen waarvoor je Django allemaal kan gebruiken.

Django is in 2003 ontwikkeld door Adrian Holovaty en Simon Willison en het framework werd voor het eerst vrijgegeven als een open source project in 2005. Drie jaar later werd de Django Software Foundation opgericht om Django verder te kunnen blijven ontwikkelen. Inmiddels is Django uitgegroeid tot een uitermate populair framework in combinatie met Python. Wist je dat zelfs Google gebruik maakt van dit framework? Ook populaire social media kanalen als Instagram en Pinterest gebruiken Django voor hun websites en applicaties!

Wat is Django?

Kortgezegd bestaat Django uit een set van bibliotheken die ervoor zorgen dat jij als programmeur relatief snel en eenvoudig een webapplicatie kan bouwen. Je kan hierbij denken aan functies als: gegevens in een relationele database opslaan, mails versturen en webpagina’s genereren. Daarnaast beschikt Django over een handige admin interface. Zo kan een programmeur die Django gebruikt er bijvoorbeeld voor zorgen dat via de ingebouwde admin interface de beheerder van een systeem gemakkelijk gegevens kan aanpassen of bewerken. Ideaal om ook iemand anders naast de programmeur aanpassingen te kunnen laten doen in het systeem. Andere sterke punten van het Django framework in ondersteuning zijn onder andere authenticatie, templates voor formulieren en het uploaden van bestanden. Door de ontwikkeling van talloze packages en het volwassen ecosysteem, wordt Django continue verbeterd door de ‘Django community’. Ben je benieuwd welke packages er allemaal op de markt zijn? Neemt dan eens een kijkje op djangopackages.org. Een belangrijk element van Django is al genoemd maar verdient het om nogmaals benadrukt te worden. Django gebruikt Python: de beste en makkelijkste programmeertaal ter wereld zodat je snel een goede web applicatie of site kunt maken.

Wat kan je met Django?

Django is uitermate geschikt voor het opzetten van:

  • CRM-systemen
  • CMS’en
  • Software voor communicatie en samenwerking
  • Online reserverings- en afspraken systemen
  • Vastgoedmanagement systemen
  • Documentmanagement systemen

Training Django

Wist je dat Learnit binnenkort een gratis webinar over Django aanbiedt? In dit webinar van een half uur zal trainer André jou alles vertellen over wat je met Django kan en waarom Django gemakkelijk in gebruik is. Ontvang bovendien een aantal praktische tips over het programmeren in Django. Meld je snel aan voor dit gratis webinar, door hier te klikken. Daarnaast biedt Learnit een training Django programmeren aan, die is bedoeld voor developers die het Django framework zouden willen leren gebruiken om webapplicaties te ontwikkelen in Python. Geïnteresseerd in deze training? Klik dan hier voor meer informatie.

Link

Webscraping with Python: data at your fingertips

Everyone makes use of it: websites where you can compare different products or services with each other. Do you want to book a hotel? Click on the arrival date and fill in the destination on a site like expedia.nl that compares different hotels and prices of providers. Looking for new sneakers? Type in sneakers on beslist.nl and enter for example what size you have and what color sneakers you are looking for. This way you will be able to find your perfect sneakers. Handy right? The technique that makes it possible to search this fast is webscraping.

What is webscraping?

Webscraping allows people to retrieve important data from a site or allows them to search for certain features on a website. Optionally, data can be retrieved or stored automatically and periodically. Website administrators can use various programming languages to enable webscraping, including Python. The 'Beautiful Soup' module is very useful for webscraping, and 'numphy' and 'pandas' make analysis a lot easier. Webscraping ensures that visitors to, for example, a comparison website can easily and quickly find the information they need. This makes it handy for websites such as expedia.nl, which actually just make smart use of the data from other websites. Websites like expedia.nl attract customers because they are able to bundle and display data from other websites in a smart way.

Webinar webscraping and Python data analysis course

Are you interested in webscraping and would you like to follow a short introduction to webinar about it? Then please here on for the free webinar Webscraping with Python, which takes place on Wednesday 23 September. Are you interested in other data analyses in Python besides webscraping? If so, please write here for our 3-day Python data analysis course. During this course you will learn how data can lead to useful insights and you will also learn how to display data in the best way. In addition, you will learn how to explain and predict the behaviour of your target group using Python. As a result, you will be better able to steer your business strategy in a targeted manner using insights gained from data analysis.

Advantages webscraping

The most important advantages of webscraping at a glance:

  • Automatically retrieve important data from a website
  • Simple way to get more insights through data analysis
  • Easily and quickly store usable data

In short: webscraping is useful for anyone who wants to learn how to get the most out of processing data from your own website!

Link

Practical examples of the Python programming language

In his previous blog trainer André showed that the Python programming language is used all around us. From the photos taken by telescopes to Netflix and Dropbox, Python often plays an important role. In this blog André will show by means of examples how you can use Python in practice.

Excel

Modify data in an excel file, add new columns, detect a trend in a series of data, extract errors from data and fill in missing data. You can do all this very easily and quickly with a Python program. In addition, you can save the settings so you can easily reuse it in the same way.

Python packages

Millions of people around the world use Python, a free language with many packages. For fast and efficient data editing, the packages numpy, pandas and pyplot are important. With numpy you can quickly edit data, pandas is very suitable for editing tables and with pyplot you can create graphs of the data.

Imagine that a long list of numbers has to be multiplied by a number. You do that in numpy as shown below.

You don't have to multiply every number by 20. It happens all at once.

As you can see below, you can also easily add up lists of numbers.

With pandas you can extract data from an excel file, edit it and write it back again. Let's take as an example a small excel file with profit and loss points in a competition.

We read this data with pandas.

Then we add up the points with pandas.

After this we can write data back to the excel file.

The file looks like this now.

In the last example you can see that it is also easy to make a graph of the table.

The conclusion we can draw from these examples is that you can use Python in many ways to make your work a lot easier. The examples are of course only a small part of the different possibilities Python offers.

Has this blog aroused your interest? Then take a look back at the free webinar of 16 January. André discussed in half an hour how easy it is to use Python in practice. Look him back here!

Link

Python is everywhere

In his previous blog trainer André showed that in Python you can quickly create a program that does useful things: read and analyse a file, edit data and then make a graph of it. In this blog the trainer shows where Python is used.

Black hole

The picture above shows a black hole. The image was created by eight telescopes – scattered throughout the world during seventh days in 2017. The telescopes received data from a black hole that was removed from us at 55 million light years.

In the processing of those dates, Python came to look around the corner. Freely accessible and available modules of the programming language, such as Numpy and pandas helped to display the black hole. Click here for more information.

Netflix

Also streaming service Netflix uses Python. The company uses the programming language to improve the streaming of videos. Python captures which network equipment is active. As a result, the language registers changes in the network, to analyse whether a device is functioning properly.

Furthermore, the streaming service uses Python to ensure that the geographical storage of content is organized in such a way that a video is available to a user as quickly as possible. In this techblog about Netflix you will find more applications for which Python is used.

Dropbox

The popular Dropbox tool uses Python for almost all its features: storage, sharing, Synchronisiatie, permission management and more. The company bought in 2012 Guido van Rossum, creator of Python, away at Google. As a result, Dropbox has since been the best conceivable support in the field of Python.

Frameworks

For Python, several webframeworks have been written. One of the most popular is Django. This framework, originally written for a well-known American newspaper, has become a universally applicable framework.

With Django you simply create a website. Python makes it easy to write code rules and Django will make sure you get structure without much effort. This allows you to maintain your website and expand it for example.

Screenshot of www.nationalgeographic.com, a website built with Django.

A very eye-catching application of Python is the contribution that the programming language has to artificial intelligence (AI). Google is very active in the field of AI and uses Python to control the AI network.

The Python package developed by the company is called Pytorch. Setting up an AI network is not easy. Many other ways of setting up such a network make it necessary to pre-record a large amount of data. Pytorch allows you to set up the network while creating the AI.

In short: More and more companies and organizations use Python, because the language is easy to learn and because there are many modules for Python available to do what they consider important. So if you're interested in your own future, you'll be immersed in Python.

Free webinar

André gave a webinar on Python on 16 July 2019. "I'm going to show how easy Python is to use," said the trainer. Look at him back here.

Link

Python: The language for everyone

Python is a programming language in which everyone can learn programming quickly. With this language you can easily create a small program, develop a website, or create an application. Python is also widely used for artificial intelligence, or for analyzing data. In short Python is everywhere.

It makes sense to know that Python was conceived in 1989 by a Dutchman, Guido van Rossum. Van Rossum worked at the Centre for Mathematics and Informatics in Amsterdam and wanted to write programs in a simple way for a project that was carried out at the Institute.

Growing interest

Although the language was initially only used by a handful of people, the interest increased rapidly. By the expert guidance of Van Rossum the use was only increased. The Dutch polder mentality has ensured that the Python user group is friendly and open, for anyone who wants to work with Python.

Currently, there are thousands of Python files, called modules, that allow the user to write the software he needs. So it's easy in Python to open a text file, to count what words appear in it and how often. Then, in a few Python phrases, the user can extract the most common words and create a chart of them.

Analyzing with Python

Also downloading data from a website can be done in a few Python rules. Python is widely used for data analysis. For example, a company wants to make an analysis of the usefulness of the ads it places on different local media.

To do this, a link must be made between the area where the media appears and the sales in the shops there on the spot. Also now Python can help. In a few lines there is an analysis, and if you want also graphs. If it is useful to put the data in an EXCEL spreadsheet, it costs only one Python rules.

Also for scientific arithmetic and artificial intelligence much use is made of Python. All artificial intelligence platforms are designed to be used by Python and because the language is so easy to learn, many scientists and engineers use it.

The company Tiobe keeps track of which language is widely used. In This ranking, Python is in third place. Most likely Python is going to rise even further.

The conclusion is that when you need programming in your job, Python is the language to learn. In A few days time you can write small but useful programs for example to analyze website data or to monitor the use of network equipment.

Link

Creating dynamic Web sites with JavaScript

JavaScript is a widely used scripting language that is mainly applied to create dynamic Web pages. It is, in other words, a language that allows interaction with visitors and users of a website. JavaScript is used through a browser and is also read in that way (just like CSS and HTML). The code that is present in JavaScript is executed by the browser and it is basically plain text. In this case, a Word-processing tool is not possible to use! However, Editors such as Adobe Dreamweaver, Gedit, or Notepad + + can read this unique code.

The many features of JavaScript

Any Web page that you can interact with, for example, a menu, uses JavaScript. Pages that customize themselves without having to do something for yourself or Instant Search on Google, where all possible search results already appear before you press search: All are examples of applications where JavaScript is used Is. It is therefore a scripting language that is widely applicable.

With this language everything can make even real 3D games (although this is of course a very complicated process)! However, smaller assignments such as building a Mario game, an automatic monitoring website or customizing ads are much simpler to do with JavaScript.

Some important tips when using JavaScript

In managing, writing, and customizing JavaScript, many elements are used to write the code language. The following overview gives some tips to get more out of javascript:

1. Use = = =, not = =

In JavaScript, two ´ equality operators are ´ available, both of which are made up of equality signs, exclamation marks and dashes. It is advisable to use the triple as you will not get any problems when working with different types. If you use = = and! = You will get problems, because the JavaScript engine automatically converts those values.

2. Avoid ' eval '

The ' eval ' function in JavaScript gives you access to the JavaScript compiler as a user. So if you enter a string as a parameter, the compiler will execute it as a JavaScript language, making its execution much slower (and more dangerous)!

3. Place your script at the bottom of the page

When you develop a webpage you want it to load as soon as possible for every visitor. However, if you add an external script, the browser cannot load any further before the complete file is loaded. The consequence? The user needs to wait longer on his page!

If you use JS files with extra functionality (e.g. event handlers for certain buttons), you should load them at the bottom of the page, before the end of the body tag.

More about JavaScript

JavaScript is an indispensable and important language for developing Web pages where visitors have something to do. However, the world of scripting languages is not a simple one, precisely because there are so many different ways to make the visitor experience of a website unique. The more you know here as a beginner, the better you can apply that knowledge to get the best out of your website!

In Our three -day training you get to know JavaScript. The training is a solid foundation for further training on JavaScript-based techniques and toolkits, such as jQuery. Under the guidance of professional trainers you can get started with JavaScript, so that it does not remain a theoretical concept, but in practice you will learn what unique results you achieve with this scripting language.

Link

You can learn programming!

Visit any vacancy site and you will see it immediately: there is an unprecedented demand for programmers. If you are looking for a paid job with excellent perspectives for the future, learning programming is a must. Even for jobs in which you don't directly program yourself, a programming language is an excellent addition to your CV. However, there are numerous programming languages, so where can you start best now? And which languages are interesting for the future? We made an overview of the 10 most important programming languages. Languages where you can also directly follow a training course: let those jobs come!

Java

Java was for years the most-requested programming language for employers. Although this has recently been outpaced by SQL, it is still very popular. Java is the standard for many enterprise software, is used by more than 9 million developers and is used to control more than 7 billion (!) devices worldwide. Its popularity owes the programming language mainly to the simplicity and readability of the code, which makes it a good starting point for novice programmers. Also, one of the basics of Java is the compatibility that ensures that older applications continue to work.

SQL

You'll find SQL everywhere. Database technologies like MySQL, PostgreSQL and Microsoft SQL Keep banks, universities, hospitals, small and large companies running. It is not exaggerated to say that every computer and person with access to technology somehow comes into contact with SQL. For example, iOS and Android devices have access to SQLite, a SQL database, and numerous mobile applications that use SQL directly.

C

C originates from the early years 70, when it was developed as a generic, general programming language. As one of the oldest programming languages available, C gives us the building blocks for other popular languages such as C++, Java, JavaScript and Python. C itself is mainly used for operating systems and industrial applications.

C++

C is an object-oriented programming language based on C. Since the language in the years 80 was developed it has been used to develop Adobe and Microsoft applications, MongoDB databases and large portions of Mac OS/X operating system. It is considered by many to be the best programming language to learn for applications where performance is of great importance, such as games or audio/videobewerking.

iOS/Objective C/Swift

Until 2014, objective C was the programming language used by the Apple operating system. It plays a role in Apple's OS X, iOS and its Apis. For a long time it was the language in which you had to write iPhone applications as a programmer, until Apple came up with its own programming language a few years ago: Swift. Swift seems to be very much like C++ and its predecessor objective C, but it is easier for most programmers to learn.

Javascript

JavaScript – not to be confused with Java – is widely used to add interactivity to websites and is supported by all larger internet browsers. Not only can it be used for simple functionality like popups or simple games, it also forms the basis for Node. JS – A server technology that is widely used in real-time communication.

PHP

PHP was in fact never meant as a programming language. The Danish-Canadian programmer Rasmus Lerdorf developed PHP in 1994 as a series of tools that enabled him to manage his personal website (Personal homepage). Today we changed the meaning of the abbreviation to Hyper test Pre-Processor and used the language on servers to dynamically generate HTML websites. PHP is easy to learn, but in addition possesses much advanced functionality that is of great value for experienced programmers.

HTML/CSS

HTML forms the basis for Web pages. This does the programming language by actually setting a structure that can be extended or modified by other languages. For example, JavaScript can be used to add advanced interactivity, and CSS influences the presentation, formatting, and layout of Web pages. Although PHP can generate HTML from a server, knowledge of HTML and CSS for Web developers is an absolute must.

Python

Python is a server-side programming language for websites and mobile applications. It is a relatively easy language to learn, thanks to the readability and brevity of the code. In Python, it is often possible to express a concept in less rules than in many other languages. Python is used in applications such as Insta gram and Pinterest in the form of the Web-framework Django. Google, Yahoo! and NASA all make use of Python.

Ruby

Ruby is – like Python – a programming language that is very user-friendly for novice programmers. At the same time, the object-oriented language is very dynamic and thus popular for developing websites and mobile apps. It is the basis of the Ruby on Rails framework used by Groupon, Shopify, Scribd and GitHub.

Fill in the list!

Of course there are many more programming languages. We've just put a few of the most popular for you. Do you have additions? Are you missing a language that you really often use? Share your knowledge and experience with us!

Learning A (different) programming language yourself?

Would you like to learn a (different) programming language yourself? Then quickly discover our workshops and courses.Under the guidance of an experienced trainer you will learn the basics of programming in an efficient way. Have you moved on? Then it is possible to register for an advanced training. You will then go deeper into the subject matter. Such a training is not only fun, but it also fits in well with practice. This way you can be sure that you can immediately do something with your new knowledge and skills!

Link

5 reasons to communicate with your SQL database via PDO

There are several ways to communicate with a database from PHP. Since PHP 5.1 A nice extension has been released: PHP database Objects (PDO). Do you use the old fashioned mysql_connect() And mysql_query() Features? Here five reasons to switch:

  1. Binding parameter

    Creating a query with input from website visitors brings with it dangers. Visitor Input can contain dangerous SQL code. If the code component becomes a query there is a SQL injection, a common vulnerability.

    With PDO you can better arm against SQL injections thanks to ' parameter binding '. PDO offers the ability to use placeholders in your query. This will prevent unwanted SQL code from entering the query.

  2. Exploits of a mom

    Randall Munroe, xkcd.com, CC BY-NC 2.5

  3. Transactions

    Changes to your database are often not self-explanatory. Often, one request from the visitor asks for changes to multiple tables. When making an order in a webshop, not only the order must be saved, but also the inventory will be updated.

    If one of these queries does not go well, for example because the inventory is insufficient, the database will be in an inconsistent state. With transactions, you can do a "rollBack" in such a case, which will undo all changes to the database since the start of the transaction.

  4. ' Universal ' interface

    With PDO you are not tied to one database. No less than 12 database systems are supported, including MySql, PostgreSQL, Microsoft SQL Server and Oracle. Thanks to PDO, your program can communicate with it in the same way. When you connect, you indicate what type of database it is, then you can ask them using the same methods.

  5. Disappearance of old functions

    The obsolete mysql_*() Features are no longer supported from PHP version 5.5.0. In the latest versions (from PHP 7.0.0) They are not even included and therefore no longer use.

  6. Object oriented

    PDO is completely object oriented. So you have all the advantages of object oriented programming, including exceptions. Exceptions allow you to handle errors, such as connection problems, in an elegant way.

Note: Is the PDO extension not available on the system where your website Is running, and do you use a MySQL database? Then switch to Mysqli. Less universal and elegant than PDO, it also provides parameter binding, transactions and stored procedures.

Link

Save visitor passwords securely with PHP? Use Hashing!

Again this week the weather was quite touching: The passwords of millions of internet users are on the street. While the creator of the website could have avoided this easily.

What is the danger?

Unlike computers, people are not really good at memorizing them. However, you have to remember passwords everywhere. As a result, many people use a single password for multiple websites. This entails a major security risk. If a password is leaked, all accounts can be accessed where this password has been reused.

How do you prevent visitor password theft?

The best solution to not steal passwords is simply not to keep them! Instead, we'll save the hash of the password. A hash function makes a password unrecognizable. Based on the hash, it is impossible to trace the input. A hash function always produces the same result with the same input. A strong hash function also ensures that two different texts do not result in the same hash (if this happens there is a collision). Even if the hackers manage to get a database with hashes, they don't have passwords in their hands yet.

How do you use the hash functions of PHP?

Since PHP 5.5 It has become very easy to hash passwords by using the function password_hash(). This function has one mandatory argument: the password. The second argument allows you to specify which hashing algorithm to use. If you do not specify this, the strong BCrypt algorithm is used by default. In addition to hashing, this function also adds a Salt which protects against Rainbow Tables. Generating the hash goes as follows:

 
  $wachtwoord = ' secret password ';
  $hash = Password_hash ($wachtwoord, PASSWORD_BCRYPT);
  Echo $hash;

The generated hash is a string of 60 characters and can look like this: $2y $10 $ Se3mLsHueAYTM3G4Wd9hTuyfzPCRYtafImcOSO2U0H4290jPU. SUA. From this hash it is impossible to retrieve the password. This hash can be stored securely in your database.

To check if someone has entered a correct password we use the function password_verify(). We give these two arguments, the password that was entered in the login and the hash that we had saved.


  $hash = '$2y$10$Se3mLsHueAYTM3G4Wd9hTuyfzPCRYtafImcOSO2U0H4290jPU.SGO';
  $wachtwoord = 'Onzin';

  if (password_verify( $wachtwoord, $hash)){
      echo 'Correct wachtwoord';
  } else {
    echo 'Incorrect wachtwoord';
  }

In this case, the user password will generate a different hash than was stored in our database. This allows us to verify that the password you entered is correct, without having to save the original password. Even if a hacker gains access to our database there is no password to find.