text:
Q: Kivy App immediately crashes on android, stuck in loop The app works perfectly well in windows but on android it will not load on my phone.
I am using a samsung galaxy s3 running android 4.3
I have the phone in developer mode.
I am using the buildozer VM for virtualbox.
Heres the buildozer.spec
[app]

# (str) Title of your application
title = EvenProblems

# (str) Package name
package.name = evenprobs

# (str) Package domain (needed for android/ios packaging)
package.domain = org.test

# (str) Source code where the main.py live
source.dir = .

# (list) Source files to include (let empty to include all the files)
source.include_exts = py,png,jpg,kv,atlas

# (list) List of inclusions using pattern matching
#source.include_patterns = assets/*,images/*.png

# (list) Source files to exclude (let empty to not exclude anything)
#source.exclude_exts = spec

# (list) List of directory to exclude (let empty to not exclude anything)
#source.exclude_dirs = tests, bin

# (list) List of exclusions using pattern matching
#source.exclude_patterns = license,images/*/*.jpg

# (str) Application versioning (method 1)
version = 0.1

# (str) Application versioning (method 2)
# version.regex = __version__ = ['"](.*)['"]
# version.filename = %(source.dir)s/main.py

# (list) Application requirements
# comma seperated e.g. requirements = sqlite3,kivy
requirements = python3crystax,kivy
android.ndk_path = /home/kivy/Desktop/crystax-ndk-10.3.2/

# (str) Custom source folders for requirements
# Sets custom source for any requirements with recipes
# requirements.source.kivy = ../../kivy

# (list) Garden requirements
#garden_requirements =

# (str) Presplash of the application
#presplash.filename = %(source.dir)s/data/presplash.png

# (str) Icon of the application
#icon.filename = %(source.dir)s/data/icon.png

# (str) Supported orientation (one of landscape, portrait or all)
orientation = portrait

# (list) List of service to declare
#services = NAME:ENTRYPOINT_TO_PY,NAME2:ENTRYPOINT2_TO_PY

#
# OSX Specific
#

#
# author = © Copyright Info

# change the major version of python used by the app
osx.python_version = 3

# Kivy version to use
osx.kivy_version = 1.9.1

#
# Android specific
#

# (bool) Indicate if the application should be fullscreen or not
fullscreen = 0

# (string) Presplash background color (for new android toolchain)
# Supported formats are: #RRGGBB #AARRGGBB or one of the following names:
# red, blue, green, black, white, gray, cyan, magenta, yellow, lightgray,
# darkgray, grey, lightgrey, darkgrey, aqua, fuchsia, lime, maroon, navy,
# olive, purple, silver, teal.
#android.presplash_color = #FFFFFF

# (list) Permissions
#android.permissions = INTERNET

# (int) Android API to use
#android.api = 19

# (int) Minimum API required
#android.minapi = 9

# (int) Android SDK version to use
#android.sdk = 20

# (str) Android NDK version to use
#android.ndk = 9c

# (bool) Use --private data storage (True) or --dir public storage (False)
#android.private_storage = True

# (str) Android NDK directory (if empty, it will be automatically downloaded.)
#android.ndk_path =

# (str) Android SDK directory (if empty, it will be automatically downloaded.)
#android.sdk_path =

# (str) ANT directory (if empty, it will be automatically downloaded.)
#android.ant_path =

# (bool) If True, then skip trying to update the Android sdk
# This can be useful to avoid excess Internet downloads or save time
# when an update is due and you just want to test/build your package
# android.skip_update = False

# (str) Android entry point, default is ok for Kivy-based app
#android.entrypoint = org.renpy.android.PythonActivity

# (list) Pattern to whitelist for the whole project
#android.whitelist =

# (str) Path to a custom whitelist file
#android.whitelist_src =

# (str) Path to a custom blacklist file
#android.blacklist_src =

# (list) List of Java .jar files to add to the libs so that pyjnius can access
# their classes. Don't add jars that you do not need, since extra jars can slow
# down the build process. Allows wildcards matching, for example:
# OUYA-ODK/libs/*.jar
#android.add_jars = foo.jar,bar.jar,path/to/more/*.jar

# (list) List of Java files to add to the android project (can be java or a
# directory containing the files)
#android.add_src =

# (list) Android AAR archives to add (currently works only with sdl2_gradle
# bootstrap)
#android.add_aars =

# (list) Gradle dependencies to add (currently works only with sdl2_gradle
# bootstrap)
#android.gradle_dependencies =

# (str) python-for-android branch to use, defaults to stable
#p4a.branch = stable

# (str) OUYA Console category. Should be one of GAME or APP
# If you leave this blank, OUYA support will not be enabled
#android.ouya.category = GAME

# (str) Filename of OUYA Console icon. It must be a 732x412 png image.
#android.ouya.icon.filename = %(source.dir)s/data/ouya_icon.png

# (str) XML file to include as an intent filters in <activity> tag
#android.manifest.intent_filters =

# (list) Android additionnal libraries to copy into libs/armeabi
#android.add_libs_armeabi = libs/android/*.so
#android.add_libs_armeabi_v7a = libs/android-v7/*.so
#android.add_libs_x86 = libs/android-x86/*.so
#android.add_libs_mips = libs/android-mips/*.so

# (bool) Indicate whether the screen should stay on
# Don't forget to add the WAKE_LOCK permission if you set this to True
#android.wakelock = False

# (list) Android application meta-data to set (key=value format)
#android.meta_data =

# (list) Android library project to add (will be added in the
# project.properties automatically.)
#android.library_references =

# (str) Android logcat filters to use
#android.logcat_filters = *:S python:D

# (bool) Copy library instead of making a libpymodules.so
#android.copy_libs = 1

# (str) The Android arch to build for, choices: armeabi-v7a, arm64-v8a, x86
android.arch = armeabi-v7a

#
# Python for android (p4a) specific
#

# (str) python-for-android git clone directory (if empty, it will be automatically cloned from github)
#p4a.source_dir =

# (str) The directory in which python-for-android should look for your own build recipes (if any)
#p4a.local_recipes =

# (str) Filename to the hook for p4a
#p4a.hook =

# (str) Bootstrap to use for android builds
# p4a.bootstrap = sdl2

#
# iOS specific
#

# (str) Path to a custom kivy-ios folder
#ios.kivy_ios_dir = ../kivy-ios

# (str) Name of the certificate to use for signing the debug version
# Get a list of available identities: buildozer ios list_identities
#ios.codesign.debug = "iPhone Developer: <lastname> <firstname> (<hexstring>)"

# (str) Name of the certificate to use for signing the release version
#ios.codesign.release = %(ios.codesign.debug)s

[buildozer]

# (int) Log level (0 = error only, 1 = info, 2 = debug (with command output))
log_level = 2

# (int) Display warning if buildozer is run as root (0 = False, 1 = True)
warn_on_root = 1

# (str) Path to build artifact storage, absolute or relative to spec file
# build_dir = ./.buildozer

# (str) Path to build output (i.e. .apk, .ipa) storage
# bin_dir = ./bin

#    -----------------------------------------------------------------------------
#    List as sections
#
#    You can define all the "list" as [section:key].
#    Each line will be considered as a option to the list.
#    Let's take [app] / source.exclude_patterns.
#    Instead of doing:
#
#[app]
#source.exclude_patterns = license,data/audio/*.wav,data/images/original/*
#
#    This can be translated into:
#
#[app:source.exclude_patterns]
#license
#data/audio/*.wav
#data/images/original/*
#

#    -----------------------------------------------------------------------------
#    Profiles
#
#    You can extend section / key with a profile
#    For example, you want to deploy a demo version of your application without
#    HD content. You could first change the title to add "(demo)" in the name
#    and extend the excluded directories to remove the HD content.
#
#[app@demo]
#title = My Application (demo)
#
#[app:source.exclude_patterns@demo]
#images/hd/*
#
#    Then, invoke the command line with the "demo" profile:
#
#buildozer --profile demo android debug

The app will start and it will have a kivy logo and loading screen and then crash immediately. These are the logs. I have set the log_level = 2. I am hoping that someone can provide some answers on hope to stop the app from crashing when it starts. If anyone needs the apps code I can send you it. It consists of a few screens and boxlayouts. It works as expected in windows.
Im trying to boot it using:
 buildozer android debug deploy run logcat

