|
Google actually
|
|
|
|
|
I'm so glad that that word has become a verb. The world would be full of stupid people if there was no google
|
|
|
|
|
Hi!
I just created a simple server that prints messages received from the client to console(the server
listens to port 5000).
My problem is this(and I'm not sure if I posted this to the right forum):
When I start the server and try connecting to it from another computer the remote computer
declines the connection and I get a System.Net.Sockets.SocketException-exception.
I have disabled all firewalls(Windows firewall) from the remote computer but I still
keep getting the same exception. I have also tried different port-numbers without success.
Any thoughts, solutions and suggestions are very much appreciated.
-K-
--------------------
Brian: You have to be different!
Crowd: Yes! We are all different!
Small lonely voice: I'm not!
|
|
|
|
|
What IP address are you listening on the server side?
If you listen on 127.0.0.1(localhost) you won't be able to connect from remote computer,
but will successfully connect from the same machine.
Vitaliy
|
|
|
|
|
Oh, yeah! That was it!
Thank you very much!
-K-
|
|
|
|
|
Hi, there are two functions below that do the same thing.
And the question is which one of them is more readable? Which one would you prefere? And why?
Thanks in advance,
Vitaliy
version 1:
__________________________________
<code>
private ContentParameterDetail GetParameterFromProfile(ContentParameterX prm, SubscriptionScenario scenario)
{
string profileKey = scenario.TimeoutMode ? prm.GetFromProfileTimeout : prm.GetFromProfile;
if (string.IsNullOrEmpty(profileKey))
{
return null;
}
string parameterValue = scenario.IPHelper.Profile[profileKey];
if (string.IsNullOrEmpty(parameterValue))
{
return null;
}
ContentParameter parameter = _entity.ContentConfig.GetParameter(prm.ParameterID);
ContentParameterDetail pd = parameter.GetDetailbySPGWCode(parameterValue);
return pd;
}
</code>
version 2:
__________________________________
<code>
private ContentParameterDetail GetParameterFromProfile(ContentParameterX prm, SubscriptionScenario scenario)
{
ContentParameterDetail pd = null;
string profileKey = scenario.TimeoutMode ? prm.GetFromProfileTimeout : prm.GetFromProfile;
if(!string.IsNullOrEmpty(profileKey))
{
string parameterValue = scenario.IPHelper.Profile[profileKey];
if (!string.IsNullOrEmpty(parameterValue))
{
ContentParameter parameter = _entity.ContentConfig.GetParameter(prm.ParameterID);
pd = parameter.GetDetailbySPGWCode(parameterValue);
}
}
return pd;
}
</code>
|
|
|
|
|
I prefer version 1 cause there it's perfectly clear that null gets returned if string.IsNullOrEmpty is true. In version 2 I have to take a look at the whole method to see that pd isn't changed anywhere and therefor null will be returned.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Yes, good point. I just wonder if those multiple return statements are bad. Otherwise I defenitely go with version 1.
Vitaliy
|
|
|
|
|
Vitaliy Tsvayer wrote: if those multiple return statements are bad
This is a controversial topic and you can find many comments on this when googling for "multiple returns" e.g. this one[^] by Bruce Eckel.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
I would go with version 1...
You can actually see when it returns null, in version 2 you really have to read all the code to know when it returns null...
Don't you also love the code?
|
|
|
|
|
Yes, Stefan in above reply also pointed that out.
OK, I go with version 1.
I LOVE THE CODE!
Vitaliy
|
|
|
|
|
Hello,
I have XML file, I can read and write data on it but there is a problem when i add data cause it overwrites the previuos inserted ones.
I need a code of insterting new data over the existing ones without updating i need to insert new values without the change on the previuos ones.
Thanks alot
Hamody
|
|
|
|
|
You can not add values to an XML file. Load the XML file to an XmlDocument object, add the items to the document, and save the document back to the file.
---
b { font-weight: normal; }
|
|
|
|
|
I am trying to derive bytes from a pass phrase. The latest MSDN doc
indicated that the PasswordDerivedBytes.GetBytes method is obsolete. This
leads me to the CryptDeriveKey method. I can get it to work just fine with the following:
algName = "TripleDES"
algHashName = "SHA1"
keySize=192
rbgIV. Length =8
[this produces byte[] length = 24 {192 bits}]
Now. I want to create a 256 bit byte[] for use with Rijndael.
Unfortunatelty, I do not know the "correct" parameter values. I thought:
algName = "RijndaelManaged"
algHashName = "SHA256"
keySize=256
rbgIV.Length = 16
I can not get it to work. I keep getting the following exception:
System.Security.Cryptography.CryptographicExceptio n was unhandled
Message="Object identifier (OID) is unknown."
Source="mscorlib"
Q1. What are the valid values for the algName ?
Q2. Can any hash be used for any algnName?
Thanks for you help.
|
|
|
|
|
Dear Sir,
I am working on a ASP.NET application, where i am using OLEdbConnection to connect to the Access 2003.
My objective of writing this code is to be able to change the existing password
Here :
T_EMP_PERSONAL is the table name
change_pwd.Text and pwd_txt.Text are the textboxes
Following is the code
private void ImageButton1_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
try
{
string qry;
qry="Update T_EMP_PERSONAL set PASSWORD='"+change_pwd.Text+"' where PASSWORD='"+pwd_txt.Text+"'";
Label1.Text=qry;
con.Open();
OleDbCommand cmd=new OleDbCommand(qry,con);
cmd.ExecuteNonQuery();
Response.Write("Done");
con.Close();
}
catch(Exception ex)
{
Response.Write(ex.Message);
}
OUTPUT
Syntax error in Update statement.
Where as, when i tried the same query in Sql server 2003 it executes succesfully
so could u pl help me out with this
thanks 4 ur kind support
arun
|
|
|
|
|
Arun Hegde wrote: when i tried the same query in Sql server 2003
How about running it in Access 2003? Perhaps Access would provide some information that would help determine the problem.
led mike
|
|
|
|
|
Hi,
Dear Respected Programmers.
kindly let me know that, How can I add Crystal Reports DesigntTime Designer into C# 2005 ?
Thank you in Advance
|
|
|
|
|
hi all...
is there any way by which i can get the print screen of a particular form and print it using c#.net...
Thanks in advance...
Rohit
|
|
|
|
|
|
Hi there,
VERY beginners question I'm sure, but how do I find out which drive letter my program was called from?
I'm writing an autorun program for a CD which just displays a simple form with my company logo and details about the CD and what it was anti-virus scanned with. When the user presses the "okay" button I'd like to automatically run explorer.exe with the right folder open for the CD.
Can someone give me a clue?
Thanks in advance!
Gary
|
|
|
|
|
Path.GetPathRoot(Application.StartupPath) should do the job.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Application.ExecutablePath
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi,
I want to show the chinese and janpanese character on the the windows form .
When I type any chinese or janpanese character from the arialuni.ttf font ,I get the "?' rather than acutal character.
Any help in this regard would be highly appreciated.
Thanks
|
|
|
|
|
Hi,
Dear Respected Programmers.
Kindly help me. I am using C#. whenever I try to insert a datevalue into Access database, "Datevalue Example 05/08/2006" why it inserts like this ==> "08/05/2006"
Please send me the solutions
Thank you in advance
|
|
|
|
|
Because the database interprets "05/08/2006" as the 8th of may rather than the 5th of august (or vice versa).
Use a parameterized query, then you don't have to try to match the date format with the format that the database is using.
---
b { font-weight: normal; }
|
|
|
|