text:
Q: How to disable a href How to disable a href link if there's value in PR row from database? Like my sample table below, if there PR disable the link.
Table
item_name | PR     |  < Add >  |

ballpen   | pr100  |        |
pencil    |        |        |
Paper     |        |        |
Clip      |        |        |

Codes,
  <?php
    echo '

        Item Name
        PR
        <Add>

';
    echo '
';
    $i = 1;
    while ($row = $result1->fetch_assoc()) {
        if ($row['app_cn'] != '') {
            echo '

            ' . $i++ . '
            ' . $row['item_name'] . '
            ' . $row['pr'] . '

';
        }
?>

I want to disable ballpen row  if there's PR in row

A: while ($row = $result1->fetch_assoc()) {
    if ($row['app_cn'] != '') {
        echo '

        ' . $i++ . '
        ' . $row['item_name'] . '
        ' . $row['pr'] . '

        ';
if (!empty($row['pr'])){
    echo '';
}
echo'
';
}

A: Set the href attribute to "javascript:;"

A: You can use the following:
...
echo '	';

A: if you are trying to remove the modal (fancybox) functionality then you can do so by removing the class of the link with jquery or javascript..
example
$('a[href="PR100"]').removeClass('fancybox');

this checks each link on the page.  if the link has an href attribute that is equal to PR100, we remove the fancybox class which would prevent the popup.
your question is pretty cryptic though.  I'm guessing this is what youre asking..

A:  <?php
    echo '

        Item Name
        PR
        <Add>

';
    echo '
';
    $i = 1;
    while ($row = $result1->fetch_assoc()) {
        if ($row['app_cn'] != '') {
            $url = $row['pr'] ? 'addpr.php?counts=' . $row['pr'] : '#';
            echo '

            ' . $i++ . '
            ' . $row['item_name'] . '
            ' . $row['pr'] . '

';
        }
?>


text:
Q: Importing HTML into another HTML import I've got a small website I'm working on, and have chosen to seperate the navbar (I use Bootstrap) into an external file, so I don't have to re-write it for every file that uses it, every time I make a change to it. This works really well, as I have imported it with the following code:

In my , I have the following code where I need the navbar:

The issue is, is that on my index, I have a link in the navbar that smoothly moves to the anchor position on the index page when clicked. What I want, is to be able to instantly move to the anchor when loading from another page other than the index (that works), except smoothly anchor from index itself.
My proposed solution is to simply add in a second import, which will be different based upon each page. In other words, the link to the anchor will have different href contents, so I'll store them in seperate files, but it won't work for some reason:
i.e.:
On index.html, use the following code:

Except what happens is, the entire thing is replaced by indexcontact.html instead of adding to navbar.html. I've tested with stupid things and this seems to happen no matter what I have in those two files.
So, is there a way to merge two jQuery loads so I can import both of the imports simply merged together into one huge string?

A: One way is to use $.when with two AJAX calls and concatenate the output before setting it into the #navbarContent.
var d1 = $.ajax('/navbar.html');
var d2 = $.ajax('/indexcontact.html');

$.when( d1, d2 ).done(function ( v1, v2 ) {
    $("#navbarContent").html([v1[0], v2[0]].join());
});

To know more about $.when, you can refer to the jQuery documentation here.

redpajama_set_name: RedPajamaStackExchange


text:
Q: MS Access prevent simultaneous check out of same kit I am creating a database in MS Access 2010 for a lending library (and realize that there's a template in 2013 but I've already invested time into my own).  My big problem is preventing two users from borrowing the same kit simultaneously.  Here are the relevant tables:
KIT (KIT_ID, ITEM_ISBN)
LOAN (USER_ID, KIT_ID, CHECK_OUT_DATE, CHECK_IN_DATE, STATUS)
USER (USER_ID, USER_LNAME, USER_FNAME, JOB_CODE)
My users will return kits to the library and shelve them without checking them in so this really is a problem - I need the system to control that behavior.  The issue is exacerbated when a kit is finally checked in but doesn't check it in to all the outstanding check outs.  There are multiple tuples in the LOAN table of the same kit being checked out without a check in date.  If a kit can only be checked out to one user at a time then that would solve my problems.  There would then only be one record of a kit with a status of "Not Available" (that would not have a value in the CHECK_IN_DATE field).
Is there some validation rule I'm missing at the LOAN table, do I have the primary keys set incorrectly, am I indexing the wrong fields?
Maybe my form is the problem.  The record source is the LOAN table and it is set for data entry.  The available fields in the form are USER_ID, KIT_ID and CHECK_OUT_DATE.
If you've guessed that I'm a bit of a novice who can create macros but doesn't know enough code to generate my own (just copy it) then you're correct.  I would appreciate your help, though, and thank you in advance!


text:
Q: Java process stuck in SIGTERM handler deleting a file I have a java process that is failing to respond to a SIGTERM. This is a sporadic issue but occurred on several servers at the same time. I know that I can just kill it with SIGKILL but want to understand why it may be stuck not responding to the SIGTERM signal(s) that have been sent to it. Looking at the output of jstack, it seems the following threads are stuck:
"SIGTERM handler" daemon prio=10 tid=0x00007fcb30006000 nid=0x259c waiting for monitor entry [0x00007fc98cd2c000]
   java.lang.Thread.State: BLOCKED (on object monitor)
        at java.lang.Shutdown.exit(Shutdown.java:212)
        - waiting to lock <0x00000005fc7cdc60> (a java.lang.Class for java.lang.Shutdown)
        at java.lang.Terminator$1.handle(Terminator.java:52)
        at sun.misc.Signal$1.run(Signal.java:212)
        at java.lang.Thread.run(Thread.java:745)

"SIGTERM handler" daemon prio=10 tid=0x00007fcb30005000 nid=0x30cb waiting for monitor entry [0x00007fc982282000]
   java.lang.Thread.State: BLOCKED (on object monitor)
        at java.lang.Shutdown.exit(Shutdown.java:212)
        - waiting to lock <0x00000005fc7cdc60> (a java.lang.Class for java.lang.Shutdown)
        at java.lang.Terminator$1.handle(Terminator.java:52)
        at sun.misc.Signal$1.run(Signal.java:212)
        at java.lang.Thread.run(Thread.java:745)

"SIGTERM handler" daemon prio=10 tid=0x00007fcb30004000 nid=0x1305 waiting for monitor entry [0x00007fc982a8a000]
   java.lang.Thread.State: BLOCKED (on object monitor)
        at java.lang.Shutdown.exit(Shutdown.java:212)
        - waiting to lock <0x00000005fc7cdc60> (a java.lang.Class for java.lang.Shutdown)
        at java.lang.Terminator$1.handle(Terminator.java:52)
        at sun.misc.Signal$1.run(Signal.java:212)
        at java.lang.Thread.run(Thread.java:745)

"SIGTERM handler" daemon prio=10 tid=0x00007fcb30003000 nid=0xa3e runnable [0x00007fc982585000]
   java.lang.Thread.State: RUNNABLE
        at java.io.UnixFileSystem.delete0(Native Method)
        at java.io.UnixFileSystem.delete(UnixFileSystem.java:265)
        at java.io.File.delete(File.java:1035)
        at java.io.DeleteOnExitHook.runHooks(DeleteOnExitHook.java:80)
        at java.io.DeleteOnExitHook$1.run(DeleteOnExitHook.java:49)
        at java.lang.Shutdown.runHooks(Shutdown.java:123)
        at java.lang.Shutdown.sequence(Shutdown.java:167)
        at java.lang.Shutdown.exit(Shutdown.java:212)
        - locked <0x00000005fc7cdc60> (a java.lang.Class for java.lang.Shutdown)
        at java.lang.Terminator$1.handle(Terminator.java:52)
        at sun.misc.Signal$1.run(Signal.java:212)
        at java.lang.Thread.run(Thread.java:745)

There are many other threads, but nothing looks out of the ordinary in them. The thread holding the lock appears to be deleting some file. Does anyone know what this file may be and why deletion of it may be stuck?

A: It is deleting a file that was marked for deletion on JVM termination with File.deleteOnExit. This is probably a temporary file your code or a library of yours created. It is not clear to me why this could be hanging. Maybe the file is on a very slow file system (a remote file system), or some I/O device is dead?
Finding out which file this is could be complicated, if you don't find a likely candidate when looking for callers to deleteOnExit in your code.
You could check for likely candidates in the list of open files of your JVM (with lsof), but the file might not be opened currently.
Probably the best bet is to attach strace to your JVM with strace -e unlink,unlinkat -p <PID> right before sending SIGTERM and check what files the JVM attempts to delete.


text:
Q: How do I specify the platform for MSBuild? I am trying to use MSBuild to build a solution with a specified target platform (I need both binaries, x86 and x64). This is how I tried it:
C:\WINDOWS\Microsoft.NET\Framework\v3.5>MsBuild SolutionPath\Solution.sln /t:Rebuild /p:Configuration=Release /p:Platform="x86"

However the build always fails if the platform is different from "Any CPU". What am I doing wrong?
This is the while output MSBuild prints:

C:\WINDOWS\Microsoft.NET\Framework\v3.5>MsBuild
  SolutionPath\Solution.sln /t:Rebuild
  /p:Configuration=Release
  /p:Platform="x86" Microsoft (R) Build
  Engine Version 3.5.30729.1 [Microsoft
  .NET Framework, Version
  2.0.50727.3082] Copyright (C) Microsoft Corporation 2007. All rights
  reserved.
Build started 1.7.2010 8:28:10.
  Project "SolutionPath\Solution.sln" on
  node 0 (Rebuild targe t(s)).
  SolutionPath\Solution.sln : error
  MSB4126: The specified sol ution
  configuration "Release|x86" is
  invalid. Please specify a valid
  solution c onfiguration using the
  Configuration and Platform properties
  (e.g. MSBuild.exe Solution.sln
  /p:Configuration=Debug
  /p:Platform="Any CPU") or leave those
  prope rties blank to use the default
  solution configuration. Done Building
  Project "SolutionPath\Solution.sln"
  (Rebuild t arget(s)) -- FAILED.
Build FAILED.
"SolutionPath\Solution.sln" (Rebuild
  target) (1) ->
  (ValidateSolutionConfiguration target)
  ->   SolutionPath\Solution.sln : error MSB4126: The specified s olution
  configuration "Release|x86" is
  invalid. Please specify a valid
  solution  configuration using the
  Configuration and Platform properties
  (e.g. MSBuild.ex e Solution.sln
  /p:Configuration=Debug
  /p:Platform="Any CPU") or leave those
  pro perties blank to use the default
  solution configuration.
0 Warning(s)
1 Error(s)

Time Elapsed 00:00:00.03

If I try to build it for x86/x64 with devenv it works perfectly, however I am trying to set up a build server without installing all the necessary versions of Visual Studio. By the way, if there is a better free tool (that supports .NET framework 4) out there, I'd love to hear about it.

A: Hopefully this helps someone out there.
For platform I was specifying "Any CPU", changed it to "AnyCPU" and that fixed the problem.
msbuild C:\Users\Project\Project.publishproj /p:Platform="AnyCPU"  /p:DeployOnBuild=true /p:PublishProfile=local /p:Configuration=Debug

If you look at your .csproj file you'll see the correct platform name to use.

A: In MSBuild or Teamcity use command line
MSBuild yourproject.sln /property:Configuration=Release /property:Platform=x64

or use shorter form:
MSBuild yourproject.sln /p:Configuration=Release /p:Platform=x64

However you need to set up platform in your project anyway, see the answer by Julien Hoarau.

A: If you're trying to do this from the command line, you may be encountering an issue where a machine-wide environment variable 'Platform' is being set for you and working against you. I can reproduce this if I use the VS2012 Command window instead of a regular windows Command window.
At the command prompt type:

set platform

In a VS2012 Command window, I have a value of 'X64' preset. That seems to interfere with whatever is in my solution file.
In a regular Command window, the 'set' command results in a "variable not defined" message...which is good.
If the result of your 'set' command above returns no environment variable value, you should be good to go.

A: If you want to build your solution for x86 and x64, your solution must be configured for both platforms. Actually you just have an Any CPU configuration.
How to check the available configuration for a project
To check the available configuration for a given project, open the project file (*.csproj for example) and look for a PropertyGroup with the right Condition.
If you want to build in Release mode for x86, you must have something like this in your project file:
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
  ...
</PropertyGroup>

How to create and edit the configuration in Visual Studio

(source: microsoft.com)

(source: msdn.com)

(source: msdn.com)
How to create and edit the configuration (on MSDN)

A: For VS2017 and 2019... with the modern core library SDK project files, the platform can be changed during the build process. Here's an example to change to the anycpu platform, just before the built-in CoreCompile task runs:
<Project Sdk="Microsoft.NET.Sdk" >

  <Target Name="SwitchToAnyCpu" BeforeTargets="CoreCompile" >
    <Message Text="Current Platform=$(Platform)" />
    <Message Text="Current PlatformTarget=$(PlatformName)" />
    <PropertyGroup>
      <Platform>anycpu</Platform>
      <PlatformTarget>anycpu</PlatformTarget>
    </PropertyGroup>
    <Message Text="New Platform=$(Platform)" />
    <Message Text="New PlatformTarget=$(PlatformTarget)" />
  </Target>

</Project>

In my case, I'm building an FPGA with BeforeTargets and AfterTargets tasks, but compiling a C# app in the main CoreCompile. (partly as I may want some sort of command-line app, and partly because I could not figure out how to omit or override CoreCompile)
To build for multiple, concurrent binaries such as x86 and x64: either a separate, manual build task would be needed or two separate project files with the respective <PlatformTarget>x86</PlatformTarget> and <PlatformTarget>x64</PlatformTarget> settings in the example, above.

A: When you define different build configurations in your visual studio solution for your projects using a tool like ConfigurationTransform, you may want your Teamcity build, to build you a specified build configuration. You may have build configurations e.g., Debug, Release, Dev, UAT, Prod etc defined. This means, you will have MSBuild Configuration transformation setup for the different configurations. These different configurations are usually used when you have different configurations, e.g. different database connection strings, for the different environment. This is very common because you would have a different database for your production environment from your playground development environment.
They say a picture is worth a thousand words, please see the image below how you would specify multiple build configurations in Teamcity.
In the commandline input text box, specify as below
/p:OutputPath=Publish;Configuration=Dev
Here, I have specified two commandline build configurations/arguments OutputPath and build Configuration with values Publish and Dev respectively, but it could have been, UAT or Prod configuration. If you want more, simply separate them by semi-colon,;

A: There is an odd case I got in VS2017, about the space between 'Any' and 'CPU'.
this is not about using command prompt.
If you have a build project file, which could call other solution files. You can try to add the space between Any and CPU, like this (the Platform property value):
<MSBuild Projects="@(SolutionToBuild2)" Properties ="Configuration=$(ProjectConfiguration);Platform=Any CPU;Rerun=$(MsBuildReRun);" />

Before I fix this build issue, it is like this (ProjectPlatform is a global variable, was set to 'AnyCPU'):
<MSBuild Projects="@(SolutionToBuild1)" Properties ="Configuration=$(ProjectConfiguration);Platform=$(ProjectPlatform);Rerun=$(MsBuildReRun);" />

Also, we have a lot projects being called using $ (ProjectPlatform), which is 'AnyCPU' and work fine. If we open proj file, we can see lines liket this and it make sense.
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">

So my conclusion is,
'AnyCPU' works for calling project files, but not for calling solution files,
for calling solution files, using 'Any CPU' (add the space.)
For now, I am not sure if it is a bug of VS project file or MSBuild.
I am using VS2017 with VS2017 build tools installed.

A: In Visual Studio 2019, version 16.8.4, you can just add
<Prefer32Bit>false</Prefer32Bit>


text:
Q: Do...While loop with logical operators I copied a simple "calculator" example from my textbook that accepts 2 values and an operator. However, it does not check if the expression entered is valid. The code should prompt the user until a proper expression is entered.
How should I fix it with my style in mind? What is a better way of doing this?
/*
Input: A simple expression with 2 values and 1 operator
Format: value1 (operator) value2
Ex: 5*5
Output: Answer
*/

#include <stdio.h>

int main (void)
{
float value1, value2;
char operator = ' ';

//Issue Area, the while section does not work
do
{
    printf ("Type in your expression:");
    scanf ("%f %c %f", &value1, &operator, &value2);
}
while ((operator != '+' || operator != '-' || operator != '*' || operator != '/'));

//This is fine, code is for an else...if example in textbook
if (operator == '+')
    printf ("%.2f\n",value1 + value2);
else if (operator == '-')
    printf ("%.2f\n",value1 - value2);
else if (operator == '*')
    printf ("%.2f\n",value1 * value2);
else if (operator == '/')
    printf ("%.2f\n",value1 / value2);

return 0;
}

A: You have:
do
{
   ...
}
while ((operator != '+' || operator != '-' || operator != '*' || operator != '/'));

Use of || in the conditional of the while is wrong.
Let's say the value of operator is '+'. Then, the while evaluates to:
while ((false || true || true || true));

which evaluates to
while (true);

No matter what the value of operator is, at least three of those sub-expressions will evaluate to true. Hence, the conditional will always evaluate to true.
You need to use && instead of ||.
do
{
   ...
}
while ((operator != '+' && operator != '-' && operator != '*' && operator != '/'));

One possible way to make the code clearer is:
do
{
   ...
}
while (!isValidOperator(operator));

where
int isValidOperator(char operator)
{
   return (operator == '+' ||
           operator == '-' ||
           operator == '*' ||
           operator == '/' );
}

You can make code shorter in isValidOperator by using:
int isValidOperator(char operator)
{
   return (operator != '\0' && strchr("+-*/", operator) != NULL);
}


text:
Q: ANDROID: SEND MAIL with PreConfigured mail:From Address without using mail provider(Like GMAIL,YAHOO pre-installed in ANDROID DEVICE) I am trying to use RECOVER PASSWORD button which requires MAIL SENDING to correspondent USERNAME. I would like to know the way if somehow I can send MAIL (In Background) without using GMAIL, YAHOO(Pre Installed EMAIL Provider Service) with my own address like abc@abc.com to every user of my application.
Any Help is most welcome!!

A: Send e-mail in Android using the JavaMail API using Gmail authentication
Steps to create a simple Project:
MailSenderActivity.java
YOUR PACKAGE;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;

public class MailSenderActivity extends Activity {

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        final Button send = (Button) this.findViewById(R.id.send);
        send.setOnClickListener(new View.OnClickListener() {

            public void onClick(View v) {
                // TODO Auto-generated method stub

                try {
                    GMailSender sender = new GMailSender("username@gmail.com", "password");
                    sender.sendMail("This is Subject",
                            "This is Body",
                            "user@gmail.com",
                            "user@yahoo.com");
                } catch (Exception e) {
                    Log.e("SendMail", e.getMessage(), e);
                }

            }
        });

    }
}

GmailSender.java
YOUR PACKAGE;

import javax.activation.DataHandler;
import javax.activation.DataSource;
import javax.mail.Message;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.security.Security;
import java.util.Properties;

public class GMailSender extends javax.mail.Authenticator {
    private String mailhost = "smtp.gmail.com";
    private String user;
    private String password;
    private Session session;

    static {
        Security.addProvider(new com.provider.JSSEProvider());
    }

    public GMailSender(String user, String password) {
        this.user = user;
        this.password = password;

        Properties props = new Properties();
        props.setProperty("mail.transport.protocol", "smtp");
        props.setProperty("mail.host", mailhost);
        props.put("mail.smtp.auth", "true");
        props.put("mail.smtp.port", "465");
        props.put("mail.smtp.socketFactory.port", "465");
        props.put("mail.smtp.socketFactory.class",
                "javax.net.ssl.SSLSocketFactory");
        props.put("mail.smtp.socketFactory.fallback", "false");
        props.setProperty("mail.smtp.quitwait", "false");

        session = Session.getDefaultInstance(props, this);
    }

    protected PasswordAuthentication getPasswordAuthentication() {
        return new PasswordAuthentication(user, password);
    }

    public synchronized void sendMail(String subject, String body, String sender, String recipients) throws Exception {
        try{
        MimeMessage message = new MimeMessage(session);
        DataHandler handler = new DataHandler(new ByteArrayDataSource(body.getBytes(), "text/plain"));
        message.setSender(new InternetAddress(sender));
        message.setSubject(subject);
        message.setDataHandler(handler);
        if (recipients.indexOf(',') > 0)
            message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(recipients));
        else
            message.setRecipient(Message.RecipientType.TO, new InternetAddress(recipients));
        Transport.send(message);
        }catch(Exception e){

        }
    }

    public class ByteArrayDataSource implements DataSource {
        private byte[] data;
        private String type;

        public ByteArrayDataSource(byte[] data, String type) {
            super();
            this.data = data;
            this.type = type;
        }

        public ByteArrayDataSource(byte[] data) {
            super();
            this.data = data;
        }

        public void setType(String type) {
            this.type = type;
        }

        public String getContentType() {
            if (type == null)
                return "application/octet-stream";
            else
                return type;
        }

        public InputStream getInputStream() throws IOException {
            return new ByteArrayInputStream(data);
        }

        public String getName() {
            return "ByteArrayDataSource";
        }

        public OutputStream getOutputStream() throws IOException {
            throw new IOException("Not Supported");
        }
    }
}

JSSE Provider
/*
 *  Licensed to the Apache Software Foundation (ASF) under one or more
 *  contributor license agreements.  See the NOTICE file distributed with
 *  this work for additional information regarding copyright ownership.
 *  The ASF licenses this file to You under the Apache License, Version 2.0
 *  (the "License"); you may not use this file except in compliance with
 *  the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

/**
 * @author Alexander Y. Kleymenov
 * @version $Revision$
 */

import java.security.AccessController;
import java.security.Provider;

public final class JSSEProvider extends Provider {

    public JSSEProvider() {
        super("HarmonyJSSE", 1.0, "Harmony JSSE Provider");
        AccessController.doPrivileged(new java.security.PrivilegedAction<Void>() {
            public Void run() {
                put("SSLContext.TLS",
                        "org.apache.harmony.xnet.provider.jsse.SSLContextImpl");
                put("Alg.Alias.SSLContext.TLSv1", "TLS");
                put("KeyManagerFactory.X509",
                        "org.apache.harmony.xnet.provider.jsse.KeyManagerFactoryImpl");
                put("TrustManagerFactory.X509",
                        "org.apache.harmony.xnet.provider.jsse.TrustManagerFactoryImpl");
                return null;
            }
        });
    }
}

ADD 3 jars found in the following link to your Android Project

*

*mail.jar

*activation.jar

*additionnal.jar
Click here - How to add External Jars
Run the project and check your recipient mail account for the mail.
Cheers!!
Hope this helps
And don't forget that you cannot do network operation from the any UI activity in android.
So follow this answer if you have any network issue:
Jar files : https://code.google.com/p/javamail-android/


text:
Q: How to change username used by github pull requests I am seeing different usernames when pushing changes from bash vs. using a pull request in github.
In my .gitconfig file I set name = first last.  Which matches what I have in github.com under Public profile Name.  When I push changes from bash this is the name that gets used.
When I merge a pull request on github.com the username is getting used.  when I do a git log this causes these to show as different people under Author.
Right now it seems like the only way to work around this would be to ask everyone to change their config files to match this bad behavior, does anyone know of a better solution?

A: Found the solution in talking to someone.  The issue was that github will set the author name to username if it doesn't have a name set in the users profile.  After changing that things work great.


text:
Q: ModernHttpClient in release mode I am using ModernHttpClient in my app (in PCL via nuget and the same version 2.0.1 in both Droid and IOS projects) and it works perfectly in Debug Mode. It also works for IOS in release mode but for Android I am getting exception saying Java.Net.SocketException (thrown from NativeMessageHandler some async method). Is there any setting needed for release mode? Is this a known issue?

A: The problem was not because of ModernHttpClient but because the Internet permission was not set in the manifest file. It was working on Debug mode without this permission but not for Release mode.


text:
Q: PHP. Вывод данных с массива Всем привет. Возникла задачка, которую не могу решить.
К примеру, есть в массиве 500 данных. И я хочу разбить их по 100. Чтобы в секцию 1 - попадали от 0 до 100, в секцию 2 от 101-200 и так далее. Как это можно решить? Гуглил, но ответ так и не нашел.
Спасибо.

A: Например разбить по 5:
$array = array(1, 2, 3, 4, 5, 6);
var_dump(array_chunk($array, 5));

Документация http://php.net/manual/ru/function.array-chunk.php

A: Если именно из массива, то
$array500 = [....]; // Массив из 500 элементов

$section1 = array_slice($array500, 0, 100);
$section2 = array_slice($array500, 100, 100);
// и т.д.

http://php.net/manual/ru/function.array-slice.php


text:
Q: How do I get Jquery tabs to work on my existing page? I created a section of a page in its own file. The code looks like-
 <!doctype html>

      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <title>Test</title>

  <link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">
  <link href="css/styles.css" rel="stylesheet">

Easily find all of your application needs!

View All

Our outside salesforce works closely
with our local OEM customers

Meet the Team

Our UL508 shop can do everything from
product modifications to designing a panel

Quick Quote

Everything works fine. I try to add it to my homepage and it doesn't work. My guess as to the reason is that it is a different version of jquery. The versions that I am running on the existing page is-

After some research it appears I need to add a link to the ui js.
I added http://code.jquery.com/ui/1.9.1/jquery-ui.min.js because that is what matches the current jquery and it didn't work. I switched to 1.12.1 which is what I have on my test page( that works fine) and it doesn't work. Which link am I missing?

A: This is from a Magento website that uses prototype js. When I switched the $ for jquery it worked!


text:
Q: Future-In-The-Past Form of 'Should [subject]…, or should [subject]…?'-Type Sentences?      Consider a present-tense sentence in which a story's narrator expresses a situation in which the character in focus is considering which of two alternative choices he or she should make in the near future.  Such a sentence can be constructed as follows:

[a] Should he or she…, or should he or she…?
[b] Should he or she…, or would it be better if he or she…?
…, et cetera.

Here's an example of this kind of sentence:

[a] Should he eat the sandwich, or should he save it for later?
[b] Should he eat the sandwich, or would it be better if he saved it for later?
…, etc.

Now suppose the person who wrote that sentence and its surrounding text decided to change his or her work relative to the past tense.  How would he or she then alter a sentence like the one presented above as an example to make it fit in right alongside his or her newly revised content without needless linguistic contortions on his or her part?  Would the author use the 'future in the past' tense in some way, shape, or form?  If so, then how?  I haven't, for the life of me, been able to figure that out by myself.

A: Let's consider an example of a present-tense, first-person narration that considers a future action*:

[1a] I sit in the dark, holding a pistol as I realize that I will
  kill my wife because she cheated on me with my best friend.
[2a] I sit in the dark, holding a pistol as I realize that I
  shall kill my wife because she cheated on me with my best friend.
[3a] I sit in the dark, holding a pistol as I realize that I am
  going to kill my wife because she cheated on me with my best friend.
[4a] I sit in the dark, holding a pistol as I realize that I can
  kill my wife because she cheated on me with my best friend.
[5a] I sit in the dark, holding a pistol as I realize that I may
  kill my wife because she cheated on me with my best friend.

(There are some differences here.  Depending on your tastes, one of [1a] and [2a] is the more emphatic.  In [4a], can is the present tense, but it has an enduring sense:  I've realized that I am able to kill my wife, I feel that way now, and will likely into the near future.  The same goes for may in [5a], which for now, let's interpret as meaning that I have permission.)
All of these have a transposition to a past-tense narrative, with the future consideration placed in the past from the narrator's point of view but after the realization that came to the murderous protagonist.

[1b] I sat in the dark, holding a pistol as I realized that I would
  kill my wife because she cheated on me with my best friend.
[2b] I sat in the dark, holding a pistol as I realized that I
  should kill my wife because she cheated on me with my best friend.
[3b] I sat in the dark, holding a pistol as I realized that I was
  going to kill my wife because she cheated on me with my best friend.
[4b] I sat in the dark, holding a pistol as I realized that I could
  kill my wife because she cheated on me with my best friend.
[5b] I sat in the dark, because a pistol as I realized that I might
  kill my wife because she cheated on me with my best friend.

Notice the following:

*

*[1b] and [3b] are proper transpositions to the past, having meanings that correspond to [1a] and [3a], respectively.

*[4b] is ambiguous.  It means either that I was capable of murder or that it's uncertain whether I was, with murder being only a possibility.

*[2b] means that I had an obligation to kill.

*[5b] is ambiguous. It means either that I had permission to kill or that it's uncertain whether I would.

The reason for the changes in meaning from present to past tense, is that these past tenses has a modal sense, i.e, they record an aspect of the verb's meaning that isn't related to time.  You can see this because you can replace shall with should, can with could, and may with might in [2a], [4a], and [5a], respectively.

A: Your question is still confusing from my perspective, but I feel the answer is similar in that we use a variation of to do +/- past perfect.
Did Joe want to play soccer in the morning, or did he want to wait until later in the day?
Had Joe waited until the morning to play soccer, then he wouldn't have sprained his ankle in the dark.
In either case, you are using a past-tense auxiliary verb along with your action verb. In the first example, by adding an infinitive it brings your past tense "into the present," giving an illusion, if you will, of a future action.
It seems to me a problem you're having is leaving a semblance of mystery in a past-tense story frame. A primary reason most novels are written past tense is so the author can describe the action and describe the scene in a way the reader can take it all in.
You can't really write Did he eat the sandwich or didn't he? with any kind of interest unless that's the primary question of your mystery.
In third person, you have to be a little creative: Joe considered eating the sandwich. It sure looked tasty. But then he remembered the warnings, the rumors. Food was not be trusted from this kitchen. Should I eat the sandwich or shouldn't I, Joe thought to himself. He ate the sandwich; and it was a good thing, too. For that would be the last solid food Joe would eat for three days.
You can keep your basic premise by attributing to a thought or conversation, which is usually in present tense, of a past-tense story.


text:
Q: Where to store Document Templates in Word 2013? I'm working on Windows 8.1 with Word 2013. I created a Template from an existing document in Word. I placed the template in C:\Users\<me>\App Data\Roaming\Microsoft\Templates. I open Word and attempted to create a document based on the Template. But I can't because the template is not available. Its not available on the "New Document" screen. And searching for it from within Word returns 0 results.
File → Options → Advanced no longer lists template locations. This new interface really sucks. Microsoft has ruined nearly every one of its programs with this cursed tablet interface.
Where do I store templates in Word 2013?

A: In Office 2013 %APPDATA%\Microsoft\Templates is used to store templates from Office.com.
The default location for personal, customized templates is now at: My Documents\Custom Office Templates.


text:
Q: Open a DatePickerDialog on Click of EditText takes two clicks I want to open a Calendar on the click of Edit text. After that I want to set the date which the user selects from the Calendar in the edit text. Problem is that, only when I click on the EditText for the second time then the calendar open. Please help me to resolve the issue(why calendar don't open for the first time).
EditText XML code
<EditText
            android:id="@+id/dateofBirth"
            android:layout_width="290dp"
            android:layout_height="wrap_content"
            android:layout_marginLeft="5dp"
            android:layout_marginTop="10dp"
            android:maxLines="1"
            android:hint="dd/mm/yyyy" />

Activity Code
public void informationPopUp() {
        final Dialog dialog= new Dialog(MainActivity.this,R.style.Dialog_Fullscreen);
        dialog.setContentView(R.layout.details_dialog);
        dateofBirth = (EditText)dialog.findViewById(R.id.dateofBirth);

        dialog.show();
         myCalendar = Calendar.getInstance();

       final DatePickerDialog.OnDateSetListener date = new DatePickerDialog.OnDateSetListener() {

            @Override
            public void onDateSet(DatePicker view, int year, int monthOfYear,
                    int dayOfMonth) {
                // TODO Auto-generated method stub
                myCalendar.set(Calendar.YEAR, year);
                myCalendar.set(Calendar.MONTH, monthOfYear);
                myCalendar.set(Calendar.DAY_OF_MONTH, dayOfMonth);
                updateLabel();
            }

        };

        dateofBirth.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                showDialog(DATE_DIALOG_ID);
              }
        });

    }
     private void updateLabel() {
         String myFormat = "MM/dd/yy"; //In which you need put here
         SimpleDateFormat sdf = new SimpleDateFormat(myFormat, Locale.US);
         dateofBirth.setText(sdf.format(myCalendar.getTime()));
     }

     protected Dialog onCreateDialog(int id) {
            final Calendar now = Calendar.getInstance();

            switch (id) {
            case DATE_DIALOG_ID:
                // set date picker as current date
                DatePickerDialog _date =   new DatePickerDialog(this, date,myCalendar
                        .get(Calendar.YEAR), myCalendar.get(Calendar.MONTH),
                        myCalendar.get(Calendar.DAY_OF_MONTH)){
                    @Override

                    public void onDateChanged(DatePicker view, int year, int monthOfYear, int dayOfMonth){

                        if (year > now.get(Calendar.YEAR))

                            view.updateDate(myCalendar
                                    .get(Calendar.YEAR), myCalendar
                                    .get(Calendar.MONTH), myCalendar.get(Calendar.DAY_OF_MONTH));

                        if (monthOfYear > now.get(Calendar.MONTH) && year == now.get(Calendar.YEAR))
                            view.updateDate(myCalendar
                                    .get(Calendar.YEAR), myCalendar
                                    .get(Calendar.MONTH), myCalendar.get(Calendar.DAY_OF_MONTH));

                        if (dayOfMonth > now.get(Calendar.DAY_OF_MONTH) && year == now.get(Calendar.YEAR) &&
                                monthOfYear == now.get(Calendar.MONTH))
                            view.updateDate(myCalendar
                                    .get(Calendar.YEAR), myCalendar
                                    .get(Calendar.MONTH), myCalendar.get(Calendar.DAY_OF_MONTH));
                            }
                };
                return _date;
            }
            return null;
        }

