text:
Q: Python multiple regexes cleaning the file Preface
It has been a while me not using python so I'm having issues with data cleaning.
In notepad++ it goes really slow so I am looking for more efficient options in python.
What I need
I need to clean over 100 files in one directory, all of them were extracted manually from SAP.
Steps that I am looking for:

*

*Remove first line with -----

*Remove third line with -----

*Remove first and last character | from each line

*Remove whitespaces where needed - between text I need to keep them

Original File
---------------------------------------------------------------------------
|  MANDT|BUKRS|NETWR     |UMSKS|UMSKZ|AUGDT     |AUGBL|ZUONR              |
---------------------------------------------------------------------------
|  100  |1000 |23.321-   |     |     |          |     |TEXT I WANT TO KEEP|
|  100  |1000 |0.12      |     |     |          |     |TEXT I WANT TO KEEP|
|  100  |1500 |90        |     |     |          |     |TEXT I WANT TO KEEP|
---------------------------------------------------------------------------

Expected Outcome
MANDT|BUKRS|NETWR|UMSKS|UMSKZ|AUGDT|AUGBL|ZUONR
100|1000|23.321-|||||TEXT I WANT TO KEEP
100|1000|0.12|||||TEXT I WANT TO KEEP
100|1500|90|||||TEXT I WANT TO KEEP

The code here is what I'm trying to work with but I need help with regular expression composition. In Notepad++ I can use \h+(\w+)\h+ and as a replace \1 but here it doesn't work. Please help me to build a proper regex.

A: Two approaches:
-- using built-in str object functions:
with open('yourfile.txt', 'r') as f:
    lines = f.read().splitlines()     # getting list of lines
    for l in lines:
        if not l.startswith('---'):   # skip dashed lines
            print('|'.join(map(str.strip, l.strip('|').split('|'))))

-- using re.sub() function:
with open('yourfile.txt', 'r') as f:
    lines = f.read().splitlines()
    for l in lines:
        if not l.startswith('---'):
            print(re.sub(r'\|\s*|\s*\|', '|', l).strip('|'))
            # an auxiliary pattern for complex cases:
            # re.sub(r'\|\s*(\S*)\s*(?=\|)', '|\\1', l).strip('|')

The output:
MANDT|BUKRS|NETWR|UMSKS|UMSKZ|AUGDT|AUGBL|ZUONR
100|1000|23.321-|||||TEXT I WANT TO KEEP
100|1000|0.12|||||TEXT I WANT TO KEEP
100|1500|90|||||TEXT I WANT TO KEEP

Read/write mode:
To overwrite the current file with new content use the following approach:
with open('yourfile.txt', 'r+') as f:   # 'r+' - read/write mode
    lines = f.read().splitlines()
    f.seek(0)      # reset file pointer
    f.truncate()   # truncating file contents
    for l in lines:
        if not l.startswith('---'):
            # or f.write('|'.join(map(str.strip, l.strip('|').split('|'))) + '\n')
            f.write(re.sub(r'\|\s*|\s*\|', '|', l).strip('|') + '\n')

A: WRT the code snippet in reference, you can use following patterns:
REGEXES = [(re.compile(r'^[-\n]+',re.M), ''),
       (re.compile(r'([\s]+)?\|([\s]+)?'), '|')]

A: Preface
Assuming all your files are in the same format, you could simply use a regex replace.
Answer
You can view this in use on regex101 here
Explanation
This regex [\t ]|-{2,}\s*|^\||\|$ will:

*

*Catch all tab or space characters

*Catch all - characters where two such characters follow each other (as well as any following whitespace characters)

*Catch all lines beginning with the | character

*Catch all lines ending with the | character

Note that you must ensure global g and multi-line m modifiers are active.

Code
Your final code should resemble the following:
import re

regex = r"[\t ]|-{2,}\s*|^\||\|$"

subst = ""

result = re.sub(regex, subst, test_str, 0, re.MULTILINE)

if result:
    print (result)

Where test_str contains the file's contents (such as below)
---------------------------------------------------------------------------
|  MANDT|BUKRS|NETWR     |UMSKS|UMSKZ|AUGDT     |AUGBL|ZUONR              |
---------------------------------------------------------------------------
|  100  |1000 |23.321-   |     |     |          |     |TEXT I WANT TO KEEP|
|  100  |1000 |0.12      |     |     |          |     |TEXT I WANT TO KEEP|
|  100  |1500 |90        |     |     |          |     |TEXT I WANT TO KEEP|
---------------------------------------------------------------------------

Output
MANDT|BUKRS|NETWR|UMSKS|UMSKZ|AUGDT|AUGBL|ZUONR
100|1000|23.321-|||||TEXTIWANTTOKEEP
100|1000|0.12|||||TEXTIWANTTOKEEP
100|1500|90|||||TEXTIWANTTOKEEP

Edit
Answer
You can view this in use on regex101 here
Explanation
(?:^\|[\t ]*)|(?:[\t ]*\|$)|(?:(?<=\|)[\t ]*)|(?:[\t ]*(?=\|))|(?:-{2,}\s*)

The regex above will:

*

*Catch | (only at the beginning of a line) followed by any number of tab or space characters

*Catch any number of tab or space characters followed by | (only at the end of a line)

*Catch any number of tab or space characters that follow |

*Catch any number of tab or space characters that precede |

*Catch all - characters where two such characters follow each other (as well as any following whitespace characters)

Note that you must ensure global g and multi-line m modifiers are active.

Code
Your final code should resemble the following:
import re

regex = r"(?:^\|[\t ]*)|(?:[\t ]*\|$)|(?:(?<=\|)[\t ]*)|(?:[\t ]*(?=\|))|(?:-{2,}\s*)"

subst = ""

result = re.sub(regex, subst, test_str, 0, re.MULTILINE)

if result:
    print (result)

Where test_str contains the file's contents (such as below)
---------------------------------------------------------------------------
|  MANDT|BUKRS|NETWR     |UMSKS|UMSKZ|AUGDT     |AUGBL|ZUONR              |
---------------------------------------------------------------------------
|  100  |1000 |23.321-   |     |     |          |     |TEXT I WANT TO KEEP|
|  100  |1000 |0.12      |     |     |          |     |TEXT I WANT TO KEEP|
|  100  |1500 |90        |     |     |          |     |TEXT I WANT TO KEEP|
---------------------------------------------------------------------------

Output
MANDT|BUKRS|NETWR|UMSKS|UMSKZ|AUGDT|AUGBL|ZUONR
100|1000|23.321-|||||TEXT I WANT TO KEEP
100|1000|0.12|||||TEXT I WANT TO KEEP
100|1500|90|||||TEXT I WANT TO KEEP


text:
Q: Nginx not redirect none www to www So I a website which i cant reveal the url to at the moment. So i will refer to it as www.example.com for this question.
I want any attempt to get to my site to redirect to HTTPS:://www.example.com. However this is not the case. I have managed to get it working with redirecting http to https.
If i go to example.com it does redirect to www.example.com, but if i try any other route such as example.com/videos it just redirects to https://example.com/videos instead of https://www.example.com.
Here is my nginx config file:
server{

    listen 80;
    server_name example.com www.example.com;
    rewrite ^/(.*) https://www.example.com/$1 permanent;
}

server {
    listen 443 ssl;

    server_name example.com www.thevirtualpornwebsite.com;
    root /var/www/example_folder/public;

    index index.php index.html index.htm index.nginx-debian.html;

    ssl_certificate /home/example_user/example.com.chained.crt;
    ssl_certificate_key /home/example_user/example.com.key;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;
    ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';

    location / {
        rewrite ^/(.*)/$ /$1 permanent;
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    }
}

If anyone could help out that would be great!

A: If you check your HTTP server configuration you should see a rewrite rule
rewrite ^/(.*) https://www.example.com/$1 permanent;

This basically matches any given URL and this match is afterwards passed to the new location as the parameter $1 (check regular expressions).
If you remove this parameter, you should accomplish what you want:
rewrite ^/.* https://www.example.com/ permanent;

redpajama_set_name: RedPajamaStackExchange


text:
Q: This while loop for my sorting algorithm doesn't seem to exit, why? I am coding in javascript and am trying to make a sorting algorithm, and my while loop doesnt seem to exit, anybody know why?

let sort = true
let length = 0
let i = 1
function multiSort(n) {
    length = n.length-1
    while (sort=true) {
        sort = false
        if (n[i]>n[i+1]) {
            [n[i],n[i+1] = n[i+1],n[i]]
            i += 1
            sort=true
            if (i = length) {
                i = 1
            }
            console.log(i)
        }
    }
    return n
}
console.log("Final Product: ", multiSort([3,2,5,1,4]), " Iterations: ", i)

A: You have a couple problems here.
As mentioned your using javascript incorrectly. You should spend some time learning about how operators and comparisons work. You can read about them here. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators#assignment_operators

*

*Your while statement will never be false.

*n[i+1] in your compare statement can be undefined so will be false when it shouldn't be checked.

I have re-written your algorithm using a for loop instead of a while loop since we get a free iterator when we set up the loop.

// We keep track of the iterations outside of the function
let iterations = 0

function multiSort(n) {
    iterations++

    // We set sort to false, if our conditions are not met we won't need to keep sorting
    let sort = false

    // Loop through every item in the array
    for(let i = 0; i < n.length; i++) {
        let next = n[i+1]
        // If the current item is larger than the next swap their positions. We also have to check for undefined here since the end of the array can't compare to anything.
        if(n[i] > next && next !== undefined) {
            // Set sort to true since at least one item need to be sorted. This will not be set if all items in the array are in sequence.
            sort = true
            n[i+1] = n[i]
            n[i] = next
        }
    }

    // If we set sort to true re-run everything with the current array.
    if(sort) {
        multiSort(n)
    }

    // return the final array
    return n
}

console.log("Final Product: ", multiSort([3,2,5,1,4]), " Iterations: ", iterations)


text:
Q: When changing into Rails folder, have rvm pick ruby and gemset? For my different Rails folders, I would like to have rvm automatically load the correct gemset when running anything from 'bundle install' to doing my 'autotest' or rails console or server.  Is this possible?  Currently I have to manually do 'rvm use' which is getting a bit tedious as I am working on multiple Rails projects at the same time.

A: You can also use this in Gemfile
ruby '2.2.0'
ruby-gemset=significa

This way rvm will automatically pick the configured version

A: For current RVM version 1.29.1, the recommended way is
rvm --ruby-version use <ruby-version>@<gemset>

