Click here to Skip to main content
14,921,612 members

Comments by stixoffire (Top 57 by date)

stixoffire 14-Dec-16 16:58pm View
   
No it can't try using the result set in a secondary SQL statement - so call the stored procedure and then try to use those results in the same SQL Statement - using only SQL. No C#, VB, PHP, etc.. you will find it can not.
stixoffire 16-Oct-16 22:04pm View
   
I know this is late but for others that might be reading.
dgvCaseLst1.ClearSelection() - The selection Changed event will Fire!
dgvCaseLst1.Rows(Pi_CaseIndex).Selected = True , The selection Changed the Event will fire!
This code inside the event handler
dgvCaseLst1.Rows(Pi_CaseIndex).Selected = True
Will not cause a SelectionChanged Event because the selection did not change from the line that set this to begin with. Of course this depends on the order of his calling methods. Do not trigger the same event with in the handler - this is a no no. There is a lot wrong with the code above but that is why he has the event firing like crazy.
stixoffire 22-Oct-15 20:43pm View
   
Did not see that..
stixoffire 1-Sep-15 15:34pm View
   
I had a race condition with WCF. Seems checking state ICommunication obj is not a good thing , yet the examples show this.
I am able to update the UI now I use a threaded binding list, which has it's own SynchronizationContext with send or post back methods ..it works pretty nicely and I was able to transform it into a RollingQueue. My updates take general about 14ms for merging the data initially it was 0 but I had to add some logical checks and handle those so the time went up.
stixoffire 17-Aug-15 17:11pm View
   
Ok I am getting the first part updating data - may not have finished and so it runs the code again (or tries to). To handle this I think maybe I will do this: Run a background worker , if it is busy no need to continue just skip and wait for next push of data . I know in the run worker complete event I can then update the bindingsource.resetbinding(false) and set my values for the scroll position on datagridview.

As for the users ability to scroll the data while it is being updated - how in the world is this accomplished to make it appear seemless (do people cache this and go virtual mode?), my laptop has 8 cores in it an 24GB - the code I have going is consuming 25% of the CPU cycle time. - I only have 30 rows with minimum data.
stixoffire 17-Aug-15 9:14am View
   
There is no timer - it is driven by an event. The event fires and I handle the event. The problem is the datagridview does not maintain position even though I maintain the vscroll and hscroll positions the grid resets back to showing row 1 through visble row x. Instead it should show only the rows in that are visible and not change that unless the user scrolls. Also the user needs to be able to interact with the grid without being locked out. How can I accomplish user interactivity and frequent grid updates?
stixoffire 14-Aug-15 21:00pm View
   
The event comes from a WCF service pushing the data. So I do not have any timers. The data event occurs every 1 to seconds and can be faster, I need to be able to manage the DataGridView updates and manage the User Experience. Just not sure how to do it , with out interfering with the user being able to scroll - since I cannot display all rows at once , maybe I should just page it.
stixoffire 4-Aug-15 20:05pm View
   
Thank you - this is what I was looking for .. I don't know as much as I would like to know so getting advice from more experienced programmers is helpful.
stixoffire 30-Jul-15 9:48am View
   
As you can tell I am learning Entity Framework - and it is really a complex piece of work. I am also learning WCF and it too is pretty involved. The one thing I noticed about EF is it does not like the DataTable and I really love those things - bc they are so easy to work with and have a gazillion things built in. I will put your answer to use. Thank you for your time in answering I really appreciate it!
stixoffire 30-Jul-15 2:11am View
   
Relationship handling was actually my main driver for using EF. I guess I am at a loss regarding Navigation properties - I know I have a template that generated POCOs for me with the relations (I assumed form my reading that these were navigation properties).
In your example code [given my Product is a DTO] , does the db.Products table get magically updated / inserted (in my case they will never already exist in the db) ..because you set the batchproduct.Product = Product?
And is this a typo Batch = batch
stixoffire 23-Jul-15 16:51pm View
   
