|
yes the time out takes 4 secs, i have given 2 secs for testing ... actually on successful ping checking for ping i am trying to get some basic details of that ip using WMI.WMI is taking some time also if its not enabled.
for (int index = startIP; index <= EndIP; index++)
{
ipVal = startSubnet + "." + index.ToString();
Thread wmithread = new Thread(() => PerformWMIOperation(ipVal.ToString().Trim(), txtUserName.Text.ToString().Trim(), txtPassword.Text.ToString(), txtDomain.Text.ToString(), dtAssetValues, chkImpersonate.Checked, recordnumber));
wmithread.Start();
wmithread.Join(2500);
}
|
|
|
|
|
Ok, not like that. Don't, "for every thread, start it, then join it". That just runs everything in serial. Do, "for every thread, start it. Then, for every thread, join it." That's how I said it: start them all then join them all.
|
|
|
|
|
Hi i did not understand do you want the code to be changed to
for (int index = startIP; index <= EndIP; index++)
{
ipVal = startSubnet + "." + index.ToString();
Thread wmithread = new Thread(() => PerformWMIOperation(ipVal.ToString().Trim(), txtUserName.Text.ToString().Trim(), txtPassword.Text.ToString(), txtDomain.Text.ToString(), dtAssetValues, chkImpersonate.Checked, recordnumber));
wmithread.Start();
wmithread.Join();
}
|
|
|
|
|
That wouldn't help. The problem is this:
superselector wrote: wmithread.Start();
wmithread.Join(); That's like calling that ping operation without a thread, except this way resources are wasted as well. Or to put it differently, it's like hiring a team to play a game of monopoly, in order to do it faster. That doesn't work. If everyone takes turns anyway, you might as well do it by yourself.
You need an array of threads. Fill the array, start them all, then, and only then, join them all.
Besides, what's with the WMI stuff? Do you need something that the Ping class[^] can't do?
|
|
|
|
|
can you please give a sample code to implement this
|
|
|
|
|
Ok.. it's not that hard though.
Thread[] threads = new Thread[something];
for (int i = 0; i < threads.Length; i++)
{
threads[i] = new Thread(something);
threads[i].Start();
}
for (int i = 0; i < threads.Length; i++)
threads[i].Join();
|
|
|
|
|
hi with this approach , I am missing data .. means i am not getting output for all the IPs
|
|
|
|
|
The ip address is getting overlapped. Means two rows are having same ip address.
|
|
|
|
|
Did you forget to use synchronization when saving the result?
|
|
|
|
|
If you have a multi-core processor you can consider using Parallel.ForEach .
It could lead to another set of issues with concurrency, but you will be able to run a loop faster.
|
|
|
|
|
Question.
Why are you calling a method that generates an individual row?
Yhy not get all the data required at once and then populate the datatable?
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
HI everyone,
Thanks for you replies.I had never used thread before hence i had very little idea about multi-threding.I have removed the sleep inside the method as i found that it is not helping the cause.
|
|
|
|
|
I want to know enterprise application completely because i am going to switch in another company. i have not worked at any enterprise application. i want to learn ERP base application. please help me how i should start to learn so that i can completely learn ERP base application and make an advance level ERP base sample application.
if some one have some sample code and some suggested website and book then please let me know.
|
|
|
|
|
Yeah, the only thing that makes an "enterprise" application "enterprisey" is the size of the application. There's nothing different between that and a "normal" application, or even something like Notepad. In the end, you're still just breaking a large problem down into smaller and smaller pieces and writing code to solve each little tiny problem.
There is no single website that's going to walk you through all of this stuff. The only thing that's going to teach you how to make an "advanced level" app is experience, trial and error, and making mistakes. Lots of them.
|
|
|
|
|
Dear Dave Kreskowiak,
Really i am happy to read your reply, but can you list the content topics in a sequence such that it will help me to cover it very short duration. I mean from which topic i should start and keep my self move ahead, in such a way it create less confusion for for me.
Can you please suggest me some website for it and can you send me some sample application with code and explanation. Just start from much basic application based on ERP. My E-mailId is amitteshwar@gmail.com
Thanks
Amit Teshwar
|
|
|
|
|
Member 8824417 wrote: can you list the content topics in a sequence such that it will help me to cover
it very short duration
Yeah, right. You don't get it. ERP systems covers such a huge range of disciplines, applications and systems, that there is no list! You're NOT going to learn how to design enterprise systems in a couple of weeks. This takes years of experience developing all kinds of systems or all different sizes.
Member 8824417 wrote: Can you please suggest me some website for it
There is no one website. There is no one books. ERP systems are about the largest, most complex computer systems you can come by in an enterprise, spanning an entire enterprise, usually touching every corner of the business processes in a company. These systems are not just one application. They are suites of applications, spanning a large range of technologies and languages.
In other words, there's no such thing as an "example" ERP system. There is no such thing as a "simple" explanation for one of these systems.
...and the only people who will every send you an email are the spam bots that troll websites looking for newbies like you who are dumb enough to post your email address in a public forum.
|
|
|
|
|
Hello,
I am trying to implement DataLogic OPOS driver. In this dll I have function to connect to device:
int OpenService(string DeviceClass, string DeviceName, object pIDispatch);
Unfortunately vendor documentation is miserable. Can you help me with this last parameter. What is this? If I understand it correctlly it is an instance of class which will react when device will scan data.
m.
|
|
|
|
|
The device is DataLogic qw2100
|
|
|
|
|
What on earth makes you assume that we will know more than the manufacturer?
You should talk to the people who created it - they should provide technical support and will know more about their product than we will. If they don't, then find another supplier and demand your money back!
If you don't tell them that their "documentation is miserable" how do you expect them to improve it?
The only instant messaging I do involves my middle finger.
|
|
|
|
|
Hello,
I'm writing a class(MyClass) that have a subclass(Item) and a property of List of that subclass(List<item>).
MyClass have a property with name "CurrentItem " that returns required Item.
My class is like this:
public class MyClass
{
private DataTable _mainDataTable;
private List<Item> _items;
public class Item
{
public Item()
{
}
public int Id { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public bool Enabled { get; set; }
}
private MyClass()
{
}
public DataTable MainDataTable
{
get
{
if (_mainDataTable == null && _items != null)
_mainDataTable = _items.ConvertToDataTable<Item>();
return _mainDataTable;
}
set { _mainDataTable = value; }
}
public List<Item> Items
{
get
{
if (_items == null && _mainDataTable != null)
{
_items = _mainDataTable.ConvertToListOfItems<Item>();
}
return _items;
}
set { _items = value; }
}
public int CurrentItemIndex { get; set; }
public Item CurrentItem
{
get
{
if (Items == null || Items.Count == 0 || CurrentItemIndex + 1 > Items.Count)
return new Item();
return Items[CurrentItemIndex];
}
}
}
And this code is an example of using it:
Myclass obj=new Myclass();
int id=obj.CurrentItem.Id;
My problem is: I don't know that is there any way to access properties of CurrentItem directly without writing CurrentItem . like this code:
Myclass obj=new Myclass();
int id=obj.Id;
Is there any way to do this?
Thanks
h.goli
|
|
|
|
|
H.Goli wrote: Is there any way to do this? Create a property called "Id" in MyClass and have it return the Id of the CurrentItem object?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Several things in your code "jump out at me" as kind of ... confusing:
1. you made the constructor of MyClass private: so you cannot create a new instance of MyClass. Since MyClass is not a static class, the dance will never begin.
2. so, changing the access modifier to MyClass' ctor to 'public, and creating a new instance of 'MyClass:
a. you have not created any instances of the Item class simply by creating an instance of 'MyClass ... there's nothing inherently wrong with that.
b. the Items collection in _items will be null ... nothing wrong with that.
3. MyClass does have a 'CurrentItem property which will contain null when instances of MyClass are created.
a. but when you access 'CurrentItem, which only implements a 'get: if your internal List<Item> is null: it will create a new Item and return it, but none of that instance of Item Class has its internal fields initialized.
4. the only other means by which I see in your code creates instances of the 'Item class is provided by code you do not show in your question here, via a call to what looks like an extension method on the DataTable Object: _items = _mainDataTable.ConvertToListOfItems<Item>
Since multiple instances of the 'Item class are, obviously going to be created: with the way you have your code structured now, you can only access the Properties of the last created instance of 'Item via the 'CurrentItem property, or by selecting an instance of 'Item in your List<Item> stored in _items.
So to answer your question, specifically, yes, you can execute int id=obj.CurrentItem.Id; as you show, just after you create an instance of 'MyClass (if you change the ctor to 'public), and id will be set to #0, because your invocation of 'CurrentItem caused a new instance of 'Item to be created, and an integer variable will have a default value of #0 when an instance of a class is created.
Big picture: it looks to me like your code needs some strategic re-thinking, about which I can't comment since I don't understand your exact goals here.
As the code is now (once the ctor of 'MyClass is set to public access) I can create an instance of the 'Item class without creating an instance of 'MyClass: do you really want to allow that to happen ?
Google CEO, Erich Schmidt: "I keep asking for a product called Serendipity. This product would have access to everything ever written or recorded, know everything the user ever worked on and saved to his or her personal hard drive, and know a whole lot about the user's tastes, friends and predilections." 2004, USA Today interview
|
|
|
|
|
I am totally new to c#, need urgent help to parse this xml. I want to extract all attribute and node values and load it to data tables so that i can load to sql tables later.
<?xml version="1.0" encoding="utf-8"?>
<Response>
<OrganizationTable maxtimestamp="20121009_100244427" moredata="yes">
<Organization preferredid="4295384274" operation="U">
<ActiveDebtInstrumentCount>0</ActiveDebtInstrumentCount>
<ActiveEquityInstrumentCount>0</ActiveEquityInstrumentCount>
<ActiveInstrumentCount>0</ActiveInstrumentCount>
<AdminStatus>Published</AdminStatus>
<BusinessIntelligenceExists>0</BusinessIntelligenceExists>
<CommonName>Government Capital Corp</CommonName>
<CommonNameLanguageID>505062</CommonNameLanguageID>
<DebtInstrumentCount>0</DebtInstrumentCount>
<DocumentsExist>0</DocumentsExist>
<DomiciledInGeographyID>100319</DomiciledInGeographyID>
<EFXId>10823945</EFXId>
<EntityLastReviewedDate>2013-06-28T04:00:00</EntityLastReviewedDate>
<EquityInstrumentCount>0</EquityInstrumentCount>
<FilingsExist>0</FilingsExist>
<GemAlphaNumericID>CT01Z1CZPU</GemAlphaNumericID>
<HasBusinessDescriptionInVFDB>1</HasBusinessDescriptionInVFDB>
<HasDeals>0</HasDeals>
<HasFinancials>0</HasFinancials
><HasFinancialsInVFDB>0</HasFinancialsInVFDB>
<HasIndustryCodeInVFDB>1</HasIndustryCodeInVFDB>
<HasOwnership>0</HasOwnership>
<HasProfileInVFDB>1</HasProfileInVFDB>
<PrefImmediateParentOrganizationID>4295384274</PrefImmediateParentOrganizationID>
<ImmediateParentOrganizationID>4295384274</ImmediateParentOrganizationID>
<IncorporatedInGeographyID>100319</IncorporatedInGeographyID>
<InstrumentCount>0</InstrumentCount>
<IsCapitalMarketsActive>0</IsCapitalMarketsActive>
<IsFundSupportCompany>0</IsFundSupportCompany>
<IsIndexConstituent>0</IsIndexConstituent>
<IsOrganizationManaged>1</IsOrganizationManaged>
<IsOrganizationVerified>1</IsOrganizationVerified>
<IsPublic>0</IsPublic>
<LegalName>GOVERNMENT CAPITAL CORP.</LegalName>
<LegalNameLanguageID>505062</LegalNameLanguageID
><MXID>108985413</MXID>
<NDAOrganizationType>CO</NDAOrganizationType>
<NDAOrgID>107972635</NDAOrgID>
<OfficersDirectorsExist>0</OfficersDirectorsExist>
<OrganizationFoundedDay>6</OrganizationFoundedDay>
<OrganizationFoundedMonth>11</OrganizationFoundedMonth>
<OrganizationFoundedYear>1992</OrganizationFoundedYear>
<OrganizationID>4295384274</OrganizationID>
<OrganizationJurisdictionOfIncorporationTypeCode>477</OrganizationJurisdictionOfIncorporationTypeCode>
<OrganizationNodeType>STANDALONE</OrganizationNodeType>
<OrganizationParentTypeCode>SELF OWNED</OrganizationParentTypeCode>
<OrganizationPI>17768471</OrganizationPI>
<OrganizationProviderTypeCode>1</OrganizationProviderTypeCode>
<OrganizationStatusCode>Act</OrganizationStatusCode>
<OrganizationSubTypeCode>COR</OrganizationSubTypeCode>
<OrganizationTypeCode>COM</OrganizationTypeCode>
<OrganizationWebsite>http://www.govcap.com/about-gcc#!__about-gcc</OrganizationWebsite>
<PEBackedStatus>Never</PEBackedStatus>
<RCPID>600317805</RCPID>
<RegistrationNumber>0124957400</RegistrationNumber>
<RoleToIssueStatus>AC</RoleToIssueStatus>
<SignificantDevelopmentsExist>0</SignificantDevelopmentsExist>
<SubsidiariesCount>0</SubsidiariesCount>
<TaxID>752462160</TaxID>
<TotalScore>13.00</TotalScore>
<TRBCPrimaryIndustryID>4294951354</TRBCPrimaryIndustryID>
<PrefUltimateParentOrganizationID>4295384274</PrefUltimateParentOrganizationID>
<UltimateParentOrganizationID>4295384274</UltimateParentOrganizationID>
</Organization>
</OrganizationTable>
</Response>
|
|
|
|
|
Well Google[^] has many, many working solutions. The very first[^] one looks promising.
|
|
|
|
|
I did go through the google, but it was very confusing for me since I am very new to c#. I am not familiar with linq or xmldocument or....so couldnt exactly makeout which approach to take.
|
|
|
|