Exmaple
rvm --ruby-version use 2.4.0@rails5
cat .ruby-version  # 2.4.0
cat ruby-gemset # rails5

this will generate two file .ruby-version and .ruby-version in your porject directory. This will compatible with other Ruby Versions Managers

A: Yaw just create two plain-text files and put into your project folder:
.ruby-gemset and .ruby-version
.ruby-gemset should contain only gemset alias name and nothing else
.ruby-version follows the same rules, put your ruby version or alias there

A: Create a .rvmrc file in your rails directory, and rvm will automatically load it. An example .rvmrc that loads Ruby 1.9.2 and a gemset named "rails3":
.rvmrc
rvm 1.9.2@rails3

You can do a lot more too, described in detail here: https://rvm.io/workflow/rvmrc/

A: For current versions of RVM, using two files is best practice:
.ruby-version
.ruby-gemset

http://rvm.io/workflow/projects

A: You can easily do that by placing an .rvmrc file at the base of your project.

A: I had the same problem. But, I found I had installed a ruby version globally while installing rvm.
I uninstalled that global version and everything started to work fine with .ruby-version and .ruby-gemset file in project's root directory.


text:
Q: Showing progress dialog while getting data from firebase database I am new to firebase and i want to show progress dialog while fetching data from firebase. I have achieved this but the problem is i cannot dismiss the dialog when some network error occurs while fetching. I know OnDataChange method is called when data is loaded without errors from firebase but what if some error occurs. Which method is called then?
 View view = inflater.inflate(R.layout.fragment_stories, container, false);
    recyclerView = (RecyclerView) view.findViewById(R.id.recycler_view);
    recyclerView.setHasFixedSize(true);
    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));

    showProgressDialog("Please Wait...");
    firebaseDatabase = FirebaseDatabase.getInstance();
    databaseReference = firebaseDatabase.getReference("content");
    databaseReference.addValueEventListener(new ValueEventListener() {
        @Override
        public void onDataChange(DataSnapshot dataSnapshot) {
            Log.d(TAG,"On Data Change");
            if(mProgressDialog != null){
                mProgressDialog.dismissWithAnimation();
            }
        }

        @Override
        public void onCancelled(DatabaseError databaseError) {
            Log.d(TAG,"On Cancelled");

            if(mProgressDialog != null){
                mProgressDialog.dismissWithAnimation();
            }
        }
    });

A: private ProgressDialog mProgressDialog = new ProgressDialog(this);

mProgressDialog.setMessage("Work ...");
mProgressDialog.show();

FirebaseDatabase.getInstance().getReference()
                                    .child("child node")
                                    .addListenerForSingleValueEvent(new ValueEventListener() {
                                        @Override
                                        public void onDataChange(DataSnapshot dataSnapshot) {

                                            if (dataSnapshot.exists()){

                                               do something
                                               mProgressDialog.dismiss();
                                            } else {

                                               mProgressDialog.dismiss();
                                               Snackbar.make(v, "datasnapshot is null", Snackbar.LENGTH_LONG).setAction("Action", null).show();

                                            }
                                        }

                                        @Override
                                        public void onCancelled(DatabaseError databaseError) {

                                           mProgressDialog.dismiss();
                                        }
                                    });


text:
Q: Determining the nature of these rings How can we determine whether the quotient rings $R/I$ where where $R=\mathbb Z[x], \mathbb Z_2[x], \mathbb Z_3[x]$ and $I=(x^2+1), (x^2+x+1)$ are fields, principal ideal domains, unique factorization domains or integral domain? (Of course they are all integral domains, but I am looking for the strictest condition.) Thank you.

A: Note that $R/I$ is a field if and only if $I$ is maximal and $R/I$ is an integral domain if and only if $I$ is prime.
Also note that if $F$ is a field then $(p(x))$ is maximal in $F[x]$ if and only if $p(x)$ is irreducible over $F$.
Note that $\mathbb{Z}_2$ and $\mathbb{Z}_3$ are fields. Now use that $f(x) \in F[x]$ with $\operatorname{deg}{(f)} \in \{2,3\}$ is reducible if and only if it has a root in $F$.
First let $p(x) = x^2 + 1$ and $R = \mathbb{Z}_3 [x]$. Note that $p(0) = 1 \neq 0$, $p(1) = 2 \neq 0$ and $p(2) = 2 \neq 0$. Hence $p(x)$ is irreducible and therefore $I = (p(x))$ is maximal and therefore $R/I$ is a field in this case. Every field is also an integral domain, a PID and a UFD, so you're done.
Now let $p(x) = x^2 + x + 1$ and $R = \mathbb{Z}_2[x]$. Is $p(x)$ irreducible over $R$?
Hope this helps. I'll add some more details later.

A: Her are some (disorganized) ramblings.
First of all: they are not all integral domains. For example, $x^2+1$ is reducible modulo 2, namely as $(x+1)^2$, so $\mathbb{Z}_2[x]/(x^2+1)$ is not an integral domain.
Similarly, $x^2+x+1=x^2+x+1-3x=(x-1)^2$ mod 3, so $\mathbb{Z}_3[x]/(x^2+x+1)$ is not an integral domain either.
For the other case, note that since $\mathbb{Z}_2$ and $\mathbb{Z}_2$ are fields, $\mathbb{Z}_2[x]$ and $\mathbb{Z}_3[x]$ are PID's. Hence so are their quotient rings.
Note also that $\mathbb{Z}[x]/(x^2+1) \cong \mathbb{Z}[i]$.


text:
Q: Is it possible to retrieve the attributes of a custom view through accessibility services I have a custom View with an "abc" String attribute
public class MyCustomView extends View {
    private String abc;
}

Is possible to retrieve with an accessibility service the "abc" attribute when a "MyCustomView" is displayed on the user screen?

A: public List<AccessibilityNodeInfo> findAccessibilityNodeInfosByViewId (String viewId);

You can find the node of your custom view, by Id or Text
public List<AccessibilityNodeInfo> findAccessibilityNodeInfosByText (String text);

You can find the methods like this,
private List<CharSequence> getAllChildNodeText(AccessibilityNodeInfoCompat infoCompat) {
    List<CharSequence> contents = new ArrayList<>();
    if (infoCompat == null)
        return contents;
    if (infoCompat.getContentDescription() != null) {
        contents.add(infoCompat.getContentDescription().toString().isEmpty() ? "unlabelled" : infoCompat.getContentDescription());
    } else if (infoCompat.getText() != null) {
        contents.add(infoCompat.getText().toString().isEmpty() ? "unlabelled" : infoCompat.getText());
    } else {
        getTextInChildren(infoCompat, contents);
    }
    if (infoCompat.isClickable()) {
        if (infoCompat.getClassName().toString().contains(Button.class.getSimpleName())) {
            if (contents.size() == 0) {
                contents.add("Unlabelled button");
            } else {
                contents.add("button");
            }
        }
        contents.add("Double tap to activate");
    }
    return contents;
}

private void getTextInChildren(AccessibilityNodeInfoCompat nodeInfoCompat, List<CharSequence> contents) {
    if (nodeInfoCompat == null)
        return;
    if (!nodeInfoCompat.isScrollable()) {
        if (nodeInfoCompat.getContentDescription() != null) {
            contents.add(nodeInfoCompat.getContentDescription());
        } else if (nodeInfoCompat.getText() != null) {
            contents.add(nodeInfoCompat.getText());
        }
        if (nodeInfoCompat.getChildCount() > 0) {
            for (int i = 0; i < nodeInfoCompat.getChildCount(); i++) {
                if (nodeInfoCompat.getChild(i) != null) {
                    getTextInChildren(nodeInfoCompat.getChild(i), contents);
                }
            }
        }
    }
}


text:
Q: How to freeze the date in Windows 7 or disable it I want to set the date on my windows 7 Home Premium virtual machine to Jan X, 2009 (any day in that month). Or if I cannot do that set the date to Jan X, 2009 and then let it increment normally after that (less desirable) but I can live with it. I have tried this already but the system changes it back to today and nothing I do can stop it.
There is no point in telling me about secpol.msc because that does not exist in the home editions. Does anyone know how to disable date inside the bowels of the beast? Perhaps using the CLI.
And I did what Natsu Gage suggested:
    net stop w32time

and then
    w32tm /unregister

But that had no affect other than to kill the time server connection (a good thing!).
I also tried using the "date" command in the CLI as SU.  That seemed to work but it had no affect on the date in the panel and then when I ran the "date" command it reported today's date unchanged.
Edit many hours later:
OK these are all the things I have done to figure this out.

*

*I changed the date in my UEFI even though I didn't think that would matter.  It didn't matter.

*I changed the date in the host. Linux wouldn't let me do that even when I logged in as root. Just as well. I do want auto date and time in the host.

*I went through the registry file. I found there was a "datetime.cpl" (or maybe timedate.cpl?) being called in a number of entries. But since they were inside Windows hieroglyphics entries and I don't know what I am doing with those, I left them alone.

*I found w32time nestled all nice and cozy inside a service host call.  When I saw that I disabled the Ethernet card in the virtual machine (apparently that also disables it in the host!)) so that we could positively eliminate w32time as the culprit. I then rebooted.

*I opened task manager to see what processes and services were running but found no likely candidates. But there were a dozen service hosts running that could have been hiding it.  Virtualbox guest additions was also running.

*I then logged in as super administrator and changed the date using CLI "date" command.  I had done this before to no avail but I did notice a 10 second lag before the date changed back to today in the panel. So I opened task manager, sorted by CPU use and watched as I hit the enter on the date command. Sure enough for the briefest moment a service host process logged cpu time at the exact moment the date changed in the panel.

Third Update Edit:
I forgot to mention that following a suggestion from Natsu Gage, I ran:
    sc qtriggerinfo w32time

The result was:
    The specific service does not exist as an installed service

And therefor that corroborated the fact that the w32time service was not doing the automatic date updating.  Since Microsoft says that it is the only service which updates time and date, that strengthens my suspicion that Virtualbox is doing it.
CONCLUSION: Virtual box guest additions is the only possible program that could be using  service host to make the date changes and it is getting the date time from the host system.  So I need to go and post on their forum.
I would never have got this far without Natsu Gage's help. He/she gave me search criteria for google that I would never have thought of (I am old) and they were extremely helpful.

A: Short answer:
Once installed and started, the Oracle VM VirtualBox Guest Additions will try to synchronize the guest time with the host time. This can be prevented by forbidding the guest service from reading the host clock:
$ VBoxManage setextradata VM-name "VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" 1

