Forum: C
Mar 19th, 2008, 2:38 PM
|
|
Replies: 15
Views: 706
Re: Causing a Seg Fault on Purpose
grumpy, narue and L7sqr gave you the answer.
I have a lot of different unix OS's and architectures here at work. One is a PA_RISC2 64 bit machine. It allocates 4096 bytes of memory minimum to a...
|
Forum: Bash / Shell Scripting
Feb 11th, 2008, 2:29 PM
|
|
Replies: 2
Views: 338
Re: Switch User
The /etc/sudoers file dictates who is allowed to sudo to what account.
When setup up correctly:
sudo su - <someusername>
ls
exit # get out of sudo
requires no password.
If you set up so that...
|
Forum: Bash / Shell Scripting
Feb 11th, 2008, 2:24 PM
|
|
Replies: 1
Views: 253
Re: scripting question
echo "Which directory \c"
read directory
tmpfile=/tmp/tmpfile.$$
for file in loaderconfiguration*.xml
do
sed "s|${directory}|$inName|g" $file > $tmpfile
mv $tmpfile $file
done
|
Forum: C
Feb 4th, 2008, 2:23 PM
|
|
Replies: 9
Views: 274
Re: Accessing bits
Just in case: the bits in a float have different meanings - sign bits, mantissa, exponent.
For a float this is the IEEE 754 standard, which most, but not all systems ahdere to.
Just like endianess,...
|
Forum: C
Jan 25th, 2008, 10:42 AM
|
|
Replies: 13
Views: 414
Re: printf Alignment
Dunno if this helps:
The %n format specifier tells you how many characters have been output at the point %n is encountered in the formatting process. It also is a good place for hackers to attack...
|
Forum: C
Jan 8th, 2008, 4:27 PM
|
|
Replies: 12
Views: 414
Re: Calling exit(???) functions
exit(int status) is defined by standard to close open files, stop the executable image from running and to return the value of status to the calling program. In MS this could be windows explorer, a...
|
Forum: C
Dec 18th, 2007, 11:00 AM
|
|
Replies: 20
Views: 740
Re: Function returning double pointer ?
In C: int foo(); as a function declaration
does mean there is no parameter specification, which then means you can call foo with different numbers of arguments of differing datatypes and not have...
|
Forum: C
Nov 15th, 2007, 1:06 PM
|
|
Replies: 2
Views: 205
|
Forum: Bash / Shell Scripting
May 4th, 2007, 11:24 AM
|
|
Replies: 2
Views: 384
#Bourne shell
VARIABLE="something"
export...
#Bourne shell
VARIABLE="something"
export VARIABLE
#ksh, zsh, bash
export VARIABLE="something"
OR in a pathname? Do you mean this
if [[ -d /path/one || -d /path/two ]] ; then
echo "At least one...
|
Forum: C
Mar 28th, 2007, 2:20 PM
|
|
Replies: 21
Views: 587
|
Forum: C
Mar 9th, 2007, 2:08 PM
|
|
Replies: 13
Views: 402
Canonical vs non-cononical terminal I/O?
The...
Canonical vs non-cononical terminal I/O?
The setbuf function in stdio is defined to be able to turn off/on buffering. Subsequent fprintf calls are affected. In most implementations, you must call...
|
Forum: C
Mar 2nd, 2007, 10:12 AM
|
|
Replies: 21
Views: 587
This is the Knuth PRNG (Pseudo-Random Number...
This is the Knuth PRNG (Pseudo-Random Number generator) that was used in glibc3.1 for Linux, it is reentrant:
int
rand_r (unsigned int *seed)
{
unsigned int next = *seed;
int result;
next *=...
|
Forum: C
Feb 22nd, 2007, 3:30 PM
|
|
Replies: 11
Views: 296
|
Forum: Bash / Shell Scripting
Feb 22nd, 2007, 3:10 PM
|
|
Replies: 8
Views: 391
|
Forum: C
Feb 14th, 2007, 12:17 PM
|
|
Replies: 4
Views: 248
If you are dealing a deck of cards, infogeek's...
If you are dealing a deck of cards, infogeek's method is what you want. You can deal a card only once. If you are doing something with "random" selections, then repeats have to be allowed, because...
|
Forum: Bash / Shell Scripting
Feb 9th, 2007, 3:44 PM
|
|
Replies: 3
Views: 341
In ksh and bash you can use a limited form of...
In ksh and bash you can use a limited form of regex called pattern-matching
ls *.c lists all of the file that have a . followed by the letter c
ls *.[!c] lists all of the files that have a do and...
|
Forum: C
Feb 9th, 2007, 3:34 PM
|
|
Replies: 9
Views: 221
|
Forum: C
Feb 6th, 2007, 3:08 PM
|
|
Replies: 3
Views: 206
|
Forum: C
Feb 6th, 2007, 3:04 PM
|
|
Replies: 4
Views: 177
|
Forum: C
Feb 6th, 2007, 3:02 PM
|
|
Replies: 4
Views: 241
|
Forum: C
Feb 6th, 2007, 2:56 PM
|
|
Replies: 7
Views: 219
|
Forum: C
Jan 24th, 2007, 4:55 PM
|
|
Replies: 2
Views: 202
1. Borland TC 3.0 does not support threads or...
1. Borland TC 3.0 does not support threads or memory sharing.
2. If you must do this with TC 3.0 use a "lock" file as a sempahore-like object.
3. TC 3.0 is a DOS compiler. DOS does not handle...
|
Forum: Bash / Shell Scripting
Nov 30th, 2006, 2:21 PM
|
|
Replies: 2
Views: 276
|
Forum: Bash / Shell Scripting
Nov 16th, 2006, 4:28 PM
|
|
Replies: 4
Views: 260
|
Forum: Bash / Shell Scripting
Nov 16th, 2006, 4:27 PM
|
|
Replies: 4
Views: 358
It constitutes a magic number. UNIX can...
It constitutes a magic number. UNIX can interpret the magic number for a lot of files, and then behave accordingly.
#!/bin/ksh
loads the ksh shell for the duration of the script - the script file...
|
Forum: C
Oct 3rd, 2006, 11:03 AM
|
|
Replies: 9
Views: 241
|
Forum: Bash / Shell Scripting
Sep 28th, 2006, 3:27 PM
|
|
Replies: 12
Views: 667
|
Forum: Other Programming Languages
Sep 18th, 2006, 10:20 AM
|
|
Replies: 2
Views: 162
One strategy is to install the executable with...
One strategy is to install the executable with "knowledge" about what directory it allowed to run in, for example C:\Program Files\Appname\bin
or /usr/opt/local/bin
When it starts it checks to see...
|
Forum: Sed and Awk
Aug 28th, 2006, 10:19 AM
|
|
Replies: 3
Views: 559
|
Forum: Sed and Awk
Aug 23rd, 2006, 4:43 PM
|
|
Replies: 0
Views: 366
Let's try efficiency - a coding challenge
Suppose that we have a really big number file, say 20 MB of numbers in a
single column. It has duplicates. Let's call this file bigfile.
You are given another file, which is much smaller, say 20000...
|
Forum: Bash / Shell Scripting
Aug 23rd, 2006, 3:38 PM
|
|
Replies: 5
Views: 301
The print command line utility will round...
The print command line utility will round numbers.
z=2.111
printf "%.0f\n" $z
stick a :; between do and done That's a colon semicolon
Finally, I don't understand what you mean by reference...
|
Forum: Sed and Awk
Aug 17th, 2006, 8:46 AM
|
|
Replies: 2
Views: 459
|
Forum: Sed and Awk
Aug 16th, 2006, 4:50 PM
|
|
Replies: 2
Views: 459
sed challange
This forum is near death. Maybe some interesting activity will restore it to life.
Challenge - write a simple sed script to reverse a string or file:
prompt$> echo "hi there" | sed 'your script...
|
Forum: C
Aug 11th, 2006, 1:50 PM
|
|
Replies: 10
Views: 333
|
Forum: Other Scripting Languages
Aug 10th, 2006, 6:52 AM
|
|
Replies: 6
Views: 408
Also.
When you have a WHERE clause you return...
Also.
When you have a WHERE clause you return fewer records, using less direct I/O compared to a full-table scan. This gets down to size of the table - ie., number of records in the table. You are...
|
Forum: Other Web Development Languages
Aug 2nd, 2006, 1:50 PM
|
|
Replies: 4
Views: 332
|
Forum: C
Jul 19th, 2006, 2:46 PM
|
|
Replies: 9
Views: 282
|
Forum: C
Jul 17th, 2006, 2:18 PM
|
|
Replies: 24
Views: 499
|
Forum: C
Jul 14th, 2006, 12:14 PM
|
|
Replies: 7
Views: 304
|
Forum: C
Jul 14th, 2006, 12:12 PM
|
|
Replies: 7
Views: 304
It's been six years since I did windows...
It's been six years since I did windows internals. There is a masthead called a directory which has a pointer to the the process page table directory, each page directory entry ( a PDE ) points to...
|