Language Selection

English French German Italian Portuguese Spanish

Development

Programming With Python: PyQt5, “Effective Python” and Wing Python IDE

Filed under
Development
  • PyQt5 plotting with matplotlib, embed plots in your GUI applications

    In the previous part we covered plotting in PyQt5 using PyQtGraph. That library uses the Qt vector-based QGraphicsScene to draw plots and provides a great interface for interactive and high performance plotting.

    However, there is another plotting library for Python which is used far more widely, and which offers a richer assortment of plots — Matplotlib. If you're migrating an existing data analysis tool to a PyQt GUI, or if you simply want to have access to the array of plot abilities that Matplotlib offers, then you'll want to know how to include Matplotlib plots within your application.

    In this tutorial we'll cover how to embed Matplotlib plots in your PyQt applications

    Many other Python libraries — such as seaborn and pandas— make use of the Matplotlib backend for plotting. These plots can be embedded in PyQt5 in the same way shown here, and the reference to the axes passed when plotting. There is a pandas example at the end of this tutorial.

  • “Effective Python” by Brett Slatkin book review

    Let’s start with the target audience for this book. I’d recommend it to the people who are using Python at least several months and are feeling good with the basics. If you need more practical advice you are definitely welcome.

  • Wing Tips: Using Black and YAPF Code Reformatting in Wing Python IDE

    ing version 7.2 has been released, so in the next couple Wing Tips we'll take a look at some of its new features.

    Wing 7.2 expands the options for automatic code reformatting to include also Black and YAPF, in addition to the previously supported autopep8. Using one of these allows you to develop nicely formatted uniform-looking code without spending time manually adjusting the layout of code.

More Python Programming Leftovers

Filed under
Development
  • Hello Word in Django: How to start with Django

    In this article, we will learn how to develop and run a python-Django app in less than 5 minutes.

  • Python GUI Programming With Tkinter

    Python has a lot of GUI frameworks, but Tkinter is the only framework that’s built into the Python standard library. Tkinter has several strengths. It’s cross-platform, so the same code works on Windows, macOS, and Linux. Visual elements are rendered using native operating system elements, so applications built with Tkinter look like they belong on the platform where they’re run.

    Although Tkinter is considered the de-facto Python GUI framework, it’s not without criticism. One notable criticism is that GUIs built with Tkinter look outdated. If you want a shiny, modern interface, then Tkinter may not be what you’re looking for.

    However, Tkinter is lightweight and relatively painless to use compared to other frameworks. This makes it a compelling choice for building GUI applications in Python, especially for applications where a modern sheen is unnecessary, and the top priority is to build something that’s functional and cross-platform quickly.

  • The contextmanager Decorator

    Context managers provide a cool programming pattern, especially if you’re forgetful or just have too much to keep track of and you want to simplify your life.

  • URLs Lead The Way

    In the last article in the Understand Django series, we saw how a user’s browser request goes from their browser to Django’s “front door.” Now it’s time to look at how Django processes those requests.

    An HTTP request coming from a browser includes a URL describing which resource Django should produce. Since URLs can come in many forms, we must instruct Django on the kinds of URLs that our web application can handle. This is what the URL configuration is for. In the Django documentation, the URL configuration is called a URLconf, for short.

    Where is the URLconf? The URLconf is at the module path set by the ROOT_URLCONF setting in your project’s settings file. If you ran the startproject command, then that setting will be named like project.urls where “project” is the name given as an argument to the command. In other words, the URLconf is placed right next to the settings.py file in project/urls.py.

Python Programming

Filed under
Development
  • Using IF ELSE condition in Django template

    IF tag evaluates the variable and variable is considered True if it exists and is not empty (if that variable is any iterable) and is not a False boolean value. Which means we can use a boolean variable, a list or a set with IF tag.

  • Ensemble/Voting Classification in Python with Scikit-Learn

    Ensemble classification models can be powerful machine learning tools capable of achieving excellent performance and generalizing well to new, unseen datasets.

    The value of an ensemble classifier is that, in joining together the predictions of multiple classifiers, it can correct for errors made by any individual classifier, leading to better accuracy overall. Let's take a look at the different ensemble classification methods and see how these classifiers can be implemented in Scikit-Learn.

  • PyCharm 2019.3.2

    We’ve been taking some time to polish PyCharm further, so be sure to update to the newest version! You can get it from within PyCharm (Help | Check for Updates), using JetBrains Toolbox, or by downloading the new version from our website.

  • EuroPython 2020: Pre-launch Website Ready

    In the last couple of weeks we have put together a pre-launch site for EuroPython 2020, which has all the information around the event, as we currently know and can share with you.

