Language Selection

English French German Italian Portuguese Spanish

Programming Leftovers

Filed under
Development
  • How can I encrypt/protect JavaScript source code

    JavaScript is the most popular web programming language that comes with a lot of useful features. One of these features is immediate parsing i.e the browser executes the code as it downloads the content. This makes it browser interpreted or client side programming language. Therefore, it works on the client machine and hence making it difficult to hide the code from the client.
    Immediate parsing has its perks but it also comes with major downsides. As the source code is easily visible, everyone can read it. This can cause major security risks and hence the code needs to be protected.

    Sometimes you want to protect your JavaScript code from hackers, and sometimes you want to showcase an application but at the same time you don’t want your code to be copied. In this article, we’ll learn how to protect your JavaScript code and decrease the security risk.

  • How to Show or Hide an Element on Website using JavaScript

    Throughout web development, users need to hide or show some elements. These elements can be a button, some animation, or a navigation bar etc. Most of the time the user wants a button or a navigation bar to be visible for the desktop viewpoint but not for the mobile viewpoint.

    With JavaScript, users can easily hide or show an element on the webpage, depending on the behavior of the user. In this article we’ll see how JavaScript is used for this purpose.

  • How to Remove Elements from an Array in JavaScript

    Arrays allow us to store similar kind of data in a single variable. We can then iterate over the data stored in the arrays and perform different functions to manipulate the data according to our needs. A single piece of data in an array is known as its element. JavaScript gives us the option to add and remove elements from an array after we have declared and initialized it. In this post we will only focus on the methods which can be used removing an element from an array.

    JavaScript provides numerous methods which can be used to remove array elements; In this post we will discuss four such methods.

  • How to Loop/Iterate Through an Array in JavaScript

    Loops are key components of every programming language. They are used to run the same code or logic again and again in a cycle. Usually loops have an index value which is different each time the loop repeats. There are different kinds of loops available in JavaScript which help us iterate over an array. An array is a collection that is used to store different elements;

  • How to Minify (Compress) JavaScript Code

    To compress or minify a code means removing all the irrelevant characters from your source code without changing its functionality. These characters include white spaces, comments, new line characters, semicolons etc. But why is minimization of your code necessary? Well, it reduces the size to lesser kilobytes. Hence, making the loading of your website faster and providing the user an amazing experience.

    Various developers write well structured code with spaces and comments. This makes their code understandable. But, at the same time it creates extra space and hence increases the load time.

    This is why minimization of code is extremely useful in JavaScript as it reduces the size of the page. This minimized version provides better functionality without any additional network traffic.

  • How to Read, Write and Parse JSON in JavaScript

    The full form for JSON is JavaScript Object Notation and it is derived from the JavaScript programming language. A standard text format that defines the structured data is based on JavaScript object syntax. Transmission of data in web applications takes place through JSON. Have you heard about JavaScript object literal syntax? Yeah, JSON resembles it in a close manner. We are not limited to use it always with JavaScript.

  • How Do I Delete a Specific Row in PostgreSQL?

    Whenever we talk about the data storage of any website or application, postgresql comes to our mind. This database supports both JSON and SQL querying. Postgresql is customizable, and you can add many services and plugins you think are not present in postgresql, and you need them for your project. If you want to select specific rows to be deleted, postgresql allows you to use the command having Delete statement with “where” command. We have quoted a sequence of examples here in psql and pgAdmin as well.

  • Can You Delete a Vector in C++?

    Yes! Yes, but it does not go without constraints. There are two ways of deleting a vector. Again they do not go without constraints. One way of deleting a vector is to use the destructor of the vector. In this case, all the elements are deleted, but the name of the vector is not deleted. The second way to delete a vector is just to let it go out of scope. Normally, any non-static object declared in a scope dies when it goes out of scope. This means that the object cannot be accessed in a nesting scope (block). A nesting scope is an outer scope (block). A nested scope is an inner scope, which is still part of the scope of interest. These two ways of deleting a vector are discussed in this article.

  • C++ Vector Clear vs Erase

    The C++ vector has many member functions. Two of them are clear() and erase(). clear() “removes” all the elements of the vector. erase() “removes” a single element or a range of elements. There are two overloaded variants of the erase() member function for the vector.

    The title of this article is actually “Vector clear() Member Function versus Vector erase() Member Function, in C++”. This is a comparison of the two-member functions. It deals with when to use which, how to use which, and under which conditions either is used.

  • How I rediscovered Logo with the Python Turtle module | Opensource.com

    When I was in high school, one of the very first programming languages I was introduced to was Logo. It was interactive and visual. With basic movement commands, you could have your cursor (“turtle”) draw basic shapes and intricate patterns. It was a great way to introduce the compelling concept of an algorithm—a series of instructions for a computer to execute.

  • Russ Allbery: DocKnot 5.00

    This release is the culmination of a project that I've been wanting to do for two years, but nearly all the work was done in the past week. That experience made me rethink some of my skepticism, but I'll get to that part of the story later.

    In March of 1999, I got tired of writing HTML by hand and wrote a small program called spin that implemented a macro language that translated into HTML. This makes it one of the oldest programs for which I have a continuous development history, predating podlators by three months. I think only News::Gateway (now very dormant) and Term::ANSIColor (still under active development but very stable) are older, as long as I'm not counting orphaned packages like newsyslog.

    I've used spin continuously ever since. It's grown features and an ecosystem of somewhat hackish scripts to do web publishing things I've wanted over the years: journal entries like this one, book reviews, a simple gallery (with some now-unfortunate decisions about maximum image size), RSS feeds, and translation of lots of different input files into HTML. But the core program itself, in all those years, has been one single Perl script written mostly in my Perl coding style from the early 2000s before I read Perl Best Practices.