Logs:
kivy@kivyvm:~/EvenProblems$ buildozer android debug deploy run logcat
# Check configuration tokens
# Ensure build layout
# Check configuration tokens
# Preparing build
# Check requirements for android
# Run 'dpkg --version'
# Cwd None
Debian 'dpkg' package management program version 1.18.10 (amd64).
This is free software; see the GNU General Public License version 2 or
later for copying conditions. There is NO warranty.
# Search for Git (git)
#  -> found at /usr/bin/git
# Search for Cython (cython)
#  -> found at /usr/local/bin/cython
# Search for Java compiler (javac)
#  -> found at /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
# Search for Java keytool (keytool)
#  -> found at /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/keytool
# Install platform
# Run 'pip install -q --user "appdirs" "colorama>=0.3.3" "sh>=1.10,<1.12.5" "jinja2" "six"'
# Cwd None
# Apache ANT found at /home/kivy/.buildozer/android/platform/apache-ant-1.9.4
# Android SDK found at /home/kivy/.buildozer/android/platform/android-sdk-20
# Android NDK found at /home/kivy/Desktop/crystax-ndk-10.3.2
# Check application requirements
# Check garden requirements
# Compile platform
# Run '/usr/bin/python -m pythonforandroid.toolchain create --dist_name=evenprobs --bootstrap=sdl2 --requirements=python3crystax,kivy --arch armeabi-v7a --copy-libs --color=always --storage-dir=/home/kivy/EvenProblems/.buildozer/android/platform/build'
# Cwd /home/kivy/EvenProblems/.buildozer/android/platform/python-for-android-new-toolchain
[INFO]:    Will compile for the following archs: armeabi-v7a
[INFO]:    Found Android API target in $ANDROIDAPI
[INFO]:    Available Android APIs are (19)
[INFO]:    Requested API target 19 is available, continuing.
[INFO]:    Found NDK dir in $ANDROIDNDK
[INFO]:    Got NDK version from $ANDROIDNDKVER
[WARNING]: NDK version was set as r9c, but checking the NDK dir claims it is 10.3.2.
[WARNING]: The build will try to continue, but it may fail and you should check that your setting is correct.
[WARNING]: If the NDK dir result is correct, you don't need to manually set the NDK ver.
[INFO]:    Using Crystax NDK r9c
[INFO]:    Found virtualenv at /usr/local/bin/virtualenv
[INFO]:    ccache is missing, the build will not be optimized in the future.
[INFO]:    Found the following toolchain versions: ['4.9', '5', 'clang3.6', 'clang3.7']
[INFO]:    Picking the latest gcc toolchain, here 5
[WARNING]: Missing executable: autoconf is not installed
[WARNING]: Missing executable: automake is not installed
[WARNING]: Missing executable: libtoolize is not installed
[INFO]:    Of the existing distributions, the following meet the given requirements:
[INFO]:     evenprobs: includes recipes (hostpython3crystax, sdl2_image, sdl2_mixer, sdl2_ttf, python3crystax, sdl2, six, pyjnius, kivy), built for archs (armeabi-v7a)
[INFO]:    evenprobs has compatible recipes, using this one
# Build the application #17
# Copy application source from /home/kivy/EvenProblems
# Create directory /home/kivy/EvenProblems/.buildozer/android/app
# Copy /home/kivy/EvenProblems/main.py
# Package the application
# project.properties updated
# Gradle project detected, copy files /home/kivy/EvenProblems/.buildozer/android/platform/build/dists/evenprobs/src/main/java
# Run '/usr/bin/python -m pythonforandroid.toolchain apk --debug --bootstrap=sdl2 --dist_name evenprobs --name EvenProblems --version 0.1 --package org.test.evenprobs --android_api 19 --minsdk 9 --private /home/kivy/EvenProblems/.buildozer/android/app --orientation portrait --window --copy-libs --arch armeabi-v7a --color=always --storage-dir=/home/kivy/EvenProblems/.buildozer/android/platform/build'
# Cwd /home/kivy/EvenProblems/.buildozer/android/platform/python-for-android-new-toolchain
[INFO]:    Will compile for the following archs: armeabi-v7a
[INFO]:    Getting Android API version from user argument
[INFO]:    Available Android APIs are (19)
[INFO]:    Requested API target 19 is available, continuing.
[INFO]:    Found NDK dir in $ANDROIDNDK
[INFO]:    Got NDK version from $ANDROIDNDKVER
[WARNING]: NDK version was set as r9c, but checking the NDK dir claims it is 10.3.2.
[WARNING]: The build will try to continue, but it may fail and you should check that your setting is correct.
[WARNING]: If the NDK dir result is correct, you don't need to manually set the NDK ver.
[INFO]:    Using Crystax NDK r9c
[INFO]:    Found virtualenv at /usr/local/bin/virtualenv
[INFO]:    ccache is missing, the build will not be optimized in the future.
[INFO]:    Found the following toolchain versions: ['4.9', '5', 'clang3.6', 'clang3.7']
[INFO]:    Picking the latest gcc toolchain, here 5
[WARNING]: Missing executable: autoconf is not installed
[WARNING]: Missing executable: automake is not installed
[WARNING]: Missing executable: libtoolize is not installed
[INFO]:    Of the existing distributions, the following meet the given requirements:
[INFO]:     evenprobs: includes recipes (hostpython3crystax, sdl2_image, sdl2_mixer, sdl2_ttf, python3crystax, sdl2, six, pyjnius, kivy), built for archs (armeabi-v7a)
[INFO]:    evenprobs has compatible recipes, using this one
[INFO]:    Of the existing distributions, the following meet the given requirements:
[INFO]:     evenprobs: includes recipes (hostpython3crystax, sdl2_image, sdl2_mixer, sdl2_ttf, python3crystax, sdl2, six, pyjnius, kivy), built for archs (armeabi-v7a)
[INFO]:    evenprobs has compatible recipes, using this one
[INFO]:    -> directory context /home/kivy/EvenProblems/.buildozer/android/platform/build/dists/evenprobs
[INFO]:    Selecting java build tool:
[INFO]:    Detected highest available build tools version to be 28.0.1
[INFO]:        Building with gradle, as gradle executable is present
[DEBUG]:   -> running gradlew assembleDebug
[DEBUG]:    > Configuring > 0/1 projects > root project > Resolving dependenIncremental java compilation is an incubating feature.
[DEBUG]:    :preBuild UP-TO-DATE
[DEBUG]:    :preDebugBuild UP-TO-DATE
[DEBUG]:    :checkDebugManifest
[DEBUG]:    :prepareDebugDependencies
[DEBUG]:    :compileDebugAidl UP-TO-DATE
[DEBUG]:    :compileDebugRenderscript UP-TO-DATE
[DEBUG]:    :generateDebugBuildConfig UP-TO-DATE
[DEBUG]:    :generateDebugResValues UP-TO-DATE
[DEBUG]:    :generateDebugResources UP-TO-DATE
[DEBUG]:    :mergeDebugResources
[DEBUG]:    :processDebugManifest UP-TO-DATE
[DEBUG]:    :processDebugResources
[DEBUG]:    :generateDebugSources
[DEBUG]:    :incrementalDebugJavaCompilationSafeguard UP-TO-DATE
[DEBUG]:    :javaPreCompileDebug
[DEBUG]:    :compileDebugJavaWithJavac UP-TO-DATE
[DEBUG]:    :compileDebugNdk UP-TO-DATE
[DEBUG]:    :compileDebugSources UP-TO-DATE
[DEBUG]:    :mergeDebugShaders UP-TO-DATE
[DEBUG]:    :compileDebugShaders UP-TO-DATE
[DEBUG]:    :generateDebugAssets UP-TO-DATE
[DEBUG]:    :mergeDebugAssets
[DEBUG]:    :transformClassesWithDexForDebug UP-TO-DATE
[DEBUG]:    :mergeDebugJniLibFolders UP-TO-DATE
[DEBUG]:    :transformNativeLibsWithMergeJniLibsForDebug UP-TO-DATE
[DEBUG]:    :transformNativeLibsWithStripDebugSymbolForDebug UP-TO-DATE
[DEBUG]:    :processDebugJavaRes UP-TO-DATE
[DEBUG]:    :transformResourcesWithMergeJavaResForDebug UP-TO-DATE
[DEBUG]:    :validateSigningDebug
[DEBUG]:    :packageDebug
[DEBUG]:    :assembleDebug
[DEBUG]:
[DEBUG]:    BUILD SUCCESSFUL
[DEBUG]:
[DEBUG]:    Total time: 5.24 secs
[DEBUG]:
[INFO]:    <- directory context /home/kivy/EvenProblems/.buildozer/android/platform/python-for-android-new-toolchain
[INFO]:    # Copying APK to current directory
[INFO]:    # APK filename not found in build output, trying to guess
[INFO]:    # Found APK file: /home/kivy/EvenProblems/.buildozer/android/platform/build/dists/evenprobs/build/outputs/apk/evenprobs-debug.apk
[INFO]:    # Add version number to APK
[INFO]:    # APK renamed to evenprobs-0.1-debug.apk
[DEBUG]:   -> running cp /home/kivy/EvenProblems/.buildozer/android/platform/build/dists/evenprobs/build/outputs/apk/evenprobs-debug.apk evenprobs-0.1-debug.apk
Could not find hostpython, will not compile to .pyo (this is normal with python3)
No compiled python is present to zip, skipping.
this should only be the case if you are using the CrystaX python
# Android packaging done!
# APK evenprobs-0.1-debug.apk available in the bin directory
# Run '/home/kivy/.buildozer/android/platform/android-sdk-20/platform-tools/adb devices'
# Cwd None
List of devices attached
6e06d061    device

# Deploy on 6e06d061
# Run '/home/kivy/.buildozer/android/platform/android-sdk-20/platform-tools/adb install -r "/home/kivy/EvenProblems/bin/evenprobs-0.1-debug.apk"'
# Cwd /home/kivy/.buildozer/android/platform
[  0%] /data/local/tmp/evenprobs-0.1-debug.apk
[  1%] /data/local/tmp/evenprobs-0.1-debug.apk
[  1%] /data/local/tmp/evenprobs-0.1-debug.apk
[  2%] /data/local/tmp/evenprobs-0.1-debug.apk
[  3%] /data/local/tmp/evenprobs-0.1-debug.apk
[  3%] /data/local/tmp/evenprobs-0.1-debug.apk
[  4%] /data/local/tmp/evenprobs-0.1-debug.apk
[  5%] /data/local/tmp/evenprobs-0.1-debug.apk
[  5%] /data/local/tmp/evenprobs-0.1-debug.apk
[  6%] /data/local/tmp/evenprobs-0.1-debug.apk
[  7%] /data/local/tmp/evenprobs-0.1-debug.apk
[  7%] /data/local/tmp/evenprobs-0.1-debug.apk
[  8%] /data/local/tmp/evenprobs-0.1-debug.apk
[  9%] /data/local/tmp/evenprobs-0.1-debug.apk
[  9%] /data/local/tmp/evenprobs-0.1-debug.apk
[ 10%] /data/local/tmp/evenprobs-0.1-debug.apk
[ 11%] /data/local/tmp/evenprobs-0.1-debug.apk
[ 11%] /data/local/tmp/evenprobs-0.1-debug.apk
[ 12%] /data/local/tmp/evenprobs-0.1-debug.apk
[ 13%] /data/local/tmp/evenprobs-0.1-debug.apk
[ 13%] /data/local/tmp/evenprobs-0.1-debug.apk
[ 14%] /data/local/tmp/evenprobs-0.1-debug.apk
[ 15%] /data/local/tmp/evenprobs-0.1-debug.apk
[ 15%] /data/local/tmp/evenprobs-0.1-debug.apk
[ 16%] /data/local/tmp/evenprobs-0.1-debug.apk
[ 17%] /data/local/tmp/evenprobs-0.1-debug.apk
[ 17%] /data/local/tmp/evenprobs-0.1-debug.apk
[ 18%] /data/local/tmp/evenprobs-0.1-debug.apk
[ 19%] /data/local/tmp/evenprobs-0.1-debug.apk
[ 19%] /data/local/tmp/evenprobs-0.1-debug.apk
[ 20%] /data/local/tmp/evenprobs-0.1-debug.apk
[ 21%] /data/local/tmp/evenprobs-0.1-debug.apk
[ 21%] /data/local/tmp/evenprobs-0.1-debug.apk
[ 22%] /data/local/tmp/evenprobs-0.1-debug.apk
[ 23%] /data/local/tmp/evenprobs-0.1-debug.apk
[ 23%] /data/local/tmp/evenprobs-0.1-debug.apk
[ 24%] /data/local/tmp/evenprobs-0.1-debug.apk
[ 25%] /data/local/tmp/evenprobs-0.1-debug.apk
[ 25%] /data/local/tmp/evenprobs-0.1-debug.apk
[ 26%] /data/local/tmp/evenprobs-0.1-debug.apk
[ 27%] /data/local/tmp/evenprobs-0.1-debug.apk
[ 27%] /data/local/tmp/evenprobs-0.1-debug.apk
[ 28%] /data/local/tmp/evenprobs-0.1-debug.apk
[ 29%] /data/local/tmp/evenprobs-0.1-debug.apk
[ 29%] /data/local/tmp/evenprobs-0.1-debug.apk
[ 30%] /data/local/tmp/evenprobs-0.1-debug.apk
[ 31%] /data/local/tmp/evenprobs-0.1-debug.apk
[ 31%] /data/local/tmp/evenprobs-0.1-debug.apk
[ 32%] /data/local/tmp/evenprobs-0.1-debug.apk
[ 33%] /data/local/tmp/evenprobs-0.1-debug.apk
[ 33%] /data/local/tmp/evenprobs-0.1-debug.apk
[ 34%] /data/local/tmp/evenprobs-0.1-debug.apk
[ 35%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 35%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 36%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 37%] /data/local/tmp/evenprobs-0.1-debug.apk
....
    [ 60%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 61%] /data/loc

al/tmp/evenprobs-0.1-debug.apk
    [ 61%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 62%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 63%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 63%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 64%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 65%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 65%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 66%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 66%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 67%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 68%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 68%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 69%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 70%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 70%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 71%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 72%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 72%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 73%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 74%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 74%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 75%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 76%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 76%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 77%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 78%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 78%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 79%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 80%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 80%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 81%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 82%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 82%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 83%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 84%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 84%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 85%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 86%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 86%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 87%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 88%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 88%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 89%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 90%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 90%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 91%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 92%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 92%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 93%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 94%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 94%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 95%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 96%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 96%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 97%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 98%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 98%] /data/local/tmp/evenprobs-0.1-debug.apk
    [ 99%] /data/local/tmp/evenprobs-0.1-debug.apk
    [100%] /data/local/tmp/evenprobs-0.1-debug.apk
    /home/kivy/EvenProblems/bin/evenprobs-0.1-debug.apk: 1 file pushed. 0.7 MB/s (9879478 bytes in 13.266s)
        pkg: /data/local/tmp/evenprobs-0.1-debug.apk

