gusano79 247 Posting Shark

make it shared across my LAN with others so that they can pull a copy on their own PC and work on it, and push their changes to the project, and thus make it available to all devs concerned.

You want some sort of version control system to avoid the special hell that is conflicting edits.

What is the best way/tool available to share such a project freely on a LAN?

There are more than a few systems out there, depending on your requirements...

What tools would be required for each user to get access to be able to pull/push a copy from their PC using VS 2015?

Off the top of my head, Visual Studio integrates with Git and Subversion; there are also VS plugins for other source control systems.

Ritesh_4 commented: thanks will have a look at these options +6
gusano79 247 Posting Shark

The only downside is that it appears to require some compiled binaries. I understand that it might not be possible to get around this though...

The only dependencies are whatever system libraries are necessary on your platform, and GLFW builds very easily from source. You can use CMake to create project files, but it's simple enough to do it manually; this is what I have done for my personal projects that use it.

OpenGL without the useless Win32 baggage

A little "gotcha" here... there are a few things that some (most?) Windows-based systems need for gl.h (e.g., having APIENTRY defined). I recommend including glfw3.h wherever you need OpenGL, even if you're only making GL calls; it takes care of the necessary bits without the overhead of including <windows.h>.

gusano79 247 Posting Shark

If you want to be cross-platform, GLFW is an excellent lightweight library that handles creating OpenGL contexts, basic window management, and user input. Then it gets out of your way.

gusano79 247 Posting Shark

Yes, I am using GLEW for my opengl functions.

Aha. See if this SO answer gets you going.

gusano79 247 Posting Shark

Hm. Perhaps an overzealous browser pre-loaded it for you from a link on a page you visited?

gusano79 247 Posting Shark
gusano79 247 Posting Shark

What I'm looking for is a library that can read in an equation...

Well, if your input is like the example (V = Q/C = ...), you can split at = and proceed with shunting-yard as you said, at least for this portion.

parse the relations between the variables and can reverse the relationships so if I give it any set of all-but-one known values, it can calculate the unknown variable.

Hm. Something like MATLAB?

gusano79 247 Posting Shark

You mean like the first paragraph of https://en.wikipedia.org/wiki/Database_index ?

gusano79 247 Posting Shark

define "equations".

I second the question; are you looking for an algebraic solver, like a system of equations kind of scenario?

What do you see as an equation?
1 + 3 + 4 - 1 / 2 = ?
or
"1 + 3 + 4 - 1 / 2 = " ?

Those are expressions, "equals" sign notwithstanding. Or is the "?" in the first example meant to be a variable name?

gusano79 247 Posting Shark

This right here is your problem:

*ptr = '\0'

...because you do this earlier:

ptr = string

...which means you're modifying the string as you scan it. This is not a good idea.

A better signature for your splitter function would be:

int StrTok(vector<string> &vTokens, const char* string, const char *delim);

Note the use of const; now the compiler won't let you change those arguments.

This breaks your code, though, so you'll have to work out how to split the string without modifying it. You could make a copy, but I think a better approach would be to track the start and end positions of the "current" token, advancing them as you find the delimiter string.

Unrelated comments:
* ptr doesn't need to be static.
* i should be a size_t to avoid the signed/unsigned mismatch warning.
* p_str isn't used anywhere.

gusano79 247 Posting Shark

What other headers are you using? One of them must be including cctype for its own purposes.

gusano79 247 Posting Shark

Had a quick glance at PortAudio, but I do not see any mixing features listed in the docs (unless overlooked).

You didn't miss anything; that's why I called it DIY... :) Mixing is just about the easiest thing you can do in audio software, though, and a simple crossfade between two audio streams isn't much harder.

I'm not aware of any library that has a complete crossfading solution, but you might get close with SDL_mixer (.NET-ified with C# SDL). IIRC, it does automatic fades on a single channel, so all you'd have to do is tell one to fade in and another to fade out.

You might also find something similar in OpenAL (usable from .NET via OpenTK and probably some other wrappers).

gusano79 247 Posting Shark