Knowing the correct terminology sure makes a big difference in search results! So it turns out that "Virtualbox guest additions" does in fact update the time in a virtual machine and they provide a way to turn that off. Wish I had know that to start with!
Here are the solutions to the problem.  I am posting three different threads because the circumstances may be different and not all the solutions will work for everyone but one of the solutions should work for you.  I don't really understand them yet (that will require a great deal of study) but I wanted to post them immediately in case someone has a similar issue.
https://unix.stackexchange.com/questions/505650/manually-set-time-overwritten-without-a-time-sync-active-in-a-vm
How to disable time sync with Windows 7 as host OS in VirtualBox?
https://forums.virtualbox.org/viewtopic.php?f=2&t=8535&sid=b33293ccc01c532972318e370223aff1&start=15
Also the manual has information but I certainly did not understand any of it on first read but you might:
https://www.virtualbox.org/manual/ch09.html#fine-tune-timers
The key to this is knowing the right search terms which is:
    How to disable time sync between host and guest

When I began this thread I did not know that Virtualbox Guest Additions was causing the problem and therefore wasted a lot of time.  Also it never occurred to me to post in the Linux/Unix exchange since I thought it was a Windows issue.


text:
Q: How can i use Pool instead of Process & Pipe I have a first tree class that does some calculations, and another forest class that contains trees and does more calculations.
The tree class uses the Pipe() connection mecanism to fit a tree : the resulting nodes and leaves need to be recv() by the tree.
The forest class, after fitting a certain number of tree, uses also the Pipe() connection mecanism to compute other things depending on the trees, which are also recv() by the forest.
When the number of tree rises in the forest, i am running into OSError : Too many open files and cant increase the ulimit since i have no root access on the machine where the code is running.
I am gessing that using Pool() will not have theese problems. But i do not understand how i can transmit information using Pool between child and main processes. For the moment, i use an idiom that looks like :
from multiprocessing import Pipe, Process

class tree:
    def __init__(self):
        self.random_number = 5 # Choosed by fair roll dice

    def start_fit(self):
        self.parent_conn, child_conn = Pipe(duplex=False)
        self.process = tree_fitter(self.random_number, child_conn)
        self.process.start()
        return None

    def join_fit(self):
        self.fitting_result = self.parent_conn.recv()
        self.process.join()
        self.parent_conn.close()
        del self.parent_conn
        del self.process
        return None

class tree_fitter(Process):

    def __init__(self, random_number, connection):
        self.connection = connection
        self.new_randm_number = 2 # Choosed by fair roll dice

    def run(self):
        result = self.new_randm_number * random_number
        self.connection.send(result)
        self.connection.close()
        return 0

class forest:
    def __init__(self,n_trees):
        self.n = n_trees  # Number of trees
        self.trees = [tree() for i in range(0,self.n)]

    def compute_more_complicate_things(self):
        processes = []
        parents = []
        results = []

        for i in range(0,self.n):
            self.trees[i].start_fit()

        for i in range(0,self.n):
            self.trees[i].join_fit()
            parent_connection, child_connection = Pipe(duplex=False)
            parents.append(parent_connection)
            processes.append(forest_cumulative_mean(self, i,child_connection))

        for i in range(0,self.n):
            processes[i].start()

        for i in range(0,self.n):
            results.append(parents[i].recv())
            processes[i].join()
            parents[i].close()
            print(i, end=" ")

        del processes
        del parents
        del results
        self.cumusum_of_result = results

class forest_cumulative_mean(Process):

    def __init__(self, forest, i, connection):
        self.trees = forest.trees[:i]
        self.connection = connection

    def run(self):
        result = sum([t.result for t in self.trees])
        self.connection.send(result)
        self.connection.close()
        return 0

1° How can i transform it to the Pool idiom without changing too much the structure of my code (this is of course a dummy example (i did not try to run it), i have a lot more code around it..).
2° Will this tackle the error i have about spanning too many processes ?


text:
Q: How can we access dynamic variable {{$guid}} inside pre request in postman? I can access guid in url or body like {{$guid}} but same doesn't work inside pre-request script.

A: actually uuid.v4 represent guid in postman
let uuid = require('uuid');
let guid = uuid.v4(); //you can use this variable in wherever you need to use guid in
                      //pre-request script
console.log(guid);


text:
Q: Does Apache thrift work with Scala I am new to apache thrift and I am familiar with Scala. But I have not seen any example or any reference on internet, saying it supports Scala.
Can some one tell me is there a way to work with scala on thrif. thank you.

A: I don't mean to be rude, but the very first link for the google query apache thrift scala shows up scrooge, which

*

*notes, that due to interoperability between scala and java ordinary thrift-java will work fine

*itself -- a way to work with thrift in scala-native way

So yes, there are ways to work with Thrift in Scala.

A: Yes, thrift can work with scala smoothly. It's not surprising since scala essentially works on JVM. One open-source example is Twitter's Scalding, a scala DSL for Cascading. In scalding, one is able to handle various cascading flows whose tuples are in the type of thrift-based classes.
See LongThriftTransformer for example.

A: Twitters 'Scrooge' is meant as a replacement for the standard Thrift generator and generates Java and Scala code. It works with SBT and seems relatively mature.


text:
Q: How can I install packages using pip according to the requirements.txt file from a local directory? Here is the problem:
I have a requirements.txt file that looks like:
BeautifulSoup==3.2.0
Django==1.3
Fabric==1.2.0
Jinja2==2.5.5
PyYAML==3.09
Pygments==1.4
SQLAlchemy==0.7.1
South==0.7.3
amqplib==0.6.1
anyjson==0.3
...

I have a local archive directory containing all the packages + others.
I have created a new virtualenv with
bin/virtualenv testing

Upon activating it, I tried to install the packages according to requirements.txt from the local archive directory.
source bin/activate
pip install -r /path/to/requirements.txt -f file:///path/to/archive/

I got some output that seems to indicate that the installation is fine:
Downloading/unpacking Fabric==1.2.0 (from -r ../testing/requirements.txt (line 3))
  Running setup.py egg_info for package Fabric
    warning: no previously-included files matching '*' found under directory 'docs/_build'
    warning: no files found matching 'fabfile.py'
Downloading/unpacking South==0.7.3 (from -r ../testing/requirements.txt (line 8))
  Running setup.py egg_info for package South
....

But a later check revealed that none of the packages are installed properly. I cannot import the packages, and none are found in the site-packages directory of my virtualenv. So what went wrong?

A: *

*Create virtual environment python3 -m venv virtual-env (For windows use python instead of python3)

*Activate your virtual environment source virtual-env/bin/activate

*Now install requirements pip install -r requirements.txt

A: pip install --user -r requirements.txt

OR
pip3 install --user -r requirements.txt

A: Use pip3 install -r requirements.txt  But make sure the requirements.txt file has been pulled from origin and not added to .gitignore

A: I had a similar problem. I tried this:
    pip install -U -r requirements.txt

(-U = update if it had already installed)
But the problem continued. I realized that some of generic libraries for development were missed.
    sudo apt-get install libtiff5-dev libjpeg8-dev zlib1g-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python-tk

I don't know if this would help you.

A: In Windows, this can lead to less format-related path issues, if you have

c:\folder\subfolder\requirements.txt

cd c:\folder\subfolder
pip install -r requirements.txt

A: Use:
pip install -r requirements.txt

For further details, please check the help option:
pip install --help

We can find the option '-r' -

-r, --requirement     Install from the given requirements file. This option can be
used multiple times.

Further information on some commonly used pip install options (this is the help option on the pip install command):

Also the above is the complete set of options. Please use pip install --help for the complete list of options.

A: Short answer
pip install -r /path/to/requirements.txt

or in another form:
python -m pip install -r /path/to/requirements.txt

Explanation
Here, -r is short form of --requirement and it asks the pip to install from the given requirements file.
pip will start installation only after checking the availability of all listed items in the requirements file and it won't start installation even if one requirement is unavailable.
One workaround to install the available packages is installing listed packages one by one. Use the following command for that. A red color warning will be shown to notify you about the unavailable packages.
cat requirements.txt | xargs -n 1 pip install

