Using Nested JSON as section.property in listView QML

Question: I am creating a listView where my delegate and it's information comes from JSON - My issue is I am trying to set the section.property from a nested area within the JSON. The nested data will be dynamic so I need to work in a way that adapts to each app user.
The documentation for what i'm working with is:
JsonListModel & SortFilterProxyModel
An example of my JSON would be;
[{
"firstname":"Edward",
"subGroup":"Reception",
"admin":1,
"roles":
    {"Assistant":0,"Reception":1,"Stylist":1,"Technical":0
    }
},
{
"firstname":"Claire",
"subGroup":"Stylist",
"admin":1,
"roles":
    {"Assistant":1,"Reception":0,"Stylist":1,"Technical":0
    }
}]

I am working via using the JsonListModel, QT Creator a minimal section of my code is below:
import Felgo 3.0
import QtQuick 2.0

Page {
id: editAdmins

property var newArr: dataModel.calendarUserItems.users
property var userRoles: ({})
property var l

JsonListModel { // list model for json data
    id: jsonModel
    source: dataModel.jsonList // my full JSON
    keyField: "firstname " + " surname"
    fields: ["firstname", "surname", "subGroup", "admin", "email", "roles"]
}

SortFilterProxyModel { // SortFilterProxyModel for sorting or filtering lists
    id: sortedModel
   // Note: when using JsonListModel, the sorters or filter might not be applied correctly when directly assigning sourceModel
   // use the Component.onCompleted handler instead to initialize SortFilterProxyModel
    Component.onCompleted: sourceModel = jsonModel
    sorters: [
        RoleSorter {
            id: groupSorter
            roleName: "subGroup"
        },
    ]
}

AppListView {
    id:view
    model: sortedModel
    anchors.fill: parent

    section.property: "subGroup" //How I have used it previously before needing to set 'roles' as my property (which shows nothing)
    section.delegate: SimpleSection {}

delegate: SimpleRow {
    id: container

    text: model.firstname
    detailText: model.surname
    }
}
}

From the above JSON, the expected result would be that my listView has 4 Sections from within the roles nest.
Assistant, Reception, Stylist, Technical
My question is:
I would like to use the roles as my ListView {section.property}, and the visibility of users depends on their Boolean in that role - so from the above example;
Edward would be visible in BOTH Reception and Stylist, whereas Claire would be visible in both Assistant and Stylist!
How can I define the nested JSON as my section property within my list?
------Update------
By adding an additional proxyRole within my SortFilterProxyModel { } as shown:
proxyRoles: ExpressionRole {
            name: "role"
            expression: JSON.stringify(model.roles)
       }

and changing my section.property: to "role" I am able to create sections for those with matching roles, closer, but still not as intended (see the attached screenshot for this)
I have further tried looping through the data, in many variations of:
        expression: {
            for(var x in model.roles){
                if(model.roles[x] === 1){
                    x
                }
            }
        }

and either returned the final index (As expected from above) or again, pushing the items to a new array but still returning them all as a result.
Comment: Please show your code. What you have managed to do so far, what you have failed to do. What is the expected behavior and what do you see instead. Now it looks like "do it for me" task.
Comment: Hi @folibis I've updated with a minimal JsonListModel which I am using for clarity! It's a case of usually setting the `section.property: "..."` is normally fine but where it's the root of nested data I get nothing show up at all for my sections!
Comment: Hi @folibis I've further expanded my question if this helps provide more insight on what I am trying to achieve! Thanks
Answer: ListViews create each delegate derived from their model data, meaning delegates cannot be duplicated as effectively that's what I was trying to do depending on the Booleans in the user roles.
I rectified this, by when the array is created, any user with multiple Boolean values within thier roles gets an additional array object for each role, and directing my section.property to each individual role name.
From the below code Edward would have 2 array objects created, which then acts as a 'duplicate' delegate.
[{
"firstname":"Edward",
"subGroup":"Reception",
"admin":1,
"roles":
    {"Assistant":0,"Reception":1,"Stylist":1,"Technical":0
    }
},
{
"firstname":"Claire",
"subGroup":"Stylist",
"admin":1,
"roles":
    {"Assistant":1,"Reception":0,"Stylist":1,"Technical":0
    }
}]


pooling lines in a categorical variable with MATLAB

Question: I have a table of size 2775x2, with text only:
'Papio cynocephalus'      'Papio cynocephalus'
'Cercopithecus kandti'    'Papio cynocephalus'
'Papio cynocephalus'      'Human in vivo'
'Papio cynocephalus'      'Papio cynocephalus'
'Gorilla beringei'        'Papio cynocephalus'
'Papio cynocephalus'      'Gorilla gorilla'
'Papio cynocephalus'      'Human in vivo'
'Papio cynocephalus'      'Papio cynocephalus'
...

Overall, there are 5 different categories ( = 5 primate species, the same in both colunms),
I would like to build a new table of size 111x2, where each line indicates the most frequent category (for both columns) for every block of 25 lines (l1->l25, then l26->l50, then l51->l75... ->l2775). Why 111 ? Because 111= 2775/25.
Any idea of how to proceed ? Many thanks in advance !!
Comment: what have you tried? Check functions like `unique` or `histogram`  or `strcmp` and then come back.
Answer: Here is what I would suggest.

Get the text out of the table into a cell array
Reshape the cell array to 111 rows (and 50 columns) and convert to categorical
Find mode for every column

Here is some code to generate sample data and demo:
names = {'Alpha','Beta','Gamma','Delta','Echo'}';
A = names(randi(5,2775,1));
B = names(randi(5,2775,1));
txtTable = table(A,B); % This is the kind of table you have

Now convert txtTable to a cell array for reshaping and convert the cell array into a categorical
textsWide = categorical(reshape(table2cell(txtTable),25,[]));
mostFrequent = mode(textsWide,2); % Find mode in each column

Comment: thanks ! good idea to reshape de table first. Then using function "mode", I should be able to extract the most frequent category in each column.
Comment: `mode` is a good suggestion to get the most frequent item, I got lost while answering and used `grpstats` instead. Will update my answer


Difference between .state('init.home') and .state('/home')

Question: I am new to angularjs. can you explain me difference between
.state('init.home') and .state('/home')
Thanks Inadvance.
Answer: I believe you're referring to ui-router and in that case, here's the difference:
.state('init.home') would be something you can reference within an HTML template using Click me and it will transition the user to that state.
That state would look something like this:
.state('init.home', {
  url: "/home",
  templateUrl: "views/home.html",
  controller: "HomeController"
})