I don't know NAudio, but it looks useful at a first glance.

Do you have language/platform restrictions?

If you have the time and inclination for portable DIY, you might look at PortAudio for output (I can speak to this one a bit) and something to decode whatever formats you want (e.g., libsndfile, FFmpeg, mpg123).

ETA: I realize you posted in the C# forum; C interop shouldn't be too hard for the DIY options.

gusano79 247 Posting Shark

Hm. Do you need a GUI? The 'sqlite3' tool that ships with SQLite should work well if you don't mind a text interface.

gusano79 247 Posting Shark

Well, crap; sorry. It says "Encrypted database support" right on the page I linked...

gusano79 247 Posting Shark

Hm, no... I get the green padlock; identity verified by COMODO. It also reports that the certificate's encryption is obsolete (TLS 1.0), but that didn't register as bad enough for the red pen.

gusano79 247 Posting Shark

SQLite2009 Pro Enterprise Manager says it supports encrypted databases; I don't have any personal experience with it.

gusano79 247 Posting Shark

Perhaps, by coincidence, all of their certificates have expired. Does Chrome tell you why it's red-ified "https"?

gusano79 247 Posting Shark

"The Loan Ranger" (domino mask)
"Loan Wolf" ('three wolf moon' with a coin instead of the moon)
"I Think We're A Loan Now" (Tiffany)
"The Loan Wars" (a $ith lord)

Mya:) commented: Haha thanks those are some great ideas +2
gusano79 247 Posting Shark

"My struct variable" means key, right?

The compiler message (I get a warning, not an error) is showing up because you declare it and then pass it as a parameter immediately thereafter:

struct KeyInfo key;

GenerateKey(key, KEY_SIZE_128);

But look at the declaration of GenerateKey:

void GenerateKey(KeyInfo keyInfo, int keySize);

You're passing keyInfo by value, which is not what you want, judging by GenerateKey - as written, you'll never get anything back.

Change GenerateKey to take keyInfo as a pointer or a reference, and that should take care of it.

While we're here...

typedef struct KeyInfo
{
    char Key[32];
    int KeySize;
};

Do you expect KeySize to always be 32 or less?

gusano79 247 Posting Shark

Side note - please indent code so it reads better, e.g.:

if (fundt[kq-1][ky-1][2-1] < 450,000,000.00) ktti[ky-1][0] = 1;

First thing I notice is you're indexing the array every single time you check the value... it seems pretty clear you don't expect the value to change, so it will be much easier to read if you index it once and stuff it into a variable, like this:

if (value < 450,000,000.00) ktti[ky-1][0] = 1;
else if ((value >= 450,000,000.00) && (value < 525,000,000.00)) ktti[ky-1][0] = 2;
else if ((value >= 525,000,000.00) && (value < 650,000,000.00)) ktti[ky-1][0] = 3;
...

Also, in the if/else if blocks, you don't need to test the low value in the else ifs; you've already tested for that in the previous line. Eliminate those tests, and it'll look more like this:

if (value < 450,000,000.00) ktti[ky-1][0] = 1;
else if (value < 525,000,000.00) ktti[ky-1][0] = 2;
else if (value < 650,000,000.00) ktti[ky-1][0] = 3;

Make those changes, and see if your problem becomes more apparent.

gusano79 247 Posting Shark

What happens when you enter the same string twice?

gusano79 247 Posting Shark

Have you tried to do this yet? Show us what you've written so far, and we can help with specific problems you're having.

gusano79 247 Posting Shark

See the PointToClient method. In this case, Main_Window is the control.

gusano79 247 Posting Shark

What error do you get?

Also, I think you should be getting at least a few warnings out of your compiler, if not errors. Are you?

Things I notice at a first glance:

You have...

int initialize(PTR_VALUE value_array);

... which is equivalent to:

int initialize(int* value_array);

... but you call it like this:

PTR_VALUE pValue;
initialize(*pValue);

*pValue is dereferencing your pointer, so you're passing in the value pointed at by pValue, not the pointer itself.

