would you put here your table structure with some data in it
^^ This. We can't help you if we don't know what we're working with.
would you put here your table structure with some data in it
^^ This. We can't help you if we don't know what we're working with.
Right. The question is how to translate from (x,y) to (lat,long)... and to do that properly, you need to know what kind of projection was used to create the map.
Is there a specific map you're using, or do you want to be able to do this with a variety of user-provided maps?
Without details, I can't give you a specific answer, but this is where to fix your immediate problem:
FRS.Source = "SELECT * FROM Family"
You could add a WHERE condition to this query to only count entries for a specific branch.
This is a little fragile, though. You might instead select the highest branch number in a particular branch and add one to that instead of relying on the numbers to match the record count.
I don't think the indirection operator is needed (?) because that kind of code has compiled and worked before when I was comparing variables.
Oh, now that you mention it, I seem to remember that iterators are sometimes implemented as plain old pointers... I'm used to seeing the dereferencing syntax.
So. On my machine, your code builds and runs just fine, after I fill in a few blanks. Can you post the whole thing, including the data file? Just so we're testing the same thing.
Just saying it "isn't working" isn't very helpful. Does the code not build? Does it build but not run? Does it run but produce unexpected output? Show us what you've been trying; please be specific.
It looks like the error is coming out of the vector class itself, not your code. Hm. I'm not sure from reading the error message what's going on, but your iterator syntax looks odd.
it
is the actual iterator, while *it
gets you the object to which the iterator refers.
So you have (for example):
(it-1)->Low
...but I think you mean this:
(*(it - 1)).Low
...unless your definition of PriceList
is unusual; I'm assuming it's a fairly thin wrapper around vector<PriceInfo>
.
Ah, ok. For basic WCF services, you shouldn't notice anything different. We've got a number of WCF services at my day job, where we've transitioned from VS 2005 to 2008 to 2012, and I haven't noticed or heard of any problems.
You've got a clue right here:
where n is Dataset.begin() + 2
Vectors get you random access iterators, so you can also subtract.
So start at Dataset.begin() + 2
, increment your iterator while it's not equal to Dataset.end()
as usual, and just refer to the iterators (it - 1)
and (it - 2)
in your loop.
You could also start with three iterators pointint at Dataset.begin()
, Dataset.begin() + 1
, and Dataset.begin() + 2
, and increment them all, using the last one to control the loop. It seems like this might get you a performance improvement, but I'm not 100% sure about that. At the moment, I prefer the first approach; I consider it more readable.
I assume that I shouldn't have to RE-LEARN WCF for each version of Visual Studio.
I agree... it shouldn't be that different. And it hasn't been, in my experience.
What it seems is that the code for VS 2005 would not work in VS 2008. I'm wondering why?
So are we. What does "not work" mean? Does your code fail to build, or just behave badly? Can you provide specific error messages?
The command object doesn't know what connection to use. You should use the MySqlCommand constructor that takes a MySqlConnection parameter.
Can you post the error messages and the relevant code?
Allows you to use parameterized queries ... a lot better than what was suggested
Does sp_executesql
allow you to parameterize column names? I thought it was just another way to do parameterized queries.
A properly better response would be to redesign one's table structure so you don't have to dynamically find the right column. Perhaps with a separate Category
table and a corresponding column in DailyBudget
.
You can't use parameters for column names like that. If you really want something that can adapt to different columns, you'll need to format it yourself beforehand.
Something like this:
String.Format("UPDATE DailyBudget SET {0} = @amount ...", "Foods");
Of course, be aware that this is dynamic SQL.
Something like this:
SELECT
t2.ID,
t2.Firstname,
day1.value AS seq1value,
day2.value AS seq2value
FROM Table2 t2
LEFT JOIN Table1 day1
ON day1.ID = t2.ID
AND day1.sequence = 1
LEFT JOIN Table1 day2
ON day2.ID = t2.ID
AND day2.sequence = 2
That Cartesian product looks suspicious... you shouldn't have to group results for a query like this.
I'd left join on your subqueries instead.
Hm. It's looking for g2res.dll
. I haven't done this myself, but I think C::B knows what to do with .RC files. Try making a new DLL project with the files in g2res.dsp
and see if that builds.
Regarding X11, it was actually a simple X11 function, g2_open_X11
Yep, that's specific to the X window system. For Windows machines, try g2_open_win32.
g2.dll is missing
Ah, sorry, forgot. If you built g2 as a static library, C::B will name the output "libg2.a" unless you changed it. You have to link to that file directly.
I think it wants "g2" to be a DLL if you leave off the extension.
is X11 a different library from g2?
It's the GUI system for many *nix-type OSes. Windows doesn't care.
And there are some functions he is not recognizing
Are these X11 API calls? Or something else?
looking at my old code (the one I used back in Linux)
You may have to rewrite parts of your old code to work on a Windows machine.
If you want to use a Linux-like environment, you might also look into Cygwin.
Oh. And you'll also need to link gd in your project.
Awesome. Just add the g2 library you built to the linker settings of your project like you did for gd. Then include "g2.h" and knock yourself out :)
tried everything said above and I get alot of undefined referenced functions
That's expected :)
Make a note of the reference names; they usually refer to functions in a library the compiler hasn't been told about.
In this case, I know there are some Windows GDI functions that g2 uses. To fix these errors, go to your project's build options, and in the linker settings section, add "gdi32" to the link libraries list. No path needed.
GD support would be much appreciated for my project development.
Do you already have GD on your system? If not, go download a binary.
I think that's where any other undefined references will be found. You'll have to add the GD library in the linker settings like we did for GDI32, but it isn't a system library, so you'll have to browse for it and keep the path information.
the difference between a static or a dynamic library
Static libraries (*.lib or *.a) contain code that is copied into your program when it is built.
Dynamic libraries (*.dll or *.so) are kept separate, and may be shared between different programs.
Further reading:
http://en.wikipedia.org/wiki/Static_library
http://en.wikipedia.org/wiki/Dynamic_loading
Let's see if we can just build it with C::B; that seems simplest to me.
Fixing the errors partly depends on what you need from g2:
Ah, on the Linux machines you just get the package and configure/build from source. Not so simple for Windows.
It looks like the source package includes some old Visual Studio files, so the easiest thing would be to build the 'g2' and 'g2dll' projects... if you can. I think they're VS6 projects, so if you happen to have VS6, do that.
Otherwise, I think cooking up a Code::Blocks project based on the VS6 ones shouldn't be too hard.
Are you using the MinGW/GCC that comes with some C::B distributions?
I'm not 100% sure, but I have a theory. Are you pressing ENTER to finish entering the price? It seems like nextDouble
isn't consuming an ENTER-press, so the following call to nextLine
sees it, and assumes you entered nothing for the category. Try using nextLine
to get the price and convert it to a double separately... if that works, then my theory is correct.
If I remember correctly, the session end event doesn't have an HTTP context because it's not initiated by a request; it happens on the server when it decides the session is over, either timed out or abandoned.
Please elaborate on "prompts me an error"--I presume this was an unhandled exception... post the type of exception and the actual text of the message.
Extra right round bracket here:
"[ClassifiedUnitValuePerm] DOUBLE), " & _
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?
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
String.IndexOf
in the .NET Framework is essentialy the same thing as Java's String.indexOf
, allowing for platform differences.
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.
Are the cars supposed to travel along the grid, or do they go directly from point A to point B?
Oops, missed the nextGaussian
method. That's certainly easier. You can use the same transformation from standard to custom normal distributions.
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.
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.
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();
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.
its still only running the first line of the method and skipping back to the form
This doesn't make sense... under normal execution, code isn't just skipped like that. If it's doing what you say, there must be an exception being thrown. Are you really not seeing an unhandled exception? What IDE are you using?
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 seeing an unhandled exception at line 54 up there, where you try to open a connection that has an empty connection string. Is that what you mean by "never does anything other than call the first method"? Because if there's no exception, loadTblCars
should always be called after loadTblStaff
.
Hm. localhost
is the same as 127.0.0.1
so I'd expect the same result. If it couldn't connect to your server (for example if it was off), you'd get a different error... Hmmmmmm.
I was able to get a similar command to run for my local MySQL over here...
Unknown MYSQL Server host '127.0.0.1'--databases
Notice that there is no space between the host name and --databases
in the error as reported; are there appropriate spaces in your manual command line?
First step is to see what the console output says; open up a command window and run it manually.
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 find the occurence of a specific character in an array of characters
Do you mean a) find the first occurrence, b) find the last occurrence, c) find any occurrence, or d) count the number of occurrences?
From the name characterCounter
, I imagine it's d), but the code doesn't actually count occurrences of the given character.
characterCounter(test, searchChar, test.length-1)
I generally find starting at the beginning results in code that is easier to understand.
if(t.length < 0)
Arrays never have a length less than zero; not sure what you're trying to do with this.
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 Excel file (i.e., don't change the extension), then have Excel export it to CSV--have a look at SaveAs or SaveCopyAs.
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 guess is that they required the last block to have a break
as well just for consistency--they already assume we can't handle fall-through; why confuse us further? Eh, nichevo. =P
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, then your Employee
class is a consumer/client of EmployeeClass
because the former uses the latter, but not the other way around.
Does that make sense?
To sort as part of your query, use an ORDER BY
clause.
Does that help? If not, please post some code so we can get at specifics more easily.