text:
Q: Access Window Re-sizing I recently purchased a 34 inch wide screen monitor. I am using the Dell Display Manager to setup different windows enable me to open multiple word documents etc neatly.
When I am using Access I can dock the app window to 1/2 or 1/3 of the screen correctly. However when I open a form (because its a child perhaps?) it doesn't stay within the confines of the parent window or the Dell Display Manager.
So, my idea was to resize any popup forms to the dimensions of the parent access window with the same Left, Top, Width and Height.
However, despite trying a few different techniques I have not been able to achieve this.
Anybody got any ideas?
Thank you!
Edit: Thanks Jashin. I have implemented your code but the form is still not showing up as I would have expected. This is the code I have used:
SetWindowPos hWndChild, hWndParent, mainRECT.wdw_left, mainRECT.wdw_top, mainRECT.wdw_right, mainRECT.wdw_bottom, &H4
When the form loads the height and left are slightly off, but the form is really thin. I tried getting the width from mainRECT.wdw_right - mainRECT.wdw_left but it had the same result.
Final Edit: Got with working with a bit of tweaking of the code provided by @Jashin. Here is the final code:
Dim hWndParent As LongPtr
Dim hWndChild As LongPtr
Dim mainRECT As RECT

hWndParent = Application.hWndAccessApp

hWndChild = Me.hwnd

GetWindowRect hWndParent, mainRECT

SetParent hWndChild, hWndParent

SetWindowPos hWndChild, 0, mainRECT.wdw_left, mainRECT.wdw_top, mainRECT.wdw_right - mainRECT.wdw_left, mainRECT.wdw_bottom, &H4

Me.SetFocus

