text:
Q: Application running indefinitely while using spring-integration I am using spring-integration to merge two files . But while merging the files, the application is running indefinitely. Below is my code to merge
 @EventListener(ApplicationReadyEvent.class)
    public void mergeFiles() {
        for (String file : fileNamesList){
            try {
                sftpRemoteFileTemplate.execute((SessionCallbackWithoutResult<ChannelSftp.LsEntry>) session -> {
                    session.append(session.readRaw("path/to/input/"+file), "path/to/output/file3.txt");

                });

            } catch (Exception e) {
                log.error("Could not send file per FTP: " + e);
            } finally {
                sftpRemoteFileTemplate.getSession().close();
                log.info("closing FTP session ");
            }
    }
            }

The fileNamesList got injected properly and the application is starting fine. I checked the output folder in sftp server and in file3.txt only content of first file is present. After the last line of logs given below, logs are not getting printed any further . Below are the logs of application
 Started Application in 2.874 seconds (JVM running for 3.994)
2022-10-09 19:08:37,386 [main] INFO  com.jcraft.jsch: Connecting to 192.168.1.32 port 22
2022-10-09 19:08:37,410 [main] INFO  com.jcraft.jsch: Connection established
2022-10-09 19:08:37,418 [main] INFO  com.jcraft.jsch: Remote version string: SSH-2.0-OpenSSH_7.4
2022-10-09 19:08:37,418 [main] INFO  com.jcraft.jsch: Local version string: SSH-2.0-JSCH-0.1.54
2022-10-09 19:08:37,418 [main] INFO  com.jcraft.jsch: CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256
2022-10-09 19:08:37,473 [main] INFO  com.jcraft.jsch: CheckKexes: diffie-hellman-group14-sha1,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521
2022-10-09 19:08:37,625 [main] INFO  com.jcraft.jsch: CheckSignatures: ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
2022-10-09 19:08:37,630 [main] INFO  com.jcraft.jsch: SSH_MSG_KEXINIT sent
2022-10-09 19:08:37,630 [main] INFO  com.jcraft.jsch: SSH_MSG_KEXINIT received
2022-10-09 19:08:37,631 [main] INFO  com.jcraft.jsch: kex: server: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
2022-10-09 19:08:37,631 [main] INFO  com.jcraft.jsch: kex: server: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519
2022-10-09 19:08:37,631 [main] INFO  com.jcraft.jsch: kex: server: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,aes192-cbc,aes256-cbc,blowfish-cbc,cast128-cbc,3des-cbc
2022-10-09 19:08:37,631 [main] INFO  com.jcraft.jsch: kex: server: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,aes192-cbc,aes256-cbc,blowfish-cbc,cast128-cbc,3des-cbc
2022-10-09 19:08:37,631 [main] INFO  com.jcraft.jsch: kex: server: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
2022-10-09 19:08:37,631 [main] INFO  com.jcraft.jsch: kex: server: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
2022-10-09 19:08:37,631 [main] INFO  com.jcraft.jsch: kex: server: none,zlib@openssh.com
2022-10-09 19:08:37,631 [main] INFO  com.jcraft.jsch: kex: server: none,zlib@openssh.com
2022-10-09 19:08:37,631 [main] INFO  com.jcraft.jsch: kex: server:
2022-10-09 19:08:37,632 [main] INFO  com.jcraft.jsch: kex: server:
2022-10-09 19:08:37,632 [main] INFO  com.jcraft.jsch: kex: client: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
2022-10-09 19:08:37,632 [main] INFO  com.jcraft.jsch: kex: client: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
2022-10-09 19:08:37,632 [main] INFO  com.jcraft.jsch: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-ctr,aes192-cbc,aes256-ctr,aes256-cbc
2022-10-09 19:08:37,632 [main] INFO  com.jcraft.jsch: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-ctr,aes192-cbc,aes256-ctr,aes256-cbc
2022-10-09 19:08:37,632 [main] INFO  com.jcraft.jsch: kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
2022-10-09 19:08:37,632 [main] INFO  com.jcraft.jsch: kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
2022-10-09 19:08:37,632 [main] INFO  com.jcraft.jsch: kex: client: none
2022-10-09 19:08:37,632 [main] INFO  com.jcraft.jsch: kex: client: none
2022-10-09 19:08:37,634 [main] INFO  com.jcraft.jsch: kex: client:
2022-10-09 19:08:37,634 [main] INFO  com.jcraft.jsch: kex: client:
2022-10-09 19:08:37,634 [main] INFO  com.jcraft.jsch: kex: server->client aes128-ctr hmac-sha1 none
2022-10-09 19:08:37,634 [main] INFO  com.jcraft.jsch: kex: client->server aes128-ctr hmac-sha1 none
2022-10-09 19:08:37,639 [main] INFO  com.jcraft.jsch: SSH_MSG_KEX_ECDH_INIT sent
2022-10-09 19:08:37,639 [main] INFO  com.jcraft.jsch: expecting SSH_MSG_KEX_ECDH_REPLY
2022-10-09 19:08:37,649 [main] INFO  com.jcraft.jsch: ssh_rsa_verify: signature true
2022-10-09 19:08:37,655 [main] INFO  o.s.i.sftp.session.DefaultSftpSessionFactory: The authenticity of host '192.168.1.32' can't be established.
RSA key fingerprint is 7c:6a:e8:bb:2d:1e:4a:88:4c:b1:98:07:c8:cb:4b:34.
Are you sure you want to continue connecting?
2022-10-09 19:08:37,655 [main] WARN  com.jcraft.jsch: Permanently added '192.168.1.32' (RSA) to the list of known hosts.
2022-10-09 19:08:37,655 [main] INFO  com.jcraft.jsch: SSH_MSG_NEWKEYS sent
2022-10-09 19:08:37,655 [main] INFO  com.jcraft.jsch: SSH_MSG_NEWKEYS received
2022-10-09 19:08:37,659 [main] INFO  com.jcraft.jsch: SSH_MSG_SERVICE_REQUEST sent
2022-10-09 19:08:37,660 [main] INFO  com.jcraft.jsch: SSH_MSG_SERVICE_ACCEPT received
2022-10-09 19:08:37,666 [main] INFO  com.jcraft.jsch: Authentications that can continue: gssapi-with-mic,publickey,keyboard-interactive,password
2022-10-09 19:08:37,666 [main] INFO  com.jcraft.jsch: Next authentication method: gssapi-with-mic
2022-10-09 19:08:37,669 [main] INFO  com.jcraft.jsch: Authentications that can continue: publickey,keyboard-interactive,password
2022-10-09 19:08:37,670 [main] INFO  com.jcraft.jsch: Next authentication method: publickey
2022-10-09 19:08:37,799 [main] INFO  com.jcraft.jsch: Authentication succeeded (publickey).