I am not understanding what I have done wrong. Please suggest a solution.

A: public class MainActivity extends Activity  {

 private Calendar cal;
 private int day;
 private int month;
 private int year;
 private EditText et;

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

     et= (EditText) findViewById(R.id.edittext1);
      cal = Calendar.getInstance();
      day = cal.get(Calendar.DAY_OF_MONTH);
      month = cal.get(Calendar.MONTH);
      year = cal.get(Calendar.YEAR);

     et.setText(day+"/"+month+"/"+"/"+year);

      et.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            DateDialog();

        }
    });
     }

public void DateDialog(){

    OnDateSetListener listener=new OnDateSetListener() {

        @Override
        public void onDateSet(DatePicker view, int year, int monthOfYear,int dayOfMonth)
        {

         et.setText(dayOfMonth+"/"+monthOfYear+"/"+year);

        }};

    DatePickerDialog dpDialog=new DatePickerDialog(this, listener, year, month, day);
    dpDialog.show();

}

}

A: In your xml, set the focusable to false
android:focusable="false"

A: Just only do this
//Open the DatePicker dialgo in one click and also hide the soft keyboard.
youEditText.setInputType(InputType.TYPE_NULL);
youEditText.requestFocus();

A: I'll try to address your problem, but I am not completely sure about the first reason.

