Language Selection

English French German Italian Portuguese Spanish

Development

Programming Leftovers

Filed under
Development
  • with Statement – Linux Hint

    The Python with statement is a very advanced feature that helps to implement the context management protocol. When the programmer starts coding, they are basically using the try/except/finally to maintain the resources. But there is another way to do this automatically, called the ‘with’ statement.
    So, in this article, we will discuss how we can use the ‘with‘ statement.

    We can understand this with a very simple example.

    Whenever we code something to read or write a file, the first thing which we have to do is to open the file, and then we perform the read or write operations on that and, at last, we close the file so that all the resources will not be busy. So it means that we have to release the resource after we complete our work.

  • Assembly of Python External C++ procedure returning the value of string type

    Writing C++ procedure below we get a final answer as C++ string , then via sequence of operations which convert string to the pointer (say c) to "const char" and finally return required value via pointer to PyObject provided by PyUnicode_FromString(c) to Python Runtime module.

  • How to split string in C++ – Linux Hint

    Working with string data is an essential part of any programming language. Sometimes we need to split the string data for programming purposes. The split() function exists in many programming languages to divide the string into multiple parts. There is no built-in split() function in C++ for splitting string but many multiple ways exist in C++ to do the same task, such as using getline() function, strtok() function, using find() and erase() functions, etc. The uses of these functions to split strings in C++ have been explained in this tutorial.

  • Do while in c – Linux Hint

    Loops in C are divided into two parts. One is the loop body, and the other is the control statement. Each loop is unique in its way. Do while loop is alike to a while loop in some aspects. In this loop, firstly, all the statements inside the body are executed. In case the condition is true, then the loop is again executed until the condition becomes false. In this guide, we will shed some light on the examples of do-while loops.

  • C++ class constructors – Linux Hint

    Constructors are like functions. These are used to initialize the values and the objects of the class. These constructors are initiated when the object of a class is created. Constructor directly does not return any value. To get the value of the constructor, we need to describe a separate function as the constructor doesn’t have any return type. Constructor differs from the simple function in different ways. A constructor is created when the object is generated. It is defined in the public segment of the class.

    In this article, we will deliberate on all these types of constructors with examples.

  • Comparing Strings in Java – Linux Hint

    It is easier to understand the comparison of characters before learning the comparison of string literals. A comparison of strings is given below this introduction. With Java, characters are represented in the computer by integers (whole numbers). Comparing characters means comparing their corresponding numbers.

    With Java, uppercase A to uppercase Z are the integers from 65 to 90. A is 65, B is 66, C is 67, until Z, which is 90. Lowercase ‘a’ to lowercase ‘z’ are the integers from 97 to 122. ‘a’ is 97, ‘b’ is 98, ‘c’ is 99, until ‘z,’ which is 122. Decimal digits are the integers, 48 to 57. That is, ‘0’ is 48, ‘1’ is 49, ‘2’ is 50, until 9, which is 57.

    So, in this new order, digits come first before uppercase letters, which come next before lowercase letters. Before the digits, there is the bell, which is a sounding and not a printable character. Its number is 7. There is the tab character of the keyboard, whose number is 9. There is the newline character (pressing the Enter key), whose number is 10. There is the space character (pressing the space-bar key), whose number is 32. There is the exclamation character, whose number is 33. There is the forward-slash character, whose number is 47. ‘(’ has the number, 40 and ‘)’ has the number, 41.

  • How to use HashMap in Java – Linux Hint

    The column on the left has the keys, and the column on the right has the corresponding values. Note that the fruits, kivi, and avocado have the same color, green. Also, the fruits, grapes, and figs have the same color, purple. At the end of the list, three locations are waiting for their own colors. These locations have no corresponding fruits; in other words, these three locations have no corresponding keys.

Programming Leftovers

