3,183 Posted Topics

Member Avatar for somjit{}

On a side note, the technique you're showing is called [type punning](http://en.wikipedia.org/wiki/Type_punning). It's rather common in lower level code. If you're feeling frisky, an example of union-based punning to break down a floating-point value can be found in one of my teaching libraries [here](https://code.google.com/p/c-standard-library/source/browse/includes/std/math.h#39) and [here](https://code.google.com/p/c-standard-library/source/browse/src/std/math.c#94). > In the same …

Member Avatar for somjit{}
0
429
Member Avatar for mridul.ahuja

`...` at the end of a function's parameter list says that the function takes a variable number of arguments. I'll leave it at that so you can try to figure out why it works, then I can tell you *how* it works. :) One thing to note though is that …

Member Avatar for cgeier
0
129
Member Avatar for Wandaga1

It really depends on what kind of code you'll be working with. If you're only doing system level stuff, learning UI components isn't as important. If you're only doing the front end of applications, learning the niggling low level features isn't as important. Repeat ad infinitum for whatever feature you …

Member Avatar for vegaseat
0
250
Member Avatar for iConqueror
Member Avatar for J.C. SolvoTerra

In terms of e-peen points, you're doing okay. What really matters is the intangible reputation you earn that is what people who matter think of you. And that kind of reputation takes time. Were I concerned about reputation, I'd wonder what people thought about a public annoucement of leaving after …

Member Avatar for J.C. SolvoTerra
0
532
Member Avatar for Mr.M

> I also think it maybe best if DaniQueen introduce a way to decrease points to those who are doing this I'm not entirely sure what you mean by "points", but voting and reputation work both ways. If you find someone spoonfeeding beginners, then by all means given them a …

Member Avatar for deceptikon
2
278
Member Avatar for lewashby

> In the first one, why would we start writing to the file at position n \* recsize instead of position 0? Judging from the code, the intention is to overwrite an existing record that may or may not be the first record. If you always used position 0, you'd …

Member Avatar for deceptikon
0
132
Member Avatar for RikTelner

The compiler is correct, `varying` doesn't exist at that point. You declare it in `textBox1_TextChanged`, but try to use it in a completely different method. Why not just use `textBox1.Text` directly and not worry about handling `TextChanged`? MessageBox.Show("Hello!", textBox1.Text, MessageBoxButtons.OK);

Member Avatar for deceptikon
0
148
Member Avatar for RikTelner

It's impossible to answer your question as asked because the benefits of cores versus clock speed are situational. What's the average use case of the intended machine?

Member Avatar for RikTelner
0
172
Member Avatar for Xavier_1

Would you be kind enough to explain what exactly the problem is? It's too early for guessing games here. ;)

Member Avatar for Moschops
0
198
Member Avatar for Diellza S.
Member Avatar for vergil1983

This is actually a common exercise, with well known solutions. But the neatest trick is to make two passes over the string: 1. First Pass: Reverse all characters in the string (ie. "treboR si eman yM") 2. Second Pass: Reverse each *word* in the string Nothing fancy, just super basic …

Member Avatar for deceptikon
0
97
Member Avatar for MandrewP

> Or do you just not ask that question and automatically stay away from any undefined operations? No and yes, respectively. Undefined behavior is super bad, but questioning *why* something is undefined improves understanding of the concept and helps one to avoid it in cases that aren't textbook examples.

Member Avatar for shahid_650
0
204
Member Avatar for theashman88

The method belongs to the class and not any single instance of the class.

Member Avatar for RichardGalaviz
1
308
Member Avatar for ddanbe

For smaller projects I place enums in a project-level Enumerations.cs file. For larger projects I tend to break things down into folders where each folder holds related stuff and might have its own Enumerations.cs file. For tiny projects or strongly self-contained classes where only the class needs access to it, …

Member Avatar for RichardGalaviz
0
597
Member Avatar for tingwong

Note that Daniweb prohibits discussion of hacking. I'll allow this thread because the question is very specific and more about C in general, but take care in asking for details about how the exploit works.

Member Avatar for deceptikon
0
156
Member Avatar for lian_1

Since this is a final project, I tend to agree with your teachers. You should have all of the building blocks available at this point to complete the project, they just need to be put together. Perhaps if you asked a more specific question rather than just posting your assignment, …

Member Avatar for deceptikon
-1
106
Member Avatar for J.C. SolvoTerra