To ignore comments (lines starting with a #) and blank lines, use:
cat requirements.txt | cut -f1 -d"#" | sed '/^\s*$/d' | xargs -n 1 pip install

A: On windows Using this
pip install -r /path/to/requirements.txt

On linux pc we have python2 and also python3 so most time pip is regarded as
Python2
pip install -r /path/to/requirements.txt

Python 3
pip3 install -r /path/to/requirements.txt

A: First of all, create a virtual environment.
In Python 3.6
virtualenv --python=/usr/bin/python3.6 <path/to/new/virtualenv/>

In Python 2.7
virtualenv --python=/usr/bin/python2.7 <path/to/new/virtualenv/>

Then activate the environment and install all the packages available in the requirement.txt file.
source <path/to/new/virtualenv>/bin/activate
pip install -r <path/to/requirement.txt>

A: Often, you will want a fast install from local archives, without probing PyPI.
First, download the archives that fulfill your requirements:
$ pip install --download <DIR> -r requirements.txt

Then, install using –find-links and –no-index:
$ pip install --no-index --find-links=[file://]<DIR> -r requirements.txt

A: Try this:
python -m pip install -r requirements.txt

A: This works for everyone:
pip install -r /path/to/requirements.txt

Explanation:

-r, --requirement < filename >

Install from the given requirements file. This option can be used multiple times.

A: For virtualenv to install all files in the requirements.txt file.

*

*cd to the directory where requirements.txt is located

*activate your virtualenv

*run:  pip install -r requirements.txt in your shell

A: I work with a lot of systems that have been mucked by developers "following directions they found on the Internet". It is extremely common that your pip and your python are not looking at the same paths/site-packages. For this reason, when I encounter oddness I start by doing this:
$ python -c 'import sys; print(sys.path)'
['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu',
'/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old',
'/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages']

$ pip --version
pip 9.0.1 from /usr/local/lib/python2.7/dist-packages (python 2.7)

That is a happy system.
Below is an unhappy system. (Or at least it's a blissfully ignorant system that causes others to be unhappy.)
$ pip --version
pip 9.0.1 from /usr/local/lib/python3.6/site-packages (python 3.6)

$ python -c 'import sys; print(sys.path)'
['', '/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
'/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
'/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
'/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
'/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
'/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
'/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
'/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
'/usr/local/lib/python2.7/site-packages']

$ which pip pip2 pip3
/usr/local/bin/pip
/usr/local/bin/pip3

It is unhappy because pip is (python3.6 and) using /usr/local/lib/python3.6/site-packages while python is (python2.7 and) using /usr/local/lib/python2.7/site-packages
When I want to make sure I'm installing requirements to the right python, I do this:
$ which -a python python2 python3
/usr/local/bin/python
/usr/bin/python
/usr/local/bin/python2
/usr/local/bin/python3

$ /usr/bin/python -m pip install -r requirements.txt

You've heard, "If it ain't broke, don't try to fix it." The DevOps version of that is, "If you didn't break it and you can work around it, don't try to fix it."

A: Installing requirements.txt file inside virtual env with Python 3:
I had the same issue. I was trying to install the requirements.txt file inside a virtual environment. I found the solution.
Initially, I created my virtualenv in this way:
virtualenv -p python3 myenv

Activate the environment using:
source myenv/bin/activate

Now I installed the requirements.txt file using:
pip3 install -r requirements.txt

Installation was successful and I was able to import the modules.

A: This works for me:
$ pip install -r requirements.txt --no-index --find-links file:///tmp/packages

--no-index - Ignore package index (only looking at --find-links URLs instead).
-f, --find-links <URL> - If a URL or path to an HTML file, then parse for links to archives.
If a local path or file:// URL that's a directory, then look for archives in the directory listing.

A: While pip install -r requirements.txt works most of the time,
we sometimes face the problem that our requirements have conflicting dependencies.
You can install the packages line-by-line with the following one-liner:
while read -r line; do echo $line | cut -d' ' -f1 | xargs pip install; done < requirements.txt

Hope it helps someone!

A: Inside your project directory terminal write this:
$ pip freeze > requirements.txt

A: I have solved with running the below command:
py -m pip install ./requirements.txt

the above command will install all dependencies and libraries for the Django project.


text:
Q: AutoCAD.PlotToPDF+prod Last Page Missing From Resulting PDF We're using the shared Forge activity "AutoCAD.PlotToPDF+prod" to get back a plotted DWG in a PDF file, but the resulting PDF is missing the last layout from the DWG. However, there see to be some cases where the last page does get included. There are no obvious differences between the DWGs that include the last page when plotted to PDF and those who don't. Is there any reason why these shared Forge activity wouldn't include the last layout from the source DWG?
This is something that's holding us up from completing a large feature implementation before deploying it to production, so we'd like to find out if we're not going to be able to use the shared activity to make this work so that we can implement a work-around and prevent missing the deadline for delivery.
Thanks in advance.
Here is an example of the input versus output.

A: The provided drawing is dependent on external reference "background.bmp" as overlay, Forge Design Automation is not aware of the dependent reference, you need to provide that as well.
If your drawing depends on external files, you need to zip them and send, and make sure to provide path of main drawing that to be processed in pathInZip argument of workitem.
For example
{
  "activityId": "AutoCAD.PlotToPDF+prod",
  "arguments": {
    "HostDwg": {
      "localName": "Outputs",
      "pathInZip": "Output.dwg",
      "url": "downloadUrl",
      "verb": "get"
    },
    "Result": {
      "url": "uploadUrl",
      "verb": "put"
    }
  }
}


text:
Q: Rebuilding project takes an exceptionally long amount of time if using predefined maps? Compile/Link settings are fairly normal (/O2 for optimization and /LTCG for the linker - this is forced due to using a module compiled with /GL).
I have found the section of code causing the compile time increase, but I do not know how to resolve the problem. Despite the long compile time, the current code actually does work when it finally finishes.
When the following function is removed, the compile time is reduced from 125 seconds to 4 seconds (almost all of the time gain is in the linking phase):
static void InitializeItemSlotLists(std::map<uint32_t, uint32_t>& HEAD_IDS, std::map<uint32_t, uint32_t>& SHOULDER_IDS, std::map<uint32_t, uint32_t>& CHEST_IDS, std::map<uint32_t, uint32_t>& GLOVE_IDS, std::map<uint32_t, uint32_t>& WAIST_IDS, std::map<uint32_t, uint32_t>& LEGS_IDS, std::map<uint32_t, uint32_t>& FEET_IDS, std::map<uint32_t, uint32_t>& WEAPON_1H_IDS, std::map<uint32_t, uint32_t>& WEAPON_2H_IDS, std::map<uint32_t, uint32_t>& SHIELD_IDS, std::map<uint32_t, uint32_t>& OFFHAND_IDS) {
    HEAD_IDS[60202] = 93792;
    HEAD_IDS[60222] = 35113;
    HEAD_IDS[60237] = 81960;
    HEAD_IDS[60243] = 77144;
    HEAD_IDS[60249] = 91486;
    HEAD_IDS[60256] = 91255;
    HEAD_IDS[60258] = 82002;
    HEAD_IDS[60299] = 82025;
    (This continues for 5000 or so more lines.)
}

I could load all of this from an external text file at runtime, but honestly that's just adding pointless complexity. Despite how arbitrary the data seems, it is extremely unlikely to change in future.
Is the problem that it is trying to optimize this huge chunk of data? If so, is there a way I can force it to ignore this specific file for optimization (it's in its own .cpp file with its own header to predefine the function)?

A: If you must do this using static data, and you don't want to/can't use the map brace-initializer made available with C++11, the way to avoid the performance hit of the compiler trying to optimize 5000 lines of std::map assignments is to put all that data into a static array somehow, like so:
#include <map>
#include <stdint.h>

typedef std::map<uint32_t, uint32_t> IdMap;

struct IdRow {
  uint32_t src;
  uint32_t dst;
};

IdRow InitialHeadIds[] = {
  { 60202, 93792 },
  { 60222, 35113 },
  { 60237, 81960 },
  { 60243, 77144 },
  { 60249, 91486 },
  { 60256, 91255 },
  { 60258, 82002 },
  { 60299, 82025 }
};

static void InitializeItemSlotLists(
    IdMap& HEAD_IDS, IdMap& SHOULDER_IDS, IdMap& CHEST_IDS, IdMap& GLOVE_IDS,
    IdMap& WAIST_IDS, IdMap& LEGS_IDS, IdMap& FEET_IDS, IdMap& WEAPON_1H_IDS,
    IdMap& WEAPON_2H_IDS, IdMap& SHIELD_IDS, IdMap& OFFHAND_IDS) {
  for (int i = 0; i < sizeof(InitialHeadIds) / sizeof(IdRow); i++) {
    IdRow curr = InitialHeadIds[i];
    HEAD_IDS[curr.src] = curr.dst;
  }
}

int main() {
  IdMap headIds, otherIds;
  InitializeItemSlotLists(
    headIds, otherIds, otherIds, otherIds, otherIds, otherIds, otherIds,
    otherIds, otherIds, otherIds, otherIds);
  return 0;
}


text:
Q: Writing in text files using python does not work When i create and write in a text file using the python code below, it executes successfully. However, when i open the text file, it does not show anything written in it!
newl=[]
    print ""
    while 1:
        tks=raw_input("# ")
        if tks=="/":
            text=''.join(newl)
            print text
            filen=open('c:/Users/Admin/Desktop/snickcode.txt', 'w')
            filen.write(str(text))
            filen.close
            print "#saved to desktop, please rename the file before reuse"
            print "{non}"
            print ""
            break
        else:
            gig=(str(tks))
            newl.append(gig)
            print newl

A: I assume / is the first input you tried.
Because this
text=''.join(newl)
...
filen.write(str(text))

is what you write you the file and
newl=[]

doesn't contain any items at that point, the contents of the file remain 'empty'.


text:
Q: Remove space between string after comma in python dataframe column df1
ID                       Col
1       new york, london school of economics, america
2       california & washington,  harvard university, america

Expected output is :
df1
ID                       Col
1       new york,london school of economics,america
2       california & washington,harvard university,america

My try is :
df1[Col].apply(lambda x : x.str.replace(", ","", regex=True))

A: It is advisable to use the regular expression ,\s+, which allows you to capture several consecutive whitespace characters after a comma, as in washington,  harvard
df = pd.DataFrame({'ID': [1, 2], 'Col': ['new york,           london school of economics,  america',
                                         'california & washington,  harvard university, america']}).set_index('ID')
df.Col = df.Col.str.replace(r',\s+', ',', regex=True)
print(df)

                                                  Col
ID
1         new york,london school of economics,america
2   california & washington,harvard university,ame...

A: You can use str.replace(', ', ",") instead of a lambda function. However, this will only work if there is only one space after ",".
As Алексей Р mentioned, (r',\s+', ",", regex=True) is needed to catch any extra spaces after ",".
Reference: https://pandas.pydata.org/docs/reference/api/pandas.Series.str.replace.html
Example:
import pandas as pd

data_ = ['new york, london school of economics, america', 'california & washington,  harvard university, america']

df1 = pd.DataFrame(data_)
df1.columns = ['Col']
df1.index.name = 'ID'
df1.index = df1.index + 1

df1['Col'] = df1['Col'].str.replace(r',\s+', ",", regex=True)

print(df1)

Result:
                                                  Col
ID
1         new york,london school of economics,america
2   california & washington,harvard university,ame...

A: If you mention the axis it will be solved
df.apply(lambda x: x.str.replace(', ',',',regex=True),axis=1)

A: You can split the string on ',' and then remove the extra whitespaces and join the list.
df1=df1['Col'].apply(lambda x : ",".join([w.strip() for w in x.split(',')]))

Hope this helps.


text:
Q: Google Maps API cannot process one specific address We have a working Google Maps API (V2) module working correctly on our custom made CMS.
I cannot figure out why but this code seems to be having troubles processing one specific Address. What's weird is that the address can be found normally on Google Maps.
Here are two examples, one address that works perfectly and the address that Google Maps API cannot find :
Working Address : via Zups 2, 7013 Domat/Ems
<script>
initialize( "googlemap-viazups17013domat/ems", "via Zups 2 7013 Domat/Ems" )Marly" )
</script>

working HTML output (cleaned up)
Unworking Address : via Zups 1, 7013 Domat/Ems
<script>
initialize( "googlemap-viazups17013domat/ems", "via Zups 1 7013 Domat/Ems" )
</script>

non Working HTML output (cleaned up)
Also note that if I change the address to display Number 2 of the same street it works! But Number 1 never works.
––––
Edit :
Here is the initialize function :
function initialize( div, address ) {
    var geocoder;
    var map;
    geocoder = new google.maps.Geocoder();
    var latlng = new google.maps.LatLng(-34.397, 150.644);
    var myOptions = {
      zoom: 15,
      center: latlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP,
      scrollwheel:false
    }

    map = new google.maps.Map(document.getElementById( div ), myOptions);
    //map.disableDragging()
    if (geocoder) {
        geocoder.geocode( { 'address': address}, function(results, status) {
            if (status == google.maps.GeocoderStatus.OK) {
                map.setCenter(results[0].geometry.location);
                     var marker = new google.maps.Marker({
                         map: map,
                         position: results[0].geometry.location
                          });
            } else {
                 alert("Impossible de localiser " + address);
            }
        });
    }
}


text:
Q: Cooccurrence in Mongodb I am familiar with relationnal database such as Mysql. Recently I'm working on project that use MongoDb to stock 100000 Documents. The structure of these Docs is as such :
    {
      "_id" : "1",
      "abstract" : "In this book, we present ....",
      "doi" : "xxxx/xxxxxx",
      "authors" : [
                   "Davis, a",
                   "louis, X",
                   "CUI, Li",
                   "FANG, Y"
                    ]
      }

I would like to extract the cooccurence matrix or cooccurence value of all possible combination of authors (only pairs). the expected outpout is :
{ [auth1 , auth2 : 5 ] [auth1, auth3 : 1] [auth2, auth8 : 9]....}
wich means that auth1 and auth2 coollaborate 5 times (in 5 books) auth2 and auth8 collaborate 9 times ....
In relation database, possible solution could be :
 in a table auth-book for example :
    INSERT INTO auth-book (id_book, id_auth) VALUES
              (1, 'auth1'),
              (1, 'auth2'),
              (1, 'auth3'),
              (2, 'auth1'),
              (2, 'auth5'),
              (2, 'auth87'),
              (2, 'auth2')...

the query that calculate cooccurence or collaboration of authors is :
     SELECT   a.id_auth a, b.id_auth b, COUNT(*) cnt
     FROM     auth-book a JOIN auth-booke b ON b.id_book= a.id_book AND   .id_auth > a.id_auth
     GROUP BY a.id_auth, b.id_auth

output: [auth1 auth2 => 2][auth1 auth3 => 1][auth2 auth3 => 1].......etc
I have no idea how to implement such query in mongodb

A: This is a wee bit scary but it seems to work.  Basically, we $lookup against ourselves and leverage the fact that lookup of a string into an array of strings is an implicit $in-like operation.
 db.foo.aggregate([
 // Create single deduped list of authors:
 {$unwind: "$authors"}
 ,{$group: {_id:null, uu: {$addToSet: "$authors"} }}

 // Now unwind and go lookup into the authors array in the same collection.  If $uu
 // appears anywhere in the authors array, it is a match.
 ,{$unwind: "$uu"}
 ,{$lookup: { from: "foo", localField: "uu", foreignField: "authors", as: "X"}}

 // OK, lots of material in the pipe here.  Brace for a double unwind -- but
 // in this data domain it is probably OK because not every book has the same
 // set of authors, which will attenuate the result $lookup above.
 ,{$unwind: "$X"}
 ,{$unwind: "$X.authors"}

 // The data is starting to be clear here.  But we see two things:
 // self-matching (author1->author1) and pairs of inverses
 // (author1->author2 / author2->author1).  We don't need self matches and we
 // only need "one side" of the inverses.   So... let's do a strcasecmp
 // on them.  0 means the same so that's out.  So pick 1 or -1 to get one side
 // of the pair; doesn't really matter!  This is why the OP has b.id_auth > a.id_auth
 // in the SQL equivalent: to eliminate self match and one side of inverses.
 ,{$addFields: {q: {$strcasecmp: ["$uu", "$X.authors"] }} }
 ,{$match: {q: 1}}

 // And now group!
 ,{$group: {_id: {a: "$uu", b: "$X.authors"}, n: {$sum:1}}}
            ]);

A: Probably not what you're looking for but this "works."   The challenge is creating the pairs list which is what the self join in SQL is doing.   Moving the pairing out of the query also means it is easier later to change from pairs to triples to whatever because the find() uses the $all function to ensure a match for any number of items.
c=db.foo.aggregate([
// Create single deduped list of authors:
{$unwind: "$authors"}
,{$group: {_id:null, uu: {$addToSet: "$authors"} }}
            ]);

doc = c.next(); // Get single doc output from above
ulist = doc['uu'];
c.close();

// Create unique pairs:
pairs = [];
for(var index = 0; index < ulist.length; index++) {
    var first = ulist[index];
    for(var p2 = index+1; p2 < ulist.length; p2++) {
        pairs.push([first, ulist[p2]]);
    }
}

// And now go get 'em:
pairs.forEach(function(qq) {
    n=db.foo.find({"authors": {$all: qq }}).count();
    print(qq[0] + "-" + qq[1] + ": " + n);
    });


text:
Q: poll tag causing conflict Below is the xhtml body.

        <h:outputText value="#{notificationBean.strMessg}" id="outText" escape="false" styleClass="msgCls"/>
        <p:poll interval="20"  listener="#{notificationBean.browerNotified}" update="outText"  id="notificationPoll" >
        </p:poll>
        <audio id="audio1" src="./images/new_notification.wav"  preload="auto"></audio>

</h:body>

I have included this xhtml file in another xhtml named "test.xhtml".
My Project consists of 4-5 modules.When i call poll tag in test.xhtml other ajax requests failed to call and shows me the partial response error...


text:
Q: Проблема с записью в БД. Потоки, Java Реализовал паттерн Producer-Consumer.
Класс Producer производит изображения а Consumer записывает их в БД.
Если в классе Consumer заменить код (который выполняет запись в БД) на код, который будет записывать эти изображения на диск, то все работает.
Если проверить все построчно, то preparedStatement.executeUpdate(); он просто пропускает и сразу же переходить в блок исключений Exception. Ни ошибки, ничего.
Вот тут реализовывается запись:
String id_tile;
int zoomLvl;
int x;
int y;
byte[] imageInByte;
String id_photo;
DataLoader dat = new DataLoader();

private boolean available = false;

public synchronized void get() throws IOException, SQLException {

    while (available == false) {
        try {
            wait();
        } catch (InterruptedException e) {
        }
    }
    // метод, который записывает в БД (должен записывать)
    dat.insertToTiles(id_tile, zoomLvl, x, y, imageInByte, id_photo);

    available = false;
    notifyAll();
}

public synchronized void put(String id_tile, int zoomLvl, int i, int j,
               byte[] imageInByte, String id_photo) throws IOException {
    while (available == true) {
        try {
            wait();
        } catch (InterruptedException e) {
        }
    }

    this.id_tile = id_tile;
    this.zoomLvl = zoomLvl;
    this.x = i;
    this.y = j;
    this.id_photo = id_photo;
    this.imageInByte = imageInByte;

    available = true;
    notifyAll();
}

Значения в параметрах проверял, все заполнены, равных null нету.
Вот сам метод записи:
public void insertToTiles(String id_tile, int zoom, int x, int y,
                     byte[] image, String id_photo) throws SQLException {

    Connection conn = SingletonDBConnection.getConnection();
    PreparedStatement pstmt = null;

    try {

        String query = "insert into tiles(id_tile, zoom, x, y, image, id_photo) "+
                               "values(?,?,?,?,?,?)";
        pstmt = conn.prepareStatement(query);

        pstmt.setString(1, id_tile);
        pstmt.setInt(2, zoom);
        pstmt.setInt(3, x);
        pstmt.setInt(4, y);
        pstmt.setBytes(5, image);
        pstmt.setString(6, id_photo);

        pstmt.executeQuery();
    } catch (Exception e) {
        System.out.println("Error !");
    }
}

Добавил e.stacktrace и выдало вот такую ошибку:

org.postgresql.util.PSQLException: ERROR: current transaction is
  aborted, commands ignored until end of transaction block  at
  org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2270)
    at
  org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1998)
    at
  org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
    at
  org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:570)
    at
  org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:420)
    at
  org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:305)     at DataLoader.insertToTiles(DataLoader.java:83)     at
  TileLoader.get(TileLoader.java:26)    at Consumer.run(Consumer.java:21)
    at java.lang.Thread.run(Thread.java:745)


