text:
Q: java Regex: how to find real number not preceded by spaces and comma I have following piece of text:
"M -0.6,-0.5 V 256e-17 512.5 h 44.107422 c 20.577609,0 l-3,-4 2,2 -1.9e-12 , 0"

I want to make regex detecting all real numbers except ones preceded by comma. I can't do this, anyone can help me?
I wrote regex for opposite situation:
, *[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?

it detects every real number preceded by comma.
I'm using this expression for real number detection:
[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?

I've tried to do something with lookbehind, like that:
(?<!, *)[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?

but "Look-behind group does not have an obvious maximum length" or another error is served to me.
I'm thinking about two different ways:

*

*exclude numbers preceded by comma from all real numbers, but idk how,

*find numbers not preceded by comma, also idk how.

I'm using java.util.regex
Thank you and greetings,
MSZ.

A: You may use a regex like yours but with the lookbehind converted to an optional capturing group:
(, *)?([-+]?[0-9]*\.?[0-9]+(?:[eE][-+]?[0-9]+)?)

See its demo. Once you get a match, discard all those where Group 1 was matched.
See Java demo:
String s = "M -0.6,-0.5 V 256e-17 512.5 h 44.107422 c 20.577609,0 l-3,-4 2,2 -1.9e-12 , 0";
Matcher m = Pattern.compile("(, *)?([-+]?[0-9]*\\.?[0-9]+(?:[eE][-+]?[0-9]+)?)").matcher(s);
List<String> results = new ArrayList<>();
while (m.find()) {
    if (m.group(1) == null) {
        results.add(m.group(2));
    }
}
System.out.println(results);

Output:
[-0.6, 256e-17, 512.5, 44.107422, 20.577609, -3, 2, -1.9e-12]

A: EDIT: Since my previous regex that doesn't require any processing after matching doesn't work when the commas have spaces after them (sigh), here's a different solution that shouldn't take too many steps.
Link to new regex
First use the regex ((?<!([,\-+.0-9]))(?<![0-9][eE])(?<!, ))(\s*[-+]?+)((\d*\.\d+)|\d+)([eE][-+]?\d+)?. This will match the real numbers but also includes spaces before the numbers.
Then, to remove the spaces, you can do
Pattern
  .compile("((?<!([,\-+.0-9]))(?<![0-9][eE])(?<!, ))(\s*[-+]?+)((\\d*\\.\\d+)|\\d+)([eE][-+]?\\d+)?")
  .splitAsStream(inputYouWantToMatch)
  //You could also use regex like "^ *" to trim it, if you wish
  .map(str -> (str.startsWith(" ")) ? str.replaceFirst(" *", "") : str)
  .collect(Collectors.toList()) //or whatever you prefer to collect it

The other answer by Wiktor Stribizew is great, but this doesn't really require any processing later and (probably) works just as fine.
((?<!([,\-+.0-9]))(?<![0-9][eE]))[-+]?((\d*\.\d+)|\d+)([eE][-+]?[0-9]+)?.
If you want it to match numbers ending with a dot like 2., then you can use this:
((?<!([,\-+.0-9]))(?<![0-9.][eE]))[-+]?((\d*\.\d+)|\d+\.?)([eE][-+]?[0-9]+)?
Link to online regex tester for the first one (thanks for the link, Wiktor Stribizew)
It's the regex for a real number but it can't have these things before it

*

*commas (because you said so)

*plus or minus signs (so it doesn't match 2 in ,-2

*a digit and then 'e' (so it doesn't match 17 in ,2e17)

*other numbers (so it doesn't match 3 in ,23)

Also, between the optional plus or minus sign and the 'e' part, it has to either have more than one digit (\d+) or (zero or more digits followed by a period followed by one or more digits) so that it doesn't match empty input (forgive me for not using parentheses correctly, those "or"s would have been confusing otherwise.

A: Actually deciced to make this that way. Works perfectly.
// Parsing points. X'es are detected, when ',' is after number
matcher = Pattern.compile("(, *)?([-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?)").matcher(commandList.get(y));
ArrayList<Double> xPointsList = new ArrayList<Double>();
ArrayList<Double> yPointsList = new ArrayList<Double>();
// If it's y number, matcher.group(0) looks like this ", 123", Double.valueOf() throws an exception and number is read properly with matcher.group(2)
while(matcher.find()) {
    double number = 0;
    try {
        number = Double.valueOf(matcher.group(0));
        xPointsList.add(number);
    }
    catch(Exception e) {
        number = Double.valueOf(matcher.group(2));
        yPointsList.add(number);
    }
}


text:
Q: Number of free actions from group to set I'm currently stuck on a problem where we need to determine the number of free actions from $Z_{10}$ to the set $\lbrace 1,2,....,100\rbrace$. As I understand it, an action being 'free' implies that every stabilizer is just the set $\lbrace \epsilon \rbrace $. By the Orbit-Stabilizer theorem, this implies that the size of every orbit must be 10. As such, there will be ten different orbits for this action.
However, there's an immense number of different actions that will produce ten different orbits in the numbers 1-100... which always makes me doubt the validity of the answer. Is my reasoning sound? If so, might it be that only 'natural' actions of $Z_{10}$ are to be taken into consideration, as in, the ones that send an element of the set to its successor? In this case, the answer would be 10, I think.
I hope someone is able to shed some light on this problem, thank you in advance!

A: Everything you say makes sense; the question really comes down to what we mean by "number of ... actions."
Basically, you are looking for embeddings of $\mathbf{Z}_{10}$ into $S_{100}$ in which no element other than the identity fixes any point. Any such action will be completely determined by the action of $1$; and the property of not fixing any point means that the image of $1$ must be a product of 10 disjoint cycles, each of length 10.
Up to isomorphism (i.e., up to an automorphism of $S_{100}$), there is only one such element; that is, any two embeddings of $\mathbf{Z}_{10}$ into $S_{100}$ are related by conjugation (renaming the elements of ${1,2,\ldots,100}$). So in fact, we would have just one and only one action, "essentially", namely the action will, up to relabeling the points, correspond to the action determined by
$$1\longmapsto (1,2,\ldots,10)(11,12,\ldots,20)\cdots(91,92,\ldots,100).$$
On the other hand, we may not want to consider the actions "the same"  unless they are completely identical. In that case, even as simple a change as mapping $1$ to
$$1 \longmapsto (2,1,3,4,\ldots,10)(11,12,\ldots,20)\cdots(91,92,\ldots,100)$$
instead will give us a "new" action. In this situation, the number of distinct actions will be equal to the index of the centralizer of
$$(1,2,\ldots,10)(11,12,\ldots,20)(91,92,\ldots,100)$$
in $S_{100}$. This centralizer has order $100$, so the total number of actions would be $100!/100 = 99!$. Oops. As Derek Holt points out, this particular computation is incorrect and silly (I was centralizing each $10$-cycle, and then compounding the error by miscomputing $10\times 10$ instead of $10^{10}$). The centralizer actually has larger order: you can first permute the $10$ cycles amongst themselves ($10!$ ways), and then permute each cycle in $10$ different ways to obtain the same permutation. So you get $10!(10^{10})$ elements in the centralizer, giving you a total of
$$\frac{100!}{10!10^{10}}$$
actions.
Or you may want actions to be "the same" if they agree up to an automorphism of $\mathbf{Z}_{10}$, but otherwise be identical in $S_{100}$; in that case, you would want to divide by $|\mathrm{Aut}(\mathbf{Z}_{10})|$ as well.
Or maybe somewhere in between.
If you want to consider two actions as being "the same" if the orbits are the same (which is, I think, what you describe under "the one(s) that send an element of the set to its successor", i.e., the next smallest element in the orbit, or in the case of the largest element in the orbit, to the smallest), then you want to count the number of partitions of $\{1,2,\ldots,100\}$ into subsets of size $10$ each. You get
$$\frac{1}{10!}\binom{100}{10}\binom{90}{10}\cdots\binom{10}{10}$$
possible partitions.

redpajama_set_name: RedPajamaStackExchange


text:
Q: fade in page elements from top-to-bottom What are some good resources for fading in page elements from top to bottom?
I have a Magento project where I have a several flexsliders and some other static elements, and I am interested in trying to fade in the different rows of elements from top to bottom as they load. Presently the static elements load and then the flexslider loads last, making the page loading inelegant.
Does anyone have some suggested plugins or similar resources that I can investigate? I am going to use lazy loading for some of the static images, but that doesn't solve the vertical loading problem. Preferably based on jquery if not javascript straight.

A: If you're trying to do something like fade in the first row, then the next row, then the next row, and so on, you can use a custom queue:
// Set up your queue of fadeIns:
$(row_selectors).each(function() {
    $(this).queue(
        'fade_in_tans',
        function() {
            $(this).fadeIn().delay(delay_in_ms_if_desired).dequeue('fade_in_trans');
        }
    );
});
// now initiate the first fadeIn:
$(first_row_selector).dequeue('fade_in_tans');


text: Q: How to restrict openfiledialog to select only directory and folders not a file in c# I have an input files with .si extensions.On button click i m trying to display all files with .si extension which are exist in diretory or in a particular folder.


text:
Q: Combining Two Images with Matching Features So basically I am working on trying to combine two images together which overlap each other. I have used the registration estimator app to check and they have matched features.
My program at the moment picks up the matched features and displays them, with the other image in the background.
What I want to do is be able to replicate what the registration estimator app does and combine the two images where their features meet.
I have looked at a panorama example but it doesn't seem to work for whatever reason.
clear all;
close all;
I1 = rgb2gray(imread('q2.jpg'));
I2 = rgb2gray(imread('q20.jpg'));

points1 = detectSURFFeatures(I1);
points2 = detectSURFFeatures(I2);

[f1, vpts1] = extractFeatures(I1, points1);
[f2, vpts2] = extractFeatures(I2, points2);

indexPairs = matchFeatures(f1, f2) ;
matchedPoints1 = vpts1(indexPairs(:, 1));
matchedPoints2 = vpts2(indexPairs(:, 2));

figure; ax = axes;
showMatchedFeatures(I1,I2,matchedPoints1,matchedPoints2,'Parent',ax);
title(ax, 'Putative point matches');
legend(ax,'Matched points 1','Matched points 2');

% Create new Image ...
% joinedImg = Combined image where matched points overlap

So basically what I need to do is be able to create a new image and imwrite it which is the combined image of the two images. Something like a panorama but not because its just where the points meet and overlap

A: I think you chose the wrong example from MATLAB documentation.
You can use estimateGeometricTransform example.
The following code gives you the transformation tform:
[tform,inlierPtsDistorted,inlierPtsOriginal] = ...
    estimateGeometricTransform(matchedPtsDistorted,matchedPtsOriginal,...
    'similarity');

The warp code is: Ir = imwarp(distorted,tform,'OutputView',outputView);
For fusing the images, you can use imfuse function.
Following code combines estimateGeometricTransform example with imfuse example:
%https://www.mathworks.com/help/vision/ref/estimategeometrictransform.html
original  = imread('cameraman.tif');
%imshow(original);
%title('Base image');
distorted = imresize(original,0.7);
distorted = imrotate(distorted,31);
%figure; imshow(distorted);
%title('Transformed image');
ptsOriginal  = detectSURFFeatures(original);
ptsDistorted = detectSURFFeatures(distorted);
[featuresOriginal,validPtsOriginal] = extractFeatures(original,ptsOriginal);
[featuresDistorted,validPtsDistorted] = extractFeatures(distorted,ptsDistorted);
index_pairs = matchFeatures(featuresOriginal,featuresDistorted);
matchedPtsOriginal  = validPtsOriginal(index_pairs(:,1));
matchedPtsDistorted = validPtsDistorted(index_pairs(:,2));
%figure;
%showMatchedFeatures(original,distorted, matchedPtsOriginal,matchedPtsDistorted);7
%title('Matched SURF points,including outliers');
[tform,inlierPtsDistorted,inlierPtsOriginal] = estimateGeometricTransform(matchedPtsDistorted,matchedPtsOriginal, 'similarity');
%figure;
%showMatchedFeatures(original,distorted, inlierPtsOriginal,inlierPtsDistorted);
%title('Matched inlier points');
outputView = imref2d(size(original));
Ir = imwarp(distorted,tform,'OutputView',outputView);
%figure; imshow(Ir);
%title('Recovered image');

%https://www.mathworks.com/help/images/ref/imfuse.html
C = imfuse(original, Ir, 'falsecolor', 'Scaling', 'joint', 'ColorChannels', [1 2 0]);
figure; imshow(C);
title('fuse image');

%Write result image to file.
imwrite(C, 'fused.png');

It could be helpful if you attach your input images: 'q2.jpg' and 'q20.jpg'.


text:
Q: Chrome Web App with A Lot of Images How to Download and Store? What is the best way to create a chrome web app and have about 300-400MB of images download initially on load to a local storage and then be able to retrieve those images at any time in my app.
I want my app to look at local storage first, and if images exist use those images and if they don't then download from an online repository. My app can have upwards of over 1000 images and I don't want to code individual XMLHTTPRequests for each image.

A: You're looking for ServiceWorker. This API will allow you to implement a cache for various URLs on your website and to prefetch/predownload these URLs. You will probably want to use the newer Cache API, however, to do this rather than storing the downloaded images in localStorage.


text:
Q: Vue.js mounted function not accessing component properties I'm not very new to Vue.js which is probably why I feel like I've been running mad all morning :). While creating a component, which I usually do, quite frequently, in this case, I had to initialize Google Maps within the mounted function, which seems like the right place to do that. In the mounted function, I would access the id property of a nested input field and attach an event listener to it. Pretty simple right?
Well, I figured that when I try to use the component multiple times on my page, I'm somehow accessing the same (seemingly shared) this variable within the mounted function.
Not sure why exactly this happens and/or if it's a feature but to make it even weirder, the props yield correct values within the template. (and within the methods as well)
Component Definition
<template>

    <input
      type="text"
      :id="id"
    />

</template>

Using my component...
<template>

    <LocationInput id="id1"/>
    <LocationInput id="id2"/>

</template>

What I get at the end of the day is the correct id values in the template but in my console, the exact same object and id are logged as you can see below. Notice how the _uid property is the same thing for both.

To make matters even worse, after modifying the this variable in the mounted function, while inspecting, I observed that the second component has that property modified as well. So they are essentially sharing the same object, which is extremely weird.
I would like to know if anyone has had similar issues and how to deal with it.

A: No self-closing tags for components.

Vue templates need to be valid HTML. There are no "self closing tags"
in HTML5, it's an XHTML syntax which is now outdated and you should
never use it.

(Later note:)

FYI self-closing tags works in 2.0 as long as you don't use in-dom
templates.

You may also be having an issue with camelCase vs. kebab-case. The snippet below behaves as expected.

Vue.component('locationInput', {
  template: '#location-input-template',
  props: ['id'],
  mounted() {
    console.log('Component object representation ==> ', this._uid)
    console.log('ID ==> ', this.id)
  }
});

new Vue({
  el: '#my-travel-app'
});

<template id="location-input-template">

    <input type="text" :id="id">

</template>

  <location-input id="id1"></location-input>
  <location-input id="id2"></location-input>


text:
Q: Why createAsyncThunk doesn't pass through extraArgument type? I have a Redux store with an extra argument for thunk middleware configured according to docs. That extra argument contains axios instance which I want to access from my thunks.
This example works, but passing extraArgument type explicitly for every thunk is annoying. Also I have to get rid of the dependency between store and slice, to move slice (as a part of a feature) to a shareable library. What's the right approach here?
//store.ts
const store = configureStore({
  middleware: getDefaultMiddleware => {
    return getDefaultMiddleware({
      thunk: {
        extraArgument: { axiosInstance }
      },
    })
  },
  reducer: rootReducer,
});

//devices.ts
interface ExtraArgument {
  extra: {
    serviceApi: AxiosInstance;
  };
}

interface FetchResultFromServer {
  count: number;
  entities: Device[];
}

export const fetchDevices = createAsyncThunk<FetchResultFromServer, void, ExtraArgument>(
  'devices',
  async (args, { extra }) => {
    const { serviceApi } = extra;
    const response = await serviceApi.get('/devices');
    return response.data;
  }
);


text:
Q: How to mount data volume outside container? I have to make a container in A directory and mount in B directory that /home/B. Now how to mount Container A in B so that I can read files from B. I just want to make 1 container that is in A directory and need to read files of B directory so for this I am mounting it. Here is what I have wrote in dockerfile
From python:2.7-slim
WORKDIR /app
ADD . /app
RUN ls

A: docker run --name=container1 -v /home/B:/common_dir <image_name>
docker run --name=container2 -v /home/B:/common_dir <image2_name>

after it you have 2 running containers with the common folder /home/B on your host
both 2 containers can read/write to /home/B


text:
Q: Sort mongo results if a value exists in the field or not I have a Student struct which looks like this.
type Student struct {
    Name            string                         `json:"name" bson:"name"`
    Marks           int                            `json:"marks" bson:"marks"`
    Subjects        []string                       `json:"subjects" bson:"subjects"`
}

I am using opts.Sort to Sort the result. More on that
opts.Sort = bson.D{
    {Key: "marks", Value: -1},
}

I also want to sort the results by Subjects, in a way that, if for any Student, if the subject Math exist, it should be sorted on top (descending order), before sorting it by marks
I tried doing this
opts.Sort = bson.D{
    {Key: "subjects", Value: bson.M{"$in": "math"}},
    {Key: "marks", Value: -1},
}

I know this doesn't seem right because I am not passing 1 or -1 but I don't know how can I modify it to make it work.
What am I missing here?.

A: You can't do this with a single "simple" query.
Query the records sorted by marks, and do a second sorting in Go, by moving documents having "math" subject to the front.
If you need to do this only in MongoDB, you may redesign: e.g. you may add a boolean field to documents storing the information whether the student has "math", so you can easily include that in sorting.
Do note however that you may do this with the Aggregation framework. This is the query that would do what you need:
db.students.aggregate(
    {$addFields:{"hasMath": {$in:["math", "$subjects"]}}},
    {$sort:{hasMath: -1, marks: -1}}
)

What this does is essentially what I suggested: it adds a hasMath field, telling if the student has "math" in the subjects array, and then sorts documents first by hasMath descending, then by marks descending.
This is how you can do that in Go using the official mongo-go driver:
c := ... // Obtain students collection

pipe := []bson.M{
    {"$addFields": bson.M{
        "hasMath": bson.M{"$in": []any{"math", "$subjects"}},
    }},
    {"$sort": bson.D{
        {Key: "hasMath", Value: -1},
        {Key: "marks", Value: -1},
    }},
}

curs, err := c.Aggregate(ctx, pipe)
if err != nil {
    // Handle error
    panic(err)
}

var students []Student
if err := curs.All(ctx, &students); err != nil {
    // Handle error
    panic(err)
}


text:
Q: Is this denominator of a posterior distribution the marginal distribution of Y? From Wikipedia:
, where

Is the denominator (above pics are from Wiki) the marginal distribution of Y?
Intuitively, it seems that way so that when we cross-multiply, LHS and RHS are mirrors.
Proof:
Denom = $\int_{\mathbb{R}} f_X(x)f_{Y | X=x}(y) dx$
$= \int_{\mathbb{R}} f_{XY}(x,y) dx$ (um, right?)
$= f_Y(y)$
Is that right?

A: I can see one other thing to comment on here, so I will answer.

*

*Yes, that's correct.

*It would be unusual to use $x$ for a parameter, and if it weren't a parameter, even more unusual to call $f_{Y|X=x}$ a likelihood; That usage there in the Wikipedia article is in total contradiction to the earlier use in the same article (where it was a random variable), and also breaks the typical convention of using Greek letters for parameters. Conventions can be broken when there's a reason to; I see no reason for it to have been done there.

A: Yes. Bayes Theorem is just a restatement of the basic definiton of conditional probability:
$$P(A|B)=\frac{P(A\cap B)}{P(B)}=\frac{P(A)P(B|A)}{P(B)}$$
And in the denominator:
$$P(B)=\sum_{i\in\mathcal{I}}P(A_i)P(B|A_i)$$
Where the $\{A_i\}$ are a mutually exclusive and collectively exhaustive partition of the sample space.
You should be able to think of your formula for the posterior in the continuous mixture case in these terms if it helps.


text:
Q: Can I look upp a key in a tcl dict when having the value? Reverse lookup I have an tcl dict containing keys and their values. Is there a way to do a "reverse lookup" eg looking for the value, and retrieving the key.
I know that this does not sound like state of the art programming, but the dict already exists in my code and I would not like to recreate it the other way around just because of this one time I need it.

A: You can use the dict filter command. Values can repeat, so you should expect more than one single key.
set d [dict create a b c d e b]
# note that the "b" value is repeated for keys "a" and "e"

dict filter $d value b
-> a b e b

So you can use something like this:
set lookupVal b
dict for {k v} [dict filter $d value $lookupVal] {
    lappend keys $k
}

puts $keys
-> a e

A: If your values are unique, the dirty-hack way to get the key for a particular value is this:
set theKey [dict get [lreverse $theDict] $theValue]

I wouldn't particularly recommend it as it's a type-buster, but it will do the right thing. (If you've got the same value several times, this will return the key for the first instance.)
Note that you still retain the original dictionary in $theDict if you do this. (Well, assuming you're satisfied with Tcl's detailed type semantics when behind-the-scenes type conversions are happening.)

If you're thinking about doing this more than very occasionally, consider keeping a reversed dictionary around alongside the original so that you can do the lookup rapidly. This applies even if you use the dict keys [dict filter …] solution; linear scans of anything large can definitely slay you otherwise.


text:
Q: How to make SVG break aspect ratio I have and SVG and I need to fulfil the browser windows. It´s an  with sag assigned to src attribute. No mather I do, always keep aspect ratio. I even force image width and height via CSS but I can´t make it work.
The url: https://dl.dropboxusercontent.com/u/814218/svg/svg_test.html
Any suggestion?

A: Finally, I find the solution by recommendation of #SVG IRC Mozilla Group. The related info is here: http://codepen.io/jonitrythall/blog/preserveaspectratio-in-svg
I need to use, viewBox and preserveAspectRatio attributes. That´s the solution.
Here the final sample SVG source code:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 1282 802" preserveAspectRatio="defer none"
xml:space="preserve">
<polygon opacity="0.2" fill="#FF00FF" stroke="#93278F" stroke-miterlimit="10" points="-1.5,0 -1.5,800 638.5,400 "/>
<polygon opacity="0.2" fill="#009245" points="0,801 1280,801 640,401 "/>
<polygon opacity="0.2" fill="#FFFF00" stroke="#FFFF00" stroke-miterlimit="10" points="638.5,400 1278.5,800 1278.5,0 "/>
</svg>

A: Try using:
.autoHeight{
width: 100%;
height: 100%;
}

#bg img {
max-width: 100%;
width: 100%;
height: 100%;
}

And your html should looks like:

But, basically, you need use: for both, width and height: 100%

A: Do you mean you need something like this?


text:
Q: How to put an application in stop stage without destroing on back button? I am developing server client application so my client android connected to server that is run in pc.
if i am in any other activity rather than main activity than I pressed back button than i go to previous one but when I pressed back button  when I was in home screen of my application than application destroy and go to home screen of mobile
so after that i hold on home button of mobile and again start my application although i am connected to pc than also i have to again give IP address and port number
so i have to solve it by using putting my application in stop stage when i pressed back button and again if  i select through hold on home button than back to main screen of my application without enter again IP and port
public void onBackPressed() {

    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_MAIN);
    intent.addCategory(Intent.CATEGORY_HOME);

    startActivity(new intent(mainactivity.this , home.class);

    return;
}

A: You are doing it wrong to put network client related code inside Activity. You ought to be using Service for that and bind or send commands to it from Activities.

A: Actually you on the right way, doing some stuff on implementing onBeackPressed() method, but home button should be untouched.
However when you start your app t=you can use predefined settings for development.
For example: if DEVELOPMENT = true, use some stub IP.


text:
Q: return a string value from post data I am working with a company that posts data to my server and i am receiving the xml data this way :
using (StreamReader reader = new StreamReader(Request.InputStream))
{
    String xmlData = reader.ReadToEnd();
    XmlDocument doc = new XmlDocument();
    doc.LoadXml(xmlData);
}

But now they need me to return a value to them.
Do i return a value by posting back like they posted to me ?
Or how does it work when i want to return a value for their post?
The value that should be returned is a string.
Project built in c#

A: To return any kind of string to your vendor, try something like this :
using (StreamReader reader = new StreamReader(Request.InputStream))
{
    String xmlData = reader.ReadToEnd();
    XmlDocument doc = new XmlDocument();
    doc.LoadXml(xmlData);
    Response.Write("MyString");
}

Specify whatever in "MyString" as per need.

A: You have included the tag asp.net-mvc-3 in your question, so i guess you are in a controller.
If you want to return a simple string just use the Content method:
public ActionResult MyAction() {
    return Content("Your String")
}

A: If you only need to return a simple type, such as an integer, string or true/false, then it should be sufficient to simply use:
Response.Write(returnVal);

Or similar.  This isn't necessarily the "correct" way to do it, and if you need to return a complex type, such as an object, then you might be best serializing it and returning it as json or XML.  Here is an example using xml as the output type on a blank aspx page:
us
using System;

namespace myProject
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            var o=new customObject
                {
                    prop1 = "Value1",
                    prop2 = "Value2",
                    prop3 = "Value3"
                };
            var x = new System.Xml.Serialization.XmlSerializer(o.GetType());
            Response.ContentType = "text/xml";
            x.Serialize(Response.Output, o);
        }
    }

    public class customObject
    {
        public string prop1;
        public string prop2;
        public string prop3;
    }
}

Hope that all makes sense.

A:
Do i return a value by posting back like they posted to me?

No. You have to send a response.
Or how does it work when i want to return a value for their post?

All you have to do is return the proper action result from your action. For ex. you can use ContentResult to return a simple string and JsonResult to return json etc.


text:
Q: How can I create a certain layout shape using css grid-template-areas? I'm trying to create a layout of square divs something like this:
      xx
     xxxx
    xxxxxx
    xxxxxx
     xxxx
      xx

I'm not understanding css grid-template-area so well.
I tried:
html

 ...

css
.container {
 display: grid;
 grid-template-areas:
  "... ... square square ... ..."
  "... square square square square ..."
  "square square square square square square"
  "... square square square square ..."
  "... ... square square ... ..."
;

#square {
  width: 50px;
  height: 50px;
  grid-area: square;
}
}

If I could ask for pointers and help, thank you.
I can only see one square.

A: I just made it like so for now (it looks dirty but it shows up fine):

.grid {
    width: 80%;
    display: grid;
    margin: 0 auto;
    align-items: center;
    justify-content: center;
    grid-template-columns: repeat(6, 50px);
    grid-template-areas:
    ". . two twoa . ."
    ". four foura fourb fourc ."
    "sixa sixb sixc sixd sixe sixf"
    "six2 six2a six2b six2c six2d six2e"
    ". four2 four2a four2b four2c ."
    ". . two2 two2a . ."
    ;
}

.hole {
    height: 50px;
    width: 50px;
    background-image: url('../images/dirt.png');
    background-position: bottom;
    background-size: cover;
}

.two-hole {
    grid-area: two;
}
.two-holeA {
    grid-area: twoa;
}
.two-hole2 {
    grid-area: two2;
}
.two-hole2A {
    grid-area: two2a;
}

.four-hole {
    grid-area: four;
}
.four-holeA {
    grid-area: foura;
}
.four-holeB {
    grid-area: fourb;
}
.four-holeC {
    grid-area: fourc;
}

.four-hole2 {
    grid-area: four2;
}
.four-hole2A {
    grid-area: four2a;
}
.four-hole2B {
    grid-area: four2b;
}
.four-hole2C {
    grid-area: four2c;
}

.six-holeA {
    grid-area: sixa;
}
.six-holeB {
    grid-area: sixb;
}
.six-holeC {
    grid-area: sixc;
}
.six-holeD {
    grid-area: sixd;
}
.six-holeE {
    grid-area: sixe;
}
.six-holeF {
    grid-area: sixf;
}

.six-hole2 {
    grid-area: six2;
}
.six-hole2A {
    grid-area: six2a;
}
.six-hole2B {
    grid-area: six2b;
}
.six-hole2C {
    grid-area: six2c;
}
.six-hole2D {
    grid-area: six2d;
}
.six-hole2E {
    grid-area: six2e;
}

1

2

3

4

5

6

7

8

9

0

11

12

13

14

15

16

17

18

19

2

22

23

24

25

A: first of all, you can't use the same id for more than one element. Second, you can achieve this using flexbox by centering and resizing the children as desired without any CSS grid as following

#container{
display: flex;
    flex-direction: column;
    align-items: center;
    }
