gusano79 247 Posting Shark

error C2065: 'StreamReader' : undeclared identifier

Add this:

using namespace System::IO;

error C2065: 'inData' : undeclared identifier
error C2227: left of '->EndOfStream' must point to class/struct/union/generic type

These happen because of the StreamReader problem.

The following isn't in your list, but it'll come up:

error C2039: 'searchResult' : is not a member of 'Hardware_Store::Form1'

The member is searchResults, note the plural. Change it in the few places it's not right.

gusano79 247 Posting Shark

Are you stuck with this technology choice? Because from your description, this project has outgrown Excel as a useful backing data store. I'd consider a database-oriented solution like MySQL (which does incorporate regular expressions).

gusano79 247 Posting Shark

Off the top of my head:

  • Use HTTPS, if you can.
  • Authenticate without actually sending the password, as in a challenge/response. This isn't completely safe (e.g. it's still vulnerable to man-in-the-middle attacks), but it's much better than sending a cleartext password.
Gribouillis commented: good link +13
gusano79 247 Posting Shark

I'm not up on my Android details, but I'll give this advice: Pick a graphics subsystem that's the simplest and easiest for you at first, and write your card game so that the actual operation of the game is decoupled from the graphics. Separating them is a good practice in general, and it will also allow you to upgrade to fancier graphics later without having to rewrite the rest of it.

gusano79 247 Posting Shark

Aha! I found an example of how you can customize a locale.

A quick test:

#include <iostream>
#include <iomanip>

using namespace std;

struct CustomSeparator : numpunct<char>
{
   char do_thousands_sep() const { return ','; }
   string do_grouping() const { return "\3"; }
};

#define AMOUNT 250714520349508480.0

int main()
{
    cout << fixed << setprecision(2);
    cout << "Normal: " << AMOUNT << endl;
    cout.imbue(locale(locale(), new CustomSeparator));
    cout << "Custom: " << AMOUNT << endl;
}

For me, this displays the following:

Normal: 250714520349508480.00
Custom: 250,714,520,349,508,480.00
gusano79 247 Posting Shark

Well, your mileage may vary... I can't actually get it to format numbers like that, which appears to be because MinGW apparently doesn't do locales much at all.

gusano79 247 Posting Shark

What about std::locale?

gusano79 247 Posting Shark

This line looks odd:

for (float rate=.5; .5<=.10;rate+=.1)

Specifically, this part:

.5<=.10

This will always be false, so the body of the loop never executes.

You probably meant something like this:

for (float rate = 0.5; rate <= 1.0; rate += 0.1)
gusano79 247 Posting Shark

Extra right round bracket here:

"[ClassifiedUnitValuePerm] DOUBLE), " & _
gusano79 247 Posting Shark

If I understand you correctly, this should be workable in a single query. Before we get into details, how familiar are you with MySQL JOIN syntax? ...and table aliases in particular?

gusano79 247 Posting Shark

It works for me, too (mingw32-gcc 4.7.1). What compiler versions do you have on your machine and the school one?

gusano79 247 Posting Shark

Perhaps something like this will work for you:

DECLARE @enddate DATETIME
SET @enddate = GETDATE() -- or whatever end date you're interested in

SELECT ...
WHERE a.IPI_Ref_Date BETWEEN DATEADD(YEAR, -1, @enddate) AND @enddate
gusano79 247 Posting Shark
gusano79 247 Posting Shark

String.IndexOf in the .NET Framework is essentialy the same thing as Java's String.indexOf, allowing for platform differences.

gusano79 247 Posting Shark
gusano79 247 Posting Shark

You're about to point out that doing pythagorus on two gaussians doesn't give a gaussian hypotenuse?

No; it'll give a distribution with a different mean/stdev. So if we're being precise, either pick the x and y deltas using smaller parameters, or pick total distance from the desired distribution and decompose that into x and y lengths.

If the exact distribution isn't critical, I'd go with (startX + g1, startY + g2) as JC suggests.

gusano79 247 Posting Shark

Are the cars supposed to travel along the grid, or do they go directly from point A to point B?

gusano79 247 Posting Shark

Depends... if you just need to draw it rotated using GDI+, you can use Graphics.RotateTransform and draw using the original, unrotated coordinates. Otherwise, I think you're stuck doing it yourself.

gusano79 247 Posting Shark

