gusano79 247 Posting Shark

We won't write it for you - show us what you've done so far, and it helps to indicate a specific question or problem you're having.

gusano79 247 Posting Shark

I was thinking about having an employee table, a job table, and then a employee_job table that has a foreign key to an employee and a job.

This is a pretty standard way of doing a many-to-many relationship in a relational database; it should work for you.

In the employee_job table there would be a one to many link with a weeks table which would just hold how many hours the employee worked that week for that specific job.

I'm wary of representing weeks directly in the data; it feels too constrained. Depending on your requirements, doing it by week may be just fine, but in general, I'd suggest relating hours to a specific date. This allows you to chop the data more freely (e.g., start the week on Sunday vs. Monday in some cases), and frees you from having a custom definition of "week" (makes your system harder to maintain).

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

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

Another approach:

  1. Shuffle your list of questions (make a copy if the original order is important)
  2. Present them in the new order
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

Do you have a complete example that's short enough to post?

You may be able to use some sort of RAII-like approach; i.e., release the handle in some object's destructor. But beware std::exit... nothing with automatic storage duration will have its destructor called. std::atexit should help there.

If possible, I'd avoid "exit" and just set a flag instead:

bool running = true;
do
{
    Sleep(10);
    if (kbhit())
    {
        running = false;
    }
}
while (running)
// Cleanup
gusano79 247 Posting Shark

Would you temporarily allow for the fact that both algorithims could be used in the code, or do you create a program that makes the necessary conversions, and uploads the data to another server, or what?

Either could work, and I've seen both done... If you can, I'd go with a one-time conversion. You have the passwords encrypted, so there's no technical reason you can't just decrypt and hash them all at once. Just make sure that this change happens at the same time you deploy the application with the change to hashing.

Also, what Hash algorithims are generally considered secure for this kind of thing.

https://en.wikipedia.org/wiki/Comparison_of_cryptographic_hash_functions

One of the more recent SHA algos would be a decent choice; they're supported by the .NET framework

I know that the higher the number after the algorithim, generally the better secured it is, because it "rotates" or morphs the data that many times

For older ones maybe, but for more recent hashes, the number is often the length of the hash itself.

overwraith commented: Thanks for the reply. +2
gusano79 247 Posting Shark

With generics, you can use type parameter constraints to limit the types someone can use with a method, to a certain extent.

If I'm reading you right, though, that's not what you want. The point of a generic method is that the code is identical, no matter what type you put in the parameter. If you find yourself making decisions based on what the actual type is, then you're probably misusing generics.

In this specific case, I think what you're really looking for is a pair of methods, perhaps like this:

public static SqlDataReader ExecuteSelectProcedureSqlDataReader (string procedureName);
public static DataTable ExecuteSelectProcedureDataTable(string procedureName);

To preserve the kind of reuse you're attempting, you can have ExecuteSelectProcedureDataTable call ExecuteSelectProcedureSqlDataReader internally.

ddanbe commented: Great! +15
gusano79 247 Posting Shark

You're writing a class that implements an interface:

public class EWrapperImpl : EWrapper

This means your EWrapperImpl class must have methods that match everything in EWrapper...

Error: TestCsharp.EWrapperImpl' does not implement interface member 'IBApi.EWrapper.currentTime(long)

...but it doesn't, so...

you need to provide at least an empty shell of the method declared in EWrapper but I don't know how to do this. I wonder if it is a basic delaration that can be done in EWrapper ?

Implementing an interface is a way of saying, "My class has these methods."

EWrapperImpl needs to have a method called currentTime that matches the declaration in EWrapper; i.e., it has the same parameter and return types.

tobyITguy commented: supported. +3
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

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

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

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

We won't do your work for you... have you tried doing this yourself yet? Post some code with a specific question or problem, and we'll help you with that.

gusano79 247 Posting Shark

Try to do this yourself, and post code with specific questions if you have a problem.

gusano79 247 Posting Shark

What do you mean by "effective"?

gusano79 247 Posting Shark
Santanu.Das commented: Great Resource +5
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

We aren't going to do your homework for you. Try doing it yourself, post what you've written, and we'll be happy to point you in the right direction or answer specific questions.

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

What have you written so far? Is there a specific part of the task you're having trouble with?

Hadi.M commented: No actually I have a problem with the entire idea. How do I approach this one? +0
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

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

So, there's no way to do anything about user messing up the code using "false" delimiter? I thought someone invented solution for this

If you're talking about delimiter collision, this is a well-known problem that isn't language- or platform-specific. There are various ways you can reduce that risk, and they can be effective if you have some control over user input.

As there's something like mysqli_real_escape_string(); which prevent user to do SQL-injection by doing delimiters.

There are some string-escaping functions in the .NET Framework library, but they're aimed at specific situations like URL encoding. There isn't anything for delimited text files, probably because there is no consistently-used standard for formatting them.

It should be straightforward enough to write your own using one of the solutions I linked above. A common approach for CSV is to quote fields that contain embedded commas, and use two quote characters for embedded quote characters. This can get a little interesting to parse.

gusano79 247 Posting Shark

does StreamReader or any other IO in C# (in Visual Studio) treat \xFFFD as ONE character, or actually 6?

Only one character, but many possible encodings.

When in .NET-land, as opposed to C/C++-land et al., there's only one type of string, which is a sequential collection of UTF-16 encoded characters. That's all you get.

But of course data are typically stored and transmitted as sequences of bytes, so you have various implementations of the Encoding class to convert from bytes to text and back again.