*

*The calendar opening only on the second click is because you are using an edittext. On the first click, your Edit Text will get focus. then the second click only calls the onClickListener.
If you are not looking forward to edit the date set manually (using keyboard), then why not using a TextView to display the selected Date?

*The problem with the date not updating in editText is occurring because you are not setting the DateSetListener in your code. You need to set that to notify the system that a Date was set. The DateChange listener only returns the date while you are changing the date, and it doesn't appear that you are setting the date in the EditText.
Try this code:
            Calendar cal = Calendar.getInstance(TimeZone.getDefault());
            DatePickerDialog datePicker = new DatePickerDialog(this,
                R.style.AppBlackTheme,
                datePickerListener,
                cal.get(Calendar.YEAR),
                cal.get(Calendar.MONTH),
                cal.get(Calendar.DAY_OF_MONTH));

            datePicker.setCancelable(false);
            datePicker.setTitle("Select the date");

            return datePicker;
        }
    } catch (Exception e) {
        showMsgDialog("Exception",
            "An error occured while showing Date Picker\n\n"
            + " Error Details:\n" + e.toString(), "OK");
    }
    return null;
}

private DatePickerDialog.OnDateSetListener datePickerListener = new DatePickerDialog.OnDateSetListener() {

    // when dialog box is closed, below method will be called.
    public void onDateSet(DatePicker view, int selectedYear, int selectedMonth, int selectedDay) {
        String year1 = String.valueOf(selectedYear);
        String month1 = String.valueOf(selectedMonth + 1);
        String day1 = String.valueOf(selectedDay);
        TextView tvDt = (TextView) findViewById(R.id.tvDate);
        tvDt.setText(day1 + "/" + month1 + "/" + year1);
    }
};

