Language Selection

English French German Italian Portuguese Spanish

Development

GNU Guix: Guile 3 & Guix

Filed under
Development
GNU

Most users interact with Guix through its command-line interface, and we work hard to make it as approachable as possible. As any user quickly notices, Guix uses the Scheme programming language uniformly for its configuration—from channels to manifests and operating systems—and anyone who starts packaging software knows that package definitions are in fact Scheme code as well.

This is a significant departure from many other, and in particular from Nix. While Nix defines several domain-specific languages (DSLs) for these aspects—the Nix language but also specific configuration languages—Guix chooses Scheme as the single language for all this, together with the definition of high-level embedded domain-specific languages (EDSLs).

It goes beyond that: in Guix System, all the things traditionally implemented in C or as a set of Perl or shell scripts are implemented in Scheme. That includes the init system, package builds, the initial RAM disk (initrd), system tests, and more. Because this leads to several layers of Scheme code, executed at different points in time, Guix includes a code staging mechanism built upon the nice properties of Scheme.

Why do that? The arguments, right from the start, were twofold: using a general-purpose language allows us to benefit from its implementation tooling, and having interfaces for “everything” in Scheme makes it easy for users to navigate their distro or OS code and to reuse code to build new features or applications. Guix developers benefit from the ease of code reuse every day; demonstrative examples include the use of Guix container facilities in the init system, the development of many tools providing facilities around packages, the implementation of additional user interfaces, and work on applications that use Guix as a library such as the Guix Workflow Language and Guix-Jupyter.

As for the benefits of the host general-purpose language, these are rather obvious: Guix developers benefit from an expressive language, an optimizing compiler, a debugger, a powerful read-eval-print loop (REPL), an interactive development environment, and all sorts of libraries. Moving to Guile 3 should add to that better performance, essentially for free. To be comprehensive, Guile 3 may well come with a set of brand new bugs too, but so far we seem to be doing OK!

Read more

Programming Leftovers