What if user says "I'm gonna troll you so badly let's say \xFFFD", it will be there in data?

If a user manages to get it entered, sure. It'll be there.

But if you're going to delimit text with text, you'll always have the "what if I get a delimiter embedded in content" problem. This has been a fact of life for a long time: C strings can't have embedded zeros because they use it to mark the end of the text.

When \xFFFD is written into file, is it treated as string of 6 characters or actually one character that is unreadable to users?

That depends on which encoding scheme you use. With the .NET I/O library, you always have the option to specify the encoding, although there are some defaults so you don't have to when it's not needed.

Examples:
* ASCIIEncoding will write one byte, but it won't be …

gusano79 247 Posting Shark

Is there a character, that can be written/read by system (C#/.NET), but can't be written by any standard keyboard

Strings in .NET are Unicode, so you have plenty of options. Something like '\xFFFD' ("Replacement Character") might be the closest to what you're looking for. But that seems overkill; you're probably safe using tabs.

Is x00 exploit possible with this?

No. .NET strings can have embedded zeros. You won't be using '\0' to detect the end of the string; the runtime manages finding it for you.

Further reading: Strings (C# Programming Guide)

RikTelner commented: Thanks for the "character". +2
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

It looks like you're missing a finally before the block that closes the connection.

ChrisHunter commented: Spot on +7
gusano79 247 Posting Shark

If you go with PHP, you can perform XPath queries on your data.

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

Let's look at reversed() real quick here...

if(!this.isEmpty()){
    return this;
}

"If I'm not empty, just return myself"--probably not what you meant.

Seems like it should be the other way around: "If I'm empty, return myself." But that's problematic too... it's a reference to the same object, which again I don't think you mean. I'd pass a new empty stack.

while(this.isEmpty())

"Only build the stack if I'm empty"--also probably not what you meant.

return this;

Wait, it looks like you're building that and then ignoring it completely. That can't be right. You must have meant to return that, right?

that.push(pop());

Combined with the above, this is why you're getting an empty stack. The call to pop() is emptying out the current stack, and then you're returning it.

So:

First, fix up how you're building that and return it, not the original object.

Second, figure out how to actually copy the contents of this without actually removing them. You should be able to follow the nodes directly, starting with upnode, and push them until there aren't any left.

gusano79 247 Posting Shark

MD5 and SHA-256 are hash functions, not encryption algorithms. They only work one way, which is why you aren't finding anything else; that they are non-reversible is quite intentional.

Is this for something specific you're trying to accomplish, or are you just exploring security concepts?

gusano79 247 Posting Shark

Definitely keep the lexer/parser concept; it makes things much easier to deal with.

You'll see lost of people online recommending that you write a recursive descent parser or use a parser generator, both of which are fine if you want to learn about them.

My preferred approach to parsing algebraic expressions is the shunting-yard algorithm. It's powerful enough to deal with any expression you want (including functions and operator precedence), and it's not hard to extend (new functions or operators, variable substitution) if you're smart about the implementation. But it's also not overwhelmingly general-purpose, so you can focus on the algebra.

ddanbe commented: Thanks for the tip +14
gusano79 247 Posting Shark

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.

gusano79 247 Posting Shark

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.

gusano79 247 Posting Shark

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?

gusano79 247 Posting Shark

Your client doesn't need a system that has a particular design; your client needs a system that solves some problem of theirs. Your role as a software engineer is to determine the design, which may be layered if you think it's appropriate.

So... if you think you need those three specific layers and WordPress doesn't have all of them, then WordPress isn't an appropriate solution.

Does your client have a system need that requires a service layer, or are they just asking for one directly?

gusano79 247 Posting Shark

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.

gusano79 247 Posting Shark

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.

gusano79 247 Posting Shark

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 :)

gusano79 247 Posting Shark

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

gusano79 247 Posting Shark

Let's see if we can just build it with C::B; that seems simplest to me.

  1. Create a new project. Use the empty project template.
  2. Go to project properties, build targets tab.
  3. Change type to static or dynamic library (do for both Debug and Release)
  4. Open g2.dsp in a text editor
  5. Go to the end, where there are a bunch of lines starting with "SOURCE="
  6. Add all of these files to your C::B project
  7. Try to build the project; it won't work.

Fixing the errors partly depends on what you need from g2:

  • Do you want a static or dynamic library?
  • Do you want GD support (PNG and JPEG)?
gusano79 247 Posting Shark

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?

gusano79 247 Posting Shark

I can successfuly insert data but when I close the app the data is not save

What code do you have that you think will save data for you?

Is this a WinForms application? If so, you might want to look at the FormClosing event.

gusano79 247 Posting Shark

What does "not coming out" mean? What gets shown for averagegrade?

averagegrade = (exam1 + exam2+ exam3 + final) / 4;

All of exam1, exam2, exam3, final, and 4 are integer values... so the compiler does integer division. For floating point arithmetic, at least one of the operands needs to be a floating point value... try this:

averagegrade = (exam1 + exam2+ exam3 + final) / 4.0;
gusano79 247 Posting Shark

To start with, you'll need a good idea of what a solution to the scheduling problem might look like. Do you have more requirements than "develop a smart scheduling system" for this project?

Once you know the basic "shape" of a solution, the important things to determine are

  1. how to evaluate the effectiveness of a given solution (i.e., fitness function), and

  2. how to encode a scheduling solution into "DNA" (i.e., genetic representation).

It's essential to get these two things right (or close enough) for a genetic algorithm to work well.