Having a Textfile in favorites

I have a text file that I would like to have quick access to. I would like it to show in the shortcuts “bar” with my other shortcuts.

In order to do this, I know that I am supposed to create a file ~/.local/share/applications/custom-filemanager.desktop

and put “code” that looks something like this into the file:

[Desktop Entry]

Type=Application

Name=notes

Exec=gedit-open home/user1/Desktop/notes

Comment=Launch notes

Terminal=false

Icon=accessories-text-editor

However, part of what I wrote there must be wrong because although it creates the “shortcut,” nothing happens when I click on the shortcut.

How to prevent querying each user each time when having per microservice authorization? [on hold]

I am trying to find a good approach for authentication and authorization of a user in a microservice-application.

Currently I have the following idea:

authentication and authorization using JWT

In regards to the sequence diagram I have the following questions:

  1. [step 12] and [step 16] check for a permission, which is necessary on the server-side. Where are those permissions supposed to be stored?
  2. What about the note (after [step 20])? Possibilities:
    1. Issue an additional signed Token, that contains permissions / roles for the message service. This token can be acquired during [step 13].
    2. Re-issue existing JWT, include permissions / roles for the message service. This token can be acquired during [step 13].
    3. Issue a server-side request, that returns information about whether a certain GUI-area should be displayed.

If in 2.1 or 2.2 the client-token is modified, the user is able to access GUI-areas, which should not be available to him. However: any subsequent service calls will not succeed, because the modified (nor the original) token permits access to corresponding server-calls to the user.

In 2.3 the microservice is queried each time the GUI has to decide whether to display a GUI-area or not.

Having tasks that can be ran individually or “in trees”, and each task can be blocking or non-blocking

I’m creating a framework that needs to execute certain tasks, I’ll use building a car as an example for this. So, an individual task could be something like weld metal or screw bolt. But there are also collections of tasks, I call them jobs. Each job can have X amount of tasks, so combining these two tasks could get us a job build an engine:

build an engine +-- weld metal +-- screw bolts 

Additionally, jobs can have sub-jobs:

build a car +-- build an engine |   +-- weld metal |   +-- screw bolts +-- build a frame |   +-- weld metal |   +-- screw bolts |   +-- paint +-- combine engine and frame 

So basically each node of my tree is a job, and each leaf is a task. This is easy enough, here’s what my classes would look like:

class Task:     def do(self):         raise NotImplementedError('abstract method')  class Job(Task):     def __init__(self):         self.tasks = []      def do(self):         for task in self.tasks:             task.do() 

And now I’d just subclass WeldMetal and ScrewBolts from Task.

The problem arrives when we want to parallellise this. I need to somehow tell each task (and job) whether it should block the execution, or run in a separate thread and not block it. Sometimes my jobs also need results from other jobs, while those jobs may run in parallel to each other. For example in the above car building:

  • weld metal must block, since you can’t screw before the metal is welded.
  • build an engine and build a frame can be ran in their own threads (and within those threads the weld metal and screw bolts must block the particular thread).
  • combine engine and frame must wait for build an engine and build a frame to finish.

Honestly I’m not too sure where to start, initially I thought of using ThreadPoolExecutor in Job.do(), but I’m not sure how to block only some jobs and not others, and another issue is that sometimes a task must be ran “alone” without even being inside of any job, i.e. WeldMetal(block=False).do() must be valid.

I ended up using this at first:

class Task:     def do(self):         raise NotImplementedError('abstract method')      def run(self):         if self.block:             self.do()         else:             threading.Thread(target=self.do).start() 

And this works for most cases, but the issue comes when combine engine and frame needs to wait for both build an engine and build a frame to finish.

Having tasks that can be ran individually or “in trees”, and each task can be blocking or non-blocking

I’m creating a framework that needs to execute certain tasks, I’ll use building a car as an example for this. So, an individual task could be something like weld metal or screw bolt. But there are also collections of tasks, I call them jobs. Each job can have X amount of tasks, so combining these two tasks could get us a job build an engine:

build an engine +-- weld metal +-- screw bolts 

Additionally, jobs can have sub-jobs:

build a car +-- build an engine |   +-- weld metal |   +-- screw bolts +-- build a frame |   +-- weld metal |   +-- screw bolts |   +-- paint +-- combine engine and frame 

So basically each node of my tree is a job, and each leaf is a task. This is easy enough, here’s what my classes would look like:

class Task:     def do(self):         raise NotImplementedError('abstract method')  class Job(Task):     def __init__(self):         self.tasks = []      def do(self):         for task in self.tasks:             task.do() 

And now I’d just subclass WeldMetal and ScrewBolts from Task.

The problem arrives when we want to parallellise this. I need to somehow tell each task (and job) whether it should block the execution, or run in a separate thread and not block it. Sometimes my jobs also need results from other jobs, while those jobs may run in parallel to each other. For example in the above car building:

  • weld metal must block, since you can’t screw before the metal is welded.
  • build an engine and build a frame can be ran in their own threads (and within those threads the weld metal and screw bolts must block the particular thread).
  • combine engine and frame must wait for build an engine and build a frame to finish.

