text:
Q: Adding JQuery Datepicker Dynamically to Form Elements I am working on a form with dynamically added inputs, by using the cloned method.  Each input will need a datepicker.
The name of each input will be distinct for output.
I am using the Jquery UI Datepicker for this.
The problem that occurs (the message in the console) is "$cloned.find(...).attr(...) is undefined"
I went to another post jQuery DatePicker not working on newly added row
and tried removing the hasDatepicker class (included in code below), but the problem persists.
Thanks for any input or resources.
The code is below:

 Class Year*
 <input type="text" id="datepicker" name="ClassYear_1" class="usedatepicker" value="" tabindex="4" />

  <button type="button" id="add-btn" name="add-btn">Add Class Year</button>

JS Code:
 function clone2(){
 var $cloned = $('table tr:last').clone();
 $cloned.removeClass('hasDatepicker').datepicker();
 //console.log($(this));
 //alert($(this).attr('name'));
 var oldIndex = $cloned.find('input').attr('name').match(/\d+/);
 var newIndex = parseInt(oldIndex,10)+1;
 $cloned.find('input').each(function(){
 var newName = $(this).attr('name').replace(oldIndex, newIndex);
 $(this).attr('name', newName);
 });
 $cloned.insertAfter('table tr:last');
 }

 $('#add-btn').click( function() {
 clone2();
 });

 //attach datepicker - begin
 $(document).ready(function() {

 $(".usedatepicker").datepicker(); // or
 $(".usedatepicker").datepicker("refresh");

 });

A: After cloning / inserting the new table row, you have new elements with .usedatepicker class that have not yet been initialized with datepicker.
I notice you are trying to initialize the new row with datepicker before adding it to the DOM. Two problems. First, you are trying to init datepicker to the entire (new) row and not just to the input field, and second you must do this after injecting the row into the DOM.
Try something like this:
function clone2(){
    var $cloned = $('table tr:last').clone();
    $cloned.removeClass('hasDatepicker').datepicker();
    //console.log($(this));
    //alert($(this).attr('name'));
    var oldIndex = $cloned.find('input').attr('name').match(/\d+/);
    var newIndex = parseInt(oldIndex,10)+1;
    $cloned.find('input').each(function(){
        var newName = $(this).attr('name').replace(oldIndex, newIndex);
        $(this).attr('name', newName);
    });
    $cloned.insertAfter('table tr:last');

    $(".usedatepicker").datepicker();  //<=== NEW
}

Another note:
You have an ID with value datepicker. When the row is cloned, you will have multiple elements with the same ID. A no-no. Change the ID to a class and all will work fine. Note that the only essential difference between a class and an ID is that you cannot use the same ID for more than one element. Simple solution: switch ID to class.
If that is not good enough, perhaps because you need to address each input field directly via a unique ID, do the same thing to the ID attribute that you are already doing to the name attribute.


text:
Q: Mismatching properties in array of objects I have a list of names (first + last). I want to mismatch all the fullname and lastname such that no full name is common between new list and initital list of names.
Mike,Pence
Tom,ho
Dave, hike
.......so on  ...

valid output would be:
Mike,hike
Tom,pence
Dave,ho
.......so on  ...

My data is
      var name = [ {
       firstN: 'Mike',
       lastN: 'Pence',
       fullName: 'Mike Pence'
    },
    {
       firstN: 'Tom',
       lastN: 'Ho',
       fullName: 'Tom Ho'
    },
    {
       firstN: 'Dave',
       lastN: 'hike',
       fullName: 'Dave Hike
    }

................and so on upto 100s
 ]
Expected Output:
 New List  = [ {
       firstN: 'Mike',
       lastN: 'Hike',
       fullName: 'Mike Hike'
    },
    {
       firstN: 'Tom',
       lastN: 'Pence',
       fullName: 'Tom Pence'
    },
    {
       firstN: 'Dave',
       lastN: 'ho',
       fullName: 'Dave Ho
    }

A: You clarified in a comment that your initial list will not have any repeated first or last names, so all you need to do is "slide" each person's surname up to pair with the previous person's first name:

var input = [{"firstN":"Andrew","lastN":"Anderson","fullName":"Andrew Anderson"},{"firstN":"Belinda","lastN":"Brown","fullName":"Belinda Brown"},{"firstN":"Clare","lastN":"Charleston","fullName":"Clare Charleston"},{"firstN":"David","lastN":"Downer","fullName":"David Downer"},{"firstN":"Edwin","lastN":"Edwards","fullName":"Edwin Edwards"},{"firstN":"Francine","lastN":"Fellows","fullName":"Francine Fellows"},{"firstN":"Gary","lastN":"Green","fullName":"Gary Green"},{"firstN":"Harriot","lastN":"Harcourt","fullName":"Harriot Harcourt"},{"firstN":"Irwin","lastN":"Inglesson","fullName":"Irwin Inglesson"},{"firstN":"Jennifer","lastN":"Jones","fullName":"Jennifer Jones"}]

var output = input.map(function(p, i, a) {
  var next = (i + 1) % a.length
  return {
    firstN: p.firstN,
    lastN: a[next].lastN,
    fullName: p.firstN + ' ' + a[next].lastN
  }
})

console.log(output)

A: You can do something like this. Just need to change the logic in shuffling array since sometimes it produces same value at the same index.

var nameList =[{firstN:'Tom',lastN:'Ho',fullName:'Tom Ho'},{firstN:'Mike',lastN:'Pence',fullName:'Mike Pence'},{firstN:'Dave',lastN:'Hike',fullName:'Dave Hike'}]

var newNameList = [];

var length = nameList.length;
for (var a=[],i=0;i<length;++i) a[i]=i;

function shuffle(array) {
  var tmp, current, top = array.length;
  if(top) while(--top) {
    current = Math.floor(Math.random() * (top + 1));
    tmp = array[current];
    array[current] = array[top];
    array[top] = tmp;
  }
  return array;
}
a = shuffle(a);

for(var i=0;i<length;i++){
  newNameList[i] = {};
  newNameList[i].firstN = nameList[i].firstN;
  newNameList[i].lastN = nameList[a[i]].lastN;
  newNameList[i].fullName = newNameList[i].firstN + " "+       newNameList[i].lastN;
}

console.log(newNameList)

redpajama_set_name: RedPajamaStackExchange


text:
Q: Matplotlib & Tkinter: prevent titles from hiding the graph I have two subplots, each with title. I plot them below with tkinter.
That works the way it should. My problem is that while decreasing the whole window the title of the lower plot covers the x-label of the upper plot. Is there a possibility to have a minimum space between the subplot(-titles)? Thanks :)
here is an example:
from tkinter import *
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
from matplotlib.figure import Figure

root = Tk()
x = [-3, -2, -1, 0, 1, 2, 3, 4, 5]
y_1 = [2, 4, 6, 8, 1, 3, 5, 7, 9]
y_2 = [9, 6, 3, 1, 4, 7, 6, 2, 2]

fig = Figure(figsize=(9, 9))
ax = fig.add_subplot(211)
ax.set_title("TITLE ONE")
ax.set_ylabel("Y1")
ax.set_xlabel("X")
line = ax.plot(x, y_1, color="black" )[0]

canvas = FigureCanvasTkAgg(fig, master=root)
canvas.get_tk_widget().pack()

ax2 = fig.add_subplot(212)
ax2.set_title("TITLE TWO")
ax2.set_ylabel("Y2")
ax2.set_xlabel("X")
ax2.plot(x, y_2, color="black")
fig.tight_layout()

root.mainloop()

A: Remove the fig.tight_layout() line, and instead use
import matplotlib
matplotlib.rcParams['figure.autolayout'] = True

on top of your script.


text:
Q: How to alter CSS for an inaccessible child class for an alert message component? I have created a textarea element with a maximum character limit. When the limit is reached, it should display an error message. I am using a pre-existing component called lib-error-alert-message. This is how the HTML code looks like -
<textarea class="my-text" rows="10" maxlength="500" [formControl]="textControl"> </textarea>
<lib-error-alert-message class="alert" *ngIf="(text | async) == 50" [alertMsg]="limitAlertMessage">
</lib-error-alert-message>

I have used this component elsewhere and it is working fine, however, in this particular page, the component has an internal class named "msgs" which has a margin-left property of -3rem.

This is causing the error alert and the textarea orientation to be askew.
While inspecting the element, if I uncheck the margin-left property then it looks correct.
I tried to create a class "alert" for the lib-error-alert-message and used the following code for that -
.alert {
margin-left: 0 !important;
width: fit-content;
}

But this does not override the inherent margin-left property for the internal class "msgs". How would I change the property for the internal class "msgs" (which is not accessible to me) in order to serve my purpose?

A: Add this style to your global styles.scss file. It selects the div with class msgs inside lib-error-alert-message element:
lib-error-alert-message div.msgs {
    margin-left: 0 !important;
    width: fit-content;
}

It's right that you don't have direct access to the library component, but good news is that the global styles.scss is applied to all dom elements.

A: Use the Angular deep selector - it can be used to target inner component of external libs
:host ::ng-deep {
   lib-error-alert-message div.msgs {
      margin-left: 0;
      width: fit-content;
   }
}


text:
Q: Share a method between two classes with buttons I have two Classes in C# with Windows Forms, let us call them One.cs and Two.cs. On both Classes I have two exactly the same Buttons, with the same function and the same name.
Now I have a function, which disables among other things one of these Buttons. Simplified it looks like that:
public static void Something(){
btnOne.Enabled = false; }

And now I want to share this function Something between my two classes One.cs and Two.cs. How can I do that?
I already tried to made a new static Class, with this function and tried to access it from class One and Two. But the problem is the Button, which I want to access...

A: You can have multiple options.

*

*Create  a base class and have that function in that base class. Now inherit the same and use anywhere you want.

*Create a common class . Include every function that you want to have across the application. Now create an object of that class and use it. (you need a reference for the button).

*Create an interface and have that virtual function. Now override that function in the classes where you want and use it as per need.

A: Obviously you need a reference to the button to be enabled/disabled. This you have to provide it within your method-parameters:
public static void Something(Button btn)
{
    btn.Enabled = false;
}

Now you can simply call it from everywhere in your code using MyStaticClass.Something(btnOne) (or btnTwo when in Two-class).


text:
Q: Android, Fit an Image Inside an ImageView i try to fit any image inside a diamond shape. My image is dynamic, how can i handle this ?
This is what I do:

and this is what I'm trying for:

A: You should try something like this this creates a custom shape ImageView and then you can use it as you see fit.. then you can add some edge color to have the effect you want


text:
Q: On Automorphism on Space of Smooth Functions Given a Operator $T$ (an Automorphism) on the subspace  $X$ of Smooth functions on $\mathbb R ^n$, $\mathcal C^\infty(\mathbb R^n)$
$$
X=\{u \in \mathcal C^\infty (\mathbb R^n) \,|\, supp \,(u)\subset H\}
$$
Where, $H$ is a Half Space defined by a fixed vector $N\neq 0$ in $\mathbb R^n$
$$
H=\{y\in \mathbb R^n \,|\, (y,N)\geq 0\}
$$
$(,)$ is inner product in $\mathbb R^n$.
I wish to show that for every $y \in H$, there exist a compact set $K\subset \mathbb R^n$ and constants $C $ and $k$ (all depending on y) such  that
$$
|u(y)|\leq C \sum_{|\alpha |\leq k} \sup _{K}|D^{\alpha} \,T(u)|
$$
For all $u \in X$
PS: In my context the operator $T$ is a differential operator, if someone thinks the question in under-informed, I can provide extra details.
PPS: It seems to me that the structure preserving Automorphisms preserves the semi-norms, the the result should follow. But I cannot figure out whey the constants and compact set depend on the point we take.


text:
Q: Is win32security.logonuser is secured? Or the inputs sent as plain-text Im trying to verify if user credentials getting him logged or not.
this input sent from the front-end to the back-end.
I need to find a way to secure the info which sent through all the way (end point computer to the back-end). what is the best way to do it? and is the win32security.logonuser is secured enough (i use it on the back-end).
Thanks!

A: [GitHub]: mhammond/pywin32 - Python for Windows (pywin32) Extensions is a wrapper over native Win APIs.
[ActiveState]: win32security.LogonUser (this is the closest of an official doc that I could find) is just a wrapper over [MS.Docs]: LogonUserW function. Here's what the latter states:

lpszPassword [in, optional]
  A pointer to a null-terminated string that specifies the plaintext password for the user account specified by lpszUsername. When you have finished using the password, clear the password from memory by calling the SecureZeroMemory function. For more information about protecting passwords, see Handling Passwords.

If you take a look at the source code: [GitHub]: mhammond/pywin32 - (b222) pywin32/win32/src/win32security.i:1021 (PyObject *PyLogonUser(PyObject *self, PyObject *args, PyObject *kwargs)), you'll notice that at the end of the function,

*

*SecureZeroMemory

*PyWinObject_FreeWCHAR
are called upon sensitive data.So, all the guidelines are met, there is of course the time window when the password string is in memory (between filling and releasing it, here the Python overhead will add a few milli / nanosecs), but this is as secure as you can get using this method.


text:
Q: How to upload multiple files with uploadcare I am trying to implement Uploadcare for multi-image upload, but confused about the code structure. Below code works, but it has two .fail blocks and two .done blocks. Additionally, adding the images to the front-end using $.each() should be done after the group has been saved on the server, while this code executes both simultaneously.
How can this code be improved?
$('button').on('click', function() {

    var myDialog = uploadcare.openDialog(null, {
        imagesOnly: true, multiple: true, multipleMin: 1, multipleMax: 7
    });

    myDialog.fail(function(error, fileInfo) {
        alert('Upload fialed');
    });

    myDialog.done(

        groupInstance => {
            var groupPromise = groupInstance.promise();
            var arrayOfFiles = groupInstance.files();

            groupPromise.done(function(fileGroupInfo) {
                /* Save group to server using Ajax */
                uploadGroup(fileGroupInfo.uuid);
            });

            groupPromise.fail(function(error, fileGroupInfo) {
                alert('Upload failed');
            });

            $.each(arrayOfFiles, function(i, file) {
                file.done(function(fileInfo) {
                    /* Add image to front-end */
                });
            });
        });

       return false;
    });

And the AJAX function:
uploadGroup = function(imgurl) {
    $.post('index.php',
    {string:imgurl},
    function(data) {
        if(data.status=='success') {
            alert('success');
        }
        else {
            alert('error');
        }
    },'json');
};

Also confused about the groupInstance => notation.

A: It seems arrayOfFiles is an array of promises?
So, you wait for all of them to complete using $.when
and since you're already using modern javascript, going to add another "oddity" you may not be familiar with ..., but it makes things easier

I may have misunderstood what you wanted to wait for

   groupInstance => {
        var groupPromise = groupInstance.promise();
        var arrayOfFiles = groupInstance.files();

        groupPromise.done(function(fileGroupInfo) {
            /* Save group to server using Ajax */
            uploadGroup(fileGroupInfo.uuid);

            // move the .each code here
            $.each(arrayOfFiles, function(i, file) {
                file.done(function(fileInfo) {
                    /* Add image to front-end */
                });
            });

            /* Probably not what you wanted
            $.when(...arrayOfFiles).then((...fileInfos) => {
                $.each(fileInfos, function(i, fileInfo) {
                    // Add image to front-end
                });
            });
            // the above 5 lines in old school JS
            $.when.apply(null, arrayOfFiles).then(function() {
                var fileInfos = [].slice.call(arguments);
                $.each(fileInfos, function(i, fileInfo) {
                    // Add image to front-end
                });
            });
            */
        });

        groupPromise.fail(function(error, fileGroupInfo) {
            alert('Upload failed');
        });
    }

...arayOfFiles ... ... is spread syntax ... so
$.when(...arrayOfFiles)

is like
$.when.apply(null, arrayOfFiles)

