text:
Q: How do I fix "Sorry, this file type is not permitted for security reasons" When I try to upload any PNG file, I get the following error message:

I have no plugin or anything installed, that could cause this. I even added the following line in order to fix this:
define('ALLOW_UNFILTERED_UPLOADS', true);
Since it is a local installation, security is not an issue. But still this didn't fix my problem. Any ideas what could cause this problem?

A: This error is thrown in _wp_handle_upload function. As you see from line above it will be thrown when WordPress can not figure it out which file type or file extension you are trying to upload. Try to debug $type and $ext variables to find out why your .png file is not recognized correctly.
My guess is that your webserver/WordPress is not recognizing png mime type correctly. Thats why $type variable is false|null|0.

A: Did you add this line correctly?
define('ALLOW_UNFILTERED_UPLOADS', true);
Because I faced the same issue fee days back and I added that code in my wp-config file right above where it says /* That's all, stop editing! Happy blogging. */
After uploading the file, I removed this line from wp-config file.

A: Try using the plugin WP Extra file types . Install this plugin in your wordpress site and you will be provided with a variety of extension option . You can select whatever extensions you want like png and upload the png file. This plugin will automatically support your files. You can also add new type of file which is not in the library and edit . This is a very easy way to upload whichever files you want.

A: Please insert the script below to function.php in your theme:
 function custom_myme_types($mime_types){
  $mime_types['images'] = "png/jpg";
  return $mime_types;
}
add_filter('upload_mimes', 'custom_myme_types', 1, 1);

A: WordPress has a logic to check the file content.  If it doesn't match to the ext of the file, it may not accept the upload.


text:
Q: Substring, As, Count issue I need to extract part of an ID Field (ParcelID) and then use the count field to count the number of times it is in the database.  This is what I did: I created a view with the following:
SELECT  ParcelID, SUBSTRING(ParcelID, 1, 12) AS PID, COUNT(PID) AS PIDCount
FROM    dbo.RptCDMGISExtract

It says that Invalid Column Name.  I guess I understand (PID) does not exist.  How can I complete this?

A: Based on your description, you seem to want:
SELECT SUBSTRING(ParcelID, 1, 12) AS PID, COUNT(*) AS PIDCount
FROM dbo.RptCDMGISExtract
GROUP BY SUBSTRING(ParcelID, 1, 12);

Note that many databases would use LEFT(ParcelID, 12) instead of the SUBSTRING() function.

A: SELECT SUBSTRING(id, 1, 12) AS PID,
       COUNT(*) AS PIDCount
FROM new_schema.new_table
GROUP BY PID;

redpajama_set_name: RedPajamaStackExchange


text:
Q: how to verify a omniture tag fired correctly using tamper data Sorry for asking a newbie question here. I've searched on the web but everyone else seems to know the answer so I can't find any definite words. I need to verify my omniture tag fires correctly in tamper data. Should I look for a call from adobetag.com? Or what other URL call should I look for?

A: If your implementation is Omniture's 3rd party cookie, the request will be sent to 2o7.net or omtrdc.net depending on the version of SiteCatalyst you are using (and whether or not it is through their TagManager). If it is a first party implementation, it will be to your own domain that you worked with Omniture ClientCare to setup.
You can certainly look for those domains in any number of addons or other programs (built-in net console, firebug, httpfox, charles proxy - basically anything that can see requests being made) but FYI there are a couple of options that make it easier to see Omniture requests.
If you are using FireFox and have the firebug addon, there is an extension to firebug called omnibug. It adds an extra tab to firebug that will show you requests to Omniture made, and even makes it an easy to read format (It also reports other ones like GA and WebTrends).
Alternatively, Omniture provides a debugging tool called DigitalPulse.  Basically you create a bookmark and for the location/url you put the javascript code snippet.  Then on the page you click the bookmark and it pops up a window showing info about any omniture requests made.

A: Filter to requests containing b/ss
They are the requests being sent to Omniture SiteCatalyst.
See these references if you need more information -
http://blogs.adobe.com/digitalmarketing/analytics/validate-your-mobile-app-measurement-implementation/
http://blogs.adobe.com/digitalmarketing/analytics/custom-link-tracking-capturing-user-actions/
http://emptymind.org/validating-page-tags-with-httpfox/
http://tech.groups.yahoo.com/group/webanalytics/message/24232

A: In short look for: "/b/ss" however this guy wrote a very in depth article on how to do that with HTTPFox it's a good read with screenshots: http://www.mikewebguy.com/2013/08/21/httpfox-helps-you-verify-what-data-is-being-sent-to-your-analytics-provider/


text:
Q: Data manipulation on all columns in Dataset with Java API After reading csv file in Dataset, want to remove spaces from String type data using Java API.
Apache Spark 2.0.0
Dataset<Row> dataset = sparkSession.read().format("csv").option("header", "true").load("/pathToCsv/data.csv");
Dataset<String> dataset2 = dataset.map(new MapFunction<Row,String>() {

    @Override
    public String call(Row value) throws Exception {

        return value.getString(0).replace(" ", "");
        // But this will remove space from only first column
    }
}, Encoders.STRING());

By using MapFunction, not able to remove spaces from all columns.
But in Scala, by using following way in spark-shell able to perform desired operation.
val ds = spark.read.format("csv").option("header", "true").load("/pathToCsv/data.csv")
val opds = ds.select(ds.columns.map(c => regexp_replace(col(c), " ", "").alias(c)): _*)

Dataset opds have data without spaces. Want to achieve same in Java. But in Java API columns method returns String[] and not able to perform functional programming on Dataset.
Input Data
+----------------+----------+-----+---+---+
|               x|         y|    z|  a|  b|
+----------------+----------+-----+---+---+
|     Hello World|John Smith|There|  1|2.3|
|Welcome to world| Bob Alice|Where|  5|3.6|
+----------------+----------+-----+---+---+

Expected Output Data
+--------------+---------+-----+---+---+
|             x|        y|    z|  a|  b|
+--------------+---------+-----+---+---+
|    HelloWorld|JohnSmith|There|  1|2.3|
|Welcometoworld| BobAlice|Where|  5|3.6|
+--------------+---------+-----+---+---+

A: Try:
for (String col: dataset.columns) {
  dataset = dataset.withColumn(col, regexp_replace(dataset.col(col), " ", ""));
}

A: You can try following regex to remove white spaces between strings.
value.getString(0).replaceAll("\\s+", "");

About \s+ : match any white space character between one and unlimited times, as many times as possible.
Instead of replace use replaceAll function.
More about replace and replaceAll functions Difference between String replace() and replaceAll()


text:
Q: Add line to index file to avoid page number Is it possible to write custom lines into the index-file?
Consider this:
\documentclass{scrbook}
\usepackage[splitindex]{imakeidx}

\makeindex[name=date]