.rhombus{
background:red;
width:90vw;
height: 13vh;
margin: 1vh;
}
#first-row{
width:30vw
}
#second-row{
width:60vw
}
#third-row{
width:90vw
}
#fourth-row{
width:90vw
}
#fifth-row{
width:60vw
}
#sixth-row{
width:30vw
}


text:
Q: Three.js set texture to inline svg I am not sue of this is even possible but instead of setting a texture to a jpg like THREE.TextureLoader().load('./texture1.jpg')
I want to set the texture to an INLINE SVG (I want to animate with javascript GSAP).
Is this possible?  Probably not :(

A: Sorry, it's not. You can't use a SVG file as a texture. However, you can load SVG files in three.js via THREE.SVGLoader and then create shape meshes from the resulting path data.
But keep in mind this is a one-time operation. If you animate the SVG, you won't see any effect after the loading process.


text:
Q: Running a command line command with PHP So my problem is the following: I have an R markdown file on my Ubuntu 18.04.3 server that I want to be knitted via command line (this works fine with Rscript -e "rmarkdown::render('path/to/file.Rmd')"), so I tried to run this from PHP with the exec() command (obviously using escape characters). The output from PHP is the following:
Execution haltedArray ( [0] => Error: unexpected input in "rmarkdown::render(\" [1] => Execution halted )
when running the following lines of PHP:
exec("Rscript -e \"rmarkdown::render(\'path/to/file.Rmd\')\" 2>&1", $output);
print_r($output);

What is the unexpected input?

A: Don't escape the inner ''s
exec("Rscript -e \"rmarkdown::render('path/to/file.Rmd')\" 2>&1", $output);
.. or change the outermost string characters to use single quotes instead of double:
exec('Rscript -e "rmarkdown::render(\'path/to/file.Rmd\')" 2>&1', $output);
.. dont escape both unless you use both, which is ugly and confusing
exec("Rscript -e \"rmarkdown::render(\\\"path/to/file.Rmd\\\")\" 2>&1", $output);


text:
Q: Getting error like 'Testing1' is not a valid value for AxdEnum_XMLDocPurpose" in AX 2012 r2 I am completely new to MS AX technology and recently been allocated to support AX connector which is developed based on .net technologies.
Just to have small intro about AX connector:
    1. This connector is one that acts as a mediator between AX tool and JB(jitterbit) studio.
    2. Whenever a request(like create/read/update record) issued from JB studio, AX connector takes this
       request and communicate with AX tool and perform the required operation and gives back respective
       response back to JB studio.
So, now talking about the issue, a create record request has been issued from JB studio, this particular request is transformed into XML format and received by the AX connector(mediator) and when connector hand over this request to AX tool getting below error:
'Testing1' is not a valid value for AxdEnum_XMLDocPurpose"
Expectation:
If request successfully executed/completed, will have 1 record created in MS AX 2012 > CustTable.
Actual:
Getting above error or similar error with respect to other field.
My XML create record Request Below:
<?xml version="1.0" encoding="UTF-8"?>
<Request>
<body>
<executeoperation>
<operation>
<wsdlendpoint>DEMO:8101/.../wsdlendpoint>
<servicename>CustomerServiceClient</servicename>
<name>create</name>
<Parameters xmlns:xsi="">www.w3.org/.../XMLSchema-instance"
 xmlns:ns3="">schemas.microsoft.com/.../sharedtypes" xmlns:ns2="">schemas.microsoft.com/.../Customer"
 xmlns:ns1="">schemas.microsoft.com/.../Arrays" xmlns:ns="">schemas.microsoft.com/.../datacontracts">
<CallContext>
<ns:Company>Microsoft</ns:Company>
<ns:Language>Hindi</ns:Language>
<ns:LogonAsUser xsi:nil="true"/>
<ns:MessageId xsi:nil="true"/>
<ns:PartitionKey xsi:nil="true"/>
<ns:PropertyBag xsi:nil="true"/>
</CallContext>

<Customer>
<ns2:SenderId xsi:nil="true"/>
<ns2:ValidToDateTime timezone="GMTPLUS0530CHENNAI_KOLKATA_MUMBAI"
 xsi:type="ns3:AxdExtType_CreatedDateTime"/>
<ns2:CustTable>
<ns2:_DocumentHash xsi:nil="true"/>
<ns2:AccountNum>SH_11285</ns2:AccountNum>
<ns2:AgencyLocationCode xsi:nil="true"/>
<ns2:BankAccount xsi:nil="true"/>
<ns2:BankCentralBankPurposeCode xsi:nil="true"/>
<ns2:BankCentralBankPurposeText xsi:nil="true"/>
<ns2:BankCustPaymIdTable xsi:nil="true"/>
<ns2:BirthCountyCode_IT xsi:nil="true"/>
<ns2:BirthDate_IT>1985-01-12</ns2:BirthDate_IT>
<ns2:BirthPlace_IT>India</ns2:BirthPlace_IT>
<ns2:CashDisc xsi:nil="true"/>
<ns2:CCMNum_BR xsi:nil="true"/>
<ns2:ClearingPeriod xsi:nil="true"/>
<ns2:CNAE_BR xsi:nil="true"/>
<ns2:CNPJCPFNum_BR xsi:nil="true"/>
<ns2:CommercialRegister xsi:nil="true"/>
<ns2:CommercialRegisterInsetNumber xsi:nil="true"/>
<ns2:CommercialRegisterSection xsi:nil="true"/>
<ns2:CommissionGroup xsi:nil="true"/>
<ns2:CompanyChainId xsi:nil="true"/>
<ns2:CompanyIdSiret xsi:nil="true"/>
<ns2:CompanyNAFCode xsi:nil="true"/>
<ns2:ContactPersonId>test@test.com</ns2:ContactPersonId>
<ns2:CreditRating xsi:nil="true"/>
<ns2:Curp_MX xsi:nil="true"/>
<ns2:Currency>USD</ns2:Currency>
<ns2:CustClassificationId xsi:nil="true"/>
<ns2:CustGroup>10</ns2:CustGroup>
<ns2:CustItemGroupId xsi:nil="true"/>
<ns2:CustTradingPartnerCode xsi:nil="true"/>
<ns2:DAXIntegrationId xsi:nil="true"/>
<ns2:DefaultDimension>
<ns3:Values>
<ns3:Value>
<ns3:Name>Rakesh1</ns3:Name>
</ns3:Value>
</ns3:Values>
</ns2:DefaultDimension>
<ns2:DefaultDirectDebitMandate xsi:nil="true"/>
<ns2:DefaultInventStatusId xsi:nil="true"/>
<ns2:DestinationCodeId xsi:nil="true"/>
<ns2:DlvMode xsi:nil="true"/>
<ns2:DlvReason xsi:nil="true"/>
<ns2:DlvTerm xsi:nil="true"/>
<ns2:EinvoiceEANNum xsi:nil="true"/>
<ns2:EndDisc xsi:nil="true"/>
<ns2:EnterpriseCode xsi:nil="true"/>
<ns2:EnterpriseNumber xsi:nil="true"/>
<ns2:FactoringAccount xsi:nil="true"/>
<ns2:FederalComments xsi:nil="true"/>
<ns2:FineCode_BR xsi:nil="true"/>
<ns2:FiscalCode xsi:nil="true"/>
<ns2:FreightZone xsi:nil="true"/>
<ns2:IdentificationNumber xsi:nil="true"/>
<ns2:IENum_BR xsi:nil="true"/>
<ns2:INSSCEI_BR xsi:nil="true"/>
<ns2:IntBank_LV xsi:nil="true"/>
<ns2:InterestCode_BR xsi:nil="true"/>
<ns2:InventLocation xsi:nil="true"/>
<ns2:InventProfileId_RU xsi:nil="true"/>
<ns2:InventSiteId xsi:nil="true"/>
<ns2:InvoiceAccount xsi:nil="true"/>
<ns2:IssuerCountry_HU xsi:nil="true"/>
<ns2:LineDisc xsi:nil="true"/>
<ns2:LineOfBusinessId xsi:nil="true"/>
<ns2:LvPaymTransCodes xsi:nil="true"/>
<ns2:MainContactPersonnelNumber xsi:nil="true"/>
<ns2:MainContactWorker xsi:nil="true"/>
<ns2:MarkupGroup xsi:nil="true"/>
<ns2:MCRMergedParent xsi:nil="true"/>
<ns2:MCRMergedRoot xsi:nil="true"/>
<ns2:Memo xsi:nil="true"/>
<ns2:MultiLineDisc xsi:nil="true"/>
<ns2:Name>Shalini1</ns2:Name>
<ns2:NIT_BR xsi:nil="true"/>
<ns2:numberSequenceGroup xsi:nil="true"/>
<ns2:OrderEntryDeadlineGroupId xsi:nil="true"/>
<ns2:OrgId>457848</ns2:OrgId>
<ns2:OurAccountNum xsi:nil="true"/>
<ns2:PackMaterialFeeLicenseNum xsi:nil="true"/>
<ns2:Party>Connector</ns2:Party>
<ns2:PartyCountry xsi:nil="true"/>
<ns2:PartyState xsi:nil="true"/>
<ns2:PassportNo_HU xsi:nil="true"/>
<ns2:PaymDayId xsi:nil="true"/>
<ns2:PaymentReference_EE xsi:nil="true"/>
<ns2:PaymMode>Credit</ns2:PaymMode>
<ns2:PaymSched xsi:nil="true"/>
<ns2:PaymSpec xsi:nil="true"/>
<ns2:PaymTermId xsi:nil="true"/>
<ns2:PBACustGroupId xsi:nil="true"/>
<ns2:PdsCustRebateGroupId xsi:nil="true"/>
<ns2:PdsRebateTMAGroup xsi:nil="true"/>
<ns2:PriceGroup xsi:nil="true"/>
<ns2:RegNum_W xsi:nil="true"/>
<ns2:ResidenceForeignCountryRegionId_IT xsi:nil="true"/>
<ns2:Rfc_MX xsi:nil="true"/>
<ns2:SalesCalendarId xsi:nil="true"/>
<ns2:SalesDistrictId xsi:nil="true"/>
<ns2:SalesGroup xsi:nil="true"/>
<ns2:SalesPoolId xsi:nil="true"/>
<ns2:SegmentId xsi:nil="true"/>
<ns2:ShipCarrierAccount xsi:nil="true"/>
<ns2:ShipCarrierAccountCode xsi:nil="true"/>
<ns2:ShipCarrierId xsi:nil="true"/>
<ns2:StateInscription_MX xsi:nil="true"/>
<ns2:StatisticsGroup xsi:nil="true"/>
<ns2:SubsegmentId xsi:nil="true"/>
<ns2:SuframaNumber_BR xsi:nil="true"/>
<ns2:SuppItemGroupId xsi:nil="true"/>
<ns2:SyncEntityId xsi:nil="true"/>
<ns2:TaxBorderNumber_FI xsi:nil="true"/>
<ns2:TaxGroup xsi:nil="true"/>
<ns2:TaxLicenseNum xsi:nil="true"/>
<ns2:TaxPeriodPaymentCode_PL xsi:nil="true"/>
<ns2:TaxWithholdGroup_TH xsi:nil="true"/>
<ns2:VATNum xsi:nil="true"/>
<ns2:VendAccount xsi:nil="true"/>
</ns2:CustTable>
</Customer>
</Parameters>
</operation>
</executeoperation>
</body>

<authInfo>
<domain>##JB####</domain>
<username>AX2012#######</username>
<password>##########</password>
</authInfo>
<timeoutValue>300</timeoutValue>
</Request>

Above request is received in my AX connector and sent to MS AX tool. In the above request there are some mandatory fields like AccountNum, name etc. If I perform create operation with only mandatory fields values, everything works fine. If in case I provide values for non manadatory fields like Company, BirthDate_IT, Party filled in values I am getting below error.
Instance validation error: 'Testing1' is not a valid value for AxdEnum_XMLDocPurpose
Please help me with your ideas. Also plz let me know for pre-requisites, articles to go through understand AX tables, their schemas and valid values for those table fields.
Awaiting your help & suggestions.
Thanks in advance.
Regards,
Rakesh k

A: The error is straight forward...you're passing bad data somewhere...wherever "Testing1" is being used.
Testing1 is not valid for the AX enum XMLDocPurpose.
If you look in the AOT in AX and find the XMLDocPurpose enum located at \Data Dictionary\Base Enums\XMLDocPurpose you will see Testing1 is not valid...unless you've customized XMLDocPurpose and added Testing1, which I highly doubt.


text:
Q: Https отправка логина пароля Необходимо передать на сервер логин и пароль, с http только начала разбираться.
И мне кажется все это не безопасным , если делать GET до я могу просто брутфорсом долбиться на сервер с логином и паролем пока тот не ответит , что логин и пароль правильный , c POST та же история приложение смогут разобрать на исходник и посмотреть что я отправляю и куда и так же брутфорсом. Или я в чем-то ошибаюсь?

A: Передача пароля через Get является небезопасной, т.к. данные передаются в строке запроса, а эту строку логирует сам веб-сервер (тогда пароль окажется в текстовом файле в открытом виде) и все промежуточные Proxy, при настройках по умолчанию. Если ставить цель перехватывать пароли, то можно на proxy-серверах записывать и POST-запросы, по этому данные авторизации следует передавать только по HTTPS, благо есть let's encrypt и дешевые сертификаты.

A: Сейчас практически все используют защищенное соединение, то есть HTTPS. Передача пароля по GET это не правильно. Как написали выше, от брутфорса спасет только двух этапная аутентификация ( Как пример: получение СМС кода, либо получение кода Google Auth / Либо отправка кода на почту ). Либо вы можете сделать ограниченное число попыток ввода логина пароля, далее делать блокировку IP адреса, с которого пытались войти, на какое то время.


text:
Q: What are the RESTful best practices on defining a query parameter with an or condition? I would like to know, following RESTful best practices in which ways should I define an url like the following:
/people?q="email=aa@aa.com||phone=11111"

The point would be to search for a person either by their email address or phone depending on what they've inserted on a search box.
I've been reading a few guides on best practices in using RESTful services but none seem to talk about this situation.

A: REST means you follow standards by building the (uniform) application interface.
Currently there is no standard solution for general querying with GET. There are many non standard URL query languages you could use. E.g. RQL, OData, most of the structure of database REST API URIs: e.g. mongodb, etc... So try not to reinvent the wheel. As an alternative you can send a serialized query in a query param as you did in your example. It can be on any standard query language, e.g. SPARQL if you use REST with RDF vocabs like hydra. If you don't then you have to describe it in the documentation of your vendor MIME type. (General querying means in this context that you don't know what the structure of the query will be.)
If you are looking for a non-general querying solution, then you can use any URI template as long as you describe somehow the parameters of your link with your RDF vocab or in the documentation of your vendor MIME type. If you don't understand what I am talking about, check the uniform interface constraint / self-descriptive message, HATEOAS sections of the manual or use wikipedia. (Non-general querying means in this context that you have an idea about what the query structure will be and you can describe it with URI templates.)
Be aware that you have to parse and validate and authorize these queries, so sending an SQL statement and running it through the database without any check can be fatal to your application.

A: How about:
/people?condition=OR&email=aa@aa.com&phone=11111

This would allow for refinements to the query method without changing the name/URL of the endpoint.

A: An alternative might be:
/people?or_email=aa@aa.com&or_phone=11111

This way you could also implement searching by mail and phone
/people?and_email=aa@aa.com&and_phone=11111

or even do more complex queries like:
/people?and_email=aa@aa.com&and_phone=11111&or_name=Alice


text:
Q: Meteor : findOne in Tracker.autorun on server crashes ... what to do? I want to populate an in-memory list of restricted words form a list stored into the database, because is desired to be dynamic. Sound simple huh? Well no, it is not! Why ?
Here is a short code of it :
if (Meteor.isServer) {
  Meteor.startup(function() {

    var configCollection = new Mongo.Collection('config');

    // An wrapper object for easy referencing
    var words = {
      faulty: ['f_word_here']
    }; // Some default faulty words

    var updateFaultyWords = function() {
      var config = configCollection.findOne();
      if (config) {
        words.faulty = config.faultyWords;
      }
    };

    // ------- Problematic Code ------

    Tracker.autorun(function() {
      updateFaultyWords();
    });

    // -------------------------------

    // later somewhere in the code

    var allowWord = function(word) {
      return words.faulty.indexOf(word) === -1;
    };
  });
}

I am using Tracker here because like it says in the docs I want to update my list in a reactive mode.

Tracker.autorun allows you to run a function that depends on reactive
  data sources. Whenever those data sources are updated with new data,
  the function will be rerun.

However this method crashes big time with a stack trace that I cannot understand:
W20151209-17:36:55.802(1)? (STDERR)
W20151209-17:36:55.802(1)? (STDERR) /Users/tiberiu/.meteor/packages/meteor-tool/.1.1.10.1b51q9m++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:245
W20151209-17:36:55.802(1)? (STDERR)                         throw(ex);
W20151209-17:36:55.803(1)? (STDERR)                               ^
W20151209-17:36:55.865(1)? (STDERR) Error: Can't call yield in a noYieldsAllowed block!
W20151209-17:36:55.865(1)? (STDERR)     at Function.Fiber.yield (packages/meteor/fiber_helpers.js:8:1)
W20151209-17:36:55.865(1)? (STDERR)     at Function.wait (/Users/tiberiu/.meteor/packages/meteor-tool/.1.1.10.1b51q9m++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:183:14)
W20151209-17:36:55.865(1)? (STDERR)     at Object.Future.wait (/Users/tiberiu/.meteor/packages/meteor-tool/.1.1.10.1b51q9m++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:397:10)
W20151209-17:36:55.865(1)? (STDERR)     at [object Object]._.extend._nextObject (packages/mongo/mongo_driver.js:986:1)
W20151209-17:36:55.865(1)? (STDERR)     at [object Object]._.extend.forEach (packages/mongo/mongo_driver.js:1020:1)
W20151209-17:36:55.866(1)? (STDERR)     at [object Object]._.extend.map (packages/mongo/mongo_driver.js:1030:1)
W20151209-17:36:55.866(1)? (STDERR)     at [object Object]._.extend.fetch (packages/mongo/mongo_driver.js:1054:1)
W20151209-17:36:55.866(1)? (STDERR)     at [object Object].Cursor.(anonymous function) [as fetch] (packages/mongo/mongo_driver.js:869:1)
W20151209-17:36:55.866(1)? (STDERR)     at [object Object].MongoConnection.findOne (packages/mongo/mongo_driver.js:776:1)
W20151209-17:36:55.867(1)? (STDERR)     at [object Object]._.extend.findOne (packages/mongo/collection.js:305:1)

What am I doing wrong ? Should I report this as a bug ?

A: You cannot use autorun on the server; it is client-side only functionality.
Use cursor.observe or cursor.observeChanges on the cursor that is returned by "find":
http://docs.meteor.com/#/full/observe
http://docs.meteor.com/#/full/observe_changes
I would also avoid using findOne if you have more than item in your collection (not sure if you're just omitting the arguments here or are just using it as a test case).


text:
Q: Exception when Loading TableViewCell from NIB I want to load TableViewCell from NIB so IssueTableCell.xib and my code is here:
static NSString *issueTableCellId = @"IssueTableCell";

 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:issueTableCellId];
NSInteger index = indexPath.row;

NSDictionary *d = [data objectAtIndex:indexPath.row];

UILabel *titleLabel = (UILabel *)[cell viewWithTag:101];
titleLabel.text= [d objectForKey:@"Name"];

UIImageView *imageView = (UIImageView *)[cell viewWithTag:100];
imageView.image=nil;

[self setCoverOfIssueAtIndex:index completionBlock:^(UIImage *img) {
    dispatch_async(dispatch_get_main_queue(), ^{
        UITableViewCell *cell = [table_ cellForRowAtIndexPath:[NSIndexPath indexPathForRow:indexPath.row inSection:0]];
        UIImageView *imageView = (UIImageView *)[cell viewWithTag:100];
        imageView.image=img;
    });
}];

NKLibrary *nkLib = [NKLibrary sharedLibrary];
NKIssue *nkIssue = [nkLib issueWithName:[self nameOfIssueAtIndex:index]];
UIProgressView *downloadProgress = (UIProgressView *)[cell viewWithTag:102];
UILabel *tapLabel = (UILabel *)[cell viewWithTag:103];
if(nkIssue.status==NKIssueContentStatusAvailable) {
    tapLabel.text=@"TAP TO READ";
    tapLabel.alpha=1.0;
    downloadProgress.alpha=0.0;
} else {
    if(nkIssue.status==NKIssueContentStatusDownloading) {
        downloadProgress.alpha=1.0;
        tapLabel.alpha=0.0;
    } else {
        downloadProgress.alpha=0.0;
        tapLabel.alpha=1.0;
        tapLabel.text=@"TAP TO DOWNLOAD";
    }

}
return cell; }

