BoincView - Replacement part 2

Message boards : Number crunching : BoincView - Replacement part 2
Message board moderation

To post messages, you must log in.

AuthorMessage
Profile Mike O
Avatar

Send message
Joined: 1 Sep 07
Posts: 428
Credit: 6,670,998
RAC: 0
United States
Message 884586 - Posted: 12 Apr 2009, 15:23:23 UTC

Yes.. the IL and JIT compiling. I read a great deal about this, John.
It has some huge advantages when trying to port code to other systems.

I used your advice. I redid the parsing using movotofollowing and then reading the .innerXML as a string. It is MUCH faster than searching a block using my slow Instr search method.

Now that I have a datatable created and bound to a datagridview object, Im trying to turn the prasing in to a thread. There are so many things that need designed and implemented, this project is starting to become overwhelming.
I really need to start writing sudo-code again so I can at least get a grasp of what needs to happen before I dive in.

Here's a few questions maybe someone can help with.
Is a datatable object considered part of the UI control it its defined using the data designer? If so any threadng that changes it needs special coding.
Is it safe to call other subs and functions that are inside the form's class? It seems to me that as long as no other calls are made while being called by a thread, it should be safe but I may be wrong on this. What about other functions like socket calls? I guess I need to read and study this before I go on to much more. All the data needs to be delt with in threads. The UI as I mentioned before, comes to a halt during the processing of RPCs. Races and/or deadlocks are already showing up. My code looks ok but its locking. I think it has to do with accessing the datatable object.

Here's a twist.. I may bag the VB and head to Managed C. Its been some time since I have programmed in C or C++. YIKES!
BUT.... This all depends on how the basics of the VB coding performance is.

Thanks for the input John :)
--Mike
Not Ready Reading BRAIN. Abort/Retry/Fail?
ID: 884586 · Report as offensive
John McLeod VII
Volunteer developer
Volunteer tester
Avatar

Send message
Joined: 15 Jul 99
Posts: 24806
Credit: 790,712
RAC: 0
United States
Message 884462 - Posted: 12 Apr 2009, 3:04:43 UTC - in response to Message 884160.  

1) Use an XML parser. MSXML has 2 types of functions - linear time and n^2 time. Use the first child, next sibling to scan the XML. Do NOT use the find by name functions.

2) Parse the data into structures that you write. You should have one for at least the following Host, Project, Task, and I am certain that there are others.

3) The tag item in tree, list, and grid views is your friend. You get one per row. Use it to contain a pointer to the object for that line.

This is about as efficient as you can get. Yes, there are some order n^2 operations, but it minimizes n.


Thanks for the info John.

This is where I am now..
I have a xml parser.. way crappy.. I will see what I can do with using your input.
I managed to get a bargraph working.. sorta cool but needs much more tweeking.
I really do need to speed up the parsing and also turn it in to a thread. The UI is all but frozen while its parsing.

I myself and not real efficient in C++. I can learn. From what I understand, programming in .net using VB or managed C, the results as far as speed are the same. Its all about optomizing the source code. Bad coding is just bad and in any language, It's not going to run worth a crap.

Thanks again John.

--Mike

There are a few extra fun bits with .NET. It is Compiled Just In Time. So, the first time any code path is run, the performance is going to stink.

Interpreted languages are, in general, much slower than compiled languages, even for exactly the same algorithm.

But, you are rignt, picking the right algorithm is much more important than the choice of language. Choosing a linear algorithm as opposed to a 2^n algorithm is far more important than whether it is implemented in C or Pascal or BASIC.


BOINC WIKI
ID: 884462 · Report as offensive
Profile Mike O
Avatar

Send message
Joined: 1 Sep 07
Posts: 428
Credit: 6,670,998
RAC: 0
United States
Message 884160 - Posted: 11 Apr 2009, 2:37:58 UTC
Last modified: 11 Apr 2009, 3:35:30 UTC

1) Use an XML parser. MSXML has 2 types of functions - linear time and n^2 time. Use the first child, next sibling to scan the XML. Do NOT use the find by name functions.

2) Parse the data into structures that you write. You should have one for at least the following Host, Project, Task, and I am certain that there are others.