DoCmd.MoveSize 0, 0`

A: I am not familiar with the Dell Display Manager however, if I understand your problem well, you are looking after some procedure to force positioning of pop-up forms anywhere on screen. As @ThunderFrame suggested you can't do this with Access API but you can do it using Windows API.
Create a module and declare the following functions
Public Type RECT
    wdw_left As Long
    wdw_top As Long
    wdw_right As Long
    wdw_bottom As Long
End Type

Public Declare PtrSafe Function SetParent Lib "user32" _
                               (ByVal hWndChild As LongPtr, _
                                ByVal hWndParent As LongPtr) As Long

Public Declare PtrSafe Function SetWindowPos Lib "user32" _
                               (ByVal hwnd As LongPtr, _
                                ByVal hWndInsertAfter As LongPtr, _
                                ByVal x As Long, _
                                ByVal y As Long, _
                                ByVal cx As Long, _
                                ByVal cy As Long, _
                                ByVal wFlags As Long) As Long

Public Declare PtrSafe Function GetWindowRect Lib "user32" _
                               (ByVal hwnd As LongPtr, _
                                lpRect As RECT) As Long

Note I am using PtrSafe and LongPtr keywords because I am working on a 64bit system; if you work on a 32bit system you can delete the PtrSafe keywork and substitute Long for LongPtr.
Then in the Form_Open() event of your pop-up form write the following code.
Dim hWndParent As LongPtr  ' handle of your parent form (access window or
                           ' any other form you want to set as parent
Dim hWndChild As LongPtr   ' handle of the child pop-up form
Dim mainRECT As RECT       ' coordinates of the parent form

hWndParent = Form_frm_home.hwnd ' or hWndAccessApp to get the handle of
                                ' the main Access Window
hWndChild = Form_frm_child.hwnd

GetWindowRect hWndParent, mainRECT ' this gets the coordinates of the
                                   ' parent window

SetParent hWndChild, hWndParent   ' set the pop-up form as child of the
                                  ' parent form

SetWindowPos hWndChild, hWndParent, left, top, width, heigth, &H4

The function SetWindowPos allows you to position your pop-up form on the screen anywhere. You can access the coordinates of the parent form from your RECT struct using the following code
mainRECT.wdw_left
mainRECT.wdw_top
mainRECT.wdw_right
mainRECT.wdw_bottom

The function SetParent allows you to create a child form, so it will stay always in between the boundaries of the parent form and will move with the main form (or Access Window).
Hope this helps!

A: You can't do this directly using the Access API, but you can use some Windows API functions to achieve the result you're after.
You'll need to perform the following

*

*Get the RECT struct of the Access Application window (using the hidden Hwnd property) and the Windows API GetWindowRect function

*Build a new RECT struct where you'd like your form to be placed, relative to the Application's RECT, and then use the SetWindowPos Windows API function


text:
Q: How can I import the reference of content to table of content of the imported PDF in the global document? I'm writing a bilingual book combined with ENG - FR
the idea is to generate the first book in FR then import it inside the ENG one,
all is good with this code
\AtEndDocument{\includepdf[pages=-]{21stskills4testers_FR_just_for_test.pdf}}

But the problem, the reference to table of content of the imported PDF (FR) disappears.
Can I import a PDF without loosing it's reference of content ?

A: Using pdfpages you cannot import the TOC, but you can recreate it. But I don't think this is worth the effort in your case. Especially not, when you are writing both  versions of the book. In this case I would consider \include instead of \includepdf. See the example below.
Anyway, assuming that you have only the PDF (not the LaTeX source), then it might be reasonable to recreate the TOC like this:
\documentclass[a4paper]{article}
\usepackage{pdfpages}
\usepackage{hyperref}

\begin{document}

\includepdf[
  pages=-,
  addtotoc={%
    1, section, 1, aaa, sec:aaa,
    2, section, 1, bbb, sec:bbb,
    3, section, 1, ccc, sec:ccc
    }%
]{dummy.pdf}

\end{document}

But since you are writing both versions of the book, and have the LaTeX source of both, the following approach is much better.
English version of your book. File content-en.tex.
\section{English}
\lipsum

French version of your book. File content-fr.tex.
\section{French}
\lipsum

And finally the main document, where you include both versions or just one or the other.
\documentclass{article}
\usepackage{lipsum}
\usepackage{hyperref}
\begin{document}
\include{content-en}
\include{content-fr}
\end{document}

redpajama_set_name: RedPajamaStackExchange


text:
Q: Measure of normality independent of sample size I am trying to automate a system for checking if data is approximately normally distributed.
I know for a fact that the data is not strictly normal (there are small deviations from normality) so I only want to check if it is "normal enough".
I have large sample sizes so I avoid using a hypothesis test. I always use a QQ plot to check for approximate normality, I'm aware of the problem with hypothesis tests like the Sapiro-Wilk test when the sample size is very big.
I'm searching for a numerical measure of normality which has an equal expected value for any sample size. A measure like the p value of a test will converge to $0$ for large sample sizes and the variance of the $p$ value also tends towards $0$. I'd like a measure which has the same expected value for any sample size but a lower variance for larger samples.
Since I'm looking at QQ plots I tried to use the $R^2$ value of the line on the QQ plot but this didn't work because it measures the quality of the correlation without caring if the slope of the line is $1$ and the intercept is $0$. In the chart below I've made a QQ plot of an exponentially distributed variable (transformed to have $0$ mean and unit variance), the $R^2$ was high because most of the values are between -4 and -3 where the line is very linear.

I also tried to use the slope of the QQ plot line (where a slope near 1 indicates normality). However, after some testing I found that any symmetrical distribution will have a QQ plot with an expected slope equal to 1 so this is a measure of symmetry not normality.
Is there a smarter way to approach this problem?


text:
Q: apt-get update failed to fetch and /sources.list.d/ empty Running the sudo apt-get update command, I got the following error:
Fetched 988 kB in 16s (59,3 kB/s)
W: Failed to fetch http://old-releases.ubuntu.com/ubuntu/dists/trusty/main/binary-amd64/Packages  404  Not Found

W: Failed to fetch http://old-releases.ubuntu.com/ubuntu/dists/trusty/restricted/binary-amd64/Packages  404  Not Found

W: Failed to fetch http://old-releases.ubuntu.com/ubuntu/dists/trusty/universe/binary-amd64/Packages  404  Not Found

W: Failed to fetch http://old-releases.ubuntu.com/ubuntu/dists/trusty/multiverse/binary-amd64/Packages  404  Not Found

W: Failed to fetch http://old-releases.ubuntu.com/ubuntu/dists/trusty/main/binary-i386/Packages  404  Not Found

W: Failed to fetch http://old-releases.ubuntu.com/ubuntu/dists/trusty/restricted/binary-i386/Packages  404  Not Found

W: Failed to fetch http://old-releases.ubuntu.com/ubuntu/dists/trusty/universe/binary-i386/Packages  404  Not Found

W: Failed to fetch http://old-releases.ubuntu.com/ubuntu/dists/trusty/multiverse/binary-i386/Packages  404  Not Found

W: Failed to fetch http://old-releases.ubuntu.com/ubuntu/dists/trusty-updates/main/binary-amd64/Packages  404  Not Found

W: Failed to fetch http://old-releases.ubuntu.com/ubuntu/dists/trusty-updates/restricted/binary-amd64/Packages  404  Not Found

W: Failed to fetch http://old-releases.ubuntu.com/ubuntu/dists/trusty-updates/universe/binary-amd64/Packages  404  Not Found

W: Failed to fetch http://old-releases.ubuntu.com/ubuntu/dists/trusty-updates/multiverse/binary-amd64/Packages  404  Not Found

W: Failed to fetch http://old-releases.ubuntu.com/ubuntu/dists/trusty-updates/main/binary-i386/Packages  404  Not Found

W: Failed to fetch http://old-releases.ubuntu.com/ubuntu/dists/trusty-updates/restricted/binary-i386/Packages  404  Not Found

W: Failed to fetch http://old-releases.ubuntu.com/ubuntu/dists/trusty-updates/universe/binary-i386/Packages  404  Not Found

W: Failed to fetch http://old-releases.ubuntu.com/ubuntu/dists/trusty-updates/multiverse/binary-i386/Packages  404  Not Found

W: Failed to fetch http://old-releases.ubuntu.com/ubuntu/dists/trusty-security/main/binary-amd64/Packages  404  Not Found

W: Failed to fetch http://old-releases.ubuntu.com/ubuntu/dists/trusty-security/restricted/binary-amd64/Packages  404  Not Found

W: Failed to fetch http://old-releases.ubuntu.com/ubuntu/dists/trusty-security/universe/binary-amd64/Packages  404  Not Found

W: Failed to fetch http://old-releases.ubuntu.com/ubuntu/dists/trusty-security/multiverse/binary-amd64/Packages  404  Not Found

W: Failed to fetch http://old-releases.ubuntu.com/ubuntu/dists/trusty-security/main/binary-i386/Packages  404  Not Found

W: Failed to fetch http://old-releases.ubuntu.com/ubuntu/dists/trusty-security/restricted/binary-i386/Packages  404  Not Found

W: Failed to fetch http://old-releases.ubuntu.com/ubuntu/dists/trusty-security/universe/binary-i386/Packages  404  Not Found

W: Failed to fetch http://old-releases.ubuntu.com/ubuntu/dists/trusty-security/multiverse/binary-i386/Packages  404  Not Found

W: Failed to fetch http://archive.getdeb.net/ubuntu/dists/rebecca-getdeb/apps/binary-amd64/Packages  404  Not Found [IP: 104.28.24.125 80]

W: Failed to fetch http://archive.getdeb.net/ubuntu/dists/rebecca-getdeb/apps/binary-i386/Packages  404  Not Found [IP: 104.28.24.125 80]

E: Some index files failed to download. They have been ignored, or old ones used instead.

I know that to solve this kind of errors, I have to modify the sudo gedit /etc/apt/sources.list , but, in this case, I found only those:
#deb cdrom:[Linux Mint 17.1 _Rebecca_ - Release amd64 20141126]/ trusty contrib main non-free
deb http://download.virtualbox.org/virtualbox/debian trusty contrib
deb http://cran.cnr.berkeley.edu/bin/linux/ubuntu/ trusty/

/etc/apt/source.list.d is empty. sudo apt-cache policy gives:
Package files:
 100 /var/lib/dpkg/status
     release a=now
 500 http://ppa.launchpad.net/ubuntuhandbook1/apps/ubuntu/ trusty/main Translation-en
 500 http://ppa.launchpad.net/ubuntuhandbook1/apps/ubuntu/ trusty/main i386 Packages
     release v=14.04,o=LP-PPA-ubuntuhandbook1-apps,a=trusty,n=trusty,l=Apps,c=main
     origin ppa.launchpad.net
 500 http://ppa.launchpad.net/ubuntuhandbook1/apps/ubuntu/ trusty/main amd64 Packages
     release v=14.04,o=LP-PPA-ubuntuhandbook1-apps,a=trusty,n=trusty,l=Apps,c=main
     origin ppa.launchpad.net
 500 http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu/ trusty/main Translation-en
 500 http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu/ trusty/main i386 Packages
     release v=14.04,o=LP-PPA-ubuntu-wine,a=trusty,n=trusty,l=Wine Team PPA,c=main
     origin ppa.launchpad.net
 500 http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu/ trusty/main amd64 Packages
     release v=14.04,o=LP-PPA-ubuntu-wine,a=trusty,n=trusty,l=Wine Team PPA,c=main
     origin ppa.launchpad.net
 500 http://deb.playonlinux.com/ saucy/main i386 Packages
     release v=13.10,o=PlayOnLinux,a=saucy,n=saucy,l=PoL,c=main
     origin deb.playonlinux.com
 500 http://deb.playonlinux.com/ saucy/main amd64 Packages
     release v=13.10,o=PlayOnLinux,a=saucy,n=saucy,l=PoL,c=main
     origin deb.playonlinux.com
 500 http://archive.canonical.com/ubuntu/ trusty/partner Translation-en
 500 http://archive.canonical.com/ubuntu/ trusty/partner i386 Packages
     release v=14.04,o=Canonical,a=trusty,n=trusty,l=Partner archive,c=partner
     origin archive.canonical.com
 500 http://archive.canonical.com/ubuntu/ trusty/partner amd64 Packages
     release v=14.04,o=Canonical,a=trusty,n=trusty,l=Partner archive,c=partner
     origin archive.canonical.com
 500 http://security.ubuntu.com/ubuntu/ trusty-security/universe Translation-en
 500 http://security.ubuntu.com/ubuntu/ trusty-security/restricted Translation-en
 500 http://security.ubuntu.com/ubuntu/ trusty-security/multiverse Translation-en
 500 http://security.ubuntu.com/ubuntu/ trusty-security/main Translation-en
 500 http://security.ubuntu.com/ubuntu/ trusty-security/multiverse i386 Packages
     release v=14.04,o=Ubuntu,a=trusty-security,n=trusty,l=Ubuntu,c=multiverse
     origin security.ubuntu.com
 500 http://security.ubuntu.com/ubuntu/ trusty-security/universe i386 Packages
     release v=14.04,o=Ubuntu,a=trusty-security,n=trusty,l=Ubuntu,c=universe
     origin security.ubuntu.com
 500 http://security.ubuntu.com/ubuntu/ trusty-security/restricted i386 Packages
     release v=14.04,o=Ubuntu,a=trusty-security,n=trusty,l=Ubuntu,c=restricted
     origin security.ubuntu.com
 500 http://security.ubuntu.com/ubuntu/ trusty-security/main i386 Packages
     release v=14.04,o=Ubuntu,a=trusty-security,n=trusty,l=Ubuntu,c=main
     origin security.ubuntu.com
 500 http://security.ubuntu.com/ubuntu/ trusty-security/multiverse amd64 Packages
     release v=14.04,o=Ubuntu,a=trusty-security,n=trusty,l=Ubuntu,c=multiverse
     origin security.ubuntu.com
 500 http://security.ubuntu.com/ubuntu/ trusty-security/universe amd64 Packages
     release v=14.04,o=Ubuntu,a=trusty-security,n=trusty,l=Ubuntu,c=universe
     origin security.ubuntu.com
 500 http://security.ubuntu.com/ubuntu/ trusty-security/restricted amd64 Packages
     release v=14.04,o=Ubuntu,a=trusty-security,n=trusty,l=Ubuntu,c=restricted
     origin security.ubuntu.com
 500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
     release v=14.04,o=Ubuntu,a=trusty-security,n=trusty,l=Ubuntu,c=main
     origin security.ubuntu.com
 700 http://extra.linuxmint.com/ rebecca/main i386 Packages
     release v=17.1,o=linuxmint,a=rebecca,n=rebecca,l=linuxmint,c=main
     origin extra.linuxmint.com
 700 http://extra.linuxmint.com/ rebecca/main amd64 Packages
     release v=17.1,o=linuxmint,a=rebecca,n=rebecca,l=linuxmint,c=main
     origin extra.linuxmint.com
 700 http://packages.linuxmint.com/ rebecca/import i386 Packages
     release v=17.1,o=linuxmint,a=rebecca,n=rebecca,l=linuxmint,c=import
     origin packages.linuxmint.com
 700 http://packages.linuxmint.com/ rebecca/upstream i386 Packages
     release v=17.1,o=linuxmint,a=rebecca,n=rebecca,l=linuxmint,c=upstream
     origin packages.linuxmint.com
 700 http://packages.linuxmint.com/ rebecca/main i386 Packages
     release v=17.1,o=linuxmint,a=rebecca,n=rebecca,l=linuxmint,c=main
     origin packages.linuxmint.com
 700 http://packages.linuxmint.com/ rebecca/import amd64 Packages
     release v=17.1,o=linuxmint,a=rebecca,n=rebecca,l=linuxmint,c=import
     origin packages.linuxmint.com
 700 http://packages.linuxmint.com/ rebecca/upstream amd64 Packages
     release v=17.1,o=linuxmint,a=rebecca,n=rebecca,l=linuxmint,c=upstream
     origin packages.linuxmint.com
 700 http://packages.linuxmint.com/ rebecca/main amd64 Packages
     release v=17.1,o=linuxmint,a=rebecca,n=rebecca,l=linuxmint,c=main
     origin packages.linuxmint.com
 500 http://ppa.launchpad.net/notepadqq-team/notepadqq/ubuntu/ trusty/main Translation-en
 500 http://ppa.launchpad.net/notepadqq-team/notepadqq/ubuntu/ trusty/main i386 Packages
     release v=14.04,o=LP-PPA-notepadqq-team-notepadqq,a=trusty,n=trusty,l=Notepadqq,c=main
     origin ppa.launchpad.net
 500 http://ppa.launchpad.net/notepadqq-team/notepadqq/ubuntu/ trusty/main amd64 Packages
     release v=14.04,o=LP-PPA-notepadqq-team-notepadqq,a=trusty,n=trusty,l=Notepadqq,c=main
     origin ppa.launchpad.net
 500 http://ppa.launchpad.net/noobslab/themes/ubuntu/ trusty/main Translation-en
 500 http://ppa.launchpad.net/noobslab/themes/ubuntu/ trusty/main i386 Packages
     release v=14.04,o=LP-PPA-noobslab-themes,a=trusty,n=trusty,l=Themes Collection by NoobsLab,c=main
     origin ppa.launchpad.net
 500 http://ppa.launchpad.net/noobslab/themes/ubuntu/ trusty/main amd64 Packages
     release v=14.04,o=LP-PPA-noobslab-themes,a=trusty,n=trusty,l=Themes Collection by NoobsLab,c=main
     origin ppa.launchpad.net
 500 http://ppa.launchpad.net/moka/stable/ubuntu/ trusty/main Translation-en
 500 http://ppa.launchpad.net/moka/stable/ubuntu/ trusty/main i386 Packages
     release v=14.04,o=LP-PPA-moka-stable,a=trusty,n=trusty,l=Moka Stable,c=main
     origin ppa.launchpad.net
 500 http://ppa.launchpad.net/moka/stable/ubuntu/ trusty/main amd64 Packages
     release v=14.04,o=LP-PPA-moka-stable,a=trusty,n=trusty,l=Moka Stable,c=main
     origin ppa.launchpad.net
 500 http://ppa.launchpad.net/lyx-devel/release/ubuntu/ trusty/main Translation-en
 500 http://ppa.launchpad.net/lyx-devel/release/ubuntu/ trusty/main i386 Packages
     release v=14.04,o=LP-PPA-lyx-devel-release,a=trusty,n=trusty,l=LyX PPA (release),c=main
     origin ppa.launchpad.net
 500 http://ppa.launchpad.net/lyx-devel/release/ubuntu/ trusty/main amd64 Packages
     release v=14.04,o=LP-PPA-lyx-devel-release,a=trusty,n=trusty,l=LyX PPA (release),c=main
     origin ppa.launchpad.net
 500 http://dl.google.com/linux/chrome/deb/ stable/main i386 Packages
     release v=1.0,o=Google, Inc.,a=stable,n=stable,l=Google,c=main
     origin dl.google.com
 500 http://dl.google.com/linux/chrome/deb/ stable/main amd64 Packages
     release v=1.0,o=Google, Inc.,a=stable,n=stable,l=Google,c=main
     origin dl.google.com
 500 http://ppa.launchpad.net/gezakovacs/ppa/ubuntu/ trusty/main i386 Packages
     release v=14.04,o=LP-PPA-gezakovacs,a=trusty,n=trusty,l=UNetbootin PPA,c=main
     origin ppa.launchpad.net
 500 http://ppa.launchpad.net/gezakovacs/ppa/ubuntu/ trusty/main amd64 Packages
     release v=14.04,o=LP-PPA-gezakovacs,a=trusty,n=trusty,l=UNetbootin PPA,c=main
     origin ppa.launchpad.net
 500 http://ppa.launchpad.net/fossfreedom/rhythmbox/ubuntu/ trusty/main Translation-en
 500 http://ppa.launchpad.net/fossfreedom/rhythmbox/ubuntu/ trusty/main i386 Packages
     release v=14.04,o=LP-PPA-fossfreedom-rhythmbox,a=trusty,n=trusty,l=Rhythmbox,c=main
     origin ppa.launchpad.net
 500 http://ppa.launchpad.net/fossfreedom/rhythmbox/ubuntu/ trusty/main amd64 Packages
     release v=14.04,o=LP-PPA-fossfreedom-rhythmbox,a=trusty,n=trusty,l=Rhythmbox,c=main
     origin ppa.launchpad.net
 500 http://ppa.launchpad.net/costales/folder-color/ubuntu/ trusty/main Translation-en
 500 http://ppa.launchpad.net/costales/folder-color/ubuntu/ trusty/main i386 Packages
     release v=14.04,o=LP-PPA-costales-folder-color,a=trusty,n=trusty,l=Folder Color,c=main
     origin ppa.launchpad.net
 500 http://ppa.launchpad.net/costales/folder-color/ubuntu/ trusty/main amd64 Packages
     release v=14.04,o=LP-PPA-costales-folder-color,a=trusty,n=trusty,l=Folder Color,c=main
     origin ppa.launchpad.net
 500 http://ppa.launchpad.net/atareao/telegram/ubuntu/ trusty/main Translation-en
 500 http://ppa.launchpad.net/atareao/telegram/ubuntu/ trusty/main i386 Packages
     release v=14.04,o=LP-PPA-atareao-telegram,a=trusty,n=trusty,l=Telegram,c=main
     origin ppa.launchpad.net
 500 http://ppa.launchpad.net/atareao/telegram/ubuntu/ trusty/main amd64 Packages
     release v=14.04,o=LP-PPA-atareao-telegram,a=trusty,n=trusty,l=Telegram,c=main
     origin ppa.launchpad.net
 500 http://repository.spotify.com/ stable/non-free i386 Packages
     origin repository.spotify.com
 500 http://repository.spotify.com/ stable/non-free amd64 Packages
     origin repository.spotify.com
 500 http://cran.cnr.berkeley.edu/bin/linux/ubuntu/ trusty/ Packages
     release v=14.04,o=CRAN,a=trusty,n=trusty,l=CRAN,c=
     origin cran.cnr.berkeley.edu
 700 http://download.virtualbox.org/virtualbox/debian/ quantal/contrib i386 Packages
     origin download.virtualbox.org
 700 http://download.virtualbox.org/virtualbox/debian/ quantal/contrib amd64 Packages
     origin download.virtualbox.org
Pinned packages:

Running the command inxi -r I get:
Active apt sources in file: /etc/apt/sources.list
           deb http://download.virtualbox.org/virtualbox/debian trusty contrib
           deb http://cran.cnr.berkeley.edu/bin/linux/ubuntu/ trusty/
           Active apt sources in file: /etc/apt/sources.list.d/additional-repositories.list
           deb http://repository.spotify.com stable non-free
           Active apt sources in file: /etc/apt/sources.list.d/atareao-telegram-trusty.list
           deb http://ppa.launchpad.net/atareao/telegram/ubuntu trusty main
           deb-src http://ppa.launchpad.net/atareao/telegram/ubuntu trusty main
           Active apt sources in file: /etc/apt/sources.list.d/costales-folder-color-trusty.list
           deb http://ppa.launchpad.net/costales/folder-color/ubuntu trusty main
           deb-src http://ppa.launchpad.net/costales/folder-color/ubuntu trusty main
           Active apt sources in file: /etc/apt/sources.list.d/fossfreedom-rhythmbox-trusty.list
           deb http://ppa.launchpad.net/fossfreedom/rhythmbox/ubuntu trusty main
           deb-src http://ppa.launchpad.net/fossfreedom/rhythmbox/ubuntu trusty main
           Active apt sources in file: /etc/apt/sources.list.d/getdeb.list
           deb http://archive.getdeb.net/ubuntu rebecca-getdeb apps
           Active apt sources in file: /etc/apt/sources.list.d/gezakovacs-ppa-trusty.list
           deb http://ppa.launchpad.net/gezakovacs/ppa/ubuntu trusty main
           deb-src http://ppa.launchpad.net/gezakovacs/ppa/ubuntu trusty main
           Active apt sources in file: /etc/apt/sources.list.d/google-chrome.list
           deb http://dl.google.com/linux/chrome/deb/ stable main
           Active apt sources in file: /etc/apt/sources.list.d/lyx-devel-release-trusty.list
           deb http://ppa.launchpad.net/lyx-devel/release/ubuntu trusty main
           deb-src http://ppa.launchpad.net/lyx-devel/release/ubuntu trusty main
           Active apt sources in file: /etc/apt/sources.list.d/moka-stable-trusty.list
           deb http://ppa.launchpad.net/moka/stable/ubuntu trusty main
           deb-src http://ppa.launchpad.net/moka/stable/ubuntu trusty main
           Active apt sources in file: /etc/apt/sources.list.d/noobslab-themes-trusty.list
           deb http://ppa.launchpad.net/noobslab/themes/ubuntu trusty main
           deb-src http://ppa.launchpad.net/noobslab/themes/ubuntu trusty main
           Active apt sources in file: /etc/apt/sources.list.d/notepadqq-team-notepadqq-trusty.list
           deb http://ppa.launchpad.net/notepadqq-team/notepadqq/ubuntu trusty main
           deb-src http://ppa.launchpad.net/notepadqq-team/notepadqq/ubuntu trusty main
           Active apt sources in file: /etc/apt/sources.list.d/official-package-repositories.list
           deb http://packages.linuxmint.com rebecca main upstream import
           deb http://extra.linuxmint.com rebecca main
           deb http://old-releases.ubuntu.com/ubuntu trusty main restricted universe multiverse
           deb http://old-releases.ubuntu.com/ubuntu trusty-updates main restricted universe multiverse
           deb http://old-releases.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse
           deb http://archive.canonical.com/ubuntu/ trusty partner
           Active apt sources in file: /etc/apt/sources.list.d/playonlinux.list
           deb http://deb.playonlinux.com/ saucy main
           Active apt sources in file: /etc/apt/sources.list.d/ubuntu-wine-ppa-trusty.list
           deb http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu trusty main
           deb-src http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu trusty main
           Active apt sources in file: /etc/apt/sources.list.d/ubuntuhandbook1-apps-trusty.list
           deb http://ppa.launchpad.net/ubuntuhandbook1/apps/ubuntu trusty main
           deb-src http://ppa.launchpad.net/ubuntuhandbook1/apps/ubuntu trusty main

Running cd /etc/apt/sources.list.d and ls -la I get:
total 60
4 -rw-r--r-- 1 root root  50 Apr  5 21:26 additional-repositories.list
4 -rw-r--r-- 1 root root 134 Mar 21 19:59 atareao-telegram-trusty.list
4 -rw-r--r-- 1 root root 144 Apr  4 11:18 costales-folder-color-trusty.list
4 -rw-r--r-- 1 root root 144 Mar 27 14:10 fossfreedom-rhythmbox-trusty.list
4 -rw-r--r-- 1 root root  57 May  1 02:23 getdeb.list
4 -rw-r--r-- 1 root root 130 Apr  2 14:31 gezakovacs-ppa-trusty.list
4 -rw-r--r-- 1 root root 176 Apr  5 21:26 google-chrome.list
4 -rw-r--r-- 1 root root 136 Mar 25 23:04 lyx-devel-release-trusty.list
4 -rw-r--r-- 1 root root 124 Mar 23 02:27 moka-stable-trusty.list
4 -rw-r--r-- 1 root root 132 Mar 23 13:43 noobslab-themes-trusty.list
4 -rw-r--r-- 1 root root 150 Apr  6 21:43 notepadqq-team-notepadqq-trusty.list
4 -rw-r--r-- 1 root root 470 May  1 22:55 official-package-repositories.list
4 -rw-r--r-- 1 root root  43 Feb 27 22:06 playonlinux.list
4 -rw-r--r-- 1 root root 142 Mar 23 22:44 ubuntuhandbook1-apps-trusty.list
4 -rw-r--r-- 1 root root 132 Apr 14 00:34 ubuntu-wine-ppa-trusty.list

Can someone suggest a solution?

A: For each of the urls mentioned in the error message in the question, do a search for it. Then remove it from the relevant file in /etc/apt/sources.list..
For example
cd /etc/apt/sources.list.d
grep -R http://old-releases.ubuntu.com/ubuntu/dists/trusty/main/binary-amd64/Packages

This will give you a name of a file in /etc/apt/sources.list.d. Then go into that file, and either remove the corresponding line, or edit it out using the # comment character. As far as I can tell, all the error messages you are seeing come from files in /etc/apt/sources.list.d.

A: sudo sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list

would solve the problem
then type
sudo apt-get update

hope this solves ur problem

A: It appears that my Mint 17.1 is not using /etc/apt/sources.list, but rather /etc/apt/sources.list.d/official-package-repositories.list
Please try the following command:
# inxi -r

Let me know what you get.

A: Repos:     Active apt sources in file: /etc/apt/sources.list
           deb http://packages.linuxmint.com/ debian main upstream import
           deb ht tp :// debian.linuxmint.com/latest testing main contrib non-free
           deb ht tp:// debian.linuxmint.com/latest/security testing/updates main contrib non-free
           deb h ttp:// debian.linuxmint.com/latest/multimedia testing main non-free
           Active apt sources in file: /etc/apt/sources.list.d/official-package-repositories.list
           deb ht tp://packages.linuxmint.com rebecca main upstream import
           deb h tp://extra.linuxmint.com rebecca main
           deb ht tp://archive.ubuntu.com/ubuntu trusty main restricted universe multiverse
           deb ht tp:// archive.ubuntu.com/ubuntu trusty-updates main restricted universe multiverse
           deb ht tp:// security.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse
           deb ht tp:// archive.canonical.com/ubuntu/ trusty partner
           Active apt sources in file: /etc/apt/sources.list.d/pgdg.list
           deb ht tp:// apt.postgresql.org/pub/repos/apt/ trusty-pgdg main


text:
Q: Pmos or Nmos? Which has the biggest contribution to flicker noise? I would like to ask if this sentence below is correct.I had find it, when I was reading a paper.
"PMOS transistors have lower flicker noise than similarly-sized nMOS transistors in most CMOS processes."
I am a little confused why PMOS transistors have lower flicker noise.I didn't find a good explanation for this.

A: The answer lies in the mean time between collisions and this is based on mobility.  Whichever device has a higher mobility, \$\mu\$, will have higher collisions because you have a greater probability of have a collision.  This generally means that nFETs have higher collisions and therefore higher flicker noise, but on undoped channels, you will see similar mobilities.  I have 10nm fins on my bench that show higher \$\mu_p\$.
Due to Brownian motion, you have movement whenever you have heat, and skipping a bunch of physics, you end up with the average net velocity for drift to be \$v_{dn}= -\mu_nE\$ and \$v_{dp}= \mu_pE\$ respectively. The mobility \$\mu_x\$ has the "mean free time between collisions" term of \$\tau_c\$, as \$\mu_{n,p}=\frac{q\tau_c}{2m_{n,p}}\$.
Once you calculate \$\tau_c\$, what this tells you is that for a field, \$E\$, for similar devices you will have more collisions just due to higher mobility.  To actually calculate \$\tau_c\$, you will need to pull out a device physics book and look at the density of states at a temperature under field conditions.  This is one of those things that we just empirically measure.  The math says it's proportional to \$T^{\frac{1}{2}}\$, but on the bench you see \$T^{\frac{3}{2}}\$ as your channel changes.


text:
Q: Show loading image after click button and page load i got a problem in my project. I have 2 webpage, webpage xxx for the input and webpage yyy for the output. the processing time is taking 2 mins, so after i clicked the button on webpage xxx, it shows white, wait till the processing finish and show webpage yyy.

*

*How can i replace the white blank with loading image and gone after webpage yyy is finished processing? i've done some research and the example is like this code
function onReady(callback) {
var intervalID = window.setInterval(checkReady, 60000);

function checkReady() {
if (document.getElementsByTagName('body')[0] !== undefined) {
    window.clearInterval(intervalID);
    callback.call(this);
       }
   }
}

the example is from this site http://jsfiddle.net/MrPolywhirl/cbLsc81f/

*Where to put the code and CSS to show the loading screen? on webpage xxx or webpage yyy?

I confused on how implement the js to my project. I need your help
Thank you in advance.

UPDATE.
this code is how i request the yyy page from xxx
    public void GenerateReport()
    {

        System.Collections.Specialized.NameValueCollection collections = new System.Collections.Specialized.NameValueCollection();

        collections.Add("ID", Session["ID"].ToString());

        string remoteUrl = "WebfrmReport.aspx";
        string html = "";
        html += "";
        html += string.Format("<form name='PostForm' method='POST' action='{0}' style='display:none;'>", remoteUrl);
        foreach (string key in collections.Keys)
        {
            html += string.Format("<input name='{0}' type='text' value='{1}'>", key, collections[key]);
        }
        html += "</form>";
        Response.Clear();
        Response.ContentEncoding = Encoding.GetEncoding("ISO-8859-1");
        Response.HeaderEncoding = Encoding.GetEncoding("ISO-8859-1");
        Response.Charset = "ISO-8859-1";
        Response.Write(html);
        Response.End();
    }

A: Try this:

function DisablePage() {
    $('.ui-widget-overlay').css('height', '100%');
}
function EnablePage() {
    $('.ui-widget-overlay').css('height', '0%');
}
$(document).ajaxStart(function () {
    DisablePage();
});
$(document).ajaxStop(function () {
    EnablePage();
    // Redirect to yyy
});
function GenerarteReport() {
    var url = urlHelper.CommonHelper("", "Home", "GenerateReport");
    $.ajax({
        url: url,
        dataType: "json",
        ype: "GET",
       contentType: 'application/json; charset=utf-8',
        async: true,
        processData: false,
        cache: false,
        success: function (data) {
            if(data.success)
                alert("success");
            else
                alert("not success")
        }
    });
}

public JsonResult GenerateReport()
{
    System.Collections.Specialized.NameValueCollection collections = new System.Collections.Specialized.NameValueCollection();

    collections.Add("ID", Session["ID"].ToString());

    string remoteUrl = "WebfrmReport.aspx";
    string html = "";
    html += "";
    html += string.Format("<form name='PostForm' method='POST' action='{0}' style='display:none;'>", remoteUrl);
    foreach (string key in collections.Keys)
    {
        html += string.Format("<input name='{0}' type='text' value='{1}'>", key, collections[key]);
    }
    html += "</form>";
    Response.Clear();
    Response.ContentEncoding = Encoding.GetEncoding("ISO-8859-1");
    Response.HeaderEncoding = Encoding.GetEncoding("ISO-8859-1");
    Response.Charset = "ISO-8859-1";
    Response.Write(html);
    Response.End();
    return Json(new { success = true }, JsonRequestBehavior.AllowGet);
}


text:
Q: TomCat: opening file using classpath I want to open a file on disk when I run a server application on Tomcat. When I print my classpath I get
C:\JavaDev\tools\apache-tomcat-6.0.33\bin\bootstrap.jar;
C:\Program Files\Java\jdk1.6.0_23\lib\tools.jar

which makes little sense to me, but then again I don't even have a basic understanding how it works. Where are my projects loaded from? Don't they need to be on the classpath?
This is the directory layout of the domain I'm currently working on:
src/main/java/com/company/product/domain/b/beans/MyClass.java
src/main/resources/whatever/myfile.txt

I've tried opening the file using variations along the lines of:
String filename = "../resources/whatver/myfile.txt";
URL url = MyClass.class.getResource(filename);

Alas url==null every time. Among other path variations I've tried:
whatver/myfile.txt
../whatver/myfile.txt
../../../../../../../resources/whatver/myfile.txt

I need a solution that I can commit (i.e. not stored in the Eclipse workspace), so not all team members have to update their settings.
This the environment I'm using:

*

*Tomcat 6.0

*Eclipse Java EE IDE for Web Developers, Version: Helios Service Release 2

*Maven 3.0.3 (r1075438; 2011-02-28 18:31:09+0100)

A: In a Maven project, the files in resources are usually packaged in the classpath somewhere.  Try this:
InputStream in = this.getClass().getClassLoader().getResourceAsStream("whatever/myfile.txt");

Is this a web application that gets packaged by Maven as a .war?


text:
Q: Best practice for resolving in Spring4D? In the spring4d demos, ServiceLocator.GetService<MyType>('Name') is used to resolve the types. But why not use GlobalContainer.Resolve<MyType>('Name')? I don't see any advantage in this approach...

A: There is one use case, where I use ServiceLocator:
when coding to make legacy code projects unit-testable...
There is an old project, where in mulitiple places, there are constructor calls of an object, which I write tests for (new and changed methods only, in classes, where injection is not possible, e.g. when a Form is created and destroyed in a button event).
In unit-tests, spring4d is helpful to instantiate the class-under-test:
I can use the GlobalContainer in the dpr for the production project and a special (test-only) TContainer-object which is constructed in Testfixture.Setup and destroyed in Testfixture.TearDown... I also re-initialize the global Service-Locator to use my Test-Container (Reason: I have bad experiences to use GlobalContainer in Test, you cannot un-register a type from GlobalContainer in Testfixture.TearDown).
So now, I got a big method in the dpr, where I register all types to GlobalContainer in the production-code project. In the Setup-Method of my test-fixture-class,  I register all types needed for the test to my Testing-Container. And in the Methods, that I changed to make them unit-testable, I construct the classes-under-test with ServiceLocator, where formerly constructor-calls where used.
For me, it is the only way to make such a legacy-code project unit-testable... But my strategic goal is to replace most of this code (part-by-part, including the re-initialized ServiceLocators) one day. It is just not possible to replace it now (too much costs, too much risk...).


text:
Q: Laravel Large CSV import using maatwebsite excel I have a CSV file with 30 k rows. I have used maatwebsite excel to import CSV in my pgsql database.
Problem is every time it's uploading 10k-12k data in database, then page giving HTTP ERROR 500
Error :
This page isn't working
localhost is currently unable to handle this request.
HTTP ERROR 500

I have changes below variable in php.ini
max_execution_time=0
max_input_time=3000
post_max_size=128M

I have tried below code in  ReportsImport
class UserReport implements ToModel, WithCustomCsvSettings,WithChunkReading,WithHeadingRow
{
    public function model(array $row)
    {
          // dd($row);
          return new UserReport([
              'user'     => $row['username],
              'amount'   => $row['amount']
          ]);
    }

    public function getCsvSettings(): array
    {
         return [
              'input_encoding' => 'UTF-8'
         ];
    }

    public function chunkSize(): int
    {
        return 1000;
    }
}

How can I resolved this HTTP 500 error ?
Error Log : local.ERROR: Allowed memory size of 536870912 bytes exhausted
Version : Laravel Framework 7.26.1

A: The problem is that the application is trying to hold too much data in memory. I see you're already using Chunk reading but it appears not to be enough
To decrease the memory consumption when reading the table data, try decreasing your chunk size.
To decrease the memory consumption of the models, try adding Batch inserts in addition to chunk reading .


text:
Q: What does it mean for a Limit to be Flat? I am reading a mathematical paper where it is stated for a particular limit that 'the limit for $t \rightarrow \infty$ is flat in some integral sense'.
Could someone clarify exactly what this means?  What does it mean for the limit to be flat?  I am assuming this is meant to be some kind of statement about the strength of the convergence?
Edit: I should add that the integral in question is the following:
$\int_0^{\infty} \int_M |\text{Ric}|^2 dV dt \leq C$,
so the paper is stating that the limit as $t$ tends to infinity is flat in some integral sense and I am not clear what that means.
Edit: I contacted the author of the paper who clarified that he simply meant that there exists a sequence of metrics such that the $L^2$-norm of their Ricci curvature goes to zero.

A: Some more details would help, for example a reference to the paper, but from the context it seems likely the paper is discussing convergence of Riemannian manifolds (or similar) to a limit Riemannian manifold, perhaps in the sense of Gromov-Hausdorff. Then flatness is with regard to the curvature of the limit object, and in particular an integral curvature. From the notation it looks like they are integrating a quantity associated to the Ricci curvature. That said there are some subtleties here, as if $t$ is indexing the manifolds then they are not just integrating the curvature over the limit manifold, but all the manifolds, and presumably that this integral of a non-negative quantity is finite allows us to deduce something about the quantity in the limit. (Or at least they want you to think of it as doing so, in this 'integral sense').


text:
Q: Detail in proof of Hartog Theorem I am stuck in the middle of what you can see below: when the book says "we can repeat the same construction [...] horizontal strip arbitrary close to $z_2=0$":

*

*We define different sets $E_l$ on any open subset of $\Delta$: what does this mean? I tried to pick $A\subseteq\Delta$ and pose $E_l:=\{z_2\in A\;\;:\;\;\sup_{z_1\in\Delta}|f(z_1,z_2)|\le l\}$ but it doesn't work for what is to come: if we agree on calling $\Delta\times\Delta_{z_2^0,r}$ an horizontal strip, taking $A\subset\Delta$ such that $d(0,A)>0$ such a strip is not arbitrarily close to $z_2=0$. So I misunderstood.

*Next: what does $B\subset\Delta$ dense mean? Where is dense?

Many thanks!

A: Let $A$ be an open neighborhood of $z_2^0$ with radius $1/n$, where $z_2^0\in \Delta$ is arbitrary.
For large positive $l$, let us define $E_l := \{z_2 \in A : \sup_{z_1\in \Delta} |f(z_1,z_2)|\le l\}$. ...... Thus $E_l$ is closed.
...... $\bigcup_l  E_l=A$. Thus, Baire's theorem ...... that $E_l$ has non-empty interior for large $l$. ......$f$ is holomorphic in $\Delta\times\stackrel{\circ}E_l$.  (Notice that $\stackrel{\circ}E_l$ is contained in $|z_2-z_2^0|<1/n$.)
Let $B=\bigcup_{z_2^0\in \Delta, n\in \mathbb{N}} \stackrel{\circ}E_l$, then  $f$ is holomorphic in $\Delta\times B$.
 By its construction $B$ is dence in $\Delta$ since $z_2^0$ is arbitrary and $\stackrel{\circ}E_l$ is contained in a neighborhood of $z_2^0$ with radius $1/n$.
$\Delta\times B$ contains a horizontal strip $\Delta\times\Delta_{z_2^0,r}$ arbitrary close to $z_2=0$ since there is an $\stackrel{\circ}E_l(\supset\Delta_{z_2^0,r}) $ arbitrary close to $z_2=0$.


text:
Q: Javascript - Utilização do reduce Boa tarde, pessoal! Tudo bem com vocês? Espero que sim.
Estou começando meus estudos em Java Script, porém estou com dificuldade para implementar uma função usando o reduce.
O código é o seguinte:
const cartasFrete = []

const sequencia = {
    _id: 0,
    get id() { return this._id++}
}

/*const getCartaFrete = (id) => {
    const aux = cartasFrete.filter((cartaFrete) => {
        return cartaFrete.id === id
    })
    return aux[0]
}
*/

const criarCartaFrete = (local, destino, valorFrete,porcentagem) => {
    return {
        id: sequencia.id,
        local: local,
        destino: destino,
        valorFrete: valorFrete,
        porcentagem: porcentagem,
        getValorFrete() {
            return this.valorFrete
        },

        getPorcentagem() {
            return this.porcentagem
        },
        getInformacoes() {
            return `
            Local: ${this.local}
            Destino: ${this.destino}
            Valor do Frete: ${this.valorFrete}
            Porcentagem: ${this.porcentagem * 100}
            `

        }
    }
}

const salvarCartaFrete = (...cartaFrete) => {
    cartaFrete.forEach((valor,indice) =>{
        cartasFrete[indice] = valor
    })
}

// ------------------------------------------------------ ## --------------------------------------------------//

let valoresCartas = []

const calcularCarta = (idCartaFrete, peso) => {
    const valorCarta = cartasFrete[idCartaFrete].getValorFrete()
    const valorTotal = valorCarta * peso
    const valorAbastecimento = valorTotal * cartasFrete[idCartaFrete].getPorcentagem()
    const valorTroco = valorTotal - valorAbastecimento
    return {
        total: valorTotal,
        troco: valorTroco,
        abastecimento: valorAbastecimento
    }

}

 const salvarCalculos = (...calculos) => {
    calculos.forEach((valor,indice) =>{
        valoresCartas[indice] = valor
    })
}

const calcularTodasCartas = (array) => {
    let valorGeral = array.reduce((acumulador,atual)=>{
        return acumulador + atual.total
    })
    return valorGeral
}

// ------------------------------------------------------ ## --------------------------------------------------//

salvarCartaFrete(
    criarCartaFrete('PMI','PEMA', 10.5, 0.5),
    criarCartaFrete('PMI','FILIAL', 14, 0.5),
    criarCartaFrete('SARZEDO','VDL', 22, 0.4)
)

salvarCalculos(
    calcularCarta(0,22),
    calcularCarta(1, 18),
    calcularCarta(2, 17)
)

console.log(valoresCartas)
console.log(calcularTodasCartas(valoresCartas))

O código funciona direitinho, até eu usar a função "calcularTodasCartas" .
A ideia desta função é somar os valores de todas as Cartas frentes dentro do array "valores Cartas".
Exemplo:
Neste código ele gera o seguinte array de objetos:
[ { total: 231, troco: 115.5, abastecimento: 115.5 },
  { total: 252, troco: 126, abastecimento: 126 },
  { total: 374, troco: 224.4, abastecimento: 149.6 } ]

Quero pegar os valores das chaves "total" de todas as posições do array e somar e retornar o valor acumulado,
pegar os valores das chaves "troco"  e somar voltar o valor acumulado, pegar os valores do abastecimento e somar e voltar acumulado.
Exemplo:
Total: 231 + 252 + 374 = 857
Seguindo essa lógica, escrevi o seguinte código:
const calcularTodasCartas = (array) => {
        let valorGeral = array.reduce((acumulador,atual)=>{
            return acumulador + atual.total
        })
        return valorGeral
    }

Mas o resultado é o seguinte:
[object Object]252374

Poderiam me dar uma luz?
Muito obrigado!

A: Resposta
Faltou você setar o valor inicial para 0:

let array = [
  { total: 231, troco: 115.5, abastecimento: 115.5 },
  { total: 252, troco: 126, abastecimento: 126 },
  { total: 374, troco: 224.4, abastecimento: 149.6 }
]

const calcularTodasCartas = (array) => {
    let valorGeral = array.reduce((acumulador, atual)=>{
        return acumulador + atual.total
    }, 0) // faltou setar o valor inicial
    return valorGeral;
}

console.log(calcularTodasCartas(array));

Assim, na primeira vez que rodar, ele irá fazer (0 + { total: 231}), o que resulta em 0 + 287, depois (287 + { total: 252 }), o que resulta em 287 + 252, na terceira vez 539 + { total: 374 }, o que resulta em 539 + 374, e por aí vai.
O que deu errado?
Do jeito anterior, você estava somando um objeto, no caso o acumulador com a o valor da propriedade atual.total, por isso dava aquele resultando com [object Object], ao setar o valor inicial para 0, o acumulador, passar a ser 0, como você pode ver no exemplo abaixo:

let array = [
  { total: 231, troco: 115.5, abastecimento: 115.5 },
  { total: 252, troco: 126, abastecimento: 126 },
  { total: 374, troco: 224.4, abastecimento: 149.6 }
]

// EXEMPLO SEM VALOR INICIAL
const calcularTodasCartasSemValorInicial = (array) => {
    let valorGeral = array.reduce((acumulador, atual)=>{
        console.log(acumulador);
        return acumulador + atual.total
    })
    return valorGeral;
}

// EXEMPLO COM VALOR INICIAL
const calcularTodasCartasComValorInicial = (array) => {
    let valorGeral = array.reduce((acumulador, atual)=>{
        console.log(acumulador);
        return acumulador + atual.total
    }, 0)
    return valorGeral;
}

console.log("Sem valor inicial: ", calcularTodasCartasSemValorInicial(array));
console.log("Com valor inicial: ", calcularTodasCartasComValorInicial(array));


text:
Q: Handle searchview results in other activity I'm trying to handle the text you write in a searchview in other activity. I'm testing with print the result but nothing happens. No print, no errors... My code is,
mainlayout:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context="xxx.xxx.xxx.MainActivity">

<android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/AppTheme.AppBarOverlay">

<include android:id="@+id/appbar"
    layout="@layout/toolbar" />

</android.support.design.widget.AppBarLayout>

</android.support.design.widget.CoordinatorLayout>

toolbar:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    android:minHeight="?attr/actionBarSize"
    android:background="?attr/colorPrimary"
    android:elevation="4dp"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light" >
</android.support.v7.widget.Toolbar>

searchmenu:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

<item android:id="@+id/action_search"
    android:title="Search"
    android:icon="@android:drawable/ic_menu_search"
    app:actionViewClass="android.support.v7.widget.SearchView"
    app:showAsAction="ifRoom|collapseActionView" />
</menu>

MainActivity:
public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main_layout);

        Toolbar toolbar = (Toolbar) findViewById(R.id.appbar);
        setSupportActionBar(toolbar);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.search_menu, menu);

        SearchManager searchManager =
            (SearchManager) getSystemService(Context.SEARCH_SERVICE);
        SearchView searchView = (SearchView)menu.findItem(R.id.action_search).getActionView();
        searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));

        return true;
    }
}

ResultsActivity for handle the results:
public class ResultActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.resultsong_layout);
        Toolbar toolbar = (Toolbar) findViewById(R.id.appbar);
        setSupportActionBar(toolbar);
        handleIntent(getIntent());
    }

    @Override
    protected void onNewIntent(Intent intent) {
        handleIntent(intent);
    }

    private void handleIntent(Intent intent) {

        if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
            String query = intent.getStringExtra(SearchManager.QUERY);
            System.out.println(query);
        }
    }
}

And AndroidManifest:
<activity android:name=".MainActivity">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER"/>
    </intent-filter>
</activity>
<activity android:name=".ResultActivity">
    <intent-filter>
        <action android:name="android.intent.action.SEARCH" />
    </intent-filter>
    <meta-data android:name="android.app.searchable"
        android:resource="@xml/searchable"/>
</activity>


text:
Q: PHP - Is this a good method to prevent re-submission? This is related to preventing webform resubmission, however this time the context is a web-based RPG. After the player defeats a monster, it would drop an item. So I would want to prevent the user from hitting the back button, or keep refreshing, to 'dupe' the item-drop.
As item drop is frequent, using a DB to store a unique 'drop-transaction-id' seems infeasible to me. I am entertaining an idea below:

*

*For each combat, creating an unique value based on the current date-time, user's id and store it into DB and session. It is possible that given a userid, you can fetch the value back

*If the value from session exists in the DB, then the 'combat' is valid and allow the user to access all pages relevant to combat. If it does not exist in DB, then a new combat state is started

*When combat is over, the unique value is cleared from DB.

*Values which is 30mins old in the DB are purged.
Any opinions, improvements, or pitfalls to this method are welcomed

A: This question is very subjective, there's things you can do or can not do, depending on the already existing data / framework around it.
The solution you've provided should work, but it depends on the unique combat/loot/user data you have available.
I take it this is what you think is best? It's what I think is best :)

*

*Get the userID, along with a unique piece of data from that fight. Something like combat start time, combat end time, etc

*Store it in a Database, or what ever storage system you have

*Once you collect the loot, delete that record

That way if the that userID, and that unique fight data exists, they haven't got their loot.
And you are right; tracking each piece of loot is too much, you're better off temporarily storing the data.

A: Seems like a reasonable approach. I assume you're storing the fact that the player is in combat somewhere anyway. Otherwise, they can just close their browser if they want to avoid a fight?
The combat ending and loot dropping should be treated as an atomary operation. If there is no fight, there can't be any dropping loot.

A: That depends on your game design: Do you go more in the direction of roguelikes where only turns count, and therefore long pauses in between moves are definitely possible (like consulting other people via chatroom, note: in NetHack that is not considered cheating)? Can users only save their games on certain points or at any place? That makes a huge difference in the design, e.g. making way for exploits similar to the one Thorarin mentions.
If your game goes the traditional roguelike route of only one save, turn basement and permadeath, then it would be possible to save the number of the current turn for any given character along with any game related information (inventory, maps, enemies and their state), and then check against that at any action of the player, therefore to prevent playing the turn twice.

A: Alternatively you could bundle everything up in client side javascript, so that even if they did resubmit the form it would generate an entirely new combat/treasure encounter.


text:
Q: Creating a BarChart with scala.js I am trying to create a Bar Chart using scala-js-d3.
The problem is that in the title there is no and only the underline is visible. Bars have no text at all.
The BarChart is rendered and there are no problems in the console of Developer Tools.
Here is a sample of the code used:
val graphHeight = 450

    //The width of each bar.
    val barWidth = 80

    //The distance between each bar.
    val barSeparation = 10

    //The actual horizontal distance from drawing one bar rectangle to drawing the next.
    val horizontalBarDistance = barWidth + barSeparation

    //The value to multiply each bar's value by to get its height.
    val barHeightMultiplier = graphHeight / maxData;

    //Color for start
    val color = d3.rgb("DarkSlateBlue")

    //val my_data = js.Array(8, 22, 31, 36, 48, 17, 25)

    val rectXFun = (d: Int, i: Int) => i * horizontalBarDistance
    val rectYFun = (d: Int) => graphHeight - d * barHeightMultiplier

    val rectXFun2 = (d: Int, i: Int) => i * horizontalBarDistance +5
    val rectYFun2 = (d: Int) => graphHeight - d * barHeightMultiplier +15
    val rectHeightFun = (d: Int) => d * barHeightMultiplier
    val rectColorFun = (d: Int, i: Int) => color.brighter(i * 0.5).toString
    val remove_element = d3.select("#"+currContainer).select("svg").remove()
    val svg = d3.select("#"+currContainer).append("svg").attr("width", "100%").attr("height", "450px")
    val sel = svg.selectAll("rect").data(my_data)
    val data_enter = sel.enter()
    val sel2 = data_enter
      .append("rect")
      .attr("x", rectXFun)
      .attr("y", rectYFun)
      .attr("width", barWidth)
      .attr("height", rectHeightFun)
      .style("fill", rectColorFun)
    //.style("fill", "black")

      val textXOffset = horizontalBarDistance / 2 - 12
      val textYOffset = 20
      val textYPosition = graphHeight + textYOffset;

      //Draw the text.
      data_enter.append("text").text((d: Int) => d.toString)
      .attr("x", (d: Int,i: Int) => i * horizontalBarDistance + textXOffset)
      .attr("y", textYPosition)
      .style("text-decoration", "underline")
      .style("fill","black")
      .style("font-size", "16px")

      svg.append("text")
      //.attr("x", (width / 2))
      //.attr("y", 0 - (margin.top / 2))
      .text("Graph Title")
      .attr("text-anchor", "middle")
      .style("font-size", "16px")
      .style("text-decoration", "underline")
      .style("fill","blue")
      .style("color","blue")

A: I had to create the axis for the example to work.


text:
Q: Point in opengis Polygon I have a given opengis-Polygon (org.opengis.geometry.coordinate.Polygon) and I need a method to determine whether a given point is within the area that that Polygon spans up. Up until now I used: polygon.getBoundary().getMbRegion().contains(point). That works fine as long as the polygon is not "tilted" because it checks the max and min latitudes and longitudes and compares them to the point's coordinates. polygon.getSurface() which I would use intuitively returns null for me and polygon.getBoundary() otherwise just gives me access to the points on the boundary of the polygon. Another thing I thought of trying was implementing the Ray casting algorithm. But to implement that I did not yet find the possibility to create rays in opengis/GeoTools.
Thanks for any answers in advance!

A: Alright for anyone who stumbles upon this problem again, I solved the issue by implementing the algorithm proposed in this answer.


text:
Q: MySQL replication between main server and on-location laptops We are a company that offers time tracking at all sorts of sport events. To store these timing results, we use laptops with a MySQL server, containing the timing data.
In the current situation we get a local copy of the master (the main server, running behind our website) just before we drive to the event, and submit these changes back to the master server after the event.
In the near future we would like implement live tracking on our website, and get user profile changes (users can change the time of their batch just before the batch starts) to the on-location machines.
An events exists of multiple batches (start times). A user subscribes to a certain batch, but sometimes when they are in traffic eg, they like to changes their batch to a later one.
So we need two way synchronisation, since data get updates on both our main server and our on-location machines.
On most events we have internet access. If we don't, I'd like to have the synchronisation working as soon as the connection gets online again.
I already found out about MySQL master-master replication. This looks pretty good, however I'm not feeling 100% satisfied.
Are there any suggestions how to setup such an environment? All suggestions are very welcome!

A: Multi-Master replication is best in environments where the databases are always connected. This reduces the chance of conflicts. Multi-master replication does not have any automatic conflict resolution, which can lead to incorrect data if there is any latency between the two masters.
Multi-master replication is generally used to provide redundancy. If one master fails, all writes can failover to the other.
With multi-master replication, if you allow updates on both masters when there is latency between the servers (not connected or slow connection), you can have data conflicts, which can lead to incorrect or unexpected data.
Multi-master replication wasn't designed for offline distributed database synchronization, but it can be used in this situation if you have a strategy to avoid data conflicts.
To avoid conflicts entirely, allow updates to only one database at a time.
You could design the website to detect whether replication is active with the local database, and if it is, allow changes on the web site only, which then replicates to the local database.
If there is no Internet connection and replication, require users to update the data at the event, on the local database. Once you go back online or reestablish the connection, you can then replicate back to the website database.
Since data for different events won't conflict, this won't prevent your website from remaining in operation for upcoming events while you restrict updates on the website for ongoing events.
Regarding time tracking data, since that won't be updated on the website at all, you don't have to worry about conflicts. You can replicate that data to the website master any time you want.


text:
Q: Company mail configuration in iPad? I need to configure my company email to iPad. Following is screen shot of the manual for mail configuration which company mailed to me. I tried giving incoming mail server as specified but it didn't work . Where will i add port no? i didn't come across it while configuring. Whenever i try they send me an error "would you like to configure with out using SSL?" Any method for knowing incoming and outgoing server?
Screen shot :

7.Give Incoming server as 10.0.4.24 and Port as 50110

8.Give Login ID(if different from e-mil address)as SR NO

9.Give Outgoing server as 10.0.4.24 and Port as 25
Click Next

A: The configuration totally depends on the email server details. If your admin has emailed you these settings trust that they will be complete. The settings you have in the screenshot above would be meant for an office computer residing inside the company office.
The problem why you cannot connect to the email server would be because the IP addresses are internal (10.0.0.x). This means that you need to be connected to the company network to access the email server with these details. This leaves you with a few different solutions:

*

*On an iPad this would mean that you would need to be connected to the company wifi whilst attempting to fetch your email. You would need to sit inside your office and connect.

*Ask your admin for VPN access, and through your iPad iOS settings enable the VPN access. This creates a virtual tunnel over the internet wherever you are directly to the company internal network, making the iPad believe that it is accessing the company network directly. You can then use the email settings as per your screenshot to connect.

*Ask your admin for the public IP addresses to the email server and use them for your email seetings instead. (example: 212.120.243.xxx)

Hope you find the solution you need. Good luck!


text:
Q: Project ERROR: Unknown module(s) in QT: websockets I'm trying to run a simple client example using QTWebsockets using Qt Creator, already add the
QT       += websockets

But it throws this when i run build or qmake
:-1: error: Unknown module(s) in QT: websockets

I tried
QT       += core websockets

Then realized that since installed Qt Creator from the repositories it wasn't up to date, so I reinstalled it from the Qt website but the problem persisted, I then ran pkg-config --modversion QtCore and it returns 4.8.6, thing is, in the QT version tab of qt creator it shows 5.4.1 to GCC compiler which is the compiler I'm using, in /opt/Qt/5.4/gcc_64/lib there is the QT5WebSockets module even in the help tab are listed the QT5 modules but I can't use them.
Tried with SerialPort and it didn't work, tried with Opengl and it worked which means is a version problem but I can't seem to find how to solve.

A: sudo apt-get install libqt5websockets5-dev

A: I solved it, the problem was that I just opened the project I made with qt4, when I tried to build it in the freshly installed qt creator the .pro.user file kept pointing to all qt4.
Solution, create a new project and add the source from the first, or change all the references from qt4 to qt5.

A: sudo zypper install libqt5-qtwebsockets-devel


text:
Q: Start a Command Prompt and then change the title of it via batch file? I'm trying to start a command prompt via a batch file, echo some text, and change the title of the command prompt. I'm trying:
start cmd
/k echo This is a terminal
/k title Terminal

The echo text displays, but not the title text.

A: The TITLE command works for me.
start cmd
TITLE Test
PAUSE

Edit: I believe the syntax for /k is
cmd /k "TITLE Test"

A: Silly me, I've found what I needed.
Doing
start "title here"

will do a title for the wanted program. From there, it is just
start "Terminal" cmd /k echo This is a terminal

If you want to run multiple echos / other commands, do
start "Terminal" cmd /k "echo this is one echo command & echo this is another"

where you separate each command input with &

A: You could use the following:
start cmd /k "echo this is a terminal & title Terminal"

The ampersand allows you to put multiple commands on one command line - see Command shell overview.

A: I recommend using start "Terminal Name Here" C:\Windows\system32\cmd.exe because it only opens 1 window while start "Terminal" cmd /k echo This is a terminal will keep opening windows over and over again until it is forced to stop IF you name it cmd.cmd or cmd.bat.


text:
Q: Second website on subfolder doesn't work: how to debug? I want to create secondary website to be accessed in a subfolder. My base magento installation folder is in domain's root http://mydomain.com/. I am setting up secondary website in http://mydomain.com/ws2/.
I have created the secondary website in Magento Admin, given the code ws2 and set unsecure and secure base urls to http://mydomain.com/ws2/.
Since I am on a shared hosting, and I don't have access to apache configuration, I have followed this tutorial with Step 2- Method 1 Separate Directories for Each Store.
Essentially, I have created a new folder, copied there index.php and .htaccess. I have created the symlinks pointing at the app, include, js, lib, media, skin, var folders of the root installation.
I have edited index.php in ws2 folder, changing last line to:
Mage::run('ws2', 'website');

Unfortunately, when I access the url http://mydomain.com/ws2/, I get 404 Page Not Found error.
Have I made a big mistake? If no, how can I debug this?

A: If 404 Error is generated by Magento, it means that everything is fine.
Just magento's home page is cms page and by default is configured to be displayed on default website.
Go to admin section to CMS->Pages and edit "Home" page to be displayed on all websites. Or create one more home page which will be displayed only on your new website.


text:
Q: Configuring Vim/Neovim ALE plugin to support :ALEGoToDefinition in JavaScript files I installed the ALE plugin for Vim using vim-plug:
Plug 'dense-analysis/ale'

The plugin seems to have been installed correctly. I can use ALE to automatically format files with Prettier, for example. But I can't seem to get anything that uses the language server to work.
For example, in the following JavaScript file, putting my cursor over the name add on line 5 and using the :ALEGoToDefinition command has no effect.
function add(x, y) {
  return x + y;
}

console.log(add(1, 2));

I have really made an effort to read the documentation. The ALE help file says that "ALE will do nothing" if an LSP server does not provide a location to jump to. That seems to be my problem. But the ALE documentation on GitHub also says that "ALE integrates with almost all JavaScript tools very well, and most things should work without requiring any configuration."
I must be missing something. Aside from installing ALE, is anything needed to enable features which use a language server? Should I install some kind of language server globally on my machine?

A: User toupeira on Reddit answered this question for me. At the time of this writing, the only JavaScript language server that ALE supports is tsserver. It ships with TypeScript. To enable ALE's language server features, I needed to install the typescript package globally.
npm install -g typescript

I don't need to start the server manually. ALE seems to take care of that.
The only other requirement is that tsserver is enabled as a JavaScript "linter." It is by default. Run :ALEInfo to see which linters are enabled for the current file.


text:
Q: Almost sure convergence of $\hat{\sigma^2}$ Let $Y \sim N(X\beta,\sigma^2I)$ where $Rank(X_{n\times p})=p \leq n$. The least square estimate of $\sigma^2$ is $\hat{\sigma^2}=\frac{Y'(I-P)Y}{n-p}$ where $P=X(X'X)^{-1}X'$ is the projection matrix onto $C(X)$. Now by Chebyshev's inequality it's easy to show $\hat{\sigma^2}\xrightarrow[]{P}\sigma^2$. But how do I show
Question: $\hat{\sigma^2}\xrightarrow[]{a.s.}\sigma^2$?
My approach: $Z=(I-P)Y \sim N(0,\sigma^2(I-P))$
$\hat{\sigma^2}=\frac{Z'Z}{n-p}=\frac{n}{n-p}\frac{\sum Z_i^2}{n}$. Although $\frac{n}{n-p} \rightarrow 1$ but I can't apply SLLN as $Z_i$'s are not $i.i.d$ which is where I am stuck at.
Further question: If we drop normality assumption can we claim the above (i.e. a.s. convergence or in probability convergence)?

A: The model is given by
$$
y_i=X_i^{\top}\beta_0+\epsilon_i.
$$
Denote $e:=(Y-X\hat \beta)=(I-P)Y=(I-P)(X\beta_0+\epsilon)=(I-P)\epsilon$. Then
$$
\hat{\sigma}^2=\frac{e^{\top}e}{n-p}=\frac{\epsilon^{\top}(I-P)\epsilon}{n-p}=\frac{n}{n-p}\left[\frac{\epsilon^{\top}\epsilon}{n}-\frac{\epsilon^{\top}X}{n}\left(\frac{X^{\top}X}{n} \right)^{-1}\frac{X^{\top}\epsilon}{n} \right].
$$
You don't need distributional assumptions to show that $\hat{\sigma}^2=\sigma^2+o_{a.s}(1)$. You need to impose appropriate assumptions on the moments of $\epsilon_i$ and $X_i$ in order to use one of the SLLNs. Then
\begin{align}
\hat{\sigma}^2&=\frac{n}{n-p}\left[\frac{1}{n}\sum \epsilon_i^2-\frac{1}{n}\sum(\epsilon_iX_i^{\top}) \left(\frac{1}{n}\sum (X_iX_i^{\top}) \right)^{-1}\frac{1}{n}\sum(X_i\epsilon_i) \right] \\
&=(1+o(1))\left[(\sigma^2+o_{a.s.}(1))-o_{a.s.}(1)O_{a.s.}(1)o_{a.s.}(1)\right] \\[0.8em]
&=\sigma^2+o_{a.s.}(1).
\end{align}
For example, if $(X_i,\epsilon_i)$ are i.i.d., it suffices to assume that $\mathsf{E}\epsilon_i^2<\infty$ and $\mathsf{E}X_{i,j}^2<\infty$ for $j=1,\dots,p$ (also $\mathsf{E}[X_iX_i^{\top}]$ must be invertible).


text:
Q: Cannot find the class file for org.springframework.beans.factory.annotation.Autowire I'm trying to move my project to Spring Boot 1.4.1.RELEASE and can't compile the source code with a following error:
The project was not built since its build path is incomplete. Cannot find the class file for org.springframework.beans.factory.annotation.Autowire. Fix the build path then try building this project

The type org.springframework.beans.factory.annotation.Autowire cannot be resolved. It is indirectly referenced from required .class files

Where org.springframework.beans.factory.annotation.Autowire can be found ?
UPDATED
I use Maven in order to build the project:
parent pom:
<?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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.example</groupId>
    <artifactId>example</artifactId>
    <version>0.0.1</version>
    <packaging>pom</packaging>

    <name>Own Pleasure</name>

    <properties>
        <springframework.boot.version>1.4.1.RELEASE</springframework.boot.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.source.version>1.8</java.source.version>
        <java.target.version>1.8</java.target.version>
    </properties>

    <repositories>
        <repository>
            <id>spring-snapshots</id>
            <name>Spring Snapshots</name>
            <url>https://repo.spring.io/libs-snapshot</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-commons</artifactId>
            <version>1.12.1.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-jpa</artifactId>
            <version>1.10.2.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-parent</artifactId>
                <version>${springframework.boot.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

    <modules>
        <module>common</module>
        <module>api</module>
        <module>dashboard</module>
    </modules>
</project>

common pom:
<?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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <artifactId>example</artifactId>
        <groupId>com.example</groupId>
        <version>0.0.1</version>
    </parent>

    <artifactId>common</artifactId>
    <packaging>jar</packaging>

    <properties>
        <hibernate-jpa.version>1.0.0.Final</hibernate-jpa.version>
        <querydsl.version>4.1.4</querydsl.version>
        <commons-lang3.version>3.5</commons-lang3.version>
        <commons-collections4.version>4.1</commons-collections4.version>
        <togglz.version>2.3.0.Final</togglz.version>
        <UserAgentUtils.version>1.20</UserAgentUtils.version>
        <imgscalr-lib.version>4.2</imgscalr-lib.version>

        <apt-maven-plugin.version>1.1.3</apt-maven-plugin.version>
        <maven-resources-plugin.version>2.5</maven-resources-plugin.version>
    </properties>

    <dependencies>
        <!-- Hibernate -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.hibernate.javax.persistence</groupId>
            <artifactId>hibernate-jpa-2.1-api</artifactId>
            <version>${hibernate-jpa.version}</version>
        </dependency>

        <!-- Apache Commons -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-dbcp2</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-collections4</artifactId>
            <version>${commons-collections4.version}</version>
        </dependency>

        <!-- Liquibase -->
        <dependency>
            <groupId>org.liquibase</groupId>
            <artifactId>liquibase-core</artifactId>
        </dependency>

        <!-- PostgreSQL -->
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
        </dependency>

        <!-- Spring -->
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
        </dependency>

        <!-- Spring Boot -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.security.oauth</groupId>
            <artifactId>spring-security-oauth2</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>

        <!-- QueryDSL -->
        <dependency>
            <groupId>com.querydsl</groupId>
            <artifactId>querydsl-apt</artifactId>
        </dependency>
        <dependency>
            <groupId>com.querydsl</groupId>
            <artifactId>querydsl-jpa</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>eu.bitwalker</groupId>
            <artifactId>UserAgentUtils</artifactId>
            <version>${UserAgentUtils.version}</version>
        </dependency>

        <!-- Togglz -->
        <dependency>
            <groupId>org.togglz</groupId>
            <artifactId>togglz-spring-web</artifactId>
            <version>${togglz.version}</version>
        </dependency>
        <dependency>
            <groupId>org.togglz</groupId>
            <artifactId>togglz-spring-security</artifactId>
            <version>${togglz.version}</version>
        </dependency>

        <!-- Joda time -->
        <dependency>
            <groupId>joda-time</groupId>
            <artifactId>joda-time</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>${commons-lang3.version}</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.imgscalr/imgscalr-lib -->
        <dependency>
            <groupId>org.imgscalr</groupId>
            <artifactId>imgscalr-lib</artifactId>
            <version>${imgscalr-lib.version}</version>
        </dependency>

    </dependencies>

    <build>

        <resources>
            <resource>
                <directory>${project.basedir}/src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
            <resource>
                <directory>${project.build.directory}/generated-resources</directory>
            </resource>
        </resources>

        <testResources>
            <testResource>
                <directory>${project.basedir}/src/test/resources</directory>
                <filtering>true</filtering>
            </testResource>
        </testResources>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>${java.source.version}</source>
                    <target>${java.target.version}</target>
                    <optimize>true</optimize>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <encoding>${project.build.sourceEncoding}</encoding>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>${java.source.version}</source>
                    <target>${java.target.version}</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>com.mysema.maven</groupId>
                <artifactId>apt-maven-plugin</artifactId>
                <version>${apt-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>process</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>target/generated-sources/java</outputDirectory>
                            <processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
                            <options>
                                <querydsl.entityAccessors>true</querydsl.entityAccessors>
                                <querydsl.useFields>true</querydsl.useFields>
                            </options>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>${maven-resources-plugin.version}</version>
                <configuration>
                    <encoding>UTF-8</encoding>
                    <nonFilteredFileExtensions>
                        <nonFilteredFileExtension>ttf</nonFilteredFileExtension>
                    </nonFilteredFileExtensions>
                </configuration>
            </plugin>
        </plugins>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <executions>
                        <execution>
                            <phase>generate-sources</phase>
                            <goals>
                                <goal>add-source</goal>
                            </goals>
                            <configuration>
                                <sources>
                                    <source>target/generated-sources/java</source>
                                </sources>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>

    </build>
</project>

A: Very strange issue... I have removed my Maven repository and re-downloaded it once again.. and the issue is gone

A: Read the Error, classpath is wrong.


text:
Q: linux distro for ase sybase? I am currently configuring a vm on using vagrant and need to set up ase sybase. I have had no luck with ubuntu 12.0.4 LTS as the glibc are not compatible.
The available vm linux distros that I have available are listed on this url:
http://www.vagrantbox.es/

there is no red-hat distro, but a scientific linux 6 distro.
Could someone tell me out of the list what my best chances of getting ase sybase to run.
The version of ase sybase I am trying to use is found here :
http://www.sybase.com/linux

A: CentOS is the free version of Red Hat, so I would suggest trying that.

A: In January 2011, I managed to install and use Sybase ASE on Fedora 14.
You could try the distro Fedora 17. Let us know if it works.


text:
Q: Two strings and unicodes that are exactly the same do not return true when evaluated with each other This makes no sense to me. The ultimate goal of what I need to do is break down a very long string into respective words and compare each word with something.. I am only posting a snippet of the total output not to overwhelm and clutter this post with unnecessary data.
I created a simple setup to compare if these two 'words' are the same. In raw form they come out as unicode, but evaluating them as unicode or converting them to string does not return True.. here is a sample output
u'altmer'/<type 'unicode'> | u'altmer'<type 'unicode'> | False

Here is the code that compares the two.
ch.msg("%r/%r | %r%r | %s" % (color_entrytxt_list[index].lower(),
                              type(color_entrytxt_list[index].lower()),
                              entry,
                              type(entry),
                              "True" if color_entrytxt_list[index].lower() == entry.lower() else "False"))

* note I have also tried is instead of '=='
** I have also tried converting each unicode to string via str(unicode)

I don't understand why this is evaluating to false?
EDIT:
Thank you everyone for helping with this question. As mentioned by a few folks, the problem actually did reside that the two strings were not structurally the same, the problem was some characters weren't outputted to the screen.

A: You need to use == to check for equality instead of is which checks if they occupy the same memory location.
s1 = 'abc' * 10000
s2 = 'abc' * 10000

>>> id(s1)
4480540672

>>> id(s2)
4480570880

>>> s1 is s2
False

>>> s1 == s2
True

If the string is short enough, they will use the same memory location.  Once it gets larger, however, they will each get there own.


text:
Q: how to get the count of elements within a dynamically generated DOM object within a form I have a section that allows the user to build out a search query. Within the options the user has the ability to select different operators ( contains, does not contain, like, between).
When the user selects between I insert a new input field after the drop down menu which would server as a to from field see image:

The issue I am having is how I am testing for the existence of the field. Currently I am doing this  based upon the value of the object.  This approach does not work if the field was not originally set to between.  I.E if it is on contains and I select like the field is removed.
I think I need to  count the number of text input fields in the current div and then if the number is greater than 2 remove one otherwise do nothing.
Where I am stuck is in the ability to count the input elements for the current div
I have tried:
var cnt = $(this, 'div .operClass input:text').length;

but this counts all inputs in the form vs the current row.
Can anyone point me in the right direction on when an option is selected to count and return the number of input fields for the current div that the selector is inside?
Thanks in advance,
jscript
$(document).ready(function () {
            $('#add').click(function () {
                InsertFields();
            });
            //insert first row
            function InsertFields() {
                $("
<select name='condition'><option value='AND'>AND</option><option value='OR'>OR</option></select><input type='text' name='fieldname' id='fieldName' size='20' /><select name='operator'class='operClass'><option id='opt1' value='CONTAINS'>Contains</option><option id='opt2' value='DOES NOT CONTAIN'>Does Not Contain</option><option id='opt3' value='LIKE'>Like</option><option id='opt4' value='BETWEEN'>Between</option></select><input type='text' name='fieldValue1' id='fieldvalue1' value='' size='20' /> <input type='button' id='newAdd' value='Add' /> <input type='button' id='btnRemove' value='Remove' />
").appendTo('#queryFields');
            }
            //add additional row
            //used second funciton to reset bindings
            $('#newAdd').live('click', function () {
                $("
<select name='condition'><option value='AND'>AND</option><option value='OR'>OR</option></select><input type='text' name='fieldname' id='fieldName' size='20' /><select id='newOperator' name='operator' class='operClass'><option id='opt1' value='CONTAINS'>Contains</option><option id='opt2' value='DOES NOT CONTAIN'>Does Not Contain</option><option id='opt3' value='LIKE'>Like</option><option id='opt4' value='BETWEEN'>Between</option></select><input type='text' name='fieldValue1' id='fieldvalue1' value='' size='20' /> <input type='button' id='newAdd' value='Add' /> <input type='button' id='btnRemove' value='Remove' />
").appendTo('#queryFields');
            });
            //remove row
            $('#btnRemove').live('click', function () {
                $(this).parent().remove();
            });

            $('.operClass').change(function () {
                var foo = $('.operClass option:selected').val();
                alert(foo);
            });

            $('select').live('change', '.operClass', function () {
                var sb = $(this, '.operClass option:selected').val();
                var ci = $(this, '.operClass');
                insertFromField(sb, ci);
            });
            //insert field after between option or remove it if it exists
            function insertFromField(param1, param2, param3) {

                if (param1 == "BETWEEN") {
                    $("<input type='text' name='fieldValue1' id='fieldvalue1' value='' size='20' />").insertAfter(param2);
                }
                else {
                //need to test count of existing input fields for the current row here if n > 1 remove the second field else do nothing.
                    $(param2).next().remove();
                }
            }
        });

html

            <select name="condition">
                <option value="AND">AND</option>
                <option value="OR">OR</option>
            </select>
            <input type="text" name="fieldname" id="fieldName" size="20" />
            <select  name="operator">
                <option id="opt1" value="CONTAINS">Contains</option>
                <option id="opt2" value="DOES NOT CONTAIN">Does Not Contain</option>
                <option id="opt3" value="LIKE">Like</option>
                <option id="opt4" value="BETWEEN">Between</option>
            </select>
            <input type="text" name="fieldValue1" id="fieldvalue1" value="" size="20" />
            <input type="button" id="add" value="Add" />

A: You can do this
var $selector = $(this); /* Assuming the selector is `this` */
var count = $selector.siblings("input:text").length;

No extra classes needed.
If you only want to match text inputs AFTER the select, you can use:
$selector.nextAll("input:text").length;

This won't match the first text input before each select.

A: Add a class to your input field based on the row number, and then use
Basically add a class number here and increment it for each new row.

<select name="condition">
<option value="AND">AND</option>
<option value="OR">OR</option>
</select>
<input type="text" class="classname" name="fieldname" id="fieldName" size="20" />
<select  name="operator">
<option id="opt1" value="CONTAINS">Contains</option>
<option id="opt2" value="DOES NOT CONTAIN">Does Not Contain</option>
<option id="opt3" value="LIKE">Like</option>
<option id="opt4" value="BETWEEN">Between</option>
</select>
<input type="text" class="classname" name="fieldValue1" id="fieldvalue1" value="" size="20" />
<input type="button" id="add" value="Add" />

jQuery
var cnt = $('div .operClass .row-1 input.classname').length;

This will give you count of 2 in this row.


text:
Q: Does a photon's wavelength (and energy) change when reflecting off a mirror? The momentum of a photon is $\ p=E/c.$
When a photon reflects off a mirror, it is elastic scattering. Elastic scattering should keep the energy of the photon.
But radiation pressure states, that part of the momentum of the photon will be transferred to the mirror, this is how the photon exerts pressure on the mirror.
Now if $\ p=E/c\ $ and the momentum of the photon changes (part of it gets transferred to the mirror), and the momentum of the photon depends on the wavelength $\ p = h/\lambda$.
https://en.wikipedia.org/wiki/Radiation_pressure

Elastic scattering is a form of particle scattering in scattering theory, nuclear physics and particle physics. In this process, the kinetic energy of a particle is conserved in the center-of-mass frame, but its direction of propagation is modified (by interaction with other particles and/or potentials). Furthermore, while the particle's kinetic energy in the center-of-mass frame is constant, its energy in the lab frame is not. Generally, elastic scattering describes a process where the total kinetic energy of the system is conserved.

https://en.wikipedia.org/wiki/Elastic_scattering

In Rayleigh scattering a photon penetrates into a medium composed of particles whose sizes are much smaller than the wavelength of the incident photon. In this scattering process, the energy (and therefore the wavelength) of the incident photon is conserved and only its direction is changed. In this case, the scattering intensity is proportional to the fourth power of the reciprocal wavelength of the incident photon.

Now this is a contradiction. How can the energy of the photon be kept, and at the same time how can the photon exert pressure on the mirror, thus losing momentum, and change its wavelength?
$p=E/c$, so the momentum and energy of the photon cannot change without the other. If the photon's energy is kept during elastic scattering (mirror reflection), and the photon still exerts radiation pressure on the mirror, then the photon's momentum has to change (part of it needs to get transferred to the mirror), so the energy needs to change too.
Question:

*

*Does the wavelength of the photon change during elastic scattering (mirror reflection)?

A: The answer is "almost no" - the wavelength of the photon is virtually unchanged (in the initial rest frame of the mirror, the "lab frame").  Because the mirror is much more "massive" than the photon, it serves as a "momentum sink" and picks up almost no energy.
The best way to develop an intuition for this is to consider a collision between two balls: one lighter (with mass $m$) and initially moving (at velocity $v_1$) and one more massive (with mass $M$) and initially at rest.  After scattering, the lighter ball leaves the scene at velocity $v_3$ and the more massive ball leaves the scene at velocity $v_4$.
Set  $v_2 = 0$ in the following worked-out example (see page 3):
https://web.archive.org/web/20181222165457/http://www.its.caltech.edu/~teinav/Lectures/Ph%201a/Lecture%207%20-%202017-10-19.pdf
We obtain $v_3 = \frac{(M-m)v_1}{M+m}$ and $v_4 = \frac{2mv_1}{M+m}$
In the limit that $M >> m$ the fraction of the initial kinetic energy picked up by the massive object goes to zero, but it acquires twice as much momentum (and in the opposite direction) as the lighter object initially had.  Thusly can momentum be transferred but (almost) no energy.
NOTE - In the "center of mass frame" the wavelength will be completely identical, but I believe it is the "lab frame" that supplies the intuition you seek.  In the center of mass frame the momentum just changes sign and your equation should really be $|p| = E/c$, which admits a sign change of $p$ while conserving $E$.  This is why there is a $2$ in the equation for $v_4$ - flipping the sign of momentum imparts double the initial momentum to the mirror.

A: The reflected photons are entirely identical to the incident photons except for the change in direction. The energy lost due to the pressure exerted on the mirror can be accounted for by comparing the number $N_i$ of incident photons to the number $N_r$ of reflected photons. I.e., $N_i > N_r$.

A: If a mirror reflection affected the energy of the photons to a large extent the colors would change, and it would not be a "true mirror"
The fact that the colors do not change for a "true" mirror , means that the interaction of the photons is elastic, i.e no energy is lost in our frame, the lab, reference. Elastic scattering keeps the energy of the photon the same in the center of mass system "Photon + mirror"  Because the mass of the mirror is so very large, the lab frame is also the center of mass for the "photon+mirror" scattering, the tiny  $ΔE$ due to the momentum given to the mirror is not discernible or computable to give a different center of mass frame to the  lab frame.

A: In the consideration of the photon behaving like a particle and reflecting from the surface of the mirror, the momentum is conserved and the wavelength does not change.
From conservation of momentum we know that the total momentum of the photon and the mirror is the same before and after the collision (considering the photon and mirror to be a closed system).  In the simplest of considerations of refelection the quantum of the momentum of the photon is the same, but the direction is different.  Resolving the momentum into two parts, one parallel to the surface of the mirror and one normal to the surface of the mirror then the momentum in the direction normal to the surface is reversed.  To conserve momentum the mirror itself must have a balancing momentum equal and opposite to the change in momentum of the photom in the direction normal to the surface of the mirror.  (You can see this effect in a rotating 'solar windmill' toy left in sunlight on a window sill - the reflective 'sails' reflect light and turn).
I stated above 'in the simplest of considerations' because the process of interaction may not be straight forward.  There are different ways in which the photon and the mirror interact.  For example Compton scattering may occur and that will change the wavelength of the light.  (See https://en.wikipedia.org/wiki/Compton_scattering for more details on Compton Scattering).
So in a simple 'particle' model of reflection momemtum is conserved even though the direction of the photon changes.

A: Even if you assume infinite mass for the mirror, and also assume infinite rigidity for the mirror, an aluminium mirror will only reflect about 90% of the light due to I squared times R loss. this will radiate black body (approx.), in the microwave range, therefore less energy will be available to be reflected. Assuming one photon only, the wave function must collapse and two new photon's will be created. one at microwave freq., and one at slightly lower freq. than the incident photon.