and function(...fileInfos) is Rest Syntax
function(...fileInfos) {

is equivalent to
function() {
    fileInfos = [].slice.call(arguments);
}

is like


text:
Q: Handling the output which contains chinese characters I am using a command(powershell qwinsta) on windows os which returns active sessions. The output contains chinese characters(for username). I have to verify that chinese username. But how can I handle that chinese username? If I write the output to console it is displaying the question marks, if I redirect the output(result) to to text file, then also it is writing question marks in to the file (for chinese characters). How to handle this?

A: One option is to change the language used for non-Unicode programs to Chinese.  On Windows 7, go to: Control Panel, Region and Language, Administrative, Change system locale and change it to an appropriate Chinese setting.  Reboot, and the console will support Chinese characters.
Another option is to redirect the output to a file in Powershell, which writes the file in UTF-16:
C:\>powershell
Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.

PS C:\> qwinsta > out.txt
PS C:\> notepad out.txt


text:
Q: Sci-fi book (no magic, hyperspace jumps, blind protagonist) I'm trying to recover a book from my childhood:

*

*I believe I read it in 199x, maybe early 200x

*No magic. Space sci-fi with hyperspace jumps between stars. The plot is all about jumps. Hyperspace jump destination is "random" and depends on jump starting point. To reach a specific location you usually need to make thousands of jumps in sequence. Paths are precious and were found accidentally or by recon drones.

*Swarms of drones are constantly searching for shorter paths to known stars and back.

*To make a blind jump (from some random point in space) usually means a suicide.

*The protagonist (male) was blinded on some planet and managed to create a kind of artificial eye, using a bird (crow?)

*More to the end of the book the protagonist was forced to make a blind jump on a spaceship with unknown destination and then he managed to return back to Earth using his blindness and camera

A: I wonder if this is Night Walk by Bob Shaw.
It has the problems with hyperspace that you mention:

In the first century of interstellar exploration Earth alone dispatched some forty million robot probes, of which less than two hundred chanced to make their way back. Of that number, exactly eight had found usable planetary systems. Not one of the handful of manned ships that accidentally made open-ended jumps was ever seen again -- on Earth, anyway. Some of them may still be going, carrying the descendants of their original crews, cosmic Flying Dutchmen glimpsed only by uncomprehending stars as their destiny of flicker-transits gradually takes them beyond the reach of human thought.
  The eight successful probes of that first century established zigzagging trade lanes, which the manned ships that came afterward were very careful to follow closely. That is the other aspect of null-space travel that troubles you as you wait for the relays to act. Although it was a logical deduction from the absence of reciprocity in null-space, a few pioneers discovered the hard way that jumping from a point near A will not take you to a corresponding point near B. Get more than about two light-seconds from the established jumping-off point, the so-called portal, and you are off on your own random pilgrimage to the far side of eternity.

The protagonist Sam Tallon is blinded when he is being tortured, and he has  device called an eyeset that allows him to see through other creatures eyes. He returns to Earth by seeing through the eyes of a rat that he finds in the spaceship.


text:
Q: Google Cloud Streaming Speech API C# not working I was trying to read streaming speech from microphone and translate it to text using Google Cloud Speech API sample code provided in the following URL.
https://github.com/GoogleCloudPlatform/dotnet-docs-samples/tree/master/speech/api
I followed the steps provided along with code and was able to enable speech service, got the API key from google account and finally was also able to build the solution but when i run project .exe file in console it was throwing exception
related to GOOGLE_APPLICATION_CREDENTIALS environmental variable setup.
Then to fix this error i have added the following code
Environment.SetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS", @"D:\Project-b1145200231e.json");

inside the main method of Recognize.cs file
This fixed the exception but the execution gets stopped/hanged after reading the following code.
Task printResponses = Task.Run(async () =>
            {
                while (await streamingCall.ResponseStream.MoveNext(
                    default(CancellationToken)))
                {
                    foreach (var result in streamingCall.ResponseStream.Current.Results)
                    {
                        foreach (var alternative in result.Alternatives)
                        {
                            Console.WriteLine(alternative.Transcript);
                            Console.ReadLine();
                        }
                    }
                }
            });

Please help on this. Thanks.


text:
Q: Select an existing variable by using readline I'd like to allow the user of my script to pick an existing object (a vector).
I thought something like this
...
message("Select a vector of y values")
nwd <- readLines(n = 1)
return(mean(nwd))
...

but the result is NA because nwd is seen as a character.
How can I solve?
Thanks.

A: A bit safer than eval(parse(...)):
x <- 1:10

message("Select a vector of y values")
nwd <- readLines(n = 1)
#input x
mean(get(nwd))
#[1] 5.5


text:
Q: Reclassifying data column with specific parameters I have a tree list with diameters for each tree (among many other variables). I'm trying to streamline the process of adding a new column that gives a diameter class based on each tree's diameter and I think it can be done with indexing and/or a for loop but I'm not strong with either of these skills. Diameters range from 0-80 cm. I want to put these into 2-cm classes where a tree between 0-0.9 is class "0", a tree 1.0-2.9 is class "2", a tree 3-4.9 is class "4" etc all the way to 80 cm. Here is a small snapshot of my data:
     Unit Plot Treatment           Year Species2 DBHmet
2     1    1        WB Post-treatment     PIPO 42.164
3     1    1        WB Post-treatment     PIPO 24.384
4     1    1        WB Post-treatment     PIPO 16.764
5     1    1        WB Post-treatment     PIPO 23.114
6     1    1        WB Post-treatment     PIPO 41.148
7     1    1        WB Post-treatment     PIPO  4.826
8     1    1        WB Post-treatment     PIPO 17.780
10    1    1        WB    Pre-harvest     PIPO 11.176
11    1    1        WB    Pre-harvest     PIPO 42.164
12    1    1        WB    Pre-harvest     PIPO  3.302
13    1    1        WB    Pre-harvest     PIPO 12.192

How can I quickly add an additional column that places the "DBHmet" into 2cm classes, as described above?

A: From the snapshot, I assume, that you have a dataframe/table and not a list.
Assuming this, the following will change the DBHmet values to the desired 2 cm classes:
> data <- data.frame(DBHmet = c(0.0, 0.9, 1.0, 2.9, 3.0, 4.9, 80.0),
+                    otherVar = rep("a", 7))
> data$DBHmet_2cm <- floor(((data$DBHmet + 1)/2))*2
> data
  DBHmet otherVar DBHmet_2cm
1    0.0        a          0
2    0.9        a          0
3    1.0        a          2
4    2.9        a          2
5    3.0        a          4
6    4.9        a          4
7   80.0        a         80


text:
Q: Creating a caesar cipher method using java I want to create a method that will use a phrase and a number taken from args.
The number form args will shift the letters of the phrase from args the amount of letters the number is.
example
javac Caesar.java
java Caesar abcd 1
the end result should print
bcde
my method is giving me problems.. help?
private String encode(String num, int x)
{
    char[] charnum = args[1];
    for (x = 0; x <= charnum.length; x++)
    {
        charnum = charnum + x;
    }
    return new String(charnum);
}

What do I do? Similarly i have to write a decoder method.
I was going to have the same set up except
the effects of the for loop change to
charnum = charnum - x;

My problem is that when I try to compile, I get the following errors
symbol  : variable argslocation: class Lab041
    char[] charnum = args[1];
                     ^

Lab041.java:17: operator + cannot be applied to char[],int

        charnum = charnum + x;
                          ^

2 errors

how do i fix it? and is my assumption for the decode method correct?

A: Charnum is a character array. You want to do:
for (i = 0; i <= charnum.length; i++) {
    charnum[i] = (char) (charnum[i] + x);
}

Which will refer to an element of that array.
Also keep in mind that you don't have safe guards for if you go over 'z'
Also check out this: Simple caesar cipher in java

A: I would start with a simpler encode method, like this
private static String encode(String num, int x)
{
  StringBuilder sb = new StringBuilder();
  for (char c : num.toCharArray()) {
    sb.append((char) (c + x));
  }
  return sb.toString();
}

Then to use it, I'd use a main method like this
public static void main(String[] args)
{
  if (args == null || args.length < 2) {
    System.out.println("Not enough arguments.");
    System.exit(1);
  }
  int val = Integer.valueOf(args[args.length - 1]);
  for (int i = 0; i < args.length - 1; i++) {
    if (i != 0) {
      System.out.print(' ');
    }
    System.out.print(encode(args[i], val));
  }
  System.out.println();
}

A: java cmd line args is a string array, you can't simply assign it to a char array, instead String class has a method toCharArray()
Also make use of the fact char data type can be manipulated by addition operator, eg:
char c = 'a';
c = (char)(c + 1);  // c is now 'b'

A: class CaesarCipher {
 private final String ALPHABET = "abcdefghijklmnopqrstuvwxyz";

 public String encrypt(String plainText,int shiftKey)

 {

       plainText = plainText.toLowerCase();

       String cipherText="";

       for(int i=0;i<plainText.length();i++)

       {

            int charPosition = ALPHABET.indexOf(plainText.charAt(i));

            int keyVal = (shiftKey+charPosition)%26;

            char replaceVal = this.ALPHABET.charAt(keyVal);

            cipherText += replaceVal;

       }

       return cipherText;

 }

 public String decrypt(String cipherText, int shiftKey)

 {

       cipherText = cipherText.toLowerCase();

       String plainText="";

       for(int i=0;i<cipherText.length();i++)

       {

            int charPosition = this.ALPHABET.indexOf(cipherText.charAt(i));

            int keyVal = (charPosition-shiftKey)%26;

            if(keyVal<0)

            {

                  keyVal = this.ALPHABET.length() + keyVal;

            }

            char replaceVal = this.ALPHABET.charAt(keyVal);

            plainText += replaceVal;

       }

       return plainText;

 }

}


text:
Q: Kofax "edit table header" not allowing second page navigation of a single document It has been more than a week, i have tried almost all option on Kofax Total Agility 7.6 "Transformation Designer"
I have a requirement of:

*

*Locating and Extracting the table content of a document(English or French)

To be able to do that i follow steps:

*

*Open "Transformation Designer"

*Created an extraction project, attached a sample document (having 5 pages)

*Navigate to project settings->Table tab

*Trying to create new "table header pack"

When i am trying to train system for header and non header lines, i am unable to navigate from pages of a same document, the image-viewer screen is showing only first page of a selected document and there is no next page button/navigation, only next document button/navigation is available.
Note: All training material covers only single page document where extraction is quite straight forward
Exact question is How should someone train "table header pack" when table is on the second or third page of a document
Any help?

A: Have not received anything from forum about the same. So in my case i will create zone, for each Table Cell than map it to table schema by code: Internal or External

A: I have been in the same situation and resolved it by changing the sample multi-page image into single page Tiff images. The you can create a doc with the table starting on page 1. When you test you'll find that it still finds the table starting on the nth page.
E.g. KTA comes with the Repository Browser (separate installation) which allows you to export documents as single-page Tiff images.


text:
Q: Wordpresscustom php only running when i uncomment the echo I made a little script in php and included it in the page.php from wordpress so it will run on every page.
Currently, the script is only running if I uncomment the

echo "Connected succesfully";

The moment I comment it out, the script stops working...
Please see the script below.
<?php
ob_start();

//SQL DATABASE INIT
$servername = "localhost";
$username = "user";
$password = "password";
$dbname = "databasename";

// Create connection
$mysqli = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($mysqli->connect_error) {
  die("Connection failed: " . $mysqli->connect_error);
}
//echo "Connected successfully";

//URL RETREIVAL
if (isset($_GET['uid']) && !isset($_GET['valid'])) {

        $urlId = $mysqli->mysqli_real_escape_string($_GET['uid']);
        $result = $mysqli->query("SELECT * FROM tablename WHERE id= '". $urlId ."'");

        if (mysqli_num_rows($result) > 0)
        {
            $url = "https://thisismywebsite.com/?valid=1&uid=". $_GET['uid'];
            header('Location:'. $url);
            ob_end_flush();
        }
        else
        {
            $url = "https://thisismywebsite.com/?valid=0&uid=". $_GET['uid'];
            header('Location:'. $url);
            ob_end_flush();
        }
} else {
    // Fallback behaviour goes here
}

?>

A: in wordpress you don't have to connect with database. just declare global $wpdb
   ob_start();

    global $wpdb;

   //URL RETREIVAL
    if (isset($_GET['uid']) && !isset($_GET['valid'])) {

    $urlId =$_GET['uid'];
              $result = $wpdb->$wpdb->get_results("SELECT * FROM tablename WHERE
    id= '". $urlId ."'");

    if (!empty($result))
    {
        $url = "https://thisismywebsite.com/?valid=1&uid=". $_GET['uid'];
        header('Location:'. $url);
        ob_end_flush();
    }
    else
    {
        $url = "https://thisismywebsite.com/?valid=0&uid=". $_GET['uid'];
        header('Location:'. $url);
        ob_end_flush();
    }
   } else {
     // Fallback behaviour goes here
   }


text:
Q: Isomorphic Quotient Ring Consider the ring $M_n(\mathbb{Z})$ and the ideal $M_n(2\mathbb{Z})$. My question is
$$M_n(\mathbb{Z})/M_n(\mathbb{2Z})\approx\ ?$$
Thanks.

A: Consider the homomorphism $f : M_n(\Bbb{Z}) \to M_n(\Bbb{Z}/2\Bbb{Z})$ which sends a matrix $M$ to the same matrix, but with entries modulo $2$. Is $f$ surjective? What is the kernel of $f$?


text:
Q: Expected function is a called but none of the functions inside of it are never called So I currently doing some unit test for an Angular application using Jasmine and Karma. I'm having a problem with a unit test that must open a modal, change some value of the form and save it. Everthing is doing well until it reaches inside the promise for the open()of my modal service and call saveAttribute() function.
The expects seems to have been called saveAttribute() successfully, but none of the functions inside of it are never called, even the hasValidRegex() function, despite being the first thing called in the saveAttribute() function. I also tried using a console log at the beginning of the saveAttribute() function but it never reaches it and print nothing apart of the function begin successfully called. Am I missing something?
.spec file
it('should save edited values in an selected attribute', fakeAsync(() => {
    const mockOpenModalResult = {
      result: new Promise((resolve, reject) => resolve('Save'))
    };
    spyOn(ngbModal, 'open').and.returnValue(mockOpenModalResult);
    spyOn(component, 'saveAttribute');
    spyOn(component, 'hasValidRegex').and.returnValue(true);
    spyOn(siteService, 'saveRequestTypeAttribute').and.returnValue(1155);
    spyOn(component, 'updateSiteTreeView');
    spyOn(component, 'clearFields');

    component.openModalInternal(mockAttributeRootNode, mockDetectChanges);
    flush();

    expect(component.saveAttribute).toHaveBeenCalledWith(mockAttributeRootNode, mockDetectChanges);
    expect(component.hasValidRegex).toHaveBeenCalled();

    expect(siteService.saveRequestTypeAttribute).toHaveBeenCalledWith(mockRequestTypeAttribute);
expect(component.updateSiteTreeView).toHaveBeenCalledWith(mockRequestTypeAttribute);
    expect(component.clearFields).toHaveBeenCalled();

  }));

Component.ts
openModalInternal(attributeRootNode: SiteTreeNode, detectChanges: Function) {
    this.title = this.editMode ? 'Edit' : 'Add';
    const ngbModalOptions: NgbModalOptions = {
      ariaLabelledBy: this.title,
      backdrop: 'static',
      scrollable: true,
      size: 'xl',
      centered: true,
      keyboard: false
    };
    this.modalService.open(this.requestTypeAttributeTypeModal, ngbModalOptions).result.then(result => {
      if (result === 'Save') {
        console.log('test reaches this part of the code and calls saveAttributes successfully')
        this.saveAttribute(attributeRootNode, detectChanges);
      } else if (result === 'Remove') {
        this.removeAttribute(attributeRootNode, detectChanges);
      } else {
        this.clearFields();
      }
    });
  }

  saveAttribute(attributeRootNode: SiteTreeNode, detectChanges: Function) {
    if (!this.hasValidRegex()) {
      return;
    }
    const locationId: number = this.storageService.getLocationId();
    const myObjType: item = {
      // ...
    };
    this.siteService.saveRequestTypeAttribute(item).subscribe(id => {
      item.AttributeId = id;
      this.alertMessageService.setSuccessMessage([SuccessMessage.SuccessMessage]);
      this.updateSiteTreeView(attributeRootNode, detectChanges);
    });
    this.clearFields();
  }

Errors:

Note: Can't show you mocked data because of a disclosure matter. But I don't think that the mocked data is causing this behavior

A: I think I know the issue. The issue is this:
spyOn(component, 'saveAttribute');

When you spyOn a method, you are losing its implementation details and you can just see whether if it was called or not or how many times it was called. To still have the implementation details, you have to use .and.callThrough() to actually call the function every time it is called.
Change the line to:
spyOn(component, 'saveAttribute').and.callThrough();

and the test should hopefully pass.


text:
Q: How can I set up a vm instance on google cloud but use my preferred username rather than name_domain_com or whatever goes there by default? I just set up a new ubuntu vm "compute Engine" instance and the username at the ssh prompt is long. About a year or two ago I set up an instance and it just used the first part of my email address rather than the whole thing as my username. I have metadata set up like this:
enable-oslogin  TRUE

and ssh keys set up there with my regular username (first part of my email address).
But every time, it just uses my full email address (replacing the "@" and "." with underscores). I found a few links that point to IAM section of the console, but isn't there an easier way with fewer hoops to just choose the username you want? Obviously I could change it once I'm logged into the VM itself, but still, I'd like to not have to fiddle. Thanks.

A: I'm afraid that it is not possible to use a different user name as the OS login requires an email address. The underscores will always be present as all email addresses must contain both . and @ characters. This is part of the verification process of OS Login and cannot be changed and can be explained here


text:
Q: Javascript in preamble For TeX Live 2012 there is the package insDLJS that allows you to write a documentwide complex javascriptcode in the header of the document, like (Pseudocode):
\documentclass{standalone}
\usepackage{insDLJS}
\begin{insDLJS}[script]{script}{script}
some.javascript.code;
\end{insDLJS}
%
\begin{document}
something that execute javascriptcode and something handelt by javascript
\end{document}

Now I-ve installed the new TeX Live 2014 too but, like the media9 didn't work with the l3kernel from 2012 the insDLJS does not work with the l3kernel from 2014.
Did someone know how i can write a javascript in header to include it with \input{thejavascriptcode.tex}? Must not be the insDLJS, can be something else too so long I can use \pushButton and \textField !!!Not \TextField (capital letter T)!!!.
Thanks alot for your time


text:
Q: Two different definitions of the mean curvature - how do they coincide? On Wikipedia (https://en.wikipedia.org/wiki/Mean_curvature) it says that mean curvature $H$ in 3D-space can be calculated via
$$2H= - \nabla \cdot n$$
but also via
$$2H = tr ((II)(I^{-1}))$$. How do these definitions coincide?
On a unit sphere with parametrization $X(\theta,\phi)=\bigl(\sin(\theta)\cos(\phi), \sin(\theta)\sin(\phi, \cos(\theta)\bigr)^T$ for example, I get $$(II)(I^{-1})=\begin{pmatrix}1 &0 \\ 0 &1\end{pmatrix}$$thus $H=1$.Given the normalized normal vector
$N=\begin{pmatrix}\sin(\theta)\cos(\phi)\\ \sin(\theta)\sin(\phi)\\\cos(\theta)\end{pmatrix}$, I am not really sure in how to apply the operator $\nabla$ onto $N$.

A: You made a sign error here.  For $\mathbf{n}=\mathbf{e}_r$, you get $X_{\theta\theta}\cdot\mathbf{n}<0$ in $\mathrm{I\!I}$, similarly other components, so $(\mathrm{I\!I})(\mathrm{I}^{-1})=\begin{pmatrix}-1\\&-1\end{pmatrix}$.
What you want to do is to extend $\mathbf{n}$ from $S$ to a neighbourhood of our surface $S$, then calculate its divergence in $\mathbb{R}^3$.
Specifically, every point $\mathbf{p}$ in a sufficiently small neighbourhood of $S$ has a unique closest point $\mathbf{x}$, and we let $\mathbf{n}(\mathbf{p})=\mathbf{n}(\mathbf{x})$, where $\mathbf{n}(\mathbf{x})$ is our outward normal to surface $S$ at $\mathbf{x}\in S$.  So in your example, in a small spherical shell we have $\mathbf{n}=\mathbf{e}_r$.  Then
$$
2H=-\nabla\cdot\mathbf{n}=-\left.\frac1{r^2}\frac{\partial}{\partial r}(r^2\mathbf{n}\cdot\mathbf{e}_r)\right\vert_{r=1}=-2.
$$


text: Q: .docx file edited in TextEdit once, lost all footnotes I used TextEdit to quickly add two sentences in my .docx file. Before I could react, the file was overwritten and I could not get the previous version of this file, as it was on my USB key. Fortunately I did not lose all formatting, but unfortunately ALL footnotes (that were added beforehand in Word) have been deleted and I do not see them in Word on Windows. Is there an explanation for this incident and recovery plan for this? I am perfectly aware of differences of formats used by TextEdit and Office.


text:
Q: FileNotFoundError: [Errno 2] No such file or directory: 'greetings.txt' I  am stuck to this weirdly small problem for like 3 hours and i just can't find the fix of it. Here look at the problem I'm trying to read a .txt file(greetings.txt) which contains a simple message and both- the .txt file and the program to read the file (readingfile.py) are inside the same folder, but still when i try to run the program which should return the text inside the .txt file , instead , it's throwing an error FileNotFoundError: [Errno 2] No such file or directory: 'greetings.txt'  If you think you familiar with this issue please help.
The code is written below and i will be also attaching an image please check that as well.Go through this link to view the image
with open('greetings.txt') as file:
    content = file.read()
print(content)

A: Your corrent folder is not the parent folder of the script, which is coincidentally also where your greetings.txt file is located.
To fix that, use __file__ to get the absolute path of the executing script, and then join with the parent path to get the absolute path of the text file.
For instance:
import os

path_to_file = os.path.join(os.path.dirname(__file__), 'greetings.txt')

with open(path_to_file) as file:
    ...

Alternatively, in Python 3.x, the above code can be simplified even further by relying on pathlib module:
from pathlib import Path

content = (Path(__file__).parent / 'greetings.txt').read_text()


text:
Q: HTML divs can go outside browser window? I was playing around with ASP.NET Web Parts which has a "drop down" div.  It's all the way to the right of the page.  When I click to bring it up, it goes off the window.  Usually anything off the viewable area will trigger the bottom scrollbars.  How is this possible?

Edit: It's Internet Explorer 8.  Below is the markup with some context.  The relevant one I think is id=WebPart_wp774658725VerbsMenu.  By default it doesn't display.  When you click on the td/span Verbs/span VerbsPopup (it could be any), it shows the "dropdown".  In Developer Tools I don't see any JavaScript attached to those elements, but if I debug it I see it running some.

        Billing Information

            u

                         Delete

WebParts.js
    function WebPartMenu_OnClick() {
    var a = window.event.srcElement.__menu;
    if (typeof a != "undefined" && a != null) {
        cancelEvent(window.event);
        a.Show()
    }
}

function WebPartMenu_Show() {
    if (typeof __wpm.menu != "undefined" && __wpm.menu != null) __wpm.menu.Hide();
    var e = "' + this.menuElement.innerHTML + "",
    b = 16,
    c = 16;
    this.popup = window.createPopup();
    __wpm.menu = this;
    var d = this.popup.document;
    d.write(e);
    this.popup.show(0, 0, b, c);
    var a = d.body;
    b = a.scrollWidth;
    c = a.scrollHeight;
    if (b < this.menuLabelElement.offsetWidth) b = this.menuLabelElement.offsetWidth + 16;
    if (this.menuElement.innerHTML.indexOf("progid:DXImageTransform.Microsoft.Shadow") != -1) a.style.paddingRight = "4px";
    a.__wpm = __wpm;
    a.__wpmDeleteWarning = __wpmDeleteWarning;
    a.__wpmCloseProviderWarning = __wpmCloseProviderWarning;
    a.popup = this.popup;
    this.popup.hide();
    this.popup.show(0, this.menuLabelElement.offsetHeight, b, c, this.menuLabelElement)
}

A: It is indeed the createPopup method that does the trick. It's a proprietary method in Internet Explorer.
See http://msdn.microsoft.com/en-us/library/ms536392%28VS.85%29.aspx.

A: Why not add a little extra to the margin there? Seems like the most easiest and cheapest way to save time.


text:
Q: In what situation would it prove to be more useful to use a hash instead of an array in Ruby? I'm am just now learning Ruby programming language on my own, and was wondering in what cases would it be more useful to use a hash instead of an array? It seems like a hash is simply an array where each element has a name rather than an index. Thanks.

A: Hashes are great as libraries where you want to store specific pieces of information for multiple things. Think of it as an excel table with the columns representing specific data (i.e. Name, Age, Address, etc), and each row represents a single person with specific information stored.
Lets say you want to access a specific information in this hash you built or generated. Well, their name has to be "Philip" and their Age has to be greater than 20.
my_hash.each do |person|
  if person[:name] == "Philip" && person[:age] >= 20
    puts person
  end
end

Not particularly Ruby, but JSON (JavaScript Object Notation) uses a hash structure to store a ton of information. Also, when you consume API's, a lot of the data you receive will be in hash notation that you will then need to parse and take needed information from.

A: You're exactly right, while arrays hold an integer as the key, hashes can store any object as the key. because of this, arrays are more data efficient*, but hashes are more flexible. I'd recommend using whichever you are more comfortable with for now, unless you are very concerned with using as little data as possible.


text:
Q: Can't Create Or Open Web Sites in Visual Studio 2012 Ultimate SP1 x64 I have an error when trying to create  or to open a website in my visual studio professional 2012.
A dialog box appears to me that says says

The Web Developer Tools option must be installed prior to opening or creating Web projects.You can install this option by repairing your Microsoft Visual Studio installation and ensuring that 'Web Developer Tools' is checked in the list of optional components

I am using  Windows 7  Ultimate Service Pack 1 on a 64-bit operating system and I have already installed the Web Developer Tools.
Could you please help me.

A: *

*Go to Control Panel -> Programs and Features -> Select your Visual Studio Version and hit "Change".

*Click MODIFY and enable Web Developer Tools

*Enable Web Developer Tools

*Click Update


text:
Q: Mysql takes more tmp space than the table size I have a mysql table with 2.8GB data+index size. I wanted to add a column to the table and it was failing due to insufficient space on /tmp. When I looked at the size available on /tmp it was 3.9GB.
See the below mysql error which the alter command was failing with
2016-03-17 01:47:53 7f8962739700 InnoDB: Error: Write to file (merge) failed at offset 140509184.
InnoDB: 1048576 bytes should have been written, only 667648 were written.
InnoDB: Operating system error number 0.
InnoDB: Check that your OS and file system support files of this size.
InnoDB: Check also that the disk is not full or a disk quota exceeded.
InnoDB: Error number 0 means 'Success'.
InnoDB: Some operating system error numbers are described at
InnoDB: http://dev.mysql.com/doc/refman/5.6/en/operating-system-error-codes.html

My Question is why did the mysql alter command fail due to insufficient size when there is more than 2.8GB of space on /tmp.
To see how much space is mysql consuming to run the alter command. I changed the /tmp partition to a partition which has more space like 15GB.
when I ran the alter command, mysql took up 5.4GB of tmp space to process the command. This is almost twice the size of the table.
Can anybody help me understand this behaviour. I am using Server version: 5.6.22-log MySQL Community Server (GPL)
show create table jjkl_sec\G
    *************************** 1. row ***************************
           Table: jjkl_sec
    Create Table: CREATE TABLE `jjkl_sec` (
      `ia_second_UTC` datetime NOT NULL,
      `ia_second` datetime NOT NULL,
      `ia_device_id` int(11) NOT NULL,
      `ia_job_id` int(10) unsigned zerofill DEFAULT NULL,
      `ia_time` bigint(19) NOT NULL DEFAULT '0',
      `ia_network_type` varchar(45) DEFAULT NULL,
      `ia_mcc` int(10) DEFAULT NULL,
      `ia_mnc` int(10) DEFAULT NULL,
      `ia_lac_id` int(10) DEFAULT NULL,
      `ia_cell_id` int(10) DEFAULT NULL,
      `ia_signal_strengh_rssi` int(10) DEFAULT NULL,
      `ia_testcase_id` varchar(128) DEFAULT NULL,
      `ia_lte_pci` int(10) DEFAULT NULL,
      `ia_lte_rsrp` int(10) DEFAULT NULL,
      `ia_lte_rsrq` int(10) DEFAULT NULL,
      `ia_lte_rssnr` int(10) DEFAULT NULL,
      `ia_dbm` int(10) DEFAULT '-1',
      `ia_asu` int(10) DEFAULT '-1',
      `ping_avg` varchar(50) DEFAULT '0',
      `ia_ping_rtt_min` varchar(50) DEFAULT '0',
      `ia_ping_ip_address` varchar(100) DEFAULT '0',
      `ping_id` int(10) DEFAULT NULL,
      `ftpdl_id` varchar(128) DEFAULT NULL,
      `httpdl_id` varchar(128) DEFAULT NULL,
      `ftpul_id` varchar(128) DEFAULT NULL,
      `httpul_id` varchar(128) DEFAULT NULL,
      `ftpdl` float(12,0) DEFAULT '0',
      `httpdl` float(12,0) unsigned DEFAULT '0',
      `ftpul` float(12,0) DEFAULT '0',
      `httpul` float(12,0) DEFAULT '0',
      `x_param` float(16,8) DEFAULT '0.00000000',
      `y_param` float(16,8) DEFAULT '0.00000000',
      `x_indoor` float(16,8) DEFAULT '0.00000000',
      `y_indoor` float(16,8) DEFAULT '0.00000000',
      `ia_last_location_time` datetime DEFAULT NULL,
      `ia_location_provider` varchar(128) DEFAULT NULL,
      `ia_collect_altitude` float(12,0) DEFAULT '0',
      `ia_location_tags` varchar(50) DEFAULT NULL,
      `ia_arfcn` int(10) DEFAULT NULL,
      `ia_pci` int(10) DEFAULT NULL,
      `ia_rsrp_rx0` float(12,0) DEFAULT NULL,
      `ia_rsrq_rx` float(12,0) DEFAULT NULL,
      `ia_rssi_rx0` float(12,0) DEFAULT NULL,
      `ia_sinr_rx0` float(12,0) DEFAULT NULL,
      `ia_cqi_pucch` int(10) DEFAULT NULL,
      `ia_cqi_pusch` int(10) DEFAULT NULL,
      `ia_wcdma_rx0` float(12,0) DEFAULT NULL,
      `ia_evdo_rx0` float(12,0) DEFAULT NULL,
      `ia_wcdma_psc` float(12,0) DEFAULT NULL,
      `ia_cdma_rf_pn` float(12,0) DEFAULT NULL,
      `ia_wcdma_ec_io` float(12,0) DEFAULT NULL,
      `ia_evdo_asp_pilotpn_0` float(12,0) DEFAULT NULL,
      `ia_evdo_asp_pilotstr_0` float(12,0) DEFAULT NULL,
      `ftpdl_i` float(20,0) DEFAULT NULL,
      `ftpul_i` float(20,0) DEFAULT NULL,
      `httpdl_i` float(20,0) DEFAULT NULL,
      `httpul_i` float(20,0) DEFAULT NULL,
      `ia_wifi_ssid` varchar(150) DEFAULT NULL,
      `ia_wifi_bssid` varchar(150) DEFAULT NULL,
      `ia_wifi_signal_level` int(10) DEFAULT NULL,
      `ia_wifi_frequency` int(10) DEFAULT '0',
      `ia_wifi_linkspeed` varchar(255) DEFAULT NULL,
      `wholepage_duration` bigint(19) DEFAULT '0',
      `setup_time` bigint(19) DEFAULT NULL,
      `call_event` varchar(15) DEFAULT NULL,
      `call_id` varchar(128) DEFAULT NULL,
      `video_ref_file` varchar(300) DEFAULT '0',
      `video_test_estimated_FPS` float(9,4) DEFAULT NULL,
      `video_jitter` int(10) DEFAULT NULL,
      `video_PEVQ_MOS` float(9,4) DEFAULT NULL,
      `udp_datagram_size` int(10) DEFAULT NULL,
      `udp_Jitter` double(22,0) DEFAULT NULL,
      `udp_direction` varchar(30) DEFAULT NULL,
      `udp_thoughput` float(12,0) DEFAULT NULL,
      `MOSLQO` float(9,4) DEFAULT NULL,
      `vqt_call_id` varchar(128) DEFAULT NULL,
      `ia_file_url` varchar(500) DEFAULT NULL,
      `MOSLQO_UL` float(9,4) DEFAULT NULL,
      `vqt_call_id_ul` varchar(128) DEFAULT NULL,
      `ia_file_url_ul` varchar(500) DEFAULT NULL,
      `video_throughput` float(19,1) DEFAULT NULL,
      `voice_call_type` varchar(20) DEFAULT NULL,
      `voice_handover` varchar(20) DEFAULT NULL,
      `voice_jitter` int(11) DEFAULT NULL,
      `voice_jitter_ul` int(11) DEFAULT NULL,
      `playback_time` bigint(19) DEFAULT NULL,
      `data_timestamp_change` bigint(20) DEFAULT NULL,
      `data_change_type` varchar(80) DEFAULT NULL,
      `data_duration` bigint(20) DEFAULT NULL,
      `ftpdl_filesize` varchar(100) DEFAULT NULL,
      `ftpdl_progress` int(11) DEFAULT NULL,
      `ftpul_filesize` varchar(100) DEFAULT NULL,
      `ftpul_progress` int(11) DEFAULT NULL,
      PRIMARY KEY (`ia_second_UTC`,`ia_device_id`),
      KEY `MOSLQO` (`MOSLQO`),
      KEY `MOSLQO_UL` (`MOSLQO_UL`),
      KEY `udp_thoughput` (`udp_thoughput`),
      KEY `udp_direction` (`udp_direction`),
      KEY `video_PEVQ_MOS` (`video_PEVQ_MOS`),
      KEY `ftpdl` (`ftpdl`),
      KEY `httpdl` (`httpdl`),
      KEY `ftpul` (`ftpul`),
      KEY `httpul` (`httpul`),
      KEY `ia_job_id` (`ia_job_id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8
    1 row in set (0.00 sec)

The alter command took 6 1/2 min to complete.
(root@localhost) [smart_report]> ALTER TABLE `jjkl_sec`
    ADD COLUMN `datagram_lost` INT DEFAULT NULL AFTER `udp_direction`;
Query OK, 0 rows affected (6 min 25.76 sec)
Records: 0  Duplicates: 0  Warnings: 0

A: It looks like a lot of columns could be 'normalized, thereby significantly decreasing the size of the table and the cost of altering it.
Virtually all columns are optional??  (I see that most are NULL instead of NOT NULL.)  This implies that the table probably could/should be split up into multiple tables, making the ALTER less disk-intensive.
Did you try the ALTER with ALGORITHM=INPLACE?  If so, did it complain that AFTER prohibits such?
If it has to rebuild the table, then it also rebuilds all the indexes.  This is another tmp-space hog.  So, do you really need all the tables?
That leads to another possible technique...

*

*Drop the secondary indexes.

*Do the non-INPLACE ALTER.

*Add the indexes back using INPLACE.


text:
Q: If $Gf$ is connected and locally-connected then $f$ is continuous. I encountered this proof in the H. Herrlich's Topology book. There are several steps there that are unclear, perhaps someone would have an idea.
Prove that:
$f: \underline R \rightarrow \underline R\ $ is a map and $GF = \{(x, f(x)) \ | \ x \in R)\}$ it's graph. Then $f$ is continuous if $GF$ is connected and locally-connected.
The author starts by stating that if $f$ were discontinuous then WLOG there would exist such $x \in R$ and $r > 0$ and monotone icreasing $x_n \rightarrow x$.
It would hold then that $f(x_n) > f (x) + r, \forall n \in N$. Then the set U = $\{ (a,b) \in Gf \ |\ b < f(x) + r \}$ would be an open neighbourhood of $(x, f(x))$.
Since $GF$ is locally-connected, there is such open and connected $V \subset U$.
If one defines $V_n = \{(a,b) \ \in V | \ a < x_n\}$ then each $V_n$ has to be empty. Therefore, from $a < x_n$ it follows that $(a, f(a)) \notin V$.
Hence, $V$ is an open neighbourhood of $(x,f(x))$, such that it does not intersect $A = \{ (a,b) \in Gf \ | \ a < x \}$.
$A$ would be therefore both open and closed, which contradicts the connectedness of $Gf$.

I've marked unclear parts using bold font.

*

*In order to prove that $A$ is closed the author needs to show that any point not from $A$ has an open neighbourhood that does not intersect $A$. He finds it by defining $V$ for $(x, f(x))$. The way I see it $(x, f(x))$ is not an arbitrary point. However, in the beginning, the author states that it is. By writing WLOG, it looks as if the author assumes that the map is discontinuous at every point. Why is that?

*Why does it follow that each $V_n$ must be empty? I see why $V_n$ is supposed to be closed and open set and since $V$ is connected then $V_n$ must be either $\emptyset$ or $V$ itself. Why is the latter not possible and only the $\emptyset$ is considered?

*Why does it follow that $(a, f(a)) \notin V$? I guess it has to hold for each $V_n$ but how does one transition from there to $V$? $V$ could be bigger than the union of all $V_n$'s and thus contain $(a,f(a))$ in that gap.

A: Let us begin with some notation. For $x \in \mathbb R$ let $p(x) = (x,f(x)) \in Gf$, $H_+(x) = \{ (a,b) \in \mathbb R^2 \mid a > x \},  H_-(x) = \{ (a,b) \in \mathbb R^2 \mid a < x \}$. The sets $H_\pm(x)$ are open in $\mathbb R^2$, hence the sets $Gf_\pm(x) = Gf \cap H_\pm(x)$ are open in $Gf$.

*

*W.l.o.g. :
If $f$ is not continuous, then there exists $x$ and $r > 0$ and a sequence $(x_n)$ converging to $x$ such that $x_n \ne x$ and $\lvert f(x_n) - f(x) \rvert > r$. Thus $f(x_n) - f(x)  > r$ for infinitely many $n$ or $f(x_n) - f(x)  <  -r$ for infinitely many $n$. We may assume that $f(x_n) - f(x)  > r$ for infinitely many $n$, the other case can be treated similarly. So w.l.o.g. all  $f(x_n) - f(x)  > r$ (otherwise take a subsequence). We may also assume that the sequence $(\lvert x_n - x \lvert)$ is stricty decreasing (otherwise take a subsequence). But infinitely many $x_n < x$ or infinitely many $x_n > x$. We may assume that infinitely many $x_n < x$, the other case can be treated similarly. So w.l.o.g. all  $x_n < x$ (otherwise take a subsequence). This means that $(x_n)$ is strictly increasing.

*$V_n$ has to be empty :
Note that $f(x_n) > f(x) + r$, thus $p(x_n) \notin U$ and hence $p(x_n) \notin V$. Therefore $V = (V \cap Gf_+(x_n)) \cup (V \cap Gf_-(x_n))$, where $V \cap Gf_\pm(x_n)$ are disjoint open subsets of $V$. Clearly $V \cap Gf_+(x_n) \ne \emptyset$ because $p(x) \in V$ and $p(x) \in Gf_+(x_n)$ because $x > x_n$. Since $V$ is connected, we conclude that $V_n = V \cap Gf_-(x_n)$ must be empty. Now assume that $V \cap Gf_-(x) \ne \emptyset$. Then there exists $(a,b) \in V$ such that $(a,b) \in Gf_-(x)$, i.e. $a < x$. There exists $n$ such that $a < x_n < x$ which implies $(a,b) \in Gf_-(x_n)$. Thus $(a,b) \in V \cap Gf_-(x_n)$, a contradiction.

*$A = Gf_-(x)$ is open and closed in $Gf$ :
It is open by definition. Moreover $Gf = Gf_-(x) \cup V \cup Gf_+(x)$. We have $Gf_-(x) \cap (V \cup Gf_+(x)) = Gf_-(x) \cap V \cup Gf_-(x) \cap Gf_+(x)) = \emptyset$. Therefore $Gf_-(x)$ is the complement of the open subset $V \cup Gf_+(x) \subset Gf$.


text:
Q: How to install ArangoDB Docker on an Arch Linux headless server? I would like to install ArangoDB for Docker on an Arch Linux machine I access via ssh. The ArangoDB Docker download is found here:
Docker - ArangoDB
This ArangoDb will not be part of a cluster, and there is no active failover. The ArangoDB configuration and the database will need to be persistent.
I will need to access it using the arango command line tools (arangosh, arangoimp, etc.) via ssh. And we'll need http access to the Arango WebUI from the local area network on port 8529 (ArangoDB's default).
I have done these steps:
sudo pacman -Syu docker
sudo systemctl enable docker
sudo systemctl start docker
sudo docker info

Docker is installed correctly.
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 18.09.0-ce
Storage Driver: btrfs
Build Version: Btrfs v4.19
Library Version: 102
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
init version: fec3683
Security Options:
seccomp
Profile: default
Kernel Version: 4.19.11-arch1-1-ARCH
Operating System: Arch Linux
OSType: linux
Architecture: x86_64
CPUs: 12
Total Memory: 62.82GiB
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false

I installed the hello-world docker container:
sudo docker run -i -t hello-world

Hello from Docker!
  This message shows that your installation appears to be working correctly.

Next I ran this command:
docker run -e ARANGO_NO_AUTH -d --name arangodb-instance arangodb

That produced the expected identifier. However, it does not appear that any containers are running.
sudo docker info
Containers: 4
 Running: 0
 Paused: 0
 Stopped: 4
Images: 2

ArangoDB is not accessible at http://localhost:8529

A: running
docker run -e ARANGO_NO_AUTH -d --name arangodb-instance arangodb

will produce identifier, but arangod will exit with error, run
docker ps -a

there you'll see your container with STATUS
Exited (1) 5 seconds ago

run
docker logs arangodb-instance

and you'll see why it exited
automatically choosing storage engine
error: database is uninitialized and password option is not specified
You need to specify one of ARANGO_ROOT_PASSWORD, ARANGO_NO_AUTH and ARANGO_RANDOM_ROOT_PASSWORD

so
to start arango with no password, you need to state
-e ARANGO_NO_AUTH=1

you forgot =1, -e are KEY=VALUE
to access arango remotely, you need to expose port
-p 8529:8529

to persist data, you need to map them to your host path or volume (volume is best practice)
-v arangodb3:/var/lib/arangodb3

so
for persisting in volume, run
docker volume create arangodb3

and then
docker run -d \
-e ARANGO_NO_AUTH=1 \
-p 8529:8529 \
-v arangodb3:/var/lib/arangodb3 \
--name arangodb-instance \
arangodb/arangodb:3.4.0

before you'll run those, you'll need to remove existing container with same name
docker stop arangodb-instance
docker rm arangodb-instance

to run arangosh, etc run
docker exec -it arangodb-instance arangosh

notice, that arangodb/arangodb:3.4.0 instead of arangodb/arangodb when executing docker run, it's best practice, avoid to run containers without specified version, it will pull arangodb/arangodb:latest which can cause, that your staging or prod can pull newer version than you have on dev, which could be a problem if newer version is minor or major
also never run arangodb with ARANGO_NO_AUTH=1 in production or on publicly accesible server
more details related to Docker are at https://hub.docker.com/_/arangodb/


text:
Q: Is there any library or code for DES which take 7 byte key? Do we have any library or any mechanism where we can use true 7 byte key for DES instead of 8 byte key. I need it for keys  analysis in DES and 8 byte key requirement for associated library is creating problem in getting actual keys analysis.

A: As explained in http://en.wikipedia.org/wiki/Data_Encryption_Standard, the 8-byte key for DES is just a 56-bit key in 8 bytes with odd parity check added:
The key is nominally stored or transmitted as 8 bytes, each with odd parity. According to ANSI X3.92-1981, section 3.5:
One bit in each 8-bit byte of the KEY may be utilized for error detection in key generation, distribution, and storage. Bits 8, 16,..., 64 are for use in ensuring that each byte is of odd parity.

(end quote)
So given an 8-byte key I can generate a 7-byte key by dropping the parity check bits and reformatting, and given a 7-byte key I can generate an 8-byte key by reformatting and adding parity check bits. It should therefore be easy to produce wrappers to make a library for one key format look like a library for another - or are you having some other problem I haven't noticed?

A: In DES a key is comprised of 8 bytes with the LSB a parity bit, a nice and regular structure.  There's an implication there for the relationship between input bytes and Permuted Choice 1, which loads the two 28 bit C and D Registers.
In parlance of the NBS standard a Permuted Choice is a selection permutation not using all the values of a greater whole.
Historically any DES implementation that used 7 bytes wasn't compatible where there are several FIPS/Nist pubs specifying key/ciphertext/plaintext triplets.
If you have a need for a 56 bit number representing a key there's an implication you're using or storing them in a tabular fashion.  Otherwise you could simply guarantee the parity bit is either correct or say '0'.  'Packed' keys are only of interest for saving storage space.
All that said and done if you need a 56 bit number representing a key you could represent 8 bytes of key in a 64 bit value and after identifying the parity bit locations with respect to endian-ness, shift the 64 bit array value obliterating the parity bits one at a time in 8 operations on a 64 bit machine, leaving 56 'effective' key bits.
On a 32 bit or smaller machine you'd also have to track byte position to keep track of bit shift offsets and would have to deal with bits moving between bytes to pack bits into 7 bytes.
For a 32 bit machine you could pack two 32 bit values into 28 bits in opposite directions then merge the proper 4 bits of the second one into the first followed by shifting the second value down 8 bits.
For a big-endian bit in byte numbering system 1 to 8 with bit 8 the LSB (from the standard)
Bits 1-4 go to the C register, with only four  bit 4 values from 8 successive bytes of an input key (described as an input array of bits).  The D block shares bit 4 and uses bits 5-7 to derived 28 bits:

The bigger issue here may be the ability to communicate any interesting finding in terms of keys useful to those dealing with an 8 byte key representation.  It may be handy to have an inverse function available as well.
There's also a relationship between round keys and the C and D concatenated block, shown in Carl Meyers and Stephen Metyas book "Cryptography, A New Dimension in Computer Security', subtitled 'A Guide for the Design and Implementation of Secure Systems', Wiley Interscience, 1982, ISBN-0-471- 04892-5.
I recreated the table using a derivative of the original BSD libcrypt source.  The significance of this is that C and D bits don't mix in the two 24 bit values derived from Permuted Choice 2 (which is visible in selected key (KS) in round 16 of the table).
  Bit  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
KS
   1  15 18 12 25  2  6  4  1 16  7 22 11 24 20 13  5 27  9 17  8 28 21 14  3
   2  16 19 13 26  3  7  5  2 17  8 23 12 25 21 14  6 28 10 18  9  1 22 15  4
   3  18 21 15 28  5  9  7  4 19 10 25 14 27 23 16  8  2 12 20 11  3 24 17  6
   4  20 23 17  2  7 11  9  6 21 12 27 16  1 25 18 10  4 14 22 13  5 26 19  8
   5  22 25 19  4  9 13 11  8 23 14  1 18  3 27 20 12  6 16 24 15  7 28 21 10
   6  24 27 21  6 11 15 13 10 25 16  3 20  5  1 22 14  8 18 26 17  9  2 23 12
   7  26  1 23  8 13 17 15 12 27 18  5 22  7  3 24 16 10 20 28 19 11  4 25 14
   8  28  3 25 10 15 19 17 14  1 20  7 24  9  5 26 18 12 22  2 21 13  6 27 16
   9   1  4 26 11 16 20 18 15  2 21  8 25 10  6 27 19 13 23  3 22 14  7 28 17
  10   3  6 28 13 18 22 20 17  4 23 10 27 12  8  1 21 15 25  5 24 16  9  2 19
  11   5  8  2 15 20 24 22 19  6 25 12  1 14 10  3 23 17 27  7 26 18 11  4 21
  12   7 10  4 17 22 26 24 21  8 27 14  3 16 12  5 25 19  1  9 28 20 13  6 23
  13   9 12  6 19 24 28 26 23 10  1 16  5 18 14  7 27 21  3 11  2 22 15  8 25
  14  11 14  8 21 26  2 28 25 12  3 18  7 20 16  9  1 23  5 13  4 24 17 10 27
  15  13 16 10 23 28  4  2 27 14  5 20  9 22 18 11  3 25  7 15  6 26 19 12  1
  16  14 17 11 24  1  5  3 28 15  6 21 10 23 19 12  4 26  8 16  7 27 20 13  2

  Bit 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
KS
   1  42 53 32 38 48 56 31 41 52 46 34 49 45 50 40 29 35 54 47 43 51 37 30 33
   2  43 54 33 39 49 29 32 42 53 47 35 50 46 51 41 30 36 55 48 44 52 38 31 34
   3  45 56 35 41 51 31 34 44 55 49 37 52 48 53 43 32 38 29 50 46 54 40 33 36
   4  47 30 37 43 53 33 36 46 29 51 39 54 50 55 45 34 40 31 52 48 56 42 35 38
   5  49 32 39 45 55 35 38 48 31 53 41 56 52 29 47 36 42 33 54 50 30 44 37 40
   6  51 34 41 47 29 37 40 50 33 55 43 30 54 31 49 38 44 35 56 52 32 46 39 42
   7  53 36 43 49 31 39 42 52 35 29 45 32 56 33 51 40 46 37 30 54 34 48 41 44
   8  55 38 45 51 33 41 44 54 37 31 47 34 30 35 53 42 48 39 32 56 36 50 43 46
   9  56 39 46 52 34 42 45 55 38 32 48 35 31 36 54 43 49 40 33 29 37 51 44 47
  10  30 41 48 54 36 44 47 29 40 34 50 37 33 38 56 45 51 42 35 31 39 53 46 49
  11  32 43 50 56 38 46 49 31 42 36 52 39 35 40 30 47 53 44 37 33 41 55 48 51
  12  34 45 52 30 40 48 51 33 44 38 54 41 37 42 32 49 55 46 39 35 43 29 50 53
  13  36 47 54 32 42 50 53 35 46 40 56 43 39 44 34 51 29 48 41 37 45 31 52 55
  14  38 49 56 34 44 52 55 37 48 42 30 45 41 46 36 53 31 50 43 39 47 33 54 29
  15  40 51 30 36 46 54 29 39 50 44 32 47 43 48 38 55 33 52 45 41 49 35 56 31
  16  41 52 31 37 47 55 30 40 51 45 33 48 44 49 39 56 34 53 46 42 50 36 29 32

This almost says your 56 bit number should be concatenated from the C and D Register values so there's a discernible relationship with round keys while allowing you to index based on C and/or D values.

A: I tried editing pyDes library code I just took 7 byte key and converted back to 64 bits by padding '0' to every multiple of 8th positions of bits.  so the analysis on 7 byte-key actually required for algorithm hopefully is gained and the the parity bits are taken as 0 (that is not associated to my key now)  :) . please comment if my key still is not solely for DES algorithm..


text:
Q: Data animation bootstrap carousel effects is not working Hi i have implemented data animation effect in my slider but the animation effect is not working after implementing in my project.it is displaying all the images as a single slide and the slider also not moving for the first time.If we click on next and previous buttons then the slider is moving automatically if not it is not accepting.Here is my code.While implementing in my project got error as
Uncaught TypeError: $myCarousel.carousel is not a function

  (function( $ ) {
//Function to animate slider captions
function doAnimations( elems ) {
    //Cache the animationend event in a variable
    var animEndEv = 'webkitAnimationEnd animationend';

    elems.each(function () {
        var $this = $(this),
            $animationType = $this.data('animation');
        $this.addClass($animationType).one(animEndEv, function () {
            $this.removeClass($animationType);
        });
    });
}

//Variables on page load
var $myCarousel = $('#carousel-example-generic'),
    $firstAnimatingElems = $myCarousel.find('.item:first').find("[data-animation ^= 'animated']");

//Initialize carousel
$myCarousel.carousel();

//Animate captions in first slide on page load
doAnimations($firstAnimatingElems);

//Pause carousel
$myCarousel.carousel('pause');

//Other slides to be animated on carousel slide event
$myCarousel.on('slide.bs.carousel', function (e) {
    var $animatingElems = $(e.relatedTarget).find("[data-animation ^= 'animated']");
    doAnimations($animatingElems);
});
$('#carousel-example-generic').carousel({
    interval:3000,
    pause: "false"
});

 })(jQuery);
#first-slider .main-container {
padding: 0;
}
#first-slider .slide1 h3, #first-slider .slide2 h3, #first-slider .slide3 h3, #first-slider .slide4 h3{
color: #fff;
font-size: 30px;
  text-transform: uppercase;
  font-weight:700;
}
#first-slider .slide1 h4,#first-slider .slide2 h4,#first-slider .slide3 h4,#first-slider .slide4 h4{
color: #fff;
font-size: 30px;
  text-transform: uppercase;
  font-weight:700;
 }
 #first-slider .slide1 .text-left ,#first-slider .slide3 .text-left{
padding-left: 40px;
}
#first-slider .carousel-indicators {
bottom: 0;
}
#first-slider .carousel-control.right,
#first-slider .carousel-control.left {
background-image: none;
}
#first-slider .carousel .item {
 min-height: 425px;
height: 100%;
width:100%;
}
 .carousel-inner .item .container {
  display: flex;
  justify-content: center;
  align-items: center;
  position: absolute;
bottom: 0;
top: 0;
left: 0;
right: 0;
 }
  #first-slider h3{
  animation-delay: 1s;
  }
  #first-slider h4 {
  animation-delay: 2s;
  }
  #first-slider h2 {
  animation-delay: 3s;
  }
  #first-slider .carousel-control {
  width: 6%;
  text-shadow: none;
  }
  #first-slider h1 {
  text-align: center;
  margin-bottom: 30px;
  font-size: 30px;
  font-weight: bold;
  }
  #first-slider .p {
  padding-top: 125px;
  text-align: center;
  }
  #first-slider .p a {
  text-decoration: underline;
  }
  #first-slider .carousel-indicators li {
  width: 14px;
  height: 14px;
  background-color: rgba(255,255,255,.4);
  border:none;
  }
  #first-slider .carousel-indicators .active{
  width: 16px;
  height: 16px;
  background-color: #fff;
  border:none;
  }
 .carousel-fade .carousel-inner .item {
 -webkit-transition-property: opacity;
  transition-property: opacity;
  }
 .carousel-fade .carousel-inner .item,
 .carousel-fade .carousel-inner .active.left,
 .carousel-fade .carousel-inner .active.right {
 opacity: 0;
}
  .carousel-fade .carousel-inner .active,
  .carousel-fade .carousel-inner .next.left,
  .carousel-fade .carousel-inner .prev.right {
  opacity: 1;
  }
 .carousel-fade .carousel-inner .next,
 .carousel-fade .carousel-inner .prev,
 .carousel-fade .carousel-inner .active.left,
 .carousel-fade .carousel-inner .active.right {
   left: 0;
  -webkit-transform: translate3d(0, 0, 0);
      transform: translate3d(0, 0, 0);
    }
   .carousel-fade .carousel-control {
  z-index: 2;
  }
 .carousel-control .fa-angle-right, .carousel-control .fa-angle-left {
  position: absolute;
  top: 50%;
  z-index: 5;
  display: inline-block;
  }
 .carousel-control .fa-angle-left{
 left: 50%;
width: 38px;
height: 38px;
margin-top: -15px;
font-size: 30px;
color: #fff;
border: 3px solid #ffffff;
-webkit-border-radius: 23px;
-moz-border-radius: 23px;
border-radius: 53px;
 }
.carousel-control .fa-angle-right{
right: 50%;
width: 38px;
height: 38px;
margin-top: -15px;
font-size: 30px;
color: #fff;
border: 3px solid #ffffff;
-webkit-border-radius: 23px;
-moz-border-radius: 23px;
border-radius: 53px;
}
.carousel-control {
opacity: 1;
filter: alpha(opacity=100);
}
#first-slider .slide1 {
background-image: url(http://s20.postimg.org/h50tgcuz1/image.jpg);
  background-size: cover;
background-repeat: no-repeat;
}
 #first-slider .slide2 {
  background-image: url(http://s20.postimg.org/uxf8bzlql/image.jpg);
  background-size: cover;
  background-repeat: no-repeat;
  }
  #first-slider .slide3 {
  background-image: url(http://s20.postimg.org/el56m97f1/image.jpg);
  background-size: cover;
  background-repeat: no-repeat;
  }
  #first-slider .slide4 {
  background-image: url(http://s20.postimg.org/66pjy66dp/image.jpg);
  background-size: cover;
  background-repeat: no-repeat;
  }
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<link rel="stylesheet" href="http://cdn.bootcss.com/animate.css/3.5.1/animate.min.css">
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet" />

Add images, or even your logo!

Easily use stunning effects

 50 animation options A beautiful

Create beautiful slideshows

Simple Bootstrap Carousel

Bootstrap Image Carousel Slider with Animate.css

We are creative

Get start your next awesome project

        Previous

        Next

A: Try including scripts after the html,

        Previous

        Next


text:
Q: Bean's method that returns to the previous page After performing the appropriate action, the method of my bean must ensure that the browser back to the previous page. How can I handle it?
I am using the CDI Conversation.

A: Pass the current URI as request parameter along during navigation to the page containing that action.
<h:link value="Go to page containing that action" outcome="pageContainingThatAction.xhtml">
    <f:param name="from" value="#{request.requestURI}" />
</h:link>

(use #{view.viewId} instead if you want to pass the view ID)
Set and remember that parameter representing the URI in the view/conversation scoped managed bean.
<f:metadata>
    <f:viewParam name="from" value="#{bean.from}" />
</f:metadata>

Finally redirect to that URI in that action method.
public void thatActionMethod() throws IOException {
    // ...

    externalContext.redirect(from);
}

A: After asking you a couple of question in comments, I think what you want to do is :

*

*On your button, specify the attribute action to a function in your bean that return a String.

*The String returned need to be the navigation path to the page you want to be redirected.

*If the validation is wrong on button click, then simply return null and it will stay on same page.

*Make sure you define the proper navigation rule in faces-config.xml

See this tutorial for how to configure navigation rules.
See Primefaces commandButton doc for info on action tag.


text:
Q: Why my pyspark udf function will return None for me ? My data have some None after join, so I want to fill them with vector. For example, my data are like
id  value
1   [1,2,3,4,5]
2   Null
3   [1,2,3,4,5]
4   [1,2,3,4,5]
5   [1,2,3,4,5]

and my udf function is
def fillVec_5(y):
    if y:
        return y
    else:
        return Vectors.dense([0 for i in range(5)])
getVector_5 = udf(lambda y: fillVec_5(y),VectorUDT())
df = df.withColumn('value',getVector_5(col('value'))
df.show(5,False)

But I will get error:
  File "/opt/cloudera/parcels/CDH-5.11.2-1.cdh5.11.2.p0.4/lib/spark/python/lib/pyspark.zip/pyspark/worker.py", line 111, in main
    process()
  File "/opt/cloudera/parcels/CDH-5.11.2-1.cdh5.11.2.p0.4/lib/spark/python/lib/pyspark.zip/pyspark/worker.py", line 106, in process
    serializer.dump_stream(func(split_index, iterator), outfile)
  File "/opt/cloudera/parcels/CDH-5.11.2-1.cdh5.11.2.p0.4/lib/spark/python/lib/pyspark.zip/pyspark/serializers.py", line 263, in dump_stream
    vs = list(itertools.islice(iterator, batch))
  File "/opt/cloudera/parcels/CDH-5.11.2-1.cdh5.11.2.p0.4/lib/spark/python/lib/pyspark.zip/pyspark/serializers.py", line 139, in load_stream
    yield self._read_with_length(stream)
  File "/opt/cloudera/parcels/CDH-5.11.2-1.cdh5.11.2.p0.4/lib/spark/python/lib/pyspark.zip/pyspark/serializers.py", line 164, in _read_with_length
    return self.loads(obj)
  File "/opt/cloudera/parcels/CDH-5.11.2-1.cdh5.11.2.p0.4/lib/spark/python/lib/pyspark.zip/pyspark/serializers.py", line 442, in loads
    return pickle.loads(obj)
  File "/opt/cloudera/parcels/CDH-5.11.2-1.cdh5.11.2.p0.4/lib/spark/python/lib/pyspark.zip/pyspark/sql/types.py", line 1159, in <lambda>
    return lambda *a: dataType.fromInternal(a)
  File "/opt/cloudera/parcels/CDH-5.11.2-1.cdh5.11.2.p0.4/lib/spark/python/lib/pyspark.zip/pyspark/sql/types.py", line 565, in fromInternal
    values = [f.fromInternal(v) for f, v in zip(self.fields, obj)]
  File "/opt/cloudera/parcels/CDH-5.11.2-1.cdh5.11.2.p0.4/lib/spark/python/lib/pyspark.zip/pyspark/sql/types.py", line 438, in fromInternal
    return self.dataType.fromInternal(obj)
  File "/opt/cloudera/parcels/CDH-5.11.2-1.cdh5.11.2.p0.4/lib/spark/python/lib/pyspark.zip/pyspark/sql/types.py", line 619, in fromInternal
    return self.deserialize(self._cachedSqlType().fromInternal(obj))
  File "/opt/cloudera/parcels/CDH-5.11.2-1.cdh5.11.2.p0.4/lib/spark/python/lib/pyspark.zip/pyspark/mllib/linalg/__init__.py", line 166, in deserialize
    assert len(datum) == 4, \
TypeError: ("object of type 'NoneType' has no len()", <function <lambda> at 0x1dba938>, (None,))

I do not understand why my udf function will return None for me , please help me~


text:
Q: Forms bound to updateable ADO recordsets are not updateable when the source includes a JOIN I'm developing an application in Access 2007.  It uses an .accdb front end connecting to an SQL Server 2005 backend. I use forms that are bound to ADO recordsets at runtime.  For the sake of efficiency, the recordsets usually contain only one record, and are queried out on the server:
Public Sub SetUpFormRecordset(cn As ADODB.Connection, rstIn As ADODB.Recordset,      rstSource As String)
Dim cmd As ADODB.Command
Dim I As Long

Set cmd = New ADODB.Command

cn.Errors.Clear

'   Recordsets based on command object Execute method are Read Only!

With cmd
    Set .ActiveConnection = cn
    .CommandType = adCmdText
    .CommandText = rstSource
End With

With rstIn
    .CursorType = adOpenKeyset
    .LockType = adLockPessimistic                           'Check the locktype after   opening; optimistic locking is worthless on a bound
End With                                                    ' form, and ADO might open optimistically without firing an error!

rstIn.Open cmd, , adOpenKeyset, adLockPessimistic           'This should run the query on the server and return an updatable recordset

With cn
    If .Errors.Count <> 0 Then
        For Each errADO In .Errors
            Call HandleADOErrors(.Errors(I))
            I = I + 1
        Next errADO
    End If
End With
End Sub

rstSource (the string containg the TSQL on which the recordset is based) is assembled by the calling routine, in this case from the Open event of the form being bound:
Private Sub Form_Open(Cancel As Integer)
Dim rst As ADODB.Recordset
Dim strSource As String, DefaultSource as String
Dim lngID As Long

lngID = Forms!MyParent.CurrentID

strSource = "SELECT TOP (100) PERCENT dbo.Customers.CustomerID,   dbo.Customers.LegacyID,  dbo.Customers.Active, dbo.Customers.TypeID, dbo.Customers.Category, " & _
"dbo.Customers.Source, dbo.Customers.CustomerName, dbo.Customers.CustAddrID, dbo.Customers.Email, dbo.Customers.TaxExempt, dbo.Customers.SalesTaxCode, " & _
"dbo.Customers.SalesTax2Code, dbo.Customers.CreditLimit, dbo.Customers.CreationDate, dbo.Customers.FirstOrder, dbo.Customers.LastOrder, " & _
"dbo.Customers.nOrders, dbo.Customers.Concurrency, dbo.Customers.LegacyLN, dbo.Addresses.AddrType, dbo.Addresses.AddrLine1, dbo.Addresses.AddrLine2, " & _
"dbo.Addresses.City, dbo.Addresses.State, dbo.Addresses.Country, dbo.Addresses.PostalCode, dbo.Addresses.PhoneLandline, dbo.Addresses.Concurrency " & _
"FROM dbo.Customers INNER JOIN " & _
"dbo.Addresses ON dbo.Customers.CustAddrID = dbo.Addresses.AddrID "
strSource = strSource & "WHERE dbo.Customers.CustomerID= " & lngID

With Me                             'Default is Set up for editing one record
    If Not Nz(.RecordSource, vbNullString) = vbNullString Then
        If .Dirty Then .Dirty = False   'Save any changes on the form
        .RecordSource = vbNullString
    End If

    If rst Is Nothing Then          'Might not be first time through
        DefaultSource = .RecordSource
    Else
        rst.Close
        Set rst = Nothing
    End If
End With

Set rst = New ADODB.Recordset
Call setupformrecordset(dbconn, rst, strSource)    'dbconn is a global variable

With Me
    Set .Recordset = rst
End With

End Sub

The recordset that is returned from setupformrecordset is fully updateable, and its .Supports property shows this.  It can be edited and updated in code.
The entire form, however, is read only, even though it's .AllowEdits and .AllowAdditions properties are both true. Even the fields from the right hand side (the 'many' side) cannot be edited.
Removing the INNER JOIN clause from the TSQL (restricting strSource to one table) makes the form fully editable.
I've verified that the TSQL includes priimary key fields from both tables, and each table includes a timestamp field for concurrency.
I tried changing the .CursorType and .CursorLocation properties of the recordset to no avail.
What am I doing wrong?

A: I think you want to set the Unique Table dynamic property on the recordset.

A: A work-around that I've found is to use an 'IN' clause.  For example:
SELECT  c.*
FROM    CATEGORY        c
WHERE   c.category_id IN (
            SELECT  p.category_id
            FROM    PRODUCT     p
            JOIN    CUST_ORDER  o   ON o.product_id = p.product_id
            WHERE   p.product_type  = 'Widget'
            AND     o.units         > 50
        )

Obviously, the hard-coded values can be passed into the subroutine (and bind variables utilized).  The important thing to note is that the IN clause can have any number of joins and the Resultset will still be updatable.
If you need fields from more than one table, you could try creating a database view and/or using DLookup().


text:
Q: Помогите, пожалуйста, исправить ошибку на Pascal Задание: Описать функцию, возвращающую количество перемен знака в вещественном векторе длины 20. Использовать эту функцию для нахождения всех номеров строк с максимальным числом перемен знака в заданных вещественных матрицах А и B размерностью 10х20 и 20х20 соответственно.
Мой код-решение:
program SignChanges;

const
  arr_size = 20;

type
  arr = array[1..arr_size] of Real;

// Функция, возвращающая количество перемен знака в вещественном векторе
function countSignChanges(a: arr): Integer;
var
  i, count: Integer;
begin
  count := 0;
  for i := 1 to arr_size - 1 do
  begin
    if ((a[i] > 0) and (a[i + 1] < 0)) or ((a[i] < 0) and (a[i + 1] > 0)) then
      count:= count + 1;
  end;
  Result := count;
end;

var
  A: array[1..10, 1..20] of Real;
  B: array[1..20, 1..20] of Real;
  i, j, maxChanges, changes: Integer;

begin
  // Инициализируем матрицы А и B с помощью циклов
  for i := 1 to 10 do
    for j := 1 to 20 do
      A[i, j] := i * j; // пример инициализации элементов матрицы А

  for i := 1 to 20 do
    for j := 1 to 20 do
      B[i, j] := i * j; // пример инициализации элементов матрицы B

  // Выводим матрицы на экран
  WriteLn('Матрица А:');
  for i := 1 to 10 do
  begin
    for j := 1 to 20 do
      Write(A[i, j]:5:2, ' ');
    WriteLn;
  end;

  WriteLn;

  WriteLn('Матрица B:');
  for i := 1 to 20 do
  begin
    for j := 1 to 20 do
      Write(B[i, j]:5:2, ' ');
    WriteLn;
  end;

  // Находим все номера строк с максимальным числом перемен знака
  maxChanges := 0;
  for i := 1 to 10 do
  begin
    changes := countSignChanges(A[i]);
    if changes > maxChanges then
    begin
      maxChanges := changes;
      WriteLn('Строка ', i, ', в матрице A максимальное кол-во смен знака: ', maxChanges);
    end;
  end;

  for i := 1 to 20 do
  begin
    changes := countSignChanges(B[i]);
    if changes > maxChanges then
    begin
      maxChanges := changes;
      WriteLn('Строка ', i, ', в матрице B максимальное кол-во смен знака: ', maxChanges);
    end;
  end;
end.

Выдаёт ошибку: "Program1.pas(62) : Нельзя преобразовать тип real к array [1..20] of real". Надеюсь, что больше ошибок нет. Помогите, пожалуйста, ее исправить!

A: // PascalАВС.NЕТ 3.8.3
function countSignChanges(a: array of real) :=
  a.PairWise.Count(\(x, y) -> x * y < 0);

begin
  var a := new real[10, 20];
  var b := new real[20, 20];
  for var i := 0 to a.RowCount - 1 do
    for var j := 0 to a.ColCount - 1 do
      a[i, j] := Round(Random(-9.0, 9.0), 1);
  a.Println(5,1);
  var c := a.Rows.Select(row -> countSignChanges(row)).ToArray;
  var mx := c.Max;
  Print('Максимальное количество перемен знака в строках:');
  c.Numerate.Where(\(i, v) -> v = mx).Select(\(i, v) -> i).Println;
  Writeln;
  for var i := 0 to b.RowCount - 1 do
    for var j := 0 to b.ColCount - 1 do
      b[i, j] := Round(Random(-9.0, 9.0), 1);
  b.Println(5,1);
  c := b.Rows.Select(row -> countSignChanges(row)).ToArray;
  mx := c.Max;
  Print('Максимальное количество перемен знака в строках:');
  c.Numerate.Where(\(i, v) -> v = mx).Select(\(i, v) -> i).Print
end.


text:
Q: How to check value is null or blank in sails js How can I check value is null or blank in sails using waterline. I can do this with mysql native query but due to some reason I don't want to use it.
I have tried something like below code but it's not working.
var query = {
    Status: [1, 2, 3],
    Date: [null, '']
};
table.count(query).exec(function (err, count) {
    if (err) {
        return res.badRequest(err);
    }
    return res.send(count);
});

Any help would be appreciated.

A: You have to use or query
var query = {
    Status : [1, 2, 3],
    or     : [
      { Date : null },
      { Date : '' },
    ],
};


text:
Q: udevadm to retrieve device attribute OS: Ubuntu 16.04
Ethernet chip: Intel I210
Ethernet driver: igb
I've looked into my etherent device attribute.
By typing the command
udevadm info -p -a /sys/class/net/eth0

I got the following information:
looking at device '/devices/pci0000:00/0000:00:1c.2/0000:02:00.0/net/eth0':
    KERNEL=="eth0"
    SUBSYSTEM=="net"
    DRIVER==""
    ATTR{mtu}=="1500"
    ATTR{type}=="1"
    ATTR{netdev_group}=="0"
    ATTR{flags}=="0x1003"
    ATTR{speed}=="1000"
    ATTR{dormant}=="0"
    ATTR{addr_assign_type}=="0"
    ATTR{dev_id}=="0x0"
    ATTR{duplex}=="full"
    ATTR{gro_flush_timeout}=="0"
    ATTR{iflink}=="2"
    ATTR{addr_len}=="6"
    ATTR{address}=="0c:c4:7a:12:b4:e4"
    ATTR{operstate}=="up"
    ATTR{carrier_changes}=="2"
    ATTR{broadcast}=="ff:ff:ff:ff:ff:ff"
    ATTR{tx_queue_len}=="1000"
    ATTR{dev_port}=="0"
    ATTR{ifalias}==""
    ATTR{ifindex}=="2"
    ATTR{link_mode}=="0"
    ATTR{carrier}=="1"

  looking at parent device '/devices/pci0000:00/0000:00:1c.2/0000:02:00.0':
    KERNELS=="0000:02:00.0"
    SUBSYSTEMS=="pci"
    DRIVERS=="igb"
    ATTRS{irq}=="18"
    ATTRS{subsystem_vendor}=="0x15d9"
    ATTRS{broken_parity_status}=="0"
    ATTRS{class}=="0x020000"
    ATTRS{index}=="1"
    ATTRS{label}==" Intel Ethernet controller#1 i210"
    ATTRS{driver_override}=="(null)"
    ATTRS{consistent_dma_mask_bits}=="64"
    ATTRS{dma_mask_bits}=="64"
    ATTRS{local_cpus}=="00000000,00000000,00000000,00000000,00000000,00000000,00000000,0000000f"
    ATTRS{device}=="0x1533"
    ATTRS{enable}=="1"
    ATTRS{msi_bus}=="1"
    ATTRS{local_cpulist}=="0-3"
    ATTRS{vendor}=="0x8086"
    ATTRS{subsystem_device}=="0x1533"
    ATTRS{numa_node}=="-1"
    ATTRS{d3cold_allowed}=="1"

Some questions below:

*

*what is the relationship between "device" and "parent device"

*Are these attributes retrieved from firmware ( on device ) or BIOS or driver ?

*Is it possible to modify the attribute value ?

I ask this is because as you may know, Ubuntu 15.10 and newer version has taken the rule of predictable network interface names. For the onboard device, it will be recognized as "enox" and x means its index.
Unfortunately, on my host, my two ethernets have the same index and this causes the race condition. If I did not revert back to the original network interface naming rule, the boot is gonna take about 4 mins.
I suspect it's the firmware issue.


text:
Q: What is the kernel width of the gdalwarp resampling methods? gdalwarp provides 7 resampling methods.
How many neighborhood pixels do contribute to upsampling respectively downsampling?
I will try to guess. Please correct, if values are wrong:

*

*Upsampling:

*

*near: 1

*bilinear: 4 (one time around my new resampled pixel)

*cubic: 4 + 12 (two times around my new resampled pixel)

*cubicspline: 4 + 12

*lanczos: 4 + 12

*average: 4 + 12

*mode: 4 + 12

*Downsampling:

*

*near: 1

*bilinear: ?

*cubic: ?

*cubicspline: ?

*lanczos: ?

*average: ?

*mode: ?

Downsampling is different, then upsampling. A clever downsampling algorithm would use a bigger Kernel width, if downsampling factor is bigger then 2.


text:
Q: Kubuntu 12.04 keyboard + mouse do not respond I just installed Kubuntu 12.04 amd-64. When I login the mouse, moves but the clicks appear to be random (some are accepted and some are not) and the same happens with the keystrokes. This makes the system utterly unusable.
The strange things is that I'm writing this from the live USB from which I installed the system and both work just fine.
I should mention I had issues getting the system to boot-up after installation due to my board's UEFI. I got around that by starting the live USB in not-UEFI mode.
EDIT: I gave up and installed Ubuntu 12.04.

A: I had the same problem and managed to fix it by reinstalling the OS (64-bit), but this time without installing third party software and downloading updates. I then installed the the graphics driver (NVIDIA) under Systems and Muon to update the system.


text:
Q: Using Nuget on VS2015 RC Tools for Apache Cordova Bit of a newbie to VS2015RC with Cordova but I have a query regarding how to use Nuget to add dependencies like say Jquery, Angular etc.
If you add the dependencies or packages using Nuget then they are added to the root of the Project (Not in the www folder). Of course you can just move the files but this plays havoc with some of the Source Control we are using and also you have to remember to move it back again to the root if you want to "Upgrade" the dependency or package with Nuget again.
So....

*

*Is there a way of getting Nuget to install the files in the correct
sub-folder? or...

*Is there another way to add the dependencies /
packages (Npm etc?) and is there a tutorial around for that?

Thanks in advance for the help.

A: The way I understood it, the directory structure was changed in the RC. I chalked the wrong directory up to the nuget configs not being updated yet. I expect the gold release to have that fixed.


text:
Q: Local machine env vars not passed to vscode dev container Problem:
When I spin up a vscode dev container that uses a docker compose file, the desired env vars set within my local machine are not passed to the dev container even though the associated docker-compose.yml and devcontainer.json files are allowing the local env vars to be passed.
Here are the relevant files:
devcontainer.json
{
  "remoteEnv": {
      "MYVAR": "${localEnv:MYVAR}"
  },
  "containerEnv": {
    "MYVAR": "${localEnv:MYVAR}"
  },
  "customizations": {
    "vscode": {
      "extensions": [
        "ms-python.python",
        "ms-python.vscode-pylance"
      ],
      "settings": {
        "#terminal.integrated.defaultProfile.linux#": "/bin/bash",
        "python.defaultInterpreterPath": "/usr/local/bin/python",
        "python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
        "python.formatting.blackPath": "/usr/local/py-utils/bin/black",
        "python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
        "python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
        "python.linting.enabled": true,
        "python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",
        "python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
        "python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
        "python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
        "python.linting.pylintEnabled": true,
        "python.linting.pylintPath": "/usr/local/py-utils/bin/pylint"
      }
    }
  },
  "dockerComposeFile": "docker-compose.yml",
  "features": {
    "ghcr.io/devcontainers/features/docker-from-docker:1": {
      "version": "latest"
    },
    "ghcr.io/devcontainers/features/github-cli:1": {
      "version": "latest"
    }
  },
  "name": "Development",
  "service": "dev",
  "shutdownAction": "stopCompose",
  "workspaceFolder": "/workspace"
}

docker-compose.yml
There are other services within the docker-compose.yml file but for the sake of simplicity, they have been removed.
version: '3.8'
services:
  dev:
    image: python:3.9-slim-buster
    container_name: dev
    volumes:
    - /usr/bin/docker:/usr/bin/docker
    - /var/run/docker.sock:/var/run/docker.sock
    - ../:/workspace
    entrypoint: [/bin/bash, ./.devcontainer/entrypoint.sh]
    command: sleep infinity
    environment:
    - MYVAR=${MYVAR}
    networks:
      custom_network:

networks:
  custom_network:
    name: custom_network
    driver: bridge
    ipam:
      driver: default

entrypoint.sh
(contains only relevant code)
#!/bin/bash

exec "$@"

Steps

*

*export env var to local machine via vscode terminal: export MYVAR=foo

*Run the vscode extension: Dev Containers: Rebuild and Reopen in Container

*Within dev container shell, echo $MYVAR results are empty

Attempts:

*

*Remove remoteEnv and containerEnv from devcontainer.json - same results

*Check Terminal > Integrated: Inherit Env is checked as mentioned on vscode page

*Remove the stopped dev container from the previous attempt before performing the steps mentioned above - same results


text:
Q: ComputerInfo.TotalVirtualMemory is not correct I have a question about the property TotalVirtualMemory in the VB class ComputerInfo. I have checked this property from code on several different computers and the number is always 2047 MB. This is strange because I know for a fact that the virtual memory on these computers differ (~1GB, ~2GB and ~3.5GB). Does anyone know why it is like this and is there any other way to get the total and available virtual memory?
Best regards
Daniel

A: You can use WMI to get memory information:
ManagementObjectSearcher mgmtObjects = new ManagementObjectSearcher("Select * from Win32_OperatingSystem");

    foreach (var item in mgmtObjects.Get())
    {
        Console.WriteLine("FreeVirtualMemory:" + item.Properties["FreeVirtualMemory"].Value);
        Console.WriteLine("TotalVirtualMemorySize:" + item.Properties["TotalVirtualMemorySize"].Value);
    }

A: This might be a case where WMI will provide the correct information for you. Have a browse around the avaliable objects using Scriptomatic, the Win32_PageFile object might contain what you are after.
Edit: It's Win32_OperatingSystem, not Win32_ComputerSystem, but otherwise Tom Frey's code is correct.

A: TotalVirtualMemory does not return the amount of virtual memory on the computer.  Rather, it returns the virtual address space available to the program.
This will almost always be 2GB, which is the amount of address space allocated to an operating program by windows (at least by win32).  For more information on Virtual Address Space, you can check out "Advanced Windows" by Jeffrey Richter, which goes into far more detail.
To get this information, you can add a reference to System.Management.dll and run this
System.Management.ManagementObject logicalMemory = new
     System.Management.ManagementObject("Win32_LogicalMemoryConfiguration.Name=\"LogicalMemoryConfiguration\"");

Console.WriteLine("Total virtual memory: {0}",logicalMemory["TotalVirtualMemory"].ToString());

On my work system, this outputs 2809756.
This object also supports these properties
  uint32 AvailableVirtualMemory;  //in Kb
  string Caption;
  string Description;
  string Name;                    //NO LONGER SUPPORTED
  string SettingID;
  uint32 TotalPageFileSpace;      //in Kb
  uint32 TotalPhysicalMemory;     //in Kb
  uint32 TotalVirtualMemory;      //in Kb

I hope this helps.

A: I'm not sure, but it probably tops to the maximum memory that a 32-bit program can allocate (2GB). Have you tried to test it on a 64-bit machine?


text:
Q: How do I formulate find() based on multiple _ids? I am trying retrieve two objects based on their two Object _ids.
As demonstrated in the code below, my Session.get(); function retrieves the two _id, that I use in my query.
 var selectedID = Session.get('selectedItemIDSet');
 selectedID = selectedID.toString();
 selectedID = selectedID.split(",");

 alert(selectedID);

The alert above pops out two _ids : LZJKA8S3wYNwHakzE, ikrbCDuttHrwkEcuv
 console.log("selectedID is: ",...selectedID);

The above console() function also yeilds:
selectedID is:  LZJKA8S3wYNwHakzE  ikrbCDuttHrwkEcuv
 buyList.find({_id:{ "$in": selectedID} }).fetch();

The query above only returns One object, namely Object with _id: "LZJKA8S3wYNwHakzE" and not TWO Objects which would be the expected results.
Just to clarify, the expected result should be TWO Objects with _ids: LZJKA8S3wYNwHakzE, ikrbCDuttHrwkEcuv
Kindly point out what I am doing wrong here?