Filed under
Development
  • 6 things you should be doing with Emacs

    Imagine using Python's IDLE interface to edit text. You would be able to load files into memory, edit them, and save changes. But every action you perform would be defined by a Python function. Making a word all capitals, for instance, calls upper(), opening a file calls open, and so on. Everything in your text document is a Python object and can be manipulated accordingly. From the user's perspective, it's the same experience as any text editor. For a Python developer, it's a rich Python environment that can be changed and developed with just a few custom functions in a config file.

    This is what Emacs does for the 1958 programming language Lisp. In Emacs, there's no separation between the Lisp engine running the application and the arbitrary text you type into it. To Emacs, everything is Lisp data, so everything can be analyzed and manipulated programmatically.

    That makes for a powerful user interface (UI). But if you're a casual Emacs user, you may only be scratching the surface of what it can do for you. Here are six things you may not have realized you could do with Emacs.

  • Intersecting Intel & AMD Instruction Set Extensions

    In some of my projects, I’ve recently had the need to utilize FMA (fused-multiply-add) or AVX instructions. Compiling C/C++ on X86_64 will by default only activate MXX and a few of the early SSE extensions. The utilized instruction set basically predates the core2 which was introduced in 2006.

    Math instructions and vectorizations can greatly benefit from more modern instructions like SSE4*, FMA, AVX, AVX2, etc, but because of the way the -march compiler option works, those are not easily enabled for all CPU types of similar age.

  • Intel Continues Improving Its SYCL Stack - Now Supports Ahead-Of-Time Compilation

    The Khronos SYCL standard as a single-source C++-based programming model for OpenCL is one of the exciting elements for Intel's GPU compute plans with the forthcoming Xe graphics cards and fits into their oneAPI umbrella. They just released their SYCL Compiler and Runtimes 2019-12 release with numerous updates.

    First up this new version of their SYCL compiler/run-time features opencl-aot as a new tool for offering ahead-of-time compilation of SYCL sources. The AoT compilation tool is geared for generating device-dependent OpenCL program binaries optimized out of SPIR-V. The optimized binaries are catered for Intel's architecture.

  • Excellent Free Tutorials to Learn Fortran

    The language is designed to be simple to understand, yet retains the efficiency in execution as assembly language – about 80% as efficient as assembly/machine code. Fortran is machine independent, and a problem oriented language. It is often used in the scientific community, particularly among physicists, and is designed for scientific numerical computing. Fortran allows for high parallelization, it’s easy to optimize, and lends itself particularly well to computationally intensive fields such as finite element analysis, numerical weather prediction, computational physics, computational chemistry, and computational fluid dynamics.

    Fortran has evolved over time, with various standards including Fortran IV, Fortran 77, Fortran 90 and Fortran 95. More recent revisions are Fortran 2003, and Fortran 2008. Since Fortran 9x, it has many structured programming features, dynamic memory, operator overloading, and primitive objects. It is both the language of the past, the current, and the future (high-performance computing is unlikely to cast aside Fortran). Despite its age, Fortran is still very much alive and kicking. Fortran has a vast number of libraries of code.

  • k-means: a brief interlude into Data Wrangling

    When last we saw our heroes, what they thought was the brink of success turned out to be the precipice of hasty interpretation and now they are dangling for dear life on the branch of normalization! how's that for tortured metaphor!

    If you use raw values for your k-means clustering, dimensions with large values or large ranges can swamp smaller dimensions and skew your clusters. The process of normalization tries to bring everything into the same range, usually [0,1], although your choices on how to transform the ranges are also significant. There is not always one best way to do it and, as usual, get familiar with your dataset and use your judgement.

  • Paws XXXXIX (Very Close)

    Finally things were looking my way. I plowed thought the remaining CloudFront actions and got them all to work without any more changes to Paws.

    In the end I checked in 30+ new tests cases and over 2k of tests the other day. So I can safely say that 'CloudFront' is fully operational.

    That leaves only 'Route53' to look and for me this is somewhat problematic. The Route53 api deals with 'Domains', 'Checks', 'Hosts', 'Traffic' and such.

  • String Formatting with Python 3's f-Strings

    Python 3.6 introduced a new way to format strings: f-Strings. It is faster than other string formatting methods in Python, and they allow us to evaluate Python expressions inside a string.

    In this post, we'll look at the various ways we can format strings in Python. Then we'll have a deeper look at f-Strings, looking at how we can use it when displaying different data.

  • Massive change of file extension (bash)

The Rock Pi S Review

Filed under
Development
GNU
Linux
Hardware
Reviews

When writing articles like these, there is an inevitable comparison to the Raspberry Pi series. There is no way to fight this, and for good reason. The first Raspberry Pi ushered in a slew of Single Board Computers (SBCs), and one of them is the Rock Pi S, a new board from Seeed Studio.

In the interest of full disclosure, the Rock Pi S was provided by Seeed Studio for this review. Specifically, it?s the model with 512MB of RAM and 4Gb of built-in flash.

The Rock Pi S competes in the same segment as the Raspberry Pi Zero, particularly the Zero W with built-in WiFi. Its form factor is different; where the Zero is shaped like a stick of gum, the Rock Pi S is closer to a square. The Rock also has USB-C for power, an ethernet jack, and a USB-A port. Depending on the project, it can end up being cheaper than the Zero, since you don?t have to buy a micro-USB to USB-A adapter to hook up most other devices.

You do still need a micro SD card. While there are versions of the Rock with built-in flash, it?s small and not meant for booting an OS. Note that the size of the built-in flash is listed in gigabits. The 4Gb version is actually 512 megabytes. So get an SD card.

Which leaves us the question of which SD card. Some people automatically reach for a class 10 or UHS-I card, since those have the highest performance on the box. Trouble is, the traditional class ratings on SD cards only tell you the sequential read and write performance. That?s fine for cameras, but running an operating system means lots of random reads. Testing often showed that a good class 4 card was better than a lot of the class 10 cards out there.

Read more

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!

  •       

Syndicate content