That sounds interesting , but if I do that - each time I set a property on that dynamic object it is a dictionary lookup -, one of the steps I was looking to avoid. because if it is dynamic, my valueItem has an identifier and I can use valueItem.Identifer so my object would be instantiated with the valueUniqueIdentifier as its name and then setting the values is easy , and when I am done I just update my other class
myOtherClassInstance = (MyOtherClass)MyDynamicObject();
I might save a little time this way but I am not sure..
stixoffire 13-Jul-15 0:48am View
   
In the second article blogs understanding Known Types, this is the conclusion of the article:
After all this talk about known types, you may be surprised to learn that you should try to avoid using known types.
stixoffire 13-Jul-15 0:42am View
   
1st thank you for your answer it is much appreciated. In reading over the article on stack that you have linked to it is really hard for me to follow , I am as you can guess learning WCF and there is a lo to learn, I am also working with 2 other libraries I am trying to learn and make work with WCF being the glue between two applications one is a service and the other Winforms application.
So [ServiceContract] only on the interface not on the class and The behavior attribute will be on the class.
I had heard of the KnownType attribute but thought that was for cross platform communications and not really needed in Windows .NET to Windows .NET applications.
stixoffire 6-Jul-15 11:04am View
   
Yes I found the issue, but why the IDE is tool tipping me about the class needing a reference other than to confuse me I have no idea.
stixoffire 2-Jul-15 20:56pm View
   
I get a null reference exception . My constructor which I did not include in the sample is just a simple empty constructor. So I am sitting at a loss as to why it is null reference except these tooltips in the IDE , I use a Method also that call GetLocalServers which is similar to GetRemoteServers.. My debug seems to jump right past my class method and into a null reference exception. The code compiles with no errors, the app runs to this point and bam .. right now I am using Sharp Develop as Vusual Studio is too expensive for me and the Community Edition limits the things I can do.
stixoffire 2-Jul-15 17:47pm View
   
When I hilite the method: CreateServer(Opc.URL url, System.Net.NetworkCredential credentials) the popup tooltip from the IDE declares and object reference is needed for MY method CreateServer. it is not static this I know, the class it is in is not static either because I want other classes that use it to instantiate an instance before they can use it. The other method ['B'] public Opc.Da.Server CreateServer(string OpcUrl, OpcCom.Factory factory, System.Net.NetworkCredential Credential)
does not give me this tooltip error. I do not have a clue why one behaves as it does and the other not ?
stixoffire 12-Jun-15 17:30pm View
   
