Interaction between model and self-modifying data in Qt MV

I have a tree structure that represents a system of devices that are connected to the PC via serial port. In a way, this structure was inspired by tree model example in Qt and I think that helps to separate logic part from gui. My model has a root node member, and can access all underlying nodes through the root node. Some nodes should do their work automatically (i.e. send commands to the serial port on timer). Routine tasks for the application are ordinary:

  1. Notify model when state of a node had changed.
  2. Notify model when the structure of the tree was modified, a node has added a new child node or has removed a node.

Each node has pointer to the root and can emit signals about any changes. So the root node is some kind of the interface for the tree. Now i’m struggled with the crashing when removing a child node and notifying model about that. Actually I solved this problem, however I think it’s something wrong in the design. So I want to ask how best to implement interaction between my data structure and the model.

Some questions are: should data structure be able to perform some actions on itself (add or remove nodes) and just notify model about changes, or that should be strictly performed by the model on appropriate request from the tree?

I use Qt, signals and slots, is it bad if my structure would rely on QAbstractItemModel mechanics – use signals like nodeIsAboutToBeRemoved / nodeRemoved to prepare model for corresponding actions?

Update, about the structure I’m using. I don’t insist tree is the best or the ideal structure for my purpuses. There were two thoughts about the tree – it’s naturally represents the real system and it’s easy to use Qt’s models and views (both tree and table views). Finally, the tree idea was accepted by chiefs and colleagues. My tree is 5 levels now: root – hub (represents serial port) – coordinator device – terminal device – sensor. Later, new level may be inserted between coordinator device and terminal, and a hub class may be reimplemented for using something else instead of serial port or to use another protocol. There is no multithreading now and it’s not planned, but it seems to me, multithreading can be injected relatively simple and natural. Each hub controls serial poort settings. Node at each level knows about all child nodes and so it knows how to form a set of commands to survey physical devices. Each node can hold it’s state (is it accessible at the physical level or not) and pass this state to children or just control their behaviour.

How to implement a CLI interaction with running java programm?

I would like you tipps how to implement a command line interface to interact with a running java application.

Example:

The Java Application is a webserver and a cli-client should interact with it:

1 ) Start server application: java -jar webserver.jar

2) Get status of the application: java -jar webserver.jar --status or other commands like: java -jar webserver.jar --add-user Paule --password 1234 so adding an entry in a hashmap in the running application.

Does anyone know a Best-Practice tutorial about this?

Implementing a HTTP/TCP/UDP/UNIX-Socket would be one solution for interaction.

An other solution would be reading external resources and placing commands in files for example.

What is your way to implement this?

Is there a technical term for interaction with a running thread?

Thanks in Advance

Please help me figure out this included/excluded search filter interaction (4 options)?

I am working on a tool that allows users to analyze a report populated with a bunch of social media (primarily Twitter) posts relating to a topic they are interested in. Within this, I am building something that allows users to search the report (for things like text, author, hashtags, etc) and apply this search as a filter. So for example, a user that works at Nike may want to search the “Nike Shoes” report they created that is all about Nike for mentions of the word “Lebron” to see what people think about their latest campaign with LeBron James. They may also just want to exclude the word “Nike” to get rid of that data and see what else is mentioned outside of their brand (ie: whoa lots of people are positively talking about Adidas + Lebron for some reason this month).

I have come up with a few options for an MVP of this feature. My constraints right now are that the search/filter experience must feel very quick and lightweight, a user must be able to include and exclude text, authors, URLs, and IDs, and that we can’t save or allow toggling on/off of any of these search/filters (what the heck are they?) yet.

Here are the 4 options for the controls that I have come up with thus far. In this scenario a user wants to Exclude any posts that mention or contain the author @nike from their report view. I am going throw them up on a testing site, but I would love feedback here as well.


Option 1: One search box. A user can select if they would like to include or exclude once they are hovering on an option.

Option 1:


Option 2: This was actually my first iteration. One search box with a [equals/not not equal] (could be is/is not, +/- .. not sure?) dropdown input next to it. User can click and chose if it is an inclusion or exclusion from the dropdown and then search for what they want.

enter image description here


Option 3: One search box. The searches are all Included/Inclusion (our primary use case) on default. If a user wants it to be an Exclusion they can click the “Exclude instead” link on hover.

enter image description here


Option 4: Two search boxes. The user clicks into the inclusion search box if they want to include something and into the exclusion search box if they want to exclude. I had actually settled on this option but got pushback that it used to much screen real estate and could probably be accomplished with only search box.

enter image description here

I’d love some feedback on:

  1. What option you think works best, or if there is an entirely different solution you think I am missing?
  2. Is there a better search dropdown interaction I could be going with her instead of the flyout appearing below the box? Any inspiring tools or websites with a better pattern?
  3. What is this called? It is basically creating temporary filters by searching a report comprised of posts that that user generated by.. searching a large database of posts. I have been calling it Post Search Filters but :shrug: !

Thanks so much!

Can I track stats of my interaction with notifications?

I would like to have my interaction with each notification automatically tracked. I’d like to get results such as:

“What percent of the time do I open vs dismiss the notifications from each app?” (and which apps do I almost always dismiss?) *If I knew this, I could turn those notifications off, and have less distractions…

“Which apps do I open the notifications to fastest on average?” *These would be good apps to make sure I set as high priority for the notifications.

How can I begin tracking this data?

fighter sharpshooter, snap shot and extra attack interaction

i was reading trough the fighter archtypes and came across the sharpshooter unearthed arcana archtype.

the level 18 trait is:

Snap Shot

Starting at 18th level, if you take the Attack action on your first turn of a combat, you can make one additional ranged weapon attack as part of that action.

at level 18 fighter you also have acces to 2 extra attacks.

how does these traits interact?

could i do:

normal attack + extra attack + extra attack + snap shot?

or is it:

normal attack + snap shot + extra attack + snap shot + extra attack + snap shot?

Client/Server Interaction on Dataflow Task

Initial Case:

There are two servers:

  1. FileServer – its purpose to download, concatenate and filter CSV-files so that in final I have directory PROCESSED with bunch of CSV-files. (ubuntu server 16.04). So, there are such operations:

    a. download files b. process files 
  2. DBServer – it’s purpose to store information from files from FileServer (Windows Server 2016, MS SQL Server 2017). CSV files from FileServer are copied to DBServer and BulkInsert after that. As the dataflow is about 100 millions of rows daily, I have following operations on it:

    c. move files to DBServer (for bulk insert) d. bulk insert to DB_A.temp_table (for data coming in during the day) e. bulk insert to DB_A.main_table (to accumulate data for specific date, that can be passed in a range of one week) f. queryout data for specific date to CSV-file (for bulk insert to DB_B.archive) f. bulk insert to DB_B.archive (to store data in partitioned, indexed and processed way) 

FileServer has very slow CPU.

DBServer has very slow hdd-speed (about 200 MB/s).

So, as you can see, the main purpose of such complex data flow, is to restrict the load of DBServer to get users fast Query Performance:

I accumlate csvfiles on FileServer during a day, after that I process them and put to the DBServer for insertion.

As I said the dataflow is about 100 millions of records from daily streamed CSV-files.

So, I have to make partitioned tables, partitioned by the date. But CSV-files for specific date can be passed in a range of one week.

That’s why I had to create DB_A, where I accumulate data for specific date. After period of two weeks I switch out the latest partition in DB_A into CSV-file, and then BULK INSERT it into specific partition of DB_B.

That is the case.

Where do I need help

So, I want to create WebServer (ubuntu, nginx, python backend, js/vue.js frontend), from which I would be able to control all these steps from A to F.

All these tasks should be executed periodically, but also I want to be able to stop them and run again manually from Webapp.

What is the best practice to organize these operations?

  1. Should they all be executed in one entry point, such as python server application, or may I divide responsibility of them among Python ans MS SQL Server – what is the best practice for my case?

  2. How should be implemented process’ control via API from Webapp? Could you please tell me what stack of technologies (such as celery, rabbitmq and so on) I should use to implement control of processes on my Webapp? And in general would it be a good practice to implement my task in such way?

jQuery weird interaction between .hide() and .show()

I have two elements in my website in the same container. One is visible (display: block), and one is hidden (display: none). On an event, I want the visible element to hide, and the hidden element to show. The problem is, when I show the hidden element after hiding the visible element, it always has a split second where it jumps from its previous stacked position on top of the visible element to the position it should be in:

Velocity(document.getElementById("loading"), { opacity: 0 }, { display: "none" }, {duration: 500}); Velocity(document.getElementById("loaded"),{ opacity: 1 },{ display: "block" },{duration: 500, delay: 200000}); 

I thought this was a conflict with the two commands being two close to eachother, so I added a delay to the second command. However, no matter how long the delay is, the issue still prevails.

Why does this happen?

How to document or describe an ethically designed user interface or interaction pattern?

An article written by a company involved in developing software used in research talks about the concept of “ethically designed algorithms” which can be administered by an organisation that is akin to the “FDA of Algorithms” (Andrew Tutt, 2016).

The principles of ethically designed algorithms, as described in the article, embodies the following elements:

Responsibility

Make available externally visible avenues of redress for adverse individual or societal effects of an algorithmic decision system, and designate an internal role for the person who is responsible for the timely remedy of such issues.

Explainability

Ensure that algorithmic decisions as well as any data driving those decisions can be explained to end-users and other stakeholders in non-technical terms.

Accuracy

Identify, log, and articulate sources of error and uncertainty throughout the algorithm and its data sources so that expected and worst case implications can be understood and inform mitigation procedures.

Auditability

Enable interested third parties to probe, understand, and review the behavior of the algorithm through disclosure of information that enables monitoring, checking, or criticism, including through provision of detailed documentation, technically suitable APIs, and permissive terms of use.

Fairness

Ensure that algorithmic decisions do not create discriminatory or unjust impacts when comparing across different demographics (e.g. race, sex, etc).

Is there anything similar that has been developed for research in similar fields (e.g. Psychology or Medical Research) that is suitable for adaptation to UX design? Or does something like this already exist and is used?