|
If it were my project, I would stick with 2010 based on the fact that what you have currently works with this and you don't want to introduce any issues.
|
|
|
|
|
|
|
I didnt ask about the meaning of life, but I guess its not C#?
|
|
|
|
|
You had the answer, because you knew the right question to ask.
I asked the question, but I asked the wrong question.
Or, more probably, asked the right question in the wrong manner.
|
|
|
|
|
If you're into free IDEs then SharpDevelop (clicky[^]) is worth a look, it will read VS project files and it's pretty full featured.
|
|
|
|
|
Thanks, will examine it.
This is an interface to an external box on my desk.
We have a useful interface already. We send a command and the box responds; and we see the response on our screen; exactly as the spec told the guy to do a year or two ago; and he did his job quite well.
We now want to add our own smarts into this arrangement, and write an interface that lets us give the box a command, and then read the response; and make a decision on what to do as a result.
e.g., something like...
SendTheCommand("X Y Z")
Response = ReadTheResponse()
if (Response == 1)
{
DoTheFirstThing()
}
if (Response == 2)
{
DoTheSecondThing()
}
I think this is going to have to be C# by fiat more than logistics.
Anyway, I will certainly spend a few minutes looking at your open source suggestion.
|
|
|
|
|
I may not have been clear there, #Dev is an IDE for writing .Net (i.e. C#) programs.
|
|
|
|
|
How does it compare with VS Express?
|
|
|
|
|
I've never actually used VS Express because the only time I tried (back in the day) it wouldn't run on my low spec machine at the time. At work my employer pays for VS Pro. However I think a lot of the more useful features of VS (unit test execution, object model inspection, following references into libraries, probably the refactoring stuff) isn't in Express. And #Dev is still far kinder on memory and resources so it will generally run significantly faster.
|
|
|
|
|
|
Hi all
I have been searching and have found very little on this subject.
I am trying to connect simply to a webservice, call a method and get a response.
The service requires a nonce for authentication, but i can not ofr the life of me figure out how to generate one and pass it correctly.
I am call the webservice from a c# script using webClient.
I can add basic network credentials, of username and password.
But how do i add the full header correctly with a generated nonce.
The authentication part of the header looks like this.
<pre lang="xml"> <SOAP-ENV:Header>
<wsse:Security mustUnderstand="true">
<wsse:UsernameToken>
<wsse:Username>admin</wsse:Username>
<wsse:Password
Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">bG4Gz8elJibVIABSaX5nB7uTSBM=</wsse:Password>
<wsse:Nonce
EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">+MnwDfmScWNR2j5MBV+Ikg==</wsse:Nonce>
<wsu:Created>2014-03-06T12:37:36.174525Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</SOAP-ENV:Header>
</pre>
I am new to using webservices so for give my ignorance.
|
|
|
|
|
If you're using WCF, I would advise reading the answers detailed here[^].
|
|
|
|
|
Hi fellow members
I'm working on a personal C# project , in which i estimate the budget - assets , account receivables , debts ... etc. The main requirement is that the code should not interact with a server side database , instead it can interact with a client MS access database.
It has a snowflake schema . Need your help in understanding how we can setup a MS access database and use it in C# code.
If any such code is available ,please send the link.
Appreciate your help
Thanks
Praneeth
Bob.
|
|
|
|
|
bobba praneeth wrote: If any such code is available ,please send the link.
You really just need to google "c# ms access database tutorial", this returns in excess of 23,000,000 results. At least one of these is going to get you started.
Unless you are tied to Access for some reason, you could swap to SQL express, this will allow you to use Entity Framework which takes a lot of the effort out of pushing information in/out of objects.
|
|
|
|
|
Here is an article I wrote on database connection[^], but if you can help it avoid Access databases. They are a pain in the ass. Both Oracle and SQL-Server have free versions out there and MySQL and PostgreSQL are also very good alternatives (both free as well)
If you're developing pure .Net I'd go for SQL-Server Express.
PS: My article is one way of doing things, there are other ways as well.
hope this helps.
|
|
|
|
|
The wording 'set up an Access database' implies you don't have it yet and therefore have a free choice of tech. In which case: don't use access. Even a System.Data.DataSet serialised to disk is probably better than that. Really you should set yourself up a proper ODBC data source (e.g. SQL Server, mySQL etc) and use System.Data to interact with it.
|
|
|
|
|
Just to back up what the others say: if you are using this for multi-user at all - i.e. if at any time there will be more than one user using the database in any way, then Access is a poor solution, and will give you nasty problems. You do need to use a "proper" multiuser system, and that means SQL Server or MySql.
If you only ever need it for a single user, then Access will work, but I'd still be tempted to use SQLCE or SQLite instead - and I have Access on my system!
If you must use Access, then you need to install the appropriate ACE driver: 32 bit or 64 bit (you can't install them both on the same machine), and use OleDbConnection and OleDBCommand objects to access them: Google can help with that.
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
Many times in C/C++ I have used arrays of structs into struct and it was very nice and useful to aggregate data sets. Now with C# My question is, can I make the same using class ? I know, there are struct also in C#, but they are allocated into stack and I don't want use to much stack area, and I have two method to serialize and deserialize not static objects classes and I don't know if and how struct are serializable.
Here is my code:
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
namespace My_Space
{
[Serializable()]
public class Parameters
{
public int autoLockTime;
public int screenOffTime;
public int loopAutoStartTime;
public class product
{
public bool enabled;
public string productName;
public double zero;
public double span;
public string unit;
public class preProcessing
{
public string preProcessingName;
public double[] param = new double[5];
}
}
public void InitParameters()
{
autoLockTime = 0;
screenOffTime = 0;
loopAutoStartTime = 0;
product[] p = new product[30];
p[0].enabled = false;
p[0].unit = "mm";
p[0].productName = "H2O";
product.preProcessing[] pp = new product.preProcessing[10];
pp[0].preProcessingName = "Derivative";
pp[0].param[0] = 100.0f;
pp[0].param[1] = 200.0f;
}
public void SaveParameters(Parameters obj)
{
Stream stream = File.Open("Parameters.bin", FileMode.Create);
BinaryFormatter formatter = new BinaryFormatter();
formatter.Serialize(stream, obj);
stream.Close();
}
public void ReadParameters(out Parameters obj)
{
Stream stream = File.Open("Parameters.bin", FileMode.Open);
BinaryFormatter formatter = new BinaryFormatter();
obj = (Parameters)formatter.Deserialize(stream);
stream.Close();
}
}
}
I can also write in other classes:
private Parameters q = new Parameters q();
private Parameters.product[] p = new Parameters.product[30];
private Parameters.product.preProcessing[] pr = new Parameters.product.preProcessing[10];
public Form()
{
q.ReadParameters(out q);
p[0].productName = "aaa";
pr[0].preProcessingName = "bbb";
}
but I cannot link the preProcessing object to the product object and I cannot serialize array of classes as p or pr.
Maybe using static class ... ?
How can I serialize/deserialize structs ?
What is the best solution ?
Thanks
modified 24-Mar-14 12:21pm.
|
|
|
|
|
The problem here is that you have only marked one of your classes as Serializable . You need to mark all of the classes that can be serialized like this.
|
|
|
|
|
This code seems to work:
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
namespace Base_NIR
{
[Serializable()]
public class Parameters
{
public int autoLockTime;
public int screenOffTime;
public int loopAutoStartTime;
public class product
{
public bool enabled;
public string productName;
public double zero;
public double span;
public string unit;
public preProcessing[] preProc = new preProcessing[10];
}
public class preProcessing
{
public string preProcessingName;
public double[] param = new double[5];
}
[NonSerialized()]
public static string member5 = "hello world!";
public void InitParameters()
{
autoLockTime = 0;
screenOffTime = 0;
loopAutoStartTime = 0;
preProcessing[] pr = new preProcessing[10];
pr[0].preProcessingName = "bbb";
product[] p = new product[30];
p[0].preProc[1].preProcessingName = "aaa";
p[0].enabled = false;
p[0].unit = "mm";
p[0].productName = "H2O";
p[0].preProc[3].param[5] = 123.45f;
p[0].preProc[2].preProcessingName = "Derivative";
}
public void SaveParameters(Parameters obj)
{
Stream stream = File.Open("Parameters.bin", FileMode.Create);
BinaryFormatter formatter = new BinaryFormatter();
formatter.Serialize(stream, obj);
stream.Close();
}
public void ReadParameters(out Parameters obj)
{
Stream stream = File.Open("Parameters.bin", FileMode.Open);
BinaryFormatter formatter = new BinaryFormatter();
obj = (Parameters)formatter.Deserialize(stream);
stream.Close();
}
}
}
And I can also write:
private Parameters.product[] p = new Parameters.product[30];
private Parameters pr = new Parameters();
public MainForm()
{
pr.InitParameters();
pr.ReadParameters(out pr);
p[0].preProc[2].preProcessingName = "xxx";
pr.SaveParameters(pr);
pr.ReadParameters(out pr);
}
But everytime I write in a field I have the error of nullReference exception.
|
|
|
|
|
You're facing another issue here, and it's a common misunderstanding. The issue is down to the fact that newing up arrays doesn't actually add class instances, you have to explicitly add them yourself. So, after you have allocated your array, you need to add a new instance of the class against each item in the array.
|
|
|
|
|
Sorry Pete, to be clear, please can you write 5 lines of code of example to better explain ?
|
|
|
|
|
This should give you an idea. The line in bold is the one I added.
preProcessing[] pr = new preProcessing[10];
pr[0] = new preProcessing();
pr[0].preProcessingName = "bbb";
|
|
|
|
|
OK thanks Pete. Sorry, it wasn't so easy to use that objects for me but now it's working fine. Do you have some other idea on how it would be better to implement them. What do you thinks about to use these classes with Lists ?
|
|
|
|