In this, I am updating the date to a TextView with the ID "tvDate". I advise using a TextView instead of EditText and try this code.
Update
If you need to use EditText and load the calender in the first click, then try setting an onFocusListner to the editText instead of onClickListner.
editText.setOnFocusChangeListener(new OnFocusChangeListener() {
    @Override
    public void onFocusChange(View v, boolean hasFocus) {
        if(hasFocus) {
           // Show your calender here
        } else {
           // Hide your calender here
        }
    }
});

A: Just use this in your EditText
    android:focusable="false"

A: use  setOnFocusChangeListener instead of OnCLickListner following code is an example which i am using for same purpose.
editText_dob.setOnFocusChangeListener(new View.OnFocusChangeListener() {
        @Override
        public void onFocusChange(View v, boolean hasFocus) {
            if(hasFocus){
                hideSoftKeyboard(RegisterationActivity.this);
                editText_dob.setRawInputType(InputType.TYPE_CLASS_TEXT);
                setDate(editText_dob);
            }
        }
    });

A: first define these variables in your activity
    import android.app.AlertDialog;
    import android.app.DatePickerDialog;
    import android.app.TimePickerDialog;
    import android.content.Context;
    import android.content.DialogInterface;
    import android.util.Log;
    import android.view.View;
    import android.widget.DatePicker;
    import android.widget.TimePicker;

    import java.text.DateFormat;
    import java.text.ParseException;
    import java.text.SimpleDateFormat;
    import java.util.Calendar;
    import java.util.Date;

public class MainActivity extends Activity  {

    private int mYear, mMonth, mDay, mHour, mMinute;

then uses these methods:
1) for open DATE picker modal
            public void openDatePicker() {
                // Get Current Date
                final Calendar c = Calendar.getInstance();
                mYear  = c.get(Calendar.YEAR);
                mMonth = c.get(Calendar.MONTH);
                mDay   = c.get(Calendar.DAY_OF_MONTH);
                //launch datepicker modal
                DatePickerDialog datePickerDialog = new DatePickerDialog(this,
                        new DatePickerDialog.OnDateSetListener() {
                            @Override
                            public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
                                Log.d(APIContanst.LOG_APP, "DATE SELECTED "+dayOfMonth + "-" + (monthOfYear + 1) + "-" + year);
                                //PUT YOUR LOGING HERE
                                //UNCOMMENT THIS LINE TO CALL TIMEPICKER
                               //openTimePicker();
                            }
                        }, mYear, mMonth, mDay);
                datePickerDialog.show();
            }

2) for open TIME picker modal
            public void openTimePicker() {
                // Get Current Time
                final Calendar c = Calendar.getInstance();
                mHour            = c.get(Calendar.HOUR_OF_DAY);
                mMinute          = c.get(Calendar.MINUTE);
                //launch timepicker modal
                TimePickerDialog timePickerDialog = new TimePickerDialog(this,
                        new TimePickerDialog.OnTimeSetListener() {
                            @Override
                            public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
                                Log.d(APIContanst.LOG_APP, "TIME SELECTED "+hourOfDay + "-" + minute + "-");
                            //PUT YOUR LOGIC HERE
                            }
                        }, mHour, mMinute, false);
                timePickerDialog.show();
            }

also you can combine the two methods to open the time picker after closing the date picker.
These functions do not need to use a plugin

A: Try this code 100% works
WRITE THIS IN ONCREATE
et_dob.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            showDialog(DATE_DIALOG_ID);
        }

    });
    final Calendar calendar = Calendar.getInstance();
    DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
    if (et_dob.getText().toString() != null) {
        try {
            calendar.setTime(df.parse(et_dob.getText().toString()));
        } catch (java.text.ParseException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }
        mYear = calendar.get(Calendar.YEAR);
        mMonth = calendar.get(Calendar.MONTH);
        mDay = calendar.get(Calendar.DAY_OF_MONTH);
        SimpleDateFormat month_date = new SimpleDateFormat("MMM");
        month = month_date.format(calendar.getTime());
    } else {
        mYear = calendar.get(Calendar.YEAR);
        mMonth = calendar.get(Calendar.MONTH);
        mDay = calendar.get(Calendar.DAY_OF_MONTH);
        SimpleDateFormat month_date = new SimpleDateFormat("MMM");
        month = month_date.format(calendar.getTime());
    }

    if (cal_currentTime.compareTo(calendar) > 0)
        updateDisplay();

AND PASTE REMAINING CODE IN YOUR CLASS
static final int DATE_DIALOG_ID = 1;
private int mYear;
private int mMonth;
private int mDay;
private String month;
private String dateOfBirth;

@Override
protected Dialog onCreateDialog(int id) {
    switch (id) {
    case DATE_DIALOG_ID:
        return new DatePickerDialog(this, mDateSetListener, mYear, mMonth,
                mDay);
    }
    return null;
}

@Override
protected void onPrepareDialog(int id, Dialog dialog) {
    switch (id) {
    case DATE_DIALOG_ID:
        ((DatePickerDialog) dialog).updateDate(mYear, mMonth, mDay);
        break;
    }
}