and my exception is

UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath

where is the error?

A: the error comes because compiler can't find reuseidentifier & it means your cell is nil
also maintain reuseidentifier properly so compiler can reuse it.
you should try this after dequeueReusableCellWithIdentifier:
You have to  check for nil and if cell is nil then create new cell
like this:
if(cell == nil)
{
//create new cell here...
}


text:
Q: iptables ports redirect does not work I am trying to setup a webserver running on localhost:8082 and redirect port 80 to it.
I have done it using the prerouting redirect nat table but it does not seem to work, the packets arrive to the rule, but don't seem to be forwarded on.
Here is what my iptable looks like:
ubuntu@ip-172-31-31-104:~$ sudo iptables -t nat -L -v -n
Chain PREROUTING (policy ACCEPT 6 packets, 348 bytes)
 pkts bytes target     prot opt in     out     source               destination
    6   320 REDIRECT   tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:80 redir ports 8082
    2    84 REDIRECT   tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:443 redir ports 8082
    0     0 REDIRECT   tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:38204 redir ports 38204

Chain INPUT (policy ACCEPT 14 packets, 752 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain OUTPUT (policy ACCEPT 381 packets, 27905 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain POSTROUTING (policy ACCEPT 381 packets, 27905 bytes)
 pkts bytes target     prot opt in     out     source               destination

My server logs look like this when I do a curl to localhost:8082:
2019/09/16 11:47:36 "GET http://localhost:8082/ping HTTP/1.1" from 127.0.0.1:40386 - 200 87B in 83.384µs

However when I try to do a request from outside, ei using postman, here is what the ip table looks like:
ubuntu@ip-172-31-31-104:~$ sudo iptables -t nat -L -v -n
Chain PREROUTING (policy ACCEPT 6 packets, 348 bytes)
 pkts bytes target     prot opt in     out     source               destination
   11   580 REDIRECT   tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:80 redir ports 8082
    2    84 REDIRECT   tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:443 redir ports 8082
    0     0 REDIRECT   tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:38204 redir ports 38204

Chain INPUT (policy ACCEPT 19 packets, 1012 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain OUTPUT (policy ACCEPT 395 packets, 28995 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain POSTROUTING (policy ACCEPT 395 packets, 28995 bytes)
 pkts bytes target     prot opt in     out     source               destination

notice the pkts and bytes columns do change, so it seems like the packet does get to the mahcine, but no new logs come in the server logs.
Is there another firewall or level of abstraction I need to worry about ?
Thank you for the help !
UPDATE
Here is the netstat, my server is called centrifuge, so it does listen on port 8082
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:8082          0.0.0.0:*               LISTEN      4163/centrifuge
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -
tcp        0      0 127.0.0.1:52698         0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:38204           0.0.0.0:*               LISTEN      4163/centrifuge
tcp6       0      0 :::22                   :::*                    LISTEN      -
tcp6       0      0 :::8088                 :::*                    LISTEN      26143/pm2-gui slave
tcp6       0      0 ::1:52698               :::*                    LISTEN      -

A: As @msp9011 and @user4556274 attempted to describe, you need to make your server listen to the "any address" instead of the "127.0.0.1" address. So depending on your webserver software, you change the so called "listen address" to either:

*

*replace 127.0.0.1 with nothing, i.e. remove the configuration

*replace 127.0.0.1 with 0.0.0.0 which means listen to any IP

*add 0.0.0.0 config to override the default 127.0.0.1

*something along these lines, check your documentation for "listen" or "bind" address and how to make it NOT listen to only local address

If you tell us more about what webserver software you have, we can perhaps assist with more detail on the above procedure.
Nevertheless, when successful, this line in your current netstat output:
tcp        0      0 127.0.0.1:8082          0.0.0.0:*               LISTEN      4163/centrifuge

should look like this when you have successfully updated the config:
tcp        0      0 0.0.0.0:8082            0.0.0.0:*               LISTEN      4163/centrifuge

The documentation quoted by @user4556274 means that if a new connection comes in with an interface that has local IP address 123.456.78.9, then the REDIRECT target will change the destination port to 8082 and the destination host to 123.456.78.9 (i.e. NOT 127.0.0.1). Because your configuration listen only to 127.0.0.1, it will not see packets with any other destination address. Address 0.0.0.0 is special and means it will listen to all addresses.


text:
Q: Trigger a report based entry of data I'm using MS SQL Server 2008R2 Standard Edition. I'm looking to trigger a report based on end entry of an end value into a certain table. The report was designed using SQL Server Business Intelligence Development studio.
Is it possible to do this without using data driven subscriptions. Data driven subscriptions are a feature missing from Standard Edition of MS SQL Server 2008R2.
I have a partial solution
CREATE TRIGGER tr_Report_INSERT_PHASE_PROC

ON [database].[dbo].[table]
AFTER INSERT
AS
IF EXISTS (SELECT * FROM [database].[dbo].[table] where process_value = 'End Of BATCH' )
BEGIN

    EXEC ReportServer.dbo.AddEvent @EventType='TimedSubscription',

    @EventData='xxxx' -- SubscriptionID from Report Manager URL
END
go

But this is triggering on on every insert and my table has historical process_value = 'End of Batch'. So I need to add an AND if serial_no = inserted serial_no to my condition.
How could I find the value of the inserted serial number?

A: I would add a bit column to the table called 'processed'.  Then update the procedure to:
CREATE TRIGGER tr_Report_INSERT_PHASE_PROC
ON [database].[dbo].[table]
AFTER INSERT
AS
IF EXISTS (
           SELECT *
           FROM [database].[dbo].[table]
           WHERE process_value = 'End Of BATCH'
                AND processed = 0 -- Only process if there is an unprocessed record
          )
BEGIN

    EXEC ReportServer.dbo.AddEvent @EventType='TimedSubscription',
    @EventData='xxxx' -- SubscriptionID from Report Manager URL

    -- Mark record as processed
    UPDATE [database].[dbo].[table]
    SET processed = 1
    WHERE process_value = 'End Of BATCH'
         AND processed = 0

END
go


text:
Q: wpf window is not activated I am launching a wpf application from a process. I am activating the main window on the event handler OnContentRendered. It is not getting activated. It returns false.
I am launching the application from a foreground process only. So it should be succeeded.
I set window.Topmost = true which works well. But Activate() returns false.
Window is on the topmost but not activated.
(Previously I asked one question without a clarification of actual problem. so I removed it)

A: See the MSDN documentation for SetForegroundWindow, which lists the rules for bringing a window to the front.
https://msdn.microsoft.com/en-us/library/windows/desktop/ms633539(v=vs.85).aspx
As an aside, it's very unusual to be calling this from OnContentRendered


text:
Q: Understanding COPY in postgresql and database/server hosting I am trying to understand a few things that arose from writing the COPY command in a SQL (.sql) file generated by Prisma. I understand that the filepath given to COPY is absolute/relative to where the database is running.
COPY table(value,other) FROM 'how/do/i/get/the/right/path' DELIMITER ',' CSV HEADER
Can someone explain when we have a hosted server and database (I believe they are usually on separate machines) how we would COPY from a csv file. The file is part of my typical git repo. After reading, my understanding is that the file would actually need to be where the database is hosted, is that correct? I am not sure I have a full grasp on this. Do hosted db servers also store files? I thought it would just be the database (I understand its a machine that could technically have anything on it but is that ever done?)
What would be the best way to access this file from the db? Would I use psql to connect to my database and then ssh into the server? I think there are different solutions like running a script which has psql in it and using the variation \COPY.
What I wanted ideally was to have the file as part of my repo and in a Prisma migrate file copy over the contents into a database table. If the above was incorrect, would someone be able to clarify how I would get the correct path into the command? I want it to be in a .sql file and put in the host variable (assuming that would work, depending on clarity on the above points regarding where files live).
Thanks!
Sources used:

*

*https://www.postgresql.org/docs/current/sql-copy.html

*https://www.cybertec-postgresql.com/en/copy-in-postgresql-moving-data-between-servers/


text:
Q: KitKat Animation and WebView rendering issue I am facing a rendering issue when running animation to simple View. My setup has ViewPager and the first Fragment contains a WebView and the second Fragment has custom progress indicator which I animate.
Following image shows the problem, somehow there is relation with the WebView although the indicator is fully in it's own Fragment. My guess is that the platform uses the same GPU renderer and when having a WebView there it gets broken.

Anyone had same issue/found a workaround?
Thanks.

A: My guess was somewhat correct. I found a hack to fix this issue.

*

*Extend WebView and override all constructors

*Set layer type to software for the custom WebView
API level >= 11
setLayerType(LAYER_TYPE_SOFTWARE, null);

API level < 11
try {
    Method setLayerType = getClass().getMethod("setLayerType",
            new Class[] { int.class, Paint.class });
    if (setLayerType != null)
        setLayerType.invoke(this, new Object[] { 1, null });
} catch (NoSuchMethodException e) {
} catch (IllegalArgumentException e) {
} catch (IllegalAccessException e) {
} catch (InvocationTargetException e) {
}

NOTE: This implementation dramatically affects performance of WebView.

A: Have a look at this,
https://developer.android.com/guide/webapps/migrating.html
In KitKat everything has pretty much changed.
Why don't you try and set the target SDK to 18. If you do this then the webview works in compatibility mode.


text:
Q: Installing Admissions Connect I have tried to install Admissions Connect package in dev org, EDA trial org using the link below:
https://install.salesforce.org/products/admissions-connect/latest/install
But before installing it asks to run a validation process to check the compatibility of the existing org. It always give the below error:

Admissions Connect licenses have not yet been provisioned to this
Salesforce org. Contact your Salesforce Account Executive to be sure
you have the correct licenses set up in your org.

I read the documentation, I thought there might be some permission set that needs to be assigned to the user, but I don't see anything like that anywhere. Do anyone of you aware of what needs to be done?
The documentation says:

To use Admissions Connect, you need an Enterprise, Unlimited, or
Developer Edition org with:

*

*Lightning Experience enabled

*Service Cloud Lightning Console enabled

*Full access to Contact, Account, and other standard objects

A: Admissions Connect is a paid, licensed product. You must purchase licenses for Admissions Connect before you can install it in your org.
Note that the Admissions Connect license is distinct from EDA (Education Data Architecture), which is free and open source.
Disclosure: I work for Salesforce and support the Education Cloud teams, but am not on the Admissions Connect team.


text:
Q: How to make clicking a menu button toggle show/hide of a menu sidebar component I have this three component app.js, header.js and menu.js. I'm trying to code when you click on menu button which is in header component it toggles (show/hide) menu component (menu-sidebar). Is it possible to make such communication in react with two components without jQuery? I tried with this tutorial but didn't succeed https://www.codementor.io/chrisharrington/how-to-build-a-sliding-menu-using-react-js-and-less-css-du107mpij
app.js:
import React, { Component } from 'react';

// components
import Header from './components/header';
import Menu from './components/menu';

class App extends Component {
  render() {
    return (

        <Menu />

    );
  }
}

export default App;

header.js:
import React, { Component } from 'react';

class Header extends Component {
    render() {
        return (

Lorem

Lorem

Ipsum

Feugiat

Tempus

Adipiscing

                            search

                            Menu

        );
    }
}

export default Header;

menu.js:
import React, { Component } from 'react';

class Menu extends Component {
    render() {
        return (

            <form className="search" method="get" action="#">
                <input type="text" name="query" placeholder="Search" />
            </form>

        {/* Links */}

Lorem ipsum

Feugiat tempus veroeros dolor

Dolor sit amet

Sed vitae justo condimentum

Feugiat veroeros

Phasellus sed ultricies mi congue

Etiam sed consequat

Porta lectus amet ultricies

        );
    }
}

export default Menu;

A: What you want to achieve is a very common pattern in React. Which is good because you can easily achieve it. You need to pass information from one component to another. So you need some kind of state management. There are different approaches. Your use case is easy, so no need for over-engineering. What you can do:
Pass props and functions (suitable here)
React uses a unidrectional data flow. It always goes from parent components to the children and by default children can not alter this data (called props). You this like so: .
You might wonder: If I only can pass info DOWN how to pass it UP, in your case from menu to header when the button is clicked. The react pattern to solve this is not to change data directly but rather pass a function from the parent component to the child that changes the data and distributes the new value. Let me show you. This is your app:
- APP
-- Header
-- Menu

Your parent is APP, children are header and menu. To get data from Menu to header you need to enable APP to manage this data by doing the following:

*

*define the variable you need as state of app, e.g. showMenu (in example below I used the constructor to set a default value).

*pass toggleMenu to the menu component with <Menu showMenu={showMenu}/>

*Pass a function to alter showMenu from App to Header to enable header to alter the toggle (or rather: call the function in App that actually alters it).

Here is a working sandbox: https://codesandbox.io/s/l4n7p435kz
Simplified for your case:
App
class App extends Component {

constructor(props){
    super(props);
    this.state = { showMenu: true };
}

toggleMenu() {
    this.state.showMenu = !this.state.showMenu //Flips true/false
}

render() {
    return (

        <Menu showMenu={this.state.showMenu}/>

    );
  }
}

Now you can use the function toggleMenu in your header like this:
<button onClick={this.props.toggleMenu()}/>

And the variable in your Menu component:
return (
    {this.props.showMenu &&
 ... your menu code
}
)

There might be a few kinks you need to consider to make this work but if you struggle just comment on it.
Use React-Redux (overkill)
If you have A LOT of communication between components and need to pass them down long ways things get unwieldy. For these kind of cases you can use redux. It basically capsules all state changes and remembers them in a separate storage. You could compare it to a state-database that has some standard interfaces. Feel free to read up on redux, but for your case something far simpler will do.


text:
Q: Suppose $f(x)$ is two-times differentiable, $f(x),\;f'(x),\;f''(x)$ are all $>0$ and there are $a,\,b>0$ such that $f''(x)\leq af(x)+bf'(x)$
Suppose $f(x)$ is two-times differentiable in $\mathbb R$, $f(x),\;f'(x),\;f''(x)$ are all $>0$ and there are $a,\,b>0$ such that
  $$
f''(x)\leq af(x)+bf'(x),\qquad\text{for all $x\in\mathbb R$}.
$$
  Show that
(1) $\displaystyle\lim_{x\to-\infty}f'(x)=0$.
(2) There is a constant $c$ such that $f'(x)\leq cf(x)$.
(3) Find the smallest $c$ in (2).

It's easy to prove (1), since otherwise $f(x)$ will not keep greater than zero.


text:
Q: How to write client and server with TLS encryption in Qt? I am relatively new to Qt and have no experience in network programming. I am trying to write a minimal TCP-client-server connection with TLS encryption in Qt using the QSslSocket class. So far I established a connection between server and client both running on localhost without encryption. For TLS encryption I found this example on gitHub: https://github.com/GuiTeK/Qt-SslServer
and followed carefully the given instructions (including the OpenSSL installation). Nevertheless I can not establish a connection between client and server (even if I set timeout to -1). The error messages for the server and client are depicted below.
Can anybody help me with that ? If someone has complete code examples in Qt for client and server which exchange data via TCP using encryption SSL encryption I would highly appreciate. I am working with QtCreator running Qt 5.5.0 MSVC2013 64 bit.

A: Launch Qt Creator. On Welcome screen hit "Examples" button.  Then at search box write "ssl". You will see several fully working Qt examples for ssl clients and servers. This is the good place for start. Also read this link.


text:
Q: Search multiple files though sub folders VB.net I'm having a hard time trying to figure it out how to find multiple files through sub folders, I'm looking for different file names and I think that's why I can't solve it.
"file_name" in the code is the name of the varible, I pull the name of the document from the data base which it's stored in a field without the extension and then when it finds the .docx/doc file it should convert it to pdf.
    Dim di As DirectoryInfo = New DirectoryInfo("\\192.168.1.70\sisint\court\
agreements")

        For Each fi In di.GetFiles(file_name, SearchOption.AllDirectories)

            'seleccionamos los archivos con las extensiones de Word
            If fi.Extension.ToUpper = ".DOC" Or fi.Extension.ToUpper = ".DOCX" Then
                ListaArchivos.Add(fi.FullName)
                ListaNombres.Add((fi.Name.Substring(0, fi.Name.Length - fi.Extension.Length)))

            End If

        Next

A: To search a directory with multiple sub directories for a file you can use the following line of code:
Dim folders As List(Of String) = New DirectoryInfo("C:\Test").EnumerateFiles("test.txt", SearchOption.AllDirectories).[Select](Function(d) d.FullName).ToList()

Replace "C:\Test" with the directory to search and "test.txt" with the filename to search for. If the same file name is in multiple directories all iles matching that name will be returned.
To find multiple file names, just loop through your list(file_name) replacing "test.txt" with the file. How you save all the output is up to you. You can add everything found to 1 large list and then convert them all to pdf's, or you can convert them as you find them.
Here is an example:
Private Function FindFiles() As List(Of String)

    Dim allFilesFound As New List(Of String)

    Dim dirSearch = "C:\Test"

    Dim file_name As New List(Of String) From {"test.txt", "test2.txt"}

    For Each file In file_name
        allFilesFound.AddRange(New DirectoryInfo(dirSearch).EnumerateFiles(file, SearchOption.AllDirectories).[Select](Function(d) d.FullName).ToList())
    Next

    Return allFilesFound

End Function

Keep in mind that the more files in file_name and the farther up the Directory tree you start searching from, the longer this will take. If you are dealing with large amounts of files, then consider using recursion so you can find all files in one pass. You can take a look here Recursively search folder with subdirectories in .NET and modify the code demonstrated there to fit your search pattern.


text:
Q: Can VBA be used to change the sort order of the Microsoft Access Navigation Pane..? Does the Microsoft Access 2007 Navigation Pane have a simple .Sort property that can be accessed by VBA..?
I would like to add some AutoExec code to a database which explicitly sets the NavPane to sort by name each time a user opens it.
I understand changing the NavPane system tables is a big can of worms, but I was wondering if something as simple as the sorting could be changed through an object property somewhere.

A: MS has an alternative approach which could basically be described as "roll your own replacement navigation page". Links to their information are on https://support.office.com/en-us/article/customize-the-navigation-pane-ccfb0ee7-d72f-4923-b4fb-ed6c15484244. I have not yet tried to follow their instructions, so I cannot report on how easy, difficult or effective this is.


text:
Q: How to minimize jade script tag by using uglifyjs? I have the following script tag in my jade file:
!!!5
html(lang="en")
   head
   body
     script(type='text/javascript')
       function something() {
         alert("test")
       }

How can I minimized by using uglifyjs or any existing minification?

A: You should be able to do it using a jade filter.
Here's a module that looks like it's implimented one: https://npmjs.org/package/jade-filter


text:
Q: Why is the container null for static fragment? I have the following Layout with static fragment and RelativeLayout as parent:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="@dimen/activity_vertical_margin">

    <fragment
        android:id="@+id/list_fragment"
        android:name="com.listfragmenttest.MyListFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

</RelativeLayout>

Yet the container or parent comes up null in OnCreateView:
public class MyListFragment extends ListFragment {

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                                       Bundle savedInstanceState) {
        return inflater.inflate(R.layout.my_list_fragment, container, false);
    }
}

Is this the normal behavior for Static fragment?

A: Yes, that's how it is implemented. Fragments inflated statically from XML get a null as parent container.
For details, consult FragmentManager source. In particular, onCreateView() that handles fragment instantiation from layout inflation, setting mInLayout = true and calls to performCreateView() that are conditional on mInLayout.


text:
Q: Ubuntu 12.04 CD-R doesn't start when i start the PC I've got an Ubuntu CD-R and a Samsung Laptop with Windows 8 64 Bit.
When i start the Laptop with the Ubuntu CD-R in it, it shows the Samsung-sign, makes a "Beep" tune, shows the normal "Loading-Circle" and then Windows 8 starts normaly...
I know something about changing the boot device in the Bios, but my laptop doesn't show the normal message "Press F12 to Bios setup", its just the Samsung-sign and then Windows 8 boots, so i dont know how to enter the bios...
Tank you for your help and sorry for my bad English :)

A: Without a specific model, it's hard to tell you exactly how to do this, but:
SafeBoot is likely to be blocking CD boot, so you are indeed headed in the right direction.
Note that not all BIOSes want F12 - some like DEL, some F2 and so on.
Also, ensure you are in fact pressing the F key - on my HP Pavilion G6, to get F2 I have to hold [fn] + [BRIGHTNESS DOWN], to get F3 I have to hold [fn] + [BRIGHTNESS UP] and so on.


text:
Q: All images resize except for one I am building a website for myself as a sort of a CV.
Things are going pretty well, though I do have one problem.
In the CSS I targeted all the images in the jumbotron, but still, one of the images won't resize when I make the browser smaller, the rest does. I have no idea why so after already searching and trying, I thought maybe you guys could help me out here.
What does resize are the icon's for social media and contact.
What doesn't resize, is the catcolor.img (yeah it's a picture of me holding a cat in the Azores, really cute and all that).

.jumbotron {
  /*background: url('image.jpg') no-repeat center center;
  background-size: cover;*/
  height: 400px;
  background-color: transparent;
    margin-left: 7%;
    margin-right: 7%;
}

.jumbotron img {
  display: block;
  margin-left: auto;
  margin-right: auto;
  border-radius: 10px;
  border: 4px solid white;
    max-width: 100%;
    height: auto;
}

.jumbotron h1, p {
  color: black;
}

.jumbotron p {
  font-size: 18px;
  margin-top: 40px;
}

#nopadding {
  padding-left: 0px;
}

