679 Posted Topics
Re: [Bruce Eckel's book](http://www.mindview.net/Books/TICPP/ThinkingInCPP2e.html) has been a good refresher reference for me. | |
Re: You don't need to append the whole thing at once. One way to address your problem is to append only if you have data: sb.Append("Address: "); if(!String.IsNullOrEmpty(Street1)) sb.Append(Street1 + ", "); if(!String.IsNullOrEmpty(Street2)) sb.Append(Street2 + ", "); sb.Append("{0} {1}", PostalCode, City); sb.AppendLine(); | |
Re: At first glance, I'd say it's likely that the subquery is what's killing performance. Try executing that `SELECT` statement separately into a temporary table and doing the update as a `JOIN` with that table. | |
Re: Consider returning a `vector` or some other variable-length list of roots, which would also scale well to a more general root-finding algorithm. | |
Re: p = q = r = n = (int*)malloc(20 * sizeof(int)); Note that this statement will assign the *same address* to all four variables; there's only one call to `malloc`. If you want to allocate four *different* blocks of memory, I'm not aware of any such shortcut. Either allocate them … | |
Re: By "throws error" do you mean "does not compile"? Because [`HttpPostedFile.FileName`](http://msdn.microsoft.com/en-us/library/system.web.httppostedfile.filename.aspx) is a read-only property. Which makes sense, as there hasn't been any file posted yet. Also, it's a string, not a byte array. Have a look through the [`FileUpload` control documentation](http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.fileupload_properties.aspx); you might find something else you can use. … | |
Re: > I plugged a monitor directly to the board and recieved no signal to the monitor I don't see any onboard video for the [M4A77 on the Asus website](http://www.asus.com/Motherboards/M4A77/)... what did you plug it into? > I installed a known good GPU into the board and used that and still … | |
Re: I'd start by refactoring for concision and readability; this will make your algorithm easier to analyze. The most obvious improvement to me is with the nested `if` statements that start out looking like this: if 1<= opp_6 <= 2: These could be turned into a function that takes each of … | |
Re: Best to avoid cursors when possible (which is almost always :). Here's a start, to sum Amounts per unique Reference and ID: SELECT Reference, ID, SUM(Amount) AS TotalAmount FROM [table] GROUP BY Reference, ID What is the purpose of the ID grouping? | |
Re: Assuming you have random access to the input file, you could do something like this: When you read a line that represents a new member (*i.e.*, it's different than the last line's member), hang onto the data in memory for a second. Scan the file, counting lines that represent that … | |
Re: You don't need the `foreach` loop. `i` is already indexing each book; you just need to call the methods on `book[i]`. | |
Re: In the interest of getting your code working soon, this seems to be a problem: loadTblStaff(); loadTblCars(); con.ConnectionString = dbProvider + dbSource; You're creating the connection string *after* calling methods that need to use it. Try moving that last line above the `load`\* method calls. I think you should be … | |
Re: In addition to Mr. Waddell's comments... An immediately obvious problem: the source has `green.png`, but you're looking for `red.png`. A less obvious problem: You have a space at the end of the first part of the regular expression, but the input looks like it has a newline there. As it's … | |
Re: You have double *backward* slashes, which will confuse a Windows machine. Change `\\` to `\` both places it appears. When troubleshooting batch files like this, you should remove or comment out `echo off`; then you'll be able to see exactly what commands are being executed. | |
Re: Have you looked at using the [Microsoft Office Primary Interop Assemblies](http://www.microsoft.com/en-us/download/details.aspx?id=3508)? | |
Re: [MSDN How to: Display Modal and Modeless Windows Forms](http://msdn.microsoft.com/en-us/library/39wcs2dh(v=vs.110).aspx) | |
Re: Side note: Also consider [`Path.Combine`](http://msdn.microsoft.com/en-us/library/fyy7a5kt.aspx) for creating the final path. | |
Re: [Assemblies Overview on MSDN](http://msdn.microsoft.com/en-US/library/k3677y81(v=vs.80).aspx) Short version: They're how .NET applications are organized. | |
Re: Does this model have a touchpad below the spacebar? I've had similar problems with laptops before; my hands tend to brush against the touchpad, which causes all sorts of weird cursor movement. | |
Re: Rather than try and guess what's wrong, let's see what SQL is getting executed. Set a breakpoint on the line `command.CommandType = System.Data.CommandType.Text` and run the project... when it stops, see what the value of `command.CommandText` actually is. That should be illuminating. Also, do get into [parameterized queries](http://msdn.microsoft.com/en-us/library/yy6y35y8.aspx) sooner rather … | |
Re: What's the value of `DS` when this error happens? | |
Re: As for #1, it looks like it's supposed to be "[factorial](http://en.wikipedia.org/wiki/Factorial)"; that's what `n!` usually means. #4 makes sense that way, too. | |
Re: Are you sure it's stopping with the first frame, or is it possible that it's looping all the way around once and stopping on the first frame? That's what your code looks like it's doing. It will always reset `currentFrame` to zero, even if we're not looping. Try changing this: … | |
Re: What have you tried so far? Showing us what you've tried will help us understand better where your problem is. In this case, you want `count(/library/book)`. The query `/library/book` returns all of the `book` elements, which you should pass as a parameter to the `count` function so it can do … | |
Re: [Here's a discussion on a few ways to implement paging](http://stackoverflow.com/questions/548475/efficient-way-to-implement-paging); that's the closest I can think of to get what you want. | |
Re: From [the Wikipedia article on digital watermarking](http://en.wikipedia.org/wiki/Digital_watermarking): > A digital watermark is a kind of marker covertly embedded in a noise-tolerant signal What algorithm you use depends on what kind of data you're watermarking. For example, if it's an image, you can usually add a watermark by replacing low bits … | |
Re: What do you mean by "can't get them to work"? Please provide specific examples of what you expect to see and what is actually happening. It makes it much easier to help you find what's wrong. | |
Re: Does `loginName` come with [quotes](http://dev.mysql.com/doc/refman/5.0/en/string-literals.html) already? | |
Re: Have you tried writing this yourself yet? Show us some work, and we'll help you get moving in the right direction. | |
Re: I use Visual Studio at my day job; it's a decent IDE (though there are a few things I'd have had it handle differently, especially around autogenerated code). Haven't used Eclipse for .NET development, so I can't comment on that. You may also want to look at [SharpDevelop](http://www.icsharpcode.net/opensource/sd/); I use … | |
Re: 1. [NSLog](http://cocoadev.com/wiki/NSLog) works much like [printf](http://www.cplusplus.com/reference/cstdio/printf/); `%d` is for integers, `%f` and `%F` work for both floating point types, and `BOOL` is [just an integer](http://stackoverflow.com/questions/3452306/objective-c-boolean-values), so use `%d`. 2. `double` [can handle more precision](http://www.techotopia.com/index.php/Objective-C_2.0_Data_Types#double_Data_Type); try a number with more digits. 3. That's how the language works; you have to write … | |
Re: Do you have any requirements, or are you free to design the file system however you want? I'd start with basic design (folders, files, *&c*.), and from there, design the API that consumers of your file system will use (or if you want to be more formal, start with use … | |
Re: First step is to see what the console output says; open up a command window and run it manually. | |
Re: This also might indicate that a background thread is still running. | |
Re: What behavior are you expecting and what are you actually seeing? It's easier to help if you give specifics. Meanwhile, here are some comments: > trying to use recursion Is there a specific requirement that you use recursion? If not, there are other approaches I'd recommend exploring first. > to … | |
Re: Changing the file extension doesn't do anything to the contents of the file. It looks like this is what's causing your "corruption"--you're asking Excel to load a CSV file, but its contents are still Excel format. What you'll want to do is load the XLS or XLSX file as an … | |
Re: I'm not familiar with the term "client" used this way; that usually indicates some kind of network connection to me. For what I think you're asking, I usually use "consumer"--that is, a consumer of class A is any class B that uses class A. If that's what we're talking about, … | |
Re: I agree that fall-through can be handy, and I do occasionally lament its absence at my day job. But Microsoft seems to have been interested in lowering barriers to entry for a long time now, and AFAICT, this was just a decision the language designers made to prevent foot-shooting. My … | |
Re: Comment #1: > for(int x = i+1 but > x+=30; I don't think that will do what you think it will do... are you trying to increase an x-coordinate there? Comment #2: > but this way x+= 30 can still move enemy on top of each other. So the next … | |
Re: "Don't work" isn't enough information for us to help... please post the code you have so far. | |
Re: To sort as part of your query, use an [`ORDER BY` clause](http://office.microsoft.com/en-us/access-help/order-by-clause-HP001032258.aspx). Does that help? If not, please post some code so we can get at specifics more easily. | |
Re: Also: [wxWidgets](http://www.wxwidgets.org/), which is supported by [various GUI designer tools](http://wiki.wxwidgets.org/Tools#Rapid_Application_Development_.2F_GUI_Builders). | |
Re: What does "didn't work" mean? What results did this code give you? | |
Re: You could generalize the point generation you have in `initPoints` to a method that takes an angle and returns the point at that angle; it would look something like `Point CreatePoint(double theta)`, and would make use of the code inside your `for(int theta...` loop. Then get points for 45, 235, … | |
Re: Have you looked at [these methods](http://en.wikipedia.org/wiki/Determination_of_the_day_of_the_week)? | |
Re: Decryption is the same as shifting by `(26 - shift)` | |
Re: [SQL INSERT](http://www.w3schools.com/sql/sql_insert.asp) doesn't use the WHERE clause. I'm not sure what you want to do here... can you post a "before" and "after" table to show us what you want to happen? Please include column names too. | |
Re: First thing that leaps to my attention is this section: if (rollTotal == 2) // for each roll of the dice. With the if { rollHist[0] += 1; // statements it calculates how many times } if (rollTotal == 3) // a certain value is produced by a roll of … | |
Re: It might help to visualize the constructed tree. For your example sequence [5, 3, 9, 7], I get: 5 / \ 3 9 / 7 I'm not aware of "binary search cost" as a standard term, but it appears to be the element's tree depth plus one. This makes sense; … | |
Re: From Wikipedia's [article on variance](http://en.wikipedia.org/wiki/Variance): > The variance of a random variable or distribution is the expectation, or mean, of the squared deviation of that variable from its expected value or mean. So you need the mean first; you're already calculating that in `Average`. So for each original number, find … |
The End.