3) The tag item in tree, list, and grid views is your friend. You get one per row. Use it to contain a pointer to the object for that line.

This is about as efficient as you can get. Yes, there are some order n^2 operations, but it minimizes n.


Thanks for the info John.

This is where I am now..
I have a xml parser.. way crappy.. I will see what I can do with using your input.
I managed to get a bargraph working.. sorta cool but needs much more tweeking.
I really do need to speed up the parsing and also turn it in to a thread. The UI is all but frozen while its parsing.

I myself and not real efficient in C++. I can learn. From what I understand, programming in .net using VB or managed C, the results as far as speed are the same. Its all about optomizing the source code. Bad coding is just bad and in any language, It's not going to run worth a crap.

Thanks again John.

--Mike
Not Ready Reading BRAIN. Abort/Retry/Fail?
ID: 884160 · Report as offensive
John McLeod VII
Volunteer developer
Volunteer tester
Avatar

Send message
Joined: 15 Jul 99
Posts: 24806
Credit: 790,712
RAC: 0
United States
Message 884107 - Posted: 11 Apr 2009, 0:05:59 UTC - in response to Message 883828.  



Question: Could you use some help programming? What language are you coding in?


Hey John..
I'm using Visual Basic .net.. version 9 I believe.
There are some areas I may need help with..
I can get the data back from the core client but I'm struggling with finding the best and fastest way to bind the data to a DataGridView object.
What do you know about this John?
Thanks
--Mike

I am very good at c++. I don't know VB very well as the last time I really used Basic was about 30 years ago.

However, there are efficient ways of dealing with the XML data, and inefficient ways, and very ineffecient ways.

1) Use an XML parser. MSXML has 2 types of functions - linear time and n^2 time. Use the first child, next sibling to scan the XML. Do NOT use the find by name functions.

2) Parse the data into structures that you write. You should have one for at least the following Host, Project, Task, and I am certain that there are others.

3) The tag item in tree, list, and grid views is your friend. You get one per row. Use it to contain a pointer to the object for that line.

This is about as efficient as you can get. Yes, there are some order n^2 operations, but it minimizes n.


BOINC WIKI
ID: 884107 · Report as offensive
Profile Mike O
Avatar

Send message
Joined: 1 Sep 07
Posts: 428
Credit: 6,670,998
RAC: 0
United States
Message 883965 - Posted: 10 Apr 2009, 15:54:01 UTC - in response to Message 883890.  

I have no programming experience, but I would be happy to help with alpha / beta testing.

Sure thing.. once it gets that far :)
--Mike
Not Ready Reading BRAIN. Abort/Retry/Fail?
ID: 883965 · Report as offensive
Profile Mike O
Avatar

Send message
Joined: 1 Sep 07
Posts: 428
Credit: 6,670,998
RAC: 0
United States
Message 883961 - Posted: 10 Apr 2009, 15:44:32 UTC
Last modified: 10 Apr 2009, 16:15:07 UTC

[quote]personally im not a fan of multi dimensional arrays. mostly because sorting and search through them is tedious. where a simple datatable.select or datatable.sort make it so easy.{/quote]

I opted out of using muti dimensional arrays. Like you said, too tedious.
I wound up shoving the data info an datatable. Its easy to bind that table to the datagridview object.
Is it possible to add a tabledata object to a structure?
My goal is to try to build a single dimension array of structures. Each structure in the array being a container so to speak for all the data related to a core client (or host). I think this approuch will make it easier to reuse all the functions to.. get the data, create the tables, setup timer events and keep track of other things like host groupings, color schemes.. and such.

As far as getting the source.. In time that wont be a problem. Right now, Im trying to just deal with getting the major functions created. Mostly buttons that test the code. Once that is done, It will be time to move on to addressing the timers and building the UI. My method of programming has always be to get the main functions done and fine tuned then write the code to work with them.

I found some code that adds the ablility of having a progess bar in one of the datagridview's columns. The problem is I can't figure out how to add it using a tabledata object. Im still playing with that.