Filed under
Development

  • The four noisy horsemen of Perl hate

                         

                           

    It’s easy to hate what you don’t under­stand. I hope that read­ing this arti­cle has helped you deci­pher some of Perl’s ​“noisy” quirks as well as its fea­tures for increased read­abil­i­ty. Let me know in the com­ments if you’re hav­ing trou­ble grasp­ing any oth­er aspects of the lan­guage or its ecosys­tem, and I’ll do my best to address them in future posts.

  • JDK Flight Recorder support for GraalVM Native Image: The journey so far | Red Hat Developer

    Over the past year, Oracle and Red Hat engineers have worked together to bring JDK Flight Recorder (JFR) support to GraalVM Native Image. Prototype pull requests were first introduced by Red Hat and Oracle in late 2020 and early 2021. Work then continued in a shared repository, with plans to contribute a new pull request incorporating work from all parties. In June 2021, we merged the first pull request that introduces the infrastructure for supporting JDK Flight Recorder on GraalVM with OpenJDK 11 upstream. It is available in GraalVM's 21.2 release. This article shares some of the details behind that story: What native images are, why we worked to add JDK Flight Recorder, some of the technical challenges we faced, and what we're looking to do next.

  • Converting to C++ and refactoring #24 from Eugene Djobs Stream as of 12/25/2020

    The text file contains only capital letters of the Latin alphabet (ABC ... Z). Identify the most common character in the file immediately after the letter X. In the answer, write down this symbol first, and then immediately (no separator) how many times it occurs after the letter X.

  • How To Install A Laravel Project

    In web development, a robust framework is where most developers go. As a result, Laravel is quite popular and loved by many developers. This post will teach you how to install Laravel and set up a basic project.

Adam Jackson: threads and libxcb: problems now we have two

Filed under
Development
Linux

If you want to write an X application, you need to use some library that speaks the X11 protocol. For a long time this meant libX11, often called xlib, which - like most things about X - is a fantastic bit of engineering that is very much a product of its time with some confusing baroque bits. Overall it does a very nice job of hiding the icky details of the protocol from the application developer.

One of the details it hides has to do with how resource IDs are allocated in X. A resource ID (an XID, in the jargon) is a 32 29-bit integer that names a resource - window, colormap, what have you. Those 29 bits are split up netmask/hostmask style, where the top 8 or so uniquely identify the client, and the rest identify the resource belonging to that client. When you create a window in X, what you really tell the server is "I want a window that's initially this size, this background color (etc.) and from now on when I say (my client id + 17) I mean that window." This is great for performance because it means resource allocation is assumed to succeed and you don't have to wait for a reply from the server.

Key to all this is that in xlib the XID is the return value from the call that issues the resource creation request. Internally the request gets queued into the protocol's write buffer, but the client can march ahead and issue the next few commands as if creation had succeeded - because it probably did, and if it didn't you're probably going to crash anyway.

Read more

Programming Leftovers

Filed under
Development
  • Is GitHub a derivative work of GPL'd software?

    GitHub recently announced a tool called Copilot, a tool which uses machine learning to provide code suggestions, inciting no small degree of controversy. One particular facet of the ensuing discussion piques my curiosity: what happens if the model was trained using software licensed with the GNU General Public License?

  • This Week In Rust: This Week in Rust 400
  • Random Thought: Exposure of Perl in the Academic Circles

    Today I have wandered on the famous academic paper archive and suddenly a thought popped into my mind - use Perl as the keyword in searching.

  • Write your first JavaScript code | Opensource.com

    JavaScript is a programming language full of pleasant surprises. Many people first encounter JavaScript as a language for the web. There's a JavaScript engine in all the major browsers, there are popular frameworks such as JQuery, Cash, and Bootstrap to help make web design easier, and there are even programming environments written in JavaScript. It seems to be everywhere on the internet, but it turns out that it's also a useful language for projects like Electron, an open source toolkit for building cross-platform desktop apps with JavaScript.

  • RcppSpdlog 0.0.6 on CRAN: New upstream

    A new version 0.0.6 of RcppSpdlog is now on CRAN. It contains releases 1.9.0 of spdlog which in turn contains an updated version of fmt.

    RcppSpdlog bundles spdlog, a wonderful header-only C++ logging library with all the bells and whistles you would want that was written by Gabi Melman, and also includes fmt by Victor Zverovich. No R package-side changes were needed or made.

Tim Lauridsen: Pimp your Gtk application with CSS

Filed under
Development
GNOME

GTK is a powerful framework for building GUI application in Linux and other OSes. It is written in C, but there is binding for many programing languages like Python.

GTK uses a subset of CSS for styling your application. I have made a little Python Demo Application to show how to pimp your application like a pimp.

Read more

Programming Leftovers