Then it gets stuck into a loop like this:
E/SMD     (  166): DCD OFF
I/System.out( 1348): 29 bLAR false
I/System.out( 1348):  ----Tether Manager - isWifiConnected------- true
I/SecureStorage( 3239): [INFO]: Secure Storage Daemon is preparing to run
I/SecureStorage( 3239): [INFO]: Secure Storage Daemon successfully binded a socket
D/QSEECOMAPI: ( 3239): QSEECom_start_app sb_length = 0x19a040
D/QSEECOMAPI: ( 3239): App is not loaded in QSEE
E/QSEECOMAPI: ( 3239): Error::Cannot open the file /firmware/image//sec_stor.mdt
E/QSEECOMAPI: ( 3239): Error::Loading image failed with ret = -1
D/QSEECOMAPI: ( 3239): QSEECom_start_app sb_length = 0x19a040
D/QSEECOMAPI: ( 3239): App is not loaded in QSEE
E/QSEECOMAPI: ( 3239): Error::Cannot open the file /firmware/image//sec_storage.mdt
E/QSEECOMAPI: ( 3239): Error::Loading image failed with ret = -1
E/SecureStorage( 3239): [ERROR]:Loading app sec_stor and sec_storage failed
E/SecureStorage( 3239): [ERROR]:Fail to open session with qualcomm
E/SecureStorage( 3239): [ERROR]:Error cannot connect to TA/driver!
E/SMD     (  166): DCD OFF
D/BatteryService(  348): update start
D/BatteryService(  348): level:46, scale:100, status:2, health:2, present:true, voltage: 3975, temperature: 318, technology: Li-ion, AC powered:false, USB powered:true, Wireless powered:false, icon:17303560, invalid charger:0, online:4, charge type:0, current avg:0
D/BatteryService(  348): Sending ACTION_BATTERY_CHANGED.
D/BatteryService(  348): stay LED for charging
D/STATUSBAR-BatteryController(  893): onReceive() - ACTION_BATTERY_CHANGED
D/STATUSBAR-BatteryController(  893): onReceive() - BATTERY_STATUS_CHARGING:
D/STATUSBAR-PhoneStatusBar(  893):  mBrightnessEnablebySettings = true mBrightnessEnablebyBattery = true mBrightnessEnablebyDisableFlag = true
D/LockPatternUtils(  348): isPcwEnable = null
D/CMASMessage(  348): [update] mShowingCMASText is false
D/CMASMessage(  348): CMASIcon was GONE :
E/SMD     (  166): DCD OFF
I/SecureStorage( 3241): [INFO]: Secure Storage Daemon is preparing to run
I/SecureStorage( 3241): [INFO]: Secure Storage Daemon successfully binded a socket
D/QSEECOMAPI: ( 3241): QSEECom_start_app sb_length = 0x19a040
D/QSEECOMAPI: ( 3241): App is not loaded in QSEE
E/QSEECOMAPI: ( 3241): Error::Cannot open the file /firmware/image//sec_stor.mdt
E/QSEECOMAPI: ( 3241): Error::Loading image failed with ret = -1
D/QSEECOMAPI: ( 3241): QSEECom_start_app sb_length = 0x19a040
D/QSEECOMAPI: ( 3241): App is not loaded in QSEE
E/QSEECOMAPI: ( 3241): Error::Cannot open the file /firmware/image//sec_storage.mdt
E/QSEECOMAPI: ( 3241): Error::Loading image failed with ret = -1
E/SecureStorage( 3241): [ERROR]:Loading app sec_stor and sec_storage failed
E/SecureStorage( 3241): [ERROR]:Fail to open session with qualcomm
E/SecureStorage( 3241): [ERROR]:Error cannot connect to TA/driver!
V/AlarmManager(  348): waitForAlarm result :8
D/KeyguardClockWidgetService( 3885): onReceive action=android.intent.action.TIME_TICK
V/AlarmManager(  348): ClockReceiver onReceive() ACTION_TIME_TICK
D/STATUSBAR-IconMerger(  893): checkOverflow(384), More:false, Req:false Child:4
E/SMD     (  166): DCD OFF

A: Can it be an extra backslash in filename "//sec_stor.mdt"?
E/QSEECOMAPI: ( 3241): Error::Cannot open the file /firmware/image//sec_stor.mdt
E/QSEECOMAPI: ( 3241): Error::Loading image failed with ret = -1
D/QSEECOMAPI: ( 3241): QSEECom_start_app sb_length = 0x19a040
D/QSEECOMAPI: ( 3241): App is not loaded in QSEE
E/QSEECOMAPI: ( 3241): Error::Cannot open the file /firmware/image//sec_storage.mdt
E/QSEECOMAPI: ( 3241): Error::Loading image failed with ret = -1


text:
Q: Common EmberJS Route Events Is there a way to have common events shared among multiple routes in Ember?
Sample:
App.CommonMenu = Ember.Mixin.create({
  events: {
    onDelete: function() {}
  }
});

App.MainMenu = Ember.Route.extend(App.CommonMenu, {
  events: {
    onSave: function() {}
  }
});

App.StoreMenu = Ember.Route.extend(App.CommonMenu, {
  events: {
    onSave: function(){}
  }
})

I'm only asking because I continue to get an error where, when a button is clicked, I get something similar to this:
Uncaught Error: Nothing handled the event 'onDelete'.

A: A better way I can think of handling events globally across routes would be to define them in the events hash in your ApplicationRoute
App.ApplicationRoute = Ember.Route.extend({
  events: {
    myEvent: function() {
      // do stuff
    }
  }
});

App.MainMenu = Ember.Route.extend({
  events: {
    onSave: function() {}
  }
});

App.StoreMenu = Ember.Route.extend({
  events: {
    onSave: function(){}
  }
});

You could have also some route that handle the same event defined in your ApplicationRoute e.g. myEvent as long as you return true from that handler it will additionally bubble up all the way to the ApplicationRoute myEvent handler.
App.SomeOtherRoute = Ember.Route.extend({
  events: {
    myEvent: function(){
      // do stuff
      return true; // this will make the event bubble up all the way to the ApplicationRoute
    }
  }
});

Hope it helps.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Customize Google Places autocomplete pac-item text I would like to know how could I customize the default Google Places Autocomplete text shown when user types on a autocomplete-enabled input (".pac-item" elements).
Specifically, I want to use portuguese language on my results, but even when I specify pt-BR language on autocomplete instantiation results are shown in english (e.g. "State of", "Brazil" ):
var autocomplete = new google.maps.places.Autocomplete(
                 (document.getElementById('city_settings')),
                 { language: "pt-BR", types: ['(cities)'], componentRestrictions : { country: 'br' } });

Any thoughts on how could I activate portuguese responses or how could I programatically edit those texts?

A: Specify the language in the API call while loading the library
https://maps.googleapis.com/maps/api/js?key=*yourkey*&libraries=places&language=en

See also:
google.maps.places.Autocomplete language output


