Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 3 years ago. Improve this question I am currently developing an executable which runs on linux. I want to hav…
Tag: linux
ruby Array.inspect vs. Array[element].to_s
I’m working with an array, which we’ll call books, of complex objects, which we’ll call Book. The problem is when I call puts “#{books.inspect}”, ruby outputs a stream of binary (unreadable utf8 characters). However, when I call puts #{books[0].to_str}”, I get a brief, pret…
Git aliases – command line autocompletion of branch names
If I run a regular git command such as git checkout I get helpful autocompletion of branch names when hitting the tab key. I have a few git aliases which take branch names as parameters, and I’m wondering if there’s a way of getting the branch name autocompletion to work with them? Edit: Just to p…
Easiest way to locate a Segmentation Fault
I encountered my first Segmentation Fault today (newbie programmer). After reading up on what a segmentation fault is (Thanks for all of the helpful info on this site, as well as Wikipedia’s lengthy explanation), I’m trying to determine the easiest way to go about finding where my fault is occurin…
Does struct hostent have a field “h_addr”?
I encountered the following code snapshot: I am rather confused by the last statement, the declaration of struct hostent is like this: It doesn’t have a field named “h_addr”, but the code did can compile, can anyone tell me why? thanks. Answer You missed this bit right under it: So no, there…
Editing the sudoers file on Mac or Linux when you have no permissions
I’m trying to install something on my MacOS (or Linux) system and I don’t have permission because I’m not the admin. So I tried using sudo and it says that I’m not in /etc/sudoers file. I’ve tried editing the sudoers file but it won’t let me, so I “googled” it. …
Why is the close function is called release in `struct file_operations` in the Linux kernel?
I’m trying to make a linux kernel module, which supports open, close, read and write operations. So I want to register these functions via struct file_operations, however I can’t find ‘close’ entry in the struct. I think I should use ‘release’ instead of ‘close’…
How to suppress warnings in GNU octave
I am using Octave version 3.4.3, and I get this warning: I know why this warning occurs, I just want to make the warning not appear on screen when run. I know I can suppress ALL warnings by putting this command at the top of my octave program: Docs: https://octave.sourceforge.io/octave/function/warning.html B…
How to use FANN in C++
Here I have read good references about FANN for Artificial Neural Networks in C/C++. Actually I am using C++ (on Ubuntu with g++ v4.6.1). The library written in C, has a wrapper for C++. But I don’t get it to work. Even the example included xor_sample.cpp works. I have a Makefile with a line like this: …
How do I get the interrupt vector number on Linux?
When I run “cat /proc/interrupts”, I can get the following: How can I get the interrupt number of “NMI” “LOC” “SPU” “PMI”, etc. Answer On x86 NMIs are always on interrupt vector 2. The number is hard-coded just as common exceptions (division by 0, pa…