Honestly I’m not too sure where to start, initially I thought of using ThreadPoolExecutor in Job.do(), but I’m not sure how to block only some jobs and not others, and another issue is that sometimes a task must be ran “alone” without even being inside of any job, i.e. WeldMetal(block=False).do() must be valid.

I ended up using this at first:

class Task:     def do(self):         raise NotImplementedError('abstract method')      def run(self):         if self.block:             self.do()         else:             threading.Thread(target=self.do).start() 

And this works for most cases, but the issue comes when combine engine and frame needs to wait for both build an engine and build a frame to finish.

Search for files having bad I/O errors

I tried to mount iOS device on Ubuntu to copy/backup images. The DCIM folder has lots of files. For some reason, many of them has “Failed to open file (Input/output error)” error when trying to open them. They are intermingled with good files.

I want to delete all those image files with those errors, but don’t want to go through them one by one to find out what file is good and what file cannot be opened.

Is there a way to detect those bad files from command lines?

~/usr/mnt/DCIM/101APPLE$   ll -1rth total 614M -rw-r--r--  2 gdhp gdhp 2.1M May  4 13:01 IMG_1568.JPG -rw-r--r--  2 gdhp gdhp 1.7M May  4 13:01 IMG_1562.JPG -rw-r--r--  2 gdhp gdhp 3.8M May  4 13:01 IMG_1063.JPG -rw-r--r--  2 gdhp gdhp 1.4M May  4 13:04 IMG_1816.JPG -rw-r--r--  2 gdhp gdhp 190K May  4 13:04 IMG_1517.JPG  # bad I/O -rw-r--r--  2 gdhp gdhp 1.3M May  4 13:06 IMG_1811.JPG -rw-r--r--  2 gdhp gdhp 668K May  4 13:06 IMG_1263.JPG -rw-r--r--  2 gdhp gdhp 1.3M May  4 13:06 IMG_1048.JPG -rw-r--r--  2 gdhp gdhp 3.0M May 16 11:20 IMG_1172.JPG  # bad I/O -rw-r--r--  2 gdhp gdhp 2.6M May 16 11:21 IMG_1175.JPG -rw-r--r--  2 gdhp gdhp 1.5M May 17 18:29 IMG_1727.PNG ... 

Search for files having bad I/O errors

I tried to mount iOS device on Ubuntu to copy/backup images. The DCIM folder has lots of files. For some reason, many of them has “Failed to open file (Input/output error)” error when trying to open them. They are intermingled with good files.

I want to delete all those image files with those errors, but don’t want to go through them one by one to find out what file is good and what file cannot be opened.

Is there a way to detect those bad files from command lines?

~/usr/mnt/DCIM/101APPLE$   ll -1rth total 614M -rw-r--r--  2 gdhp gdhp 2.1M May  4 13:01 IMG_1568.JPG -rw-r--r--  2 gdhp gdhp 1.7M May  4 13:01 IMG_1562.JPG -rw-r--r--  2 gdhp gdhp 3.8M May  4 13:01 IMG_1063.JPG -rw-r--r--  2 gdhp gdhp 1.4M May  4 13:04 IMG_1816.JPG -rw-r--r--  2 gdhp gdhp 190K May  4 13:04 IMG_1517.JPG  # bad I/O -rw-r--r--  2 gdhp gdhp 1.3M May  4 13:06 IMG_1811.JPG -rw-r--r--  2 gdhp gdhp 668K May  4 13:06 IMG_1263.JPG -rw-r--r--  2 gdhp gdhp 1.3M May  4 13:06 IMG_1048.JPG -rw-r--r--  2 gdhp gdhp 3.0M May 16 11:20 IMG_1172.JPG  # bad I/O -rw-r--r--  2 gdhp gdhp 2.6M May 16 11:21 IMG_1175.JPG -rw-r--r--  2 gdhp gdhp 1.5M May 17 18:29 IMG_1727.PNG ... 

What is special about having a majordomo?

The Knight variant of the Noble background (PHB page 136) gives the following feature:

RETAINERS

You have the service of three retainers loyal to your family … one might be a majordomo …

I can’t find any other mention of a majordomo in the PHB, so what is special from a D&D perspective about a majordomo vs any other retainer?

It might be worth noting that this feature seems to have said squire once upon a time if this question is correct, and a squire is a specific NPC.

I’m having this error “maximum call stack size exceeded while establishing react-redux”

This error appears on a dispatch call please see the source below

I’m using windows and real android device for development purposes

This is My App.js

class App extends Component {       placeAddedHandler=()=>{          if(this.state.text.trim()===''){              return;          }         this.props.onAddPlace(this.state.text); // error happens here      };      render() {          return (             <View style={styles.container}>                     <PlacesInput                         onPlaceAdded={this.placeAddedHandler}                     />             </View>         );     } }    const mapStateToProps= state =>{     return {       places:state.placesReducer.places,       modal:state.placesReducer.modal     }; };  const  mapDisptachToProps= dispatch =>{     return{        onAddPlace:(name)=>dispatch(addPlace(name)),        onDelPlace:(key)=>dispatch(delPlace(key)),        onSelectPalce:(key)=>dispatch(selectPlace(key)),        onDeSelectPalce:()=>dispatch(deSelectPlace()),      }; };  export default connect(mapStateToProps,mapDisptachToProps)(App);   

And the Error is maximum call stack size exceeded.