825 Posted Topics
Re: @David W: The code you provided doesn't address the OPs concerns and the relative use of `inline` compared to the example size is very small. It might be helpful if you condensed the example to a very small class and taylored the code to address the 'multiple files' problem the … | |
Re: To fully understand this you need to understand how stages of compilation work over several files. However, conceptually, you can think of this using the following example: File: `main.c` int add (int x, int y) { return x + y; } int main () { int i = 3, j … | |
Re: NOTE: This might be better in the Linux/Unix forum - maybe a moderator can move it as appropriate. Traditionally, a *sniffer* intercepts network traffic from a device; usually a network interface card (NIC). Sniffing can also be done with a network tap/bridge that sits between two machines on a network. … | |
Re: Generally, when you have to parse input that must adhere to some constraints (a language, for example) you use a grammar. The grammar can be built up in a variety of ways: using tools like `yacc`/`bison` or in code ala `llvm`. In the former, you usually have a parser generator … | |
Re: Just rewrite the serialization routines to write the first byte (or 32-bit chunk) as the size. On the read side, read the size first and then read however many bytes it indicates. | |
Re: The next time you loop through you are calling `listen` and `accept` again. First, I would move the `listen` outside of the loop. Second, `accept` is a blocking call - that is, if no other connection attempts are made it will wait there indefinitely. A general approach to this situation … | |
Re: I doubt autonomous systems will ever be more than a pet project - at least over the next 20 or so years. A very real problem is that the 'real world' is messy; it is dominated by things that trigger false positives and heuristics can only get you so far … | |
Re: And what, exactly, have you tried so far? What is it you are having trouble with? | |
Re: @shahzrinsaid: What have you tried? What problems have you encountered? There is plenty of information there to make an honest attempt at the assignment - you have the formulae; all you need to do is construct functions that implement them. @Sarkurd: It is obvious this is some sort of assignment … | |
Re: Why not search for tools that can read the metadata directly and use that API? If not, look at the MP3 *file format* and write a program that will parse that. Any open source tool that plays MP3s will have the logic to extract the information you seek - you … | |
Re: What is your question? Also, why would you use a text file to do this? It seems more natural to use an IPC mechanism more suited to such an operation - pipes, for example. | |
Re: If you are the least experienced at an already established financial institution I would suggest you first consult the more serior staff about where to look. Presumably there are internal documents detailing the layout, configuration, and operation of your system. The work that has been done will guide your research … | |
Re: Inserting a node that is the sum of the next two nodes creates an infinite process. Consider: Original: 1 -> 2 -> 3 -> 4 Iteration 1: 1 -> 2 -> 3 -> 4 ^ (add 2 + 3, insert node) 1 -> 5 -> 2 -> 3 -> 4 … | |
Re: You need a few pieces: * Input routine to collect user number * Process to split that number into individual digits * Recursive call that takes the result of the above operation as input and returns a digit in the terminating case | |
Re: If your school has a bus lot consider building a program that simulates (and potentially optimizes) the bus loading process. You can sample (by observing) how long it usually takes to load/unload a bus how long busses usually wait in the lot after having loaded or unloaded the students. This … | |
Re: A local hash table and a DHT are fundamentally different; it is a non-trivial process to convert one to another. Perhaps you could explain why there is a need to move to a distributed design. | |
Re: When you say it doesn't work, could you be more presise? Is there no output, incorrect output, a crash? | |
Re: Why not just store the name in the `player` struct itself? Something like: typedef struct plist_ { int atc, def; char *name; struct plist_ *next; } PlayerList; | |
Re: Most shells provide the `EDITOR` environment variable (or you can set to have it exported in your rc file). If that is set the way you want you can use that. For example: `${EDITOR} &` would open Emacs if the environment had `EDITOR` exported as `emacs`. Another way you might … | |
Re: You probably shoud have started earlier than now. What have you accomplished so far? Which one do you need help with? | |
Re: What do you plan to do about inputs that match multiple words? For example if I input `ewst` that should match any of `west`, `wets` or `stew`. Since you have ambiguity in the matching for a scrambled input why have the overhead of iterating all permutations of the input string … | |
Re: If the format is consistent enough, you can just match the surrounding pieces. For example: sed 's;Report name=".* - Report";Report name="'"`date +"%D %I:%M:%S %p"`"' - Report";' which results in: [ezpz@mercury (tmp)]$ cat t.t <Report name="05/14/14 05:05:53 AM - Report"> [ezpz@mercury (tmp)]$ sed 's;Report name=".* - Report";Report name="'"`date +"%D %I:%M:%S %p"`"' … | |
Re: This sounds very much like an asignment *you* should be completing. What have you tried so far? | |
Re: You can get the keys of a hash with `hash.keys`. puts hash.keys.join ',' hash.keys.size.times do |i| s = hash.collect { |h| # fill the entry (h[1]) as you'd like h[1][i] }.join ',' puts s end | |
Re: You are using single quotes in the `awk` expression. That terminates the expression prematurely. Try using double quotes; something like: awk '{ if((substr($1,12,2)==84) && (substr($1,26,2)=="CC" || substr($1,26,2)=="CA")) print $4; else print "0" }' Should work out for you. | |
Re: Probably more of a boredome thing. Documentation is boring. Documentation maintenance is even worse. Part of the thrill of programming is getting something to work. Once it works there are other challenges like extending what you have just created; supporting others' interest in your technology; refactoring out the nasty parts. … | |
Re: I'm not familiar with TS or VU+ formats but, in general, you can not simply rename files and expect that they will be interpreted differently. Is Avidemux capable of handling TS files? | |
Re: A little late to the game but hopefully this helps the situation for 3 or more lists: require 'matrix' m = Matrix[ [1,2,3], [2,3,4], [3,4,5], [4,5,6] ] # transpose will get the order you want m.transpose.to_a.each do |xs| puts xs.join "-" end # => 1-2-3-4 # => 2-3-4-5 # => … | |
![]() | Re: You can easily do this in a shell. If your file is named `foo.in` then you would get what you want with: sort foo.in | uniq -c | awk '($1 == 1) {print $2}' This gives you the entries that occur exactly once in the input file. Now, depending on … ![]() |
Re: 'Cloud' computing is a rather large space. In the most generic sense it means having computations run elsewhere. What, specifically, are you looking to research? | |
Re: Enum is a way to provide clarity (and type information) to your code. The underlying type is simply some integral type so you could just get rid of the `enum` altogether and replace with numeric values (by default, `enums` values begin at 0). The consequence of that is when you … | |
Re: `gets` is [bad](http://stackoverflow.com/questions/4346598/gets-function-in-c/4346650#4346650). And, yes, `strcpy` fails to do bounds checking. | |
Re: Well, in general, *nix usually has a forward slash (/) delimeter, not a backslash (\\). From your current position you would do: mkdir /red5/webapps/openmeetings/uploadtemp/files Of course, you need permision to create that directory. If you do not have permissions you need to do the action as `root` or with elevated … | |
Re: It is illegal to convert from type `double` to a pointer to type `float`. You may want to declare `value` as `float value;` (rather than `float *value`). Do note, however, that `double` to `float` is a lossy transformation. Is there any reason that you dont make `value` a `double` as … | |
Re: To append to strings in C you use `strcat`. To copy from another string you use `strcpy`. (There are variants of these that allow you to specify a length - check your documentation). It is unclear to me which you need. Below is an example that shows how to use … | |
Re: `std::string` maintains memory (and various other operators) for you. Everything you do with a `char` array must be handled by you explicitly: memory management, copy, appending, length checking, and so on. | |
Re: Well, you cannot expect that you are going to learn something by osmosis - you have to experiment and try for yourself. That does not excuse an incompetent teacher, of course. Otherwise, you still have not mentioned a system. Linux? Windows? Are you provided any existing code (or libraries)? Suggestions … | |
Re: You do not assign anything to `input`; it is a raw pointer (in your example). If you try to read from an arbitrary location in memory the best you are going to get are strange characters in your output. Try reading from `stdin` or opening a file stream with `fopen`. | |
Re: Decimal and Hexidecimal are encodings of some *value*. The *value* itself doesn't change. So do the math in whatever encoding is most comfortable for you then convert the result to desired encoding. For example, with the values your provided: `15 + 17 = 32` `32 decimal is 20 hex` | |
Re: If this is `C++` why not use `std::string`? Something like: #include <iostream> #include <string> int main () { std::string src, dst; src = "C:\\Windows"; dst = src.substr (0, src.find_first_of ("\\") + 1); std::cout << "Original: " << src << std::endl; std::cout << "Modified: " << dst << std::endl; return 0; … | |
Re: We don't give out code here. You need to show some effort of your own and we can help you along the way. | |
Re: What do you want to secure shell connect *to*? In general, to connect to a remote location (somehost.net, for instance) you would do the following: `ssh user@somehost.net` That would try to connect (and log in) as user `user` on host `somehost`. To know more, open a terminal and type `man … | |
Re: By 'Multicasting' are you referring to something like IP Multicast or something simpler such as basic medium broadcast with efficient pruning? What, then, do you want to secure about it? The data, source/destination pairs, the control information, the fact that you are even using multicast? | |
Re: For your original example, your script gives the answer 9, not 7 as you requested. The command you show does not handle punctuation and capitalization. You probably want to add some `sed`-like functionality to remove punctuation and address capitalization. After that you can consider the encoding. | |
Re: It seems to be the difference between UTF-8 hex and UTF-16 hex ([See encodings section here](http://www.fileformat.info/info/unicode/char/21b/index.htm)) | |
Re: Are you asking for *help* or just the answer? If it is the former please explain what you've tried and how you are stuck. | |
Re: There are a few problems with your code: * You don't have a `main` function * The `Command` structure seems to be keeping the history? Idealy, the history should keep a list of `Commands`. * The `if` condition in your `while` needs `{` and `}` or you will *always* break … | |
Re: [This](https://github.com/sam-github/libnet/releases) repo goes back as far as libnet-1.1.3 (2008). The sourceforge page looks as if it ends releases libnet-0.10.11 (2003). Searching for specific versions turns up other resoures. What exactly have you tried in your searches? | |
Re: A `switch` works on integral types. The best you could do (to keep some sembelance of the command name) is to use an `enum` type - but you would still need to map strings to that. | |
Re: What have you tried so far? Even if we wanted to help at this point we would be unable. What format is the FSM in, for example? To properly read and build a FSM in memory is a non-trivial task so you need to provide some more detail (and evidence … |
The End.