Neighborhoods of points in cofinite topological spaces

Question: My topology text defines the "neighborhood" of a point as follows:Let p be a point in a topological space X .A subset N of X is a neighborhood of p iff N is a superset of an open set G containing p.
Now I am stuck on the following problem:Let X be a cofinite topological space .Show that every neighborhood of a point p (element of x) is an open set .Now since in cofinite topology the closed sets are finite , so this should be true by definition , that is aclosed set could not contain an open set ...I just cannot see what we have to prove here ........
Answer: The definition is correct and also the statement that every neighborhood of a point in a space endowed with the cofinite topology is open.
Suppose $N$ is a neighborhood of $p$ and that $G$ is an open set such that $p\in G$ and $G\subseteq N$.
Then $X\setminus G\supseteq X\setminus N$, so $X\setminus N$ is finite. Hence $N$ is open.
Comment: Are we showing here that there exists one more larger open set $N$ in the topology, such that $G$ is a subset of it, and $G$ contains $x$ , hence making $N$ a nbd of $x$ as well as member of the topology ?

I am a bit confused as to why $N$ should be open
Comment: @TheDoctor I'm proving that, if $N$ is a neighborhood of $p$, then $N$ is open. Since it is a neighborhood, there exists an open set $G$ with $p\in G\subseteq N$ (by definition of neighborhood). Now we check that $X\setminus N$ is finite, so that $N$ turns out to be open as well.
Comment: because $N'$ is finite, so $N$ is infinite and hence open. Am I right?
Comment: @TheDoctor Not really: $N'=X\setminus N$ finite ends the argument (the fact that $N$ is infinite is irrelevant and indeed false if $X$ is finite to begin with).
Comment: Thank you, I get it now


Default multiple comparison correction in TukeyHSD in R?

Question: Does anyone know what the default method is for adjusting for multiple comparisons is in the TukeyHSD function? (e.g. BH, Bonferroni, etc.)
Answer: The Turkey HSD (honest significant difference) test is itself a procedure for statistical testing that takes into account multiple comparisons. It's based on the Studentized range distribution of the difference between the maximum and minimum of a set of a number of values (expressed in terms of sample standard deviations). The multiple-comparisons issue is handled by the incorporation of the number of values being compared (mean values, in this case) as a parameter of the Studentized range distribution.
Tukey's HSD attempts to control family-wise error rate so in that sense it is more similar to the Bonferroni correction than to the Benjamin-Hochberg false discovery rate approach. But it is a test of its own and depends on no other correction for multiple comparisons.


Tinymce paste image?

Question: I have searched the net a lot and i didnt find solution for this issuse? Is there anyway to paste formated word document in tinymce but with picture inside?
Answer: No, there is no way that i know of to do this becasue of the structure of the word document.
In Word images are not inserted using a href with an image location. In word images are usually referencing to local files. To display an image in an editor/web page you need the image location or a base64-encoded string (pasting from word does not deliver this information).
Answer: Useful, but old, link http://www.tinymce.com/forum/viewtopic.php?id=5585
Some php code that convert inline IMG tags with data:url to actual image files on the server side using PHP : http://jk3.us/2011/10/31/pasting-images-in-tinymce/

Tinymce paste image?


Integer to integer not working

Question: I need the same counts from the previous Mesh Line or Curve Line nodes to continue Multiplying or dividing for ahead but at this point, I am confused that in the Viewer node it is showing the exact integers I want but it is not working. Why?
Comment: The _Count_ input is a single number, like a count of 10 with an offset of 1 m meaning every meter there is a point and 10 overall. You try to input a list (called "field" in _Geometry Nodes_) of index integers into it. The indices are 0, 1, 2, 3 etc. but a mesh line can only have one count of points, not several. How should a single line have an overall count of 0 points (impossible anyway, has to be 1 at least), but at the same time 1 point, 2 points, 3 points etc.?
Comment: I got it Thanks, but I want the same count I have in the previous `Mesh Line` node for the next one. Is it possible to get this?
Comment: The count is a fixed value. So why not simply put the same value in there? And if you want to change the value, just use an _Integer_ node which you plug in both _Count_ inputs. There you can set a single value. The _Index_ holds a list of incrementing numbers, not the count of the _Mesh Line_.
Answer: I guess we are talking of different things in the comments. What you show in the Viewer node is the index of points in that Mesh Line, the index is their unique number to identify them. The Count in the Mesh Line node is the sum of all points that are building this line, so they are 10 points altogether.
Each Mesh Line with 10 points would have the indices 0, 1, 2, ..., 9 for its points. But after you combine them with Join Geometry, they are treated like a single object consisting not of 10 points, but 20. Since the index is a unique indentifier, no two points are allowed to have the same index inside an instance or mesh.
If you want them to repeat, you can use the ID instead of an index. Therefore you have a Set ID node in Geometry Nodes. You can use the Index node and plug it into a Math node set to Modulo with the other value set to 10. The result will be the difference between the index and a multiple of 10.
So while the Index in the joined geometry goes from 0 to 19, the ID goes from 0 to 9, then starts again at 0 and up to 9 again. So if you need these values for anything later on, you can use the ID node instead of the Index node.
Answer: If you use Capture Attribute or Transfer Attribute to query the index of a geometry on a certain domain (in your case you have chosen the attribute domain Points), you will always get the consecutive index of each point.
So you get back an integer value changing per point. This is called "field" and this type is marked with a diamond shaped socket. You can also compare this with an array consisting of several values.
In contrast to the "field", which is a whole array of values, the node Mesh line needs a single value for the input Count. This is represented with a circular socket.
So to feed both nodes with a single value you have (at least) two possibilities...
Either you give both nodes the same integer value:

Or you evaluate the number of points of one node with Domain Size and feed the second node with this value:
Comment: After a few comments and looking at the marked index column in the screenshot, I think he wants something else, hence my answer...
Comment: ...once again I didn't understand the question at all, and he didn't actually tell us what he really wants to do here :D
Comment: Yes, I think he confuses the "count" in the mesh line with the incremental index numbers which are like you "counted" the points... but that's just a wild guess :D

Integer to integer not working


Is there a way to make keras custom test_step aware of the call being made from model.fit and model.evaluate

Question: I am using keras custom model with custom train_step and test_step methods overwritten. Also, have a need to change certain margin used in the loss function, only for test dataset. In other words I want to use one value of margin for training and validation datasets, but a little relaxed margin for test datasets. I think I can accomplish this if the test_step method gets to know(some how) if the function call has come from model.fit(validation part) and model.evaluate(test part).
Answer: Yeah, you can do that. You can just use a flag or variable that you can set based on the context in which the method is being called and in this way you can make the custom test_step method aware of the call being made from model.fit and model.evaluate.
Well, what you can do is that you could define a variable is_training in your custom model, and set it to True in the train_step method and to False in the test_step method. Then, you can use this variable to determine whether the model is being trained or evaluated in the test_step method.
Comment: I think, I didn't get it entirely. How setting is_training **inside** train_step or test_step helps this condition! I am guessing such kind of setting has to be done outside of test_step, that way test_step would know where the call has come from. My apologies, if I didn't get it correctly, can you rephrase it please.
Answer: There is a nice keras.backend.in_train_phase() function for that. It is not documented (intentionally) but its signature is:
def in_train_phase(
    x: Any,
    alt: Any,
    training: Any | None = None
) -> Any

Selects x in train phase, and alt otherwise.


Why was use of Mistress was considered vulgar during 1800's?

Question: I found out in etymology of Mistress that it was considered vulgar to use it for women. I want know why and what is it's exact meaning and origin of word Mister and Mistress.
Comment: Sorry, off topic. Though - http://www.merriam-webster.com/dictionary/mistress AND http://www.etymonline.com/index.php?term=mistress
Answer: Both words are variants of master, originally Old French maistre—mistress is the same word with the French feminizing suffix -esse tacked on. A master (or mistress) was anyone who exercised control over subordinate persons—servants. Consequently, Master and Mistress became in the 15th century honorifics bestowed upon men and women who did not have aristocratic titles. The owner of the tavern where Shakespeare's Falstaff lodges is Mistress Quickly.
But when mistress came into the English language in the 14th century, it brought along some literary baggage. In the 'courtly love' tradition of the 12th century and after it was conventional for the poet to offer his 'service' to the woman he loved, he swore to follow and obey her in all things. He therefore referred to her as his 'mistress'; so the term came to have a secondary meaning of the woman whom one loves, as in Shakespeare's sonnet: My mistress' eyes are nothing like the Sun.
Originally the word did not imply a sexual relationship, although it did not exclude it either. But around the year 1600 mistress began to be used as a polite term for a woman with whom a man had a long-term illicit sexual relationship—typically, what the Victorians called a "kept woman", a woman maintained at her lover's expense. Over the next two centuries this gradually came to be the primary sense of the word; so by about 1800 it became very awkward to refer to a respectable woman as Mistress Jones or Mistress Smith. What happened was the term shifted its pronunciation when used as an honorific: it became missus and, eventually, mizziz as it is today.
Comment: Nice bit of historical context.


How to sort a file in-place?

Question: When we use the sort file command,
the file shows its contents in a sorted way. What if I don't want to get any output on stdout, but in the input file instead?
Comment: Into the orignal file
Comment: @AliSajid: Then please update your question to say that, so your question is useful for other readers with the same problem.
Comment: Please update your question to clearly tell explain what you want to do with the result of sorting the file. Do you want to sort it in place, replacing the unsorted contents of `file` with the sorted contents of the same file? The way your question is currently stated, doing nothing at all is a correct answer (you don't want any output, so don't do anything).
Comment: @KeithThompson thanks for your concern actually, I was trying to sort a file but want to avoid the output on the screen.
Comment: So where do you want the output to go? Into a new file? Into the original file? To the printer down the hall?
Comment: run `sort infile >outfile` and you'll get the sorted output into file "outfile".  Then you can erase the original "infile" and everything will be ok.
Answer: You can use the -o, --output=FILE option of sort to indicate the same input and output file:
sort -o file file

Without repeating the filename (with bash brace expansion)
sort -o file{,}

⚠ Important note: a common mistake is to try to redirect the output to the same input file
(e.g. sort file > file).  This does not work as the shell is making the redirections (not the sort(1) program) and the input file (as being the output also) will be erased just before giving the sort(1) program the opportunity of reading it.
Comment: Just to mention the importance of order.