Programming Leftovers

Filed under
Development
  • Operator pattern: REST API for Kubernetes and Red Hat OpenShift

    In this article, we will see a similar pattern when writing the REST API in any known framework vs. writing an Operator using Kubernetes’ client libraries. The idea behind this article is not to explain how to write a REST API, but instead to explain the internals of Kubernetes by working with an analogy.

  • Rust framework dev says ‘I’m done with Open Source’…has second thoughts

    The main developer behind a Rust actor framework pulled the code behind the project in apparent protest against an “unsafe sh*tstorm” against him last week.

    And while the coder in question now appears to have nominated new leadership to continue the project, the apparent “ragequit” has prompted questions about the dynamics within the open source community.

    [...]

    “You could notice after each unsafe shitstorm, I started to spend less and less time with the community,” he continued. “You felt betrayed after you put so much effort and then to hear all this sh*t comments, even if you understand that that is usual internet behavior. Anyway, removing issue was a stupid idea. But I was pissed off with last two personal comments, especially while sitting and thinking how to solve the problem. I am sorry for doing that.” [SIC]

  • How to Write and Run a C Program in Linux

    Linux is becoming programming heaven for developers, being an open-source and free operating system. Turbo C compiler is already an old approach to compile programs so let us programmers move to Linux for a new programming environment. In this article,

  • TechWiser’s giant Raspberry Pi AirPod speaker (and more)

    YouTube is a haven for awesome Raspberry Pi projects, and we often spend time scanning through the platform’s wares for hidden gems. One such hidden gem is this video from TechWiser, in which they showcase some of their favourite Raspberry Pi projects:

  • A quick-and-dirty guide on how to install packages for Python

    When people start learning Python, they often will come across a package they want to try and it will usually start with "just pip install it!" The problem with that advice is it's a very simplistic view of how to manage packages and can actually lead to problems down the road. And while there is a tutorial on installing packages at packaging.python.org, it might be a bit intimidating for some if they are just looking to quickly get up and going.

    If you just want to start poking at Python and want to avoid the pitfalls to installing packages globally, it only takes 3 steps to do the right thing.

Programming/Development: Perl, Python/Django and Bash

Filed under
Development
  • Springtime in Switzerland

    During the same week I’ll also be giving a half-day seminar on Raku, which has been generously sponsored by EPFL and so will cost nothing to attend. It’s suitable for anyone who would like a quick but comprehensive overview of this remarkable new programming language.

    Besides making the Raku seminar entirely free, SIB/UNIL/EPFL have done an amazing job
    keeping the prices of the other classes extremely competitive...especially if you can claim a plausible association to any academic institution, either as a student or staff member.

    If you’re looking for some training that’s economical, practical, and just plain fun,
    in a location that’s central, civilised, and simply breathtaking, then this week
    in Switzerland might fit just the bill.

  • PyCoder’s Weekly: Issue #404 (Jan. 21, 2020)
  • Basic Data Types in Python

    In this step-by-step course, you’ll dig into the basic data types that are built into Python.

  • Python 3.7.5 : Django security issues - part 002.
  • Python 3.7.5 : Use Django Formsets.

    Django Formsets manage the complexity of multiple copies of a form in a view. 
    This simplifies the task of creating a formset for a form that handles multiple instances of a model.

  • Hunting gremlins

    In the UTF-8 files I audit, the only invisible characters I expect to see... er... not see... are whitespace (hexadecimal 20), horizontal tab (09) and newline (linefeed; 0a). All others I call "gremlins". They include carriage return (0d), no-break space (c2 a0), soft hyphen (c2 ad) and another 62 control characters.

    Gremlins are a nuisance. One gremlin causes a shell to hang. Less evil gremlins lurk inside apparently OK strings and cause the strings to be processed weirdly. In the file "demo1", two of the strings contain no-break spaces (in different places), two contain soft hyphens (in different places) and three have no gremlins. 

  • A more expressive Bash prompt

    Bash provides some interesting built-in specifiers for the prompt strings PS1. 

Programming: Git, Python and PHP