Oops, missed the nextGaussian method. That's certainly easier. You can use the same transformation from standard to custom normal distributions.

gusano79 247 Posting Shark

Wikipedia has a list of methods for generating normally-distributed values. Note that the methods described correspond to a standard normal distribution, but the linked article gives a simple transformation from a standard normal to one with the desired mean and standard deviation.

For the standard normal, inverse transform sampling won't be useful, but there are other methods, such as the Box–Muller transform or the ziggurat algorithm.

gusano79 247 Posting Shark

What database server are you connecting to? It's likely that connectionstrings.com has a sample connection string for it.

gusano79 247 Posting Shark

When you compare a range such do you use && or do you use the or statement to compare them?

If you want to check whether a value is inside a range, use &&: (x >= 1) && (x <= 10).

If you're checking whether it's outside a range, use ||: (x < 1) || (x > 10).

As I understand them when you and both conditions must be ture and with an or statement only one has to be ture.

Yes.

So then can they both not work to compare a range of numbers?

It depends on what you're comparing for; like in my examples above.

When you're not sure which to use, it can be helpful to draw the inequalities on a number line and see what they do

In c++ you can use the word "and" or the && do these have the same effect?

They are the same thing. and and others like it exist for historical reasons. Nothing wrong with using it, but the symbolic && seems to be more widely used.

gusano79 247 Posting Shark

Well, what's in cell F2?

gusano79 247 Posting Shark

Have you tried starting Windows in safe mode?

gusano79 247 Posting Shark

From which directory are you trying to run FFmpeg? Did you follow step 5 in the how-to, "Edit the Windows System PATH"?

gusano79 247 Posting Shark

Bruce Eckel's book has been a good refresher reference for me.

gusano79 247 Posting Shark

From the FFmpeg download page:

FFmpeg Windows Builds are available at Zeranoe FFmpeg Builds.

You can link to these builds instead of compiling yourself.

gusano79 247 Posting Shark

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();
gusano79 247 Posting Shark

can u also explain how can ffmpeg be related to C?

FFmpeg is a project for working with multimedia data; it includes several C libraries you can use in your own applications.

But...

can u please detail me how to proceed...

...leads me to agree with this statement:

The way you ask the question suggests that this might be awfully difficult for you

Go read some of the FFmpeg documentation or tutorials... if you're still lost, that's a good sign that you're probably not ready to tackle this quite yet.

If a general-purpose multimedia library is overkill for your purposes, there might be a simpler approach we could help with. Is this a specific project and/or video format you're working on, or is this just a general question?

gusano79 247 Posting Shark

You'll want to start with a library like those provided by FFmpeg to decode the video file.

gusano79 247 Posting Shark

Are you suggesting that I calculate the roots first and, if I discover that one doesn't exist, just reduce the size of the results vector

More like as you discover them, add them to the list and return it when you're done. How practial this might be depends on your solver algorithm.

and not even mention the fact that another root doesn't exist?

Basically yes... this does require callers to know how many roots they should normally expect. This is how I'd build a general-purpose root finder, but it may not be the best for your specific scenario.

A question: What would your solver do with a quadratic equation where a != 0 but there is still only one root (e.g., f(x) = x^2)?

gusano79 247 Posting Shark

Consider returning a vector or some other variable-length list of roots, which would also scale well to a more general root-finding algorithm.

gusano79 247 Posting Shark

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.

gusano79 247 Posting Shark

if it assigns same address to all the four variables then how can i proceed with it

The point is you can't, not if you want four separately allocated blocks. We've shown you this construction because it does do something, and it's important to understand so you don't use it incorrectly.

it will somehow delete the values stroed to previous variable while i assign values to the new one,isnt it?

That's not what happens, if I understand your question correctly.

p = q = r = n = (int*)malloc(20 * sizeof(int));

is essentially equivalent to

n = (int*)malloc(20 * sizeof(int));
r = n;
q = r;
p = q;

So there's only one actual call to malloc that happens, and nothing is "deleted."

gusano79 247 Posting Shark
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 all separately, or for more compact code, put your pointers in an array and allocate them in a loop.

gusano79 247 Posting Shark

By "throws error" do you mean "does not compile"? Because HttpPostedFile.FileName 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; you might find something else you can use. I don't know this control very well, but the FileName property is read-only, too. I don't see anything else that might set the filename.