If you wnat to help slozomby, the best I can offer is to post some of the code via PM and let you creat some uses for it. For one, I need to be able to keep track of the timers for each host. I want to be able to update host data only as the user wants for each host. Much like boincview does. This is a cool feature if you have tons of computers to monitor as you can reduce the network usage but still update the hosts that you are worried about.

I also need to parse as fast as can be done, I'm good at SQL. Its real straight forward but I have not worked with XML parsing in VB let alone VB.NET

When I send a command to a client <get_results>, I get back this xml:
<boinc_gui_rpc_reply>
<results>
<result>
    <name>11fe09aa.29065.390563.13.8.157_1</name>
    <wu_name>11fe09aa.29065.390563.13.8.157</wu_name>
    <project_url>http://setiathome.berkeley.edu/</project_url>
    <final_cpu_time>1961.797000</final_cpu_time>
    <exit_status>0</exit_status>
    <state>5</state>
    <report_deadline>1241323339.000000</report_deadline>
    <estimated_cpu_time_remaining>0.000000</estimated_cpu_time_remaining>
    <ready_to_report/>
    <completed_time>1239318646.390625</completed_time>
</result>
<result>
    <name>10fe09ab.12700.9070.6.8.0_2</name>
    <wu_name>10fe09ab.12700.9070.6.8.0</wu_name>
    <project_url>http://setiathome.berkeley.edu/</project_url>
    <final_cpu_time>274.484400</final_cpu_time>
    <exit_status>0</exit_status>
    <state>5</state>
    <report_deadline>1241297562.000000</report_deadline>
    <estimated_cpu_time_remaining>0.000000</estimated_cpu_time_remaining>
    <ready_to_report/>
    <completed_time>1239316251.609373</completed_time>
</result>
<result>
    <name>11fe09aa.13001.72.14.8.26_1</name>
    <wu_name>11fe09aa.13001.72.14.8.26</wu_name>
    <project_url>http://setiathome.berkeley.edu/</project_url>
    <final_cpu_time>131.593800</final_cpu_time>
    <exit_status>0</exit_status>
    <state>5</state>
    <report_deadline>1241324641.000000</report_deadline>
    <estimated_cpu_time_remaining>0.000000</estimated_cpu_time_remaining>
    <ready_to_report/>
    <completed_time>1239317461.437500</completed_time>
</result>
<result>
    <name>11fe09aa.13001.72.14.8.45_1</name>
    <wu_name>11fe09aa.13001.72.14.8.45</wu_name>
    <project_url>http://setiathome.berkeley.edu/</project_url>
    <final_cpu_time>3209.485000</final_cpu_time>
    <exit_status>0</exit_status>
    <state>5</state>
    <report_deadline>1241324641.000000</report_deadline>
    <estimated_cpu_time_remaining>0.000000</estimated_cpu_time_remaining>
    <ready_to_report/>
    <completed_time>1239319829.609373</completed_time>
</result>
<result>
    <name>11fe09aa.13001.72.14.8.46_0</name>
    <wu_name>11fe09aa.13001.72.14.8.46</wu_name>
    <project_url>http://setiathome.berkeley.edu/</project_url>
    <final_cpu_time>127.562500</final_cpu_time>
    <exit_status>0</exit_status>
    <state>5</state>
    <report_deadline>1241324641.000000</report_deadline>
    <estimated_cpu_time_remaining>0.000000</estimated_cpu_time_remaining>
    <ready_to_report/>
    <completed_time>1239320068.265625</completed_time>
</result>
<result>
    <name>11fe09aa.13001.72.14.8.34_0</name>
    <wu_name>11fe09aa.13001.72.14.8.34</wu_name>
    <project_url>http://setiathome.berkeley.edu/</project_url>
    <final_cpu_time>0.000000</final_cpu_time>
    <exit_status>0</exit_status>
    <state>2</state>
    <report_deadline>1241324641.000000</report_deadline>
    <estimated_cpu_time_remaining>1458.542161</estimated_cpu_time_remaining>