text:
Q: {14.04 Elementary OS} sudo apt-get update - Failed to Fetch (Also Software Center doesn't open) Here is the output of sudo apt-get update in the terminal:
Hit http://gr.archive.ubuntu.com trusty-updates InRelease
Hit http://repo.steampowered.com precise InRelease
Hit http://gr.archive.ubuntu.com trusty-backports InRelease
Hit http://repo.steampowered.com precise/steam Sources
Ign http://archive.canonical.com trusty InRelease
Ign http://debian.intergenia.de trusty InRelease
Hit http://gr.archive.ubuntu.com trusty-proposed InRelease
Ign http://ppa.launchpad.net sid InRelease
Hit http://gr.archive.ubuntu.com trusty-updates/main Sources
Hit http://repo.steampowered.com precise/steam amd64 Packages
Hit http://archive.canonical.com trusty Release.gpg
Hit http://gr.archive.ubuntu.com trusty-updates/restricted Sources
Ign http://ppa.launchpad.net sid InRelease
Hit http://gr.archive.ubuntu.com trusty-updates/universe Sources
Hit http://repo.steampowered.com precise/steam i386 Packages
Ign http://debian.intergenia.de trusty Release.gpg
Hit http://archive.canonical.com trusty Release
Hit http://gr.archive.ubuntu.com trusty-updates/multiverse Sources
Ign http://ppa.launchpad.net sid InRelease
Hit http://security.ubuntu.com trusty-security InRelease
Hit http://gr.archive.ubuntu.com trusty-updates/restricted amd64 Packages
Hit http://archive.canonical.com trusty/partner amd64 Packages
Ign http://ppa.launchpad.net sid InRelease
Ign http://debian.intergenia.de trusty Release
Hit http://gr.archive.ubuntu.com trusty-updates/multiverse amd64 Packages
Hit http://archive.canonical.com trusty/partner armhf Packages
Ign http://ppa.launchpad.net sid InRelease
Hit http://security.ubuntu.com trusty-security/main Sources
Hit http://archive.canonical.com trusty/partner i386 Packages
Ign http://ppa.launchpad.net sid Release.gpg
Hit http://archive.canonical.com trusty/partner Translation-en
Ign http://ppa.launchpad.net sid Release.gpg
Hit http://security.ubuntu.com trusty-security/restricted Sources
Hit http://gr.archive.ubuntu.com trusty-updates/restricted i386 Packages
Ign http://ppa.launchpad.net sid Release.gpg
Hit http://security.ubuntu.com trusty-security/universe Sources
Ign http://ppa.launchpad.net sid Release.gpg
Hit http://gr.archive.ubuntu.com trusty-updates/multiverse i386 Packages
Ign http://ppa.launchpad.net sid Release.gpg
Hit http://gr.archive.ubuntu.com trusty-updates/main Translation-en
Hit http://security.ubuntu.com trusty-security/multiverse Sources
Hit http://gr.archive.ubuntu.com trusty-updates/multiverse Translation-en
Ign http://ppa.launchpad.net sid Release
Hit http://gr.archive.ubuntu.com trusty-updates/restricted Translation-en
Hit http://gr.archive.ubuntu.com trusty-updates/universe Translation-en
Ign http://ppa.launchpad.net sid Release
Hit http://gr.archive.ubuntu.com trusty-backports/main Sources
Hit http://security.ubuntu.com trusty-security/main amd64 Packages
Hit http://gr.archive.ubuntu.com trusty-backports/restricted Sources
Ign http://ppa.launchpad.net sid Release
Hit http://gr.archive.ubuntu.com trusty-backports/universe Sources
Hit http://gr.archive.ubuntu.com trusty-backports/multiverse Sources
Ign http://ppa.launchpad.net sid Release
Hit http://gr.archive.ubuntu.com trusty-backports/universe amd64 Packages
Hit http://security.ubuntu.com trusty-security/restricted amd64 Packages
Hit http://gr.archive.ubuntu.com trusty-backports/multiverse amd64 Packages
Ign http://ppa.launchpad.net sid Release
Hit http://gr.archive.ubuntu.com trusty-backports/restricted amd64 Packages
Hit http://gr.archive.ubuntu.com trusty-backports/main amd64 Packages
Hit http://security.ubuntu.com trusty-security/universe amd64 Packages
Hit http://gr.archive.ubuntu.com trusty-backports/universe i386 Packages
Hit http://security.ubuntu.com trusty-security/multiverse amd64 Packages
Hit http://gr.archive.ubuntu.com trusty-backports/multiverse i386 Packages
Hit http://gr.archive.ubuntu.com trusty-backports/restricted i386 Packages
Hit http://gr.archive.ubuntu.com trusty-backports/main i386 Packages
Hit http://gr.archive.ubuntu.com trusty-backports/main Translation-en
Hit http://gr.archive.ubuntu.com trusty-backports/multiverse Translation-en
Hit http://gr.archive.ubuntu.com trusty-backports/restricted Translation-en
Ign http://dl.google.com stable InRelease
Ign http://download.opensuse.org  InRelease
Hit http://gr.archive.ubuntu.com trusty-backports/universe Translation-en
Hit http://download.opensuse.org  Release.gpg
Ign http://dl.google.com stable InRelease
Hit http://gr.archive.ubuntu.com trusty-proposed/universe amd64 Packages
Hit http://gr.archive.ubuntu.com trusty-proposed/multiverse amd64 Packages
Hit http://download.opensuse.org  Release
Hit http://dl.google.com stable Release.gpg
Hit http://security.ubuntu.com trusty-security/main i386 Packages
Hit http://gr.archive.ubuntu.com trusty-proposed/restricted amd64 Packages
Hit http://download.opensuse.org  Packages
Hit http://dl.google.com stable Release.gpg
Hit http://gr.archive.ubuntu.com trusty-proposed/main amd64 Packages
Hit http://dl.google.com stable Release
Ign http://repo.steampowered.com precise/steam Translation-en_US
Hit http://security.ubuntu.com trusty-security/restricted i386 Packages
Ign http://repo.steampowered.com precise/steam Translation-en
Hit http://dl.google.com stable Release
Hit http://gr.archive.ubuntu.com trusty-proposed/universe i386 Packages
Hit http://dl.google.com stable/main amd64 Packages
Hit http://security.ubuntu.com trusty-security/universe i386 Packages
Hit http://gr.archive.ubuntu.com trusty-proposed/multiverse i386 Packages
Hit http://dl.google.com stable/main amd64 Packages
Hit http://gr.archive.ubuntu.com trusty-proposed/restricted i386 Packages
Hit http://security.ubuntu.com trusty-security/multiverse i386 Packages
Hit http://gr.archive.ubuntu.com trusty-proposed/main i386 Packages
Hit http://security.ubuntu.com trusty-security/main Translation-en
Hit http://gr.archive.ubuntu.com trusty-proposed/main Translation-en
Hit http://gr.archive.ubuntu.com trusty-proposed/multiverse Translation-en
Hit http://gr.archive.ubuntu.com trusty-proposed/restricted Translation-en
Ign http://download.opensuse.org  Translation-en_US
Hit http://gr.archive.ubuntu.com trusty-proposed/universe Translation-en
Get:1 http://gr.archive.ubuntu.com trusty-updates/main amd64 Packages [740 kB]
Ign http://download.opensuse.org  Translation-en
Hit http://security.ubuntu.com trusty-security/multiverse Translation-en
Hit http://security.ubuntu.com trusty-security/restricted Translation-en
Hit http://security.ubuntu.com trusty-security/universe Translation-en
Get:2 http://gr.archive.ubuntu.com trusty-updates/universe amd64 Packages [356 kB]
Get:3 http://gr.archive.ubuntu.com trusty-updates/main i386 Packages [710 kB]
Err http://security.ubuntu.com trusty-security/main armhf Packages
  404  Not Found [IP: 91.189.91.15 80]
Err http://security.ubuntu.com trusty-security/restricted armhf Packages
  404  Not Found [IP: 91.189.91.15 80]
Get:4 http://gr.archive.ubuntu.com trusty-updates/universe i386 Packages [357 kB]
Err http://security.ubuntu.com trusty-security/universe armhf Packages
  404  Not Found [IP: 91.189.91.15 80]
Err http://security.ubuntu.com trusty-security/multiverse armhf Packages
  404  Not Found [IP: 91.189.91.15 80]
Err http://gr.archive.ubuntu.com trusty-updates/restricted armhf Packages
  404  Not Found
Err http://gr.archive.ubuntu.com trusty-updates/main armhf Packages
  404  Not Found
Err http://gr.archive.ubuntu.com trusty-updates/universe armhf Packages
  404  Not Found
Err http://gr.archive.ubuntu.com trusty-updates/multiverse armhf Packages
  404  Not Found
Err http://gr.archive.ubuntu.com trusty-backports/universe armhf Packages
  404  Not Found
Err http://gr.archive.ubuntu.com trusty-backports/multiverse armhf Packages
  404  Not Found
Err http://gr.archive.ubuntu.com trusty-backports/restricted armhf Packages
  404  Not Found
Err http://gr.archive.ubuntu.com trusty-backports/main armhf Packages
  404  Not Found
Err http://gr.archive.ubuntu.com trusty-proposed/universe armhf Packages
  404  Not Found
Err http://gr.archive.ubuntu.com trusty-proposed/multiverse armhf Packages
  404  Not Found
Err http://gr.archive.ubuntu.com trusty-proposed/restricted armhf Packages
  404  Not Found
Err http://gr.archive.ubuntu.com trusty-proposed/main armhf Packages
  404  Not Found
Err http://ppa.launchpad.net sid/main amd64 Packages
  404  Not Found
Err http://ppa.launchpad.net sid/main armhf Packages
  404  Not Found
Err http://ppa.launchpad.net sid/main i386 Packages
  404  Not Found
Ign http://ppa.launchpad.net sid/main Translation-en_US
Ign http://ppa.launchpad.net sid/main Translation-en
Err http://ppa.launchpad.net sid/main amd64 Packages
  404  Not Found
Err http://ppa.launchpad.net sid/main armhf Packages
  404  Not Found
Err http://ppa.launchpad.net sid/main i386 Packages
  404  Not Found
Ign http://ppa.launchpad.net sid/main Translation-en_US
Ign http://ppa.launchpad.net sid/main Translation-en
Err http://ppa.launchpad.net sid/main amd64 Packages
  404  Not Found
Err http://ppa.launchpad.net sid/main armhf Packages
  404  Not Found
Err http://ppa.launchpad.net sid/main i386 Packages
  404  Not Found
Ign http://ppa.launchpad.net sid/main Translation-en_US
Ign http://ppa.launchpad.net sid/main Translation-en
Err http://ppa.launchpad.net sid/main amd64 Packages
  404  Not Found
Err http://ppa.launchpad.net sid/main armhf Packages
  404  Not Found
Err http://ppa.launchpad.net sid/main i386 Packages
  404  Not Found
Ign http://ppa.launchpad.net sid/main Translation-en_US
Ign http://ppa.launchpad.net sid/main Translation-en
Err http://ppa.launchpad.net sid/main amd64 Packages
  404  Not Found
Err http://ppa.launchpad.net sid/main armhf Packages
  404  Not Found
Err http://ppa.launchpad.net sid/main i386 Packages
  404  Not Found
Ign http://ppa.launchpad.net sid/main Translation-en_US
Ign http://ppa.launchpad.net sid/main Translation-en
Err http://debian.intergenia.de trusty/main Sources
  404  Not Found
Err http://debian.intergenia.de trusty/restricted Sources
  404  Not Found
Err http://debian.intergenia.de trusty/universe Sources
  404  Not Found
Err http://debian.intergenia.de trusty/multiverse Sources
  404  Not Found
Err http://debian.intergenia.de trusty/main amd64 Packages
  404  Not Found
Err http://debian.intergenia.de trusty/restricted amd64 Packages
  404  Not Found
Err http://debian.intergenia.de trusty/universe amd64 Packages
  404  Not Found
Err http://debian.intergenia.de trusty/multiverse amd64 Packages
  404  Not Found
Err http://debian.intergenia.de trusty/main armhf Packages
  404  Not Found
Err http://debian.intergenia.de trusty/restricted armhf Packages
  404  Not Found
Err http://debian.intergenia.de trusty/universe armhf Packages
  404  Not Found
Err http://debian.intergenia.de trusty/multiverse armhf Packages
  404  Not Found
Err http://debian.intergenia.de trusty/main i386 Packages
  404  Not Found
Err http://debian.intergenia.de trusty/restricted i386 Packages
  404  Not Found
Err http://debian.intergenia.de trusty/universe i386 Packages
  404  Not Found
Err http://debian.intergenia.de trusty/multiverse i386 Packages
  404  Not Found
Ign http://debian.intergenia.de trusty/main Translation-en_US
Ign http://debian.intergenia.de trusty/main Translation-en
Ign http://debian.intergenia.de trusty/multiverse Translation-en_US
Ign http://debian.intergenia.de trusty/multiverse Translation-en
Ign http://debian.intergenia.de trusty/restricted Translation-en_US
Ign http://debian.intergenia.de trusty/restricted Translation-en
Ign http://debian.intergenia.de trusty/universe Translation-en_US
Ign http://debian.intergenia.de trusty/universe Translation-en
Fetched 2,163 kB in 26s (81.8 kB/s)
W: Failed to fetch http://gr.archive.ubuntu.com/ubuntu/dists/trusty-updates/main/binary-amd64/Packages  Hash Sum mismatch

W: Failed to fetch http://gr.archive.ubuntu.com/ubuntu/dists/trusty-updates/universe/binary-amd64/Packages  Hash Sum mismatch

W: Failed to fetch http://gr.archive.ubuntu.com/ubuntu/dists/trusty-updates/restricted/binary-armhf/Packages  404  Not Found

W: Failed to fetch http://gr.archive.ubuntu.com/ubuntu/dists/trusty-updates/main/binary-armhf/Packages  404  Not Found

W: Failed to fetch http://gr.archive.ubuntu.com/ubuntu/dists/trusty-updates/universe/binary-armhf/Packages  404  Not Found

W: Failed to fetch http://gr.archive.ubuntu.com/ubuntu/dists/trusty-updates/multiverse/binary-armhf/Packages  404  Not Found

W: Failed to fetch http://gr.archive.ubuntu.com/ubuntu/dists/trusty-updates/main/binary-i386/Packages  Hash Sum mismatch

W: Failed to fetch http://gr.archive.ubuntu.com/ubuntu/dists/trusty-updates/universe/binary-i386/Packages  Hash Sum mismatch

W: Failed to fetch http://gr.archive.ubuntu.com/ubuntu/dists/trusty-backports/universe/binary-armhf/Packages  404  Not Found

W: Failed to fetch http://gr.archive.ubuntu.com/ubuntu/dists/trusty-backports/multiverse/binary-armhf/Packages  404  Not Found

W: Failed to fetch http://gr.archive.ubuntu.com/ubuntu/dists/trusty-backports/restricted/binary-armhf/Packages  404  Not Found

W: Failed to fetch http://gr.archive.ubuntu.com/ubuntu/dists/trusty-backports/main/binary-armhf/Packages  404  Not Found

W: Failed to fetch http://gr.archive.ubuntu.com/ubuntu/dists/trusty-proposed/universe/binary-armhf/Packages  404  Not Found

W: Failed to fetch http://gr.archive.ubuntu.com/ubuntu/dists/trusty-proposed/multiverse/binary-armhf/Packages  404  Not Found

W: Failed to fetch http://gr.archive.ubuntu.com/ubuntu/dists/trusty-proposed/restricted/binary-armhf/Packages  404  Not Found

W: Failed to fetch http://gr.archive.ubuntu.com/ubuntu/dists/trusty-proposed/main/binary-armhf/Packages  404  Not Found

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/main/binary-armhf/Packages  404  Not Found [IP: 91.189.91.15 80]

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/restricted/binary-armhf/Packages  404  Not Found [IP: 91.189.91.15 80]

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/universe/binary-armhf/Packages  404  Not Found [IP: 91.189.91.15 80]

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/multiverse/binary-armhf/Packages  404  Not Found [IP: 91.189.91.15 80]

W: Failed to fetch http://debian.intergenia.de/debian/dists/trusty/main/source/Sources  404  Not Found

W: Failed to fetch http://debian.intergenia.de/debian/dists/trusty/restricted/source/Sources  404  Not Found

W: Failed to fetch http://debian.intergenia.de/debian/dists/trusty/universe/source/Sources  404  Not Found

W: Failed to fetch http://debian.intergenia.de/debian/dists/trusty/multiverse/source/Sources  404  Not Found

W: Failed to fetch http://debian.intergenia.de/debian/dists/trusty/main/binary-amd64/Packages  404  Not Found

W: Failed to fetch http://debian.intergenia.de/debian/dists/trusty/restricted/binary-amd64/Packages  404  Not Found

W: Failed to fetch http://debian.intergenia.de/debian/dists/trusty/universe/binary-amd64/Packages  404  Not Found

W: Failed to fetch http://debian.intergenia.de/debian/dists/trusty/multiverse/binary-amd64/Packages  404  Not Found

W: Failed to fetch http://debian.intergenia.de/debian/dists/trusty/main/binary-armhf/Packages  404  Not Found

W: Failed to fetch http://debian.intergenia.de/debian/dists/trusty/restricted/binary-armhf/Packages  404  Not Found

W: Failed to fetch http://debian.intergenia.de/debian/dists/trusty/universe/binary-armhf/Packages  404  Not Found

W: Failed to fetch http://debian.intergenia.de/debian/dists/trusty/multiverse/binary-armhf/Packages  404  Not Found

W: Failed to fetch http://debian.intergenia.de/debian/dists/trusty/main/binary-i386/Packages  404  Not Found

W: Failed to fetch http://debian.intergenia.de/debian/dists/trusty/restricted/binary-i386/Packages  404  Not Found

W: Failed to fetch http://debian.intergenia.de/debian/dists/trusty/universe/binary-i386/Packages  404  Not Found

W: Failed to fetch http://debian.intergenia.de/debian/dists/trusty/multiverse/binary-i386/Packages  404  Not Found

W: Failed to fetch http://ppa.launchpad.net/gregory-hainaut/pcsx2.official.ppa/ubuntu/dists/sid/main/binary-amd64/Packages  404  Not Found

W: Failed to fetch http://ppa.launchpad.net/gregory-hainaut/pcsx2.official.ppa/ubuntu/dists/sid/main/binary-armhf/Packages  404  Not Found

W: Failed to fetch http://ppa.launchpad.net/gregory-hainaut/pcsx2.official.ppa/ubuntu/dists/sid/main/binary-i386/Packages  404  Not Found

W: Failed to fetch http://ppa.launchpad.net/hunter-kaller/ppa/ubuntu/dists/sid/main/binary-amd64/Packages  404  Not Found

W: Failed to fetch http://ppa.launchpad.net/hunter-kaller/ppa/ubuntu/dists/sid/main/binary-armhf/Packages  404  Not Found

W: Failed to fetch http://ppa.launchpad.net/hunter-kaller/ppa/ubuntu/dists/sid/main/binary-i386/Packages  404  Not Found

W: Failed to fetch http://ppa.launchpad.net/mjblenner/ppa-hal/ubuntu/dists/sid/main/binary-amd64/Packages  404  Not Found

W: Failed to fetch http://ppa.launchpad.net/mjblenner/ppa-hal/ubuntu/dists/sid/main/binary-armhf/Packages  404  Not Found

W: Failed to fetch http://ppa.launchpad.net/mjblenner/ppa-hal/ubuntu/dists/sid/main/binary-i386/Packages  404  Not Found

W: Failed to fetch http://ppa.launchpad.net/noobslab/pcsx2/ubuntu/dists/sid/main/binary-amd64/Packages  404  Not Found

W: Failed to fetch http://ppa.launchpad.net/noobslab/pcsx2/ubuntu/dists/sid/main/binary-armhf/Packages  404  Not Found

W: Failed to fetch http://ppa.launchpad.net/noobslab/pcsx2/ubuntu/dists/sid/main/binary-i386/Packages  404  Not Found

W: Failed to fetch http://ppa.launchpad.net/pcsx2-team/pcsx2-daily/ubuntu/dists/sid/main/binary-amd64/Packages  404  Not Found

W: Failed to fetch http://ppa.launchpad.net/pcsx2-team/pcsx2-daily/ubuntu/dists/sid/main/binary-armhf/Packages  404  Not Found

W: Failed to fetch http://ppa.launchpad.net/pcsx2-team/pcsx2-daily/ubuntu/dists/sid/main/binary-i386/Packages  404  Not Found

W: Failed to fetch http://dl.google.com/linux/chrome/deb/dists/stable/Release  Unable to find expected entry 'main/binary-armhf/Packages' in Release file (Wrong sources.list entry or malformed file)

W: Failed to fetch http://dl.google.com/linux/earth/deb/dists/stable/Release  Unable to find expected entry 'main/binary-armhf/Packages' in Release file (Wrong sources.list entry or malformed file)

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

This is my /etc/apt/sources.list
###### Ubuntu Main Repos
deb http://gr.archive.ubuntu.com/ubuntu/ trusty main restricted
deb-src http://gr.archive.ubuntu.com/ubuntu/ trusty main restricted

###### Ubuntu Update Repos
deb http://gr.archive.ubuntu.com/ubuntu/ trusty-security main restricted
deb http://gr.archive.ubuntu.com/ubuntu/ trusty-updates main restricted
deb-src http://gr.archive.ubuntu.com/ubuntu/ trusty-security main restricted
deb-src http://gr.archive.ubuntu.com/ubuntu/ trusty-updates main restricted

###### Ubuntu Partner Repo
deb http://archive.canonical.com/ubuntu trusty partner
deb-src http://archive.canonical.com/ubuntu trusty partner

###### 3rd Party Binary Repos

#### Clementine PPA - http://www.clementine-player.org/
## Run this command: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 044A3B98
deb http://ppa.launchpad.net/me-davidsansome/clementine-dev/ubuntu trusty main

#### Dropbox - http://dropbox.com
## Run this command: sudo apt-key adv --keyserver pgp.mit.edu --recv-keys 5044912E
deb http://linux.dropbox.com/ubuntu/ trusty main

#### Steam for Linux - http://store.steampowered.com/about/
## Run this command: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F24AEA9FB05498B7
deb [arch=i386] http://repo.steampowered.com/steam/ precise steam

#### Wine PPA - https://launchpad.net/~ubuntu-wine/+archive/ppa/
## Run this command:  sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F9CB8DB0
deb http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu trusty main

####### 3rd Party Source Repos

#### Clementine PPA (Source) - http://www.clementine-player.org/
## Run this command: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 044A3B98
deb-src http://ppa.launchpad.net/me-davidsansome/clementine-dev/ubuntu trusty main

#### Wine PPA (Source) - https://launchpad.net/~ubuntu-wine/+archive/ppa/
## Run this command:  sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F9CB8DB0
deb-src http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu trusty main

I know it's a mess but I want help..
P.S My Software Center can't open, but I couldn't try the solutions i found online because the first thing they require is apt-get update.

A: You're getting a lot of 404s. That simply means those URLs do not exist. http://debian.intergenia.de is a Debian repository, as the name suggests and you easily verify by pointing a web browser to it. It doesn't contain trusty, which is an Ubuntu release. The Hash sum mismatch errors are easily fixed by deleting the relevant files in /var/lib/apt/lists. I think some of the other errors you're getting are because your chosen mirror doesn't have the armhf arch on it, I could do a more comprehensive audit of your sources, but just go to those urls yourself and check it out.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Allow user to send multiple's user to email via one function laravel function sendEmail($user_id){

    $ids = Input::get('system_id');
    DB::setFetchMode(PDO::FETCH_ASSOC);
    $send = DB::table('users')
                    ->whereIn('user_id', $ids)->get();

    $mainUser = User::where('user_id', $user_id)->first();
    foreach($send as $value) {

        $data = [
                    'master_name'  => $mainUser['name'],
                    'master_id'  => $mainUser->user_id,
                    'name'     => $value->name,
                    'email'    => $value['email'],
                    'link_confirmation_code'  => $value['link_confirmation_code']
                ];

        }

        Mail::later(5, 'emails.send.confirm-user', $data, function($message) use ($emails, $names)
                {
                    $message->from('no-reply@myemail.com', 'Myemail');
                    $message->to($emails, $names)->subject('Yes - connect us');
                });

}