.btn-default {
  text-decoration: none;
  margin-top: 15px;
  background-color: #281A1F;
  color: white;
  font-size: 14px;
}

.btn-default:hover {
  background-color: #5D6263;
  color: white;
}

.jumbotron li {
  list-style: none;
  margin: 13px;
}

.jumbotron ul {
  padding: 0px;
}

.contact img {
  border: 0px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>

TITLE

SUBTITEL

        Go to latest creation


text:
Q: Measurement of total AC resistance (including radiation resistance) of a coil using LCR meter If we measure AC resistance of a coil using an LCR meter (or impedance analyser), does it include both ohmic resistance and radiation resistance? I understand that the radiation resistance is negligibly small for coil at low frequencies, however, for example, if we submerge a coil underwater, radiation resistance can be comparable to ohmic resistance.
I am measuring resistance of a coil underwater and I noticed a significant increase in resistance compared to the air surrounding. I wanted to confirm that the increase is due to the increase of radiation resistance. Maximum frequency is 1 MHz, and coil self resonance is way above the measurement range - we can safely neglect the effect of parasitic capacitance.

A:
I am measuring resistance of a coil underwater and I noticed a
  significant increase in resistance compared to the air surrounding. I
  wanted to confirm that the increase is due to the increase of
  radiation resistance.

Water conducts quite well and of course sea water conducts a lot better. What you are seeing is the effect of induced eddy currents (electrical) in the water. Literally, your coil creates a changing magnetic field and this induces an electric field in the water and the water acts as a resistor and electrical currents are produced.
It has nothing to do with radiation resistance - radiation resistance is a phenomena associated with the transmission of EM power through a medium. What you are seeing is a resistance due to near-field effects and eddy currents in the water.

A: Yes, radiation resistance is indistinguishable from other impedance, it appears at the terminals of the coil/antenna.
But watch out - at high frequencies, the impedance and radiation resistance of the loop created by the wires from meter to coil could be significant compared to that of the coil itself. Once you are in the regime of measuring antenna properties, the entire circuit is an antenna. Careful comparison of a circuit with and without the coil might help.


text:
Q: pd series from dictionary and xlsx generation with the values from the dict I would like to generate an XLSX file with keys and values from a Dictionary. Example bellow
statistics = {
        "a:": f"textt",
        "b": " ",
        "c": f"{len(list_1)}",
    }

    df = pd.DataFrame(
        {'Statistics': pd.Series(statistics.keys()),
         'Statistics Values': pd.Series(statistics.values()))

writer = pd.ExcelWriter(f"{output_xlsx_file}", engine='xlsxwriter')

df['Statistics'].to_excel(writer, sheet_name='Statistics', index=False)
df['Statistics Values'].to_excel(writer, sheet_name='Statistics', startcol=1, index=False)

The expected result is to have an xlsx file with 2 columns in the col 1 dicts keys in the second column dicts values
This does happen, with one exception for the dicts values if they are a number like 3rd one in my example within the XLSX there is quote infront of the number

Any idea how can make that being a number and get rid of that quote, if I want to add in xlsx the numbers it will fail as it's not seen as a number.


text:
Q: Error while hosting CodeIgniter Framework to online server I need to solve the below issue:

When I tried to hosting codeIgniter framework to my online server, this error occurred.
A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /home/lviscomp/public_html/system/core/Output.php:528)

Filename: core/Common.php

Line Number: 573

Backtrace:

A PHP Error was encountered

Severity: Error

Message: XCache: Cannot init

Filename: Unknown

Line Number: 0

Backtrace:

A: For Above Error header information already sent...
Click here!
XCache: Cannot init
Try Disable XCACHE from the Php configuration..
if this doesn't work ..
I think this is a question for your host.

A: I had the same  xcache issue in my Laravel application. I resolved it by upgrading the PHP version.
I think this might help you as well.

*

*Go to your cPanel

*Go to software section and click "select PHP version"

*Change your PHP version from "native" to 5.4 or 5.5 (It will give you a list of drivers with checkboxes)

*Select Xcache and enable it

*Save your settings as well as PHP version

I hope it will work.


text:
Q: Exponential moving average (EMA) with different number of observations per day but equally weighted observations I have a DataFrame df1 with observations according to one specific ID. The number of observations per ID varies over time. For each ID, I try to calculate an exponential moving average (EMA) over 3 days. Each observation should be weighted equally within a rolling window of 3 days, regardless of the number of observations on a specific date.
df1:
            ID   Value
Date
2022-01-01  ID1  1
2022-01-01  ID2  0
2022-01-01  ID3  -1
2022-01-02  ID1  1
2022-01-02  ID3  0
2022-01-03  ID1  -1
2022-01-03  ID1  1
2022-01-04  ID1  0
2022-01-04  ID1  1
2022-01-04  ID2  1
2022-01-04  ID3  -1
2022-01-06  ID2  1
2022-01-06  ID2  1
2022-01-06  ID3  -1

So far I constructed a simple moving average (SMA) by creating a pivot table with the sum and count of the values per ID on each date.
pivot:
            sum         count
ID          ID1 ID2 ID3 ID1 ID2 ID3
Date
2022-01-01  1   0   -1  1   1   1
2022-01-02  1   0   0   1   0   1
2022-01-03  0   0   0   2   0   0
2022-01-04  1   1   -1  2   1   1
2022-01-06  0   2   -1  0   2   1

Then I took the rolling sum over 3 days of the values and divided it by the number of observations and created SMA:
SMA:

ID          ID1   ID2   ID3
Date
2022-01-01  NaN   NaN   NaN
2022-01-02  NaN   NaN   NaN
2022-01-03  0.50  0.0   -0.5
2022-01-04  0.40  1.0   -0.5
2022-01-06  0.25  1.0   -1.0

Is there a similar approach for the EMA, so that I exponentially weight each observation over the period regardless of the number of observations on the days?
Thanks a lot and best regards!
For reproducability:
df1 = pd.DataFrame({
    'Date':['2022-01-01', '2022-01-01', '2022-01-01', '2022-01-02', '2022-01-02', '2022-01-03', '2022-01-03', '2022-01-04', '2022-01-04', '2022-01-04', '2022-01-04', '2022-01-06', '2022-01-06', '2022-01-06'],
    'ID':['ID1', 'ID2','ID3', 'ID1', 'ID3', 'ID1', 'ID1', 'ID1', 'ID1', 'ID2', 'ID3', 'ID2', 'ID2', 'ID3'],
    'Value':[1, 0, -1, 1, 0, -1, 1, 0, 1, 1, -1, 1, 1, -1]})
df1 = df1.set_index('Date')

pivot = df1.explode('ID').pivot_table(
    index='Date', columns='ID', values='Value', fill_value=0, aggfunc=['sum', 'count'])

SMA = pivot.rolling(3).sum().xs('sum', axis=1, level=0).div(RollingSum.xs('count', axis=1, level=0))

A: Sorry, as I am new, I do not have the option to leave a comment. But, you can try pandas .emw similar to SMA right?
pivot.ewm(span=3, min_periods=3).mean().
I'm not exactly sure what RollingSum does in your code; but try this:
EMA = pivot.ewm(span=3, min_periods=3).mean().div(RollingSum.xs('count', axis=1, level=0))


text:
Q: ProGuard Configuration File is not working Trying to use Proguard in an Project for Shrinking, Optimization and Obfuscation purposes.
I'm Using Following External libraries in my Project.
     - ActionBarSherlok : com.actionbarsherlock
        - SherlokNavigationDrawer : com.sherlock.navigationdrawer
        - GoogleplayLib : com.google.android.gms
        - ViewPagerIndicator : com.viewpagerindicator
        - MyAppPackage : ...

     - External Jar used are
       - HttpMime :
       - GoogleAnalytics
       - Crittercism
       - UniversalImageLoader

# This is a configuration file for ProGuard.
# http://proguard.sourceforge.net/index.html#manual/usage.html

-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-verbose

# repackage and optimize
-repackageclasses "com.example.data"

# Keep a fixed source file attribute and all line number tables to get line
# numbers in the stack traces.
# You can comment this out if you're not interested in stack traces.
#-renamesourcefileattribute SourceFile
#-keepattributes SourceFile,LineNumberTable

# keep annotations
-keepattributes *Annotation*

# keep the licencing service classes from Google
-keep public class com.google.vending.licensing.ILicensingService
-keep public class com.android.vending.licensing.ILicensingService

# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native
-keepclasseswithmembernames class * {
    native <methods>;
}

# keep setters in Views so that animations can still work.
# see http://proguard.sourceforge.net/manual/examples.html#beans
-keepclassmembers public class * extends android.view.View {
   void set*(***);
   *** get*();
}

# We want to keep methods in Activity that could be used in the XML attribute onClick
-keepclassmembers class * extends android.app.Activity {
   public void *(android.view.View);
}

# For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations
-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

-keep class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator *;
}

