infinite regular cardinal

Question: Let $(X,\tau)$ be a KC non-compact space. Then there is a discrete
subset $D \subseteq X$ such that $\overline D$ is not compact.
Furthermore there is an ultrafilter $F$
in $X$ such that $ D \in F $ and for every $C \in F$, $\overline C$
is not compact in $(X,\tau)$.
Proof. Let $ U = \{U_{i} : i < k \} $ be a strictly increasing open cover of $ X $, where $k$ is
an infinite regular cardinal. We'll construct sets $ D_{\beta } = \{ x_{i }: i < \beta \} $ by transfinite
induction. First, let $ D_{0} = \{x_{0} \} $ for some $ x_{0 } ∈ U_{0} $.
Let $ \beta $ is ordinal successor. If $ \overline{D}_{\beta - 1 } $ is compact, then there is
$ \alpha_{\beta}$ such that
$ \overline{D}_{\beta - 1 } \subseteq U_{\alpha_\beta}$. Let $x_\beta \in  U_{\alpha+1} - U_{\alpha} $ and  $ D_{\beta } = D_{\beta - 1 } \cup {x_{ \beta}}$. For limit ordinals
$ \beta$, let $ D_{ \beta} = \bigcup_{i < \beta }D_{i} $.
This process stops when $ \overline{D}_{\beta} $ is not compact, which holds at least for  $ \beta = k $,
because then the open cover $\mathcal{ U } $ witnesses that $ \overline{D}_{k} $ is not compact. It is easy to
see that $ D_{ \beta} $ is discrete. The open set, which contains exactly one point $ x_{i+1 } $ is $ U_{ \alpha_{i+1}}  - \overline{D_{i}}$.
Let's construct the ultrafilter. Let $ F $ a filter-base, such that $ D \in F $ and for any
 $ C \in F $, $ \overline {C } $ is not compact. Furthermore let $ F $ be maximal with these properties.
If $ C \in F $ then for any $ C' \supseteq C $, holds  $C'\in F $, because if $C'$ were compact, then it
would be closed from $ KC $ property and  $ \overline{C} \subseteq C' $, but $ \overline{C}$ is non-compact closed subset of a
compact set  $C'$, which is a contradiction. If $ D = D_{0 } \cup D_{1} $ and $ D_{0} \cap D_{1} = \varnothing $ then
either $D_{0}$ or $ D_{1} $ is in $ F$. Otherwise both $ \overline{D_{0 }} $ and $ \overline{D_{1}} $ would be compact, hence
$ \overline{D} = \overline{D_{0 }} ∪ \overline{D_{1 }} $ would be compact. Finally this gives that $ F $ is an ultrafilter.

(1): why we can say in the first paragraph" If $ \overline{D}_{\beta - 1 } $ is compact, then there is
  $ \alpha_{\beta}$ such that
  $ \overline{D}_{\beta - 1 } $  ⊆ $ U_{\alpha_{\beta}}$. Let $ x_{ \beta } ∈  U_{\alpha+1} - U_{\alpha} $ and  $ D_{\beta } = D_{\beta - 1 } ∪ {x_{ \beta}}$"?
(2): why we can say " This process stops when $ \overline{D}_{\beta} $ is not compact, which holds at least for  $ \beta = k $,
  because then the open cover $\mathcal{ U } $ witnesses that $ \overline{D}_{k} $ is not compact. It is easy to
  see that $ D_{ \beta} $ is discrete. The open set, which contains exactly one point $ x_{i+1 } $ is $ U_{ \alpha_{i+1}}  -\overline{D_{i}}$."?
Comment: "$k$ is an" what?
Comment: @Habib I do appreciate that you took time to typeset your question. However, it would be nice to add a link to the source where it is from. Google suggests that it is taken from [this thesis](http://atrey.karlin.mff.cuni.cz/~snek/pub/thesis/minimal_kc_spaces_revised.pdf).
Comment: BTW you can typeset $\kappa$ as `$\kappa$`. See the [turorial](http://meta.math.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference) on meta.
Answer: This seems to be from this thesis (BTW, it would be nice to mention such sources in the original question!). There the proof is slightly different in notation and this causes some of the confusion here:
We have a non-compact KC space $(X,\tau)$. Then there is some infinite regular cardinal $\kappa$ such that there is a strictly increasing open cover (of non-empty open subsets) $U_i$, $i < \kappa$ of $X$.
(this can be found from a minimal size open cover without a finite subcover). Then the proof goes on to construct an increasing family of discrete subsets $D_i$ for some $i < \lambda \le \kappa$ by transfinite recursion: take any $x_0 \in U_0$, and define $D_0 = \{x_0\}$. For a successor ordinal $\alpha+1$, having defined $D_\alpha$, we have two cases: either $\overline{D_\alpha}$ is non-compact (and then we stop: we have found a discrete set $D_\alpha$ with non-compact closure, and $\lambda = \alpha+1$)) or $\overline{D_\alpha}$ is compact, and then we let $i_\alpha < \kappa$ be minimal such that $\overline{D_\alpha} \subset U_{i_\alpha}$. We then pick $x_{\alpha+1} \in U_{i_{\alpha}+1} \setminus U_{i_{\alpha}}$ and we define $D_{\alpha + 1} = D_\alpha \cup \{ x_{\alpha+1} \}$. Note that $D_0$ is discrete and if $D_\alpha$ is discrete, so is $D_{\alpha+1}$, as $(U_{i_\alpha + 1}\setminus \overline{D_\alpha}) \cap D_{\alpha + 1} = \{ x_{\alpha + 1}\}$, making the added point isolated in $D_{\alpha+1}$ as well. For limit ordinals $\beta$ we just "do nothing": $D_\beta = \bigcup_{\alpha < \beta} D_\alpha$.

Added: $D_\beta$ is still discrete. To see this, let $\alpha<\beta$, and let $V=U_{i_\alpha+1}\setminus\overline{D_\alpha}$. Clearly $V$ is an open nbhd of $x_{\alpha+1}$, and $V\cap D_{\alpha+1}=\{x_{\alpha+1}\}$. Suppose that $\alpha<\gamma<\beta$. Then $x_{\alpha+1}\in D_\gamma$, so $U_{i_\gamma}\supseteq\overline{D_\gamma}\supseteq D_\alpha$, and therefore $i_\gamma\ge i_\alpha$ by the minimality of $i_\alpha$. But $x_{\alpha+1}\in U_{i_\gamma}\setminus U_{i_\alpha}$, so $U_{i_\gamma}\supsetneqq U_{i_\alpha}$, and the open cover is strictly increasing, so $i_\gamma>i_\alpha$, and therefore $x_{\gamma+1}\notin U_{i_\gamma}\supseteq U_{i_\alpha+1}\supseteq V$. Thus, $V\cap D_\beta=\{x_{\alpha+1}\}$, and $D_\beta$ is discrete.

Now $\overline{D_\kappa}$ is non-compact, so for some stage we get a $D_{\alpha}$ with non-compact closure; this is basically a cardinal exhaustion argument.
Comment: @BrianM.Scott You're free to edit my post, if you like. Make the argument more complete.
Comment: I don't quite see how can $U_n$, $n<\omega$, be chosen in such way that $D_\omega$ would be $\mathbb Q$. We want $x_n \in U_{\alpha_n}$, but any open set containing $x_n$ must contain infinitely many other rational numbers, and those numbers cannot be chosen as $x_m$ for $m>n$. (The construction of $D_\omega$ requires $x_m\notin U_{\alpha_n}$.)
Comment: BTW the same fact is given as Lemma 3 in Angelo Bella, Camillo Costantini: *Minimal KC spaces are compact*; DOI: [j.topol.2008.04.005](http://dx.doi.org/10.1016/j.topol.2008.04.005)
Comment: @MartinSleziak a) I cannot access the other paper (is the proof any different?) and b) how do you suggest we prove the limit case to be discrete if the previous stages are, given the construction?
Comment: Feel free too email me (my email can be found two clicks away from my profile page) and I can send you the paper. However, the proof doesn't seem different to me. This is the part which seems relevant to what we are discussing: *Any $x_\beta\in D_\delta$ has the open neighbourhood $V=U_{\alpha_\beta+1}\setminus \overline{D_\beta}$ satisfying $V\cap D_\delta=\{x_\beta\}$ (this depends on the fact, which is easy to check, that $\beta\mapsto\alpha_\beta$ is strictly increasing), and we conclude that $D_\delta$ is discrete.*
Comment: @Martin: You should probably add that $\delta$ is minimal such that $D_\delta$ has non-compact closure. It's clear that $V\cap D_{\beta+1}=\{x_\beta\}$. If $\beta<\gamma<\delta$, then $x_\beta\in D_\gamma$, so $U_{\alpha_\gamma}\supseteq\overline D_\gamma\supseteq D_\beta$, and hence $\alpha_\gamma\ge\alpha_\beta$. But $x_\beta\in U_{\alpha_\gamma}\setminus U_{\alpha_\beta}$, so $U_{\alpha_\gamma}\supsetneqq U_{\alpha_\beta}$. But the open cover is strictly increasing, so $\alpha_\gamma>\alpha_\beta$, and $x_\gamma\notin U_{\alpha_\gamma}\supseteq U_{\alpha_\beta+1}\supseteq V$.
Answer:
(1): why we can say in the first paragraph" If $ \overline{D}_{\beta - 1 } $ is compact, then there is
  $ \alpha_{\beta}$ such that
  $ \overline{D}_{\beta - 1 }  \subset U_{\alpha_{\beta}}$. Let $ x_{ \beta } \in U_{\alpha+1} - U_{\alpha} $ and  $ D_{\beta } = D_{\beta - 1 } \cup \{x_{ \beta}\}$"?

If $\overline{D}_{\beta-1}$ is compact then the cover $\{U_i; i<k\}$ has a finite subcover $\{U_{i_1},\dots,U_{i_n}\}$. Simply take $\alpha_\beta=\max\{i_1,\dots,i_n\}$.

(2): why we can say " This process stops when $ \overline{D}_{\beta} $ is not compact, which holds at least for  $ \beta = k $,
  because then the open cover $\mathcal{ U } $ witnesses that $ \overline{D}_{k} $ is not compact.

For $\overline{D_k}$ the cover induced by $\mathcal U$ on the subspace $\overline{D_k}$ is an open cover without a finite subcover. Just notice that the transfinite sequence $\alpha_\lambda$ is strictly increasing, which implies $\alpha_\lambda>\lambda$. Any subcover must somehow cover all points $x_{\alpha_i}$ for $i<k$, and this is only possible if supremum of $\alpha_i$'s corresponding to sets from subcover is $k$. Since $k$ is an infinite regular cardinal, this cannot happen for any finite subcover.

It is easy to
  see that $ D_{ \beta} $ is discrete. The open set, which contains exactly one point $ x_{i+1 } $ is $ U_{ \alpha_{i+1}}  -\overline{D_{i}}$."?