Try this for starters:

initialize(pValue);
gusano79 247 Posting Shark
gusano79 247 Posting Shark

More explicitly, you have an array of ints at the top:

int str[5];

...but an array of pointers to int as a parameter:

int mult(int x, int y, int *str[])

You probably want this instead:

int mult(int x, int y, int *str)
Ctwo commented: Thanks that worked. I've tried alot of combinations with the brackets and stars, somehow didn't end up using the proper one. +0
TalhaMoazSarwar commented: You are good!! +0
gusano79 247 Posting Shark

8 1 0 9 2 7 12 56
This clearly works and is very elegant in its implementation.

Is that the last result? Because it's clearly not sorted...

Ah, I see. It's the first partition, not the end state. Sorry, disregard.

If possible, could you explain me the idea behind writing the partition as mentioned above?

In other words, do you mean "how does partition work?"

gusano79 247 Posting Shark

Something like this:

if(i.fsize != j.fsize) return i.fsize < j.fsize;
else return /* compare filenames here */

There are other ways to organize the if-chain; this one makes the most sense to me because the higher-precedence comparison appears first.

gusano79 247 Posting Shark

Hm. That "exists" clause seems unnecessary; have you tried updating with a join instead?

Here's the general shape:

UPDATE p
SET p.<fields...>
FROM Packet p
JOIN MSGTO m ON m.MSGTO = p.MSGTO
WHERE <conditions...>

This is what I do with SQL Server; Access might want different syntax, but IIRC it will do this too.

gusano79 247 Posting Shark

From the MSDN page I linked:

In formatting operations, custom date and time format strings can be used either with the ToString method of a date and time instance or with a method that supports composite formatting.

So...

string ddd= DateTime.Now.ToString("yyyy-MM-dd");

Another possibility is this webpage

Those are both correct. The former is "the ToString method", and the latter is "composite formatting".

gusano79 247 Posting Shark