-keepclassmembers class **.R$* {
    public static <fields>;
}

# an example on how to keep an entire package
# -keep class com.google.zxing.**
#############################################################################
#-keep class com.data.metro.services.**
-keep class com.actionbarsherlock.**  { *; }
-keep class com.sherlock.navigationdrawer.**  { *; }
-keep class com.viewpagerindicator.**  { *; }

-libraryjars libs
-keep class crittercism.sdk.**  { *; }
-keep class crittercism.android.**  { *; }
-keep class org.apache.http.entity.mime.**  { *; }
-keep class google.ads.**  { *; }
-keep class google.analytics**  { *; }
-keep class google.android.gms.**  { *; }
-keep class google.tagmanager.**  { *; }
-keep class com.nostra13.universalimageloader.** { *; }

#############################################################################
# The support library contains references to newer platform versions.
# Don't warn about those in case this app is linking against an older
# platform version.  We know about them, and they are safe.
-dontwarn android.support.**

# an example if you don't want to be warned about missing libraries
# -dontwarn javax.naming.**

#############################################################################

# remove logging, note that this removes ALL logging, including the
# Log.e statements
-assumenosideeffects class android.util.Log {
    *;
}

#-optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/*
#-optimizationpasses 5
#-allowaccessmodification
#-dontpreverify