Since $x_i\notin U_{\alpha_i}$ and $U_{\alpha_i}\supseteq \overline{D_i}$, you have $x_i\notin\overline{D_i}$. You also have $x_i\in U_{\alpha_i+1}$. Together you get $x_i \in U_{\alpha_i+1} \setminus \overline{D_i}$.
Comment: @Habib: If some further clarification is needed, feel free to ping me here or (probably better) in [general topology chatroom](http://chat.stackexchange.com/rooms/info/10072/general-topology). You need 20 rep points to [talk in chat](http://math.stackexchange.com/help/privileges/chat), but if you merge all your accounts, you will have more than sufficient rep for this.

infinite regular cardinal


Using a Wii classic controller with Xbox

Question: I just ordered an original Xbox and a controller. However, I also have a Wii classic controller pro that I don't use anymore. I am wondering if there is some way for me to connect my Wii controller to the Xbox for use as a second controller. I googled it and found nothing, so I was wondering if anybody here knew of a way to do it.
Comment: You found nothing, because it's not possible.  Why would a peripheral ever connect to a console its manufacturer competes with?
Comment: Well, I did find an adapter to use it with a ps3, so I know that it is probably possible. I am not looking for a direct connection, I am thinking more of an adapter with components on the inside to make the transition. I know that it doesn't directly connect.
Answer: There is no possible way to connect a Wii controller to an XBOX. It would be quite a hassle to play certain games, such as Halo, and not be able to play it due to the fact that the Wiimote (Wii Remote) does not have 2 functional joysticks, X and Y buttons, or a multitude of other buttons. If you want two different controllers, you should probably just order another one.
Comment: He's not asking about connecting a Wiimote, he's asking about connecting a Wii [Classic Controller Pro](http://en.wikipedia.org/wiki/Classic_Controller#Classic_Controller_Pro).  Which looks suspiciously like a PS2 controller.
Comment: Ah. Well, no matter what Nintendo controller he desires to connect, it **will not work**. The only compatible controller to the XBOX is the XBOX controller.
Comment: Since the Xbox 360 uses a modified version of XInput (which Windows also uses), I wouldn't be so sure of that.
Comment: This is for an original xbox, not a 360. DekuLeaf is probably right, I just wanted to see if I had missed something when I searched for a way to do this.
Comment: I'll Probably just sell or trade in the wii classic controller and buy an xbox controller. Even if there was a way, I wouldn't have pressure sensitive triggers, l/r 3 buttons, or the black/white buttons.


Do Guild Wars 2 Beta characters carry over to the full release?

Question: If you play the beta will you be able to access your characters in the full game when released?
Comment: Not a direct answer to your question, but at the original Guild Wars launch, character names were reserved for your account and their appearance customizations were preserved, but all mission and quest progress was wiped; you started at level 1 with starter items.
Comment: Leaving this closed, as the answer was "No" and is now no longer applicable since the beta is long past.
Answer: No, it will not carry over.
From the official FAQ

Will the progress I make during a Guild Wars 2 Beta Event carry over
  when Guild Wars 2 launches?
No. Everything will be wiped in preparation for launch.
Comment: But those who prepurchased *will* get a headstart, I believe.
Comment: Yes, 3 days, to be precise.
Answer: Historically, Beta characters don't carry over.
One of the reasons for wiping their characters database is to to give players the equal chance of Leveling, gearing and learning the game from scratch.
Not wiping their characters database would lead to overall unfair advantages given to the beta-tester players.
Also, the coolest names would be unavailable already
Comment: Also, what if someone finds a bug in beta that lets them level up crazy fast or earn way too much gold?
Comment: @Shadur Then that person is crowned King of All Videogames and we all pledge fealty to them.


Nextflow dynamic includes and output

Question: I'm trying to use dynamic includes but I have problem to manage output files:
/*
 * enables modules
 */
nextflow.enable.dsl = 2

include { requestData } from './modules/get_xapi_data'
include { uniqueActors } from './modules/unique_actors'
include { compileJson } from './modules/unique_actors'

if (params.user_algo) {
    include { userAlgo } from params.user_algo
}

workflow {
    dataChannel = Channel.from("xapi_data.json")
    requestData(dataChannel)
    uniqueActors(requestData.out.channel_data)

    if (params.user_algo) {
        user_algo = userAlgo(requestData.out.channel_data)
    } else {
        user_algo = null
    }

    output_json = [user_algo, uniqueActors.out]
    // Filter output
    Channel.fromList(output_json)
        .filter{ it != null }            <--- problem here
        .map{ file(it) }
        .set{jsonFiles}

    compileJson(jsonFiles)
}

The problem is userAlgo can be dynamically loaded. And I don't know how I can take care of it. With this solution, I got a Unknown method invocation getFileSystem on ChannelOut type error.
Answer: The problem is that fromList expects a list of values, not a list of channels. If you use an empty Channel instead of checking for a null value, you could use:
if( params.user_algo ) {
    user_algo = userAlgo(requestData.out.channel_data)
} else {
    user_algo = Channel.empty()
}

user_algo
    | concat( uniqueActors.out )
    | map { file(it) }
    | compileJson

Comment: Good idea, I did more or less the same stuff in order to use fromList
```    uniqueActors()
    uniqueChannel = uniqueActors.out

    if (params.user_algo) {
        userAlgo()
        userChannel = userAlgo.out.userJson
    } else {
        userChannel = Channel.empty()
    }

    allJson = uniqueChannel.mix(userChannel)
    compileJson(allJson.toList())
```

Nextflow dynamic includes and output


How to get a matrix of two dynamic axes

Question: I have two tensors, t1 is a 200-dim vector with dynamic axes [batch_len, seq1_len], and t2 is also a 200-dim vector with dynamic axes [batch_len, seq2_len]. I want to get a matrix M of dimension (seq1_len, seq2_len), in which M_ij is the inner product of the two 200-dim vectors t1_i and t2_j. Is there a way to achieve this?
Answer: Currently (February 2017) there's no way to have two sequence axes. One possibility is to treat the sequence with the shortest range as a tensor with with only static axes.

How to get a matrix of two dynamic axes


Shuffle a Questions array and an Answers multidimensional array the same

Question: Alright, so the thing is;
Now I made this website for myself to study japanese more easily, by making a list of japanese words and its definition. I put the japanese words in lesson1.txt and the answers in lesson1answers.txt in the same order. I read them out in php and put them in arrays in javascript.
Now the problem is is that these arrays have the same order every time I start the site, which is quite annoying for me as I keep resembling the spot to the answer, and I dont even read the japanese word (Damn our human brains!). So I figured the best way to solve this is by randomizing the elements of both the arrays, but they both have to be randomized in the same pattern because else the question doesnt correspond correctly to the answer anymore.
One of the arrays I have is multidimensional. The array first holds elements that represent the lines I read out of a .txt file. The line has multiple characters in it, consequently the second element of the array represents each character (Dont ask me why I did this, it had to do with me not being able to read out japanese characters in php and put them in js directly). The other array is just the array I keep the answers in.
So I have AnswersArray(); and JapaneseCharactersArray();
I've been stuck on this problem for a whole day now, someone please help or give a hint..
Comment: Could you show us a sample array. I am not visioning what you are saying.
Comment: So the AnswersArray is in english so that's why you're using a non-multi-dimensional array.  What's the indexes of the Japanese Characters Array()?  What I mean is it layed out something like JapaneseCharactersArray('325235235')(0)='3', JapaneseCharactersArray('325235235')(1)='2',
Comment: JapaneseCharactersArray[0][0] = お
JapaneseCharactersArray[0][1] = お
JapaneseCharactersArray[0][2] = き
JapaneseCharactersArray[0][3] = い
Comment: @user1534664: Reading that script you linked hurts :-| Please ask another question on how to improve the array output, containing your php code. Evaling Unicode-codepoint-strings to get characters is *not* the way to go.
Comment: This is only my second year programming, mate. I'm sorry my skills arent that good yet. But thats besides the point, I just want it working right now.
Answer: You should merge them into one array of objects:
// assuming AnswersArray.length == JapaneseCharactersArray.length
var array = [];
for (var i=0; i<AnswersArray.length; i++)
    array[i] = {
       answer: AnswersArray[i],
       japanese: JapaneseCharactersArray[i]
    };

Now you have only one array, each item containing all information on a single word. You can easily shuffle it now.
Instead of AnswersArray[x] you then would use array[x].answer further down in your code.

Of course, you could just adapt your fisherYates function to shuffle two or more arrays in the same way:
function fisherYates(first/*, ... arrays */) {
    var i = first.length,
        argl = arguments.length;
    if (i == 0) return false;
    while (--i) {
        var r = Math.floor(Math.random() * (i + 1));
        for (var j=0; j<argl; j++) {
            var tempi = arguments[j][i];
            var tempj = arguments[j][r];
            arguments[j][i] = tempj;
            arguments[j][r] = tempi;
        }
    }
}

// usage:
> fisherYates(AnswersArray, JapaneseCharactersArray);

Comment: Thanks mate, I am not very familiar with javascript yet so I'ma try this out. This does seem like a good solution.
Comment: the top solution still seems the best because its alot clearer to me ;) Thanks for the effort and fast reply.
Answer: Although the best way is probably to just create them as a single array, another way is to create a new array, of the same length as the others, where each item in the array is a number: 1, 2, 3 ... n.  But instead of having the numbers in order, use Math.random() to randomize their order.
Then loop through that new array as such:
for(i=0; i<AnswersArray.length; i++) {
    AnswersArray[RandomArray[i]]; // whatever
}

Another way is to just swap the entire row when you randomize the array.


Remove list entries containing multiple conditions

Question: I have list of paths as strings
>>> p = ['/path/one/foo.txt', '/path/two/foo.txt', '/path/three/foo.txt', '/path/four/foo.txt]
I know I can remove an entry containing a word from the list using something like
>>> p = [x for x in p if 'two' not in x]
>>> p
['/path/one/foo.txt', '/path/three/foo.txt', '/path/four/foo.txt']
However, this doesn't seem to work
>>> p = [x for x in p if 'two' or 'three' not in x]
>>> p
['/path/one/foo.txt', '/path/two/foo.txt', '/path/three/foo.txt', '/path/four/foo.txt]`
How can I remove all entries in p containing two or three?
Note, I am pull values two and three from separate keys in a dict so it might not be simple to create a single list.
Answer: Try this one:
p = [x for x in p if 'two' not in x and 'three' not in x]

Comment: This seems to be the ticket
Comment: Yes, just doing some testing
Answer: You can use all with a generator expression:
values = ('two', 'three')
p = [x for x in p if all(i not in x for i in values)]

A better idea is to extract the specific folder and compare it to a set. Your example is straightforward since you are only interested in the second directory:
values = {'two', 'three'}

L = ['/path/one/foo.txt', '/path/two/foo.txt',
     '/path/three/foo.txt', '/path/four/foo.txt']

res = [i for i in L if i.split('/')[2] not in values]

print(res)

['/path/one/foo.txt', '/path/four/foo.txt']

Answer: p = [x for x in p if 'two' not in x and 'three' not in x]
In Python, you have two separate Boolean statements: 'two' in x and 'three' in x. The syntax you were using does not work because Python is unable to recognize that syntax as two separate Boolean statements.
Comment: This is helpful but per `Ayoub Laazazi` I think I should be using `and` not `or`
Comment: Yup, you're right. I edited my post to reflect this.
Answer: Using Regex. --> re.search(r"(two|three)", x)
Demo:
import re
p = ['/path/one/foo.txt', '/path/two/foo.txt', '/path/three/foo.txt', '/path/four/foo.txt']
p = [x for x in p if not re.search(r"(two|three)", x)]
print(p)

Output:
['/path/one/foo.txt', '/path/four/foo.txt']

Answer: @afg1997, you can also continue with your own approach just by replacing or with and and with a little modification in your code as follows.
>>> p = ['/path/one/foo.txt', '/path/two/foo.txt', '/path/three/foo.txt', '/path/four/foo.txt']
>>>
>>> [x for x in p if not 'two' in x and not 'three' in x]
['/path/one/foo.txt', '/path/four/foo.txt']
>>>


Parse Value from repeater

Question: <asp:Repeater ID="repeater" runat="server" OnItemDataBound="repeater_ItemDataBound">

<HeaderTemplate>

</HeaderTemplate>

<ItemTemplate>
<asp:Literal ID="Publication_Date" runat="server" Text="{0}" />
...

Ok so i have a date coming back from the source, i need to strip this date into day and month as it currently
comes back like "march 12 2012".
once parsed into a day and a month string i want to then pass it back into
<asp:Literal ID="Publication_Day" runat="server" Text="{0}" />

now ive tried some things such as
protected void repeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
    string newsdate = "";
    if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==  ListItemType.AlternatingItem)
    {
        Literal ltDate = (Literal)e.Item.FindControl("Publication_Date");
        newsdate = ltDate.Text;
        //do parse code
        Literal ltDay = (Literal)e.Item.FindControl("Publication_Day");
        ltDay.Text = newsdate;
    }
}

but when i step through the publication_date is only returning {0} as a string not the date.
i know the source is fine, as if i just put the date on the template is shows up on the front end.
Any ideas what im doing wrong?
Comment: What is the type of object you are binding on the repeater?
Comment: What is the value of `ltDate.Text` in the above code?
Answer: It is returnin {0} because it is on the Text property of Literal.
You could use the DataBinder.Eval to read the column of your DataSource from e.Item.DateItem. Since you know what is the column you want to read you could get the DateTime object direct from datasource, for sample:
// get the dateTime from datasource
DateTime datePublication = DateTime.Parse(DataBinder.Eval(e.Item.DataItem, "DatePublicationColumn").ToString());

// show the day name
ltDay.Text = datePublication.ToString("dddd");

Where I add DatePublicationColumn, you specify the column.
Comment: ah so throw that into my IF statement inside my repeater method?
Comment: Yes, but remember, I do not know if your column is the `DatePublicationColumn`. make sure it is the right name and change if necessary.
Comment: yeh, thats a problem, this is code that is inside the sitefinity cms, im trying to change the layout of the news items, unfortunatly I do not know what table is being used.  have you used sitefinity before?
Comment: No, I do not know how to implement it using `sitefinity`, maybe using a debugger you can check.
Comment: yeh just did found the table, the column isnt a datefield, its a varchar called url, the date is actually inside there.... "/12-03-27/newsitemname"
Comment: Well, the code to read a column from datasource is it :), maybe your the problem could be in another level.
Comment: how would i get the day "27" and the month "march" from that string?

