|
Signature updated!
DaveIf this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier.
Please take your VB.NET out of our nice case sensitive forum.(Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
Like it.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
hi everyone,
I have done single client-server application using c#. Now i have to made that application for multiple clients. kindly guide me.
Regards
|
|
|
|
|
Is they always seem to call at the same time demanding an on site visit Friday at 4:30pm.
If you have implemented a "single" client-server application the multiple client application should work with no changes. There is no difference. Ahem, there should be no difference. When a TCP connection is established from the Listening port he OS assigns it a temporary high number port so the listener can continue to listen. No work should need to be done. The only other issue is if your command processing does not support the ability to distinguish different requests from different clients but again that is such a large area.
|
|
|
|
|
hi, I've been looking for a way to send a listview from server to client over tcp. I managed to serialize the listview but stuck on sending it through network.Below is the piece of code I could manage to write and still I don't know what to do how to receive that listview. Any help is appreciated
MemoryStream ms = new MemoryStream();
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(ms, lst);
byte[] byt = new byte[1024];
byt = ms.ToArray();
streamWrite.Write(byt);
|
|
|
|
|
You can't serialize a listview control, you can serialize the contents of the control however.
What research have you done on TCP connections? Do you understand you need to open a channel between the client and server?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Here is what I have, I can currently send strings to client with streamWrite() method but don't know what method used to send for serialized objects
public void sendSerialized()
{
IPHost = Dns.GetHostEntry(Dns.GetHostName());
TcpListener tcpListener = new TcpListener(IPHost.AddressList[0], 8080);
tcpListener.Start();
while (true)
{
Socket handlerSocket = tcpListener.AcceptSocket();
if (handlerSocket.Connected)
{
ntrStream = new NetworkStream(handlerSocket);
streamWrite = new StreamWriter(ntrStream);
ListView lst = new ListView();
MemoryStream ms = new MemoryStream();
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(ms, lst);
byte[] byt = new byte[1024];
byt = ms.ToArray();
streamWrite.Write(byt);
}
}
}
modified on Thursday, July 1, 2010 2:28 PM
|
|
|
|
|
Hi,
I am new to regular expressions, I am having a problem regarding matching a specific keyword in certain condition.
string regexstring="\\bhtml\\b|[.]net\\b";
Regex rgx = new Regex(regexstring, RegexOptions.IgnoreCase);
MatchCollection matcol = null;
string st_data = "I am a .net developer, but also know about asp.net, vb.net ; I work on c#/asp.net platform. I also know dhtml, html4.0, html/xml etc etc.";
st_data = System.Web.HttpUtility.HtmlDecode(Regex.Replace(st_data, @"<(.|\n)*?>", string.Empty));
matcol = rgx.Matches(st_data);
foreach (Match mat in matcol)
{
}
I tried various variations but of no use.
I want to match html4.0 but some how I need only html out of it.kind of substringed match.
I hope You understand my point.
Please help
any help shall be appreciated.
Thanks
Shankbond
|
|
|
|
|
I'm not sure exactly what you are trying to do, but have a look at match-but-don't-capture groups ( ?: )
Or, explain exactly what you want to achieve and I'll have a look.
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
Hi,
I tried looking this stuff, but may be I did something wrong with match-don't capture.
1) I want the regex to match --> html56 but capture only html also
2) match 45html but capture only html,
3) and don't match or capture at all abchtmldef (not surrounded by alphabets one word only)
4) match html
I used \b(?:\d*)html(?:\d*)\b
It would be nice if someone can help.
Thanks
Shankbond
|
|
|
|
|
The match to do that is quite simple:(?:\d|\s)(?<data>html)(?:\d|\s)
Find (but do not capture) either a digit or a whitespace,
Find and capture in a group called data the four characters 'h', 't', 'm', 'l' in that order,
Find (but do not capture) either a digit or a whitespace.
But I doubt that will solve your problem!
What are you trying to achieve? It looks as if you are trying to process a CV and extract all the relevant job skills without manually looking at it. If so, then you may need to be a bit more clever / thorough about it, particularly with a trigger word such as "html" which appears in every web page...
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
OriginalGriff wrote: particularly with a trigger word such as "html" which appears in every web page...
Yes You are absolutly right. I did that with the help of a javascript.
Thanks
Shankbond
|
|
|
|
|
Just to add to what I said, go and get a copy of Expresso - it examines and generates Regular expressions.
Expresso[^] It's free, and really can help create and understand complicated expressions. You can also feed it a sample file that you want to examine and it will show you what the Regex will capture.
I wish I'd written it!
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
Thanks but I already have one ,
my query is solved now I got the solution by using
(?<=\\d+(\\.\\d*)?|\\b)html(?=\\d+(\\.\\d*)?|\\b)
but I am having a new query now?
(?:.....) is also a non capturing group so I can theoretically use it in place of look ahead and look behind but that does not work here?
any solutions?
Thanks
Shankbond
|
|
|
|
|
can someone really explain that; I am curious about it.
Thanks
Shankbond
|
|
|
|
|
First of all, I know this question is only partially relevant to C#, so sorry for posting it here.
I am trying to implement Facebook single sign on using a desktop application. The one thing I figured out so far is to retrieve an access token.
How I retrieve the access token:
browserFacebook.Navigate(@"https://graph.facebook.com/oauth/authorize?client_id="+ FacebookApplicationID + "&redirect_uri=http://www.facebook.com/connect/login_success.html&type=user_agent&display=popup");
This redirects the user to page where he/she must first authorize the application. Once authorized, I redirect the user to "http://www.facebook.com/connect/login_success.html" as specified in the above address. I then intercept this URL to retrieve the access token like so:
string someString = browserFacebook.Url.ToString();
This returns something like the following:
"http://www.facebook.com/connect/login_success.html#access_token=ACCESS TOKEN.expires_in=0"
I can then easily use this access token with the Graph API to access an users facebook details as in the following code:
Facebook.FacebookGraphAPI g = new FacebookGraphAPI("ACCESS_TOKEN");
var fbUser = g.GetObject("me", null);
Can I also use this token somehow to simply log a user in to the site? My goal is not really to develop a complete new facebook application as my application is simply a prototype.
|
|
|
|
|
Good Morning,
I feel like Dr Frankenstein; I created this monster and now I cannot shut it off! Case in point. My application begins with a Splash screen that retrieves information (Connections Strings, Permissions) and sets a switch in a remote database that defines the users status as active. I hide this page when I advance to the next page (The Main Page). Now, I try to shut it down. I call a method from the Form_Closing event so that I can reset the users status as inactive and I use Application.Exit() as the closing command. BUT....my back trace shows that the script re runs the Splash page and turns the switch in the remote database back to active again before it closes. NOW.... when the user goes to log back on again, the system denies him access with the response that he is already active. In essence, the function of the code is to discourage a hacked application from being able to open if the original application is already active. It's a just in case scenario. SO...what to do? Thanks, Pat
<br />
private void frmMain_FormClosing(object sender, FormClosingEventArgs e)<br />
{<br />
if (alreadyClosing)<br />
{<br />
return;<br />
}<br />
<br />
if (richTextResult.Text != string.Empty)<br />
{<br />
DialogResult answer;<br />
string message1 = "Are you sure you want to exit the program? " +<br />
"\n\nThe information in your Result box will be lost!";<br />
answer = MessageBox.Show(message1, "Exit?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);<br />
if (answer == DialogResult.No)<br />
{<br />
e.Cancel = true; <br />
return;<br />
}<br />
else<br />
{<br />
ResetDatabaseActivity();<br />
alreadyClosing = true;<br />
Application.Exit();<br />
}<br />
}<br />
|
|
|
|
|
private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
{
if (richTextResult.Text != string.Empty)
{
DialogResult answer;
string message1 = "Are you sure you want to exit the program? " +
"\n\nThe information in your Result box will be lost!";
answer = MessageBox.Show(message1, "Exit?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (answer == DialogResult.No)
{
e.Cancel = true;
}
else
{
ResetDatabaseActivity();
Application.Exit();
}
}
}
I know nothing , I know nothing ...
|
|
|
|
|
Hello Stark,
Thank you for your reply. No, unfortunately, the alreadyClosing bool is required. When the application closes, if it is not in place, it trys to run this code twice. This switch is just a stop measure. It's not a big issue, but it takes 2 clicks to close the question box. That is the only reason that it is there. However, I just realized that Application.Exit() call is not required at all, since it is already staring to close before the call. Sometimes (Pat) cannot see the forest through the trees. I removed it and the problem has been solved. Thank you for your thoughts and input. I appreciate it. Best Regards, Pat
|
|
|
|
|
Hi!!
i'm back to disturb u again...
This time i wanna know y cant i use System.windows in a console program..
wheneva i type this it shows error.. that it doesn't exists.. but when i choose window application. i uses it...
help me out..i need to use it...
|
|
|
|
|
You need to add it as a reference. By default, it doesn't get added to console applications. Why would it? They aren't responsible for drawing windows after all.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
how???
i m working on keyloggers... so need to write a console program for it...
thats y...
i'm using System.Windows.Forms.Keys... but cant use it...
as mentioned...
|
|
|
|
|
In your solution explorer, right-click References (looks like a folder), Add Reference. Then find the one you need.
I will advise you that using keyloggers maliciously (such as to spy on someone, steal passwords etc) is ill-advised, and probably illegal.
|
|
|
|
|
A console application does not include Windows by default. You need to add it to the References section of your project in order to use it. However, if you are developing an application that needs Windows why would you start with a console app?
It's time for a new signature.
|
|
|
|
|
sir, thats m asking.. how shud i... actually i'm new to VS2008 and C#.. thats y stuck here...
|
|
|
|