In blade

Hi {{$name}},

{{$master_name}} has requested you to connect with us!

Connect

I expect each user should get email along with main_user and each user have confirmation_link that allow him/her to verifying the same. Applied code but does work only for single/first user not for others. please suggest

A: I assume that you just trying send the mail using dynamic looping without delay operation. If this is correct, follow below code:
In controller:
function sendEmail($user_id){

    $ids = Input::get('system_id');
    DB::setFetchMode(PDO::FETCH_ASSOC);
    $send = DB::table('users')
                    ->whereIn('user_id', $ids)->get();

    $mainUser = User::where('user_id', $user_id)->first();
    foreach($send as $value) {

        //Variable initializaation and setup operation...
        $toEmail = $value->email;
        $toName = $value->name;
        $link_confirmation_code = url('v1/register/', [$link_confirmation_code]);
        $data = [
                    'master_name'  => $mainUser['name'],
                    'master_id'  => $mainUser->user_id,
                    'name'     => toName,
                    'email'    => $toEmail,
                    'link_confirmation_code'  => $link_confirmation_code
                ];

        //Mail sendting operation...
        Mail::send('emails.send.confirm-user', $data, function($message) use($toEmail, $toName) {
            $message->from('no-reply@myemail.com', 'Myemail');
            $message->to($toEmail, $toName)->subject('Yes - connect us');
        });
    }
}

In Blade:
Hi {{$name}},

{{$master_name}} has requested you to connect with us!

Connect

Just check that $toEmail and $toName, as there is no definition given so place it as assumption.


text:
Q: Subquery-error message-Different data types I run the following SQL code from a public dataset:
SELECT station_id,name
FROM bigquery-public-data.new_york_citibike.citibike_stations
WHERE station_id IN (Select start_station_id  from bigquery-public-data.new_york_citibike.citibike_trips where usertype='Subscriber')
It is shown the message Cannot execute IN subquery with uncomparable types STRING and INT64.
The station_id is string and start_station_id is integer.
Can someone help with this please?
Thanks
Panos
I expected to run a query but it was shown an error message


text:
Q: ASP.Net C# - Remove controls dynamically I dynamically create a RadioButtonList or a CheckBoxList depending on a condition within a Button_Click event (which works).
protected void btnGetQuestion_Click(object sender, EventArgs e)
{
    string connStr = ConfigurationManager.ConnectionStrings["myConnectionString"].ConnectionString;
    MySqlConnection conn = new MySqlConnection(connStr);
    MySqlDataReader reader;

    List<string> listOfAnswerIDs = new List<string>();
    List<string> listOfAnswers = new List<string>();
    List<string> listOfCorrectAnswerIDs = new List<string>();

    int questionCounter = 0;

    //get questionIDs and store in ViewState["listOfQuestionIDs"]
    getListOfQuestionIDs();

    try
    {
        conn.Open();

        string cmdText = "SELECT * FROM questions_m WHERE question_id=@QuestionID";
        MySqlCommand cmd = new MySqlCommand(cmdText, conn);
        cmd.Parameters.Add("@QuestionID", MySqlDbType.Int32);
        cmd.Parameters["@QuestionID"].Value = listOfQuestionIDs[questionCounter];

        reader = cmd.ExecuteReader();

        if (reader.Read())
        {
            lblQuestion.Text = reader["question"].ToString();

            if (reader["type"].ToString().Equals("C"))
            {
                CheckBoxList cblAnswers = new CheckBoxList();
                cblAnswers.ID = "cblAnswers";
                Page.Form.Controls.Add(cblAnswers);
            }
            else if (reader["type"].ToString().Equals("R"))
            {
                RadioButtonList rblAnswers = new RadioButtonList();
                rblAnswers.ID = "rblAnswers";
                Page.Form.Controls.Add(rblAnswers);
            }

            questionCounter += 1;
            ViewState["questionCounter"] = questionCounter;
            ViewState["QuestionID"] = Convert.ToInt32(reader["question_id"]);
            reader.Close();

            string cmdText2 = "SELECT * FROM answers WHERE question_id=@QuestionID";
            MySqlCommand cmdAnswers = new MySqlCommand(cmdText2, conn);
            cmdAnswers.Parameters.Add("@QuestionID", MySqlDbType.Int32);
            cmdAnswers.Parameters["@QuestionID"].Value = ViewState["QuestionID"];

            reader = cmdAnswers.ExecuteReader();

            while (reader.Read())
            {
                listOfAnswerIDs.Add(reader["answer_id"].ToString());
                listOfAnswers.Add(reader["answer"].ToString());
            }

            reader.Close();
            populateAnswers(listOfAnswers, listOfAnswerIDs);
        }
        reader.Close();
    }
    catch
    {
        lblError.Text = "Database connection error - failed to read records.";
    }
    finally
    {
        conn.Close();
    }
}

