Adding
comboBox1.DisplayMember = "Name";
comboBox1.ValueMember = "Filter";
should show what you want to see, then later you should be able to
Directory.GetFiles(comboBox1.SelectedValue);
(or something similar) later.
Adding
comboBox1.DisplayMember = "Name";
comboBox1.ValueMember = "Filter";
should show what you want to see, then later you should be able to
Directory.GetFiles(comboBox1.SelectedValue);
(or something similar) later.
According to some quick google searches (google makes me look so smart!) in "ECMA-334: 14.2.2 Operator overloading" there is a line that reads "User-defined operator declarations cannot modify the syntax, precedence, or associativity of an operator." So, if I understand that correctly (I'm not done with my Red Bull, so anyone out there with knowledge please reply) you can't change the precedence of operators. For a fun test, derive a class from Integer and overload * and + by swapping them (make * actually add, and + multiply), then try to solve
MyInteger two = 2, three = 3, four = 4; MyInteger X = two * three + four;
Are you having problems figuring out what the text is, or actually getting it into the DB? How far have you gotten so far? If you can post a sample of your code and where you think it's breaking (and what you have already attempted) we can help better.
sknake has a point (and no, he doesn't pay me to agree with him), calling .Replace() will fix this problem for now, but what you really want to do is understand why it's happening in the first place, or else your program will have a million Replace() commands. My money is on the data stored as char instead of varchar in the DB.
I doubt this is the problem, but you might want to be careful with this line:
string strSQL = "INSERT INTO memberinfo " + "(memberid,memberSname,memberFname, fileName)" + "VALUES( '" + txtmid.Text + "','" + txtmSname.Text + "','" + txtFname.Text + "', '" + file +"')";
If any of those text boxes have an apostrophe in there, the insert will break. I suggest using
OleDbCommand cmd = new OleDbCommand(...);
cmd.Parameters.AddWithValue(...)
(or OdbcCommand, I forget which is for MS Access) to prevent any kind of query hacking shenanigans.
Does this work?
cout<<strupr(s[0]).substring(0,1);
Try
// call the function
cout << "Your number doubled is: " << number->doubleNumber(input) << endl;
My C++ is a little rusty, and FBody said (but might have got lost in there) is you probably meant to write this:
if (type=="algebra")
The string you are comparing it to needs to be in quotes, and "==" means "equals" and "=" means "assignment". IIRC
if (type="algebra")
would always return true (unless you set something = 0 ... maybe.)
do you need a space between "-options" and the email address? Like:
system(("sendmail -options " + EMAIL_TEXT));
What type of exception is it? What does the message of the Exception read?
The column in your database that holds the filename might be a char data type column (or wchar, etc), if you change it to varchar (or nvarchar, etc) then it will let you use variable length strings and not give you all those extra zeros.
The other choice (off the top of my head) is to change line 29 to this:
String path = ("d:\\Pictures\\" + img.Trim() + ".jpg");
Edit: (for some reason I think the char data type pads with spaces, not zeros, so the column data type couple be wrong. Also, I forget if Trim() removes zeros like this, you might need to call
img.Trim(new char[] {'\0'})
instead which specifically removes the zeros ... I think
Oh, yeah, sorry we derailed your original request about creating a peer 2 peer chat program. What you want to do is do a search for normal client/server communications and let your chat program do both.
System.Net.Sockets.Socket is a good class to start, and you will probably base your "server" aspect on the BeginAccept() function, and your client aspect on the Connect() and Send() functions.
Create a serializable class that has at least a "Command" and "Data" member, and send instances of that object back and forth between each other. Sample commands are "Connect", "Disconnect", "Chat", and "RequestForOtherPeerIpAddresses" and "HereIsAListOfOtherPeers" (you might want to shorten those last two.) The "Data" would hold things like my display name for the "Connect" request, "dude, we should hang out!" for "Chat", etc.
Good luck!
sknake is correct that you can define peer-to-peer both ways, connectionless and connected.
Connectionless P2P
SNMP is a popular connectionless protocol, it is used by a lot of servers and network service boxes (routers, printers, etc) to broadcast their statuses, errors, etc for others on the network to hear. These have no idea if anyone is listening to them or not, and they keep merrily broadcasting away anyway. However, like DiamondDrake mentioned, packets without a specific destination are never going to make it to the Internet. Can you imagine the traffic if every message sent by every device had to reach every other device on the net? This is how Code Red and other worms shut down the internet. Thus, UDP would be a great solution for creating a p2p chat program that never leaves your local lan.
Traditional Client/Server
In a traditional client-server, each client connects to a central server in order to do anything. World of Warcraft is a good example of this. The only connection the client ever makes is to the server. Even if it seems like you are talking directly to someone else, your chats first go to a server, then get forwarded to your buddy. If the server goes down, everyone gets disconnected and all activity stops. Except for the people who keep clicking "logon" waiting for the server to come back. We aren't talking about c/s here, but it helps explain what makes p2p be p2p.
Common P2P
This is the best thread ever. You guys are so helpful! BTW, can you help me? I am having trouble writing a new operating system that works on desktops, cell phones, watches, the internet and ATM machines. It needs multimedia and social networking, and run Windows, Mac and Linux apps side-by-side. This is what I have so far:
#include <iostream.h>
#include <windows.h>
int main(){
cout << "Hello World.";
}
My problem is the clock keeps blinking "12:00"
Thanks!