Posts
 
Reputation
Joined
Last Seen
Ranked #25
Strength to Increase Rep
+15
Strength to Decrease Rep
-3
92% Quality Score
Upvotes Received
2K
Posts with Upvotes
2K
Upvoting Members
538
Downvotes Received
210
Posts with Downvotes
194
Downvoting Members
48
350 Commented Posts
~2.00M People Reached
Favorite Tags
c++ x 2K
c x 2K
vb.net x 204
java x 96
c# x 93

3,183 Posted Topics

Member Avatar for deceptikon

A common task in C or C++ is to get a string from somewhere and convert it to an integer. "Use `atoi`" is a common suggestion from the unwashed masses, and on the surface it works like a charm: #include <stdio.h> #include <stdlib.h> long long square(int value) { return value …

Member Avatar for Salem
8
2K
Member Avatar for Saqlainz

> WRONG : Console.WriteLine("%d * %d = %d",c,a,b); Of course it's wrong, WriteLine() does not and never has purported to offer printf() style format specifiers. Saying that the above code is wrong is just like saying that the following line is wrong: Console.WriteLine("FORMAT INT #1 LITERAL(*) INT #2 LITERAL(=) INT …

Member Avatar for Bunker
-3
163
Member Avatar for abdallah_adiga

While there might be a tool out there to do the conversion, I wouldn't trust it. The appropriate way is to know both languages and convert manually. However, since assemblies written in either language are interoperable, there's no need to convert unless you're trying to match company standards where only …

Member Avatar for Emanuil23
0
579
Member Avatar for gil.nickson
Member Avatar for f200196
1
39K
Member Avatar for london-G

I typically separate testing into two phases: 1. Unit testing for basic functionality and internal correctness that isn't easily checked by the end user or needs to be more thorough at a lower level. 2. UAT testing based on user stories from the design notes. These are cases where there's …

Member Avatar for phinisdo
0
233
Member Avatar for Quinton_1
Member Avatar for alamu

Nobody is going to do your homework for you. But I'll give you a push in the right direction. You essentually have two options: 1. Build a new list in sorted order while traversing the old list. 2. Sort the old list into a new list. It's a fairly subtle …

Member Avatar for 4rajgopal
0
1K
Member Avatar for awfootball7

Take each number and subtract the mean, then square the result. Finally, divide by the length of the array and add that to your sum. The sum is the variance, and the square root of that is the standard deviation: double sd = 0; for (int i = 0; i …

Member Avatar for woo_1
0
18K
Member Avatar for Dani

> so those who love banners can enjoy them. Spoken like someone who doesn't depend on ad revenue to stay in business. Hop in chat sometime and ask Dani to explain where Daniweb's funding comes from. She'll talk your ear off, but it's an eye opener.

Member Avatar for j.khurram
11
5K
Member Avatar for kanebt

[QUOTE]1) Why I want to delete? I want to delete my account because I've never used Daniweb, so it's useless for me. ... Note that I'm registered since 2009 and rarely (2 times) I came on Daniweb to find answers (sorry but it's the true)[/QUOTE] What's wrong with simply abandoning …

Member Avatar for Олег_9
3
3K
Member Avatar for Tekmaven

> To me, the best type of SEO is popularity. The more popular your site is, the higher ranked you would be (based on backlinks, etc). Indeed. But you're neglecting the critical first step that to become popular you must be noticed. How do you get noticed when your site …

Member Avatar for dhirajkumar123
4
4K
Member Avatar for coroll

This seems more like a job for a frequency list. You can use a dictionary of characters and counts like so: for each word in the dictionary build a frequency list of each character initialized to 0 for each character in the letter collection if the character exists in the …

Member Avatar for JamesCherrill
0
2K
Member Avatar for Bob

> OKAY YOU NOOBS!!!!! > HERE IS A MUCH SIMPLER THING TO DO!!!! It's also [subtly broken](http://eternallyconfuzzled.com/arts/jsw_art_rand.aspx) if you care about uniform distribution. Simple isn't always better...noob. ;)

Member Avatar for JamesCherrill
3
53K
Member Avatar for ddanbe
Member Avatar for KushMishra

> Create a TcpClient and connect to the POP3 server, open a NetworkStream that uses the client and download all the data available. You can then parse this using the POP3 specification. That's a gross oversimplification. ;) Doing it right is a non-trivial task, so I'd recommend utilizing a library …

Member Avatar for Elpat14
1
2K
Member Avatar for Nether_1