I want to create a method that I can run in another button click event (btnNext_Click) that will remove the RadioButtonList or CheckBoxList if one exists.
I've tried the following but it doesn't seem to work:
protected void clearAnswers()
{
    if (((CheckBoxList)this.FindControl("cblAnswers")) != null)
    {
        Page.Form.Controls.Remove(this.FindControl("cblAnswers"));
    }

    if (((RadioButtonList)this.FindControl("rblAnswers")) != null)
    {
        Page.Form.Controls.Remove(this.FindControl("rblAnswers"));
    }
}

UPDATE:
I think the issue I had occured with the repopulation of the RadioButtonList/CheckBoxList. If I cleared each item before repopulating them, that resolved my problem.
    if (((CheckBoxList)this.FindControl("cblAnswers")) != null)
    {
        ((CheckBoxList)this.FindControl("cblAnswers")).Items.Clear();
        foreach (int num in numbers)
        {
            ((CheckBoxList)this.FindControl("cblAnswers")).Items.Add(ans[num - 1]);
        }
    }

    if (((RadioButtonList)this.FindControl("rblAnswers")) != null)
    {
        ((RadioButtonList)this.FindControl("rblAnswers")).Items.Clear();
        foreach (int num in numbers)
        {
            ((RadioButtonList)this.FindControl("rblAnswers")).Items.Add(ans[num - 1]);
        }
    }

A: Try this:
protected void clearAnswers()
{

    CheckBoxList cblAnswers = (CheckBoxList)this.FindControl("cblAnswers");
    RadioButtonList rblAnswers = (RadioButtonList)this.FindControl("rblAnswers");

    if (cblAnswers != null)
    {
        Page.Form.Controls.Remove(cblAnswers);
    }

    if (rblAnswers != null)
    {
        Page.Form.Controls.Remove(rblAnswers);
    }
}


text:
Q: Output of an algorithm in QGIS Graphic Modeler I use two Processing tools in a graphic Model in QGIS:
1-Select by Location
2-Select by Attribute
The problem is that I can't get the output of the selection by location so that I can't use it as input for other algorithms.

A: Select by Location tool doesn't give any output. It just selects features. If you want to process on selected features you have to add "Extract selected features" tool and set "Select by Location" as parent algorithm of "Extract selected features" tool. Then you can use the output as input for other algorithms.


text:
Q: Apex email : How to override 'From address' Friends,
This issue is driving me nuts. Basically, I have an APEX trigger which is supposed to send out emails to customers when new records are available for them to look at.
Everything is working as expected. Except the sender name on the email which is the "From address"
I read the documentation and called these methods as follows:
    // Specify the address used when the recipients reply to the email.

        mail.setReplyTo('testaccount@testOrg.com');

        // Specify the name used as the display name.

        mail.setSenderDisplayName('Test Org Account Team');

