Language Selection

English French German Italian Portuguese Spanish

Programming Leftovers

Filed under
Development
  • Built to Last

    As the catastrophe unfolded, several state governments blamed it on aged, supposedly obsolete computer systems written in COBOL, a programming language that originated in the late 1950s. At least a dozen state unemployment systems still run on this sixty-one-year-old language, including ones that help administer funds of a billion dollars or more in California, Colorado, and New Jersey. When the deluge of unemployment claims hit, the havoc it seemed to wreak on COBOL systems was so widespread that many states apparently didn’t have enough programmers to repair the damage; the governor of New Jersey even publicly pleaded for the help of volunteers who knew the language.

    But then something strange happened. When scores of COBOL programmers rushed to offer their services, the state governments blaming COBOL didn’t accept the help. In fact, it turned out the states didn’t really need it to begin with. For many reasons, COBOL was an easy scapegoat in this crisis—but in reality what failed wasn’t the technology at all.

  • Reducing Streams in Java

    Java 8 introduced streams, among other things, and one of my favourite features is the reduce() method. It combines a stream into a single method.

  • Humility

    Humility helps you respect the people you’re working with and see what they bring. We can’t genuinely respect them if we’re feeling superior; if we think we have all the answers.

    If we have compassion for our teammates (and ourselves) we will desire to minimise their suffering.

    We will want to avoid inflicting difficult merges on anyone. We will want to avoid wasting their time, or forcing them to re-work; having been surprised by our changes. The practice of Continuous Integration can come from the desire to minimise suffering in this way.

    We will want those who come after us in the future to be able to understand our work—understand the important behaviour and decisions we made. We’ll want them to have the best safety net possible. Tests and living documentation such as ADRs can come from this desire.

    We’d desire the next person to have the easiest possible job to change or build upon what we’ve started, regardless of their skill and knowledge. Simplicity and YAGNI can come from this desire.

    Humility and compassion can drive us to be curious: what are the coding and working styles and preferences of our team mates? What’s the best way to collaborate to maximise my colleagues’ effectiveness?

    Without compassion we might write code that is easiest for ourselves to understand—using our preferred idioms and style without regard for how capable the rest of the team is to engage with it.

    Without humility our code might show off our cleverness.

  • Python Throw Exception – Linux Hint

    An exception appears during program execution and changes its normal flow due to an error. An exception arises on account of an error. The main cause of an exception is a logical error. Like many other programming languages, Python provides several built-in exceptions, i.e., ZeroDivisionError, ImportError, EOFError, etc.; for instance, the ZeroDivisionError exception is raised when a number is divided by zero. The Python exceptions are handled by the try statement. We define a try block and put the code vulnerable code inside this block, which can raise an exception. Next, after the try block, we define an except block to deal with the exception. Besides all these built-in exceptions, sometimes we need to raise or throw an exception when we encounter a specific situation. The Python developer can throw a user-defined exception easily. We use the raise keyword for raising or throwing an exception. This article explains the Python raise keyword usage for throwing the exception with examples.

  • How to use nftables from python

    One of the most interesting (and possibly unknown) features of the nftables framework is the native python interface, which allows python programs to access all nft features programmatically, from the source code.

    There is a high-level library, libnftables, which is responsible for translating the human-readable syntax from the nft binary into low-level expressions that the nf_tables kernel subsystem can run. The nft command line utility basically wraps this library, where all actual nftables logic lives. You can only imagine how powerful this library is. Originally written in C, ctypes is used to allow native wrapping of the shared lib object using pure python.

    To use nftables in your python script or program, first you have to install the libnftables library and the python bindings. In Debian systems, installing the python3-nftables package should be enough to have everything ready to go.

    To interact with libnftables you have 2 options, either use the standard nft syntax or the JSON format. The standard format allows you to send commands exactly like you would do using the nft binary. That format is intended for humans and it doesn’t make a lot of sense in a programmatic interaction. Whereas JSON is pretty convenient, specially in a python environment, where there are direct data structure equivalents.

  • Vue.js Change Style – Linux Hint

    Vue.js is used to build User Interfaces (UIs) and Single-Page Applications (SPAs). It is easy to learn how to use Vue.js and the framework of freedom and comfort that is available while developing applications in this program because it has the best-combined features of Angular and ReactJS. That is why it is known for its easy-to-use and clean coding.

    Vue.js provides style binding that you can use to change the style dynamically. You can bind a variable to the style attribute in any HTML tag and change the style when the bound variable is changed. In this article, we will have a look at how to use style binding and change the styling of variables using vue.js.

  • Vue.js Conditional Rendering – Linux Hint

    Vue.js is an easy to learn and approachable library that we can start building web applications in it with the basic knowledge of web development. In Vue.js, developers love to code and feel freedom while developing applications.

More in Tux Machines

Android Leftovers

Explore binaries using this full-featured Linux tool

In 10 ways to analyze binary files on Linux, I explained how to use Linux's rich set of native tools to analyze binaries. But if you want to explore your binary further, you need a tool that is custom-made for binary analysis. If you are new to binary analysis and have mostly worked with scripting languages, 9 essential GNU binutils tools will help you get started learning the compilation process and what constitutes a binary. It's natural to ask why you need yet another tool if existing Linux-native tools do similar things. Well, it's for the same reasons you use your cellphone as your alarm clock, to take notes, as a camera, to listen to music, to surf the internet, and occasionally to make and receive calls. Previously, separate devices and tools handled these functions — like a physical camera for taking pictures, a small notepad for taking notes, a bedside alarm clock to wake up, and so on. Having one device to do multiple (but related) things is convenient for the user. Also, the killer feature is interoperability between the separate functions. Read more

7 ways open source was essential to business in 2020

The COVID-19 pandemic created many new challenges for businesses in 2020 as they rapidly moved non-essential workers to remote operations. However, it also created tremendous opportunities for innovation as people searched for effective ways to work and collaborate virtually. Opensource.com responded to the need by publishing a variety of articles in 2020 on working better with open source. Since it appears working remotely is here to stay for the foreseeable future, make sure you're doing everything you can to adapt by reading the top seven articles about open source business from 2020. Read more

Ubuntu 21.04 Release Date & Planned Features

While development on Ubuntu 21.04 is still (somewhat) early, rumours are already circling about what to expect from the release that Ubuntu developers have dubbed the “Hirsute Hippo”. In this post we rundown everything we know so far, including when Ubuntu 21.04 will be released, how long it’ll be supported for, and what kind of new features and key changes its likely to include. Read more