text:
Q: The difference between np.random.seed(int) and np.random.seed(array_like)? In Python's numpy library, the np.random.seed method can accept two different types of parameter: int and array_like[int].
What's the difference between them? Such as: np.random.seed(2) and np.random.seed([2013, 1, 4]).

A: The state of the underlying Mersenne Twister PRNG is very large, 624 32-bit integers, to be exact. If given an integer seed, the initialization routine will run a smaller PRNG to expand that single 32-bit integer out to the full 624-element state. This does mean that you can't access the vast majority of the possible states.
Similarly, if given a sequence of integers as the seed, then a different smaller PRNG will use that to expand out to 624 elements, but one that can use the whole array that you pass it. This lets you access the whole space of initial states, if such a thing matters to you. This algorithm is shared between the standard library's random module and numpy.random.


text:
Q: Does time exist in a vacuum? Imagine a perfect vacuum devoid of all matter and radiation. Irrespective of whether such a space can even exist, my intuition tells me that time would not exist within such a space. What this thought experiment tells me is that the human concept of time is basically that it's a measure of motion. Whether its a car speeding down a highway, skin on your face as the years go by, or photons, it's really all about motion. Now what about something like a gravitational field? Could that also be excluded from acting within a perfect vacuum?

A: Assuming you're willing to accept General Relativity as a valid theory, your question has a well defined answer because we can solve the equations of GR for an empty universe. The result (well, the simplest result) is Minkowski spacetime.
You might think that nothing much can happen in an empty universe, but even though no matter or energy is present there can still be gravity waves. Indeed it's just possible, though sadly the evidence is against it, that you could have stable structures called geons that are built only from gravitational radiation.
Anyhow the point is that even a completely empty universe can have a dynamical structure and hence time evolution. So time does still exist even in a completely empty universe.

A:
Now what about something like a gravitational field? Could that also be excluded from acting within a perfect vacuum?

As pointed out in this Wikipedia article on gravitational shielding, the ability to shield gravitational fields would violate the equivalence principle which is inconsistent with both Newtonian mechanics and Einstein's general relativity.  I.E. the ability to shield gravity is inconsistent with everything we know about gravity.  Practically, this is also related to the fact that mass comes with only one sign.

A: Isn't saying that time doesn't exist without motion equivalent to saying that sound doesn't exist when no one is around to hear it? You can't rule out time's existence in this way. Then again, why focus on time? When you propose an empty space, does space exist? Normally space is detected as a separation between objects. If no objects exists, as per scenario envisioned, would space exist when no one is around to measure or view it? In both cases I would argue that space and time exist regardless of the presence of particles and their motion, and indeed, regardless of the presence of an observer.