private DatePickerDialog.OnDateSetListener mDateSetListener = new DatePickerDialog.OnDateSetListener() {

    public void onDateSet(DatePicker view, int year, int monthOfYear,
            int dayOfMonth) {
        mYear = year;
        mMonth = monthOfYear;
        mDay = dayOfMonth;

        String dateSetter = (new StringBuilder().append(mYear).append("-")
                .append(mMonth + 1).append("-").append(mDay).append(""))
                .toString();
        final Calendar cal = Calendar.getInstance();
        DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
        if (dateSetter != null) {
            try {
                cal.setTime(df.parse(dateSetter));
            } catch (java.text.ParseException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }
            SimpleDateFormat month_date = new SimpleDateFormat("MMM");
            month = month_date.format(cal.getTime());
        }

        if (cal_currentTime.compareTo(cal) > 0)
            updateDisplay();
        else
            Toast.makeText(context, "Choose Proper date format",
                    Toast.LENGTH_SHORT).show();
    }
};

to load it to edit text
private void updateDisplay() {
    dateOfBirth = (new StringBuilder()
            // Month is 0 based so add 1
            .append(mYear).append("-").append(mMonth + 1).append("-")
            .append(mDay).append("")).toString();
    et_dob.setText(new StringBuilder()
            // Month is 0 based so add 1
            .append(mDay).append("-").append(month).append("-")
            .append(mYear));
}

A: Add this in your edittext to open date picker at first click.
 android:focusable="false"

A: Add this to your EditText xml file:
    android:clickable="false"
    android:cursorVisible="false"
    android:focusable="false"
    android:focusableInTouchMode="false">

By this way it will work like a text view

A: the first thing, add android:focusable="false" in xml.
In java code, only set an event:
case R.id.edt_d_o_birth: {
            KeyboardUtils.hideSoftKeyboard(this);
            Calendar calendar = Calendar.getInstance(Locale.getDefault());
            DatePickerDialog datePickerDialog = new DatePickerDialog(RegisterActivity.this,
                    new DatePickerDialog.OnDateSetListener() {
                @Override
                public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
                    //todo
                }
            },calendar.get(Calendar.YEAR),calendar.get(Calendar.MONTH),calendar.get(Calendar.DAY_OF_MONTH));
            datePickerDialog.show();
            break;
        }

A: 100 % working code
Implement  implements View.OnClickListener
Inside onCreate  YourEditText.setOnClickListener(this);
@Override
    public void onClick(View v) {

        if (v == YourEditText) {

            // Get Current Date
            final Calendar c = Calendar.getInstance();
            mYear = c.get(Calendar.YEAR);
            mMonth = c.get(Calendar.MONTH);
            mDay = c.get(Calendar.DAY_OF_MONTH);

            DatePickerDialog datePickerDialog = new DatePickerDialog(this,
                    new DatePickerDialog.OnDateSetListener() {

                        @Override
                        public void onDateSet(DatePicker view, int year,
                                              int monthOfYear, int dayOfMonth) {

                            YourEditText.setText(dayOfMonth + "-" + (monthOfYear + 1) + "-" + year);

                        }
                    }, mYear, mMonth, mDay);
            datePickerDialog.show();
        }
}

A: Add this in your EditText
 android:editable="false"
 android:focusable="false"

A: In the layout.xml file, add the property android:focusable=false, this will surely work

A: In the XML file add property android:focusableInTouchMode="false" :
 <EditText
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:focusableInTouchMode="false"
        android:hint="Some text"/>

A: try this ones
         <EditText
            android:id="@+id/et_mDate"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:clickable="false"
            android:cursorVisible="false"
            android:focusable="false"
            android:focusableInTouchMode="false"
            android:hint="Enter A Date in dd/mm/YYYY "
            android:inputType="date"
            android:padding="8dp" />

A: Thanks to Lavekush Agrawal  , this works for me, just write this on your onCreate method
register_birthday.setInputType(InputType.TYPE_NULL);
register_birthday.requestFocus();

A: problem is your edit text is get in focus on first click and than on second click it apply click event. so you just need to do is set focus default or as i did it in xml add one attribute as below :
android:focusableInTouchMode="false"

in sort replace your xml with below and try again:
<EditText
        android:id="@+id/dateofBirth"
        android:layout_width="290dp"
        android:layout_height="wrap_content"
        android:layout_marginLeft="5dp"
        android:layout_marginTop="10dp"
        android:maxLines="1"
    android:focusableInTouchMode="false"
        android:hint="dd/mm/yyyy" />

A: If you want open dialog box in edit text single click. Please try this one.
editTextNmae.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
    if(hasFocus) {
       // call Date dialog box...
    } else {
       // Hide Hide dialog box....
    }
}

});

A: As you are using EditText it get focused when you click on it for first time.
just add focusable attribute in your xml files as :
android:focusable="false"


text:
Q: Bind Items to a DropDownBox in OpenUI5 I am trying to bind a Value inside of an Array with Objects to a sap.ui.commons.DropdownBox.
My JSON-structure looks like that:
{
  "forms": [
    {
      "name": "First Object"
    },
    {
      "name": "Second Object"
    }
  ]
}

Now I try to bindItems to my DropdownBox like that:
var oItemTemplate = new sap.ui.core.ListItem();
oItemTemplate.bindProperty("text", "{/name}");

var oModel = new sap.ui.model.json.JSONModel();
oModel.setData(oData);
sap.ui.getCore().setModel(oModel);

var oDropDown = new sap.ui.commons.DropdownBox("dropDownBox");

oDropDown.bindItems("/forms", oItemTemplate);

Unfortunately the Items, i am adding/binding to the Dropdown, are empty.
How to properly bind Items in an Array of Objects to a DropdownBox?
JSBIN-Example

A: Got the answer after a very restfully night :)
This is the working code snippet:
var oItemTemplate = new sap.ui.core.ListItem();
oItemTemplate.bindProperty("text", "name");

var oModel = new sap.ui.model.json.JSONModel();
oModel.setData(oData);
sap.ui.getCore().setModel(oModel);

var oDropDown = new sap.ui.commons.DropdownBox("dropDownBox");
oDropDown.bindItems("/forms", oItemTemplate);

JSBIN-Example


text:
Q: how to speed up enumerate for numpy array / how to enumerate over numpy array efficiently? I need to generate a lot of random numbers. I've tried using random.random but this function is quite slow. Therefore I switched to numpy.random.random which is way faster! So far so good. The generated random numbers are actually used to calculate some thing (based on the number). I therefore enumerate over each number and replace the value. This seems to kill all my previously gained speedup. Here are the stats generated with timeit():
test_random - no enumerate
0.133111953735
test_np_random - no enumerate
0.0177130699158

test_random - enumerate
0.269361019135
test_np_random - enumerate
1.22525310516

as you can see, generating the number is almost 10 times faster using numpy, but enumerating over those numbers gives me equal run times.
Below is the code that I'm using:
import numpy as np
import timeit
import random

NBR_TIMES = 10
NBR_ELEMENTS = 100000

def test_random(do_enumerate=False):
    y = [random.random() for i in range(NBR_ELEMENTS)]
    if do_enumerate:
        for index, item in enumerate(y):
            # overwrite the y value, in reality this will be some function of 'item'
            y[index] = 1 + item

def test_np_random(do_enumerate=False):
    y = np.random.random(NBR_ELEMENTS)
    if do_enumerate:
        for index, item in enumerate(y):
            # overwrite the y value, in reality this will be some function of 'item'
            y[index] = 1 + item

if __name__ == '__main__':
    from timeit import Timer

    t = Timer("test_random()", "from __main__ import test_random")
    print "test_random - no enumerate"
    print t.timeit(NBR_TIMES)

    t = Timer("test_np_random()", "from __main__ import test_np_random")
    print "test_np_random - no enumerate"
    print t.timeit(NBR_TIMES)

    t = Timer("test_random(True)", "from __main__ import test_random")
    print "test_random - enumerate"
    print t.timeit(NBR_TIMES)

    t = Timer("test_np_random(True)", "from __main__ import test_np_random")
    print "test_np_random - enumerate"
    print t.timeit(NBR_TIMES)

What's the best way to speed this up and why does enumerate slow things down so dramatically?
EDIT: the reason I use enumerate is because I need both the index and the value of the current element.

A: To take full advantage of numpy's speed, you want to create ufuncs whenever possible. Applying vectorize to a function as mgibsonbr suggests is one way to do that, but a better way, if possible, is simply to construct a function that takes advantage of numpy's built-in ufuncs. So something like this:
>>> import numpy
>>> a = numpy.random.random(10)
>>> a + 1
array([ 1.29738145,  1.33004628,  1.45825441,  1.46171177,  1.56863326,
        1.58502855,  1.06693054,  1.93304272,  1.66056379,  1.91418473])
>>> (a + 1) * 0.25 / 4
array([ 0.08108634,  0.08312789,  0.0911409 ,  0.09135699,  0.09803958,
        0.09906428,  0.06668316,  0.12081517,  0.10378524,  0.11963655])

What is the nature of the function you want to apply across the numpy array? If you tell us, perhaps we can help you come up with a version that uses only numpy ufuncs.
It's also possible to generate an array of indices without using enumerate. Numpy provides  ndenumerate, which is an iterator, and probably slower, but it also provides indices, which is a very quick way to generate the indices corresponding to the values in an array. So...
>>> numpy.indices(a.shape)
array([[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]])

So to be more explicit, you can use the above and combine them using numpy.rec.fromarrays:
>>> a = numpy.random.random(10)
>>> ind = numpy.indices(a.shape)
>>> numpy.rec.fromarrays([ind[0], a])
rec.array([(0, 0.092473494150913438), (1, 0.20853257641948986),
       (2, 0.35141455604686067), (3, 0.12212258656960817),
       (4, 0.50986868372639049), (5, 0.0011439325711705139),
       (6, 0.50412473457942508), (7, 0.28973489788728601),
       (8, 0.20078799423168536), (9, 0.34527678271856999)],
      dtype=[('f0', '<i8'), ('f1', '<f8')])

It's starting to sound like your main concern is performing the operation in-place. That's harder to do using vectorize but it's easy with the ufunc approach:
>>> def somefunc(a):
...     a += 1
...     a /= 15
...
>>> a = numpy.random.random(10)
>>> b = a
>>> somefunc(a)
>>> a
array([ 0.07158446,  0.07052393,  0.07276768,  0.09813235,  0.09429439,
        0.08561703,  0.11204622,  0.10773558,  0.11878885,  0.10969279])
