|
MSManager MGR = new SMSManager();
string num = MGR.abc;
MessageBox.Show("RECEIRE" +num);
string num = MGR.abc; before you can do this you need to call MGR.testMethod which actually does abc = RPN;
Alternatively
You can set the abc in a constructor.
Regards,
Karmendra
|
|
|
|
|
i call the MGR.testMethod in the button event in another form as:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public void sampleArray()
{
}
private void button1_Click(object sender, EventArgs e)
{
SMSManager sm = new SMSManager();
sm.testMethod("82083427", "1122887779", "testmessagetxt");
}
}
how can i retreive the value then??
|
|
|
|
|
Think you need to re-visit OOPS concepts.
In button click event you have created another object sm and you have set sm.abc by running testMethod.
and you have never run SMSMdm.testMethod to set SMSMdm.abc, it wil give error also because you have never initialized SMSMdm.abc.
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
SMSManager <big>sm</big> = new SMSManager();
}
public void sampleArray()
{
}
private void button1_Click(object sender, EventArgs e)
{
sm.testMethod("82083427", "1122887779", "testmessagetxt");
}
}
class SMSManager
{
public string abc="";
public void testMethod(string MPN, string RPN, string text)
{
SMSModem SMSMdm = new SMSModem();
MessageBox.Show("RPN" + RPN);
abc = RPN;
int x = myArray.Length / 5;
for (int i = 0; i < x; i++)
{
string a = myArray[i, 0];
if (a == MPN)
{
MessageBox.Show("MODEM NUMBER :"+MPN);
SMSModem SMSM = new SMSModem();
SMSM.SendSms();
}
}
}
class SMSModem
{
public bool SendSms()
{
try
{
string num = <big>sm</big>.abc;
MessageBox.Show("RECEIRE" +num);
serialPort1.WriteLine("AT+CMGF=1;+CSCA=\"+6598540020\";+CMGS=\"+65" + num + "\"\r\n");
System.Threading.Thread.Sleep(40);
serialPort1.Write("Test message from coded program");
char[] arr = new char[1];
arr[0] = (char)26;
serialPort1.Write(arr, 0, 1);
System.Threading.Thread.Sleep(3000);
string data = serialPort1.ReadExisting();
MessageBox.Show(data);
if (data.IndexOf("OK") != -1)
{
return true;
}
else
{
return false;
}
}
catch
{
return false;
}
}
}
Remember all these should be in same namespace.
Regards,
Karmendra
|
|
|
|
|
Aghosh Babu wrote: abc = RPN; //this isnt wrking
What do you mean it did not work? It is just a simple assign-op. Maybe you can debug it.
Aghosh Babu wrote: string num = MGR.abc; //This is not retreiving the value!//I WANT THAT VALUE TO BE CALLED HERE AND ASSIGN IT TO "num"
According to the cdoe, the value should be null.
I Love KongFu~
|
|
|
|
|
Hi,
I have created a login in my winform application, i encrypt the password and store in a xml file.
I am worried about if the user deletes the xml file, he can crack into the system.
can you please suggest me how to make sure user cannot delete the xml file.
I tried embedding the xml file but, if i do that authorized users will not be able to change password and update the xml.
Please help
Thanks for your time and knowledge,
Karmendra
|
|
|
|
|
KSuthar wrote: if the user deletes the xml file, he can crack into the system.
Why? If the application can not validate the password by using your xml file, in other words, the validation fails. In this case, the app should not let the user login. Hence, it should not be the problem at all.
I Love KongFu~
|
|
|
|
|
And if the user deletes the xml file by going to the physical location of the file. what shall I do in such case. as of now my program recreates the xml with default password.
|
|
|
|
|
KSuthar wrote: And if the user deletes the xml file by going to the physical location of the file. what shall I do in such case. as of now my program recreates the xml with default password.
That's entirely up to you and your app specifications how it should respond. Recreating with a default password seems reasonable, IF it doesn't compromise the secruity of your data.
Oh! You can't stop someone from deleting the file...
|
|
|
|
|
KSuthar wrote: what shall I do in such case.
If the user has the administration authority, I do not think we can stop him/her to delete the file. Maybe you can design you app logic again for validating password.
KSuthar wrote: as of now my program recreates the xml with default password.
Is it safe enough for you? If yes, go ahead.
I Love KongFu~
|
|
|
|
|
Hello everyone,
Here is my code at both client side and server side. My code is simple, just upload a file to an ASP.Net web site.
My client code throws exception when it works on Vista (x64, Enterprise, SP1), but works fine on Windows Server 2003.
Any ideas?
10.10.12.162 is my server address.
Client:
static void Main(string[] args)
{
Console.Write("\nPlease enter the URI to post data to : ");
String uriString = Console.ReadLine();
WebClient myWebClient = new WebClient();
Console.WriteLine("\nPlease enter the fully qualified path of the file to be uploaded to the URI");
string fileName = Console.ReadLine();
Console.WriteLine("Uploading {0} to {1} ...", fileName, uriString);
DateTime begin = DateTime.Now;
byte[] responseArray = null;
try
{
responseArray = myWebClient.UploadFile(uriString, fileName);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.WriteLine(ex.ToString());
}
DateTime end = DateTime.Now;
Console.WriteLine("Elapsed time is: {0}", (end - begin).TotalMilliseconds);
}
Server:
public partial class FileUploadHandler : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
foreach (string f in Request.Files.AllKeys)
{
HttpPostedFile file = Request.Files[f];
file.SaveAs("D:\\UploadFile\\UploadedFiles\\" + file.FileName);
}
}
}
Exception from client side:
Unable to connect to the remote server
System.Net.WebException: Unable to connect to the remote server ---> System.Net.
Sockets.SocketException: No connection could be made because the target machine
actively refused it 10.10.12.162:1031
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddre
ss socketAddress)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Sock
et s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state,
IAsyncResult asyncResult, Int32 timeout, Exception& exception)
--- End of inner exception stack trace ---
at System.Net.WebClient.UploadFile(Uri address, String method, String fileNam
e)
at FileUploadClient.Program.Main(String[] args) in D:\UploadFile\FileUploadClient\Program.cs:line 30
regards,
George
|
|
|
|
|
It could be a firewall blocking the connection. Try disabling the firewall for a moment and see if it connects. If it does work then you will need to configure your firewall to allow the connection.
My current favourite word is: Delicious!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
Thanks SK,
1.
Do you mean checking firewall at client side or server side?
2.
I have checked my firewall is off at server side, and the server is Windows Server 2003. I have made another test which using browser from another machine to access http://10.10.12.162:1031/<some existing URL>, and IE on another machine can not access the URL. But IE on the same machine (which the server runs) could access the URL.
I have two further questions,
A. If the firewall is off (checked from Control Panel --> Firewalls), any other points to check which may block network connection?
B. I run the web server from Visual Studio directly by pressing F5 on the Windows Server 2003 machine, other than run from IIS web server. I am not sure whether running from Visual Studio will only enable client to access locally?
regards,
George
|
|
|
|
|
iwant to add a looping string into an arraylist ,each loop string value in each index of the arraylist..how?can somebody help me?
|
|
|
|
|
Could you give us a specific example?
I Love KongFu~
|
|
|
|
|
foreach (string st in arrayList)
{
...
}
|
|
|
|
|
Hi, all
A little bird told me there are three type of JIT: Pro-JIT, Ecno-JIT, Normal-JIT. How can we set the JIT type for our application?
Thanks.
Dragonfly
I Love KongFu~
|
|
|
|
|
If you google this and find that it's not a pile of BS, I'd sure love to know about it.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
I just want to know if the JIT type can be decided by Microsoft or programmer. I am pleased if you can offer an effective link, too.
I Love KongFu~
|
|
|
|
|
High on that oak-tree, the birds are singing about native compilation and stuff. It's even the right answer to one of those "tech interviews" that you can find with Google
The moderator on the Microsoft forum has some other explanation;
Shawn wrote: NGWS - now that's a blast from the past. It stood for Next Generation Web Services (one of the many code names .NET went through before it was released).
You're correct that Pre-JIT is what today is called NGEN. You can use it by running ngen install <path to="" assembly="">
(Source)[^]
What those birds didn't read;
MSDN says Once you create a native image for an assembly, the runtime automatically uses that native image each time it runs the assembly. You do not have to perform any additional procedures to cause the runtime to use a native image. Running Ngen.exe on an assembly allows the assembly to load and execute faster, because it restores code and data structures from the native image cache rather than generating them dynamically.
(Source)[^]
I are troll
|
|
|
|
|
Eddy Vluggen wrote: It's even the right answer to one of those "tech interviews" that you can find with Google
Thanks, Eddy Vluggen.
Actually, I know the differences for these three type of JIT. I just want to know how to choose the JIT type and the related cmd.
I Love KongFu~
|
|
|
|
|
I don't think we get to choose that much, only whether we want to precompile or not. I couldn't find a satisfactory answer either
I are troll
|
|
|
|
|
OK, thanks, Eddy.
I Love KongFu~
|
|
|
|
|
Hi Expert,
I am Using the Calibri Fonts in Crystal Report.Report is cumming correctly in Crystal Viewer But when i export it in PDF. Some Sentence is cumming wrong. How i can fix this problem when i export the Report in PDF.Any kind of suggestion is highly appreciated.
Thanks
|
|
|
|
|
Hi, don't know really where to post this but because I wrote the program in c# to solve this problem, I guess its as good a place as any.
Project Euler is for bored programmers (like myself) that like to solve problems.
Well I am pretty sure I solved problem 9[^] correctly, yet the site tells me i'm crazy.
The answer I got was:
{200, 375, 425} [a^2 + b^2 = c^2]
And the product of abc is 6375000000.
Am I reading the problem wrong?
This checks out on my end, please double check this for me and let me know I'm not crazy.
Matthew Hazlett
Fighting the good fight for web usability.
|
|
|
|
|
Heres the code if you want to see how I did it:
int objectNum = 1000;
for (int counterOne = 1; counterOne < objectNum; counterOne++)
{
for (int counterTwo = 1; counterTwo < objectNum; counterTwo++)
{
double a = Math.Pow(counterOne, 2);
double b = Math.Pow(counterTwo, 2);
double c = Math.Sqrt(a + b);
if (Math.Truncate(c) == c)
if (counterOne + counterTwo + c == (double)objectNum)
Console.WriteLine("{0}, {1}, {2}", counterOne, counterTwo, c);
}
}
Matthew Hazlett
Fighting the good fight for web usability.
|
|
|
|