\newcommand\dateindex[1]{\index[date]{#1}}

\begin{document}
 \section{Diary, April 4th, 1891}
 \dateindex{1891!04!27}

Just some text

\immediate\write\@indexfile{???}{}

   \printindex[date]
   \end{document}

My question is: How do i change this
\immediate\write\@indexfile{???}{}

to write something without pagenumber into the idx file?
Of course this does not make any sense as I could just use an sty-file. But in my final version I would have dates and page numbers for those part of the book that are not within a diary entry.

A: this example shows a simple method for suppressing the page number,
as well as the comma.
\documentclass{article}
\usepackage{makeidx}
\newcommand{\idxnopage}[1]{{}}
\providecommand{\gobble}[1]{{}}
\newcommand{\idxsechead}[1]{\textbf{#1}\gobble}
\makeindex

\begin{document}
Here is some text\index{some text} that we want indexed.

We also want a ``header'' in the index.

\index{00@\idxsechead{Header} |idxnopage}
\printindex
\end{document}

the resulting index:

of course, you are responsible for creating an appropriate sort field
so these entries sort into the desired order.
update:
according to a comment by @florian, this does not work with xindy.
it does work with imakeindex as long as makeindex is used as the back end.

A: This provides \dateindex for adding the page number and \dateindex* for suppressing it.
\documentclass{scrbook}
\usepackage{imakeidx}

\makeindex[name=date]

\makeatletter
\newcommand\dateindex{\@ifstar{\dateindex@noshow}{\index[date]}}
\newcommand\dateindex@noshow[1]{\index[date]{#1|noshowdate}}
\let\noshowdate\@gobble
\makeatother

\begin{document}

Not in the diary\dateindex{1892!04!27}\dateindex{1892!05!27}

\section{Diary, April 4th, 1891}
\dateindex*{1891!04!04}

\section{Diary, April 5th, 1891}
\dateindex*{1891!04!05}

Just some text

\printindex[date]

\end{document}

If you want to suppress the comma in the "no page" entries, you need a style file.
\begin{filecontents*}{checkcomma.ist}
delim_0 "\\checkcomma"
delim_1 "\\checkcomma"
delim_2 "\\checkcomma"
\end{filecontents*}

\documentclass{scrbook}
\usepackage{imakeidx}

\makeindex[name=date,options=-s checkcomma]

\makeatletter
\newcommand\dateindex{\@ifstar{\dateindex@noshow}{\index[date]}}
\newcommand\dateindex@noshow[1]{\index[date]{#1|noshowdate}}
\let\noshowdate\@gobble
\newcommand\checkcomma{\@ifnextchar\noshowdate{}{, }}
\makeatother

\begin{document}

Not in the diary\dateindex{1892!04!27}\dateindex{1892!05!27}

\section{Diary, April 4th, 1891}
\dateindex*{1891!04!04}

\section{Diary, April 5th, 1891}
\dateindex*{1891!04!05}

Just some text

\printindex[date]

\end{document}


text:
Q: What are the mandatory steps to import a module? I'm new to python and I face an issue:
I try to extend my SConstruct file and to import a module located in a sub-directory of my project.
Here is my SConstruct file:
import os, sys
sys.path.append(os.path.abspath(os.path.join('.', 'custom_dir')))
import mymodule

mymodule.foo()

Here is the mymodule.py file, located into a subdirectory named custom_dir:
def foo():
  print 'foo'

I also have a __init__.py file in my custom_dir directory.
When I execute scons:
  File ".\SConstruct", line 22, in <module>
    mymodule.foo()
AttributeError: 'module' object has no attribute 'foo'

If I do python.exe SConstruct I got the same result.
What am I doing wrong here ?

A: You should make sure that you are importing the correct module and not a different one with the same name somewhere else in your path
try running your program with python.exe -v SConstruct
or
print mymodule.__file__ right before print mymodule.foo()

A: Beware path manipulation; trouble will find you.
Take a look at http://docs.python.org/tutorial/modules.html
I've set up what I think you are trying to do below. This should work.
File structure:
/SConstruct.py
/custom_dir/
/custom_dir/__init__.py
/custom_dir/mymodule.py

/custom_dir/__init__.py is blank
/custom_dir/mymodule.py:
def foo():
    print 'foo'

/SConstruct.py:
import custom_dir.mymodule as mymodule

mymodule.foo()

A: You can access SCons classes, e.g. Environment from modules other than SConstruct by including
from SCons.Script import *

See the documentation here.
Also, rather than using '.' to indicate the root of the build tree, you should be using Dir('#').path.


text:
Q: Elasticsearch self.published? I am using elasticsearch-rails gem For my site i need to create custom callbacks. https://github.com/elastic/elasticsearch-rails/tree/master/elasticsearch-model#custom-callbacks
But i really confused by one thing. What means if self.published? on this code?
i try to use this for my models
after_commit on: [:update] do
  place.__elasticsearch__.update_document if self.published?
end

but for model in console i see self.published? => false but i don`t know what this means

A: From the document of elasticsearch-rails.

For ActiveRecord-based models, use the after_commit callback to protect your data against inconsistencies caused by transaction rollbacks:

I think it was used to make sure everything is updated successfully into database before we sync to elasticsearch server


text:
Q: Do we have to hardcode for localization in angular-translate for every language? Here i am doing the translation for 2 languages 'en' and 'de'
 app.config(['$translateProvider', function($translateProvider) {
  $translateProvider.translations('en', {
   'name': 'Hello',
   'FOO': 'This is a paragraph'
  });
 $translateProvider.translations('de', {
  'name': 'Hallo',
  'FOO': 'Dies ist ein Absatz'
  });
 $translateProvider.preferredLanguage('de');
}])

I am hardcoding the value for the key. How can we change the hello to hallo without hardcoding if we choose 'de' language?

A: You can put your translations into a separate file and load it as JSON. This way your localisation is not in your code.
As an example you can configure it:
$translateProvider.useStaticFilesLoader({prefix: 'l10n/', suffix: '.json'});

Which will try to load l10n/de.json for de language from your server. Just make sure to include angular-translate-loader-static-files dependency.


text: Q: An English translation of the paper "Expansion in Fourier series and integrals with Bessel functions" by Levitan In my research, I've come across some results which can be found in the aforementioned paper by Levitan (see here). Several authors simply paraphrase the work in the paper, particularly the results about the Bessel translation operator; however I am not interested just in the result but also in the proofs contained therein. Unfortunately, I cannot read Russian to tell what exactly it says. I can put pieces here or there together, but, for the most part, it's inaccessible. I was wondering if there was an English translation anywhere. For such a highly cited paper (110+ times!), I would think that an English translation would be floating around somewhere but I can't seem to find one. Or alternatively if there is an English reference which proves a lot of the results contained therein (not necessarily a translation), that would work as well. If worse comes to worst, I might try to recreate the proofs myself by piecing together the equations. If it comes to that, I'll throw it up on arXiv for ease of accessibility.


text:
Q: PSN Germany to Belgium transfer I recently moved to Belgium from Germany. Is there any way I can transfer my PS Network account info and games to the European PS Store before I pay for the PS+ package? Also, would it change the PS Store language so it isn't in German anymore?

A: No. Profiles can't be moved across regions. If you're not going to have German billing information anymore (address / payment method), then you'll need to either buy German PSN points, etc... from an online retailer to keep things consistent. Or setup a second account for the region you now live in and use that for purchases going forward.
Frankly, if you have already bought games and have trophies, etc... under your German account, just keep using that account. The devices don't care where you are and you can play local content even on a device homed to an different region. It only gets tricky if you want to buy DLC.


text:
Q: I would like to learn how to make a folder invisible, but not like changing attributes First, let me say thank you to all the people who have helped me. You guy's are great!
Ok, I saw some software that made a folder invisible. I'm not talking about hidden, I mean you couldn't see it at all! Does anyone know how to do that? If you could point me in a direction, that would be cool too.
Also, I'm already doing some things with setting the attributes to "hidden", but that's not what I'm looking for.
thanks.

A: You can utilize Windows API's to directly change its name for another starting with a "not-allowed" character (like % or &). Since deleted file are those starting with "?" (I guess), you could try the same approach.
So, you need to call the low-level function of the same DLL the .NET's "rename" function does.


text:
Q: Remove a group on strings from an object in ruby So, I have the following
removed_caps = self.user.caps.reject { |c| c == 'test' || c == 'test1'}
I want to have test and test1 as configs so that I can add to these in the future.
so something like:
caps_to_remove = ENV['BLACK_LIST']
split_caps_to_remove = caps_to_remove.split(' ')
puts split_caps_to_remove -->>> ["test", "test1"]

How do I incorporate split_caps_to_remove in the original code?
Thanks.

A: You could change your code to:
removed_caps = self.user.caps.reject { |c| split_caps_to_remove.include?(c) }

A: Use Fixed-String Methods
Assuming you have some variables defined as in the example below, then you can use String#delete or String#delete! as a faster way to remove your unwanted characters. Consider:
caps = ENV['BLACKLIST']='TE'
str1, str2 = 'TEST', 'TEST1'

[str1, str2].map { _1.delete caps }
#=> ["S", "S1"]

Fewer methods in a chain are often faster, and String methods that operate on a fixed String are often and order of magnitude faster Regexp-related methods like #gsub or iterating over a collection.
See Also
You didn't provide your actual input or calling code, but in newer Ruby versions (including 3.1.2) there are some other related methods (some with bang methods, which are both useful and faster if you aren't using frozen strings) that may also help:

*

*String#delete_prefix

*String#delete_suffix

*String#downcase

*String#swapcase


text:
Q: How to use std::copy() to copy to a destination that is pointer to the beginning of a generic buffer of bytes? In this example, let's say myVector is a std::vector of some custom type myType.
unsigned char* bufferPtr = myBufferOfBytes.getBufferPointer();
std::copy(myVector.begin(), myVector.end(), bufferPtr);

Is this possible to do somehow, or can I only do this using std::memcpy()?

A: You can use uninitialized_copy and cast the bufferPtr to the expected type:
std::uninitialized_copy(myVector.begin(), myVector.end(), reinterpret_cast<myType*>(bufferPtr));

The usual warnings apply:

*

*make sure that bufferPtr is long enough for the entire copy;

*bufferPtr must originally have been allocated as an array of unsigned char, or else you may invoke undefined behavior (use std::copy if the array was originally allocated as myType);

*bufferPtr's alignment must be greater or equal to alignof(myType);

*if myType is not trivially destructible, then bufferPtr must be deallocated in a way that is aware of it.


text:
Q: Function of require in angularjs I have seen this require in custom directive.
require: '^create'

I can't understand this. Can you explain me require in angularjs?

A: require

*

*The require takes a string name (or array of strings) of the directive(s) to pass in.

*If an array is used, the injected argument will be an array in corresponding order.

*If no such directive can be found, or if the directive does not have a controller, then an error is raised (unless no link function is specified, in which case error checking is skipped).

*The name can be prefixed with:
(no prefix) - Locate the required controller on the current element. Throw an error if not found.
? - Attempt to locate the required controller or pass null to the link fn if not found.
^ - Locate the required controller by searching the element and its parents. Throw an error if not found.
^^ - Locate the required controller by searching the element's parents. Throw an error if not found.
?^ - Attempt to locate the required controller by searching the element and its parents or pass null to the link fn if not found.
?^^ - Attempt to locate the required controller by searching the element's parents, or pass null to the link fn if not found.
Require a Controller
If you want to share the same instance of a controller, then you use require.
require ensures the presence of another directive and then includes its controller as a parameter to the link function. So if you have two directives on one element, your directive can require the presence of the other directive and gain access to its controller methods. A common use case for this is to require ngModel.
^require, with the addition of the caret, checks elements above directive in addition to the current element to try to find the other directive. This allows you to create complex components where "sub-components" can communicate with the parent component through its controller to great effect. Examples could include tabs, where each pane can communicate with the overall tabs to handle switching; an accordion set could ensure only one is open at a time; etc.
In either event, you have to use the two directives together for this to work. require is a way of communicating between components.
Check out the Guide page of directives for more info http://docs.angularjs.org/guide/directive


text:
Q: Decorator isn't returning the object to the class methods in Python So I'm trying to return a object from a decorator to a method of my class. Basically I'm doing an API that use a decorator method:
    def token_required(f):
        @wraps(f)
        def decorated(*args, **kwargs):
            token = None

            if 'x-access-token' in request.headers:
                token = request.headers['x-access-token']

            if not token:
                return jsonify({'message' : 'Token is missing!'}), 401

            try:
                data = jwt.decode(token, app.config['SECRET_KEY'])
                current_usuario = Usuarios.query.filter_by(usuarioid = data['usuarioid']).first()
            except:
                return jsonify({'message' : 'Token is invalid!'}), 401

            return f(current_usuario, *args, **kwargs)

        return decorated

The problem is that I need to get the current_usuario back at my methods of the UsuariosView class, this is what I'm trying right now:
    class UsuariosView(MethodView):

        @token_required
        def get(self, current_usuario, usuario_id = None):

            if not current_usuario.admin:
                return ({'message' : 'Not admin!'})
            #do stuff

I'm not getting the current_usuario back, so I can't access the attribute admin of him and get the following error:
AttributeError: 'UsuariosView' object has no attribute 'admin'

A: I will split this up into, 1) why your code fails, 2) a terrible hack solution that should solve your immediate problem and why it will create future problems, 3) a different approach that splits up responsibilities but might not work as I don't know the specifics of your design.
1 - as it is, your decorator gets a value for current_usuario and binds it to the first argument of the method you call. When the method is called, all the other arguments get assigned afterwards.  Here's a clearer example of what's going on.
from functools import wraps

def assign_first(func):
    @wraps(func)
    def wrapper(*args, **kwargs):
        # do stuff
        first_argument = 10
        return func(first_argument, *args, **kwargs)

    return wrapper

class MyClass(object):
    @assign_first
    def first_method(self, first, second):
        print(f"self: {self}")
        print(f"first: {first}")
        print(f"second: {second}")

output:
>>> MyClass().first_method(100)
self: 10
first: <__main__.MyClass object at 0x7fdbdebd3400>
second: 100

The decorator binds 10 to the first argument of the method (which is self) and so the instance (which should be bound to self) now gets bound to the second argument (called first). You are getting that error message because your UserView object is getting bound to current_usuario, and does not have an admin attribute.
2) in your case, you could do the very buggy idea of having your wrapper bind to a keyword argument.  But then you would need all decorated methods to know that they need that specific keyword argument and to only use keyword arguments.
def assign_my_kwarg(func):
    @wraps(func)
    def new_func(*args, **kwargs):
        # do stuff
        return func(*args, my_kwarg=3, **kwargs)
    return new_func

class MyClass(object):
    @assign_my_kwarg
    def second_method(self, *, my_kwarg, second=1):  # a function that only takes keyword arguments
        print(f"self: {self}")
        print(f"my_kwarg: {my_kwarg}")
        print(f"second: {second}")

running:
>>> MyClass().second_method(second=5)
self: <__main__.MyClass object at 0x7f679eccd400>
my_kwarg: 3
second: 5

So you could do the same thing with your token_required, returning return f(*args, current_usuario=current_usuario, **kwargs) and change your method signature to: def get(self, *, current_usuario, usuario_id = None):. But it would be super fragile and very confusing.  Anyone who calls the method and puts in current_usuario will cause an error because it is already assigned.  Any mis-spelling of the keyword will cause errors.  Changing the name of the keyword will cause endless headaches.
3) The real issue is that token_required is both checking tokens and getting the current user.  You can side-step this by having a function to get current user that raises custom token errors and then a decorator to handle those errors.
from functools import wraps

class BadTokenError(ValueError):
    pass

class MissingTokenError(ValueError):
    pass

def get_current_user():
    token = get_token()
    try:
        data = jwt.decode(token, app.config['SECRET_KEY'])
        return Usuarios.query.filter_by(usuarioid=data['usuarioid']).first()
    except (SPECIFIC_ERROR, OTHER_SPECIFIC_ERROR):  # do not catch MissingTokenError
        msg = 'bad token'
        raise BadTokenError(msg)

def get_token():
    try:
        token_name = 'x-access-token'
        return request.headers[token_name]
    except KeyError:
        msg = 'missing token'
        raise MissingTokenError(msg)

def catch_token_errors(func):
    @wraps(func)
    def func_with_handler(*args, **kwargs):
        try:
            return func(*args, **kwargs)
        except (BadTokenError, MissingTokenError) as error:
            return jsonify({'message': error.args[0]}), 401
    return func_with_handler

class UsuariosView(MethodView):

    @catch_token_errors
    def get(self, usuario_id=None):
        current_usuario = get_current_user()
        if not current_usuario.admin:
            return ({'message': 'Not admin!'})

This splits up responsibilities a little more, but may not work for what you need.


text:
Q: Delete MongoDB database from Bash script I'm not a Bash/Linux person, but I've been asked to just come up with the lines needed to run to authenticate against a database and then drop it.  Here is what I have so far and I'm not sure if it's correct:
mongo mydatabase –port –username <username> –password <password> –authenticationDatabase admin –eval " printjson(db.dropDatabase())"

If it's possible to use one line to delete any database whose name starts with "cpt_" then that would be absolutely ideal.
Thanks!

A: You can use -

*

*Get all the names

*Loop and check if the name starts with cpt_

*drop the database

db.getMongo().getDBNames().forEach(function(dbName){ if (dbName.startsWith('cpt_')) printjson(db.getSiblingDB(dbName).dropDatabase())

Full
mongo –port –username <username> –password <password> –authenticationDatabase admin --eval "db.getMongo().getDBNames().forEach(function(dbName){ if (dbName.startsWith('cpt_')) printjson(db.getSiblingDB(dbName).dropDatabase())  })"


text:
Q: Range Slider Labels are not showing (marks)     data = [[30, 100], [31, 200], [32, 80], [33, 90], [34, 25], [35, 125],[36, 130],[37, 159],
           [38, 60]]
    df = pd.DataFrame(data, columns = ['week', 'orders'])

    html.Div([
    html.H3('Week Range'),
    dcc.RangeSlider(
        id='slider',
        min=df["week"].min(),
        max=df["week"].max(),
        value=[30, 38],
        step=None,
        marks={int(i):int(i) for i in list(df["week"].unique())}
    )])

After a lot of search i could not find why this RangeSlider labels are not showing, check the attached image we will find that the two ends of the slider have 3 and 8 which i think that this is the left number of the first week = 30 "3" and the last number of the last week = 38 "8"

A:     data = [[30, 100], [31, 200], [32, 80], [33, 90], [34, 25], [35, 125],[36, 130],[37, 159],
       [38, 60]]
df = pd.DataFrame(data, columns = ['week', 'orders'])

html.Div([
html.H3('Week Range'),
dcc.RangeSlider(
    id='slider',
    min=df["week"].min(),
    max=df["week"].max(),
    value=[30, 38],
    step=None,
    marks={int(i):str(i) for i in list(df["week"].unique())}
)]),html.Br(),

the problem that the second graph div was just below the RangeSlider which made the almost the display label area not showing so a break line will 100% solve the issue


text:
Q: Platform specific cut paste mnemonics swing. I'm developing my own text-like JComponent.  It isn't a subclass of JTextComponent, because it isn't using a Document as the model.  I'd still like to support the standard mnemonics of cut/copy/paste, but I know that the keystrokes depend on the platform.
Ultimately, I'll let the user edit the keybindings themselves, but for now, I'd like to at least default to something that is sensible.
Is it possible to get it from the LookAndFeel somehow? Or do I need to detect the platform myself and just have a mapping per platform?
I'm using Java 8 if that makes a difference.

A: There is no LAF property that I'm aware of for this purpose.
However you might be able to use the information from the InputMap of the LAF.
The following works for Windows 8:
import java.awt.*;
import javax.swing.*;

public class PlatformMnemonics
{
    public static void main(String[] args)
    {
        KeyStroke copyKeyStroke = null;
        KeyStroke cutKeyStroke = null;
        KeyStroke pasteKeyStroke = null;

        InputMap im = (InputMap) UIManager.get("TextField.focusInputMap");

        for (KeyStroke keyStroke: im.keys())
        {
            boolean upperCase = Character.isUpperCase( keyStroke.getKeyCode() );

            if ( upperCase )
            {
                String actionMapKey = im.get( keyStroke ).toString();

                if ("copy-to-clipboard".equals(actionMapKey))
                    copyKeyStroke = keyStroke;
                else if ("cut-to-clipboard".equals(actionMapKey))
                    cutKeyStroke = keyStroke;
                else if ("paste-from-clipboard".equals(actionMapKey))
                    pasteKeyStroke = keyStroke;

            }
        }

        System.out.println("Copy  KeyStroke: " + copyKeyStroke);
        System.out.println("Cut   KeyStroke: " + cutKeyStroke);
        System.out.println("Paste KeyStroke: " + pasteKeyStroke);
    }
}

Note there are actually 3 bindings on Windows for each Action as you can see in the Key Bindings programs that displays all the key bindings for every Swing component. I just displayed the binding I think you are interested in.

A: So, the closest I found to do what I want is the OS X Integration for Java page from Apple.  There is a method on the Toolkit class getMenuShortcutKeyMask(), which will help support what I want.
For example, the following will get the right keystroke for "meta-v" on mac, and "ctrl-v" on windows/linux.
KeyStroke.getKeyStroke(KeyEvent.VK_V,
    Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())


text:
Q: Which shortcut in Zsh does the same as Ctrl-U in Bash? In Bash, when I am typing a command, I press Ctrl+U, all characters from the beginning of the line to the cursor are going to be removed. However, in zsh, if I pressed Ctrl+U, the whole line is gone.
How to do the same in Zsh as in Bash?

A: It sounds like you'd like for Ctrl+U to be bound to backward-kill-line rather than kill-whole-line, so add this to your .zshrc:
bindkey \^U backward-kill-line

The bindkey builtin and the available editing commands ("widgets") are documented in the zshzle man page.


text:
Q: How to Create a JSON Object and Array of Objects? I am wanting to get data from a phone (geoLocation data) and put that into a JSON Object and send that over a network to a database to be stored. I am unsure how to create this object and if it should be an array of objects. Also, how do I setup the object to receive new information as it updates to send to the server? Here is the code I currently have. I am using eclipse, phonegap, javascript and JSON.
var JSONID = 0;

    // Create a JSON Object Array
    geoLocJSON ();

    /* This is what I want my Object to look like.
    [
        {
        "id" : 0,
        "geoLoc" : {
                        "Lat" : "",
                        "Long" : ""
                    },
        "direction" : {
                        "Alt" : "",
                        "Head" : "",
                        "Speed" : ""
                       },
        "Time" : ""
        };
    ]
    */

// onSuccess Geolocation
    function onSuccess(position){
        // Testing for data
        var element = document.getElementById('geolocation');
        element.innerHTML =
        'Latitude: ' + position.coords.latitude + '
' +
        'Longitude: ' + position.coords.longitude + '
' +
        'Altitude: ' + position.coords.altitude + '
' +
        'Heading: ' + position.coords.heading + '
' +
        'Speed: ' + position.coords.speed + '
' +
        'Timestamp: ' + new Date(position.timestamp) + '
' +
        '
' + element.innerHTML;

        // Puts into JSON Object
        geoLocJSON.id = JSONID;
        geoLocJSON.geoLoc.Lat = position.coords.latitude;
        geoLocJSON.geoLoc.Long = position.coords.longitude;
        geoLocJSON.direction.Alt = position.coords.altitude;
        geoLocJSON.direction.Head = position.coords.heading;
        geoLocJSON.direction.Speed = position.coords.speed;
        geoLocJSON.Time = new Date(position.timestamp);

        // Increments the JSONID
        JSONID++;
    }

This will then be posted to the server after 1 minute of collecting data and the JSON Object will be erased UNLESS the POST is unsuccessful, then the object will be stored locally to the device and posted later when a network is available again.
Thank you for your help.

A: var JSONID = 0;

// Create a JSON Object Array
var geoLocJSON = new Array();

/* This is what I want my Object to look like.
[
    {
    "id" : 0,
    "geoLoc" : {
                    "Lat" : "",
                    "Long" : ""
                },
    "direction" : {
                    "Alt" : "",
                    "Head" : "",
                    "Speed" : ""
                   },
    "Time" : ""
    };
]
*/

// onSuccess Geolocation
function onSuccess(position){
    // Testing for data
    var element = document.getElementById('geolocation');
    element.innerHTML =
    'Latitude: ' + position.coords.latitude + '
' +
    'Longitude: ' + position.coords.longitude + '
' +
    'Altitude: ' + position.coords.altitude + '
' +
    'Heading: ' + position.coords.heading + '
' +
    'Speed: ' + position.coords.speed + '
' +
    'Timestamp: ' + new Date(position.timestamp) + '
' +
    '
' + element.innerHTML;

    var myJSON = {
        "id":JSONID,
        "geoLoc":{
            "Lat":position.coords.latitude,
            "Long":position.coords.longitude
        },
        "direction":{
            "Alt":position.coords.altitude,
            "Head":position.coords.heading,
            "Speed":position.coords.speed
        },
        "Time":new Date(position.timestamp
    };

    // Increments the JSONID
    JSONID++;
    geoLocJSON.push(myJSON);
}


text:
Q: MySQL table access analogy correct? I am designing a database and certain parts of the system that will sit on top of it is the concept of being able to create notes for certain things.
E.g. I have a database of customers and users can create notes for these customers.
There are two styles I can do to achieve this.
The first is to create a notes table and notes type table. All notes for anything i.e. customers, suppliers, invoices etc etc are stored here but differentiated by a typeId which references a type in "notes_type_table".
Alternatively, I could split out all the notes for different parts of my system. i.e. "customer_notes", "supplier_notes" and "invoice_notes".
Similarly to if you wanted to shop for shoes, going to a big superstore that sells shoes and many other things would slow you down due to more traffic (people, queuing etc). Whereas going to a shop that only sells shoes should result in a faster and more efficient process of buying shoes.
Would splitting out note tables for separate parts of my system be better performance wise?

A: I would go for splitting the information into several tables:

*

*easier to maintain the database structure

*more simple queries

*good when you have a lot of data and your queries are more "note type-oriented".


text:
Q: Updated from 16.04 to 18.04 and having issues booting I just updated from 16.04 to 18.04. Upon restarting I ended up at what appears to be the terminal. I was prompted for my login and password and got links to documentation, management, and support, as well as a little message about meltdown and spectre. Below that is:
[80.133769] Could not find key with description: [alphanumericstring]
[80.133922] could not find valid key in user session keyring for sig specified in mount option[samestringasabove]
[80.134129] Error parsing options; rc = [-2]

What is happening here and how do I get to my desktop? I am unsure if that key string should remain private so I left it out.

A: I had the same problem after upgrading to 18.04.  The computer would boot into text terminal, and I could start the X Session with startx.  I could resolve the problem with:
sudo apt-get install --reinstall gdm3

It seems this is a problem with the display manager and not necessarily linked to the ecryptfs bug.  I think I was using lightdm before the update which is not the default.

A: I faced with this problem when activated Timeshift snaphots schedule (tool for making system backup and recovery). Backup's stole all free disk space, and after executing
sudo rm -rf /timeshift/snapshots

the GUI booted automatically.

A: You are hitting this bug:
https://bugs.launchpad.net/ubuntu/+source/ecryptfs-utils/+bug/1718658
I have the same problem and I haven't found a way to fix it.
There are a few workarounds mentioned in the report but none of them worked for me.
Keep reading for what did work to get my system working again:
There is a chance that this is not really your problem. In my local instance this seemed to be an issue with the graphics drivers, as (after installing SDDM from the command line) I was seeing the mouse cursor, but I didn't see the log-in screen. I ended up in this question because the message you posted was the only error message I saw. However, if you look into /var/log/X11.0.log you will see that it fails to load libGL.so.1, and it tries to use Vesa. While digging into the issue I discovered that libglx-mesa0 libgl1-mesa-dri and some other packages were corrupted and had missing configurations and files
What I did to fix this:
I purged all xorg, xserver*, lightdm, gdm3, sddm, libglx*, libgl0, libgl1 and everything I could find related to the UI. Specifically around libGL.so.1 (apt-file find libGL.so.1) and then installed it again using apt.
Of course I ended up removing most of my system and restarted to install all packages from the ground, but at some point in this mess, I reinstalled libgl1-mesa-dri (+dependencies), sddm and kde-plasma-desktop, and I was finally able to boot into my system again. I understand this answer is quite chaotic, but this is what worked for me, and the real reason behind my issues was not related to the error message you are seeing, but to a broken mesa installation. This may be your case too.
As a side note I would like to warn you that at some point I stopped seeing errors about libGL.so.1 in my X logs, but it kept refusing to load the drivers anyway, (and SDDM didn't show the log-in screen either!). So I kept removing and reinstalling packages around mesa and libgl* until my installation started working again.
Good luck!


text:
Q: Nginx - Rewrite URL containing amp/ to remove amp/ from the end I am using wordpress and installed an AMP plugin last week. After playing with it for a bit, I decided to remove it until Google makes AMP prominent for non news sites as well.
In the time it was installed, some of my AMP pages got shared on social media and now visitors come to my site to AMP URLs. They see the original page but the URL stays and gets shown in Google Analytics as a separate page from the non AMP version.
I think they're also hitting my server directly instead of cache and it's putting a heavy load on my server.
My AMP URLs look like:
www.mysite.com/category/this-is-my-post/amp/
I'm not well versed in nginx rewrites and don't understand the syntax properly.
How do I get that example URL to just be:
www.mysite.com/category/this-is-my-post/
This is the nginx rewrite code I have so far and it's not doing anything at all. What am I doing wrong here?
location /amp {
    rewrite ^/amp(/.*)$ $1 last;
}

and I also tried this:
rewrite ^/amp/(.*)$ http://www.myserver.com/$1 last;

These solutions seem to take /amp/ out of the URL if it's somewhere in the middle, not at the end. When amp is at the end it refuses to get redirected.
Also, if there are GET parameters (for tracking or anything else), I'd like them to stay and not be re-written.
Thank you!

A: You need to remove the amp/ sequence from the end of the URL.
rewrite ^(.*/)amp/$ $1 permanent;


text:
Q: Where to decide what item should be evicted from cache? When size of the cache reaches the capacity, should the function, that decides what should be evicted, be located in cache class or it should be passed as argument to the cache class in it's initialization?

A: Good question. If you apply the single responsibility principle , it makes sense to inject the eviction logic in. So the cache object is responsible for caching and the injected eviction function/class is responsible for the eviction logic. This way you can reuse your cache with multiple eviction strategies.


text:
Q: How to view aspect affected Java classes in IntelliJ IDEA 12? Is there some way to see the aspect affected (advised) Java methods in IntelliJ IDEA?
Like XRef in Eclipse?

Edited:
@Xiujun_Ma showed the feature exists, but I don't know what is not working.
I'm using the libs and the facets on the project.
Libs:

Facets:

A: In your aspect class you will see like this:

click the ball after line number (navigate to advised methods),
then, you will see aspect affected methods.

A: Yes, it is shown as you can see from @XiujunMa answer. It also works in 11.1.3. Used to navigate to the transaction affected methods in Spring.

To be able to use the AspectJ support in IntelliJ IDEA, you have to
  make sure that the following plugins are enabled:
Spring-AOP and @AspectJ Support.
AspectJ Support.

In addition to that, you should also create a library for
  aspectjrt.jar.

You probably need to use <aop:config> in the spring configuration to define <aop:pointcut. Then use <aop:advisor to map that pointcut and advice reference. You could also put the <aop:aspect there.


text:
Q: Ошибка при запуске tomcat приложения на VPS Написал небольшое приложение на Java (Spring MVC) которое запускаю с помощью Tomcat из Intellij IDEA. Получил VPS сервер (Ubuntu 14.04), установил на нем томкат (страница Tomcat Web Application Manager работает), залил проект в директорию /var/lib/tomcat7/webapps/ и в менеджере томката появился url моего приложения
но когда перехожу на этот url получаю

HTTP Status 404 - /YaPokupay/
description The requested resource is not available.

Локально на localhost все нормально запускалось.
Если необходима дополнительная информация по теме - с радостью предоставлю.
На всякий случай web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

    <filter>
        <filter-name>encoding-filter</filter-name>
        <filter-class>
            org.springframework.web.filter.CharacterEncodingFilter
        </filter-class>
        <init-param>
            <param-name>encoding</param-name>
            <param-value>UTF-8</param-value>
        </init-param>
        <init-param>
            <param-name>forceEncoding</param-name>
            <param-value>true</param-value>
        </init-param>
    </filter>

    <filter-mapping>
        <filter-name>encoding-filter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/appconfig-root.xml</param-value>
    </context-param>

    <!--Security-->
    <filter>
        <filter-name>springSecurityFilterChain</filter-name>
        <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>springSecurityFilterChain</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <servlet-mapping>
        <servlet-name>appServlet</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>

    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

     Processes application requests
    <servlet>
        <servlet-name>appServlet</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/appconfig-mvc.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

</web-app>

РЕДАКТИРОВАНО:
/var/log/tomcat7/catalina.log
Dec 20, 2016 2:24:04 PM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-bio-8080"]
Dec 20, 2016 2:24:05 PM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Catalina
Dec 20, 2016 2:24:05 PM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["http-bio-8080"]
Dec 20, 2016 2:24:05 PM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["http-bio-8080"]
Dec 20, 2016 2:24:06 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/common/classes], exists: [false], isDirectory: [false], canRead: [false]
Dec 20, 2016 2:24:06 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/common], exists: [false], isDirectory: [false], canRead: [false]
Dec 20, 2016 2:24:06 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/server/classes], exists: [false], isDirectory: [false], canRead: [false]
Dec 20, 2016 2:24:06 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/server], exists: [false], isDirectory: [false], canRead: [false]
Dec 20, 2016 2:24:06 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/shared/classes], exists: [false], isDirectory: [false], canRead: [false]
Dec 20, 2016 2:24:06 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/shared], exists: [false], isDirectory: [false], canRead: [false]
Dec 20, 2016 2:24:06 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Dec 20, 2016 2:24:06 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 490 ms
Dec 20, 2016 2:24:06 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Dec 20, 2016 2:24:06 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.52 (Ubuntu)
Dec 20, 2016 2:24:06 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor /etc/tomcat7/Catalina/localhost/host-manager.xml
Dec 20, 2016 2:24:07 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor /etc/tomcat7/Catalina/localhost/docs.xml
Dec 20, 2016 2:24:07 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor /etc/tomcat7/Catalina/localhost/manager.xml
Dec 20, 2016 2:24:07 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /var/lib/tomcat7/webapps/YaPokupay
Dec 20, 2016 2:24:07 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /var/lib/tomcat7/webapps/ROOT
Dec 20, 2016 2:24:08 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Dec 20, 2016 2:24:08 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1228 ms
Dec 20, 2016 2:24:27 PM org.apache.catalina.core.StandardContext reload
INFO: Reloading Context with name [/YaPokupay] has started
Dec 20, 2016 2:24:27 PM org.apache.catalina.core.StandardContext reload
INFO: Reloading Context with name [/YaPokupay] is completed

/var/log/tomcat7/localhost 2016-12-20.log
Dec 20, 2016 2:24:15 PM org.apache.catalina.core.ApplicationContext log
INFO: HTMLManager: init: Associated with Deployer 'Catalina:type=Deployer,host=localhost'
Dec 20, 2016 2:24:15 PM org.apache.catalina.core.ApplicationContext log
INFO: HTMLManager: init: Global resources are available
Dec 20, 2016 2:24:15 PM org.apache.catalina.core.ApplicationContext log
INFO: HTMLManager: list: Listing contexts for virtual host 'localhost'
Dec 20, 2016 2:24:23 PM org.apache.catalina.core.ApplicationContext log
INFO: HTMLManager: list: Listing contexts for virtual host 'localhost'
Dec 20, 2016 2:24:27 PM org.apache.catalina.core.ApplicationContext log
INFO: HTMLManager: restart: Reloading web application '/YaPokupay'
Dec 20, 2016 2:24:27 PM org.apache.catalina.core.ApplicationContext log
INFO: HTMLManager: list: Listing contexts for virtual host 'localhost'

pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.ya.pokupay</groupId>
    <artifactId>YaPokupay</artifactId>
    <name>YaPokupay</name>
    <packaging>war</packaging>
    <version>1.0.0-BUILD-SNAPSHOT</version>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java-version>1.8</java-version>
        <org.springframework-version>4.0.3.RELEASE</org.springframework-version>
        <org.spring-data-version>1.8.2.RELEASE</org.spring-data-version>
        <org.aspectj-version>1.7.4</org.aspectj-version>
        <hibernate.version>4.3.5.Final</hibernate.version>
        <jackson.version>2.5.3</jackson.version>
        <logback.version>1.1.3</logback.version>
        <javax.mail-version>1.4.7</javax.mail-version>
        <velocity-version>1.7</velocity-version>
    </properties>
    <dependencies>

        <dependency>
            <groupId>org.apache.directory.studio</groupId>
            <artifactId>org.apache.commons.io</artifactId>
            <version>2.4</version>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.9</version>
        </dependency>

        <!-- Spring -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>

        <!--Mail-->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context-support</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>

        <!-- Spring MVC Mail Related Dependency -->
        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
            <version>${javax.mail-version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.velocity</groupId>
            <artifactId>velocity</artifactId>
            <version>${velocity-version}</version>
        </dependency>

        <!-- Spring ORM -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>

        <!--Spring Security-->
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>

        <!-- Hibernate -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>${hibernate.version}</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>${hibernate.version}</version>
        </dependency>

        <!--Hibernate Search-->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-search-orm</artifactId>
            <version>5.0.0.Final</version>
            <!--<version>5.5.5.Final</version>-->
        </dependency>

        <!-- Apache Commons DBCP -->
        <dependency>
            <groupId>commons-dbcp</groupId>
            <artifactId>commons-dbcp</artifactId>
            <version>1.4</version>
        </dependency>

        <!-- AspectJ -->
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjrt</artifactId>
            <version>${org.aspectj-version}</version>
        </dependency>

        <!-- @Inject -->
        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
            <version>1</version>
        </dependency>

        <!-- Servlet -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>

        <!--Data JPA-->
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-jpa</artifactId>
            <version>${org.spring-data-version}</version>
        </dependency>

        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>${logback.version}</version>
        </dependency>

        <!--Jackson-->
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <version>${jackson.version}</version>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>${jackson.version}</version>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>${jackson.version}</version>
        </dependency>

        <!--File Upload-->
        <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
            <version>1.3.1</version> <!-- make sure correct version here -->
        </dependency>

        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.5</version>
        </dependency>
        <dependency>
            <groupId>com.github.jsimone</groupId>
            <artifactId>webapp-runner</artifactId>
            <version>8.5.5.0</version>
        </dependency>

    </dependencies>
    <build>
        <plugins>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.5.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <compilerArgument>-Xlint:all</compilerArgument>
                    <showWarnings>true</showWarnings>
                    <showDeprecation>true</showDeprecation>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.2.1</version>
                <configuration>
                    <mainClass>org.test.int1.Main</mainClass>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
                <version>2.2</version>
                <!--<configuration>-->
                    <!--<url>http://localhost:8080/manager/text</url>-->
                    <!--<server>YaPokupay</server>-->
                    <!--<path>/</path>-->
                <!--</configuration>-->
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>appassembler-maven-plugin</artifactId>
                <version>1.1.1</version>
                <configuration>
                    <assembleDirectory>target</assembleDirectory>
                    <programs>
                        <program>
                            <mainClass>com/ya/pokupay/MainController</mainClass>
                            <name>webapp</name>
                        </program>
                    </programs>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>assemble</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <finalName>${project.artifactId}</finalName>
    </build>
</project>

Структура:

facets->web in IDEA:

deployment:

artifact:

A: Проблема оказалась в несоответствии версий java на VPS и локальной машине. Для решения необходимо произвести следующие действия:

*

*удалить java на ПК и на сервере

*скачать последнюю версию jdk с  официального сайта

*установить эту версию на ПК и на сервере (инструкции есть в интернете, например здесь)

*далее в файле /etc/init.d/tomcat7 в строчке c JDK_DIRS указываем путь к ранее установленной jdk, у меня установлена здесь: JDK_DIRS="/opt/jdk/jdk1.8.0_112"

*перезапускаем томкат

*радуемся


text:
Q: Python sort list by regular expression I have a list of strings looking like this:
['dsafjhsafjkhefhajwejh;NR;123;dfgdsrhgjhdfgjhdsfjhg','jhfewrgjhdfjhgsufgssdfjgh;NR;3243;fgjdsgfjsdfkjgdf', ...]

This list should be sorted by the numbers in between the ";", the numbers always come after ";NR;", but not every string contains a number. I've already tried hundreds of solutions and none seems to work.
Please help me
EDIT:
Sorry I didn't add some examples, so here they are:
1.
a = sorted(a, key=lambda x: x.split("NR;")[-1].split[";"][0])

*

*for item in a:
b.append(re.search("(;NR;[0-9]*;)", str(item)))
Basically I tried the above and some variations above, I can't exactly remember all the code I tried.

A: In [1]: a = ['jhfewrgjhdfjhgsufgssdfjgh;NR;3243;fgjdsgfjsdfkjgdf', 'dsafjhsafjkhefhajwejh;NR;123;dfgdsrhgjhdfgjhdsfjhg']

In [2]: a.sort(key=lambda x: x.split(';')[2])

In [3]: a
Out[3]:
['dsafjhsafjkhefhajwejh;NR;123;dfgdsrhgjhdfgjhdsfjhg',
 'jhfewrgjhdfjhgsufgssdfjgh;NR;3243;fgjdsgfjsdfkjgdf']

As pointed out by @EMS below it is possible to split on NR; and use the first part of that if there is always a NR; present.
a.sort(key=lambda x: int(x.split("NR;")[-1].split(";")[0]))

This sorts the list in order. If you wanted to create a copy of your list (to assign it a new variable) you can use sorted
b = sorted(a, key=lambda x: int(x.split("NR;")[-1].split(";")[0]))

End-to-end:
# Includes an entry without the `;NR;`
In [1]:     a = ['jhfewrgjhdfjhgsufgssdfjgh;NR;3243;fgjdsgfjsdfkjgdf', 'dsafjhsafjkhefhajwejh;NR;123;dfgdsrhgjhdfgjhdsfjhg', 'jhfewrgjhdfjhgsufgssdfjgh;fgjdsgfjsdfkjgdf']

# Remove any entry that doesn't have `;NR;` in it
In [2]:     a = filter(lambda x: ';NR;' in x, a)

# Sort with an integer version of the number found (rather than the string)
In [3]:     a.sort(key=lambda x: int(x.split("NR;")[-1].split(";")[0]))

In [4]: a
Out[4]:
['dsafjhsafjkhefhajwejh;NR;123;dfgdsrhgjhdfgjhdsfjhg',
 'jhfewrgjhdfjhgsufgssdfjgh;NR;3243;fgjdsgfjsdfkjgdf']

A: Sorting a list always accept a 'key' argument and you can pass an arbitrary function as key. In your case, the function should do these:

*

*Find the part of the string after "NR;"

*Find the initial part of THAT part, that comes before ";" and parse it as an integer.

Here is one method to do this
def func(st): # I am using your first string as a running example in this code
    nr_part = st.split("NR;")[1]  # returns "3243;fgjdsgfjsdfkjgdf"
    int_part = nr_part.split(";")[0] # returns "3243"
    return int(int_part)

Now, you can separate out strings cointaining "NR;" by using filter.
aa = filter(a, lambda x: "NR;" in x)

Finally, sorting the resulting list is simple
aa = ['jhfewrgjhdfjhgsufgssdfjgh;NR;3243;fgjdsgfjsdfkjgdf', 'dsafjhsafjkhefhajwejh;NR;123;dfgdsrhgjhdfgjhdsfjhg']
a.sort(a, key=func)  # in place sorting

Or
sorted(a, key=func)  # Return a new sorted list

A few caveats: You must ensure that your assumptions of "NR;<int>" regex should be satisfied by all strings in the list and int part of the string should not be large enough so that 'int()' casting does not result in overflow.


text:
Q: How to get back to the same game after quitting races I've just started playing GTA 5 Online with a few friends, and am having trouble getting all of us into the same game after completing a few races.
Normally, we setup the online game via Invite Only. We do this so if we have friends that the others don't, we can just invite them in.
After doing a few races, we get back to the voting screen and choose the option to Quit. When we do that, it throws us each in different game sessions. So we all have to get back into the same together again by doing invites. How can we just get back into the same game after doing missions, races, etc... without having to rejoin?

A: If you and your friends in the voting screen all click on 'freemode' you all should I get in the same session.

A: I'm not sure exactly but my guess is when everyone is on the voting screen, make everyone click the free mode option and it should place all players in the same lobby.


text:
Q: toolstripbutton with images for each state I have in my app a ToolSrip with some ToolStripButtons.
I wish add not only the basic image, but an image for the hover state and another for the clicked state, and if possible, remove the orange background when the button is hovered by the mouse...
it's possible?
thanks in advance!

A: If you look at the events of the button you can see various events including. This isnt working code its just a sample from my head but look at the link.
private void Button1_OnMouseHover
{
   BackGroundImage = "test.png";
}

http://msdn.microsoft.com/en-us/library/system.windows.forms.toolstripbutton.aspx


text:
Q: CSS: resizing logo while maintaining aspect with browser #logo {
    background: url(/images/logo.png) 0 0 no-repeat;
    width: 268px;
    height: 96px;
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 1000;
}

This is my logo css and when I change the height and width to x% It just cuts of the bottom and right side of my logo image. How can I style my logo so that it stays at 5% of the browser width  while maintaining aspect? Thanks

A: Your image has to be an <img> tag, not a background, and the CSS of this <img> tag :
#logo_img{
    width:5%;
}

assuming the parent of #logo_img is 100% in width.

A: By using the <img> element for images, of course.

A: It is possible in a background image. See this demo at CSSplay. Ethan Marcotte has also detailed techniques that may fit your application.


text:
Q: How to give notification for apk update for angular PWA I have been searching for a solution which I am not able to find yet. I have a PWA app and I am creating apk of it. I know about swupdate feature in angular PWA service worker. But that will only notify if there is some changes in hosted server.
How I can notify user when we have new update in apk to PWA Angular app ?


text:
Q: FireFox versus FireFox Developer This url works fine in FireFox (Latest Version) but does not in FireFox Developer (Latest Version):
http://domain.site.org/JavaScriptSite/ggov.html?city=Minnetonka&dept=Police&extent=[-93.45,44.93]
FF Dev did not like the JSON.parse([-93.45,44.93]).
What does everyone do when it works on one browser but not another?  Ugh!
Is there a proper way to fix this? Any sites or docs talk about this? Suggestions?

A: JSON.parse([-93.45,44.93]) is invalid. parse takes a string argument, not an array.
 Your code should be JSON.parse("[-93.45,44.93]") if anything.
This is not related to browser choice though..


text:
Q: Wordpress updating Script n Styles Extension Script does not work Thanks in advance for any help provided guys.
I have a wordpress Script n styles extension on my wordpress, the previous developer added it.
However I noticed that when I update my script in "Script n Styles", that does not change anything.
Without cache, with cache, refreshing as many times as you want, switching navigators it does not update the script stays the same.
Just take a look:
Script n Styles extension's script here
Script displayed on the page whatever I do in script n style extension
Do you have any ideas where that could come from ? I can send the link of that website if you want! Its afh.asso.fr (the home page only uses that bit of code (its for the "mon afh" little red button on the home page)
Thanks in advance for your help guys, it is really appreciated ! :)

A: add_action('wp_enqueue_scripts', 'theme_enqueue_styles');

function theme_enqueue_styles() {

    // Get the theme data
    $the_theme = wp_get_theme();

   // Add custom style here in custom.css
    wp_enqueue_style('custom', get_stylesheet_directory_uri() . '/css/custom.css', array(), $the_theme->get('Version'));

     wp_enqueue_script('jquery');

     // add custom javascript here in custom.js
     wp_enqueue_script('main', get_stylesheet_directory_uri() . '/js/custom.js', array(), $the_theme->get('Version'), true);

}

Can find more information here:
https://developer.wordpress.org/reference/functions/wp_enqueue_script/


text:
Q: Can we say that $f_\infty(t)=g_\infty(t) \text{ a.e}$? Let $(E,\mathcal{A},\mu)$ be a finite measure space. Let $\{f_n\}$ and $\{g_n\}$  two uniformly integrable sequences such that:
$$
\qquad\forall n\geq 1~:~ f_n(t)=g_n(t)~~ \text{ a.e.}\tag1
$$
$$
\qquad f_n\underset{n}{\to} f_\infty\text{ weakly in } L^1 \tag2
$$
and for all subsequence $\{g_{n_i}\}$ of $\{g_n\}$ we have
$$
\qquad\frac{1}{m}\sum_{i=1}^{m}{g_{n_i}(t)}\underset{m}{\to} g_\infty(t) \text{ a.e.} \tag3
$$
Can we say that $f_\infty(t)=g_\infty(t) \text{ a.e}$?

A: Yes: by uniform integrability and Vitali's convergence theorem, one concludes that the pointwise a.e. convergence (3) can be upgraded to strong $L^1$ convergence, hence also weak convergence.
Moreover, (2) implies that the Cesáro mean
$$
\frac{1}{m}\sum\limits_{i=1}^mf_{n_i}\rightharpoonup f_\infty
\qquad\mbox{ weakly in }L^1
$$
(Apply the usual fact that if some real sequence converges to a finite limit then its Cesáro mean also converges to the same limit, here the real sequence is $\int f_{n_i} \phi\to \int f_\infty\phi$ for any fixed $\phi\in L^\infty$ as $i\to\infty$.)
Since $f_n=g_n$ as elements of $L^1$ the uniqueness of weak limits guarantees indeed $f_\infty=g_\infty$


text:
Q: Task Board does not show WorkItems that have the State "In Progress" We have a problem with our TFS 2013.
We are trying to set up our Taskboard. Unfortunately, the taskboard is only showing workitems with the state New, Committed, and Done. But workitems with the state In Progress aren't showing up.
Does anybody know a solution for this? Do I have to add the state In Progress somewhere in the process template?
Our process template is "Microsoft Visual Studio Scrum 2013.4" and we customized a few things in it.
Here's a screenshot of what I meant to describe:

A: There are no default "In Progress" state of the workitems created in backlog. Seems you have customize it and add this state.
If you want this workitem with "In Progress" state also shown in the task. You should also customize your backlog
<RequirementBacklog category="Microsoft.RequirementCategory" pluralName="Backlog items" singularName="Backlog item">
   <States>
      <State value="New" type="Proposed" />
      <State value="Approved" type="Proposed" />
      <State value="Committed" type="InProgress" />
      <State value="Done" type="Complete" />
   </States>
 . . .
</RequirementBacklog >

Then add  a value such as below:
 <State value="In Progress" type="InProgress" />

You may need some restart after the changing, more details please refer this link: Map WIT category workflow states to metastates


text:
Q: Bring amount into Paypal BuyNow button from session variable I have asp.net page with vb.net code behind which produces a money value (TotAmt) from various radio buttons when a calculate Button is pressed. I want to pass through value to Paypal page with Standard BuyNo Button.  I am not very experienced with Paypal.
<input type="hidden" name="cmd" value=_s-xclick"/>
<input type="hidden" name="hosted_button-id" value="XXXXXXXXXXX"/>
<input type="text" name="amount" value= "TotAmt"

Help gratefully received.

A: You would just need to dynamically populate the "amount" variable in your button code.  However, to be able to dynamically populate the amount you need to create a non hosted clear text button.  You won't be able to populate the amount into a hosted button.
To generate a non-hosted/clear text button follow these steps:

*

*Log in your PayPal account www.paypal.com

*Click the tab "Merchant Services" to access the Merchant Tools tab.

*In the Website Payment Standard section select the type of button you would like to create (Buy Now, Add to Cart, Donation, Etc…).

*Click "Create your button now" to access to the PayPal Button Factory.

*Fill out the fields you will need in your button (Item name, Price, Currency…).

*Click the tab "Step 2: Track inventory (optional)" then uncheck the box "Save button at PayPal".

*Click on "Create Button".

*The encrypted HTML code of your button will be displayed.

*Click on the link "Remove code protection"

*The HTML code of your button will be displayed, click "Select Code" and copy it to your website.

A: Create a session in code and pass amount to it, for example
session["amt"]=lable.text1;

and then in HTML use this code
<input type="hidden" name="amount" value='<?php echo $_SESSION["amt"]?>' />
<input type="hidden" name="return" value="confirm.php" />


text:
Q: How to use function to define a string in C #include <stdio.h>
#include <string.h>

void Define_string(char *str)
{
    str = "hello";
    return;
}

int main()
{
    char my_string[100] = {'\0'}

    Define_string(my_string);
    printf("%s", my_string);

    return(0);
}

I am trying to use a function to define a string, but i just keep getting null or pointer conversion errors. How would you use a function to define a string declared in the main? im not trying to input the strings value but just define it with hard code.
To try to have a nested if-else that returns different strings.

A: #include <stdio.h>
#include <string.h>

void Define_string(char *str)
{
    strcpy(str, "hello");
    return;
}

int main()
{
    char my_string[100] = {'\0'};

    Define_string(my_string);
    printf("%s", my_string);

    return(0);
}

if you use strcpy, it works.

A: if you just define string hard code. use macro.
#define Define_string(var,val) const char *var=val
Define_string(my_string,"hello");


text:
Q: div with margins & padding that needs to fill its parent I have a container div (it has both width an height set in pixels).
Is there a way to add a child div that will fill its entire parent but still have margin and or padding ?
suppose the parent div is 200px wide, and 200px high.
if I give the child div a width/height of 100% then it assumes that I mean for the content are to be of size 200px and then if I add padding or margins the size of the child becomes bigger then that of the parent.
I want the child div's content area to be what ever is left after taking out 5px margins on each side...
and please don't tell me to subtract 2*5px from 200px  - I know that but I am looking for a better solution.
could it be that css can't handle such a simple task...

A: Set all elements to have box-sizing as border-box in your stylesheet.
This will sum up the padding of all elements so you don't have to worry about any disruptions if you add any padding.
*{
   box-sizing: border-box;
}

A: You could try the following:
#outer {
  width: 200px;
  height: 200px;
  background: blue;
  position: relative;
}

.inner {
  position: absolute;
  top: 5px;
  right: 5px;
  bottom: 5px;
  left: 5px;
}

demo: http://jsfiddle.net/wYNYh/1/

A: Something like this: http://jsfiddle.net/Rnf82/ ?

A: You can set the padding of the outer div. Then the inner div will only occupy what's left.
Have a look at this: (try yourself at jsFiddle)
.outer {
 width: 200px;
 height: 200px;
 background-color: #DD0000;
 padding: 5px;
 box-sizing: border-box;
}
.inner {
 width: 100%;
 height: 100%;
 background-color: #0000DD;
}

really these two ways of doing this is equivalent as far as the question is concerned. It is important to remember the redundancy generated by how html and css standards are setup.


text:
Q: Error using SciPy: ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject I'm trying to install SciPy using a bootstrap script to use it to calculate a new field in a dataframe, running Spark on AWS EMR.
Although the SciPy website states that only NumPy is needed, when I tried to install SciPy using pip, pip kept failing, complaining about missing software, until I ended up with this bootstrap script:
sudo yum install -y python3-devel
sudo pip3 install -U Cython
sudo pip3 install -U pybind11
sudo pip3 install -U pythran
sudo pip3 install -U numpy
sudo pip3 install -U scipy

At this point, the bootstrap seems to be successful, but then at this line:
from scipy.stats import norm

I get the following error:
ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject

I tried --no-binary :all:, but that made no difference.
Any advice? Thanks!
Best, Oliver


text:
Q: I want to install ubuntu but will I be able to go back to windows? I have a new laptop and I want to install ubuntu on it, I would just like to know if there's any way I'll be able to go back to windows or run two operating systems at once.

A: You may run two operating systems(dualbooting windows and ubuntu).
https://help.ubuntu.com/community/WindowsDualBoot
Or
You can put back windows How to remove Ubuntu and put Windows back on?

A: You can:

*

*Install Windows and Ubuntu side-by-side using dual boot. Ubuntu will suggest you this on the installation Wizard.

*Install Ubuntu inside Windows using Wubi


text:
Q: Layout autoscale Windows 8 I want to make a simple layout:
This is my code:
<ScrollViewer Grid.Column="1" Grid.Row="1" HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Disabled" VerticalContentAlignment="Stretch">
    <StackPanel  Name="MainStack" Orientation="Horizontal">
        <StackPanel Width="800" Height="800" Margin="140,0,10,0" Background="#FFAC3737"/>
            <StackPanel Width="400" Height="800" Margin="0,0,10,0">
                <StackPanel Width="400" Height="395" Background="Black" HorizontalAlignment="Left" Margin="0,0,0,10" />
                <StackPanel Width="400" Height="395" Background="Black" HorizontalAlignment="Left" />
            </StackPanel>

            <StackPanel Width="400" Height="800" Margin="0,0,10,0">
                <StackPanel Width="400" Height="395" Background="Black" HorizontalAlignment="Left" Margin="0,0,0,10" />
                <StackPanel Width="400" Height="395" Background="Black" HorizontalAlignment="Left" />
            </StackPanel>

            <StackPanel  Width="400" Height="800" Margin="0,0,10,0">
                <StackPanel Width="400" Height="395" Background="#FF5686AE" HorizontalAlignment="Left" Margin="0,0,0,10" />
                <StackPanel Width="400" Height="395" Background="#FF5583AA" HorizontalAlignment="Left" />
            </StackPanel>

            <StackPanel Width="400" Height="800" Margin="0,0,10,0">
                <StackPanel Width="400" Height="395" Background="#FF5180A8" HorizontalAlignment="Left" Margin="0,0,0,10" />
                <StackPanel Width="400" Height="395" Background="#FF426E93" HorizontalAlignment="Left" />
            </StackPanel>
        </StackPanel>
    </StackPanel>
</ScrollViewer>

Now It looks like this:

What is the best way to scale this layout to all resolutions ?

A: Grid is a great control for specifying how you want to use available space. I like to use * (star) sizing and think of each * as a percentage. So, if I want two columns to each take up 50 percent of the screen, their widths would be 50* and 50* (though technically as long as they're equal numbers they'll take up equal space so 1* and 1* would do the same thing).
The problem with Grid is that it tries to use all the space you give it. So, if you design a layout on a square monitor (4:3 aspect ratio) then display it on a widescreen monitor (16:9 aspect ratio) all your squares become rectangles!
You could sort of deal with this in code by monitoring whenever the size changes and making sure that the width is always some percentage of the height. But that's an ugly fix and leaves one more challenge to contend with: font size.
Many times when you're creating a very specific layout you want it to scale perfectly to all screen sizes, including text. But just because Grid adapts to the available real estate doesn't mean that the font size will automatically scale up too. That is, unless you use ViewBox.
ViewBox is an awesome control. You can put anything inside of it with a specific width and height, and as the available space for the ViewBox increases or decreases, it automatically scales everything inside of it. ViewBox maintains the correct aspect ratio for you and automatically does font scaling too!
So, start with a Grid and give it a specified width and height, then divide the rows and columns to make it look like your image above. Start at whatever width and height you want, but I suggest 1366 x 768 because that's the lowest recommended resolution for Windows 8. Finally, wrap the Grid in a ViewBox and you're done!
<ViewBox>
   <Grid Width="1366" Height="768">
   ...
   </Grid>
</ViewBox>

Dev support, design support and more awesome goodness on the way: http://bit.ly/winappsupport

A: I think StackPanels not the best choice for complex layout. I'd use Grid with different Width/Height ratios for different columns/rows with span columns/rows when needed. Then you will have elastic layout for every resolution.


text:
Q: Why is $\max \{ | a_{i,j}| : 1 \le i \le m, 1 \le j \le n \} \le \sup \{||Ax|| : ||x|| = 1\}$? This is an inequality on the operator norm, but I cannot understand why it's true.
Why is $\max\{|a_{i,j}| : 1 \le i \le m, 1 \le j \le n\} \le \sup\{||Ax|| : ||x|| = 1\}$?
That is, why is the absolute value of the largest element of $A$ lesser than or equal to the square root of the largest eigenvalue of $A$?

A: For any $i_0$, choosing the vector $e_{i_0}$, which is admissible as its norm is $1$, the right hand side is
$$\|Ae_{i_0}\|=\sqrt{\sum_j (a_{i_0j})^2}\geq\sqrt{a_{i_0j_0}^2}=|a_{i_0j_0}|,\ \forall\ j_0$$
where the middle equality follows from the monotonicity of the square root.


text:
Q: What are ways to manage secrets in a big organisation? Many articles on the internet focus on methods to keep secrets outside public-access (like mobile apps, website frontend etc). But let's take the example of a really big organisation. It has secrets outside public-access, as recommended, but it is within any developer's reach because they have access to the backend code.
What happens if a malicious developer decides to steal the secret (say, an API key) and use it for malicious purposes? Is there a way to store secrets in such a way that a backend developer doesn't have direct access to the API Key?
A solution I thought would work is having a dedicated service that issues the secrets to VM instances, and a CI/CD mechanism for the developers to deploy backend code to production without the backend developers having access to the server. However, I am unsure about the security and drawbacks of this approach.

A: It is exactly the same as managing secrets in a small company. As soon as you have a company with more than one person in it, you need to manage secrets.
So what can you do to prevent, for instance, the API keys to leak?

*

*You audit who access what. If recently a developer requested access to an API key, and a few days later, the API key was used outside the organization, it doesn't prove that the developer is the one who caused the API key to leak, but (1) management may still want to ask a few questions to this developer, and (2) the sole fact that the access is audited may be enough to prevent the secrets to leak in the first place.

*You restrict access to the API to a range of IP addresses. So given an API key, the API can be used from your company, but not outside. Figuring out who's maliciously using the resources from one of your companies PC could be relatively easy.

*You don't give access to everybody. If there is a team using an artificial intelligence API, and another team using geopositioning API, you don't give access to both APIs to every member of those two teams. One has access to the first API only; the other has access to the second API only.
Similarly, there may be specific persons who can access production, and therefore read API keys used in production, and then there can be developers who can't do that. This way, those developers can have their personal API keys, or a shared API key with very limited impact. Say your production API key allows to use some beefy EC2 machines which cost you a few thousands of dollars per month; a shared development API key allows only smaller instances which cost about a few tens of dollars per month.

*You file a complaint when the API key is stolen. If one of the employees is using it from home, the law enforcement would simply request the IP address to the API provider, and then find the person.

*Or you make it useless to steal the API key in the first place. If you're pretty sure your employees would be inclined to play with the artificial intelligence API, or store some personal data on Amazon S3, just give them their personal API key that they can use in any way they want. Not only this would make your company look friendlier, but it could also encourage your employees to try something new on their free time, and then bring their inventions back to your company.


text:
Q: Why does the gui thread respond slowly to calling the setText method of the QLabel control in a slot? Problem
I am developing a program with QT. Recently I found that sometimes calling the repaint method of the QLabel control takes two or three seconds in a slot function when I emit a signal in a thread. While sometimes it takes only about one millisecond. There is a difference when I make it sleep for different seconds in the run function of the thread. Here is my code:
main.cpp
#include "mainwindow.h"
#include <QApplication>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;
    w.show();

    return a.exec();
}

mainwindow.h
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include "testthread.h"
#include <QDateTime>

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

private:
    Ui::MainWindow *ui;

    TestThread *m_testThread;  //thread
private slots:
    void onTestSlot();
};

#endif // MAINWINDOW_H

mainwindow.cpp
#include "mainwindow.h"
#include "ui_mainwindow.h"

#include <QDebug>

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    m_testThread = new TestThread();
    connect(m_testThread, &TestThread::sigTest, this, &MainWindow::onTestSlot);
    m_testThread->start();
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::onTestSlot()
{
    ui->label_resultSimilarity->setText("test");
    qDebug() << QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss:zzz") << ":【MainWindow::onTestSlot】start repaint";
    ui->label_resultSimilarity->repaint();
    qDebug() << QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss:zzz") << ":【MainWindow::onTestSlot】end repaint";
}

testthread.h
#ifndef FACERECOGNIZETHREAD_H
#define FACERECOGNIZETHREAD_H
#include <QThread>
#include <QImage>
#include <QDebug>
#include <QMainWindow>

class TestThread: public QThread
{
    Q_OBJECT
public:
    TestThread();
protected:
    void run();

signals:
    void sigTest();
};

#endif // FACERECOGNIZETHREAD_H

testthread.cpp
#include "testthread.h"
#include <QApplication>

TestThread::TestThread()
{

}

void TestThread::run()
{
    //QThread::msleep(200);
    QThread::msleep(500);
    emit sigTest();
}

mainwindow.ui
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>MainWindow</class>
 <widget class="QMainWindow" name="MainWindow">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>817</width>
    <height>478</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>MainWindow</string>
  </property>
  <widget class="QWidget" name="centralWidget">
   <widget class="QLabel" name="label_preview">
    <property name="geometry">
     <rect>
      <x>93</x>
      <y>9</y>
      <width>571</width>
      <height>401</height>
     </rect>
    </property>
    <property name="sizePolicy">
     <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
      <horstretch>0</horstretch>
      <verstretch>0</verstretch>
     </sizepolicy>
    </property>
    <property name="layoutDirection">
     <enum>Qt::LeftToRight</enum>
    </property>
    <property name="frameShape">
     <enum>QFrame::Box</enum>
    </property>
    <property name="text">
     <string/>
    </property>
    <property name="scaledContents">
     <bool>false</bool>
    </property>
   </widget>
   <widget class="QWidget" name="widget" native="true">
    <property name="geometry">
     <rect>
      <x>679</x>
      <y>10</y>
      <width>131</width>
      <height>381</height>
     </rect>
    </property>
    <widget class="QLabel" name="label_resultImage">
     <property name="geometry">
      <rect>
       <x>10</x>
       <y>20</y>
       <width>111</width>
       <height>151</height>
      </rect>
     </property>
     <property name="frameShape">
      <enum>QFrame::Box</enum>
     </property>
     <property name="text">
      <string/>
     </property>
    </widget>
    <widget class="QLabel" name="label_resultSimilarity">
     <property name="geometry">
      <rect>
       <x>20</x>
       <y>210</y>
       <width>91</width>
       <height>20</height>
      </rect>
     </property>
     <property name="text">
      <string/>
     </property>
    </widget>
   </widget>
  </widget>
  <widget class="QMenuBar" name="menuBar">
   <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
     <width>817</width>
     <height>23</height>
    </rect>
   </property>
  </widget>
  <widget class="QToolBar" name="mainToolBar">
   <attribute name="toolBarArea">
    <enum>TopToolBarArea</enum>
   </attribute>
   <attribute name="toolBarBreak">
    <bool>false</bool>
   </attribute>
  </widget>
  <widget class="QStatusBar" name="statusBar"/>
 </widget>
 <layoutdefault spacing="6" margin="11"/>
 <resources/>
 <connections/>
</ui>

Additional remarks
After I edit the run method in testthread.cpp and make it sleep for 500 miliseconds, I would get the following result after I exec the program:
"2021-05-26 00:15:31:641" :【MainWindow::onTestSlot】start repaint
"2021-05-26 00:15:34:605" :【MainWindow::onTestSlot】end repaint

However, after I edit the run method in testthread.cpp again and make it sleep for 200 miliseconds, I would get the following result after I exec the program:
"2021-05-26 00:14:55:954" :【MainWindow::onTestSlot】start repaint
"2021-05-26 00:14:55:970" :【MainWindow::onTestSlot】end repaint

I donot know why the gui thread respond to the repaint so slow. Is there any solutions to make it respond quickly? Thanks for any assistance.

A: If you want ui updated immediatly,could change connection mode to 'Qt::BlockingQueueConnection'.And does the 'repaint()' calling is necessary after 'setData' method ?
Good Luck~


text:
Q: Returning the y value of a drawline Is there any way to get the y value of a drawline. I can get the only start and end position.
I try to catch the chance when a candle of moving financial series breaks through a drawline.

A: You can do something as in the All Features\Welcome !\Chart styles\Standard\Line(Strip)\Interpolating line series included in the features demo in most TeeChart versions. This example is based in the interpolating examples I made here:
TeeChart VCL & Delphi: http://www.teechart.net/support/viewtopic.php?t=2828
TeeChart ActiveX * VB6: http://www.teechart.net/support/viewtopic.php?t=4161
If more specific information is required please let us know the TeeChart version you are using.


text:
Q: How to convert python 3.6 config file into argparser code I have a file.conf that I load into python with ConfigParser(). The conf file has the usual format (using opencv also):
[decorations]
timestamp_fg= 255,255,255
timestamp_bg= 0,0,0
font_scale = 1.5

The conf file is large. I would like a way to automatically generate python code for ArgumentParser() so I can single author the conf file, gen some code, and remove code I don't need:
parser = argparse.ArgumentParser()
parser.add_argument("-c","--config", help="full pathname to config file", type=str)
# etc.

I didn't find such a utility, but still only been in python for few months.

A: While I'm not absolutely certain, I'd do one of two things

*

*Create a function that accepts an ConfigParser object and converts it into Argparse's equivalent

*

*amend tool

*run normally

*run the magic part that dumps the now parsed ConfigParser object as a big string of the Argparse commands in a new file for your viewing pleasure

*Write a regex for it and do a direct conversion

*

*write a new script

*pass in path of config

*run the magic part that dumps the now parsed ConfigParser object as a big string of the Argparse commands in a new file for your viewing pleasure

Simply using string.format() is probably fine
# make a template for your Argparse options
GENERIC_COMMAND = """\
parser.add_argument(
        "--{long_name}", "-{short_name}",
        default="{default}",
        help="help_text")"""

...
# parse ConfigParser to commands
commands = [
    {
        "long_name": "argumentA",
    },
    {
        "long_name": "argumentB",
        "help_text": "Do Thing B"
    },
...
]

commands_to_write_to_file = []
for command in commands:
    try:
        commands_to_write_to_file.append(
            GENERIC_COMMAND.format(**command))  # expand command to args
    except Exception as ex:
        print("Caught Exception".format(repr(ex)))

# to view your commands, you can write commands to file
# or try your luck with the help command
with open(out.txt, "w") as fh:
    fh.write("\n\n".join(commands_to_write_to_file))

Neither of these are great solutions, but I expect will get 90% of the work done easily, leaving good logging and yourself to find and convert the remaining few oddball commands.
Once you're happy with the output, you can get rid of your dump logic and fill argparse arguments directly with 'em instead
for command in commands:
    argparse.add_argument(**command)

A: I would checkout ConfigArgParse. That library allows for

a combination of command line args, config files, hard-coded defaults, and in some cases, environment variables


text:
Q: Fixed search button top bar I'm trying to make a fixed top bar with a search button, facebook login, etc...
The bar is fine, the problem is, the search button is moving along the page when it changes the resolution, I want it fixed like the facebook login bar, so it doesn't matter if you change the resolution, all the buttons have to move with the topbar, what do I have to do?
Thanks.
.fixbar {
width: 100%;
position: fixed;
left: 0px;
top: 0px;
height: 30px;
background-image: url(../img/fixbar.png);
background-repeat: repeat-x;
z-index: 1;
bottom: 0px;
}

#search {
position: fixed;
left: 396px;
top: 0px;
width: 100%;
height: 22px;
z-index: 2;
}

A: You need to set position:fixed .fixbar class and then u need to set position:absolute to the #search id.
CSS
.fixbar {
    width: 100%;
    height:30px;
    position: fixed;
    left: 0px;
    top: 0px;
    right:0 height: 30px;
    background: red;
    z-index: 1;
}
#search {
    position: absolute;
    right:20px;
    top: 0px;
    width: 30px;
    height: 22px;
    z-index: 2;
    background:blue;

}

HTML

output in here
DEMO

A: Sorry I do not understood your question.
Let's play with a live example and i'll try to unsderstand and maybe can help you.
Have a look at: http://jsfiddle.net/xdEUN/

<input type="search" id="search" />


text:
Q: Retrieving oldest commit with JGit I am experimenting with JGit for a project and while it mostly works, retrieving the oldest (first) commit does not. Here is the code:
    RevWalk rw = new RevWalk(new Repository(
           new File("/path/to/git")));
    RevCommit oldest;
    Iterator<RevCommit> i = rw.iterator();
    if (i.hasNext())
        oldest = i.next();
    Commit c = oldest.asCommit(rw); //oldest is null here, NPE

Does anyone know what I am doing wrong?

A: I think I found it. You have to reverse the commit log and set a starting point in order to make it start going through the revisions. The following extract does what I was looking for, but I somehow doubt how optimal it is.
 RevWalk rw = new RevWalk(new Repository(
       new File("/path/to/git")));
 RevCommit c = null;
 AnyObjectId headId;
 try {
     headId = git.resolve(Constants.HEAD);
     RevCommit root = rw.parseCommit(headId);
     rw.sort(RevSort.REVERSE);
     rw.markStart(root);
     c = rw.next();
 } catch (IOException e) {
     e.printStackTrace();
 }


text:
Q: What's different with Spring Kafka MessageListenerContainer start/Resume / stop/ Pause # spring-kafka         for (MessageListenerContainer e : containers) {
            if (!e.isContainerPaused()) {
                e.pause();
                e.stop();
            } else {
                e.resume();
                e.start();
            }
        }

in my springboot-kafka project I want to control these container, but I don't know what's the different on pause / stop  or  resume / start.
thx.

A: See documentation for more details: https://docs.spring.io/spring-kafka/docs/current/reference/html/#pause-resume
The pause/resume is, essentially, a KafkaConsumer feature to prevent rebalance when we cannot keep up for poll.interval. See more in its docs: https://medium.com/@vaibhav.vb24/kafka-confluent-pause-and-resume-consumer-cda7305944bf.
The start/stop is a Spring's lifecycle management feature. You subscribe to the topic and start consuming from it when the start() is called. You stop consuming and unsubscribe from the topic when stop() is called. This way a rebalance happens for the consumer group. See more info in docs:
https://docs.spring.io/spring-kafka/docs/current/reference/html/#connecting
https://docs.spring.io/spring-framework/docs/current/reference/html/core.html#beans-factory-lifecycle-processor