text:
Q: Extract key-value pairs from a string I want to extract key value pairs from a string. I need this to define a new glossary style and want to pass some additional information through a existing parameter.
\newglossarystyle{meinglossar}{%
\renewenvironment{theglossary}{\begin{description}}{\end{description}}%
\renewcommand*{\glossaryentryfield}[5]{%
\item[\glstarget{##1}{##2}:]%
\dotfill ##5%
\item
\ifthenelse{\equal{##4}{\relax}}{}{\space (##4)}%
\space ##3 % THIS IS THE LINE THAT MATTERS
}%
}

In the almost last line I get the argument ##3 which contains a string like parameter_1=xyz,parameter_2=ztu. What I want to do is to access the values of this parameters to build a table:
\begin{tabular}{l l}
  First Parameter & \parameter_1 \\ % \parameter_1 should contain "xyz"
  ...
\end{tabular}

What is the best way to do this?
Here is an example input:
\documentclass[12pt]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage[]{glossaries}

\newglossarystyle{meinglossar}{%
\renewenvironment{theglossary}{\begin{description}}{\end{description}}%
\renewcommand*{\glossaryentryfield}[5]{%
\item[\glstarget{##1}{##2}:]% Eintragsname:
\dotfill ##5% ...Seitenzahl
\item
\gdef\parameters{##3}
% parameters contains now the key value pairs in the form of "name={lorem ipsum...},ref={lorem ipsum}" and i want to extract them one by one to insert them to a table
\begin{tabular}{l l}
  Name & <name> \\%nameparameter
  Reference & <ref> %refparameter
\end{tabular}
}%
}

%format
\renewcommand*{\glstextformat}{\textit}

% glossary
\newglossaryentry{workstation}{
    name=Workstation,
    description={
        name={Lorem Ipsum},
        ref={Chapter 1}
    }
}

\newglossaryentry{Test}{
    name=Test,
    description={
        name={Lorem Ipsum},
        ref={Chapter 1}
    }
}

\makeglossaries

\begin{document}

\section*{Test}
Now i will use \gls{workstation} and the \gls{Test} entries of the glossary.

\printglossary[style=meinglossar]

\end{document}

A: You can quite easily use keyval for this task:
\documentclass{report}
\usepackage{glossaries}
% Edit by A.M.:
% Which package loads xkeyval.sty before here? To find it requires
% putting some search code on top of \documentclass. Certainly xkeyval
% has been loaded before here.
% \ifcsname ver@xkeyval.sty\endcsname\undefined\fi
% \usepackage{keyval}

\makeatletter
\define@key{glossparam}{name}{\def\seb@name{#1}}
\define@key{glossparam}{ref}{\def\seb@ref{#1}}

\newglossarystyle{mainglossary}{%
  \renewenvironment{theglossary}{\begin{description}}{\end{description}}%
  \renewcommand*{\glossaryentryfield}[5]{%
    \item[\glstarget{##1}{##2}:]%
    \dotfill ##5%
    \item\setkeys{glossparam}{##3}
    \begin{tabular}{l l}
      Name & \seb@name \\ % name parameter
      Reference & \seb@ref % ref parameter
    \end{tabular}
  }%
}
\makeatother

\let\glstextformat\textit
\newglossaryentry{workstation}{%
  name=Workstation,
  description={%
    name={Lorem Ipsum}, ref={Chapter 1}%
  }%
}
\newglossaryentry{Test}{%
  name=Test,
  description={%
    name={Lorem Ipsum}, ref={Chapter 1}%
  }%
}

\makeglossaries
\begin{document}
\section*{Test}
Now I will use \gls{workstation} and the \gls{Test} entries of the glossary.

\printglossary[style=mainglossary]
\end{document}


text:
Q: Scripted map rendering (multiple similar maps from one shapefile) using PyQGIS? I would like to ask for advice on creating a Python script that will provide the opportunity to render a plenty of similar maps (with the same extent, projection, layout, color scheme and composition, but with differing titles and data used for rendering).
Say we have a single shapefile or Spatialite DB with a huge attribute table inherited from csv file like this:

I want to turn them into a set of choropleth maps like this:

So I guess that I need a script that will just:

*

*Iterate through specified range of columns in the attribute table;

*Call some (yet not written?) rendering function that will produce the choropleth map with a legend and title;

*Dump the output to the vector formatted-file (PDF, EPS, etc.).

I'm going to use QGis for that purpose and would be glad if anyone could outline the main ideas and key QGis API functions that I can rely on at first.

A: http://documentation.qgis.org/2.0/en/docs/pyqgis_developer_cookbook/composer.html has a simple Python example. http://spatialgalaxy.net/2012/01/27/qgis-running-scripts-in-the-python-console/ has a more detailed example.


text:
Q: How to repair/recover Snow Leopard when the installation DVD has been lost? So I seem to not have my Snow Leopard DVD available anywhere.
I can't use a newer version like Lion.
What can I do to repair/recover Snow Leopard now that the installation DVD is not available?

A: If you computer not booting is the reason you need your Snow Leopard disc, there are several things to try and troubleshoot your issue.

*

*Boot into single user mode (Cmd + S @ POST (chime)).  Once the command prompt comes up, type fsck -fy.  This will attempt to repair your disk.

*If this is okay, hold down Shift at POST and see if it boots.  This disables kexts, fonts, etc.

*If this does not work try verbose mode (Cmd + V @ POST) and see where your computer stops loading at and troubleshoot from there.
Good luck.

A: An unrepairable disk error requires an Erase/Install of OS X.  It may not cause issues right away, so get the files transferred now.
In fact it may fail to even boot up.  The previously mentioned shift key at boot (Safe Mode) worked.
I just used Disk Utility to BACK UP the entire hard drive to a properly setup USB.  That will repair the installed OS X 10.6.8.
Carbon Copy Cloner allows bulky user files to be excluded.
I made a copy of OS X 10.6.8 installation right after Software Update was finished.
Thanks to apple discussions for tip on using a copy to repair the system.


text:
Q: GTK+3 C gtk_label_set_use_markup for a GtkButton + CSS style I'm porting a GTK+2 based application to GTK+3 on Ubuntu 16.  I'm trying to set the markup for the label of a button but it seems something has been deprecated.  Here is the original code:
gtk_label_set_use_markup(GTK_LABEL(GTK_BIN(button)->child), TRUE);

GCC now complains that GTK_BIN doesn't have a member 'child'.  So is there another technique I can use to do this?  I've really struggled to find any useful information on this.
Related to this...I'm also looking for a WORKING example of using CSS to setup widget styles for a GTK+3 app.  The current app uses gtk_widget_override_background_color() which is now deprecated.  It seems the only way to control color is with CSS but I can't seem to glue the pieces together yet.  I need to setup different colors for different widgets.

A: After some searching and experimentation found a solution to part of the problem.  This works to set the markup of a button label as long as the label is the only child of the button widget:
gtk_label_set_use_markup(GTK_LABEL( gtk_bin_get_child( GTK_BIN(button) ) ), TRUE);

I still have not found a way to dynamically control the background color of a label or button widget using styles.


text:
Q: How to remove space gap when using & symbol in vim I want to add "caps" at the end of all words ending with "w".
For example "jaw" should become "jawcaps", and "blow" should become "blowcaps"
The following command is using regular expression for achieving upper requirement.
:%s/[A-Za-z][A-Za-z]*w[^A-Za-z]/&caps

But when I use the command above "jaw" converts into "jaw caps" not "jawcaps"
How can I remove the space which is located between "jaw" and "caps"?

A: How about this:
:%s/w\>\zs/caps/g

A: You have a problem in your regex, your regex would match a non character after the value w. In your case, match jaw[one space] instead of jaw
:%s/[A-Za-z][A-Za-z]*w[^A-Za-z]/&caps
                       ^^^ here match a space

I suggest you to use a capture regex.
:%s/\([A-Za-z][A-Za-z]*w\)\([^A-Za-z]\)/\1caps\2

A better solution should be using look behind.
:%s/\w\w*w\w\@!/&caps

A: Sato Katsura's answer :%s/w\>\zs/caps/g works like this:

*

*Search for every place where a "w" character is the last character of a word: /w\>.

*But don't match that "w": only a zero-width space after the "w" should be matched: /w\>\zs (or /w\zs\>).

*Replace that match with the word "caps": s/w\>\zs/caps/.

*Do so on every line: range is %, and on every occurrence on those lines: flag is g.
Putting it together: :%s/w\>\zs/caps/g.

*

*match word end :h /\>

*set match start :h \zs

*substitution command :h :s

*range specification :h :range

*substitution flags :h :s_flags


text:
Q: I'm trying to have a video displaying on my webpage, but it won't load? Is there something wrong with my html code? This is the html file for my webpage. It's not much but I'm just starting off and trying some things. If i run this as a file on my computer the video will load and play with no problem but on my website it will not load. Can someone help me?
<html>
<head>
    <link rel="stylesheet" href="styles.css">
</head>
<body>
<p>
    <video width="800" height="600" autoplay loop>
    <source src="rickroll.mp4" type="video/mp4">
    </video>
</p>
</body>
</html>```


text:
Q: How to read text file to matrix with specific column size and rows size in matlab I want to read a text file which contains English words and sentences. I want to store the characters in this text file in a matrix with a specific size.
Suppose my text file is named textfile.txt and looks like this:

Creating strings in a regular MATLAB® array requires that all strings in the array be of the same length. This often means that you have to pad blanks at the end of strings to equalize their length. However, another type of MATLAB array, the cell array, can hold different sizes and types of data in an array without padding. Cell arrays provide a more flexible way to store strings of varying length.

This is part of the article "Cell Arrays of Strings" in the Matlab documentation.
I specified a column size of 16, so the number of rows will be the total numbers of characters divided by the colunm size (16).
My result matrix should look like this:
c r e a t i n g  s t r i n g
s t r i n g s  i n a r e g u l a    ... and so on

Space and new lines should also be considered while storing the characters in the matrix.

A: You can read the entire textfile.txt as a single vector of characters (of size 1-by-n where n is the number of characters).
Then you should pad this vector with ceil(n/16)*16 - n spaces to make the length of the vector divisible by 16.
Finally, you can reshape it:
 myMatrix = reshape( myVec, 16, [] ).';


text:
Q: Is it a security risk to include a .git folder in the build step of a Docker multistage build? Is it a security risk to include a .git folder in the build step of a Docker multistage build?
To illustrate with an example. We have a compilation step using Java's maven build tool which reads git information, such as the tag and the commit. This requires the compile step to have access to the .git folder. Afterwards the resulting artifacts are copied to the final image. See:
FROM maven:3.5.4 as build
COPY $PWD /cbioportal
WORKDIR /cbioportal
RUN mvn -DskipTests clean install

FROM openjdk:8-jre
RUN mkdir -p /cbioportal
COPY --from=build /cbioportal/cbioportal*.war /app.war
COPY --from=build /cbioportal/webapp-runner.jar /webapp-runner.jar

If we share the resulting image publicly. Are there any ways to obtain information about the original .git folder the image was created from?

A: The .git will be cached on the computer which will build the image but wont be include in the final image, that will have only 3 layers added to the openkdk ones:
  - one layer with /cbioportal dir
  - one layer with the war file copied from build
  - one layer with the webapp-runner.jar
Using docker inspect, you can list the layers of the two images and compare...


text:
Q: viewing a polygon read from shapefile with matplotlib I am trying to view a basic polygon read from a Shapefile using matplotlib and pyshp
But all my efforts yield just an empty axes with no polygon. Here are few of my tries, using the dataset showing the borders of Belgium:
import shapefile as sf
r = sf.Reader("BEL_adm/BEL_adm0")
p=r.shapes()
b=p[0]
points = b.points

import matplotlib.pyplot as plt
from matplotlib.path import Path
imporst matplotlib.patches as patches

verts = points

verts = []
for x,y in points:
    verts.append(tuple([x,y]))

codes = ['']*len(verts)
codes[0] = Path.MOVETO
codes[-1] = Path.CLOSEPOLY

for i in range(1,len(verts)):
    codes[i]=Path.LINETO

path = Path(verts, codes)
fig = plt.figure()
ax = fig.add_subplot(111)
patch = patches.PathPatch(path, facecolor='orange', lw=2)
ax.add_patch(patch)
ax.set_xlim(-2,2)
ax.set_ylim(-2,2)
plt.show()

Another try with patches also yields an empty frame:
fig = plt.figure(figsize=(11.7,8.3))

ax = plt.subplot(111)
x,y=zip(*b.points)
import matplotlib.patches as patches
import matplotlib.pyplot as plt
bol=patches.Polygon(b.points,True, transform=ax.transAxes)

ax.add_patch(bol)
ax.set_ylim(0,60)
ax.set_xlim(0,200)
plt.show()

Would be happy to see what I am missing.
Thanks, Oz

A: instead of calling set_xlim(), set_ylim() to set the range of axis, you can use ax.autoscale().
For your Polygon version, you don't need to set transform argument to ax.transAxes, just call:
bol=patches.Polygon(b.points,True)


text:
Q: Warning when reloading a module in Python and PyCharm 2020.2 After updating to PyCharm 2020.2, the following piece of code:
import DataSets
import importlib

importlib.reload( DataSets )

issues the warning Expected type 'ModuleType', got 'DataSets.py' instead for the last statement.  Everything works as expected, and I am pretty sure that DataSets is a module.  Can anyone please let me know why I am getting this warning and how I can get rid of it?
My dev environment is based on Python 3.6.

A: Sounds like this issue https://youtrack.jetbrains.com/issue/PY-36062, feel free to vote (thumbs up near the title)


text:
Q: How can i consume WS on server from mobile is not in the same network? I have a WebService published on a server. I want to consume(invoke) this WS
from mobile(mobile Application) which is not in the same network.I want to access this WS through internet 3G.How can i do this in windows mobile 5.0 and Compact framework??

A: you can access the web service in the same way you would access it using a normal c# application
http://msdn.microsoft.com/en-us/library/aa446547.aspx


text:
Q: Regex match different numbers when only this number is present Good morning,
I have been having issues with regex in finding the way to implement such this case:

Input string (tested string) can be any of those options:

*

*Empty string:

*

*""

*String with one number (and maybe letters at the beggining):

*

*"1234567890"

*"aa1234567890"

*String with multiple numbers (and maybe letters at the beggining) separated with semicolon:

*

*"1234567890;1234567890"

*"aa1234567890;aa1234567890"

*"aa1234567890;1234567890"

*"1234567890;aa1234567890"

*"1234567890;aa1234567890;..." (any combination you can imagine)

My regex search would always try to match a known string which will always be as follows:

*

*single number:

*

*"12345"

*single number starting with some letters:

*

*"bb12345"

I have already tried it but without success: https://regex101.com/r/0ojdb9/3

To sum up, when I have the known string to build the regex (let's say "12345") when I test it the match should only occur:

*

*[any character or start of line or start of string but NOT NUMBER]12345[any character or end of string or end of line but NOT NUMBER]

*Example:

*

*"12345".test("(12345)")  --> Match

*"123456".test("(12345)")  --> NO Match

*"012345".test("(12345)")  --> NO Match

*"12345;".test("(12345)")  --> Match

*"123456;".test("(12345)")  --> NO Match

*"012345;".test("(12345)")  --> NO Match

*"a12345".test("(12345)")  --> Match

*"a123456".test("(12345)")  --> NO Match

*"a012345".test("(12345)")  --> NO Match

*"a12345;".test("(12345)")  --> Match

*"a123456;".test("(12345)")  --> NO Match

*"a012345;".test("(12345)")  --> NO Match

A: You may use
/(?:^|\D)12345(?!\d)/

It matches:

*

*(?:^|\D) - start of string or any non-digit char

*12345  - the known value

*(?!\d) - there must be no digit right after the known value.

See JS demo:

val = 12345;
rx = new RegExp("(^|\\D)" + val + "(?!\\d)");
console.log(rx.test("12345"));  // Match
console.log(rx.test("123456")); //  NO Match
console.log(rx.test("012345")); //  NO Match
console.log(rx.test("12345;"));  // Match
console.log(rx.test("123456;")); //  NO Match
console.log(rx.test("012345;")); //  NO Match
console.log(rx.test("a12345"));  // Match
console.log(rx.test("a123456")); //  NO Match
console.log(rx.test("a012345")); //  NO Match
console.log(rx.test("a12345;"));  // Match
console.log(rx.test("a123456;")); //  NO Match
console.log(rx.test("a012345;")); //  NO Match

A: I am answering my question but all credit goes to the user Egan Wolf, since he was the one posting the solution in the comments of the original post (I don't know how to tag him or give the credit to him)
The answer to my question was solved with this regex:
([^0-9;\n]*(?<!\d)1234567890(?!\d)[^0-9;\n]*)

And can be checked here: https://regex101.com/r/0ojdb9/4
Thank you very much for your help!


text:
Q: Github forking conundrum My problem: I'm taking advice from people who do not use the command line but who use GUIs and this advice seems to be wrong. But perhaps someone here can verify that it is.
The person who advocates forking has said my workflow needs to be this:

*

*clone from the main repo

*create a branch and make changes and check them in

*somehow push to my fork of the repo -- not to the main repo

*create a pull request from my fork

Is this a normal workflow? Are there commands to do these things? Step 3 makes no sense because when I look at .git/config, I see no mention of my fork. So I cannot push. How do I add my fork? The upstream is the main repo, the origin is the main repo.

A: Yes, this is normal, and doesn't depend much on a GUI vs. command line dichotomy. It is sometimes known as a triangular workflow:

*

*Fork a repository on Github from the main repo.

*On your local development machine, clone one of the Github repos (it doesn't matter which), and configure both of the Github repos as remotes.

*Do your work in a branch that you branch off from the main repo. Periodically either rebase or merge (your choice, according to temperament and/or company standards) updates from the main repo into your work.

*When you're happy with your new feature, push it to your personal Github fork, and create a pull request from the branch on your fork to the master repo. Your collaborators can review that and get Github to merge it when all agree it looks good.
With this workflow, the 'master' branch in your personal fork never gets used for anything. I periodically update mine to match the master from the main repo, but that's just for tidiness. You can also delete 'master' on your Github repo completely and declare something else to be the "main branch" there. This works quite okay for many purposes, but I went back to having an explicit master because there was little bits and pieces of our CI automation that it confused.
The end result of this will look just the same as if you synchronize everything both back and forth through our own Github fork, so you can be fully compatible with colleagues who do it that way around.
You can push your working branch to your own Github fork even before you're ready to create a PR. This can be a convenient way to back up your work in case your development machine explodes or you have a brainfart and accidentally rm -rf your working directory or recode everything to EBCDIC.

A: You can add your fork as a "remote" to your repo with this command:
git remote add my_fork <URL>

<URL> is the URL for your forked repository. You can use whatever name you wish instead of my_fork.
Alternatively, you can clone directly from your fork and add the main repo as a remote to your local repo.


text:
Q: How do I use ffmpeg to trim silence in a mp3 file? We need to trim silence from mp3 files and since we're already using ffmpeg to perform some conversions, we prefer to use it to do the trimming too.
Is this possible?  I can't find any reference about using ffmpeg to trim silence.
Thanks.

A: https://ffmpeg.org/ffmpeg-filters.html#silenceremove
Here is an example:
$ ffmpeg -hide_banner -i the_4_hour_work_week.wma  -af silenceremove=0:0:0:-1:5:-25dB the_4_hour_work_week.mp3

0:0:0:-1:5:-25dB means start_periods:start_duration:start_threshold:stop_periods:stop_duration:stop_threshold. So it will search for 5s of silence less than -25dB.
By the way, dB is case sensitive. Really. dB is the abbreviation for Decibel.


text:
Q: Showing an outerplaner graph has less than $2n-3$ edges An outerplanar graph is a connected plane graph that can be drawn in such a way that all it's vertices are on the outer face.
I want to show that for every $G$ outerplaner graph with $n$ vertices and $m$ edges, $m\leq 2n-3$
I tried induction and I have a graph on $n$ vertices. I want to take one that has exactly 2 edges to it, so when I remove it will fit.
Just to be clear, I started my proof by saying that if G is a tree then $m=n-1$ and it's all good.
How can I show that exists a vertice with 2 edges?

A: If the graph is $K_1$ it is false since $m=0$ and $n=1$.
Let $n\geq 2$:
If the graph is a tree it has $n-1\leq 2n-3$ edges.
We suppose the graph is not a tree:
If you add the number of edges each face has you get $2m$. This sum is at least $3(f-1)+n$ since the inner faces have at least $3$ edges and the outer face has at least $n$ edges (since the outer edges form a connected graph that is not acyclic).  So $2m\geq3f+n-3\implies 3f \leq 2m+3-n\implies f\leq\frac{2m+3-n}{3}$.
Now we use Euler's formula:
$2=n+f-m\leq n+\frac{2m+3-n}{3}-m\implies 6\leq 3n+2m+3-n-3m\implies m\leq2n-3$


text:
Q: Plot unimodal distributions determined from a multimodal distribution I've used GaussianMixture to analyze a multimodal distribution. From the GaussianMixture class I can access the means and covariances using the attributes means_ and covariances_. How can I use them to now plot the two underlying unimodal distributions?
I thought of using scipy.stats.norm but I don't know what to select as parameters for loc and scale. The desired output would be analogously as shown in the attached figure.

The example code of this question was modified from the answer here.
import numpy as np
import matplotlib.pyplot as plt
from sklearn import mixture
from scipy.stats import norm

ls = np.linspace(0, 60, 1000)
multimodal_norm = norm.pdf(ls, 0, 5) + norm.pdf(ls, 20, 10)
plt.plot(ls, multimodal_norm)

# concatenate ls and multimodal to form an array of samples
# the shape is [n_samples, n_features]
# we reshape them to create an additional axis and concatenate along it
samples = np.concatenate([ls.reshape((-1, 1)), multimodal_norm.reshape((-1,1))], axis=-1)
print(samples.shape)

gmix = mixture.GaussianMixture(n_components = 2, covariance_type = "full")
fitted = gmix.fit(samples)

print(fitted.means_)
print(fitted.covariances_)

# The idea is something like the following (not working):
new_norm1 = norm.pdf(ls, fitted.means_, fitted.covariances_)
new_norm2 = norm.pdf(ls, fitted.means_, fitted.covariances_)
plt.plot(ls, new_norm1, label='Norm 1')
plt.plot(ls, new_norm2, label='Norm 2')

A: It is not entirely clear what you are trying to accomplish. You are fitting a GaussianMixture model to the concatenation of the sum of the values of pdfs of two gaussians sampled on a uniform grid, and the unifrom grid itself. This is not how a Gaussian Mixture model is meant to be fitted. Typically one fits a model to random observations drawn from some distribution (typically unknown but could be a simulated one).
Let me assume that you want to fit the GaussianMixture model to a sample drawn from a Gaussian Mixture distribution. Presumably to test how well the fit works given you know what the expected outcome is. Here is the code for doing this, both to simulate the right distribution and to fit the model. It prints the parameters that the fit recovered from the sample -- we observe that they are indeed close to the ones we used to simulate the sample. Plot of the density of the GaussianMixture distribution that fits to the data is generated at the end
import numpy as np
import matplotlib.pyplot as plt
from sklearn import mixture
from scipy.stats import norm

# set simulation parameters
mean1, std1, w1 = 0,5,0.5
mean2, std2, w2 = 20,10,1-w1

# simulate constituents
n_samples = 100000
np.random.seed(2021)
gauss_sample_1 = np.random.normal(loc = mean1,scale = std1,size = n_samples)
gauss_sample_2 = np.random.normal(loc = mean2,scale = std2,size = n_samples)
binomial = np.random.binomial(n=1, p=w1, size = n_samples)

# simulate gaussian mixture
mutlimodal_samples = (gauss_sample_1 * binomial + gauss_sample_2 * (1-binomial)).reshape(-1,1)

# define and fit the mixture model
gmix = mixture.GaussianMixture(n_components = 2, covariance_type = "full")
fitted = gmix.fit(mutlimodal_samples)

print('fitted means:',fitted.means_[0][0],fitted.means_[1][0])
print('fitted stdevs:',np.sqrt(fitted.covariances_[0][0][0]),np.sqrt(fitted.covariances_[1][0][0]))
print('fitted weights:',fitted.weights_)

# Plot component pdfs and a joint pdf
ls = np.linspace(-50, 50, 1000)
new_norm1 = norm.pdf(ls, fitted.means_[0][0], np.sqrt(fitted.covariances_[0][0][0]))
new_norm2 = norm.pdf(ls, fitted.means_[1][0], np.sqrt(fitted.covariances_[1][0][0]))
multi_pdf = w1*new_norm1 + (1-w1)*new_norm2
plt.plot(ls, new_norm1, label='Norm pdf 1')
plt.plot(ls, new_norm2, label='Norm pdf 2')
plt.plot(ls, multi_pdf, label='multi-norm pdf')
plt.legend(loc = 'best')
plt.show()

The results are
fitted means: 22.358448018824642 0.8607494960575028
fitted stdevs: 8.770962351118127 5.58538485134623
fitted weights: [0.42517515 0.57482485]

as we see they are close (up to their ordering, which of course the model cannot recover but it is irrelevant anyway) to what went into the simulation:
mean1, std1, w1 = 0,5,0.5
mean2, std2, w2 = 20,10,1-w1

And the plot of the density and its parts. Recall that the pdf of the GaussianMixture is not the sum of the pdfs but a weighted average with weights w1, 1-w1:


text:
Q: AC vs DC and ELF - extremely low frequency given :

How do static fields differ from time-varying fields ? A static field does not vary over time. A direct current (DC) is an electric current flowing in one direction only. In any battery-powered appliance the current flows from the battery to the appliance and then back to the battery. It will create a static magnetic field. .... In contrast, time-varying electromagnetic fields are produced by alternating currents (AC)

are thus extremely low frequency -ELF - fields a property of AC current only and not of DC?, that way when an electrical appliance such as a phone/tablet/laptop runs on battery only  does not emmit ELF, but on the other hand when plugged into a socket becomes subject to AC, thus emmiting ELF ?

A: The quote is incorrect on this bit: -

In any battery-powered appliance the current flows from the battery to
  the appliance and then back to the battery. It will create a static
  magnetic field.

The above is wrong - most battery powered pieces of equipment consume a static current (basically the average current taken) and an alternating current superimposed on the static current. The alternating current produces alternating magnetic fields which can be detected.
An exception to this is a battery connected to a passive component like a resistor. In this case the current might decrease very slowly over time (due to battery exhausting itself) but the slowness of the current change (in the order of milli amps per hour) will not generate a field that is easily detectable other than by using a gauss/flux meter (they are also used to measure the earth's largely static magnetic field.

A: It depends on how you define ELF. The ITU and IEEE designation is electromagnetic radiation at frequencies from >0.3Hz to 300Hz. However the World Health Organization's extremely low frequency category goes down to zero, so turning your phone off at night could be causing it to produce ELF at 11.6µHz.
If ELF is from >0.3Hz to 300Hz, then a phone charger that draws pulses of current at 301Hz is not producing ELF, but one which charges with a 'DC' current interrupted every 2.99 seconds is (that the current is always flowing in the same direction is irrelevant - the variation is still AC).

A static field does not vary over time

A truly static field is impossible - unless it has always existed. In practice we call a field 'static' if it doesn't vary significantly over the length of time we are interested in.


text:
Q: How to delete multiple empty spaces simultaneously? I have a passage here but it separate via new line such as this picture. How to delete the space separate between the words simultaneously because there are so many in my original documents (the picture is just example). The final result should be a one sentence only.
Edited:
I do change the new picture to give a better prespective

A: Replace two spaces with one and redo it until done.
For horizontal spaces, in the Replace dialog (Ctrl+H) put two spaces in the find box and one space in the replace with box. Hit Replace All repeatedly until Word tells you it can't find any.


text:
Q: How to create custom view with on Click in android This is my class
import android.content.Context
import android.util.AttributeSet
import android.view.View
import androidx.appcompat.widget.AppCompatTextView
import timber.log.Timber

class ContactUsLink : AppCompatTextView, View.OnClickListener {
    constructor(context: Context?, attrs: AttributeSet?, defStyle: Int) : super(context, attrs, defStyle) {
        init()
    }

    constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) {
        init()
    }

    constructor(context: Context?) : super(context) {
        init()
    }

    private fun init() {
        setOnClickListener(this)
    }

    override fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int) {
        super.onLayout(changed, left, top, right, bottom)
    }

    override fun onClick(v: View?) {
       Timber.d("Click Event ");

        // Do whatever you need to
    }
}

This is my XML calling like below
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="wrap_content"
              android:layout_height="match_parent"
              android:background="@color/background_grey"
              android:orientation="vertical">

<com.tesco.clubcardmobile.features.common.customview.ContactUsLink
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:padding="12dp"
            android:text="Click Here"
            android:layout_marginLeft="20dp"
            android:layout_marginTop="10dp"/>

</LinearLayout>

I am able to display view in my layout display text view but when I click on the text of text view on click is not working can you please tell me how to apply on click function.

A: Call setMovementMethod(LinkMovementMethod.getInstance()) on your custom view and it will open browser
The onClick method is no longer needed as LinkMovementMethod will do all the work for you. Also, you can use UrlSpannable.
Here is your updated custom view. It no longer needs OnClickListener and Context no longer nullable type.
import android.content.Context
import android.text.SpannableString
import android.text.Spanned
import android.text.method.LinkMovementMethod
import android.text.style.URLSpan
import android.util.AttributeSet
import androidx.appcompat.widget.AppCompatTextView

class ContactUsLink : AppCompatTextView {
    constructor(context: Context, attrs: AttributeSet?, defStyle: Int) : super(
        context,
        attrs,
        defStyle
    ) {
        init()
    }

    constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) {
        init()
    }

    constructor(context: Context) : super(context) {
        init()
    }

    private fun init() {
        val spannableString = SpannableString(text.toString())
        spannableString.setSpan(
            URLSpan("https://developer.android.com/reference/android/text/style/URLSpan?authuser=1"),
            0,
            text.length,
            Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
        )
        text = spannableString
        movementMethod = LinkMovementMethod.getInstance()
    }

}

And here is your XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:background="@color/background_grey"
    android:orientation="vertical">

    <com.tesco.clubcardmobile.features.common.customview.ContactUsLink
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="12dp"
        android:text="Click. Here"
        android:layout_marginLeft="20dp"
        android:layout_marginTop="10dp"/>

</LinearLayout>

A: If you want your whole view to be clickable, and not just a URL in a span on the text (which you should avoid when possible, as it may be a small touch target), then
override fun onClick(v: View) {
    val intent = Intent(
        Intent.ACTION_VIEW,
        Uri.parse("https://www.tesco.com/help/contact/")
    )
    startActivity(intent)
}


text:
Q: Exchange Online - Unable to change end time of event in progress Assume the following:

*

*In Office365 a room resource has been created with the default
settings.

*A  meeting is booked at this room.

*The meeting has started.

The organizer then changes the end-time of the meeting (either to extend it or end it early).
The room auto-replies with
Your meeting request was declined. The invitation was declined because it occurred in the past.
Interestingly, at this point, the event then completely disappears from the room's calendar - as if it never existed.
This is a reasonable use-case. Which settings would allow the organizer to achieve the above scenario without being declined?


text:
Q: How to link two different tables and update the second one? I have two tables, A and B.
Table A  .Birthday  .Name    .LastName
Table B  .Date      .Salary  .Rent

I need to write a query that increases Salary by 10% for everybody born on (Birthday=) 05/05/1977.
I don't know how to link these two tables and make it update table B.

A: As they don't have a common column it is not possible to join those tables.

A: As previously mentioned by fellow distinguished users, you NEED the PK in Table A and FK in Table B, otherwise it is impossible to join. But to do the actual updateing a better sql query would be:

Update b set b.Salary = b.Salary*1.1
From TableB b Inner Join TableA a On b.Id = a.Id
Where a.Birthday = '05/05/1977'

A: My dear first you have to link these two tables. Create a field of a_id in your A table and use that field as primary key in A table. Then also create a field a_id as a foreign key in you B table. After that you will be able to write the query

$q="select a_id from A where birthday='05/05/1977'";
$rs= mysql_query($q);
if($rs && mysql_num_rows($rs))
{
 whlile($rd=mysql_fetch_object($rs))
 {
  $q1="update B set salary=(salary*1.1) where aid=$rd->aid";
  $rs=mysql_query($q1);
 }
}


text:
Q: Aggregation query takes more than hour Oracle SELECT
  subs_key,
  sum(ROUNDED_DATA_VOLUME) AS RDV_SUM,
  CASE WHEN to_char(CALL_START_TIME , 'HH24:MI:SS') >= '00:00:00'
        AND to_char(CALL_START_TIME , 'HH24:MI:SS') <= '07:00:00' THEN 'Night'
       WHEN to_char(CALL_START_TIME , 'HH24:MI:SS') >  '07:00:00'
        AND to_char(CALL_START_TIME , 'HH24:MI:SS') <= '23:59:59' THEN 'Day'
  END AS Tariff_flag
FROM DWH.FCT_USAGE_PREP_OGPRS_N
WHERE CALL_START_TIME >= to_date('2021-11-01', 'YYYY-MM-DD')
  AND CALL_START_TIME <= to_date('2021-11-30', 'YYYY-MM-DD')
GROUP BY
  SUBS_KEY,
  CASE WHEN (to_char(CALL_START_TIME , 'HH24:MI:SS') >= '00:00:00'
    AND to_char(CALL_START_TIME, 'HH24:MI:SS') <= '07:00:00') THEN 'Night'
       WHEN (to_char(CALL_START_TIME , 'HH24:MI:SS') > '07:00:00'
    AND to_char(CALL_START_TIME, 'HH24:MI:SS') <= '23:59:59') THEN 'Day'
  END

My query takes more than hour and still running. Is there any way to optimize it?
UPD:
Execution Plan
Is that what Ankit asked?

A: You are grouping by a relatively complex function:
CASE WHEN (to_char(CALL_START_TIME , 'HH24:MI:SS') >= '00:00:00' AND to_char(CALL_START_TIME , 'HH24:MI:SS') <= '07:00:00') THEN 'Night'
WHEN (to_char(CALL_START_TIME , 'HH24:MI:SS') > '07:00:00' AND to_char(CALL_START_TIME , 'HH24:MI:SS') <= '23:59:59') THEN 'Day' END

If this particular query is important enough you could index this whole thing, but I suspect you would be better off getting the hour using extract.
CASE WHEN extract(hour from CALL_START_TIME) > 7 then 'Night' --midnight (inclusive) - 7am (exclusive)
     else 'Day' --7am (inclusive) - midnight (exclusive)
END

For your where clause I would
I have no way to tell whether this will speed up your query. Or speed it up sufficiently for your use case. But you can try out the two queries and see if one of them is significantly faster than the other. Also, if you're frequently using times, it might make sense to index extract(hour from CALL_START_TIME), whereas an index on your entire case statement is only likely to get used in this one query.
Your question is how to speed up the query but when I have a query that takes hours to run I will often not bother to optimize it. It's long enough that you're unlikely to get the kind of speed-ups you need to have an application executing the query based on a user's request, and if a query takes 1 hour or 12, you likely need to plan when you run it.


text: Q: Flutter печать чека на термопринтере, как предварительно просмотреть чек перед печатью? Я использую esc_pos_bluetooth в своем приложении Flutter, есть ли способ экспортировать билет в pdf или изображение, чтобы иметь возможность предварительного просмотра перед печатью.


text:
Q: Implementing CRUD services for JSP/Servlet Application - Problems with read operations I am currently working on a website that incorporates JSP's, servlets and some CRUD database services. I am stuck on the read portion of the CRUD, as I am unable to get the desired effects.
I am connected to a database and am able to insert data from the website without any trouble.  What I am trying to do now is to have a select/option box in the JSP call on a row from the database, and to have the corresponding columns of the row translate on the next page.  However, I am unable to get more than one row from the option box to appear.  The code is listed below.
Bean class:
public class ReadBean {
    protected String title;
    protected String author;
    protected String text;

    public String getTitle() {
        return title;
    }

    public void setTitle(String newTitle) {
        title = newTitle;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String newAuthor) {
        author = newAuthor;
    }

    public String getText() {
        return text;
    }

    public void setText(String newText) {
        text = newText;
    }
}

Controller:
@WebServlet(urlPatterns = { "/com/defaultValidate/ReadController" })
public class ReadController extends HttpServlet {

    protected void doGet(HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {
        ReadBean reader = new ReadBean();
        String address;

        if (request.getParameter("ReadConfirm") != null) {
            try {
                Connection connect = ConnectionManager.getConnection();
                String SQL = "SELECT * FROM prayers ORDER BY prayerTitle DESC";
                PreparedStatement ps = connect.prepareStatement(SQL);

                ResultSet rs = ps.executeQuery();
                while (rs.next()) {
                    request.getSession().setAttribute("ref", reader);
                    reader.setTitle(rs.getString("prayerTitle"));
                }
            } catch (Exception e) {
            }
            address = "ReadConfirm.jsp";
        } else if (request.getParameter("ReadView") != null) {
            address = "ReadView.jsp";
        } else {
            address = null;
        }

        RequestDispatcher dispatcher = request.getRequestDispatcher(address);
        dispatcher.forward(request, response);
    }
}

And then the corresponding jsp page that the controller responds to:
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<%@include file="MenuHeader.jsp"%>

Options

Select a prayer

                        <form action="ReadController">

                                        <select name="prayer_id">

                                                <c:forEach var="ReadController"       items="${ref.title}">
                                                    <option value="">${ref.title}</option>
                                                </c:forEach>

                                            </select>

                                        <input type="submit" name="ReadView" value="View">

                        </form>

    <%@ include file="../menuHeaderAndFooter/MenuFooter.jsp" %>

I am definitely not an expert, but I think I am missing something in between the connection from the controller to the for-each element in the JSP that I am simply stuck on.  In case curious, the WEB-XML portion of this section is operational and the ConnectionManager is a simple call to set up the connection to the database.  The Glassfish package is the utilized server.
If you have any questions about any other portion of the code, let me know as I am quite interested in getting this particular project completed and running as soon and efficiently as possible.  I will be happy to provide any additional coding and reference requested.
Any assistance on this particular spot is most appreciated and very helpful.  Thank you for looking this over.

A: The problem is here with this part of your code
while(rs.next()){
   request.getSession().setAttribute("ref", reader);
   reader.setTitle(rs.getString("prayerTitle"));
}

You are overriding the "ref" attribute every time you are reading a new value and then putting  that "ref" in the session. So you are putting a single value in the session and hence you are getting a single row.
So instead put all that values inside a collection like a list and then set that list inside the session:
List<ReadBean> myList = new Arraylist<ReadBean>();
while(rs.next()){
   ReadBean reader = new ReadBean();
   reader.setTitle(rs.getString("prayerTitle"));
   myList.add(reader);
}
request.getSession().setAttribute("ref", myList);

Now you can use the for each inside your jsp as :
<c:forEach var="myReader" items="${ref}">
       <option value="">${myReader.title}</option>
</c:forEach>

Please note the changes that I have made in the for-each loop above.
First in items attribute you need a collection, so we set a collection named ref inside the session, so we can use it.
Now in the var attribute, we define a local variable whihc is similar to
for(Reader myReader : ref) //myReader will go in var and ref the list(collection) will go in items
And now you can access the properties using the myReader var in the for-each like ${myReader.title} or ${myReader['title']}

A: Modify your code
List<ReadBean> readerList = new Arraylist<ReadBean>();

while(rs.next()){
// blah blah
reader.setTitle(rs.getString("prayerTitle"));
readerList.add(reader); // add this reader instance to list
}
// after while loop
request.getSession().setAttribute("ref", readerList);

Modify your JSP accordingly to iterate over readerList if necessary, i think it should work without jsp modification.


text:
Q: Extract Key from XML I am invoking an API using "Invoke-WebRequest" and getting the below as return XML.
<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://www.sft.com/">a879-956c3452f55e3c</string>

How can I extract the "a879-956c3452f55e3c" part from this retun XML.
I tried this code
$tmpstring1 = $temp.Content -split 'com/">'
$finalString1 = $tmpstring1[1] -split "</"
$Key = $finalString1[0]

A: String parsing of XML text is best avoided, because it is brittle; it's always preferable to us a dedicated XML parser; fortunately, PowerShell provides easy access to .NET's System.Xml.XmlDocument type ([xml]):
$xmlText = @'
<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://www.sft.com/">a879-956c3452f55e3c</string>
'@

([xml] $xmlText).string.InnerText  # .'#text' works too

Note: PowerShell conveniently adapts the XML DOM for dot notation, so that elements and attributes can be accessed as if they were regular object properties - see this answer for more information.
Normally, an XML element that only has text content (a text child node, such as the <string> element's a879-956c3452f55e3c value here) directly returns that text content when accessed with dot notation (.string).
However, because the <string> element has a namespace declaration (xmlns=...), .string actually returns a [System.Xml.XmlElement] instance whose text child node must explicitly be accessed, either via its .InnerText property or via the adapted property named for the (generic) node name of the text child element, .'#text'.


text:
Q: Why doesn't cant it copy folders and only does files I have a method that takes source address, destination address and an ArrayList, then it goes through the giver Source folder and check each file with the ArrayList items and if they have the same name, then it copies the the destination with the exact same folder structure (so it makes folders in needed). All works till here. But it gives error if the item of the ArrayList is a folder name. Some how It can't find that folder, and comes up with errors.
Here is my code:
public class Syncer {

    public static void main(String[] args) {
        File source = new File("D:\\Documents\\A X");
        File destination = new File("D:\\Documents\\A X Sample");
        ArrayList<String> list = new ArrayList<String>();
        list.add("third");

        folderCrawler(source, destination, list);
    }

    public static void folderCrawler(File src, File dest, ArrayList<String> filesToCopy){
        if(src.isDirectory()){
            String[] children = src.list();
            for(String file:children){

                if(filesToCopy.contains(file)){
                    File from = new File(src, file);
                    File to = new File(dest, file);
                    dest.mkdirs();

                    try{
                        copy(from, to);
                    }catch(IOException e){
                        e.printStackTrace();
                        System.exit(0);
                    }
                }
                else{System.out.println("Not Found");}
            }

            for (int i=0; i<children.length; i++){
                folderCrawler(new File(src, children[i]), new File(dest, children[i]), filesToCopy);
            }
        }
    }
    public static void copy(File src, File dest) throws IOException{
        InputStream in = new FileInputStream(src);
        OutputStream out = new FileOutputStream(dest);

        byte[] buf = new byte[1024];
        int len;
        while ((len = in.read(buf)) > 0) {
            out.write(buf, 0, len);
        }
        System.out.println("Copied: " + src.getName());
        in.close();
        out.close();
    }
}

It does compile and goes down the list till it finds the array item same as the current source, and then stops.
Error:
java.io.FileNotFoundException: D:\Documents\A X\folder2\tohi\third (Access is denied)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:138)
    at syncer.Syncer.copy(Syncer.java:61)
    at syncer.Syncer.folderCrawler(Syncer.java:45)
    at syncer.Syncer.folderCrawler(Syncer.java:55)
    at syncer.Syncer.folderCrawler(Syncer.java:55)
    at syncer.Syncer.main(Syncer.java:31)

In my other mathchine I get same error but it is (Is a directory) instead of (Access denied).
So any idea to make it work even if a folder is given. So it will copy the folder with its inner files ?

A: Sorry, I don' have enough rep to comment.
Have a look at apache commons FileUtils. They have a lot of copy functions so you don't have to implement them yourself.


text:
Q: when to call XMLHttpRequest? Is there a difference in browser behavior between:
var xhr = new XMLHttpRequest();
xhr.open('GET',url);
xhr.onload = function(){/*various things*/};
xhr.onerror = function(){/*various things*/};
xhr.send();

and
var xhr = new XMLHttpRequest();
xhr.onload = function(){/*various things*/};
xhr.onerror = function(){/*various things*/};
xhr.open('GET',url);
xhr.send();

The reason I ask: I have an uploading process that performs ~500 xhr.sends() (over many GBs of uploads), and I'm seeing that sometimes just one of the .sends() silently fails - no evidence of the request in the servers logs, and no errors shown on the client side. As an experiment I changed my code from the 1st pattern above, to the 2nd pattern, and it seems to be 'fixed', but n=1 does not a proof make, so I'm trying to figure whether there is a best practice, or rationale for doing #2 instead of #1.
It's in Chrome 25.0.1364.172m on Win7. Perhaps it's a Chrome bug, but before I file that I want to check I'm not missing something obvious.
Thanks!

A: Rob W stated "The code you've shown behaves identical in all respects.". No-one contested that, and I have no evidence to the contrary, so I'm accepting that as the answer. Thanks Rob.


text:
Q: Url rewriting using .htaccess file on php i am using htaccess for dynamic url rewriting. i want to show the test.php as test.html
the htaccess code is
Options +FollowSymlinks

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\.html$ $1.php [nc]

after running test.php, the browser show test.php on address bar. but if i change test.php as test.html  the page give the same content. my apache config file are fine. how can i solve this?
thanks to help me..

A: You cant deny access to your .php
Yon need to put in your a tag the html link and it will go to php in the background.
If you still want to sow only the html address you can put regex in your php file and check if the extension is php. if so redirect the page to html.
example:
<?php
     $temp = $_SERVER['PHP_SELF'];
     $temp = explode('.', $temp);
     if($temp[count($temp)-1] == "php"){
         header("Location: test.html", true, 301);
     }
?>

* not tasted !!! *


text:
Q: Should One Use ctx.moveTo Before ctx.lineTo I couldn't find this on mdn (I know it's not the official reference) or anywhere else; so, I thought I would just ask this easy question:
For example, I have the following snippet:
var can = document.getElementById("can");
var ctx = can.getContext("2d");
var w = can.width; var h = can.height;
var ys = [1, 3, 2, 4, 5, 3, 2, 4, 5, 6, 7, 3];
ctx.beginPath();
for (var i = 0, iMax = ys.length; i < iMax; i++) {
    ctx.lineTo(i, ys[i]);
}
ctx.stroke();

It works in chrome, firefox, ie11, but I was wondering about the validity of the code and cross-browser support. I couldn't find any mention of it, but I assume that there must be some mention of it.
Therefore, my question is, should one use ctx.moveTo before using ctx.lineTo or is it completely fine to merely use ctx.lineTo first (after ctx.beginPath), and why? (I couldn't find an answer on this, but sorry if it's a duplicate.)

A: No, there is no need to call moveTo before a lineTo if you just called beginPath.
According to specs:

The lineTo(x, y) method, when invoked, must run these steps:

*

*If either of the arguments are infinite or NaN, then return.

*If the object's path has no subpaths, then ensure there is a subpath for (x, y).

*Otherwise, connect the last point in the subpath to the given point (x, y) using a straight line, and then add the given point (x, y) to the subpath.

After calling beginPath, the object's path has no subpaths, and thus, we end in the second bullet of this algorithm.
The algorithm to ensure there is a subpath is:

When the user agent is to ensure there is a subpath for a coordinate (x, y) on a path, the user agent must check to see if the path has its need new subpath flag set. If it does, then the user agent must create a new subpath with the point (x, y) as its first (and only) point, as if the moveTo() method had been called, and must then unset the path's need new subpath flag.

So you first call to lineTo after beginPath is actually converted to a moveTo call.

var ctx = canvas.getContext('2d');
ctx.beginPath();
ctx.lineTo(120, 120); // converted to moveTo
ctx.lineTo(200, 150);
ctx.stroke();
<canvas id="canvas"></canvas>

Note that only lineTo has its algorithm set to stop right after this ensure there is a subpath algorithm, this means that other methods will continue drawing after this inserted moveTo.

var ctx = canvas.getContext('2d');
ctx.beginPath();
ctx.arc(60, 60, 30, 0, Math.PI);
// first we'll get new (x, y) coordinates of the first point of our arc (90, 60)
// since there is no subpath yet, we implicitely call moveTo(90, 60)
// then we draw the arc as usual
ctx.stroke();
<canvas id="canvas"></canvas>

A: I have checked it out now correctly:
ctx.moveTo function you can use only if you want to start to draw a new path. And ctx.lineTo function you can use instead of ctx.moveTo function.
If you write only ctx.lineTo(50, 50) then the computer understands it like ctx.moveTo(50, 50);. Without following call from ctx.lineTo you can not draw. In this case you have to use after this call the next call from ctx.lineTo again.

var ctx = document.querySelector('canvas').getContext('2d');
ctx.lineTo(50, 50); // it is like moveTo
ctx.lineTo(150, 150);

ctx.moveTo(180, 150);
ctx.lineTo(180, 50);
ctx.stroke();
<canvas width="250" height="250"></canvas>

In my example above you can see two unconnected lines because with the call ctx.moveTo we start to draw a new path.

A: Like others have said, moveTo() is used to set the initial point of your line.
ctx.moveTo(x,y) would be useful if you wanted to draw again, but starting from another point.
for (var i = 0, iMax = ys.length; i < iMax; i++) {
    ctx.lineTo(i, ys[i]);
}
//uncomment
// ctx.moveTo(20, ys[0]+20)
for (var i = 0, iMax = ys.length; i < iMax; i++) {
    ctx.lineTo(i+20, ys[i]+20);
}
ctx.stroke();

Edit this pen to see the difference:
https://codepen.io/caiodv/pen/rrLMRm


text:
Q: How to remove blurriness around pie chart when using custom colors? I'm using MPAndroidchart pie chart and used my own colors for charts. Now the problem is the pie chart is blurred. Its edges are in blur. I want to remove the blur and make it sharp edges.How to do it?
I don't have 10 reputations to post image.
https://drive.google.com/open?id=1umms-1LZj0XuuKuDpOWZqcpRCOn6rh-X

Here is the code for chart displaying.
private void showChart(BudgetResponse.Budgets[] items) {
        chart.setVisibility(View.VISIBLE);
        chart.setUsePercentValues(true);
        chart.getDescription().setEnabled(false);
        chart.setExtraOffsets(5, 10, 5, 5);

        chart.setDragDecelerationFrictionCoef(0.95f);

        //chart.setCenterTextTypeface(tfLight);
        //chart.setCenterText(generateCenterSpannableText());

        chart.setDrawHoleEnabled(true);
        chart.setHoleColor(Color.TRANSPARENT);

        chart.setTransparentCircleColor(Color.WHITE);
        chart.setTransparentCircleAlpha(110);

        chart.setHoleRadius(58f);
        chart.setTransparentCircleRadius(61f);

        chart.setDrawCenterText(true);
        SimpleSpanBuilder sb=new SimpleSpanBuilder();
        sb.append("Total budget",new RelativeSizeSpan(1.0f));
        float budget=0;
        try{
            for (int i=0;i<items.length;i++){
                budget+=Float.parseFloat(items[i].getCurrentAmount());
            }
        }catch (Exception e){
            e.printStackTrace();
        }
        sb.append("\n"+budget,new RelativeSizeSpan(2.0f),
                new ForegroundColorSpan(activity.getResources().getColor(R.color.colorPrimary)));

        chart.setCenterText(sb.build());
        chart.setCenterTextColor(activity.getResources().getColor(R.color.titleColor));
        chart.setCenterTextSizePixels(12f);

        chart.setRotationAngle(0);
        // enable rotation of the chart by touch
        chart.setRotationEnabled(false);
        chart.setHighlightPerTapEnabled(true);

        chart.animateY(1400, Easing.EaseInOutQuad);

        chart.getLegend().setEnabled(false);

        ArrayList<PieEntry> entries = new ArrayList<>();

        ArrayList<Integer> pieColors=new ArrayList<>();

        for (BudgetResponse.Budgets budgets:items){
            entries.add(new PieEntry(Float.parseFloat(budgets.getCurrentAmount()), budgets.getCategoryGroupName()));
            if(budgets.getCategoryGroupName().contains("Bills")){
                pieColors.add(getAppColor(R.color.lightViolet));
            }else if(budgets.getCategoryGroupName().contains("Entertainment")){
                pieColors.add(getAppColor(R.color.lightPink));
            }else if(budgets.getCategoryGroupName().contains("Food")){
                pieColors.add(getAppColor(R.color.lightBlue));
            }else if(budgets.getCategoryGroupName().contains("Auto")){
                pieColors.add(getAppColor(R.color.darkViolet));
            }else if(budgets.getCategoryGroupName().contains("Shopping")){
                pieColors.add(getAppColor(R.color.lightOrangeVariant));
            }else if(budgets.getCategoryGroupName().contains("Transfers")){
                pieColors.add(getAppColor(R.color.lightGreenVariant));
            }
        }
        // add a lot of colors

        ArrayList<Integer> colors = new ArrayList<>(pieColors);

        PieDataSet dataSet = new PieDataSet(entries, "Budget Spends");

        dataSet.setDrawIcons(false);

        dataSet.setSliceSpace(3f);
        dataSet.setIconsOffset(new MPPointF(0, 40));
        dataSet.setSelectionShift(1f);

        colors.add(ColorTemplate.getHoloBlue());

        dataSet.setColors(colors);
        //dataSet.setSelectionShift(0f);

        PieData data = new PieData(dataSet);
        data.setValueFormatter(new PercentFormatter(chart));
        data.setValueTextSize(11f);
        data.setValueTextColor(Color.TRANSPARENT);
        //data.setValueTypeface(tfLight);
        chart.setData(data);

        //to remove labels over pie chart
        chart.setDrawEntryLabels(false);
        //to remove percentage over pie chart
        chart.setUsePercentValues(false);
        //chart.setDrawCenterText(false);

        // undo all highlights
        chart.highlightValues(null);

        MyMarkerView mv = new MyMarkerView(activity, R.layout.custom_marker_view);
        mv.setChartView(chart); // For bounds control
        chart.setMarker(mv); //

        chart.invalidate();

    }

I want to remove blurriness around chart.

In activity the donut chat looks great. But in viewpager it looks blur.


text:
Q: Diagonalization of Leslie matrix I am trying to show that this matrix:
$$L=\begin{bmatrix}
 f_0 &  f_1& \cdot & \cdot & f_n\\
p_0 &  0 & \cdot & \cdot & 0\\
0 &  p_1& \cdot & \cdot & 0\\
\cdot &  \cdot& \cdot & \cdot & \cdot\\
0 &  0& \cdot & p_{n-1} & 0
\end{bmatrix}\mbox{  , } 0\leq f_i \mbox{ and }0<p_i<1.$$
commonly known as the Leslie matrix is diagonalizable.
I know a $n \times n$ matrix is diagonalizable if there exist $n$ linearly independent eigenvectors. I also know two different eigenvalues have linearly independent eigenvectors. So my approach was to show the characteristic equation of the Leslie matrix has $n$ different solutions, but here I got stuck.
Can somebody help me?

A: Here is a simple counterexample with a $3 \times 3$ matrix:
$$L=\begin{bmatrix}
 1 &  5&   3\\
 1 &   0&   0\\
 0 &   1&   0
\end{bmatrix}$$
with eigenvalues $-1$ (order of multiplicity $2$) and $3$.
The eigenspace associated with eigenvalue $-1$ is obtained as solution of
$$\begin{cases}2x&+&5y&+&3z&=&0\\x&+&y&&&=&0\\&&y&+&z&=&0\end{cases}$$
which gives $\begin{bmatrix}x\\y\\z\end{bmatrix} \ = \ k \ \begin{bmatrix}\ \ 1\\-1\\ \ \ 1\end{bmatrix}.$
Thus, this eigenspace is only one dimensional. As this dimension is less than the order of multiplicity of the corresponding eigenvalue, matrix $L$ is not diagonalizable.
Remark 1: $kL$, with any positive real $k$, is a counterexample as well.
Remark 2: matrix $L$ is a "companion" matrix : see the Wikipedia article (http://www.math.wsu.edu/faculty/watkins/seminar/pdfiles/fiedler_companion.pdf) where it is explicitly said: "In general, the companion matrix may be non-diagonalizable.". But the difficulty is to find such a matrix with positive coefficients.
Remark 3: a companion matrix can have different equivalent forms: one can find the (opposite of the) list of polynomial coefficients on

*

*the rightmost column (as in the Wikipedia article)

*upper row (in direct correspondence with Leslie matrices, as the convention taken in Matlab (https://fr.mathworks.com/help/matlab/ref/compan.html)),

*bottom row.
Remark 4: the counterexample given by @quasi is, up to a multiplication by 2 (which does not affect the "non-diagonalizability" property), a "companion matrix".
If you are interested by companion matrices, here is a very interesting discussion by Cleve Moler, the founder of Matlab: (http://blogs.mathworks.com/cleve/2013/12/23/fiedler-companion-matrix/)


text:
Q: Keeping track of dropped indices when dropping elements from numpy array I want to drop elements from a numpy array theoretical_price_for_bonds that do not meet a particular condition. I know I can do this with the line of code below. However, I also want to keep track of the indices of the deleted elements and I was wondering how I could look to do this.
theoretical_price_for_bonds = theoretical_price_for_bonds[(theoretical_price_for_bonds>75)]

I tried using loops to delete elements dynamically from the numpy array. The prices are okay, but dropped_indices turns out to be just a list filled with None's:
#To insert values into a list dynamically
class GrowingList(list):
    def __setitem__(self, index, value):
        if index >= len(self):
            self.extend([None]*(index + 1 - len(self)))
        list.__setitem__(self, index, value)

count = 0
dropped_indices = GrowingList()
for x,value in np.ndenumerate(theoretical_price_for_bonds):
    count = count + 1
    if count < theoretical_price_for_bonds.shape[0]:
        if theoretical_price_for_bonds[count] < 75:
            theoretical_price_for_bonds = np.delete(theoretical_price_for_bonds, (count), axis=0)
            dropped_indices[count] = count

Thank You

A: If you'd like to keep track of the indices of elements that were dropped, just hold on to the boolean mask you use to index into the array and use np.where:
>>> x = np.array([2,8,3,4,7,6,1])
>>> lix = x > 4
>>> x = x[lix] # this "drops" everything 4 or less
>>> x
array([8, 7, 6])
>>> [dropped] = np.where(~lix) # find the indices that weren't dropped
>>> dropped
array([0, 2, 3, 6])

A: You might also consider using a pandas.Series, which has a .index attribute that can be used to keep track of dropped values:
import numpy as np
import pandas as pd

s = pd.Series(np.array([2,8,3,4,7,6,1]))
print(s.values, s.index)
# (array([2, 8, 3, 4, 7, 6, 1]), Int64Index([0, 1, 2, 3, 4, 5, 6], dtype='int64'))

s2 = s[s > 4]
print(s2.values, s2.index)
# (array([8, 7, 6]), Int64Index([1, 4, 5], dtype='int64'))


text:
Q: Extracting data from only one line in a command substitution without echo $data | I have a command that I'd like to run and get output from. Here's the command:
sh execute_odi_script.sh Audit_ExecutionLogStart.sql heelo

It should return
Begin Informatica Script 18 Redshift Delta copy completed at: 04/10/17 18:46:20 END

Now I need to grab just the output from the SQL file, which is 18 in this case.
Someone was able to help me achieve that, but only if I do it in 2 steps like so:
> logStart=$( sh execute_odi_script.sh Audit_ExecutionLogStart.sql heelo )
> echo $logStart | sed -r s/.*Begin\ Informatica\ Script\ \(\.*\)\ Redshift\ Delta.*/\\1/ ); echo $logStart
18

I've been trying to play around with how I'm doing the command substitution but am having trouble understanding what to even change. How do I do all this in one line?

A: First -- if you only care about one line, grep for that line:
logStart=$( sh execute_odi_script.sh Audit_ExecutionLogStart.sql heelo \
            | grep -e "Begin Informatica Script" \
            | sed -r 's/.*Begin Informatica Script (.*) Redshift Delta.*/\1/' )
echo "$logStart"

Alternately, you  the entire pipeline inside the command substitution:
logStart=$( sh execute_odi_script.sh Audit_ExecutionLogStart.sql heelo \
            | tr '\n' ' ' \
            | sed -r 's/.*Begin Informatica Script (.*) Redshift Delta.*/\1/' )
echo "$logStart"

If you want to avoid the echo as a separate step, you might add a | tee /dev/stderr to the end of the pipeline (again, inside $()).


text:
Q: How can I mapped through this object from firestore? Getting the users collection from firestore:
  useEffect(() => {
        if (currentUser) {
          const unsubscribe = db
            .collection("users")
            .doc(uid)
            .onSnapshot((snapshot) => {
          const arr = [];
          arr.push({
            ...snapshot.data(),
          });

          setUsers(arr);
          console.log(JSON.stringify(arr));
        });

      return () => {
        unsubscribe();
      };
    }
  }, [currentUser]);

This is what is shows where I console.log(JSON.stringify(arr));
[
  {
    1: { others: "books", items: { Item1: true, Item2: true } },
    2: {
      items: { Item3: true, Item2: true },
      others: "books",
    },

    displayName: Inigi,
    address: "US",
  },
];

I am new to react so this is quite confusing to me. How do I retrieve and display those 1 and 2?
I tried this but it does not work and I keep on getting an error:"

TypeError: _user$.items.map is not a function

 {user["1"]?.items.map((index) => (
                  <li>{index.Item1}</li>
                ))}

A: You can use {user["1"]?.others}


text:
Q: Multiple file upload with codeigniter Once again I need some help.
I'm creating a multiple file upload function with codeigniter and I'm stuck with the "multiple" part.
The follwing code works perfect to upload a single image, it basically uploads an regular size image to a folder and a thumbnail size version of the same image to another folder.
2 images for 2 folders, see my code:
$config['upload_path'] = './cars/large_thumb/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '2000';
$config['file_name'] = $newfilename;
$this->load->library('upload', $config);
$this->upload->initialize($config);
$uploadimages = $this->upload->do_upload();
$image_data = $this->upload->data();

$configlarge = array(
    'source_image' => $image_data['full_path'],
    'new_image' => './cars/large_thumb',
    'maintain_ratio' => true,
    'quality' => 70,
    'width' => 600,
    'height' => 450
);
$this->load->library('image_lib', $configlarge);
$this->image_lib->initialize($configlarge);
$resizelarge = $this->image_lib->resize();

$configsmall = array(
    'source_image' => $image_data['full_path'],
    'new_image' => './cars/small_thumb',
    'maintain_ratio' => true,
    'width' => 100,
    'height' => 75
);
$this->load->library('image_lib', $configsmall);
$this->image_lib->initialize($configsmall);
$resizesmall = $this->image_lib->resize();

What I need help with is the loop that that should run this code as many times as images are being uploaded.
I tried a "foreach" loop using something like this:
foreach ($_FILES["userfile"]["error"] as $key => $error)  {
    code above here...
  }

And it gives me this error: Message: Array to string conversion
I've also tried a "for" loop in which I iterate through the code and it kind of works, but it uploads the last image as many times as images were being uploaded.
Hope somebody can share some knowledge with me.
Thanks

A:
I've also tried a "for" loop in which I iterate through the code and it kind of works, but it uploads the last image as many times as images were being uploaded.

It looks like you attempted to fix the problem with a for loop which was only broken because you have the incorrect naming convention for the HTML form.
Try something like the following:
    <form action="upload.php" method="post" enctype="multipart/form-data">
    <input type="file" name="car_1" value="" />
    <input type="file" name="car_2" value="" />
    <input type="file" name="car_3" value="" />
    </form>

Then in your code you can change
    $uploadimages = $this->upload->do_upload();

to
    $uploadimages = $this->upload->do_upload('car_1');

You should be able to enclose it in a loop to go through each image you want uploaded with the afor mentioned for loop you were using