After Exporting the application it doesn't work at all.
Reason being are code are not shrinking properly it removes some used code as well, I found this when I saw the code using dex2jar and jdgui.
Needs suggestions, What changes are required in this proguard.cfg Cofiguration file.

A: I think you need to add lines in your Proguard file to tell to shrink all useful code .
So to include SherLock codes you will need to add all useful class in Proguard as
-keep class com.example.classname.**{
       *;
 }

 -keep interface  com.example.classname.**{
      *;
 }

and to include Jars use below lines
 -injars bin/classes
 -injars libs
 -outjars bin/classes-processed.jar

 -libraryjars /libs/nameofjarfile.jar

like these above lines.
Hope it will help you .
Please try and let me know

A: I think you need to import the libraries for a correct compilation. Try with the folowing parameters (for instance):
-injars libary1.jar
-libraryjars '/Java/jre6/lib/rt.jar'


text:
Q: If I have 2 Video cards in the same computer without SLI or Crossfire will it boost performance at all? I have this motherboard with 2 PCI-E Graphics cards, apparently only one of them is actually x16 what ever that means.
http://www.gigabyte.com/products/product-page.aspx?pid=2625#ov
If I put the same graphics card in each slot, will I get a performance boost in games? (I belive SLI is not supported on this board, although the card I have do support it)
This is the video card I have and I was going to get another one.
http://www.gigabyte.eu/products/product-page.aspx?pid=2804#ov
And can someone please explain the difference between "PCI-E 16 x4" and "PCI-E 16 x16"?
Thanks heaps.
UPDATE:
Performance Mark Tests showed 10FPS in Complex 3D tests on the x4 Slot and 57+ FPS on the x16 slot.
Nothing else really differed.

