mobi phil | 1 May 2012 20:05

object subtree update strategy

Hello,

trying to allocate again some time for wt programming...
I have however a question about the overall strategy of updating sub trees.

Assumption about how wt works (of course this may be wrong):

1. an object tree (dom) is built dynamically on the browser (and on
the server) as a sequence of a first http request for the root html
followed by several subsequent ajax based http requests to <fill in
the gaps>/<decorate>/<make pages dynamic> or whatsoever purpose.
2. for the same session multiple request may be sent and processed on
different trees
3. these multiple requests may be handled on different threads

What is the locking mechanism principle to avoid to mess up the object
tree on two different threads that operate for the same session

If my question is unclear, please let me know.

rgrds,
mobi phil

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
(Continue reading)

Wim Dumon | 2 May 2012 08:58
Picon
Favicon

Re: object subtree update strategy

Hello,

1. Wt always renders all modifications to the widget tree in a single
response (for application startup, there may be a few extra requests).
All modifications of all modified subtrees are combined in one
response.
2. When Wt processes a session, it grabs the WApplication::UpdateLock
of that session. Therefore, for all event handlers initiated by the
client, you are guaranteed to have exclusive access to the widget
tree. If you take the initiative to use a session's widget tree
server-side outside of this mechanism, you must grab the updatelock
before doing so.
3. That is correct: threads are randomly assigned to incoming requests.

Regards,
Wim.

2012/5/1 mobi phil <mobi@...>:
> Hello,
>
>
> trying to allocate again some time for wt programming...
> I have however a question about the overall strategy of updating sub trees.
>
> Assumption about how wt works (of course this may be wrong):
>
> 1. an object tree (dom) is built dynamically on the browser (and on
> the server) as a sequence of a first http request for the root html
> followed by several subsequent ajax based http requests to <fill in
> the gaps>/<decorate>/<make pages dynamic> or whatsoever purpose.
(Continue reading)

Mihaly Elekes | 2 May 2012 12:43
Picon

Re: object subtree update strategy

Hi Wim,


thanks for your quick answer. To conclude, please let me know if I understand correctly: given that I have a page that triggers two ajax events (almost the same time), these two requests cannot be processed in parallel (two different threads) as the tree is locked. 


rgrds,
mobi

On Wed, May 2, 2012 at 8:58 AM, Wim Dumon <wim-fsvWVe5cvas@public.gmane.org> wrote:
Hello,

1. Wt always renders all modifications to the widget tree in a single
response (for application startup, there may be a few extra requests).
All modifications of all modified subtrees are combined in one
response.
2. When Wt processes a session, it grabs the WApplication::UpdateLock
of that session. Therefore, for all event handlers initiated by the
client, you are guaranteed to have exclusive access to the widget
tree. If you take the initiative to use a session's widget tree
server-side outside of this mechanism, you must grab the updatelock
before doing so.
3. That is correct: threads are randomly assigned to incoming requests.

Regards,
Wim.


2012/5/1 mobi phil <mobi <at> mobiphil.com>:
> Hello,
>
>
> trying to allocate again some time for wt programming...
> I have however a question about the overall strategy of updating sub trees.
>
> Assumption about how wt works (of course this may be wrong):
>
> 1. an object tree (dom) is built dynamically on the browser (and on
> the server) as a sequence of a first http request for the root html
> followed by several subsequent ajax based http requests to <fill in
> the gaps>/<decorate>/<make pages dynamic> or whatsoever purpose.
> 2. for the same session multiple request may be sent and processed on
> different trees
> 3. these multiple requests may be handled on different threads
>
> What is the locking mechanism principle to avoid to mess up the object
> tree on two different threads that operate for the same session
>
> If my question is unclear, please let me know.
>
> rgrds,
> mobi phil
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> witty-interest mailing list
> witty-interest <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/witty-interest

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
witty-interest mailing list
witty-interest <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
witty-interest mailing list
witty-interest@...
https://lists.sourceforge.net/lists/listinfo/witty-interest
Wim Dumon | 2 May 2012 12:51
Picon
Favicon

Re: object subtree update strategy

That is correct.

Wim.

