|
use the watch window to see what is in valid - or the locals window
Weight loss Target
Weight at start [1/Feb/2009] 127kg
Weight now [31/Jul/2009] 107.7kg
Target weight : 80kg
Only 28 TO go hope to be there by March Wish me luck!
|
|
|
|
|
try double.Parse("1241771674");
|
|
|
|
|
im still getting the same error as posted :S
|
|
|
|
|
Try adding code to catch the error and show you the string that caused it, so you can confirm that it's not a number. It plainly is not a number, it must have some extra characters in it that are causing it to break.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
thanks alot!
you just reminding me of something that fixed it
thanks
|
|
|
|
|
Please can you share what fixed it?
Weight loss Target
Weight at start [1/Feb/2009] 127kg
Weight now [31/Jul/2009] 107.7kg
Target weight : 80kg
Only 28 TO go hope to be there by March Wish me luck!
|
|
|
|
|
Hi,
there are two parts to the "problem", one is you get a string and need a number, two is you need to convert that number to a DateTime.
A Unix timestamp is the number of seconds since 01-JAN-1970, hence:
string unixStampString="1241771674";
int unixStamp;
if (int.TryParse(unixStampString, out unixStamp)) {
DateTime dt=new DateTime(1970, 1, 1).AddSeconds(unixStamp);
Console.WriteLine(dt.ToString());
} else {
Console.WriteLine("Input error");
}
Now the silly thing is the result is 08-MAY-2009, hardly today.
You can check that here.[^]
To get today, your UNIX timestamp should be close to 1249489460
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
In my applcn client first connects to server then client disconnects but the server should wait again to accept new connection.
wht is the code to do this.
can anyone help me .............
This code was posted by me...
|
|
|
|
|
Well, your code was listening, so I guess it needs to listen for a connection again
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
how do i make server listen for new connection again
This code was posted by me...
|
|
|
|
|
There are lots of ways.
You could use a
While(true)
{
Your server code goes here;
}
When the server closes the connection and finishes it will start over and be ready
to accept a new connection
|
|
|
|
|
I'm trying to convert an uint value to int, but it always raise overflow exception as it should. Actually, I'm hashing the url and saving an int value in SQL, since the hashed value is in uint and SQL do not support uint in DB so I've to convert it to int. Using bigint is also a way to go but space does matter in there. So I'm just wondering that is there any way to do that...?
Edited :
Okay, I got an idea...
uint ToUInt(int value)
{
return value < 0 ? (uint)(int.MaxValue - value) : (uint)value;
}
int ToInt(uint value)
{
return value > int.MaxValue ? (int)(int.MaxValue - value) : (int)value;
}
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
modified on Wednesday, August 5, 2009 5:55 AM
|
|
|
|
|
how about
uint u;
return unchecked((int)u);
or
int i;
return unchecked((uint)i);
??
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
cool
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
HOW DO I PASS ARRAYS TO METHODS?
|
|
|
|
|
Hi,
you mean like this:
public void MyCaller() {
string[] aMyArray = ...
this.MyMethod(aMyArray);
}
public void MyMethod(string[] aArray) {
...
}
Does this help?
Regards
Sebastian
P.S.: By the way, I would suggest using a List or sth. similar, because these offer much more functions...
|
|
|
|
|
an array is an object, hence just like any other object.
String.Join() is an example.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
"7. Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job."
public void MyMethod(int[] myArray)
{
...
}
|
|
|
|
|
Hi all,
I have found this some unusual problem while working on the debug and release build. I have two forms MainForm and ModelForm. Following is the code for these respective forms .cs files
Code for MainForm.cs :
namespace ModelDialogExceptions
{
public partial class MainForm : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
try
{
ModelDialog mdl = new ModelDialog();
mdl.ShowDialog();
}
catch (Exception exc)
{
MessageBox.Show("Exception captured!!!");
}
}
}
}
And code for ModelForm.cs :
namespace ModelDialogExceptions
{
public partial class ModelDialog : Form
{
public ModelDialog()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
throw new System.IO.FileNotFoundException("");
}
}
}
If I run this project in debug build, message box gets poped up however, in the Release (when i run output .exe in) build an unhandeled exception is raised.
Any body know, why this code is behaving differently for different builds?
or any comments about this!!
|
|
|
|
|
You can add a top level exception handler, which will catch exceptions from other threads. Why you have this difference, I don't know.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I guess top level exception handler wont be useful as application is going to shut down anyway!!
it will be just more or less equals to saying "good bye"!!
some additional info:
actually this difference is not related to debug or release(sorry for previous info- i just got this difference)
instead it is in between output .exe (both in debug and release) and visual studio code,when i run from the visusal studio i gets the message box
|
|
|
|
|
1. debug and release EXE files are stored in different folders
2. your "current directory" initially is set to the folder containing the EXE
3. you forgot to copy the file your app wants from your debug folder to your release folder, so the debug version finds it, the release version does not.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
I don't read his code that he's looking for any file at all, he's just playing with exceptions. But, if he failed to post most of his code, then you're probably right. A try/catch that then throws a FileNotFoundException is a bit retarded, tho
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
no guys!
i am not at all playing with files!
that was just for demonstration
instead of throwing FileNotFoundException I can throw any Exception
|
|
|
|
|
That's what I thought
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|