Parse Value from repeater


Why does assignment to a reference use the copy assignment operator?

Question: For the following example:
#include <iostream>

using namespace std;

class Obj {
    public:
        Obj& operator=(const Obj& o) {
            cout << "Copy assignment operator called" << endl;
            return *this;
        }
};

Obj o;

int update(Obj& o) {
    o = ::o;
}

int main() {
    Obj o2;
    update(o2);
}

I get the result:
Copy assignment operator called

Why is a copy assignment used when assigning an object to a reference? Why isn't the reference just updated to point to the assigned object? Is this a matter of convention or is there a reason behind this?
Comment: References cannot be re-seated - once initialised they always refer to the same object.
Comment: What else would you expect and why? There's no reference as target.
Comment: @πάνταῥεῖ I thought that maybe the reference (`Obj& o`) would be updated to point to `::o`.
Comment: @NeilButterworth Gotcha, that answers my question. Thank you for the response!
Comment: Think of it as assignment **through** a reference: the new value gets assigned to the object that the reference points at.
Comment: @PeteBecker I'm not having difficulty understanding the behavior. My question is why does the language use this particular behavior when it could very easily use use a different behavior. [This answer](https://stackoverflow.com/questions/728233/why-are-references-not-reseatable-in-c/728272#728272) does a pretty good job of answering that question.
Answer: Assigning to a reference assigns to the object the reference refers to, not the reference itself.  Thus, your update function is equivalent to:
o2 = ::o;

Comment: I understand that now after seeing the results of this example. However, I'm curious as to why this is the case.
Comment: It's to allow a function that takes a parameter by reference to mutate the original object.  This is much more useful, in general, than reseating the reference would be.
Comment: @johnnyodonnell Because a reference is just another name for the object. References are not pointers. A pointer points to an object. A reference **is** the object, just with a different name.
Comment: @NikosC. A reference is not a pointer, but it does point to an object. With the help of Neil's comment above, I was able to find [this](https://stackoverflow.com/a/728272/5832619). It looks like it could've been possible to reseat a reference, but it's precisely because of situations like this that Bjarne decided to not allow reseating of references.
Comment: @johnnyodonnell It is not correct thinking that references point to objects, because everything points to objects, including non-references. The `n` for example in `int n;` points to a memory location that is interpreted as holding the bytes of an integer. The correct thinking for references is that they are another name for an object. They do not point to an object, in the same way that `n` in `int n;` does not point to an object. It **is** the object.


SQL Select only rows with Max Value on a Column revisited

Question: Same old question:
I have a table. I want the rows with max value for a field, grouped by a set of fields. BUT I do not need JUST the max value and group by fields, I need the full row (all other fields, so I can't just do:
select max(field1),  field2 from table group by field2;

As I said, I need field3, field4, ... , fieldn.
This has been treated before, and I found an excelent answer here:
SQL Select only rows with Max Value on a Column
Basically, it says I should do a join between the original table, getting all fields from there, and a subquery that gets me the max and group by fields. And for most cases, that probably works.
My issue
For my particular case I am not so sure that approach works, because of the data types involved. Let me give an example.
Consider this gives me the max values I want, grouped by the field I want:
select max(field1) maxf1, field2 f2 from mytable group by f2

The above link would suggest trying something like:
SELECT mt.field1, mt.field2, mt.field3, ... , mt.fieldn
FROM mytable mt
INNER JOIN (
    SELECT max(field1) maxf1, field2 f2 FROM mytable GROUP BY f2
) sq
ON sq.maxf1 = mt.field1 AND sq.f2 = mt.field2

For my particular case, field1 and field2 may be of type FLOAT and TIMESTAMP. Therefore, the join comparisons sq.maxf1 = mt.field1 and sq.f2 = mt.field2 might not be the way to go (see What is the most effective way for float and double comparison?). So, any hints for me on this one?
Comment: I don't see the problem. There's no roundoff problem when you use `MAX()`.
Comment: You only need to worry about floating point comparisons when you're comparing the results of calculations that might round slightly differently, or accumulate errors. This isn't the case when you're comparing a field in a table against itself.
Answer: Your query is fine:
SELECT mt.field1, mt.field2, mt.field3, ... , mt.fieldn
FROM mytable mt
INNER JOIN ( SELECT max(field1) maxf1, field2 f2
             FROM mytable GROUP BY f2
           ) sq
   ON sq.maxf1 = mt.field1
     AND sq.f2 = mt.field2

MAX() or MIN() will not result in float rounding issues, if you were aggregating or performing other calculations that would be a concern, but then you wouldn't be using the field to JOIN anyway.
FYI: If you were doing some other conversion or trying to JOIN using a FLOAT on one side and DECIMAL on the other a common method is choosing an acceptable margin of error and using absolute value and subtraction:
SELECT mt.field1, mt.field2, mt.field3, ... , mt.fieldn
FROM mytable mt
INNER JOIN ( SELECT max(field1) maxf1, field2 f2
             FROM mytable GROUP BY f2
           ) sq
   ON ABS(sq.maxf1 - mt.field1) < .0001
     AND sq.f2 = mt.field2

Comment: Indeed the data type FLOAT itself has rounding issues so functions run that on the data with type FLOAT like MAX or MIN should also has problems see http://dev.mysql.com/doc/refman/5.0/en/problems-with-float.html...
Comment: @RaymondNijland indeed it mentions that the internally stored value may not be the same as the value viewed, but it does not say that the internally stored value is not consistent.  ie: I shouldn't count on comparing a decimal with a seemingly equivalent float, but I can count on FLOAT = FLOAT when only taking MAX()/MIN() and not doing any conversions.
Comment: true you are right about the MIN and MAX like the manual says you should lookout with functions like SUM and ABS or if you do an conversion. +1 for the ON ABS(sq.maxf1 - mt.field1) < .0001 edit
Comment: Side Note you may also want to enlarge the  tmp_table_size and max_heap_table_size settings if indexes dont work for this query if the settings these are to low MySQL will create an disk based myisam table what will kill MySQL performance. and also GROUP BY will trigger to Using temporary if you dont properly index and maybe even the DERIVED (nested select inside the inner join) could trigger an temporary table. see the documentatie about this http://dev.mysql.com/doc/refman/5.7/en/internal-temporary-tables.html


Get element that stole focus before it does in WPF

Question: To be clearer. I need to know which element stole focus in the focused element LostFocus event. Something like this:

I have 3 buttons: A, B and C
"Button A" has focus
"Button C" is clicked
"Button A" LostFocus event is triggered
In there I want to know that "Button C" stole the focus (Could've also been "Button B")

Let me know if there's a way to accomplish this.
Thanks!
Answer: You can always check the FocusManager.GetFocusedElement(dObj) to get the focused element within a given DependencyObject.  So, in your scenario above, it will be something like this:
<Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Window.Resources>

    </Window.Resources>

    <StackPanel>
        <Button>Button1</Button>
        <Button>Button2</Button>
        <Button>Button3</Button>
    </StackPanel>
</Window>

Event Handler:
private void OnLostFocus(object sender, RoutedEventArgs e)
{
    object focusedElement = FocusManager.GetFocusedElement(this);

    if (focusedElement is Button)
        Console.WriteLine(((Button)focusedElement).Content.ToString());
}

Comment: what if i don't know the type of focused element.


How to factorize polynomial in GF(2)?

Question: I want to know how to factorize polynomials in $\ GF(2) $ without a calculator in a product of irreducible factors. For example, in my exercises, I must factorize $\ p(x) = (x^7 - 1)$
The response is $\ (x − 1)(x^3 + x^2 + 1)(x^3 + x + 1)$
I just not understand the methodology to do it just by hand.
thanks a lot.
Comment: Degree seven is still small. You can do what you do when factoring moderate size integers - test divisibility by small primes. The difference is that you first need to build a list of small (=low degree) irreducibles. Here's how the list begins: $x,x+1$, $x^2+x+1$, $x^3+x+1$, $x^3+x^2+1$. You can continue either sieve of Eratosthenes style or use tricks. There's also Berlekamp's algorithm, but that is probably too rich for paper and pencil work.
Comment: Thanks for your response. So to do this, I need to have all irreducible polynomials of degree less or equals to 7/2 ? This list seems to be long no ? This list is the first step but after ?
Comment: That list is actually surprisingly short. There are only three irreducible quartics, and six irreducible quintics. I have spent a LOT of time with polynomials like these, and I rarely need to go above quartics - when doing hand calculations. This may be because I run into problems like this fromf coding theory side, where we usually have several low degree factors. Crypto people face more serious factoring challenges.
Answer: The methodology of factoring of a polynomial $f(x),$  $\deg f=n$:
1) find all irreducible polynomials up to degree $\dfrac{n}{2}.$
2) divide $f(x)$ on every of  the irreducible polynomials.
Comment: no,  start again from the first irreducible
Comment: Thank you a lot for your clear response ! the methodology is in your response. for the point 1, I must always find all irreducible polynomials up to degree $\ deg(f(x))/2 $ or it's just for this specific case ? that work with all degrees ?. How can i rapidely find the list of irreducible polynomials ? You always have a copy of this list with you ? :-)
Comment: Yes,  for the general case you have to find all irreducible polynomials up to degree $n/2$. for this specific case it enougth up to degree $3$.   List  of  irreducible polynomials you may find at the very end of any coding theory book :)
Comment: Yes thank you. I found an online tool to generate this list: http://theory.cs.uvic.ca/gen/poly.html
Comment: My last question for you @Leox . I make the division of f(x) on every irreducible polynomials and sometime the rest is 0 and sometime is bigger. When the rest is 0, the next step is to divide the current quotient by the next irreducible of the list right ?
Answer: for that particular example you have $7=2^3-1$ where $2$ is the characteristic. this means that $x^7-1$ is the product of all the irreducible polynomials whose degree divides $3$.
there is only one such polynomial of degree $1$, namely $x \pm 1$ (they are the same since
$1 \equiv_2 -1$). for degree $3$ there are the two polynomials $x^3 \pm  x^2 \pm 1$ and $x^3 \pm x \pm 1$
(NB any polynomial over $F_2$ with an even number of non-zero terms has the linear factor $x \pm 1$)