A: The motherboard support CrossFire, which is a brand name for SLI between 2 ATI (AMD) videocards. Your current videocard is an NVidia one, and indeed doesn't support CrossFire.
As for the slot sizes, PCI-e is intentionally designed to allow imperfect combinations. For instance, as a rule a 16x videocard will still work (with lower performance) in a 4x slot. Your motherboard has an example of such a 4x slot. Now, why is it just as big as the other, 16x slot? That's because many of those videocards are big, heavy monsters. Using the mechanical format of a 16x slot prevents the card from falling out.

A: Some games can use a dedicated card for PhysX simulation.
Other than that, I can't come up with anything that the second card could be used for (in terms of enhancing performance).
The difference between x1, x2, x4, x8 and x16 PCIe is the maximum throughput of the bus (how much data can pass between the card and the rest of the system in a given time).
Directron lists the following speeds:
PCI Express 1x   250 [500]* MB/s
PCI Express 2x   500 [1000]* MB/s
PCI Express 4x  1000 [2000]* MB/s
PCI Express 8x  2000 [4000]* MB/s
PCI Express 16x 4000 [8000]* MB/s
PCI Express 32x 8000 [16000]* MB/s

* Note 1 - Since PCI Express is a serial based technology, data can be sent over the bus in two directions at once. Normal PCI is Parallel, and as such all data goes in one direction around the loop. Each 1x lane in PCI Express can transmit in both directions at once. In the table the first number is the bandwidth in one direction and the second number is the combined bandwidth in both directions. Also please note that in PCI Express bandwidth is not shared the same way as in PCI, so there is less congestion on the bus.
Update: Table above contains speeds for PCI Express 1.0 bus. For version 2.0, multiply all bandwidths by 2. For example a PCI Express 2.0 16x slot has a max bandwidth of 8000 MB/s one way or 16000 MB/s both ways.