>>> b
array([ 0.07158446,  0.07052393,  0.07276768,  0.09813235,  0.09429439,
        0.08561703,  0.11204622,  0.10773558,  0.11878885,  0.10969279])

As you can see, numpy performs these operations in-place.

A: Check numpy.vectorize, it should let you apply arbitrary functions to numpy arrays. For your simple example, you'd do something like this:
vecFunc = vectorize(lambda x: x + 1)
vecFunc(y)

However, that will create a new numpy array instead of modifying it in-place (which may or may not be a problem in your particular case).
In general, you'll always be better manipulating numpy structures with numpy functions than iterating with python functions, since the former are not only optimized but implemented in C, while the latter will be always interpreted.


text:
Q: Can you shelve code in TFS visual studio, roll back to a previous check in and the shelved code still be there? Developers have redesigned the homepage for a website and I amended my automated tests to reflect this and checked in these changes.  The homepage was reverted back to its original layout since the golive date has been pushed back three weeks. I have loaded the automated tests checked in before redesigned homepage changes.  Between now and the new go-live date there will be new functionality added to other pages on the website.  Am I able to

*

*Shelve the new code that tests new functionality

*When the  new homepage is switched on, roll back to the last check in ( the one that had the tests that reflect the new homepage)

*Unshelve the new code and integrate it with tests for the new homepage


text:
Q: PascalABC ошибка
Пишу chat bot, PascalABC ошибка ошибка времени выполнения входная строка имела неверный формат помогите пожалуйста

A: Вот она, пресловутая ошибка в 17 строке ;)
Переменная name имеет тип почему-то Integer, поэтому readln  ожидает ввод целого числа, а не 'Вася Пупкин'.
Сделайте
var name: string;

и больше не приводите код скриншотами.


text:
Q: Why am I getting "-bash: 'alias: command not found", but it's there..? I dont understand why my alias doesnt work, any idea people? I want to use 'pro' as an alias
thanks! ^_^)
this is how my bash-file looks like:
export PATH="/usr/local/bin:$PATH"

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