How to factorize polynomial in GF(2)?


Atlas of a regular surface

Question: I have the following set of $R^3$:
$$
S=\{(x,y,z) \in \mathbb{R}^3: \, x^2+y^2-z^3=1\}
$$
It is immediate to see that $S$ is a regular surface. How may I find an atlas? When  $z \neq 0$, as $z=\sqrt[3]{x^2+y^2-1}$, we have the parameterization $x(u,v)=(u,v,\sqrt[3]{u^2+v^2-1})$ but what happens when $z=0$?
Answer: Hint: At least one of $x$, $y$ and $z$ is not zero. So the open sets $\{x< 0\}$, $\{x>0\}$, $\{y < 0 \}$, $\{y>0\}$ and $\{z\neq 0\}$ cover $S$.
Since you already found a parametrization for $z\neq 0$, I'm sure you will find parametrization for the coordinate neighborhoods $x < 0$, $y < 0$ and so on. Then you are left to show that the change of coordinates is smooth.
Comment: So, such an atlas has 5 charts, two for both the cases $x \neq 0$ and $y \neq 0$ and that I found before?
Comment: @TheWanderer Yeah, I guess the open sets are more like $\{x>0\}$, $\{x<0\}$ etc... I'll edit my answer. (Edit: Which means, yes, 5 charts)

Atlas of a regular surface


If I use field injection with Guice, why can I only use the no arg constructor?

Question: Here is an example:
public class Dog implements Animal{
    private  String color;

    @Inject
    private  Owner owner;

    //This constructor always used to build the Dog object.
    public Dog(){}

    public Dog(String random){}
}

Is this a restriction or default behavior? Is there any way to use a parameterized constructor instead to build the Dog object? This seems like a limitation so I must be missing something.
Answer: Annotate your other constructor with @Inject
Think about it. Guice is a dependency injection (DI) framework. This means that Guice takes responsibility for creating objects.
Guice therefore needs to know some things. The first among them is how to create a new instance. Therefore, Guice (and most other DI frameworks) put some conventions about how to create new objects.
Guice's conventions for creating objects are the following: either provide a no-arg constructor or annotate it with @Inject. Why the no-arg constructor? Because all of its parameters are known: there are none. It's easy to create an object that doesn't have any parameter.
If there was any parameter, such as a String in your example, how would Guice know which String to inject? Well, you might say that you provide it in a module, fair enough. But in your example, you have more than one constructor. How would Guice know which constructor to use? Well, let's standardize and say that the easiest to construct is allowed but not the others. So let's instantiate using the no-arg constructor.
Please note that you can associate field injection with constructor injection, but to do so, you must annotate at most one constructor with @Inject. The following code is totally valid:
public class Dog implements Animal{
    private  String color;

    @Inject
    private  Owner owner;

    //This constructor always used to build the Dog object.
    public Dog(){}

    @Inject public Dog(String random){} // Note the @Inject annotation.
}

Please note that Guice's @Inject's Javadoc is rather explicit (emphasis mine):