text:
Q: Initial villager spawning On the initial generation (before any player interactions, and not repopulation) of a village, what determines where the villagers will spawn? Will they spawn inside houses within a radius of the center? Or outside on the gravel paths/farms?.

A: During generation, a structure has the option to run the following function:
protected void spawnVillagers(World worldIn, StructureBoundingBox sbb, int X, int Y, int Z, int maxVillagers)
{
    if (this.villagersSpawned < maxVillagers)
    {
        for (int i = this.villagersSpawned; i < maxVillagers; ++i)
        {
            int xOffset = this.getXWithOffset(X + i, Z);
            int yOffset = this.getYWithOffset(Y);
            int zOffset = this.getZWithOffset(X + i, Z);

            if (!sbb.isVecInside(new BlockPos(xOffset, yOffset, zOffset)))
            {
                break;
            }

            ++this.villagersSpawned;
            EntityVillager entityvillager = new EntityVillager(worldIn);
            entityvillager.setLocationAndAngles(xOffset + 0.5D, yOffset, zOffset + 0.5D, 0.0F, 0.0F);
            entityvillager.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityvillager)), (IEntityLivingData)null);
            entityvillager.setProfession(this.func_180779_c(i, entityvillager.getProfession()));
            worldIn.spawnEntityInWorld(entityvillager);
        }
    }
}

As long as the number villagers spawned for this individual structure is less than the maximum input, it will attempt to spawn a villager at the specified coordinates (which are initially relative to the corner of the structure's bounding box) provided it's not inside a block. To reiterate: the villagersSpawned is not for the entire village, but for this individually-spawned structure.
An example of the function being called, which is used by the "church" structure:
this.spawnVillagers(worldIn, structureBoundingBoxIn, 2, 1, 2, 1);

The maximum number of villagers to spawn inside a church is 1 and will always spawn at the provided offset coordinates.
Out of all the structures available, only large and small farms do not use this function.
Here are images where villagers will always spawn, represented by armor stands (though rotation of the structure may cause them to be mirrored on the other side).
Overview
Here is an example village where villager spawns are highlighted (armor stands with the Glowing effect):

Church

Wood Hut

Large House

Butcher's Shop

Library

Small House

Blacksmith

A: The Wiki says,

"Villagers spawn along with naturally-generated villages, inside various buildings."

So we can assume that they are in fact spawned inside the surrounding buildings of the village, and then exit.
Again hitting up the Wiki it says that,

"There is evidence that villagers are prone to overcrowding certain areas of a village while leaving other areas completely empty. When moving inside, the AI prefers doors within 16 blocks (Euclidean distance). It also attempts to prefer doors with fewer villagers nearby, however "nearby" in this case is only 1.5 blocks and, when moving inside, villagers prefer to move 2.5 blocks inside when the inside is to the south or east and therefore will be out of range of this check. During the day, it has been observed that villagers will tend to cluster near a trapped villager or any existing large cluster of villagers, likely due to the "socialize" AI routine overriding their inclination to wander".

Seeing as the AI clump together within a shorter radius, they likely spawn as a group, and then spread out initially during the day, moving to different areas as they travel throughout the day, and return to their various homes come nightfall.


text:
Q: Trying to create a user account from a new entity First of all i'm new to Jhipster, i've read the official documentations but i still can't seem to find a solution to my problem (i've been stuck for almost 3 weeks now), that's why i decided to ask here for help.
So, i have an application where i need to create an entity called employee and i need to create a user account with the additional fields taht are specified in the employee entity, so in other words, when i fill the form to create a new employee that will not only create a new one but it will also automatically create a user account for that emplyee.
What i've tried doing up until now, is creating a new employee entity and link it with a OneToOne relashionship to the USER entity (created by Jhipster) but the thing is, in that case i would have to create a new user and then add the additional information for the employee, wheareas i need it to be in the same form, to create an employee and the user linked to it at the same time.
Any help will be really appreciated.

A: What you want to do is not supported off the shelf by JHipster, you have to code it manually.
In backend, you could do it by defining a DTO that combines both entities, a RestController that exposes it and a service that is responsible for orchestrating persistence.
In frontend, it's the same you have a component that contains the form to update this DTO and call your REST API.
Alternatively, if a User is always an Employee, you could also merge them in a single User entity.
Of course, this depends on which authentication type you selected which defines where users are managed.


text:
Q: Virtual Memory on linux Virtual pages are mapped to physical pages in the VM mechanism. The physical pages are evicted once a new page must be paged in.
I always assumed that the page-in/page-out was either to the swap area or the file region that has been actually mapped to the VM.
I have read that Linux on start up maps all the physical pages to virtual pages (and that is why the monitoring tools show much memory kept by the kernel I guess).
So my question is, what is the benefit of this approach? A virtual page does not physically exist on disk until a physical page has been evicted and the costly part is to page in and out a page and this is not avoided. Additionally it seems to me it is more complicated to passing all these pages originally reserved for the kernel to the various processes that request them.
What am I misunderstanding here?

A: Mapping all of the physical pages simplifies loading something into about-to-be-initialized memory.  The initial page mapping is not assigned to any process (just the kernel), but doing so simplifies and speeds up the i/o and/or copying of data, code, kernel structures to freshly allocated memory, maybe just with a memcpy() or memset().
Philosophically, virtual memory pages should not be considered only mapped to part of a file:  they can be stack, heap, filesystem associative cache, or driver data structures.  In those cases, the virtual space would not be mapped to anything.
I haven't looked at the relevant source code in years, but paging to a swap file tends to be avoided, at least on modern systems with 1+G of memory.  It is at least twice as efficient (and likely 10+ times) to unmap some readonly page which hasn't been accessed in a long time and remap that to whatever is currently needed.  Only a modified page need be written to swap.
If you want to see drastically different paging and swap conditions, tell the kernel to use less memory.  Add mem=64M (or less) to the Linux boot arguments.

A: Linux virtual memory (virtual memory in general) is used to abstract physical memory to allow for operating system control over memory access.  The kernel maintains the page table that maps from the virtual addresses to physical addresses.
Paging memory is used to refer to pages currently stored on disk (swap) being brought into memory.  Paging memory out refers to writing the page to disk (swap) and being cleared from memory.  This allows more frequently used pages to be kept in faster storage, and less frequently used pages to be kept on slower storage.
Virtual memory also allows the operating system and processes to use more memory than actual physical memory exists on the system.