A: I think that using the concept of vacuum makes it harder to explain your question, because with the absence of matter you are moving towards the absence of Universe. I learned from the other answers that there is still energy and waves in vacuum, this is why I say "moving towards the absence of Universe", which I think it's not what you wanted to aim.
I myself asked this question long ago but I prefer to think in absolute zero, in which you are moving towards the absence of motion, like you describe. From Wikipedia I just learned that in absolute zero there is still a minimum energy state, but the reason I prefer using absolute zero instead of vacuum is because you still have matter in it, and can concentrate only in the (non)existence of Time.
So, ending with all motion would probably require ending with the Universe, which is not what we want to do here. Thus, I prefer to pose the question in the following way: is Time different from Space or a redundant dimension?
I think Time is redundant. You can refer to any point in Time (abstract concept) by describing the configuration of Space (all particles of the Universe). Using that configuration of Space and the laws of Physics you can predict the next configuration of Space. So, using the abstract concept of Time is just a way of referring to a configuration of the Universe in a practical way.
I hope I have improved my answer by slightly modifying your question, since I've also been through that line of thought. To better answer your question there is this book "The End of Time" by Julian Barbour. It was very reassuring to know there were more people to think about Time the way I do. Maybe you feel the same.

A: You people make this overly complicated. If the vacuum exists, time absolutely exists as well.
For example, if the vacuum were to exist near a source of radiation, particles. They could enter the given vacuum as time passes by so time absolutely exists.
also, time as a count of existence progressing, also must be identically throughout the universe to our existence in and of itself, whereby a time period passed on earth is the sane time period passed in a vacuum on the other side of our universe.


text:
Q: How to make a form able to upload files in elm I am trying to make a form in elm that would be able to upload a picture and some accompanying data.
Right now all my fields are updating my model via the onInput function, and I when I press the submit button I send my data as JSON via the Http.post function. If I understand well this is the idiomatic way of doing forms in elm.
Is there a way to add file uploading capabilities to this kind of form? If possible I would like to keep control in the elm app without resorting to the standard html elements to do submitting.

A: Here you are. Some of my notes:

*

*http://simonh1000.github.io/2016/12/elm-s3-uploads/

*

*https://github.com/simonh1000/file-reader

*https://github.com/danyx23/elm-dropzone

*

*https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API/File_drag_and_drop

*File Upload in Elm

*elm: read file content

*https://www.paramander.com/blog/using-ports-to-deal-with-files-in-elm-0-17

*Add support for  https://github.com/elm-lang/html/issues/20

*

*https://github.com/lovasoa/elm-fileinput

*https://www.reddit.com/r/elm/comments/4926am/uploading_files_through_elmhttp/

*http://elm-ui.info/documentation/guides/handling-files

*How to trigger click event in elm

A: Yes, native code is needed for two things:

*

*to access the FileReader API; and

*to 'trick' the HTTP library into allowing you to add a file to a multipart form.

This is all covered in this blog post, which accompanies the FileReader library mentioned by rofol.
Instead of native code, you can of course use ports.


text:
Q: How do you add user variables to custom Python functions in QGIS Function Editor? How do you add user input variables to a Custom Function created in Python in QGIS3.x. I found the below piece of code but need to modify it to control the string to split by and the index value to return.
import re
from qgis.core import *
from qgis.gui import *

@qgsfunction(args="auto", group='Custom')
def splitField(inField, feature, parent):
    return  re.split('[-|#|~|\*]', inField)[1]

How do I make the search string and the list index a user controlled variable?

A: Using the example
import re
from qgis.core import *
from qgis.gui import *

@qgsfunction(args="auto", group='Custom')
def splitField(inField, feature, parent):
    return  re.split('[-|#|~|\*]', inField)[1]

the "def splitField(inField, feature, parent)" section is where you need to define the variables by adding "variablename" separated by a ",", then using that variable name in the pythoncode. Using the example code it should look like this.
import re
from qgis.core import *
from qgis.gui import *

@qgsfunction(args="auto", group='Custom')
def splitField(inField, inString, listIndex, feature, parent):
    return re.split(inString, inField)[listIndex]

When you use this Custom Function in your Expression builder you will address the variable sin the order they are listed in the "def splitField(inField, feature, parent):" section of the code for example
splitField("MYFIELD",'MYSTRING',MYINDEX)

or
splitField('QGIS ROCKS!', 'S', -1)

Will return "!" for more information how this is used the links below are good resources.
My source;
https://madmanwoo.gitlab.io/foss4g-python-workshop/expression_functions/
https://docs.qgis.org/3.4/pdf/en/QGIS-3.4-PyQGISDeveloperCookbook-en.pdf


text:
Q: How to create GoogleMap Marker Listeners to open a Vue component? I am working on an app in which there are restaurants on a map (Google Map API) and in a list composant aside.
I have set a listener which opens the component AddRestaurant with a click on the map.
What I don't manage to do is to setting a listener to open the component ReadComments when the user clicks on a marker.
The click doesn't work, whether I put the listener in the component GoogleMap (create the map), or GoogleMarkers (create the markers), or MainMap (which imports the two others).
I'm sorry I can't put the code in a jsfiddle, so here are the code of the three map componants:
GoogleMap:
<template>

    <template v-if="Boolean(this.google) && Boolean(this.map)">
      <slot :google="google" :map="map"></slot>
    </template>

</template>

GoogleMarkers:
<template>

</template>

MainMap:
<template>
  <google-map
    :center="customCenter"
    :defaultCenter="defaultCenter"
    @map-initialized="initialize"
    @map-bounds-changed="selectVisibleMarker"
    @map-clicked="openAddRestaurant"
  >
    <template slot-scope="{ google, map }">
      <google-markers v-for="marker in markers" :marker="marker" :map="map" :google="google"></google-markers>
      <google-markers v-if="userMarker !== {}" :marker="userMarker" :map="map" :google="google"></google-markers>
    </template>
  </google-map>
</template>

For know I am stuck here (but have already tried to put this listener in GoogleMap and MainMap.
This is the method I tried to set in GoogleMarkers.
openReadComments() {
        // google.maps.event.addListener(this.marker, 'click', (event) => {
        //   console.log('I am clicked');
        // });

        this.marker.addListener('click', function () {
          console.log('clicked');
        });
      },

I have tried to set a listener on the user marker (since there is only one, so no array problem) but it still doesn't work at all.
The listener doesn't work and there is no message in the console.
If someone does know to create such listeners (without the plugin available for Vuejs), it would be a great help. Thanks.


text:
Q: Which selector will apply for HTML tag

Both ID and class have same style.
Which will apply? And what is the reason?

A: It will always apply id style. Because Id have high specificity .
Check:

#divNav
       {
        font-size:25px;
       }
.divNav
       {
        font-size:15px;
       }

test

And:

.divNav
       {
        font-size:15px;
       }

#divNav
       {
        font-size:25px;
       }

test

A:

.divnav{
  color:red !important;
  }

#divnav{
  color:blue;
  }

Test

You can try to remove important and style in tag for look at the priority.
Css have some priority :

*

*Tag < class < id

*Style in attribute > id

*But !important > all, don't use it

you can calculate priority using :
Style in attribute = 1000

#id = 100

.class = 10

tag = 1

So
#id .class tag {
 /* = 111 */
}

#id #id2 {
/* = 200 */
}


text:
Q: problem triggering input on selenium java I am trying to do web automation test with cucumber/selenium java. This is the site i am trying : https://www.vakifbank.com.tr/kredi-hesaplama-araci.aspx?pageID=1333
In this page, i can not enter a value the second tab. I tried to slide the bar, but the two slider have same html code. First i tried this;
@And("Tutar olarak onbin tl girilir.")
public void tutar_olarak_onbin_tl_girilir() {
    JavascriptExecutor js = (JavascriptExecutor) driver;
    WebElement a = driver.findElement(By.xpath("//div[@class=\"slider tutarSlider ui-slider ui-corner-all ui-slider-horizontal ui-widget ui-widget-content\"]"));
    js.executeScript("arguments[0].setAttribute('style', 'left: 30%;')",a);
}

After i tried;
@And("Tutar olarak onbin tl girilir.")
public void tutar_olarak_onbin_tl_girilir() {

 driver.findElement(By.xpath("//input[@id=\"txtTutarVisible\"]")).sendKeys("10000");

}

But both of them are not working.


text:
Q: Cannot Access to Data from my API (Asynchronous problems) I have a problem, I'm trying to get my room data from my API to use the map function after but I can't get the data.
Here is my code.
    Axios.get(`/user/rooms?${token}`).then(res => {
        tmp.push(res.data)
    })
    const data = tmp
    const Rooms = [data]
    const RoomNames = []

And Here is the output after making console.log(data):
0: (4) [{…}, {…}, {…}, {…}]length: 1
__proto__: Array(0)

And data[0] is undefined