More in Tux Machines

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. Read more

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. Read more

today's howtos

  • How to install go1.19beta on Ubuntu 22.04 – NextGenTips

    In this tutorial, we are going to explore how to install go on Ubuntu 22.04 Golang is an open-source programming language that is easy to learn and use. It is built-in concurrency and has a robust standard library. It is reliable, builds fast, and efficient software that scales fast. Its concurrency mechanisms make it easy to write programs that get the most out of multicore and networked machines, while its novel-type systems enable flexible and modular program constructions. Go compiles quickly to machine code and has the convenience of garbage collection and the power of run-time reflection. In this guide, we are going to learn how to install golang 1.19beta on Ubuntu 22.04. Go 1.19beta1 is not yet released. There is so much work in progress with all the documentation.

  • molecule test: failed to connect to bus in systemd container - openQA bites

    Ansible Molecule is a project to help you test your ansible roles. I’m using molecule for automatically testing the ansible roles of geekoops.

  • How To Install MongoDB on AlmaLinux 9 - idroot

    In this tutorial, we will show you how to install MongoDB on AlmaLinux 9. For those of you who didn’t know, MongoDB is a high-performance, highly scalable document-oriented NoSQL database. Unlike in SQL databases where data is stored in rows and columns inside tables, in MongoDB, data is structured in JSON-like format inside records which are referred to as documents. The open-source attribute of MongoDB as a database software makes it an ideal candidate for almost any database-related project. This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the MongoDB NoSQL database on AlmaLinux 9. You can follow the same instructions for CentOS and Rocky Linux.

  • An introduction (and how-to) to Plugin Loader for the Steam Deck. - Invidious
  • Self-host a Ghost Blog With Traefik

    Ghost is a very popular open-source content management system. Started as an alternative to WordPress and it went on to become an alternative to Substack by focusing on membership and newsletter. The creators of Ghost offer managed Pro hosting but it may not fit everyone's budget. Alternatively, you can self-host it on your own cloud servers. On Linux handbook, we already have a guide on deploying Ghost with Docker in a reverse proxy setup. Instead of Ngnix reverse proxy, you can also use another software called Traefik with Docker. It is a popular open-source cloud-native application proxy, API Gateway, Edge-router, and more. I use Traefik to secure my websites using an SSL certificate obtained from Let's Encrypt. Once deployed, Traefik can automatically manage your certificates and their renewals. In this tutorial, I'll share the necessary steps for deploying a Ghost blog with Docker and Traefik.