|
Dears;
i want build a software that can send and receive SMS from windows application C# with USB modem huawei E303.
i found a code but i could't connect to usb port
can you help me please ???
|
|
|
|
|
I don't have that modem, but my questions could propably help you to find out more:
Is the driver installed correctly?
Is there a virtual COM-Port for the modem?
How does the example code connect to the modem? Mabe you can post some snippets.
|
|
|
|
|
I have the same trouble. Even using hyperterminal I cannot connect to it. The only way is 192.168.1.1 but then it is no possible to get the incoming sms to manage them.
Some help will be appreciated.
Kurtz
|
|
|
|
|
A 401 error occur when i use post method to login a website.
The website is: www.19lou.com/login
My username is: cyberarmy
My password is: wangyouliang
My C# code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.IO;
using System.Web;
namespace _19lou
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
const string LoginUrl = @"http://www.19lou.com/login";
HttpWebRequest httpWebRequest;
HttpWebResponse httpWebResponse;
string responseFromServer;
string username = "cyberarmy";
string password = "wangyouliang";
private void btn_login_Click(object sender, EventArgs e)
{
if (txt_username.Text != "" && txt_password.Text != "")
{
string PostData = string.Format("userName={0}&userPass={1}&captcha=&checked=0&cityInfo=&refererUrl=aHR0cDovL3d3dy4xOWxvdS5jb20=&remember=1", username, password);
SendLogin(LoginUrl, PostData);
}
}
public void SendLogin(string loginUrl, string postData)
{
byte[] byteArray = Encoding.GetEncoding("GBK").GetBytes(postData);
try
{
ServicePointManager.Expect100Continue = false;
CookieContainer cookieContainer = new CookieContainer();
httpWebRequest = (HttpWebRequest)WebRequest.Create(loginUrl);
httpWebRequest.Credentials = new NetworkCredential(username, password, "www.19lou.com");
httpWebRequest.CookieContainer = cookieContainer;
httpWebRequest.Accept = "image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/QVOD, application/QVOD, application/xaml+xml, application/x-ms-xbap, application/x-ms-application, application/vnd.ms-xpsdocument, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*";
httpWebRequest.Headers["Accept-Language"] = "zh-cn";
httpWebRequest.UserAgent = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E)";
httpWebRequest.ContentType = "application/x-www-form-urlencoded";
httpWebRequest.Method = "POST";
httpWebRequest.ContentLength = byteArray.Length;
Stream dataStream = httpWebRequest.GetRequestStream();
dataStream.Write(byteArray, 0, byteArray.Length);
httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();
if (httpWebResponse.StatusCode == HttpStatusCode.OK)
{
StreamReader reader = new StreamReader(httpWebResponse.GetResponseStream(), Encoding.GetEncoding("utf-8"));
responseFromServer = reader.ReadToEnd();
reader.Close();
dataStream.Close();
httpWebResponse.Close();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
}
|
|
|
|
|
So, you posted your account username and password in a public forum for ANYONE to use? You idiot. I HIGHLY suggest you remove that part or your post, immediately.
|
|
|
|
|
This account is for testing .
|
|
|
|
|
SO FREAKIN' WHAT?? Now ANYONE can impersonate you with malicious intent. Who cares if it's a "test" account.
|
|
|
|
|
Well now we have your username and password, and your email address we can cause any sort of trouble for you.
|
|
|
|
|
I voted to remove the post for the author's own good for that reason.
|
|
|
|
|
You're bypassing a captcha; meaning the site's owner has put in measures to prevent automated bots abusing his/her site. Whatever you're going to do, I doubt it complies with the TOS.
|
|
|
|
|
Just actually went to the URL?? I wasn't going to risk it because of recently exposed exploits.
|
|
|
|
|
hi all
I want to pass generic collection, List<string> with wcf
how to do that ?
i tried [datamember] but it's don't work
|
|
|
|
|
Sure it works. I do it all the time. Post your code.
|
|
|
|
|
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.Serialization;
namespace BE
{
[DataContract]
public class BusinessAccount : Account
{
private string companyNumber;
private string companyName;
private List<string> authorizedSignatory = new List<string>();
public BusinessAccount() { }
public BusinessAccount(long number, int branchNumber, DateTime openingAccountDate, string password, int credit, int balance,
AccountStatus status, AccountType account_Type, string companyNumber, string companyName, List<string> authorizedSignatory)
: base(number,branchNumber,openingAccountDate,password,credit,balance,status,account_Type)
{
this.companyNumber = companyNumber;
this.companyName = companyName;
this.AuthorizedSignatory = authorizedSignatory;
}
[DataMember]
public string CompanyNumber
{
get { return companyNumber; }
set { companyNumber = value; }
}
[DataMember]
public string CompanyName
{
get { return companyName; }
set { companyName = value; }
}
[DataMember]
public List<string> AuthorizedSignatory
{
get { return authorizedSignatory; }
set
{
foreach (var item in value)
authorizedSignatory.Add(item);
}
}
}
}
|
|
|
|
|
hi guys , im using the zeromq dll , and most of you knows , that this dll is handling the socket programming job .
okay , after that im define a dealer , i used the dealer.recived event is like
dealer.OnReceived += delegate(byte[] bytes, bool multipart)
{
string recive = Encoding.UTF8.GetString(bytes);
message = recive.Split('|');
publisher.Send(bytes);
if (Application.OpenForms["form2"] != null)
Application.OpenForms["form2"].Close();
};
Cross-thread operation not valid: Control 'Form2' accessed from a thread other than the thread it was created on.
this error belong to the application.openform.
i know one thing , when im using the threading opreation , i should define a new delegate to just invoke the object and get access of it , but here i dont really know what should i do to just close the form2.
so , any idea , i'll appriciate that .
|
|
|
|
|
It applies the same here. OnReceived is gets called from a different thread and hence any operation on UI objects should route through InvokeRequired mechanism.
Jibesh V P
|
|
|
|
|
|
i've solved the problem , but ty
|
|
|
|
|
i m developing the desktop application in c# dotnet for p2p file transffering..I am using wcf for this ..I have seen many articles over this ,they run smoothly on local computer as usually,but my application is p2p over internet and should not limited to LAN.I have found a article "http://www.codeproject.com/Articles/37057/File-Transfer-using-WCF-and-Socket" .Its run smoothly sometime but not always..can anybody help me regarding this.I Have done this with webservies hosted on server where my data reaches first on server and then transfer to destination but this is not wat i need.I want to transfer p2p directly where data should not reaches on intermediate server..please help me regarding this..Thanks in advance
|
|
|
|
|
I have problem making tab alignment in a text file.
For example I have this simple code:
long l1 = 500;
long l2 = long.MaxValue;
long l3 = 568678;
Console.WriteLine("Value1\tValue2");
Console.WriteLine("--------------");
Console.WriteLine("{0}\t{1}", l1, l3);
Console.WriteLine("{0}\t{1}", l2, l3);
This gives this output:
Value1 Value2
--------------
500 568678
9223372036854775807 568678
With this code I get the result I want:
long l1 = 500;
long l2 = long.MaxValue;
long l3 = 568678;
Console.WriteLine("Value1\t\t\tValue2");
Console.WriteLine("------------------------------");
Console.WriteLine("{0}\t\t\t{1}", l1, l3);
Console.WriteLine("{0}\t{1}", l2, l3);
Output becomes:
Value1 Value2
------------------------------
500 568678
9223372036854775807 568678
In the second result I have hard-coded the tab escape sequence different for each row to make it looking good.
Is there any way to fix this automatically?
|
|
|
|
|
String.Format [^] has an alignment field.
You can set this alignment number to the length of long.Maxvalue in terms of characters and then you can use this directly (even without using \t ). E.g. Console.WriteLine("{0,10},11,13);
Here[^] is an example.
String.PadLeft [^] could provide you with alternate solutions that you could consider and use.
|
|
|
|
|
Thanks very much!
|
|
|
|
|
I have 1 Usercontrol. In it I load an image from code. But when I go to Form1 and put this control into form, I get an error that he can not find the image, but the image is there, and the root is correct from code. When I run the application, is working fine, loading the correct image. What setting I miss?
Thanks and here is the code:
public partial class Equipment : UserControl
{
public Equipment(){InitializeComponent();}
string path = Application.StartupPath;
PictureBox pictureBox3429= new PictureBox();
public void Equipment_Load(object sender, EventArgs e)
{
panel1.BackgroundImage = Image.FromFile(path + "\\unit.jpg");
try
{
}
catch (Exception) { throw; }
}
}
modified 18-Jan-13 10:34am.
|
|
|
|
|
Instead of rethrowing the exception (which is a bit redundant - why catch it if you only throw it again), put up a messagebox or write the output (Debug.WriteLine); sounds like the designer is running it in a different path, and that's what you want to check.
Also, if it throws an exception, paste it here; it holds hints on whats wrong and how to solve it.
|
|
|
|
|
It's because the StartupPath is not what you think it is. Testing this on my system causes the designer view of the form to show an error message in HTML, helpfully rendered as one very long line. Carefully scrolling through it reveals that it looking for the image
C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\pic.jpg
In a simplified test I place the image directly onto an otherwise empty user control. I thought that the correct thing to do would be to stop the designer attempting to load the image like this:
public partial class ImageControl : UserControl {
String path;
public ImageControl() {
InitializeComponent();
path = Application.StartupPath;
}
private void ImageControl_Load(object sender, EventArgs e) {
if (!DesignMode) {
BackgroundImage = Bitmap.FromFile(Path.Combine(path, "pic.jpg"));
}
}
}
Job done you might think, but no, as this allows the form to render properly with the image displayed. So what is going on? Actually I don't know, but the only reasonable explanation is that the designer loads the form more than once, in DesignMode where the path is incorrect and at least once more, not in DesignMode, where the path is correct.
|
|
|
|
|