825 Posted Topics

Member Avatar for caven.chunyen_1
Member Avatar for 0773247886

@Gonbe - Do you think it would be better for someone trying to learn to get an informed nudge or suggestion rather than a working solution? Often times a full solution only serves to further bury a person struggling with the basics.

Member Avatar for vijayan121
0
173
Member Avatar for Upendra76

Use cron to manage to recurring task. Check the file for conditions (there is not enough information in your post to determine the best way to do that). If conditions warrant an alert use a mail client (`mutt` is a good choice) to send yourself an email.

Member Avatar for L7Sqr
0
334
Member Avatar for SHAHAB UDDIN
Member Avatar for NathanOliver
0
84
Member Avatar for nitin1

@rubberman: I think the comment was to mean that he had been working on it already for two days without luck. The link is to an online progreamming competition so I doubt this is an assignment, per se.

Member Avatar for Gonbe
0
176
Member Avatar for valenluis

That's not even valid C code. Unless you specify what `scanf(*)` does and what `eof` is there is no way to answer this quetion.

Member Avatar for L7Sqr
0
35
Member Avatar for Kaiser.432

Talk to an office worker or school administrator. Ask them what would be useful in the day-to-day operations that they do not already have. I'm sure you will get relevant information from that.

Member Avatar for rubberman
0
126
Member Avatar for doa.sdude

Since you are using (presumably well-formed) XML, why not just use a scripting language with XML libraries (Ruby, Python, Perl, etc) to do this?

Member Avatar for L7Sqr
0
254
Member Avatar for prakhs

I believe you are over-thinking this. Try to abstract the problem into something you already understand. Here is a hint: ones, tens, hundreds, thousands, ...

Member Avatar for L7Sqr
0
678
Member Avatar for silvercats

Firstly, source code does not run; it is compiled. It is possible to compile the same source code on multiple platforms but only if you write portable code. Using system-specific utilities will tie to you a particular platform and porting will be next to impossible. It's aslo unclear whether `console.write` …

Member Avatar for Ancient Dragon
0
278
Member Avatar for Stpdoug

If you do not understand the concept of loops then no tutorial on drawing borders is going to help. Perhaps you should start by trying to use a loop to draw a straight line of a given size. From there, you can begin to extend your approach to multiple nested …

Member Avatar for Stpdoug
0
2K
Member Avatar for dellat

`x+y` evaluates to a single integral value. You probably intended to write that as: `z = addem(x, y);`

Member Avatar for dellat
0
385
Member Avatar for alfredgg