Filed under
Development

  • The Rust Programming Language Blog: Rust 2021 public testing period

    We are happy to announce that the Rust 2021 edition is entering its public testing period. All of the planned features for the edition are now available on nightly builds along with migrations that should move your code from Rust 2018 to Rust 2021. If you'd like to learn more about the changes that are part of Rust 2021, check out the nightly version of the Edition Guide.

  • Released Giblog 2.0, and a movie "How to create your web site using Giblog and Perl"

    Released Giblog 2.0. GIblog is a tool to create your web site easily.

  • Ravgeet Dhillon: Progress Bar in Next.js

    Sometimes when we transition from one route to another, it takes a little time to do so due to different factors. Behind the scenes, it may be rendering a complex page component or doing an API call. In such cases, the app looks like it has frozen for some seconds and then suddenly transitions to the next route. This results in a poor UX. In such cases, it is better to add a progress bar to our application which gives our users a sense that something is loading.

  • Delivering Common Lisp executables using Consfigurator

    I realised this week that my recent efforts to improve how Consfigurator makes the fork(2) system call have also created a way to install executables to remote systems which will execute arbitrary Common Lisp code. Distributing precompiled programs using free software implementations of the Common Lisp standard tends to be more of a hassle than with a lot of other high level programming languages. Executables will often be hundreds of megabytes in size even if your codebase is just a few megabytes, because the whole interactive Common Lisp environment gets bundled along with your program’s code. Commercial Common Lisp implementations manage to do better, as I understand it, by knowing how to shake out unused code paths. Consfigurator’s new mechanism uploads only changed source code, which might only be kilobytes in size, and updates the executable on the remote system. So it should be useful for deploying Common Lisp-powered web services, and the like.

    Here’s how it works. When you use Consfigurator you define an ASDF system – analagous to a Python package or Perl distribution – called your “consfig”. This defines HOST objects to represent the machines that you’ll use Consfigurator to manage, and any custom properties, functions those properties call, etc.. An ASDF system can depend upon other systems; for example, every consfig depends upon Consfigurator itself. When you execute Consfigurator deployments, Consfigurator uploads the source code of any ASDF systems that have changed since you last deployed this host, starts up Lisp on the remote machine, and loads up all the systems. Now the remote Lisp image is in a similarly clean state to when you’ve just started up Lisp on your laptop and loaded up the libraries you’re going to use. Only then are the actual deployment instructions are sent on stdin.

  • Write your first web component

    Web components are a collection of open source technologies such as JavaScript and HTML that allow you to create custom elements that you can use and reuse in web apps. The components you create are independent of the rest of your code, so they're easy to reuse across many projects.

  • Josef Strzibny: Elixir Authorization Plugs

    Similar to Ruby’s Rack, Plug is a general specification for composing modules between web applications and application servers. Here’s how we can use them to build authorized pipelines in your router.

    Note that this post is not about whether you should do authorization at the router level. It’s likely you’ll do it as part of your business logic for the most part. But when it makes sense, you can use Plugs.

  • AMD AOCC 3.1 Compiler Released - Rebased On LLVM 12.0

    AMD earlier this week quietly published a new version of its AOCC code compiler that is now rebased against the upstream LLVM/Clang 12.0 compiler state.

    AMD Optimizing C/C++ Compiler 3.0 was released back in March alongside the EPYC 7003 "Milan" launch. AOCC 3.1 is now available as the latest incremental improvement to this LLVM/Clang downstream that focuses on carrying various out-of-tree patches optimizing the open-source compiler for AMD's Zen microarchitecture family, making Flang suitable for compiling more Fortran code-bases, and other enhancements when building code for AMD CPUs.

Programming Leftovers

Filed under
Development

Open/Development Hardware: Xavier NX and Kinetic Digital Clock With Arduino

Filed under
Development
Hardware
  • Xavier NX edge AI system supports four GMSL cameras

    Vecow’s “EAC-2000” and “EAC-2100” computers run Linux on Nvidia’s Jetson Xavier NX and provide 2x GbE, 2x GbE with PoE+, 4x USB 3.1, and on the EAC-2100, a CAN port and 4x GMSL cam connectors.

    Vecow announced an EAC-2000 Series of fanless embedded computers that run Linux on Nvidia’s Jetson Xavier NX. The rugged edge AI system includes a standard EAC-2000 model and a larger EAC-2100 that adds 4x Fakra-Z connectors for GMSL cameras.

    Vecow manufactures several Intel-based edge AI systems with slots for Nvidia GPU cards, such as its Coffee Lake based GPC-1000. Yet, the new EAC-2000 Series is the company’s first system to run on an Nvidia Jetson module, which also handles CPU duties. The systems support applications including traffic vision, intelligent surveillance, auto optical inspection, smart factory, AMR/AGV, and other AIoT/Industry 4.0 deployments.

  • Kinetic digital clock takes 7-segment displays to another dimension | Arduino Blog

    Seven-segment displays have been around for ages, and they have a really cool retro aesthetic about them. Over on Instructables, user alstroemeria (known as Jacky Mok in real life) decided to build a different kind of display that utilizes individual servo motors to slide the segments out, thus creating a 3D clock. The main board in this project was the Arduino Mega, which was selected due to its large number of digital GPIO pins that can set all 28 of the servos to the correct positions.