gusano79 247 Posting Shark

Good luck!

gusano79 247 Posting Shark

I don't know where to start in programming the Ai player to select the best possible move with gaining the highest points , but also stopping the opponent from having a "better" move to follow , at same time

Have you read the minimax article I linked? It's one of the fundamental decision techniques for games like this.

gusano79 247 Posting Shark

Unless of course the bad card fried the slot instantaniously upon installation

That's what I'm afraid may have happened.

As for having old PCI cards....sigh as it always goes, I just dumped a bunch of old pc's that had some. But at this moment I do not have any

Hm. Can you could borrow one to test it out? That would be my next step. If a known good PCI video card works, I'd take that as pretty good evidence that your problem lies somewhere in the PCIe bus.

gusano79 247 Posting Shark

Okay. If I were doing this, I'd end up with four tables: one each for spending classes, items available for purchase, persons, and actual purchases. The "amount per spending class" sproc would start with the purchases table and join to the others as needed.

Try modeling it that way and see how far you get; I've left plenty as an "exercise for the reader."

gusano79 247 Posting Shark

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... what did you plug it into?

I installed a known good GPU into the board and used that and still no signal going to the monitor. (light never turns green)

The bad one may have fried the PCIe x16 (that's the slot it went into, right?). Do you have an older video card you could test in one of the PCI slots?

gusano79 247 Posting Shark

you could do that but would have to show the function you have made in the ai player programing

Excellent. Yes, the code would have to be right there next to ai_player, but that's fine; it's just a handy organizational tool.

So on the "make code better" front, I'd start here:

if 1<= opp_6 <= 2:
    points[5] = points[5] + 1
    if points[4] != 0:
            points[5] = points[5] +1
            if points[3] != 0:    
                points[5] = points[5] +1 
                if points[2] != 0:    
                    points[5] = points[5] +1
                    if points[1] != 0:    
                        points[5] = points[5] +1
                        if points[0] != 0:    
                            points[5] = points[5] +1

This can be simplified (from a syntax perspective) into a single loop. Have a try at writing one that cycles down through points[n]. Meanwhile, I'll ponder which kind of loop makes the most sense.

For the "play the game better" goal... it looks like you're picking the move that improves your immediate position. A next step there would be to look ahead a bit to consider what opportunities each possible move would open up for your opponent. Anecdotal example: My grandfather always played a very short-sighted game of Scrabble, so playing directly after him was always the favorite seat; he would invariably leave at least one triple word score wide open over the course of the game.

gusano79 247 Posting Shark

So we're missing data to indicate the spending class of a particular ID. Are you limited to this single table as described, or can we modify things a bit?

gusano79 247 Posting Shark

Does "need to use these basics" include/permit writing separate functions to reuse inside of ai_player?

gusano79 247 Posting Shark

The C# Programming Guide has a quick overview of how to use foreach with arrays. The C# Reference explains a bit about how it uses IEnumerable to get elements of the collection. Follow links and read for more details.

In your case, this:

for (int j = 0; j < choice; j++)
{
    books[j].Display();
}

becomes this:

foreach(book b in books)
{
    b.Display();
}
gusano79 247 Posting Shark

You don't need the foreach loop. i is already indexing each book; you just need to call the methods on book[i].

gusano79 247 Posting Shark

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 the opp_x variables and updates the points array using a simple for loop. Moving another step past that, it could even loop through pots[1][x] directly, so you wouldn't have to copy out the array values.

At the algorithmic level, it looks like you're doing a simple static analysis of the board position. Are you familiar with optimization approaches like minimax?

gusano79 247 Posting Shark

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?

gusano79 247 Posting Shark

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 member. If there are too many lines for that member to fit in what remains of the current file, close it and start a new one; otherwise, keep using the same file. Either way, write out the in-memory record, seek back to the next one, and continue reading records.

If you have the memory available, you could also keep reading in records and only write them out once you have the last one for a member.

All of this is assuming member records are stored contiguously; if they can come in any (dis)order, that's another conversation.

gusano79 247 Posting Shark

Hm, okay. Weird. There are some circumstances under which I've seen .NET applications silently fail and/or die, but as far as I can tell, you're not doing anything nearly arcane enough for that to be a problem.

Can you zip up your entire solution and post it? I'd like to see if I can reproduce the problem over here.