|
MDarray's are quite slow to index, a normal array with some funny math for the indexing is faster. But I don't really understand your requirement to return "a list inside the matrix" - what do you mean? Do you want access to rows or columns as lists?
|
|
|
|
|
harold aptroot thank you for your insight on MD Arrays.
"A list inside the matrix" is miss leading. I will have an initial datasource of Objects that I will reference by Id so once/while I iterate through the relationship matrix I can return a List<objects>.
Robert Fidler
I'm listening but I only speak GEEK.
|
|
|
|
|
HI please any one help me how to work with IRC any guide any help
please i need this i am waiting
thanks
|
|
|
|
|
Well, Bing suggests the following, for example:
http://www.ircbeginner.com/index.php[^]
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
|
Hi there
In VS2008 I type in AssemblyInfo with a period. When I do that , I see different strings representing different assemblies.
Where do these strings come from? Are these shared assemblies installed on the computer?
|
|
|
|
|
AssemblyInfo is a .Net class. What you see after the dot are its members.
|
|
|
|
|
Hello,
I am a newbie here and have an issue with a combobox. When a requestor is added, a form using a showdialog method is opened and the user is asked to enter and confirm their email address. When this is completed, the user clicks a button which adds the new requestor beautifully. It even keep that requestor as the selected one in the combobox of the request form but it places this new record at the end of the list in the combobox. The datasource of this combo is a table in an access datatabase. Can anyone help? My code with the sections of issue is below.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using Outlook = Microsoft.Office.Interop.Outlook;
using CSharp;
namespace WinSIRAD
{
public partial class frmSTDREQ : Form
{
public frmSTDREQ()
{
InitializeComponent();
}
private void frmSTDREQ_Load(object sender, EventArgs e)
{
XmlTextReader textreader2 = new XmlTextReader(Environment.CurrentDirectory.ToString() + "\\XMLFile1.xml");
textreader2.WhitespaceHandling = WhitespaceHandling.None;
while (textreader2.Read())
{
switch (textreader2.NodeType)
{
case XmlNodeType.Element:
while (textreader2.MoveToNextAttribute())
break;
OleDbConnection myconnection = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;" + textreader2.Value.ToString());
try
{
myconnection.Open();
}
catch
{
MessageBox.Show("Can Not Connect To The SIRAD Database!");
Application.Exit();
}
string sCmdString4 = "SELECT fldemailname,fldemailadd FROM tblAddBook ORDER BY fldemailname";
OleDbDataAdapter myadapter4 = new OleDbDataAdapter(sCmdString4, @"Provider=Microsoft.Jet.OLEDB.4.0;" + textreader2.Value.ToString());
DataTable myDT2 = new DataTable();
myadapter4.Fill(myDT2);
cboRequestor.DataSource = myDT2;
cboRequestor.DisplayMember = "fldemailname";
cboRequestor.ValueMember = "fldemailadd";
cboRequestor.SelectedIndex = -1;
myconnection.Close();
break;
}
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using System.Data.OleDb;
namespace WinSIRAD
{
public partial class frmNReq : Form
{
public frmNReq()
{
InitializeComponent();
}
private void btn1NReq_Click(object sender, EventArgs e)
{
if (txtBox2.Text != "" && txtBox1.Text != "")
{
if (txtBox1.Text != txtBox2.Text)
{
MessageBox.Show("The Email Addresses Do Not Match!", "Error", MessageBoxButtons.OK);
}
else
{
XmlTextReader textreader = new XmlTextReader(Environment.CurrentDirectory.ToString() + "\\XMLFile1.xml");
textreader.WhitespaceHandling = WhitespaceHandling.None;
while (textreader.Read())
{
switch (textreader.NodeType)
{
case XmlNodeType.Element:
while (textreader.MoveToNextAttribute())
break;
//Connect to the backend via XML string
OleDbConnection myconnection = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;" + textreader.Value.ToString());
try
{
myconnection.Open();
}
catch
{
//If connection cannot be made then warn user and exit SIRAD
MessageBox.Show("Can Not Connect To The SIRAD Database!");
Application.Exit();
}
string sCmdString3 = "SELECT fldemailname,fldemailadd FROM tbladdbook ORDER BY fldemailname";
OleDbDataAdapter myadapter3 = new OleDbDataAdapter(sCmdString3, @"Provider=Microsoft.Jet.OLEDB.4.0;" + textreader.Value.ToString());
OleDbCommandBuilder mycb = new OleDbCommandBuilder(myadapter3);
DataTable mydt = new DataTable();
myadapter3.Fill(mydt);
DataRow dnewrow = mydt.NewRow();
dnewrow["fldemailname"] = htxtbox.Text;
dnewrow["fldemailadd"] = txtBox1.Text;
mydt.Rows.Add(dnewrow);
myadapter3.Update(mydt);
MessageBox.Show("Entry Added");
Form frm = (Form)Application.OpenForms["frmSTDREQ"];
ComboBox cb = (ComboBox)frm.Controls["cboRequestor"];
cb.Datasource = null;
cb.items.Clear();
cb.DataSource = mydt;
cb.DisplayMember = "fldemailname";
cb.ValueMember = "fldemailadd"
cb.Text = htxtbox.Text;
myconnection.Close();
this.Close();
break;
}
}
}
}
modified on Monday, May 10, 2010 1:58 PM
|
|
|
|
|
what exactly do you want help with?
Of course it gets added at the end...that's the way tables work. If you want it somewhere else, you need to implement an OrderBy in your SQL to change that.
And next time you post code, first, wrap it in pre tags. You can do this by selecting it all and hitting the "code block" button above where you are typing this message, or just adding the following opening and closing tags:
<pre lang="cs">
</pre>
Secondly, you have to tell us what the problem is and you need to identify where your problem is happening. It sounds like the code is working exactly as its supposed to. But I'm not going to read through unformatted, long code to find out what you're doing and not doing.
|
|
|
|
|
Hi Thanks for the reply!
Well I am a newbie so sorry if I am unfamiliar with posting code at this website. Secondly,my SQL does implement Orderby when the table is to be updated. So this doesn't explain why, after adding a requestor to the table and thus the combobox, the requestor is not in the proper order in the combobox.
Art
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using Outlook = Microsoft.Office.Interop.Outlook;
using CSharp;
namespace WinSIRAD
{
public partial class frmSTDREQ : Form
{
public frmSTDREQ()
{
InitializeComponent();
}
private void frmSTDREQ_Load(object sender, EventArgs e)
{
XmlTextReader textreader2 = new XmlTextReader(Environment.CurrentDirectory.ToString() + "\\XMLFile1.xml");
textreader2.WhitespaceHandling = WhitespaceHandling.None;
while (textreader2.Read())
{
switch (textreader2.NodeType)
{
case XmlNodeType.Element:
while (textreader2.MoveToNextAttribute())
break;
OleDbConnection myconnection = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;" + textreader2.Value.ToString());
try
{
myconnection.Open();
}
catch
{
MessageBox.Show("Can Not Connect To The SIRAD Database!");
Application.Exit();
}
string sCmdString4 = "SELECT fldemailname,fldemailadd FROM tblAddBook ORDER BY fldemailname";
OleDbDataAdapter myadapter4 = new OleDbDataAdapter(sCmdString4, @"Provider=Microsoft.Jet.OLEDB.4.0;" + textreader2.Value.ToString());
DataTable myDT2 = new DataTable();
myadapter4.Fill(myDT2);
cboRequestor.DataSource = myDT2;
cboRequestor.DisplayMember = "fldemailname";
cboRequestor.ValueMember = "fldemailadd";
cboRequestor.SelectedIndex = -1;
myconnection.Close();
break;
}
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using System.Data.OleDb;
namespace WinSIRAD
{
public partial class frmNReq : Form
{
public frmNReq()
{
InitializeComponent();
}
private void btn1NReq_Click(object sender, EventArgs e)
{
if (txtBox2.Text != "" && txtBox1.Text != "")
{
if (txtBox1.Text != txtBox2.Text)
{
MessageBox.Show("The Email Addresses Do Not Match!", "Error", MessageBoxButtons.OK);
}
else
{
XmlTextReader textreader = new XmlTextReader(Environment.CurrentDirectory.ToString() + "\\XMLFile1.xml");
textreader.WhitespaceHandling = WhitespaceHandling.None;
while (textreader.Read())
{
switch (textreader.NodeType)
{
case XmlNodeType.Element:
while (textreader.MoveToNextAttribute())
break;
OleDbConnection myconnection = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;" + textreader.Value.ToString());
try
{
myconnection.Open();
}
catch
{
MessageBox.Show("Can Not Connect To The SIRAD Database!");
Application.Exit();
}
string sCmdString3 = "SELECT fldemailname,fldemailadd FROM tbladdbook ORDER BY fldemailname";
OleDbDataAdapter myadapter3 = new OleDbDataAdapter(sCmdString3, @"Provider=Microsoft.Jet.OLEDB.4.0;" + textreader.Value.ToString());
OleDbCommandBuilder mycb = new OleDbCommandBuilder(myadapter3);
DataTable mydt = new DataTable();
myadapter3.Fill(mydt);
DataRow dnewrow = mydt.NewRow();
dnewrow["fldemailname"] = htxtbox.Text;
dnewrow["fldemailadd"] = txtBox1.Text;
mydt.Rows.Add(dnewrow);
myadapter3.Update(mydt);
MessageBox.Show("Entry Added");
Form frm = (Form)Application.OpenForms["frmSTDREQ"];
ComboBox cb = (ComboBox)frm.Controls["cboRequestor"];
cb.Datasource = null;
cb.items.Clear();
cb.DataSource = mydt;
cb.DisplayMember = "fldemailname";
cb.ValueMember = "fldemailadd"
cb.Text = htxtbox.Text;
myconnection.Close();
this.Close();
break;
}
}
}
}
|
|
|
|
|
Any and all,
Try not to flame me, I'm a EE that writes C# sparingly, so go easy on me.
I have an application with a property grid and a data grid view. The data grid represents a register table of an ASIC. A register location inside the ASIC controls some portion of the ASIC. The property grid contains the same control as the register table, only in a more easy to use manner, as you can imagine.
The user can alter a property which in turn writes a register in the ASIC, this register change fires the data grid to update, via reading all the registers in the ASIC. The reverse is also possible: the user may manually change a register which updates the data grid and then the property grid is updated.
If I explained myself well enough, the data grid and property grids are tied together via control of the ASIC. Currently, if a property is changed I have a big case statement with the property name as the switch. Depending on which property is updated I then alter the specific register.
Currently, if a register is manually written (via the data grid) I have another big case statement with the register address as the switch. I then update the necessary property in the property grid.
My question is there must be a better way of doing this. As you can imagine every time I port my software to a new or different ASIC I have to re-write ~1000 lines of code. Also a property can affect multiple registers, which in turn can affect other properties, i.e. Prop A Changed->Write Register B, C, & D->Update data grid->Register D Changed->Update property A & E->etc. These "callbacks" can get long & slow down my application. What can I do to make this process more seemless?
FYI I can't completely remove the data grid view, because of other reasons, even though I believe users use the PropertyGrid > 98% of the time.
Thanks,
--RB
|
|
|
|
|
i want to save a TreeView in database
i designed a table with three fields (ID , NodeName,UpareNodeID)
and create a relation ship with ID and UpareNodeID is it correct?
if it is , how can i retrieve thees nodes with the best performance ?
i want to know if there is a better solution to save and retrieve this kind of collection
thanks!
modified on Monday, May 10, 2010 12:08 PM
|
|
|
|
|
|
Where you are retrieving the data to populate the treeview, you should look at lazy loading it. In other words, if you have a deep hierarchy with lots of records, you can improve the responsiveness of your application and the overall feel for your users just by loading data as it's needed.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
You may use XML for this with succes!
Give it a try. Good luck!
Alex Manolescu
|
|
|
|
|
calculated with the formula I want to put a space variable. Then I'd like to collect these variables.
for example :
v1 = x1 * y1 / z3
global numbervar v1;
sum (v1)
|
|
|
|
|
Hi
I have two pieces of software communicating over a TCP/IP, one is written in MFC and the other one in C#.In MFC I use memcpy to copy the hole structures to a byte array and send it to the other software, and when receiving data in MFC I use memcpy as well to align each bit to its variable
example
typedef struct<br />
{<br />
unsigned int ID;<br />
unsigned int SequenceNumber;<br />
unsigned int ReferenceSeqNumber;<br />
} HeaderType;<br />
<br />
HeaderType header;<br />
<br />
memcpy(&header,&byteArray,sizeof(HeaderType));
but in C# I have no clue how to do this, and if not possible, then what is the best way to extract these variables?
Thanks in advance
Abdulaziz
|
|
|
|
|
|
|
Thanks, I'll try that and give you a feedback.
|
|
|
|
|
Hello guys. How are you doing?
I am going to do my Senior Project on SMS Banking or Mobile Banking (but too limited scope). Currently in our country,none of the banks use this method,even there is no internet banking.
Here is the idea how I planned to do the project with 2 of my friends.
- Currently, College students who study abroad needs money to be sent from their parents every month which will cover expenses. So when the parents send the money, they will go to bank fill a bulk of forms then it will be send to a bank which is near to the student. The amount is drawn either from the parent's account or direct cash.
Take the following cases in mind
1) It takes time.
2)The student is not expected to have an account. s/he is expected to have an ID only.
3)The parents might be busy to go to the bank and fill the form. Since it is a must, they should have to go to send the money. But they might be loosing something (may be their Golden time on work)
So the purpose of my project is to make it fast, easy, more secured so that the money will be transfered using the parents mobile (Here there will be a mobile application which will send the data of the filled form to a central server where the parent's account is located)............... Then after authentication (Which will be more SECURED) ...... The server will send an encrypted ID (which contain a the data of the parent , the amount, the student, etc ....) to the parent's cellphone (which is encrypted). So that the Parent will send this ID to his Son/Daughter and the Son/Daughter is expected to go with this ID AND with his Student ID Show to the bank's responsible person,............. When the the responsible person get the ID , he enters in to the system ... it will be then decrypted so that the original information will be retrieved.
This is the plan I wanted to do my senior project. I found that GSM modem is a must (which will act as a telephone on the server side to accept incoming SMS messages) in order to accomplish this task. I also found a software which I can write a code to the mobile application which is platform independent and I planned to use C# for authentication on the server side.
If you have any idea, please help me. Thank you.
|
|
|
|
|
Encryption is not a good idea (for sending back the message). What would you use as encryption key? The ID of the student? That's easily obtained through social engineering, and may even not be a private thing in most schools.
Also, if you have to encrypt all the data about the transaction, the encrypted string will be long and difficult to remember. On top of that, students will soon have a collection of 'encrypted' messages, together with their keys, and the unencrypted data. They'll soon pool these together, and reverse-engineer your encryption scheme.
Furthermore, your scheme offers no opportunity for the paying bank to clear the transactions. What if a student goes round twice with the same message at two different branches?
It's better to have a central server, that distributes unique 'transaction keys', which point to transaction data on the server. (a 13-14 digit number seems to be the biggest that people can dictate and jot down without errors). No duplicates of course, and the digits must be seemingly random. This has the advantage that, if a transaction is intercepted, it will only harm that transaction, and no others. It is also an unbreakable scheme, but it requires paying banks to have access to the central server, in order to retrieve the information. It also allows the paying banks to claim the money from the parent's bank, and to mark the transaction as payed, so it cannot be claimed twice.
|
|
|
|
|
I will not use students’ ID. When I said ID it is kind of collection of strings (some from the name, from the branch, from his parents name and others, including even the date (I will have some random picking of this strings by different mechanisims which I will use as an encryption , so that the decryption will be processed by a reverse mechanism)) Even if it is long, the user , either the parents or the student will write it on paper , so that it will be neither forgotten nor easy to break. By the way students and the parents will not know the unencrypted or decrypted data. Even if they go to the bank with a fake ID, how do you think it will be stored on the system? I mean the parents didn’t sent anything and neither the bank stored that data.
And I forgot to mention about deleting the transaction after it is completed (which will avoid claiming of transaction twice). It is done when the student gets his cash. It is also possible to notify the parents whether their child get the money or not. Is that makes sense?
Because of the problem of technology in our country, to have a central server is unimaginable.
Thank you for your response.
|
|
|
|
|
CoderForEver wrote: to have a central server is unimaginable
Well, you still need it for clearing the transaction, and for verifying the transaction exists
This was the whole argument for keeping 'cheques': A cheque was a difficult to duplicate, uniquely numbered piece of paper. As long as central servers were not practical, they provided a clearing mechanism which was based on physical evidence. As soon as the evidence is electronic, and by definition allows copying without data loss, clearing HAS to be done through a central server.
Your system of picking pieces of strings from various bits of information is well-known by old programmers like myself. It was used for example by tour-operators to check the validity of voucher claims entered by hotels and transportation companies. But it was not fail-safe. We used it because the paying departments didn't have access to online terminals, and still had to dispatch payments. (Waiting for the weekly batch processing was not an option). It is a typical example of security by obscurity, which is a bad practice nowadays. (In those days, most people had never heard of a computer, much less had access to one, so it didn't matter so much.)
It also provides an opportunity for key collision. Once your encryption algorithm starts omitting data from the key or the data, it becomes a hashing algorithm, and cannot guarantee uniqueness any more.
Do telephone operators sell pre-paid rechargeable cards in your country? I suppose they do.
Well here if you want to recharge your phone, you go to local phone shop, and you buy credit from an operator. The cashier punches in the amount, and the cash register requests a 13-digit number from the operator network. This is then printed on your receipt. And this is the number you send to your mobile operator to claim the credit on your phone. Your phone is then topped up, and the transaction is cleared.
This is a typical example of an easily duplicated piece of evidence, which can still be only used once. It ALWAYS requires a central server. Breaking it is impossible, because it is impossible to guess a valid, active transaction number.
Sending a message back to the parents? Sure why not, but how long are you going to wait before sending a no-claim message? and will this no-claim message cancel the transaction?
|
|
|
|
|
Oh, sorry. When I mention about central server, I think I wrote the wrong idea. So, yes they do have a central server.
The idea of the telephone operators sounds nice. It works in our country, once up on a time it had a problem which is fixed now (the problem was, if you take one card and when u send to the mobile operator and at the same time your friend is doing the same thing but both of you are using only on card, both of you will get the amount at the card. i.e by concurrency you faked the operator. But this time, even if I dont know they did it, the problem is fixed).
About the claim, I hope I will wait may be up to 2 or 3 days for the student to take the cash. If not the amount will be transfered back to the parent's account. I think it is a good idea, isnt it?
About the encryption, can you tell me the best algorithm for this one, or recommend me free book or sites to read it.
Thank you Michel.
|
|
|
|
|