Questions tagged [programming]
Questions about tools for programming (compilers, IDE, etc.) For questions that involve programming, ask on Stack Overflow.
203 questions
0
votes
1
answer
149
views
Keyboard buffer management
On Linux, when a shell is running a process it usually allows you to keep typing commands which will be processed when the process finishes. The same can be observed in other applications that behave ...
1
vote
0
answers
60
views
Running a program/script before a user logs in on RedHat Linux GUI
I am looking to run a script prior to a user being able to log in on the GUI.
Its a basic script, do you accept Ts&Cs Y/N, enter user name, data is captured and stored. Then once complete takes ...
0
votes
0
answers
166
views
How to "wake-up" user space threads from kernel?
Suppose you have a kernel device driver receiving data and a user space threads waiting for the data.
You want to avoid wasted cycles by having the user space thread block and wake-up once the kernel ...
0
votes
0
answers
167
views
Geany: Possible to automatically enable/disable line wrap dependent on file type?
In Geany text editor / IDE, is there a way to tell it to automatically enable line wrapping for certain file types, but not for others?
For example, for .txt files, I would like it to always enable ...
-4
votes
1
answer
97
views
Why build a .deb package vs simply including files? [closed]
I'm confused as to why you would create a .deb package vs simply putting your program in a folder + additional files and writing an install script.
What are the value of packages?
-1
votes
1
answer
83
views
Searching for an old laptop to learn linux [closed]
I have years of experience in programming algorithms and compiling statistics.
Now I would like to develop my skills and immerse myself in the world of Linux in order to get more involved with the ...
1
vote
2
answers
2k
views
Is there a way to do namespaces like in C for bash?
What I'm talking about is like in C, you get to use namespaces with the statement using namespace blah blah blah, can you do the same thing but in bash?
0
votes
1
answer
691
views
Are there Visual Studio -like tools for creating forms in Linux?
I want to create forms in Linux.
I create Windows forms, but for example if I was to use Linux to develop is there any software I could use to create a form like you would in Visual Studio?
1
vote
1
answer
250
views
Sending data with raw socket over gretap
I'm trying to write an IS-IS packet to gretap interface with ISO (0x00fe) protocol type. In this case there is no ethernet header so I'm using raw socket. The gretap always puts 0x6558 as the protocol ...
1
vote
2
answers
557
views
Linearizing a fasta file and removing special characters in
I linearized a fasta file using using awk on a remote computer.
when I used nano to open it, it showed that the file had linearized. However when I downloaded the file to my local computer, and I ...
0
votes
1
answer
56
views
How can I en- and decompress a bootable image?
I have a bootable kernel image, that I had created with MinGW Toolchain's that available for Microsoft Windows 11.
The Project is in size tiny, but I would know: "How can I shrink the image, if ...
4
votes
2
answers
14k
views
Creating a bash script to install packages
I'm quite a newbie when it comes to bash. I'm trying to create a script that checks whether a package is installed or not. If not it will install that package. Not sure what I'm doing tbh.
#! /bin/...
0
votes
2
answers
2k
views
Change permissions on symbolic link [duplicate]
I'm starting in programming with multiple exercices and I don't know how to change my link permission (lrwxrwxrwx to lrwxr-xr-x).
I have already searched solutions from Google and Youtube but nothing ...
0
votes
3
answers
120
views
Quoting rules in a complex situation
When writing lines of code we sometimes need to consider escaping some characters.
I have come across a situation that I cannot answer on my own
In PHP, the exec command requires a string enclosed in ...
0
votes
1
answer
111
views
EPROTOTYPE (_SIGN 41 ) while creating raw socket() in MINIX 3
The following is my code snippet that is producing EPROTOTYPE error, aka, Protocol Wrong Type for Socket.
I checked for the headers in /usr/include in MINIX 3, sys/socket.h contains definitions for ...
5
votes
3
answers
1k
views
Tool to detect errors in application's execution logic
I want to detect errors in application's execution logic. E.g.:
forgot to call free() on address returned by malloc()
did not close file handle returned by open()
invalid flags passed to open()
...
1
vote
0
answers
84
views
A minimal virtual unix shell environment as a library for games
I've played a few games in the past that had somewhat unix-like shell environments, but which were clearly missing major portions of the system because the developer had simply not bothered to ...
-5
votes
1
answer
130
views
How to make CLI applications in Unix? [closed]
How are apps like vim and w3m built? I was trying to find info about this online but I couldn’t really find much.
1
vote
4
answers
178
views
Scoring from input in Bash
Can you help me please?
I have a task. I have from input some text with numbers. For example:
beta 1
score 9
something 2
beta 4
something 1
I need to calculate all numbers with the same ...
1
vote
1
answer
150
views
Linux mint - classify an application correctly in the start menu
Mint auto-classifies applications into categories in the start menu. I use this classification to navigate apps more easily.
Recently I have installed Eclipse IDE and Mint failed to classify it as &...
-1
votes
3
answers
5k
views
What does it mean to both append and prepend a value to a variable (in fish shell or in general)?
Per the fish shell documentation for the set command:
append: causes the values to be appended to the current set of values for the variable. This can be used with --prepend to both
append and ...
0
votes
1
answer
175
views
Remove null variable name and value both while echoing in a single string
i have the below condition where values are as below.
emp_name="Sid"
emp_id=1234
emp_hobby=""
emp_likes="swimming"
emp_dislikes=""
emp_summary="emp_name:$...
0
votes
2
answers
405
views
What is lsh_ used for and/or what is it doing?
I am new to programming in Linux and I am quite confused. I notice the lsh_ prefix is used for function names here. I'm not sure why.
The only thing I can find on the internet is that lsh could ...
2
votes
1
answer
1k
views
get event when user has selected a text in any window in X11
I want to write an app that shows a popup-menu after a user has selected a text in any window in Linux (debian based).
Mac users may know "PopClip" (https://pilotmoon.com/popclip/) and as I ...
0
votes
1
answer
928
views
Bash script printing expression instead of result
I am trying to calculate multiplication of number of arguments and first argument provided by the customer. here the arguments are 10, 15 so total number of arguments is 2. Now i want the shell to ...
1
vote
1
answer
450
views
Ensuring only 1 mandatory parameter is passed to script
I am writing a shell script and new to getopts for parameter parsing.
What I have are 1 optional and 2 mandatory parameters and what I want to do is ensure that only one mandatory parameter is passed. ...
1
vote
1
answer
60
views
how to repeat values of B variable till number of A variables are finished
I have infile with values for 2 variables
# cat infile
A 1
B 2
C
D
E
I want to read variable a & b, so that if $b has null value, it should repeat like 1..2,
till all $a values are read.
so if I ...
2
votes
2
answers
4k
views
Missing header file linux/io_uring.h
#include <linux/io_uring.h>
main.c:1:10: fatal error: linux/io_uring.h: No such file or directory
#include <linux/io_uring.h>
^~~~~~~~~~~~~~~~~~
Kernel version 5.4.0-80.
I ...
2
votes
1
answer
2k
views
How to reposition the elements of a json array conditionally using jq?
I want to re-position elements of an array (change index of array elements) based on a condition. I don't know how to translate this to jq which is more of a functional language.
Basically I want to ...
2
votes
2
answers
6k
views
How to generate thumbnails/previews for files?
I wrote an app for Windows and macOS and I am in the process of porting it to Linux. My app has a file browser implemented and can display thumbnails or document icons of files.
On Windows I get ...
0
votes
1
answer
111
views
How to make a script which create a file with the info i want?
i'm a newbie on Linux here and i was hoping to find help. I was using Centos and i've found an exercise where i have to create a script.
This script should create a text file with the network ...
1
vote
2
answers
3k
views
Printing to the STDOUT vs writing to an output file directly [closed]
Is there any rule of thumb when the result of the program should be printed to the stdout by default, and when the more appropriate approach is to accept output file as one of the arguments and write ...
0
votes
2
answers
161
views
using command subsitition in a bash for loop
I am probably making an obvious mistake but I could use a strong hint:-)
for file in *; do ls $file | var=$(ls $file | grep -Eo '.{18}$' | cut -d '.' -f1 |sed 's/.\{12\}/&./'); echo "var is $...
0
votes
1
answer
198
views
Does the shell script interpreter optimize if else chains?
As far as I understand, an interpreter runs code line by line; but I find probable that my reasoning is incorrect. If in this example case the first if line returns true, will the program know to skip ...
-3
votes
1
answer
68
views
Perl having problem in programme execution [closed]
#!/usr/bin/perl
#Script:name2.pl - Demonstrates use of chop
#
print("Enter your name:");
$name=<STDIN>;
$lname = chop($name); #Removes newline character from $name
...
0
votes
1
answer
423
views
Flip-flop in shell
In Wikipedia there are two relevant articles about the term "Flip-flop":
Flip-flop (electronics)
Flip-flop (programming)
I think that there is a formal-logic common denominator between the ...
0
votes
2
answers
99
views
awk to vlookup and print
I got a comma-separated file
# cat data
smartplayer,2222,off
smartplayer,1111,on
scorer,0000,
I want to search for smartplayer in $1, get its state from $3
and print like this
off-smart-player 2222
...
1
vote
0
answers
113
views
Convert jpg to bmp in an ARM Cortex M4 MCU
I'm currently working in a project that involves the use of an ARM cortex M4 MCU, specifically STM32F429, which has an embedded LCD controller which uses the bmp image format to show the images in the ...
2
votes
2
answers
5k
views
Locating the C header "stdio.h"
I wrote my first C program which is the generic "hello world" program. Could anyone please tell me where can I find stdio.h file in my system? It will help me a lot in understanding of the ...
0
votes
1
answer
45
views
How does many binaries changes the percent number of the execution in its right place?
I'm trying to write a C program which can do the thing that many binaries such as package managers do in execution time. They change and add to the already outputted texts in terminal and it makes it ...
1
vote
0
answers
293
views
How can I listen to port creation events on a network interface?
I would like to create a TUN interface (following this tutorial) that takes specific actions when a listening port is created on it. Those include logging the application that created the port, which ...
2
votes
1
answer
212
views
Pipes and graphics
When developing a program (in C or Python, say), I often write debug messages to see whether my program behaves as intended. On Linux, such text messages can be handled in varied and flexible ways ...
0
votes
0
answers
249
views
How do programs accessing symbolic links differ from users? (What scenarios can break by replacing a file with a symbolic link?)
I think I understand what soft and hard symbolic links are, but I'm not sure how programs access them (as opposed to me, a user).
For example, I want to replace my ~/.bashrc with a symbolic link that ...
0
votes
2
answers
7k
views
How to get into python environment and run some python commands and return to normal terminal using shell script
Sorry about the title it may not be clear. Here is the complete explanation of my doubt. I am writing the below shell script and expecting the mentioned output.
#!/bin/bash
python3
print("Hello ...
1
vote
1
answer
708
views
"Pinging" using DNS protocol
Is there accepted "good practice" for checking that the network connection to a DNS server is operational, and that the server responds minimally, other than issuing a lookup request? ...
0
votes
0
answers
195
views
End process but resume bash script?
I am trying to create a script in which part of it runs a command that can only be stopped by the user sending SIGINT to the process. I want the user to be able to press Ctrl+C to end that part of the ...
1
vote
0
answers
29
views
How to give stdout to different program on same line? [duplicate]
I could do it long way i.e
cat hi.txt | grep 'important url' > imurl
cat hi.txt | grep -v 'not important url' > imnoturl
cat hi.txt | otherprogram1
cat hi.txt | otherprogramN
However, is there ...
0
votes
0
answers
115
views
how to use plantUML after installing PowerTools?
On the understanding that PowerTools includes plantUML I've installed and enabled the package.
How do I now invoke plantUML to use it?
(Although I now realize that the above link is actually for ...
0
votes
1
answer
186
views
How to configure flatpak on CentOS?
I don't believe flatpak is configured:
$ lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 8.2.2004 (Core)
Release: 8.2.2004
...
0
votes
0
answers
338
views
Execute shell commands ubuntu in Python
I'm currently studying Automation and Python programming. I just want to know how I would go about executing a Linux command in Python. The commands I want to execute are:
install = os.system("...