825 Posted Topics

Member Avatar for liran

The problem with redirecting to a file or using a subshell or similar technique is that the `yes` command is infinite. There is no terminating condition other than killing the process. There are ways to do this with *other* commands but something like `yes` is going to be problematic. Is …

Member Avatar for rubberman
0
1K
Member Avatar for Dman01

Instead of hooking keystrokes why not use the clipboard api to get notifications when the clipboard changes? ([clipboard](http://msdn.microsoft.com/en-us/library/windows/desktop/ms648709(v=vs.85).aspx))

Member Avatar for dospy
0
230
Member Avatar for arupface

From the selected answer in **Taywins** link: > I didn't notice the ampersand. You don't need it, inject will work with a symbol. But if you do write it, the symbol is converted to block, it can be useful with other methods

Member Avatar for L7Sqr
0
144
Member Avatar for arupface

A point of clarification. Every operation in Ruby returns some object. Usually, it is just the result of the last operation. Consider: irb(main):001:0> def foo &block irb(main):002:1> block.call irb(main):003:1> end => nil irb(main):004:0> foo { nil } => nil irb(main):005:0> foo { 42 } => 42 irb(main):006:0> foo { Hash.new(0) …

Member Avatar for L7Sqr
0
112
Member Avatar for manujkathuria

You could start by issuing a directory listing of the files you'd like to copy `ssh user@server "ls -l"` Using that list you can evaluate how many files have been copied (by checking against your local listing) and only request the ones you do not have. N.B. This will not …

Member Avatar for L7Sqr
0
115
Member Avatar for nullifyQQ

`cout<<Entry[f];` That will only ever print the elements indicated by `f`. If `Entry.size()` is optimized away that will only ever be 3 (the original 3 items). You should be aware that you are modifying the size of teh vector while simultaneously using it's size as a stopping condition. This is …

Member Avatar for L7Sqr
0
295
Member Avatar for Slayer_Dude_420

Try enclosing the entire `if` body in brackets. while(fgets(line, 200, file_in) != NULL){ if(line[0] == '>') { sscanf(line, "%s | %s | %s | %s | %s", part1, part2, part3, part4, part5); fprintf(file_out, "%s\n", part2); } } What you currently have functions, instead, like while(fgets(line, 200, file_in) != NULL){ if(line[0] …

Member Avatar for Slayer_Dude_420
0
110
Member Avatar for lewashby

Try `GROUPS=$(($GROUPS + 1))` I'm not near a terminal so the syntax may be slightly different

Member Avatar for L7Sqr
0
108
Member Avatar for Azhar886

Presenting on the topic 'Linux' is as broad as presenting on the topic 'Color'. It is much easier to present on the color _blue_, or the color _red_, or a particular _shade_ of either of those. There are also composite colors, primary colors, secondary colors (both additive and subtractive), and …

Member Avatar for madcSPYnX0420
0
83
Member Avatar for rohit.khurana

Can you give an example where ERB fails and you need something more flexible?

Member Avatar for L7Sqr
0
113
Member Avatar for tm1987

If you want the linux version use a VM to run linux and install to that. There are also Windows versions available. My guess, however, is that you are going to be hard pressed to find a cluster of machines available for free to host your data processing; most services …

Member Avatar for manu nair
0
134
Member Avatar for kedxu

The advantage of the second version (using `else if`) is that the condition is part of the *same construct*. That means if some condition within the `if/else if` tree equates to true then the processing of that tree stops and the code continues after the whole tree. In the case …

Member Avatar for deceptikon
0
212
Member Avatar for general2012

First, you only allow for 3 names in you structure (`name[3][20]`) so copying 5 is going to do potentially bad things. `p->count++` increments the counter. There is no *if is does, if it doesn't* Also, I'm confused by your comments: > ... p->count will be 4. for this the loop …

Member Avatar for general2012
0
150
Member Avatar for TheBrick

It may be that the quetions dealt with edge cases and they wanted to see if you'd catch them. It might also be the case that they had a candidate in mind and you were part of the process the company requires to allow a hire (must interview X candidates...). …

Member Avatar for mike_2000_17
0
139
Member Avatar for general2012

I'd suggest you use a safer method to read input - `gets` is an unsafe operation. `fgets` can be used instead: char name[20] = {0}; fgets (name, 20, stdin); Also, `strcpy` expects the destination to be a pointer to a `char` array. You are providing a `char` (by indexing the …

Member Avatar for general2012
0
227
Member Avatar for opel123

There is no reason why you cant have both streams open at the same time and continue to extract from both so long as there is data in each. For example (pseudocode): stream1 = open(1strow.txt); stream2 = open(2ndrow.txt); while (stream1.good and stream2.good) c1 = stream1.extract c2 = stream2.extract output c1 …

Member Avatar for opel123
0
240
Member Avatar for ziyaddinsadigov

`git` is the command name - it is what you are executing. If you want to have a program that does what `git` does then you create a script that will call `git`. If you want a script that does something entirely different you name it what you want and …

Member Avatar for L7Sqr
0
187
Member Avatar for kdar

I cant say for sure without measuring but know that, in general, output streams are buffered. In particular, writing to disk is buffered by the OS. It is unlikely that you will notice a difference between writing a single line 1000 times or a 1000-line entry once. As far as …

Member Avatar for L7Sqr
0
615
Member Avatar for FakeTales

The signature of the function `pthread_create` expects to call is `void * function(void *)` and the fourth argument is a `void*` that is the argument passed to that function on thread creation. So, for example: void * printFunction(void * arg) { int * array = (int *)arg; // ... } …

Member Avatar for FakeTales
0
235
Member Avatar for Huxaifa

It sounds to me like you may want to set up a bank of words/names that represent the set that are capable of mispellings. Once you have that, you might check each entry using [Levenshtein distance](http://en.wikipedia.org/wiki/Levenshtein_distance) to determine if a change is necessary. This is not straightforward. Consider the names …

Member Avatar for L7Sqr
0
148
Member Avatar for Carc369

You can use a `char` in a switch. The reason that your first attempt failed is that a switch statement expects constant values in the case labels. So `('a' || 'A')` evaluates to true (most likely 1). Therefor you get a final expression that looks something like: switch (pick) { …

Member Avatar for awaisahmad13
0
139
Member Avatar for it@61@sec

You can do this fairly easily with AWK. Consider the following AWK script: { for (i = 1; i <= NF; i++) { printf("Parameter: %d: %s\n", i, $i) } } And run that like: `awk -f t.awk t.in` where teh above is in `t.awk` and your input is in `t.in` …

Member Avatar for it@61@sec
0
970
Member Avatar for amnakhan786
Member Avatar for JasonHippy
0
236
Member Avatar for nitin1

`system` will not provide you with output. You need to using something like `popen` or the longhand version of that using `fork` and `exec`. These tools allow you to capture the output of a program that is run - you would use that output to construct a message to be …

Member Avatar for L7Sqr
0
162
Member Avatar for marnun

Hard to say if this falls within the > ... a variable or two as needed. requirement but you can construct a binary search tree which, by it's properties, is always sorted. Printing the sorted items requires only an inorder traversal of the tree.

Member Avatar for marnun
0
3K
Member Avatar for holfery.haryordele

Usually, that department provides some sample topics for those who can not decide for themselves. Does your university not have this support? As far as course materials, this requires an actual course. If you have a course in mind, use a search engine to find the course website and request …

Member Avatar for L7Sqr
0
49
Member Avatar for eilrac

What focus have you had over the past three years? You may want to design your thesis around something you have an existing body of work for; something that you are familiar with. Starting from scratch and expecting to be successful is not always the best approach.

Member Avatar for L7Sqr
0
137
Member Avatar for new_developer

> use case for static data members If there is only ever a single `BankAccount` or the op wants a count across all accounts I would agree. However, if you did that with something like BankAccount mary; CheckingAccount jane; mary.Credit(100.00); mary.Debit(50.00); I think Jane would be surprised to hear about …

Member Avatar for L7Sqr
0
96
Member Avatar for adityasingh95

> we have to use void main That doesn't make much sense. Why such a requirement?

Member Avatar for L7Sqr
0
238
Member Avatar for Ainnop

You dont need a server to connect computers; you need a way to forward/route packets. You can use a switch, router or basic computer to manage packets depending on what equipment you have a vailable. Once you have a way to route packets you need unique addresses for each of …

Member Avatar for anilak
0
157
Member Avatar for ulrik m.

You say obviously wrong. In what way? Does the book describe why this is considered bad (or undefined) behavior?

Member Avatar for ulrik m.
0
314
Member Avatar for Ben Ashton

You could use a `static` variable to manage the count for you. Fore example: class Account { static int next_account_number; int account_number; public: Account () : account_number(++next_account_number) {} int Number () const { return account_number; } }; int Account::next_account_number = 0; int main () { Account a, b, c, d; …

Member Avatar for Ben Ashton
0
124
Member Avatar for sarvari

Many of your questions can be answered, as **Ancient Dragon** suggests, by reading a book. Another appraoch that I find very useful (especially for C++ hidden behavior) is to write a small sample program to test things out. If you write a small class with a copy constructor, assignment operator, …

Member Avatar for L7Sqr
0
1K
Member Avatar for kgal

You set `current=$x` and then look for `$current` to be something other than `$x`. What you probably want is to check `if [ $current -gt $max ]` and `if [ $current -lt $min ]`. Other than that your logic looks in order.

Member Avatar for 1234brut
0
704
Member Avatar for santhoshkumar.k.372

There are tools that exist to do this already. Is there any reason to not use them?

Member Avatar for L7Sqr
0
126
Member Avatar for McCrockett

I'm not sure about claim to fame, but certainly what helped C++ gain momentum was the fact that a C programmer could pick it up fairly quickly and C programs were valid C++ programs. Templates are another huge gain. There are some other topics which you might look into: RAII, …

Member Avatar for L7Sqr
0
138
Member Avatar for shreya19

@Watael: It is not very useful to suggest reading the manual on a command you dont yet know. The point of the question was to determine `cp`; not to ask how to use it. Perhaps something along the lines of: "`cp` or `mv` will copy or move files, respectively. If …

Member Avatar for Watael
0
103
Member Avatar for Alexkid

You say that you want all of [5] and the first half of [6] but your example does not show that. If you have `0101 1011` and `0111 1011` and you want the first with the 4 least significant bytes of the second you would get `0101 1011 1011`. Or, …

Member Avatar for L7Sqr
0
194
Member Avatar for Starship12

You imply that you are attempting this with struct then go on to say that you must not use classes. You do realize that they are basically the same thing, right?

Member Avatar for NathanOliver
0
121
Member Avatar for urvashi2

These are both well studied and well documented. Have you looked at your course material or online at all?

Member Avatar for L7Sqr
0
44
Member Avatar for chiboyy2k3

One would think that, with a degree in communications, you would avoid things such as 'pls' and 'cos'. As far as you concern: Did you know everything about communications before you started taking classes? Probably not, that is why you needed the classes. If you are interested in software engineering …

Member Avatar for L7Sqr
0
157
Member Avatar for nova4005

There is a hidden benefit to education that is oftentimes overlooked (in my opinion). That is that you can interact with people who are already in the industry and get a leg up on your competition - even if it is for a little lower pay at first. Case in …

Member Avatar for L7Sqr
0
214
Member Avatar for vishankparikh
Member Avatar for phorce

**phorce** are you familiar with templates at all? They are a much nicer way to have the type-based behavior you are looking for. The question is independent of the singleton class (which could still be used). You could transition to something similar to // Two ways to create a Dog …

Member Avatar for L7Sqr
0
228
Member Avatar for kshahnazari

You should have a look at [string.find](http://www.cplusplus.com/reference/string/string/find/).

Member Avatar for L7Sqr
0
81
Member Avatar for lscamaro

I would offer that you should contend the basis of the assignment. Anything that makes you use a construct that is to be used lightly (if at all) in a context it was not intended to support is flawed in my opinion. The `goto` can be used to implement control …

Member Avatar for Ancient Dragon
0
141
Member Avatar for Kyle Willett

Make is notorious for not working with spaces. The `client: ...` line should have - on the very next line - a command that starts with a single tab. If your editor expands tabs to spaces you will have problems. If you insert spaces you will have problems.

Member Avatar for Kyle Willett
0
251
Member Avatar for daino

It looks like CMake is [written in C++](http://cmake.org/gitweb?p=cmake.git;a=tree)

Member Avatar for L7Sqr
0
92
Member Avatar for Learningvinit

Note that printing is often a slower process compared to in-memory computations. It is entirely possible that you have a race condition somewhere that is avoided simply by printing. Are you using threads? However, without any example of your code it is hard to make any sound judgement. So, as …

Member Avatar for Learningvinit
0
873
Member Avatar for Dani

My submission. A simple [calculator](http://www.daniweb.com/software-development/cpp/code/427500/calculator-using-shunting-yard-algorithm). Internally uses reverse polish notation format generated using shunting-yard algorithm.

Member Avatar for L7Sqr
3
1K

The End.