# Git branch in prompt.
parse_git_branch() {
    git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \W\[\033[32m\]\$(parse_git_branch)\[\033[00m\] $ "

#******ALIAS FOR TEALEAF_COURSE3**********************

alias pro='cd /Users/yoniPacheko/Documents/ruby/RnR/third_course_0/projects '

A: well I was looking all the time for the .bash_profile but I've zsh as a shell, so I was looking at the wrong place.
The right place is .zshrc, for those that don't run a bash-shell and want to make aliases
But thanks for yr inputs community, I got the picture finally.
:)


text:
Q: Android - Constraint Layout wont respect margins? I'm very new to ConstraintLayout and I'm having trouble with margins.  I have the following layout file, but I'm trying to get the layoutNewsEventsItemImageContainer to have a 20dp margin on the left, while keeping the TextView's to the left of that margin.
What am I doing wrong???
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/layoutNewsEventsItemContainer"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:clickable="true"
    android:focusable="true"
    android:padding="20dp">

    <TextView
        android:id="@+id/lblNewsEventsItemHeadline"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="TextView"
        app:layout_constraintRight_toLeftOf="@+id/layoutNewsEventsItemImageContainer"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"/>

    <TextView
        android:id="@+id/lblNewsEventsItemCopy"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:text="TextView"
        app:layout_constraintRight_toLeftOf="@+id/layoutNewsEventsItemImageContainer"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/lblNewsEventsItemHeadline"/>

    <TextView
        android:id="@+id/lblNewsEventsItemDateModified"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="TextView"
        app:layout_constraintRight_toLeftOf="@+id/layoutNewsEventsItemImageContainer"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/lblNewsEventsItemCopy"/>

    <android.support.constraint.ConstraintLayout
        android:id="@+id/layoutNewsEventsItemImageContainer"
        android:layout_width="75dp"
        android:layout_height="75dp"
        android:background="@color/BackgroundColor2"
        android:layout_marginStart="20dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toTopOf="parent">

    </android.support.constraint.ConstraintLayout>

</android.support.constraint.ConstraintLayout>

As you can see in the preview below, it's cutting off my Copy TextView.  The TextView should be keeping to the left of the layoutNewsEventsItemImageContainer and therefore wrapping to the next line.  but as you can see, no margin is being applied.

A: Please user below xml code to achieve proper result
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/layoutNewsEventsItemContainer"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:clickable="true"
    android:focusable="true"
    android:padding="20dp">

    <TextView
        android:id="@+id/lblNewsEventsItemHeadline"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginRight="20dp"
        android:text="TextViewnsd,n,snfklsdnfknkfnm,nfm,nf,mn,mfnm,sdnfm,dnf,mnsd,mfn,sdmfn,dmsnf,sdnf,nsd,fn,sdf,nms,fn,fsd"
        app:layout_constraintEnd_toStartOf="@id/layoutNewsEventsItemImageContainer"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"

        />

    <TextView
        android:id="@+id/lblNewsEventsItemCopy"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginRight="20dp"
        android:layout_marginTop="10dp"
        android:text="88888888888888888888888888888888888888888888888888888888888888888888888888"
        app:layout_constraintEnd_toStartOf="@id/layoutNewsEventsItemImageContainer"
        app:layout_constraintStart_toStartOf="parent"

        app:layout_constraintTop_toBottomOf="@+id/lblNewsEventsItemHeadline" />

    <TextView
        android:id="@+id/lblNewsEventsItemDateModified"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginRight="20dp"
        android:text="yess"
        app:layout_constraintEnd_toStartOf="@id/layoutNewsEventsItemImageContainer"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/lblNewsEventsItemCopy" />

    <android.support.constraint.ConstraintLayout
        android:id="@+id/layoutNewsEventsItemImageContainer"
        android:layout_width="70dp"
        android:layout_height="70dp"
        android:background="@color/colorPrimary"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toTopOf="parent">

    </android.support.constraint.ConstraintLayout>
</android.support.constraint.ConstraintLayout>

This will help you to achieve below result using constraint layout

Hope this will help

A: first of all why don't you just use an Image View for your container ?
and check this one just edit the text view width that don't accept the margin to 0dp
     <?xml version="1.0" encoding="utf-8"?>
     <android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/layoutNewsEventsItemContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:focusable="true"
android:padding="20dp">

<TextView
    android:id="@+id/lblNewsEventsItemHeadline"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="TextView"
    app:layout_constraintRight_toLeftOf="@+id/layoutNewsEventsItemImageContainer"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"/>

<TextView
    android:id="@+id/lblNewsEventsItemCopy"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_marginTop="10dp"
    android:text="88888888888888888888888888888888888888888888888888888888888888888888888888"
    app:layout_constraintRight_toLeftOf="@+id/layoutNewsEventsItemImageContainer"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/lblNewsEventsItemHeadline" />

<TextView
    android:id="@+id/lblNewsEventsItemDateModified"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginStart="16dp"
    android:text="TextView"
    app:layout_constraintRight_toLeftOf="@+id/layoutNewsEventsItemImageContainer"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/lblNewsEventsItemCopy" />

<ImageView
    android:id="@+id/layoutNewsEventsItemImageContainer"
    android:layout_width="70dp"
    android:layout_height="70dp"
    android:layout_marginEnd="16dp"
    android:layout_marginStart="20dp"
    android:background="@color/colorPrimary"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toEndOf="@+id/lblNewsEventsItemCopy"
    app:layout_constraintTop_toTopOf="parent"
    android:layout_marginRight="16dp"
    android:layout_marginLeft="20dp">

</ImageView>

A: As suggested, place your text views inside relative layout. This will allow your constraint layout to align next to something it knows, as opposed to aligning next to a textview that might change size and thus causing overlapping. You get predictable behavior with this.
<ConstraintLayout
android:id="@+id/layoutNewsEventsItemContainer"
...

<RelativeLayout
android:id="@+id/container_for_textview"
android:width="wrap_content"
android:height="wrap_content">
 <TextView> ...first
 <TextView> ...second
 <TextView> ...third
</RelativeLayout>

<ConstraintLayout
    android:id="@+id/layoutNewsEventsItemImageContainer"
    ....
    app:layout_constraintEnd_toEndOf="@+id/container_for_textview"
</ConstraintLayout>

</ConstraintLayout>//NewsEventsItemContainer


text:
Q: AngularJS how to submit untouched, empty form fields? I've got a problem with a form. I'm submitting the form and some of the fields don't have to be filled, when the data is send to a restful API I see that angular doesn't pick up the empty, never touched, never changed, input fields.
But on the server side the field is expected to be present. How can I get angular to send these fields as well?
I have two inputs (data.Record.one, data.Record.two), when I fill one and submit the form I'm ending up with this:
{
  "Record": {
    "one": "test"
  }
}

I guess this is because angular doesn't "see" untouched and empty fields.
But I want that:
{
  "Record": {
    "one": "test",
    "two": ""
  }
}

Here is a demo of what I try: http://plnkr.co/edit/Ky0PQ9U5o1V7IyU9QgkK
I'm well aware that I could initialize the form with an empty skeleton object but I would really prefer to not have to do that. If I need to do that it's just additional code that as a bonus will just introduce an area of potential fail if another dev adds a field in the form but forgets / doesn't know about the skeleton in the JS code.

A: Angular treats empty fields as empty/null by default. You can disable this by adding ng-trim="false" on your input fields.
This will not add extra code, only definition on your markup.
https://docs.angularjs.org/api/ng/input/input%5Btext%5D
EDIT: I see now what you want. Angular takes good care of your model (data). Just because you bind an input field to a sub,sub property won't initialize the property with empty string. The input fields does not contain empty string - they contain null which is what you put in them in the first place (by binding them to an uninitalized property).
The feature you want, is for angular to initialize your data.Record with the properties you need. You could make a custom directive for that called initialize-property that would set its model to an empty string.
EDIT: I created the directive but plunker won't let me access due to some cross domain problems. You should be able to use it in your own work though
myApp.directive('initializeProperty', function() {
  return {
      restrict: 'A',
      link: function (scope, element, attr) {
        element.val('');
      }
  };
});

And then on your input fields use this:
One <input name="one" ng-model="data.Record.one" initialize-property ng-trim="false" />

Two <input name="one" ng-model="data.Record.two" initialize-property ng-trim="false" />

A: replace your app.js code to this one
var myApp = angular.module('myApp', []);

myApp.controller('TestFormController', ['$scope', '$log', function($scope, $log) {
    $scope.data = {
      Record : {
        "one": "",
      "two": ""
      }
    }
    $scope.add = function() {
        $log.log($scope.data);
    }
}]);

DEMO
UPDATE !
change your view with this html
One <input name="one" ng-init="data.Record.one = ''" ng-model="data.Record.one"  />

Two <input name="one" ng-init="data.Record.two = ''" ng-model="data.Record.two" />

i have added extra ng-init directive which will initilize your data
DEMO

A: I fixed it simply using ng-init="inputfieldname=''"

A: I had the same problem, so then in my research I find this:
http://blog.fernandomantoan.com/angularjs-forcando-bind-de-todos-os-campos-no-submit/
Solve my problem, but I had to edit, thus:
.directive('forceBind',  function() {
    return {
        require: '^form',
        priority: -1,
        link: function (scope, element, attrs, form) {
            element.bind('submit', function() {
                angular.forEach(form, function(value, key) {
                    if(typeof value == 'object'){
                        if (value.hasOwnProperty('$modelValue')) {
                            if (!value.$viewValue) {
                                value.$setViewValue("");
                            }
                        }
                    }
                });
            });
        }
    };
});

So, when the event submit runs, before entering in method the directive force bind.
I recommend using ng-submit for validation.
Sorry my english.


text:
Q: Reading files line-by-line and searching for patterns in python I am reading a file line-by-line and store the information, but some lines are slightly different and needs to be sorted out.
I have a text file with 502 lines and it is something like
VV item1 value1 item2 value2 itemA valA
VV item1 value1 item2 value2 itemB valB
...

I am storing these values by reading the text line-by-line, but there are differences between the lines. Instead of itemA, I have itemB sometimes. I first tried
ifn = open(afile,'r')
while 1:
    l = ifn.readline()
    print(int(l.split(' ')[1])) #prints value1 as expected
    if re.search('itemB', l):
            print(int(l.split(' ')[6]))

This last print statement doesn't print anything although it supposes to and ignores it totally.
Then I also tried
ifn = open(afile,'r')
for i,l in enumerate(ifn):
        print( linecache.getline(ifn.name,i).split(' ')[1]) )

but it prints a blank line before implementing the re.search statement.
I'd appreciate any help on either one of the approaches.
Thanks you.

A: I suspect that its your while loop + readline() that's causing the problem. This code should work if you use a context manager and a for loop:
with open('test.txt','r') as file:
    for line in file:
        if 'itemB' in line:
            print(line.split(' ')[5])

Also, it looks like you're trying to access the 6th item in the line - which means you need to use index 5


text:
Q: E-mail sending using Gmail I've developed an email application which can be consist of several attachment.size of those attachments could be 20MB or even higher and i'm using smtp.gmail.com as my host.my issue is it's very slow.i think it may because attachments are uploaded when the Send() mail function is called.is there any option to solve this issue?

A: The bottleneck is your Internet connection upload speed.
The only way to resolve this issue is to lease a faster Internet connection.
On most broadband connections, you should expect this upload to take at least 100 seconds (200k per second upload).
Web Email Clients (Like Gmail) get around this with asynchronous uploaders. The attachment begins uploading as soon as you select it (even while you are still typing out the rest of your email, before you hit send). Unfortunately, I do not believe there is an API that allows async file upload to GMail for this purpose.
With that said, you may be able to do an async upload to another server, and simply link to that file in the emails that you are sending.


text:
Q: Wrong String parameter when sending a json string as a post request I used this code for my Macro in VBA in excel:
Sub Macro1()

Dim URL As String, JSONString As String, objHTTP As Object
Set objHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")
URL = "xxxxx"
objHTTP.Open "POST", URL, False
objHTTP.setRequestHeader "Content-type", "application/x-www-form-urlencoded"
objHTTP.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
JSONString = "{""name"": ""long"",""startDate"": 12345,""endDate"": 67890,""status"": ""in progress""}"
objHTTP.send JSONString
Debug.Print objHTTP.Status
Debug.Print objHTTP.responseText

End Sub

In the immediate window, I received this error:

400  Apache Tomcat/8.0.28 - Error
  reportH1
  {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;}
  H2
  {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;}
  H3
  {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;}
  BODY
  {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;}
  B
  {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P
  {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A
  {color : black;}A.name {color : black;}.line {height: 1px;
  background-color: #525D76; border: none;}
  HTTP Status 400 - Required String parameter 'name' is
  not presenttype Status
  reportmessage Required String parameter 'name' is not
  presentdescription The request sent by the client
  was syntactica lly incorrect.Apache
  Tomcat/8.0.28

I have not known how to solve it, please help me !

A: I solved this problem:

Sub Macro1()
Dim URL As String, JSONString As String, objHTTP As Object
Set objHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")
URL = "xxxxx?name=long&startDate=12345&endDate=67890&status=in progress"
objHTTP.Open "POST", URL, False
objHTTP.setRequestHeader "Content-type", "application/x-www-form-urlencoded"
objHTTP.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"

objHTTP.send
Debug.Print objHTTP.Status
Debug.Print objHTTP.responseText
End Sub


text:
Q: QGIS: Converting a QVariantlist from a GeoJSON to a List with some prefix removed I have some problem seeming to converting a QVariantList from a GeoJSON file to a list in a new shapefile.
Every time I just do the expression "Column" and just put the type of data as List in the Refactor Fields algorithm.
The data vanishes, in other words it becomes completly empty (not even the NULL is Showing).
There is one exception for one pecular column. You see there is a column with a kind of prefix so to remove that prefix from some thing like "Type1:Type1a:Actual value" to "Actual Value" I did this formula.
 CASE WHEN "references"  IS NOT NULL THEN
string_to_array("references" ,':')[2]
ELSE
NULL
END

Problem is it only will keep the first record in the list
I want to have all the values here because the reference column is a link column. There are three columns being in Qvariantlist, only the column references contains a prefix I want to have removed all the rest does not need a prefix removal.

Edit: 5/07/2020:
The Sollution provided by Thomas is putting me in the right direction the formula .
array_to_string("Field",',') does make sure I truly get the data back as a string but even  though I select the data to be a list in my refactor fields I still cannot set as a list in my arribute forms.

Allso to note that the formula that the formula Thomas had provided cause my field to go empty. If I do array_to_string alone it is fine but as soon as I do his, formula to remove the prefix of something like this:
Pipe:AWeVe:P7224741f-fa8f-4503-8b04-4f654ca294f1,Pipe:AWeVe:P8e69091d-cc9c-436a-8357-a3e85eb8495
Or TelecommunicationsCable:InfraDEFRegio5:43565,TelecommunicationsCable:InfraDEFRegio5:4357

To:
P7224741f-fa8f-4503-8b04-4f654ca294f1,P8e69091d-cc9c-436a-8357-a3e85eb8495
    Or
43565,4357

What needs to removed in EACH value is the substring that goes to the second ':' mark.
EDIT 2: Let me be clear here that in the references column in the screenshot that sometimes in that you Columns there is only one value in the list.

A: Normally the following expression should do what you want. We loop to get a first list (coma separated) then within this list we loop and keep only the suffix and we finish by concatenating again the result.
Tried with multiple elements
array_to_string(
  array_foreach(
    string_to_array('Pipe:AWeVe:P7224741f-fa8f-4503-8b04-4f654ca294f1,Pipe:AWeVe:P8e69091d-cc9c-436a-8357-a3e85eb8495', ','),
    string_to_array(@element, ':')[2]
  ),
  ','
)

Tried with one element
array_to_string(
  array_foreach(
    string_to_array('WaterPipe:FARYS_TMVW:WP-019', ','),
    string_to_array(@element, ':')[2]
  ),
  ','
)


text:
Q: Understanding the useState hook behaviour I'm currently in the process of implementing a ripple effect in my application. I'm using the Material UI Button (https://material-ui.com/components/buttons/) as a starting point for this.
During my own implementation I've run into some behaviour I'm unsure about. I've created a corresponding sandbox with a basic example, https://codesandbox.io/s/zealous-cloud-69uvh?file=/src/App.js.
The Container is the Parent Component and the Ripple is the Child Component. The Container has a onMouseUp and onMouseDown handler, which adds and removes the child component respectively.
Below is a small extract of the onMouseDown logic. The rippleCounter variable is a ref object that keeps a count which is used to set the key of the Ripple.
    setRipples((oldRipples) => {
      return [
        ...oldRipples,
        <Ripple
          key={rippleCounter.current}
          timeout={500}
          rippleX={rippleX}
          rippleY={rippleY}
          rippleSize={rippleSize}
        />
      ];
    });
    rippleCounter.current += 1;
  };

I understand that useState is asynchronous, so there is no guarantee that the key set against the Ripple component will be before or after it is incremented. This is where I'm having some difficulties understanding.
Example 2 follows this asynchronous behaviour, as the Ripple component is having its key value set either before or after. This results in the ripple being messed up as the same key is implemented in some cases.
Example 1 doesn't appear to follow this behaviour. The setRipples function is always run in an synchronous fashion, with rippleCounter always being incremented after the setRipples function is run. i.e. Same key is never useed.
Example 1
State being managed and updated before child component is removed.
const Ripple = ({
  in: inProp,
  onExited = () => {},
  timeout,
  rippleSize,
  rippleY,
  rippleX
}) => {
  const [leaving, setLeaving] = useState(false);

  const style = {
    width: rippleSize,
    height: rippleSize,
    top: -(rippleSize / 2) + rippleY,
    left: -(rippleSize / 2) + rippleX
  };

  useLayoutEffect(() => {
    if (!inProp) {
      setLeaving(true);

      const timeoutValue = setTimeout(onExited, timeout);

      return () => {
        clearTimeout(timeoutValue);
      };
    }
  }, [timeout, inProp, onExited]);

  return (

  );
};

Example 2
No state being managed.
const Ripple = ({
  in: inProp,
  onExited = () => {},
  timeout,
  rippleSize,
  rippleY,
  rippleX
}) => {
  // const [leaving, setLeaving] = useState(false);

  const style = {
    width: rippleSize,
    height: rippleSize,
    top: -(rippleSize / 2) + rippleY,
    left: -(rippleSize / 2) + rippleX
  };

  useLayoutEffect(() => {
    if (!inProp) {
      // setLeaving(true);

      const timeoutValue = setTimeout(onExited, timeout);

      return () => {
        clearTimeout(timeoutValue);
      };
    }
  }, [timeout, inProp, onExited]);

  return (

  );
};

Apologies for the poor articulation. If there is additional information I can provide, please let me know.


text:
Q: Phonegap and web api Hello I'm making my first phonegap application and I'm interesting in using a shared database (sql server?) and not the local storage that each platform has and phonegap supports.
I prefer the use of sql server because I used to work with it on my intranet job app. I was wondering if it is possible to use web api over php requests and manipulate my data with it (INSERTS, UPDATES and so on). I also think I should use standart rdbms cus I'm willing to use a daily job on the data.
So, will it be possible to make Web api requests using js on the phonegap app ?
Another question is if there is any way to test my web api proj on my mobile? thus I need to have any free trial web hosting provider (azure? or any cloud service?).

A: of course it possible! And it's amazingly simple. Your web API will handle all the stuff relating to the database (sql request...etc), then from your cordova app you will just have to make a http request on your webservices (using JavaScript) and get the result back in your JS callback in JSON (really easy to parse in JS).
I would suggest you to use an UI framework (suck as senchaTouch, JQueryUI...etc), those frameworks includes a "store" system that make httpRequest and items management really easy and transparent.
Hope I help!

A: There are frameworks like BreezeJS and JayData to abstract your database so you get a client side (javascript) view of your database. This is how it works

*

*Expose your backend database (datacontext/dto context) as a WebAPI (good with BreezeJS) or OData (good with JayData)

*Use the tools provided by these frameworks to generate client side view of your backend data which you can readily use.

Going by this route saves you from

*

*Writing javascript models of your backend data

*Writing js code to handle transportation data

*Plus you get nice query support, bulk data update for conserving network usage on mobile devices, if you need you get offline data as this is mostly required for mobile devices.

In my understanding these frameworks help you reduce your development cost, if your data access is mainly CRUD based. If you need to support more action based interaction, rather than REST, you may still do quite a bit of dev. which again may be less effort then not going for these frameworks.


text:
Q: Generate toString method with ant I have .wsdl files and using wsimport I'm generating classes to use the webservices.
The problem is that I need to add toString method to the generated classes. I saw that it is possible in the xjc but can't find a way to do it in wsimport.
Do you know how to approach this?
At the moment the function looks like that
    <basename property="basename.file" file="${file}" />
    <mkdir dir="/tmp" />
    <exec executable="wsimport">
        <arg value="-catalog" />
        <arg value="jax-ws-catalog.xml" />
        <arg value="-s" />
        <arg value="${src.generated}" />
        <arg value="-keep" />
        <arg value="-d" />
        <arg value="/temp" />
        <arg value="-Xnocompile" />
        <arg value="file://mock_${basename.file}" />
    </exec>

A: As per the link
The CXF XJC toString Plugin provides and XJC plugin that updates the generated beans to implement toString methods to override the default Object.toString method. It uses Apache Commons Lang ToStringBuilder class to build the String, so commons-lang.jar needs to be available on the classpath.
Add the argument -Xts

A: Disclaimer: I am the author of JAXB2-Basics a power package of XJC plugins.
You can use the ToString from JAXB2-Basics for this. It uses a "strategic" approach similar to commons-lang but generates reflection-free code - meaning the generated toString() methods will be pretty fast.
You'll get generated something like:
public String toString() {
    final ToStringStrategy strategy = JAXBToStringStrategy.INSTANCE;
    final StringBuilder buffer = new StringBuilder();
    append(null, buffer, strategy);
    return buffer.toString();
}

public StringBuilder append(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) {
    strategy.appendStart(locator, this, buffer);
    appendFields(locator, buffer, strategy);
    strategy.appendEnd(locator, this, buffer);
    return buffer;
}

public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) {
    {
        USAddress theShipTo;
        theShipTo = this.getShipTo();
        strategy.appendField(locator, this, "shipTo", buffer, theShipTo);
    }
    {
        USAddress theBillTo;
        theBillTo = this.getBillTo();
        strategy.appendField(locator, this, "billTo", buffer, theBillTo);
    }
    // ...
    return buffer;
}

Ant usage is more or les as follows:
<target name="generate-sources">
    <taskdef name="xjc" classname="org.jvnet.jaxb2_commons.xjc.XJC2Task">
        <!-- XJC2 Task classpath -->
        <classpath>
            <fileset dir="${basedir}/lib">
                <include name="activation-*.jar"/>
                <include name="jaxb-api-*.jar"/>
                <include name="jaxb-impl-*.jar"/>
                <include name="jaxb-runtime-*.jar"/>
                <include name="jaxb-core-*.jar"/>
                <include name="jsr173_api-*.jar"/>
                <include name="stax-api-*.jar"/>

                <include name="jaxb-xjc-*.jar"/>
                <include name="jaxb2-basics-ant-*.jar"/>

                <include name="slf4j-*.jar"/>
                <include name="jcl-over-slf4j-*.jar"/>
            </fileset>
        </classpath>
    </taskdef>
    <mkdir dir="${basedir}/target/generated-sources/xjc"/>
    <xjc destdir="${basedir}/target/generated-sources/xjc" extension="true">
        <arg line="
            -Xequals
            -XhashCode
            -Xinheritance
            -XtoString
            -Xcopyable
            -XenumValue"/>
        <binding dir="${basedir}/src/main/resources">
            <include name="**/*.xjb"/>
        </binding>
        <schema dir="${basedir}/src/main/resources">
            <include name="**/*.xsd"/>
        </schema>
        <!-- Plugins -->
        <classpath>
            <fileset dir="${basedir}/lib">
                <include name="jaxb2-basics-plugins-*.jar"/>
            </fileset>
        </classpath>
    </xjc>
</target>

The distribution has a ready-to-run Ant sample (see jaxb2-basics-sample-basic-<VERSION>-ant-src.zip).


text:
Q: How to make the code more readable (for-loop or apply) In my R code I'm using variables mydata1, mydata2, mydata3, …, mydataN that are store results of the function1():
mydata1 <- function1()
mydata2 <- function1()
mydata3 <- function1()
#…
mydataN <- function1()

Variables mydata1, mydata2, mydata3, …, mydataN can be the vectors, matrices or data.frames.
Later I pass variables mydata1, mydata2, mydata3, …, mydataN as input values of the function2() and save results in the new variables newmydata1, newmydata2, …, newmydata1:
newmydata1<- function2(mydata1)
newmydata2<- function2(mydata2)
newmydata3<- function2(mydata3)
#…
newmydataN<- function2(mydataN)

I now the number N before calculation.
Question. How to make the code more functional and readable?
Should I use the for-loop or a function from the apply family?

A: To make this concrete and runnable define the initial list, L0 and functions used as in the Note at the end.
In the following solutions L3, LL, L, out4, out4a and out5 are all identical.
1) Repeated lapply
L1 <- lapply(L0, function1)
L2 <- lapply(L1, function2)
L3 <- lapply(L2, function3)

2) Reduce
FL <- list(function1, function2, function3)
LL <- Reduce(lapply, FL, init = L0)

3) loop FL is as in (2).
L <- L0
for(f in FL) L <- Map(f, L)    # or for(f in FL) L <- lapply(L, f)