While I'd start by suggesting that you use the .NET file stream options instead, String^ *can* be converted to std::string using marshal_as if so needed.

Member Avatar for Nether_1
0
2K
Member Avatar for vvsmario

The trick with this program is defining what's meant by a "word". You can't just take whatever is separated by whitespace and call it good, because that will incorrectly include punctuation. To properly do it would require some lookahead and lookbehind, and even then poorly formatted sentences could cause an …

Member Avatar for Busuioc
-1
4K
Member Avatar for chris ig

From the provided code, I can't offer more than int delete_list_entry(temp_head, randvar); should be delete_list_entry(temp_head, randvar); I get the impression there's a little confusion between how to declare/define functions and how to call them. Also, if `delete_list_entry` returns a value, I'd also ask why you're ignoring it.

Member Avatar for deceptikon
0
150
Member Avatar for G_Waddell

> It could be the Framework or it could be how it has been implemented by my predecessor It's the latter, almost surely. The Entity Framework most certainly has its quirks, but being unstable and slow are not among them when used properly. > So I'm wondering if there is …

Member Avatar for Aleksey_2
0
4K
Member Avatar for Devon_4

`p` is a pointer to read-only memory. While some compilers might allow it to be modified, technically what you're doing is undefined behavior. Change line 6 to `char p[] = "foo";` and it should work just fine.

Member Avatar for deceptikon
0
158
Member Avatar for Violet_82

> I’ve realized that I’m a little weak when it comes to fix, modify and understand code within large applications, and, needless to say, I need to find a way to get better at it. There are two books I rather like: Code Reading and Code Quality. They go beyond …

Member Avatar for Violet_82
0
417
Member Avatar for MukeshZ

I'm surprised that nobody has even mentioned the TextFieldParser class in Microsoft.VisualBasic.FileIO... :P

Member Avatar for deceptikon
0
20K
Member Avatar for azeez_2
Member Avatar for thines01
0
619
Member Avatar for ddanbe

I'm a bit surprised you haven't been walking around town handing them out as advertising. There were still a number of big boxes full of shirts after that night, IIRC. ;)

Member Avatar for Dani
0
299
Member Avatar for AssertNull

> Teaching Pascal as a first language in 2017? Really? Pascal has the benefit of being very easy to understand. It's also hand-holdey, which for most of us translates to "heavily restricted", but for beginners means less working around the quirks of the language and focusing directly on solving the …

Member Avatar for stephenlangton
0
467
Member Avatar for Prasad_4

This is clearly a homework or interview question, so please let us know what your thoughts are first.

Member Avatar for Reverend Jim
-2
1K
Member Avatar for rupali

> Also if the time xomplexity of both the methods is O(n), then how is the second method runs faster than the linear search method? Big O only tells you the expected growth rate of the algorithm, which in both cases is indeed O(n), not its actual execution performance. Algorithms …

Member Avatar for jamie_13
2
50K
Member Avatar for clarkkent021

> This is really confusing as I dont know which is right and which is wrong, could use some help They're both right. Your compiler is right because it's from 1991 and conformed to the C++ of the time. Your book is also right because it's reasonably current with the …

Member Avatar for Aatulya
0
2K
Member Avatar for d1e9v85

> I do not understand why did you make 3 for loops? The real question would be why did the OP not format his code in an understandable way. Reread the original code, it doesn't have three nested loops.

Member Avatar for White_2
1
764
Member Avatar for daino

> char array's are actually pointers This is a common misconception. An array is *not* a pointer, but when used in value context, the name of an array is converted to a pointer to the first element in the array. In object context, the name of an array is not …

Member Avatar for deceptikon
0
43K
Member Avatar for anny**

> printf("%c occurs %d times in the entered string.\n",c+'a',count[c]); > what is its cout statement cout << (c + 'a') << " occurs " << count[c] << " times in the entered string.\n";

Member Avatar for helo_1
0
4K
Member Avatar for MRehanQadri
Member Avatar for Dhelandel

Most common domain applications, perhaps? Which examples are you referring to? Bucket sort is certainly not limited to that range, though I can imagine how it's wildly useful.

Member Avatar for rubberman
0
394
Member Avatar for Twee Nguyen

Step 1 of troubleshooting is narrowing down the places you need to look. With that in mind, my first question would be whether `dt` actually contains data or not when you look at it in a debug trace. If it does, then binding or refreshing the grid would be my …

Member Avatar for deceptikon
0
378
Member Avatar for Siva_13

