text:
Q: TF 2.2 precision and recall are always returning zeros in training and validation Hello I am trying to train a small model using tf.keras. with tf 2.2.0, i'm using a generator which returns sequences of [5,120,32,64,9] and labels [5,120,1] and I'm importing from tf.keras
from tensorflow.keras.metrics import Recall, Precision, Metric

Additionally I am adding them into the compile and fit section
model.compile(
                loss="mse",
                optimizer=Adam(learning_rate=self.learning_rate),
                metrics=[Recall(), Precision()],
                sample_weight_mode="temporal",
            )

if callbacks is None:
            callbacks = []

model.fit(
            data.training(),
            callbacks=callbacks,
            steps_per_epoch=epoch_size,
            epochs=epochs,
            validation_data=data.training(),
            validation_steps=validation_size,
            verbose=0,
        )

(I'm conscious that I'm using training as training data and validation data. I'm trying to find a bug in my code or in TF since we get strange and strong changes in results in recall and precision w.r.t validation. It never converges and produces extreme changes for example from 0 - 0.8 - 0.2 - 0.9 - 0.4 - 0.8 ...)
Additionally I'm using a generator which yields tuples of inputs and outputs, since that "corrected the problem"
however I'm still having results with precision and recall 0.00000
100/100 [==============================] - 224s 2s/step - loss: 0.0371 - recall: 0.0000e+00 - precision: 0.0000e+00 - val_loss: 0.0331 - val_recall: 0.0000e+00 - val_precision: 0.0000e+00
Does anyone know any other trick to use in tf 2.2 that I can use in order to solve that problem?
a summary of my NN is the following:
Layer (type)                 Output Shape              Param #
=================================================================
input (InputLayer)           [(None, None, 32, 64, 9)] 0
_________________________________________________________________
conv_lst_m2d_1 (ConvLSTM2D)  (None, None, 30, 62, 20)  20960
_________________________________________________________________
time_distributed_MP_1 (TimeD (None, None, 15, 31, 20)  0
_________________________________________________________________
time_distributed_BN_1 (TimeD (None, None, 15, 31, 20)  80
_________________________________________________________________
time_distributed_F (TimeDist (None, None, 9300)        0
_________________________________________________________________
time_distributed_D1 (TimeDis (None, None, 32)          297632
_________________________________________________________________
time_distributed (TimeDistri (None, None, 32)          0
_________________________________________________________________
time_distributed_D2 (TimeDis (None, None, 24)          792
_________________________________________________________________
time_distributed_1 (TimeDist (None, None, 24)          0
_________________________________________________________________
time_distributed_D3 (TimeDis (None, None, 16)          400
_________________________________________________________________
time_distributed_2 (TimeDist (None, None, 16)          0
_________________________________________________________________
output (TimeDistributed)     (None, None, 1)           17
=================================================================

A: This was happening to me and I finally figured out why. My data was ordered. So for example all my negative samples were at the end of the array and all my positive at the beginning.  So when the Neural Network was training at the beginning it would only find negative samples of the class.


text:
Q: cannot login to my imac running 10.4 I have an iMac with OS X 10.4 that I can't login to. Whenever I get to the login page I type my password and it starts to login. The blue and white status bar appears and eventually login but only for a split second. A blank blue screen flashes and then it returns to the login screen. This only occurs with the admin account. Any ideas on how to stop this?

A: Try rebooting in Safe mode by holding Shift as the Mac starts to boot -- this will disable several categories of system add-ons (see Apple's KB #HT1455 and #1564) that're likely suspects with a problem of this sort.  If that works (i.e. lets you log in), look through the various things that were disabled, and experiment with removing them some at a time to isolate what's causing the problem.  Since it's only one account having trouble, things inside the user Library are the most likely suspects.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Select columns in matrix corresponding to rows So I have a large covariance matrix. I want to pick certain rows, and then have it select the correct corresponding column.
For example:
data(data)
data

lng   lat     x1 x2 x3 x4 x5 x6 x7 x8 x9 x10
-97.5 69.5    .5 .8 .9 .1 .5 .3 .2 .4 .6 .2
-101.5 49.5    .5 .8 .9 .1 .5 .3 .2 .4 .6 .2
-98.5 89.5    .5 .8 .9 .1 .5 .3 .2 .4 .6 .2
-97.5 49.5    .5 .8 .9 .1 .5 .3 .2 .4 .6 .2
-107.5 79.5   .5 .8 .9 .1 .5 .3 .2 .4 .6 .2
-92.5 29.5    .5 .8 .9 .1 .5 .3 .2 .4 .6 .2
-97.5 48.5    .5 .8 .9 .1 .5 .3 .2 .4 .6 .2
-91.5 19.5    .5 .8 .9 .1 .5 .3 .2 .4 .6 .2
-97.5 37.5    .5 .8 .9 .1 .5 .3 .2 .4 .6 .2
-80.5 39.5    .5 .8 .9 .1 .5 .3 .2 .4 .6 .2

This is a covariance matrix so x1 = lng -97.5 and lat 69.5 and so on.
Right now I have
section_data <- subset(data, -97.5 <= lng & lng <= -80.5 & 35.5 <= lat & lat <= 49.5)

So that's rows 4,7,8,9,10.
That gives me
 lng   lat     x1 x2 x3 x4 x5 x6 x7 x8 x9 x10
-97.5 49.5    .5 .8 .9 .1 .5 .3 .2 .4 .6 .2
-97.5 48.5    .5 .8 .9 .1 .5 .3 .2 .4 .6 .2
-91.5 19.5    .5 .8 .9 .1 .5 .3 .2 .4 .6 .2
-97.5 37.5    .5 .8 .9 .1 .5 .3 .2 .4 .6 .2
-80.5 39.5    .5 .8 .9 .1 .5 .3 .2 .4 .6 .2

but it doesn't take away the columns that correspond to that. I want it to give me rows 4,7,8,9,10 but only with columns 4,7,8,9,10.
 lng   lat     x4 x7 x8 x9 x10
-97.5 49.5    .1 .2 .4 .6 .2
-97.5 48.5    .1 .2 .4 .6 .2
-91.5 19.5    .1 .2 .4 .6 .2
-97.5 37.5    .1 .2 .4 .6 .2
-80.5 39.5    .1 .2 .4 .6 .2

I searched and searched but I couldn't find any answers to help me with my question.
I would appreciate any help.
Thanks!

A: Indices = with(data,
              which(-97.5 <= lng & lng <= -80.5 & 35.5 <= lat & lat <= 49.5))
Rows = Indices
Columns = Indices + 2
Columns = c(1:2, Columns)
section_data <- data[Rows,Columns]


text:
Q: SoapMessageHandler not invoked in Weblogic I am trying to intercept SOAP message of a JWS webservice using SOAPHandlerJax-ws SoapHandler.
Below is the snapshot of what I have done.

*

*Wrote a class JwsSoapRequestValidationHandler which extends SOAPHandler

*Created HandlerConfig.xml with the below entry:

<jws:handler-chain>
    <jws:handler>
        <jws:handler-name>SoapRequestValidator</jws:handler-name>
        <jws:handler-class>com.service.ws.jws.JwsSoapRequestValidationHandler</jws:handler-class>
    </jws:handler>
</jws:handler-chain>

*

*I have placed the xml in the same folder as my webservice.

*I have annotated my webservice with @HandlerChain(file = "HandlerConfig.xml")

But strangly anf frustratingly, my handler is not invoked. I have deployed my war file in Weblogic 10.3.2
Please help me resolve this issue. I have spent 2 days without any result.......
Thanks a lot for your help.

A: At last, I got the solution to this problem. We need to make sure that the HandlerConfig.xml file is present in the generated artifact as well.
As soon as I included the xml in my war file, it started invoking the handler. So easy at the end :) ...
Thanks to all. Hope this will be helpful to others.


text:
Q: Clarification for locating .RDS OAuth tokens generated by `gargle` package Not strictly an RStudio question but the relevant packages are maintained by this community I think.
Apologies for not providing a working example of the problem. The question pertains to use within a container, and I am not sure if an example will provide clarity. :|
I am reading this about non-interactive authentication to google, for googlesheets/googledrive (either will do).
https://cran.r-project.org/web/packages/gargle/vignettes/non-interactive-auth.html
I am confused by the following:

If you know the filepath to the token you want to use, you could use readRDS() to read it and provide as the token argument to the wrapper's auth function.
How would you know this filepath? That requires some attention to the location of gargle's OAuth token cache folder, which is described in the next section.

I can't find a clear description in this or the linked documents of where to find the .RDS file.
My use-case is to read or download a googlesheet (via googlesheets or googledrive packages) within a docker package.
I was previously doing this just fine with the old token setup, before google made the changes their side.
Also I have no problem running non-interactively within a scrip on my machine, using httr::oauth_app and drive_auth_configure, then drive_auth as described in the above link.
I am just not clear as to how I can locate the .RDS file from the above documentation.
If you could give a brief description, or if you were so kind as to provide a link to other documents, or sections of the above that I have overlooked or misunderstood I would be very grateful.
Thank you!
Simon


text:
Q: Split an existing react application to ship only a selected part of features I have a react application which is capable to create and manage 4 different type of config files.
Each with their on set of keys and possible values.
in my App.jsx I have a custom layout component with header, side navigation, footer and a <Switch> defined from react-router-dom with different Routes to the corresponding overview and editor pages for the different config files. As well as some routes to more general pages like /home or /404. The <Switch> defines which content gets rendered in the body of the layout component.
A potential client wants to use the application but needs only to manage 2 config files of the 4 available.
I'm looking for an elegant way to introduce some sort of properties file into the application in which I can configure which sites are available and which are not.
I want to avoid copying the existing codebase and deleting everything I don't need for the client, resulting in me being forced to apply bugfixes or patches on two repos/codebases.
One approach would be to introduce conditional rendering to the different navigation links and introduce a custom hook which redirects to /404 when trying to access a disabled site. But I feel this approach can get messy quick and scales bad.
I'm looking for guides, tutorials, experiences or ideas on how to split up and ship parts of an existing react application.
Thanks in advance :)
If this is not the right place to ask, please redirect me in the right direction


text:
Q: Regex Match All Unless? Assuming I want:
TESTGRID - NOT MATCH
testgrid - NOT MATCH
ACTIVEID - MATCH
activeID - MATCH
testRID - MATCH

I've tried:
(?!([^GR]))ID*?\b (I really thought I had it with this one - Don't match ID if it is preceeded with GR, right?
(?!([^GRID]))ID*?\b
(?!([GRID]))ID*?\b

None of which is working.
I swear I'm getting better with regex, though :)  I've managed to knock out the last 6 attempts without seeking help from SO, but I'm once again stuck :(

A:
Don't match ID if it is preceeded with GR

If you mean to match ID that is at the end of the word, and is not preceded with GR, use
(?<!GR)ID\b

See this regex demo
Note that (?<!GR) is a negative lookbehind that fails the match if the lookbehind pattern finds a match to the left of the current position in the string. If you use [^GR], a negated character class, then only one single symbol/character is checked for (a character other than G and R), not a character sequence.


text:
Q: point condition to be remove If I 'm using GPS and adding some Over lay items in the map and i want to play a game when ever my current location is == to the over lay item then remove this item the problem is due to the gps inaccuracy i want to make a margin error around the over lay item so what i did is
Since the P is the geo point of the overlay item
enter code here
   int error =10 ;
if (loc.getLatitude() * 1E6>=p.getLatitudeE6()-error&&loc.getLongitude() * 1E6 < p.getLatitudeE6()+error)
 mapView.getOverlays().remove(itemizedOverlay);
  mapView.invalidate();

so the question now is this if condition is true or what ??

A: Use LocationManager.addProximityAlert(double latitude, double longitude, float radius, long expiration, PendingIntent intent).  The radius will be the distance you are to the POI.


text:
Q: How to properly upgrade npm on debian when installed with apt I have issue with jessie and npm.
I have installed package nodejs with sudo apt-get install nodejs, so it installed npm automatically.
I then want to install latest of npm using npm i -g npm@latest, which work fine except the apt npm version is conflicting.
I want to remove the conflicting apt installed version, or to know the official way to update npm, if installed from apt.
I am only able to update node using npm i -g n  then n stable but it is impossible for me to upgrade npm

A: npm is distributed with Node.js- which means that when you download Node.js, you automatically get npm installed on your computer.
A quote from The npm Blog

The best way to install npm is to install node using the node.js installer. npm is installed as part of node.

It's over at nodejs.org. It will give you a recent, working version of npm with all the paths in the expected places. This is the version that npm Inc and the Node.js project both support.
Once you've installed Node.js, you can make sure you've got the very most recent version of npm using npm itself by running this:
npm install npm -g

If you have issues, do not use sudo, read in documentation fixing npm permissions carefully and configure npm properly.


text:
Q: Get programmatically driver name of an interface Is there a way  programmatically driver name of interface, except of parsing output of "ethtool -i interface_name"?
I would happy if it can be retrieved from a file.

A: You can query sysfs for it. Read the target of the /sys/class/net/$interface/device/driver symlink and take the part after the last /.
Example:
$ stat --format '%N' /sys/class/net/*/device/driver
'/sys/class/net/eth0/device/driver' -> '../../../../bus/pci/drivers/jme'
'/sys/class/net/wlan0/device/driver' -> '../../../../bus/pci/drivers/iwlagn'


text:
Q: android:elevation для api <21 или Как сделать тень у элементов RecyclerView? Есть RecyclerView с такими элементами:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"

android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/competition_card_shadow">

<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginBottom="2dp">

    <LinearLayout
        android:id="@+id/positionLV"
        android:layout_width="60dp"
        android:layout_height="0dp"
        android:background="@drawable/rounded_card_left"
        android:orientation="vertical"
        android:gravity="center"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <TextView
            android:id="@+id/speciality_points"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:padding="2dp"
            android:textAlignment="center"
            android:textSize="20sp"
            android:textColor="@color/colorOrange"
            tools:text="1"/>
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:visibility="visible"
            android:textSize="12sp"
            android:textColor="@color/colorOrange"
            android:text="@string/place"/>

    </LinearLayout>

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:background="@drawable/rounded_card_right"
        android:orientation="vertical"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toEndOf="@+id/positionLV"
        app:layout_constraintTop_toTopOf="parent">

        <TextView
            android:id="@+id/speciality_title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingStart="4dp"
            android:paddingEnd="4dp"
            android:textSize="18sp"
            android:textColor="@color/colorWhite"
            tools:text="Геодезия" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:padding="2dp"
            android:orientation="horizontal">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/speciality_plan"
                android:layout_gravity="center"
                android:layout_margin="2dp"
                android:paddingStart="4dp"
                android:paddingEnd="4dp"
                android:textColor="@color/colorWhite"
                android:background="@drawable/rounded_tag_green"
                tools:text="Топ-30"/>

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/speciality_status"
                android:layout_gravity="center"
                android:layout_margin="2dp"
                android:paddingStart="4dp"
                android:paddingEnd="4dp"
                android:textColor="@color/colorGreyDark"
                android:background="@drawable/rounded_orange_text_view_corners"
                tools:text="Зачислен"/>

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/speciality_order"
                android:layout_gravity="center"
                android:layout_margin="2dp"
                android:paddingStart="4dp"
                android:paddingEnd="4dp"
                android:background="@drawable/rounded_order_text_view"
                android:textColor="@color/colorBlack"
                android:visibility="gone"
                tools:text="ПРИКАЗ"/>

        </LinearLayout>

    </LinearLayout>

</android.support.constraint.ConstraintLayout>

competition_card_shadow.xml
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="rectangle">
            <solid android:color="@color/colorBlackTransparent"/>
            <corners android:radius="10dp" />
        </shape>
    </item>

    <item
        android:left="0dp"
        android:right="0dp"
        android:top="0dp"
        android:bottom="2dp">
        <shape android:shape="rectangle">
            <solid android:color="@android:color/white"/>
            <corners android:radius="10dp" />
        </shape>
    </item>
</layer-list>

Выглядит это так:

Тень при помощи цвета смотрится убого. При том, что хочется сделать тень вокруг всей вьюхи, а при помощи цвета это будет смотреться как обводка.
ViewCompat.setElevation() не работает (в качестве вьюхи передавал linearLayout).
Нарисовать градиентом - градиент нужен специфичной формы, на данный момент я не смог придумать градиент такой формы, чтобы тень нормально смотрелась.
Буду благодарен всем, кто обратит внимание на проблему.
РЕШЕНИЕ:
Благодаря добрейшим и уважаемым людям в комментариях, проблема решилась так:

*

*Корневой LinearLayout теперь CardView из библиотеки
com.android.support:cardview-v7.

*Добавлены атрибуты
app:cardElevation="@dimen/cardview_default_elevation" и
app:cardCornerRadius="10dp"


text:
Q: How can I get task-specific properties from a MailItem I've been having a little weekend project for myselff which involves getting all my ToDo tasks from Outlook, put them in a DataGridView and me being able to edit and export them.
The only problem I've been running into is me being unable to get the task specific properties for flagged emails while they still exist, I just don't see any way to access them.
Here is a portion of my current code.
private void retrieveTasks()
    {

        //Clear datagrid so we won't have duplicate information
        taskList.Rows.Clear();

        //Define some properties so we can use these to retrieve the tasks
        Outlook.Application app = null;
        _NameSpace ns = null;
        Store outlookStore = null;
        Outlook.MAPIFolder taskFolder = null;
        Outlook.MAPIFolder specialFolder = null;
        TaskItem task = null;
        DateTime nonDate = new DateTime(4501, 1, 1);

        try
        {
            //Connect to Outlook via MAPI
            app = new Outlook.Application();
            ns = app.GetNamespace("MAPI");
            ns.Logon(null, null, false, false);

            /*
            outlookStore = ns.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox).Store;
            taskFolder = outlookStore.GetSpecialFolder(Microsoft.Office.Interop.Outlook.OlSpecialFolders.olSpecialFolderAllTasks);
            */

            //Get the taskfolder containing the Outlook tasks
            //taskFolder = ns.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderTasks);
            outlookStore = ns.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox).Store;
            taskFolder = outlookStore.GetSpecialFolder(OlSpecialFolders.olSpecialFolderAllTasks);
            //Console.WriteLine(specialFolder.Items[1].Subject.ToString());

            /*for (int i = 1; i <= specialFolder.Items.Count; i++)
            {
                //task = (Outlook.TaskItem)specialFolder.Items[i];
                Console.WriteLine(specialFolder.Items[i].ToString());
            }*/

            for (int i = 1; i <= taskFolder.Items.Count; i++)
            {
                //Get task from taskfolder
                Object item = taskFolder.Items[i];
                if (item is Outlook.MailItem)
                {
                    MailItem mail = (Outlook.MailItem)item;
                    if (mail.TaskCompletedDate.Equals(nonDate))
                    {
                        string percentComplete = "";
                        string taskPrio = "";
                        if (mail.UserProperties.Find("Prio") == null)
                        {
                            taskPrio = "";
                        }
                        else
                        {
                            taskPrio = mail.UserProperties.Find("Prio").Value.ToString();
                        }

                        //mail.UserProperties.

                        if (mail.UserProperties.Find("% Complete") == null)
                        {
                            percentComplete = "";
                        }
                        else
                        {
                            percentComplete = mail.UserProperties.Find("% Complete").Value.ToString();
                        }

                        //Add the tasks details to the datagrid
                        taskList.Rows.Add(
                            i.ToString(),
                            checkForNull(mail.Subject),
                            parseDate(mail.TaskStartDate.ToString()),
                            parseDate(mail.TaskDueDate.ToString()),
                            percentComplete, "Taak voltooid",
                            //statusToFriendlyName(mail.Status.ToString()),
                            taskPrio
                        );
                    }
                }
                else if (item is Outlook.TaskItem)
                {
                    task = (Outlook.TaskItem)item;
                    Console.WriteLine(task.Subject);
                    if (task.Complete == false)
                    {
                        string taskPrio = "";

                        //Make sure custom task property is failed or set it to empty text to prevent crashes
                        if (task.UserProperties.Find("Prio") == null)
                        {
                            taskPrio = "";
                        }
                        else
                        {
                            taskPrio = task.UserProperties.Find("Prio").Value.ToString();
                        }

                        //Add the tasks details to the datagrid
                        taskList.Rows.Add(
                            i.ToString(),
                            task.Subject.ToString(),
                            parseDate(task.StartDate.ToString()),
                            parseDate(task.DueDate.ToString()),
                            task.PercentComplete.ToString(),
                            statusToFriendlyName(task.Status.ToString()),
                            taskPrio
                        );
                    }
                }

            }
        }
        catch (System.Runtime.InteropServices.COMException ex)
        {
            MessageBox.Show(ex.ToString());
        }
        finally
        {
            //Release Outlook sources
            ns = null;
            app = null;
        }
    }

So specifically I am looking for the "% complete" property and the status property, everything else I am able to work around on.
It would make my life SO MUCH EASIER if I can get this to work :)
Hope to hear from anyone on here!
Jeffrey

A: Do you mean you need to retrieve the task specific properties from a MailItem object (as opposed to the TaskItem object)?
Take a look at the message with OutlookSpy (I am its author) - click IMessage button, look at the MAPI properties in the GetProps tab. Any property can be accessed using MailItem.PropertyAccessor.GetProperty. The DASL name to be used by GetProperty is displayed by OutlookSpy (select the property in the IMessage window, see the DASL edit box).


text:
Q: How to simulate SVG `pointer-events: bounding-box` in Firefox & Safari I have an SVG with nested SVGs inside of it that are wrapped inside various <a> tags. I would like the entire nested SVG to activate the link (i.e. be clickable), but it seems I cannot use the CSS property pointer-events: bounding-box as that value isn't supported by Safari & Firefox. (This works great in Chrome, however).
What other approach could I use to simulate this behavior in these browsers?

A: Cover each SVG with a transparent <rect> and wrap that with the link element.

<svg width="300" height="200">

  <a xlink:href="http://www.google.com">
    <svg x="50" y="50" width="200" height="100">
      <ellipse cx="100" cy="50" rx="100" ry="50" fill="red"/>
    </svg>
  </a>

</svg>

<svg width="300" height="200">

  <svg x="50" y="50" width="200" height="100">
    <ellipse cx="100" cy="50" rx="100" ry="50" fill="green"/>
  </svg>
  <a xlink:href="http://www.google.com">
    <rect x="50" y="50" width="200" height="100" fill="transparent"/>
  </a>

</svg>


text:
Q: Kotlin with Android DataBinding in Android Studio 3.0 canary 2 my project have 2 modules which are app and apphelper as a library. I have been trying to use kotlin with android Databinding with it but I can't figure it out why it keep showing me these errors when I built project:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:stagingRuntimeClasspath'.
   > Unable to find a matching configuration in project :apphelper:
       - Configuration 'debugApiElements':
           - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'AndroidTypeAttr{name=Aar}' and found compatible value 'AndroidTypeAttr{name=Aar}'.
           - Required com.android.build.gradle.internal.dependency.BuildTypeAttr 'BuildTypeAttr{name=staging}' and found incompatible value 'BuildTypeAttr{name=debug}'.
           - Found com.android.build.gradle.internal.dependency.VariantAttr 'VariantAttr{name=debug}' but wasn't required.
           - Required org.gradle.api.attributes.Usage 'for runtime' and found incompatible value 'for compile'.
       - Configuration 'debugRuntimeElements':
           - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'AndroidTypeAttr{name=Aar}' and found compatible value 'AndroidTypeAttr{name=Aar}'.
           - Required com.android.build.gradle.internal.dependency.BuildTypeAttr 'BuildTypeAttr{name=staging}' and found incompatible value 'BuildTypeAttr{name=debug}'.
           - Found com.android.build.gradle.internal.dependency.VariantAttr 'VariantAttr{name=debug}' but wasn't required.
           - Required org.gradle.api.attributes.Usage 'for runtime' and found compatible value 'for runtime'.
       - Configuration 'releaseApiElements':
           - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'AndroidTypeAttr{name=Aar}' and found compatible value 'AndroidTypeAttr{name=Aar}'.
           - Required com.android.build.gradle.internal.dependency.BuildTypeAttr 'BuildTypeAttr{name=staging}' and found incompatible value 'BuildTypeAttr{name=release}'.
           - Found com.android.build.gradle.internal.dependency.VariantAttr 'VariantAttr{name=release}' but wasn't required.
           - Required org.gradle.api.attributes.Usage 'for runtime' and found incompatible value 'for compile'.
       - Configuration 'releaseRuntimeElements':
           - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'AndroidTypeAttr{name=Aar}' and found compatible value 'AndroidTypeAttr{name=Aar}'.
           - Required com.android.build.gradle.internal.dependency.BuildTypeAttr 'BuildTypeAttr{name=staging}' and found incompatible value 'BuildTypeAttr{name=release}'.
           - Found com.android.build.gradle.internal.dependency.VariantAttr 'VariantAttr{name=release}' but wasn't required.
           - Required org.gradle.api.attributes.Usage 'for runtime' and found compatible value 'for runtime'.

The error log above is shown when I simply click on the build button and it is weirder if I click run button to install an app to a device which is like:
:app:transformDexArchiveWithDexMergerForDebug
AGPBI: {"kind":"error","text":"Error converting bytecode to dex:\nCause: com.android.dex.DexException: Multiple dex files define Lorg/intellij/lang/annotations/PrintFormatPattern;","sources":[{}],"original":"UNEXPECTED TOP-LEVEL EXCEPTION:\ncom.android.dex.DexException: Multiple dex files define Lorg/intellij/lang/annotations/PrintFormatPattern;\n","tool":"Dex"}
AGPBI: {"kind":"error","text":"com.android.dex.DexException: Multiple dex files define Lorg/intellij/lang/annotations/PrintFormatPattern;","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:608)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:563)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:545)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:167)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat com.android.dx.merge.DexMerger.merge(DexMerger.java:194)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat com.android.builder.dexing.DexArchiveMergerCallable.mergeDexes(DexArchiveMergerCallable.java:66)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat com.android.builder.dexing.DexArchiveMergerCallable.call(DexArchiveMergerCallable.java:54)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat com.android.builder.dexing.DexArchiveMergerCallable.call(DexArchiveMergerCallable.java:37)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1424)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)","sources":[{}]}

 FAILED
:app:buildInfoGeneratorDebug

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformDexArchiveWithDexMergerForDebug'.
> com.android.build.api.transform.TransformException: com.android.dex.DexException: Multiple dex files define Lorg/intellij/lang/annotations/PrintFormatPattern;

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED in 4s
74 actionable tasks: 7 executed, 67 avoided (91%)

I downgrade kotlin version to be '1.1.2-2' to avoid the error and also added 'kotlin.incremental=false' to local.properties
Here are all my build.gradle files:
app Module:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: 'test-environment.gradle'
apply plugin: 'io.fabric'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'

repositories {
    maven { url 'https://maven.fabric.io/public' }
    maven { url "https://jitpack.io" }
    mavenCentral()
}

allprojects {
    repositories {
        jcenter()
        mavenCentral()
        maven { url 'https://maven.fabric.io/public' }

    }
}

android {
    compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
    buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
    defaultConfig {
        applicationId "com.myapp.android"
        minSdkVersion Integer.parseInt(project.ANDROID_BUILD_MIN_SDK_VERSION)
        targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
        versionCode 1
        versionName "1.0"
    }

    dataBinding {
        enabled = true
    }

    dexOptions {
        jumboMode = true
    }

    if (System.getenv("CIRCLE")) {
        defaultConfig {
            versionCode Integer.parseInt(System.getenv("CIRCLE_BUILD_NUM"))
            versionName "1.0." + System.getenv("CIRCLE_BUILD_NUM")
        }
    } else {
        defaultConfig {
            versionCode 1
            versionName "1.0"
        }
    }

    signingConfigs {
        debug {
            storeFile file("../myappdebug.keystore")
            storePassword "myapprocks"
            keyAlias "myapp"
            keyPassword "myapprocks"
        }
        staging {
            storeFile file("../myapp_staging.keystore")
            storePassword "myapprocks"
            keyAlias "myapp"
            keyPassword "myapprocks"
        }

        release {
            storeFile rootProject.file('myapp.keystore')
            storePassword System.getenv("KEYSTORE_PASS")
            keyAlias System.getenv("ALIAS_NAME")
            keyPassword System.getenv("ALIAS_PASS")
        }
    }

    buildTypes {
        debug {
            ext.betaDistributionNotifications = false
            signingConfig signingConfigs.debug
            applicationIdSuffix ".dev"
            minifyEnabled false
            shrinkResources false
            proguardFile 'proguard-release.cfg'
            testProguardFile 'proguard-release.cfg'
            manifestPlaceholders = [providerSuffix: ".dev"]
        }
        staging {
            ext.betaDistributionEmailsFilePath = "staging_distribution_emails.txt"
            ext.betaDistributionReleaseNotesFilePath = "release_notes.txt"
            signingConfig signingConfigs.staging
            applicationIdSuffix ".staging"
            shrinkResources true
            minifyEnabled true
            proguardFile 'proguard-release.cfg'
            manifestPlaceholders = [providerSuffix: ".staging"]

        }

        release {
            signingConfig signingConfigs.release
            shrinkResources true
            minifyEnabled true
            proguardFile 'proguard-release.cfg'

        }
    }
}

kapt {
    generateStubs = true
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    api project(':apphelper')
    compile 'com.android.support:appcompat-v7:' + project.ANDROID_SUPPORT_LIBRARY_VERSION
    compile 'com.android.support:cardview-v7:' + project.ANDROID_SUPPORT_LIBRARY_VERSION
    compile 'com.android.support:design:' + project.ANDROID_SUPPORT_LIBRARY_VERSION
    compile 'com.android.support:support-v13:' + project.ANDROID_SUPPORT_LIBRARY_VERSION
    compile 'hanks.xyz:smallbang-library:0.1.2'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'com.facebook.device.yearclass:yearclass:1.0.1'
    compile 'com.facebook.android:facebook-android-sdk:4.+'
    compile group: 'com.google.code.gson', name: 'gson', version: '2.7'
    compile('com.crashlytics.sdk.android:crashlytics:2.6.2@aar') {
        transitive = true
    }
    compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    compile "android.arch.lifecycle:runtime:" + project.ANDROID_ARCH_VERSION
    compile "android.arch.lifecycle:extensions:" + project.ANDROID_ARCH_VERSION
    annotationProcessor "android.arch.lifecycle:compiler:" + project.ANDROID_ARCH_VERSION
    compile "android.arch.persistence.room:runtime:" + project.ANDROID_ARCH_VERSION
    annotationProcessor "android.arch.persistence.room:compiler:" + project.ANDROID_ARCH_VERSION
    kapt "com.android.databinding:compiler:$android_plugin_version"

}

library module:
apply plugin: 'com.android.library'

apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'

android {
    compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
    buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION

    defaultConfig {
        minSdkVersion Integer.parseInt(project.ANDROID_BUILD_MIN_SDK_VERSION)
        targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
        exclude 'META-INF/maven/com.squareup.okio/okio/pom.properties'
        exclude 'META-INF/maven/com.squareup.okio/okio/pom.xml'
        exclude 'META-INF/maven/com.squareup.retrofit/retrofit/pom.xml'
        exclude 'META-INF/maven/com.squareup.retrofit/retrofit/pom.properties'
    }
}

kapt {
    generateStubs = true
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.code.gson:gson:2.6.2'
    compile 'com.squareup.retrofit2:retrofit:2.1.0'
    compile group: 'com.squareup.retrofit2', name: 'converter-gson', version: '2.1.0'
    compile group: 'com.squareup.okhttp3', name: 'logging-interceptor', version: '3.4.1'
    compile 'org.jetbrains:annotations-java5:15.0'
    compile 'hanks.xyz:smallbang-library:0.1.2'
    compile 'com.android.support:support-annotations:' + project.ANDROID_SUPPORT_LIBRARY_VERSION
    compile 'com.android.support:support-v13:' + project.ANDROID_SUPPORT_LIBRARY_VERSION
    compile 'com.android.support:appcompat-v7:' + project.ANDROID_SUPPORT_LIBRARY_VERSION
    compile 'com.android.support:design:' + project.ANDROID_SUPPORT_LIBRARY_VERSION
    compile 'com.android.support:customtabs:' + project.ANDROID_SUPPORT_LIBRARY_VERSION
    compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"

    compile 'com.github.bumptech.glide:glide:3.7.0'
}

repositories {
    mavenCentral()
}

main gradle build script:
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext.kotlin_version = '1.1.2-2'
    ext.android_plugin_version = '3.0.0-alpha2'

    repositories {
        jcenter()
        maven { url 'https://maven.google.com' }
        maven { url 'https://maven.fabric.io/public' }

    }
    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
        classpath "com.android.tools.build:gradle:$android_plugin_version"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        maven { url 'https://maven.google.com' }
        mavenCentral()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Anyone has same problems as mine please share the solution.
Thanks.

A: Remove:
kapt {
    generateStubs = true
}

and add to dependencies:
kapt "com.android.databinding:compiler:$android_plugin_version"

A: It works just for now, I just downgrade com.android.tools.build:gradle to 2.3.2, change the distributionUrl to be https://services.gradle.org/distributions/gradle-3.3-all.zip and use the stable Android Studio (2.3.2). This problem should be wipe out when the Android Studio 3.0 stable is released.

A: I think, that correct sollution is wait for Google fix it: https://issuetracker.google.com/issues/62170415
or for now use workaround as I described here:
https://stackoverflow.com/a/44346259/4024146


text:
Q: Firebase updating single field I already have a large JSON file which I will be uploading to firebase. Sample format is
{
  "ImpList": [
    {
      "email": "NA",
      "name": "NA"
    },

    {
      "email": "NA1",
      "name": "NA1"
    }

  ]
}

For testing purpose, I have uploaded this to firebase and my structure looks like

Now I need to update the value of email "email1" to "email2". I am able to successfully fetch the data and display it in the sample app. I am not using any firebase auth so basically anybody can update the content. I have seen this example Firebase updating value for a field in a child but in my case, I do not have any key.

A: Try do this:
FirebaseDatabase database = FirebaseDatabase.getInstance();
    DatabaseReference myRef = database.getReference("teste-2df21").child("ImpList").child("Implist").child("0").child("email");

        myRef.setValue("email2").addOnSuccessListener(new OnSuccessListener<Void>() {

            @Override
            public void onSuccess(Void aVoid) {

            }

        }).addOnFailureListener(new OnFailureListener() {
            @Override
            public void onFailure(@NonNull Exception e) {

            }
        });


text:
Q: How to get the returned value of rpc query in odoo12 Hi im having trouble in getting the returned value in the rpc query in the .then() function
here's my code

initialize_qr_code:function(){
            return rpc.query({
                    model: "pos.order",
                    method: "generated_qr_order",
                    args: ["Order 00001-023-0017"],
                }).then(function (qr_val) {
                    return qr_val;
                });
        },

I print the output of the initialize_qr_code() function like this console.log(this.pos.get_order().initialize_qr_code()) in my console here's what i always get
{state: ƒ, always: ƒ, then: ƒ, promise: ƒ, pipe: ƒ, …}
but when i console.log(qr_val) in the .then() function i get the correct output
is there something wrong in my code?

A: You get that log because you returned a resolved promise object.
You can initialize qr_val in PosModel or use the code you wrote to call generated_qr_order function and use qr_val when it is available.

A: You can store qr_val in you object variable, and then use it afterwards.
initialize_qr_code:function(){
            var self = this;
            return rpc.query({
                    model: "pos.order",
                    method: "generated_qr_order",
                    args: ["Order 00001-023-0017"],
                }).then(function (qr_val) {
                    self.qr_val = qr_val;
                });
        },


text:
Q: Django: Python path syntax to my custom validators.py? I want to implement the solution detailed in this thread but I can't for the life of me figure out the Python path syntax in settings.py needed to link back to my custom validators.py I'm not even sure where to put it. I feel like a simple explanation of how the Python path syntax works in Django ought to be in the docs but after almost 20 minutes of looking through them I don't see anything. Any help would be greatly appreciated.

A: I'm assuming your custom validators.py is within your project, so like any of your other Python project's module it is accessed using dot notation.
The only thing "different" here is that you append the actual class name to this module string. For example:
AUTH_PASSWORD_VALIDATORS = [
    'yourproject.validators.YourValidatorClass',
]

(although the format is not specified in this specific setting in the docs, it is a constant pattern used throughout Django settings)


text:
Q: How can I simulate keystrokes in a Google Script App? I need to simulate a keyboard in Google Script Apps (like SendKeys in C#).
For example, Alt+Tab, Alt+F1, or any other shortcut or button.
Is there any function or library for this in Google Script Apps?  If not, what external library could I use?


text:
Q: How to add background to Rechart component? I am planning to build a ToDo list inspired by the Eisenhower Matrix using React and Recharts ScatterCharts.
The user can set both the importance and urgency on a scale from 0 to 100. To visualize it better, it would be good to have four quadrant in different colors (see screenshot).

I'm thinking to use a SVG as background image, but can't find how to add it to Recharts.

I've already found how to hide the y-axis using <YAxis dataKey="y" domain={[0, 100]} axisLine={false} tick={false} />, but unfortunately the chart itself stays with the same dimensions (so it's difficult to center the background SVG).
One more questions: Is there any possibility to add two labels on both the x- and y-axis to visually create the four quadrants?


text:
Q: Why FLOAT != FLOAT $a     = 100;
$b     = 3;
$test1 = $a/ $b;
$test2 = 33.333333333333;  // $test2 == $test1

var_dump(($test1 * $b));   // float(100)
var_dump(($test2 * $b));   // float(99.999999999999)

Any explanation for that ?

A: 100/3 results in 33.3-repeating.
There is no decimal point value that will ever show it. In maths, such a number is normally shown by a little dot over the repeating value. (though I have no idea how to show that in this code box).
Refer to this wiki article to see how they are represented in various places and a much more detailed explanation that I have given here.
However, from the article here is a snippet of the summary:

In arithmetic, repeating decimal is a way of representing a rational number. Thus, a decimal representation of a number is called a repeating decimal (or recurring decimal) if at some point it becomes periodic, that is, if there is some finite sequence of digits that is repeated indefinitely. For example, the decimal representation of 1/3 = 0.3333333… or 0.3 (spoken as "0.3 repeating", or "0.3 recurring") becomes periodic just after the decimal point, repeating the single-digit sequence "3" infinitely. A somewhat more complicated example is 3227/555 = 5.8144144144…, where the decimal representation becomes periodic at the second digit after the decimal point, repeating the sequence of digits "144" indefinitely.

Now, that's the crux of your issue here, but also keep in mind (as the other two answers point out) that floats are amazingly innacurate in terms of calculations and comparisons. A quick search of this site will reveal a small army of people that have had problems with the internal representations of floats - mainly which resulted in unexpected behavior when doing comparisons.
Take a long read of the PHP warning on the float data type - again I have copied the important bit here:

Additionally, rational numbers that are exactly representable as floating point numbers in base 10, like 0.1 or 0.7, do not have an exact representation as floating point numbers in base 2, which is used internally, no matter the size of the mantissa. Hence, they cannot be converted into their internal binary counterparts without a small loss of precision. This can lead to confusing results: for example, floor((0.1+0.7)*10) will usually return 7 instead of the expected 8, since the internal representation will be something like 7.9999999999999991118....

A: Not all floats can be represented exactly by processor. $a/$b is one of them.
So, $test1 != $test2 is true.

A: Information from PHP

Warning
Floating point precision
Floating point numbers have limited precision. Although it depends on
  the system, PHP typically uses the IEEE 754 double precision format,
  which will give a maximum relative error due to rounding in the order
  of 1.11e-16. Non elementary arithmetic operations may give larger
  errors, and, of course, error propagation must be considered when
  several operations are compounded.
Additionally, rational numbers that are exactly representable as
  floating point numbers in base 10, like 0.1 or 0.7, do not have an
  exact representation as floating point numbers in base 2, which is
  used internally, no matter the size of the mantissa. Hence, they
  cannot be converted into their internal binary counterparts without a
  small loss of precision. This can lead to confusing results: for
  example, floor((0.1+0.7)*10) will usually return 7 instead of the
  expected 8, since the internal representation will be something like
  7.9999999999999991118....
So never trust floating number results to the last digit, and do not
  compare floating point numbers directly for equality. If higher
  precision is necessary, the arbitrary precision math functions and gmp
  functions are available.

As noted in the warning above, testing floating point values for equality is problematic, due to the way that they are represented internally. However, there are ways to make comparisons of floating point values that work around these limitations.
To test floating point values for equality, an upper bound on the relative error due to rounding is used. This value is known as the machine epsilon, or unit roundoff, and is the smallest acceptable difference in calculations.
Many thanks to all who took the time to answer my question


text:
Q: Installing window service on Windows 2003 Can't find Service.InstallState file I am deploying a windows service which was packaged with the installer (.msi and .exe files).
Everything worked on my VM, which is installed with Windows 2003 OS. But when I went to deploy on the real server, I got the following message (when I doubled-clicked on the msi file and following the installer walk through)
Could not find file
C:\Program Files\ProgramNameFolder\ServiceSetup\Service.InstallState

Not sure why the InstallState file did not get copied to the folder. I only see the Service.exe file.
Any help is greatly appreciated.


text:
Q: Generalizing UI element relationships in a single iOS view I am creating a calculator view that uses sliders to set textbox values. Each textbox has a slider that corresponds to it. The code for updating textbox values is as follows:
- (void) updateAlphaTextField:(id)sender
{
    int value = [alphaSlider value];

    NSString *stringValue = [NSString stringWithFormat:@"%d",value];

    [alphaTextField setText:stringValue];
}

However I have about 20 textboxes (and 20 corresponding sliders) that I would like to demonstrate this behavior and I don't want to write 20 of these update functions.
Is there a function that I can write that could watch all the sliders and update a corresponding textbox with the right value? If so, how do I make my IB connections to get it to work? (The above function required 1 IB connection to be made)
Or even better is there a Cocoa Touch function that would allow me to do this easily?

A: Put tags in your UITextFields and UISliders. For instance: UITextField 1, would have tag 1 and the UISlider 1, would also have tag 1. Then, create an IBOutlet collection with all your UITextFields. You can use this to help you out:
http://www.bobmccune.com/2011/01/31/using-ios-4s-iboutletcollection/
In your function do this:
- (void) updateAlphaTextField:(id)sender
{
    int value = [alphaSlider value];

    NSString *stringValue = [NSString stringWithFormat:@"%d",value];

    UISlider *senderSlider = (UISlider*)sender;

    for(UITextField *textField in textFieldCollection){
       if(textField.tag==senderSlider.tag){
           [textField setText:stringValue];
       }
    }

}

A: You can handle all of your UISlider changes in your view controller. To map a slider to a specific text field, set on both the same tag property. Then you can enumerate all your text fields and check, wether the tag property is equal.
[mySlider1 addTarget:self action:@selector(sliderValueChanged:) forControlEvents:UIControlEventValueChanged];
[mySlider2 addTarget:self action:@selector(sliderValueChanged:) forControlEvents:UIControlEventValueChanged];

And in your sliderValueChanged: method:
for (UITextField *textField in allMyTextFields) {
    if (sender.tag == textField.tag) {
        [textField setText:[NSString stringWithFormat:@"%d", value]];
    }
}


text:
Q: Find the joint distribution of $(Y_1,Y_2)$. Are $Y_1 \text{ and } Y_2$ independent? Consider two urns, urn A and urn B. In urn A, there are 3 balls numbered 0,1,2. In urn B there are 6 balls numbered 1,2,3,4,5,6. A ball is drawn from urn A, then a ball is drawn from urn B. Define $X_A$ as the number of the ball from urn A and $X_B$ the number of the ball drawn form urn B. What is the joint distribution of $(X_A, X_B)$. Let $Y_1 = X_A X_B$ and $Y_2 = \text{max}\{X_A, X_B\}$. Find the joint distribution of $(Y_1, Y_2)$. Hint: make a table. Find the marginal distribution of $Y_1$ and $Y_2$. Are $Y_1$ and $Y_2$ independent? Justify your answer using part (b).
I tried making the table, not sure if it's correct or not. Also I don't know how to use it to check whether $Y_1$ and $Y_2$ independent or not?
$$
\begin{array} {l|l|l|l|l|l|l}
 &  &     &     & X_B    &     &     &     \\ \hline
 &  & 1    & 2    & 3    & 4    & 5    & 6    \\ \hline
&0  & 1/18 & 1/18 & 1/18 & 1/18 & 1/18 & 1/18 \\ \hline
X_A&1  & 1/18 & 1/18    & 1/18    & 1/18    & 1/18    & 1/18    \\ \hline
&2  & 1/18    & 1/18  & 1/18    & 1/18    & 1/18    & 1/18
\end{array}
$$
$$
\begin{array} {l|l|l|l|l|l|l}
 &  &     &     & Y_2    &     &     &     \\ \hline
 &  & 1    & 2    & 3    & 4    & 5    & 6    \\ \hline
&0  & 1/18 & 1/18 & 1/18 & 1/18 & 1/18 & 1/18 \\ \hline
&1  & 1/18 & 0    & 0    & 0    & 0    & 0    \\ \hline
&2  & 0    & 1/9  & 0    & 0    & 0    & 0    \\ \hline
&3  & 0    & 0    & 1/18 & 0    & 0    & 0    \\ \hline
Y_1&4  & 0    & 1/18 & 0    & 1/18 & 0    & 0    \\ \hline
&5  & 0    & 0    & 0    & 0    & 1/18 & 0    \\ \hline
&6  & 0    & 0    & 1/18 & 0    & 0    & 1/18 \\ \hline
&8  & 0    & 0    & 0    & 1/18 & 0    & 0    \\ \hline
&10 & 0    & 0    & 0    & 0    & 1/18 & 0    \\ \hline
&12 & 0    & 0    & 0    & 0    & 0    & 1/18
\end{array}
$$


text:
Q: how can I make a function to save dataframe I want to make a function to save dataframe, so I coded as below:
 save<-function(x)
{
write.table(x, file=paste(x,"csv", sep="."))
write.table(x, file=paste(x,"txt", sep="."))
}

but I got errors:
 save(summary1)

Error in file(file, ifelse(append, "a", "w")) :
  invalid 'description' argument
  In addition: Warning message:
  In if (file == "") file <- stdout() else if (is.character(file)) { :
    the condition has length > 1 and only the first element will be used

what's wrong?

A: Your filename is not a character string, it looks like your filename is an attempt to paste an entire dataframe as a string along with 'csv' (the paste(x, 'csv', ...). This is because x is a dataframe, not a string, so R is complaining because it is not sure how to convert an entire dataframe to a single string.
If you want to save the file as 'x.csv' just do file="x.csv".
If you want the user to be able to specify the filename you could do:
 save<-function(x, fname)
{
write.table(x, file=paste(fname,"csv", sep="."))
write.table(x, file=paste(fname,"txt", sep="."))
}
save(summary1, "summary") # saved as summary.csv


text:
Q: How can I get my CV to print the publication list? % LaTeX resume using res.cls
\documentclass[margin]{res}
%\usepackage{helvetica} % uses helvetica postscript font (download helvetica.sty)
%\usepackage{newcent}   % uses new century schoolbook postscript font
\usepackage[T1]{fontenc}
%\usepackage{kpfonts,baskervald}
\usepackage{ebgaramond}
\usepackage{comment}
\usepackage{bibentry}

\RequirePackage{filecontents}
\begin{filecontents}{refs1.bib}
@inproceedings{McGoldrick:2016:WCR:2999504.3001118,
    author = {Mc Goldrick, Ciar\'{a}n and Segura, Enrique and Wu, Tianyan and Gerla, Mario},
    title = {WaterCom: Connecting Research Configurations with Practical Deployments: A Multilevel, Multipurpose Underwater Communications Test Platform},
    booktitle = {Proceedings of the 11th ACM International Conference on Underwater Networks \& Systems},
    series = {WUWNet '16},
    year = {2016},
    isbn = {978-1-4503-4637-5},
    location = {Shanghai, China},
    pages = {8:1--8:2},
    articleno = {8},
    numpages = {2},
    url = {http://doi.acm.org/10.1145/2999504.3001118},
    doi = {10.1145/2999504.3001118},
    acmid = {3001118},
    publisher = {ACM},
    address = {New York, NY, USA},
}

@inproceedings{Goldrick:2015:WMM:2831296.2831336,
    author = {Goldrick, Ciar\'{a}n Mc and Matney, Mark and Segura, Enrique and Noh, Youngtae and Gerla, Mario},
    title = {WaterCom: A Multilevel, Multipurpose Underwater Communications Test Platform},
    booktitle = {Proceedings of the 10th International Conference on Underwater Networks \& Systems},
    series = {WUWNET '15},
    year = {2015},
    isbn = {978-1-4503-4036-6},
    location = {Arlington, VA, USA},
    pages = {14:1--14:8},
    articleno = {14},
    numpages = {8},
    url = {http://doi.acm.org/10.1145/2831296.2831336},
    doi = {10.1145/2831296.2831336},
    acmid = {2831336},
    publisher = {ACM},
    address = {New York, NY, USA},
}
\end{filecontents}

\usepackage[backend=biber]{biblatex}
\addbibresource{refs1.bib}

\begin{document}
\begin{resume}
\section{PUBLICATIONS}
\printbibliography{refs1}

\end{resume}
\end{document}

A: The res.cls blocks the use of any .aux files by issuing a \nofiles command inside the class.  This means that out of the box you cannot use any bibliography software with it.
I would probably recommend using a different class altogether, or just formatting your CV using article and a few packages. But if you do want to continue to use the res.cls it can be done.
Edit res.cls
Make a copy of res.cls and rename it, e.g. res-bib.cls.  Line 203 of the class (version on CTAN) should read:
\nofiles %  resume's don't need .aux files

Delete or comment this line out in the copy of your class. (Deleting is preferred since it  will also get rid of the apostrophe in the comment...)
Use biblatex not bibentry
Now, using the modified class, here's how to use biblatex to add the publications:
% LaTeX resume using res.cls
\documentclass[margin]{res-bib}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{ebgaramond}

\RequirePackage{filecontents}
\begin{filecontents}{\jobname.bib}
@inproceedings{McGoldrick:2016:WCR:2999504.3001118,
    author = {Mc Goldrick, Ciar\'{a}n and Segura, Enrique and Wu, Tianyan and Gerla, Mario},
    title = {WaterCom: Connecting Research Configurations with Practical Deployments: A Multilevel, Multipurpose Underwater Communications Test Platform},
    booktitle = {Proceedings of the 11th ACM International Conference on Underwater Networks \& Systems},
    series = {WUWNet '16},
    year = {2016},
    isbn = {978-1-4503-4637-5},
    location = {Shanghai, China},
    pages = {8:1--8:2},
    articleno = {8},
    numpages = {2},
    url = {http://doi.acm.org/10.1145/2999504.3001118},
    doi = {10.1145/2999504.3001118},
    acmid = {3001118},
    publisher = {ACM},
    address = {New York, NY, USA},
}

@inproceedings{Goldrick:2015:WMM:2831296.2831336,
    author = {Goldrick, Ciar\'{a}n Mc and Matney, Mark and Segura, Enrique and Noh, Youngtae and Gerla, Mario},
    title = {WaterCom: A Multilevel, Multipurpose Underwater Communications Test Platform},
    booktitle = {Proceedings of the 10th International Conference on Underwater Networks \& Systems},
    series = {WUWNET '15},
    year = {2015},
    isbn = {978-1-4503-4036-6},
    location = {Arlington, VA, USA},
    pages = {14:1--14:8},
    articleno = {14},
    numpages = {8},
    url = {http://doi.acm.org/10.1145/2831296.2831336},
    doi = {10.1145/2831296.2831336},
    acmid = {2831336},
    publisher = {ACM},
    address = {New York, NY, USA},
}
\end{filecontents}

\usepackage[backend=biber,style=authoryear]{biblatex}
\addbibresource{\jobname.bib}

\begin{document}
\nocite{*}
\begin{resume}

% we need heading=bibnumbered here to tell biblatex to use \section
% not \section* (which will produce a spurious * with this class)
%
\printbibliography[title=PUBLICATIONS,heading=bibnumbered]

\end{resume}

\end{document}


text:
Q: Quadratic variation along a sequence of subpartitions Given a sequence $\Pi=\{\pi_n\}$ of partitions of an interval $[0,T]$ with $|\pi_n|=\max\limits_{t^n_i,t^n_{i+1}\in \pi^n}|t^n_{i+1}-t^n_i|\to_{n\to +\infty} 0$ the quadratic variation of a path $x\colon [0,T]\to \mathbb{R}$ along $\Pi$ is defined by
$$
[x]_{\Pi}(t)=\lim_{n\to +\infty}\sum_{\pi_n}|x(t_{i+1}\wedge t)-x(t_i\wedge t)|^2.
$$
Let $\Pi'=\{\pi'_n\}$ be another set of partitions with $\pi'_n\subset \pi_n,$ $|\pi'_n|\to_{n\to+\infty} 0$.
My question: is it possible that while $[x]_{\Pi}$ exists and is finite $[x]_{\Pi'}$ does not exist, or if both $[x]_{\Pi},\, [x]_{\Pi'}$ exist do we necessarily have $[x]_{\Pi}=[x]_{\Pi'}$?
Note that this is not true without the condition $\pi'_n\subset \pi_n$. For example one can construct a set of partitions $\Pi'=\{\pi'_n\}$  with $|\pi'_n|\to_{n\to+\infty} 0$ so that the paths of Brownian motion a.s. have infinte quadratic variations along $\Pi'.$
I assume that $x$ is continuous ( or càdlàg "right continuous with left limits").
In particular if we let
$$
[x](t)=\lim_{n\to +\infty}\sum_{i=0}^{2^n-1}\left|x\left(\frac{i+1}{2^n}\wedge t\right)-x\left(\frac{i}{2^n}\wedge t\right)\right|^2.
$$
Is it true that
$$
\lim_{n\to +\infty}\sum_{k=1}^{2^{n-1}-1}\left|x\left(\frac{2k+1}{2^n}\wedge t\right)-x\left(\frac{2k-1}{2^n}\wedge t\right)\right|^2=[x](t)?
$$


text:
Q: Puzzled: Clojure for loop with :while -> unexpected behaviour? I've been learning Clojure and puzzled by the following:
user=> (for [a (range 1 4) b (range 1 4)] [a b])
([1 1] [1 2] [1 3] [2 1] [2 2] [2 3] [3 1] [3 2] [3 3]); _no surprise here_

Let's add :while (not= a b), I expect to see an empty list as the loop should stop if the condition is false. In this case it's the very first item where a=b=1. Let's see:
user=> (for [a (range 1 4) b (range 1 4) :while (not= a b) ] [a b])

([2 1] [3 1] [3 2]) ; _surprise!_

Changing :while to :when to filter out (= a b) pairs
user=> (for [a (range 1 4) b (range 1 4) :when (not= a b) ] [a b])
([1 2] [1 3] [2 1] [2 3] [3 1] [3 2]); _expected_

Could anyone explain why (for [ ... :while ..] ...) behaves like this?
I'm using Clojure 1.3 on OS X.
Thank you and apologize for the lack of formatting. This is my virgin post on StackOverflow.

A: Let's look at each iteration.
a = 1
  b = 1 -> a == b, break because of while

a = 2
  b = 1 -> a != b, print [2 1]
  b = 2 -> a == b, break because of while

a = 3
  b = 1 -> a != b, print [3 1]
  b = 2 -> a != b, print [3 2]
  b = 3 -> a == b, break because of while

A: The :while condition in for only terminates the inner-most loop. I use for all the time, but :while so rarely that I never realized this; thanks for the great question!
Sadly I think the best you can do is wrap a take-while around the for, since you want a "global" stop-counter on the output sequence, not a stop-counter on one of the input sequences you're iterating over. For example:
(->> (for [a (range 1 4)
           b (range 1 4)]
       [a b])
     (take-while (fn [[a b]] (not= a b))))

()


text:
Q: Rails Views [confused by guide] I've been confused by the following lines:
    <%= link_to 'Show', book %>
    <%= link_to 'Edit', edit_book_path(book) %>
    <%= link_to 'Remove', book, :confirm => 'Are you sure?', :method => :delete %>

from
http://guides.rubyonrails.org/layouts_and_rendering.html

what is 'edit_book_path(book)' defined? Can you possibly explain what that means? Does it look at the controller 'book' and check the controller method 'edit' while passing in the variable book?
What is <%= link_to 'Show', book %>? Is it go to the controller method 'show'? Or display 'show'? Is 'book' the passed on variable?

A: Paths are generated by ruby's routes. You can get a list of routes available in your application by running rake routes, which will parse your config/routes.rb file and give you a list of routes and their respective paths. The output of that command should include edit_book_path, which is probably generated by a resources :books line in your config/routes.rb file.

A: 1) <%= link_to 'Show', book %>
    # => Show

This means that Show is the link and path of that link is book to show. So if you click on Show, the corresponding book will be shown.
Here book has the id of 1. So you say that book with id = 1 is displayed.
Example:
link_to "Profile", :controller => "profiles", :action => "show", :id => @profile
# => Profile

Similarly,
link_to "Profiles", profiles_path
# => Profiles

The above link will have Profiles as link and the path to profiles as its path.
2) <%= link_to 'Edit', edit_book_path(book) %>
            #=> Edit

This means that Edit is the link and path of that link is book to edit. So if you click on Edit, the corresponding book page will be displayed for edit.
3) <%= link_to 'Remove', book, :confirm => 'Are you sure?', :method => :delete  %>
    #=> Remove

This means that Remove is the link and path of that link is book to remove. So if you click on Remove, the corresponding book page will be removed and will not shown in the view.


text:
Q: Method of object as method argument of another class in c++ I have an istance of a class A, that has some methods like:
class A
{
 ...
public:
 bool  DoOperation_one(Mytype*  pSomeValue);
 bool  DoOperation_two(Mytype*  pSomeValue);
 ...
 bool  DoOperation_th(Mytype*  pSomeValue);
...
}

Another class, class B, has a pointer to A class and a method BMethod.
Class B
{
 ...
 A*  myPtrA;
...

bool  BMethod(...);   // arguments have to be defined
}

Is it possible to pass to BMethod, methods of A class instance as argument? I will try to be more clear with the follow pseudocode. In same place in class B i call BMethod with myPtrA method as argument (with parameters). I don't want to execute the myPtrA->DoOperation_two(somevalue) at calling time, but only in the BMethod (if statement):
    ...
    bool bVal = BMethod(myPtrA->DoOperation_two(somevalue))
    ...

bool B::BMethod("valid signature" myFunction)
{
 bool bfun=false;

  if (myFunction)
  {
    do_something....
  }

 return  bfun;
}

My goal is to call BMethod argument (DoOperation_one, DoOperation_two or DoOperation_th)   in the body of BMethod only. I have been used template, but DoOperation_XXX is executed at calling time.
....
bool bVal = BMethod(myPtrA->DoOperation_two(somevalue));

or

bool bVal = BMethod(myPtrA->DoOperation_one(somevalue));

...

     template <typename FunctionT>
         bool BMethod(FunctionT myFunc)
    {
          bool bfun=false;
          bool breturn = false;

          while (!bfun)
          {
            if (myFunc)
             {
              bfun=true;
              breturn = some_other_operation();
             }
           }

         return  breturn ;
    }

Moreover, myFunc contains result of myPtrA->DoOperation_one(somevalue), and doesn't change in the while statement because it has executed at calling time.
Is there any other approach/solution?

A: You can pass a member function pointer but then you'll need an A instance to call it and a Mytype* to be passed as parameter:
struct Mytype {};

struct A {
    bool  DoOperation_one(Mytype*  pSomeValue) { return true;}
    bool  DoOperation_two(Mytype*  pSomeValue) { return true;}
    bool  DoOperation_th(Mytype*  pSomeValue) { return true; }
};

struct B {
    A  a;
    template <typename F>
    bool  BMethod(F f,Mytype* mt) {
        bool bfun=false;
        bool breturn = false;

        while (!bfun) {
            if ((a.*f)(mt))
             {
              bfun=true;
              breturn = true;//some_other_operation();
             }
           }

         return  breturn ;
    }
};
int main() {
    Mytype mt;
    B b;
    b.BMethod(&A::DoOperation_one,&mt);
}

Instead of making BMethod a template, I could have spelled out the type explcitly, it is bool (A::*)(Mytype*). The syntax to call a member function pointer is a little clunky. If a is a pointer to A (like in your code) then it is (a.->f)(mt).
Note that this only makes sense if the value returned from A::DoOperation_xyz changes while B::BMethod is executing. For example when multiple threads are involved. If thats the case you need to be careful with synchronizing access to shared data to avoid data races. If this isnt multi-threaded, I see no reason to make it complicated and BMethod can simply be bool BMethod(bool x).


text:
Q: Simple docker example only appears to expose db container and not web I clone this repo (it's pretty much based on docker docs here) and run docker-compose up.  Docker builds the 2 containers and I see the output from db_1 (psql looks to be completely ready) but nothing at all from web_1, no output whatsoever.
I go to my host IP + 8000 and nothing is running there.  I am using docker toolbox for mac.  It's pretty much the simplest possible example of using Docker - any idea why I'm not seeing anything from my Django container?
Thanks in advance,

A: it might be possible that STDOUT of the web_1 Container is mapped only to display WARN and ERROR level. You say youre using Docker Toolbox for Mac? Have you tried to reach the Website over the IP of the DockerToolBox VM or the HostIP? Im not quite aware with DockerToolbox since there is an native MacClient (https://docs.docker.com/engine/installation/mac/). Maybe try to reach the DockerToolboxIp not HostIP. I would also recommend to use Docker for Mac native, since i had problems with the ToolBox but none with the "Native" Client.
Hope i could Help

A: After taking a better look to the documentation I was able to start your containers.
After the git clone:
cd sane-django-docker
docker-compose up -d

This is the output
Starting sanedjangodocker_db_1
Starting sanedjangodocker_web_1
[root@localhost sane-django-docker]# docker ps
CONTAINER ID        IMAGE                  COMMAND                  CREATED             STATUS              PORTS                    NAMES
cde9e93c1a70        sanedjangodocker_web   "python3 manage.py ru"   19 seconds ago      Up 1 seconds        0.0.0.0:8000->8000/tcp   sanedjangodocker_web_1
73ad8cafe798        postgres:9.4           "/docker-entrypoint.s"   20 seconds ago      Up 1 seconds        5432/tcp                 sanedjangodocker_db_1

When I just performd docker-compose up (running in the forground I saw this issue).
LOG:  shutting down
LOG:  database system is shut down

After taking a better look in the documentation I saw the problem

Django will complain about the postgres database not existing so we'll
  create one:

docker exec sanedjangodocker_db_1 createdb -Upostgres webapp

Now the postgres is fine but I had to restart the webapp to find the db.
docker restart sanedjangodocker_web_1

Now I'm able to acces it on IP:8000
It worked!
Congratulations on your first Django-powered page.

I don't know how the django app really works but the setup is pretty strange.


text:
Q: IndexableGraphHelper in Titan? I am wondering if there is an implementation of Blueprint's IndexableGraphHelper or equivalent work-around in Titan. During ETL, I want to ensure that I do not create duplicate vertices and my edges have are properly connected. So, I attempt to see if a vertex with the same key/value exists before creating as follows:
Iterable<Vertex> sampleVertices =graph.getVertices("MyKey", MyKevValue);

if (!sampleVertices.iterator().hasNext())
{
    //create a new vertex here
}
else
{
    for(Vertex v:sampleVertices)
    {
        sampleVertex=v;
        //System.out.println("sampleVertexID: " + sampleVertex.getId().toString());
        break;
    }
}

I am a Titan novice and have not used Java in several years. Any help would be greatly appreciated.

A: There are no such "helper" methods for Titan.  You have to write your own getOrCreate function to ensure uniqueness.  This is a fairly common pattern in "bulk loading".  You might consider using BatchGraph during your ETL process as it helps simplify the getOrCreate a bit and will help improve the performance of your load.  You also might find this blog post series on batch loading to Titan useful: "Powers of Ten" - Part One and Part Two.


text:
Q: CSS - Is it possible to use a * to parse a class or id? I'm adding some styles to some legacy code that dynamically adds a step counter per wizard step of this web app. For instance if the first page of the web wizard is completed the id attribute in the html would equal id="my-wizard-page-name.step1".
An example of what the html may look like in the inspector is below:

  This is step 1

After completing step 1 it would then reload and the div would be replaced with:

   This is step 2

I am trying to add styles specific to the wizard page without updating the template class or id. Is it possible to parse the id in my css or less files.  Im thinking something that would be similar to #my-wizard-page-name\.step* or #my-wizard-page-name* that would target every step within the page name.
(FYI: the backslah in the id is so I can use the . without the css assuming its a class on the id)

A: You can use attribute selectors
For your case, the starts with operator would be best: [id^=my-wizard-page]
Though, it's probably better to just add a class like my-wizard-page-step to each item and use that to select them.


text:
Q: Mocha typescript compilation issue related to downlevelIteration I just tried incorporating Mocha into my Typescript application. This is my tsconfig.json
{
         "compilerOptions": {
             "target": "ES6",
             "module": "commonjs",
             "outDir": "../dist",
             "sourceMap": true,
             "esModuleInterop": true,
             "downlevelIteration": true
         },
         "include": [
             "**/*.ts"
         ]
}

and this is my package.json
{
  "name": "game_server",
  "version": "1.0.0",
  "description": "A backend server for the game ",
  "scripts": {
    "test": "mocha -r ts-node/register src/**/*.spec.ts",
    "start": "concurrently \"tsc -p ./src -w\" \"nodemon ./dist/app.js\" "
  },
  "author": "XXXXX",
  "dependencies": {
    "@types/express": "^4.17.6",
    "@types/shortid": "0.0.29",
    "@types/socket.io": "^2.1.4",
    "express": "^4.17.1",
    "shortid": "^2.2.15",
    "socket.io": "^2.3.0",
    "typedeck": "^1.5.2"
  },
  "devDependencies": {
    "@types/chai": "^4.2.11",
    "@types/mocha": "^7.0.2",
    "chai": "^4.2.0",
    "concurrently": "^5.2.0",
    "mocha": "^7.1.2",
    "nodemon": "^2.0.3",
    "ts-node": "^8.10.1",
    "typescript": "^3.9.2"
  }
}

At some point in my code I am using an for .. of iterator for a map that looks like
for (let [key, value] of cardMap) {
}

When I do a npm run start my code gets compiled fine  and the server starts
but when I do npm run test which expands to
mocha -r ts-node/register src/**/*.spec.ts
I get an error on the above line
TSError: ⨯ Unable to compile TypeScript:
src/state/GameState.ts:183:30 - error TS2569: Type 'Map<Player, Card[]>' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators.

183     for (let [key, value] of cardMap) {
                                 ~~~~~~~

I have tried incorporating downLevelIteration=true in my tsconfig, am I missing something to get mocha tests working?

A: I started using ts-mocha and changed my test script to ts-mocha -p ./src/tsconfig.json ./src/**/*.spec.ts and it started working
https://github.com/piotrwitek/ts-mocha#readme


text:
Q: How to combine values with Bash from two files I have two files:
Text 1:
1 element
2 element
3 element
4 element

Text 2:
line1
line2
line3
line4
line5
line6
line7

I need to get this result:
1 element at line1
2 element at line2
3 element at line3
4 element at line4
1 element at line5
2 element at line6
3 element at line7

And if I add the  five line at text 1 the result expected like this:
1 element at line1
2 element at line2
3 element at line3
4 element at line4
5 element at line5
1 element at line6
2 element at line7

A: paste -d '' <(while cat text1; do :; done) <(yes ' at ') text2 | head -n "$(<text2 wc -l)"

while cat text1; do :; done repeats the content of text1. yes ' at ' generates lines, each being  at  (with adjacent spaces). paste merges lines of the two plus text2 with an empty delimiter.
paste works until all input files are depleted. while … and yes can stream endlessly, they would make paste continue even after file2 is depleted. Therefore we need to accept exactly as many lines as text2 has. This is what head does.
The approach assumes the two files are static.


text:
Q: Is it possible to run query while debugging procedure in aqua data studio? I found a documentation of SQL Debugger for Sybase ASE
documentation of SQL Debugger for Sybase ASE
But I want to run queries while I am stopping in breakpoint,
using temp tables from the procedure, and vaiables from the procedure
Is it possible?


text:
Q: How can I connect to an RTSP h.264 stream on iPhone using objective-c library I realize that the official supported streaming protocol for the iPhone is HTTP streaming .  This is great, but many appliances implement the RTSP protocol to stream video.  I have looked around for quite some time looking for RTSP libraries in objective c and have not found them.  Does anyone know of such libaries?
If not, does anyone know of some demo/code examples from people who have tried to get this to work.  Since Apple supports h264 in hardware, I'm assuming it is possible to get low level, implement the stream, then construct the video packet and pass it along as if you have streamed using HTTP streaming.  Anyone advice on how this might be done is appreciated.

A: Check out live555.  This will handle all the RTSP handshaking and deliver data (in your case, h264) to you application for further processing/decoding.  It is a C/C++ library, and hence can run on iOS.
Your options for integration with a cocoa app are:
1) Run live555 on its own thread using the event loop mechanism given as part of the library (note then that all operations directly related to live555 need to be run on this thread as live555 itself is not designed to be thread-safe).
2) Provide a cocoa implementation of "TaskScheduler", in which you use the cocoa library for async network callbacks, timers etc.
The above points will make more sense to you after reviewing the live555 doco.


text:
Q: speeding up initial display of contextMenu? Environment: Qt 5.1 OSX 10.7.5
I am showing a contextMenu when a Qt::RightButton event is received.
Issue: It works fine except that the initial display is very slow and can take 3-5 seconds to display the menu. Any subsequent displays are immediate. The delay is long enough so that the user can think nothing is happening.
Question: Is there any way to preload or otherwise speed up the initial display of the contextMenu?
I've tried initializing it in my class constructor:
   contextMenu = new QMenu(this);
   QAction *saveAction=contextMenu->addAction("Save");
   connect(saveAction,SIGNAL(triggered()),this,SLOT(saveSlot()));

I've tried declaring it as a pointer and as a... (not pointer? ;-)
  QMenu *contextMenu;

This is the mousePressEvent that executes to show the contextMenu.
void RPImageLabel::mousePressEvent(QMouseEvent *event)
{
    if (!imageRect.contains(event->pos())) return;

    origin = event->pos();

    this->setFocus();

    if (event->button()==Qt::RightButton){
        if (selectionRect.contains(origin))
            //            contextMenu.exec(this->mapToGlobal(origin));
            contextMenu->exec(this->mapToGlobal(origin));

    } else {
        selectionStarted=true;
        selectionRect.setTopLeft(origin);
        selectionRect.setBottomRight(origin);

        if (rubberBand->isHidden()){
            rubberBand->setGeometry(QRect(origin, origin));
            rubberBand->show();
            repaint();
        }
    }
}

A: Ok, I solved this by changing the contextMenuPolicy from DefaultContextMenu to ActionsContextMenu for the widget in Qt Creator.
I'm new to Qt so just guessing here but perhaps this uses a Qt contextMenu instead of the OSX menu? In any event, it displays immediately now. However it does throw an alert on certain conditions:
QNSView mouseDragged:
Internal mouse button tracking invalid (missing Qt::LeftButton)

Not clear what is going on but I see that there has been a bug report filed which may be related.


text:
Q: Is it possible to cache subversion? Is it possible to cache subversion at all? May be any commercial solution?
Any help would by highly appreciated.

A: The context of your question is unclear, but I would suggest using git-svn instead of Subversion.  The git-svn bridge gives you an interface and user experience like Git, while retaining Subversion as the official repository.  Basically, you start by running git svn clone URL, which creates a local Git repository that contains the entire repository history, with some Subversion metadata so that you can resynchronize later.  The Subversion repository is treated by Git as a special kind of remote repository.  Git-svn has multiple advantages over the usual Subversion workflow:

*

*Git is simply a more powerful tool than Subversion.

*Operations that Subversion would normally query the server for, such as svn log, happen locally.  git log is much faster than svn log.  (If you want the output to look like svn log, then run git svn log instead.)

*You have the option to make local Git branches, commit to them, rewrite history in them, etc., before pushing them into the remote Subversion repository.

*Road warriors can work offline except when syncing.

The main caveats are:

*

*Git is more difficult to learn than Subversion.

*The multiple steps to commit (git commit -a followed by git svn dcommit) can be confusing to some users.

*Some Subversion concepts are not well supported.  For example, Git does not handle keyword expansion well.

*Subversion lets you check out portions of a repository, whereas Git operations always work on the entire repository.  If your Subversion repository has per-directory access control, then git-svn won't work well.

A: I have found interesting info http://www-01.ibm.com/support/docview.wss?uid=swg21217781
Supported methods:

WebDAV methods (defined in RFC 2518):
PROPFIND , PROPPATCH , MKCOL, COPY, MOVE, LOCK, UNLOCK, SEARCH

Does anyone tried run subversion via ibm proxy server?

A: A very general commercial solution is a product offering from Riverbed Technology.  To my understanding, it's deployed at the data center and at remote site offices and watches all network traffic, on which it calculates checksums at a block-by-block (?) level.
In the data-center-outbound case (e.g., a central Subversion server), when it sees outbound traffic that matches a previous checksum, it sends just the checksum over the WAN, which the remote office's device looks up, decompresses, and transmits the corresponding data block on its LAN.  I've heard of this used in multiple companies to improve site office network speeds.

A: You can try to use a HTTP Cache like Squid to cache the HTTP requests.


text:
Q: adding and displayin E-Books in django I am working on a project for selling E-Books but I want to know the best way to display E-Books and handling them considering that users can not download or copy E-Books and can just read them
can anyone help me what can I do?

A: Ok I understand that you want to create an online Ebook store where you can sell ebooks. What you can do is create a django application for displaying and buying available ebooks then send the customer an system generated user ID & password to their respected contact details. Now create another djanog application hosted on different domain and only accessible from your custom modified browser that you can build with Electron (https://github.com/electron) and restrict user with printing ebook, screenshot and other restrictions you want to add. To display pdf in django you can read an article here https://www.csestack.org/render-open-pdf-file-django/


text:
Q: Event "controller_action_predispatch" not working. Magento 1 Config.xml
<?xml version="1.0"?>
<config>
    <modules>
        <Vendor_Module>
            <version>0.1.0</version>
        </Vendor_Module>
    </modules>
    <global>
        <models>
            <vendor_vodule>
                <class>vendor_vodule_Model</class>
            </vendor_vodule>
        </models>
        <helpers>
            <vendor_vodule>
                <class>vendor_vodule_Helper</class>
            </vendor_vodule>
        </helpers>
    </global>
    <frontend>
        <events>
            <controller_action_predispatch>
                <observers>
                    <vendor_vodule>
                        <class>Vendor_Module_Model_Observer</class>
                        <method>Module</method>
                    </vendor_vodule>
                </observers>
            </controller_action_predispatch>
        </events>
    </frontend>
    <adminhtml>
        <acl>
            <resources>
                <admin>
                    <children>
                        <system>
                            <children>
                                <config>
                                    <children>
                                        <vendor_vodule translate="title" module="vendor_vodule">
                                            <title>Module Validation</title>
                                            <sort_order>999</sort_order>
                                        </vendor_vodule>
                                    </children>
                                </config>
                            </children>
                        </system>
                    </children>
                </admin>
            </resources>
        </acl>
    </adminhtml>
</config>

Vendor/Module/Model/Observer.php
<?php

class Vendor_Module_Model_Observer
{
    /**
     * Validate
     *
     * @param Varien_Object $eventObject
     */
    public function Module($eventObject)
    {
        echo 'check'; exit;
    }
}

Any thoughts what's the issue with event ?


text:
Q: SimpleSAMLphp not redirecting on logout SimpleSAMLphp is not redirecting me to my ReturnTo address the first time, it takes me to my IdP's logout page. If I click the logout link again, it takes me to my correct ReturnTo page. Any ideas on why this may be happening?
I am using $as->logout("http://myurl.com"); to process the logout.

A: I had similar case with solution that implement SAML protocol. I think the analogy may apply.
The logout scenario works on two steps.

*

*The first step is to call into IDP server to perform the logout from its prospective.

*if  IDP successful logout , then ,  it will redirect to the URL given.

The obvious reason is that IDP logout is not successful.
You should check errors in the login process or corruption in the login data after login.
I hope this help.


text:
Q: Ejected Create react app jest coverage report not accurate I create an app using create-react-app and after that I ejected it. Currently doing my test suite, I want to show my test coverage so I added "collectCoverage" : true under my package.json. After I run my test it doesnt show the percentage of my test coverage

Is there anything I need to do?
Here is the Links.test.jsx
import React from "react";
import { shallow, mount } from "enzyme";

import Links from "./Links";

it("should show correct links", () => {
  const wrapper = mount(<Links />);

  expect(wrapper).toMatchSnapshot();
});

Below is the Links component that was being tested
import React from "react";

const Links = () => {
  return (

OUR LINKS

My Site

Maps

Social

              Acceptable Use
 and Security Policies

  );
};

export default Links;


text:
Q: Residues of $\frac{\pi \cot(\pi z)}{(z+1)(z+2)}$ I need to find the residue at $z= -1$ and $z=-2$ of the following function:
$$f(z) =  \frac{\pi \cot(\pi z)}{(z+1)(z+2)}$$
I now that $f(z)$ has a double pole at $z=-1$ because $\sin(-\pi) = 0 $. Now for a double pole the residue should be:
$$\lim\limits_{z \to -1} \frac{d}{dz} \frac{(z+1) \pi \cot(\pi z)}{z+2}$$
However evaluating the differentiation of that term can be quite annoying especially if you don't remember the "formula" for $\cot(z)$. Is there a more simple to evaluate this?
I know that the answer should be $-1$ (checked with Maple)

A: A series expansion is probably the quickest way here. An important sum identity for cotangent is:
$$
\pi \cot(\pi z) = \frac{1}{z} +2z \sum_{n=1}^{\infty}\frac{1}{z^2-n^2} = \frac{1}{z}+\frac{2z}{z^2-1} +\frac{2z}{z^2-4}+\frac{2z}{z^2-9}+\cdots
$$Let $f(z) = \frac{\pi \cot(\pi z)}{(z+1)(z+2)}$. Each singularity is a double pole, so to compute the residues we have
$$
\text{Res}(f(z);z=-1) = \lim_{z\to -1} \frac{2z}{(z^2-1)(z+1)(z+2)}\cdot \frac{(z+1)^2}{1!} = \lim_{z\to -1}\frac{2z}{(z-1)(z+2)}=-1
$$The residue at $z=-2$ is computed similarly and is found to be $-1$ as well.


text:
Q: Convert numeric entities to UTF-8 How can I replace all numeric entities with the appropriate UTF-8?
For example: in the source the string shows like this:
$string1 = "The Devil's in the Details";
$string2 = "Dónde estás, hermano?";

And I need replace it with
echo string1; //OUTPUTS Should be: The Devil's in the details
echo string2; //OUTPUTS Should be: Dónde Estás, Hermano?

I tried html_entity_decode() but it didn't work; any ideas?

A: If the problem with html_entity_decode was that it didn't decode the ', it's because the default flags are set to decode everything but a single quote. Do not attempt to ask why this is; it is PHP.
Try ENT_QUOTES:
html_entity_decode($str, ENT_QUOTES | ENT_HTML5); # HTML5 is good

That appears to work.


text:
Q: Time Machine encryption variations - how does each work? I've seen some great answers on Time Machine encryption, especially one by Gordon Davisson. But the variations regarding networked volumes is still hazy. The rules for locally attached volumes seem clear - it's an all-or-nothing proposition, please verify:
TM unencrypted backup to unencrypted volume: TM does an unencrypted backup.
TM encrypted backup to unencrypted volume: TM encrypts the volume (and all the files on it) then does the backup.
TM unencrypted backup to encrypted volume: TM decrypts the volume (and all the files on it) then does the backup.
TM encrypted backup to encrypted volume: TM does a backup and the OS handles the encryption?
Now, as for network attached storage:
TM unencrypted backup to unencrypted volume: TM creates an unencrypted backupbundle.
TM encrypted backup to unencrypted volume: TM creates an encrypted backupbundle. The other files on the volume are not encrypted and require no password?
TM unencrypted backup to encrypted volume: TM creates an unencrypted backupbundle, but it is encrypted by the OS anyway because the volume is encrypted? The backupbundle requires the same password as all the other files on the volume??
TM encrypted backup to encrypted volume: TM creates an encrypted backupbundle but what password does it require - the TM specified password or the volume's password (assuming they are different). Are two passwords required, one to mount the volume and one to open the backupbundle (Apple's documentation implies that you can)? Is the backupbundle encrypted separately using a different key than the other files or is it double-encrypted? Does reality exist?... oops too many questions.
Thank you for your patience! Any light on this subject would be appreciated.

A: It's pretty easy if you just look at the disks and you're on a moderately new macOS version.
Today, Apple encrypts disks and not backups. If the source is encrypted, it doesn't matter because it gets copied unencrypted to the Destiination. If the destination is not encrypted the file stay clear, if the destination is encrypted, the files are encrypted.
Apple does encryption at rest, so until the filesystem is uncounted and then the key to decrypt them is no longer valid until a key to unlock is provided.
You can inspect encryption status with these two commands.
diskutil apfs list
diskutil cs list

APFS is the newer modern filesystem and core storage was used after the original method of encrypted sparse disk images. Complicated, so that's why you see so many answers here on the old method, the newer method and the current method. Full disk encryption arrived with 10.7 Lion, so many major versions ago the old implementation is likely not in play for you.

*

*What is the difference between FileVault 2 and Disk Utility Encryption?

*When does encryption actually happen in MacOS/OS X encrypted volumes?


text:
Q: Method until(Function) in the type FluentWait is not applicable for the arguments I am running into an issue with until method using appium through selenium webdriver. It throws this error

The method until(Function) in the type FluentWait is not applicable for the arguments (new Function(){})

I followed every option from prior posts but none have worked.
Using Java 1.8, added pretty much every dependency in POM file.
public class AppInit {

    public static void setUp(AndroidDriver<AndroidElement> adriver) throws InterruptedException, MalformedURLException {
        ...........
        WebDriver driver;
        final WebDriverWait wait = new WebDriverWait(driver, 5);
        final By testXpath = By.xpath("////android.widget.Button[@content-desc='someid']");
        wait.until(ExpectedConditions.visibilityOfElementLocated(testXpath)).click();
   }

   public static void clickMenu() {
        WebDriver driver;
        new WebDriverWait(driver, 60).until(new Function<WebDriver, Boolean>() {
            Boolean isWindowFound = Boolean.FALSE;
            public Boolean apply(WebDriver driver) {
                try {
                   driver.switchTo().window("Your Window Name");
                   isWindowFound = Boolean.TRUE;
                } catch (NoSuchWindowException e) {
                   System.out.println("Your Window Name not found");
                   System.out.println(driver.getTitle());
                   return isWindowFound;
                }
                return isWindowFound;
            }
        });
    }

}

A: Adding below dependencies has fixed the issue
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>3.5.2</version>
    </dependency>

    <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>23.0</version>
    </dependency>

A: In case this helps someone - I was using Selenium-java version "3.141.59" and was able to compile the project fine using maven but was getting compile time errors in eclipse although I generated the eclipse project settings using maven itself. I then only added below guava dependency and my compile time errors in eclipse went away
<dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>23.0</version>
    </dependency>


text: Q: Error sending sms in Twilio when in then message's content there is a phone number I am using Twilio with dotnet (using endpoints not Twilio library), when I send sms, they are delivered correctly, but when in my message there is a phone number, it looks it was sent, I can see in my Twilio's console that his status is delivered, also the response of the post is ok. But in my cellphone i dont receive the message. For example if the message is "Hello world" -> everithing okay and I receive the message. I fthe message is "Please call(888) 888 - 888 for Customer Service", in Twilio's console everything is okay but I dont receive the message. Is there an specific format for a phone number in Twilio messages?