506 Posted Topics

Member Avatar for Shruti4444

[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 …

Member Avatar for IIM
1
131
Member Avatar for anjoz

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 ] && …

Member Avatar for thekashyap
0
136
Member Avatar for kristo5747

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 …

Member Avatar for kristo5747
0
221
Member Avatar for vaibhav1983

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 …

Member Avatar for thekashyap
0
93
Member Avatar for airbourne

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 …

Member Avatar for L7Sqr
0
719
Member Avatar for chhabraamit

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 …

Member Avatar for Narue
0
311
Member Avatar for ssesham1

[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".

Member Avatar for thekashyap
0
428
Member Avatar for warlord902

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].

Member Avatar for thekashyap
0
573
Member Avatar for winecoding

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?

Member Avatar for thekashyap
0
203
Member Avatar for htmler

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.

Member Avatar for stultuske
-1
91
Member Avatar for prathu1

"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.

Member Avatar for thekashyap
0
255
Member Avatar for ChosenOreo

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 …

Member Avatar for abhimanipal
0
175
Member Avatar for lochnessmonster

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: …

Member Avatar for thekashyap
0
187
Member Avatar for vasuv
Member Avatar for thekashyap
0
147
Member Avatar for surferxo3
Member Avatar for bibiki

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, ...) …

Member Avatar for bibiki
0
115
Member Avatar for ekailan

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, *, [], ., ->, ...) …

Member Avatar for predator78
0
112
Member Avatar for Sonia11

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' …

Member Avatar for mrnutty
0
307
Member Avatar for adarshcu

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 …

Member Avatar for thekashyap
0
183
Member Avatar for stereomatching

[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, …

Member Avatar for thekashyap
0
160
Member Avatar for narlapavan

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.

Member Avatar for thekashyap
0
64
Member Avatar for tikoti
Member Avatar for thekashyap

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 …

Member Avatar for thekashyap
0
201
Member Avatar for empyrean

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] …

Member Avatar for thekashyap
0
293
Member Avatar for chintan_1671

[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:: * …

Member Avatar for thekashyap
0
1K
Member Avatar for thekashyap

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 …

Member Avatar for thekashyap
3
573
Member Avatar for thekashyap

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 …

Member Avatar for thekashyap
0
386
Member Avatar for ajwest85

[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 …

Member Avatar for thekashyap
0
147
Member Avatar for keeda

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.

Member Avatar for thekashyap
0
112
Member Avatar for rkumra

Did you check details using -d option? clearmake -d "whatever other options/params you used"

Member Avatar for thekashyap
0
67

The End.