506 Posted Topics
Re: [QUOTE=smrati.katiyar;1540474]cat filename | grep word | echo "$?" if the result of above oneliner is 0 it means the word is there in the file . if it's non zero it means word is not there.(echo "$?" tells us whether the previous command was successful or not) let say your … | |
Re: May be there is an easier way, but here is what I can think of.. [CODE]total_params=`echo $* | sed 's/ */\n/g' | sort | sed '/^$/d' | wc -l` unique_params=`echo $* | sed 's/ */\n/g' | sort -u | sed '/^$/d' | wc -l` [ $total_params -ne $unique_params ] && … | |
Re: Why don't you simplify your code? It's looking too complex to understand really. [CODE]for myfile in `find . -name "R*VER" -mtime +1` do echo "Processing $myfile" # did you mean to use -l instead of -H by any chance? # Two conditions on RHS and LHS do not produce similar … | |
Re: That's how it works! :) What do you want to do? To process the file line by line you should directly pipe the output of cat to next command like: [CODE]cat orders.0613 | awk ... cat orders.0613 | sed ... cat orders.0613 | cut ... # Of course all of … | |
Re: There are 2 simple options: 1. If the number of params are not too many just pass them on command line: [CODE]#/bin/bash APPLICATION=$1 LOCALHOST=`hostname -s` REMOTEHOST=$2 WEBDATA=$3 SQLUSER=$4 SQLPASS=$5 SQLDB=$6 # --------------------------------------------- #run like this: backup.sh appName remotehost webdataLocation usr pswd db[/CODE] You name make them named params [URL="http://stackoverflow.com/questions/402377/using-getopts-in-bash-shell-script-to-get-long-and-short-command-line-options"]using the … | |
Re: I would guess he means "formatted I/O" instead of buffered I/O. Which would be fprintf/fscanf. Basically the functions that try to interpret the data that's read to some specific type. I never tried in C/C++ but in Java it was quite clear that ObjectInputStream.readInt() is much slower than FileInputStream.read(). If … | |
Re: [QUOTE=Narue;1577057]...answer is no...[/QUOTE] Technically correct is to say that: Yes, but it doesn't make sense. As the templates are "compiler feature", definition of a template must be in the same compilation unit as the user. So if you do this all users would have to [ICODE]#include[/ICODE] the "implementation source file". | |
Re: Static members are init'd when teh class is loaded. Classloader's [URL="http://download.oracle.com/javase/1.4.2/docs/api/java/lang/Class.html#forName%28java.lang.String%29"]forName()[/URL] method is the one that is supposed to do it. Exception is when you explicitly ask classloader NOT to init the class but just load it by passing false as second argument to the [URL="http://download.oracle.com/javase/1.4.2/docs/api/java/lang/Class.html#forName%28java.lang.String,%20boolean,%20java.lang.ClassLoader%29"]overloaded forName()[/URL]. | |
Re: Yeah, it looks like some class path issue and not exactly a compilation error. Answer NormR's question.. [QUOTE]java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory [/QUOTE] Where is the class that is referred to in this error message? | |
Re: You write code for [URL="http://en.wikipedia.org/wiki/Selection_sort#Algorithm"]selection sort[/URL]! Might help to see [URL="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Comparable.html"]Comparable[/URL] as well, you can make your implementation a bit generic. | |
Re: "shell is uninitialized" means that the files (scripts) listed there (/etc/profile, ...) are NOT executed. So whatever env variables you're setting/updating in those files are not set/updated. | |
Re: In short try implementing some OS kernel services. - I would recommend you take a look at anything that describes the kernel functions/algorithms. ---- [URL="http://en.wikipedia.org/wiki/Kernel_%28computing%29"]A starting point[/URL]. ---- Another one: Just implement a part of [URL="http://en.wikipedia.org/wiki/POSIX"]POSIX[/URL]'s [URL="http://pubs.opengroup.org/onlinepubs/9699919799/"]specification[/URL]. :) - You can always get more info on how say RHEL implements … | |
Re: Mike already gave an excellent example. Just to point out in different words. In a good design you want abstraction. And that's provided by inheritance (among other options) primarily. As long as users use abstractions (Shape in this case) they're shielded from implementation details. A good example from "Java" is: … | |
Re: Put enough info in the question.. POSIX/Windows? What's the problem? | |
| |
Re: If your question is purely on GUI (how to take an expression as input): - Make a list of functions supported by your code and build a GUI such that user can only use one of those. - Fix the number of variables supported in an expression (1, 2, ...) … | |
Re: Yes. There are 2 ways to look at it: 1. You do all your operations by reading / writing to file from your code. Instead of memory. I.e. you take care in your code to access file. 2. You overload all required operators (new, delete, *, [], ., ->, ...) … | |
Re: well, what you've written is a pure C++ class, without using templates. Unless you use the template type inside declaration/definition of the class it's not a template class. In your case you're not using the tyep elemType anywhere. So it has no effect. It's like an idiot wearing the wise-guys' … | |
Re: What do you wnat to validate? I.e what's the validation? Perhaps match() takes a long time due to the generic nature of the regEx you're using. Pattern.compile() however shouldn't take any longer/shorter as it's not connected to the input at all. Can you enhance the code you've posted so that … | |
Re: [QUOTE=firstPerson;1562010]It might be possible but it would be a lot of work, and might not be worth it. Is this just for curiosity or a project or something else?[/QUOTE] Can you give at least an outline how can you do this? My understanding is that templates are a compiler feature, … | |
Re: You can - do rsh/ssh/telnet to execute the ls/stat command and get it's output. - do cp/rcp/scp to get the file itself to local machine and find out the size. | |
Re: What is the problem?! Any errors you're getting.. | |
Hi, I wrote [URL="http://www.daniweb.com/software-development/cpp/code/363562"]this C++ article[/URL]. 1. At first I thought of making it a tutorial, but when I create a new post there is no option in the combo to say it's a tutorial. Only options available were discussion thread and code snippet. I was hoping to get an … | |
Re: You can use sed or awk. Perhaps awk is more readable if you're new to shell scripting. Create one RE each for ID, PA, PT and Sequence. And in the body print the output. something like: [CODE]awk ' /^ID / { print $2,";" } /..../ { print ... } '[/CODE] … | |
Re: [quote]error C2440: 'static_cast' : cannot convert from 'void (__thiscall CChatView:: * )(LPARAM,WPARAM)' to 'LRESULT (__thiscall CWnd:: * )(WPARAM,LPARAM)' [/quote] It's been 10 years since I did some MFC so don't really remember. But from teh error msg itself you can deduce this: Your declaration translates to: [iCODE]void (__thiscall CChatView:: * … | |
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. [COLOR="Red"][B]A brief on problem:[/B][/COLOR] Lets take example problem for simplicity: - I have a GSM network with a cell in it. - Cell's coverage … | |
Hi, I have a problem where I need to generate hash for ~10e9 (1 bio) keys. I tried creating a hash of my own but after all the research I realized that I can as well (or even should) use one of existing functions. I narrowed down on SHA-1, which … | |
Re: [CODE]for (i in name) { printf("%15s %21.2f\n", name[i], sales[i]) | "sort -nr" }[/CODE] In this i is set to each "value" of the array element and not the index. There is no simple way to find the array size in awk. Some newer versions of gawk, nawk support it. So … | |
Re: What if you hardcode the key inside the script and then [URL="http://linux.koolsolutions.com/2009/01/20/howto-encrypting-a-shell-script-on-a-linux-or-unix-based-system/"]encrypt the script itself[/URL]? Given that shell script itself is not human readable anymore, your key is safe. Downside is that every change in script would need to you to re-encrypt it. | |
Re: Did you check details using -d option? clearmake -d "whatever other options/params you used" |
The End.