Programming Leftovers

Filed under
Development

  • How to Create Audiobooks Using Python – Linux Hint

    As you might already know, Python is a wonderful programming tool because it allows us to do virtually anything! This also means that we can create our own software. In this tutorial, we will learn to synthesize speech, get Python to read pdfs, even translate them for us, and then read them to us.

    What we’re going to do here is to get Python to read us a pdf, and translate it for us. First, we’ll try to create an English audiobook. As such, the first thing we must logically do is to extract the text from the pdf. For this, we use the module known as tika. As usual, to install Tika, one conjures pip.

  • Rakudo Weekly News: 2021.29 Scheduled To 3

    After a lot of discussion, Andrew Shitov has announced the schedule of the first ever Raku Conference (online on 6, 7 and 8 August 2021). Yes, you read that right: 3 days! One track per day.

  • Nibble Stew: A quick look at the O3DE game engine and building it with Meson

    Earlier today I livestreamed what it would take to build a small part of the recently open sourced O3DE game engine. The attempt did not get very far, so here is a followup. It should not be considered exhaustive in any way, it is literally just me poking the code for a few hours and writing down what was discovered.

  • Use GDB Print Stack Trace of Core File

    If you have been programming for a while, you have come across the term core dump.
    If you look at the core man page, it defines as core dump as “a file containing an image of the process’s memory at the time of termination. This image can be used in a debugger (e.g.) gdb to inspect the state of the program at the time that it terminated”.

    In simple terms, a core dump file is a file that contains memory information about a process when the specific process terminates.

    There are various reasons why processes may crash and create a core dump file. This tutorial will show you how to use GDB to view the core dump file and print the stack trace.

  • Calling getpid function in C with Examples – Linux Hint

    Getpid() is the function used to get the process ID of the process that calls that function. The PID for the initial process is 1, and then each new process is assigned a new Id. It is a simple approach to getting the PID. This function only helps you in getting the unique processes ids.

    Functions used in getting ids

    Two types of IDs are present here. One is the current id of the process PID. Whereas the other is the id of the parent process PPID. Both these functions are built-in functions that are defined in library. While running the code without using this library may cause an error and stops executing.

  • C String Concatenation – Linux Hint

    Concatenation is the process to append second string to the end of first string. In this article we are going to discuss how to concatenate strings in C by using different methods.

    The standard C library function which is used to concatenate string is strcat().

  • Quick Sort in Java Explained

    Quick Sort, also written as Quicksort, is a list sorting scheme that uses the divide-and-conquer paradigm. There are different schemes for Quick Sort, all using the divide-and-conquer paradigm. Before explaining Quick Sort, the reader must know the convention for halving a list or sub-list and the median of three values.

    [...]

    What about the case, when the number of elements in the list or sub-list is odd? At the start, the length is still divided by 2. By convention, the number of elements in the first half of this division is length / 2 + 1/2. Index counting begins from zero. The middle index is given by length / 2 – 1/2. This is considered as the middle term, by convention. For example, if the number of elements in a list is 5, then the middle index is 2 = 5/2 – 1/2. And, there are three elements in the first half of the list and two elements in the second half. The middle element of the whole list is the third element at index, 2, which is the middle index because index counting begins from 0.

Programming Leftovers