<active_task>
    <active_task_state>1</active_task_state>
    <app_version_num>608</app_version_num>
    <slot>4</slot>
    <scheduler_state>2</scheduler_state>
    <checkpoint_cpu_time>2008.297000</checkpoint_cpu_time>
    <fraction_done>0.614969</fraction_done>
    <current_cpu_time>2016.985000</current_cpu_time>
    <elapsed_time>2329.640627</elapsed_time>
    <swap_size>45744128.000000</swap_size>
    <working_set_size>37326848.000000</working_set_size>
    <working_set_size_smoothed>37326848.000000</working_set_size_smoothed>
    <page_fault_rate>0.000000</page_fault_rate>
</active_task>
</result>
</results>
</boinc_gui_rpc_reply>

If you want to copy and past that into a form to play with, that would be cool.
I cut out most of the returned XML because of the size but note that there is a child node inside of any <result> that is active called <active_task>.
This MUST be parased as well in any method that is used.
What im doing now is: (this is a stripped down chunk)
        Dim document As XPathDocument = New XPathDocument(str_data) 'the xml above
        Dim navigator As XPathNavigator = document.CreateNavigator()

        navigator.MoveToChild(XPathNodeType.Element)
        navigator.MoveToChild(XPathNodeType.Element)
        navigator.MoveToChild(XPathNodeType.Element)
        While navigator.MoveToNext
            work_unit = get_inner_xml("wu_name", inner_xml) 'get data in <wu_name>
            row("Result") = work_unit

            table.Rows.Add(row)
        End While
            view = New DataView(table)
            DataGridView1.DataSource = table

get_inner_xml looks like this:
    Public Function get_inner_xml(ByVal str_s As String, ByVal inner_xml As String) As String

        Dim s As String = "<" & str_s & ">"
        Dim e As String = "</" & str_s & ">"
        Dim startp, endp As Integer
        startp = InStr(inner_xml, s, CompareMethod.Text) + Len(s)
        endp = InStr(startp, inner_xml, e) - startp
        If endp <= 0 Then Return ""

        Dim ret As String = Mid(inner_xml, startp, endp)
        Return ret

    End Function

If you can find a faster way, please let me know.

If Your_Ideas_Are_Used Then
You_get_credit_in_aboutbox = True
Else You_get_credit_in_aboutbox = False
End If

-- Mike
Not Ready Reading BRAIN. Abort/Retry/Fail?
ID: 883961 · Report as offensive
Profile Borgholio
Avatar

Send message
Joined: 2 Aug 99
Posts: 653
Credit: 18,623,738
RAC: 103
United States
Message 883890 - Posted: 10 Apr 2009, 7:01:49 UTC

I have no programming experience, but I would be happy to help with alpha / beta testing.


You will be assimilated...bunghole!

ID: 883890 · Report as offensive
slozomby

Send message
Joined: 16 Nov 04
Posts: 20
Credit: 242,588
RAC: 0
United States
Message 883845 - Posted: 10 Apr 2009, 3:06:46 UTC - in response to Message 883828.  
Last modified: 10 Apr 2009, 3:14:51 UTC

this will point ya in the right direction:
http://msdn.microsoft.com/en-us/library/system.data.dataset.readxml(vs.71).aspx

the example is a little bloated but you can pare it down to the essentials.

basically something along these lines:

public dsGrid as dataset
datagridview.source=dsGrid.tables(sometablename)
datagridview.update

timer.event function
dim ds as dataset
ds.readxml(result_from_xmlrpc_funtion)
return ds

timer.event.exit function
dsgrid.tables(tablename).merge(ds.tables(tablename))
datagridview.update

i'd have to see the source to be more specific.
i'd like to see it anyway. pm me if you wouldnt mind sharing it.

option number 2
have the timer event push the xmlrpc functions results into sql then you can just let the datagridview object look for table updates which is a pretty easy timer event to setup.

personally im not a fan of multi dimensional arrays. mostly because sorting and search through them is tedious. where a simple datatable.select or datatable.sort make it so easy.
ID: 883845 · Report as offensive
Profile Mike O
Avatar

Send message
Joined: 1 Sep 07
Posts: 428
Credit: 6,670,998
RAC: 0
United States
Message 883828 - Posted: 10 Apr 2009, 1:27:43 UTC - in response to Message 883808.  



