k-means clustering on percentages

Question: Can we do k-means clustering on percentage data (like 56%, 44%, 22%, 13%, etc.)?
There is a data set, and data in various parts are measured in percentages.
Comment: You can apply K-Means on any data as long as your covariates are expressed as numericals.
Is it a good idea?! We don't know by simply examining the data range (i.e. percentages), data visualization, domain knowledge and testing are imperative.
Answer: I don't see any reason not to.
The percentage values are just classical numbers all divided by another one.
If other part of the data are not in percentage you might have to scale the data appropriately (or turn them also in percentage) or to choose carefully the distance you use.
Answer: Because many clustering algorithms (very much including k-means) are thrown off by data in which the variables have different ranges (cf., this excellent CV thread: Why does gap statistic for k-means suggest one cluster, even though there are obviously two of them?), it is very common to normalize all variables first (i.e., convert the range to $[0,\ 1]$, see here). In this way, it is common to run k-means on data where all variables are expressed in essence as percentages.
Answer: I think there's no theoretical issue against it, but my gut tells me to avoid including variables that explain 100% of a given item; for example if you're measuring an individual's use of time and clustering across individuals to differentiate Couch Potatoes from Stats Fans from Hiking Enthusiasts, and you have five values to associate time (sleep, eat, exercise, work, play), don't include all five as percentages. In linear regression this causes perfect goodness-of-fit values. In a cluster problem it seems like it would also overfit.

k-means clustering on percentages


Is ERD considered a kind of UML diagram?