Generally you would also have .state('init') as the parent, something like:
.state('init', {
  abstract: true,
  resolve: {
    authenticated: ['$auth', function($auth) {
      if (!$auth.isAuthenticated()) {
        $state.go('login');
      }
  }
})

That would ensure any transition to a child state under 'init' would have access to 'authenticated' for ensuring the user was logged in, as an example.
.state('/home') isn't actually valid. You would instead define the state and use the 'url' parameter to specify the location:
.state('home', {
  url: '/home'
}

This page is probably a good resource to review: https://github.com/angular-ui/ui-router/wiki/URL-Routing
Answer: States can be nested within each other. There are several ways of nesting states:
Using 'dot notation'. For example .state('contacts.list', {})...
please read this article for more details.


How do you position a background image inside a ?

Question: My code currently looks like this:

The
 shows up just fine, with the grey background color, but the background image won't show up at all. What am I missing here? There's no reason I should have to specify background-attachment or background-repeat, right? (I don't want it to repeat.)
Answer: Is that image referenced correctly? Like, is it not in a folder:
background-image: url('/images/myimage.jpg');

Answer: Try testing it with an image linked from the web.
Comment: That's a great idea for testing. Wish I had thought of that.


python something like assertFunctionNotCalled?

Question: Edit: This question refers to python 3.5
In python unit testing, is there a way to assert that a given block of code is not called?
I have a function I am testing that can follow either of two branches: a faster, more reliable branch if the user has logged in before, or a slower less reliable branch if this is their first visit. Basically, the first time a user logs in, the program has to request information about them from separate server, which can be slow (and, occasionally, down). Once it has the information, however, it caches it locally and should just use the local cache for the data on subsequent logins.
The end result of the function is the same either way, so there is no way for me to know which code branch it took to get the information by simply looking at the output of the function. So ideally I'd like to be able to do effectively an assertFunctionNotCalled to test that it is pulling from the local cache on the second (and subsequent) login attempt. How should I best test this?
Comment: Are you mocking out the separate server for these tests? What have you tried so far?
Comment: @jonrsharpe: no, I do the actual request. Since it is just a SELECT, it doesn't hurt it to be run many times.
Comment: It might not hurt anything, but does make it more difficult to test (and to tell which side any breaking changes happened). Perhaps this should be a unit test against a mock, and the tests that actually call out should be separate integration tests.
Comment: @jonrsharpe That makes sense. And with that function being a mock, I can then directly check if it was called (or is that what MagicMock is needed for?). Just check that the function works as desired completely separately.
Answer: Use the bool called like so:
from mock import patch
with patch('something') as mock_something:
    self.assertFalse(mock_something.called)


what is difference between async private and private async?

Question: I am just wondering that what is basic difference between async private and private async methods. Which declarations is good to implement? Does it effect on any performances ?
Any one knows ?
Answer: There's no difference at all - use whichever style you like.
Answer: They are both the same. Access Modifiers and Modifiers can be in any order, the Compiler doesn't care which order you put them in. Usually the Access Modifier is put before the Modifier.
public const // Is the same as:
const public

private static // Is the same as:
static private


Netflix Issue : Firefox can't find the server at movies.netflix.com

Question: I'm new to Ubuntu world...recently, I have installed Netflix desktop on my system. But, it is not working...giving an error "Firefox can't find the server at movies.netflix.com."..
I have Firefox and Chrome web browser installed on my system. Netflix website is opening on Chrome but not on firefox.
Please help me. Thank You
Comment: What exact commands did you use to install netflix-desktop and how are you starting the app?
Comment: Don't remember the commands....I googled it and followed the steps......I added netflix desktop in left side toolbar and accessing it.....
Comment: full error msg :
Comment: Server not found

          Firefox can't find the server at movies.netflix.com.

  Check the address for typing errors such as
    ww.example.com instead of
    www.example.com
  If you are unable to load any pages, check your computer's network
    connection.
  If your computer or network is protected by a firewall or proxy, make sure
    that Firefox is permitted to access the Web.
Answer: I've been having the same issue for quite a while, and just recently fixed it. I was getting the exact same error, but it would actually work on the rare occasion when I closed and re-opened it a ton of times. I changed the default DNS servers for my connection in Ubuntu to 220.127.116.11,184.108.40.206 (Google DNS), and it's worked 100% so far.
I'm still not sure exactly what caused this though. I'm using Xubuntu 64 bit, I didn't have wine installed previous to netflix-desktop, and am using Mediacom internet.


Processing inputs and report success or error

Question: I have a program that gets requests (an array of strings of size n) from different domains (each input value is called as a domain) for each second i.
Within 5 seconds for a given domain the program should accept at most 2 successful requests.
Also at most 5 successful requests in 30 seconds.
For each request the program should return either "success" if accepted or "error" if not accepted.
Example:
n = 9, requests = ["xyz", "abc", "xyz", "pqr", "abc", "xyz", "xyz", "abc", "xyz"]

Result =
["success", "success", "success", "success", "success", "success", "error", "success", "success"]

Explanation:
domain xyz occurs at indices = [0,2,5,6,8]
domain abc = [1,4,7]
domain pqr = [3]

If we pick index 6, if we pick 5 seconds range there are 2 successful requests at 2 and 5, so we get an error response at index 6.
Remaining cases we get success response.
Constraints
n range is 1 to 10^4
input string contains lowercase English letters.

Here is what I tried:
public static List<String> solve(List<String> requests) {
    List<String> result = new ArrayList<>();
    Map<String, List<Integer>> map = new HashMap<>();

    int n = requests.size();
    for(int i=0; i<n; i++) {
        String s = requests.get(i);
        int time = i;

        // remove items older than 30 seconds
        while(!map.getOrDefault(s, new ArrayList<>()).isEmpty() && time - map.get(s).get(0) >= 30) {
            map.get(s).remove(0);
        }

        // remove items older than 5 seconds
        while(!map.getOrDefault(s, new ArrayList<>()).isEmpty() && time - map.get(s).get(0) >= 5) {
            map.get(s).remove(0);
        }

        //check if we have 2 successful requests for given domain
        if(map.getOrDefault(s, new ArrayList<>()).size() >= 2) {
            map.get(s).remove(0);
            result.add("error");
        } else {
            result.add("success");
            map.computeIfAbsent(s, k-> new ArrayList<>()).add(time);
        }
    }
    return result;
}

When I tried to solve it my program fails saying wrong output for many test cases. What is the correct approach to solve this problem.
Comment: It looks like your approach doesn't handle the case where you have less than or equal to two successful requests within five seconds but more than five successful requests within thirty seconds; e.g a specific domain `d` appears at times `[0, 5, 10, 15, 20]` and you're considering a request for it at time between `20` and `30`. Also not providing failing edge cases or the driver program makes it a bit harder to debug.
Comment: @wLui155, the first while loop is to check 30 seconds time constraint, I have second while loop to check 5 second time constraint. The next if condition for 2 successful requests
Answer: You don't check anything after first while loop, in fact you could just skip it and get the same result, it is doing absolutely nothing that the next while isn't doing anyway. The second while loop leads to discarding all values not in a 5s range, so it is impossible to check the 30s condition.
Fixed code (also using LinkedList instead of ArrayList where it is used like a Queue which would shift all elements in the ArrayList every time you remove the head).
public static List<String> solve(List<String> requests) {
    List<String> result = new ArrayList<>(requests.size()); // you know capacity
    Map<String, LinkedList<Integer>> map = new HashMap<>();

    int n = requests.size();
    for(int = 0; i < n; i++) {
        String s = requests.get(i);
        int time = i;
        // remove items older than 30 seconds only
        // no unnecessary list creations
        while(map.containsKey(s) && !map.get(s).isEmpty()) && time - map.get(s).getFirst() >= 30) {
            map.get(s).removeFirst();
        }
        // add element, you also need it in error case for next iteration
        map.computeIfAbsent(s, k-> new LinkedList<>()).add(time);
        // check both conditions now
        // the 2nd part is the general way to test if more than x elements in y time
        int m = map.get(s).size();
        if (m > 5 || m > 2 && time - map.get(s).get(m - 3) < 5) {
            result.add("error");
        } else {
            result.add("success");
        }
    }
    return result;
}

Comment: ` if (m > 5 || m > 2 && time - map.get(s).get(m - 3) < 5) {` can you explain more about this line of code
Comment: @learner yes. && has higher precedence, so it is the same as `m > 5 || (m > 2 && time - map.get(s).get(m - 3) < 5)`. The first part checks if there are more than 5 elements within 30 seconds (because those outside are discarded) the second part first verifies that there are more than 2 items and if the third from behind is within 5 seconds then we have 3 elements in the last 5 seconds because the times are ordered.


How to run a test plan multiple time with successive increasing concurrency

Question: I have a test plan. Set some users there. How can I run this test plan multiple times consequently with 1x load, 5x load, 10x load without change the test plan and  keep all the logs with unique log name?
Answer: Use property for Thread Group settings, for example
Put Thread Group's Number of Threads value as ${__P(threadNum,1)}
Call the jmx with different property value -JthreadNum=1, -JthreadNum=5, -JthreadNum=10
That way you will achieve different load with same test plan


How can I reset my game progress?

Question: I made a lot of progress in A Dark Room a long time ago. Now I want to start from scratch. Can I reset my progress somehow?
Comment: There's a restart link at the bottom right of the screen. I haven't tried it because I don't want to lose my progress, but wouldn't that do the trick?
Answer: As Lex said in his comment there is a restart button. Once you hit it, a dialog box will pop up and check to make sure you really want to restart the game. Hit yes and you will start again in the dark room where you have to light the fire. You won't be able to get back your data unless it is on a save slot so be careful.

How can I reset my game progress?


How to force all spawner mobs to spawn on one platform?

Question: I want to make a mob drop trap with spawners in the Nether, and as it's the Nether I can't use water, so I want to have them spawn on one platform which retracts with pistons every so often. I tried to cover the area around the platform with cobblestone slabs, but the mobs were just spawning on the slabs. How do I make sure they spawn on that platform only (with the least amount of blocks)?
I recreated the platform with the spawners in a superflat world, the gold blocks represent the platform where the mobs should spawn:
Comment: @Riftcaster added it. Not the original spawners as those have too many failed attempts in them to serve as a proper image, but a similar spawner platform
Comment: Is it possible for you to include a picture so that we can get a better image of what you mean?
Comment: Have you thought of using torches or lava, lol?
Comment: @Riftcaster For some reason, lighting the place didn't work. Filling the are with blocks, like Rudolf answered, did work though
Answer: To prevent Blazes spawning around the platform, you can do a few things:

Fill the area around with blocks, or
Fill the ground and adjacent walls with torches. Place them everywhere, on each block you can, except the platform and it's close surroundings

I'd recommend doing something in between - encasing the spawner and platform, and fill the area outside of the box with torches.
Good luck!


Proof that rational polynomials have at least one rational root

Question: Every odd degree polynomial with real coefficient has at least one real root, that i can prove. but i dont know how to prove that every odd degree polynomial with rational coefficients has at least one rational root?
Comment: I'm happy to hear that you can't prove it, because, as M10687.  says, this simply **isn't true**!
Comment: The intermediate value theorem is not true over the rational numbers, see [here](http://math.stackexchange.com/questions/1586543/why-is-the-rational-number-system-inadequate-for-analysis). So the proof you know will not work. For good reason, because it is no longer true.
Comment: You may be confused about what the https://en.wikipedia.org/wiki/Rational_root_theorem says, which is "**if** a polynomial has a rational root, then it satisfies a certain condition" - but it doesn't say **all** polynomials **must** have rational roots.
Comment: I'm voting to close this question as off-topic because it asks for the proof of a non-result.
Answer: Consider $x^3+ 2$. Does this have a rational root?
Comment: now i get it thank you!
Comment: but how do i prove it with a polynomial with rational coefficients like 3/4x^3 +2?
Comment: That polynomial has rational coefficients, 1 and 2 are rational


Female only persona

Question: i'm working on building personas at the moment, and was wondering how to choose gender for persona. According to gAnalytics and Facebook we have 70%, and 80% Female. Does this mean we should ignore Males in personas, and in design decision?
And if so, would that still be the case if their percentage is increasing?
Thanks in advance!
Comment: Please would you add details about the scenario you are modelling with personas? I am trying to learn how they are used.
Comment: where are you @Alvaro ? just answer it!
Answer: What you have now is a clear statistical evidence that shows most of your audience is female, and that you should take special care about that evidence.
Statistical evidence also shows that AT LEAST 20% of your audience is male. That is a really big number. Just imagine telling your SEO or stock holders "oh, it's just 20% so we have no problem in giving that away".
More important: you don't provide any info on your service, but it obviously caters a female audience. Then... why do you have such important amount of males? There's something there. And in the few cases I have seen this happen, it ended in a very interesting opportunity.
Basically, it seems you have something that is a bit diffuse somehow, and with a few adjustments, it can become something else. Probably more users, or more sales from that existing group or whatever (again, I have no idea what your service is about, but you get the concept)
In short: not only you need male personas, but they're of utmost importance
Comment: Thanks for your detailed response, that makes a lot of sense now!
Answer: So, if your product is exclusive (100%) for women (for example Period Tracker app or something like that) then your personas should be women. But, if your product will be used by at least 1 man, then you should create a persona that represents that target category, even if it's 1% of your target. Every user counts.
Answer: Unless gender is the ONLY factor of interest, you should also create personas that encode ethnic identity, age, social class, and perhaps physical limitations.

Female only persona


Creating the two column design of a scientific paper

Question: I want to create a document similar to the format of the following paper:
https://dl.dropboxusercontent.com/u/84207818/Neural-network-based-PHY-layer-key-exchange-for-wireless-communications.pdf
The above format is the design of a scientific paper, thus are there any guides or ways to create a document with a similar design? In TeX, libreoffice or anything?
Answer: If you decide to go with LaTeX, you can get pre-made templates for conference proceedings and IEEE transactions (journals) from the IEEE website. They also have Microsoft Word 2003 'templates' there (really just doc files) which should work to some extent in LibreOffice, at least to provide a basic format you can start with.
Everyone will have their own favorite TeX/LaTeX environment - personally I'm using TeXmaker at the moment (which you can find in the repository). To use the IEEE templates you will probably also need to install the texlive-fonts-recommended package.
Comment: They are (or at least the one that I'm currently using is) distributed under the LaTeX Project Public License (LPPL) - see http://latex-project.org/lppl/
Answer: Yes, it's possible in LibreOffice Writer by using sections (Insert -> Section).
Comment: I'd just google "LaTeX tutorial" (and make sure safe search is on, for Latex might lead to, well, distracting results ^^). Installation is rather easy, just get the texlive-generic-recommended package for starting `sudo apt-get install latex-generic-recommended`). You can add additional LaTeX packages later when needed. I wouldn't go for texlive-full, since it requires a huge amount of disk space... For editing, Lyx is a rather nice tool, though many purists will telly you that vim or emacs are the only LaTeX editors worth using ;-)
Comment: Just for your information: Most scientific papers are written using LaTeX [citation needed] and journals often supply premade LaTeX style files which should be used when writing papers for them. Therefore, although it's a lot of work, it might be worth to learn LaTeX instead of using LibreOffice to write scientific papers.


Content background cut off

Question: Scroll to the right and you'll see the background is truncated:

div {
  width: 300px;
  overflow: auto;
}

p {
  background: green;
}

ThisIsSomeText.ThisIsSomeText.ThisIsSomeText.ThisIsSomeText.ThisIsSomeText.ThisIsSomeText.ThisIsSomeText.ThisIsSomeText.ThisIsSomeText.ThisIsSomeText.

Why does it happen? What's the solution?
Answer: Try this code
this is because p doesn't get its actual width
p {
    background: green;
    float: left;
}

div {
  width: 300px;
  overflow: auto;
}

p {
  background: green;
  float:left;
}

ThisIsSomeText.ThisIsSomeText.ThisIsSomeText.ThisIsSomeText.ThisIsSomeText.ThisIsSomeText.ThisIsSomeText.ThisIsSomeText.ThisIsSomeText.ThisIsSomeText.

Comment: Why does it happen? What does `float: left;` do?
Comment: this is because p doesn't get its actual width.By applying float it gets its complete width
Answer: use the width and overflow in the same element as background. i have edited the snippet

div {
  width: 300px;
  overflow: auto;
}

p {
  display: inline-block;
  background: green;
}

ThisIsSomeText.ThisIsSomeText.ThisIsSomeText.ThisIsSomeText.ThisIsSomeText.ThisIsSomeText.ThisIsSomeText.ThisIsSomeText.ThisIsSomeText.ThisIsSomeText.

Comment: It shrinks the space between the scrollbar and the text, i.e. the paragraph margin goes outside the scrollbar.
Comment: then, you can simply use `display: inline-block` for `<`p>`. but this is not a good idea to do it. if you need this kind of output, i recommend using `span` instead of `p`. i have edited the above snippet
Answer:

ThisIsSomeText.ThisIsSomeText.ThisIsSomeText.ThisIsSomeText.ThisIsSomeText.ThisIsSomeText.ThisIsSomeText.ThisIsSomeText.ThisIsSomeText.ThisIsSomeText.

div {
      width: 300px;
      overflow: auto;
    }

    p {
      background: green;
    overflow: auto;
    }

Fiddler link https://jsfiddle.net/o0eqoqmh/
Answer: Or you can just set p as inline or inline-block element

div {
  width: 300px;
  overflow: auto;
}

p {
  background: green;
  display: inline-block;
  /* OR
  display: inline;
  */
}

ThisIsSomeText.ThisIsSomeText.ThisIsSomeText.ThisIsSomeText.ThisIsSomeText.ThisIsSomeText.ThisIsSomeText.ThisIsSomeText.ThisIsSomeText.ThisIsSomeText.

Content background cut off


What is the lifespan of PVC pipe in an open loop?

Question: I have an open loop geothermal heat pump. It takes well water and using schedule 40 PVC, sends the water throughout the house to air handlers and then back out to an injection well.
The PVC carrying the well water is about 34 years old. It is under a constant low level vibration from the well pump.
Do I need to worry about the PVC bursting as it ages?
Comment: Is any of the piping system exposed to sunlight?
Comment: Yes, a part of the system near the well pump. However, I'm not worried about that part breaking. I'm worried about the PVC once it's running inside the walls of my house.
Comment: Once the pipe enters the ground, vibration from the pump will be pretty well damped.
Comment: It is less but remarkably I can still hear the vibration on floor from pipes on the opposite end of the house.
Answer: The life span depends on the age of your pipes.
Those that were manufactured a few years back, ( more than 10 years) will last about 50 years.
Newer PVC technology gives a life expectancy of 100 years.
Of course this all depends on what conditions the pipes are subject too.
In the normal course of use the glue used to connect the pipes will fail before the pipes themselves.   Still, 25 to 40 years is not unexpected.
Comment: Fixed that.  Thanks for pointing that out.
Comment: @RMDman isn't PVC glue more like welding? Where it dissolved the pipe and the fitting and they bond as if they are a single piece? Do PVC connections really deteriorate faster than the pipes?
Comment: Does the OP's 34 year old pipe fall into the "few years back, 50 year life expectancy" range, or is that considered "newer PVC tech" and he can expect longer life? "A few years back" is rather vague...
Comment: Thanks for the reply, @RMDman. Towards, Eli Iser's point, do you feel this other post is incorrect - it states the PVC glue welds and should last as long as the pipe: https://diy.stackexchange.com/questions/49211/what-is-the-lifespan-of-pvc-cement?rq=1
Comment: THe glue does melt the pvc. However the perception that the 2 pieces become one and therefore stronger is a misconception.  The reality is that often too much glue is applied and the joint becomes weaker.  From a standpoint of degradation over time this often leads to failure  at the joint.


How to solve $ \displaystyle\int \bigg(\small\sqrt{\normalsize x+\small\sqrt{\normalsize x+\sqrt{ x+\sqrt{x}}}}\;\normalsize\bigg)\;dx$?

Question: How to solve this:
$$\displaystyle\int \bigg(\small\sqrt{\normalsize x +\small\sqrt{\normalsize x +\small\sqrt{\normalsize x +\sqrt{x}}}}\;\normalsize\bigg) \;dx$$
Comment: I don't think that integral is huge enough.
Comment: Seems like this is a tough one, at least mathematica cannot find it http://www.wolframalpha.com/input/?i=Integrate[Sqrt[x+%2B+Sqrt[x+%2B+Sqrt[x%2BSqrt[x]]]]%2Cx]
Comment: What does it mean to "solve" an anti-derivative?
Comment: I can help with $I=\int \sqrt{x+\sqrt{x}}dx$: Let $u(x)=\sqrt{x}$. Then $dx=2\sqrt{x}du$ and $I$ becomes $I=\int \sqrt{u^2 + u}2udu$. We integrate by parts and $I=2[\frac{u}{2\sqrt{u^2+u}}-\int \sqrt{u^2+u}du]$. Let $J=\int \sqrt{u^2+u}du$. Then $J=\frac{1+2u}{4}\sqrt{u^2+u}-\frac{1}{8}ln |2u+1+2\sqrt{u^2+u}|+c$ (from tables).
Comment: You could try a series expansion.
Comment: Just let $u=\sqrt{x+\sqrt{x+\sqrt{x+\sqrt{x}}}}$ is OK. Then you will get $x$ in terms of polynomial of $u$. WolframAlpha canot solve it because the process time is excessed.
Answer: While this is not an answer, I posted it as an answer so that I can attach the graph.
On the graph you can see how close the 2 functions are. Using this fact may help.
The Black graph is the original function and the Red graph is for the approximate function.

A better approximation for the function $f(x)=\displaystyle\bigg(\small\sqrt{\normalsize x+\small\sqrt{\normalsize x+\sqrt{ x+\sqrt{x}}}}\;\normalsize\bigg)$ is:
$0.5(1+\sqrt[]{1+4x})$
This approximation was obtained from Nested Radicals, This formula is an exact value for the infinite case, so it may be used as an approximation only in your case.
A picture of the 2 functions is shown below.
The Black graph is the original function and the Red graph is for the approximate function.
Comment: How did you come up with this approximation? Can you post the proof that it asymptotically approximates the given function?
Comment: In fact I can't claim that it an optimal approximation since I came across it by plotting various curves and noticed that this one was among the better ones. The main point I wanted to show is that there may be a good approximation for the original function that may help.


How do I change the primary URL of my Google Sites website?

Question: I have a Google site that is accessed using Google site's usual URL for sites they host: http://sites.google.com/site/<sitename>. I recently purchased a domain name for myself, and I set a subdomain of this new domain to point to my website hosted at Google Sites (sitename.mydomain.com). Unfortunately, Google and all the other search engines still point to pages at the old URL. Is there a way for me to make these search engines point to the new URL instead? Or alternately, is there a way to redirect users who visit the site at the old URL to the new one?
Comment: Did you follow [these steps](http://support.google.com/sites/bin/answer.py?hl=en&answer=99448)? And remember that it might take upto 24 hours before your domain points to your Google site.
Comment: @Jacobvdb I already did that. What I want to do now is change my site's PRIMARY url, or add a redirect so that people actually see the new domain.
Comment: is it a normal gmail account or is it a apps account?
Answer: More ->
Manage Site->
From the left menu pick web address
On this page you will find
http://sites.google.com/site/mygsite and
Add web address
Here you put your domain www.domain.com

Now where you registered your domain (www.domain.com) you will have to add a CNAME entry,
which should look something like this.
name                      Type               Data
www.domain.com   CNAME   ghs.googlehosted.com
or
Host                     Type                     Content
www                    CNAME       ghs.googlehosted.com
Like this you get your domain mapped and like this long sites url does not show up anymore.
Now if you have another Gsite within your gmail account
http://sites.google.com/site/my2ndgsite
Which you want to add with the following mapping mysite.domain.com to your domain.
You need to add the Web Address to your Gsite just like above.
And where you have your domain registered you have to create another entry something like this
name                        Type               Data
mysite.domain.com   CNAME   ghs.googlehosted.com
or
Host                       Type                     Content
mysite                    CNAME       ghs.googlehosted.com
After this you will have to inform in the Google site that they can verify your domain mapping.
And after that you will have to wait some time (24h) before actual mapping takes place.
Note I
There used to be some domain registries that required a point (.) at the end of the ghs.googlehosted.com so it would be like this ghs.googlehosted.com.
Note II
Before the hosted domain used to be like this ghs.google.com. I am not 100% sure if that is not used anymore.
Comment: That's nice, but it's not what I was asking. As I've said, I already have my domain set up, I just need a way to make search engines and users use the new URL instead of the old one.
Comment: Create a second site in your gmail account with the mapping and leave the old long url with a different landing page where you leave a message with a link to your new domain url. You can try to insert an iframe with such a tag, though I never tried that!
Comment: The problem with that is that it doesn't preserve my raking in Google's (and other search engines) search results. I guess that might be the only way though.
Comment: @Jacobvdb can you help me with this? I did all the steps but when I go to my custom url (https://www.infinitymundi.it/) it works but the browser changes the custom url to the google site url (https://sites.google.com/view/something)
Answer: You could leave a page with a meta refresh at the old url pointing to the new one?
http://en.wikipedia.org/wiki/URL_redirection#Refresh_Meta_tag_and_HTTP_refresh_header
Comment: Hmm, maybe. I don't think Google Sites lets me put tags in the head section of the document though. I wonder what would happen if I put it in the body?


Child/childhood child development tag

Question: Should we have tags for issues about childhood/development etc?
will provide linked suitable questions if oyu like
Comment: We've got a developmental-psychology tag and a parenting one, I think these cover most of the bases we'll encounter.
Answer: I think it is a good question. In some sense child psychology is a subfield of developmental psychology. I remember in undergraduate studies, there were discrete textbooks devoted to child psychology versus developmental psychology.
And there certainly are different topics that concern the development of children, versus change in adulthood and older adulthood.
I think we briefly had a child-psychology tag, but at some point decided to just go with the developmental-psychology tag.
I guess it relates to a general issue about the best level of generality to have tags.
So at the moment we have:

parenting
aging
developmental
parenting

That said, developmental is a major tag, which might get split in some strange ways if there was a separate child-psychology tag.
So with all that meandering, I'm happy with the status quo of just having a developmental-psychology tag to capture it all, but I don't feel too strongly either way.
Comment: Wow, we have two parenting tags? :)
Answer: Until quite recently, developmental psychology was concerned with childhood and adolescence only, because it was thought that psychological development ended with the advent of adulthood. Developmental psychology was synonymous with "childhood psychology". Therefore I think that even after the extension of developmental psychology over the life span it still covers the whole of "childhood psychology", with the exception of those aspects that lie within clinical psychology.

Child/childhood child development tag


Displaying output of arbitrary command on Unity panel

Question: In my current setup running Ubuntu Natty and GNOME 2, I use the COMPA applet to display information on my top GNOME panel that I wish to always be visible on my desktop. I really like this ability to show exactly the information I want, through writing a Python script that outputs something to stdout, and the having COMPA print this on my GNOME panel, updating every x seconds. Right now I have the current price of bitcoins up there, as well as the stock price of Google. . You can see the plugin in question (COMPA) and the information it outputs in the middle of the top panel (right click, "open image in new tab" for larger size).
Is there a way to achieve this in Unity? I want to have the information always visible, I shouldn't have to click anything to view the information.
Comment: came here with the exact same question and ended up fascinated by the image on your desktop. is it available online by any chance? thanks!
Comment: Here's a tip for finding similar images using Google. Works for almost any image: (1) right click image and choose "copy image location/URL", (2) perform a Google search using this URL, (3) on the search results page click "search by image", next to the text "Find other sizes of this image:" click "All sizes" and there should be plenty of background-friendly versions of the image. Like here: http://www.freecomputerwallpapers.net/view/fire_breathing_wallpaper-2560x1600.html
Answer: The program Indicator-Sysmonitor for Unity fulfills this purpose, and is basically the replacement for COMPA in Unity. Below is a link to get it to act like a netspeed-like panel applet, completely configurable by modifying the script supplied in the article:
http://www.webupd8.org/2011/05/how-to-display-network-upload-download.html
Answer: For Gnome Classic (I run 14.04), there is also an indicator applet that will let you run a command or a shell script and display the text.
<code>sudo apt-get install command-runner-applet
</code>
Then hold down Window+Alt and Right Click on panel bar and add applet.
The command runner applet has an orange icon.
Right Click on it once it is placed on the panel and add your command or shell script location to the text box.


Why isn't the 3 body problem solvable?

Question: I'm new to this "integrable system" stuff, but from what I've read, if there are as many linearly independent constants of motion that are compatible with respect to the poisson brackets as degrees of freedom, then the system is solvable in terms of elementary functions. Is this correct? I get that for each linearly independent constant of motion you can reduce the degree of freedom by one, but I don't understand why the theorem

Theorem (First integrals of the n-body problem) The only linearly independent integrals of the $n$-body problem, which are algebraic with respect to $q$, $p$ and $t$ are the $10$ described above. (http://en.wikipedia.org/wiki/N-body_problem#Three-body_problem)

implies that there is no analytic solution (I think this is synonymous with closed-form solution, and solution in terms of elementary functions). I've been trying to think about it, but I can't reason it, and apparently integrability implies no chaos, which I can't see either.
Comment: Have you read http://en.wikipedia.org/wiki/Integrable_system ?
Comment: "Integrable by quadrature", which is the classical (Liouville) notion of integrability, does not mean "integrable in terms of elementary functions". It means that you can in principle write down the solution, provided that you are able to compute all antiderivatives and inverses of functions that you happen to come across along the way. But unfortunately not all antiderivatives and inverses of elementary functions are elementary, as you probably know...
Comment: Fun fact: the quantum mechanics 3-body problem *is* solvable!
Comment: All of which leads to the curious, and unanswered question, is the solar system stable?
Comment: I had understood that a perfectly elastic simultaneous collision between three bodies could not be solved - momentum and energy are conserved, but this does not determine the subsequent motion.
Comment: @MarkBennet Can you specify what are the initial conditions of this system which does not determine the subsequent motion?
Comment: @Xnyyrznaa: I think the idea was that, given an energy E, you could fire three point particles of from the origin in a variety of ways having zero total momentum: particles of equal mass at equal speeds and at $120^o$ angles will illustrate. Reverse one of these motions. How can you tell how the particles emerge?
Comment: @Mark: while that is true, the set of initial conditions which leads to a three-body simultaneous collision has (at least morally) measure zero, which I don't think is completely the resolution to the question asked.
Comment: Roughly speaking, the idea is counting the number of degrees of freedom. For each particle you have 6 degrees of freedom (3 for position and 3 for momentum). At three or more particles you have at least 18 degrees and only 10 integrals, so you don't have closed form solutions. How about 2 particles you ask? As it turns out you can cheat a bit there: by working in the centre of mass reference frame, you kill 6 integrals (0 center of mass and 0 linear momentum). However, conservation of momentum means that the two body evolution is only two dimensional! So for the two body problem you really ...
Comment: ...only have 4 degrees of freedom, which is just enough to kill using the remaining integrals of motion (conservation of angular momentum and conservation of energy). For three and more bodies you don't have such nice reductions.
Comment: @WillieWong Indeed - I put it in a comment for that reason. It was a one-liner which I remember from a lecture once. There is an article in the Princeton Companion to Mathematics which suggests that Sundman produced a series solution for cases with non-zero angular momentum (which avoids triple collisions).
Comment: @AlexR. in what sense is it solvable? Does it admit a closed form solution or is the solution representable in terms of e.g. quadratures? And, to be precise, by the quantum 3-body problem problem do you mean initial-value problem for TDSE or boundary-value problem for TISE?
Comment: @Ruslan: the energies of the particles can be derived as generalizations of Lambert's W Function. See here for example: https://en.m.wikipedia.org/wiki/Euler%27s_three-body_problem#Quantum_mechanical_version
Comment: @AlexR. it's not the _true_ 3-body problem: there the problem is simplified to that of motion of electron (1 body!) in the field of two fixed nuclei.
Comment: @Ruslan: It was kind of a joke.
Answer: For the classical 3-body problem, the obstacle to a solution is, as you said, integrability.  This is also sometimes called separability, and when it fails, it means that there does not exist a manifold in phase space such that on that manifold, the equations for the independent degrees of freedom of the equation are separated into independent equations.  This is in turn related to being able to interchange mixed partial derivatives as you mention for the Poisson brackets, because if the equations separate, derivatives (and therefore integrals) can be performed in any order.
The relationship between this and chaos is that non-integrable systems are generically chaotic -- meaning "usually" or "observably" chaotic, the obstacle to separating the degrees of freedom being that there are intersecting stable and unstable manifolds of hyperbolic periodic points which cause the solutions to fold endlessly in phase space.  "Generic" has a definition here, it means true on a countable interesection of open dense sets -- in other words, for every solution, there is an open subset of solutions arbitrarily close which have this property.
Hope this helps.  There is a completely worked out solution for what is called the "restricted 3-body problem" (3 body problem in which one of the bodies has no mass) in Jurgen Moser's Stable and Random Motions in Dynamical Systems, which shows that even in this case, the motion of the massless body is chaotic for most initial conditions.
Answer: 2-Body Problems also exist which have no specific solution such that there is a range of solutions for a given physical condition.  This means solvability is not based on the number of bodies but the state and representation of space.
Indian Journal of Science and Technology published a physical proof called, "Binary Precession Solutions based on Synchronized Field Couplings"
http://www.indjst.org/index.php/indjst/article/view/30008/25962
In this research, a generalized wave function with classical characteristics was isolated within the motion of binary stars.  The wave function provided the first tool for cracking the complex motion of DI Herculis and other binary stars that had several measured precession solutions.
http://xxx.lanl.gov/pdf/1111.3328v2.pdf
In this research, published about a year after the Indian Journal of Science and Technology publication, mathematicians from Imperial College London produced a proof for the physical existence of wave functions.  The research was published in Nature Magazine.
Comment: Looking at the beginning of the first paper, I missed that it was regarding celestial mechanics; however, it does involve GR. [tag:classical-mechanics] specifically refers to Newtonian-only mechanics. So, although this is closer than I previously thought, and your paper looks quite interesting, I don't think this answer really addresses the question.
Comment: This does not answer the question. This answer and these citations concern quantum mechanics, not celestial mechanics.
Comment: Why isn't the 3-Body problem solvable? Implies that 2-Body systems are solvable. I prove that most 2-Body systems are unsolvable such that solvability as it relates to exactness cannot be achieved when the motion exist when a statistical form. The classical wave function produced natural solutions. GR, Newtonian mechanics and MOND failed to calculate precessions for systems such as DI Herculis and others. Ed Guinan spent over 30 years studying the DI Herculis system and why it did not conform to GR. The Classical Wave Function calculated both measurements so we know it is correct.
Comment: Binary stars are celestial and the first paper describes the mechanics of those systems.  The second paper supports one conclusion reached in the first paper.  The whole bases of the 3-Body problem is centered around the number of bodies in the system and it is clear the bases has more to do with the representation of space then number of bodies.  The proof is simply, we have 2-Body problems with unpredictable motion as it relates to Newtonian mechanics and General Relativity.  These are fact based citations not just conjecture based citations.
Comment: The classical Wave Function analysis meant Ed Guinan's original measurement was correct as well as the current measurement. An MIT group published in Nature claiming to solve the problem in 2009. This is Ed Guinan's response. http://adsabs.harvard.edu/abs/2010AAS...21541934Z Notice the last line in the abstract and comments related to the MIT group's work. It is experimental proof the system is changing between both measurements. The system's motion is not exact but exist within the statistical form of the classical wave function.
Comment: Furthermore, DI Herculis' was once postulated to be a 3-Body elliptical problem as a solution to its complex motion.
http://adsabs.harvard.edu/abs/1991ApJ...375..314K
No evidence ever identified a third-body.  Observational evidence does show DI Herculis is a detached binary system and the classical wave functional analysis models the system this way such that only the primary mass contributes to the complex statistical motion of the system.  The solution is the most accurate for both measurements not excluding the MIT group's evaluation.
http://adsabs.harvard.edu/abs/2010arXiv1002.2949C
Comment: In conclusion, GR and Special Relativity's beta structure in the Lorentz Factor is how coupling is defined in the Classical Wave Function.  Einstein's gravitational lensing for light around the Sun as well as Mercury's precession was calculated via this synthesis proving Einstein's Space-Time and Wave Functions are the same phenomena.

Why isn't the 3 body problem solvable?


remove dictionaries from list based on key value from nested dictionary in python

Question: I have the following list of dictionary:
item = {
    "relationship": [
        {
            "name": "",
            "id": "",
            "type": "",
            "relationship": {
                "id": "3006:33",
                "fkey_logical_column_id": "2006:41",
                "pkey_logical_column_id": "2006:51",
                "fkey_column_id": "3003:9",
                "fkey_column_name": "\"localhost:1521/orcl\"..\"OT\".\"ORDER_ITEMS\".\"ORDER_ID\"",
                "pkey_column_id": "3003:17",
                "pkey_column_name": "\"localhost:1521/orcl\"..\"OT\".\"ORDERS\".\"ORDER_ID\"",
                "fkey_table_id": "3001:7",
                "pkey_table_id": "3001:14",
                "pkey_physical_table_name": "",
                "pkey_business_table_name": "",
                "type": "",
                "fkey_business_column_name": "\"ofline_online_test\".\"ORDER_ITEMS\".\"ORDER_ID\"",
                "pkey_business_column_name": "\"ofline_online_test\".\"ORDERS\".\"ORDER_ID\"",
                "from_type": "0..1",
                "to_type": "n..n"
            }
        },
        {
            "name": "",
            "id": "",
            "type": "",
            "relationship": {
                "id": "3006:34",
                "fkey_logical_column_id": "2006:42",
                "pkey_logical_column_id": "2006:70",
                "fkey_column_id": "3003:10",
                "fkey_column_name": "\"localhost:1521/orcl\"..\"OT\".\"ORDER_ITEMS\".\"PRODUCT_ID\"",
                "pkey_column_id": "3003:29",
                "pkey_column_name": "\"localhost:1521/orcl\"..\"OT\".\"PRODUCTS\".\"PRODUCT_ID\"",
                "fkey_table_id": "3001:7",
                "pkey_table_id": "3001:25",
                "pkey_physical_table_name": "",
                "pkey_business_table_name": "",
                "type": "",
                "fkey_business_column_name": "\"ofline_online_test\".\"ORDER_ITEMS\".\"PRODUCT_ID\"",
                "pkey_business_column_name": "\"ofline_online_test\".\"PRODUCTS\".\"PRODUCT_ID\"",
                "from_type": "0..1",
                "to_type": "n..n"
            }
        },
        {
            "name": "",
            "id": "",
            "type": "",
            "relationship": {
                "id": "3006:35",
                "fkey_logical_column_id": "2006:67",
                "pkey_logical_column_id": "2006:61",
                "fkey_column_id": "3003:26",
                "fkey_column_name": "\"localhost:1521/orcl\"..\"OT\".\"PRODUCTS\".\"CATEGORY_ID\"",
                "pkey_column_id": "3003:22",
                "pkey_column_name": "\"localhost:1521/orcl\"..\"OT\".\"PRODUCT_CATEGORIES\".\"CATEGORY_ID\"",
                "fkey_table_id": "3001:25",
                "pkey_table_id": "3001:21",
                "pkey_physical_table_name": "",
                "pkey_business_table_name": "",
                "type": "",
                "fkey_business_column_name": "\"ofline_online_test\".\"PRODUCTS\".\"CATEGORY_ID\"",
                "pkey_business_column_name": "\"ofline_online_test\".\"PRODUCT_CATEGORIES\".\"CATEGORY_ID\"",
                "from_type": "0..1",
                "to_type": "n..n"
            }
        }
    ]
}

I have a search id **pkey_table_id = 3001:14 ** which is present in first item of list item["relationship"][0]["relationship"]["pkey_table_id"].
I want to loop through list with key item["relationship"] and if the match is found with **pkey_table_id = 3001:14 ** i want to delete that particular item from list .So my result would be
required output
item = {
    "relationship": [
        {
            "name": "",
            "id": "",
            "type": "",
            "relationship": {
                "id": "3006:34",
                "fkey_logical_column_id": "2006:42",
                "pkey_logical_column_id": "2006:70",
                "fkey_column_id": "3003:10",
                "fkey_column_name": "\"localhost:1521/orcl\"..\"OT\".\"ORDER_ITEMS\".\"PRODUCT_ID\"",
                "pkey_column_id": "3003:29",
                "pkey_column_name": "\"localhost:1521/orcl\"..\"OT\".\"PRODUCTS\".\"PRODUCT_ID\"",
                "fkey_table_id": "3001:7",
                "pkey_table_id": "3001:25",
                "pkey_physical_table_name": "",
                "pkey_business_table_name": "",
                "type": "",
                "fkey_business_column_name": "\"ofline_online_test\".\"ORDER_ITEMS\".\"PRODUCT_ID\"",
                "pkey_business_column_name": "\"ofline_online_test\".\"PRODUCTS\".\"PRODUCT_ID\"",
                "from_type": "0..1",
                "to_type": "n..n"
            }
        },
        {
            "name": "",
            "id": "",
            "type": "",
            "relationship": {
                "id": "3006:35",
                "fkey_logical_column_id": "2006:67",
                "pkey_logical_column_id": "2006:61",
                "fkey_column_id": "3003:26",
                "fkey_column_name": "\"localhost:1521/orcl\"..\"OT\".\"PRODUCTS\".\"CATEGORY_ID\"",
                "pkey_column_id": "3003:22",
                "pkey_column_name": "\"localhost:1521/orcl\"..\"OT\".\"PRODUCT_CATEGORIES\".\"CATEGORY_ID\"",
                "fkey_table_id": "3001:25",
                "pkey_table_id": "3001:21",
                "pkey_physical_table_name": "",
                "pkey_business_table_name": "",
                "type": "",
                "fkey_business_column_name": "\"ofline_online_test\".\"PRODUCTS\".\"CATEGORY_ID\"",
                "pkey_business_column_name": "\"ofline_online_test\".\"PRODUCT_CATEGORIES\".\"CATEGORY_ID\"",
                "from_type": "0..1",
                "to_type": "n..n"
            }
        }
    ]
}

This is what I have tried:
id_input = 3001:14
item ['relationship'] = list(filter(lambda i: i['pkey_table_id'] != id_input , item['relationship']['relationship']))

Comment: Move one `['relationship']` to `i['relationship']['pkey_table_id']`
Comment: Thank you ..my updated code works `item ['relationship'] = list(filter(lambda i: i['relationship']['pkey_table_id'] != id_input , item ['relationship']))
`
Answer: The following should work:
id_input = '3001:14'
item["relationship"] = [
    i for i in item["relationship"] if i["relationship"]["pkey_table_id"] != id_input
]

Answer: You're almost right, a bit corrected your code:
Try it online!
def process(item):
    id_input = '3001:14'
    item['relationship'] = list(filter(lambda i:
        i['relationship']['pkey_table_id'] != id_input , item['relationship']))

item = {
    "relationship": [
        {
            "name": "",
            "id": "",
            "type": "",
            "relationship": {
                "id": "3006:33",
                "fkey_logical_column_id": "2006:41",
                "pkey_logical_column_id": "2006:51",
                "fkey_column_id": "3003:9",
                "fkey_column_name": "\"localhost:1521/orcl\"..\"OT\".\"ORDER_ITEMS\".\"ORDER_ID\"",
                "pkey_column_id": "3003:17",
                "pkey_column_name": "\"localhost:1521/orcl\"..\"OT\".\"ORDERS\".\"ORDER_ID\"",
                "fkey_table_id": "3001:7",
                "pkey_table_id": "3001:14",
                "pkey_physical_table_name": "",
                "pkey_business_table_name": "",
                "type": "",
                "fkey_business_column_name": "\"ofline_online_test\".\"ORDER_ITEMS\".\"ORDER_ID\"",
                "pkey_business_column_name": "\"ofline_online_test\".\"ORDERS\".\"ORDER_ID\"",
                "from_type": "0..1",
                "to_type": "n..n"
            }
        },
        {
            "name": "",
            "id": "",
            "type": "",
            "relationship": {
                "id": "3006:34",
                "fkey_logical_column_id": "2006:42",
                "pkey_logical_column_id": "2006:70",
                "fkey_column_id": "3003:10",
                "fkey_column_name": "\"localhost:1521/orcl\"..\"OT\".\"ORDER_ITEMS\".\"PRODUCT_ID\"",
                "pkey_column_id": "3003:29",
                "pkey_column_name": "\"localhost:1521/orcl\"..\"OT\".\"PRODUCTS\".\"PRODUCT_ID\"",
                "fkey_table_id": "3001:7",
                "pkey_table_id": "3001:25",
                "pkey_physical_table_name": "",
                "pkey_business_table_name": "",
                "type": "",
                "fkey_business_column_name": "\"ofline_online_test\".\"ORDER_ITEMS\".\"PRODUCT_ID\"",
                "pkey_business_column_name": "\"ofline_online_test\".\"PRODUCTS\".\"PRODUCT_ID\"",
                "from_type": "0..1",
                "to_type": "n..n"
            }
        },
        {
            "name": "",
            "id": "",
            "type": "",
            "relationship": {
                "id": "3006:35",
                "fkey_logical_column_id": "2006:67",
                "pkey_logical_column_id": "2006:61",
                "fkey_column_id": "3003:26",
                "fkey_column_name": "\"localhost:1521/orcl\"..\"OT\".\"PRODUCTS\".\"CATEGORY_ID\"",
                "pkey_column_id": "3003:22",
                "pkey_column_name": "\"localhost:1521/orcl\"..\"OT\".\"PRODUCT_CATEGORIES\".\"CATEGORY_ID\"",
                "fkey_table_id": "3001:25",
                "pkey_table_id": "3001:21",
                "pkey_physical_table_name": "",
                "pkey_business_table_name": "",
                "type": "",
                "fkey_business_column_name": "\"ofline_online_test\".\"PRODUCTS\".\"CATEGORY_ID\"",
                "pkey_business_column_name": "\"ofline_online_test\".\"PRODUCT_CATEGORIES\".\"CATEGORY_ID\"",
                "from_type": "0..1",
                "to_type": "n..n"
            }
        }
    ]
}

process(item)
print(item)

Output:
{
    "relationship": [
        {
            "name": "",
            "id": "",
            "type": "",
            "relationship": {
                "id": "3006:34",
                "fkey_logical_column_id": "2006:42",
                "pkey_logical_column_id": "2006:70",
                "fkey_column_id": "3003:10",
                "fkey_column_name": '"localhost:1521/orcl".."OT"."ORDER_ITEMS"."PRODUCT_ID"',
                "pkey_column_id": "3003:29",
                "pkey_column_name": '"localhost:1521/orcl".."OT"."PRODUCTS"."PRODUCT_ID"',
                "fkey_table_id": "3001:7",
                "pkey_table_id": "3001:25",
                "pkey_physical_table_name": "",
                "pkey_business_table_name": "",
                "type": "",
                "fkey_business_column_name": '"ofline_online_test"."ORDER_ITEMS"."PRODUCT_ID"',
                "pkey_business_column_name": '"ofline_online_test"."PRODUCTS"."PRODUCT_ID"',
                "from_type": "0..1",
                "to_type": "n..n",
            },
        },
        {
            "name": "",
            "id": "",
            "type": "",
            "relationship": {
                "id": "3006:35",
                "fkey_logical_column_id": "2006:67",
                "pkey_logical_column_id": "2006:61",
                "fkey_column_id": "3003:26",
                "fkey_column_name": '"localhost:1521/orcl".."OT"."PRODUCTS"."CATEGORY_ID"',
                "pkey_column_id": "3003:22",
                "pkey_column_name": '"localhost:1521/orcl".."OT"."PRODUCT_CATEGORIES"."CATEGORY_ID"',
                "fkey_table_id": "3001:25",
                "pkey_table_id": "3001:21",
                "pkey_physical_table_name": "",
                "pkey_business_table_name": "",
                "type": "",
                "fkey_business_column_name": '"ofline_online_test"."PRODUCTS"."CATEGORY_ID"',
                "pkey_business_column_name": '"ofline_online_test"."PRODUCT_CATEGORIES"."CATEGORY_ID"',
                "from_type": "0..1",
                "to_type": "n..n",
            },
        },
    ]
}

Answer: Here's the answer with a little modification to your own code:
id_input = "3001:14"
item['relationship'] = list(filter(lambda i: i['relationship']['pkey_table_id'] != id_input, item['relationship']))

Make sure that id_input is a valid string!
You must pass item['relationship'] to the filter function.
Answer: This should work
val_to_remove = '3001:25'
for i in item['relationship']:
    if i['relationship']['pkey_table_id'] == val_to_remove :
        item['relationship'].remove(i)


Ubuntu 16.04 logs me out immediately on some action

Question: Sometimes it happens that I try to open some program or just work on my laptop and system just terminates my session and displays login screen as if I restarted my computer. Please note that the computer did not restart, just my user session is terminated, but not as if I logged out, but kinda like an interrupt that terminates all processes and displays login form. In my journalctl -xe I have this message: gnome-session-binary[5017]: CRITICAL: We failed, but the fail whale is dead. Sorry.....
It seems that this happens randomly, but today it happened when I started a Postman.
Here is a full log from the point where Postman is being started to the point where session is restarted and login is displayed:
okt 22 15:38:16 kosta-lenovo com.canonical.Unity.Scope.Applications[4867]: Error loading package indexes: Couldn't stat '/var/cache/software-center/xapian'
okt 22 15:38:16 kosta-lenovo com.canonical.Unity.Scope.Applications[4867]: (unity-scope-loader:18305): unity-applications-daemon-CRITICAL **: daemon.vala:144: Failed to load Software Center index. 'Apps Available for Download' will not be listed
okt 22 15:38:37 kosta-lenovo audit[949]: USER_AVC pid=949 uid=106 auid=4294967295 ses=4294967295 msg='apparmor="DENIED" operation="dbus_method_call"  bus="system" path="/" interface="org.freedesktop.DBus.ObjectManager" member="GetManagedObjects" mask="send" name="org.bluez" pid=18352 label="snap.postman.postman" peer_pid=1069 peer_label="unconfined"
                                          exe="/usr/bin/dbus-daemon" sauid=106 hostname=? addr=? terminal=?'
okt 22 15:38:37 kosta-lenovo kernel: audit: type=1107 audit(1540215517.058:49): pid=949 uid=106 auid=4294967295 ses=4294967295 msg='apparmor="DENIED" operation="dbus_method_call"  bus="system" path="/" interface="org.freedesktop.DBus.ObjectManager" member="GetManagedObjects" mask="send" name="org.bluez" pid=18352 label="snap.postman.postman" peer_pid=1069 peer_label="unconfined"
                                      exe="/usr/bin/dbus-daemon" sauid=106 hostname=? addr=? terminal=?'
okt 22 15:38:37 kosta-lenovo audit[18352]: AVC apparmor="DENIED" operation="open" profile="snap.postman.postman" name="/etc/pulse/client.conf" pid=18352 comm="Postman" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
okt 22 15:38:37 kosta-lenovo audit[18352]: AVC apparmor="DENIED" operation="open" profile="snap.postman.postman" name="/dev/shm/pulse-shm-1477554153" pid=18352 comm="Postman" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
okt 22 15:38:37 kosta-lenovo audit[18352]: AVC apparmor="DENIED" operation="open" profile="snap.postman.postman" name="/dev/shm/pulse-shm-3952512136" pid=18352 comm="Postman" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
okt 22 15:38:37 kosta-lenovo audit[18352]: AVC apparmor="DENIED" operation="open" profile="snap.postman.postman" name="/dev/shm/pulse-shm-4005146755" pid=18352 comm="Postman" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
okt 22 15:38:37 kosta-lenovo audit[18352]: AVC apparmor="DENIED" operation="open" profile="snap.postman.postman" name="/dev/shm/pulse-shm-162037911" pid=18352 comm="Postman" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
okt 22 15:38:37 kosta-lenovo kernel: audit: type=1400 audit(1540215517.678:50): apparmor="DENIED" operation="open" profile="snap.postman.postman" name="/etc/pulse/client.conf" pid=18352 comm="Postman" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
okt 22 15:38:37 kosta-lenovo kernel: audit: type=1400 audit(1540215517.678:51): apparmor="DENIED" operation="open" profile="snap.postman.postman" name="/dev/shm/pulse-shm-1477554153" pid=18352 comm="Postman" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
okt 22 15:38:37 kosta-lenovo kernel: audit: type=1400 audit(1540215517.678:52): apparmor="DENIED" operation="open" profile="snap.postman.postman" name="/dev/shm/pulse-shm-3952512136" pid=18352 comm="Postman" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
okt 22 15:38:37 kosta-lenovo kernel: audit: type=1400 audit(1540215517.678:53): apparmor="DENIED" operation="open" profile="snap.postman.postman" name="/dev/shm/pulse-shm-4005146755" pid=18352 comm="Postman" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
okt 22 15:38:37 kosta-lenovo kernel: audit: type=1400 audit(1540215517.678:54): apparmor="DENIED" operation="open" profile="snap.postman.postman" name="/dev/shm/pulse-shm-162037911" pid=18352 comm="Postman" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
okt 22 15:38:37 kosta-lenovo kernel: audit: type=1400 audit(1540215517.678:55): apparmor="DENIED" operation="open" profile="snap.postman.postman" name="/dev/shm/pulse-shm-758373397" pid=18352 comm="Postman" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
okt 22 15:38:37 kosta-lenovo kernel: audit: type=1400 audit(1540215517.678:56): apparmor="DENIED" operation="open" profile="snap.postman.postman" name="/dev/shm/pulse-shm-264806627" pid=18352 comm="Postman" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
okt 22 15:38:37 kosta-lenovo kernel: audit: type=1400 audit(1540215517.678:57): apparmor="DENIED" operation="open" profile="snap.postman.postman" name="/dev/shm/pulse-shm-1076741062" pid=18352 comm="Postman" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
okt 22 15:38:37 kosta-lenovo kernel: audit: type=1400 audit(1540215517.678:58): apparmor="DENIED" operation="open" profile="snap.postman.postman" name="/dev/shm/pulse-shm-4189961922" pid=18352 comm="Postman" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
okt 22 15:38:37 kosta-lenovo audit[18352]: AVC apparmor="DENIED" operation="open" profile="snap.postman.postman" name="/dev/shm/pulse-shm-758373397" pid=18352 comm="Postman" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
okt 22 15:38:37 kosta-lenovo audit[18352]: AVC apparmor="DENIED" operation="open" profile="snap.postman.postman" name="/dev/shm/pulse-shm-264806627" pid=18352 comm="Postman" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
okt 22 15:38:37 kosta-lenovo audit[18352]: AVC apparmor="DENIED" operation="open" profile="snap.postman.postman" name="/dev/shm/pulse-shm-1076741062" pid=18352 comm="Postman" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
okt 22 15:38:37 kosta-lenovo audit[18352]: AVC apparmor="DENIED" operation="open" profile="snap.postman.postman" name="/dev/shm/pulse-shm-4189961922" pid=18352 comm="Postman" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
okt 22 15:38:37 kosta-lenovo audit[18352]: AVC apparmor="DENIED" operation="open" profile="snap.postman.postman" name="/dev/shm/pulse-shm-800050483" pid=18352 comm="Postman" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
okt 22 15:38:37 kosta-lenovo audit[18352]: AVC apparmor="DENIED" operation="mknod" profile="snap.postman.postman" name="/dev/shm/pulse-shm-2592753161" pid=18352 comm="Postman" requested_mask="c" denied_mask="c" fsuid=1000 ouid=1000
okt 22 15:38:37 kosta-lenovo audit[18352]: AVC apparmor="DENIED" operation="open" profile="snap.postman.postman" name="/dev/shm/pulse-shm-1477554153" pid=18352 comm="Postman" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
okt 22 15:38:37 kosta-lenovo audit[18352]: AVC apparmor="DENIED" operation="open" profile="snap.postman.postman" name="/dev/shm/pulse-shm-3952512136" pid=18352 comm="Postman" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
okt 22 15:38:37 kosta-lenovo audit[18352]: AVC apparmor="DENIED" operation="open" profile="snap.postman.postman" name="/dev/shm/pulse-shm-4005146755" pid=18352 comm="Postman" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
okt 22 15:38:37 kosta-lenovo audit[18352]: AVC apparmor="DENIED" operation="open" profile="snap.postman.postman" name="/dev/shm/pulse-shm-162037911" pid=18352 comm="Postman" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
okt 22 15:38:37 kosta-lenovo audit[18352]: AVC apparmor="DENIED" operation="open" profile="snap.postman.postman" name="/dev/shm/pulse-shm-758373397" pid=18352 comm="Postman" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
okt 22 15:38:37 kosta-lenovo audit[18352]: AVC apparmor="DENIED" operation="open" profile="snap.postman.postman" name="/dev/shm/pulse-shm-264806627" pid=18352 comm="Postman" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
okt 22 15:38:37 kosta-lenovo audit[18352]: AVC apparmor="DENIED" operation="open" profile="snap.postman.postman" name="/dev/shm/pulse-shm-1076741062" pid=18352 comm="Postman" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
okt 22 15:38:37 kosta-lenovo audit[18352]: AVC apparmor="DENIED" operation="open" profile="snap.postman.postman" name="/dev/shm/pulse-shm-4189961922" pid=18352 comm="Postman" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
okt 22 15:38:37 kosta-lenovo audit[18352]: AVC apparmor="DENIED" operation="open" profile="snap.postman.postman" name="/dev/shm/pulse-shm-800050483" pid=18352 comm="Postman" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
okt 22 15:38:37 kosta-lenovo audit[18352]: AVC apparmor="DENIED" operation="connect" profile="snap.postman.postman" name="/run/user/1000/pulse/native" pid=18352 comm="Postman" requested_mask="wr" denied_mask="wr" fsuid=1000 ouid=1000
okt 22 15:38:38 kosta-lenovo io.snapcraft.Settings[4867]: userd.go:74: Starting snap userd
okt 22 15:38:42 kosta-lenovo gnome-session[5017]: [5271:5271:1022/153842.881517:ERROR:chrome_browser_main_extra_parts_x11.cc(62)] X IO error received (X server probably went away)
okt 22 15:38:42 kosta-lenovo gnome-session[5017]: [5682:5682:1022/153842.884635:ERROR:x11_util.cc(103)] X IO error received (X server probably went away)
okt 22 15:38:42 kosta-lenovo gnome-session[5017]: shutter: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.
okt 22 15:38:42 kosta-lenovo gnome-session[5017]: terminator: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.
okt 22 15:38:42 kosta-lenovo org.freedesktop.Notifications[4867]: (notify-osd:5122): Gdk-WARNING **: notify-osd: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.
okt 22 15:38:42 kosta-lenovo gnome-session[5017]: (unity-fallback-mount-helper:5263): Gdk-WARNING **: unity-fallback-mount-helper: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.
okt 22 15:38:42 kosta-lenovo org.a11y.atspi.Registry[5027]: XIO:  fatal IO error 11 (Resource temporarily unavailable) on X server ":0"
okt 22 15:38:42 kosta-lenovo org.a11y.atspi.Registry[5027]:       after 60293 requests (60293 known processed) with 0 events remaining.
okt 22 15:38:43 kosta-lenovo gnome-session[5017]: (nautilus:5259): Gdk-WARNING **: nautilus: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.
okt 22 15:38:43 kosta-lenovo bluetoothd[1069]: Endpoint unregistered: sender=:1.79 path=/MediaEndpoint/A2DPSource
okt 22 15:38:43 kosta-lenovo bluetoothd[1069]: Endpoint unregistered: sender=:1.79 path=/MediaEndpoint/A2DPSink
okt 22 15:38:43 kosta-lenovo gnome-session[5017]: (nm-applet:5254): Gdk-WARNING **: nm-applet: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.
okt 22 15:38:43 kosta-lenovo gnome-session[5017]: (update-notifier:6692): Gdk-WARNING **: update-notifier: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.
okt 22 15:38:43 kosta-lenovo gnome-session[5017]: (polkit-gnome-authentication-agent-1:5262): Gdk-WARNING **: polkit-gnome-authentication-agent-1: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.
okt 22 15:38:43 kosta-lenovo gnome-session[5017]: (gnome-software:5255): Gdk-WARNING **: gnome-software: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.
okt 22 15:38:43 kosta-lenovo polkitd(authority=local)[1048]: Unregistered Authentication Agent for unix-session:c2 (system bus name :1.83, object path /org/gnome/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
okt 22 15:38:43 kosta-lenovo kernel: [drm] Reducing the compressed framebuffer size. This may lead to less power savings than a non-reduced-size. Try to increase stolen memory size if available in BIOS.
okt 22 15:38:43 kosta-lenovo gnome-session[5017]: Failed to connect to Mir: Failed to connect to server socket: No such file or directory
okt 22 15:38:43 kosta-lenovo gnome-session[5017]: Unable to init server: Could not connect: Connection refused
okt 22 15:38:43 kosta-lenovo gnome-session[5017]: (polkit-gnome-authentication-agent-1:18689): Gtk-WARNING **: cannot open display: :0
okt 22 15:38:43 kosta-lenovo gnome-session[5017]: gnome-session-binary[5017]: WARNING: Lost name on bus: org.gnome.SessionManager
okt 22 15:38:43 kosta-lenovo gnome-session[5017]: gnome-session-binary[5017]: CRITICAL: We failed, but the fail whale is dead. Sorry....
okt 22 15:38:43 kosta-lenovo gnome-session-binary[5017]: WARNING: Lost name on bus: org.gnome.SessionManager
okt 22 15:38:43 kosta-lenovo gnome-session-binary[5017]: CRITICAL: We failed, but the fail whale is dead. Sorry....
okt 22 15:38:43 kosta-lenovo gnome-session[5017]: (deja-dup-monitor:6859): GVFS-RemoteVolumeMonitor-WARNING **: Owner of volume monitor org.gtk.vfs.AfcVolumeMonitor disconnected from the bus; removing drives/volumes/mounts
okt 22 15:38:43 kosta-lenovo io.snapcraft.Settings[4867]: Exiting on terminated.
okt 22 15:38:43 kosta-lenovo gnome-session[5017]: (deja-dup-monitor:6859): GVFS-RemoteVolumeMonitor-WARNING **: Owner of volume monitor org.gtk.vfs.UDisks2VolumeMonitor disconnected from the bus; removing drives/volumes/mounts
okt 22 15:38:43 kosta-lenovo gnome-session[5017]: (deja-dup-monitor:6859): GVFS-RemoteVolumeMonitor-WARNING **: Owner of volume monitor org.gtk.vfs.MTPVolumeMonitor disconnected from the bus; removing drives/volumes/mounts
okt 22 15:38:43 kosta-lenovo gnome-session[5017]: (deja-dup-monitor:6859): GVFS-RemoteVolumeMonitor-WARNING **: Owner of volume monitor org.gtk.vfs.GoaVolumeMonitor disconnected from the bus; removing drives/volumes/mounts
okt 22 15:38:43 kosta-lenovo gnome-session[5017]: (deja-dup-monitor:6859): GVFS-RemoteVolumeMonitor-WARNING **: Owner of volume monitor org.gtk.vfs.GPhoto2VolumeMonitor disconnected from the bus; removing drives/volumes/mounts
okt 22 15:38:43 kosta-lenovo gnome-session[5017]: ** (zeitgeist-datahub:6365): WARNING **: zeitgeist-datahub.vala:229: Unable to get name "org.gnome.zeitgeist.datahub" on the bus!
okt 22 15:38:43 kosta-lenovo org.gnome.zeitgeist.SimpleIndexer[4867]: (zeitgeist-fts:6383): GLib-GIO-WARNING **: Error releasing name org.gnome.zeitgeist.SimpleIndexer: The connection is closed
okt 22 15:38:43 kosta-lenovo org.gnome.zeitgeist.SimpleIndexer[4867]: ** (zeitgeist-fts:6383): WARNING **: zeitgeist-fts.vala:252: The connection is closed
okt 22 15:38:43 kosta-lenovo org.gnome.zeitgeist.Engine[4867]: (zeitgeist-daemon:6376): GLib-GIO-WARNING **: Error releasing name org.gnome.zeitgeist.Engine: The connection is closed
okt 22 15:38:43 kosta-lenovo org.gnome.zeitgeist.Engine[4867]: [13:38:43.891159 WARNING] zeitgeist-daemon.vala:449: The connection is closed
okt 22 15:38:45 kosta-lenovo lightdm[18734]: PAM unable to dlopen(pam_kwallet.so): /lib/security/pam_kwallet.so: cannot open shared object file: No such file or directory
okt 22 15:38:45 kosta-lenovo lightdm[18734]: PAM adding faulty module: pam_kwallet.so
okt 22 15:38:45 kosta-lenovo lightdm[18734]: PAM unable to dlopen(pam_kwallet5.so): /lib/security/pam_kwallet5.so: cannot open shared object file: No such file or directory
okt 22 15:38:45 kosta-lenovo lightdm[18734]: PAM adding faulty module: pam_kwallet5.so

Please ask if you need additional info or logs, since I don't have a clue where to look. Thanks.
EDIT
Here are additional outputs based on @heynnema comment:
$ grep -i sda /var/log/syslog*
/var/log/syslog:Oct 21 14:04:23 kosta-lenovo kernel: [22074.108380] sd 0:0:0:0: [sda] Synchronizing SCSI cache
/var/log/syslog:Oct 21 14:04:23 kosta-lenovo kernel: [22074.108638] sd 0:0:0:0: [sda] Stopping disk
/var/log/syslog:Oct 21 14:04:23 kosta-lenovo kernel: [22075.794605] sd 0:0:0:0: [sda] Starting disk
/var/log/syslog:Oct 22 08:49:55 kosta-lenovo kernel: [25775.145317] sd 0:0:0:0: [sda] Synchronizing SCSI cache
/var/log/syslog:Oct 22 08:49:55 kosta-lenovo kernel: [25775.145571] sd 0:0:0:0: [sda] Stopping disk
/var/log/syslog:Oct 22 08:49:55 kosta-lenovo kernel: [25775.830958] sd 0:0:0:0: [sda] Starting disk
/var/log/syslog:Oct 22 09:26:32 kosta-lenovo os-prober: debug: /dev/sda2: DOS extended partition; skipping
/var/log/syslog:Oct 22 09:26:32 kosta-lenovo os-prober: debug: /dev/sda5: is active swap
/var/log/syslog.1:Oct 19 18:16:54 kosta-lenovo kernel: [21128.508939] sd 0:0:0:0: [sda] Synchronizing SCSI cache
/var/log/syslog.1:Oct 19 18:16:54 kosta-lenovo kernel: [21128.509217] sd 0:0:0:0: [sda] Stopping disk
/var/log/syslog.1:Oct 19 18:16:54 kosta-lenovo kernel: [21129.702197] sd 0:0:0:0: [sda] Starting disk
/var/log/syslog.1:Oct 19 18:18:01 kosta-lenovo kernel: [21158.884408] sd 0:0:0:0: [sda] Synchronizing SCSI cache
/var/log/syslog.1:Oct 19 18:18:01 kosta-lenovo kernel: [21158.884706] sd 0:0:0:0: [sda] Stopping disk
/var/log/syslog.1:Oct 19 18:18:01 kosta-lenovo kernel: [21160.112390] sd 0:0:0:0: [sda] Starting disk
/var/log/syslog.1:Oct 19 18:19:39 kosta-lenovo kernel: [21189.408117] sd 0:0:0:0: [sda] Synchronizing SCSI cache
/var/log/syslog.1:Oct 19 18:19:39 kosta-lenovo kernel: [21189.408374] sd 0:0:0:0: [sda] Stopping disk
/var/log/syslog.1:Oct 19 18:19:39 kosta-lenovo kernel: [21190.641581] sd 0:0:0:0: [sda] Starting disk
/var/log/syslog.1:Oct 21 13:35:20 kosta-lenovo kernel: [21219.891444] sd 0:0:0:0: [sda] Synchronizing SCSI cache
/var/log/syslog.1:Oct 21 13:35:20 kosta-lenovo kernel: [21219.891784] sd 0:0:0:0: [sda] Stopping disk
/var/log/syslog.1:Oct 21 13:35:20 kosta-lenovo kernel: [21221.188310] sd 0:0:0:0: [sda] Starting disk

And
$ ls -al /var/crash
total 3660
drwxrwsrwt  2 root      whoopsie    4096 okt 22 16:02 .
drwxr-xr-x 15 root      root        4096 mar 15  2018 ..
-rwxrwxrwx  1 root      whoopsie       0 okt 22 15:38 .lock
-rw-r-----  1 kostandin whoopsie  407658 okt 22 15:38 _sbin_upstart.1000.crash
-rw-r-----  1 kostandin whoopsie  265858 okt 15 01:10 _usr_bin_update-manager.1000.crash
-rw-rw-r--  1 kostandin whoopsie       0 okt 15 01:10 _usr_bin_update-manager.1000.upload
-rw-------  1 whoopsie  whoopsie       0 okt 15 01:10 _usr_bin_update-manager.1000.uploaded
-rw-r-----  1 root      whoopsie 3059842 okt 22 15:57 _usr_sbin_apache2.0.crash
-rw-r--r--  1 root      whoopsie       0 okt 22 15:57 _usr_sbin_apache2.0.upload
-rw-------  1 whoopsie  whoopsie       0 okt 22 16:02 _usr_sbin_apache2.0.uploaded

EDIT 2
Output of the sudo debsums -s command:
debsums: changed file /usr/lib/python3/dist-packages/cupshelpers/__pycache__/__init__.cpython-35.pyc (from python3-cupshelpers package)
debsums: changed file /usr/lib/python3/dist-packages/cupshelpers/__pycache__/config.cpython-35.pyc (from python3-cupshelpers package)
debsums: changed file /usr/lib/python3/dist-packages/cupshelpers/__pycache__/cupshelpers.cpython-35.pyc (from python3-cupshelpers package)
debsums: changed file /usr/lib/python3/dist-packages/cupshelpers/__pycache__/installdriver.cpython-35.pyc (from python3-cupshelpers package)
debsums: changed file /usr/lib/python3/dist-packages/cupshelpers/__pycache__/openprinting.cpython-35.pyc (from python3-cupshelpers package)
debsums: changed file /usr/lib/python3/dist-packages/cupshelpers/__pycache__/ppds.cpython-35.pyc (from python3-cupshelpers package)
debsums: changed file /usr/lib/python3/dist-packages/cupshelpers/__pycache__/xmldriverprefs.cpython-35.pyc (from python3-cupshelpers package)
debsums: missing file /usr/lib/rhythmbox/plugins/rbzeitgeist/__pycache__/rbzeitgeist.cpython-35.opt-1.pyc (from rhythmbox-plugin-zeitgeist package)
debsums: missing file /usr/lib/rhythmbox/plugins/rbzeitgeist/__pycache__/rbzeitgeist.cpython-35.pyc (from rhythmbox-plugin-zeitgeist package)

@xenoid, I don't have any of the /var/log/X.*.log files, but I have these:
$ ll /var/log/X*
-rw-r--r-- 1 root root 50K okt 22 23:52 /var/log/Xorg.0.log
-rw-r--r-- 1 root root 44K okt 22 22:41 /var/log/Xorg.0.log.old
-rw-r--r-- 1 root root 55K apr 27 10:42 /var/log/Xorg.1.log
-rw-r--r-- 1 root root 53K apr 27 09:42 /var/log/Xorg.1.log.old

EDIT 3
Laptop information:
Lenovo Yoga 3 Pro:

Processor: Intel® Processor 5Y70 CPU @ 1.10GHz × 4
Graphics: Intel® HD Graphics 5300 (Broadwell GT2)
Ubuntu 16.04, Kernel version 4.15.0-36-generic

Output of the sudo lshw -c memory:
$ sudo lshw -c memory
  *-firmware
       description: BIOS
       vendor: LENOVO
       physical id: 0
       version: A6CN47WW
       date: 12/08/2014
       size: 128KiB
       capacity: 6080KiB
       capabilities: pci upgrade shadowing cdboot bootselect edd int13floppynec int13floppytoshiba int13floppy360 int13floppy1200 int13floppy720 int13floppy2880 int9keyboard int10video acpi usb biosbootspecification uefi
  *-cache:0
       description: L1 cache
       physical id: 6
       slot: L1 Cache
       size: 32KiB
       capacity: 32KiB
       capabilities: synchronous internal write-back instruction
       configuration: level=1
  *-cache:1
       description: L2 cache
       physical id: 7
       slot: L2 Cache
       size: 256KiB
       capacity: 256KiB
       capabilities: synchronous internal write-back unified
       configuration: level=2
  *-cache:2
       description: L3 cache
       physical id: 8
       slot: L3 Cache
       size: 4MiB
       capacity: 4MiB
       capabilities: synchronous internal write-back unified
       configuration: level=3
  *-cache
       description: L1 cache
       physical id: 5
       slot: L1 Cache
       size: 32KiB
       capacity: 32KiB
       capabilities: synchronous internal write-back data
       configuration: level=1
  *-memory
       description: System Memory
       physical id: 24
       slot: System board or motherboard
       size: 8GiB
     *-bank:0
          description: SODIMM Synchronous 1600 MHz (0,6 ns)
          vendor: 0000
          physical id: 0
          serial: 00000000
          slot: ChannelA-DIMM0
          size: 4GiB
          width: 64 bits
          clock: 1600MHz (0.6ns)
     *-bank:1
          description: SODIMM Synchronous 1600 MHz (0,6 ns)
          vendor: 0000
          physical id: 1
          serial: 00000000
          slot: ChannelB-DIMM0
          size: 4GiB
          width: 64 bits
          clock: 1600MHz (0.6ns)

Output of $ dpkg -l *gnome* (cannot paste here anymore):
https://pastebin.com/kfK9664L
Comment: You may have a hard disk problem. Start the `Disks` app, and use the SMART tools to review the data and run the tests. You can also, in `terminal` type `grep -i sda /var/log/syslog*` and `ls -al /var/crash`. Edit output into your question, not the comments. Report back to @heynnema
Comment: @heynnema I updated the question. I also ran SMART tests on disk and it says it finished successfully and status says disk is OK.
Comment: From the logs, looks like the X server died. Anything in the /var/log/X.*.log files?
Comment: Good, it looks like your hard disk is not a problem. Lets check some other basics... give me a couple of minutes, and I'll put together a quick action plan in an answer.
Comment: @xenoid yes, that and a few other things. It's all over the place. Partial answer coming...
Answer: Since we have so little specific data to go on, and the problems are all over the place, we have to eliminate a whole bunch of basics first.

We've checked for hard disk problems using SMART and /var/log/syslog*, and no problems were found there.
Now we'll do some basic testing...

Step #1:
Lets first check your file system for errors.
To check the file system on your Ubuntu partition...

boot to the GRUB menu
choose Advanced Options
choose Recovery mode
choose Root access
at the # prompt, type sudo fsck -f /
repeat the fsck command if there were errors
type reboot

If for some reason you can't do the above...

boot to a Ubuntu Live DVD/USB
start gparted and determine which /dev/sdaX is your Ubuntu EXT4 partition
quit gparted
open a terminal window
type sudo fsck -f /dev/sdaX # replacing X with the number you found earlier
repeat the fsck command if there were errors
type reboot

Step #2:
Go here and temporarily disable all GNOME extensions. Also show me ls -al .local/share/gnome-shell/extensions. Put that output into your original question.
Step #3:
In terminal, type:
sudo debsums -s

and edit that output into your original question. Send a comment to @heynnema to let me know that's done, so I can look at it.
Step #4:
Boot to a Ubuntu Live DVD/USB and run memtest for at least one complete pass. Report back.
Update #1:
I'd recommend sidegrading to xubuntu/lubuntu 18.04 if you need LTS, or even better, 18.10. Do good backups first.
Comment: Thanks for the answer!

**Step 1**: all passed well in first round, no errors reported.
**Step 2**: I don't have any gnome extensions nor that directory exists (I use Unity)
**Step 3**: I added output to the `sudo debsums -s` command
**Step 4:** I don't have live ubuntu, but I ran memtest from GRUB menu and it took about an hour to pass all tests with no errors.
Comment: Add another user called "Guest" (or whatever). Log out of your normal account, and into Guest. See if problems occur. Report back.
Comment: The problem is that this happens randomly and about once or twice a month, so using a guest account will probably not give any results in short time.
Comment: @Kosta  In that case, please run `memtest` overnight and lets see if it catches any errors that only one pass couldn't find. You crashed twice on Oct 22, and the crashes/errors are all over the place... that's why I suspect memory. How much memory do you have? Edit your question and show me `sudo lshw -c memory`.
Comment: @Kosta ps: I don't understand why I see references to gnome* in your log file if you're running unity. Have you installed any gnome software? Show me `dpkg -l *gnome*`.
Comment: I added more logs to the question. I don't remember installing any specific gnome software, but I do remember I had (have) problems with `network-manager` since always after suspend/wakeup my list of networks is empty. In order to solve that I tried couple of alternatives, and ended up using none of them, so maybe something left there. Please check log at the end of the question (pastebin). And I will run `memtest` this night.
Comment: @Kosta  On your login screen, select your username, then click the cog wheel icon, and tell me what choices you see there, and which one is selected?
Comment: @Kosta ps: also check the Lenovo web site for a BIOS update. It looks like there may be one newer than what you have running.
Comment: I don't have a cog icon so only Unity session exists. For the BIOS update, I checked and there is an update "for Windows" and it's exe updater, and I think it won't work with Wine. Do you think I should try? I wouldn't want to get into the point where I cannot boot anymore.
Comment: @Kosta No, don't do BIOS updates from Wine. Don't you have real Windows installed in a dual-boot config any more? If memtest runs clean, then I'd recommend upgrading to 18.04 if you need LTS, or even better, 18.10. Do good backups first.
Comment: No, I removed Windows completely before installing Ubuntu couple of years ago. I installed 18.04 but performance on my laptop was so bad that I had to return to 16.04 (I made a disk image before upgrading). I will report memtest results tomorrow. Thanks for your help!
Comment: @Kosta if 18.04 performance was so bad, you may have needed to disable wayland... or use lightdm instead of gdm3... or, because of your processors, you may need to consider running with lubuntu or xubuntu, where the performance might be much better. 18.10 is snappier than 18.04.
Comment: I tried switching to Unity and performance was much better, but when I did some screen share / video call sessions, my computer was dying. I could do that only if I closed **everything** but zoom (video conference app). So, the solution for me to use 18.04 or 10 is to buy a new laptop :)
Comment: @Kosta I recently "downgraded" my mothers older desktop from Ubuntu w/GNOME, to xubuntu, and it works much better now. And she's got older processors than yours! Consider xubuntu 18.10 or lubuntu 18.10 before giving up on your machine... but a new Christmas present is always kinda fun...
Comment: @Kosta please remember to accept my answer if it was helpful. Thanks!
Comment: I ran `memtest` last night and it did 4 rounds with no errors. So I guess I'll have to wait for another crash to maybe have better insight. If disk and memory are OK, maybe some other hardware part is problematic. Thanks for your help!
Comment: @Kosta  That's good! Consider the xubuntu/lubuntu sidegrade. It might make quite a difference with your CPU's. If you don't want to install it right away, you can always boot to a XUbuntu Live DVD/USB and try it in "Try It" mode, without disturbing your current installation.


Stuck with getaway car in GTA V and no hints in the top right corner

Question: I am pretty sure it's mission 36, I need to do truck and trash car and masks and clothes. I did all, but I can't get ANY getaway car. I know it has to be four seats. But I tried every car. No car gave me hint like: This car can be used as getaway car. I can't progress now.
I tried to do: suicide, restart the game, call Lester/Michael, but without any outcomes.
Cars I've tried: Cheval Fugitive, Emperor Habanero, Albany Primo, Ubermacht Oracle XS, Karin Intruder...
Comment: It's worth noting that the Cheval Fugitive is the default getaway vehicle when this mission is replayed. Moreso than any other vehicle, that one should be a valid one to use for the heist.
Comment: It can happen that the information doesn't get prompted to you, if you get another prompt at the same time or if you're in another activity such as another mission or hanging out with strangers and freaks. You can ultimatively check it by playing Franklin or Trevor, finding a 4-door car and calling Michael on the phone. The Dewbauchee Exemplar is a fast 4-door often found in north Vinewood or Rockford Hills. Don't forget to park it somewhere rather secluded like in the very north of Vinewood Hills or around Blaine Country. It still has to be near any kind of road, so don't park it in a bush.
Answer: So the problem has been solved. I tried next day and I tried Cheval Fugitive and it works.


non-permanent construction adhesive?

Question: I'm building a small floating wall about 3.5' wide. almost 8' tall. It will be 'floating' 8" away from the ceiling, floor, and perpendicular wall via 1/4" steel pipe connected to floor flanges. It will look like this:
<code>-------------------------------
      ---            ---    | |
       |              | <---|-|--- 1/4" steel pipe +
     --------------------   | |    floor flanges
     |                  |   | |
     |                  |--|| |
     |                  |   | |
     |                  |   | |
     |    'Floating'    |   | |<-- perpendicular wall
     |       wall       |   | |
     |                  |   | |
     |                  |   | |
     |                  |   | |
     |                  |--|| |
     |                  |   | |
     --------------------   | |
       |              |     | |
      ---            ---    | |
-------------------------------
</code>
I can easily screw into the ceiling and perpendicular wall. But I'd like to avoid drilling into the floor as future owners may want to remove this and patching holes in floors is a pain (as opposed to holes in sheetrock).
I was initially going to use rubber pads under the ones on the bottom and hoping there'd be enough tension to cause it to grip solid.
But given this is an entry way wall, I can see someone large grabbing the edge of the wall to put on their shoes or something and worry about that lower outer leg pushing out.
Is there any sort of adhesive I could use that would give the bottom plates more rigidity...but easily be removable in the future?
I'm thinking some industrial size version of those 3M 'snot' adhesives they use on hooks where they are very adhesive, but can be pulled off in the future. (Come to think of it, maybe 3M does make large versions of those already?)
Answer: Pure silicone will provide very good shear bonding, yet you'll be able to peel it up later from non-porous surfaces.
Comment: Yeah, no. You're likely to pull wood apart or leave rough residue with construction glue.
Comment: Even normal construction adhesive can be removed with enough muscle... the older it is, the easier.
Comment: Perfect! Here's the catch...I'm not sure how non-porous these floors are. They're cheap pergo. They seem to be holding up well for being pergo, and do seem to pool water (not soak in) so maybe they'll be OK?
Comment: Most laminate floors should do fine. They're sealed for the most part. Deeply-grained surfaces may require a little buffing.
Comment: Sorry, missed the part about it being a finished floor. Ignore my comment.

non-permanent construction adhesive?


Water softener beads in the system

Question: The water softener in my house failed and I now have tiny beads all through my system. I have poor water pressure with some outlets barely dribbling and these beads coming out. Is there a way to flush this stuff out of my system?
Answer: Sounds like the riser pipe is broken. Your softener will need to be rebedded (emptied, and then refilled, and obviously a new riser pipe installed).
To clear out your system, really the only way is the obvious way: flush it out with water. First off, make sure your softener is bypassed until it's fixed, so you don't add to the problem.
Regular faucets
Take off the aerators, shower heads, and anything else that has a screen or filter in it, and run water until you get everything out.

Other valves
There's a chance with some valves you could get something caught in them, so if you still notice a reduced flow or leak from a particular tap, you'll have to take apart the valve. How to do this varies depending on each particular valve, but you can find help online (try searching for "replace valve cartridge in ") or ask another question here.
Hot water heater
The hot water heater is a bit trickier, since you really can't get enough flow through the tank to "flush" it. The only way is to drain the tank:

Turn off water inlet valve and power/gas
Open some hot water taps in your house -- this will let air back in so the tank can drain
Connect a drain hose to the bottom drain valve (located around the bottom of your tank)

Open the valve and drain the tank
Comment: Will flushing it clear any debris out of the water heater, too?
Comment: Likely not: there wouldn't be enough flow. I added instructions on draining the tank. Sorry, hadn't thought about the hot water tank.

Water softener beads in the system