text:
Q: Suppress item numbers specifically in `enumerate` environment as modified by the package `enumitem` I'm trying to create a list or listlike structure that has the following characteristics:

*

*no extra vertical space between items

*no leading line numbers

*"looking nice" when surrounded by \begin{multicols}{2}... \end{multicols}.

*having no global or as few global effects on the document as possible.

It might be correct to use ordinary lines instead of a list, but I'm thinking of this region of text as a list semantically and I'd like to surface that in the structure of the LaTeX document.
The closest attempt at a solution that I've found (cobbled together from the TeX SE answers in 1001) is:
% horrible hack!
\renewcommand{\theenumi}{}

\newenvironment{minimal_enumerate}%
{%
    \begin{enumerate}[noitemsep]%
    \setlength{\topsep}{0pt}%
    \setlength{\itemsep}{-1ex}%
    \setlength{\partopsep}{1ex}%
    \setlength{\parsep}{1ex}%
}%
{%
    \end{enumerate}%
}%

Where blasting away \theenumi globally prevents the numbers 1, 2, 3 &c from being expressed, but still leaves a period that separates the would-be number from the list item.
Is there a way to modify the above definition so as to prevent the expression of list numbers or periods in front of items without global effects on the document?
Ideally, is it possible to define an environment based on enumerate when the package enumitem is loaded and the package enumerate is not loaded?

Here are some false starts I've had with other paths to a minimal list.
short_itemize is based on this answer.
\newenvironment{short_itemize}%
{%
    \begin{itemize}%
    \setlength{\itemsep}{0pt}%
    \setlength{\parskip}{0pt}%
    \setlength{\parsep}{0pt}%
}%
{%
    \end{itemize}%
}%

I can't figure out how to remove the bullets.
The other thing I've tried is just using description as in this answer.
But I can't figure out how to reduce the amount of spacing between items in the description without touching global configuration settings.

1001 -- consulted answers that appear to suggest enumerate as modified by the package enumitem.

*

*https://tex.stackexchange.com/a/10689

*https://tex.stackexchange.com/a/430559

*https://tex.stackexchange.com/a/119935


text:
Q: How can I use external types in Cython class? I am converting a vanilla python to cython to speed up the performance. I need to define a class PFR with an attribute gas. The type of gas is Solution which is a type from an external library called cantera (written in C++ with a python interface created using Cython).
# distutils: language=c++
cimport cantera as ct

cdef class PFR:
    cdef public ct.Solution gas;
    def __init__(self):
        self.gas = None;

    def set_gas(self, gas):
        self.gas = gas

When I complie the code I get this error:
    Error compiling Cython file:
------------------------------------------------------------
...
# distutils: language=c++
cimport cantera as ct

cdef class PFR:
    cdef public ct.Solution gas;
               ^
------------------------------------------------------------

C:\Users\[****]\.ipython\cython\_cython_magic_d7002e8c4a676e8ba0827e69fe89ba2a.pyx:5:16: 'Solution' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
# distutils: language=c++
cimport cantera as ct

cdef class PFR:
    cdef public ct.Solution gas;
                           ^
------------------------------------------------------------

C:\Users\[****]\.ipython\cython\_cython_magic_d7002e8c4a676e8ba0827e69fe89ba2a.pyx:5:28: C attribute of type '<error>' cannot be accessed from Python

I found a trick to make the code work. I declare gas initially as a object instead of ct.Solution
# distutils: language=c++
import cantera as ct

cdef class PFR:
    cdef public object gas;
    def __init__(self):
        self.gas = None;

    def set_gas(self, gas):
        self.gas = gas;

    def set_TP(self, T, P):
        self.gas.TP = T, P

This works fine without any errors. I can create a gas object, connect it to an instance of PFR using the gas attribute and modify it using set.TP(T,P) method.
But, I am not sure if this approach is correct because I do not understand what is happening under the hood. Could this cause performance errors when I expand the class or create multiple instances of PFR?

redpajama_set_name: RedPajamaStackExchange