The class being constructed must have exactly one of its constructors marked with @Inject or must have a constructor taking no parameters. The `Injector then proceeds to perform field and method injections.

Also, note the Javadoc of @javax.inject.Inject:

Injectable constructors are annotated with @Inject and accept zero or more dependencies as arguments. @Inject can apply to at most one constructor per class.
[...]
@Inject is optional for public, no-argument constructors when no other constructors are present. This enables injectors to invoke default constructors.
[...]

So to answer your question, no, it's not possible to request Guice to inject your constructor with a String argument without annotating it with @Inject.
Comment: Ahh I didn't know we could use another @Inject annotation on the constructor. This makes sense. Thank you :)
Comment: Why do we have to define a default String in the module? If we call the constructor with a String, shouldn't Juice know what String was passed in and just use that?


Publish Angular-CLI 6 ASP.Core application to Azure

Question: First of All here some Info

Project Angular-CLI ASP.Net Core 2.1
Publish from Visual Studio to Azure WebService

So what i have tried.
I have a running SPA in visual studio it runs fine without any error or warning.
Now i want to publish it to Azure over the build in publish via Visual Studio.
The publish Job show every thing is ok, then i go to the site where it should be hosted.
Now i get the following error:

so there is no complete error message why it was crashed i have found some logfile of the starting of the application:

2018-07-10 16:55:17.799 +00:00 [Information] Starting web host
  2018-07-10 16:55:20.691 +00:00 [Information] Azure Web Sites environment detected. Using '"D:\home\ASP.NET\DataProtection-Keys"' as key repository; keys will not be encrypted at rest.
  2018-07-10 16:55:22.456 +00:00 [Information] Starting @angular/cli on port 50808...
  2018-07-10 16:55:25.208 +00:00 [Error] npm ERR! Error: ENOENT, open 'D:\home\site\wwwroot\ClientApp\dist\node_modules\start\package.json'
2018-07-10 16:55:25.716 +00:00 [Information] Request starting HTTP/1.1 GET http://localhost/
  2018-07-10 16:55:28.285 +00:00 [Warning] Failed to determine the https port for redirect.
  2018-07-10 16:55:28.301 +00:00 [Error] npm ERR!  { [Error: ENOENT, open 'D:\home\site\wwwroot\ClientApp\dist\node_modules\start\package.json']
2018-07-10 16:55:28.575 +00:00 [Error] An unhandled exception has occurred while executing the request.
  System.AggregateException: One or more errors occurred. (One or more errors occurred. (The NPM script 'start' exited without indicating that the Angular CLI was listening for requests. The error output was: )) ---> System.AggregateException: One or more errors occurred. (The NPM script 'start' exited without indicating that the Angular CLI was listening for requests. The error output was: ) ---> System.InvalidOperationException: The NPM script 'start' exited without indicating that the Angular CLI was listening for requests. The error output was:  ---> System.IO.EndOfStreamException: Attempted to read past the end of the stream.
     at Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware.StartAngularCliServerAsync(String sourcePath, String npmScriptName, ILogger logger)
     --- End of inner exception stack trace ---
     at Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware.StartAngularCliServerAsync(String sourcePath, String npmScriptName, ILogger logger)
     --- End of inner exception stack trace ---
     at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification)
     at System.Threading.Tasks.Task1.get_Result()
     at Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware.<>c.b__2_0(Task1 task)
     at System.Threading.Tasks.ContinuationResultTaskFromResultTask2.InnerInvoke()
     at System.Threading.Tasks.Task.<>c.<.cctor>b__278_1(Object obj)
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
  --- End of stack trace from previous location where exception was thrown ---
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
     at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
     --- End of inner exception stack trace ---
     at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification)
     at System.Threading.Tasks.Task1.get_Result()
     at Microsoft.AspNetCore.SpaServices.Extensions.Util.TaskTimeoutExtensions.WithTimeout[T](Task1 task, TimeSpan timeoutDelay, String message)
     at Microsoft.AspNetCore.SpaServices.Extensions.Proxy.SpaProxy.PerformProxyRequest(HttpContext context, HttpClient httpClient, Task1 baseUriTask, CancellationToken applicationStoppingToken, Boolean proxy404s)
     at Microsoft.AspNetCore.Builder.SpaProxyingExtensions.<>c__DisplayClass2_0.<b__0>d.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
     at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
     at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
     at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
     at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
  ---> (Inner Exception #0) System.AggregateException: One or more errors occurred. (The NPM script 'start' exited without indicating that the Angular CLI was listening for requests. The error output was: ) ---> System.InvalidOperationException: The NPM script 'start' exited without indicating that the Angular CLI was listening for requests. The error output was:  ---> System.IO.EndOfStreamException: Attempted to read past the end of the stream.
     at Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware.StartAngularCliServerAsync(String sourcePath, String npmScriptName, ILogger logger)
     --- End of inner exception stack trace ---
     at Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware.StartAngularCliServerAsync(String sourcePath, String npmScriptName, ILogger logger)
     --- End of inner exception stack trace ---
     at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification)
     at System.Threading.Tasks.Task1.get_Result()
     at Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware.<>c.b__2_0(Task1 task)
     at System.Threading.Tasks.ContinuationResultTaskFromResultTask2.InnerInvoke()
     at System.Threading.Tasks.Task.<>c.<.cctor>b__278_1(Object obj)
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
  --- End of stack trace from previous location where exception was thrown ---
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
     at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
  ---> (Inner Exception #0) System.InvalidOperationException: The NPM script 'start' exited without indicating that the Angular CLI was listening for requests. The error output was:  ---> System.IO.EndOfStreamException: Attempted to read past the end of the stream.
     at Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware.StartAngularCliServerAsync(String sourcePath, String npmScriptName, ILogger logger)
     --- End of inner exception stack trace ---
     at Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware.StartAngularCliServerAsync(String sourcePath, String npmScriptName, ILogger logger)<---
  <---
2018-07-10 16:55:28.974 +00:00 [Information] Request finished in 3267.6338ms 500 text/html; charset=utf-8
  2018-07-10 16:55:41.654 +00:00 [Information] Request starting HTTP/1.1 GET http://xircuitportal-beta.azurewebsites.net/
  2018-07-10 16:55:41.790 +00:00 [Error] An unhandled exception has occurred while executing the request.
  System.AggregateException: One or more errors occurred. (One or more errors occurred. (The NPM script 'start' exited without indicating that the Angular CLI was listening for requests. The error output was: )) ---> System.AggregateException: One or more errors occurred. (The NPM script 'start' exited without indicating that the Angular CLI was listening for requests. The error output was: ) ---> System.InvalidOperationException: The NPM script 'start' exited without indicating that the Angular CLI was listening for requests. The error output was:  ---> System.IO.EndOfStreamException: Attempted to read past the end of the stream.
     at Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware.StartAngularCliServerAsync(String sourcePath, String npmScriptName, ILogger logger)
     --- End of inner exception stack trace ---
     at Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware.StartAngularCliServerAsync(String sourcePath, String npmScriptName, ILogger logger)
     --- End of inner exception stack trace ---
     at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification)
     at System.Threading.Tasks.Task1.get_Result()
     at Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware.<>c.b__2_0(Task1 task)
     at System.Threading.Tasks.ContinuationResultTaskFromResultTask2.InnerInvoke()
     at System.Threading.Tasks.Task.<>c.<.cctor>b__278_1(Object obj)
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
  --- End of stack trace from previous location where exception was thrown ---
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
     at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
     --- End of inner exception stack trace ---
     at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification)
     at System.Threading.Tasks.Task1.get_Result()
     at Microsoft.AspNetCore.SpaServices.Extensions.Util.TaskTimeoutExtensions.WithTimeout[T](Task1 task, TimeSpan timeoutDelay, String message)
     at Microsoft.AspNetCore.SpaServices.Extensions.Proxy.SpaProxy.PerformProxyRequest(HttpContext context, HttpClient httpClient, Task1 baseUriTask, CancellationToken applicationStoppingToken, Boolean proxy404s)
     at Microsoft.AspNetCore.Builder.SpaProxyingExtensions.<>c__DisplayClass2_0.<b__0>d.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
     at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
     at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
     at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
     at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
  ---> (Inner Exception #0) System.AggregateException: One or more errors occurred. (The NPM script 'start' exited without indicating that the Angular CLI was listening for requests. The error output was: ) ---> System.InvalidOperationException: The NPM script 'start' exited without indicating that the Angular CLI was listening for requests. The error output was:  ---> System.IO.EndOfStreamException: Attempted to read past the end of the stream.
     at Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware.StartAngularCliServerAsync(String sourcePath, String npmScriptName, ILogger logger)
     --- End of inner exception stack trace ---
     at Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware.StartAngularCliServerAsync(String sourcePath, String npmScriptName, ILogger logger)
     --- End of inner exception stack trace ---
     at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification)
     at System.Threading.Tasks.Task1.get_Result()
     at Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware.<>c.b__2_0(Task1 task)
     at System.Threading.Tasks.ContinuationResultTaskFromResultTask2.InnerInvoke()
     at System.Threading.Tasks.Task.<>c.<.cctor>b__278_1(Object obj)
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
  --- End of stack trace from previous location where exception was thrown ---
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
     at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
  ---> (Inner Exception #0) System.InvalidOperationException: The NPM script 'start' exited without indicating that the Angular CLI was listening for requests. The error output was:  ---> System.IO.EndOfStreamException: Attempted to read past the end of the stream.
     at Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware.StartAngularCliServerAsync(String sourcePath, String npmScriptName, ILogger logger)
     --- End of inner exception stack trace ---
     at Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware.StartAngularCliServerAsync(String sourcePath, String npmScriptName, ILogger logger)<---
  <---
2018-07-10 16:55:42.383 +00:00 [Information] Request finished in 728.6751ms 500 text/html; charset=utf-8

The sort of the log: it says that he tried to find the file D:\home\site\wwwroot\ClientApp\dist\node_modules\start\package.json
But the folder doesnt exsist and the package.json is in the ClientApp\dist folder.
All my configuration says that the output of the build is going to ClientApp\dist
So what configureation must i set, that the angular app is running in azure
Here my package.json (the start)
{
  "name": "ClientApp",
  "version": "0.1.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "serve": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "run": "ng build",
    "e2e": "ng e2e"
  },
  [...]
}

when your need more info of one file or config write it in the comment i provide it than.
Comment: Have u installed the angular cli in kudo? check this answer out https://stackoverflow.com/a/43119936
Comment: i have tried that but now im struggle with an other error when i build the app. Now azure build the app and says command `'ng' is not recognized as an internal or external command`
Answer: I think you need something like:
services.AddSpaStaticFiles(configuration =>
            {
                configuration.RootPath = "ClientApp/dist";
            });


Breaker does not make solid connection even after replacing it

Question: My main box is a 45 year old GE
the bottom 2 THQL1120 20amp breakers both are intermittent.
The breakers have lots of play and don't make solid connections.
Everyone says it's the breakers at fault not the panel.
I changed the breakers with brand new ones and no improvement at all.
So now that i established the fact that it's the panel and NOT the breakers is there anything that can be done with the panel or is total replacement necessary.
Thank you
Comment: Please include the model number of the panel.
Comment: Hello, and welcome to Stack Exchange. Would it be possible to get a close picture of the breaker mounting point (with the iffy breakers removed)? This might show a mechanical flaw.
Comment: What is the model of your panel? Will it accept the 1/2 inch wide THQP breakers?
Comment: My GE panel accepts both THQP and THQL breakers. The panel has mechanical protections to prevent improper insertion of breakers which prevent the breaker from snapping in if it's not allowed there.
Comment: What brand of breakers are you using?
Answer: My panel is a 48-year-old GE Flush Type TX1615F Mod 2.  I have never had a problem with loose contact of breakers. Is it possible that you are not pressing it in all the way?
I have installed a THQL1120GF and a similar 15A, but all my other branch circuits are protected by the thinner (1/2 inch wide) breakers which I think are THQP. If your panel allows these breakers, then try one of these. Two of these would fit in the space of one THQL, right? Their clamp is at a right angle to the clamp for the THQL. If you install only one, put a 1/2 inch spacer next to it.
EDIT
My GE panel accepts both THQP and THQL breakers. The panel and the breakers have a mechanical interface to prevent improper insertion of breakers--these prevent the breaker from snapping in if it's not allowed there. I came up against this when I tried to put a 2-pole compact breaker in a single 1-inch slot instead of astride two slots. A THQL must go into a single slot and presumably also has protection from improper insertion astride two slots. Are you putting these THQLs in a single slot?


How to use Pandas UDFs on macOS Mojave? (that fails due to [__NSPlaceholderDictionary initialize] may have been in progress...)

Question: I'm trying to use Pandas UDFs (a.k.a. Vectorized UDFs) in Apache Spark 2.4.0 on macOS 10.14.3 (macOS Mojave).
I installed pandas and pyarrow using pip (and later pip3).
Whenever I execute the sample code from the official documentation of Spark SQL I get the following exception.
import pandas as pd

from pyspark.sql.functions import col, pandas_udf
from pyspark.sql.types import LongType

def multiply_func(a, b):
    return a * b

multiply = pandas_udf(multiply_func, returnType=LongType())

x = pd.Series([1, 2, 3])
print(multiply_func(x, x))
df = spark.createDataFrame(pd.DataFrame(x, columns=["x"]))

# Execute function as a Spark vectorized UDF
df.select(multiply(col("x"), col("x"))).show()

The exception is as follows:
objc[97883]: +[__NSPlaceholderDictionary initialize] may have been in progress in another thread when fork() was called.
objc[97883]: +[__NSPlaceholderDictionary initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.
19/03/27 15:01:20 ERROR Executor: Exception in task 0.0 in stage 0.0 (TID 0)
org.apache.spark.SparkException: Python worker exited unexpectedly (crashed)
    at org.apache.spark.api.python.BasePythonRunner$ReaderIterator$$anonfun$1.applyOrElse(PythonRunner.scala:486)
    at org.apache.spark.api.python.BasePythonRunner$ReaderIterator$$anonfun$1.applyOrElse(PythonRunner.scala:475)
    at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:34)
    at org.apache.spark.sql.execution.python.ArrowPythonRunner$$anon$1.read(ArrowPythonRunner.scala:178)
    at org.apache.spark.sql.execution.python.ArrowPythonRunner$$anon$1.read(ArrowPythonRunner.scala:122)
    at org.apache.spark.api.python.BasePythonRunner$ReaderIterator.hasNext(PythonRunner.scala:406)
    at org.apache.spark.InterruptibleIterator.hasNext(InterruptibleIterator.scala:37)
    at org.apache.spark.sql.execution.python.ArrowEvalPythonExec$$anon$2.<init>(ArrowEvalPythonExec.scala:98)
    at org.apache.spark.sql.execution.python.ArrowEvalPythonExec.evaluate(ArrowEvalPythonExec.scala:96)
    at org.apache.spark.sql.execution.python.EvalPythonExec.$anonfun$doExecute$2(EvalPythonExec.scala:128)
    ...
Caused by: java.io.EOFException
    at java.io.DataInputStream.readInt(DataInputStream.java:392)
    at org.apache.spark.sql.execution.python.ArrowPythonRunner$$anon$1.read(ArrowPythonRunner.scala:159)
    ... 28 more

Answer: I found a solution in Doesn't work on macOS High Sierra #69 and thought I'd post it on StackOverflow.

You should make sure that Xcode's command line tools are already installed. If not, execute the following:
xcode-select --install

What turned out very important was to export OBJC_DISABLE_INITIALIZE_FORK_SAFETY env var:
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES

With the two above the code worked fine:
>>> # Execute function as a Spark vectorized UDF
... df.select(multiply(col("x"), col("x"))).show()
[Stage 0:>                                                          (0 + 1) / 1]/usr/local/lib/python3.7/site-packages/pyarrow/__init__.py:159: UserWarning: pyarrow.open_stream is deprecated, please use pyarrow.ipc.open_stream
  warnings.warn("pyarrow.open_stream is deprecated, please use "
/usr/local/lib/python3.7/site-packages/pyarrow/__init__.py:159: UserWarning: pyarrow.open_stream is deprecated, please use pyarrow.ipc.open_stream
  warnings.warn("pyarrow.open_stream is deprecated, please use "
/usr/local/lib/python3.7/site-packages/pyarrow/__init__.py:159: UserWarning: pyarrow.open_stream is deprecated, please use pyarrow.ipc.open_stream
  warnings.warn("pyarrow.open_stream is deprecated, please use "
/usr/local/lib/python3.7/site-packages/pyarrow/__init__.py:159: UserWarning: pyarrow.open_stream is deprecated, please use pyarrow.ipc.open_stream
  warnings.warn("pyarrow.open_stream is deprecated, please use "
+-------------------+
|multiply_func(x, x)|
+-------------------+
|                  1|
|                  4|
|                  9|
+-------------------+

Comment: Ahh ok, got it. Thanks again! :)
Comment: Important to mention: if you're running it from inside an IDE, you should set the environment variable, of course, in the IDE. This is what was not working for me.
Comment: Perhaps a dump question, but you link to a ruby project. Why is it important when using pandas udfs to set this environment variable on macOS High Sierra. And thumps up for the answer.
Comment: May I ask you to point me to "you link to a ruby project"? Where's this "ruby"?
Comment: The link [Doesn't work on macOS High Sierra #69](https://github.com/rtomayko/shotgun/issues/69) is to a thread in a GitHub project that uses the Ruby programming language. Thats what I meant by "Ruby project".

I just don't see how you connected that thread with Pandas UDF's :)
Comment: Ah, right! Because of `objc[97883]: +[__NSPlaceholderDictionary initialize]` in the logs that led to https://github.com/rtomayko/shotgun/issues/69#issuecomment-426839438. Agree?


Elasticsearch does not respond sometimes during indexing

Question: I want to index a MySQL table with 1 million rows in Elasticsearch. I trying this through PHP with the foreach loop. But after a while Elasticsearch is not responding and the process is clogging. I tried some configurations, but it did not work. I think ElasticSearch can not reach the speed of PHP. Is there someone who has encountered this problem before? How can I solve this problem?
My elasticsearch configuration;
bootstrap.mlockall: true
indices.fielddata.cache.size:  40%
http.max_content_length: 1024mb
indices.recovery.max_bytes_per_sec: 1024mb
indices.memory.index_buffer_size: 50%
min_index_buffer_size: 512mb
max_index_buffer_size: 24gb
indices.memory.min_shard_index_buffer_size: 512mb
indices.recovery.concurrent_streams: 30
indices.recovery.file_chunk_size: 256mb
indices.recovery.translog_ops: 10000
indices.recovery.translog_size: 256mb
indices.recovery.compress: true
indices.recovery.max_bytes_per_sec: 1gb

Comment: Could you share your mapping and data to sampling situation? And Are you using bulk insert or one by one insert?
Comment: Here is my code snippets.

http://prntscr.com/ee2yb2

http://prntscr.com/ee2y1n

http://prntscr.com/ee2zuu
Answer: Invalidating Refresh Interval

The refresh API allows to explicitly refresh one or more index, making all operations performed since the last refresh available for search. The (near) real-time capabilities depend on the index engine used. For example, the internal one requires refresh to be called, but by default a refresh is scheduled periodically.

There is a refresh_interval configuration of elasticsearch. This feature can coordinate your refresh actions. You can set this interval to -1 to invalidate it while indexing large dataset.
curl -XPUT localhost:9200/test/_settings -d '{
    "index" : {
        "refresh_interval" : "-1"
    } }'

With this change, your bulk indexing will faster. In this case, now you should refresh your indices, manually. After indexing your data, you need to change your configuration back.
curl -XPUT localhost:9200/test/_settings -d '{
    "index" : {
        "refresh_interval" : "1s"
    } }'

Have you tried before?
Bulk Indexing
You can use bulk API if you can index multiple data at the same time. You can gain some performance with bulk actions. Because you will go to api one instead of many times. This will increase the indexing speed greatly. You can find an example request about bulk indexing below:
POST _bulk
{ "index" : { "_index" : "test", "_type" : "type1", "_id" : "1" } }
{ "field1" : "value1" }
{ "delete" : { "_index" : "test", "_type" : "type1", "_id" : "2" } }
{ "create" : { "_index" : "test", "_type" : "type1", "_id" : "3" } }
{ "field1" : "value3" }
{ "update" : {"_id" : "1", "_type" : "type1", "_index" : "test"} }
{ "doc" : {"field2" : "value2"} }

Storage
Elasticsearch  heavily use disks, so storage is so important. Because it can be bottleneck for you if not using SSD.
For more information please check the indexing performance tips article. It will really help you.
Comment: Is a document of your data large (For example, ten key and nested data set. twenty keys and nested, etc)? Are you using mapping for your types? Because analyzing operations will be slower your indexing. And you are using one by one indexing. Bulk insert will help you about faster indexing. Have you tried bulk indexing before?
Comment: On the other hand, is your disk SSD?
Comment: No, it's not SSD. I did not try bulk indexing and I have no idea about this.
Comment: Are you using elasticsearch-php library to connect ES?


How can i reirect to my welcome page in facebook after clicking like button in facebook

Question: I have facebook fan page. and i also created a fbml tab which i have as the default tab for my facebook page. Now when someone clicks on the like button on my page it takes to the Wall. Is there anyway we can get it to show the FBML instead of the wall after clicking the like button.
Thanks
Prady
Answer: Not really a stackoverflow question imo, but click settings on your main page, there you can select the default landing page.
Comment: Oh!!... i am sorry if its not a stackoverflow question.. But is there a setting to default the fbml tab when like button is clicked. i have the default landing tab as my welcome tab. the only problem is when i click the like button it take to my wall. i need this to stay on my welcome tab after i click the like button


Writing a file in /proc continuouly floods the dmesg

Question: I am trying to read/Write a variable in the linux kernel module using /proc file entry facility.
Kernel module compiles successfully but when tried writing it via
echo 1 > My_file

This operation didn't finish.
Also, dmesg console is continuously flooded with some random value.
[ 1171.481231] proc_write_flag New_Flag 1124646486
[ 1171.481245] proc_write_flag New_Flag 1124646486
[ 1171.481259] proc_write_flag New_Flag 1124646486
[ 1171.481271] proc_write_flag New_Flag 1124646486
[ 1171.481473] ^C

I am new to linux device drivers and trying to use /proc facility provided by the linux kernel. I tried removing the this kernel module, but again, the operation didn't finish.
what is causing this behaviour and how can i rectify it?
Here is the code:
int my_flag;
static struct proc_dir_entry *pdir = NULL;

MODULE_LICENSE("GPL");
MODULE_AUTHOR("GPL");

static ssize_t proc_read_flag(struct file* page,char __user * data, size_t count, loff_t *offset);
static ssize_t proc_write_flag(struct file *file, const char __user* ubuf, size_t count, loff_t* offset);

static struct file_operations myops =
{
    .owner = THIS_MODULE,
    .read = proc_read_flag,
    .write= proc_write_flag,
};

//ssize_t (*read) (struct file *, char __user *, size_t, loff_t *);
//Updated Read function after the reply.
    static ssize_t proc_read_flag(struct file* page,char __user * data, size_t count,loff_t *offset)
{
    int ret;
    if( count >my_flag)         //my_flag holds the count of chars received by write function.
            count = my_flag;
    ret = copy_to_user(data, my_buf, my_flag );
     printk("%s: ret = %d ,my_flag %d\n",__FUNCTION__, ret, my_flag);
    return ( my_flag - ret );
}

//ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *);
//Updated Write function After the reply.
static ssize_t proc_write_flag(struct file *file, const char __user* ubuf, size_t count, loff_t* offset)
{

    if( copy_from_user(my_buf,ubuf,count) ){        //Returns No. of bytes could not copy
            return -EFAULT;
    }
    my_flag = count;
    printk("%s New_Flag %d Data: %s\n",__FUNCTION__,my_flag,my_buf);
    return count;
}

int init_module(void)
{
    struct proc_dir_entry *pfile = NULL;

    pdir = proc_mkdir("My_dir",NULL);
    if(!pdir){
        return -ENOMEM;
    }

    pfile = proc_create("My_file", 0666, pdir, &myops);
    if(!pfile)
        return -ENOMEM;

    printk("Proc_entry Created Successfully, Module initialized\n");
    return 0;
}

void cleanup_function(void)
{
    remove_proc_entry("My_file", pdir);
    remove_proc_entry("My_dir", NULL);
    printk("Removing Proc_entry!!!");
}

Comment: I must also point out that you have a potentially serious security vulnerability: your `proc_read` function will copy `my_flag` number of bytes into the user's buffer, even when that's greater than the number `count` which they requested.  That will most likely overflow their buffer and overwrite something that shouldn't be overwritten.  It seems to me that the number of bytes you copy, and the value returned from `proc_read`, should simply be `count` (which you have already ensured will not exceed `my_flag`).
Comment: You ask about "drivers" but a proc file is not a device driver.  However, there is a reasonable-looking tutorial at https://devarea.com/linux-kernel-development-creating-a-proc-file-and-interfacing-with-user-space/#.XkacDel7lhE
Comment: Write is working fine but, But when i read the device, it is continuously printing the same old data and flooding the dmesg.
Comment: Read again what `proc_read_flag` function actually does - not what you think you made it do, but what it actually does.  Try some examples on a piece of paper.  How many bytes do you copy to user?  What value is returned?
Comment: It works with return value of Zero, flooding stops.Thanks. There are no updated tutorials for learning drivers. Share if you know any.
Comment: Returning zero may stop the infinite loop, but that doesn't mean it "works"; userspace will interpret this as an indication that end-of-file was reached and no bytes were read (copied from the kernel), which is not true.  A `proc_read` function needs to follow the usual behavior of the `read` system call and return the number of bytes read into the buffer.
Answer: The write function should return the number of bytes you processed.
In your case, 'proc_write_flag' function is returning 'ret' which is 0.
which means it will be invoked repeatedly until you process 'count' number of bytes from 'ubuf'
Similarly, 'proc_read_flag' should return the number of bytes you wrote into 'data'. In your case it is returning 0 (len)
There are other problems in 'proc_write_flag' function.
'buf' array isn't initialize and casting 'buf'(address) to int will not give you the expected answer.
Start with this http://tuxthink.blogspot.com/2013/12/creating-directory-under-proc-in-kernel.html
Then look into kstrtol() function.


Install Moodle plugin into root directory or redirect it

Question: I'm in the process of programming my own static pages in moodle. It works so far, but I have the whole thing running in the local environment in its own folder in the root directory "mymoodle.com/folder/".
Now I would like to install it as a plugin on the stable instance via the dashboard/frontend, but if I understand it correctly then only works with the available plugin types => path from the docu
Is that only possible via FTP access? Or is a plugin type not listed yet or have I overlooked one?
Is there a better moodle approach than plugin type "local" ?
I have already discovered the "Static Pages" plugin, but I don't really understand how they solve the redirect from /local/staticpage/ to /static/
Answer: Local Plugin folder is the best approach, if you are creating a plugin that doesn't comes under any of the other plugin types mentioned here.
However you can shift the folder (and make appropriate changes in files to require files) under the Moodle's root directory and it should work.


My Elantech touchpad doesn't feel as good as it does in windows 10

Question: I have an Asus Zenbook UX550V, running Ubuntu Gnome 17.04 and Windows 10.
I have an Elantech touchpad and it works ridiculously well in Windows 10. It is incredibly precise, down to the pixel.
The same, however, cannot be said in Ubuntu Gnome. It works in every regard except, tapping isn't quite as sensitive and my biggest issue is that when making small movements, it just doesn't as well as it does in Windows 10.
For example, in Windows 10 if I make really tiny circles, the cursor will, expectedly, make tiny circles. In Ubuntu however, it might skip a couple dozen pixels in one direction, then another, then another, etc. This makes highlighting text, zoning in on guis, moving windows around, and other tasks a real pain. Any help on making it perform like it does in Windows 10 would be fantastic. Thanks in advance.
Answer: Hope I'm not too late.
Have you checked synclient on this?
if you haven't install that (sudo apt install synclient) and show the output.
Mine is something like this.
> synclient
Parameter settings:
LeftEdge                = 129
RightEdge               = 3105
TopEdge                 = 126
BottomEdge              = 2211
FingerLow               = 1
FingerHigh              = 1
MaxTapTime              = 180
MaxTapMove              = 175
MaxDoubleTapTime        = 180
SingleTapTimeout        = 180
ClickTime               = 100
EmulateMidButtonTime    = 0
EmulateTwoFingerMinZ    = 282
EmulateTwoFingerMinW    = 7
VertScrollDelta         = -79
HorizScrollDelta        = -79
VertEdgeScroll          = 1
HorizEdgeScroll         = 0
CornerCoasting          = 0
VertTwoFingerScroll     = 1
HorizTwoFingerScroll    = 0
MinSpeed                = 1
MaxSpeed                = 1.75
AccelFactor             = 0.0501253
TouchpadOff             = 0
LockedDrags             = 0
LockedDragTimeout       = 5000
RTCornerButton          = 2
RBCornerButton          = 3
LTCornerButton          = 0
LBCornerButton          = 0
TapButton1              = 1
TapButton2              = 3
TapButton3              = 2
ClickFinger1            = 1
ClickFinger2            = 3
ClickFinger3            = 0
CircularScrolling       = 0
CircScrollDelta         = 0.1
CircScrollTrigger       = 0
CircularPad             = 0
PalmDetect              = 1
PalmMinWidth            = 10
PalmMinZ                = 200
CoastingSpeed           = 35
CoastingFriction        = 40
PressureMotionMinZ      = 30
PressureMotionMaxZ      = 160
PressureMotionMinFactor = 1
PressureMotionMaxFactor = 1
ResolutionDetect        = 1
GrabEventDevice         = 0
TapAndDragGesture       = 1
AreaLeftEdge            = 0
AreaRightEdge           = 0
AreaTopEdge             = 0
AreaBottomEdge          = 0
HorizHysteresis         = 19
VertHysteresis          = 19
ClickPad                = 1
RightButtonAreaLeft     = 1617
RightButtonAreaRight    = 0
RightButtonAreaTop      = 1916
RightButtonAreaBottom   = 0
MiddleButtonAreaLeft    = 0
MiddleButtonAreaRight   = 0
MiddleButtonAreaTop     = 0
MiddleButtonAreaBottom  = 0

Usually by editing the CoastingSpeed and CoastingFriction you can find the sweet spot. I set mine up to 35 and 40 using:
synclient CoastingSpeed=35
synclient CoastingFriction=40

Save that on a text file and rename it as startup.sh and run it on every startup using Startup Applications.
synclient has lot of other cool options too, you should check it out like three finger tap to be recognized as a middle click, helps pasting stuff and opening new tabs. Middle Click
Comment: If you have settings that are only temporary, but you would like them to apply for each login, add them to the bottom of your `~/.profile` and `~/.bashrc` files, as a more portable and lower overhead option to using Startup Applications and a separate file just for those settings.
Comment: @prab4th Thank you so much! Actually, changing both `HorizHysteresis` and `VertHysteresis` to 0 is what fixed it for me, and it is perfect now!

The only issue is that after installing `synclient`, my palm detection has gone to hell. I tried to tinker with `PalmMinWidth` and `PalmMinZ`, but I can't quite get it right by trial and error. Are there better methods to figuring this out besides trial and error?
Comment: Set `PalmDetect = 1` ?


How to fix genymotion error of undefined symbol : drmGetDevice?

Question: When I run :
sudo /opt/genymobile/genymotion/genymotion

I've got this error :

Logging activities to file: /root/.Genymobile/genymotion.log
./genymotion: symbol lookup error:
  /usr/lib/x86_64-linux-gnu/libGL.so.1: undefined symbol: drmGetDevice
Comment: read the comment of this page: https://aur.archlinux.org/packages/genymotion/
Answer: Go to the directory where you have installed genymotion and remove libdrm.so.2
Comment: Note that updating genymotion and virtualbox may cause genymotion doesn't work.


Testing my sorting algorithm Error: control reaches end of non-void function

Question: I would like to run this to see if it works. It is supposed to sort an table of integers, but I don't know how the main function is supossed to look like. How do I enter *tab into the function?
void    swap(int *a, int *b)
{
    int buffer;

    buffer = *a;
    *a = *b;
    *b = buffer;
}

sort_int_tab(int *tab, int size)
{
    int a;
    int z;

    z = 0;
    while(z < size)
        {
            a = 1;
            while(a < size)
                {
                    if(tab[z] >= tab[a])
                        {
                            swap(&tab[z], &tab[a]);
                        }
                        z++;
                }
        }       a++;
        z++;
}

int main(void)
{

    sort_int_tab();
    return ();
}

Comment: Yes, this code isn't standards compliant and only compiles because of legacy reasons. It will produce warnings if you have warnings enabled on your compiler(which is an extremely good idea).
Comment: `sort_int_tab` doesn't have a return type?
Comment: So I need to add a return type? Sorry, I am new to this. I understood the concept of the sorting, but I can't test it.
Answer: There are two important issues in your code. First, your function does not have a return type. Since you are not returning anything, it should be void:
void sort_int_tab(int *tab, int size) {
    /// Your code...
}

Second, inside of main, you are calling the function without arguments. You should pass an array of int (remember to allocate memory and initialise it), and the size of the array:
sort_int_tab(tab, size);

You can initialize an array like this and then pass it to your function:
int tab [5] = { 3, 4, 1, 2, 5};
sort_int_tab(tab, 5);


Does Time Bomb Reveal Invisible Allies?

Question: I was thinking about Zilean's Time Bomb ability, and I started thinking about fun ways to use it.  One such way would be to cast Time Bomb on an allied champion, while they're invisible.  (Eve, Shaco, Teemo, etc.)
I'm wondering though--technically if that explodes near an enemy champ, Zilean is the one dealing damage, not Eve/the invisible ally.  So what I'm curious about is whether or not the invisible ally will be revealed when "delivering" the Time Bomb.
(Obviously the enemy would know "something's up" if an invisible ally is detonated, even if not technically revealed.  I am just trying to find out if they will then become VISIBLE to the enemy)
Answer: Stealth can only be broken by a stealthed champion performing an action that breaks stealth.
Though not viable by any means, before the sunfire cape's damage was a unique passive, it was fully possible to simply buy multiple capes and follow an enemy champion around while stealthed, relying on the damage to slowly kill them.
In this case, Time Bomb reacts the same as if you cast it on a ward - because the target is stealthed, the effect won't be visible, nor will it break stealth upon detonation. The enemy would just get a sudden burst of damage with no apparent cause.
Comment: @dani It's entirely possible that this may still be relevant. The stealth 'rework" as they've said has few details thusfar. It could simply be that stealth will be limited to Shaco-esque or Vayne-esque implementations, with severely reduced durations and long cooldowns.
Comment: So, from your response, I assume that you mean that the "ring" (explosion animation) will also be "stealthed" just like the character itself?  That is (potentially) a pretty powerful tactic...
Comment: Stealth is going to be totally remade soon fyi. RIOT have nerfed Twitch and Eve to near unplayable because stealth is a broken mechanic that dominates new players and low elo. So this question will need updating in the (near) future. See here for a more detailed discussion: http://www.reddit.com/r/leagueoflegends/comments/hp3vm/changes_to_stealth_coming_soon_some_morello_posts/
Comment: @Tux - yes. That's what I meant by "the effect won't be visible". Brush interacts the same way, actually - if an enemy nunu starts channeling his ult in the bushes, you will be slowed, but you won't see the particle effects of absolute zero unless you have vision inside the brush (and thus can through his 'stealth')
Comment: @danixd - yes, and I'm looking forward to it. But that shouldn't change the answer to this question.
Comment: I actually ran into this exact scenario last night, with my brother playing Zilean and having an Evelynn ally. It was quite amusing. It isn't necessarily the most potent use of your Mana, but it can be done to accumulate a fair amount of damage without the enemy noticing as explicitly.
Comment: @Grace Note It seems like more of a psychological influence.  Confusing the enemy or having them take damage AS IF from nowhere is a good way to have them scared early on.  (Especially since I'm not lvl 30/ranked yet--just a lowly lvl 20)
Comment: @Tux - for what it's worth, I find ranked games overrated.

Does Time Bomb Reveal Invisible Allies?


How do I frame a room inside a garage so that the room's ceiling will not touch the garage ceiling?

Question: I am considering building a small 6 x 9 room inside my garage to use as an office. However, I do not want to remove the garage door opener unit nor the tracks the door slides on because we will want to continue using that door for access to the garage.
I have seen a few resources with guides for framing but all show the top plate of the room being secured to an existing ceiling. In my case I want the ceiling to be independent.
Also, the height from the floor to the garage door slider tracks is 8 feet. With some play I am thinking I will be OK with a 7 foot ceiling but I am not too thrilled with a ceiling that low. Any creative recommendations for dealing with garage door sliders?
Comment: Why can't you put your room in a back corner of your garage where there are no door tracks ?
Comment: Good question. Because the side we do not park on (where I will build the room, the car does not fit on the other side) has stairs leading down from the house into the garage. In order for us to get to the car from those stairs means the room has to be partially under those tracks. Sucks but I don't think there is another way unless the room could be 6 x 3.
Comment: Do you need a ceiling?  why not leave it open.  just build three walls, tie them into the original wall, and fasten them to the floor. (and don't forget a door).
Comment: I need a ceiling because I live in Maryland. It gets both very hot and very cold.
Answer: You are essentially building a self-supporting flat-roofed shed inside the garage, not adding interior walls to the garage.
You should be able to screw a 2x4 sill plate onto the garage floor. The sill plate is mostly there in case the concrete is uneven. It could be pressure-treated in order to resist rotting from moisture on the floor or in the concrete. (In that case, use galvanized nails to nail the sole plate to it.) If you don't build a floor, I think the sole plate of the walls could be screwed directly into the floor, avoiding the sill.
Since you're in a cold climate, you may want to build and insulate a floor. If so, place the rim joists, then hang the remaining joists with joist hangers, insulate, then glue and nail on plywood sheathing. If the joists go in the short direction and are spaced 16" o.c. you should in theory be OK with 2x4 joists, but the code may require 2x6 as a minimum, and that would leave more space for insulation.
Next, frame the walls individually, sheathe them with plywood or OSB, and raise them. If you have a sill or subfloor, face-nail the sole plate to the floor with 16d nails 16" o.c. Sheathing the walls adds lateral support, and thereby helps keep them square. This is a lot easier to do while the walls are still flat on the floor, before you raise them. Make sure to double the top plate.
Finally, frame an "attic subfloor" as a ceiling for your office. In response to your question, the ceiling is somewhat similar to a wall, but the joists must be hung properly (not just end-nailed like the studs in a wall), and the sheathing (plywood or OSB) needs to be glued as well as nailed. Sheathing this subfloor is essential for stability. As mentioned, if spaced 16" o.c., 2x4 is sufficient to span 6 ft, but your code may require 2x6 anyway.
Check out the framing books at the home improvement or bookstore, or google for "framed floor" and "platform framing". Check your building code for insulation requirements. You will probably need a building permit.
The ceiling height may be an issue, once you subtract 6 inches for a floor and 6 inches for a ceiling.
Comment: You have the idea. Why sheathe the walls before framing?
Comment: Also, I was planning on just having the garage concrete floor remain as the floor of the 'shed'. Do I need both the sole plate and the sill plate? Couldn't I just secure the sole plate of each wall to the concrete?
Comment: Thanks for the info. I am thinking of doing no sill plate as the concrete is pretty flat and even. Can I use pressure treated wood as the sole plate and just screw that into the concrete with tapcon screws and washers?

Finally, I am wondering about the "attic subfloor" you mentioned. I did some googling but could not find any mention of this term. Is it essentially just another wall placed on top of the structure (2x4's and plywood sheathing)? If so, good, as I was planning on insulating the ceiling so this seems to be a good solution.
Comment: @phirschybar: I incorporated my answers to your comments into my main answer, as they were too long for comments.
Comment: Thanks again for helping. I am curious about your take on the flooring (or lack of). I don't think this project will be possible if I need to insulate the floor because my ceiling height will end up close to 6 feet (way too low). How necessary do you think it is?
Comment: @phirschybar: It will be like a basement. Probably tolerable as long as you wear shoes. The heat loss will add a little to your heating cost, but the room is so small that the heating costs cannot be enormous.
Answer: This solution would mean replacing the garage door, which perhaps is not in the cards, but there are "roller" doors that roll up above the garage door opening, such as those pictured here: http://www.buydoorsdirect.com/
That would eliminate the tracks as a factor, and you could build all the way up to the existing ceiling.
Comment: I think the structure would be fine as you described; I was just pointing out one way in which you could eliminate the problem of the tracks and not worry about a low ceiling.
Comment: Is it not structurally sound to not connect to the ceiling? I will be able to brace the structure to one of the walls of the garage. I don't think I can afford to replace both of the doors wih roll ups.


Using VisualStates in DataGridRow ControlTemplate

Question: I created a custom style for a DataGridRow which also changes the control template which I obtained in Visual Studio (right click on the control and chose to edit copy of the template (sorry, I don't have the exact translation)). First I omitted the entire VisualStateManager-stuff and everything worked fine. But when I want to have alternating row colors I guess I have to use the VisualStateManager with the state 'Normal_AlternatingRow'. Unfortunately, I am getting this error as soon as the VisualStateManager is uncommented:
'[Unknown]' property does not point to a dependencyobject in path '(0).(1)[0].(2)'
This is my DataGridRow style with template:

I haven't used visual states in control templates before.
Thanks for any help!
Answer: The current implementation assumes that the Background property is set to a GradientBrush.
If ControlLightBackgroundBrush is a SolidColorBrush, the following should work:
<VisualState x:Name="Normal_AlternatingRow">
    <Storyboard>
        <ColorAnimationUsingKeyFrames Storyboard.TargetName="DGR_Border"
                                      Storyboard.TargetProperty="(Button.Background).(SolidColorBrush.Color)">
            <EasingColorKeyFrame KeyTime="0" Value="Yellow"/>
        </ColorAnimationUsingKeyFrames>
    </Storyboard>
</VisualState>


How to remove annotations added as MKAnnotationView objects

Question: I am new to using MapKit framework.
I am adding an image to MKAnnotationView object at specific lat-long pair on map, say at (latA, longA).
For the next iteration, i need to remove the annotation added and add new annotation at different lat-long pair, say at (latB, longB).
Let me know of any help.
Thanks
@dity@
Answer: Step1: Remove the annotation
[self.mapView removeAnnotation:annotation];
Step2: Change/Recreate the annotation, and add it back
[self.mapView addAnnotation:annotation]


How to change text of text view or hide textview using accessibility?

Question: I want to either hide the text view of another app or want to change one of the text view of other app using accessibility service. I can get AccessibilityNodeInfo of text. How can I proceed next?
Answer: Changing any property in AccessibilityNodeInfo is not good even in your own application.
Accessibility Technologies like TalkBack uses the values/data provided by the Accessibility Service(through Accessibility Node Info) to announce how the view/element looks like for the blind/partially blind users. Any usage of data that is received from the service to change the content even if possible is not good.
There are certain methods provided in the Accessibility Delegate to change how the text is being announced of a particular view but they should be used in a very specific scenario or particularly when there is some sort of shortcoming in the data provided by the Accessibility Service.


Position react-modal relative to an element in the background

Question: I have an input box in my main App element (id= "inputBox") and a react-modal that pops up when some input is given to this input box(via onChange event).
I want to position the react-modal just below this input box when it pops open but am being unable to do so.
I have so far only been able to position it relative to the viewport by calculating the offset of the input box and accordingly setting the style.top/style.left of the modal overlay.
But this is causing some other problems,so I need to be able to set the position relative to the input box.
Any suggestions on how to do this will be highly appreciated.
Comment: Put it just below the input in the DOM
Comment: @JonasW.Hi.I tried that,but that did not have any effect.
I put the  just below the  element in the DOM,but that does render  below
Answer: I think you're creating something like a search dropdown where some results appear on users search query. The most simple solution I can think of is to create a new component and include the popup inside that so it will be relative to it no matter what.

Your component will need to have its own state


SSRS How to hide parameters/grouping panels in design mode

Question:
How to hide parameters/grouping panels in design mod. Or in other words uncheck these menu options so panels hidden when a report opened in design mode. Every time I open any report, it opens parameters and grouping panels as well. There must be any option not to open these panels by default with every report opened. I am tired and found nothing on web. Please let me know.
Thanks
Comment: What I need here is to close by default for every report I open. I know how to close it one by one for all reports opened.
Answer: Right-Click on a blank part of your report, then View -> Parameters
Comment: I have not received any answer or even comment for my question. Still looking for any good solution...
Comment: The methis I described does affect all reports, you only need to set it once.
Comment: I dont know I tried the same before but in my case it did'nt work. Well thanks.


Proving $1^k+2^k+ \dots + n^k = O(n^{k+1})$

Question: I have to prove that : $1^k+2^k+ \dots + n^k = O(n^{k+1})$, where $k \in \mathbb{Z}^+$ . I followed a technique different from the book , and I want to check if my way is correct. I approach the problem using Induction.
Let $P(n)$ be the statement "$1^k+2^k+ \dots + n^k = \sum_{i = 1}^ni^k =  O(n^{k+1})$ ".
Induction basis: I will show that $P(1)$ is true. That equals: $1^k = O(1^{k+1})$. In other words, I have to prove that $\lim_{x\to \infty}\frac{1^x}{1^{x+1}} = L \geq 0$.
$\lim_{x\to \infty}\frac{1^x}{1^{x+1}} = \lim_{x\to \infty}\frac{1^x}{1^{x}1^1} = 1 \in \mathbb{R}$ so the Induction basis is proved.
Induction step: Let $P(l)$ be true, for some $l>1$. I will prove that $P(l) \rightarrow P(l+1)$.
As $P(l)$ is true, that means that $\sum_{i=1}^{l} = O(l^{k+1})$. Let's prove that $P(l+1)$ is true. I want to prove that $\sum_{i=1}^{l+1} = O((l+1)^{k+1})$ is true, so: $1^k + 2^k + \dots + l^k + (l+1)^k = O((l+1)^{k+1})$
I have to prove that: $\lim_{x \to \infty}\frac{ 1^x + 2^x + \dots + l^x + (l+1)^x  }{(l+1)^{x+1}} = L \geq 0$
$
\begin{align}
\\
\lim_{x \to \infty}\frac{ 1^x + 2^x + \dots + l^x + (l+1)^x  }{(l+1)^{x+1}}
 &= \lim_{x \to \infty}\frac{ 1^x + 2^x + \dots + l^x + (l+1)^x  }{(l+1)^x \times (l+1)} \\
& = \frac{1}{l+1} \lim_{x \to \infty} \frac{ 1^x + 2^x + \dots + l^x + (l+1)^x  }{(l+1)^{x}} \\
& = \frac{1}{l+1} [\lim_{x \to \infty} (\frac{1}{l+1})^x+ (\frac{2}{l+1})^x + \dots (\frac{l}{l+1})^x + 1 ]
\end{align}$ .
As $l > 1 \rightarrow l+1 > 2$ the above limit equals $0 + 0 + \dots + 0 + 1 = 1$. So $\frac{1}{1+l} \in \mathbb{R}$, and thus the induction step is proven, and the proof is concluded. $\blacksquare$
Is this way correct?
Comment: You cannot prove $f(n)=O(g(n))$ by induction on $n$ because it makes no sense for fixed $n$.
Comment: @HagenvonEitzen: oh, I didn't notice that OP was using induction on $n$. It would be a valid proof it the induction is over $k$; otherwise, it's incorrect.
Comment: Looks good to me. Minor nitpick: you should replace $\Bbb R$ with $\Bbb R_{\geq 0}$ and the inductive step should assume $P(l)$ is true for some $l\color{red}{\geq} 1$ because your inductive base starts from $l=1$.
Comment: Note that you're proving something stronger than you were asked to.... as $f(n)$ being $O(g(n))$ just means that $f(n) / g(n)$ is bounded, not that it converges to a particular value.
Comment: Another approach would be to note that $(m+1)^{k+1}-m^{k+1}=\sum_{r=0}^k\binom {k+1}r m^r$ and sum both sides over $m=1$ to $n$ to note that $(n+1)^{k+1}-1=\sum_{r=0}^k\binom {k+1}r S(r)$ where $S(r)=\sum_1^n i^r$. You can then conclude using strong induction that $S(k)\in\mathcal O(n^{k+1})$ for all integers $k\geq 0$
Comment: I thaught $ k $ was fixed. Isn't this the statement ? $$ \sum_{p=1}^{n}{p^{k}}=\underset{\overset{n\to +\infty}{}}{\mathcal{O}}\left(n^{k+1}\right) $$
Comment: @mjqxxxx: I guess it would show rather the stronger assertion that it is $\Theta(n^{k+1})$, right?
Comment: @HagenvonEitzen of caurse, that's what I thaught too. $ n $ is the variable of the asymptotic developpement isn't it ?
Comment: I think your "proof" is nonsense. The statement you are trying to prove *does not* depend on $n$, is is a way of writing the statement "there exists some real number $M$ and some $n_0\in\mathbb{N}$  such that $1^k+2^k+\dots +n^k \leqslant M n^{k+1}$ for all $n\geqslant n_0$.
Comment: @PrasunBiswas: In fact it's even stronger than that... for $f(n)$ to be $\Theta(g(n))$, it's sufficient that $f(n)/g(n)$ is bounded above (away from $\infty$) and below (away from $0$).  In other words, the ratio can oscillate; it needn't converge.
Answer: Why not simply
$$\sum_{j=1}^nj^k\le \sum_{j=1}^nn^k =n\cdot n^k=n^{k+1}$$
Answer: The claim $$\sum_{k=1}^n k^r=O(n^{r+1})\qquad(n\to\infty)\tag{1}$$ cannot be proven by induction with respect to $n$, because $n$ is a dummy variable which is burnt after the claim has been spoken out, because we have said $n\to\infty$ within the claim. That $(1)$ is true for $n:=5$ is absurd: Write $5$ for $n$ in the formula, and you obtain
$$1^r+2^r+3^r+4^r+5^r=O(5^{r+1})\qquad(5\to\infty)\ .$$
We all know from high school that
$$\eqalign{\sum_{k=1}^n k^0&=n=O(n^1),\cr
\sum_{k=1}^n k^1&={n(n+1)\over2}=O(n^2),\cr
\sum_{k=1}^n k^2&={n(n+1)(2n+1)\over6}=O(n^3)\ .\cr}$$
Following this one could maybe set up an induction proof with respect to the variable $r$ in $(1)$.
Answer: I suppose $ k $ is a fixed integer, that was the first thing you've said. So we wanna prove this : $$ \sum_{p=1}^{n}{p^{k}}=\underset{\overset{n\to +\infty}{}}{\mathcal{O}}\left(n^{k+1}\right) $$
If we wanted to use induction, we must do it on $ k $, not on $ n $ which is the variable of the asymptotic developpement. I suggest to following method though :
Notice that, for any $ k\in\mathbb{N} $ : $$ \frac{1}{n^{k+1}}\sum_{p=1}^{n}{p^{k}}=\frac{1}{n}\sum_{p=1}^{n}{\left(\frac{p}{n}\right)^{k}}\underset{n\to +\infty}{\longrightarrow}\int_{0}^{1}{x^{k}\,\mathrm{d}x}=\frac{1}{k+1} $$
Thus : $$ \sum_{p=1}^{n}{p^{k}}=\underset{\overset{n\to +\infty}{}}{\mathcal{O}}\left(n^{k+1}\right) $$
That is due to the fact that any convergent sequence is bounded, since $ \left(\frac{1}{n^{k+1}}\sum\limits_{p=1}^{n}{p^{k}}\right)_{n} $ converges, $ \frac{1}{n^{k+1}}\sum\limits_{p=1}^{n}{p^{k}}=\underset{\overset{n\to +\infty}{}}{\mathcal{O}}\left(1\right) $, hence the result.
Answer: Each term in the sum is $\le n^k$, and there are $n$ terms.  So clearly
$$1^k + 2^k + \ldots + n^k \le n \cdot n^k = n^{k+1}.$$
Your proof appears to correctly show that the sum grows as $n^{k+1}$ as $k\rightarrow\infty$ for each fixed value of $n$.  This isn't what you were asked to show: you want to prove that the sum grows (no faster than) $n^{k+1}$ as $n\rightarrow\infty$ for each fixed $k$..... and in general you can't conclude one of these facts from the other.  (For instance, which grows faster, $n^k$ or $k^n$?  The answer depends on which variable is fixed and which is becoming large.)