A: Javascript is based on asynchronous so the only way to do this is to call all your logic inside the callback (because .then needs more time, and javascript doens't wait for it)
Axios.get(`/user/rooms?${token}`).then(res => {
    tmp.push(res.data)
    // this comes later so you can only get res.data in here
    const data = tmp
    const Rooms = [data]
    const RoomNames = []
})
// everything under here will be executed before .then

A: Axios.get is a promise, which will get added to the event loop for execution. .then will act as a callback after data from your request is ready it will get executed.
In your code, you are accessing tmp to data before data from the request is added to tmp array.
let tmp = [];

Axios.get(`/user/rooms?${token}`).then(res => {

    tmp.push(res.data);
    const data = tmp
    const Rooms = [data]
    const RoomNames = []

})

For more about promises.


text:
Q: How can I sort a readonly datagridview I just don't want users to manually add/edit/delete any record in the grid. All records are added by the program dynamically. Yet i want to allow users to sort the records by clicking the column header.
Is this requirement really so contradictory that the readonly and sorting can't be achieved at the same time?

A: Turns out the magic is the type of the data source of the datagridview. It has to implement some specific interfaces to support certain features such as sorting.


text:
Q: How to use okhttp, to operate the files on the Webdav? Because Sardine or Jackrabbit implementations rely on httpclient, but httpclient has been abandoned by Android. I wrote the Java code is always unable to compile correctly, some because of the multi dex error, some because not found INSTANCE or classes and so on ... ...
I would like to use okhttp, but did not find a little document, so can give me some tips. Thank you.

A: Try this: https://github.com/thegrizzlylabs/sardine-android
It is a WebDAV client for Android, using OkHttp as HTTP client.
Legacy:
Originally forked from Sardine
Apache HTTP Client was replaced by OkHttp
JAXB was replaced by SimpleXml

A: You can have a look to this lib too https://gitlab.com/bitfireAT/dav4android
It's used in https://github.com/owncloud/android-library too


text:
Q: Migrate to Spring Data JPA from Synyx Hades I want to migrate from Hades to Spring Data JPA (I know, it's late). However, when I use the @EnableJpaRepositories annotation in my configuration to enable it, I get the following exception:
java.lang.IllegalArgumentException: Environment must not be null!
    at org.springframework.util.Assert.notNull(Assert.java:112) ~[spring-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
    at org.springframework.data.repository.config.RepositoryConfigurationSourceSupport.<init>(RepositoryConfigurationSourceSupport.java:50) ~[spring-data-commons-1.8.0.RELEASE.jar:na]
    at org.springframework.data.repository.config.AnnotationRepositoryConfigurationSource.<init>(AnnotationRepositoryConfigurationSource.java:74) ~[spring-data-commons-1.8.0.RELEASE.jar:na]
    at org.springframework.data.repository.config.RepositoryBeanDefinitionRegistrarSupport.registerBeanDefinitions(RepositoryBeanDefinitionRegistrarSupport.java:74) ~[spring-data-commons-1.8.0.RELEASE.jar:na]
    at org.springframework.context.annotation.ConfigurationClassParser.processImport(ConfigurationClassParser.java:395) ~[spring-context-3.2.3.RELEASE.jar:3.2.3.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:207) ~[spring-context-3.2.3.RELEASE.jar:3.2.3.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:165) ~[spring-context-3.2.3.RELEASE.jar:3.2.3.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:131) ~[spring-context-3.2.3.RELEASE.jar:3.2.3.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:197) ~[spring-context-3.2.3.RELEASE.jar:3.2.3.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:165) ~[spring-context-3.2.3.RELEASE.jar:3.2.3.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.processImport(ConfigurationClassParser.java:401) ~[spring-context-3.2.3.RELEASE.jar:3.2.3.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:207) ~[spring-context-3.2.3.RELEASE.jar:3.2.3.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:165) ~[spring-context-3.2.3.RELEASE.jar:3.2.3.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:140) ~[spring-context-3.2.3.RELEASE.jar:3.2.3.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:282) ~[spring-context-3.2.3.RELEASE.jar:3.2.3.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:223) ~[spring-context-3.2.3.RELEASE.jar:3.2.3.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:630) ~[spring-context-3.2.3.RELEASE.jar:3.2.3.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:461) ~[spring-context-3.2.3.RELEASE.jar:3.2.3.RELEASE]
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389) ~[spring-web-3.2.3.RELEASE.jar:3.2.3.RELEASE]
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294) ~[spring-web-3.2.3.RELEASE.jar:3.2.3.RELEASE]
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112) [spring-web-3.2.3.RELEASE.jar:3.2.3.RELEASE]
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939) [catalina.jar:7.0.42]
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434) [catalina.jar:7.0.42]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:7.0.42]
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) [catalina.jar:7.0.42]
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) [catalina.jar:7.0.42]
    at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_55]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_55]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_55]
    at java.lang.Thread.run(Thread.java:744) [na:1.7.0_55]

As I'm not the most experienced Spring user I have no idea where to even begin to debug this and Google didn't return anything. If I explicitly autowire an Environment somewhere, I get one so I don't know why it would be null here.
What am I doing wrong and how can I fix it?

A: So the fix is rather trivial: After fixing the version of all Spring components to 3.2.9, everything works as it should.
I'm fairly sure it's due to Bug SPR-11744 (thanks to Andrei Stefan in the comments to the question).


text:
Q: The form is not center aligned (vertically centered/middle) I have a below code, there I have align-center justify-center defined on the v-flex. But I still see the signin form is not vertically centered in the screen. Whats wrong in my code?
<template>
  <v-container>
    <v-layout row wrap>
      <v-flex xs12 sm8 offset-sm2 align-center justify-center>
        <v-card class="elevation-12">
          <v-toolbar dark color="primary">
            <v-toolbar-title>Sign In</v-toolbar-title>
          </v-toolbar>
          <v-card-text>
            <v-container>
              <form>
                <v-layout row>
                  <v-flex xs12>
                    <v-text-field
                      name="emailid"
                    </v-text-field>
                  </v-flex>
                </v-layout>
                <v-layout row>
                  <v-flex xs12>
                    <v-text-field
                      name="password"
                    </v-text-field>
                  </v-flex>
                </v-layout>
                <v-layout row xs12>
                  <v-flex>
                    <v-btn flat block color="primary"
                      @click.prevent="validateBeforeSubmit">
                    Sign In
                    </v-btn>
                  </v-flex>
                  <v-flex>
                    <v-btn flat block
                      @click.prevent="clear">
                    Clear
                    </v-btn>
                  </v-flex>
                </v-layout>
              </form>
            </v-container>
          </v-card-text>
        </v-card>
      </v-flex>
    </v-layout>
  </v-container>
</template>

Here's the screen output. Notice it is centered at the top, not vertical middle.

Updated with additional details:
Here is my App.vue content.
<template>
  <v-app>
    <app-navbar></app-navbar>

      <router-view/>

  </v-app>
</template>

The Navigation.vue (app-navbar)file has below
<template>

    <v-navigation-drawer absolute temporary v-model='sideNav'>
      <v-toolbar flat>
      <v-list>
        <v-list-tile>
          <v-list-tile-title class='title'>
            Talent Search
          </v-list-tile-title>
        </v-list-tile>
      </v-list>
    </v-toolbar>
    <v-divider></v-divider>
    <v-list class='pt-0'>
      <v-list-tile v-for='item in menuItems' :key='item.title' :to='item.link'>
        <v-list-tile-action>
          <v-icon>{{ item.icon }}</v-icon>
        </v-list-tile-action>
        <v-list-tile-content>
          <v-list-tile-title>{{ item.title }}</v-list-tile-title>
        </v-list-tile-content>
      </v-list-tile>
    </v-list>
    </v-navigation-drawer>
    <v-toolbar dense dark color="menus">
      <v-toolbar-side-icon @click.stop='sideNav = !sideNav' class='hidden-sm-and-up '>
      </v-toolbar-side-icon>
      <v-toolbar-title>
        <router-link to='/' tag='span' style='cursor: pointer'>Talent Search</router-link>
      </v-toolbar-title>
      <v-spacer></v-spacer>
      <v-toolbar-items class='hidden-xs-only'>
        <v-btn flat v-for='item in menuItems' :key='item.title' :to='item.link'>
          <v-icon left dark>{{ item.icon }}</v-icon>
          {{ item.title }}
        </v-btn>
      </v-toolbar-items>
    </v-toolbar>

    <v-toolbar dense>
      <v-toolbar-side-icon @click.stop='userLoggedSideNav = !userLoggedSideNav'>
      </v-toolbar-side-icon>
      <v-toolbar-title>Title</v-toolbar-title>
      <v-spacer></v-spacer>
      <v-toolbar-items>
        <v-btn
          flat
          @click="onLogout">
          <v-icon left dark>exit_to_app</v-icon>
          Sign Out
        </v-btn>
      </v-toolbar-items>
    </v-toolbar>
    <v-navigation-drawer mb-0 absolute temporary v-model='userLoggedSideNav'>
      <v-layout row align-center>
        <v-flex justify-center>
          <some_image>
        </v-flex>
      </v-layout>
      <v-list class="pt-2 mb-0 pb-0" dense>
        <v-divider></v-divider>
        <v-subheader>Profile</v-subheader>
        <v-list-tile v-for="item in items" :key="item.title" :to='item.link' ripple>
          <v-list-tile-action>
            <v-icon>{{ item.icon }}</v-icon>
          </v-list-tile-action>
          <v-list-tile-content>
            <v-list-tile-title>{{ item.title }}</v-list-tile-title>
          </v-list-tile-content>
        </v-list-tile>
      </v-list>
    </v-navigation-drawer>

</template>

Please help me on this.

A: How about adding fill-height to the v-container and align-center to the v-layout:
<v-container fill-height>
  <v-layout row wrap align-center>

Remove the  tag
Also, v-content no longer needs to be wrapped in a main tag.
So change your App.vue from:
<template>
  <v-app>
    <app-navbar></app-navbar>

      <router-view/>

  </v-app>
</template>

To
<template>
  <v-app>
    <app-navbar></app-navbar>

    <router-view/>

  </v-app>
</template>

JSFiddle demo here.

A: Unfortunately, I won't be able to help you without a demo link. However, if I were to guess your issue may due to your colum size attrs - xs8. Or perhaps you're using the incorrect flex property. Try using the align-items: center;


text:
Q: Jenkins sends email notification to all SVN users I have a build job that cleans, builds, and tests our project. I have setup Jenkins to send an email to me + the developer who broke the build. We then had one developer break a test so that the test did not compile. Jenkins sent an email notification to everyone registered to SVN.
We all work on the same branch, but shouldn't Jenkins only notify me + the one developer who broke the build? I understand that all developers who have touched the code AFTER the build has broken should also be notified, but according to SVN logs there was only one person doing the commit. Jenkins polls SVN right away after a commit has been made, so there were no subsequent commits.

A: Are you using "Editable Email Notification" post-build action?
If you don't see that option, you may need to download "email-ext" plugin
https://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin
Once you've selected the plugin in the post-build section, you then have an "advanced" button. Click that, and you will see an option to "Add a trigger". You have triggers for things such as:
- "Success" (Successful build) or
- "Failure" (failed build).
- There is also a trigger for "Unstable" builds. If you are running Maven, failed tests usually mark the build unstable, or there are other ways you can manually mark builds unstable based on conditions.
Either way, for each trigger, you can specify to whom to send the email (and you can have multiple triggers configured).
Recipient list - predefined list, either global or per trigger
Committers - those that made SVN changes for this checkout
Culprits - those that made SVN changes since last successful build
Requester - user that triggers the build


text:
Q: Unhandled Xamarin Android exceptions have bad stack trace when logging to Visual Studio App Center I'm implementing Visual Studio AppCenter for handling crashes, as it's replacing HockeyApp. I'm testing it out by throwing an exception manually in my code (NOT within a try/catch block):
throw new Exception ("New exception when redirecting to property details!");

I then have code that globally handles any uncaught exceptions in Application.cs and tries to log them to AppCenter with the Crashes.TrackError call:
AndroidEnvironment.UnhandledExceptionRaiser += LogException;