2012/5/2 Mihaly Elekes <misi.aaaa@...>:
> Hi Wim,
>
> thanks for your quick answer. To conclude, please let me know if I
> understand correctly: given that I have a page that triggers two ajax events
> (almost the same time), these two requests cannot be processed
> in parallel (two different threads) as the tree is locked.
>
>
> rgrds,
> mobi
>
> On Wed, May 2, 2012 at 8:58 AM, Wim Dumon <wim@...> wrote:
>>
>> Hello,
>>
>> 1. Wt always renders all modifications to the widget tree in a single
>> response (for application startup, there may be a few extra requests).
>> All modifications of all modified subtrees are combined in one
>> response.
>> 2. When Wt processes a session, it grabs the WApplication::UpdateLock
>> of that session. Therefore, for all event handlers initiated by the
>> client, you are guaranteed to have exclusive access to the widget
>> tree. If you take the initiative to use a session's widget tree
>> server-side outside of this mechanism, you must grab the updatelock
>> before doing so.
>> 3. That is correct: threads are randomly assigned to incoming requests.
>>
>> Regards,
>> Wim.
>>
>>
>> 2012/5/1 mobi phil <mobi@...>:
>> > Hello,
>> >
>> >
>> > trying to allocate again some time for wt programming...
>> > I have however a question about the overall strategy of updating sub
>> > trees.
>> >
>> > Assumption about how wt works (of course this may be wrong):
>> >
>> > 1. an object tree (dom) is built dynamically on the browser (and on
>> > the server) as a sequence of a first http request for the root html
>> > followed by several subsequent ajax based http requests to <fill in
>> > the gaps>/<decorate>/<make pages dynamic> or whatsoever purpose.
>> > 2. for the same session multiple request may be sent and processed on
>> > different trees
>> > 3. these multiple requests may be handled on different threads
>> >
>> > What is the locking mechanism principle to avoid to mess up the object
>> > tree on two different threads that operate for the same session
>> >
>> > If my question is unclear, please let me know.
>> >
>> > rgrds,
>> > mobi phil
>> >
>> >
>> > ------------------------------------------------------------------------------
>> > Live Security Virtual Conference
>> > Exclusive live event will cover all the ways today's security and
>> > threat landscape has changed and how IT managers can respond.
>> > Discussions
>> > will include endpoint security, mobile security and the latest in
>> > malware
>> > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>> > _______________________________________________
>> > witty-interest mailing list
>> > witty-interest@...
>> > https://lists.sourceforge.net/lists/listinfo/witty-interest
>>
>>
>> ------------------------------------------------------------------------------
>> Live Security Virtual Conference
>> Exclusive live event will cover all the ways today's security and
>> threat landscape has changed and how IT managers can respond. Discussions
>> will include endpoint security, mobile security and the latest in malware
>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>> _______________________________________________
>> witty-interest mailing list
>> witty-interest@...
>> https://lists.sourceforge.net/lists/listinfo/witty-interest
>
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> witty-interest mailing list
> witty-interest@...
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
Oto Magaldadze | 2 May 2012 13:36
Picon
Favicon

Re: model->data handling


qModel->data(qModel->index(y,x)).type == typeid(std::string) )
   this gives false and that absolutely waffles me. But never mind I used QSqlTableModel::data to get what i need. 
 
From: Matthew Sherborne <msherborne-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Oto Magaldadze <omagaldadze-/E1597aS9LQAvxtiuMwx3w@public.gmane.org>; witty-interest <at> lists.sourceforge.net
Sent: Tuesday, May 1, 2012 2:38 AM
Subject: Re: [Wt-interest] model->data handling

If what's in the boost::any variable is a string thas should work I think.

if( someValue.type() == typeid(std::string) ) {
  std::string myString =
boost::any_cast<string>(qModel->data(qModel->index(y,x)));
  wt::WString wtString =
boost::any_cast<string>(qModel->data(qModel->index(y,x)));
}

Haven't actually tried it though, but should get you moving in the
right direction I think.

Kind Regards,
Matthew Sherborne

On Tue, May 1, 2012 at 7:52 AM, Oto Magaldadze <omagaldadze-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote:
>
> "Wt: error during event handling: boost::bad_any_cast: failed conversion using boost::any_cast"


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
witty-interest mailing list
witty-interest@...
https://lists.sourceforge.net/lists/listinfo/witty-interest
Oto Magaldadze | 2 May 2012 14:55
Picon
Favicon

selected items in wtableview

is it possible to get coordinates of selecteditems in WTableView?

i tried selectionModel() to achieve that but couldn't succeed.

Oto
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
witty-interest mailing list
witty-interest@...
https://lists.sourceforge.net/lists/listinfo/witty-interest
Koen Deforche | 2 May 2012 15:02
Picon
Favicon