Is this going to change anything to my project (where it will now be found, it's "file name", etc.)?

No changes to the project file name or location. Your classes, though, will automatically belong to the new namespace unless you're specifying namespaces manually (I'm guessing you're not).

gusano79 247 Posting Shark

You already have a DateTime object; have a look at custom date and time format strings.

gusano79 247 Posting Shark

I'd say it's worth it just for the reduced risk of making unintentional mistakes while generating code.

But if you're working in .NET, the Entity Framework already does most of what you'll want.

gusano79 247 Posting Shark
  • Prevent syntax errors
  • Target multiple .NET languages

Is this an assigment? Detailed explanation left as an exercise for the reader.

gusano79 247 Posting Shark

which didn't look like part of program at all

So the lesson here is software is often more complicated than it seems, especially compiled and optimized software.

RikTelner commented: :(, expected another ending. But it has to do :(. +2
gusano79 247 Posting Shark

it could break certification because the checksum may be involved in the process when issue the certification

This is one of the major reasons to have a certificate; to protect against modifications. Though the signature algorithm is usually much more secure than a simple checksum.

after I started application, it said at once, that it's missing a file

The actual error could be something completely different, and probably is. "Missing file" errors are notoriously uninformative, but it's all you can get from some software. It probably means some sort of I/O problem, but I've also seen similar messages when the real failure is security-related.

gusano79 247 Posting Shark

if ((s1[i]|32) < (s2[i]|32)) //Set the 6th bit in both, then compare

It's a case insensitive comparison.

Have a look at this ASCII table. The difference between 'A' and 'a' is 32 = 2^6, and uppercase letters all have bit 6 clear. So if you set bit 6, you get the lowercase version either way.

Note that this only works for the ASCII (or equivalent encoding) characters [A-Za-z]... if the strings have other things in them, this comparison will not behave as expected.

gusano79 247 Posting Shark

the csv file contents the weights of 200 oranges so is it really right to count rows?

Well, it's not wrong... but it's also true that this example is simple enough that you can just read numbers until you're done, so that's not really wrong either.

This exercise isn't really about CSV data, though you could interpret it as a single-column table. I'm talking about rows because that's a concept that will be useful for a wider variety of data.

For example, say there were more bits of information about the oranges... maybe diameter and hue. Then you might have a data file that looks like this:

74.81,6.43,30
70.1,6.22,31
71.54,6.11,28
68.79,5.98,33

...and you'd have to separate fields at the commas to get the weight.

All of this is just to say that if you think of each line in the data file as a row in a table, it will help you understand more complicated scenarios when you get to them.

gusano79 247 Posting Shark

Seems like im supposed to initialize a counter and count how many delimiters that are used in the csv file.

There's one orange per row, right? We want to count oranges, so count rows, not delimiters.

You're currently using delimiters:

while(input.hasNextDouble())

...which may work for this simple example, but it's not correct and it will likely cause you problems if you try this elsewhere.

You had the right idea, but commented it out:

while((line = input.readLine()) !=null)

Each line in the input is a row. This will get you one row each time through the loop; easy to count.

Then focus on getting vikt out of line.

Then sum up the content ... in a total variable and then divide the total ... with the sum of the counter

You're already summing the weights:

weight.add(vikt)

...so all that should be left is to divide at the end.

gusano79 247 Posting Shark

Anyhow, what i dont get, is how to calculate this from the csv file. I hardly believe that what they want us to do is to simply create two variables...

It sounds like it really is that simple. I read "calculate from the CSV file" to mean that you should use the data from the files, i.e., count apples and sum weights as you read the file, and divide after you're done loading. Perhaps the focus of the assignment is to be able to calculate the mean for whatever data are provided?

gusano79 247 Posting Shark

On which line is that error occurring?

gusano79 247 Posting Shark

Is this graphics context for a control, or for an off-screen image? Do you have a small sample application that we can work with?

gusano79 247 Posting Shark
gusano79 247 Posting Shark

Also, at some point you should look into using parameterized queries.

Begginnerdev commented: Safeguarding agaisnt Injection Attacks +9
gusano79 247 Posting Shark

there is no execution taking place..

It's hard to tell what's happening when you're using connection and command objects that are declared outside of the code shown. Somewhere you should be calling comm.ExecuteNonQuery().

gusano79 247 Posting Shark

UNABLE TU DELETE

What does that mean? What happens when you execute the query?

" DELETE FROM Table1 WHERE Fname =" + textBox1.Text + ""

Why are you appending an empty string to the end of the query? The append would make sense if you were surrounding the text in single quotes:

"DELETE FROM Table1 WHERE Fname = '" + textBox1.Text + "'"

Try that.

The query can be a little clearer using string formatting:

String.Format(
    "DELETE FROM Table1 WHERE Fname = '{0}'",
    textBox1.Text
);

But really, you should be using parameterized queries.

gusano79 247 Posting Shark

Neither do I; you could start at https://developers.google.com/maps/

gusano79 247 Posting Shark

the map is taken from google map

Are you using Google's API? They might have an image-to-coordinates method there.

and it can be any map according to user choice

If you're loading user-provided maps, there is no automatic solution. You need to have more than just the image to determine latitude and longitude.

gusano79 247 Posting Shark

whenever I input an expression, it just comes to an halt, and some time after, it's --"The program is not responding"

That's not what happens when I run it... depending on the input, I've been able to make it stop without doing anything, and also segfault.

What input are you giving it when it spins forever?

The code compiles

Do you get any warnings? GCC gives me a few that you should address. Let's fix these, and see if the situation improves:

main.cpp|50|warning: no return statement in function returning non-void [-Wreturn-type]|

char Push(char ch)

It doesn't return anything. Did you mean void Push(char ch)?

main.cpp|58|warning: suggest parentheses around assignment used as truth value [-Wparentheses]|
main.cpp|59|warning: suggest parentheses around assignment used as truth value [-Wparentheses]|

if(s[i]='(') l++;
if(s[i]=')') r++;

= is assignment, not an equality comparison. You meant ==.

main.cpp|68|warning: unused variable 'st' [-Wunused-variable]|

What is st for?