Linux is a Free (libre), Open Source, Unix-like operating system.
1
vote
3answers
118 views
Possible improvements for this small C program?
I'm learning C and today I wrote a program that displays info about my hardware on ubuntu.
#include <stdio.h>
#include <stdlib.h>
int main()
{
char ch, file_name[25] = ...
1
vote
2answers
63 views
First Database Schema - How did I do?
I would really like some advice from any DB gurus who have a few minutes free. After doing some reading and playing with sqlfiddle over the weekend I have constructed this postgresql schema and it is ...
2
votes
2answers
73 views
Need some advice and feedback on my C code calling Bash functions
My intent is to use Bash functions defined in functions.sh in a C program. I am doing this so that I don't have to rewrite the Bash functionality again in C. I want to use one common library for ...
12
votes
5answers
340 views
Naive C++ Matrix Multiplication 100 times slower than BLAS?
I am taking a look at large matrix multiplication and ran the following experiment to form a baseline test:
Randomly generate two 4096x4096 matrixes X, Y from std normal (0 mean, 1 stddev).
Z = X*Y
...
1
vote
1answer
32 views
Are these set-uid scripts/binaries secure?
I have a system that needs to be able to reboot a different piece of hardware partway through a script that programs it. It used to wait for me to come and reboot the hardware halfway through, but ...
-1
votes
1answer
71 views
Readers and writers (writers-preference). I'm not sure whether my code is wrong or not [closed]
I've found on the wikipedia pseudo-code, so I've decided to try it.
That's the Wiki's code:
int readcount, writecount; (initial value = 0)
semaphore mutex_1, mutex_2, mutex_3, w, r ; (initial value ...
5
votes
3answers
61 views
Can I speed up this simple versioning/backup script?
I'm writing a simple automatic backup/versioning bash script.
It should basically mirror a directory structure somewhere, and then copy files over there when they've been altered. The ghost files ...
2
votes
0answers
152 views
Writing SIMD libraries for C++ on FASM in x86-64 Linux
I have recently started a project of SIMD libraries development for C++ on FASM for x86-64 Linux.
I would be glad to hear any opinion or feedback about the project, cleanness of the code and ...
1
vote
0answers
421 views
C++ TCP Socket Server for Unix
I'm very new to C++, (7 days ago I wrote "Hello World") but I really want to write good code and increase my development skill, so I ask you for some review.
Scheme of socket server
This is the ...
1
vote
1answer
1k views
Producer-consumer in C using pthread_barrier
We're preparing for an exam at the moment, and our lecturer has given us a sample problem to work on. I have it completed, but would like to know a) If it is actually doing what it's supposed to, and ...
2
votes
1answer
101 views
Ls improved, constructive criticism
I have written a script that improves the Linux terminal experience.
This script is introduced here: http://hermannn.com/programs/aa/.
It basically displays the content of the terminals current ...
1
vote
1answer
247 views
Python pyinotify script to run in the background Linux
I want to be able to run this script in the background on a linux machine. Not really doing a program.py & but if you notice to kill the notify process I have a try & except statement that ...
3
votes
4answers
141 views
Improving file reading
I am programing in C language and have created the below functions to read files. There are two functions that I can use to read files. I wanted to know how I can further improve these two in terms of ...
1
vote
1answer
66 views
Trimming whitespace from the beginning and ending of a file
In the code below, I want to remove the "white space character" from 2 places only, from the end of 1st line and from the end of last line. How can I optimize it ?
Platform : Linux , gcc compiler
...
2
votes
0answers
114 views
First steps with amd64 assembly
I try to learn amd64 assembler. This is the first thing I tried. This piece of assembly should replicate the functionality of the following piece of C code, which turns a binary sha-256 hash into a ...
1
vote
3answers
731 views
Bash script to swap out, edit host files
So this is my first useful bash script. It's meant to make it easy to switch between a "work" hosts file (that blocks sites like reddit.com, youtube.com, etc.) and my normal hosts file, and also to ...
2
votes
2answers
82 views
How to improve the way I handle greping in this script
What my script does is:
Append data to a file on a continuous basis.
If an error pattern is observed, then do something.
I need feedback on the way I am grepping for patterns in the continuously ...
4
votes
2answers
198 views
Suggestions needed to improve my code ( bash script)
I wrote a bash script to print contents of files in a given directory in a loop. I kindly need suggestions mainly on the following aspect:
How can I improve command line parameters handling to the ...
3
votes
2answers
1k views
Linux C++ Timer Class: How can I improve the accuracy?
I wrote this class today, but I am trying to figure out how to make it more accurate. I pass in seconds and multiply by 1000 to make it milliseconds and the time does not line up. I need the ability ...
1
vote
2answers
304 views
Correct User Input - x86 Linux Assembly [closed]
So I am working on an x86 Assembly program for Linux using NASM. This program basically asks the user for their name and their favorite color. After doing this and storing the two strings in variables ...
2
votes
0answers
478 views
mutex and condition variable implementation using futex
I have implemented mutex and contition variables using futex syscall. I believe that my implementation is correct, but would like it to be verified by some one else. If some of you could verify its ...