825 Posted Topics

Member Avatar for monica23

Couple of things: [icode]puts "sum"[/icode] just outputs the string [icode]sum[/icode] not the value of the variable. If you'd like that you need to do something like [icode]puts "#{sum}"[/icode] or, simply [icode]puts sum[/icode]. As for the addition, I'm not sure if you are looking to do string concatenation or a value …

Member Avatar for monica23
0
113
Member Avatar for physicist

You can use [icode]printf[/icode] in C++. Just [icode]#include <cstdio>[/icode]. You will want to declare [icode]main[/icode] as being of type [icode]int[/icode] and will likely want to provide a return value.

Member Avatar for Schol-R-LEA
0
416
Member Avatar for beantine

Struct (or arrays of structs) can only be populated in the form you show at declaration. So to do what you want you need to do one of the following: [code]strncpy (stock[0].title, "example title1", 40); strncpy (stock[0].author, "example author1", 40); stock[0].edition = 1; stock[0].retail_price 5.80;[/code] or [code] book stock[10] = …

Member Avatar for WaltP
0
2K
Member Avatar for roshan_iiita

Find a problem; solve it with shell scripts. You are starting at the wrong location. A language by itself is meaningless. If you want to learn how to solve problems [i]using[/i] a language then you first need to define a problem and then proceed. Your request is very much like …

Member Avatar for dbashell
0
391
Member Avatar for itengineer7