But the "from address" still shows my email because the trigger is executed by my user.
When the reply button is clicked, the sender is populated to the email address set above. But I do not want my email to show up on the "From address".
Looks like Salesforce is defaulting this to the person who ran the trigger. How can I override this :( ?
Thanks.

A: The only way to modify the From line of a mail is by using the  mail.setOrgWideEmailAddressId(ID) which requires the ID of an Organization-Wide Address record defined in Your Name | Setup | Email Administration | Organization-Wide Addresses
Org wide addresses let you specify both the Display Name and the Email Address in From line of your outgoing mails.
Documentation

A: One of the posts suggests that
Under "Email Administration" setting one has to check both the checkboxes under the section "Email Security Compliance" .  It works fine when one takes the above actions.
did you check if the above was selected ?
Also check out this post from Stackexchange where another user has the exact same question with a solution to the question


text:
Q: in my mysql table having rows in one single cell i have array. How can i select rows which are having a perticular array value? postCategory column having an arrays like
Array
(
    [0] => movie news
    [1] => breaking news
    [2] => political news
)

//So please tell me how to select data
<?php

$select_posts = "select *
                 from blogposts
                 where postCategory = 'political news'
                 IN(postCategory)
                 order by postId DESC
                 LIMIT 1,6";

$run_posts = mysqli_query($con,$select_posts);

while($row=mysqli_fetch_array($run_posts)){

    $postId = $row['postId'];
    $postTitle = $row['postTitle'];
    $postContent = $row['postContent'];
    $futureImage = $row['futureImage'];
    $postCategory = $row['postCategory'];
    $postTags = $row['postTags'];
    $postAuthor = $row['postAuthor'];
    $postDate = $row['postDate'];

?>

            <a href="blog-single.php?id=<?php echo $postId; ?>?postTitle=<?php echo str_replace(' ', '-', $postTitle);?>"> <?php echo substr($postTitle,0,60); ?>

<?php } ?>


text:
Q: Too few items for RecyclerView on screen I'm making an API call getData(forPage: Int): Response which  returns a page-worth of data (10 items max) and thereIsMoreData: Boolean.
The recyclerView is implemented that by scrolling, the scroll listener automatically fetches more data using that API call:
val scrollListener = object : MyScrollListener() {
        override fun loadMoreItems() {
            apiFunctionForLoading(currentPage + 1)
        }
}

The problem is that with longer screen devices that have more space for items (let's say 20), the RV receives 10 items and then doesn't allow scrolling, because there's no more items to scroll to. Without scrolling, more data cannot be loaded.
My naive solution:

*

*load first set of data

*if thereIsMoreData == true I load another page of data

*now I have more data than the screen can display at once hence allowing scroll

Is there a more ellegant solution?

A: An elegant way would be to check whether the view can actually scroll down:
recyclerView.canScrollVertically(1)

1 means downwards -> returns true if it is possible tro scroll down.
So if it returns false, your page is not fully filled yet.

A: Android has this Paging Library now which is about displaying chunks of data and fetching more when needed. I haven't used it and it looks like it might be a bit of work, but maybe it's worth a look?
Codepath has a tutorial on using it and I think their stuff is pretty good and easy to follow, so maybe check that out too. They also have this older tutorial that's closer to what you're doing (handling it yourself) so there's that too.
I guess in general, you'd want your adapter to return an "infinite" number for getItemCount() (like Integer.MAX_VALUE). And then in your onBindViewHolder(holder, position) method you'd either set the item at position, or if you don't have that item yet you load in the next page until you get it.
That way your initial page will always have the right amount of content, because it will be full of ViewHolders that have asked for data - if there's more than 10, then item 11 will have triggered the API call. But actually handling the callback and all the updating is the tricky part! If you have that working already then great, but it's what the Paging library was built to take care of for you (or at least make it easier!)


text:
Q: c++ string function i am trying to create a string function which is callable from the main function, however this gives segmentation fault... any ideas???
also is it possible to create a string function which returns a string..
#include <iostream>
#include <stdio.h>
#include <sstream>

using namespace std;

string callMe(string& k){

    cout << "String from callMe: " << k;

}

int main(){

   string k;

   k = "K SHK";

   cout << "String from main function: " << k << endl;

   callMe(k);

}

UPDATE:
its compiles fine..
[root@server dev]# ./stringtest
String from main function: K SHK
Segmentation fault

A: your function callMe is expected to return a string, but you never return anything.
If you have compiler warnings enabled, you are warned about this ( i suggest adding -Wall and -Wextra)
It's resolvable be changing the return type from string to void.
The main function however does not need a return statement (but for beginners it may be better to just add return 0;):
From the C++ standard:

A return statement in main has the effect of leaving the main function (destroying any objects with automatic storage
  duration) and calling std::exit with the return value as the argument. If control reaches the end of main without
  encountering a return statement, the effect is that of executing "return 0;"

A: The problem is that you have declared your function as returning a string, but don't return one.
There are two ways to fix it:

*

*If you didn't intend to return a string, change callMe to
void callMe(string& k);

*If you did intend to return a string, then do so, by adding a return statement, e.g.
return "I'm returned from callMe, called with " + k;
Additionally, some style comments:

*

*It is a good idea to initialize variables right at the point of definitions where possible. In your case you'd write:
string k = "K SHK";

or
string k("K SHK");

If you don't intend to modify the string afterwards, you might also consider to define is as const to catch accidental changes (e.g. by use of = instead of ==):
string const k = "K SHK";

*If you don't change the argument in callMe, you should use a reference to const:
void callMe(string const& k);

resp.
string callMe(string const& k);

This will allow you to call the function on constant strings and string literals, like callme("I'm a string literal");

A: void callMe(string& k){

    cout << "String from callMe: " << k;

}

Since you have declared Callme as a function that returns string, and on other side you are returning just nothing,such code can cause segmentation fault.(Since value in eax is undefined).

A: callMe() and main() functions must return something...

A: In your function callMe there is no return. Try:
void callMe(string& k)
{
   cout << "String from callMe: " << k;
}

The main() function must return an int (usually 0).
Ps: If you don't modify the string k in your function, use a const reference const string&.

A:
also is it possible to create a string function which returns a string..
  Certainly.  With a slight modification from your original code above it would look something like this...

string callMe(string& k){
    string returnValue("String from callMe: ");
    returnValue += k;
    cout << returnValue << endl;
    return returnValue;
}


text:
Q: Difference between two independent geometric random variables Let $\xi_1$ and $\xi_2$ be independent random variables:
$\xi_1 \simeq Geom(1/2), \xi_2 \simeq Geom(1/6)$.
How do you find the probability mass function of $\eta=\xi_1-\xi_2$ using convolution?

A: $$P(\xi_1 - \xi_2 = k) = \sum_{i=1}^{\infty} P(\xi_2 = i,\xi_1 = k+i) = \sum_{i=1}^{\infty}P(\xi_1=i)P(\xi_2 = k+i),$$ and you can calculate this sum easily using the mass functions of $\xi_1$ and $\xi_2$.


text:
Q: How can I run iTunes without installing Bonjour in Windows 7? I just checked my Windows error logs and Bonjour has caused a ton of errors.  After reading about Bonjour and not needing the networking services it provides, I deleted it.  Now when I open iTunes, an error message appears saying that there is a problem and that it has to close.
Other posts (1, 2) seem to imply that iTunes can run without Bonjour.
How can I get iTunes running on my Windows 7 machine without installing Bonjour?

A: not sure if this is what you are looking for but I have, on occasion, done a standard iTunes install and then gone into Programs and Features and uninstall Bonjour. That and Apple Software Update show up as separate items for installation.
What it then leaves behind, I am unsure of. You used to be able to run regmon and watch installs to see what it installed so you could then rip it out by the roots later. But I gather that it is no longer supported. Not sure if Process Monitor will do the same thing.

A: This article is a little stale but it worked for me awhile back...
http://www.zdnet.com/blog/bott/the-unofficial-guide-to-installing-itunes-10-without-bloatware/2390


text:
Q: jQuery ajax return negative numbers instead of content I have this in php:
return json_encode(array($raspuns, $table_licitatii, $option));

And this in jQuery:
request.done(function( msg ) {
  var result = $.parseJSON(msg);
  $("#done").html(result[0]);
  $("#table-licitatii").html(result[1]);
  $("#produs").html(result[2]);
});

With #done and #produs i have no problems, it's OK but in #table-licitatii instead of data(table) appear numbers(-1 -2) and on every request (-2 -2, -3 -2, -4 -2, -5 -2, -6 -2).
How can i solve this?
P.S. In #table-licitatii i have to insert somenthing like this:

                    Product name
                    Product code

                    TEST ( Amazon, Skype, PayPal)
                    LU5
                    9

                    TESTT @@@ ( Amazon, Skype)
                    LU7
                    5

A: Try to change following and console the result:
In php:
  return json_encode(array($raspuns, $table_licitatii, $option));

to
  echo json_encode(array($raspuns, $table_licitatii, $option));


text:
Q: Modification of a JLabel I have a windows, which have the following private datas: a collections of vehicles and the current vehicle of the collection.
    package model;

import javax.swing.*;

import java.awt.*;

import model.*;

/**
 *
 * @author jacques
 */
public class Windows extends JFrame
{
        private static final long serialVersionUID = 1L;
        private Showroom sr;
        private Vehicle v;
        private JLabel txt;

        public Windows(Showroom sr)
        {
                super();
                this.sr=sr;
                this.v=sr.current();
                if(v.isSold())
                {
                    this.txt= new JLabel("Manufacturer: "+v.getManufacturer()+"
"+
                        "Model: "+v.getModel()+"
"+
                        "VIN: "+v.getVIN()+"
"+
                        "Date of manufacture: "+v.getDatemanuf()+"
"+
                        "Price: "+v.getPrice()+"
"+
                        "Tax Band: "+v.getTaxband()+"
"+
                        "Date of solding: "+v.getDatesold());
                }
                else
                {
                    this.txt= new JLabel("Manufacturer: "+v.getManufacturer()+"
"+
                        "Model: "+v.getModel()+"
"+
                        "VIN: "+v.getVIN()+"
"+
                        "Date of manufacture: "+v.getDatemanuf()+"
"+
                        "Price: "+v.getPrice()+"
"+
                        "Tax Band: "+v.getTaxband()+"
");
                }
                build(sr);
        }

        public void build(Showroom sr)
        {
                setTitle("Vehicles"); //Titre de la fenêtre
                setSize(700,220); //Taille minimale fixée
                setLocationRelativeTo(null); //On centre la fenêtre sur l'écran
                setResizable(false); //On interdit la redimensionnement de la fenêtre
                setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //On dit à l'application de se fermer lors du clic sur la croix
                setContentPane(buildContentPane());
        }

        private JPanel buildContentPane()
        {
            JPanel panel=new JPanel();
            panel.setLayout(new BorderLayout());

            JPanel panelbutton= new JPanel();
            JButton buttonprev= new JButton(new ButtonPrevious(this, "Previous vehicle"));
            JButton buttonnext= new JButton(new ButtonNext(this, "Next vehicle"));
            JButton buttonsell= new JButton("Sell");
            panelbutton.add(buttonprev);
            panelbutton.add(buttonnext);
            panelbutton.add(buttonsell);

            JPanel paneltext=new JPanel();
            paneltext.add(txt);

            panel.add("North",panelbutton);
            panel.add("Center",paneltext);

            return panel;
        }

    public Showroom getSr()
    {
        return sr;
    }

    public Vehicle getV()
    {
        return v;
    }

    public JLabel getTxt()
    {
        return txt;
    }

    public void setV(Vehicle v)
    {
        this.v = v;
    }

    public void setTxt(JLabel txt)
    {
        this.txt = txt;
    }

}

The datas of the current vehicle are correctly displayed on the window.
But when i check the button next or previous, which normally change the current vehicle, the JLabel which displays the data of current vehicle dont change. Why ?
Here's the code of the abstract class which represent the action of one of the buttons.
    package model;
import java.awt.event.ActionEvent;

import javax.swing.*;
import java.util.*;

/**
 *
 * @author jacques
 */
public class ButtonNext extends AbstractAction
{
    private Windows wdw;

        public ButtonNext(Windows wdw, String txt)
        {
                super(txt);
                this.wdw = wdw;
        }

        public void actionPerformed(ActionEvent e)
        {
                try
                {
                    wdw.setV(wdw.getSr().next());
                }
                catch(NoSuchElementException et)
                {

                }
                if(wdw.getV().isSold()==true)
                {
                    JLabel txt= new JLabel("Manufacturer: "+wdw.getV().getManufacturer()+"
"+
                        "Model: "+wdw.getV().getModel()+"
"+
                        "VIN: "+wdw.getV().getVIN()+"
"+
                        "Date of manufacture: "+wdw.getV().getDatemanuf()+"
"+
                        "Price: "+wdw.getV().getPrice()+"
"+
                        "Tax Band: "+wdw.getV().getTaxband()+"
"+
                        "Date of solding: "+wdw.getV().getDatesold());
                    wdw.setTxt(txt);
                    wdw.repaint();
                    wdw.validate();
                }
                else
                {
                    JLabel txt= new JLabel("Manufacturer: "+wdw.getV().getManufacturer()+"
"+
                        "Model: "+wdw.getV().getModel()+"
"+
                        "VIN: "+wdw.getV().getVIN()+"
"+
                        "Date of manufacture: "+wdw.getV().getDatemanuf()+"
"+
                        "Price: "+wdw.getV().getPrice()+"
"+
                        "Tax Band: "+wdw.getV().getTaxband()+"
");
                    wdw.setTxt(txt);
                    wdw.repaint();
                    wdw.validate();
                }
        }
}

Where is the problem ?
Thanks.

A: Instead of changing the text of the JLabel that is displayed in the frame, your actions create a new JLabel, and call setTxt() on the Windows object. That changes the field in the Windows object, but the label that is displayed is still the initial one.
Replace
JLabel txt= new JLabel("bla bla bla");
wdw.setTxt(txt);
wdw.repaint();
wdw.validate();

by
wdw.getTxt().setText("bla bla bla");

Also, avoid that like the plague:
catch(NoSuchElementException et)
{

}

It basically ignores an exception, hiding a bug. This should never happen. You shoulf check, before going to the next element, that there is one. Or even better, disable the next button when there is no next element.
And finally,
if(wdw.getV().isSold()==true)

should be written
if (wdw.getV().isSold())


text:
Q: Use Android device settings in my app I am on Android 2.3 and need to use the default system Wifi settings screen as part of my application. I was hoping to find a way to "wrap" it because this is part of a configuration manager app.
So if Wifi is not configured, the user cannot continue. Is there any easy way to display the Wifi settings screen with a "next >" button at the bottom?
EDIT:
This basically is NOT doable. The only option here was to "recreate" the wifi settings screen in my app, which is a royal pain, but it works.

A: Look at android.provider.Settings for a series of Intent actions you can use to launch various settings screens (e.g., ACTION_WIFI_SETTINGS).
ConnectivityManager manager = (ConnectivityManager)getSystemService(MainActivity.CONNECTIVITY_SERVICE);

        /*
         * 3G confirm
         */
        Boolean is3g = manager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).isConnectedOrConnecting();

        /*
         * wifi confirm
         */
        Boolean isWifi = manager.getNetworkInfo(ConnectivityManager.TYPE_WIFI).isConnectedOrConnecting();

        if(is3g){
            textView.setText("3G");
        }else if(isWifi){
            textView.setText("wifi");
        }else{
            textView.setText("nothing");
         //Activity transfer to wifi settings
            startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
        }

A: Here you go
Include following permission in Manifest.
<intent android:action="android.settings.WIRELESS_SETTINGS"/>

You can fire following intent to so WIFI Settings screen.
startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));


text:
Q: Insert missing dates into sqlite result set? I have a table filled with data for given dates. Sometimes I do not have a row for a given day because I might not have data for that day. Now when I query to get the results I would like to have the result set include a row for every date from the earliest date to the latest. Is there a way to form a query that will generate a default row when a date is missing in the results set without actually inserting them in the database? The date column is in the format YYYY-MM-DD.

A: No matter what the data type, you can create a default value for any column in your table. Please read about the SQL DEFAULT Constraint.
CREATE TABLE Foo (
    _id INTEGER PRIMARY KEY,
    date TEXT DEFAULT '2012-08-17');

Or if you want to return a default value every time you query your database, use IfNull():
SELECT IfNull(date, '2012-08-17') FROM Foo;

(I have assumed that your date is text, however you can easily change this.)


text:
Q: ListBox "IsSelected" binding not working I have searched high and low for an answer to this problem with no luck, from what I can see I have all the correct elements in place but for some reason this does not want to work.
I require the IsSelected setter to run when a item is selected in the ListBox.
XAML code
<ListBox HorizontalAlignment="Left" Height="226" Margin="10,34,0,0" VerticalAlignment="Top" Width="132" ItemsSource="{Binding Activities}" >
        <ListBox.ItemContainerStyle>
            <Style TargetType="{x:Type ListBoxItem}">
                <Setter Property="IsSelected" Value="{Binding IsSelected}" />
            </Style>
        </ListBox.ItemContainerStyle>
     </ListBox>

C# ViewModel
 private bool m_isSelected;
 public bool IsSelected
    {
        get { return m_isSelected; }
        set
        {
            if (value != m_isSelected)
            {
                m_isSelected = value;

                if (m_isSelected)
                {
                    CurrentViews = getCurrentViews((BasePropertyTypeVM)CurrentActivity);
                    AvailableViews = getAvailableViews(Properties);
                }

                OnPropertyChanged(() => IsSelected);
            }
        }
    }

Many Thanks,
Sam

A: The IsSelected property of the ListBoxItem is bound to the IsSelected view model property, which must be a property of the data item type, i.e. the element type of the Activities collection.
You need to declare such a data item class, e.g.
public class Activity : INotifyPropertyChanged
{
    public string Name { get; set; }

    private bool isSelected;
    public bool IsSelected
    {
        get { return isSelected; }
        set
        {
            if (value != isSelected)
            {
                value = isSelected;
                ...
            }
        }
    }

and declare the Activities collection like this:
public ObservableCollection<Activity> { get; set; }

The Name property of the Activity class could be used in a DataTemplate of the ListBoxItem:
<ListBox ... ItemsSource="{Binding Activites}">
    <ListBox.ItemContainerStyle>
        <Style TargetType="ListBoxItem">
            <Setter Property="IsSelected" Value="{Binding IsSelected}"/>
        </Style>
    </ListBox.ItemContainerStyle>
    <ListBox.ItemTemplate>
        <DataTemplate>
            <TextBlock Text="{Binding Name}"/>
        </DataTemplate>
    </ListBox.ItemTemplate>
</ListBox>

A: Try this :
 <Setter Property="IsSelected" Value="{Binding DataContext.IsSelected,
RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBox}}}" />


text:
Q: What does the Alt-Shift-Esc keyboard shortcut do? Accidentally I found this keyboard shortcut, Alt+Shift+Esc. It iterates over all open windows in current workspace with some Orange border.
I searched on the internet but found nothing about it.
So just wanted to know, what actually this shortcut is?
I am currently on Xorg Gnome ubuntu 17.10.