Thank you for the help and the time saver , the harder way and not elegant way to do this is create a base form from which all my forms derive from and a base UserControl (I do not think I like the idea - so I am thinking there must be a different way - I like the simple you know UserChanged -event fires (my Form is subscribed) and then my controls on Form/UserControl - change Accessibility .. one Event , one piece of code to do all the labor. Maybe in the subscription I could pass the forms controls to MyAccessClass and then update them and return them back - I am not sure I like that either but maybe it is what I need to do without repeating code in every form under the sun.
stixoffire 12-Jun-15 14:28pm View
   
I understand the first part , what I was meaning is to make a class and have MyForm : Form, MyAccessClass Or MyControl : UserControl, MyAccessClass - My AccessClass providing the methods for the form , somehow setting the controls on either parent such as DataGridView, TextBox to an accessrequired and binding the property to this - is there an easy way to do it ? I know on Textbox I can bind to read only property: I gues what I am after is something a bit more elegant and simplistic so I simply let the ApplicationUser (if that changes from another form - then any open form will update its controls appropriately sensing the user has changed. My UserAccessClass is what would do the work so to speak - just how to do that eludes me.
stixoffire 4-Jun-15 14:32pm View
   
DONT CLICK THE SIMPLE LOGIN PAGE IT IS AN AD PUMPER AND WILL LOCK YOU IN THE PAGE!
stixoffire 30-May-15 6:57am View
   
Is there a difference between duplex services and using callbacks? - they seem to be the same to me, and the example at the link is what I have implemented to test out. What is WCF Data services used for - does it do anything special for me that Duplex Services can't ?
stixoffire 28-May-15 15:15pm View
   
I was expecting something similar to the bindingsource data changes - the DataGridView automagic update by binding to that list, As I have been reading WCF does not work so nice like that. II really do not want to get the whole datasource to send , but only changes so maybe I need to know what indexes in the list changed and send them on the callback and in the receive handle the changedevent . So then I need a better collection object where I can know what items are changed, added, modified , new - and I am thinking a DataTable would have all of that built in , so I do not need to roll my own stuff. Any thoughts as to if this is a good or bad idea ?
stixoffire 28-May-15 12:56pm View
   
Maybe there is no way to do what I would like to do except to use a listchanged event in the service and trigger a WCFCallback that my Client can receive ??? Is that how I need to do this ? I have things working with GetData() but when the "datas" changes I want my Client DataGridView to reflect those changes in close proximity to real time - <200ms or so .
stixoffire 28-May-15 12:20pm View
   
OK so MSDN says I cannot have a DataMember in the service contract thanks for that hint that I am doing something wrong. Now I need to know how to reflect changes of this binding list back to my client - I was preferring not to do GetData repetitively. So I will need to know when that list changes and create a method to trigger an update of the client - I do not know how to have the WCF service update this object in a Winform automagically - unless I need to reference the application.MyObjectList some how to do this.
stixoffire 28-May-15 9:47am View
   
If I use GetData - then I physically need to request it when a change is made to the underlying component. I have a DataGridView that is bound to a datasource (which I do use GetData to fill that bindingsource - but when I add to this Datas - it is there but I do not get the changes reflected back in my DataGridView - so I am trying to bind my bindingsource to this component directly for the changes to be reflected in my client. Am I going about this wrong ?
stixoffire 28-May-15 9:43am View
   
I added the class to the question, yes it is marked and for the life of me I am stumped as to why it is not there - I updated the reference as well - and it is still not showing up.
stixoffire 28-May-15 9:35am View
   
I am trying to get the BindingList to show up in my client app, and so I marked it thinking I will see if the problem is between the chair and the code.
stixoffire 21-May-15 9:58am View
   
As I am looking at this today after a little sleep; there seems to be a problem
My clientID is not representive of the POCO but is representative of a property in the POCO (SensorA).
Given this though you have a valid and important point clientID is an object and currently when I create it I give it a guid for uniqueness; because it must be unique according to the 3rd party library,typical examples use integers.
I could just name my clientID like this GUID.PropertyName
that way I could keep track of Machine[0]= GUID [POCO], its properties would be .Property,
[POCO.Property] and as your example is using a dictionary GUID as key represents machine (POCO), then Property is property of POCO.
I will need some time looking at what you provided this morning as well, I am very excited with what you provided - I never used action nor thought I could use dictionary that way! I think I am getting to where I need to be. Your help is GREATLY Appreciated!!!!! I wish I could give you 10 stars, because this is outstanding!!
stixoffire 21-May-15 1:15am View
   
Just a quick question now that I am reading more about this: I am building my Item[] in a list - which represents one machine, I will have several machines , Machine[] this will be in this client processing class as a property. Getting a quick resolve is obvious to keep track of all machines[] with their clientID[] (list of an array) the dictionary<object, Action<int,machine,object>> , I think I will need to modify with 3 parameters , the index of Machines[index] and modify my setters with the added parameter to get to the index of m[index].SensorA.
Is this the correct way to do it ?
I still can't get over how simple and clean this code is - I have been racking my brain and all my code looked like crud (pardon the pun.)
I can't wait to start coding tomorrow!
stixoffire 20-May-15 23:53pm View
   
I have never worked with Action keyword - so I am looking this up on MSDN and also CodeProject . I like this - it seems so straight forward , clean and simple.
stixoffire 20-May-15 11:25am View
   
I create the Item[] with the clientID, transfer that to the 3rd party server, it send back the ItemValue[] in a callback event - so I can match the two up . Now I need to be able to use this clientID to match it up to a property in my POCO.
stixoffire 20-May-15 11:23am View
   
I create the Item and assign the clientID then add it to the 3rd party servers list of Items[],
1: I can at creation time create a separate dictionary , <clientid,propertyname>
2: I also thought about encapsulating Item and adding the string propertyName, object propertyValue (which I will need to box and unbox), Type dataType.

When any Item of Items[] changes with in the 3rd party server a callback event OnDataChanged is fired with the argument of ItemValues[] (and they are derived from my Items so the clientID property is in the ItemValue) - I can match that up to what I created.

Say for example my POCO represents ItemValues[0-10] (the index 0-10 is an example could be any non sequence as well). I could have 100 or 1000 ItemValues[].

So I need to iterate them correlate them to the POCO Properties and when done my POCO is ready.


In Method 1 I only have a propertyName - I cant say POCO.[Dictionary Key ClientID, Property] = ItemValue.Value (would be very nice though).

In Method 2 I could iterate ClientId and set my PropertyValue to the ItemValue, but then I still need to translate the PropertyValue into the Poco object

Of course maybe I should make a DataTable of the POCO which would leave the row for me to know what client IDs make up that row. [Perhaps dictionary<rowid ,clientid="">]
So I would have ROW[0].Column[dictionaryLookup<clientid, propertyname="">] = ItemValue.Value

Basically I have a collection of objects with a property value that represents the POCO , or should I build my collection of Item[] as if it was the POCO, using the setter to update the property - I am at a loss - because I want to store data in database and also to use WCF to automagically display the real time info in a datagrid on a winform.


I know I need to Iterate the collection ItemValues[], look up the clientID some how and map back to the POCO property. The more generic the better. The simpler the better .

I hope this makes it more clear.
stixoffire 18-May-15 17:53pm View
   
I definitely would like to see that generic dual dictionary. I have to say IMO it sure looks a little bit hackish to have to do things this way, I know this has got to be a common problem especially when mapping components, I have ClientID, ClientValue and A PropertyName, value that I certainly would like easily map one for one, where PropertyName Would have its ID mapped to the ClientID, so Ican easily set the value when my ClientValue is returned with only the ClientID and the Value . 3rd party library.. aargh for me.
stixoffire 15-May-15 16:39pm View
   
I set it as a get.
stixoffire 15-May-15 16:17pm View
   
I have a get Accessor is expected on the foreach , is this supposed to be a get property?
stixoffire 15-May-15 16:10pm View
   
for fast lookup to change a value, maybe I could do this and also with a dictionary for the lookup. Dictionary<key, list="">
Both your answer and PIEbalds are helping me alot - I think yours encapsulates the objects nicely. I will do some working with this and see what happens as it seems simple enough to test out.
stixoffire 15-May-15 16:02pm View
   
Your app changes the values , and you see those changes reflected in Winform without rebinding ? I am liking this to some extent b/c dictionary has fast lookup.
stixoffire 15-May-15 15:18pm View
   
I was looking at Dictionary - should I use one for each ItemValue and Item - keying on the UniqueID, and then how to associate that with the propertyName - another dictionary ?
So basically I am joining these objects, and looking up an item so I can change a value with info from from a continuously running process, and have those changes in the dictionary reflected in my bound control ..
stixoffire 6-May-15 10:38am View
   
I have always used the POCO method for DB access, although I have seen XSD files for datasets - I never wrote them myself, they were generated by the IDE - I think when I was using Visual Studio and if my memory is any good here I think studio had a designer for them , just not sure. If you have an example of Which would most likely be easiest and best for me given my experience level and my rust, that would be fantastic.
stixoffire 5-May-15 22:13pm View
   
My DAL is more or less a hard code of the objects which need to be saved to the database, although I am in the planning stages of it, I had the option to use entity framework but it seems there is a learning curve there for me. I have not installed the entity framework tool , and am using sharpdev 5 to do this - it will do some entity framework set up but not really what I see online that people tend to use. [and I am sure there are good reasons the majority stick to a certain way of using that framework.] I thought about going to a very simplistic architecture just because the app is not super data intensive - and I am familiar with it.. doodads and can easily autogenerate the layer.
Any advice , hints etc is very much appreciated, I am somewhat of an intermediate coder - but very rusty; I am picking up after over 5 years out.
stixoffire 1-May-15 16:14pm View
   
So what you are saying is a separate table with name, value, type and relate that to the "primary" table as additional fields so then I can do as they wish ? My DAL will need to incorporate a dynamic property as well.
Using the variant column - I can then just use 2 fields name and value and must make sure the right datatype goes in?
I have to say it sounds like some work in my DAL for me to implement this.
stixoffire 30-Apr-15 9:40am View
   
I know that if I get a callback I can write code to update the client, but what I am looking for is more automagic. For example I have code that communicates with a server that pumps out data, that data might have a change event or something and I manage the info from that into some classes (objects) that on some I keep a list<t> of, others are just that an object class, I want to bind my client to the WCF service object or list<t> objects and have the gui in the client automatically update from the WCF service as my bindingsource.
stixoffire 9-Apr-15 16:04pm View
   
Thank you Sergey!
stixoffire 9-Apr-15 16:03pm View
   
The user selects the group of nodes. My code will invert the selection.
stixoffire 9-Apr-15 12:06pm View
   
I have not tried anything as yet, I am looking at XML , and thinking to get the document, get the nodes of interest (via a tree or list view of selected nodes, and trying to make sure I am only getting those nodes in the tree that are of interest [selected] , get xml nodes as a collection that corresponds to the selection, allow the inversion of node sequence then rewrite the document (or should I simply get the xml and use a replace function). The reason for this is there is a program that exports in XML and based on the node position - sets the elements in the node sequence position .. so doing a simple inversion can take some time when doing this repetitively. Am I thinking about this the correct way or is there a better way to do it ? I do not need a bunch of code, I can write that myself - I just need some direction on the best way to go about it.
stixoffire 8-Apr-15 11:23am View
   
I must do more reading on strong names and GAC - now the GAC and strong names finally makes some sense! Reading your other post on separating classes by topics and by layers, I somewhat understand what you are saying and that helps ALOT! (thanks); the Layers well some things are obvious, others are not so obvious (I will make mistakes for sure). Since the 3rd party dlls are used by several vendors it is possible the wrong dlls could be in GAC, so if I create my own SN assembly with the 3rd party dlls [https://msdn.microsoft.com/en-us/library/s1sx4kfb%28v=vs.110%29.aspx] this should work work and keep me from having an issue with another 3rd party product being installed and changing dll's - I was thinking simply to place them in a single folder called lib in my installation and trying to force the reference locally to lib.
stixoffire 8-Apr-15 10:00am View
   
Reference an exe (just found that out) because I could get toolbox items from an executable. Since I had only one assembly file in the solution I thought that was it, assembly just said something about the dll [guess my understanding was short]. Wouldn't have a clue as to how to build a library with multiple assemblies- will research that one just to learn. Some things are not clear to me, perhaps what I wrote is not entirely accurate, so when I add to studio a reference I look for the dll to add - I am referencing an assembly with in it (this is where my question was in regards - but you bring up a lot of topics which I thank you for. Now I do understand in the using statements (imports in VB) I am referencing those namespaces.
As for moving classes around - I am not sure I understand - I do not want to have the same class in every project as I would need to make changes in each project that used that class in order to maintain it - so I wanted to place it in a library where I would have one place to maintain. I wish in my programming classes they taught these concepts but they did not (they taught methods, classes and a bit of how to and that was it), my law classes taught 4 basic questions regarding legal cases and did that repetitively until your thought process was in those terms.. I think I will need to put what you wrote in some kind of format that I can ask myself until my thought process for code writing lines up with that format.
stixoffire 21-May-14 23:25pm View
   
The regex was fine but as I said there are conditions that it did not handle well - the negative look behind actually worked fine.
stixoffire 21-May-14 10:21am View
   
I think this is working (?<!\\)d01 where d01 is the literal text I am looking at and it can be d01xyzwhatever - I will try this out and see how well it does .. Thank you for this I had read about negation on a website but it was so poorly explained (even the examples) that I could not make heads or tales of it.
stixoffire 21-May-14 10:15am View
   
This does eliminate the \typeA but it selects {typeA and I do want this selection excluding the { - so all typeA I want to be able to change but EXCLUDE it if it is preceded with the \ so I would select only typeA regardless of what precedes it EXCEPT and UNLESS the preceding character is \ in which case I do not want typeA at all.
stixoffire 21-May-14 9:52am View
   
Specifically the typeA is a prefix of a number of different words - but the words prefixed with \ is always the one that I do not want to change.
stixoffire 16-Apr-14 10:02am View
   
sergey thanks for your response - but I think you misinterpret what I was looking for, I am not monitoring a thread but a process using a separate thread - for example communication from a network it is continually listening for this data to come across and on a change of certain data an event will fire. This process must run continuously while the application continues other work. I am guessing that some chat programs out there might have an asynchronous communication or perhaps FTP so I am looking for more information.
stixoffire 16-Apr-14 10:00am View
   
Your solution seems to be on the path that I am looking at. Since the thread that is monitoring another process i.e data arriving via a network. when a particular data point changes that thread fires an event, since the thread fired the event the event is considered on that thread. Now I wish to use that event to activate a different thread [process] updating a database, sending data across a network. So what you are saying is I do not need to use callbacks - I can simply call an asynchronous thread let it run to its hearts content, and everytime it has an event ; it will fire my event in the class that called the thread - and I can do other work.
stixoffire 23-Jan-14 21:12pm View
   
I will try this either tomorrow or Saturday, this looks like it will do exactly what I need. Yes I do have a way to get the root item. I have a small question basically creating the added class to contain the representation is what is at the nuts and bolts of making the code work for the model? [Things are only hard when you are learning.. aargh] Thank you.
stixoffire 23-Jan-14 16:56pm View
   
Thank you for your replies; I might be overlooking something here or overthinking , but if object n does not contain the getItems(server, root) method can I use just the method call, nn.name is the root that I am passing to each of these methods but nn does not exist in the context .
stixoffire 23-Jan-14 14:17pm View
   
This seems closer and simpler to answer your question about flattening, no I would like to gather in the objects as they are in the object itself. I am presenting the visualization of those objects (imagine a blackbox that you would like to know what is in there) ; so the blackbox contains the objects in a hierarchical structure and I want to visually represent them. My hangup has been recursion as you mentioned because each of the items or branches could have items or branches and I had these two fixed methods that I had to use to do the recursion. Yes you are also correct I do not wish to loop forever. I will try your code and see if that does the trick for me - I have not used LINQ but I see it can be pretty powerful from your example. almost forgot - yes I would be returning the table built from the recursion.
stixoffire 23-Jan-14 12:33pm View
   
I updated the question to provide some clarity , because I have two methods for getting the object collections [which I cannot change] (GetBranch, GetItem) there is no GetAll , Branches can have items and items can have branches. So I am not sure how to recurse that structure , it seems like your method of using a stack might be the direction I need to go, but it almost seems as if I will need to keep track somehow.
stixoffire 23-Jan-14 11:24am View
   
Yes I read these two articles and I am still a bit at a loss. Most of the recursion examples I have read go back to showing code for a structure like Directories and files - which is good except if you can imagine all my objects are the same with exception they can be flagged as Item or NotItem[branch] and all of these can have children or not and the children can be either branch or item , many to many not just one to many and to build a datatable of these objects showing relationship seems to allude me. If it was just one to many that part is simple. my pseudo code is GetBranches if HasChildren GetBranches, GetItems - I do not have a way to simply get all (Branches and items) , I have to request either a branch or an item and then test for children and recurse - if I could get all - much easier.. I am trying to build a Parent Child relationship model form the objects