Re: object subtree update strategy

Hey,

> 2. for the same session multiple request may be sent and processed on
> different trees

Not exactly. Requests are serialized at the browser already (queued if necessary).

> 3. these multiple requests may be handled on different threads
>
> What is the locking mechanism principle to avoid to mess up the object
> tree on two different threads that operate for the same session

Every session is protected by a lock, the same one you take using Update lock.

Regards,
Koen

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
witty-interest mailing list
witty-interest@...
https://lists.sourceforge.net/lists/listinfo/witty-interest
Nagaev Boris | 2 May 2012 16:09
Picon
Gravatar

Re: selected items in wtableview

Hello!

Get selectionModel().selectedIndexes()

It is WModelIndexSet, typedef for std::set<WModelIndex> (this seems
not to be documented, but its name implies that it is a set, so we can
traverse it). If you want to visit each selected index:

const WModelIndexSet index_set = view->selectionModel().selectedIndexes();
for (WModelIndexSet::iterator index_iterator = index_set.begin();
index_iterator != index_set.end(); ++index_iterator) {
  WModelIndex index = *index_iterator;
  // do smth with index
}

Or you can use boost foreach:

#include <boost/foreach.hpp>

const WModelIndexSet index_set = view->selectionModel().selectedIndexes();
BOOST_FOREACH (WModelIndex index, index_set) {
  // do smth with index
}

On Wed, May 2, 2012 at 4:55 PM, Oto Magaldadze <omagaldadze@...> wrote:
> is it possible to get coordinates of selecteditems in WTableView?
>
> i tried selectionModel() to achieve that but couldn't succeed.
>
> Oto
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> witty-interest mailing list
> witty-interest@...
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
Oto Magaldadze | 2 May 2012 17:48
Picon
Favicon

Re: selected items in wtableview

it works, thanks. I saw .begin() but didn't know how to iterate on it correctly.

From: Nagaev Boris <bnagaev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Oto Magaldadze <omagaldadze-/E1597aS9LQAvxtiuMwx3w@public.gmane.org>; witty-interest-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Sent: Wednesday, May 2, 2012 6:09 PM
Subject: Re: [Wt-interest] selected items in wtableview

Hello!

Get selectionModel().selectedIndexes()

It is WModelIndexSet, typedef for std::set<WModelIndex> (this seems
not to be documented, but its name implies that it is a set, so we can
traverse it). If you want to visit each selected index:

const WModelIndexSet index_set = view->selectionModel().selectedIndexes();
for (WModelIndexSet::iterator index_iterator = index_set.begin();
index_iterator != index_set.end(); ++index_iterator) {
  WModelIndex index = *index_iterator;
  // do smth with index
}

Or you can use boost foreach:

#include <boost/foreach.hpp>

const WModelIndexSet index_set = view->selectionModel().selectedIndexes();
BOOST_FOREACH (WModelIndex index, index_set) {
  // do smth with index
}

On Wed, May 2, 2012 at 4:55 PM, Oto Magaldadze <omagaldadze-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote:
> is it possible to get coordinates of selecteditems in WTableView?
>
> i tried selectionModel() to achieve that but couldn't succeed.
>
> Oto
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> witty-interest mailing list
> witty-interest-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
witty-interest mailing list
witty-interest@...
https://lists.sourceforge.net/lists/listinfo/witty-interest
Marco Wagner | 4 May 2012 17:43
Picon

Re: Attaching WProgressBar with a process

Hi,

2012/4/29 Nagaev Boris <bnagaev@...>:
> Hi!
>
> On Sun, Apr 29, 2012 at 02:49, Mohammed Rashad
> <mohammedrashadkm@...> wrote:
>> Hi,
>> Thanks. I saw that you are using system command to execute a process. Is
>> there any alternative to execute process, PIPE ing stdout and stderr to a
>> std::stringstream without writing to file?
> I think, it is possible, at least on Unix, but has not been done yet :)

under windows you can use CreateProcess
(http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425%28v=vs.85%29.aspx)
within the STARTUPINFO sturcture (hStdOutput) you can point to a Pipe
created with CreatePipe
(http://msdn.microsoft.com/en-us/library/windows/desktop/aa365152%28v=vs.85%29.aspx)
to directly read the stdout via ReadFile
(http://msdn.microsoft.com/en-us/library/windows/desktop/aa365467%28v=vs.85%29.aspx)

--

-- 
Regards,
Marco

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

Gmane