Filed under
Development
  • Git Update Improves DevOps with Partial Cloning Feature

    On Jan. 13, Git 2.25 was released, bringing to one of the most commonly used developer tools new capabilities that will help improve performance and overall developer productivity.

  • Solving Python Error- KeyError: 'key_name'

    As per Python 3 official documentation a key error is raised when a mapping (dictionary) key is not found in the set of existing keys.

  • Python's Execution Time Is Close To C++ And Go Language: Study

    Python is the most preferred programming language for Machine Learning and Artificial Intelligence, but it is also the least preferred for being slow to solve certain problems that involve loops.

    To challenge this fact, researchers at EPFL Computer Vision Laboratory published a report in which they presented the competitiveness of Python against C++ and Go by solving the popular N-queens puzzle.

  • PHP in 2020

    It's no secret among web developers and programmers in general: PHP doesn't have the best reputation. Despite still being one of the most used languages to build web applications; over the years PHP has managed to get itself a reputation of messy codebases, inexperienced developers, insecure code, an inconsistent core library, and what not.

    While many of the arguments against PHP still stand today, there's also a bright side: you can write clean and maintainable, fast and reliable applications in PHP.

    In this post, I want to look at this bright side of PHP development. I want to show you that, despite its many shortcomings, PHP is a worthwhile language to learn. I want you to know that the PHP 5 era is coming to an end. That, if you want to, you can write modern and clean PHP code, and leave behind much of the mess it was 10 years ago.

Programming Leftovers