private void LogException (object sender, RaiseThrowableEventArgs e) {
            var exc = e.Exception;
            if (ShouldLogException (exc)) {
                // Log exception to AppCenter.
                var properties = AppCenterLoggingSink.GetProperties ();
                Crashes.TrackError (exc, properties);
                e.Handled = true;
            }
        }

When I do this, the stack trace that it logs to the console looks good:

[MonoDroid] System.Exception: New exception when redirecting to
  property details! [MonoDroid]   at
  RPR.Mobile.Droid.Fragments.RecentActivityFragment.RedirectToPropertyDetails
  (RPR.Mobile.Shared.Entities.PropertyDetails.Property property)
  [0x00001] in
  /Users/justintoth/Documents/rpr-mobile/android-application/Fragments/RecentActivityFragment.cs:190
  [MonoDroid]   at
  RPR.Mobile.Droid.Fragments.RecentActivityFragment.b__15_0
  (RPR.Mobile.Shared.Entities.PropertyDetails.Property property)
  [0x00000] in
  /Users/justintoth/Documents/rpr-mobile/android-application/Fragments/RecentActivityFragment.cs:170
  [MonoDroid]   at
  RPR.Mobile.Droid.Adapters.SearchResults.PropertyListRowPhotoAdapter.b__2_0
  (System.Object o, System.EventArgs e) [0x00001] in
  /Users/justintoth/Documents/rpr-mobile/android-application/Adapters/SearchResults/PropertyListRowPhotoAdapter.cs:34
  [MonoDroid]   at
  Android.Views.View+IOnClickListenerImplementor.OnClick
  (Android.Views.View v) [0x00011] in
  <5f142c269d8a438c94480ac03744dec7>:0  [MonoDroid]   at
  Android.Views.View+IOnClickListenerInvoker.n_OnClick_Landroid_view_View_
  (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr
  native_v) [0x00011] in <5f142c269d8a438c94480ac03744dec7>:0
  [MonoDroid]   at (wrapper dynamic-method)
  System.Object.60(intptr,intptr,intptr)

However, as the app closes it logs the exception to the console with a bad stack trace:

[AppCenterCrashes] System.Exception: New exception when
  redirecting to property details! [AppCenterCrashes]   at (wrapper
  dynamic-method) System.Object.60(intptr,intptr,intptr)
  [AppCenterCrashes]   at (wrapper native-to-managed)
  System.Object.60(intptr,intptr,intptr)

When I look in AppCenter, it logs the exception ONLY with the bad stack trace. So that's a problem... The other problem is that it completely ignored my Crashes.TrackError call, the exception with the good stack trace and properties set doesn't get added to AppCenter.
What am I missing?

A: Visual Studio AppCenter automatically catches .NET exceptions for you.
The Android code your posted earlier is not necessary. Without it, if your SDK is initialized correctly, you will receive the stacktraces in the dashboard.
AndroidEnvironment.UnhandledExceptionRaiser += LogException;

private void LogException (object sender, RaiseThrowableEventArgs e) {
        var exc = e.Exception;
        if (ShouldLogException (exc)) {
            // Log exception to AppCenter.
            var properties = AppCenterLoggingSink.GetProperties ();
            Crashes.TrackError (exc, properties);
            e.Handled = true;
        }
    }

The code above is only for the Android platform. So basically you're getting the Android error, meaning that your app crashed, and you send that to appcenter. So the behavior seems logic to me.
Let AppCenter catch crashes on its own, and your should be fine for .NET exceptions.


text:
Q: Find condition under which variables fall away I have a somewhat lengthy expression, looking like
expr = 1 + x + b + Pi + 2*a

Is there some way of generating a relationship between a and b that makes the parameters fall away? In the example above, that condition could look like a -> -b/2 or 2*a == -b, because inserting that yields the new expression
expr2 = 1 + Pi

which is independent of both a and b. Note that the relationship contains only the two variables; it leaves the terms not involving them intact (namely x), in other words: a can depend only on b in the desired solution (if there is one of course).
I tried my best using the usual suspects (Reduce, Solve, SolveAlways, ...), but couldn't come up with a solution.
Background: My expression is a physical quantity that has certain mathematical parameters left in it. Being physical, it may not depend on the choice of the leftover parameters, ergo these parameters are not independent of each other. I would like to get rid of these placeholders, and doing so will tell me something about the physics in the ansatz that lead to the whole calculation.

A: Something like :
vars = {a, b};

Reduce[expr == (expr /. Thread[Rule[vars, 0]]), vars]

A bit more generally :
Simplify[expr == Total[Cases[expr, _?(Function[{x}, And @@ (FreeQ[x, #] & /@ vars)][#] &)]]]

A: I believe that
Solve[expr == const, {a,b}]

will give you such a condition for any choice of const.  You can write 1+Pi in place of const to get the example condition you gave, but you can also write 0 which gives another relationship that, when substituted back, gets rid of a and b.
It seems it is just a plain Solve you need.


text:
Q: import pycurl: Library not loaded: @rpath/libcrypto.1.1.dylib : Reason: image not found My flask app python code error's out with below error :
Traceback (most recent call last):
  File "######.py",
    import pycurl
ImportError: dlopen(/Users/########/Library/Python/3.7/lib/python/site-packages/pycurl.cpython-37m-darwin.so, 2): Library not loaded: @rpath/libcrypto.1.1.dylib
  Referenced from: /Users/########/Library/Python/3.7/lib/python/site-packages/pycurl.cpython-37m-darwin.so
  Reason: image not found

OS: Darwin Kernel Version 18.6.0 - Mojave 10.14.5
Tried updating brew,
openssl (link and unlink, export LDFLAGS, export CFFFLAGS) but nothing appears to work
$ brew install openssl
openssl 1.0.2s is already installed and up-to-date
$brew install curl-openssl
curl-openssl 7.65.3 is already installed and up-to-date

Any additional pointers to try. Thanks in advance

A: What solved it in my case was changing the path where Python would look for this libs, as they were installed by brew. But you can tell it to look for the lib somewhere else:
Add the following at the bottom of your profile file (~/.bashrc or ~/.zshrc, depending on your shell):
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/opt/local/lib

Then restart your shell, and try again (remember to reload your venv if your were using one).


text:
Q: iPhone Status/Overview App Wanted I often have my iPhone connected to my PC and now I have a question about something like a status app.
I thought of something like this information:
- a big clock
- signal strength
- mobile signal technology (2g/3g)
- charge status
I thought of something like an overview/status app because I connect my iPhone through a 6-cm cable and so I could see the infos from about 30-40 cm distance.

A: I'm not aware of any app that does exactly this. The closest I've seen is System Status, which is an Activity Monitor-style app that has a big battery status display, as well as lots of other info on free memory, device space, running processes, etc.
Something that does exactly what you're looking for is unlikely, as there are no public APIs for getting the device signal strength. Any such app wouldn't be allowed in the App Store. It is conceivable you could make something for a jailbroken device.
Perhaps just position the phone closer on your desk, as all that information is readily available in the standard iOS status bar.


text:
Q: Laptop shuts down and reboot when loading system I received an Acer laptop of a friend and I try to fix it, but I'm out of inspiration.
When the laptop boots and loads its OS (Windows 7) the laptop shuts down and reboots automatically, but doing the same (creates an infinte loop).
When I put a livecd from Linux or a windows 7 install cd, it also shutdowns when it's loading the setup or environment.
I tried to replace the hard drive, but this didn't do also a change.
The only thing that works is installing Windows 7 in safe mode, but after the first reboot of the installation Windows 7 rejects to continue the installation in safe mode. When I proceed the installation in normal mode, the pc shuts down again...
For me, this looks like a virus in the boot sector. My question is, what can I do about this in this situation?


text:
Q: How to Throw Multilingual Exceptions I have a multilingual web application, where I use a resource file in the frontend to display the different text.
I followed this approach http://www.codeproject.com/Tips/586948/ASP-NET-Website-and-Csharp-with-Multi-Language
Is there a way where the exception handling done in the backend throws exceptions according to the current language selected?

A: You need CustomException which inherit Exception for this.(Be aware never catch all the exceptions only the exception needed for your case, I just wrote you an example. If you catch all the exception you can lose specific information when something go wrong on productive server. Like I said in the past I used it for DBConcurrencyException)
Business Object logic
try
{
    //some code
}
catch(Exception ex)
{
   CustomException newEx = new CustomException();
   newEx.Message = "Translate Multilanguage String depending of the user culture"
   throw newEx;
}

UI-part aspx.Page
try
{
    //some code which calls the BO logic with try/catch
}
catch(CustomException ex)
{
    Label1.Text = ex.Message;
}

How to use this for validation purpose:
if(myValue < 5)
   throw new CustomException("Value should not be under 5");


text:
Q: Other drive loads after minutes After my Windows 10 starts up, my non-system HDD (WDC WD5000AZRX-00L4HB0) takes a few minutes to load. Until that, my shortcuts there are white, and if I try to open the drive in win explorer, it freezed (win explorer) until the drive "wakes up".
I don't know how relevant this is but:
I have installed Win 10 about half a year, it was not activated for approximately 2 months. After activating + 1 month this problem started to appear.
I used HD Tune for SMART scan:

A: Maybe it's just a matter of memory overstocking. Have you added a lot of data over recent months to your external drive? If you have, I would rather blame it on CPU capacity.
I use external drive on my Panasonic touchbook, and the story it's just the same. It runs lickety-split when empty, but gradually slows down as it gets filled with data.


text:
Q: Android linkedin application issue I have two question regarding the android linkedin application

*

*I wants to close the linkedin login page when click back button after sharing some contents from my application
I was shared my content through linkedin share activiy, it's working fine if linkedIn is already LOGGEDIN. But, if i logout the linkedin then tried to share some contents login page will appear at this time i have tried to close the linkedin login page with clicking of back button. But Login page always showing it's does't closing.
Intent intent = new Intent(Intent.ACTION_SEND);

ComponentName shareItem = new ComponentName("com.linkedin.android", com.linkedin.android.home.UpdateStatusActivity);
intent.putExtra(Intent.EXTRA_TEXT, _myContent);
intent.setComponent(shareItem);

*I wants to find the whether linkenin application is logged in or not.

A:
I wants to close the linkedin login page when click back button after
  sharing some contents from my application

As to access any page/screen of linkedin app you need to be logged in so it's must to login first.

I wants to find the whether linkedin application is logged in or not.

AFAIK not possible, as linkedin doesn't provide such info in any means.