Question: Could you use some help programming? What language are you coding in?


Hey John..
I'm using Visual Basic .net.. version 9 I believe.
There are some areas I may need help with..
I can get the data back from the core client but I'm struggling with finding the best and fastest way to bind the data to a DataGridView object.
What do you know about this John?
Thanks
--Mike

Not Ready Reading BRAIN. Abort/Retry/Fail?
ID: 883828 · Report as offensive
John McLeod VII
Volunteer developer
Volunteer tester
Avatar

Send message
Joined: 15 Jul 99
Posts: 24806
Credit: 790,712
RAC: 0
United States
Message 883808 - Posted: 10 Apr 2009, 0:23:24 UTC - in response to Message 883793.  

Having in the past had a farm with 50+ machines, both on the local lan and remote wan, my biggest complaint with BV was the time it took to read all the machines due to its inability to easily enable/disable groups of machines.
Yes, I could enable/disable single machines but with 50+ machines this quickly becomes a pain. I used an early version of BV so it could well have included this functionality in later versions.

I eventually went with boincphpgui (which also seems to be dead now) and wrote my own front end which supported machine grouping.

So, could you include support for machine grouping please :)

Yes.. an excellent idea.. Maybe a grouping much like layers work in cad.. I'll add the ablility to assign to different data sets.
Right now, I'm just working on getting a usabe program up and running.

How about just having the ability to define sets of computers. Any computer can belong to any set. You can see one set at a time. Perhaps a combo box above the list of computers (in BV the left pane). It would require a couple of extra dialog boxes.

Question: Could you use some help programming? What language are you coding in?


BOINC WIKI
ID: 883808 · Report as offensive
Profile Mike O
Avatar

Send message
Joined: 1 Sep 07
Posts: 428
Credit: 6,670,998
RAC: 0
United States
Message 883793 - Posted: 9 Apr 2009, 23:09:24 UTC - in response to Message 883670.  

Having in the past had a farm with 50+ machines, both on the local lan and remote wan, my biggest complaint with BV was the time it took to read all the machines due to its inability to easily enable/disable groups of machines.
Yes, I could enable/disable single machines but with 50+ machines this quickly becomes a pain. I used an early version of BV so it could well have included this functionality in later versions.

I eventually went with boincphpgui (which also seems to be dead now) and wrote my own front end which supported machine grouping.

So, could you include support for machine grouping please :)

Yes.. an excellent idea.. Maybe a grouping much like layers work in cad.. I'll add the ablility to assign to different data sets.
Right now, I'm just working on getting a usabe program up and running.

Not Ready Reading BRAIN. Abort/Retry/Fail?
ID: 883793 · Report as offensive
Temujin
Volunteer tester

Send message
Joined: 19 Oct 99
Posts: 292
Credit: 47,872,052
RAC: 0
United Kingdom
Message 883670 - Posted: 9 Apr 2009, 10:52:15 UTC - in response to Message 882566.  

Having in the past had a farm with 50+ machines, both on the local lan and remote wan, my biggest complaint with BV was the time it took to read all the machines due to its inability to easily enable/disable groups of machines.
Yes, I could enable/disable single machines but with 50+ machines this quickly becomes a pain. I used an early version of BV so it could well have included this functionality in later versions.

I eventually went with boincphpgui (which also seems to be dead now) and wrote my own front end which supported machine grouping.

So, could you include support for machine grouping please :)
ID: 883670 · Report as offensive
Profile Mike O
Avatar

Send message
Joined: 1 Sep 07
Posts: 428
Credit: 6,670,998
RAC: 0
United States
Message 882566 - Posted: 5 Apr 2009, 19:00:09 UTC

YAY!
I got the RPCs to work over my lan..
It took a long time to figure out the authorizing process.. lol
I came up with nearly the exact same code as boinc manager uses(i found this later digging in the files at boinc/wiki) but my MD5 hasher was not correct.. I messed with different xml_rpc calls for many hours when there was nothing wrong with the logic.. it was the MD5 that was screwing it.
Now that this part is done.. the rest is just coding and XML extrapolation... working out flow logic.. function calls.. methods... The basic 'write a program' stuff.
Its time to stop coding and start drawing UI ideas on paper
Im starting to rethink some of the user interface. It needs to be as simple and useable as it can make it.
Maybe Im' wrong but If you use IP address to connect to a client verses 'friendly names' you can also connect over the internet, right? I'm new to this 'socket' crap but learning as fast as my brain will take it in.. lol
I guess I will test this later once I get more of the basic functionality done.