> What's your preferred method for saving your program's settings? It depends on the settings and the complexity of the program in my case. For simpler things, I prefer app.config. For more complex things I prefer my own XML file using serialization. Sometimes I'll go with storing settings in a …

Member Avatar for J.C. SolvoTerra
1
404
Member Avatar for EarhawkPH
Member Avatar for thilinam

> how to overload bitwise i.e << and >> operators ? The same way you overload any other binary operator. There's no magic to the shift operators, though if you're not careful then precedence rules might bite you in the ass when you use them.

Member Avatar for pirbhat.ariya
0
239
Member Avatar for JOSheaIV

> what tips have you learned over time? The technical stuff is easy. My biggest wins in UI design have come from end user feedback. Things I find to be obvious are often obtuse to an end user, and knowing what confuses them has helped me to build intuitive interfaces. …

Member Avatar for ddanbe
0
170
Member Avatar for AmrMohammed

> You can't do that. There is no way other people can use your "project" without also having purchased and installed MS Access. I'll be sure to let my clients know that the software they're using is impossible. ;)

Member Avatar for deceptikon
0
205
Member Avatar for rushikesh jadha

Sorry to hear that. Perhaps if you offered something significantly less vague, someone might be able to help troubleshoot.

Member Avatar for rushikesh jadha
0
74
Member Avatar for kyle.mace.35

> I need to be able to take a string and put it into an array of chars, how can i do this? If the string is a literal, it's as easy as this: char test[] = "08/11/2014"; If the string is obtained some other way, and all you have …

Member Avatar for deceptikon
0
223
Member Avatar for munchlaxxx

Imagine an array: {1, 2, 3, 4, 5, 6} Now imagine dividing it up into pairs: {1, 2} {3, 4} {5, 6} Then swap each pair: {2, 1} {4, 3} {6, 5} Put back together you have the final result: {2, 1, 4, 3, 6, 5} Which in pseudocode would …

Member Avatar for munchlaxxx
0
930
Member Avatar for DS9596

> Need it in 15 mins Yeah...15 minutes would be *really* pushing it even for an expert who knows exactly what to write and doesn't require any debugging. I'm happy to offer advice to help you learn when you have more time, but for this particular project, you're SOL.

Member Avatar for deceptikon
-2
163
Member Avatar for happygeek

I have a beard, and a damn fine looking one at that. But off the top of my head, I can't think of anyone else I've worked with recently in the IT sphere that had any significant facial hair.

Member Avatar for DistantGalaxy
1
521
Member Avatar for Chris_19

It somewhat depends on how much you do exactly with those tools and if you run them all at once. For example, Photoshop alone can be a massive resource hog. One of my buddies is a photographer, and for several years he used Mac exclusively because of the higher RAM …

Member Avatar for benmar
0
693
Member Avatar for daino

Start from the simplest and work your way up: RLE, sliding window, LZW, and Huffman are the simpler algorithms. They're relatively easy to implement and reason about. Production level algorithms tend to be either proprietary or variations/combinations of the simpler ones. Also keep in mind that different types of data …

Member Avatar for Ghost0s
1
203
Member Avatar for nitin1

> Why will I need to update each and every source file? For fun, let's use `printf` as our example even though it's unlikely to change for the forseeable life of C. int printf(const char *fmt, ...); int main(void) { printf("Hello, world!\n"); return 0; } You do that in every …

Member Avatar for Lardmeister
0
235
Member Avatar for Basit shahani

in·her·i·tance (n) 1. money, property, etc., that is received from someone when that person dies 2. something from the past that is still important or valuable 3. the act of inheriting something

Member Avatar for deceptikon
-1
129
Member Avatar for nitin1

> Why does it need int in postfix and not in prefix? This is a case of Bjarne Stroustup being *too* clever. The two member functions need a different signature to resolve ambiguity between them. C++ doesn't differentiate between return types when comparing signatures, so it has to be done …

Member Avatar for rubberman
0
203
Member Avatar for Violet_82

> The answer to that question is: "It's usually advertised with the hdd itself. Advertised poorly. Manufacturers tend to advertise in increments of 1000 rather than 1024, so a 1GB drive is smaller than a binary minded person would expect. Throw in necessary formatting and system reserved space, and the …

Member Avatar for Violet_82
0
150
Member Avatar for マーズ maazu

I think a better question is why did you reach the point where `malloc` is failing? With virtual memory being standard operating procedure in modern OSes, it should be extremely rare unless you're doing something silly. Can you elaborate on what problems you're doing and how you're solving them?