If you are going to use a file-based approach why not use something that is somewhat more robust? [url=http://linux.die.net/man/1/lockfile]lockfile[/url] already accomplishes what [b]Gromit[/b] suggests but provide a more standard means to achieve it.

Member Avatar for L7Sqr
0
148
Member Avatar for bossman5000

[code]VALUE=100 VALUE=$((VALUE + 20))[/code] That should answer both of your open questions.

Member Avatar for bossman5000
0
202
Member Avatar for Zssffssz

If you are on a Windows box then UNIX time is pretty useless, yes? Maybe you want something like 'seconds since the epoch' or similar to that?

Member Avatar for vijayan121
0
884
Member Avatar for ooops.789

There are several online networking tutorials online (Beej is a good google term) - I'll assume that you have read these and will ask direct questions on points you do not understand. The answer to your question, then, is that you[LIST] [*]open socket, listen and accept the client connection [*]read …

Member Avatar for L7Sqr
0
559
Member Avatar for GhostMonkey

As I understand what I've [just] read about Manhattan distance it is a comparison between two points. That requires at least 2 x-values and 2 y-values. How do you expect to sort based on that requirement with just a list of [icode]int[/icode] values? Or have I missed something entirely?

Member Avatar for raptr_dflo
0
108
Member Avatar for Xcelled194

You are not going to get [icode]Mbps[/icode] speedup by changing from C# to C++. How many times did you run this test? What was the state of your network when you ran these tests? Getting double the [i]transfer[/i] rate is indicative of a network problem, not a code problem. [NOTE]: …

Member Avatar for L7Sqr
0
580
Member Avatar for ankit.4aug
Member Avatar for pfm200586

My first question is whether or not you [i][u]must[/i][/u] do this as a shell script of if you can use something more suited to the task - such as perl, ruby, or python?

Member Avatar for L7Sqr
0
917
Member Avatar for ai70

Why not filter on the values you [i]do[/i] wat to allow? Something like:[code]temp.gsub(/./) { |c| if (65..90).include? c.ord or (97..122).include? c.ord c else "" end }[/code]

Member Avatar for L7Sqr
0
70
Member Avatar for bossman5000

[url=http://www.daniweb.com/software-development/shell-scripting/threads/389077]This[/url] is a good thread to get you started.

Member Avatar for L7Sqr
0
215
Member Avatar for phorce

A memory location has an address. Depending on your system the size of that address will vary. If you need to address 64 bits you will need more digits than addressing 32 bits. You may have been seen a hypothetical scenario where the numbers were used to in crease clarity …

Member Avatar for L7Sqr
0
125
Member Avatar for pfm200586

Here are a couple of hints to get you going: [list] [*] [icode]${#}[/icode] reports the number of arguments currently available [*] [icode]shift[/icode] decrements the number of available arguments[/list] Combining those two should give you ample ammunition for a while loop. The construct, by the way, is[code]while [[ ${CONDITION} ]]; do …

Member Avatar for L7Sqr
0
94
Member Avatar for Knome

Your problem may be that the [icode]excludeDir[/icode] is running in a subshell and not giving you the effect you want. Perhaps something like the following would work?[code]for i in /Users/*; do if [[ -d ${i} ]]; then excludeDir ${i} if [[ $? -eq 0 ]]; then echo ${i} fi fi …

Member Avatar for L7Sqr
0
185
Member Avatar for manpreet87

In stead of storing the entire trace and checking against that why not store some representation of that? For instance, a [icode]md5sum[/icode] takes negligible time on my system for a 13K file. You could store the MD5 of the unique traces you find and for each new one only do …

Member Avatar for manpreet87
0
216
Member Avatar for nikita.

Without context, that makes no sense to me. It could be a user-defined function in a program. It could be a little know API method for some package you have installed. It could be a compilation error. Where did you find/see this code? What is the surrounding context?

Member Avatar for L7Sqr
0
104
Member Avatar for Zssffssz

Any reason you couldnt use [icode]system[/icode] to do this? It is a blocking call so you'd have to wait until the other process returned or you could look into something like [url=http://msdn.microsoft.com/en-gb/library/t7y6z6fd(VS.80).aspx]_spawnlp[/url] with [icode]_P_NOWAIT[/icode].

Member Avatar for Ancient Dragon
0
188
Member Avatar for usustarr

First, you need a way to determine the last 100 lines. getline with a fixed-size buffer sounds like a start there. Then you iterate over only the lines left in the buffer.

Member Avatar for usustarr
0
195
Member Avatar for RohitSahni

In general, hijacking a 3-year-old thread is not a good start. As for your question, you decrease the width by putting less things in the cell. If, on the other hand, you are reading a CSV file and the contents are being imported in another format you need to configure …

Member Avatar for L7Sqr
0
2K
Member Avatar for ooops.789

This answer will be very similar to the directions [url=http://www.daniweb.com/software-development/c/threads/392126]here[/url] with the exception that instead of handling the file contents you will want to use the OS API for listing files within a program and write [i]that[/i] to the client instead of the file contents.

Member Avatar for L7Sqr
0
72
Member Avatar for babyhuyx

THe following line [code]if(favorite == info[n].weapon)[/code]Should probably be[code]if(favorite == fencers[n].weapon)[/code] Similar to the way you handle things in [icode]getTeam[/icode]

Member Avatar for babyhuyx
0
2K
Member Avatar for Gyani.gtst

Redirection works on each output stream from the program. So, for instance, if your called program writes to stdout and stderr then you need to capture and redirect both. Example:[code] # Redirect only stdout some/bin/program >/dev/null # Redirect only stderr some/bin/program 2>/dev/null # Redirect both stdout and stderr (to individual …

Member Avatar for L7Sqr
0
95
Member Avatar for vidhya33

In general, [icode]tcpdump[/icode] or [icode]wireshark[/icode] are useful tools in this respect.

Member Avatar for L7Sqr
0
35
Member Avatar for red711

Well, the error you are seeing is due to the fact that you haven't linked against the cirl library for your system (on linux-like systems this would look something like [icode]-lcurl[/icode] as a parameter to the compiler). Also, [icode]popen[/icode] takes a program name to execute as if you were going …

Member Avatar for L7Sqr
0
852
Member Avatar for SakuraPink

How about something along the lines of[code]sed -e 's/'3428$i'/'$((3428$i + 10*$j))'/g'[/code]

Member Avatar for SakuraPink
0
148
Member Avatar for scarlettmoon

If the format of one array determines the output of the other it might just be better to have a 'mapping' from one to the other. For instance, to map ints to strings you might do[code]std::map< int, std::string > months; months[1] = "January"; months[2] = "February"; // ... and so …

Member Avatar for phfilly
0
528
Member Avatar for ultimo1

This is a non-trivial task. There are many questions that you've left unanswered to help us help you. As an assignment, is this part of some larger context system you must fit into? For instance, is there an API for communicating with your upper and lower layers? Are you using …

Member Avatar for L7Sqr
0
211
Member Avatar for nikita.

If you are using [icode]bash[/icode] just execute the file with the [icode]-x[/icode] flag. Consider the following:[code] $ cat t.sh #!/bin/bash echo "Foo" >&2 echo "Bar" >&1 $ bash t.sh Foo Bar $ bash -x t.sh + echo Foo Foo + echo Bar Bar $ [/code] You can see that not …

Member Avatar for nikita.
0
4K
Member Avatar for valestrom

[QUOTE=Clinton Portis;1672550]Here is a general progression for using large numbers: 1. use a standard variable [/QUOTE] What is a [i]standard[/i] variable? I assume that you mean something smaller than a [icode]long[/icode], but there are several, so you should specify. [QUOTE=Clinton Portis;1672550] 5. use a c-string buffer[/QUOTE] I'd seriously caution against …

Member Avatar for Clinton Portis
0
262
Member Avatar for LMHmedchem

If the original drive was bad, what makes you think that the numbers it's reporting are valid? If you find that the numbers [i]are[/i] good then I would suggest you start with the list of files that had problems and you had to replace with backups. Do a [icode]diff[/icode] on …

Member Avatar for L7Sqr
0
168
Member Avatar for sarita_1

I'm not familiar with SugarCRM, but [icode]cron[/icode] has online [url=http://unixgeeks.org/security/newbie/unix/cron-1.html]resources[/url] readily available.

Member Avatar for L7Sqr
0
47
Member Avatar for linux

[icode]*x[/icode] is a way to access the first element of the character array [icode]x[/icode]. To do what you want properly, you need to iterate over all elements of the string and convert each in turn while properly maintaining the resulting value. As a hint, you may think of the following:[code] …

Member Avatar for linux
0
303
Member Avatar for Arcrammer

Ruby is a scripting language. It requires an interpreter - either command-line or embedded. It has a syntax that you must abide - though it is looser than many other languages. It is not all that different from PHP except that Ruby doesn't focus [almost] exclusively on the web as …

Member Avatar for cwarn23
0
219
Member Avatar for Hani1991

By EXE (and C#) I assume that this was compiled on a Windows-based machine? If so, no. You can not run an executable compiled for one platform on another.

Member Avatar for nalawar
0
315
Member Avatar for Tom_Weston

One way to count lines in a file is to count what you consider to be line delimiters. For instance, if your lines are terminated with [icode]\n[/icode] then you can iterate through the file character-by-character and count the number of times you see that character. That (plus one) will be …

Member Avatar for L7Sqr
0
104
Member Avatar for Azurit

You can either not put [icode]wget[/icode] in the background (drop the [icode]-b[/icode] flag) or you can issue a [icode]wait[/icode] (without arguments) directly after your loop.

Member Avatar for ennoil
0
2K
Member Avatar for DeathEater

Most switches have some level of native throttling at fixed speeds (they usually cant do too many). If those levels are not enough you might think of using [url=http://info.iet.unipi.it/~luigi/dummynet/]Dummynet[/url] between the gateway device and the clients (or just after the gateway device depending on your setup). Dummynet allows you to …

Member Avatar for L7Sqr
0
168
Member Avatar for Labdabeta

The following works for me:[code]#include <iostream> #include <vector> class Outer { struct Inner { int i_; Inner(int i) : i_(i) {} }; std::vector< Inner > vinner; public: int construct (int i) { vinner.push_back (Inner(i)); return vinner.size() - 1; } int get (int i) { return vinner[i].i_; } }; int main …

Member Avatar for mike_2000_17
0
234
Member Avatar for noobrobot

[icode]sftp[/icode] can pass flags directly to [icode]ssh[/icode] so you may want to investigate that. Also there is a [icode]-v[/icode] flag you can use which increasing logging (also passed directly to [icode]ssh[/icode]).

Member Avatar for L7Sqr
0
165
Member Avatar for soma dawoud

Depends on the network and hardware. Your question is similar to asking which is faster: wind or rain?

Member Avatar for jingda
0
132
Member Avatar for imobby

Every single category you provide is so vast that you would have a hard time scratching the surface (of just one) for a final year project. In your second post, you are closer to what a [i][b]feasible[/b][/i] final year project might consist of. Certainly, protocol enhancement and design are manageable …

Member Avatar for imobby
-1
669
Member Avatar for monty486

Names and movies are not integers. Perhaps you should consider another data structure. Maybe an array of something like:[code]struct { char * name; char * movie; int rating; }[/code]

Member Avatar for monty486
0
88
Member Avatar for munitjsr2

There is a huge amount of context missing here. For instance, are the lists always arranged such that the subset list (LIST A) is the first N items to appear in the full list (LIST B)? Without any insight I'd suggest that the only thing you can base the difference …

Member Avatar for L7Sqr
0
214
Member Avatar for BobTheLob

I think your shared use of the pipe in each child is causing you trouble. Also, the fork logic there is a little convoluted and harder to follow. Here is something that allows two children to spawn, write to their own pipes, and have the parent receive the messages. It …

Member Avatar for BobTheLob
0
837
Member Avatar for functionalCode
Member Avatar for Netnew

[QUOTE=rubberman;1646650] 5) You need to look at the MAC addresses associated with each connection [/QUOTE] Side note: You can not get this information unless your custom protocol provides it. They way layer 2 works is that you will only see the MAC address of the previous hop which is generally …

Member Avatar for suley04
0
192
Member Avatar for darelet

There is nothing preventing you from opening a socket on your windows machine and connecting to a linux machine on the other end. If you want a good introduction to the topic (for both windows and linux) you can search for Beej's guide to networking. There are also third-party libraries …

Member Avatar for darelet
0
203

The End.