A: From the GNOME Shell documentation:

Alt+Esc
Cycle through all open windows on a workspace.

Adding Shift to a cycling shortcut usually just reverses the order (compare Alt+Tab and Alt+Shift+Tab).


text:
Q: transactional poller committing exception to error channel I have a transactional poller periodically polling messages from a jdbc-backed queue-channel.
I have 2 goals:
1) prevent message loss from my source in case the process dies in the middle of processing a message.
2) prevent a single misformatted message from bringing down the whole process by discarding the related exception to the error channel (and moving on to the next message)
My Question:
How can I setup (ideally through dsl) my transactional poller so that it discards a faulty message to the error channel without rolling back the transaction ?
(so as to prevent an infinite loop where the same message is replayed again and again).
Thank you very much in advance for your feedback and your expertise.
Best Regards

A: The current architecture (and I doubt we will change it) is based on the fact that we sent to the errorChannel from poller already after transaction rollback. This way we cover not only the problem with your message, but possible failure during commit. Therefore any exceptions withing the poll task are handled with the same errorChannel.
Since such an errorChannel approach doesn't fit your requirements because the wrong message is going to be rolled back to the DB for the next poll, I would suggest you to consider to use an ExpressionEvaluatingRequestHandlerAdvice downstream around some minimal service, where you definitely fail with a wrong message. This way you can configure an appropriate failureChannel and send error message over there leave the whole process untouched and, therefore, committed properly in the end.
See more info in the Docs: https://docs.spring.io/spring-integration/docs/current/reference/html/#message-handler-advice-chain


text:
Q: Looking for divisibility by 29 and a general proof( if any) Is there any elegant way to prove that 28C14 -1 is divisible by 29? Also, is this kind of a result a theorem or a generalisation? If so please do help...
note i do mean 28 choose 14

A: I presume you mean $\binom{28}{14}-1$?
Note that
$$14!\binom{28}{14}=28\times27\times26\times\cdots\times 15
\equiv(-1)(-2)(-3)\cdots(-14)=14!\pmod{29}.$$
Therefore $\binom{28}{14}\equiv1\pmod{29}$.


text:
Q: Loading an "overlay" when running long tasks in iOS What is example for loading overlay in Swift IOS application when do a long tasks. Example for loading data from remote server.
I googled but not found any answer.
Updated:
Thanks for @Sebastian Dressler this is simple way. I updated my code and it run cool
public class LoadingOverlay{

var overlayView = UIView()
var activityIndicator = UIActivityIndicatorView()

class var shared: LoadingOverlay {
    struct Static {
        static let instance: LoadingOverlay = LoadingOverlay()
    }
    return Static.instance
}

    public func showOverlay(view: UIView) {

        overlayView.frame = CGRectMake(0, 0, 80, 80)
        overlayView.center = view.center
        overlayView.backgroundColor = UIColor(hex: 0x444444, alpha: 0.7)
        overlayView.clipsToBounds = true
        overlayView.layer.cornerRadius = 10

        activityIndicator.frame = CGRectMake(0, 0, 40, 40)
        activityIndicator.activityIndicatorViewStyle = .WhiteLarge
        activityIndicator.center = CGPointMake(overlayView.bounds.width / 2, overlayView.bounds.height / 2)

        overlayView.addSubview(activityIndicator)
        view.addSubview(overlayView)

        activityIndicator.startAnimating()
    }

    public func hideOverlayView() {
        activityIndicator.stopAnimating()
        overlayView.removeFromSuperview()
    }
}

let using:
LoadingOverlay.shared.showOverlay(self.view)
//To to long tasks
LoadingOverlay.shared.hideOverlayView()

A: For anyone late like me, I made some modifications to @Sonrobby code. As i understand, @Sonrobby adds the activity to the overlay on every showOverlay call. And some of the configuration can be passed to the init function, letting only the placement on the showOverlay method.
I also change the overlay's background to black, since my app it is mostly white.
here is the code :
public class LoadingOverlay{

    var overlayView : UIView!
    var activityIndicator : UIActivityIndicatorView!

    class var shared: LoadingOverlay {
        struct Static {
            static let instance: LoadingOverlay = LoadingOverlay()
        }
        return Static.instance
    }

    init(){
        self.overlayView = UIView()
        self.activityIndicator = UIActivityIndicatorView()

        overlayView.frame = CGRectMake(0, 0, 80, 80)
        overlayView.backgroundColor = UIColor(white: 0, alpha: 0.7)
        overlayView.clipsToBounds = true
        overlayView.layer.cornerRadius = 10
        overlayView.layer.zPosition = 1

        activityIndicator.frame = CGRectMake(0, 0, 40, 40)
        activityIndicator.center = CGPointMake(overlayView.bounds.width / 2, overlayView.bounds.height / 2)
        activityIndicator.activityIndicatorViewStyle = .WhiteLarge
        overlayView.addSubview(activityIndicator)
    }

    public func showOverlay(view: UIView) {
        overlayView.center = view.center
        view.addSubview(overlayView)
        activityIndicator.startAnimating()
    }

    public func hideOverlayView() {
        activityIndicator.stopAnimating()
        overlayView.removeFromSuperview()
    }
}

A: @Ajinkya Patil answer as a reference. Swift 4.0 and newer
This is an Extension Solution to use on all viewController without clashing.
Create a LoadingDialog+ViewContoller.swift
import UIKit

struct ProgressDialog {
    static var alert = UIAlertController()
    static var progressView = UIProgressView()
    static var progressPoint : Float = 0{
        didSet{
            if(progressPoint == 1){
                ProgressDialog.alert.dismiss(animated: true, completion: nil)
            }
        }
    }
}
extension UIViewController{
   func LoadingStart(){
        ProgressDialog.alert = UIAlertController(title: nil, message: "Please wait...", preferredStyle: .alert)

    let loadingIndicator = UIActivityIndicatorView(frame: CGRect(x: 10, y: 5, width: 50, height: 50))
    loadingIndicator.hidesWhenStopped = true
    loadingIndicator.style = UIActivityIndicatorView.Style.gray
    loadingIndicator.startAnimating();

    ProgressDialog.alert.view.addSubview(loadingIndicator)
    present(ProgressDialog.alert, animated: true, completion: nil)
  }

  func LoadingStop(){
    ProgressDialog.alert.dismiss(animated: true, completion: nil)
  }
}

call the function inside ViewController anywhere you like. like so:
self.LoadingStart()

and here's how to stop the loading dialog.
self.LoadingStop()

