05/26/19

Loop through an array of strings in Bash?

I want to write a script that loops through 15 strings (array possibly?) Is that possible? Something like: for databaseName in listOfNames then # Do something end
C++

05/21/19

Is there a technical reason to use > (<) instead of != when incrementing by 1 in a 'for' loop?

I almost never see a `for` loop like this: for (int i = 0; 5 != i; ++i) {}Is there a technical reason to use `>` or `<` instead of `!=` when incrementing by 1 in a `for` loop? Or this... more
C

05/21/19

Core dumped, but core file is not in the current directory?

While running a C program, It says *"(core dumped)"* but I can't see any files under the current path.I have set and verified the `ulimit`: ulimit -c unlimited ulimit -a I also tried to find... more
C

05/20/19

Why do you have to link the math library in C?

If I include `<stdlib.h>` or `<stdio.h>` in a C program I don't have to link these when compiling but I do have to link to `<math.h>`, using `-lm` with gcc, for example: gcc... more
C

05/20/19

How to initialize all members of an array to the same value?

I have a large array in C (not C++ if that makes a difference). I want to initialize all members to the same value. I could swear I once knew a simple way to do this. I could use `memset()` in my... more

05/17/19

How do I remove an element from a list by index in Python?

How do I remove an element from a list by index in Python?I found the `list.remove` method, but say I want to remove the last element, how do I do this? It seems like the default remove searches... more

05/14/19

Remove a symlink to a directory?

I have a symlink to an important directory. I want to get rid of that symlink, while keeping the directory behind it. I tried `rm` and get back `rm: cannot remove 'foo'`. I tried `rmdir` and got... more

05/14/19

How can I exclude directories from grep -R?

I want to traverse all subdirectories, except the "node_modules" directory.

05/14/19

How can I exclude directories from grep -R?

I want to traverse all subdirectories, except the "node_modules" directory.

05/12/19

Double-entry accounting libraries for Java?

What double-entry accounting libraries are available for Java?
Sql

05/12/19

How to reset AUTO_INCREMENT in MySQL?

How can I ***reset*** the `AUTO_INCREMENT` of a field? I want it to start counting from `1` again.

What is a bus error?

What does the "bus error" message mean, and how does it differ from a segfault?

05/11/19

Two submit buttons in one form?

I have two *submit* buttons in a form. How do I determine which one was hit serverside?

05/06/19

How do I prompt for Yes/No/Cancel input in a Linux shell script?

I want to pause input in a shell script, and prompt the user for choices. The standard 'Yes, No, or Cancel' type question. How do I accomplish this in a typical bash prompt?

05/05/19

How to update a value, given a key in a java hashmap?

Suppose we have a `HashMap<String, Integer>` in Java. How do I update (increment) the integer value of the string key for each existence of the string I find? One could remove and reenter the... more
C

05/05/19

Using boolean values in C?

C doesn't have any built-in boolean types. What's the best way to use them in C?

05/05/19

How to make the 'cut' command treat same sequental delimiters as one?

I'm trying to extract a certain (the fourth) field from the column-based, 'space'-adjusted text stream. I'm trying to use the `cut` command in the following manner: `cat text.txt | cut -d " " -f... more

How do you stop interim solutions from lasting forever?

Say there are two possible solutions to a problem: the first is quick but hacky; the second is preferable but would take longer to implement. You need to solve the problem fast, so you decide to... more

05/05/19

Library for polynomial calculus in Java?

Are there any (preferably open source) library for Java that allows one to do calculus with polynomial e.g. addition, multiplying, dividing by constans etc. ? Also if it would be capable to... more

05/04/19

Aborting a shell script if any command returns a non-zero value?

I have a Bash shell script that invokes a number of commands. I would like to have the shell script automatically exit with a return value of 1 if any of the commands return a non-zero value. Is... more

05/04/19

Aborting a shell script if any command returns a non-zero value?

I have a Bash shell script that invokes a number of commands. I would like to have the shell script automatically exit with a return value of 1 if any of the commands return a non-zero value. Is... more

05/03/19

Bash tool to get nth line from a file?

Is there a "canonical" way of doing that? I've been using `head -n | tail -1` which does the trick, but I've been wondering if there's a Bash tool that specifically extracts a line (or a range of... more

05/03/19

use space as a delimiter with cut command?

I want to use space as a delimiter with the `cut` command. What syntax can I use for this?

05/02/19

sometimes my file just freezes in my vi |vim, what happened?

Sometimes when I edit my file using vi or vim, my file just freezes. Even if I type <kbd>Ctrl+C</kbd> or <kbd>Ctrl+D</kbd>, it still freezes there. I `kill -9 <pid>`... more

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.