expansion

Avoid expansion of * in bash builtin function let

Hi all, I have a problem with a bash script. I have to use the operator * to multiplicate. Instead the script bugs me with expansion and using as operator the name of the script itself. I tried with single quotes but it doesn't work :( Here's the code #!/bin/bash -x # Bash script that calculates an arithmetic expression # NO PRECEDENCE...

Algorithm for modeling expanding gases on a 2D grid

I have a simple program, at it's heart is a two dimensional array of floats, supposedly representing gas concentrations, I have been trying to come up with a simple algorithm that will model the gas expanding outwards, like a cloud, eventually ending up with the same concentration of the gas everywhere across the grid. For example a giv...

How to escape extended pathname expansion patterns in quoted expressions?

In addition to the basic *, ? and [...] patterns, the Bash shell provides extended pattern matching operators like !(pattern-list) ("match all except one of the given patterns"). The extglob shell option needs to be set to use them. An example: ~$ mkdir test ; cd test ; touch file1 file2 file3 ~/test$ echo * file1 file2 file3 ~/test$ sh...

Why do I get this error using {1..9} in zsh?

I run the following code zgrep -c compinit /usr/share/man/man{1..9}/zsh* I get zsh: no matches found: /usr/share/man/man2/zsh* This is strange, since the following works echo Masi{1..9}/masi This suggests me that the problem may be a bug in Zsh. Is the above a bug in Zsh for {1..9}? ...

Curious C# using statement expansion

I've run ildasm to find that this: using(Simple simp = new Simple()) { Console.WriteLine("here"); } generates IL code that is equivalent to this: Simple simp = new Simple(); try { Console.WriteLine("here"); } finally { if(simp != null) { simp.Dispose(); ...

c++ preprocessor macro expansion to another preprocessor directive

Hi, Initially I thought I needed this, but I eventually avoided it. However, my curiosity (and appetite for knowledge, hum) make me ask: Can a preprocessor macro, for instance in #include "MyClass.h" INSTANTIATE_FOO_TEMPLATE_CLASS(MyClass) expand to another include, like in #include "MyClass.h" #include "FooTemplate.h" template c...

Four Dollar signs in Makefile

Hi, I am reading the document of GNU Make. Here is an example %.d: %.c @set -e; rm -f $@; \ $(CC) -M $(CPPFLAGS) $< > $@.$$$$; \ sed ’s,\($*\)\.o[ :]*,\1.o $@ : ,g’ < $@.$$$$ > $@; \ rm -f $@.$$$$ I tried this on a C++ program, and got the list of files init3d.d init3d.d.18449 input.d input.d.18444 m...

Can't assign FULLTEXT index on my table

I am trying to implement a search function on a database table using query expansion, and I'm aware that I have to add the FULLTEXT index on the fields I want to become searchable. I have tried to do this and got no errors from PHPMyAdmin, but when I examine the structure of the table the cardinality of the FULLTEXT index is 0. I have tr...

How do I temporarily disable a macro expansion in C/C++?

For some reason I need to temporarily disable some macros in a header file and the #undef MACRONAME will make the code compile but it will undef the existing macro. Is there a way of just disabling it? I should mention that you do not really know the values of the macros and that I'm looking for a cross compiler solution (should work ...

Bash globbing - autoexpand for a few specific cases?

I understand that the wildcard * (by itself) will expand in such a way that it means "all non-hidden files in the current folder" with hidden files being those prefixed by a period. There are two use cases that I would think are useful, but I don't know how to properly do: How can you glob for... "All files in the current folder, incl...

home directory expansion (~) within an argument

When I enter the following (BASH): rdesktop -r disk:bacon=~/bacon host It does not expand to rdesktop -r disk:bacon=/home/me/bacon host It seems the "disk:" part is the problem as can be seen in: $ echo bacon=~/bacon disk:bacon=~/bacon bacon=/home/me/bacon disk:bacon=~/bacon How can I make tilde expand? ...

Automake pattern expansion

I'd like to include many files in one Makefile.am file in the xxx_SOURCES = ... part. Is there any way to use a typical shell expansions there? What I'm looking for is a working equivalent for: xxx_SOURCES = xxx.c $(top_builddir)/src/{aaa,bbb,ccc}.c ...

Qt: Expand ~ to home-directory

Does Qt have any platform-independent functionality to accept paths like "~/myfile"? I know about wordexp, but it would be nice with a platform-independent wrapper. Edit: Thank you all for the responses. "~/myfile" was just an example. What I am looking for is functionality to handle file-paths as you would be able to write on the com...

Java: Expanding array size, can't seem to keep all values in original locations.

For my current homework, I'm trying to sort my array through a generic class as the user inserts values into its locations. When the size reads as fully loaded, the array class calls in an expansion method that increases the size of the array while retaining its values in proper locations, which I followed from my Professor's note. For s...

Is there a way to control macro expansion order.

Howdy! I am hoping that someone may have an idea on how to control/specify the order of macro expansion. Here is the context: // 32 bit increments, processor has registers for set, clear and invert #define CLR_OFF 1 #define SET_OFF 2 #define INV_OFF 3 #define SET(reg,bits) *((volatile unsigned long*)( SET(LATB, STATUS_LED); // LATB...

How to prevent wild card glob expansion for occurring for my command like scp does?

I wish for my application to accept an file specification argument literally, without wildcard expansion. This is because the directory from which my command is being run is not the directory (or machine) where the glob expansion should be performed. I believe the scp somehow manages to do this, but I am at a loss to replicate that in ...

jQuery Accordion expand all div

Is it possible to expand all components when page is load or when an event occurs? Thanks!! ...

Bash: trim a parameter from both ends

Greetings! This are well know Bash parameter expansion patterns: ${parameter#word}, ${parameter##word} and ${parameter%word}, ${parameter%%word} I need to chop one part from the beginning and anoter part from the trailing of the parameter. Could you advice something for me please? ...

How can I guarantee full macro expansion of a parameter before paste?

I have a general macro: #define mSwitch( Root, Case ) Root##_Case_##Case #define mSpecialDisplay( what, Val ) mSwitch(mSpecialDisplay,what)(Val) #define mSpecialDisplay_Case_Int(Val) ...do stuff #define mSpecialDisplay_Case_Float(Val) ...do stuff ...more special cases how do I guarantee that the variable Case is fully expanded ...

variable compression and expansion in java?

I would like to create a series of new windows when I click labels containing information. I want these windows to be orphaned. Is there a way to pass a static variable to a class and tell it to keep monitoring the status of that variable? Basically I want to say NewOrphanedWindow.main(StaticClass.ValueToMonitorFromNowOn); Is t...