Question: Are Entity Relationship Diagrams(ERD's) considered a type of UML diagram or are they a separate thing?
Comment: Please consider to accept the answer of Gholamali-Irani instead of the answer of Justinas Marozas who doesn't address the question how ERDs and UML Class Diagrams are related.
Comment: Didn't know I could change accepted answer after I already selected one. But I agree- a much more detailed answer for any users.
Answer: I have another idea. I think we should look in-depth.
When we are talking about ERD (Entity Relationship Diagram), we are talking about Entity Relationship Modeling.
It is firstly introduced by Peter Chen (1976). He has two famous articles on Entity Relationship Modeling (see first and second articles)
He talked about Entity-Relationship Modeling (not Entity-Relationship Diagram). It is ER Model.
There is another paper in 1975 about Modeling the Real World System.
ER Modeling is (see reference, the second paragraph):

In software engineering an ER model is commonly formed to represent
things that a business needs to remember in order to perform business
processes. Consequently, the ER model becomes an abstract data model
that defines a data or information structure that can be implemented
in a database, typically a relational database.

Diagramming Convention Techniques
When we are talking about ER Modeling, there many diagramming convention techniques.

Chen Notation (some links need translation)
IDEF1X Notation
Bechman Notation
Martin notation
(min, max)-notation of Jean-Raymond Abrial in 1974
UML class diagrams

And other notations (see reference)

All of above notations are using for ER Modeling or Data Modeling.
There is no earth-shattering difference between UML notation and other ER notations. They all model the most important elements of data models.
Finally: UML is a set of standard graphical tools to model the whole or parts of a project. We can use UML (Class Diagram) for ER Modeling and name them our ER Models or ERDs. So we can say: this is my ERD in UML Notation.
Comment: Thank you very much for the extensive information- I would give 10 upvotes if I could. Makes sense now. I am familiar with most of the notations but just wasn't sure what the official understanding was.
Comment: Only Chen's notation can directly represent the concepts of the ER model, like n-ary relationships and attributes on relationships. The other notations are closer to table diagrams or network data model diagrams.
Comment: The `<` and `>` in your UML need to be filled triangles.
Comment: @reaanb, Thanks a lot. I think we can model ER's `n-ary relationships` with N-ary Association in UML (see [here](https://www.ibm.com/support/knowledgecenter/en/SS6RBX_11.4.3/com.ibm.sa.oomethod.doc/topics/t_N-ary_Association.html)). I am not sure about `attributes on relationships`, maybe UML's Association Classes are analogous to attributes on relationships in
ER.
Answer: ERD is it's own thing. It's not in UML specification. You can download specification PDF from the link.
UML is a common notation/language for object oriented modeling and it includes a multitude of diagram types. ERD is a diagram for data modeling (attributes and relationships). Some structural UML diagrams are fairly similar in what you can model, but the concept is different.
Types of UML diagrams:
Comment: Just to add to this answer, theoretically UML "equivalent" for ERD is class diagram. They are different though.
Comment: ERD and Class Diagram doesn't fully overlap in what they can/should model, but yes, it's probably the closest alternative.
Answer: This was the first search on Google:
Key Difference: UML stands for Unified Modeling Language. ERD stands for Entity Relationship Diagram. UML is a popular and standardized modeling language that is primarily used for object oriented softwares. Entity-Relationship diagrams are used in structured analysis and conceptual modeling
Comment: "conceptual *database*  modeling", to be more specific.
Answer: I have a different opinion to Jarek. There is nothing stopping you modelling data using UML. Remember that UML is not new at its foundations, It represents the evolution of a number of types of diagrams which had already existed (ERDs included), and an attempt to standardise these notations to create a consistent language for the communication of system design.
ERDs are used to model (largely) a static model of a system. They show (unsurprisingly) the relevant entities in a system and articulate the manner in which they are related.
In UML Class Diagrams were born from ER diagrams to represent the relationship between classes. If you consider that (in its simplest form) a class is the combination of data and methods, by ignoring methods you are left with a data model (albeit with a syntax which varies from traditional ERDs).
So ERDs correlate to Class Diagrams in UML if you choose to exclude methods and those aspects of the model designed to indicate data protection.
However UML itself serves a broader purpose, as a family of modelling tools that collectively can be used to model both the static and dynamic nature of a system.
It includes diagrams that facilitate for a more complete model of a system than you can get through describing its entities (or data):

Class Diagrams for static object relationship modelling,
Object Diagrams for dynamic mnodelling of object/instance relationships
State Machine/Diagrams for modelling how a system transitions through states
Sequence and Collaboaration diagrams to demonstrate how components of a system will work together
Activity Diagrams (replacing flow charts) to demonstrate/document imperative flow
and a few others I'll leave you to investigate (check out http://www.agilemodeling.com/essays/umlDiagrams.htm for an overview)
Answer: UML, as an object oriented notation, have nothing to data modeling. Lots  times I read about attributes as data columns. It is not true. We can put to an attribute simple data or any complicated other object.
For data modeling (database, relational database) we use ERD diagram, for storing data in object systems we can use ORM (object relational model), it is mixed UML/Data model, if we use pattern like a active table or active record.
Answer: I have a different opinion to Andy. In UML Class Diagrams you describe relationship between two classes. With ERD you can talk about relationships between more than two entities.
This is the reason why the cardinality in Chen-Diagrams are on opposite site compared to UML Class Diagrams. You have to think about number of relations for every single entity.
Let's take a look at one simple example:
In this little example every supplier must be in relationship with at least one delivery. But there can be items not being delivered and projects without any deliveries.
Comment: _In UML Class Diagrams you describe relationship between two classes_ is just nonsense. You can describe relations between any number of elements (and not only classes).
Comment: UML has 20+ types of diagrams and Class Diagram is only one of them. Relationship diagram from the accepted answer is an UML too.
Comment: @Dmitry So how would you model relationships for example between three entities in UML?
Comment: @qwerty_so please feel free to create a UML Class Diagram for my example.


Specific case of RSA where cipher text equals plain text

Question: How did they arrive at the conclusion that there are 4 messages where plain text equals cipher text from "It is easy to show that in RSA, when e = 3 there are 4 messages m for which the ciphertext
is equal to the plaintext and gcd(m, n) = 1. Two of these messages are 1 and −1."? Also, how to find the other 2 messages when there is no clue about n,p,q?
Comment: "How did they arrive at the conclusion" --> Who is "they"? The other messages depend on n,p,q, so you have no chance of finding them without knowing n,p,q.
Comment: Related, almost duplicate question: [How many points in RSA, such that $m^e = m \bmod n$](https://crypto.stackexchange.com/questions/89803/how-many-points-in-rsa-such-that-me-m-bmod-n)
Answer:
It is easy to show that in RSA, when e = 3 there are 4 messages m for which the ciphertext is equal to the plaintext and gcd(m, n) = 1

Well, if $m^3 = m \pmod n$ (and assuming $n$ is a conventional RSA modulus, that is, it is $n = pq$, for $p, q$ distinct odd primes), this is equivalent to both of the below holding simultaneously:
$$m^3 = m \pmod p$$
$$m^3 = m \pmod q$$
If $p, q$ are prime, these are cubic equations in fields; such cubic equations have (at most) 3 solutions.  A moment's reflection (or a bit of algebra) yields the solutions $m = 0, 1, -1$ (with the later being equivalent to $p-1, q-1$) - since there are at most 3 solutions, this must be all of them.
Now, $m=0$ (in either case) is inconsistent with $\gcd(m, n)=1$, hence we can discard those solutions; this yields the solutions $m = 1, -1 \pmod p$ and $m = 1, -1 \bmod q$.  By the Chinese Remainder Theorem (and the fact that $p, q$ are relatively prime), all four possible combinations correspond to a single $m$ in the range $(0, n-1)$.
The combination $m = 1 \pmod p$ and $m = 1 \pmod q$ yields the value $m = 1$; similarly the combination $m = -1 \pmod p$ and $m = -1 \pmod q$ yields the value $m = n-1$ (the quote gives this as $-1$, however that's not in the range, and modular cubing will never return the value -1); these are the two trivial solutions.
The other two combinations, both $m = 1 \bmod p$ and $m = -1 \pmod q$, and $m = -1 \bmod p$ and $m = 1 \pmod q$ are the nontrivial solutions.
This logic shows there are no other possibilities.

Also, how to find the other 2 messages when there is no clue about n,p,q?

Even if you were given the value of $n$, knowing one of the two nontrivial values immediately leads to a factorization of $n$, for example, by computing $\gcd(m-1, n)$, hence there is no easy way (without knowing the factorizatoin apriori).
Comment: thank you so much for the detailed explanation. Just one question, what do you mean by a non-trivial solution? Does it mean the solution does not exist?


Internet Explorer or Edge:- How To display the warning that appear if you open Custom Protocol Handler again

Question: When i click on a custom link such as foo:\ , and there is already a registered protocol handler on windows machine, Internet explorer or Edge display a warning before allowing user to run the custom protocol handler, but if the user select to not display this warning again, the Internet explore(Edge) run the protocol handler without displaying the warning. My question is how reset my selection again and make Internet Explorer or Edge display the warning again.
Comment: any help for this question
Answer: If the name of your protocol is foo, then you can update the registry with the following:
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\ProtocolExecute\foo]
"WarnOnOpen"=dword:00000001

Will enable it
and
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\ProtocolExecute\foo]
"WarnOnOpen"=dword:00000000

will disable it
Answer: To add on Raj Rao answer: use instead HKEY_LOCAL_MACHINE**\SOFTWARE\Microsoft\Internet Explorer\ProtocolExecute to install your protocol for all users.
Answer: Revert the changes triggered by overriding the protocol handler by finding the event and reverting the state changes to their defaults:

After updating the registry keys, the program should broadcast the WM_SETTINGCHANGE message with wParam = 0 and lParam pointing to the null-terminated string "Software\Clients\ClientTypeName" to notify the operating system that the default client has changed.

In HKEY_CLASSES_ROOT, revert the default data of the protocol in question.

This registry hierarchy replaces the existing mailto registry hierarchy found at HKEY_CLASSES_ROOT\mailto. The hierarchy remains the same, only the location has changed.

References

Registering an Application to a URI Scheme (Windows)
Registering Programs with Client Types (Windows)
WM_SETTINGCHANGE message (Windows)
Windows registry information for advanced users
How to suppress or display a warning message when users try to save a file in OpenDocument Format (ODF) in Office 2010 or the 2007 Office suite Service Pack 2
You are prompted to specify Internet Explorer when you click a link in Outlook 2010 or Outlook 2007
Windows registry information for advanced users
If you don't want the changes to be permanent, the don't pass the flag that says that you want the changes to be permanent – The Old New Thing
Comment: This is not answering the question at all. The question is about how to reset suppressed warning dialogs when launching a protocol handler.


CI without Hartree-Fock SCF

Question: Usually textbooks on CI takes the SCF Hartree-Fock orbitals as a starting point. Can one use the configuration interaction method starting directly from the single-particle Slater determinants avoiding the iterative procedure. This question concerns mainly small molecules like the hydrogen molecule. Do I get a high inaccuracy in this case? If yes, why? Could this inaccuracy be decreased taking into account more configurations?
Comment: Thank you for the reply. That is actually what I am asking. How faster do I get convergence in the case of SCF orbitals. How many additional excitations I have to take into account in the case of avoiding preliminary HF computations.
Comment: Szabo and Ostlund describes CI calculations using natural orbitals where the convergence is faster than with Hartree-Fock orbitals. You should read that book for more information.
Comment: ummmm… why would you want to do that?  :-)  I guess I'm wondering if you are doing singles and doubles or toward full CI?  I think you would get toward the Full CI limit faster (with fewer excitations) if you start with more reasonable orbitals.
Comment: @freude: I don't think it's really possible to make an accurate but general statement about it: it'll vary a lot by system, and will be less important in simple systems where the difference between cheap approximations and accurate models is smaller.
Comment: "How faster do I get convergence in the case of SCF orbitals?"  Start with a better initial guess.
Answer: If you were to perform Full CI (within a finite basis) then I don't think that it matters whether you start with SCF orbitals or some other choice.  This solution will have the lowest conceivable energy no matter what.
But if you are doing truncated (less than full) CI, then you are very much at the mercy of your starting orbitals. In general, one would want to start with orbitals that resemble those of the actual state that you are trying to describe via CI.
Otherwise, your precious excitations (singles and doubles) may be consumed correcting the "slop" that you provided, rather than moving toward the full CI limit.
Comment: (As an example, I know some people using CI-related approaches (CASSCF and CASPT2, specifically) on heavier elements who prefer to start with DFT orbitals because they produce a better result than starting with HF.)
Comment: @EricBrown: Natural orbitals are the eigenfunctions of the 1st order reduced density matrix of a wavefunction. If you take n strongly orthogonal wavefunctions and mix them, your leading NOs will not make up the Slater determinant with the largest prefactor. Of course that's contrived, since the wavefunctions also are orthogonal in the energy product.
Comment: If by "some other choice" you mean a basis that can be obtained from the other one by unitary rotation then of course you are right. Otherwise it is not true that the Full CI will give you the same result. Energy minimization by Full CI only depends on your basis.
Comment: Right. I had a little trouble answering this question, because practically speaking, there is always optimization of the inital vectors. It's sort of a "textbook" question. Very interesting about DFT orbitals for metals. I've never done MCSCF on metals--they probably need all the help they can get :-)
Comment: Isn't there a theory that the exact natural orbitals (and approximations to them) should give you the quickest convergence, though? I believe that's the idea behind [Iterative Natural Orbital](http://onlinelibrary.wiley.com/doi/10.1002/qua.560110506/pdf) approaches, for example.
Comment: I think that is how Natural Orbitals are defined: orbital set that puts the most "electron" into the smallest number of MOs (in an aufbau sense).  Then one could just use the occupied orbitals.  I think the problem is that one has to solve the CI problem to determine the natural orbitals -- sort of a "no free lunch" problem.
Answer: Adding to the answer and all the related comments.
Using the HF reference as starting point provides a "clean" interpretation for the different contribution to the total energy. Indeed, the difference between HF and CI energy is, by definition, the electron correlation energy. One can then furthermore break down the correlation into single, double, etc contributions and consider a step-wise convergence to a full CI.
When the reference used for the GS already contains different "effects" (by using NOs or DFT orbitals) the lower energy obtained after performing a CI is not easily interpretable.
Comment: I assume that the same AO basis is used. It then does not matter how the reference determinant is constructed because "all" determinants will be used in the FCI. The result is the lowest possible energy for that system in that AO basis.
Comment: "lead to a final lower full CI energy". Certainly not - full CI is full CI, no matter the starting orbitals (as long as they have the correct number of electrons and similar basic conditions). I have not run such calculations, but I would wager that if one starts with orbitals other than canonical SCF orbitals, a HF-like energy is obtained, thus not the DFT energy is used.
Comment: Thank you for your comment. I have difficulty to agree with your statement "full CI is full CI, no matter the starting orbitals". In the present state of my understanding, this will only be valid when considering a infinite basis. As soon as you truncated the basis, you also impose a constrain on the way the space is spanned. The calculation should thus become orbital depended (for basis sets of the same size). Isn't it ? I think that some literature search would be needed.
Comment: Agreed. It is the underlying AO basis that defines the space that can be spannend, not the way the MO basis is constructed. The same full CI will always lead to the same energy, whatever the kind of orthogonal MO basis (HF or other). Thanks for the clarification.

CI without Hartree-Fock SCF


Preventing Chrome from keeping my history

Question: I would like Chrome to stop keeping my browsing history. I am familiar with incognito mode but would like to retain everything from my browsing except my history (e.g., Incognito mode deletes cookies which I want to retain.) Is there a way to accomplish this?
Answer: I don't think there's a way from Chrome itself (even with an extension: I don't think extensions can run a hook when the browser exits). But it's easy to do from the outside: instead of launching Chrome, launch a script that runs Chrome, then deletes the history.
For best privacy, put the history on a RAM filesystem (make the History file in your profile a symbolic link pointing into the RAM filesystem).
Comment: There is a way now: https://superuser.com/a/1469116/431826
Answer: As of now you'll have to use  Clear Browsing Data ( Chrome Menu → Tools → Clear browsing data )
Answer: If you're on Windows, I have this script below that may help.
Usage: save the script below in a "del_chrome_hist.bat" file, ensure Chrome is totally closed (no chrome.exe in your TaskMan) and then run it with admin privileges  :

ECHO deleting chrome history
set ChromeDataDir=C:\Users\%USERNAME%\AppData\Local\Google\Chrome\User Data\Default
del /q /f "%ChromeDataDir%\*History*.*">nul 2>&1

set ChromeDataDir=C:\Users\%USERNAME%\Local Settings\Application Data\Google\Chrome\User Data\Default
del /q /f "%ChromeDataDir%\*History*.*">nul 2>&1
ECHO deleting chrome history DONE

Furthermore, you can create a task schedule to run this script on Windows start-up.
Answer: if you just want to keep Chrome from logging your history, without using incognito mode, go to C:\Users\<User Name>\AppData\Local\Google\Chrome\User Data\Default, and change all of the history files to read only. just right click on them, choose properties, click the "read only" radio, and hit ok. there should only be a few - "history", 1-3 files labelled "history index .....", "history provider cache", and "history-journal". set them all to read only and it won't record your history as you browse. still haven't figured out how to stop it from recording omnibox text
Answer: There is now an extension which stops chrome from recording History... https://chrome.google.com/webstore/detail/no-history/ljamgkbcojbnmcaonjokopmcblmmpfch#


What is the best regression method for small data sets (e.g., ~1000-5000 data points)?

Question: I find it quite hard to understand what is the state of the art method for a regression task involving a small data set (e.g., ~1000-5000 data points). In some books, we can find linear regression, tree based algorithms, support vector machines, etc. I am wandering if there is now a common agreement on which method has the most benefit.
Answer: The size of the dataset has relatively little relevance to the question of "what type of regression model should I use."
In essence this is like asking: "If I'm only building a "small" house - should I use a philips head screwdriver or a flat head screwdriver?" The type of screwdriver you should use depends on the kind of screws you are using, not the size of the house you are building.
Different kinds of models are used to estimate/predict different types of dependent variables (e.g. a logit model for a binary variable, a linear model for a continuous one), different data structures (e.g. a multilevel models for data which are "nested" at multiple levels), and different types of research questions and different assumptions (e.g. a Targeted Maximum Likelihood Estimation" method for causal inference, given certain assumptions about the factors associated with treatments). Certainly different kinds of models often have different assumptions the sample size under which they produce reliable results, but that's secondary to the question of whether you are using the "right tool for the job."
Also, while "small" is a subjective term, I would not personally use that term to describe a dataset with several thousand observations...although this is perhaps due to my bias as someone who uses "old school" statistics for hypothesis testing and estimation as opposed to machine learning.
Answer: The best regression method depends on the data generating process.
Regardless of sample size, if your response is linearly related with the covariates, then linear regression should always be best.
If the relationship is complex but smooth, and you think uncertainty quantification is important, GP regression might be best
If the relationship is complex and uncertainty quantification is not important, a neural net might be best
I really hate to say it, but the answer is "it depends"


Does Celestial Crusader also boost my opponent's creatures?

Question: I have a Celestial Crusader card that says other white creatures get +1/+1. Does that apply only to my white creatures or will it apply to my opponents white creatures as well?
Answer: There are no hidden limitations.
The effect of Celestial Crusader's ability applies to white creatures other than that Celestial Crusader, no matter who controls them.
If it only affected creatures your control, the ability would have been phrased like Paragon of New Dawns's:

Other white creatures you control get +1/+1.
Answer: If an effect states "other ~ you control," then it only affects those ~s you control. but if it only states "other ~" then it applies to all that are on the battlefield. a good example is slivers. while Battering Sliver affects all slivers on the battlefield, giving them all trample, Groundshaker Sliver only gives slivers on your side of the battlefield trample.
Comment: Re "*then it applies to all that are on the battlefield*", No, it's not limited to the battlefield. It also includes itself.
Comment: Re "*then it only affects those ~s you control*", Except itself.


path hints for a unique user

Question: I know that in magento you can turn on path hints to find out which file you want to edit in order to edit the template, however, right now I work with a website that has a lot of users on the website all the time, so wondered if it is possible to turn on the path hints for admin only. Is this doable?
Because it is no good to show customers the path hints as well as it is also not secure
Answer: The short answer is no, this is not doable, because the admin session is not the same session as the frontend session. Therefore you don't know whether you are logged in as admin or not.
BUT
You have a field in the backend to enter your IP address, then all the developer features are only used, when the IP is correct.
Answer: Fabian has the answer for you - however if this site is as heavily trafficked as you indicated you should not be editing it directly in the first place. Unless you have unknown superpowers, mistakes happen and you are sure you will get every edit correct the first time I would strongly advise to create a development copy of the site and work on that instead. Only once you are happy with the results roll them out to the live site.

path hints for a unique user


Can you reapply for a UK visa after being refused entry?

Question: If one is refused entry to UK for bringing more tobacco than is allowed, does he have a right to reapply for a visa? Would he be granted another visa? There is no cancelled stamp on the visa used to travel there and the person returned to India on his own ticket.
Comment: Do they really remove someone for carrying extra cigarettes? They must have concluded that the person was doing business on a visit visa and earning money in the UK
Comment: @HankyPanky He may have been refused entry for attempting to bring in a large, undeclared amount; it happens.
Comment: I have edited your question in the hopes of making it clearer. I apologize if I have misunderstood; say what is not correct.
Comment: The fact that there is no cancelled stamp on your visa doesn't mean anything. Computer records will tell all...
Answer: You always have the right to reapply for a visa. However, your getting that visa will be influenced by the previous cancellation and how credible is the reason for your visit this time.
Answer: The procedures and policies differ when, at the border, Her Majesty's Revenue and Customs (HMRC) makes the decision to refuse entry, rather than UKVI.
The person's biometrics would have been taken and would be kept in the system for quite a few years. Forms were provided as part of the process and would indicate any consequences, both at the time of the action and for any future applications.
Certainly a fresh visa application can be made, and judgments made could consider this refusal, along with any other previous travel history. However, no one can predict the outcome, other than to suggest that the individual's credibility has taken a hit.


Location of xsd for ant ivy lib "antlib:org.apache.ivy.ant" for IDE autocomplete with xsd?

Question: I want create Ivy Ant tasks in xml editor in IDE (Intellij iDEA) with autocomplete based on xsd , but I cannot find xsd for register XML namespace xmlns:ivy="antlib:org.apache.ivy.ant"
Where I can find it?
Answer: I just copied the ivy jar to INTELLIJ_HOME/lib/ant and now intellij can resolve the ivy tasks.
Or import this ant file to your ant  project,  its actually the first ivy example in ivy documentation,   make sure to always depend on install-ivy target, add your ant file to idea in the ant build window and you dont even have to install ivy and idea recognizes ivy tasks.

<property name="ivy.jar.dir" value="${user.home}/.ivy2/jars" />
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" />

<property name="ivy.install.version" value="2.2.0" />

<target name="check-ivy-installed" unless="INTERN-ivy.jar.exists">
    <available property="INTERN-ivy.jar.exists" file="${ivy.jar.file}"/>
</target>

<target name="download-ivy" depends="check-ivy-installed" unless="INTERN-ivy.jar.exists">
    <echo message="downloading and installing ivy"/>
    <mkdir dir="${ivy.jar.dir}"/>

    <get src="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
         dest="${ivy.jar.file}" usetimestamp="true"/>
    <echo message="ivy installed"/>
</target>

<target name="install-ivy" depends="download-ivy" description="--> install ivy">

    <echo message="Installing ivy"/>
    <path id="ivy.lib.path">
        <fileset dir="${ivy.jar.dir}" includes="*.jar"/>
    </path>
    <taskdef resource="org/apache/ivy/ant/antlib.xml"
              uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
</target>

Answer: To complete Shalom's answer, the location where to add the ivy.jar for the IntelliJ IDEA Community Edition is INTELLIJ_HOME/lib/ant/lib  (one more folder to go).
Maybe it also apply to the full version.
Answer: might be, there was no xsd in the past time this discussion started, but at least since may 2011 the ivy scheme is well documented at
http://ant.apache.org/ivy/schemas/ivy.xsd
which is linked right from the documentation in http://ant.apache.org/ivy/
so, to start over using the scheme, you just need:
<?xml version="1.0" encoding="UTF-8"?>
<project name="yourproject"
         xmlns:ivy="antlib:org.apache.ivy.ant"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd"
>

Comment: That's the wrong XSD. That XSD is for the "ivy.xml" file. Notice it doesn't have the element "resolve".
Answer: I guess this discussion might help you.  It appears that there is no xsd for the ivy ant tasks, but Eclipse does autocomplete.
Comment: yes, no xsd for ivy ant tasks avialable. but i found the way to make autocomplete inIntellij IDEA
Answer: yes, no xsd for ivy ant tasks avialable. but i found the way to make autocomplete in Intellij IDEA
in ant build file need to define additional task:
<property name="ivy.jar.dir" value="C:/Apache/apache-ivy-2.2.0/"/>

<taskdef resource="org/apache/ivy/ant/antlib.xml"
                 uri="antlib:org.apache.ivy.ant">
        <classpath>
                <fileset dir="${ivy.jar.dir}" includes="*.jar"/>
        </classpath>
</taskdef>

Answer: XML plugin for jEdit defines AntCompleteTask (ant task) that produces an xml file called ant-complete.xml. The resulting file looks as follows:
<element-list>

<element name="classpath"
content="(fileset|dirset|extdirs|existing|filelist|pathelement|path)">
<attribute name="id" type="ID" />
<attribute name="location" type="CDATA" />
<attribute name="cache" type="(true|false|on|off|yes|no)" />
<attribute name="refid" type="CDATA" />
<attribute name="description" type="CDATA" />
<attribute name="path" type="CDATA" />
</element>

The generated file may be downloaded as XML plugin archive. Open XML.jar and browse to xml/completion directory. It's syntax is defined in xml-completion-info.dtd.
The task code does not contain an explicit license, but it's at least GPL. Anyway you probably don't need to distribute that task, only to use it and this doesn't require any license.
I can't assess the usability of the resulting xml file, but jEdit uses it for autocompletion.


Noether's theorem

Question: Can anyone explain to me where the functions $F$ and $Q$ come from?
Answer: For what it is worth, both $Q^{\alpha}$ and $F$ are objects that need to exist before we can apply Noether's theorem, i.e. they are assumptions. $Q^{\alpha}$ is the assumed infinitesimal transformation of the variable $q^{\alpha}$, while the total time-derivative of $F$ is assumed to be the infinitesimal change of the Lagrangian under said infinitesimal transformation, cf. eq. (7.2).

Noether's theorem


Chern Classes of a Trivial Bundle

Question: Could someone explain to me why the chern classes of a trivial bundle are zero?
(I'm studying it from Bott & Tu book) To be more specific I can't understand why, given the vector bundle $E$ on $M$, it must be $C_1(S^*_E)^n=0$. $S^∗_E$ is the dual of the tautological subbundle of the pullback of $E$ on $P(E)$.
Answer: This is a trivial consequence of the naturality (or functoriality) of the Chern classes, which should be clear no matter which definition of the Chern classes you are using.
Fix a space $X$.  Let $P$ be a one-point space, and let $E \rightarrow P$ be the trivial $n$-dimensional complex vector bundle.  There is a unique map $f : X \rightarrow P$, and it is easy to see that the trivial $n$-dimensional complex vector bundle over $X$ is exactly the pullback $f^{\ast}(E) \rightarrow X$.  All the Chern classes of $E \rightarrow P$ have to be trivial since the cohomology groups of $P$ are trivial.  Thus by the naturality of Chern classes we have
$$c_i(f^{\ast}(E)) = f^{\ast}(c_i(E)) = 0.$$
Answer: I assume you're looking for a non-technical answer, one that will somehow tell you the intuative reason for why the Chern classes of a trivial bundle are zero without going into serious calculations. I can't promise you this will be that answer, but we'll damn well do our best. For the record, what I'll say makes sense in the algebraic and analytic categories. I think it does as well in the smooth one, but I wouldn't bet my life on it.
For the setup, I'll take my manifold $X$ to be compact and smooth, and I'll take a smooth vector bundle $E \to X$ over it. Now, what are the Chern classes of the bundle $E$ really?
Suppose we have a section $\sigma$ of the bundle $E$ and suppose also that the section $\sigma$ is not the zero section, but that it still has some zeros. Then we can consider the subvariety $(\sigma)_0$ of points of $X$ where the section $\sigma$ is zero. This subvariety defines a cohomology class on $X$; it's easiest to define it by duality, that is by simply integrating differential forms that represent different classes over the subvariety $(\sigma)_0$.
This cohomology class is the first Chern class of the vector bundle $E$. Thus the first Chern class measures, in some sense, how "often" a general section of $E$ is zero.
To get a feel for the second Chern class, take two sections $\sigma_1$ and $\sigma_2$ of $E$. Locally these are just vectors in a vector space, so they can be colinear or not. Let $(\sigma_{12})$ be the subvariety of $X$ which consists of the points where the sections $\sigma_1$ and $\sigma_2$ are colinear. This subvariety again defines a cohomology class, which is exactly the second Chern class of $E$.
The same happens for the higher Chern classes. Intuitively, the $k^{th}$ Chern class of a vector bundle measures, in some sense, how "likely" it is that $k$ generic sections of the bundle are linearly dependent.
I'm told this is more or less the original historical definition of Chern classes. This point of view is exposed in great detail in a forthcoming book of Harris and Morrison called "Intersection theory". Until that book comes out, Harris talks about this a great deal in his lectures available here: http://mate.dm.uba.ar/~visita16/ELGA-2011/version/v1/images-en.shtml
Now, this is relevant to our interests. Indeed, suppose the vector bundle $E$ is trivial, or $E = \mathbb R^r$. Then it is somehow clear that we have an incredible amount of room in which to fit our sections, as there are no global obstructions coming from the structure of the bundle itself. In vague but suggestive terms, we can take a global frame, or basis, of our vector bundle. If we need to find $k$ linearly independent sections of the bundle, we just take the $k$ first vectors of that basis. These are linearly independent everywhere, thus the subvariety which defines the $k^{th}$ Chern class is empty, so the $k^{th}$ Chern class of the bundle is zero.
This was all incredibly imprecise. I do suggest you look at Harris' lectures to get a better idea of what is going on.
Comment: I'm very confused about your third paragraph. Since when do chern classes depend on a section σ? I thought they were intrinsic invariants of the bundle.
Comment: I thought that Harris and Eisenbud were coming out with an intersection theory book titled "3264 and All That".  Are you sure that's not the book you were thinking of?  (Or perhaps I am misinformed.)  Also, I wholeheartedly agree that Joe Harris' talks are fantastic.  The Chern class discussion, along the lines you described, is in the second half of video 3.
Comment: That is the book I'm thinking of, I must have misremembered.
Comment: This is a very good explanation, albeit the fact that you got it the other way around (I think, I'm not an expert). Meaning, the *top* chern class measures "how often a general section of $E$ vanishes". The relation is $c_i(E)$ measures the linear dependence of $r-i+1$ generic sections, where $r$ is the rank of $E$. See section 5.2 in "3264 & all that intersection theory in algeraic theory" by Eisenbud and Harris.
Comment: Confused in the third paragraph: 1. I can pick a section that has as many zeros as I want, right? Did you just mean the least possible amount of zeros? 2. how do you integrate forms on the isolated zeros? They have dimension 0 and the integration is zero.
Answer: At least rationally you can also see this easily since any trivial bundle admits a flat connection. But then by Chern Weil theory you see that any chern class has to be zero, since it can be computed in terms of the curvature which is $0$ in our case.
Answer: This is a late answer to the question. I just wanted to explain how Bott & Tu deduced it in the book. In the chapter they computed the cohomology of $P(V)$ and showed that $H^*(P(V))=\frac{\mathbb{R[x]}}{(x^n)}$.
They write:

If $E$ is the trivial bundle $M \times V$ over $M$ then $P(E)=M \times P(V)$ so $x^n=0$.

In there construction of the chern class they are using the Leray–Hirsch theorem to represent $H^*(P(E))$ as a free module over $H^*(M)$ with basis $\{1, \dots, x^{n-1}\}$. But in this case we can use Kunneth formula for cohomology to deduce:
$$H^n(P(E)) \cong \left(\sum_{i + j = n} H^i(M) \otimes H^j(P(V))\right)$$
From this and the knowledge of the cohomology ring of $P(V)$ we deduce that $x^n=0$.
Edit: The answers to the question in the comment gos as follows.
At page 270 in there book the construct the following exact sequence
$$0 \to S \to \pi^{-1}E \to Q \to 0$$
Where $\pi^{-1}E $ is the pullback bundle over $P(E)$. If $E$ was the trivial bundle over $M$ then $\pi^{-1}E $ will be the trivial bundle over $P(E)$. Now we ask what will be $c_1(S^*) \in H^2(P(E))$?
If $\rho_2$ is the projection $M \times P(V)\to P(V)$. Then we can show that $\rho_2^{-1}\tilde{S} \cong S$, where $\tilde{S}$ is the universal sub-bundle of $P(V)$. Thus we have $c_1(S^*)=-\rho_2^*(c_1(\tilde{S}))$. Thus
we now have
$$x^n = \left(c_1(S^*)\right)^n=-\rho_2^*(c_1(\tilde{S})^n)=-\rho_2^*(0)=0.$$
Comment: Can you please explain why `x^n` is non zero in general because it seems `H^*(P(E))\equiv H^*(M)\otimes H^*(P(E)_p))`, by Leray-Hrisch and ` H^*(P(E)_p))` is same as  `H^*(P(v))`.
Comment: This is quite hard to answer in a comment. maybe you should post a question. If its not trivial then we cant use kunneth and all we know from leray hirsch is that $x^n$ the element of the ring $H^*(P(E))$ is a linear combination of $1,x^1,\dots,x^{n-1}$ with coefficients in $H^*(M)$. Take a look at equation 20.7 page 271 in the book to understant
Comment: How do we get $x^n=0$ from this?

Chern Classes of a Trivial Bundle


House front wall cracks

Question: I was decorating my hallway and noticed hairline crack going above the front door. Scratched off the front layers and underneath found much wider crack is this something to worry about or just fill it up, paint it and forget about it?
Note this front area gets really hot in summers as sun is pointing at that side for the hottest part of the day. Have noticed few hairline cracks also on other windows but nothing on the outside brick wall.
Comment: There are many such questions on this site. Please take the search feature for a ride.
Answer: That looks like a poor finishing job. The corners weren't done well either.
It most likely is expansion and contraction that gets exacerbated in colder weather. ( you didn't indicate your location)
The large crack should be covered with mesh tape, then spackled over and smoothed then painted. The other cracks are normal as said.

House front wall cracks


How to connect an electrode to ground?

Question: I have an array of 16 electrodes that I want to be disconnected from everything until selected and then connected to ground, one at a time. Would a multiplexer work for this? My application is sensing the capacitance between pairs of electrodes in sequence using an TI FDC1004 which senses capacitance between a 25kHz signal and ground. The capacitance between electrodes 1-16 would be measured, 2-16, 3-16, 4-16, etc. for a total 128 measurements.
Comment: What potential difference are we talking about between Cin and ground?
Comment: @winny The spec sheet states that the average DC voltage applied to the sensing electrode is 1.2V
Comment: Good. How much stray capacitance is acceptable in the MUX/switch?
Answer: Depends on how sensitive your capacitance sensing is. In general, no, in capacitive button applications, which do pretty much what you describe, that often goes wrong because even in its off mode, the the contacts in a multiplexer circuit have enough capacitance to cause spurious changes, between adjacent pins and between the disconnected pin and the common ground connection. You typically counter that with plenty of post processing in software - based on the fact that for capacitive buttons, the actual capacitance doesn't matter, you just want to reliably sense a finger-induced change of capacitance.
Separate relays (with intentionally low capacitance) might work. But then you'd introduce something large, unpredictable into your measurement, which you would have to calibrate out.
Then again, things might be benign: the sensing frequency seems to be chosen intentionally low, so that the internal muxes work well. You'll honestly probably have to try
Comment: When you say, "have to try", do you mean trying to connect ground to the drain pin on an analog semiconductor-based multiplexer (ADG1206, for example)? Is there any chance of damaging the device?

How to connect an electrode to ground?


What are the advantages of using urban airship over C2DM

Question: The title pretty much sums it up.
What's the difference between those services exactly and what are the advantages of using one over another ?
I'd like to know what's the difference between UA and APN of apple as well ?
Answer: Convenience I guess I havent used it but it seems it will work on both iPhone and android.
C2DM is android(2.2) specify.
APN is specify to iphone.
So you will have to work a bit more if your app is on both android and iphone. Urban airship seems to solve this extra step.
Answer: From what I read urban airship gives push support to 1.6 and above if you go pro. Android c2dm only works on 2.2 and above.
Answer: 1- Allows the devices running platforms lower than 2.2 ( API level 8 ) to receive push notifications.
2- Handles many requests between the device and the server on behalf of the developer (e.g. the registration tying an APID (Android Push ID -  is the Urban Airship ID of a device to which a message can be pushed from the Urban Airship API ) to your application happens automatically ).
3- Broadcasts the messages to all the registered devices ( of course you can do it just by looping on all the registered devices, but eventually Urban Airship still does it for you ).


How can I force turbo boost work constantly in Ubuntu?

Question: In windows I  have a tool which I just turn on and have turbo boost constantly on my i5 in laptop.. Unfortunately i can't overclock my cpu over bios. Can anybody recommend any tool for Ubuntu ? I'm not worry about ventilation and electricity.
Comment: Did you ever manage to solve this?
Answer: Turbo-boost is on "all the time" by default in the default ondemand CPU governor.
But that doesn't mean the clock speed is always the turbo boost's level all the time and certainly not for all cores. Turbo boost allows the CPU to scale up one or two cores (depending on the CPU) to an overclocked level on demand. This will happen in Ubuntu.
What you can't (and shouldn't) do is try to turbo boost while overclocking. I'm not even sure it's possible. You'd be mixing two things that shouldn't be mixed.
But what you can do is set a manual overclock in your BIOS. CPU scaling will probably still happen but that isn't an issue because ondemand is just as fast as the performance governor in most situations. You can set it if you wish.
Comment: sorry, made a mistake. I mean I want to force cpu work on maximum speed always. For ex. if usual 2.5 and turbo boost give 3.2. for 4 cores. Would be really cool have 3.2. In windows  ThrottleStop do this. Unfortunately provider of laptop's bios don't give features for overclocking.  Seems this impossible.


Phonegap twitter plugin for ios4

Question: I integrated a twitter plugin for ios using phonegp plugins as given here. But I want the same feature in ios4 also so how can I get it?
Answer: The Twitter plugin is based around the IOS5 platform that includes twitter as standard.
Twitter API uses a type of Oauth for authentication. Maybe do a search for OAuth within a webapp for a custom solution.

Phonegap twitter plugin for ios4


Is it possible to send users a token or NFT but they don't have any Solana to make any transactions

Question: I want to build an application and send my users a custom token or nft. I can easily generate a solana address, but none of my users will have solana coins to pay for fees to send it back out or redeem it back with me. How can one tackle this common problem when you need the native parent token to pay for fees?
Answer: The user running the application must connect their wallet to open the new account and fund it with some lamports. They will sign the tx to do so. In a wallet like Phantom this is why you will see a small Sol fee to interact with some Dapps for the first time, this is the fee to open the necessary accounts. This is a pretty universal approach because other accounts such as token accounts need to be funded with the rent exemption. It sounds like you want to create an Associated Token Account for your users and mint them custom tokens.
You can also fund the creation of the accounts out of your account, so the caller of the program (maybe you) is opening an account for another user, but you will pay the rent exemption. This approach is not very common.
Comment: Let me get this straight. So i need to initiate each and every user account with a small fraction of SOL before my users can use their account? What if I have 100K user accounts and I want to generate a SOL address for each and send each one a free NFT.
Comment: That's right: any account you make on Solana requires rent. Usually you will fund the account with 2 years worth of rent, which actually allows it to be exempt from paying rent. The rent fee for something like a token account is very small (generally around .000001 Sol), and this cost is typically paid by the user when they claim the token/NFT/etc.
Answer: The key here is to specify a fee_payer under your control to also sign users' transactions.
Users would first sign and send you (not the blockchain yet) a transaction that is configured with one of your accounts as fee_payer. Then you just have your fee_payer sign and send.
Comment: so i have to sign a transaction every time a user sends the free NFT that i sent them?
Comment: Yes, the user would sign for the NFT transfer, and you'd sign for the fee-payer designation, then you'd send the transaction to the cluster. And to be clear, you wouldn't sign manually, of course. You'd use a server.


alteration of provisional patent

Question: If I prepare a provisional application for a, say, disk holder. The descriptions, drawings, etc. indicate a rack with 10 slots for disks. After receiving the pending patent status, can I add or substract slots in the patent app. which do not affect the concept of the invention?
Answer: Provisionals are not reviewed for grants, but merely establish an earlier priority date for the invention in regard to a subsequent nonprovisional application.
Because the provisional is not reviewed in this manner, there is no back-and-forth with the examiner during which alternations can be made.

You would have to file a subsequent provisional patent to introduce changes

This may be useful for additions, but you don't need to do so for subtractions, as you can simply omit the latter material in a subsequent nonprovisional application.

PS: What you're describing sounds more like a design patent.  "Provisional applications for patent may not be filed for design inventions." [See: Provisional Application for Patent; Cautions]
Answer: Assuming you are applying for a utility patent, then you shouldn't be limiting the claims to exactly one configuration. Instead of say 10 slots, the claim language should read something like "a plurality of slots...". Its important when applying for a utility patent to very clearly understand what the actual invention is and to try to claim it as broadly as the patent office will allow. A qualified patent attorney or agent is extremely valuable in this regard.

alteration of provisional patent


Should I choose 'Format' or 'Format (Quick)' when installing Windows XP?

Question: When installing Windows XP, there is a prompt for formatting the disk.  What is the difference between an NTFS 'format', and an NTFS 'format (Quick)'?
Answer: It depends.
If it's a disk that has been working fine, just use the quick format, otherwise I'd do a full format, which also scans for bad sectors.
More info here: KB302686.
Comment: but then, I would never use a disk I knew to be faulty for a fresh installation, so ....
Comment: In other words, there's no point to spending extra time scanning for bad sectors at format time, because the OS has to do that on reads/writes anyway.  You don't save any work later, and you get nothing now because even if it finds a bunch of bad sectors you didn't already know about it will still just mark them bad and move on.
Answer: I always use quick format.
There is just no reason for a long format in modern harddisk, since writing each block to zero won't do any good to "fix" any actual harddisk problems. These days, harddisk either work, or it needs to send it for RMA, or just dump it.
Answer: Use Format (Quick). One time, Format (Quick) gave me an error, and I thought that if I used Format instead, it would work. After waiting hours, Format gave me the same message.


Is infinity an odd or even number?

Question: My 6 year old wants to know if infinity is an odd or even number. His 38 year old father is keen to know too.
Comment: "Odd" and "even" are typically only applied to natural numbers, of which infinity is not. "1.4" is neither odd nor even as well.
Comment: Neither or both because $\infty=2\cdot \infty=2\cdot \infty + 1$
Comment: @The Chaz. Not true. In fact 1.4 = 7/5 is odd when considered as an elt of the subring of rationals expressible with odd denominator. To say that the concept of parity in $\mathbb Z$ doesn't apply to extensions is to miss the point. The question is whether the notion of integer parity can be *extended* in a meaningful way to certain extended "number" systems.
Comment: @The Chaz. Ditto for irrationals, e.g. $\:\sqrt{3}\:$ is odd in $\:\mathbb Z[\sqrt{3}]\:.$ See [here](http://math.stackexchange.com/questions/26837/do-odd-imaginary-numbers-exist/26843#26843) for more.
Comment: Infinity is not a number to start with :)
Comment: @Bill: I didn't have time to type-out the decimal expansion of an irrational! (But seriously, thanks for the comment)
Comment: I would answer yes. ;)
Comment: Alas! $$$$$$$$.
Comment: @Cano64 what is a number?
Comment: Related MathOverflow question: http://mathoverflow.net/questions/69461/on-the-difference-between-two-concepts-of-even-cardinalities-is-there-a-model-of
Answer: In the context of transfinite ordinals, the usual
definition is that an ordinal number $\alpha$ is even if
it is a multiple of $2$, specifically: if there is another
ordinal $\beta$ such that $2\cdot\beta=\alpha$. In other
words, the order type $\alpha$ can be viewed as $\beta$
many pairs in sequence, or in other words, $\alpha$ is
left-divisible by $2$. Otherwise, it is odd.
It is easy to prove from this definition by transfinite
recursion that the ordinals come in an alternating even/odd
pattern, and that every limit ordinal (and hence every
infinite cardinal) is even. Many transfinite constructions
proceed by doing something different on the even as opposed
to the odd stages, just as with finite constructions.
The smallest infinite ordinal is $\omega$, which is even on
this definition, since having $\omega$ many pairs in
sequence is order-isomorphic to $\omega$, and so
$2\cdot\omega=\omega$. Meanwhile, the next infinite ordinal
is $\omega+1$, which is odd. The ordinal $\omega+2$ is
even, since it is equal to $2\cdot(\omega+1)$, even though
it is not $\beta+\beta$ for any $\beta$.
(Please note that $\alpha=2\cdot\beta$ is not at all the
same as saying $\alpha=\beta+\beta$, since $\beta$ copies
of $2$ is not the same order type as $2$ copies of $\beta$,
a phenomenon at the heart of the non-commutativity of
ordinal multiplication. )
To explain the idea to a child, I would focus on the
principal idea: whether finite or infinite, a number is
even when it can be divided into pairs. For finite sets,
this is the same as the ability to divide the set into two
sets of equal size, since one may consider the first
element of each pair and the second element of each pair.
In the infinite context, as others have noted, there are
numerous concepts of infinity, each with its own concept of
even and odd. In my experience with children, one of the
easiest-to-grasp concepts of infinity is provided by the
transfinite ordinals, since it can be viewed as a
continuation of the usual counting manner of children, but proceeding  into
the transfinite:
$$1,2,3,\cdots,\omega,\omega+1,\omega+2,\cdots,\omega+\omega=\omega\cdot2,\omega\cdot
2+1,\cdots,\omega\cdot
3,\cdots,\omega^2,\omega^2+1,\cdots,\omega^2+\omega,\cdots\cdots$$
This concept of infinity is attractive to children, because
they can learn to count into the infinite this way. Also,
this concept of infinity has one of the most successful
parity concepts, since one maintains the even/odd pattern
into the transfinite. The smallest infinity $\omega$ is
even, $\omega+1$ is odd, $\omega+2$ is even and so on.
Every limit ordinal is even, and then it repeats even/odd
up to the next limit ordinal.
See the Wikipedia entries on transfinite
ordinals and ordinal arithmetic for
more information about the ordinals.
Comment: Please record your 6 year old's expression when you explain it this way ;)
Comment: Bill, despite your emphatic comments, I know for a fact that counting into the ordinals is something that children can easily learn. I have two young children (ages 4 and 9), who are happy to discuss $\aleph_\alpha$ for small ordinals $\alpha$---although my daughter's pronunciation sounds more like $\text{Olive}_0$, $\text{Olive}_1$---and my son can count up to small countably infinite ordinals. The pattern below $\omega^\omega$ is not difficult to grasp. Below $\omega^2$, it is rather like counting to $100$, since the numbers have the form $\omega\cdot n+k$, essentially two digits.
Comment: @James: " Also, ∞ is an **odd** creature in that if you add to it it still remains ∞." perhaps we have solved the mystery. :)
Comment: Almost anyone including children can learn to count to
$\omega^2$, naming the numbers in turn and describing the
general pattern---and my son can count much higher---the
key hurdle is getting to the idea that something can come
*after* all the finite numbers, that is, just getting to
$\omega$ itself. In my experience (also decades of teaching), I have found that this hurdle can be
overcome with a Zeno-style explanation of getting half way
to the line, saying $1$, then half-way again, saying $2$,
and so on, finally saying $\omega$ when you are at the
line.
Comment: Once a person can count to $\omega$, then you just do it again, counting $\omega+1$, $\omega+2$, and so on, and they will guess that the name of the ordinal after this is $\omega+\omega$, which you can explain is also known as $\omega\cdot 2$. Soon you are counting $\omega\cdot 2+1$, $\omega\cdot 2+2$, and so on, and then they will guess $\omega\cdot 3$  and also see how the $\omega\cdot n$ arise, which you can explain are called limit ordinals, and very soon you reach $\omega^2$. And one can carry interested subjects still further along...
Comment: @David: there is nothing not serious in JDH's answer. Please collect yourself, and try not to say things like *Do any of you have a mathematical education?* because it only contributes noise to the discussion (and yes, JDH and many others here do have an extensive mathematical education...)
Comment: @David, oh, my answer here is also completely serious.
Comment: @BillDubuque: I'm always amazed at what children are capable of, or anyone with an open mind. They give it 100% compared to adults, who typically have reservations or fear of failure.  Children are young and thus approach everything with no knowledge of ever failing at anything they do.
Comment: I'm slowly digesting this answer (and comments) with wikipedia in hand. Once my expression has normalised, I'll explain it to my 6 year old (and record his expression!)
Comment: In ordinal arithmetic, $\omega+1$ is the successor to $\omega$, that is, the next ordinal after $\omega$, and so $\omega\lt \omega+1$. Ordinal addition is that $\alpha+\beta$ is the order arising from a copy of $\alpha$ followed by a copy of $\beta$, and $\alpha\cdot\beta$ means $\beta$ copies of $\alpha$. So $2\cdot\omega$ means $\omega$ copies of $2$, which you can see easily is $\omega$, but $\omega\cdot 2$ means two copies of $\omega$, or $\omega+\omega$. Meanwhile, $1+\omega$ is $1$ followed by $\omega$, which is the same as $\omega$, and so $1+\omega=\omega=2\cdot\omega=67\cdot\omega$.
Comment: It may be easier for the original poster to just dodge the question by raising the kid as an ultrafinitist!
Comment: @JDH It's *quite* absurd to think that a six year olds notion of infinity might have something to do with ordinals. It's even more absurd to consider that one might be able to "explain the concept to children". I don't recall ever having encountered a more pedagogically ridiculous proposition.
Comment: I don't care for an extended argument with you about it,
but no, my children are not undertaking transfinite
consistency proofs. My claim about children above, if you
read it, was much milder, namely, that children can learn
to count in the ordinals and learn that ordinals have the
same even/odd pattern as ordinary numbers, and that to be
even means to be divisible into pairs. The task simply
isn't as difficult as your comments suggest.
Comment: I decided a couple of years ago that ordinals were the way to answer my own six-year-old's questions about "infinity", and that they led most naturally to an understandable explanation of how infinite quantities work.  For example, there is a simple and correct answer to the first question a six-year-old asks, "What is infinity?", namely, (understanding "infinity" as $\omega$) it is the smallest number that you cannot reach by counting from 0.  My experience has borne out that this was a good way to proceed.

Cardinal infinities, on the other hand, are quite peculiar and unintuitive.
Comment: This is way overkill, but I like it!
Comment: @David, on the contrary, Cantor's ordinal numbers are a major part of Cantor's work (http://en.wikipedia.org/wiki/Georg_Cantor), about which Hilbert famously declared, "No one shall expel us from the Paradise that Cantor has created." I would encourage you to learn more about the beautiful mathematical theory of ordinal numbers http://en.wikipedia.org/wiki/Ordinal_number.
Comment: @JDH Thanks for the elaboration. In my experience I think one has to exercise extreme caution lest one attribute inordinate amounts of comprehension when all that may be occuring is simply mimicry. It's not difficult to test true comprehension by asking probing questions. In my opinion, for a six-year old to truly comprehend the essence of the matter would require a mathematical prodigy.  PS Again, you need to say @Bill if you want me to see your replies.
Comment: @JDH My comment is based upon decades of interacting with hundreds of well-educated *adult* lay folks on topics like Goodstein's theorem. Some of these folks were quite well-educated, e.g. esteemed professors in other fields. Given their difficulty truly grasping ordinals, I am highly skeptical of your claims about (your) children. Not to mention the fact that, except for children of logicians, it is highly unlikely that a 6-year-old's informal notion of "infinity" has anything whatsoever to do with ordinals. PS You need to write "@Bill" not "Bill" if you wish me me to be notified.
Comment: As enlightening as this answer is, I'm not sure it answers the question.  Yes, limit ordinals, including $\omega$, the "smallest infinity", are even.  But what does this say about whether "infinity" is odd or even?  Are you assuming that the questioner's "infinity" means $\omega$?  If so, why?  Isn't $\omega+1$ also infinite?
Comment: To continue, the ordinal $\omega+2$ is even because it is equal to $2\cdot(\omega+1)=2\cdot\omega+2=\omega+2$, but it is not $\beta+\beta$ for any $\beta$, since if $\beta$ is finite, then $\beta+\beta$ is also finite, and otherwise $\beta+\beta$ is at least $\omega+\omega$, which is strictly larger than $\omega+2$. So in this context, to get the even/odd/even/odd pattern, one should not use right-divisibility by $2$, but rather left-divisibility as I mentioned.
Comment: Note that $\omega+1$ is odd, because if $2\cdot\beta=\omega+1$, then $\beta$ cannot be finite, since then $2\cdot\beta$ would be finite, and $\beta$ cannot be equal to $\omega$, since $2\cdot\omega=\omega\lt\omega+1$, and so $\beta$ must be at least $\omega+1$, but in this case $2\cdot\beta$ would be at least $\omega+2$, which is strictly larger than $\omega+1$. A similar argument establishes the even/odd pattern for all ordinals.
Comment: Eric, $\omega + 1$ actually represents the linear order of $\mathbb N \cup \{\infty\}$ if you will. There are countably many numbers that get bigger step by step and one number "$\infty$" that is bigger than all of them.

Also $n\in\mathbb N$ (as an ordinal) is a linear order of $n$ numbers. $2\cdot n$ is $n$ linear orders of $2$ numbers concatenated, hence a linear order of $2n$ numbers. $2\cdot \omega$ is $\omega$-many (countably many) linear orders of $2$ numbers, just giving a linear order isomorphic to the natural numbers.
Comment: @user10676, yes, this notion of even/odd for ordinals is just the standard ordinal arithmetic, known since the time of Cantor, and is used frequently in set theory. In transfinite constructions, for example, you can interleave two transfinite processes by doing the first on the even ordinals and the second on the odd ordinals.
Comment: Does this actually answer the question? Sorry but my grasp of mathematics isn't good enough to understand it. Also, ∞ is an odd creature in that if you add to it it still remains ∞. Which leaves the question of whether the property odd/even is exclusive in the unlikely case where a value of some sort could be both.
Comment: @JDH Do you *really* think that your children truly understand the concept of a limit ordinal, and why such limit ordinals are considered even, why such parity ordinal arithmetic is consistent, etc?
Comment: Regarding my idea above that an honest and natural way to answer kids' questions about 'infinity' is to understand 'infinity' as meaning $\omega$.  Ten years on I still think this was a good approach.  [I wrote up a blog post, "how to explain infinity to kids"](https://blog.plover.com/math/infinity-for-kids.html) with more details about this.  My experiences closely match those of JDH.
Comment: @JDH: Some naive questions: Can you explain to me what you mean when you say $\omega+1$ is odd while $\omega$ is even?  What confuses me is that $\omega=\omega+1$, so I don't know how to interpret this statement.  Also, why is it that $2\cdot\beta=\beta+\beta$ does not always hold?  What exactly is the meaning of $2\cdot \beta$ then?
Comment: Is there any application of this notion ? Or is it just a definition which extends the one on finite ordinals ?
Comment: Henrik, I think JDH did a good explaination saying, something is even, if one can pair a set with that cardinality. (Or for ordinals a linear order.) E.g. $4$ is even because you can pair $4$ apples, without leaving a single behind. The same can be made to understand for infinite many apples. (OK, here it can also be paired such that a single apple is left behind, but it is all about the definition :D)
Comment: Lol, it would appear so ;)
Comment: I added an addendum about explaining the concept to children, which in my experience is possible.
Answer: I suggest that you read the discussion at Is infinity a number? first (since of course you need to answer that question to answer this question). There are some senses in which infinity is a number, and there are some senses in which infinity is not a number, and it all depends on what exactly you mean by "number," which in turn depends on what applications you have in mind.
On the other hand, there is a useful sense in which infinity is even. To explain this we have to replace "numbers" with cardinalities of sets.
Definition: A set $S$ has even cardinality if it can be written as the disjoint union of two subsets $A, B$ which have the same cardinality.
In other words, we need to be able to divide $S$ into pairs. This definition reduces to the ordinary definition for finite sets, but an infinite set always has even cardinality. For example, the cardinality of the natural numbers $\mathbb{N}$ is even because we can pair up even numbers with odd numbers.
This definition of "even" came up in my answer to this question, where precisely the above property turned out to be relevant.
Comment: An interesting thing about this definition of "even" is that there is a model of ZF where the axiom of choice does not hold but for all infinite cardinals $a+a=a$.
Comment: @Asaf, do you know anything about the equivalence or (likely) inequivalence over ZF of the assertion that every infinite set can be partitioned into pairs (subsets of size 2) with the assertion that every infinite set can be partitioned into two equinumerous sets? The second implies the first, by considering the bijection, and for linearly orderable sets, the first implies the second, by considering the two projections of the pairs. These two concepts seem to get at the heart of "even-ness" for infinite sets, but it is not clear that they are equivalent without the axiom of choice.
Comment: @JDH: yes, I was worried about that, too, but decided it wasn't a technicality worth mentioning at this level. Might be worth asking on MO...?
Comment: I don't know the full answer offhand, and I think it would be a good MO question. The issue appears to be a uniformity issue in the pairs, that is, whether one can uniformly pick an ordering on the pairs. So I think it is likely equivalent to AC for families of pairs, since this is what it would take to turn a partion into pairs into a partion into firsts and seconds, which would then be equinumerous.
Comment: @JDH: Take the model in which we add a countable set of pairs without a choice function, the union of this family of pairs is infinite, can be split into pairs, but it is Dedekind finite, since splitting will require choosing from infinite many pairs.
Comment: @Asaf, perhaps that model will work, but are you suggesting that infinite Dedekind finite sets cannot be split into two sets of equal size? This is isn't true in general, since if $A$ is infinite Dedekind finite, then so is the set obtained by having two disjoint copies of $A$, which is clearly splittable. You seem to be addressing $a=a+a$ rather than $a=b+b$.
Comment: @JDH: Oh, you are correct. I was thinking about amorphous sets. I will look into it a bit later today. Also the model I gave does not work, since you can obviously take all the pairs which are of even/odd coordinate (there are $\omega$ many pairs).
Comment: @JDH: I think that I have a proper answer, take a model with countably many Cohen real adjoined to it, and permute the forcing such that not only there is no choice function on the pairs, but the set of pairs is amorphous. The union of the pairs is infinite, and if it can be split into two equinumerous sets that means that either you have split the pairs into two equal parts - which you cannot do; or that you chose one from infinitely many pairs - which you also cannot do. The construction is probably very technical but rather straightforward, I do not mind writing it up sometime if you want.
Comment: @Asaf, I posted a question about this at MathOverflow (http://mathoverflow.net/questions/69461/on-the-difference-between-two-concepts-of-even-cardinalities-is-there-a-model-of). Please post a fuller account of your remark there. Your argument seems to separate the two notions of even-ness, but it doesn't actually seem to answer my question above, which is about whether there is a model where *every* infinite set can be divided into pairs, but some cannot be cut in half.
Comment: @JDH: Very well, thanks.
Answer: Be aware there are many different notions of infinity in mathematics, so  the answer to your query will depend on the particular notion of infinity that you have in mind, and how it interacts with the operations and relations of the extended "number" system. For example, if your notion of $\infty$ satisfies $\:1 +\infty = \infty\:$ then this may yield an obstruction to  extending parity arithmetic.
Here is a simple example that has some hope of being comprehensible to a 6-year-old. I will explain it in a language that is hopefully comprehensible to  his 38-year-old father. Consider the ring of polynomial functions with integer coefficients, i.e $\rm\:\mathbb Z[x] = \{\: a_0 + a_1\ x\ +\:\cdots\: + a_n\: x^n\ :\ a_i \in \mathbb Z\:\}\:.\:$ If we consider these functions in a neighborhood of $\rm\:+\infty\:$ we obtain an ordered ring. Namely, define $\rm\ f(x) > g(x)\:$ if this holds true on some neighborhood $\rm\:(x_0,\:+\infty)\:$ of $\rm\:+\infty\:,\:$ i.e. if there is some $\rm\:x_0\:$ such that it holds true for all $\rm\:x > x_0\:,\:$ i.e. if it is "eventually" true. One easily checks that this is well-defined. Indeed, since polynomials have only a finite number of roots, they eventually have constant sign. Thus if $\rm\:f\ne g$ then eventually $\rm\:f-g > 0\:$ or $<0$ so eventually $\rm\:f>g\:$ or $\rm\:g>f\:$. In fact one easily deduces that this is equivalent to defining the sign of a polynomial to be the sign of its leading coefficient (the leading term eventually dominates lower-degree terms). This makes it clear that every polynomial is either positive, negative or zero, and the positive polynomials are closed under addition and multiplication (these are precisely the properties required in general to define a total order on a ring, compatible with the ring operations).
This ring $\rm\:\mathbb Z]x]\:$ has "infinite" elements, e.g. $\rm\:x > n\:$ for all integers $\rm\:n\:$ since $\rm\:x - n\:$ is eventually $> 0\:.\:$ Can we extend parity arithmetic from $\:\mathbb Z\:$ to such infinite elements? In fact we can, in two different ways. First, we can define $\rm\:x\:$ to be even. Since, by the Factor Theorem, $\rm\:f(x) = f(0) + x\ g(x)\:$ for some $\rm\:g(x)\in \mathbb Z[x]\:,\:$ this amounts to defining the parity of $\rm\:f(x)\:$ to be the parity of its constant coefficient $\rm\:f(0)\:.\:$ Alternatively we can define $\rm\:x\:$ to be odd. Again, by the Factor Theorem, we have $\rm\:f(x) = f(1) + (x-1)\ g(x)\:$ for some $\rm\:g(x)\in \mathbb Z[x]\:.\:$ Since $\rm\:x-1\:$ is even, this amounts to defining the parity of $\rm\:f(x)\:$ to be that of $\rm\:f(1)\:,\:$ i.e. the sum of its coefficients. Both definitions lead to a consistent parity arithmetic in the extension ring $\rm\:\mathbb Z[x]\:.\:$ But in general there is no compelling reason to decide which parity we should assign to the infinite element $\rm\:x\:.\:$
In contrast, there are "number" systems extending the integers where parity arithmetic has a unique extension. For example, the rational numbers (fractions) expressible with odd denominator have parity arithmetic given by defining the parity of $\rm\: m/(2\:n+1)\:$ to be the parity of $\rm\:m\:.\:$ Also the Gaussian integers $\ m + n\ i\:,\ m,n\in \mathbb Z\:,\ i = \sqrt{-1}\:,\: $ have parity arithmetic given by defining $\:i\:$ to be odd. On the other hand, there are also such number rings with no extension of parity, or with numerous possible extensions. For further discussion see my post here.
Also, as JDH mentioned, parity arithmetic extends in some sense to more exotic structures such as ordinals, which may or may not satisfy your definition of a "number". Based on a few decades teaching such concepts, I suspect that you'll have much more luck teaching a 6-year-old a concept of parity of polynomials vs. ordinals. Indeed, my experience is that many adult educated layfolks have difficulty comprehending ordinals (I've had hundreds of interactions with such adults based on my popular posts about Goodstein's Theorem, e.g. see my sci.math post of Dec 11 1995; update: now migrated here).
A nice introduction to the many different notions of infinity in mathematics is Rudy Rucker's book: Infinity and the Mind. Unlike many other popularizations, the author has expertise in the field, having completed a Ph.D. on a related topic. Moreover, Rucker has gone to great lengths to make the presentation faithful to the mathematics but still accessible to an educated layperson.
Comment: The concept of an "educated layperson" seems to me contradictory in nature.
Comment: @dberm22 If you search on this and closely related phrases you will find that they are commonly used, e.g. [this Google search.](http://www.google.com/search?q=educated+lay+person)
Comment: You are also welcome to comment to my answer to this question that I posted in December.
Answer: JH Conway's Surreal Numbers have a well-defined notion of Omnific Integer which extends the definition of integer from finite numbers. I believe this splits infinite integers between odd and even numbers according to whether they are twice an integer or not, and such that Omnific Integers which differ by 1 always have opposite parities.
I would not recommend the theory to a 6-year-old, but Knuth's "Surreal Numbers" would be a good introduction for his father, and might give some interesting ideas on how to explore the idea of numbers with a child who is asking interesting questions.
Comment: +1, esp. for the remark that it is not recommend for 6-year-olds. I find it quite bizarre that anyone thinks that a 6-year-old has any hope of comprehending ordinals (let alone surreals). This would be a challenge even for most prodigies at age 6.
Answer: "Infinity" is not a number, but there are numbers that are infinite, including cardinals, ordinals, infinite nonstandard reals, and other things.  Some of those can be considered even numbers.
The "infinity" you encounter in calculus would not normally be considered a number.
There are also other notions of "infinity", such as the ones involved in the Dirac delta function and its derivatives.  But it's hard to see how to view those as being numbers.
Answer: Look at this my answer. In that approach the "numerocity" ("refined cardinality") of natural numbers is denoted $\omega_-$ and the numerocity of non-negative integers is $\omega_+=\omega_-+1$. Similarly, the numerocity of all integers is $\omega_-+\omega_+$ and the numerocities of either odd or even numbers are $\frac{\omega_-+\omega_+}2$.
Now, we can ask a question, whether we can generalize the concept of even and odd numbers to those infinite numbers, for instance whether $\omega_+$, $\omega_-$ or $\frac{\omega_++\omega_-}2$ are even or odd?
It seems to me that we can, but we have several choices with no one looking more natural than others.

$\omega_-$ has resemblance to $0$ (we cannot divide by it or take logarithm) and $\omega_+$ resembles $1$. Also, regular parts $\operatorname{reg} (\omega_-)^n=B_n(0)$ and $\operatorname{reg} (\omega_+)^n=B_n(1)$ So, there is a reason to count $\omega_-$ as even and $\omega_+$ as odd.
On the other hand, the regular part of $\omega_-$ is $-1/2$ and that of $\omega_+$ is $1/2$. So there is a reason to count them both neither even nor odd and count their mean $\frac{\omega_-+\omega_+}2$ as even since it has regular part zero.
The logarithm of $\omega_+$ has regular part $-\gamma$, if we exponentiate the regular part of the logarithm, we come to a conclusion the absolute value-like measure of $\omega_+$ is $e^{-\gamma}$. So, there is a reason why we better consider $\omega_+e^\gamma$ as an odd number...
Comment: @JDH your comment?

Is infinity an odd or even number?


Click DirectX Button from Windows Forms

Question: I have a windows forms application where I would like to find the handle of a DirectX application, find a DirectX button in that window, and Click it.
Is this possible, and if so, where is the best place to start?
Thanks!
Answer: This is really not possible.
Unlike Windows Forms, a "DirectX Button" has no distinct windows handle.  You don't actually "click" a button in a DirectX window, but rather send a mouse click to the entire DirectX window, and allow the application to do its own hit testing to "click" the "button" (which is just a graphic).
The closest you could do would be to send a mouse click to a location within the window - however, finding the location of a "button" could be very difficult.
Comment: Oh, Well. Then that's too much work for the simple task I was hoping to accomplish. Thanks though ;)
Answer: Actually, it isn't too difficult if that is the case. A DX object can receive an click if you can isolate the object with the mouse through a reversal system, depending if it is 3D-based or 2D-based. 2D is using masking effects, and 3D adds on to translate to and from 2D/3D based space on certain properties utilized in vector calculus.
Pretty much from logical space, in 3D, a slice of the 3D object is mapped to 2D space, which is then mapped to camera space, which is then rendered. Crude, there is much more to it then that, but I'm keeping it as simple as it can be. Now the task is to find the 2D volume/per-pixel location, translate a copy of the 2D render of a 3D object on an image that will be/is already a DeviceContext for the monitor to show () to a map, and unionize a clickable object (which will run the intended code, just as a button should) to the 2D map object copy.
In other words, find where in the screen the object is rendered and generate a clickable mask over the rendered portion of the screen. Whether it is a bitmap mask, or a polygon mask, or a cube mask, or any other shape you can mathematically create; so long as the 2D clickable object actually interfaces with the mouse position and state in an constant-update system.
For example, say that application is full screen, that the resolution is 800 x 600 (keeping it simple, it could be anything), and that the object you wish to be able to interact, that is rendered in a context that doesn't permit it of it's own accord (*1), and that the rendered object shows a rectangle. Lets say that is the point of it, and the system you use for the translation outputs a Rectangle (C#.NET code, yea, but it's just an example, there are better floating around). So we can say that the mask rectangle coordinates are identical to to the rendered object coordinates.
So let's say: "Rectangle mask = new Rectangle(100, 100, 200, 100); // X starting point, Y starting point, Length, Width." Pretty self-explanatory. Add a per-frame cursor position compared with mask positions, will indicate if the cursor is above the mask, and with extra coding, can indicated if the cursor clicked (or other events) while being within the mask's range.
So let's say the button opens the main menu. And an event happens, particularly a "MouseClick" event, while the cursor hotspot is at Point(125, 200). Which of course was in the range of the mask. In this instance, through all that trivial code, opens the main menu. It is easy to add new clickable objects within this system if it is done right.
Yes, other, easier ways exist. But from them all, this is one of the more dynamic and flexible systems. Uses range from the cash you get as loot in a game that you have to click to pick up, to the UI, to the menu's, to anything clickable. The range isn't in just games, either. Custom UI designers who like to reinvent the wheel can and have taken advantage of similar systems, such as myself, like to define every aspect from the microcode to the macrocode. Precisely, to define the macrocode as it is needed, as it is expected and without unnecessary bloat through microcode management. Not saying I like microcode, as it can be way too bloody finicky, and often times, is. Worth it for the few hundred FPS you get from streamlining it right (the first time), though... >:-D
*1 = (predictable  in 3D Rendering models, from the point of view Rendering is not Modifying (which seems to be including object selection (through the mouse/cursor position and all that), which is essentially what your looking for) and as such not included (directly). Through translation it becomes possible, with the finest precision if done right. Further to that, DirectX, OpenGL, and others like, are defaultly Renderers.)
Comment: Very interesting, though complex for my brain. If you could provide an example it would be helpful ;)

Click DirectX Button from Windows Forms


How to create an Iptables rule using domain name

Question: Can anyone please suggest a way to use a domain name in iptables rules.
Answer: If it is all possible please consider setting up a transparent application-level proxy.  An application proxy will probably be much easier to do this type of filtering with.
If you must do it with iptables a kludgy option would be to create a chain, create a command line script that periodically updates that particular chain with the results from DNS for the name you need to use.
If someone was going to attempt to create such a thing that truly did packet-filtering based DNS it would almost certainly have to be done via userspace.  Specifically you would use something like libnetfilter_queue.  I have never used it, but Packetbl may be close to do this,  but it doesn't appear to be very well maintained.
Another alternative might be to setup Layer 7 filtering.  You might be able to filter a portion of the request if DNS name is being transmuted as part of the payload of the packet.
Answer: Short answer, if you are sure the IP is static forever:
iptables -A INPUT -s `dig host.your-domain-name.com +short`/32 -p tcp -m tcp --dport 22 -j ACCEPT

Comment: I don't think you need the `/32`. Also, what happens if the `dig` command fails?
Answer: I needed iptables to allow ssh access based on domain name from my home ip but wanted to keep it closed for all other addresses. Since I have a dynamic ip that changes occasionally, I wrote a script to update the rules based on the ip of my dynamic dns entry. I'm new at this so I'm sure there is a better way. Replace "yourname" with your dynamic dns hostname.
#!/bin/sh

/usr/bin/nslookup yourname.dynalias.org > temp
found=0
address=""
while read LINE
do
 if [[ "$LINE" == Address* ]]; then
        let found++
        if [[ $found == 2 ]]; then
                address=${LINE:8};
                /sbin/iptables-save > /root/rulesdump
                while read LINE2
                do
                        if [[ "$LINE2" == *$address* ]]; then
                                ruleexists=1;
                        fi
                done < /root/rulesdump;
                if [[ "$ruleexists" != 1 ]]; then
                        /sbin/iptables -D INPUT -j LOG_DROP
                        /sbin/iptables -A INPUT -s $address -p tcp -m tcp --dport 22 -j LOG_ACCEPT
                        /sbin/iptables -A INPUT -j LOG_DROP
                fi
        fi
 fi
done < /root/temp;

Put the above script in crontab to run every so often.
Comment: Its hard for me to decipher whether you do remove old IPs or not. I would also consider using a separate chain so you could make a more straight forward "here's all the new config, just replace the old" approach.
Answer: Same thing in ruby and shorter:
#!/usr/bin/env ruby
require 'resolv'
ip = Resolv.getaddress "mydomain.com"
`iptables -A INPUT -p tcp --dport 22 -s #{ip} -j ACCEPT` if `iptables --list` !~ /#{ip}/

Comment: Please note that your script would never remove old IPs AFAICT.
Answer: Since Linux 2.4.x, you have ipset that can be used to create a set of IPs without having to tweak your firewall rules.
# create the ipset (it may exist)
sudo ipset create dynamic_ips hash:ip -exist

# add a rule where the source IP must match that ipset
sudo iptables -A INPUT -p tcp -m tcp --dport 22 --syn \
               -m set --match-set dynamic_ips src -j ACCEPT

Now that rule will match only if the computer trying to connect has an address that matches the addresses found in dynamic_ips. While the set is empty, nothing happens (it cannot match any IPs). We add a new IP address to the set with the following command:
sudo ipset add dynamic_ips 10.10.10.10

To see what you currently have in your set, use the list command like so:
sudo ipset list dynamic_ips

Now, to update the list, you actually want to do that atomically. This is done using the ipset swap ... command. For that to work you create a new set and swap it with the old set. Internally, it's just a rename so you can have very large sets and the time it takes to swap them remains constant.
Here is the sequence of events I would propose:
# destroy the new set in case something went wrong and it lingered
# ignore errors if the command fails
sudo ipset destroy new_ips

# for the following, fail on error

# create the new set
sudo ipset create new_ips hash:ip

# determine the list of ip(s)
new_ip=`dig example.com +short`

# add the ip(s) to the set
for ip in $new_ip
do
    sudo ipset add new_ips $ip
done

# finally swap the sets
sudo ipset swap dynamic_ips new_ips

# remove the old set, safer & saves some memory
sudo ipset destroy new_ips

As we can see, this is 100% atomic and can be done without tweaking the iptables rules, which is generally ill advised.
Note:
If you are absolutely sure that the domain name resolves to a single IP address, then you can directly use the domain name on the ipset command line:
sudo ipset add dynamic_ips example.com

The problem which the script above resolves is when more than one IP address is returned by a lookup to that domain name returns more than one address, then the ipset command only picks the first IP.
Also, here I've shown the commands to handle IPv4. You have another set of commands to handle IPv6 IP addresses. Make sure to use the correct set or handle both as required.
For example, to create the correct set:
sudo ipset create dynamic_ip4 hash:ip family inet
sudo ipset create dynamic_ip6 hash:ip family inet6

And you will have to add IPv6 to the dynamic_ip6 set.
For more documentation about sets, try man ipset.

Final words: although blocking all IPs except yours is pretty safe, it is possible for a good hacker to pretend that his connection is coming from your IP address by forging his packets. Therefore, it is a great protection, but your server is still penetrable. Another addition is to use port knocking. I have my own solution (post includes the iptables rules) to set that up with the ipload tool found in my iplock project. Mixing both, your IP and port knocking, it becomes nearly impossible for a hacker to access your server (there is, of course, your secret key as well... so that makes it three protections to crack).


Sharepoint 2013 On Prem Attachment loading issue

Question: I am facing issue while loading attachments from my intranet sharepoint site. While opening attachments it is keep on loading and says sharepointserver took too long to respond and unable to load the document. Can anyone provide me an insight about this issue. This is happening only while trying to open the attachment files.
Answer: Did the issue occur in all file types in the site?
Did the issue only occur in one site or all sites in SharePoint farm?
To troubleshoot the issue, check things below:

Clear IE cache and re-open IE.
Create a new site, create a new list and attach a file to check if the same issue will occur.

3.Reboot the SharePoint server.
You could improve the SharePoint performance according to the article below.
10 steps to optimize SharePoint performance.
Top 3 Ways to Improve SharePoint Performance.
Answer: Do you know how to troubleshooting using ULSViewer for SharePoint logs. If yes, you can track the problem with ULS Logs. You can learn how to troubleshoot with ULSViewer from these addresses: https://blogs.technet.microsoft.com/fesiro/2013/11/11/sharepoint-logging-and-troubleshooting-using-ulsviewer/ https://hasankoroglu.com/2015/12/29/sharepoint-hata-yakalama/


How to create a bot for a real-time PvP game using machine learning?

Question: Unfortunately, I am not well-versed in machine learning. However, I'm trying to understand if it's possible to create a bot for a real-time PvP game like, for example, Clash Royale or Random Dice: Wars. Can you please advise if the current state of open-source technologies allows for this? What tools would you recommend?
Answer: Creating a bot for real-time PvP games raises ethical concerns and is often against the terms of service of the game. Using bots to automate gameplay can provide unfair advantages and is generally considered cheating. Game developers invest a lot of effort in creating fair and enjoyable experiences for players, and the use of bots can undermine these efforts.
It's essential to respect the terms of service of the games you play and avoid engaging in activities that may result in penalties, including the suspension or banning of your account.
If you are interested in exploring machine learning or AI in a gaming context, I would encourage you to focus on projects that align with ethical considerations and contribute positively to the gaming community. This could involve creating AI opponents for single-player modes or developing tools that enhance the gaming experience without providing unfair advantages.
Comment: Your response is not an answer. Please write a comment.
Comment: As for your opinion, you are looking at the task too narrowly. Bots of this kind can be used by game developers themselves, for example, for testing or assisting in match-making.
Answer: You can create a bot that can play a game and learn to get better at it through reinforcement learning.  This is actually a pretty common thing people do to play around with AI.  It looks like pytorch even offers a "Teach an RL Agent to Play Mario" tutorial as part of their docs.  I'd say run through a few tutorials like this one and then it's just a matter of adapting to PvP by having your bot play itself and other people.
https://pytorch.org/tutorials/intermediate/mario_rl_tutorial.html


Preview testnet transactions

Question: I want to access an address that is on preview testnet and create transactions to spend all tADA. How can I do something like this?
Answer: You first need to generate keys to derive an address from. Addresses that are already in use are not accessible unless you hold the associated signing key.
One way to get started is with the cardano-cli. See https://docs.cardano.org/cardano-testnet/getting-started
Answer: The easy way: https://namiwallet.io

Install browser-extension wallet, such as Nami
Restore your wallet with the mnemonics and the passphrase
Set Nami to use preview testnet (default is mainnet)
transfer tADA to the address you so choose

The hard way: cardano-cli

Install/run cardano-node by: https://developers.cardano.org/docs/get-started/installing-cardano-node
Restore wallet and create transaction by cardano-cli like: https://developers.cardano.org/docs/integrate-cardano/creating-wallet-faucet

The not-so-hard way: https://blockfrost.dev

Preview testnet transactions


Higher inductive types in higher observational type theory

Question: Mike Shulman gave the following set of talks on higher observational type theory earlier this year (part 1, part 2, part 3). However, while he talked about how the identity types are defined and behave in higher observational type theory and how univalence is a theorem in higher observational type theory, he never talked about higher inductive types. So, how are higher inductive types defined in higher observational type theory, and do they behave differently from higher inductive types in Martin-Löf type theory?
Comment: Also, FWIW, I don't think it works very well to ask questions about other people's unpublished work-in-progress on stackexchange.  You'd probably have gotten a faster and better answer by just emailing me (or Thorsten or Ambrus) directly.
Comment: This question is asked and (briefly) answered in part 1, 1h21'35"
Answer: This is work in progress.  There are issues with defining ap on the eliminator in the absence of diagonals that will probably make HITs less ergonomic than in cubical type theory, but I have hope that they can be made no less convenient than in Book HoTT.