|
As I said: if you got this from an article, then the author of the article is the best person to help you.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
|
|
|
|
|
Thanks for your suggestions,
I can't find that ariticle anymore..
maybe the best thing I should do right now is to wait
somebody can help me with that.
|
|
|
|
|
|
I cannot help with your first problem: I don't currently have any computers connected to mine, and am not about to set up a connection just for a quick test! Someone else will be along soon, who can help more with that part of your question.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
|
|
|
|
|
another question,
by which way others access to my computer,
the info will be record?
like FTP, or access to the site?
|
|
|
|
|
Hello there.
I'm learning generics and linked list.
now i have managed to make a generic linked list, but I don't know how I can get the needed data out of it.
I can do it without generics, but with generics I don't know how, I can't find it.
So here I add people and show all the added people.
LinkedList<Persoon> LlPersoon = LinkedList<Persoon>.GetInstance();
LlPerson.Add(new Persoon(1, "First Person"));
LlPerson.Add(new Persoon(2, "Second Person"));
LlPerson.Add(new Persoon(3, "third person"));
Console.WriteLine(LlPerson);
Console.WriteLine(" Done. Adding Persons...");
but how can I just show the second person?
Without generics I did the following thing to get the name of person 2
public string getName(int iPersonNr)
{
Person Per = FirstPer;
bool bln = false;
string strName = "N/A";
while (Per != null && !bln)
{
if (iPersonNr == Per.getNumber())
{
strName = Per.getName();
bln=true;
}
Per = Per.getVolgende();
}
return strName;
}
I tried for days, but can't find it.
It must be something simple but I have no clue as I don't master generics enough.
any directions or help would be appreciated
thx
frofro
|
|
|
|
|
Are you asking about your own implementation of LinkedList? There is one available in .NET since 2.0
This would be an example of its use:
public class CPTest_LinkedList : CPTest {
public override void Test(int arg) {
LinkedList<Person> persons=new LinkedList<Person>();
foreach(string s in new string[]{"jef", "jan", "jos"}) persons.AddLast(new Person(s));
foreach(Person p in persons) log(p.Name);
foreach(Person p in persons) if (p.ID==1) log("person 1 = "+p.Name);
}
public class Person {
public string Name;
public int ID;
public static int count=0;
public Person(string name) { Name=name; ID=count++; }
}
}
which outputs:
18:57:36.439 CPTest.log-59 jef
18:57:36.453 CPTest.log-59 jan
18:57:36.467 CPTest.log-59 jos
18:57:36.479 CPTest.log-59 person 1 = jan
Its use is pretty easy as it implements ICollection . The one thing you can't do with such LinkedList is indexing, as in persons[1] which works fine in array-based collections such as List<T> itself. Indexing in LinkedList requires scanning the list one node at a time.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
modified on Saturday, May 7, 2011 2:46 PM
|
|
|
|
|
Lists are for putting things in, not getting things out.
|
|
|
|
|
Best implemented in WOM. See a datasheet here[^]
Cheers,
Peter
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
I recall seeing that data sheet when it originated, a very long time ago...
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
I usually use a soft /dev/null for storing, but thinking about it, it might be better having it hardware accelerated. I will have to do some benchmarking...
|
|
|
|
|
Person secondPerson = LlPerson.First.Next.Value;
The above code assumes you are using the built-in linked list. LinkedList doesn't have a "GetInstance()" static method, as you seem to be using in your example. With the .Net LinkedList, you'd initialize it this way:
LinkedList<Person> llPerson = new LinkedList<Person>();
|
|
|
|
|
Hi,
I created setup and deployment to my project and would like to provide license agreement for the installation. Please guide me. Thanks in advance
|
|
|
|
|
|
|
thank you
|
|
|
|
|
|
|
hi! i have a simple AND gate circuit and i have to attach it with pc and control it through coding in c#. first of all i have to chk the serial port through which i have connected the circuit with pc. i dont knw how to control the working of AND gate with coding. means what should i do that if i clk the btn the LED attach on the circuit turn ON?
hope the question is clear
|
|
|
|
|
No, the details of the question aren't clear at all. This is what I can tell you:
- use SerialPort class to open up the right serial port;
- do not use the data lines (transmit, receive), use some of the control lines;
- available inputs are CD (CDHolding), CTS (CtsHolding), DSR (DsrHolding);
- available outputs are DTR (DtrEnable), RTS (RtsEnable);
- you can simply get or set their state by accessing the corresponding properties (mentioned above, within parentheses).
BTW1: for an LED you would need a series resistor, limiting the current to some 10 to 20 mA. Start with 330 or 470 ohm assuming the power supply voltage is 3.3 or 5V.
BTW2: assuming you're talking about some TTL or CMOS AND gate, you need an external voltage as well; however you probably don't really need a gate at all, and could take advantage of RS232C ports typically being able to sink and source 10mA (and more) on their control pins directly. As RS232C voltages may go up to 15V, you should start with a 1K ohm resistor here.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
|
hmm i have seen this article but it seemed to b very difficult m beginner... but from this code i have selected some piece of code to light the LED. but not sure if it is ok or not.
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Threading;
using System.Timers;
namespace LED
{
public partial class Form1 : Form
{
public int i = 0, j = 0, adress = 888;
public Form1()
{
InitializeComponent();
Reset_LEDs();
}
private void Reset_LEDs()
{
PortAccess.Output(adress, 0);
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
int value = 0;
value += (int)Math.Pow(2, 0);
LoadNewPict_D0();
PortAccess.Output(adress, value);
}
}
}
what is LoadNewPict_D0(); function doing? will this piece of code ON the LED?
thanks 4 help
|
|
|
|
|
aeman wrote: value += (int)Math.Pow(2, 0);
Isn't that just 1 ?
aeman wrote: LoadNewPict_D0();
I think that's what's altering the images on the form he has, you don't really need it.
|
|
|
|
|
PIEBALDconsult wrote: Isn't that just 1 ?
Theoretically, yes. With all the rounding errors in floating-point math, who knows, it could be slightly less and get truncated to zero...
Why make things simple when you can make them look highly scientific?
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
at this time m chking with only 1 LED.
|
|
|
|