Programming/Development Leftovers

-
Get started with Fossil, an alternative to Git
As any programmer knows, there are many reasons it's vital to keep track of code changes. Sometimes you just want a history of how your project started and evolved, as a matter of curiosity or education. Other times, you want to enable other coders to contribute to your project, and you need a reliable way to merge disparate parts. And more critically, sometimes an adjustment you make to fix one problem breaks something else that was working.
-
Booting from a vinyl record
Most PCs tend to boot from a primary media storage, be it a hard disk drive, or a solid-state drive, perhaps from a network, or – if all else fails – the USB stick or the boot DVD comes to the rescue… Fun, eh? Boring! Why don’t we try to boot from a record player for a change?
-
Python Namedtuple – Linux Hint
Python comes up with many built-in data structures like lists, dictionaries, and tuples to store and manage the data efficiently. The namedtuple is the dictionary-like container available in the “collections” module. Similar to the dictionaries, the namedtuple also contains the keys that are mapped to values. However, the namedtuple allows accessing the values through keys and as well as through indexes. As compared to the Python dictionaries, accessing the values through indexes is the additional functionality in namedtuple. This article explains the Python namedtuple in detail with examples.
-
Python OrderedDict – Linux Hint
Data structures are the essential components of any programming language that store and manage the data efficiently. Python provides many built-in data structures, i.e., lists, tuples, and dictionaries, that help the programmers to create efficient applications. The Python dictionaries store the data in key-value pairs. The OrderedDict is the subclass of the dict class and maintains the order of the keys in which were inserted in. This is the one and the only difference between the dict and OrderDict. The dict does not maintain the key’s order.
The OrderedDict keeps the order of keys insertion, and when we iterate through the OrderedDict, then it returns the keys in the same order. On the other hand, when the iteration is performed on dict, the keys are returned in random order. However, the dictionaries are now ordered in Python 3.6 and above versions and return the values in the same order as they are inserted. The OrderedDict class exists in the collections module. Therefore, to use the OrderedDict class, first, import the collections module. This article explains the Python OrderedDict in detail with examples.
-
Python Yield – Linux Hint
Yield is a Python built-in keyword that returns the value(s) from a function. The execution of the function is not terminated. Rather, it returns the value to the caller and maintains the execution state of the function. The execution of the function is resumed from the last yield statement. The yield allows us to produce a sequence of values rather than one value. It is used inside a function body. The function that contains a yield statement is known as the generator function.
There are several advantages to yield keyword. For instance, it controls the memory allocation and saves the local variable state. However, it increases the complexity of the code.
-
Python defaultdict – Linux Hint
Python offers many built-in data structures, such as lists, tuples, and dictionaries, to save and manage data efficiently. Dictionaries provide an easy way to save data as key-value pairs. A key acts as an index and is used to retrieve data. Keys should be unique and immutable throughout the dictionary. Keys are mostly strings and integers, though the value of a key could be of any type, such as an integer, string, floating-point number, or complex number. Meanwhile, a dictionary can contain a collection, such as a list, tuple, or some other type of dictionary. A dictionary in Python is created using a pair of curly brackets, in which each key-value pair is separated by a comma.
What if you try to access or modify a specific key in a dictionary that does not exist? Well, in this case, the Python interpreter will raise the “KeyError” error and terminate the execution of the program.
-
How to Add Command Line Arguments to a Python Script – Linux Hint
If you have developed a Python script or application meant to be primarily run in terminal emulators or even GUI apps, adding command line arguments can improve its useability, code readability, application structure and overall user friendliness of the application for the end users. These command line arguments are also called “options” or “switches” and work similarly to arguments you usually see in bash scripts and other C / C++ based programs.
To add arguments to Python scripts, you will have to use a built-in module named “argparse”. As the name suggests, it parses command line arguments used while launching a Python script or application. These parsed arguments are also checked by the “argparse” module to ensure that they are of proper “type”. Errors are raised if there are invalid values in arguments.
Usage of the argparse module can be best understood through examples. Below are some code samples that will get you started with the argparse module.
-
How to stack columns
-
What is Vue.js, and Why is it Cool? – Linux Hint
Vue.js is a progressive JavaScript framework, which is used to build UIs (User Interfaces) and SPAs (Single-page Applications). This framework is famous for its fast-paced learning curve. It is such an easy to learn and approachable library that with the knowledge of HTML, CSS, and JavaScript, we can start building web applications in Vue.js. The fast learning curve is kind of a signature of this framework. It is a versatile framework for our need as a library or a full-fledged framework for building huge web apps.
Evan You have created this framework. The idea of Evan You behind this framework is to build the best framework by combining the best features from already existing Angular and react Frameworks. Before building Vue.js, Evan You was working at Google. Inc and worked on Angular based projects. So, he came up with the idea of building his own framework. He picked the best parts of Angular, like template syntax, easy to use, and picked the best parts of React as well, like two-way data binding, the concept of props, component-based approach, and combined them to make a new framework Vue.js better than both of them.
-

- Login or register to post comments
Printer-friendly version- 2849 reads
PDF version
More in Tux Machines
- Highlights
- Front Page
- Latest Headlines
- Archive
- Recent comments
- All-Time Popular Stories
- Hot Topics
- New Members
digiKam 7.7.0 is released
After three months of active maintenance and another bug triage, the digiKam team is proud to present version 7.7.0 of its open source digital photo manager. See below the list of most important features coming with this release.
|
Dilution and Misuse of the "Linux" Brand
|
Samsung, Red Hat to Work on Linux Drivers for Future Tech
The metaverse is expected to uproot system design as we know it, and Samsung is one of many hardware vendors re-imagining data center infrastructure in preparation for a parallel 3D world.
Samsung is working on new memory technologies that provide faster bandwidth inside hardware for data to travel between CPUs, storage and other computing resources. The company also announced it was partnering with Red Hat to ensure these technologies have Linux compatibility.
|
today's howtos
|








.svg_.png)
Content (where original) is available under CC-BY-SA, copyrighted by original author/s.

Recent comments
1 year 11 weeks ago
1 year 11 weeks ago
1 year 11 weeks ago
1 year 11 weeks ago
1 year 11 weeks ago
1 year 11 weeks ago
1 year 11 weeks ago
1 year 11 weeks ago
1 year 11 weeks ago
1 year 11 weeks ago