A: To add on to the answers given, you might run into issues if you are attempting to run the code sometimes. Personally, there was an occasion where showOverlay was not being properly called (because I was trying to segue into a scene, then immediately call this function during viewDidLoad).
If you run into an issue similar to mine, there is one fix to the code and a change in approach I recommend.
FIX: Place both blocks of code as closures to a dispatch_async call, like so:
dispatch_async(dispatch_get_main_queue(),
 { //code });

APPROACH: When calling your code, do a dispatch_after call onto the main queue to delay the call by a few milliseconds.
The reasoning? You're simply asking the UI to do too much during viewDidLoad.
If this appendix to the solution helped, I'd be glad.
-Joel Long
P.S. Solution worked for XCode v6.3.2

A: Use ATKit.
Refer:
https://aurvan.github.io/atkit-ios-release/index.html
ATProgressOverlay Class
https://aurvan.github.io/atkit-ios-release/helpbook/Classes/ATProgressOverlay.html
Code:
import ATKit

ATProgressOverlay.sharedInstance.show() // Does not show network activity indicator on status bar.

ATProgressOverlay.sharedInstance.show(isNetworkActivity: true) // Shows network activity indicator on status bar.

Screenshot:

A: Swift 5
class func showUniversalLoadingView(_ show: Bool, loadingText : String = "") {
    let existingView = UIApplication.shared.windows[0].viewWithTag(1200)
    if show {
        if existingView != nil {
            return
        }
        let loadingView = self.makeLoadingView(withFrame: UIScreen.main.bounds, loadingText: loadingText)
        loadingView?.tag = 1200
        UIApplication.shared.windows[0].addSubview(loadingView!)
    } else {
        existingView?.removeFromSuperview()
    }

}

 class func makeLoadingView(withFrame frame: CGRect, loadingText text: String?) -> UIView? {
    let loadingView = UIView(frame: frame)
    loadingView.backgroundColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.5)
    let activityIndicator = UIActivityIndicatorView(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
    //activityIndicator.backgroundColor = UIColor(red:0.16, green:0.17, blue:0.21, alpha:1)
    activityIndicator.layer.cornerRadius = 6
    activityIndicator.center = loadingView.center
    activityIndicator.hidesWhenStopped = true
    activityIndicator.style = .white
    activityIndicator.startAnimating()
    activityIndicator.tag = 100 // 100 for example

    loadingView.addSubview(activityIndicator)
    if !text!.isEmpty {
        let lbl = UILabel(frame: CGRect(x: 0, y: 0, width: 200, height: 30))
        let cpoint = CGPoint(x: activityIndicator.frame.origin.x + activityIndicator.frame.size.width / 2, y: activityIndicator.frame.origin.y + 80)
        lbl.center = cpoint
        lbl.textColor = UIColor.white
        lbl.textAlignment = .center
        lbl.text = text
        lbl.tag = 1234
        loadingView.addSubview(lbl)
    }
    return loadingView
}

Uses
showUniversalLoadingView(true, loadingText: "Downloading Data.......")

showUniversalLoadingView(true)

Remove loader
showUniversalLoadingView(false)

A: Updated @sonrobby answer, added a background view and orientation handling via resizing mask... this can be used for simple stuffs
public class LoadingOverlay{

    var overlayView = UIView()
    var activityIndicator = UIActivityIndicatorView()
    var bgView = UIView()

    class var shared: LoadingOverlay {
        struct Static {
            static let instance: LoadingOverlay = LoadingOverlay()
        }
        return Static.instance
    }

    public func showOverlay(view: UIView) {

        bgView.frame = view.frame
        bgView.backgroundColor = UIColor.gray
        bgView.addSubview(overlayView)
        bgView.autoresizingMask = [.flexibleLeftMargin,.flexibleTopMargin,.flexibleRightMargin,.flexibleBottomMargin,.flexibleHeight, .flexibleWidth]
        overlayView.frame = CGRect(x: 0, y: 0, width: 80, height: 80)
        overlayView.center = view.center
        overlayView.autoresizingMask = [.flexibleLeftMargin,.flexibleTopMargin,.flexibleRightMargin,.flexibleBottomMargin]
        overlayView.backgroundColor = UIColor.black
        overlayView.clipsToBounds = true
        overlayView.layer.cornerRadius = 10

        activityIndicator.frame = CGRect(x: 0, y: 0, width: 40, height: 40)
        activityIndicator.activityIndicatorViewStyle = .whiteLarge
        activityIndicator.center = CGPoint(x: overlayView.bounds.width / 2, y: overlayView.bounds.height / 2)

        overlayView.addSubview(activityIndicator)
        view.addSubview(bgView)
        self.activityIndicator.startAnimating()

    }

    public func hideOverlayView() {
        activityIndicator.stopAnimating()
        bgView.removeFromSuperview()
    }
}

if you add it to keywindow, it can then go over your nav and tab bars also... something like this
LoadingOverlay.shared.showOverlay(view: UIApplication.shared.keyWindow!)

A: Just create yourself an overlay view, which you add to your parent view and remove it once your task is done, e.g. to add it:
var overlay : UIView? // This should be a class variable

[ ... ]

overlay = UIView(frame: view.frame)
overlay!.backgroundColor = UIColor.blackColor()
overlay!.alpha = 0.8

view.addSubview(overlay!)

For removal:
overlay?.removeFromSuperview()

A: Blur background + Activity Indicator, Swift 5 example
extension UIView {
    func showBlurLoader() {
        let blurLoader = BlurLoader(frame: frame)
        self.addSubview(blurLoader)
    }

    func removeBluerLoader() {
        if let blurLoader = subviews.first(where: { $0 is BlurLoader }) {
            blurLoader.removeFromSuperview()
        }
    }
}

class BlurLoader: UIView {

    var blurEffectView: UIVisualEffectView?

    override init(frame: CGRect) {
        let blurEffect = UIBlurEffect(style: .dark)
        let blurEffectView = UIVisualEffectView(effect: blurEffect)
        blurEffectView.frame = frame
        blurEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
        self.blurEffectView = blurEffectView
        super.init(frame: frame)
        addSubview(blurEffectView)
        addLoader()
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

    private func addLoader() {
        guard let blurEffectView = blurEffectView else { return }
        let activityIndicator = UIActivityIndicatorView(style: .whiteLarge)
        activityIndicator.frame = CGRect(x: 0, y: 0, width: 50, height: 50)
        blurEffectView.contentView.addSubview(activityIndicator)
        activityIndicator.center = blurEffectView.contentView.center
        activityIndicator.startAnimating()
    }
}

A: Swift 3.
I used @Lucho's code in his answer below and I changed the overlay background color to clear and added a spinner color.
public class LoadingOverlay {

    var overlayView : UIView!
    var activityIndicator : UIActivityIndicatorView!

    class var shared: LoadingOverlay {
        struct Static {
            static let instance: LoadingOverlay = LoadingOverlay()
        }
        return Static.instance
    }

    init(){
        self.overlayView = UIView()
        self.activityIndicator = UIActivityIndicatorView()

        overlayView.frame = CGRect(0, 0, 80, 80)
        overlayView.backgroundColor = .clear
        overlayView.clipsToBounds = true
        overlayView.layer.cornerRadius = 10
        overlayView.layer.zPosition = 1

        activityIndicator.frame = CGRect(0, 0, 40, 40)
        activityIndicator.center = CGPoint(overlayView.bounds.width / 2, overlayView.bounds.height / 2)
        activityIndicator.activityIndicatorViewStyle = .whiteLarge
        activityIndicator.color = .gray
        overlayView.addSubview(activityIndicator)
    }

    public func showOverlay(view: UIView) {
        overlayView.center = view.center
        view.addSubview(overlayView)
        activityIndicator.startAnimating()
    }

    public func hideOverlayView() {
        activityIndicator.stopAnimating()
        overlayView.removeFromSuperview()
    }
}

A: I've created a protocol for presenting your own view controller as an overlay. The usage is very simple:
class ViewController: UIViewController, OverlayHost {
    @IBAction func showOverlayButtonPressed() {
        showOverlay(type: YourOverlayViewController.self,
            fromStoryboardWithName: "Main")
    }
}

Result:

Source code: https://github.com/agordeev/OverlayViewController
Related article: https://andreygordeev.com/2017/04/18/overlay-view-controller-protocols-swift/

A: The above answers add a loading view but it doesn't block click events on the screen also it does not provides overlay for rest of screen. You can achieve it as follows:
let alert = UIAlertController(title: nil, message: "Please wait...", preferredStyle: .Alert)

alert.view.tintColor = UIColor.blackColor()
let loadingIndicator: UIActivityIndicatorView = UIActivityIndicatorView(frame: CGRectMake(10, 5, 50, 50)) as UIActivityIndicatorView
loadingIndicator.hidesWhenStopped = true
loadingIndicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyle.Gray
loadingIndicator.startAnimating();

alert.view.addSubview(loadingIndicator)
presentViewController(alert, animated: true, completion: nil)

Swift 3.0
let alert = UIAlertController(title: nil, message: "Please wait...", preferredStyle: .alert)

let loadingIndicator = UIActivityIndicatorView(frame: CGRect(x: 10, y: 5, width: 50, height: 50))
loadingIndicator.hidesWhenStopped = true
loadingIndicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyle.gray
loadingIndicator.startAnimating();

alert.view.addSubview(loadingIndicator)
present(alert, animated: true, completion: nil)

Swift 4.0 and newer
let alert = UIAlertController(title: nil, message: "Please wait...", preferredStyle: .alert)

let loadingIndicator = UIActivityIndicatorView(frame: CGRect(x: 10, y: 5, width: 50, height: 50))
loadingIndicator.hidesWhenStopped = true
loadingIndicator.style = UIActivityIndicatorView.Style.gray
loadingIndicator.startAnimating();

alert.view.addSubview(loadingIndicator)
present(alert, animated: true, completion: nil)

and you can hide it as follows:
dismiss(animated: false, completion: nil)

It will be shown as follows:

A: Xamarin.iOS version:
var alert = UIAlertController.Create(string.Empty, "Please wait...", UIAlertControllerStyle.Alert);
var alertIndicatorView = new UIActivityIndicatorView();
alertIndicatorView.Frame = new CGRect(x: 10, y: 5, width: 50, height: 50);
alertIndicatorView.ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.Gray;
alertIndicatorView.HidesWhenStopped = true;
alertIndicatorView.StartAnimating();
alert.Add(alertIndicatorView);
controller.PresentViewController(alert, true, null);

A: If there's someone looking for a Lottie implementation for loading view here's a working solution I made using @Shourob Datta solution:
import Foundation
import UIKit
import Lottie

public class LogoLoadingAnimation{

    class func showUniversalLoadingView(_ show: Bool, loadingText : String = "") {
        let existingView = UIApplication.shared.windows[0].viewWithTag(1200)
        if show {
            if existingView != nil {
                return
            }
            let loadingView = self.makeLoadingView(withFrame: UIScreen.main.bounds, loadingText: loadingText)
            loadingView?.tag = 1200
            UIApplication.shared.windows[0].addSubview(loadingView!)
        } else {
            existingView?.removeFromSuperview()
        }

    }

    class func makeLoadingView(withFrame frame: CGRect, loadingText text: String?) -> UIView? {
        let gradienView = GradientBackgroundView(frame: frame)
        gradienView.startColor = UIColor(red: 255, green: 255, blue: 255, alpha: 1)
        gradienView.endColor = UIColor(red: 238, green: 238, blue: 238, alpha: 1)
        gradienView.startColor = UIColor(named: "dark") ?? .blue
        gradienView.startColor = UIColor(named: "purpuleGrey") ?? .gray
        let loadingAnimationView = AnimationView()
        gradienView.addSubview(loadingAnimationView)
        loadingAnimationView.translatesAutoresizingMaskIntoConstraints = false
        loadingAnimationView.centerXAnchor.constraint(equalTo: gradienView.centerXAnchor).isActive = true
        loadingAnimationView.centerYAnchor.constraint(equalTo: gradienView.centerYAnchor).isActive = true
        loadingAnimationView.animation = UITraitCollection.current.userInterfaceStyle == .dark ? Animation.named("logoLoadingWhite") : Animation.named("logoLoadingBlue")
        loadingAnimationView.backgroundBehavior = .pauseAndRestore
        loadingAnimationView.contentMode = .scaleAspectFit
        loadingAnimationView.loopMode = .loop
        loadingAnimationView.play()
        return gradienView
    }

}


text: Q: Which kind of javascript errors stop further code execution of the web application I am from java background. I often see so many javascript errors in the console in my web application. However, not everytime further code execution gets impacted by those errors and I see application running properly. Could someone explain me whether every javascript error effects further code execution or only any specific type of errors do that. Thank you.


text:
Q: Android application out of memory error when changing Activity my name is John, I am developing this application where I have 2 types of user, each type has 2 menu style view.
What happens It`s that sometimes the application crashes. The LogCat displays "Out of memory on a 11612176-byte allocation".
Here is a portion of the code where I switch between activities:
    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
    getApplicationContext(), R.array.array_teste,
    android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spinner.setAdapter(adapter);
    spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        public void onItemSelected(AdapterView<?> parent, View view,
                int pos, long id) {

            if (parent.getItemAtPosition(pos).toString().equals("Formador")) {
                Intent i = new Intent(getApplicationContext(),
                        FormadorActivity.class);
                finish();
                startActivity(i);
            }
            //
        }

        public void onNothingSelected(AdapterView<?> parent) {
        }
    });

I am almost sure I`m doing something wrong with the images I am using.
I hope some of you guys can give me a little help I am trying to fix this all the week long.
Thank you for you attention!
UPDATED----
The device I am testing is a Galaxy SII GT-I9100
Here is the LogCat :
01-10 16:03:36.243: W/ResourceType(5624): Failure getting entry for 0x010802c0 (t=7 e=704) in package 0 (error -75)
01-10 16:03:37.098: D/dalvikvm(5624): GC_FOR_ALLOC freed 5069K, 45% free 21876K/39175K, paused 32ms, total 32ms
01-10 16:03:37.098: D/AbsListView(5624): [unregisterDoubleTapMotionListener]
01-10 16:03:37.103: I/dalvikvm-heap(5624): Grow heap (frag case) to 26.900MB for 5160976-byte allocation
01-10 16:03:37.153: D/dalvikvm(5624): GC_FOR_ALLOC freed 2K, 32% free 26914K/39175K, paused 48ms, total 48ms
01-10 16:03:37.168: I/MotionRecognitionManager(5624):   .unregisterListener : / listener count = 0->0, ubvf 9budiwrd5ordgfl5BakTrklMrfo$,@,*8b-:)(
01-10 16:03:37.213: D/dalvikvm(5624): GC_CONCURRENT freed 67K, 32% free 26848K/39175K, paused 12ms+4ms, total 60ms
01-10 16:03:37.498: D/dalvikvm(5624): GC_FOR_ALLOC freed 112K, 32% free 26735K/39175K, paused 22ms, total 22ms
01-10 16:03:37.498: I/dalvikvm-heap(5624): Forcing collection of SoftReferences for 11612176-byte allocation
01-10 16:03:37.538: D/dalvikvm(5624): GC_BEFORE_OOM freed 0K, 32% free 26735K/39175K, paused 38ms, total 38ms
01-10 16:03:37.538: E/dalvikvm-heap(5624): Out of memory on a 11612176-byte allocation.
01-10 16:03:37.538: I/dalvikvm(5624): "main" prio=5 tid=1 RUNNABLE
01-10 16:03:37.538: I/dalvikvm(5624):   | group="main" sCount=0 dsCount=0 obj=0x40d4d508 self=0x40d3c5a8
01-10 16:03:37.538: I/dalvikvm(5624):   | sysTid=5624 nice=0 sched=0/0 cgrp=apps handle=1075482416
01-10 16:03:37.538: I/dalvikvm(5624):   | schedstat=( 9495706032 3145201445 10530 ) utm=821 stm=128 core=1
01-10 16:03:37.538: I/dalvikvm(5624):   at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
01-10 16:03:37.548: I/dalvikvm(5624):   at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:625)
01-10 16:03:37.548: I/dalvikvm(5624):   at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:478)
01-10 16:03:37.548: I/dalvikvm(5624):   at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:781)
01-10 16:03:37.548: I/dalvikvm(5624):   at android.content.res.Resources.loadDrawable(Resources.java:1963)
01-10 16:03:37.548: I/dalvikvm(5624):   at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
01-10 16:03:37.558: I/dalvikvm(5624):   at android.widget.ImageView.<init>(ImageView.java:120)
01-10 16:03:37.558: I/dalvikvm(5624):   at android.widget.ImageView.<init>(ImageView.java:110)
01-10 16:03:37.558: I/dalvikvm(5624):   at java.lang.reflect.Constructor.constructNative(Native Method)
01-10 16:03:37.558: I/dalvikvm(5624):   at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
01-10 16:03:37.563: I/dalvikvm(5624):   at android.view.LayoutInflater.createView(LayoutInflater.java:587)
01-10 16:03:37.563: I/dalvikvm(5624):   at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
01-10 16:03:37.563: I/dalvikvm(5624):   at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
01-10 16:03:37.563: I/dalvikvm(5624):   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
01-10 16:03:37.563: I/dalvikvm(5624):   at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
01-10 16:03:37.563: I/dalvikvm(5624):   at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
01-10 16:03:37.563: I/dalvikvm(5624):   at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
01-10 16:03:37.563: I/dalvikvm(5624):   at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
01-10 16:03:37.563: I/dalvikvm(5624):   at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
01-10 16:03:37.568: I/dalvikvm(5624):   at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
01-10 16:03:37.568: I/dalvikvm(5624):   at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:313)
01-10 16:03:37.568: I/dalvikvm(5624):   at android.app.Activity.setContentView(Activity.java:1924)
01-10 16:03:37.573: I/dalvikvm(5624):   at com.anfengde.ui.call.FormadorActivity.onCreate(FormadorActivity.java:62)
01-10 16:03:37.573: I/dalvikvm(5624):   at android.app.Activity.performCreate(Activity.java:5206)
01-10 16:03:37.573: I/dalvikvm(5624):   at  android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
01-10 16:03:37.573: I/dalvikvm(5624):   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2074)
01-10 16:03:37.573: I/dalvikvm(5624):   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)
01-10 16:03:37.573: I/dalvikvm(5624):   at android.app.ActivityThread.access$700(ActivityThread.java:140)
01-10 16:03:37.573: I/dalvikvm(5624):   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237)
01-10 16:03:37.573: I/dalvikvm(5624):   at android.os.Handler.dispatchMessage(Handler.java:99)
01-10 16:03:37.573: I/dalvikvm(5624):   at android.os.Looper.loop(Looper.java:137)
01-10 16:03:37.573: I/dalvikvm(5624):   at android.app.ActivityThread.main(ActivityThread.java:4921)
01-10 16:03:37.573: I/dalvikvm(5624):   at java.lang.reflect.Method.invokeNative(Native Method)
01-10 16:03:37.573: I/dalvikvm(5624):   at java.lang.reflect.Method.invoke(Method.java:511)
01-10 16:03:37.573: I/dalvikvm(5624):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
01-10 16:03:37.573: I/dalvikvm(5624):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
01-10 16:03:37.573: I/dalvikvm(5624):   at dalvik.system.NativeStart.main(Native Method)
01-10 16:03:37.578: A/libc(5624): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 5624 (nfengde.ui.call)"