text:
Q: Converting h5 to tflite I have been trying to get this zero-shot text classification joeddav / xlm-roberta-large-xnli to convert from h5 to tflite file (https://huggingface.co/joeddav/xlm-roberta-large-xnli), but this error pops up and I cant find it described online, how is it fixed? If it can't, is there another zero-shot text classifier I can use that would produce similar accuracy even after becoming tflite?
AttributeError: 'T5ForConditionalGeneration' object has no attribute 'call'

I have been trying a few different tutorials and the current google colab file I have is an amalgam of a couple of them. https://colab.research.google.com/drive/1sYQJqvhM_KEvMt2IP15d8Ud9L-ApiYv6?usp=sharing

A: [ Convert TFLite from saved .h5 model to TFLite model ]
Conversion using tflite convert there are multiple ways by

*

*TF-Lite Convertor TF-Lite convertor

*TF.Lite.TFLiteConverter OR else

From the provided links currently they try to convert from saved model .h5 to TFLite, to confirm their question.
[ Sample ]:
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
: Model Initialize
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
model = tf.keras.models.Sequential([
    tf.keras.layers.InputLayer(input_shape=( 32, 32, 3 )),
    tf.keras.layers.Dense(128, activation='relu'),
])
model.compile(optimizer='sgd', loss='mean_squared_error') # compile the model
model.summary()

model.save_weights(checkpoint_path)

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
: FileWriter
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if exists(checkpoint_path) :
    model.load_weights(checkpoint_path)
    print("model load: " + checkpoint_path)

tf_lite_model_converter = tf.lite.TFLiteConverter.from_keras_model(
    model
) # <tensorflow.lite.python.lite.TFLiteKerasModelConverterV2 object at 0x0000021095194E80>
tflite_model = tf_lite_model_converter.convert()

# Save the model.
with open(checkpoint_dir + '\\model.tflite', 'wb') as f:
    f.write(tflite_model)


text:
Q: jQuery validation has stopped working Here's the form that was formerly working. I just went back to it today and for some weird reason, it stopped validating.
Would appreciate if anyone could take a look. Thank you.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

          <title>Simple Form Validation</title>

            <form id="form1" method="post" action="">

Name *<input type="text" name="name" />

E-Mail *<input type="text" name="email" />

URL<input type="text" name="url" />

Your comment *<textarea name="comment" ></textarea>

<input class="submit" type="submit" value="Submit">

            </form>

A: It looks like it works to me.
http://jsfiddle.net/fYgXD/


text:
Q: Finding duplicate numbers in a list and making them unique I'm trying to implement a Genetic Algorithm and need this for my crossover function. What I need to figure out is the following.
If I have the list
[0, 1, 6, 7, 5, 4, 3, 2, 1]

it has duplicate elements. I want to end up with the list
[0, 8, 6, 7, 5, 4, 3, 2, 1]

The reason I end up with this list is that I look at each element from left to right. And I see at index 1, there's the number '1' which also exists in the list. Therefore I change it to an element not in the list. The smallest element in the list is 0 and largest element is len(list) -1.
In this case the order of the list is important. Therefore, I do not think converting it to a set would be appropriate. I do not want to lose the order of the elements. I am just changing elements that are repeated in the list already.
Another example would be
[0, 1, 2, 7, 3, 4, 3, 2, 1]

Would become
[0, 5, 6, 7, 8, 4, 3, 2, 1]

So what happened here was I saw the number 1 at index 1, and realized that from the range of 0 to 8, I am missing the number 5. So 1 got replaced with 5. Similarly I did that for index 2, which I replaced with 6. Lastly I did this for index 4, which was originally a 3 but got replaced with an 8 because it's a duplicate.
What I was thinking was incrementing the duplicate number, then checking if its a duplicate, and repeating until every element in the list was unique. However, I can't think of a way to do this.

A: So unless I am mistaken there is no real methodology behind the number you are picking to replace, simply one you see as missing. If that is the case then this produces the desired result.
l = [0, 1, 2, 7, 3, 4, 3, 2, 1]
missing = [n for n in range(len(l)) if n not in set(l)]

for num in l:
    if l.count(num) > 1:
        ix = l.index(num)
        try:
            l[ix] = missing.pop(0)
        except IndexError:
            break

print l
>>[0, 5, 6, 7, 8, 4, 3, 2, 1]

A: UPDATE: This is possible with more_itertools.locate, which finds indices given a condition.
import itertools as it
import collections as ct

from more_itertools import locate

def replace_repeated(lst):
    """Return a list of unique values with a range ~ list size."""

    def excluded_indices():
        """Yield indices of all but the index of the last repeated element."""
        for i, n in repeated.items():
            yield from it.islice(locate(lst, pred=lambda x: x == i), 0, n-1)

    repeated = {k:v for k, v in ct.Counter(lst).items() if v > 1}
    missing = (i for i, _ in enumerate(lst) if i not in set(lst))
    for i in excluded_indices():
        lst[i] = next(missing)
    return lst

Steps

*

*Find the value (k) and frequency (v) of all repeated elements in lst.

*Find all missing numbers within a range proportional to the size of lst.

*Find excluded_indices - indices of repeated elements (except the final occurrence of each repeated value).

*For each excluded index, overwrite the element in lst with the next missing number.

Tests
import nose.tools as nt

def test_repeated(f):
    """Verify repeated terms are replaced with values."""
    nt.eq_(f([0, 1, 6, 7, 5, 4, 3, 2, 1]),              # given
             [0, 8, 6, 7, 5, 4, 3, 2, 1])
    nt.eq_(f([0, 1, 2, 7, 3, 4, 3, 2, 1]),              # given
             [0, 5, 6, 7, 8, 4, 3, 2, 1])
    nt.eq_(f([0, 1, 6, 7, 1, 4, 1, 2, 1]),              # multiples (not only duplicates)
             [0, 3, 6, 7, 5, 4, 8, 2, 1])
    nt.eq_(f([0, 1, 6, 2, 5, 3, 3, 2, 1]),              # multiples of any element
             [0, 4, 6, 7, 5, 8, 3, 2, 1])

test_repeated(f=replace_repeated)

Optionally, here is the code for locate, which can be implemented directly and obviate pip installation if desired:
def locate(iterable, pred=bool):
    return it.compress(it.count(), map(pred, iterable))

A: You need to do this in two stages (or let something else do it for you in two stages) - first find what values are missing, and then go through your list replacing the duplicates with the missing values. Something like:
def normalize_list(data):
    # data = list(data)  # uncomment if you don't want to modify the source list
    # use xrange() instead of range() on Python 2.x
    missing_keys = [i for i in range(len(data)-1, -1, -1) if i not in set(data)]
    for index, value in enumerate(data):
        try:
            if data.index(value, index+1):
                data[index] = missing_keys.pop()
        except ValueError:
            pass
    return data

print(normalize_list([0, 1, 6, 7, 5, 4, 3, 2, 1]))
# prints: [0, 8, 6, 7, 5, 4, 3, 2, 1]
print(normalize_list([0, 1, 2, 7, 3, 4, 3, 2, 1]))
# prints: [0, 5, 6, 7, 8, 4, 3, 2, 1]

This should work on a list of any size.
UPDATE
Considering the slowness of list.index(), here's a version without it - it looks counter-intuitive (one more loop) but it's nearly 4 times faster (and the longer the list is, the faster it is relative to the first example) with a slightly more memory use:
def normalize_list(data):
    # data = list(data)  # uncomment if you don't want to modify the source list
    key_lookup = dict.fromkeys(data, -1)
    # use xrange() instead of range() on Python 2.x
    missing_keys = [i for i in range(len(data)-1, -1, -1) if i not in key_lookup]
    for i in data:
        key_lookup[i] += 1
    for index, value in enumerate(data):
        try:
            if key_lookup[value]:
                data[index] = missing_keys.pop()
                key_lookup[value] -= 1
        except ValueError:
            pass
    return data

A: Here is another approach:

*

*Compute a dictionary storing the last index of occurrence for each unique value in the list.

*Create a generator of missing values.

*Use a list comprehension to replace all but the last value for each unique element of your list.

e.g.
xs = [0, 1, 6, 7, 5, 4, 3, 2, 1]
fixed  = {x: i for i, x in enumerate(xs)}
spares = iter(x for x in range(len(xs)) if x not in fixed)
res    = [x if i == fixed[x] else next(spares)
            for i, x in enumerate(xs)]

A: def returnModifiedList(x):

 #find indices where there is a repeat
 storage=[]; indices = []
 for i in range(len(x)-1,-1,-1):
     if x[i] in storage:
         indices.append(i)
     else:
         storage.append(x[i])

 #find values that are missing
 s = sorted(list(set(x)))
 missing = list(reversed([i for i in range(len(x)) if (i not in s)]))

 #fill in repeats with missing values
 for i in range(len(indices)):
     x[indices[i]] = missing[i]

 return x

x = [0, 1, 2, 7, 3, 4, 3, 2, 1]
results = returnModifiedList(x)
print results


text:
Q: Data from MatDialogConfig to MatDialog I have this FirstModalComponent that opens a ModalNewComponent. In the opened modal (ModalNewComponent), I have a save button that I need it to:

*

*Pass an array let's say this.array to FirstModalComponent

*Pass flag toSave = true, so I can do things in the parent based on this flag

I've seen something about when closing the ModalNewComponent to pass information in the close method, but how do I get that info back in FirstModalComponent since close is called on the html of ModalNewComponent and not in it's parent?
basically, how do I get the data from ModalNewComponent into FirstModalComponent? Thanks.
This is from FirstModalComponent:
dialogConfig = new MatDialogConfig();

constructor(public matDialog: MatDialog) { }

openModal(id: string) {
    this.dialogConfig.data = {
      initPage: (id == "open-search-modal") ? 'open' : 'new'
    };

    // Closes itself
    this.matDialog.closeAll();

    // Opens the modal ModalNewComponent
    const modalDialog = this.matDialog.open(ModalnewComponent, this.dialogConfig);
    }

This is from ModalNewComponent:
constructor(
   public dialogRef: MatDialogRef<ModalnewComponent>,
   @Inject(MAT_DIALOG_DATA) data: any) {
   this.initPage = data.initPage;
 }

async save() {
    this.toSave = true;
    this.array = [1,2,3];
 }

 closeModal() {
   this.dialogRef.close();
 }

A: In your ModalNewComponent component, when closing the modal, you could send the desired data to be passed into your FirstModalComponent, for example:
closeModal() {
   this.dialogRef.close({
     save: this.toSave,
     theData: 'This is the data I want to pass around'
   });
}

Then in your FirstModalComponent component, you need to subscribe to matDialog to get the data back from ModalNewComponent when closes
this.matDialog
 .open(ModalnewComponent, this.dialogConfig)
 .afterClosed()
 .subscribe((response) => {
    if (response.save) {
       // do something with response theData
       console.log('the Data:', response.theData);
    }
 })


text:
Q: Change Default Starting Domain For .NET Website Project I have a Website project that I'm trying to debug using Fiddler.  Fiddler doesn't track traffic from localhost, so I created another alias in my hosts file to use instead of localhost.  Now I would like to have my project use the fiddler.local.com instead of localhost when I run my project.  Is there a way to do this?
i.e. http://fiddler.local.com:1100/photoTest/default.aspx vs. http://localhost:1100/photoTest/default.aspx

A: Fiddler will track traffic from localhost, just use http://localhost./yoursite/default.aspx
Other than that, you right click on the website project in your solution, then select properties. The properties page will then appear, so select the web tab on the left hand side. There you will see an option to use IIS when debugging, which, when selected will enable you to set the url to use.

A: See http://www.fiddler2.com/Fiddler/help/hookup.asp#Q-LocalTraffic.


text:
Q: How to ssh from one ec2 instance to another? I have created two EC2 instances on AWS. I created a key pair for each of them. I downloaded the .pem private keys and converted them into .ppk format. I can connect to each of my ec2 instances using PuTTY and their .ppk private key. But how do I SSH from one of my ec2 instance to the other? I can ping the Public DNS of either of them from the other. But if I try ssh from one to the other, I get:

Permission denied (publickey).

A: There is a 3rd and IMHO the best solution so called ssh agent forwarding:

*

*on local machine configure ~/.ssh/config, by adding following section:

Host <ip-or-name-of-A-server>
  ForwardAgent yes

*

*I assume on server A and B you have your local ~/.ssh/id_rsa.pub added to server's ~/.ssh/authorized_keys

While working on server A your keys can be used in further ssh communication - e.g.:

*

*connecting to other server with ssh client - in this case to server B,

*scp (secure copy),

*git - you can pull/push using your local identity to your remote git repositories

*etc.

To check to see if this works:

*

*connect to server A

*check if there is socket connection for key exchange by detecting SSH_AUTH_SOCK env var:

set|grep SSH_AUTH_ # output should be something like this:
SSH_AUTH_SOCK=/tmp/ssh-sEHiRF4hls/agent.12042

Notes:

*

*you need to have ssh agent running - linux: ps -e | grep [s]sh-agent, for windows check putty's utilities pagent and plink

*reference: https://help.github.com/articles/using-ssh-agent-forwarding

*troubleshooting ssh:
https://confluence.atlassian.com/display/BITBUCKET/Troubleshoot+SSH+Issues

A: Method 1 - use the same keys on the servers:
Convert the keys to openssh format and upload the private keys to the servers. When you ssh to the destination host, specify the private key file:
ssh -i mykey.pem private.ip.of.other.server

Method 2 - Create new keys
On each server run:
ssh-keygen

Hit enter enter enter. You'll have two files:
.ssh/id_rsa
.ssh/id_rsa.pub

On Server A, cat and copy to clipboard the public key:
cat ~/.ssh/id_rsa.pub
[select and copy to your clipboard]

ssh into Server B, and append the contents of that to the it's authorized_keys file:
cat >> ~/.ssh/authorized_keys
[paste your clipboard contents]
[ctrl+d to exit]

Now ssh from server A:
ssh -i ~/.ssh/id_rsa private.ip.of.other.server

A: A new AWS solution for the problem.
EC2 Instance Connect
Here's a blog post for the same:
AWS Blog
Please note:

The SSH public keys are only available for one-time use for 60 seconds in the instance metadata. To connect to the instance successfully, you must connect using SSH within this time window. Because the keys expire, there is no need to track or manage these keys directly, as you did previously.


text:
Q: Change state to unselected for all other except selected I have list of message. I create custom component for that. I changed background color in selection of Item. But, not found way to reset background on another item selection.
Suppose I select first Item it changes to isSelected = true but,on second select it change 2nd to isSelected = true but, I want first(Or all other) isSelected = false.

const Container = styled.div`
  width: auto;
  cursor: pointer;
  :hover {
    background-color: #ccc;
    border-radius: 5px;
  }

  ${({ isSelected }) =>
    isSelected &&
    `
    background-color: #b4b4b4`}

`;

const SomeText = styled.span`
  color: #000000

    ${({ isSelected }) =>
        isSelected &&
        `
        color: #ffffff;`}
`;

const Message = ({ item, onItemClick }) => {
  const [isSelected, setIsSelected] = useState(false);

  const onClick = data => {
    onItemClick(data);
    setIsSelected(true);
  };

 return (
  <Container isSelected={isSelected} onClick={onClick}>
   <SomeText isSelected={isSelected}>{item.text}            </SomeText>
  </Container>
 )
};

Parent component:

return (

        {list.map(item => {
          return <Message item={item} key={item.id} onItemClick={onItemClick}/>;
        })}

  );

Is there any good way I can make isSelected = false all other except selected on.
Any help would be greatly appreciated.

A: You need to lift the "selected" state one level up. So, when you select a message, every message knows which is the selected one:

const Container = styled.div`
  width: auto;
  cursor: pointer;
  :hover {
    background-color: #ccc;
    border-radius: 5px;
  }

  ${({ selected }) =>
    selected &&
    `
    background-color: #b4b4b4`}

`;

const SomeText = styled.span`
  color: #000000

    ${({ selected }) =>
        selected &&
        `
        color: #ffffff;`}
`;

const Message = ({ item, onItemClick, selected, setSelected }) => {
  const onClick = data => {
    onItemClick(data);
    setSelected();
  };

 return (
  <Container selected={selected} onClick={onClick}>
   <SomeText selected={selected}>{item.text}            </SomeText>
  </Container>
 )
};

Parent component:
  const [selected, setSelected] = useState(null);
  return (

        {list.map(item => {
          return <Message
            item={item}
            key={item.id}
            onItemClick={onItemClick}
            selected={selected === item.id}
            setSelected={() => setSelected(item.id)
          />;
        })}

  );


text:
Q: Using a nuget package with a reference to a 2.2 shared framework package in 3.1 We are currently upgrading some of our applications from dotnet core 2.X to core 3.1 and I have come across an interesting conundrum. We have a shared nuget package which references Microsoft.AspNetCore.Http.Abstractions 2.2.0 and when we are building our new 3.1 version with docker and the 3.1 sdk we are getting errors about being unable to resolve the assembly reference.
I can fix this by adding an explicit reference to Microsoft.AspNetCore.Http.Abstractions 2.2.0 to the project but I am interested in the "correct" way approach this problem. It feels like there should be a way to have the package reference either assembly depending on what is installed on the host. Meaning our package can be shared between 2.1 and 3.1.
We could create a new package that references the 3.1 shared framework but then we would need some way to distinguish which package to use 2.2 or 3.1 - we would like to avoid pinning our package versions to dotnet core versions because we use our own semver numbering for the packages.
The crux of the question is - what is the best way to manage a package that has a dependency on a previous version of AspNetCore.App?

A: So this seems strange to me but the fix works. It turns out if I reference the Microsoft.AspNetCore.Http.Abstractions 2.0.2 dependency in my nuget package then any consumers of that package work both on 2.x projects and 3.x ones. It's like the core 3.x runtime understands how to deal with a 2.0.2 package but not a 2.1 or a 2.2 one!
I am sure there is a jolly good reason for this but im not clear on what that is!


text:
Q: A button inside one div affects a different div -- In Chrome browser I have a problem with a button inside a div that affects a different div. Here's the basic outline:

                <button>THIS BUTTON</button>

THIS TABLE

Intuitively, I would say that adding or removing that button should have no effect on the table and the div containing the table.
I want this table to be as wide as possible.
And without the button it looks like this:

But then I added JavaScript code that exports the table contents into a CSV file.
Once I added the button to do this action, the table becomes narrower:

Here's is the sample code as a standalone HTML file:

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
          integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

                <button style="margin-top: 0px; display: none"
                        id="export_button" type="button" onclick="">
                    Export to CSV file
                </button>

                Login

A very Informative Header

This is Column 1	This is Column 2	This is Column 3	This is Column 4	This is Column 5	This is Column 6	This is Column 7	This is Column 8	This is Column 9	This is Column 10	This is Column 11	This is Column 12	This is Column 13	This is Column 14

45629	746582945 	8752	45234	342	658472	764932	48753 		Something very important

1	2	3	3.14159265357989	13	42	7abc		Here I have some pretty long text that is not important, but it's here anyway, just to make the table bigger

A: I copied your code into JS snippet. The button doesn't seem to cause any problems.
Quick update: it behaves differently on full screen.
A quick workaround is to add width: 100% to your table's container.

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
          integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

                <button style="margin-top: 0px; display: none"
                        id="export_button" type="button" onclick="">
                    Export to CSV file
                </button>

                Login

A very Informative Header

This is Column 1	This is Column 2	This is Column 3	This is Column 4	This is Column 5	This is Column 6	This is Column 7	This is Column 8	This is Column 9	This is Column 10	This is Column 11	This is Column 12	This is Column 13	This is Column 14

45629	746582945 	8752	45234	342	658472	764932	48753 		Something very important

1	2	3	3.14159265357989	13	42	7abc		Here I have some pretty long text that is not important, but it's here anyway, just to make the table bigger


text:
Q: Object size for characters in R - How does R global string pool work? I am reading Hadley's Advanced R Programming and when it discusses the memory size for characters it says this:

R has a global string pool. This means that each unique string is only
  stored in one place, and therefore character vectors take up less
  memory than you might expect.

The example the book gives is this:
library(pryr)
object_size("banana")
#> 96 B
object_size(rep("banana", 10))
#> 216 B

One of the exercises in this section is to compare these two character vectors:
vec <- lapply(0:50, function(i) c("ba", rep("na", i)))
str <- lapply(vec, paste0, collapse = "")

object_size(vec)
13.4 kB

object_size(str)
8.74 kB

Now, since the passage states that R has a global string pool, and since vector vec is composed mainly of repetitions of two strings ("ba" and "na") I actually would - intuitively - expect the size of vec to be smaller than the size of str.
So my question is: how could you most accurately estimate the size of those vectors beforehand?

A: The key difference is because of the pointers in vec: each of the short scalar strings (CHARSXPs) has to be pointed from the corresponding string vector (STRSXP). You have some 1326 of such string pointers inside vec, but only 51 in str (a pointer is probably 8 bytes on your platform). The pool is for scalar strings (aka CHARSXP cache). Another non-obvious factor is internal fragmentation, e.g. on my system, a scalar string takes the same size regardless of whether it has zero to 7 characters, an 8 character string only takes more, and so on. See the repeated sizes in the following:
unlist(sapply(str, object.size))

[1]  96  96  96 104 104 104 104 120 120 120 120 120 120 120 120 136 136 136 136
[20] 136 136 136 136 152 152 152 152 152 152 152 152 216 216 216 216 216 216 216
[39] 216 216 216 216 216 216 216 216 216 216 216 216 216

These are, however, implementation details of R's memory manager that could change and one should not depend on them in any way in user programs - with another object layout/memory manager, str could use more space than vec.


text:
Q: How to include Google Maps in Ionic Page with no Internet fallback I need to use the Google Maps Javascript API inside my ionic application for one Page. Currently I'm integrating the source in the index.html with:
<script src="https://maps.googleapis.com/maps/api/js?key=XXX&libraries=places"></script>

Problem: When I've got no/a slow internet connection the Ionic Application won't show until this script is loaded.
How can I integrate this script only in the required Page and show a Message if it can't load?


text:
Q: RabbitMQ direct exchange queue not created I am trying to send message through direct exchange. I have not declared the queue as mentioned in the official page tutorial. Below is my code:
import sys
import pika

connection = pika.BlockingConnection(pika.ConnectionParameters('localhost'))  # Connect to AMQP

def setup():
        channel = connection.channel()
        channel.exchange_declare(exchange='direct_logs', type='direct')
        return channel

def log_emitter(message, severity):
        channel = setup()
        channel.basic_publish(exchange='direct_logs',
                      routing_key=severity,
                      body=message)

def logger():
        severity = sys.argv[1] if len(sys.argv) > 2 else 'info'
        print severity
        exit = 'N'
        message = ' '.join(sys.argv[2:]) or "Hello World!"
        log_emitter(message, severity)
        print(" [x] Sent %r:%r" % (severity, message))
    connection.close()

logger()

I am executing with
python direct_log_publisher.py info "Info testing"

It is creating the direct_logs exchange but I cannot see any "info" queue is created in the admin console. As per my understanding no queue binding is required at publisher side.
Thanks in advance.

A: Why would you want the queue to be created automatically? Since you don't bind a queue anywhere, the message is dropped basically (because it has nowhere to go). Either your consumer or your producer have to declare and bind the queue to the exchange (depending on what makes sense to you).


text:
Q: How to create bootable Windows 8 iso image in Linux? I have to insert the Autounattend.xml file into a Windows 8 iso image to make the iso install automatically. My system need to run on Linux and only could use Linux shell command, so ISO tools on Winodws such as UltraISO can not be used.
I have tried several methods, but all the created iso could not be booted, just printed
CDBOOT: Cannot boot from CD - Code: 5

A. The first method I tried is: tuto

*

*Mount iso to a folder

*Copy the mounted iso content into a new folder

*Add my files into the new folder

*Use mkisofs command to create a new iso image
mkisofs -o windows2008_new.iso -b boot/etfsboot.com -no-emul-boot   -boot-load-size 8 -boot-info-table  -V -J -l -D -N -UDF  -relaxed-filenames -V "WINSP"

B. The second method I tried:
MS cmd tool named "oscdimg" on Windows to create new Windows iso, it works. So I copy the oscdimg into Linux and use Wine to run it, it can not be run normally.
Does any one know how to make bootable Windows iso image in Linux using pure shell command?

A: I managed to successfully use genisoimage (a debian fork of mkisofs).
Method:

*

*loopback mount the iso
mount -o loop <image>.iso /mnt/iso

*copy to secondary folder for r/w access
cp -R /mnt/iso/ /mnt/iso2

*make changes

*genisoimage -b <relative boot-img path> -no-emul-boot -boot-load-size 8 -iso-level 2 -udf -joliet -D -N -relaxed-filenames -o <new-image>.iso /mnt/iso2.`

A: Proposed method for Windows 7 but it does not work with Windows 10 iso file
# https://rwmj.wordpress.com/2010/11/04/customizing-a-windows-7-install-iso/
$ dd if=../en_windows_10_x64_dvd.iso \
    of=boot.img bs=2048 count=8 skip=734

$ mkisofs -o ../new-win.iso -b boot.img -no-emul-boot -c BOOT.CAT \
    -iso-level 2 -udf \
    -J -l -D -N -joliet-long -relaxed-filenames .

Output unsuccessful in the first step
dd if=/home/masi/Downloads/en_windows_10_multiple_editions_version_1511_x64_dvd.iso of=/home/masi/Downloads/boot.img bs=2048 count=8 skip=734
8+0 records in
8+0 records out
16384 bytes (16 kB) copied, 0.000392973 s, 41.7 MB/s

Please, let me know if you find any newer method for the task.
OS: Debian 8.5 64 bit
Hardware: Asus Zenbook UX303UA
Targeting hardware: Asus PC

A: I wanted to do the same thing but with ei.cfg; here's how I did it:
First create a mountpoint:
mkdir -p /mnt/image

Mount the official Windows image to /mnt/image:
sudo mount -o loop Win10_2004_English_x64.iso /mnt/image

Create a separate directory /tmp/bootableWin for your modifications, respecting the ISO folder structure, as you can't edit the loop mount.
In my case:
mkdir -p /tmp/bootableWin/sources
sudo tee /tmp/bootableWin/sources/ei.cfg <<EOF
[Channel]
Retail
EOF
And finally package it:

mkisofs \
    -iso-level 4 \
    -l \
    -R \
    -UDF \
    -D \
    -b boot/etfsboot.com \
    -no-emul-boot \
    -boot-load-size 8 \
    -hide boot.catalog \
    -eltorito-alt-boot \
    -eltorito-platform efi \
    -no-emul-boot \
    -b efi/microsoft/boot/efisys.bin \
    -o /home/username/win10-outputimage.iso \
    /mnt/image /tmp/bootableWin/

Now you should have both a BIOS and a UEFI bootable image with your added file in it.


text:
Q: or condition in findByUsername() in yii2 with mongoDB How can i use or condition in yii2 advanced template with mongoDB:
what i want:
$sql = "SELECT * FROM admin WHERE (username = '$username' OR email = '$username');

How can i put this condition in following function:
public static function findByUsername($username)
{
  return static::findOne(['username' => $username]);
}

A: I have solved like this:
public static function findByUsername($username)
    {
        $con = array('$or' => array(array('username' => $username),array('email' => $username)));
        return static::findOne($con);
    }


text:
Q: How to get the corresponding Rd documentation file of a function How can we get the source of R Documentation for an existing function (the contents of the *.Rd), say plot or lubridate::ymd. Something for documentations that is similar to fix for functions?

A: tools::Rd_db creates a named list of parsed .Rd files for an installed package. For instance, to print the contents of lubridate's .Rd file ymd.Rd, you could use:
## create list of parsed .Rd files
db <- tools::Rd_db("lubridate")

## names of .Rd files
names(db)
#>  [1] "DateCoercion.Rd"      "DateTimeUpdate.Rd"    "Deprecated.Rd"
#>  [4] "Duration-class.Rd"    "Interval-class.Rd"    "Period-class.Rd"
#>  [7] "Timespan-class.Rd"    "am.Rd"                "as.duration.Rd"
#> [10] "as.interval.Rd"       "as.period.Rd"         "as_date.Rd"
#> [13] "date.Rd"              "date_decimal.Rd"      "day.Rd"
#> [16] "days_in_month.Rd"     "decimal_date.Rd"      "dst.Rd"
#> [19] "duration.Rd"          "fit_to_timeline.Rd"   "force_tz.Rd"
#> [22] "guess_formats.Rd"     "hidden_aliases.Rd"    "hms.Rd"
#> [25] "hour.Rd"              "interval.Rd"          "is.Date.Rd"
#> [28] "is.POSIXt.Rd"         "is.difftime.Rd"       "is.instant.Rd"
#> [31] "is.timespan.Rd"       "lakers.Rd"            "leap_year.Rd"
#> [34] "local_time.Rd"        "lubridate-package.Rd" "make_datetime.Rd"
#> [37] "make_difftime.Rd"     "minute.Rd"            "month.Rd"
#> [40] "mplus.Rd"             "now.Rd"               "origin.Rd"
#> [43] "parse_date_time.Rd"   "period.Rd"            "period_to_seconds.Rd"
#> [46] "pretty_dates.Rd"      "quarter.Rd"           "reclass_date.Rd"
#> [49] "reclass_timespan.Rd"  "rollback.Rd"          "round_date.Rd"
#> [52] "second.Rd"            "stamp.Rd"             "time_length.Rd"
#> [55] "timespan.Rd"          "today.Rd"             "tz.Rd"
#> [58] "week.Rd"              "with_tz.Rd"           "within-interval.Rd"
#> [61] "year.Rd"              "ymd.Rd"               "ymd_hms.Rd"

## print ymd.Rd
db[["ymd.Rd"]]
#> \title{Parse dates with \strong{y}ear, \strong{m}onth, and \strong{d}ay components}\name{ymd}\alias{ymd}\alias{ydm}\alias{mdy}\alias{myd}\alias{dmy}\alias{dym}\alias{yq}\keyword{chron}\description{
#> Transforms dates stored in character and numeric vectors to Date or POSIXct
#> objects (see \code{tz} argument). These functions recognize arbitrary
#> non-digit separators as well as no separator. As long as the order of
#> formats is correct, these functions will parse dates correctly even when the
#> input vectors contain differently formatted dates. See examples.
#> }\usage{
#> ymd(..., quiet = FALSE, tz = NULL, locale = Sys.getlocale("LC_TIME"),
#>   truncated = 0)
#>
#> ydm(..., quiet = FALSE, tz = NULL, locale = Sys.getlocale("LC_TIME"),
#>   truncated = 0)
#>
#> mdy(..., quiet = FALSE, tz = NULL, locale = Sys.getlocale("LC_TIME"),
#>   truncated = 0)
#>
#> myd(..., quiet = FALSE, tz = NULL, locale = Sys.getlocale("LC_TIME"),
#>   truncated = 0)
#>
#> dmy(..., quiet = FALSE, tz = NULL, locale = Sys.getlocale("LC_TIME"),
#>   truncated = 0)
#>
#> dym(..., quiet = FALSE, tz = NULL, locale = Sys.getlocale("LC_TIME"),
#>   truncated = 0)
#>
#> yq(..., quiet = FALSE, tz = NULL, locale = Sys.getlocale("LC_TIME"))
#> }
#> ... ETCETERA ...


text:
Q: First image without click I have a problem with my image gallery. When I click on a thumbnail it works and large image is shown but I want to have the first image to show up without having to click on its thumbnail.
How can I solve this problem?
Below is my code.
Here is my Django template:

    {% if offer_images1 %}

            {% for image in offer_images1 %}

            {% endfor %}

            {% trans "Title" %}: {{ offer_gallery.title }}

            {% trans "Status" %}: {{ offer_gallery.status }}

                {% for image in offer_images1 %}

                    {% if forloop.counter|divisibleby:"4" and not forloop.last %}

                    {% endif %}
                {% endfor %}

    {% endif %}

Here is my jQuery code:

A: Trigger click event on first image yourself.


text:
Q: Changing number formats in strings Given this (simplified and much shorter than the real case) string:
s="The value is now 3.219209e3, it has grown by 1.06e01 in the last year"

I would like to change the format of the numbers from the "e" notation to plain numbers:
"The value is now 3219.209, it has grown by 10.6 in the last year"
I have tried variations with StringReplace to do this e.g.:
StringReplace[s, StringExpression[m : NumberString, "e", e : NumberString] :>(ToExpression[m]*10^ToExpression[e])]

Which returns a StringExpression instead of a String:
"The value is now " ~~ 3219.21 ~~ ", it has grown by " ~~ 10.6 ~~ " in the last year"

Clearly I'm doing something wrong, is there a way of changing the format of numbers in a string like this that returns a String instead of a StringExpression?

A: You can use ToString to convert the numbers into their string representation, which can then be merged properly with the rest of the string:
s =  "The value is now 3.219209e3, it has grown by 1.06e01 in the last year";

StringReplace[s,
 m : NumberString ~~ "e" ~~ e : NumberString :>
  ToString[ToExpression[m]*10^ToExpression[e]]
 ]
(* "The value is now 3219.21, it has grown by 10.6 in the last year" *)

A: Using the functionality provided by RegularExpression along with Interpreter:
s = "The value is now 3.219209e3, it has grown by 1.06e01 in the last year"

nums = StringCases[s,
  RegularExpression["[-+]?[0-9]*[.]?[0-9]+([eE][-+]?[0-9]+)?"]
  ]

{"3.219209e3", "1.06e01"}

rule = Thread[Rule[nums, ToString@Interpreter["Number"][#] & /@ nums]]

{"3.219209e3" -> "3219.21", "1.06e01" -> "10.6"}

StringReplace[s, rule]

This above can be written succinctly as:
StringReplace[s,
 k : RegularExpression["[-+]?[0-9]*[.]?[0-9]+([eE][-+]?[0-9]+)?"]
  :> ToString@Interpreter["Number"][k]]

Result:

"The value is now 3219.21, it has grown by 10.6 in the last year"


text:
Q: Which language can be used to program PIC10F200/202/204/206? In a pursuit to use a low cost, less pin micro-controller, I have ended up with the PIC series PIC10F200/202/204/206 as a prospective choice. My use cases for them involve using just one or two pins to control external peripherals like DC motors, LEDs. And using at most one OR two sensors for input. I have some experience with Arduino but no experience with PIC series at all.
Looking at the projects over the internet, it seems that the higher series of PIC micro-controllers like PIC16*, PIC18* can be programmed in both C and assembly language. But for the series - PIC10F200/202/204/206, I see programs being developed only in assembly language. I have read somewhere that it is due to less memory available in the PIC10F* micro-controllers. I can program in C, but have no idea about assembly language. It seems difficult to learn as well, and hence could be a dead end for me for now if assembly is the only language I can use.
So, I want to ask, is it NOT possible to program these specific microcontrollers using C language? Is it really a constraint that I need to use assembly language only?
OR
Is it just my misunderstanding and the PIC10F* series can be programmed with C language just like PIC16* and PIC18* series.
Please let me know if you need any further information from my side before answering this.
Thanks,
Anurag

A:
Which language can be used to program PIC10F200/202/204/206?

Technically, you can use the MPLAB XC8 compiler; it can target these parts.
Practically, you will likely need to use assembly.  The parts you're looking at all have either 16 or 24 bytes of RAM, 256 or 512 instructions worth of program memory, and a 2-level call stack. Programming in C under these conditions is extremely difficult.
I would advise that you use a different part. The PIC10F200 series is quite old (~2004); there are much more capable parts available at comparable prices from Microchip, or much lower from other vendors.


text:
Q: How to correctly scale and position a view I have a UIView that originally is the size of 320x90
now I want to scale it, so I wrote
myView.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.9,0.8);

the problem is that now my view doesn't sit where I want it to sit, x,y wise
and any changes to its frame's origin does not change its location on the screen
how to put location on the screen after scaling ?

A: How about doing another transform for your offset by using CGAffineTransformTranslate?:
myView.transform = CGAffineTransformTranslate(myView.transform, x, y);


text:
Q: Mat Cauthon's memories of Manetheren This is a follow-up question to Matrim Cauthon's Memories From Former Lives? where we can learn from a canonical source that Mat's memories of former lives are given to him from his visit inside the ter'angreal. This can for example explain his prowess as general and all the people he remember being in previous lives.
But not all of it. There are anomalies that Jordan's explanation don't cover.
Before entering Shadar Logoth, there is a battle against trollocs where Mat suddely shouts a battlecry, which he doesn't know what it means or where he heard it:

"Carai an Caldazar! Carai an Ellisande! Al Ellisande!"

The WoT wiki gives this explanation:

"For the honor of the Red Eagle! For the Honor of the Rose of the Sun! The Rose of the Sun!"
The ancient warcry of Manetheren and its last king, whose queen, Eldrene, who was called Rose of the Sun. Mat shouts the warcry in the first fight against Trollocs and again the cry "Carai an Caldazar!" while fighting Trollocs and Myrrdraal near the Jangai Pass

After Shadar Logoth, Mat keeps mumbling in the Old Tongue and similar. If Jordan claims that Shadar Logoth left holes in his memory, then the memories gained do not come from Shadar Logoth nor from the ter'angreal, but from somewhere else.
He is a ta'veren, but apparently not one of the heroes reborn, as the other heroes don't recognize him as they do with Lews Therin. So what is the explanation?
I can think of two possibilities:

*

*Is he a reborn hero from Manetheren, a new hero to be added to the group of heroes? The books (Artur Hawkwing to Hurin) say that sometimes new heroes are added to their numbers. And if so, is Perrin one as well?
I don't recall the books giving any satisfying explanation of why three ta'veren were born at the same time. This doesn't seem to have been the case in the Dragon's previous incarnation as Lews Therin Telamon.

*If the explanation is simply "the old blood resurfacing", then isn't it strange that Mat in remembers being various people from Manetheren in particular, generals and others. Why would the people of Manetheren be more frequent visitors to the Aelfinn/Eelfinn worlds than other people?
And what would be the canonical explanation for "old blood resurfacing", as this doesn't seem to happen anywhere else in the world, or to any other character than Mat. (Not counting Rand and Ishamael who we know are reborn.)

A: Firstly, I'd like to catalog the major mentions of the old blood and see what they have to say about what the old blood is supposed to do:
Powers/Abilities corresponding to The Old Blood

*

*Purity/strength of the old blood is clearly tied to the ability to use The Power:

"Do you have any idea," Alanna went on, "how many towns and villages we usually must visit to find three girls with the ability inborn? The only wonder is that it took us so long to come hunting more. The old blood is very strong here in the Two Rivers."

The Shadow Rising, Chapter 31.

*

*Additionally, it's clear that in-universe, there is a means of accessing ancestral memories distinct from the Aelfinn/Eelfinn's powers, as the ter'angreal in Rhuidean shows.

*While it's not definite that Mat is using the memory of an ancestor, it is clear that the Aes Sedai believe that Mat's strength in the old blood is the cause of his random fits of using the Old Tongue, as the above quote and the following show:

[as Mat is being healed and separated from the Shadar Logoth dagger, he screams stuff in the Old Tongue] "Fascinating," Verin said. "That the Old Blood could flow so strongly in anyone today."
[. . .]
"What was that he was shouting, Mother?" Elayne asked, then hastily added, "If I may ask."
"He was ordering soldiers." The Amyrlin gave the young man lying on the table a quizzical look. [...] "In a battle two thousand years gone, I would say. The Old Blood comes again."
[. . .]
"For a time," she said firmly, "I believe the past and the present were one. He was there, and he was here, and he knew who we were. He commanded us to release him."

The Dragon Reborn, Chapter 18
Now, Aes Sedai cannot lie, and while they never directly say "this is because of the old blood" -- they only say "Mat speaks in the Old Tongue sometimes. The Old Blood is strong in The Two Rivers" -- we don't have any real reason to discredit it since they even use it as justification to send two Aes Sedai to a random backwater province of Andor.
It's also not totally unheard-of in-universe by non-Aes Sedai, as Thom indicates (and Agelmar later corroborates):

"The old blood, she said. The blood, not a dead man. I've heard that it can happen, sometimes. Heard, though I never really thought. . . . It was your roots, boy. A line running from you to your father to your grandfather, right on back to Manetheren, and maybe beyond. Well, now you know your family is old."

The Eye of the World, Chapter 19
And the old blood is justification enough for Agelmar to let the "Farmboys" go into the Blight, without additional troops, to seek the Eye of the World, more so than Moiraine's claim that they are ta'veren!

"They are ta'veren," Moiraine said soothingly. [explains three ta'veren together can change the course of history]
Agelmar stopped trying to find his sword, but he still looked at Rand and the others doubtfully. "Moiraine Sedai, if you say they are, then they are, but I cannot see it. Farmboys. Are you certain, Aes Sedai?"
"The old blood," Moiraine said, "split out like a river breaking into a thousand times a thousand streams, but sometimes streams join together to make a river again. The old blood of Manetheren is strong and pure in almost all these young men. Can you doubt the strength of Manetheren's blood, Lord Agelmar?"
[. . .]
"Manetheren," Agelmar said slowly, nodding. "I would not doubt that blood. [. . .] It shall be done as you wish, Aes Sedai."

The Eye of the World, Chapter 47
Although, this passage could be just Agelmar believing more in ancestral martial prowess than in the mysterious workings of the Wheel.
However, Birgitte has perhaps the clearest explanation of manifestations of the Old Blood, driven by her lifetimes of experience, as Mat tries to explain his ability to speak the Old Tongue:

"An Aes Sedai once told me the old blood runs strong in -- What are you bloody well laughing at now?"
"You, Mat. [. . .] Some people speak a few words, a phrase or two, because of the old blood. Usually what they say, or not quite. But you. . . . One sentence you're an Eharoni High Prince and the next a First Lord of Manetheren, accent and idiom perfect."

A Crown of Swords, Chapter 21

Hence, I conclude that we must accept that the Old Blood is the cause of his memories prior to the Finn, and the reason it only happens to him is that Mat just has the strongest bloodline ties to Manetheren out of the group.
As the above quotes show, Mat can clearly occasionally live out the memories of men long dead, quite apart from having the gaps filled by the Finn, indicating his long ancestry. Mat is not the only one in whom the old blood runs strongly, though, as Egwene almost understands his warcry:

Mat shrugged uncomfortably. "I don't remember." He stared at them deffensively. "Well, I don't. It's all foggy. I don't know what it was, or where it came from, or what it means." He gave a self-deprecating laugh. "I don't suppose it means anything."
"I . . . I think it does," Egwene said slowly. "When you shouted, I thought--just for a minute--I thought I understood you. But it's all gone, now."
[. . .]
Rand thought he knew what Mat was thinking. The same thing he was thinking. If Mat was a descendant of the ancient kings of Manetheren, maybe the Trollocs were really after him and not all three of them. The thought made him ashamed. His cheeks colored, and when he caught a guilty grimace on Perrin's face, he knew Perrin had been having the same thought.

The Eye of the World, Chapter 18.

As an aside, Mat has the following to say upon finding out about the old blood:

"It's as if some dead man was speaking with my mouth. I don't like it." The Eye of the World, Chapter 19.

Which is ironic given his future(?) memories of past lives as well as a rather amusing explanation for his reluctance to be tied to the Horn (and probably being reborn but perhaps he is only ever reborn in the Third Age).

A: What I believe is that Moiraine believed strongly in what she said about the Old Blood running strong in some.  That is probably an observed phenomenon written about and documented by various Aes Sedai over the millennia, perhaps even carried over from the Age of Legends and the phenomenon observed there.  In addition, what happened to Mat having "holes" in his memory, my understanding is that the Eelfinn (as Mat says) stuffed dead men's memories in his head.  Mat had obviously been reborn many times.  More than the Heroes of the Horn were reborn.  So, they weren't random men's memories, they were his memories from past lives.  He may have just been spun out by the Wheel more often in Manetheren, over the course of centuries.  Mat states he has this block of memories coming from the time when Manetheren was prominent, but there is nothing stating that he did not live any lives before or after until he was reborn as Matrim Cauthon.  Just nothing worthy of pulling memories from, at least not for the purpose of making him the battle master capable of winning the Last Battle. Not being bound to the Horn?  Well, the Wheel needed to be able to spin him out into the Pattern for the Last Battle and events just before, not just for it.  After Mat's first unwitting use of the Old Tongue, all of the Two Rivers folk wondered at it, but Egwene states that she could almost understand what it was, that it sort of danced around in the edges of her mind.
A note that I'm not sure anyone else shares: it seems like Jordan stayed very close to his original idea, but changed it just slightly on a very few small things.  Kind of reminds me of TV pilots when trying to sell the show and then there are more noticeable tweaks made once the show is green-lit that become more solid and almost ignore what was done in the pilot.
What I believe about three ta'veren is that the Wheel had woven them into the Pattern because of the dire need for them in what was believed to be the "Last Battle."  Three would have been handy during the Breaking, but for the Wheel (weaving as it wills), three were needed for the Last Battle to handle all of the enormous amount of tasks required.

A: Like Rand, Mat is a reborn hero. As Birgitte explained it, the wheel would occasionally reweave people into the pattern but without their memories from previous lives.
Since Mat, Rand, and Perrin are ta'veren, that causes "anomalies" in the pattern which result in some of his memories "leaking" back.
I'll try to add some sources later.


text:
Q: mpiexec throws error "mkstemp failed No such file or directory" I have cross compiled MPICH for Android and configured it.
It works fine when I spawn a single process as follows
$./mpiexec -n 1  -launcher=fork  ./mpi_hello_world
Hello world from processor zero, rank 0 out of 1 processors

However the Android System responds with following error if  parameter  "n" is greater than 1 as follows :
$./mpiexec -n 2  -launcher=fork  ./mpi_hello_world
Fatal error in MPI_Init: Other MPI error, error stack:
MPIR_Init_thread(474).................:
MPID_Init(190)........................: channel initialization failed
MPIDI_CH3_Init(89)....................:
MPID_nem_init(272)....................:
MPIDI_CH3I_Seg_commit(327)............:
MPIU_SHMW_Seg_create_and_attach(897)..:
MPIU_SHMW_Seg_create_attach_templ(610): mkstemp failed No such file or directory

It may be something related with name of temp file being created  on android  ? Please help.

A: The problem is that on Android file system you do not have /tmp and /dev/shm directories, which are crutial for creating temp files for shared-memory communication. Because of that, mkstemp() will fail. mkdir them while you are su, set up the permissions and ch3:nemesis will work.


text:
Q: CookieManager not saving cookies When I execute the following code:
CookieSyncManager.createInstance(activity);
CookieManager cookieManager = CookieManager.getInstance();
cookieManager.setAcceptCookie(true);

webView.setWebViewClient(new WebViewClient() {
    @Override
    public void onReceivedHttpAuthRequest(WebView view, HttpAuthHandler handler,
                            String host, String realm) {
        Log.d(Utils.TAG, "There are cookies: " + cookieManager.hasCookies());
        handler.proceed("user","pass");
    }
}
webView.loadurl("https://...");

On JellyBean I get "There are cookies: true" while on Gingerbread I get "There are cookies: false"
It seems that on Gingerbread the cookies (one in this case) are not saved by the webView, thus the web page refuses to log me in because the cookie is not passed in the headers during authentication.
The same happens when using CookieSyncManager.
Also I don't know it it can be relevant but the code is executed by a Fragment using the Android Support Library.
Has anyone had this problem before?
Thanks.


text:
Q: ASP.NET MVC3 (C#) Image from URL to database This seems like a really easy problem however after extensive searching I can't seem to find what I'm looking for. What is the best possible implementation for pulling an image from a url and saving it to a SQL database?
I'm using MVC3 in C# and Linq to SQL.

A: First download that image from URL then save it in database
     string tnail = "";
  WebClient client = new WebClient();
    using (Image src = Image.FromFile("http://www.example.com/image.jpg"))
                        {
                            using (Bitmap dst = new Bitmap(25, 33))
                            {
                                using (Graphics g = Graphics.FromImage(dst))
                                {
                                    g.SmoothingMode = SmoothingMode.HighQuality;
                                    g.InterpolationMode = InterpolationMode.High;
                                    g.DrawImage(src, 0, 0, dst.Width, dst.Height);
                                }
                                tnail = tname;
                                tnail = Path.ChangeExtension(tnail, null);
                                tnail += "_thumbnail";
                                tnail = Path.ChangeExtension(tnail, "jpg");
                                dst.Save(Path.Combine(Server.MapPath(imagepath), tnail), ImageFormat.Jpeg);

                            }
                        }

A: Maybe the best way is not to save it directly in the database, but to store a reference to a central file storage.
That said, you might have a look at Inserting image over 3mb via linq-to-sql

A: If we assume you have a persistable entity (named ImageFile below) that has a byte array property representing the file, you can use [WebClient.DownloadData][1].
using(WebClient client = new WebClient())
{
    var img = new ImageFile();
    img.Data = client.DownloadData("http://www.example.com/image.jpg");

    // continue with saving your file.
}


text:
Q: Excel: Protect password not compatible with VBA password? I know of the 2 possible ways to password-protect sheets in Excel -

*

*Manual Password protect

*Password protect using VBA

This is where I'm stumped. I have password-protected a sheet using VBA and then tried to unprotect it manually with the same password used in VBA. But Excel throws an error saying that the password provided is incorrect. I tried the opposite as well - Protected the file manually and then tried to unprotect using VBA providing the right password in the code; same error. Any ideas why this is happening?

A: After some analysis, I figured out what the issue is in my code -
ActiveWorkbook.Protect Password = "xyz", Structure:=True, Windows:=False

The password option was assigned with an "=" sign instead of a ":=". This code still protects the sheet but with an empty password. When I use a similar Unprotect code like,
ActiveWorkbook.Unprotect Password = "xyz"

the unprotect code is passing on an empty password. Hence, if I try a manual password of "xyz" it throws an error.
The correct code that solves the issue is
ActiveWorkbook.Protect Password:= "xyz", Structure:=True, Windows:=False
ActiveWorkbook.Unprotect Password:= "xyz

A: If I am understanding your question correctly, it happens because each password is protecting something different. They are not the same thing. You can have a workbook that is not password protected but the VBA code is password protected.


text:
Q: Inability to write import for Jama in java Tried to implement the example but I got the error in the title http://math.nist.gov/javanumerics/jama/doc/Jama/Matrix.html
I'm just wondering how do I write the import for it. I haven't found anything online. Thanks

A: In every Javadoc page, at the top, you have the name of the class, including its full path, which is what you should import.
For example, let's look at the well-known ArrayList class from the Java standard library. If you look at its Javadoc, you'll see:
java.lang.Object
    java.util.AbstractCollection<E>
        java.util.AbstractList<E>
            java.util.ArrayList<E>

By looking at the last line, you know you have to import java.util.ArrayList (generic type designators are not included in the import).
So now look at the Javadoc you gave us. It's a bit confusing, because ironically, the National Institute of Standards and Technology is not using the proper language conventions (the name of the package should have been gov.nist.jama or something like that, certainly not something that begins with a capital letter).
Nevertheless, the Javadoc states:
java.lang.Object
  └╴Jama.Matrix

So your import should be Jama.Matrix.


text:
Q: Sign of bivariate polynomial evaluated over two algebraic numbers I would like to compute the sign of a bivariate polynomial $f$ evaluated over two algebraic numbers $a$, $b$. The numbers are in "isolating interval representation" meaning that each one is defined by one square-free univariate polynomial $g$ and two rational endpoints. All the coefficients are integers.
I more-or-less understand what to do to find out the sign of univariate polynomial $f$ evaluated over single algebraic number $a$: I compute generalized Sturm sequence or pseudo-remainder sequence of $f$ and $g$, evaluate the sequence twice over each of the endpoints of $a$ and count the number of sign changes.
But I don't understand how to compute the PRS of a bivariate polynomial and an univariate polynomial. The problem is that I don't know how to find the reminder of a bivariate and an univariate polynomial. Is there a way do divide bivariate polynomial by univariate polynomial? Should I perhaps somehow (how?) "transform" the bivariate polynomial into univariate one and do as before?
I also read that it should be possible to consider a bivariate polynomial ($f \in Z[x, y]$) as univariate polynomial in ($f \in (Z[y])[x]$) by means of "binary segmentation". Is this how should I proceed? How does it work? To be honest I really don't get how to "consider" a bivariate polynomial as a univariate polynomial. Or perhaps there is another way how to compute the sign of bivariate polynomial over two algebraic numbers?


text:
Q: Customising class names in ASP.NET Sprite and Image Optimization framework Is it possible to control the generated CSS class names within the ASP.NET Sprite and Image Optimization Framework?
Further information:
I currently have two sprites, one for 16x16 icons and another for 32x32 icons. At present the class names are in the format .icon-16.[imagename] and .icon-32.[imagename].
I will be referencing the classes in the markup manually (i.e. not via the framework helpers):
e.g. class="icon-16 my-image".
Is there a way to achieve this with the framework?


text:
Q: Mouse X/Y detection within Flash stage not working Moz & Webkit on PC I am trying in vain to get this Flash based navigational item working in FF and Chrome on PC.  It's all good on Mac and it's just fine using IE 7 or 8 on PC.
The nav item consists of a ball that "follows" the cursor in relation to where it is on the page.  JS is used to gather the X/Y info from off the Flash stage and create vars to be used by the Flash movie to move the "orb" in relation to the cursor position.  For some reason, FF and Chrome on PC fall short here.
I've tried everything from setting the Flash movie to "opaque" and positioning a transparent DIV over it, all to no avail.
Any thoughts on this?  Has anyone encountered something like this?
Example here:
http://anthrograph.com/yarbyarb/thang/
We were given the compiled SWF with the listeners setup, but as of now, I do not have access to the FLA to make changes.
Thank you!

A: i tried in chrome and firefox, when mouse is on html part, positioning is working, while mouse is on flash it is not working.
if i understand, easiest solution is for window mode, you should make a displayObject, a sprite and set it to belove everything else with alpha = 0, with this you can set window mode anything you like.
other then, you should add Listener to MouseLeave and MouseMove to detect when listen javascript or actionscript.
there is another error, you should mask your buttons that right side. they are under other graphic but mouse_over is working when it should not. For this use ROLL_OVER instead of MOUSE_OVER.


text:
Q: How to generate in R datetime variable from millisecond starting from precise datetime I have to convert a data frame with millisecond variable to a df with datetime variable (starting from a precise datetime) where milliseconds are progressively added to the previous datetime.**
In Excel is pretty straigthforward, I solved this way:
1) convert RR_ms in text with millisecond format "YYYY-mm-dd HH:MM:SS.xxx" (i.e. "0000-00-00 00:00:00.xxx")
2) add first millisecond to "2019-05-04 08:57:42.000"
3) add progressively other millisecond cells to previous cells
4) read the xlsx file into R (readxl, lubridate)
My aim to go from
head(sample[,1])
 A tibble: 6 x 1
  RR_ms
  <dbl>
1   789
2   789
3   796
4   792
5   769
6   753

to following df
head(sample[,1:2])
# A tibble: 6 x 1
  RR_ms   Time
  <dbl>   <datetime>
1  789    2019-05-04 08:57:42.789
2  789    2019-05-04 08:57:43.578
3  796    2019-05-04 08:57:44.374
4  792    2019-05-04 08:57:45.166
5  769    2019-05-04 08:57:45.935
6  753    2019-05-04 08:57:46.688

I would appreciate any tip or link as all I saw till now did not help me to produce the R code I need.
Best regards
Andrea


text:
Q: Google Map API returns incorrect GPS coordinates I am using Google Maps API to allow customers to more accurately identify where their products should be delivered in a city where addresses are inaccurate.
I tried the answers here and here, but neither resolved the issue.
We place a moveable pin at the location the customer specifies, and then retrieve the GPS coordinates once the customer is satisfied with their placement and hits "continue".
The problem is that the retrieved coordinates are neither the original ones associated with the address nor the new ones associated with the last location of said pin.
  function initMap() {

    var latitude = -8.111735;
    var longitude = -79.025550;

    if(localStorage.getItem('dm-latitude')){
      var latitude = localStorage.getItem('dm-latitude');
      var longitude = localStorage.getItem('dm-longitude');

      if(latitude!='' && longitude!=''){
        $('.dm-clone-btn').addClass('dm-none');
        $('.dm-oroginal-btn').removeClass('dm-none');
      }else{
        $('.dm-clone-btn').removeClass('dm-none');
        $('.dm-oroginal-btn').addClass('dm-none');
      }
    }

    $('#dm-latitude').val(latitude);
    $('#dm-longitude').val(longitude);

    var myLatLng = new google.maps.LatLng(latitude,longitude);

    var mapOptions = {
      zoom: 15,
      center: myLatLng
    }
    var map = new google.maps.Map(document.getElementById("map"), mapOptions);

    var markers = [];
    var marker = new google.maps.Marker({
      position: myLatLng,
      draggable:true,
      title: latitude+', '+longitude
    });
    markers.push(marker);
    marker.setMap(map);

    google.maps.event.addListener(map,'click',function(event) {
      markers.forEach(function(marker) {
        marker.setMap(null);
      });
      markers = [];

      var marker = new google.maps.Marker({
        position: event.latLng,
        map: map,
        draggable:true,
        title: event.latLng.lat()+', '+event.latLng.lng()
      });
      markers.push(marker);
      localStorage.setItem('dm-latitude',event.latLng.lat());
      localStorage.setItem('dm-longitude',event.latLng.lng());
      $('#dm-latitude').val(event.latLng.lat());
      $('#dm-longitude').val(event.latLng.lng());
      $('.dm-clone-btn').addClass('dm-none');
      $('.dm-oroginal-btn').removeClass('dm-none');

    });

    google.maps.event.addListener(marker, 'dragend', function(event) {
      markers.push(marker);
      localStorage.setItem('dm-latitude',event.latLng.lat());
      localStorage.setItem('dm-longitude',event.latLng.lng());
      $('#dm-latitude').val(event.latLng.lat());
      $('#dm-longitude').val(event.latLng.lng());
      $('.dm-clone-btn').addClass('dm-none');
      $('.dm-oroginal-btn').removeClass('dm-none');
    } );

    // Create the search box and link it to the UI element.
    var input = document.getElementById('pac-input');
    var searchBox = new google.maps.places.SearchBox(input);
    map.controls[google.maps.ControlPosition.TOP_LEFT].push(input);

    // Bias the SearchBox results towards current map's viewport.
    map.addListener('bounds_changed', function() {
      searchBox.setBounds(map.getBounds());
    });

    // more details for that place.
    searchBox.addListener('places_changed', function() {
      console.log('search ma');
      var places = searchBox.getPlaces();

      if (places.length == 0) {
        return;
      }

      // Clear out the old markers.
      markers.forEach(function(marker) {
        marker.setMap(null);
      });
      markers = [];

      // For each place, get the icon, name and location.
      var bounds = new google.maps.LatLngBounds();
      places.forEach(function(place) {
        if (!place.geometry) {
          console.log("Returned place contains no geometry");
          return;
        }
        var icon = {
          url: place.icon,
          size: new google.maps.Size(71, 71),
          origin: new google.maps.Point(0, 0),
          anchor: new google.maps.Point(17, 34),
          scaledSize: new google.maps.Size(25, 25)
        };

        // Create a marker for each place.
        markers.push(new google.maps.Marker({
          map: map,
          title: place.name,
          map: map,
          draggable:true,
          position: place.geometry.location
        }));
        console.log(place.geometry);
        localStorage.setItem('dm-latitude',place.geometry.viewport.Za.i);
        localStorage.setItem('dm-longitude',place.geometry.viewport.Ua.i);

        $('#dm-latitude').val(place.geometry.viewport.Za.i);
        $('#dm-longitude').val(place.geometry.viewport.Ua.i);
        $('.dm-clone-btn').addClass('dm-none');
        $('.dm-oroginal-btn').removeClass('dm-none');

        //              console.log(place.geometry.viewport);
        if (place.geometry.viewport) {
          // Only geocodes have viewport.
          bounds.union(place.geometry.viewport);
        } else {
          bounds.extend(place.geometry.location);
        }
      });
      map.fitBounds(bounds);
    });

A: You are using undocumented properties: place.geometry.viewport.Za.i and place.geometry.viewport.Ua.i.
Don't do that (those property names can and do change).
I certainly wouldn't expect any property of the viewport to be related to the actual location of a place (they are likely the north east and south west corners of a bounding box associated with the place.
// more details for that place.
searchBox.addListener('places_changed', function() {
  console.log('search ma');
  var places = searchBox.getPlaces();

  if (places.length == 0) {
    return;
  }

  // Clear out the old markers.
  markers.forEach(function(marker) {
    marker.setMap(null);
  });
  markers = [];

  // For each place, get the icon, name and location.
  var bounds = new google.maps.LatLngBounds();
  places.forEach(function(place) {
    if (!place.geometry) {
      console.log("Returned place contains no geometry");
      return;
    }
    var icon = {
      url: place.icon,
      size: new google.maps.Size(71, 71),
      origin: new google.maps.Point(0, 0),
      anchor: new google.maps.Point(17, 34),
      scaledSize: new google.maps.Size(25, 25)
    };

    // Create a marker for each place.
    markers.push(new google.maps.Marker({
      map: map,
      title: place.name,
      map: map,
      draggable:true,
      position: place.geometry.location
    }));
    console.log(place.geometry);
    localStorage.setItem('dm-latitude',place.geometry.location.lat());
    localStorage.setItem('dm-longitude',place.geometry.location.lng());

    $('#dm-latitude').val(place.geometry.location.lat());
    $('#dm-longitude').val(place.geometry.location.lng());
    $('.dm-clone-btn').addClass('dm-none');
    $('.dm-oroginal-btn').removeClass('dm-none');

    //              console.log(place.geometry.viewport);
    if (place.geometry.viewport) {
      // Only geocodes have viewport.
      bounds.union(place.geometry.viewport);
    } else {
      bounds.extend(place.geometry.location);
    }
  });
  map.fitBounds(bounds);
});


text:
Q: How to check if Iterator.next() is == null? How do I check if the next element in the list is null ?
while(it.hasNext()){

            System.out.println(it.next()+"\n");
        }

this is how I tried, but when the last element is null it prints it as null.
I tried to change it
 while(it.hasNext()){
    if(it.next()==null){
    }else
        System.out.println(it.next()+"\n");
            }

but this just makes it worst because some of the elements don't even print!
This is my Iteration method/anonymous class
public Iterator<Filmi> iterator3DFilms ()throws FilmiException{
        if(filmList.isEmpty())
            throw new FilmiException("No Films on the list");
        return new Iterator<Filmi>(){
            private int index=0;
            public boolean hasNext(){
                return index <filmList.size();
            }
            public Filmi next(){
                Filmi lb = filmList.get(index++);

                if(lb.is3D()== true)
                    return lb;
                if(hasNext())
                    return next();
                return null;
            }
            public void remove(){}
        };
    }

The null print only happens at the last element
Thank you.

A: No it cannot work this way because if it.next() is not null you call it.next() twice which will make you skip a value that could not even be available.
Use a variable instead as next:
Object o = it.next();
if (o != null) {
   ...
}

A: you should use stream instead of iterator.
filmList.stream().filter(film->film!=null).filter(film->film.is3D())

Edit:
or, if you'r not in Java 8 :
Predicate<Film> isNotNullAnd3D = new Predicate<Person>() {
        public boolean apply(Film f) {
            return f != null && f.is3D();
        }
    };

Collection2.filter(filmList, isNotNullAnd3D)

A: Naturally, code like
if (it.next() == null){
} else {
    System.out.println(it.next()+"\n");
}

will consume every other non-null element, as you are observing. Plus calling it.next() without checking it.hasNext() is a recipe for disaster.
Why not write
Foo/*ToDo - use the correct type here*/ foo = it.next()
if (foo != null){
    /*ToDo*/
}

instead?

A: You never mentioned why you use iterators explicitly in the first place.
Why not use implicit iterator notation like this ? :
for (Film film : filmList) {
  if (film != null ){
     ....
  }
}

A: Additionally to what others said: in case you are doing a for-each loop with a primitive type like int
for (int node : input) {
    doSomething(node);
}

you might want to consider using the Wrapper class instead:
for (Integer node : input) {
    if (node == null) throw new IllegalArgumentException();
    doSomething(node);
}


text:
Q: Knockout Select2 set initial value by object I have a Knockout.js web application where I have a select2 dropdown. I want to bind both the id and text values to a variable instead of just the id. Here's my data:
var cars = [{id: 1, name: 'Honda'}, {id: 2, name: 'Toyota'}, {id: 3, name: 'Dodge'}];
var selectedCar = ko.observable();

Here's my html:
<select data-bind="value: selectedCar, optionsCaption: 'Select', optionsText: 'name', options: cars"></select>

So now, whenever I select something in the dropdown my variable contains the entire object like so:
selectedCar = {id: 1, name: 'Honda'};

The only problem occurs when you load the page and want the dropdown to be set to a specific value. Even though before rendering the html the selectedCar variable is set to {id: 1, name: 'Honda'} when the page renders the dropdown is not set to anything, it just is set to the placeholder 'Select'.
What am I doing wrong?

A: If you want to bind both the id and text value to a variable, you need to use the optionsValue binding and bind the entire context to it ($data);
<select data-bind="value: selectedCar,
                   optionsCaption: 'Select',
                   optionsText: 'name',
                   options: cars,
                   optionsValue: $data"></select>

Normally we would specify the id or whatever to get an initial value selected. So it would make sense like in your question to supply the entire object {id: 1, name: 'Honda'} as the initial value to selectedCar if wet set optionsValue: $data and not $optionsValue: 'id'.
(IMPORTANT) But turns out this doesn't work, because we're creating a new object and so Knockout's equality test will fail when it compares the objects of cars with the object inside selectedCar. The correct way to set the initial value is cars[0].

I'm sure this is a typo, but I'll specify anyway: when you create any variable that needs to be accessed by the HTML you need to bind it to this, which would be a reference to the viewModel.
this.cars = [{id: 1, name: 'Honda'}, {id: 2, name: 'Toyota'}, {id: 3, name: 'Dodge'}];
this.selectedCar = ko.observable();

Let's test all this with a fiddle:

var viewModel = function(){
  var self = this;
  self.cars = [{id: 1, name: 'Honda'}, {id: 2, name: 'Toyota'}, {id: 3, name: 'Dodge'}];
  self.selectedCar = ko.observable(self.cars[0]);

};

ko.applyBindings(new viewModel());

<select data-bind="value: selectedCar, optionsCaption: 'Select', optionsText: 'name', optionsValue:$data, options: cars"></select>

A: The value of a select box will become the object that corresponds to the selected item or the property set in the optionsValue parameter. So in the case of objects, the selected value you set must be the same instance that exists in the array. Having a different instance of an object happens to be structurally equivalent is not enough.
For situations like this, I find it easier to bind the value of the select box to a unique id for the object instead. Then you could map out that id to the actual instance that you want through a computed value.

function ViewModel(data) {
    this.cars = data.cars;
    this.selectedCarId = ko.observable(data.selectedCarId);
    this.selectedCar = ko.computed(() => {
        let selectedCarId = this.selectedCarId();
        return this.cars.find(c => c.id === selectedCarId);
    });
}

let model = {
    cars: [
        { id: 1, name: 'Honda' },
        { id: 2, name: 'Toyota' },
        { id: 3, name: 'Dodge' }
    ],
    selectedCarId: 2
};
ko.applyBindings(new ViewModel(model), document.getElementById('content'));

<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.5/css/select2.min.css">

  <select data-bind="value: selectedCarId,
                     optionsCaption: 'Select',
                     optionsText: 'name',
                     optionsValue: 'id',
                     options: cars">
  </select>

selectedCarId:

selectedCar:

If you'd rather not use a separate computed property, you would still need to pass in an index, but the value you set, must be obtained from the array.
function ViewModel(data) {
    this.cars = data.cars;
    this.selectedCar = ko.observable(
        data.cars.find(c => c.id === data.selectedCarId)
    );
}


text:
Q: Which external sound cards are supported in 12.04? Rather than try to get an unspecified external sound card to work it would make sense to buy an external sound card which is known to be supported.
Has anyone got an external sound card which worked out of the box?

A: hardware is supported by the kernel version and not the version of Ubuntu (although they are obviously related).
Hardware lists are user supported and I would encourage everyone to participate in reporting results of hardware support to the various listings.
See:
http://www.h-node.org/home/index/en
http://www.h-node.org/soundcards/catalogue/en
http://www.ubuntu.com/certification/test-suite/

A: are you talking about a usb sound card?
I have a Creative X-FI Titanium Fatal1ty Pro and the sound works.


text:
Q: SQL Server - Compare large number of MD5-Hashed Values Suppose I have a table in SQL Server storing customer emails (a few million records) - For simplicity's sake, looking somewhat as follows:
CREATE TABLE [Emails]
(
    [Id] [int] IDENTITY(1,1) NOT NULL PRIMARY KEY,
    [email] [nvarchar](1000) NOT NULL
)

And I have clients that send me lists, each millions of records long, of their customers' emails, but all MD5-Hash encrypted, so the list would simply look as follows:
0x3B46E0E53842A74172BA678974E93BBB
0xACAC5843E184C85AA6FF641AAB0AA644
0xD3C7BA16E02BE75142761894E8E4A125
...

And I have to come up with a fast way to see what emails from their list exist in my table.
Based upon some answers I have seen online / here, I came up with the following logic to do this:

*

*I created an indexed view of my Emails table with the MD5-Hash column as the index:
CREATE VIEW dbo.vw_Emails
WITH SCHEMABINDING
AS
    SELECT
        Id
         , email
         , CONVERT(VARBINARY(16), HASHBYTES('MD5', LOWER(email))) AS MD5
    FROM
        dbo.Emails
GO

CREATE UNIQUE CLUSTERED INDEX Idx_vw_Emails ON vw_Emails (MD5)
GO

*I created a stored procedure that will BulkImport the list given, convert it into a temporary table, join it against my view and return any matched rows as follows:
CREATE PROCEDURE Import_ReturnMatches
(
    @PathToCSVFile VARCHAR(8000)
)

AS

DECLARE @fieldsep CHAR(1) = ',';
DECLARE @recordsep CHAR(1) = CHAR(10);

DECLARE @Emails TABLE
(
    MD5 VARCHAR(MAX) NOT NULL
);

DECLARE @sql VARCHAR(8000) =
    'CREATE TABLE #tmp
    (
          MD5 varchar(max) NOT NULL
    );

    BULK INSERT #tmp
    FROM ''' + @PathToCSVFile + '''
    WITH (FIRSTROW = 1, FIELDTERMINATOR = ''' + @fieldsep + ''', ROWTERMINATOR = ''' + @recordsep + ''');

    SELECT *
    FROM #tmp';

INSERT INTO @Emails
EXEC (@sql);

SELECT
    r.*
FROM
    @Emails l
    JOIN vw_Email_Dim r
    ON l.MD5 = r.MD5

As you can see, I set the column type for my import as VARCHAR(MAX), but that was only because nothing else really worked... That's where I'm stuck. It seems to always be returning an empty set even though I've placed records in my file that should match.
My questions are:

*

*What am I doing wrong / how can I fix this?

*Am I using the right data-types for my storage / indexing / import?

*Is this just an overall bad idea and is there a better way to accomplish what I'm looking to do?

A: Your problem is likely this value:
LOWER(email)

If you aren't sure what case or encoding (Windows 1252, UTF8, UTF16, UTF16LE?) was used to generate the MD5 hash from the email at your source, then you are looking at needing to test all the combinations for a matching hash value. Consider where we change the LOWER to UPPER - a completely different MD5 hash value is generated:

You will either need to control how the MD5 hash is generated at the source or add metadata (another field) to the import to describe how the input is cased and encoded.

A: Check this answer. You need to compare varchar to varchar - not varbinary I think.
Generate MD5 hash string with T-SQL


text:
Q: REST API design: how to handle resources that can also be sub-resources I have to put a (read-only) REST service atop of an existing product database. The easy part is having a top level product resource, like:
/api/products/

Now, actually callers of this service will rather need to get their relevant products based on the ID of a store and of a specific process (like "retail"). Behind the scenes, the combination of those two values results in a configured subset of products. This must be transparent for the caller, it should not need to know about these "product portfolios".
So I thought about designing the URI like this, where 1234 is the StoreID and retail is the process:
/api/stores/1234/retail/products

The first question that comes up here is if I should return full products here or URIs to their individual resources on /api/products/ ... the pro would be clearly that the caller does not need to retrieve each individual product from /api/products, the con would be that this would cause a caching headache on the /api/stores/1234/retail/products URI.
To complicate things, those products of course also have prices. Also here, a product does not have one price, but multiple ones that is also dependent of the StoreID and the Process, besides other factors. In reality, prices are direct children of products, so:
/api/products/ABCD/prices

would be the obvious choice, but again, as StoreID and Process are relevant to pre-filter the prices, an URI like:
/api/stores/1234/retail/products/ABCD/prices

would be more appropriate.
At the same time, there are other subresources of products that will not make sense to have under this URI, like product details. Those would clearly only make sense directly under /api/products/ABCD/details as they are not dependant on the store or process.
But this looks somehow messy to me. But at the same time, solving this by only having queryparam filters to solve it directly on the product resource, is not much nicer and does not enforce the caller to provide both, StoreId and process:
/api/products?store=1234&process=retail
/api/products/ABCD/prices?store=1234&process=retail

Even more, process or storeid does not have anything to do with the product, so querying for it directly on product seems odd. For prices, it would make sense, though.
So my question is: is there a good way to solve this that i don't see? And: would you recommend returning full products when they are a subresource - and what do you think about handling (HTTP) caching when doing that?

A:
The first question that comes up here is if I should return full
  products here or URIs to their individual resources on /api/products/
  [...] the con would be that this
  would cause a caching headache on the /api/stores/1234/retail/products
  URI.

I would definitely return the full products - imagine the amount the client would have to do if it would simply want to display a list of product names. Ideally this endpoint would be paginated (query string can include something like &pageSize=10&pageNumber=2, for example).
Also there are various caching solutions around this - for example you can cache all the products in a data structure service like Redis.

To complicate things, those products of course also have prices [...]
  and details subresource.

Looking at the Richardson Maturity Model level 3, this would be where links come into play, and you could have something like this under a product resource:
<link rel = "/linkrels/products/ABCD/prices"
      uri = "/products/ABCD/prices?store=1234&process=retail"/>

and another similar link for the product details resource.
@Roman is right, REST is meant to be discoverable, clients should simply follow links (that can have long/ugly uris), instead of having to memorize them (like in SOAP, for example).


text:
Q: How to define React Class/Function components in TypeScript (With typechecking) How to define React Class/Function components in TypeScript and have working typechecking? I not found any full article about how to do it properly.
I am able to define Props and State interface, but I dont know how to define defaultProps, defaultState, etc...
Can someone help me (and others) out with some good style? Thanks!

A: For a much simpler structure you could go from this:
import * as React from "react";

const App = ({ value = 'Hello World' }: { value: string }) => (

{value}

 )

export default App

Where { value = 'Hello World' } is your default props and { value: string } is your typechecking
Here's cheatsheet guide that could help you with React + Typescript:
https://github.com/typescript-cheatsheets/react-typescript-cheatsheet

A: That's quite easy. You can still do it the old way. You can still declare it outside of your function, like with this example App.defaultProps:
import * as React from "react";
import "./styles.css";

export interface CatProps {
  catName: string;
  eyeColor: string;
  age: string;
}

export default function App(props: CatProps) {
  return (

      {props.catName} Cat, Eye Color: {props.eyeColor}, Age: {props.age}

  );
}

App.defaultProps = {
  catName: "Sandy",
  eyeColor: "deepblue",
  age: "120"
};

Working sample: Try it
Mess around a little bit, and change the defaultProps values.
Default State:
Using the example from above, you can define a defaultState, simply doing:
const [catName, setCatName] = useState('Sandy'); // define a defaultState value inside useState hook


text:
Q: ModalPopup click twice when IFrame XPAD is on the page I have a aspx page, with a modalpopup extender, and it's work perfect.
But I place an Iframe on the end of the page, and the modelpopup work only when I click the button twice. I can't find the answer for this problem.
<asp:UpdatePanel ID="UpdatePanel4" runat="server">
                <ContentTemplate>

                        Csatlakozási pont:
                        <input type="hidden" id="hdnCsatlakozasiPontKod" runat="server" value="0" />
                        <asp:TextBox ID="txtCsatlakozasiPont" runat="server" Width="480" onkeydown="return false;"></asp:TextBox>
                        <asp:Button ID="btnCsatlakozasiPont" runat="server" Text="..." />
                        <cc1:ModalPopupExtender ID="mpeCsatlakozasiPont" runat="server" CancelControlID="btnCancel"
                            TargetControlID="btnCsatlakozasiPont" OkControlID="btnOk" PopupControlID="pnPopup"
                            PopupDragHandleControlID="PopupHeader" Drag="true" BackgroundCssClass="modalBackground">
                        </cc1:ModalPopupExtender>
                        <asp:Panel ID="pnPopup" Style="display: none" runat="server">

                                    <asp:Button ID="btnCancel" runat="server" Text="x" CausesValidation="false" OnClientClick="return false;" />
                                    <asp:Button ID="btnOk" runat="server" Text="Ok" Style="display: none" CausesValidation="false"
                                        OnClientClick="return false;" />

                        </asp:Panel>

                </ContentTemplate>
            </asp:UpdatePanel>

When I delete the following part, the modalpopup work well again.

            <iframe src="http://ismts38105/viewer/ImageViewer.xbap?<%=Image%> width="1440"
                height="400" />

A: You need to set the permissions on your Internet Explorer. XBAP requires you add the domain/IP to the trusted sites, or else you will be unable to do anything with them.


text:
Q: What is the best code to use for Removing rel="nofollow" from woocommerce 'add to cart' buttons I have found a few versions of code that can be added to remove the nofollow from the 'add to cart' links in woocommerce.
The most recent code I found is:
add_filter( 'woocommerce_loop_add_to_cart_args', 'remove_rel', 10, 2 );
function remove_rel( $args, $product ) {
   unset( $args['attributes']['rel'] );
   return $args;
}

Will this do the job and where do I put the code?  I believe it needs to be put in the functions.php file but sometimes it mentions it needing to be in a child theme and others don't mention a child theme at all.
Any help would be great.
Thanks

A: This code works with WooCommerce 3.5.3. Add it to the functions.php of whichever theme you are using.


text:
Q: Product is repeating on next page automatically in magento Link of my site: http://www.classiquefurniture.com.au/index.php/
I have entered some products in this category: http://www.classiquefurniture.com.au/index.php/bookcases.html but some products are repeating automatically on 2nd page as well but thing is, the product is entered only once in backend. And some product is not displaying on any page.
Now one more strange thing: When I choose option (12 products per page) then some products are not displaying on any page but likewise when I choose (all product in one page) those products are displaying.
I don't know why this is happening. Its really surprising for me. Please help me in this matter.

A: A simple solution might be to enable the flat product catalog of Magento under  System > Config > Catalog > Frontend After reindexing, Magento will use the flat table for the store view on product listing pages on the frontend. It might be that solves the issue already for you.  If it doesn't solve your problem, try adding another sorting criteria, for example the entity_id.  You can do that using an event observer for the catalog_product_collection_load_before event. ($observer->getCollection()->setOrder('entity_id', 'ASC');).


text:
Q: Angular doesn't send the right data to firebase private currentInfo:string[];
private useruid: string;
...
constructor(private AngularAuth: AngularFireAuth,
    private db:AngularFirestore) { }

...

sendInfo(text:string){
    this.readInfo();
    this.currentInfo.push(text);
    this.db.collection('users').doc(this.useruid).update({
        Info: this.currentInfo
    })
}
...
readInfo(){
    this.useruid = this.AngularAuth.auth.currentUser.uid;
    this.db.collection('users').doc(this.useruid).snapshotChanges().subscribe(a=>{
      const data = a.payload.data() as {name:string, Info:string[]};
      data.Info.forEach(element => {
        this.currentInfo.push(element);
      });
    })
}

Good afternoon, I can't find the solution to this problem,
I have 1 method readInfo( ) that reads the current user info from firebase, this method works apparently when i try it aside from the other part of the code, however i want to update this info with some text:string, however when i run it, it reads the database simultaneously as it writes the new info this.currentInfo. So firebase doesn't update with the current info.
As an example, imagine I currently have as currentInfo = ["a","b","c"] and as text = "d", after y run the method sendInfo( ), only ["d"] is written in firebase.
Thank you in advance for the help!!

A: The snapshotChanges() method here is async so the writing is done before the reading is over. Then move your update statements into the subscribe call :
sendInfo(text:string){
    this.useruid = this.AngularAuth.auth.currentUser.uid;
    this.db.collection('users').doc(this.useruid).snapshotChanges().subscribe(a=>{
      const data = a.payload.data() as {name:string, Info:string[]};
      data.Info.forEach(element => {
        this.currentInfo.push(element);
      });
      // Add the text to currentInfo and save
      this.currentInfo.push(text);
      this.db.collection('users').doc(this.useruid).update({
        Info: this.currentInfo
      })...
    })
}

A: sendInfo(text:string){
this.readInfo(); //As Olivier Depriester said this function is called but you are not waiting for the data to be read.
this.currentInfo.push(text);
this.db.collection('users').doc(this.useruid).update({
    Info: this.currentInfo
})

}
for infinte loop issue, declare another copy of this.currentInfo and use one for the loop and another for the final values.


text:
Q: Do not want to show the default selection of cells at dragging time in SpreadSheetGear Scenario:
Select a cell, and after pressing the left button from the mouse and moving (dragging) to another cell it changes all the traversing cell's borders.
Expected behavior:
We do not need the default borders of cells when dragging one cell to another cell. We need only the source cell border and the destination cell border. (we can do this by changing border property)
Question:
How can remove the source to destination full cells range borders?
For more clarification please see this image.

A: Updated Answer
If you are asking whether you can alter the selection border (e.g., the blue border the WorkbookView renders in your screenshot) to only surround the top-left and bottom-rightmost cells (e.g., C3 and E5 only in your example) instead of surrounding the entire range selection (e.g., all of C3:E5), no, the behavior of how this range selection border is rendered cannot be modified in this manner.
If you are asking, apart from the range selection border, if you yourself can apply a cell border (via IRange.Borders APIs) to just these top-left / bottom-right cells, then this is possible:
IRange rangeSelection = workbookView.RangeSelection;
if (rangeSelection.CellCount > 1)
{
    // Get size of range selection
    int numRows = rangeSelection.RowCount;
    int numCols = rangeSelection.ColumnCount;

    // Create a new IRange representing only the top-left and bottom-right cells
    // of the range selection.
    IRange cornerCells = rangeSelection[0, 0]
        .Union(rangeSelection[numRows - 1, numCols - 1]);

    // Add a border to these cells.
    cornerCells.Borders.Weight = BorderWeight.Medium;
}

Original answer based off original question
SpreadsheetGear supports an IRange.Subtract(...) method that will remove the specified range from another range.  Example:
IRange range = worksheet.Cells["A1:B2"].Subtract(worksheet.Cells["B2"]);
Console.WriteLine(range.Address);
// OUTPUT: $A$1:$B$1,$A$2

That answers your direct question, though your description and diagrams might indicate you are asking for something beyond this but I cannot tell for sure.  If so, it would help if you can update your question to use a more concrete example, providing perhaps actual screenshots of the WorkbookView or "before" and desired "after" ranges for your use-case (e.g., A1:B2 is selected and I want to change this to "..."), any actions / features in Microsoft Excel itself that provide the behavior you are looking for (which my help in determining if the same is possible in SpreadsheetGear), etc.


text:
Q: How to get scrolling plot in Linux (using command-line tools)? Supposing I have a program that prints lines with data periodically, how can I turn then info them into graphical plot that updates itself each time new line available?

$ ./prog
10 44
20 66
30 55
40 58
50 59
55 58
60 77
^C

$ ./prog | scrollingplot

Window appears and updates on each line printed:

80|
  |                        ----
  |   ----     ______...__/
  |  /    -----
  | -
40|
-------------------------------
    10  20  30   40   50    60

# Note that ASCII art-style plot is just for example,
# I want simple X window like in mplayer.

There are enough tools for static data, but I haven't seen ones for updating data (except of ksysguard).

A: If you can run Perl, you could look into this script that seems to do exactly what you want. It is using GnuPlot for displaying the plot.
http://users.softlab.ece.ntua.gr/~ttsiod/gnuplotStreaming.html
GnuPlot is powerful and has many features. If you want to learn more about it, try googling for gnuplot tutorial.

A: Maybe I'm thinking too simple, but: Clear screen with clear and re-execute the plotting program?