I'll make the obligatory comment that you should be using a modern compiler rather than trying to kludge a 30 year old compiler into your modern OS. That said, the message suggests this AKKI wrapper is expecting some sort of input. I'd start by reading the documentation to learn how …

Member Avatar for ddanbe
0
284
Member Avatar for Brian_22

> ... or use bitwise operator `if(i&1)` if true even else odd. I suppose if you want readers of your code to think you're clever, or have legitimately profiled the code for performance, run all practical test cases, and determined that this micro-optimization is warranted *and* not actively harmful. > …

Member Avatar for rubberman
0
541
Member Avatar for naik.pranjal
Member Avatar for Varun_8
-1
880
Member Avatar for noorullah06

> The first thing that I would suggest is for you to use some comments stating what everything is and what is is supposed to do and maybe some pre and post condition statements around the class methods. Note that your sample class is a fine example of how *not* …

Member Avatar for tinstaafl
0
4K
Member Avatar for nitin1

> Can you please explain the reason behind this? You're capturing a direct pointer to the internal storage of the string returned by fun(), which is a temporary object. The temporary object is subsequently deconstructed, and the internal storage goes away. I'd suggest stepping into everything in the debugger to …

Member Avatar for AssertNull
0
3K
Member Avatar for Baastina

Well, assuming the title of your thread is the problem, I'd ask what `a.FileName` is and contains. An empty string is indeed not a legal file path, so you want to make sure that `a.FileName` represents a valid file that exists. Most likely there's a flaw in the UI's design …

Member Avatar for deceptikon
0
599
Member Avatar for Bryan_5

> `while (*p != '\0' || *q != '\0')` This is a red flag. Your arrays are not constructed as C-style strings, so '\0' isn't likely to exist within your owned memory. You can make that happen by adding the terminating value at the end of the arrays: intArray = …

Member Avatar for deceptikon
0
358
Member Avatar for JamesCherrill

> I know that Daniweb owns the I.P. No. That was unfortunate wording in previous terms of service, and the intention was to absolve Daniweb of legal responsibility for storing and editing the content of posts. After a quick reading, it looks like the wording was changed. > I want …

Member Avatar for JamesCherrill
0
309
Member Avatar for something_1

I'd strongly recommend walking through your code with a debugger. And my big hint for the problem is that the Enter key places a character in the input stream: '\n'. When you mix formatted and unformatted input (eg. getline and the >> operator), there's a strong chance that newlines are …

Member Avatar for Usman_10
0
255
Member Avatar for sunshine102030

> I know that the max value for short data type is 32767 Not necessarily. The C++ standard defines a minimum required range, but compilers are free to make it larger. > but the question is from where we get this number -25536 ? First I'll note that it's not …

Member Avatar for deceptikon
0
169
Member Avatar for catastrophe2

Well, for starters the "/* ... */" comment supports multi-line, so you'll need to consider that in your parsing. A simple approach would be a loop that reads and throws away characters until the closing token is found: public static void processInput(StreamReader input, StreamWriter output) { int ch; while (!input.EndOfStream) …

Member Avatar for tinstaafl
0
330
Member Avatar for ddanbe

The first thing that comes to mind is to filter out the special value(s): `MyList.Where(x => !double.IsNaN(x)).Min()`. Though depending on what might be acceptable insertions into the list, you might need to consider things like NegativeInfinity as well.

Member Avatar for ddanbe
0
265
Member Avatar for Vsrkprasad

The `inline` keyword isn't a guarantee, it's a hint. If the compiler determines that inlining would produce worse code, it doesn't honor the hint. Some compilers just straight up reject the inline hint if there's a loop or troublesome lookup (ie. `switch`).

Member Avatar for rproffitt
0
1K
Member Avatar for Jovanie_1

The calculations are unnecessary. `mktime` can be used to normalize the contents of a `tm` structure to the correct date and time after manual modifications. #include <iostream> #include <ctime> using namespace std; int main() { time_t now = time(0); tm *date = localtime(&now); --date->tm_mday; // Move back one day mktime(date); …

Member Avatar for deceptikon
0
4K
Member Avatar for Mayank_5

You could try not running software that's older than most of the people using it...

Member Avatar for deceptikon
0
1K
Member Avatar for Suzie999

> I have a lot of classes I need to add a ToByteArray() method to What's the purpose of this method? Typically I'd suggest utilizing the serialization classes already present in .NET: public static class BinaryWrapper { public static byte[] Serialize<T>(T obj) { using (var stream = new MemoryStream()) { …

Member Avatar for Suzie999
0
380

The End.