UPDATED-------------------------
Here is the code I think that could be the cause of the error:
I do this on Both activities on onCreate() and on the onRestart()
settings = getSharedPreferences("MyPreferenceFile", 0);
if (settings.getString("estantePadrao", "teste").equals("Claro")) {
    id = getResources().getIdentifier("estante_cursista_v01",
        "drawable", getPackageName());
    imagemPrateleira.setImageResource(id);
} else {
    if (settings.getString("estantePadrao", "teste").equals("Escuro")) {
        id = getResources().getIdentifier("estante_cursista_v02",
            "drawable", getPackageName());
        imagemPrateleira.setImageResource(id);
    } else {
        id = getResources().getIdentifier("estante_cursista_v03",
            "drawable", getPackageName());
        imagemPrateleira.setImageResource(id);
    }
}

A: I discovered that the ROM I have installed in my Phone has a memory leak wich was causing the application to crash.
I have tested on other devices and it is working normally.
Thanks for all the help and support!


text:
Q: Write a Spring Web Socket project without SpringBoot or Maven/Gradle How to create a Spring Java Web socket project with XML or Java Config but without Spring Boot. Where can I find a step-by-step tutorial. I dont know how to use spring boot in ecliplse. Also I dont want to use gradle or maven. I did not find a tutorial to use spring boot in eclipse. As I am new to spring I am unable to start a project without maven or gradle. I need to learn how to create a spring project without any built tool provided I need to use Eclipse. This is purly for learning puropse.
Below is the classes I used to replace Spring boot related main class
AppConfig Class
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;

@Configuration
@ComponentScan("hello")
@EnableWebMvc
public class AppConfig  {

}

WebAppInitializer Class
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRegistration.Dynamic;
import org.springframework.web.WebApplicationInitializer;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import org.springframework.web.servlet.DispatcherServlet;

public class WebAppInitializer implements WebApplicationInitializer{// extends AbstractAnnotationConfigDispatcherServletInitializer {

        public void onStartup(ServletContext servletContext) throws ServletException
        {
            try
            {
                 AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
                    ctx.register(AppConfig.class);
                    ctx.setServletContext(servletContext);
                    Dynamic dynamic = servletContext.addServlet("dispatcher", new DispatcherServlet(ctx));

                   dynamic.addMapping("/");
                   // dynamic.addMapping("/springStomp/");
                    dynamic.setLoadOnStartup(1);
                    //dynamic.setAsyncSupported(true);
                    //ctx.refresh();
                    System.out.println("config done");

            }
            catch(Exception e)
            {
                e.printStackTrace();
                System.out.println("error");
            }
       }
}

WebSocketConfig Class
import org.springframework.context.annotation.Configuration;
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
import org.springframework.web.socket.config.annotation.AbstractWebSocketMessageBrokerConfigurer;
import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer {
    @Override
    public void configureMessageBroker(MessageBrokerRegistry config) {
        System.out.println("inside websocket config class");
        config.enableSimpleBroker("/topic");
        config.setApplicationDestinationPrefixes("/app");
    }
    @Override
    public void registerStompEndpoints(StompEndpointRegistry registry) {
        registry.addEndpoint("/hello").withSockJS();
    }
}

Remaining is same as in spring web socket tutorial

A: I know how that feels, my company network is unfriendly towards my maven calls to download dependencies. If you had to do things the hard way like me goto www.mvnrepository.com and just type spring in the search and you can download the jars you need. If you encounter any NoClassDef errors during deployment or compilation it usually tells you what you are missing, then search for the keywords again in the link.

A: Just:

*

*add gradle plugin in eclipse

*import following project from spring site as gradle project

*???

*Profit!

Than if you don't want use spring boot remove any spring boot dependincies, add regular deps like spring-context, spring-webmvc, etc. And finally add spring-websocket and spring-messaging libraries.


text:
Q: Send React component's HTML to server So I have a react component, <ReviewScreen />. It takes in some props, styles them, and presents them. I need to convert this component into HTML, and send it to my backend so that I can generate a PDF on my server.
I tried:
import { renderToStaticMarkup } from 'react-dom/server';
import ReviewScreen from '../somePath';

const html = renderToStaticMarkup(ReviewScreen)
// ... send the html variable to backend using some HTTP library

Problem: the html variable is always empty. My question is: a) is this a 'good' way of doing what I'm trying to achieve? b) is there a better method?
UPDATE: Changing to <ReviewScreen /> actually gets a response. However, I forgot to mention that this component also talks to my Redux store which results in an Invariant Violation: Could not find "store" error.

A: You should be doing this:
const html = renderToStaticMarkup(<ReviewScreen />)

Not:
const html = renderToStaticMarkup(ReviewScreen)

A: renderToStaticMarkup takes in an element, not the component type - you'd need to do this:
const html = renderToStaticMarkup(<ReviewScreen />)

Or, without JSX:
const html = renderToStaticMarkup(React.createElement(ReviewScreen))

That said, I think you would be better off generating the HTML on the server instead - rendering arbitary markup sent from the client seems like it could get messy.


text:
Q: XMLHttpRequest cannot load [url]. Response for preflight is invalid (redirect) I encountered this problem, which i could find any answer. I tried to update text by using x-editable by bootstrap jquery. I have attached the picture error-image and below is my php code
case 'update-number':

        if (isset($_POST['pk'])) {

            header('Content-Type: application/json;charset=UTF-8');
            header('Access-Control-Allow-Origin': '*');
            header('Access-Control-Allow-Methods: DELETE, HEAD, GET, OPTIONS, POST, PUT');
            header('Access-Control-Allow-Headers: Content-Type, Content-Range, Content-Disposition, Content-Description');
            header('Access-Control-Max-Age: 1728000');

            $user_id         = $_COOKIE['user_id'];
            $fed_id          = $_POST['pk'];
            $last_update     = date('Y-m-d h:i:s');
            $number = $_POST['value'];

            $query = "SELECT * FROM abc WHERE fed_id='$fed_id'";
            $result = $mysqli->query($query);
            $row= $result->num_rows;

                if ($row) {
                    $query = "UPDATE abc SET
                    number      ='$number',
                    last_update         ='".$last_update."'
                    WHERE fed_id='".$fed_id."'";

                    $result = $mysqli->query($query);
                    echo "Updated";
                } else {
                    $query = "INSERT INTO abc (number, fed_id, user_id, last_update)
                              VALUES ('".$number."','".$fed_id."','".$user_id."','".$last_update."')";
                    $result = $mysqli->query($query);
                    echo "INSERTED";

                }
        }

        break;

A: I have found the problem. I was using base url without www (ex: http://myurl.com) I changed to http://www.myurl.com and deleted the header in the code. See the code below:
case 'update-number':

    if (isset($_POST['pk'])) {
        $user_id         = $_COOKIE['user_id'];
        $fed_id          = $_POST['pk'];
        $last_update     = date('Y-m-d h:i:s');
        $number = $_POST['value'];

        $query = "SELECT * FROM abc WHERE fed_id='$fed_id'";
        $result = $mysqli->query($query);
        $row= $result->num_rows;

            if ($row) {
                $query = "UPDATE abc SET
                number      ='$number',
                last_update         ='".$last_update."'
                WHERE fed_id='".$fed_id."'";

                $result = $mysqli->query($query);
                echo "Updated";
            } else {
                $query = "INSERT INTO abc (number, fed_id, user_id, last_update)
                          VALUES ('".$number."','".$fed_id."','".$user_id."','".$last_update."')";
                $result = $mysqli->query($query);
                echo "INSERTED";

            }
    }

    break;

A: This may due to invalid protocol.
Check your URLs, This error is also occur when using http:// instead https://.
I've faced same problem and fixed it with replaced http with https.


text:
Q: JavaScript Acrobat Forms If field A has a number entered, the number in field B must be greater I am trying to create my first ever PDF Form...
I think I have formatted the fields correctly with text, dates, numbers etc.
Now I need to do my first ever java script (I think)
I have a field where a number could be entered (if applicable)
IF it is - I do need a number to be entered in field B which needs to be GREATER than field A.
Can anyone please assist & bear in mind this is my first ever :-)
I know I will also need the same thing re dates - i.e. date must be after, but am hoping that it will be similar
Thanks in Advance

A: numA.addEventListener('input', function(){
    aValue = this.value;
})

numB.addEventListener('input', function(){
    bValue = this.value;
    validNumB();
})

function validNumB() {
    return bValue > aValue;
}

A: Add the following code to a custom validation script in Field B. You may need to adjust the name of "field A" to match your actual field name. JavaScript is case sensitive so be aware of that when you are editing. You can customize the alert message to suit your needs as well.
if (this.getField("field A").value != "" && event.value <= this.getField("field A").value) {
    app.alert("This field must be greater than field A.")
    event.rc = false;
}

In case you are curious... The event.value is the value that the user entered into the field, it only gets committed if the event.rc (result code)is true. When event.rc is set to false by the script, the field value reverts to it's previous value.