Member Avatar for rubberman
0
1K
Member Avatar for lewashby

> Playing with the structure examples in the book reminds me of accessing attributes to a python Class That's not a bad analogy. A structure in C++ is just a class with different default access (public instead of private). A union is different in that all members of a union …

Member Avatar for cheryllocascio
0
195
Member Avatar for Nathanaelneal

Wires with the same base color are paired, so it makes sense to distinguish them somehow as pairs. They can't both be a solid color or you'd confuse them on each end of the cable. Thus, the white stripe.

Member Avatar for happygeek
-2
297
Member Avatar for nitin1

> May be any platform, any compiler, I just want to do the complete procedure myself. The complete procedure really does vary between compilers and operating systems and the documentation for your compiler will give you specific instructions. For a static library it's super easy. Just create a standalone project …

Member Avatar for nitin1
0
163
Member Avatar for m.a.u.

Since you're already using C++/CLI, why not initialize a `DateTime` object with the `String^` and then use the `ToLocalTime` method? What exactly does the string contain? Is it a standard UTC format?

Member Avatar for m.a.u.
0
417
Member Avatar for razamughal67

Double check that your credentials are correct. I've seen this happen when the password expires or is changed.

Member Avatar for razamughal67
0
470
Member Avatar for anumash

Yup, variables in a nested scope hide variables with the same name in parent scopes.

Member Avatar for rubberman
0
251
Member Avatar for aabbccbryanmark_1

For this I'd select the count of matching records: select count(*) from tblSchoolYear where schoolYear = @schoolYear If it's greater than 1, you have duplicates and can show a message box. However, that particular query strikes me as producing false positives unless the schoolYear column is largely unique. You'd likely …

Member Avatar for aabbccbryanmark_1
0
353
Member Avatar for COKEDUDE

Command line arguments are always strings. What those strings represent depends on your code and how you use them. But yes, if an argument represents an integer and you want to store it in an integer type, you need to convert the string with something like `strtol` (`atoi` is not …

Member Avatar for deceptikon
0
269
Member Avatar for hor3045

What arguments are you planning on supporting? Are they the strings to convert or switches that alter how the conversion happens? The first step is to solidify your understanding of how the program should work at a higher level, then you can dig down and implement the pieces.

Member Avatar for hor3045
0
603
Member Avatar for Suzie999

> Am I using the +1 wrong? There's not really a way to use it wrong, barring full out abuse like automatically downvoting every post from a member regardless of post content. Typically I use the voting system as a type of kudos. If I think a post is well …

Member Avatar for Suzie999
0
201
Member Avatar for anumash

> Assuming the size of the register is 8 bits and the leftmost bit is reserved for sign shouldn't the size be -127 to +127. It is. Well, that's the required minimum size defined in the C standard. However, the range can be extended by any implementation. Particularly, the extra …

Member Avatar for anumash
0
216
Member Avatar for PK.AMRAV

> But try again after including the library function #include<conio.h> as well. Not only will this not solve the problem, it also destroys code portability by requiring the compiler to support a non-standard library.

Member Avatar for deceptikon
0
246
Member Avatar for Taimur_1

This is an extension method I use for that purpose: /// <summary> /// Separates a list of items into sub-lists of chunkSize chunks. /// </summary> /// <param name="items">The original list of items.</param> /// <param name="chunkSize">The desired size of each sub-list.</param> /// <returns>A list of sub-lists of up to size chunkSize.</returns> …

Member Avatar for deceptikon
0
140
Member Avatar for nhrnjic6

> Now before you all go with strstr I'm not sure I'd recommend `strstr` for this anyway. ;) > i dont want to use <string> You mean `<string.h>`? That's where `strstr` is declared. `<string>` defines the `std::string` class. > Any suggestion for solution of this issue is a big Thank …

Member Avatar for vijayan121
0
234
Member Avatar for Joemeister

I'm not entirely sure I understand the problem. A `bool` property will display appropriately as a checkbox by default in a `DataGridView`. So you'd add such a property: bool Availability { get; set; } Then convert the result of the combobox as necessary (varies depending on how you've got the …

Member Avatar for Joemeister
0
268
Member Avatar for lewashby

> In the program below what is the difference between rand and srand? `rand` generates a pseudorandom number. `srand` seeds the generator that `rand` uses. The seed essentially determines what the first random number will be and affects subsequent numbers in the sequence. If you don't call `srand`, the seed …

Member Avatar for deceptikon
0
216

The End.