Filed under
Development
  • Server-side Swift's slow support story sours some: Apple lang tailored for mobile CPUs, lacking in Linux world

    The Swift programming language has suffered some setbacks in its quest for ubiquity since Apple released it under an open-source license in 2015.

    In December, IBM said it had reevaluated its priorities and decided to back away from server-side Swift development. Then last week, Vapor Cloud, a server-side Swift hosting biz, and a related service called Vapor Red, announced plans to shut down in February.

  • Excellent Free Tutorials to Learn Scala

    Scala is a modern, object-functional, multi-paradigm, Java-based programming and scripting language that’s released under the Apache License 2.0. It blends functional and object-oriented programming models. Scala introduces several innovative language constructs. It improves on Java’s support for object-oriented programming by traits, which are stackable and cannot have constructor parameters. It also offers closures, a feature that dynamic languages like Python and Ruby have adopted.

    Scala is particularly useful for building cloud-based/deliverable Software as a Service (SaaS) online applications, and is also proficient to develop traditional, imperative code.

    The language helps programmers write tighter code. It uses a number of techniques to cut down on unnecessary syntax, which helps to make code succinct. Typically, code sizes are reduced by an order of 2 or 3 compared to an equivalent Java application.

  • 13 of the best React JavaScript frameworks

    React.js and React Native are popular open source platforms for developing user interfaces (UIs); both rank well for desirability and use in StackOverflow's 2019 Developer Survey. React.js was developed by Facebook in 2011 as a JavaScript library to address the need for cross-platform, dynamic, and high-performing UIs, while React Native, which Facebook released in 2015, is used for building native applications using JavaScript.

    The following are 13 of the best React JavaScript frameworks; all are open source—the first 11 (like React) are licensed under the MIT license and the latter two are licensed under Apache 2.0.

  • Espacio de Datos: fulldome installation

    Espacio de Datos is a site-specific, immersive audiovisual installation, consisting of a fulldome projection and a spatialized audio track that I created in collaboration with sound artist Mene Savasta for the +CODE 2018 festival in Buenos Aires, Argentina. It was originally comissioned by Cristian Reynaga and Merlina Rañi, organizers of the festival. Espacio de Datos was also shown at the 2018 edition of the Domo Lleno festival in Bogotá, Colombia, the 9th International Festival of Science Visualization in Tokyo, Japan, in February 2019, and finally at the Elektra Festival XX in Montréal, Canada, in June 2019. This blog post goes in more depth into the background for this project, and the process we followed to create its images and sounds.

    [...]

    The sound palette was informed by the thematic field of the data, which contained anonymized clinical information of patients affected by Lassa fever, a virual hemorrhagic fever endemic in West Africa. The tragedy of a deadly disease, reduced to indices and values that are then visualized in a cosmic and minimalistic vision. Mene considered these aspects to construct a noisy and glitchy while simultaneously clean palette, where the tragic element is manifested in the dynamic range, such as contrasts and accumulation.

  •      

  • 2020.03 Trait::Traced

           

             

    Ben Davies has published a module that may well change ad-hoc debugging in Raku: Trait::Traced. It introduces the is traced trait that can currently be attached to any type (class), or to any subroutine or method. So, to find out anything that is happening while executing code in your class Foo, simply do use Trait::Traced and change class Foo { to class Foo is traced {. Yours truly feels this could become a core module rather sooner than later!

  •       

Programming Leftovers

Filed under
Development
  • The Titler Revamp – The QML MLT Producer is testing ready

    The last time I blogged about the Titler, I promised that the next update would be when we have some sort of a backend ready – and I’m happy to announce now that now we have some sort of a backend ready!

  • The Meson Manual is now available for purchase

    Some of you might remember that last year I ran a crowdfunding campaign to create a full written user manual for Meson. That failed fairly spectacularly, mostly due to the difficulty of getting any sort of visibility for these kinds of projects (i.e. on the Internet, everything drowns).

  • anytime 0.3.7

    A fresh minor release of the anytime package is arriving on CRAN right now. This is the eighteenth release, and it comes roughly five months after the previous showing the relative feature-stability we have now.

    anytime is a very focused package aiming to do just one thing really well: to convert anything in integer, numeric, character, factor, ordered, … format to either POSIXct or Date objects – and to do so without requiring a format string. See the anytime page, or the GitHub README.md for a few examples.

    This release brings a clever new option, thanks to Stephen Froehlich. If you know your input has (lots) of duplicates you can now say so and anytime() (and the other entry points for times and dates, UTC or not) will only parse the unique entries leading to potentially rather large speed gains (as in Stephen’s case where he often has more than 95% of the data as duplicates). We also tweaked the test setup some more, but as we are still unable to replicate what is happening with the Fedora test boxen at CRAN due to the non-reproducible setup so this remains a bit of guess work. Lastly, I am making use of a new Rcpp #define to speed up compilation a little bit too.

  • Merging Of Flang/F18 Fortran Compiler Support Into LLVM Has Been Delayed

    The modern F18/Flang Fortran front-end to LLVM had been set to land in the LLVM mono repository last Monday that could have made it included as part of the LLVM 10.0 branch set for that day. The LLVM 10.0 branching happened as planned but the landing of this Fortran support did not.

    Landing of the Flang front-end was delayed to allow for last minute changes to happen. Their revised target for merging was 20 January.

  • Connect your Raspberry Pi 4 to an iPad Pro

    Have you ever considered attaching your Raspberry Pi 4 to an Apple iPad Pro? How would you do it, and why would you want to? Here’s YouTuber Tech Craft to explain why Raspberry Pi 4 is their favourite iPad Pro accessory, and why you may want to consider using yours in the same way.

Programming Leftovers

Filed under
Development
  • The Titler Revamp – The QML MLT Producer is testing ready

    The last time I blogged about the Titler, I promised that the next update would be when we have some sort of a backend ready – and I’m happy to announce now that now we have some sort of a backend ready!

  • The Meson Manual is now available for purchase

    Some of you might remember that last year I ran a crowdfunding campaign to create a full written user manual for Meson. That failed fairly spectacularly, mostly due to the difficulty of getting any sort of visibility for these kinds of projects (i.e. on the Internet, everything drowns).

  • anytime 0.3.7

    A fresh minor release of the anytime package is arriving on CRAN right now. This is the eighteenth release, and it comes roughly five months after the previous showing the relative feature-stability we have now.

    anytime is a very focused package aiming to do just one thing really well: to convert anything in integer, numeric, character, factor, ordered, … format to either POSIXct or Date objects – and to do so without requiring a format string. See the anytime page, or the GitHub README.md for a few examples.

    This release brings a clever new option, thanks to Stephen Froehlich. If you know your input has (lots) of duplicates you can now say so and anytime() (and the other entry points for times and dates, UTC or not) will only parse the unique entries leading to potentially rather large speed gains (as in Stephen’s case where he often has more than 95% of the data as duplicates). We also tweaked the test setup some more, but as we are still unable to replicate what is happening with the Fedora test boxen at CRAN due to the non-reproducible setup so this remains a bit of guess work. Lastly, I am making use of a new Rcpp #define to speed up compilation a little bit too.

  • Merging Of Flang/F18 Fortran Compiler Support Into LLVM Has Been Delayed

    The modern F18/Flang Fortran front-end to LLVM had been set to land in the LLVM mono repository last Monday that could have made it included as part of the LLVM 10.0 branch set for that day. The LLVM 10.0 branching happened as planned but the landing of this Fortran support did not.

    Landing of the Flang front-end was delayed to allow for last minute changes to happen. Their revised target for merging was 20 January.

Python Programming Leftovers

Filed under
Development
  • Improving python code performance by using lru_cache decorator

    Here is the program to generate the Fibonacci series up to the number provided as a command-line argument.

  • Wing Python IDE 7.2 - January 20, 2020

    Wing 7.2 adds auto-formatting with Black and YAPF, expanded support for virtualenv, support for Anaconda environments, easier debugging of modules launched with python -m, simplified manually configured remote debugging, and other improvements.

  • Python Meeting Düsseldorf - 2020-01-22

    The following text is in German, since we're announcing a regional user group meeting in Düsseldorf, Germany.

  • Having some fun with Python

    If it’s not clear after the inevitable Swedish-chef-muppet impression has run through your mind, this string-formatting operation will replace the contents of port with a string containing two copies of whatever was in port, separated by a colon. So if port was "foo", now it will be "foo:foo".

  • Using SciPy for Optimization

    When you want to do scientific work in Python, the first library you can turn to is SciPy. As you’ll see in this tutorial, SciPy is not just a library, but a whole ecosystem of libraries that work together to help you accomplish complicated scientific tasks quickly and reliably.

Syndicate content

More in Tux Machines

Lakka 2.3.2 with RetroArch 1.8.4

The Lakka team wishes everyone a happy new year and welcomes 2020 with a new update and a new tier-based releases system! This new Lakka update, 2.3.2, contains RetroArch 1.8.4 (was 1.7.2), some new cores and a handful of core updates. Read more

It is time to end the DMCA anti-circumvention exemptions process and put a stop to DRM

Although it is accurate, there's one aspect of the process that is missing from that description: the length. While the process kicks off every three years, the work that goes into fighting exemptions, whether previously granted or newly requested, has a much shorter interval. As you can see from the timeline of events from the 2018 round of the exemptions process, the process stretches on for months and months. For each exemption we have to prepare research, documents, and our comments through wave after wave of submission periods. For the 2018 exemptions round, the first announcements from the United States Copyright Office were in July of 2017, on a process that concluded in October of 2018. Fifteen months, every three years. If you do the math, that means we're fighting about 40% of the time just to ensure that exemptions we already won continue, and that new exemptions will be granted. If the timeline from the last round holds up, then we're only a few short months away from starting this whole circus back up again. Describing it as a circus seems an appropriate label for the purpose of this whole process. It's not meant to be an effective mechanism for protecting the rights of users: it's a method for eating up the time and resources of those who are fighting for justice. If we don't step up, users could lose the ability to control their own computing and software. It's like pushing a rock up a mile-long hill only to have it pushed back down again when we've barely had a chance to catch our breath. Read more

Programming With Python: PyQt5, “Effective Python” and Wing Python IDE

  • PyQt5 plotting with matplotlib, embed plots in your GUI applications

    In the previous part we covered plotting in PyQt5 using PyQtGraph. That library uses the Qt vector-based QGraphicsScene to draw plots and provides a great interface for interactive and high performance plotting. However, there is another plotting library for Python which is used far more widely, and which offers a richer assortment of plots — Matplotlib. If you're migrating an existing data analysis tool to a PyQt GUI, or if you simply want to have access to the array of plot abilities that Matplotlib offers, then you'll want to know how to include Matplotlib plots within your application. In this tutorial we'll cover how to embed Matplotlib plots in your PyQt applications Many other Python libraries — such as seaborn and pandas— make use of the Matplotlib backend for plotting. These plots can be embedded in PyQt5 in the same way shown here, and the reference to the axes passed when plotting. There is a pandas example at the end of this tutorial.

  • “Effective Python” by Brett Slatkin book review

    Let’s start with the target audience for this book. I’d recommend it to the people who are using Python at least several months and are feeling good with the basics. If you need more practical advice you are definitely welcome.

  • Wing Tips: Using Black and YAPF Code Reformatting in Wing Python IDE

    ing version 7.2 has been released, so in the next couple Wing Tips we'll take a look at some of its new features. Wing 7.2 expands the options for automatic code reformatting to include also Black and YAPF, in addition to the previously supported autopep8. Using one of these allows you to develop nicely formatted uniform-looking code without spending time manually adjusting the layout of code.

Videos/Audiocasts/Shows: System76 Serval WS, Linux Headlines, FLOSS Weekly and LCARS System 47 Screensaver on Linux

  • System76 Serval WS Workstation Laptop Full Review

    The System76 Serval WS laptop is crazy powerful, with a desktop CPU and a powerful Nvidia video card. In this review, I show off the hardware, weigh the pros and cons, and give my overall thoughts.

  • 2020-01-22 | Linux Headlines

    Major improvements come to Wine, Debian makes a significant change post systemd debate, and the world’s most popular open source API gateway gets an update.

  • FLOSS Weekly 563: Apprentice Program

    The Apprentice Program is an initiative to train and mentor female junior developers in open source, creating a pipeline of talent and changing the ratio in tech.

  • LCARS System 47 Screensaver on Linux | Install and Service Creation

    This video goes over the infamous LCARS System 47 Screensaver on Linux. You have seen it in my background and now I show how to use an old 90s screensaver scr file on Linux. I then show how to make a systemd service to activate the screensaver when you are idle for a set amount of time.