Here is a tad bit of what a RPC request for 'results' will send back.

<boinc_gui_rpc_reply>
<results>
<result>
    <name>21ja09ab.7572.19295.11.8.105_0</name>
    <wu_name>21ja09ab.7572.19295.11.8.105</wu_name>
    <project_url>http://setiathome.berkeley.edu/</project_url>
    <final_cpu_time>1905.938000</final_cpu_time>
    <exit_status>0</exit_status>
    <state>5</state>
    <report_deadline>1240880990.000000</report_deadline>
    <estimated_cpu_time_remaining>0.000000</estimated_cpu_time_remaining>
    <ready_to_report/>
    <completed_time>1238951211.812498</completed_time>
</result>
<result>
    <name>09fe09aa.26143.24203.8.8.228_1</name>
    <wu_name>09fe09aa.26143.24203.8.8.228</wu_name>
    <project_url>http://setiathome.berkeley.edu/</project_url>
    <final_cpu_time>3201.360000</final_cpu_time>
    <exit_status>0</exit_status>
    <state>5</state>
    <report_deadline>1240881231.000000</report_deadline>
    <estimated_cpu_time_remaining>0.000000</estimated_cpu_time_remaining>
    <ready_to_report/>
    <completed_time>1238952490.421875</completed_time>
</result>
...
...


Oh.. And I need a icon creator program! If anyone knows of a good one that's also.. free, please post a link here ok?
Thanks!

-- Mike


Not Ready Reading BRAIN. Abort/Retry/Fail?
ID: 882566 · Report as offensive
Profile Mike O
Avatar

Send message
Joined: 1 Sep 07
Posts: 428
Credit: 6,670,998
RAC: 0
United States
Message 882180 - Posted: 4 Apr 2009, 4:52:42 UTC

Well..
I have been tinkering away at this lil' project and this is where I'm at.
I going with a tabulated UI sorta like BV's. Im shooting for less buttons and use functions inside on tabs to control things. There will be a toolbar tho with buttons for the most important things like suspendtion and updates... things you would use all the time.

So far..
I Managed to get IPs and Host names from my LAN to list and save in the host_info array.
I have Created a dynamic array to hold the host info structure. The elements of the host_info_structure will grow as more data needs to be added.
With many clients running more than one project, an array inside the structure def may be a good solution. Things like that are a bit scary to me. I don't think I've ever tried using an array inside a structure. I'm not even sure how you would go about accessing the elemmets in the array. Humm..

host_info(index).projects(index) =  project_names(index)?



I guess that would work huh? I'n not sure about the constructor tho.. hummm..#2
I was thinking of creating a class for the host info but I CAN get from here to there using a structure.

Im having one heck of a time figuring out this RPC stuff. I need to do a whole lotta reading about the .NET classes. There is some help online of course but at this point, much of it is so far over my head, It may as well be near Saturn!
Im just now playing with .NET programming. What I see so far is pretty cool even tho it is a bit confusing to the nOOb I am ;)
If anyone has a handle on connecting to the core client using RPC calls in VB.NET.. Come on down! A lil' help is always welcome :)

I'll post an update once in awhile as this thing progresses :)

-- Mike

Oh.. And Terri O is all happy and stuff now that her new PSU is in and her CUDA is back up.. Seems she is having a bit of an issue getting work.. A bit odd as my systems are well fed :)

Not Ready Reading BRAIN. Abort/Retry/Fail?
ID: 882180 · Report as offensive

Message boards : Number crunching : BoincView - Replacement part 2


 
©2020 University of California
 
SETI@home and Astropulse are funded by grants from the National Science Foundation, NASA, and donations from SETI@home volunteers. AstroPulse is funded in part by the NSF through grant AST-0307956.