Your compiler should choke on that input. The diagnostics may or may not be useful, you have not indicated. A proper `if` construct looks something like: if (condition) { // code for this condition } else if (some_other_condition) { // code here } else { // catch-all case in the …

Member Avatar for alfredgg
0
252
Member Avatar for kshahnazari

You could also use [memcmp](http://www.cplusplus.com/reference/clibrary/cstring/memcmp/)

Member Avatar for L7Sqr
0
147
Member Avatar for rtyui

No. Redirection, piping and general screen printing are facilities of the OS, not your program. Additionally, there are other tools, such as `tee` which would complicate the matter if you could. Suppose you had `./a.out | tee a.txt` would you want that `tee` was receiving your output or that it …

Member Avatar for L7Sqr
0
278
Member Avatar for jww1232002

Well, you can't expect `"ff" != ...` to do what you want. Checking for ethernet broadcast means looking for all `0xff`. Something like unsigned char bcast_addr[6] = {0xff}; if (memcmp (bcast_addr, ether->dst_addr) == 0) { // This is a broadcast packet } This would explain why you are not capturing …

Member Avatar for L7Sqr
0
464
Member Avatar for Roman116

Dynamic programming most times revolves around caching or memoization generally coupled with some sort of recursion. The idea in this case would look something like: for each Node1 in Graph: set Node1 as Root. for each Node2 in (Graph - Node1): calculate ShortestPath(Root, Node2) print ShortestPath(NodeA, NodeB) The `ShortestPath` would …

Member Avatar for L7Sqr
0
177
Member Avatar for triumphost

Welcome to multi-platform. Things that are not specified by the standard (such as directory traversal) are left to system implementors. You may get some support from standards like POSIX but even then, you are back to requiring POSIX.

Member Avatar for deceptikon
0
762
Member Avatar for Labdabeta

You may also want to have a look at [AutoIt](http://www.autoitscript.com/site/autoit/) It might save you the trouble of re-inventing the wheel if you dont need the gritty details.

Member Avatar for Labdabeta
0
123
Member Avatar for antoinette.boulevard

Try experimenting with the following to better understand the relationship between `%` and `/`: #include <stdio.h> int main () { int x = 10, i = 0; for (; i < 30; ++i) { printf ("%02d %% %d = %d\n", i, x, i % x); printf ("%02d / %d = …

Member Avatar for pasx
0
3K
Member Avatar for phorce

In your inner loop you are incrementing `i` instead of `j`. I cant tell if this is a copy-paste error or not but it would lead to a result other than what you want and what you are getting. Please paste the *actual* code you are using so that we …

Member Avatar for L7Sqr
0
2K
Member Avatar for triumphost

You can copy to a vector in a number of ways. Use an iterator std::vector<unsigned char> out; unsigned char buff[1204] = {0}; // ... std::copy (buff, buff + 1024, std::back_inserter(out)); Or, since vector elements are guaranteed to be stored contiguously in memory, you can asign directly to reserved memory std::vector<unsigned …

Member Avatar for triumphost
0
2K
Member Avatar for myk45

If each of the calls depends on the previous one rturning a `true` value then you can use the `&&` operator to chain them. Something like: if ( func1() && func2() && func3() && func4() ) { std::cout << "Success!" << std::endl; } else { std::cout << "Error at some …

Member Avatar for myk45
0
206
Member Avatar for samsons17

That looks like perl. `tr` translates the first set of characters (empty in your case) to the second set of characters and returns the count. With an empty set that is basically a no-op. Perhaps there was a copy-paste error from where you pulled this script?

Member Avatar for L7Sqr
0
152
Member Avatar for shkr

> i am using snprintf and also strtoul Where? `strtol` will allow you to grab numeric values while stepping through a string (although if you include hex the soultion becomes ambiguous).

Member Avatar for deceptikon
0
139
Member Avatar for MasterHacker110

While `Wireshark` is a great tool I, think it is a little hard to digest for something as simple as grabbing packets. It is probably easier to concentrate on the underlying [libpcap](http://www.tcpdump.org/) to get started and move up from there.

Member Avatar for L7Sqr
0
222
Member Avatar for New Abhi
Member Avatar for Kwetal
0
123
Member Avatar for Bumpehh

Many times, when developers release code for the masses it is done as a library. This makes the integration easier for the end developer. What exactly is it you are looking for?

Member Avatar for myk45
0
235
Member Avatar for maurya10

[time](http://linux.die.net/man/2/time) gives the time in seconds. Feeding that to [srandom](http://linux.die.net/man/3/srandom) seeds the pseudo random number generator based on the time of day.

Member Avatar for Banfa
0
92
Member Avatar for riahc3

You have a couple of options. * Since this is 'just for you' then just run the entire program as root * Run the program as root, but [drop priveleges](http://linux.die.net/man/2/setuid) once you open the file * Use a combination of the two above and run as root, fork a child …

Member Avatar for L7Sqr
0
152
Member Avatar for Harshini Divya

I'd break this up into manageable pieces: * Define a function that will calculate (and return) an area given a width and height * Layout the main function to have the original width and height variables * call the area function with the original values * output the result * …

Member Avatar for Lucaci Andrew
-2
207
Member Avatar for 111100/11000

Instead of trying to get back to the middle of a function why dont you just break it up into multiple functions to begin with? Something like: int main () { /* do all output thing here as you already have */ cout << "This is enigma machine:" << endl; …

Member Avatar for WaltP
0
217
Member Avatar for ankit.shah.54584982

It is an active field as the kernel is constantly in motion. Your best bet would be to download the latest kernel source code and look at how current drivers are implemented. Once you have that build questions around items you can not understand - it will increase the likelihood …

Member Avatar for rubberman
0
126
Member Avatar for newbie1234
Member Avatar for anujthefuhrer

In general, a lexer expects input. If you do not specifically write a prompt to display it will just quietly wait for input.

Member Avatar for sepp2k
0
572
Member Avatar for Geeksoftie
Member Avatar for userIT

Instead of just outputting the values save them to a container. Then each new value you select from the original list can be checked against your new list for uniqueness. Something like: std::set< int > unique; while (unique.size () < 4) { f[i] = rand() % 7; s[i] = rand() …

Member Avatar for userIT
0
537
Member Avatar for Plazmotech
Member Avatar for I_m_rude

I have found that bit fields can be useful when you want to provide a set of non-overlapping options. For example, suppose you provide a filter for the categories of things you want to output in a logging function you may set up the following: #define LOG_DEBUG (1<<0) #define LOG_ERROR …

Member Avatar for deceptikon
0
141
Member Avatar for newbie14

You mention an exact requirement, then relax that to allow for a variable amount of delay. How critical is this timer? Are you sure you aren't just interested in having a query execute every second or so? If so the timer you set up will allow for that. However, how …

Member Avatar for newbie14
1
2K
Member Avatar for lewashby

Instead of copying the file all around you can just extract it to your chosen location directly. Consider: $ pwd /home/you/ $ tar xjvf /mnt/lfs/sources/binutils-2.22.tar.bz2 Also, you might try to run `file` on the file to make sure it is not named incorrectly.

Member Avatar for L7Sqr
0
121
Member Avatar for biblemdkeid

The minimum speed is 0. The maximum is determined by the [Bandwidth-Delay Product](http://en.wikipedia.org/wiki/Bandwidth-delay_product). There are many factors such as contention, medium, distance, and loss that factor into the equation so it is not an easy answer to provide in general.

Member Avatar for biblemdkeid
0
275
Member Avatar for Labdabeta

You are only fooling others (and yourself) if you think that being handed a clever trick constitutes you 'knowing how to hack.' If you want to impress someone or show your prowess *do the work*. Investigate a particular feature or piece software and learn how to touch it's edge cases. …

Member Avatar for VernonDozier
0
253
Member Avatar for HTMLperson5

Why people like a particular OS is purely a personal matter - all replies you get will be subjective. That being said, here is my $0.02. I use both to some extent - which one depends entirely on the task at hand. For instance, I take classes remotely and the …

Member Avatar for HTMLperson5
-3
461
Member Avatar for Geeksoftie

The simple solution is a recursive one. In pseducode that would look like: int quad_max(root) { if (root.is_a_leaf) { return root.value } else { return max( quad_max(root.east), quad_max(root.south), quad_max(root.west), quad_max(root.north)) } } Although, to be efficient you would probably want to implement a caching scheme to that search to prevent …

Member Avatar for L7Sqr
0
148
Member Avatar for vijayabhaskar.chowdary
Member Avatar for chudapati09

This is a subjective question; you will likely only get opinions as answers. My opinion is that Ruby is very nicely geared to this type of work. Perl is probably the most popular but I find the syntax prohibitive and Ruby grabs many of the most useful features from Perl …

Member Avatar for CimmerianX
0
151
Member Avatar for osiron

You may also want to look into [pthread_join](http://pubs.opengroup.org/onlinepubs/7908799/xsh/pthread_join.html)

Member Avatar for L7Sqr
0
146
Member Avatar for 24x24

Here is a simple ruby script that will (from the directory you call it in) give you all files (recursively) with full path names changing `/` to `_`. require 'pathname' Dir['**/*'].each { |f| puts Pathname(f).to_s.gsub('/', '_') } So the output is something like: ... new_gcc_gcc-4.7.1_libgo_go_image_png_testdata_pngsuite_basn0g01-30.sng new_gcc_gcc-4.7.1_libgo_go_image_png_testdata_pngsuite_basn2c16.sng new_gcc_gcc-4.7.1_libgo_go_image_png_testdata_pngsuite_basn3p01.sng new_gcc_gcc-4.7.1_libgo_go_image_png_testdata_pngsuite_basn0g02.png new_gcc_gcc-4.7.1_libgo_go_image_png_testdata_pngsuite_basn0g04-31.sng new_gcc_gcc-4.7.1_libgo_go_image_png_testdata_pngsuite_basn3p08.png …

Member Avatar for L7Sqr
0
189
Member Avatar for mpyap

To do this just keep track of the length of the longest name and use that. For example: int main () { std::vector< std::string > names; std::string name; size_t long_name = 0; while (std::cin >> name) { long_name = std::max (long_name, name.size()); names.push_back (name); } for (std::vector< std::string >::iterator it …

Member Avatar for L7Sqr
0
728

The End.