4) magrittr
library(magrittr)

L0 %>% lapply(function1) %>% lapply(function2) %>% lapply(function3) -> out4

4a) magrittr variation
library(magrittr)

L0 %>% lapply(. %>% function1 %>% function2 %>% function3) -> out4a

5) functional::Compose
library(functional)

out5 <- Map(Compose(function1, function2, function3), L0)

Note: Input used:
L0 <- as.list(1:4)
function1 <- function(x) x+1
function2 <- function(x) 2*x
function3 <- function(x) x^2


text:
Q: Filtering Exactly Same String Returns 0 I have customer rentals data based on region. I want to filter a specific, I copy region name from data and still returns 0 rows.
Rentals[Rentals$Region == "Paris",]

I can't understand what is the problem and how to solve it.
Thank you.

A: The issue would be in having leading/lagging spaces in strings.  It can be resolved with trimws that removes the white space from both ends (if any).
Rentals[trimws(Rentals$Region) == "Paris",]


text:
Q: create something like a for in swi prolog i want to create something like a for in swi prolog
for(int i=1;i<8;i++)
{
for(int j=1;j<11;j++)
{
//do something with i and j
//finish(i,j) in swi prolog
if any finish is true write a message
}
}

i don't have any ideea how to generate all this permutation i,j in swi prolog please help me.
swi prolog code:
finish :-
        finishL1(i,j),

    write('Game Over, Player1 won!'),nl,
    start.

i want finish do check all finishL1(i,j) permutation like in above for, if any finishL1 is true then write

A: Loops in Prolog are problematic, because variables cannot be reassigned. You could try
forall(between(1,8,I),
   forall(between(1,11,J), (
      % place your code
   )
),

but beware that forall/2 'release' variables when done. Please read the documentation, it's fairly explicative.

A: Another possible solution, taken from the Logtalk standard library:
:- meta_predicate(forto_aux(*, *, *, *, 0)).
forto_aux(Count, First, Last, Increment, Goal) :-
    (   First =< Last ->
        \+ \+ (Count = First, call(Goal)),
        Next is First + Increment,
        forto_aux(Count, Next, Last, Increment, Goal)
    ;   true
    ).

:- meta_predicate(forto(*, *, 0)).
forto(FirstExp, LastExp, Goal) :-
    First is FirstExp,
    Last is LastExp,
    forto_aux(_, First, Last, 1, Goal).

For other loop variations and related predicates, see:
https://github.com/LogtalkDotOrg/logtalk3/blob/master/library/loopp.lgt (interface)
https://github.com/LogtalkDotOrg/logtalk3/blob/master/library/loop.lgt  (implementation)
Some other Prolog compiler, e.g. B-Prolog and ECLiPSe, provide native support for loops. But there isn't an official or de facto standard for these constructs.


text:
Q: Unable to get aspnet core api naming to work I have a client controller that is called "ClientController".  The start of the controller is as follows:
[Route("api/[controller]")]
[AllowAnonymous]
public class ClientController : Controller

The first httpget method works like this - naming etc just a "Get":
    public IActionResult Get()
    {...

..and it does indeed work when I use Postman with a call:
http://localhost:5001/api/Client

However, If I change the name to Index and name it Index like so:
    [HttpGet(Name = "Index")]
    public IActionResult Index()
    {...
        return new OkObjectResult(some object)
    }

and I use Postman again to call it this time explicitly:
    http://localhost:5001/api/Client/Index

I get a 404 status..  - Not found..
I have looked around for some answers on this but its a bit light on for ASPNET Core examples for API and naming conventions..
How do you name an IActionResult API method (via connotations) and call it correctly (eg URL structure)? A little direction on correct convention would be great..

A: Have you tried this
    [HttpGet("Index",Name = "Index")]
    public IActionResult Index()
    {...
        return new OkObjectResult(some object)
    }

More detail is given on this link. Please check it out
https://learn.microsoft.com/en-us/aspnet/core/mvc/controllers/routing