Filed under
Development

  • [Older] Ultra App Kit Released

    Unlike other alternatives like Dear ImGui, the Ultra App Kit GUI renders in retained mode rather than immediate mode, and is specifically designed for desktop GUI applications. This makes applications snappy and responsive when resizing or refreshing a window.

    DPI scaling is baked into the design for resolution-independent graphics on any screen.

    The GUI can be combined with an embedded OpenGL viewport, or combined with a 3D game engine to make custom editors and game development tools.

    Check out the video tutorials and read the documentation to learn more.

  • Budibase: A no-code platform that turns idea into apps in a blaze

    Budibase is a no-code/ low-code platform built to help developers and decision makers create solid enterprise apps in timely fashion. It packs all the required elements to connect to different data sources, views, forms, and tables which ease the collaboration and building process.

    The platform is super-easy to install, it took less than a minute to get everything up and running. But it promises more, deployment and continuous integration which other low-code and no-code platforms don't take much good care of.

    Budibase fits perfectly in a fast, dynamic business environment, which require new solutions occasionally. It helps to model ideas into apps and ship them rapidly.

  • Run Python applications in virtual environments | Opensource.com

    If you use Python, you probably install a lot of Python applications. Some are tools you just want to try out. Others are tried and true applications you use every day, so you install them on every computer you use. In either situation, it can be useful to run your Python applications in virtual environments to keep them and their dependencies separate from one another to avoid versioning conflicts and to keep them from the rest of your system to improve security.

  • Remi Collet: PHP version 7.4.22RC1 and 8.0.9RC1

    Release Candidate versions are available in testing repository for Fedora and Enterprise Linux (RHEL / CentOS) to allow more people to test them. They are available as Software Collections, for a parallel installation, perfect solution for such tests, and also as base packages.

    RPM of PHP version 8.0.9RC1 are available as SCL in remi-test repository and as base packages in the remi-php80-test repository for Fedora 32-34 and Enterprise Linux.

    RPM of PHP version 7.4.22RC1 are available as SCL in remi-test repository and as base packages in the remi-test repository for Fedora 32-34 or remi-php74-test repository for Enterprise Linux.

  • Meson 0.59 Build System Adds First Class Cython, Wine Resource Compiler Support - Phoronix

    The open-source Meson build system that continues to be increasingly used by open-source projects and other software is out with version 0.59, which continues tacking on more features.

    Meson 0.59 adds Cython as a supported first class language, support is added for the Wine Resource Compiler, new VS2012/VS2013 back-end options for those older versions of Microsoft Visual Studio, Meson sub-projects commands are now run on each sub-project in parallel by default, new build target methods, support on Windows for automatically setting up the Visual Studio environment if necessary, and other changes.

  • A GPIO driver in Rust

    As an example of what a "real" device driver in Rust would look like, Wedson Almeida Filho has posted a translation of the PL061 GPIO driver alongside the original. For ease of reading, the resulting HTML has been reformatted a bit and placed below; viewing in a wide window is recommended.

  • Top 7 Linux Questions from Java Interviews - LinuxTechLab

    In the realm of operating systems for programmers, Linux reigns supreme. There are a lot of reasons to prefer it over other OS: memory management, case sensitivity, and built-in packages.

    So, as a Java developer, you will likely have to make a transition from Windows to macOS to Linux. What should you know to get started and which Linux questions from Java interviews, that programmers should be ready to answer at job interviews?

Syndicate content

More in Tux Machines

Type Title Author Replies Last Postsort icon
Story How to Fix yay: error while loading shared libraries: libalpm.so.12 arindam1989 24/07/2021 - 8:09am
Story Android Leftovers Rianne Schestowitz 24/07/2021 - 7:42am
Story This week in KDE: Power profiles and a more polished Kickoff Rianne Schestowitz 24/07/2021 - 7:34am
Story Debian: Release of Debian 11.0 "Bullseye" Scheduled, Sparky (Debian Based) Adds Viper Browser Roy Schestowitz 1 24/07/2021 - 5:43am
Story today's leftovers Roy Schestowitz 23/07/2021 - 11:25pm
Story Programming Leftovers Roy Schestowitz 23/07/2021 - 11:23pm
Story Computer scientist showcases world's first RISC-V-based Linux PC coupled with an AMD RX 6700 XT GPU Roy Schestowitz 23/07/2021 - 11:09pm
Story today's howtos Roy Schestowitz 23/07/2021 - 11:03pm
Story Kernel: Squashfs Tools 4.5 and Linux 5.15 Work Roy Schestowitz 1 23/07/2021 - 11:02pm
Story Server: AMD Linux Server, VPS, and Rackspace Layoffs Roy Schestowitz 23/07/2021 - 10:31pm