From `GNU sort` info page:

    `-o OUTPUT-FILE'
    `--output=OUTPUT-FILE'
          Write output to OUTPUT-FILE instead of standard output.
          On newer systems, `-o' cannot appear after an input file if
          `POSIXLY_CORRECT' is set, e.g., `sort F -o F'.  Portable scripts
          should specify `-o OUTPUT-FILE' before any input files.
Comment: The first example code line should be deleted. It is _not at all_ what the title of the question refers to: `in-place` sorting. This redirection could go last with the note. But definitely _not_ first.
Comment: I made the same mistake, too. Actually I made a backup of the file before that, so my data is intact. But I was wondering why I ended up with an empty file. Thanks for the explaination.
Comment: Thanks for the nice brace expansion trick I learned today from you. My mistake was that I used the long option `--output`. I forgot an additional hyphen in my hurry also put the output option last, which is what you would do when you are used to redirection. When you do everything properly it just works of course. :-)
Answer: The sort command prints the result of the sorting operation to standard output by default. In order to achieve an "in-place" sort, you can do this:
sort -o file file

This overwrites the input file with the sorted output. The -o switch, used to specify an output, is defined by POSIX, so should be available on all version of sort:

-o Specify the name of an output file to be used instead of the standard output. This file can be the same as one of the input files.

If you are unfortunate enough to have a version of sort without the -o switch (Luis assures me that they exist), you can achieve an "in-place" edit in the standard way:
sort file > tmp && mv tmp file

Answer: sort file | sponge file

This is in the following Fedora package:
moreutils : Additional unix utilities
Repo        : fedora
Matched from:
Filename    : /usr/bin/sponge

Comment: This also works on Ubuntu after installing with `sudo apt install moreutils`
Answer: Do you want to sort all files in a folder and subfolder overriding them?
Use this:
find . -type f -exec sort {} -o {} \;

Answer: Here's an approach which (ab)uses vim:
vim -c :sort -c :wq -E -s "${filename}"

The -c :sort -c :wq portion invokes commands to vim after the file opens.   -E and -s are necessary so that vim executes in a "headless" mode which doesn't draw to the terminal.
This has almost no benefits over the sort -o "${filename}" "${filename}" approach except that it only takes the filename argument once.

This was useful for me to implement a formatter directive in a nanorc entry for .gitignore files.  Here's what I used for that:
syntax "gitignore" "\.gitignore$"

formatter vim -c :sort -c :wq -E -s

Comment: You are using vim in your `nanorc`?  Oh the irony.
Answer: To sort file in place, try:
echo "$(sort your_file)" > your_file

As explained in other answers, you cannot directly redirect the output back to the input file. But you can evaluate the sort command first and then redirect it back to the original file. In this way you can implement in-place sort.
Similarly, you can also apply this trick to other command like paste to implement row-wise appending.
Comment: This is bad because it will not work for large files, strips ending newlines, `echo` can mess with backslash escapes in POSIX, and `-o` does work for the same file as input as explained at: https://stackoverflow.com/a/29244387/895245
Answer: No answers about few files, so:
sort -u file1 file2 -o file1

How to sort a file in-place?


MySQL Cluster is a NoSQL technology?

Question: MySQL Cluster is a NoSQL technology? Or is another way to use the relational database?
Answer: MySQL Cluster uses MySQL Servers as API nodes to provide SQL access/a relational view to the data. The data itself is stored in the data nodes - which are separate processes. The fastest way to access the data is through the C++ API (NDB API) - in fact that is how the MySQL Server gets to the data.
There are a number of NoSQL access methods for getting to the data (that avoid going through the MySQL Server/releational view) including Rest, Java, JPA, LDAP and most recently the Memcached key-value store API.
Answer: It is another way to use the database by spreading it across multiple machines and allowing a simplified concurrent-master setup. It comes with a bit of a cost in that your indexes cannot exceed the amount of RAM available to hold them. To you application, it looks no different than regular MySQL.
Perhaps take a look at Can MySQL Cluster handle a terabyte database.

MySQL Cluster is a NoSQL technology?


Can't login with iCloud Control Panel for Windows. Constant server error

Question: I have problem of connecting to iCloud with iCloud Control panel for Windows.
After a while it errors with can't connect because of server error. And gives me a link to iCloud status which is always all green.
This problem is not last hour problem, it is constantly the same from the time I installed iCloud CP version 4 when it was released. I didn't have previous version of CP installed on this machine. I did't tweaked services above usual turn off of XPS server and Tablet PC components in Programs (Unistall part of Windows Control Panel)
I have Windows Firewall enabled (though disabling it doesn't make a change). Antivirus is MSSE. I am behind old Linksys router though it has uPNP enabled on it (and disabling SPI firewall on it doesn't change anything either). It is in Gateway mode.
Itunes login into account fine and I can log into iCloud.com with a browser.
Windows is Windows 7 Ultimate 32bit on Athlon XP (not SSE2 capable, had to mention because some apps just forget there are such processors still in use)
Version of iCloud CP is the last 4.0.2 (at the moment of writing).
If anybody does know what I can do to trouble shoot it I would be happy to hear. And yes I've already removed and installed iCloud CP few times. Thanks.
Answer: Had the same problem. Turning off all antivirus temporarily and firewall seemed to fix it


Android USB Functions?

Question: Are there any USB functions for Android devices (all user devices, not rooted)?

I'm curious because I might want to make an app that puts things through USB
Comment: Please define "Things", and the direction that these "things" will travel?
Answer: Short answers are no and people are gagging for it, but depending on what you intend to do, the Android bluetooth implementation is much simpler. (and you can treat Bluetooth as a basic serial connection if so inclined)
Answer: I know that this is rather an old question but I thought I'd add an answer representing current state given that it still shows up in searches.
Since API level 12 USB support has been added to the platform. It however a bit of a minefield as to whether a given device actually supports USB host mode and exactly what that means.
More details can be found on the Google Android documentation pages
Answer: Yes like Neil said you can try and use the Host API's. Otherwise you can use the Accessory Development Toolkit: http://developer.android.com/tools/adk/adk2.html
Kevin

Android USB Functions?


Minimal polynomials of $\sqrt[4]{2}i$ over $\mathbb{Q}$ and $\mathbb{R}$

Question: Can someone tell me if this is right:
I would like to find the minimal polynomial of
(i) $\sqrt[4]{2}i$ over $\mathbb{Q}$
(ii) $\sqrt[4]{2}i$ over $\mathbb{R}$
(i):
$\sqrt[4]{2}i$ is a root of $f(x) = x^4-2$. This is already monic, so to show that this is a minimal polynomial I only need to show that it is irreducible. Edit: To do that, I can use the Eisenstein: $p=2$ does not divide $a_1 = 1$ and $p^2$ does not divide $a_0 = -2$, therefore it is irreducible over $\mathbb{Q}$.
(ii):
This time, $\sqrt[4]{2}i$ is a root of $f(x) = x^2+\sqrt{2}$. For polynomials of degree two it's enough to check if they have a root. The only roots this one has are complex therefore it is irreducible over $\mathbb{R}$ and therefore the minimal polynomial.
So my more general question is: is the way to find a minimal polynomial of an element $a$ in general to find a polynomial $f$ such that $f(a) = 0$ and then to norm $f$ and then to show that $f$ is irreducible?
Many thanks for your help!
Comment: Part (i) is incorrect: lack of roots does not imply irreducibility when the polynomial is of degree greater than 3, because the polynomial could split into a product of two irreducible polynomials, each of degree $2$. You have shown $x^4-2$ does not have a linear factor modulo $3$, but could be the product of two quadratics? I would instead suggest using Eisenstein's Criterion on $x^4-2$. (ii) is okay; for your final question, a top-down approach is what you suggest, except you can just try to find an irreducible factor of $f$ that has $a$ as a root.
Comment: I'm pretty sure that $f(x) = (x^2+x+2)(x^2+2x+2)$ modulo $3$
Comment: Many thanks to both of you. Arturo, maybe you could copy paste your comment into an answer so that I can accept it as the answer to this question?
Answer: In general, you can find the minimum polynomial for an algebraic number $\alpha$ by determining the smallest power of $\alpha$ for which $\{1,\alpha,\alpha^2,\ldots,\alpha^n\}$ is linearly dependent over $\mathbb{Q}$.
For example, let $\alpha=\sqrt{2} + \sqrt{3}$.  Then
\begin{align*}
\alpha^2 &= 5+2\sqrt{6} \\\
\alpha^3 &= 11\sqrt{2}+9\sqrt{3} \\\
\alpha^4 &= 49+20\sqrt{6}
\end{align*}
Since $\{1,\sqrt{2},\sqrt{3},\sqrt{6}\}$ are linearly independent over $\mathbb{Q}$, we can think of the powers of $\alpha$ as vectors:
$$
1 = \begin{bmatrix}1\\\ 0\\\ 0\\\ 0\end{bmatrix},
\qquad
\alpha = \begin{bmatrix}0\\\ 1\\\ 1\\\ 0\end{bmatrix},
\qquad
\alpha^2 = \begin{bmatrix}5\\\ 0\\\ 0\\\ 2\end{bmatrix},
\qquad
\alpha^3 = \begin{bmatrix}0\\\ 11\\\ 9\\\ 0\end{bmatrix},
\qquad
\alpha^4 = \begin{bmatrix}49\\\ 0\\\ 0\\\ 20\end{bmatrix}
$$
As you can see, $\{1,\alpha,\alpha^2,\alpha^3\}$ is linearly independent, so $\alpha$ is not the root of any cubic polynomial.  However, $\{1,\alpha,\alpha^2,\alpha^3,\alpha^4\}$ is linearly dependent, with
$$
\alpha^4 - 10\alpha^2 + 1 \;=\; 0
$$
It follows that $x^4-10x^2+1$ is the minimum polynomial for $\alpha$.
This technique depends on being able to recognize a useful set of linearly independent elements like $\{1,\sqrt{2},\sqrt{3},\sqrt{6}\}$.  Depending on how much Galois theory you know, it may be hard to prove that elements like this are linearly independent over $\mathbb{Q}$.  In this case, you can use this technique to guess the minimum polynomial, and then prove that you are correct by proving that the polynomial you found is irreducible.
For example, if $\alpha = i\sqrt[4]{2}$, then
$$
\alpha^2 = -\sqrt{2},\qquad \alpha^3 = -i\sqrt[4]{8},\qquad \alpha^4 = 2.
$$
It seems clear that $ \{1,\alpha,\alpha^2,\alpha^3\} $ is linearly independent, while $\{1,\alpha,\alpha^2,\alpha^3,\alpha^4\}$ satisfies $\alpha^4-2 = 0$.  Thus $x^4-2$ should indeed be the minimum polynomial over $ \mathbb{Q} $, though the easiest way to prove it is to show that $x^4 -2$ is irreducible.  This can be done using Eisenstein's criterion, or by checking that $ x^4-2 $ has no roots and does not factor into quadratics modulo $4$.
Comment: Jim, Why are $\{1,\sqrt{2},\sqrt{3},\sqrt{6}\}$ linearly independent? over $\mathbb{Q}$
Comment: Thank you, your answer is very helpful. I just started to learn Galois theory, although I don't yet see how to use it to prove linear independence of elements in a field extension. What I know so far is what a Galois group is.
Comment: Yes, they are. Suppose $\sqrt 2$ is in $Q(\sqrt3)$, then $\sqrt 2= a+bsqrt3$. $2= a^2+3+2ab \sqrt 3$. Hence $\sqrt 3 = \frac{-a^2-1}{2ab}$ but the left hand side is rational number while $\sqrt 3 $ is not. Contradiction. Apply the same to show they are all linearly independent
Answer: Part (i) as given is incorrect: lack of roots does not imply irreducibility when the polynomial is of degree greater than 3, because the polynomial could split into irreducible polynomials of degrees greater than 1.
You have shown that $x^4-2$ has no linear factors modulo $3$, but you cannot conclude from this that it is irreducible modulo $3$: it could have two irreducible quadratic factors. And indeed, as chandok writes,
\begin{align*}
(x^2+x+2)(x^2+2x+2) &= x^4 + 2x^3 + 2x^2 + x^3 + 2x^2 + 2x + 2x^2 + 4x + 4\\
&= x^4 + 3x^3 + 6x^2 + 6x + 4 = x^4 + 1 = x^4 - 2,
\end{align*}
so the polynomial is not irreducible over $\mathbb{F}_3$.
Instead, I would suggest using Eisenstein's Criterion to show $x^4-2$ is irreducible over $\mathbb{Q}$, as it is pretty easy to apply there.
Part (ii) is correct.
As to your final question: there is a top-down approach and a bottoms-up approach. In the top down approach, if you can find any polynomial $f(x)$ that has $a$ as a root, then you know that the minimal polynomial will divide $f(x)$; in fact, it will be an irreducible factor of $f$. So you can try to find which irreducible factor of $f$ has $a$ as a root. This may be $f$ itself, or some factor. For example, to find the minimal polynomial of a $7$th root of unity, you could use the fact that it satisfies $x^7-1$. Then factor $x^7-1 = (x-1)(x^6+x^5+x^4+x^3+x^2+x+1)$, and you know that $a$ is a root of either $x-1$ or the second factor. Then you would look at the second factor (since presumably your $a$ is not $1$). And so on.
The bottoms-up approach is described by Jim Belk in his answer, where you "build up" the polynomial by considering powers of $a$ (or alternatively, images under the action of some Galois group).


Get index number of static text with a certain value (AppleScript)

Question: Fairly new to AS, but I haven't come across a similar question. I am using AppleScript to get information from the UI of an app window. The window has a static text x with value "Name", and I want to get the value of the next static text, which would be static text x + 1 ("John Smith"). The value of x differs with each case, however, so I cannot simply refer to static text 9 as it can be static text 47 next time.
My solution now is to get the value of every static text available in the window and add it to a list. Then I find the first item with value "Name", and refer to that item + 1 to get the actual name I want. However, as the window can contain quite a lot of static texts, this method takes some unnecessary time.
set MyList to {}
tell application "System Events" to tell process "cBK" to set y to count static text of scroll area 2 of splitter group 1 of window 1
repeat with x from 1 to y
tell application "System Events" to tell process "cBK" to set end of MyList to value of static text x of scroll area 2 of splitter group 1 of window 1
end repeat
on findFirst(lst, val)
local lst, val, i
try
    if lst's class is not list then error "not a list." number -1704
    if {val} is not in lst then return 0
    script k
        property l : lst
    end script
    repeat with i from 1 to count of k's l
        if k's l's item i is val then return i
    end repeat
on error eMsg number eNum
    error "Can't findFirst: " & eMsg number eNum
end try
end findFirst
set Name to item (findFirst(MyList, "Name") + 1) of MyList

Is there a simple way to get x of static text x with a certain value, so I can get value of static text x + 1?
Answer: You can get, from your front window, all static text values in a list with single instruction. Then search in that list and when found, just get next item. Script bellow gives an example:
set myTarget to "Name"
tell application "System Events"
    tell process "cBK" to set myValues to value of every static text of front window
    repeat with i from 1 to count of myValues
        if item i of myValues is myTarget then exit repeat
    end repeat
    if i < (count of myValues) then
        set myNext to item (i + 1) of myValues
    else
        set myNext to "" -- not found
    end if
end tell

The last test checks that value has been found in a static text or return "" if not.


Gaming/Animation Tutorials for c++ and Windows Forms!

Question: I'm having trouble finding some gaming/animation tutorial for c++ and windows form.
I've been told (online) by many people to use gamedev.net, which i did, but unfortunately i could not find the information that i need :(
Does anyone know of any good tutorials for either a simple games (like snake or pong) or of simple animation in Windows Forms using C++ ( not C# )? If so, please let me know!
Looking forward to a reply,
Thanks!
Answer: You can use Allegro in C++ or mixed C++\CLI.
see here.


How to assign a field to map tips?

Question: In QGIS 1.8, I cannot find the way to assign a field to 'map tips'. There seems to be no way in 'properties' of the layer to do so.
Answer: From Layer Properties, General tab, choose the field you want to use with map tips from the "Display field" drop-down list.
Comment: Thank you! I am enjoying the progam more and more, Menze de Graaf - Utrecht - The Netherlands

How to assign a field to map tips?


What's the least amount of ether that can be sent in a transaction? Can you send 0 ether?

Question: What's the least amount of ether that can be sent in a transaction? Would it be 0.000000000000000001? Or can you send 0 ether? How would you do that?
Answer: You can send zero Ethereum in a transaction (in fact, many of the function calls you make on smart contracts will have you sending zero Ethereum), but you aren't currently able to spend zero Ethereum when you send a transaction. At the very least, you will have to spend the cost of gas to pay for the transaction's processing.
The send is specified in the value or amount field of a transaction. Your Ethereum wallet will allow you to enter this amount if the smart contract requires it, or if you are sending ether to another person. The value can be zero, for example, if you are simply sending your friend a message in the input field. But you would get charged gas which you can think of as a transaction fee. The wallet will extract the gas and send it along by default.
Hope that helps.


How to make bathroom tiles non slippery

Question: We currently have the typical floor tiles in our bedroom and bathroom. I dont know if they are ceramic or porcelain. The problem is the bathroom floor can get very slippery when wet (and when the bath mats are not in the bathroom (washed/dryed)). Are there any ways I could make the tiles in our bathroom non slippery ?
Installing grab rails is an option am considering at the moment. But any other ideas ?
Comment: throw a old towel on the floor
Answer: A few products on the market (depending on the type of tile). They are sealers that when applied properly, etch the face of the tile and add skid resistance when wet. They do not change the appearance of the tile at all (as always, test an inconspicuous area and follow all instructions). Check local tile distributors,the products are generally very reasonable in price.
One is by Miracle, "511 non-skid", a good product. Another I've used is Invisa Tread, not sure the manufacturer. Miracle is a reputable sealer company and I think it runs about 15$ a gallon (here).
Be careful around unfinished wood or metal, pull the strainer off your shower as well. Good Luck
Comment: Thanks mate. Any names for such products ? (So I can talk about them with the stores here in Australia)

How to make bathroom tiles non slippery


How can one sort files without knowing their extension?

Question: I have recently been having an issue moving a backup of an iPhone to a new iPhone. After many hours spent with Apple Support I've determined it's a lost cause, but I have the backup and am able to view the files in the backup, including my pictures. I was wondering if anyone knew how to sort these files using Automator so I can have all the pictures in one folder. I I have tried using the "Kind is image" filter, but that will only work if the extension is an image extension, and since none of the files have any extension this will not work.
Comment: you might try sorting on size. your pictures may all be close in size and appear together in a list sorted by size.
Comment: that kinda worked, But I have over 6 gigs worth of files to go through. Im looking into sorting them by MIME type decided this might be to complex for automator so im looking at python now
Answer: Don't need to use Python, you can do this on the command-line command: file
eg.
$ file *
Sams.jpg:               JPEG image data, JFIF standard 1.01, aspect ratio, density 72x72, segment length 16, Exif Standard: [TIFF image data, big-endian, direntries=10, manufacturer=Apple, model=iPhone 7, orientation=upper-left, xresolution=150, yresolution=158, resolutionunit=2, software=Photos 1.5, datetime=2016:11:13 14:09:31, GPS-Data], baseline, precision 8, 4032x3024, frames 3

So, you can dump that data out, and sort it for the paths you want.
eg.
alex@smiley:~|⇒  find . -type f -exec file {} \;
./.bash_history: ASCII text
./.bash_login: ASCII text
./.bash_profile: ASCII text
./.bashrc: ASCII text
./.bashrc.bak: ASCII text
./.cache/fontconfig/0f0db7876307790c19e1f91eb9095080-le64.cache-4: data
./.cache/fontconfig/1487dd4aecf3164c4a11193169052443-le64.cache-4: data
./.cache/fontconfig/2d5afd1bf94294700ac1600496f0236c-le64.cache-4: data
./.cache/fontconfig/3f80be19c668e16fc38439c9c84a1bc7-le64.cache-4: data
./.cache/fontconfig/49aa604a5ac92994756d3008e408245c-le64.cache-4: data
./.cache/fontconfig/558352270fb122ca08359d23b5a778d4-le64.cache-4: data

etc.
Filter the output for images, using grep:
From the directory storing your back-ups:
find . -type f -exec file {} \; | grep image
alex@smiley:~|⇒  find . -type f -exec file {} \; | grep image
./.gradle/caches/minecraft/assets/objects/92/92750c5f93c312ba9ab413d546f32190c56d6f1f: PNG image data, 32 x 32, 8-bit/color RGBA, non-interlaced
./.gradle/caches/minecraft/assets/objects/bd/bdf48ef6b5d0d23bbb02e17d04865216179f510a: PNG image data, 16 x 16, 8-bit/color RGBA, non-interlaced


Reset Blender scene to default state

Question: I have a script that generates scenes after each iteration is completed I delete all the mesh properties but still not all the data has been deleted.
Is there any convenient way to reset blender scene to it's default state, using script? (like when you open Blender)
Answer: You can load the default startup file using bpy.ops.wm.read_homefile(). This operator also allows you to load application templates if you use the optional app_template argument. Be aware that the current .blend project file will not be saved automatically, meaning all unsaved state will be lost.
The problem with loading the default startup file or any project for that matter, is that currently running scripts will be stopped in their execution and handlers freed. Unless you registered a persistent handler that runs after the project is loaded you won't be able to resume the execution of your script.
Comment: Ok now I can see the problem. So how can I "reset" the scene without stopping the execution? My problem is that I try to render a number of scenes automatically but from the second animation I have a difference between the rendered animation and what I see in the GUI and I think it has something with the way I'm cleaning the scene after each iteration.
Comment: That would be easier to answer when we know what differences you are experiencing.

Reset Blender scene to default state


Undoing one's activity other than voting, deleting a question or a comment

Question: Today I've "rejected" an edit to a question, but came back to it later only to realize that the reason I did that wasn't right.  I would like to withdraw my vote, but I cannot do it.  The same, I presume, happens with other similar activities.  (It took me more than a year to find out how to withdraw my vote on a question without downvoting it, so maybe there is a way, just not the one easy to discover, in which case, please treat this question as a request to make this functionality more obvious).
Comment: I don't think you can revert what you did, but you can submit the same edit yourself.
Answer: If the edit was applied even though you voted against it, there is nothing to revert, is there?
If the edit was rejected eventually, that can mean that some other reviewers voted to reject it. If you really believe that the edit was necessary, you can always apply it yourself, but you will then be bypassing the other reviewers.
You can view the status of your reviews (including the eventual action that was taken, and what other reviewers voted) by clicking the "recent reviews" link of the relevant review queue, then "history".
The same applies to other review activities: see if your vote had consequences. If you think these consequences should be reverted, engage the process to revert.
By the way, for voting queues (for example a close vote), your vote may have more influence than only 20% of the decision, because some people will think "eh, 4 guys already voted to close, who am I to disagree?". So you can be a bit less shy in starting a reopen vote if you feel that it is needed: in any case, the action will require a voting majority again.
Comment: Well, the problem with this sort of activity is that the first person gets to set the overall trend. I.e. the opinion of the first voter / editor sets a chain reaction, where others hesitate less to do the same "inspired" by example. Also, obviously it is important who made the edit, so re-doing someone else's edit isn't really going to work. Voting for reopening usually collects less votes simply because there's no novelty involved, and people are typically reluctant to change their opinions, even if they know they were wrong.
Comment: When reviewing the edit queue, you don't easily (or at all) see the other votes. People with the right to review suggested edits are also people with the right to edit, so the re-edit will definitely be not really the same. For closing/re-opening, previous votes do have an influence (even though they shouldn't ! in theory you should know what you will vote before you click the appropriate button, and not change your mind according to what is shown then), so the problem is yet different.
Comment: The thing is that in the case at hand, the harm is already done. This answer merely suggests ways to mitigate it in case it is really deemed harmful. For minor edits or shabby questions, definitely not worth the hassle.


Does an A/C change the pressure of a sealed room?

Question: Since I don't know anything about air conditioners, I thought you might have an answer.
I noticed that when my A/C is on and all the windows and doors are closed it is actually working for a few minutes then it stops for much more time and then it repeats this exact same pattern.
On the other hand, when the windows are open it does not stop working.
I was thinking that maybe when all the doors and windows are closed there is no room for the extra air molecules (which means the pressure stay constant - for my poor understanding) therefore it stops working, but I don't know how these things work so I'll be happy to hear some of your wisdom.
Answer: While colder air is denser, and would lower the pressure in a perfectly sealed room, this is not why an AC would shut off. The pressure would not really change, as there are plenty of minute openings or cracks in the average house for inside pressure to be near equal to outside pressure. Most likely the thermostat cuts off the AC when the room cools down, then turns it back on when the room warms back up. With the windows open, the room does not cool down enough for it to shut off.
Comment: Thank you very much !!
*** I would like to clarify that when the room is sealed (not hermeticlly) the temperature is definitely few Celsius away than what im asking for
Comment: @Yarin: so probably the thermostat on your AC is off by a few degrees Celsius.
Comment: @YarinShani The thermostat calibration may be off a bit, try setting it to where the temperature feels comfortable to you
Answer: A trained technician may be needed to diagnose those issues.  There are many things that can go wrong with an A/C, and some of them are better caught early.  However, what you describe sounds absolutely normal.  Air conditioners are controlled by a thermostat.  Once the A/C has cooled the room down to a certain temperature, it stops.  If your windows are open, you'll be letting a lot of warm air in, and your air conditioner wont be able to make things cold enough to reach the temperature (running all the time).
An easy test: drop the temperature on the thermostat.  It should take much longer for the air conditioner to stop (because it has to chill the house more).  Then raise the temperature on the thermostat back up, and it should be a while before the air conditioner has to turn back on.
As for your actual question, air conditioners cycle air.  If you look in your house, you'll find some very large vents that don't look like the others.  Very likely you'll be able to see a filter behind them.  Those are the return vents.  When the air conditioner's fan is on, it pumps air out of the normal vents, and then the air is returned through the return vents, completing the cycle.
In typical house construction, air flow like this is accounted for.  An air conditioner does indeed raise the air pressure in the room a little bit.  This pressure is part of the natural flowing of the air.  The air finds its way underneath doors and flows back to the return vent.  If necessary, one can also install return ducts which go around doors (you'll sometimes see them installed directly above the door).  Generally speaking there will be enough air flow to keep things working properly (some A/C specialists may argue that there's not enough airflow to be maximally efficient, but there's airflow).
Comment: Thank you very much !! Appreciate it.
*** I would like to clarify that when the room is sealed (not hermeticlly) the temperature is definitely few Celsius away than what im asking for
Comment: @YarinShani That sounds unusual enough that you should get professional help to look at the situation.
Answer: Most A/C's run full blast when thay run. They are either on, or off.
If you have sized the unit properly, it is more than powerful enough to cool the room.  So it must shut off, or the room will be too cold.
So they start at a particular set point temp (say 27C) then they cool full-blast until they reach a target temp (say, 24C), then they shut off.  This is normal.
With doors and windows closed, this is that, working normally.
With doors and windows open, you are trying to air condition the whole world.  The air conditioner keeps running and running because it doesn't have enough power to get the whole world down to target temperature.
You need a much larger air conditioner to do that :)
Comment: When the A/C unit is larger, the unit will run for a shorter time.   The thermostat will regulate the temperature of the room between the off and on limits regardless of the cooling capacity of the A/C unit.
Answer: As others mentioned, the a/c will continue to run if you have the windows open, b/c the cold air is getting let outside. An ac recycles the air. It pulls in air, removes heat, pushes the air out, and repeats. It actually pulls in the same air over and over, cooling it a little more each time. So with the window opened, you introduce more hot air into the process.
Also, You mentioned that when the room is sealed, it is a few degrees away from what you are asking for. It sounds like the thermostat is in another room, lets say, the living room, and you are measuring the air inside, lets say, your bedroom. The bedroom is warmer than the living room, and the ac shuts off when the thermostat gets to the target temp of the living room. You are wondering how to get the bedroom the same temp as the living room. Is that right? This is a duct / air balance issue. The bedroom likely has no return vents. Therefore, the cold air can't come in, because the warm air can't get out. Try cracking your bedroom door open a little. You will may hear it whistling, or be able to feel the air being pushed out. Leave it like this for several cycles, so, lets say an hour. Then measure if the room is the same as the living room. If that worked, you may want to consider installing a return duct or a jumper duct. Make sure the register is open as well. Change the batteries in your thermostat, and change your a/c filter.


Current state of EFS

Question: I need to encrypt a 3.5TB folder on 2008 R2 server.
The folder is shared and both users and applications need to access the files(pdf) in it over the network.
Since the server is a VM (ESXi 5) Bitlocker is not supported.
EFS with AD CS managed keys should work.
I'm looking for input in form of a good implementation guide and actual user/admin experiences, if there is anyone actually using it.
How bad of the performance degradation would I see?(Xeon R7-4850)
If there is a better solution for encrypting network shares please let me know.
Answer: Well I can't quantify exactly how much of a performance impact you would feel. There would be some. But the point is, if you're required to encrypt this data then that is what you have to do, and you just have to bite the bullet on any potential performance impact.
Have you considered that, once a client accesses an EFS-encrypted file on an SMB network share, that the file is decrypted on the server and then transmitted un-encrypted/"cleartext" over the network?
First, I would consider migrating this traditional file share to something like WebDAV, as that will allow you to transfer the data over an SSL/TLS/HTTPS protected channel across the network.
Some relevant words from Microsoft:

Remote EFS Operations on File Shares and Web Folders
Users can encrypt and decrypt files that are stored on network file
  shares or on Web Distributed Authoring and Versioning (WebDAV) Web
  folders. Web folders have many advantages compared to file shares, and
  Microsoft recommends the use of Web folders whenever possible for
  remote storage of encrypted files. Web folders require less
  administrative effort and are more secure than file shares. Web
  folders can also securely store and deliver encrypted files over the
  Internet by using standard HTTP file transfers. Using file shares for
  remote EFS operations requires a Windows 2000 or later domain
  environment because EFS must impersonate the user by using Kerberos
  delegation to encrypt or decrypt files for the user.
The primary difference between remote EFS operations on files stored
  on file shares and files stored on Web folders is where the operations
  occur. When files are stored on file shares, all EFS operations occur
  on the computer on which the files are stored. For example, if a user
  connects to a network file share and chooses to open a file that he or
  she previously encrypted, the file is decrypted on the computer on
  which the file is stored and then transmitted in plaintext over the
  network to the user's computer. When files are stored on Web folders,
  all EFS operations occur on the user's local computer. For example, if
  a user connects to a Web folder and chooses to open a file that he or
  she previously encrypted, the file remains encrypted during
  transmission to the user's computer and is decrypted by EFS on the
  user's computer. This difference in where EFS operations occur also
  explains why file shares require more administrative configuration
  than Web folders.

Oh, and there's also SMB encryption but it is new to Server 2012 and SMB 3.0. You have indicated that you're using 2008R2 however.
http://blogs.msdn.com/b/openspecification/archive/2012/10/05/encryption-in-smb-3-0-a-protocol-perspective.aspx
Comment: I will look into 2012 SMB encryption. If it's easier/better/faster I can definitely install some 2012 Servers.
Comment: Yep. And there are other solutions too, such as IPsec, but I didn't mention it at first because that is a much larger undertaking with a bigger scope. Basically my point is that when considering data encryption, there are two separate aspects to keep in mind - data at rest, and data in transit over the network. Gotta' remember to protect them both.
Comment: Over the wire encryption is not a problem at this point as both the file server and Citrix servers are in a secure data center. I think webdav is also much slower than file shares.
Comment: Looks like for SMB 3 both the server and client has to 2012. Not ready for that yet.

Current state of EFS


An (N)LFSR…but for bytes!

Question: A linear feedback shift register can be thought of as an array of bits where NEW_BIT is calculated using F(REGISTERS). F is a function that takes values from two or more elements of REGISTERS and XORs them together. The new value of REGISTERS is equal to (in Python) [F(REGISTERS)] + REGISTERS[1:]. Do the dynamics change if we store values greater than 1 in each register, like say bytes? If F invoked operations other than XOR, then it seems like that would make it more like an NLFSR. Are the dynamics different there, too? Is something like this used by any cipher out there?
Answer: A classic linear feedback shift register is in fact a representation of operations in a modular ring of binary polynomials. In mathematical terms, you have a base field, which is $\mathbb{Z}_2$, the field with two elements (0 and 1); then a register of $n$ bits is a polynomial of degree at most $n-1$ in $\mathbb{Z}_2[X]$, and shifting the register is equivalent to multiplying the polynomial by $X$ modulo a given polynomial $P$ of degree $n$; that polynomial $P$ corresponds to the "feedback bits", i.e. which elements of the register you take to compute the new bit.
This model naturally extends to the case of using another base field or ring. For instance, if you use bytes and additions, then you are working with $\mathbb{Z}_{256}$, i.e. the integers modulo 256. With $n$ bytes, you still have polynomials of degree at most $n-1$, but this time in $\mathbb{Z}_{256}[X]$ (and it is still linear). Like the classic LFSR, taken alone as, say, a pseudo-random generator, it is still quite weak; moreover, $\mathbb{Z}_{256}$ is not a field, which tends to make matters worst (to express it "with the hands", additions modulo 256 will propagate carries only toward higher bits, so, in particular, the low bits of each byte will only depend on each other, not on the higher bits).
Now, symmetric algorithms are almost always built by assembling several (many) operations which, by themselves, would not constitute a cryptographic algorithm of any decent quality; for instance, SHA-256 is made out of about 2500 very simple elementary operations, the most complex of which being a simple addition. As such, LFSR expressed over various rings or fields can be used, and have been used, as building elements of larger algorithms. See for instance the Sosemanuk stream cipher, or the RadioGatún hash function.
A non linear feedback shift register would entail using operations that are not additions in some field of ring, i.e. not additions on integer or XOR. You could try some multiplications, but it will make analysis more complex with no clear immediate benefits. Remember that what is sought in symmetric algorithm design is a good trade-off between "mixing" (a generic terms for various concepts such as non-linearity and avalanche effects) and performance; moreover, we cryptographers really like to feel that we understand what we are doing, therefore "hard to analyse" is a bad thing, not a good thing.
Comment: I thought addition isn't linear for bitwise operations.
Comment: "Linear" is relative to a base field (or ring). Bitwise XOR is linear when the base field is $\mathbb{Z}_2$. Addition is linear when considering the base ring $\mathbb{Z}_r$ for some integer $r$ (here 256). Linearity is a relatively large concept.
Comment: So what kind of "non-linear" function would be a good one for analysis?

An (N)LFSR…but for bytes!


Import users from LDAP

Question: I want to import user accounts to my Drupal site via the LDAP server. How do I do that? I installed LDAP feeds, but I don't understand how it works. I have LDAP query installed and working.
Comment: i looked up the .module file: it's empty. and all code is inside an "unported" folder.
Comment: What's your exact problem? What exactly don't you understand? Please expand your question.
Comment: how can i use ldap queries and convert the query result to drupal user entities? Apparently, you do it with drupal ldap feeds, but i don't understand how.
Comment: A month ago LDAP Feeds still was not ported to D8. Is it now? What's the README in the LDAP module saying?
Answer: As the comment noted this question would benefit from much more detail.
There are 2 very broad scenarios here;

Loading LDAP user attributes for use and reference within Drupal (probably user entities) users that exist.
Linking LDAP users to Drupal in an ongoing fashion including some form of authentication requirement.

In the first case you won't likely be dealing with LDAP user credentials (which is good) and greatly simplifies the implementation.  This is a good example; on Drupal.org using LDAP feeds.
In the second case LDAP feeds is probably not the best or only module you'll need.  This d.o article covers some ground but there are important gaps, but also some good linked resources in that section that could be of great help to you depending on your needs.
There are a plethora of variants on these cases.  One time vs ongoing, update bi-directional or with one resource overwriting the other as authoritative, updating non-user entities and keeping them in reference to users, and many more.  This split is designed to identify the most likely cases from the question you asked.
If this is one-time, an option (not ideal) may be to bring the users into an interim D7 instance and then migrate them to D8.  This could be done repeatedly but would require a standing D7 instance to maintain.  I'd only suggest this until the D8 LDAP feeds project is further along.  It could give you time to dig in and contribute as well. ;)
Giving this further thought and since the module isn't fully ported, this could be done with a server cron, a little scripting and a docker D7 instance.  A nightly docker spin up, pull from LDAP into D7 and migrate users to D8.  It's far from a good solution.  But it sounds like your need is immediate and this would work.  If time isn't a factor either porting the module yourself or paying someone to do it is the best path.
I'm happy to amend or expand this answer as needed based on additional information added in your question.
Comment: i want to use the result of an ldap to query to programatically create user entities on drupal. i'm using Drupal 8. i noticed ldap feeds is still unported, as you're supposed to use it to do it.
Comment: Is this an ongoing sync or a 1 time sync?  Figuring here that credentials are a non-factor.. not synced.  This is 1 way as well, from LDAP to Drupal right?
Comment: ongoing. preferably done with a cron job.yes, only one-way, from ldap to drupal.
Comment: The module isn't fully ported as yet.  If you're able to contribute - that's ideal. However it's likely an interim approach might be needed it seems.
Comment: unfortunately, i can't.

Import users from LDAP


Black loading screen

Question: This is the first time that I use Xubuntu and I'm experiencing a problem with it. D:
I've just installed Xubuntu 12.10 desktop 64-bit on my laptop alongside with Windows 8.
When I choose Ubuntu from grub loader, the screen goes black and the LCD backlight goes off: the white-bar-on-blue-background Xubuntu loading screen doesn't appear, but after a few seconds the Xfce login window materializes and the desktop enviroment after login works fine. When I shutdown or restart the system, the white-bar-on-blue-background Xubuntu loading screen magically appears! :)
I know that is only an aesthetic bug, but how can I bring back the Xubuntu loading screen on boot?
Please notice that my video card is the Nvidia NVS 2100M, and that I'm NOT experiencing any problem with Xfce's desktop.
A huge kiss to anyone who will help me! :*
Comment: possible duplicate of [My computer boots to a black screen, what options do I have to fix it?](http://askubuntu.com/q/162075/22949) (There are some answers there that give the same advice as [the upvoted answer here](http://askubuntu.com/a/254767/22949). The description of the problem is a bit different but it seems like it could be caused by some of the same factors discussed there, especially if the backlight is turning off. If you're still having this problem with a now-supported Ubuntu release, please let us know.)
Answer: This doesn't seem to be specific to particular graphics cards. It just appears that the framebuffer code or the choice when to use it is less robust on some newer Ubuntu versions. I am encountering the same on some of my machines. What you can do is on the grub prompt use vbeinfo and see which graphic modes are supported. Then after booting do
sudo editor /etc/default/grub

and uncomment the line #GRUB_GFXMODE=640x480, i.e. remove the #. Then adjust the resolution to a value that was listed as supported by grub on the prompt.
After that run:
sudo update-grub

and test by rebooting.
If you want to get rid of the progress screen and prefer the classic console output, simply don't edit the line mentioned above and instead uncomment the line #GRUB_TERMINAL=console.

Black loading screen


Rotating a UIView through the "transform" property gets messed up when the orientation changes

Question: I'm trying to create an iPad application but am encountering a questionable behavior from the simulator (Can't be tested on a device for now..).
The issue is when having any UIView rotate through its transform property, and then allowing the view containing it to be manipulated by changing the orientation of the iPad. This can be simplified by creating a new View-based iPad project and inserting the following code to the view controller:
<code>- (IBAction) rotate:(UIView*)sender {
 if (CGAffineTransformIsIdentity(sender.transform)) {
  sender.transform = CGAffineTransformMakeRotation(M_PI / 4);
 } else {
  sender.transform = CGAffineTransformIdentity;
 }
}
</code>
Then adding a single button to the view and linking its action with the above method.
As you see, the method should rotate the button when clicked, and then un-rotate when clicked again - and it does just that. However, when the button is rotated, and you change the orientation (from the Hardware menu), it'll start acting really weird - changing its shape or disappearing altogether.
Worth noting that if I create a translation transform, this does not happen.
My question is:
1. Since I don't have an iPad at the moment (working on that), can anyone tell me if that happens on the device as well?
2. Am I doing something wrong here? Maybe this is not the way to rotate the UIView? If so, what is?
Update: From the documentation, it seems that If [the transform] property is not the identity transform, the value of the frame property is undefined and therefore should be ignored. So the problem is probably the fact that I am using the autoresizeMask while changing the transform property. So how can or should this be done?
Thanks,
Aviad.
Answer: I think if I remember correctly I ran into this same problem a while back and it was caused by  anchors being set in Interface Builder. Go into the Size Inspector and turn off the pins that pin the view to the edges in the authorising panel I think that should do it.
I hope I am remembering this correctly.


ohlc chart in jfreechart

Question: Is there a way to detect when the mouse goes over a bar in the chart ?
Answer: Take a look at ImageMapUtilities. I added mouseover capabilities by drawing custom XYAnnotations over what I wanted the browser to respond to, and specifying the appropriate tooltip/URLs in the annotation.
(the above is particularly useful for a browser)

ohlc chart in jfreechart


I am unable to run Google assistant on my phone

Question: I am a citizen of India and want to run Google assistant on my phone. My phone is LS 4505 and Android marshmallow. Google app version is 8.0. And screen resolution 720p and 312 MB free space. So can I run Google assistant on my phone. And are there any other apps like this which I can run?
Answer: According to DeviceSpecifications.com, your Lyf Flame 8 (LS-4505) device has only 1GB of RAM and a 480p (480x854) display. It shipped with Lollipop, but further research indicates it was upgraded to Marshmallow.
According to 9to5Google, Google Assistant requires the device have Marshmallow or newer Android, 1.5GB of RAM, and a 720p display. Your device does not meet the minimum requirements to use this feature.
As far as alternatives, a simple Google search will yield a variety of options, I did not investigate them to see if your device meets the requirement for any one specifically (this is not the Software Recommendations site), but you can start here doing your own research.


How do you write a good attention grabber for a style analysis essay?

Question: I have to write a style analysis essay on the short story "Was it a Dream" by Guy de Maupassant and I'm getting stuck on the attention grabber. It should be pretty easy, but it isn't. I was wondering how to write a good attention grabber.
Comment: I think it would help answer if you could expand on what you mean by "attention grabber" what are the parameters? What are you trying to do with it? Also, what specifically are you struggling with? The more information you can give about your problem the better chance their is of us providing a useful answer. Note that request to write it for you are off topic, but we can provide advice on how to write it.
Comment: I'm not familiar with the story. What is it about? Emphasize what is unique or special about the subject, exaggerating slightly in an "attention grabber" line is kind of expected.
Comment: As a quick overview, I'd personally try to give the woman a name: Maya (but in the philosophical way) https://www.britannica.com/topic/maya-Indian-philosophy
Answer: Keep in mind why your audience is reading your paper. An academic essay does not need an attention grabber. Instead, it needs a clear statement of your thesis and an overview of what your argument will be.
This is because people do not read academic papers for enjoyment. Instead, they read them to learn something. If you're writing this paper for a journal or as part of a communique to your peers, your readers will want to glean what you have to say as quickly and clearly as possible. If you're writing it for a class, your teacher wants to be able to assess your knowledge of the story and your ability to write in a formal setting. In both cases, something clever but divorced from the meaning of the rest of your paper will only serve as a distraction.
(This is in contrast to writing fiction. If you were writing a story or a comedy essay, burying your meaning between the lines with poignant vignettes would be a strength. People read those pieces of writing to be entertained and let their imaginations run wild. But that's not the context you're in.)
My suggestion really is to keep your introduction dry and to the point. Figure out what the main idea of your essay is and state it right away. Then figure out the meat and structure of your argument and give a quick overview of where you're going. It's OK if it doesn't grab attention. If people are interested in the content of your writing for its own sake, they'll appreciate the no-nonsense approach that gets them right into what you have to say. If they're not interested, then there's no way to manufacture that interest in them in the first place.

If you're writing this for a class, it's possible that your teacher is saying that an "attention-grabbing" introduction is part of their grading rubric. And you'll occasionally come across formal pieces of writing that have more involved and clever introductions. So writing a more interesting introduction isn't out of the question.
If you are required to include a hook for your class, you really don't have to overthink it much. You can pick out a famous quote that relates to your main idea or tell a very very short vignette that relates to your argument. Pick something easy and obvious and phone it in. What your teacher is looking for is that you know how to write an introduction with a hook. They're not looking to actually be impressed by how you say it. This isn't an insult to them at all. If they're a smart and reasonable person - and I assume they are - they know that there's no way to take a dry, somewhat forced homework prompt and turn it into a gripping tour de force. Instead, they have the good sense and respect towards you to just want to see you practice writing. So if you give them something that checks off the boxes, they'll be satisfied that when you really have something you truly want to say, you'll have the tools to say it with style and confidence.
If you do write an introduction like this, keep it short. The most important part is still the statement of your main theme and an overview of your argument.
If you're writing a catchy introduction for an essay you have more control over, you have more room to be inventive. I can't tell you how to write a hook for something that's personal enough that you want to say it for your own sake. But I will say that it's worth your while to consider whether a clever introduction is really worth the effort. Your readers want to hear what you have to say. Are you certain you want to make them sit through a short story before you give it to them? If you are, then I think you already have a good idea what the hook you want to write is. I can't give you advice on how to write something you've already decided on; you need to write it as you know it needs to be written for yourself. If you aren't certain, then maybe it's best to accept that your paper serves a more functional purpose. Tell your readers what you have to say and trust that they have their own good motivations for listening to you.


Virtual and override

Question: I came from a world of C++ and as you may know there is only one keyword for virtual methods there, which is virtual. So in C++ you redefine virtual method in derived class using the same virtual keyword (in C# you use override). I'm perfectly aware of polymorphism and how do "override" and new works in C#. However, I wasn't able to find in books whether there is some idea behind creating two different keywords for virtual methods in base and derived classes, namely virtual and override corresponding?  Or was it made just for clarity?
Comment: Your C++ knowledge is a bit out of date.  Since C++11, the compiler knows how to cross-check signatures of overridden virtual functions if you use the `override` keyword (be careful, it isn't placed in the same location in the function signature as `virtual`)
Comment: If you use `new` every class base or derived calls their own method. If you use `override` base and inherited class use overrided method (which is in derived class).
Answer: In a 2003 interview, Anders Hejlsberg (the lead architect of C#) explained that the decision to have two distinct keywords was made mainly to address a versioning concern with base components changing across versions. In his own words (emphasis mine):

I can demonstrate to you a very real world versioning problem, one that indeed we see now from experience with Java. Whenever they ship a new version of the Java class libraries, breakage occurs. Whenever they introduce a new method in a base class, if someone in a derived class had a method of that same name, that method is now an override—except if it has a different return type, it no longer compiles. The problem is that Java, and also C++, does not capture the intent of the programmer with respect to virtual.
When you say "virtual," you can mean one of two things. If you did not inherit a method of the same signature, then this is a new virtual method. That's one meaning. Otherwise it is an override of an inherited method. That's the other meaning.
From a versioning perspective, it is important that the programmer indicate their intent when they declare a method virtual. In C#, for example, you must explicitly indicate which meaning of virtual you intend. To declare a new virtual method, you just mark it virtual. But to override an existing virtual method, you must say override.
As a result, C# doesn't have the particular versioning problem I described earlier in which we introduce a method in a base class that you already have in a derived class. In your class, you would have declared foo virtual. Now we introduce a new virtual foo. Well, that's fine. Now there are two virtual foos. There are two VTBL slots. The derived foo hides the base foo, but that's fine. The base foo wasn't even there when the derived foo was written, so it's not like there's anything wrong with hiding this new functionality. And things continue to work the way they're supposed to.

So, you're extending a class. You add a virtual method to your class. In a later version, the base class adds a virtual method of its own and its signature matches the signature of your virtual method. This could happen either by complete accident or because your methods happen to actually serve related purposes (and you simply addressed a particular need before the base class designers did). In any case, the situation is ambiguous.
Thanks to the existence of two distinct keywords (virtual and override), the C# compiler can give you non-breaking behavior (by hiding the inherited virtual method and keeping it separate from your virtual method) and also bring the issue to your attention, through this warning:

'Derived.Foo()' hides inherited member 'Base.Foo()'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword.

It now asks you to address the issue by making your intention explicit: From now on, are you overriding the inherited method that has been added (override)? Or are you still starting your own virtual method that now hides the inherited one (virtual and new)?
Comment: Thanks a lot. That answers my question.
Answer: This is a good question.
You use the override keyword to override a virtual method because you can actually define a second virtual method in a derived class, with the same signature as the base classes virtual method, and this can be overridden as well.
This is the actual example from MSDN:
using System;
class A
{
   public virtual void F() { Console.WriteLine("A.F"); }
}
class B: A
{
   public override void F() { Console.WriteLine("B.F"); }
}
class C: B
{
   new public virtual void F() { Console.WriteLine("C.F"); }
}
class D: C
{
   public override void F() { Console.WriteLine("D.F"); }
}
class Test
{
   static void Main() {
      D d = new D();
      A a = d;
      B b = d;
      C c = d;
      a.F();
      b.F();
      c.F();
      d.F();
   }
}

yields:
B.F
B.F
D.F
D.F

because:

the C and D classes contain two virtual methods with the same
  signature: The one introduced by A and the one introduced by C. The
  method introduced by C hides the method inherited from A. Thus, the
  override declaration in D overrides the method introduced by C, and it
  is not possible for D to override the method introduced by A.
Comment: Cool, it is a perfect explanation. Thank you.
Answer: I am assuming for clarity.  I personally prefer having override for when changing behaviour from a parent class.  Also, I believe it provides more clarity in the fact that C# does not allow multiple inheritance, where as perceivably, a class in C++ could inherit from both a Grand Parent and Parent class.

Virtual and override


Is there a machzor ashkenaz for yomim noroim without piyutim?

Question: Is there a machzor ashkenaz for yomim noroim without piyutim?
Seeing that we skip so much of it these days, it would be proper if we had a smaller standardised machzor.
Comment: This reminds me of the story that was doing the rounds on social media this year....The Gerrer Rebbe was once asked by a chossid, "There are so many things in the Machzor we don't say. Why don't we just print a new Machzor that only includes what we say?" The Rebbe responded, "And take away the Simcha that a Yid gets when he skips a page of davening" :-)
Comment: Yes there is, and it's called a Siddur. Many Siddurim print the Amida for Rosh Hashana and Yom Kippur in them already (for example, [this one from Artscroll](https://zbermanbooks.com/%D7%A1%D7%99%D7%93%D7%95%D7%A8-%D7%99%D7%A6%D7%97%D7%A7-%D7%99%D7%90%D7%99%D7%A8-%D7%90%D7%A9%D7%9B%D7%A0%D7%96)). The whole point of a machzor is the piyyutim; if you don't want piyyutim just use a siddur.
Answer: There is, the machzor used by (and published by) the Zilberman yeashiva of Jerusalem's Old City and the Horva synagogue. They say most of the piyutim said by other yeshivos that I am familiar with, but after the chazan's repetition instead of during, other than the avoda piyut of Yom Kippur. These are printed there and not in the traditional places. The piyutim that they don't say are not printed at all. Also generally the layout is exceptional. It comes out to one small volume for Rosh Hashana and Yom Kippur together.
But I don't recommended it for anyone davening at a standard minyan. The change of structure would be very confusing, and the gain of not having the piyutim that are not said is offset by the ones that are said being in a new place or skipped, and other changes from the standard nusach.
BTW, many standard machzorim put piyutim that are usually skipped either in small type or in the back of the book, like the English Artscroll machzorim, Feldhim's Keter Malchus, and Machzor Sidur Tefilosanu.
Comment: This machzor (apparently) has different piyyutim in different places, but how does it answer the question which sought a machzor without piyyutim?
Comment: "put piyutim that are usually skipped" Is this an effect or a cause? Did they put them in small type because they were skipped or are they skipped because they are in small type? For example, Artscroll put some piyyutim in the back that Birnbaum had in the main text and seemingly everyone was saying. (Silluk of YK Mincha comes to mind.)
Comment: The piyutim not said are not printed at all. As you pointed out, a siddur without any piyutim is hardly a machzor.
Comment: Not what the OP asked about, the Sidur Tefilosanu Shalosh Regalim machzor doesn't have piyutim other that the short versions of Tefilas Tal and Geshem. But no one would know what is being skipped if they don't take a long look at the machzorim for the shlosh regalim.
Comment: @DoubleAA Why the would have the silluk of mincha have been recited but not the silluk of shacharit? Just because it's shorter?
Comment: @JoelK Probably that's part of it? But really you can't ask questions like that since there's no good reason to assume a priori consistency.


Selenium 2 opens Google Chrome but doesn't load webpages

Question: When I execute a test calling google chrome (*googlechrome), Selenium Wedriver opens a browser and starts to launch the test cases but it doesn't load anything. I had the same problem with Firefox and IE but I solved it opening the proxy's/adding user sessions. I don't know if it's the same problem for Chrome or what's happening.
I work with Selenium grid 2, Jenkins and a Java interface. Paths for chrome.exe and chromedriver.exe are added in my environment (instances of *googlechrome appear in my grid2), in fact as I said Selenium Webdriver opens the browser but doesn't load, I have searched for a solution during days on the Internet but nothing...
Someone can help me? I have chromedriver and the references to it in my environment path.
Thanks! :)
Comment: Can you include the code you are using and any errors you might be getting?
Answer: Solved, we just need to add <code>-Dhttp.proxyHost=isa.be.bvdep.net -Dhttp.proxyPort=8080</code> in the command line to launch the node.
Comment: Well done for finding your solution! To take the question off the Unanswered list, it's best to accept your own answer.


Does modal "will" have mood or tense, and if so what is it?

Question: Reading elsewhere on this forum, it seems that "will" when used as a modal auxiliary is not regarded as having tense (despite that dictionaries seem to regard "would" as its past tense), even though it is used to convey future tense. Instead, posted comments seem to regard "will" has having mood. If that's the case, what mood? Often related modals like would, could, should, and might are considered to have "conditional" mood, I don't see what their counterparts (will, can, shall, may) mood designations are.
Comment: The short answer is that syntactically, the modal auxiliary verb "will" has two tenses: present and preterite. Semantically, it is used to make reference to future time (about 80% of its occurrences, I believe) but also for expressing volition. It does, of course, express mood, hence it being called a 'modal' auxiliary verb.
Comment: @BillJ - I get that modal verbs express mood and that "will's" counterpart "would"'s mood is "conditional", but what is the mood of "will"? Also, if "will" can have preterite tense, what would be an example?
Comment: By the gods, I will go now or tomorrow, I have not yet decided. There is no "mood designation".will here is intend.
Comment: @tangosquared "Will" expresses epistemic modality, conditional consequence and of course futurity.See my comment to Colin Fine.
Answer: Historically, the English modals had tense, and mostly came in pairs of present/past: can/could, will/would, shall/should, may/might, dare/durst.
There are vestiges of this pairing still, so can, will, shall become could, would, should in past-tense reported speech. ("I will!" "He said he would!")
But all the originally past-tense forms also have independent uses, and in those uses it does not make sense to talk of any of them as having a tense.
In my view it does not make any sense to talk of mood in relation to them either. vaguer and less clear by saying "the volitional" instead of "modal will".
Comment: Thanks. You somewhat confirmed my evolving understanding that "tense" for modal verbs may be a somewhat obsolete, or at a minimum, misleading classification (as may also be "mood"). However, those characteristics might still be useful to me as my task is to parse out semantic meaning by categorizing words in a phrase. So knowing that may and might, can and could, and will and would are related but convey different intents may be helpful. Similarly, while "will" clearly isn't future tense, it seems to be a common element of future construction.
Comment: Syntactically, "would" is undoubtedly the preterite (past) form of "will", since it's the form required in backshift, just as "could" and "might" are the preterite forms of "can" and "may". "Will" conveys a lower degree of modality than the others, but it does express epistemic modality, conditional consequence and of course futurity. Past tense "would" has three uses: past time, backshift and modal remoteness.
Answer: I found this, https://www.thoughtco.com/tense-grammar-1692532, to be helpful in that it seems to imply that "tense" is more of a syntactical classification and that may be separate from the semantic role of a verb. But it also seems to imply that "can" and "may" are conditional moods, and possibly that "will" is also, but perhaps that is intended to refer to the construction of the modal with the verb it is supporting, as in "I may walk" is present conditional.


Sql Server 2005 - Insert Update Trigger - Get updated, insert row

Question: I want to create a table trigger for insert and update. How can I get the values of the current record that is inserted/updated?
Answer: within the trigger, you can use a table called 'inserted' to access the values of the new records and the new version of the updated records. Similarly, the table called 'deleted' allows you to access deleted records and the original versions of updated records.
Answer: using function 'update' on column ( if you wanna check the fact of update) or retrieving rows from table 'inserted'
Answer: While triggers can be used for this, I'd be very careful about deciding to implement them.  They are an absolute bear to debug, and can lead to a lack of maintainability.
if you need to do cascading updates (i.e. altering table A in turn changes table B), I would either use a stored procedure (which can be tested and debugged more easily than a trigger), or if you're fortunate enough to be using an ORM (Entity framework, NHibernate, etc.) perform this function within your model or repository.


Ensemble Model using Stacking

Question: I learned that building an ensemble model using stacking is done by training a meta-model on the predictions of $n$ other models in order to combine the predictions and try to enhance the performance. But can we in addition add the original input features to teach the model a relation between specific input features and the models predictions, hence, increase the accuracy?
Answer: You certainly can. Whether you train your meta-model on just the base model predictions, predictions + original data, transformations of one or both of these, etc. can be viewed as just another hyper-parameter you can tune in your meta-model.
In Python, StackingClassifier has an argument to allow you to do exactly what you've suggested (passthrough = True).
When you view your base model out-of-sample predictions as "just another feature", the possibilities are pretty endless.

Ensemble Model using Stacking


How to find online discussion groups on research topics which are relatively less popular

Question: How could someone who has just enrolled in a phd or started a research could find online discussion groups, especially if the topic is relatively less popular.(e.g How to find research or discussion group working in privacy aware learning specially differential privacy).
Comment: Did you ask your supervisor?
Answer: If you are in a small niche area of a field then such groups aren't likely to be very visible. It might even be that none exist.
But, if there are productive people in that field who are still working  actively, you can contact a few of them and ask what might be available. Recent papers can be your guide. It might even be that retired folks know of active researchers, perhaps among their own students, who can help.
And, consider starting such a group yourself if you can get a few interested people to agree. It might pay dividends in the future.


What is the blast radius for a Atomic Bomb?

Question: In Civilization V, I have built some Atomic Bombs to drop on my opponent city. However, some of my units are nearby. How far should I move my units in order for them to be safe from my own bomb? What is the blast radius for a Atomic Bomb?
Comment: Are you talking about "Atomic Bomb" or "Nuclear Missile" or both? There's two separate nuclear units in the game. I'm not sure if their AOE is the same or not.
Comment: @Ullallulloo Whoa! Didn't even realize there were 2, I'm so new. Thanks, I'll edit the question. I was talking about the Atomib Bomb :P
Answer: The blast radius is the same for both the atomic bomb and the nuclear missile at 2 tiles. The only difference between the two from a combat perspective is that the bomb is treated as an aircraft and the missile is treated as a missile (obviously).


Strange object crossing the sky

Question: Was stargazing last night and spotted an object traversing the sky from roughly East to West. It had a bright light that was intermittently flashing but with three different intensities. The "third" flash was really bright like a camera flash. Never seen a plane with lights this bright and was not a satellite (like any that I've ever seen), nor was it the ISS as that was not in this part of the world at this time. Any ideas anyone?
Comment: Sounds like a satellite with specular reflections to me. There are very few objects in an east-to-west orbit, so if the date, time, (time zone), latitude, and longitude were known, heavens-above.com or some other site would be able to identify the object (unless it is a classified satellite). Knowing which constellations it passed through would also be good to know.
Comment: I can verify if it was the AJISAI (EGS) satellite (a japanese passive geodetic beacon consisting in a 2 m sphere surrounded by mirrors) but you should give some extra information like observing location, date and time, and if you remember something about it, the region of the sky where you saw it.
Comment: I saw the same thing last night in South Africa just after night fall,but heading in an west to east direction. Looked very much like a tipe of satellite, can't confirm which one sorry.
Answer: It seems you saw a Tumbling satellite. They don't have a constant brightness. This is a result of satellite's rotation. Learn more: http://www.satobs.org/tumble/tumbleintro.html

Strange object crossing the sky


Singularity of Hyperbolic PDE $u_x+2 (x+\sqrt{x^2-y}) u_y=0$

Question: I am studying first order hyperbolic PDEs and want to know if there is a technique to find singularities in your solution without explicitly solving. The PDE in particular is $$u_x+2\left(x+\sqrt{x^2-y}\right) u_y=0$$ where $0<y<x^2$.  Any thoughts or resources? (On a side note, Mathematica was able to produce a solution:  $u(x,y)=F(\frac12 \log{(-1 - 2 x - 2 x^2 + 2 (1 + x) \sqrt{x^2 - y} + y)})$, where $F$ is your boundary condition. Any thought of techniques to solve? MOC yielded me a nonlinear ODE that I couldn't solve, so it appears to not be useful here).
Answer: Assume a singularity for which $q = u_y$ becomes infinite (1). Differentiating the PDE w.r.t. $y$, we have:
$$
q_x + 2 \left( x + \sqrt{x^2 - y} \right) q_y = \frac{q}{\sqrt{x^2 - y}} \, .
$$
Thus, along the PDE's characteristic curves $s\mapsto (x(s), y(s))$, the unknown $u$ is constant and we have
$$\dot q(s) = \frac{q(s)}{\sqrt{x(s)^2 - y(s)}} \, .
$$
Therefore, if the boundary data is smooth, then the method of characteristics provides smooth solutions everywhere inside the domain where $y < x^2$.

(1) P.D. Lax, Hyperbolic systems of conservation laws and the mathematical theory of shock waves. SIAM, 1973. doi:10.1137/1.9781611970562.ch1


XNA C# Making the game scaleable for different resolutions

Question: I am currently developing a game in C# and XNA, and I want it to look right at all resolutions. How would I get started with doing that?
Comment: You need to define what kind of game you're making, and what "look right" means specifically.
Comment: At the moment when I make the resolution bigger, everything in the game stays the same size and gets pushed to the top left hand corner of the screen. On the bottom right there is just the window colour I am drawing. I want it to scale to fill the window at all times.
Comment: @Matthew: sounds like you need to scale the positions and sizes of your sprites according to the viewport size.
Comment: Thanks for the help. Could you please give me an example on how I would do that?
Comment: I probably should have asked specifically - but you should say *how* you are drawing. I assume `SpriteBatch`? Can you please edit your question to include all this information - for anyone who comes along later? (And to avoid your question getting closed.)
Comment: Yes, spritebatch
Answer: First, you have to decide how are you going to actually do the scaling? Do you need to handle aspect ratio? (It sounds like you do.)
If you are using SpriteBatch, you can pass a scaling matrix to Begin. You can also set the Viewport to letterbox or pillarbox off the screen you don't want to render to. Here is an example:
int backbufferWidth = GraphicsDevice.PresentationParameters.BackBufferWidth;
int backbufferHeight = GraphicsDevice.PresentationParameters.BackBufferHeight;

Viewport originalViewport = GraphicsDevice.Viewport;
GraphicsDevice.Viewport = new Viewport((backbufferWidth - viewWidth)/2
        (backbufferHeight - viewHeight)/2, viewWidth, viewHeight);

Matrix scaleMatrix = Matrix.CreateScale(scale, scale, 1);
spriteBatch.Begin(0, null, null, null, null, null, scaleMatrix);

// ... draw your sprites ...

spriteBatch.End();

GraphicsDevice.Viewport = originalViewport;

Note that the above code is untested. Also, I've left the maths for figuring out scale and viewWidth and viewHeight as an exercise - it will depend on how you actually want the scaling to look.
(My answer on that question I linked might give you a starting point. Don't forget to use Math.Floor to set viewWidth/Height, so it doesn't round up and extend outside the backbuffer!)
Answer: You can create a menu with an option to change the resolution. Include all the  standard resolutions.
When the user clicks on that option, change the resolution via
graphics.PreferredBackBufferWidth = 1920; //Your width
graphics.PreferredBackBufferWidth = 1080; //Your height
graphics.ApplyChanges(); //When calling this from outside the constructor, apply all the changes.

And if you want to scale up everything, render it into a RenderTarget with fixed size and then render the RenderTarget to the screen (and scale it up).
Comment: It would be better to get the available resolutions dynamically from `GraphicsAdapter.DefaultAdapter.SupportedDisplayModes`, rather than making potentially invalid settings available.
Comment: I didn't know something like that existed. But I'd really appreciate if you changed my answer or created your own one.


How can I change the order of GNU Screen "screens"?

Question: I am currently using the GNU Screen tool. Now my question is whether there is a way to organize or rather change the order of the screens/ screen list displayed at the bottom of my console window. I haven't managed to do this however having my screens sorted would be a nice thing.
Answer: Open :windowlist move windows up and down with . (dot) and , (comma).
I find it helpful to organize windows in groups. You can create a group with :screen -t mygrouptitle //group but for this you need Screen 4.1.0 which is unreleased yet, so it is necessary to get git version and compile.
For sorting of windows there is screnum script but I find :windowlist -m (MRU list) much more useful.
Answer: You might want to check out creating a custom .screenrc file to open windows specific to whatever project/environment you're working on when you startscreen.  That way your windows will always be in the same order and named the same way, and you can even start up whatever programs you want in each window.
Here's my .screenrc.ror file, which I use when working on Ruby on Rails projects:
<code># to use this:
# screen -c $HOME/.screenrc.ror
# read normal .screenrc
source $HOME/.screenrc

screen -t shell
screen -t shell2
screen -t console
screen -t mongrel
screen -t log tail -f -n200 log/development_vm.log
screen -t mysql mysql -u www-rw -pwww-rw-pass
# start with main 'shell' window showing
select 0
</code>


Symplectic form on the third symmetric power of a plane

Question: Let $V$ a vector space of dimension $2$ over a field $k$ of characteristic different from $2$ and $3$. Let $S^{3}V$ the third symmetric power of $V$.
How to construct a symplectic form on $S^{3}V$ such that elements coming  from the linear group of $V$ are similitudes for this form?
I believe it's some miraculous formula that I can't write down.
Comment: The linear group of $V$ contains many homotheties.  Did you mean the special linear group of $V$?
Comment: I edited my post !
Answer: There's nothing miraculous about this:  Here is an explicit formula:  Let $x$ and $y$ be a basis for $V$.  Then $A,B\in S^3(V)$ can be written in the form
$$
A = a_{-3}\,x^3+3a_{-1}\,x^2y+3a_1\,xy^2+a_3\,y^3
\quad\text{and}\quad
B = b_{-3}\,x^3+3b_{-1}\,x^2y+3b_1\,xy^2+b_3\,y^3
$$
where $a_i$ and $b_i$ are in $k$.  Set
$$
\langle A,B\rangle = a_{-3}b_3 - 3a_{-1}b_1 + 3a_1b_{-1} - a_3b_{-3}\,.
$$
This anti-symmetric pairing is then preserved (up to a multiple) under basis change.  I.e., if $\phi:V\to V$ is an isomorphism, it induces a map $\phi_3:S^3V\to S^3V$, and one has
$$
\langle \phi_3(A),\phi_3(B)\rangle = \det(\phi)^{-3}\langle A,B\rangle.
$$
Note that this generalizes to give a non-degenerate skew-symmetric pairing on $S^{2m+1}V$ when $V$ has dimension $2$ and the characteristic $p$ of $k$ does not divide any of the binomial coefficients ${2m{+}1}\choose{i}$ for $0\le i\le 2m{+}1$.
Comment: @WillSawin:  Not sure what your comment means. When $m=1$, the only forbidden prime is $p=3$, so $p=2$ is OK.  When $m=2$, $p=3$ is OK.  When $m=3$, $p=2$ is OK.  When $m=4$, $p=5$ is OK.
Comment: Good point. I think the actual characterization is that for this to be nondegenerate, $2m+2$ must have a single nonvanishing digit in base $p$ notation - i.e. it is a power of $p$ times an integer less than $p$.
Answer: Here is a construction that gives a way from where this formula comes from. I do not fully understand what the OP is trying to find in his last sentence. But this is what I think the question is about. Please downvote or comment if I misunderstood the intent of the question.

Let $V = k^{2^*}$. Denote by $X,Y$ the coordinate linear functionals for $V$. Thus,
$$ V = \{ aX+bY ~ | ~ a,b\in k \} $$
The determinant $\omega:V\times V \to k$ given by,
$$ \omega(aX+bY,cX+dY) = ad - bc$$
will turn $(V,\omega)$ into a symplectic space.
We can allow the group $G=\text{SL}_2(k)$ to act linearly on $V$ by inverse-transpose. A computation will show that this action preserves the symplectic structure. That is, $\omega(g.v,g.w) = \omega(v,w)$ where $g\in G$ and $v,w\in V$.
There is a natural action of $G$ on $\text{sym}^3 V$. Our goal is to construct a sympletic form on $\text{sym}^3 V$, denote again by $\omega$, such that the action of $G$ is still compatible with this new form.

The symmetric power $\text{sym}^3V$ is the space of all trilinear maps,
$$ k^2 \times k^2 \times k^2 \to k $$
Denote by $x^3$ to be the following trilinear map,
$$ (u,v,w) \mapsto X(u)X(v)X(w) $$
In a similar way we can construct $y^3:k^2 \times k^2 \times k^2 \to k$.
Denote by $3x^2y$ to be the following trilinear map,
$$ (u,v,w) \mapsto X(u)X(v)Y(w) + X(u)Y(v)X(w) + Y(u)X(v)X(w) $$
It may be helpful to imagine $3x^2y$ as $xxy + xyx + yxx$.
In a similar manner one has the trilinear map $3xy^2:k^2 \times k^2 \times k^2 \to k$.
These four maps form a basis for $\text{sym}^3V$ and so,
$$ \text{sym}^3V = \{ ax^2 + b(3x^2y) + c(3xy^2) + dy^3 ~ | ~ a,b,c,d\in k \} $$
We will use a small modification. Instead of the map $3x^2y$ we will denote by $x^2y$ as the map $\tfrac{1}{3}xxy + \tfrac{1}{3}xyx + \tfrac{1}{3}yxx$. This way we can use $x^2y$ and $yx^2$ in our basis of symmetric powers and restate,
$$ \text{sym}^3V = \{ ax^2 + bx^2y + bxy^2 + dy^3 ~ | ~ a,b,c,d\in k \} $$

There is a trilinear universal map for the symmetric power,
$$ V \times V \times V \to \text{sym}^3V $$
which is defined as follows,
$$ (\ell_1,\ell_2,\ell_3) \mapsto \bigg( (u,v,w) \mapsto \frac{1}{3!}\sum_{\sigma\in S_3} \ell_{\sigma(1)} (u)\ell_{\sigma(2)} (v)\ell_{\sigma(3)}(w) \bigg) $$
It is easy to check that $(X,X,X)\mapsto x^3$, and likewise with all the other powers.
Given $(\ell_1,\ell_2,\ell_3) \in V\times V\times V$ we denote its image under this map by simply,
$$ \ell_1.\ell_2.\ell_3$$
and this image is symmetric in each of the three variables.

If $G$ is a group which acts on $V$ then we can put an action of $G$ on $\text{sym}^3V$. Given $g\in G$ and $\ell_1.\ell_2.\ell_3 \in V$ the action is given by,
$$ g(\ell_1.\ell_2.\ell_3) = (g\ell_1).(g\ell_2).(g\ell_3) $$
If the action of $G$ preserves $(V,\omega)$ i.e. $\omega(g\ell_1,g\ell_2) = \omega(\ell_1,\ell_2)$ then it is clear that the action of $G$ on $\text{sym}^3 V$ will preserve the symplectic form.

The space $V$ has a sympletic form $\omega$ given by the determinant, namely,
$$ \omega(aX+bY,cX+dY) = ad - bc $$
We will use the sympletic space $(V,\omega)$ to construct a sympletic form on $\text{sym}^3V$ which we will denote again by $\omega$. This is accomplished by setting,
$$ \omega( \ell_1.\ell_2.\ell_3 , \ell_1'.\ell_2'.\ell_3') = \frac{1}{3!} \sum_{\sigma\in S_3} \prod_{i=1}^3 \omega(\ell_i,\ell_{\sigma(i')}) $$
Since $\omega$ on $\text{sym}^3V$ is bilinear and alternating and since $x^3,x^2y,xy^2,y^3$ form a basis for $\text{sym}^3V$ it is sufficient to determine what $\omega$ does on each pair of these forms. That will give us an explicit rule to compute with $\omega$ using these coordinates.
We start with $\omega(x^3,x^2y)$, this is,
$$ \omega(X.X.X,X.X.Y) = 0$$
this is because $\omega(X,X) = 0$, and any pairing of $X$ from $X.X.X$ will get paired with an $X$ from $X.X.Y$ no matter how these products are permuted. Thus, the end result is always zero.
In the same way $\omega(x^3,xy^2) = 0$. However, for $\omega(x^3,y^3)$ we get,
$$ \omega(X.X.X,Y.Y.Y) = \frac{1}{3!} \sum_{\sigma\in S_3} \omega(X,Y)\omega(X,Y)\omega(X,Y) = 1$$
Next, $\omega(x^2y,y^3) = 0$ but for $\omega(x^2y,xy^2)$ we instead get,
$$ \omega(X.X.Y,Y.Y.X) = \frac{1}{3!}\left( \omega(X,X)\omega(X,Y)\omega(Y,X) +  \omega(X,X)\omega(X,Y)\omega(Y,X) \right) = -\tfrac{1}{3} $$
One can check $\omega(xy^2,x^2y) = \tfrac{1}{3}$.
More explicitly, if $P = ax^3 + bx^2y + cxy^2 + dy^3$ and $P' = a'x^3 + b'x^2y + c'xy^2 + d'y^3$,
$$ \omega(P,P') = ad' - da' - \tfrac{1}{3}bc' + \tfrac{1}{3}cb' $$