How can I handle computationally expensive operations on the blockchain?

Question: Sometimes a blockchain application needs to perform an operation, such as a scrypt verification, that is extremely computationally expensive.  Are there any techniques that can help me design around this problem so that my application doesn't have to pay enormous fees?
Comment: Also see the previous, similar question: https://ethereum.stackexchange.com/questions/22/are-there-any-best-practices-for-optimizing-computations
Comment: Posting an answer to this question now, which will help to show how these two questions are actually slightly different from each other.
Comment: There.  As you can see, the objective of this question is to "design around the problem" by taking the computation off chain, whereas I'm taking the other one to be about the performance optimisation techniques used in on-chain code.
Answer: Yes, there are!  Although the Ethereum scripting language is Turing Complete and therefore able to perform any possible computation, there is a simple way to remove many types of difficult computation from having to be performed directly on the blockchain itself, by making use of deposits, challenges and verifications.
Take the example of verifying a scrypt operation.  My application might have some data, and it wants to know what the scrypt hash of that data is in order to compare it against a reference or to check a certain property of the hash (for a mining algorithm, perhaps).  Instead of computing the hash immediately, the application can instead allow anyone to submit the hash of the data themselves, along with a deposit.  The purpose of the deposit is so that submitter can be penalised if they submit an inaccurate hash, and for the sake of our example let's assume the deposit is large enough to cover the cost of computing the operation on the blockchain if necessary, in addition to the penalty.
Next, the application holds a challenge period so that external observers have a chance to check on their own machines if the data in fact hashes to the claimed value.  Because this operation is performed by only a few observers instead of the entire blockchain, this is a total savings in terms of resources.  During the challenge period, if any of the observers discovers that the submitted hash is inaccurate, they submit a transaction to that effect containing their own counter-deposit.  Again we can assume for the sake of our example that the deposit is large enough to cover the costs of verifying the hash on chain.
Now the application merely needs to check the result and return the remainder of the deposits to the party who was proved correct, along with an additional reward of some kind for a correct hash.  Or, if no challenge was submitted during the challenge period, the application can merely return the reward along with the deposit to the original user, without performing any verification.  With this technique, users who submit correct hashes or challenges receive a reward for their efforts, and if they submit incorrect hashes (or incorrect challenges) they pay a large penalty.  The incentives ensure that any misbehaviour is a losing strategy, and the application developer themselves can play the role of both submitter and challenger to ensure the application operates as desired.  Because observers will not pursue losing strategies, the application will almost never have to actually verify the hash.
An advanced version of this technique would give the "caught" submitter with an incorrect hash an opportunity to "fess up" in return for a lower penalty, so that even in the event an invalid hash is submitted, verification will not need to be actually performed.
More elaborate techniques are also possible involving zero knowledge proofs, but this basic deposit-challenge-verification approach requires no complicated mathematics, and incurs a lower computational cost than most zero knowledge proof techniques.
Comment: Proof-of-Concept for this idea is located here: https://github.com/pipermerriam/ethereum-computation-market
Comment: Doesn't this open up a possibility of an attack, where an attacker controlling multiple addresses gives an invalid hash. If the number of attacker controlled addresses is greater than the number of valid hashes submitted in transactions by legit users the attacker wins in a sense that your application will always pick the majority correct hash (since it does not actually compute the hash on its own). Another issue is with respect to the reward; only one submitter is rewarded (continued)
Comment: (continued) but there may be several valid hashes submitted submitted by users who will not get anything for the invested computation and time.


Rejected question edit

Question: As the code on this post is really compact and hard to read, I made an edit to improve it.
However, the author rejected it because this "deviates from the original intent of the post".
I do not agree, I did not changed the meaning or behavior of this code.
Comment: Is there a question here?
Answer: Based on the diff in the suggestion, you did change random things: n=0 became n=1, an ((n++)) went missing, as did a skip=0 argument, possibly other things. Changing code in a question is risky because it could inadvertently confuse others trying to post an answer or the asker trying to understand answers based on the modified code. The asker wants to see answers based on exactly what they were doing, not based on the new version someone else came up with.
Comment: @user285259 even if your changes are correct, they should not have been made on a question. Edits improving code are fine on answers, but not on questions since you might be removing the very error that was causing the problem in the first place. Instead, next time post an answer correcting the code and pointing out whatever errors you might have found.
Comment: Thanks for your answer.  The argument `skip=0` for `dd` just do nothing, it is the default, so i simplified.  The initial value of `n` is now clear, it was set to 0 and incremented before first use.  I merged the two `((n++))` to only one, and moved it at the bottom of the loop, this is the canonical form.  Values of variables are strictly preserved for all commands.

Rejected question edit


Mordell-Weil and finiteness of rational points

Question: Let $E$ be a CM elliptic curve defined over a quadratic imaginary field $K$ with maximal order, that is, $\mathrm{End}_K(E)\cong \mathcal{O}_K$. Suppose the class number of $K$ is equal to $1$. Let $\mathfrak{p}$ be a prime ideal of $\mathcal{O}_K$ which satisfying $E(K)/\mathfrak{p}E(K)=0$. In this case, is it possible to derive finiteness of $E(K)$ using Mordell-Weil?
Comment: "Using Mordell-Weil" ? If you know that $E(K)$ is a finitely generated $\mathcal{O}_K$-module, then it is quite clear that $E(K)$ won't contain a copy of $\mathcal{O}_K$ using the decomposition theorem for finitely generated $\mathcal{O}_K$-modules because $\mathcal{O}_K/\mathfrak{p}\neq 0$ .
Comment: @ChrisWuthrich I am sorry, could you explain more details? In general, for a fixed ring $R$, a finitely generated $R$-module contains a copy of $R$, doesn't it?
Comment: No. $\mathcal{O}_K/\mathfrak p$ is a counter-example for $R=\mathcal{O}_K$ and $\mathbb{Z}/2\mathbb{Z}$ a counter-example for $R=\mathbb{Z}$.
Answer: Let $Q\in E(K)$. Since $E(K)/\mathfrak{p}E(K)=0$, we know that $Q\in\mathfrak{p}E(K)$. You've assumed that $\mathfrak{p}$ is principal, say $\mathfrak{p}=(\pi)$, so $Q=u_1\pi Q_1$ for some unit $u_1\in\mathcal{O}_K^*$ and some point $Q_1\in E(K)$. Repeating $n$ times, we get $Q=u_n\pi^nQ_n$. (For simplicity, I'll assume that $p=N\mathfrak{p}$ is odd.) Then the easiest way to finish the proof at this point is probably to use canonical heights to conclude that
$$ \hat h(Q)=\hat h(u_n\pi^nQ_n)=p^n\hat h(Q_n). $$
Next we observe that
$$ h(Q_n) = \hat h(Q_n) + O(1) = p^{-n}\hat h(Q) + O(1), $$
so $(Q_n)_{n\ge1}$ is a set of bounded height in $E(K)$, hence is finite. Hence we can find $n>m$ with $Q_n=Q_m$, and hence
$$ Q = u_n\pi^nQ_n = u_n\pi^nQ_m = u_nu_m^{-1}\pi^{n-m}u_m\pi^mQ_m = u_nu_m^{-1}\pi^{n-m}Q. $$ Therefore
$$ (u_nu_m^{-1}\pi^{n-m}-1)Q = 0, $$
which proves that every point in $E(K)$ is a torsion point.
(There may well be easier ways to do this, but this is the first thing that occurred to me.)
Comment: Maybe, I cannot get the result just from the statement of Mordell-Weil.
Comment: The proof of MW has two parts, first show $E(K)/mE(K)$ is finite, then use heights to deduce finite generation of $E(K)$. So you just want to use the fact that $E(K)$ is finitely generated, without using heights. Doesn't the fact that $Q$ is infinitely $\pi$-divisible contradict the finite generation of $E(K)$ (assuming that $Q$ is non-torsion, of course)?


How prop 8 (1978: Property Tax Reduction) works in California?

Question: If I understand correctly, then in California Prop 8 is supposed to give peace of mind to home buyers by providing temporary property tax relief in case housing market crashes soon after they bought a home.
Had two questions how prop 8 works in real life:

When there is market down turn, how is the reassessment value determined under prop 8? To me it seems that assessors have a lot of leeway and could treat different homeowners differently by assessing higher values to some and lower to some?
In case of market crash, can homeowner make the value assessed under prop 8 permanent by having a triggering event that would require value reassessment (e.g. by starting home remodeling works or by making changes to home ownership)? Basically he could lock in lower cost basis that would allow homeowner to enjoy benefits under prop 13 (that limits 2% increase to assessed value) for few more years in case there is sharp price rebound in next few years? Obviously, if this is possible, then this sounds like winning strategy.
Answer: You contact your county assessor's office if you think you've had a decline below your base value. Each county is different, but generally they just want to see some kind of a justification.
A triggering event such as a sale does indeed lead to an assessment and establish a new base value from which prop 13 limits are based, making the temporary prop 8 reduction obsolete. A remodel may or may require an assessment, though. Best to check with county assessor's office.


「noun」は、「noun」でも代用かのうです。 - What is the role of でも here?

Question: For example if you have the sentence "ストッキングは、靴下でも代用かのうです。"
Is でも a single word or is it the で-particle followed by the も-particle? If the latter one is the case, then も can be left off right?
Answer: Basically it's で ("with") followed by も ("even/also"), but the nuance added by this type of も is not large. See: Nuance between でいい and でもいい
靴下で代用可能です is "substitutable with socks", and 靴下でも代用可能です is a little closer to "substitutable also with socks", but in a sentence like this, も is unimportant and optional. It's okay to ignore も and just translate it simply like "you can use socks instead".
Answer:
ストッキングは、靴下でも代用かのうです

I would say that this も means "or the like". This meaning comes from the all-mighty "also". で is the particle that marks what thing you replace with.

You can replace ストッキング with 靴下 or the like.

I mean by omitting も, you could be implying that you can only replace it in that particular way.
For example

テープが無くなったので、のりで代用する。
Tape has run out so we will substitute it with glue. -> We run out of tape, so we will use glue instead.

Note that you  will use glue and nothing else.
So, it's pretty neat that they included も in the answer because it implies that you may replace it with other words but also 靴下 in particular.

「noun」は、「noun」でも代用かのうです。 - What is the role of でも here？


Apple ID review information

Question: I tried downloading apps with my new Apple ID and it asked me to review it. After filling in the information it shows an error and asks me to insert a billing address with atmost 70 letters or numbers. My address that I mentioned is correct. How do I get past this?
Answer: Have you tried logging on to the iTunes store on your computer rather than an iOS device?
That will usually allow the account to settle and allow you to start purchasing apps.
Answer: I would enter the first 60 letters of the address field in question to get the computer to accept things.
Then you could use your postal website (or local postmaster) to determine if your address has a suitable official abbreviation to make it both correct and amenable to the field limits Apple has.
You can also always contact Apple Support to get assistance in correcting your Apple ID and store account information.

http://www.apple.com/support/appleid/

Apple ID review information


What alternatives exist to Spring Batch to handle queued jobs?

Question: I have been looking in to Spring Batch to solve a batch processing scenario with huge amount of data involved in each job. Are there any other solutions that compete with Spring Batch? To be used in a Java EE environment.
Comment: I think https://camunda.com/ can also be used as an alternative. you can use Camunda Platform 7 as an embedded engine to orchestrate their Java code (using Spring Boot or Tomcat)
Answer: Batch support is now available in Java EE 7 via JSR 352: Batch applications for the Java platform.
See Batch Applications in Java EE 7 - Undertanding JSR 352 Concepts for some more info.
Answer: Well the uber-king of big-data batch processing is Hadoop, but that can be rather tricky to set up, to put it mildly.
Answer: There is also JobRunr - It is a port of Hangfire to Java.
It allows to schedule simple Java 8 lamdbda's as follows:
<code>BackgroundJob.enqueue(() -> System.out.println("this will be done in a background process, perhaps even on a different server"));
</code>
More info on https://www.jobrunr.io or https://github.com/jobrunr/jobrunr.
P.s.: I'm the creator of JobRunr so I might be biased.
Comment: hello, is there anyway to try batch processing without purchasing? it is good if there is key and expires after 1 week. i compare same task by using spring batch and jobrunr-spring-boot-starter in terms of usage and time complexity
Comment: Please mail me at firstname.lastname@example.com to see what we can work out.
Comment: @rdehuyss Is it possible to combine Spring Batch with JobRunr?
Comment: @trshiv: I think it would be possible (I haven't tried it, though), but I don't see the added value of combining the 2 of them.
Answer: Akka is a nice solution too for precessing small tasks http://akka.io/
Answer: Try easyBatch. The simple stupid Batch framework.
Try it once and use it forever.
https://github.com/j-easy/easy-batch


Good LaTeX template for book about maths

Question: As I want to write a short "book" about Analysis I would like to work with a template which is good enough for readability, looks good and furthermore can handle dozens of my theorems, axioms, corollaries etc. by layouting them as good as possible. Can anyone suggest or even provide a good template which satisfies my needs?
Comment: Possible duplicates: [How to write a book in LaTeX?](http://tex.stackexchange.com/q/16835/5764), [Technical documentation and/or book templates?](http://tex.stackexchange.com/q/20101/5764). And, just because, consider viewing: [Showcase of beautiful typography done in LaTeX?](http://tex.stackexchange.com/q/1319/5764)
Comment: You could have a look at those examples : http://tex.stackexchange.com/a/231572/34551
Answer: i would suggest using the amsbook document class.  it incorporates amsthm and amsmath, and is tuned particularly for use with math-heavy books.  several publishers other than the ams (american math society) base their house packages on amsbook.
for variations in the final appearance (while using exactly the same input), there are several ams "author packages" that format the output in the specified style of the different ams book series.  all are extensions to amsbook, guaranteeing consistency of input handling and the ability to switch smoothly from one style to another if desired.
there are some differences between amsbook and the basic latex book class, principally in the input style of the top matter and in the inclusion of starred chapter and section titles in the table of contents; these are "house style" matters based on traditional ams practices.  these decisions are subjective; your mileage may vary.
amsbook is part of the amscls collection (formerly ams-latex), which is included in the latex "required" components.  all are on ctan and in the tex live distribution.
disclaimer: before my retirement, i was one of the maintainers of the ams-latex collection, and principal support contact when ams authors encountered problems.
Comment: @MartinArgerami -- Yes, I discovered that over the weekend, and have reported it.  The ftp server was permanently disabled recently, but the internal links were not updated; this is awaiting attention.  I will update the link here when I get the new information.
Comment: @niloderoock -- The linked page does lead to links to packages for particular book series, but the desired series must be chosen from a list.  Yes, this answer is still valid, although using it requires more than one click.
Comment: The link to the AMS site is dead. Worse, within the AMS site itself the links are dead (after searching for "author packages" within).
Comment: Did you ever get them? Is this answer still valid?
Comment: Just wanted to be sure, thank you.
Answer: Your question seems a little fuzzy: Readability? Good looks? That's in the eye of the beholder. Likewise, there usually isn't much to a template. It sets up the basic structure of the files that you will input into it (such as the chapters). Since you indicate your book is in Analysis, you should use the amsbook format.  TUG (TeX User's Group) has a AMS book template that can get you started. The AMS (American Mathematical Society) has more in depth information to help authors prepare there books in the style of the AMS here. The link to author monograph packages might be especially helpful.
You should also be aware that most schools with math programs (at least in the US) have LaTeX templates to fit their style: example. Likewise, many book publishers have their LaTeX templates: Springer.
The AMS book template link I provided is fairly basic, but since you are talking about readability, it sounds like you are looking for more than basic. If that's so, consider a math book you like the typesetting on and check the website for their style files.
Answer: Here is the free available algebra book from Jim Hefferon: http://joshua.smcvt.edu/linalg.html/  You can download the sources and have a look into the preamble of
the document. You can get some ideas or use it as a skeleton for your book.
Answer: From someone who has learned the hard way, I think it is best to start with the minimum set of packages:
\documentclass{book}
\usepackage{standalone}%
\usepackage{amsmath}%
\begin{document}
...
\end{document}

I would use the standalone package for dividing your chapters into separately compilable files.
Then add packages only as you need them. There are questions that help you decide What packages do people load by default in LaTeX?.
As you go you'll probably need to select a theorem package (amsthm, ntheorem), a list package (enumitem), and something for doing graphs and figures (tikz, pgfplots).  There are plenty of questions here on selecting those, but I included my preferences in parenthesis.
Comment: For graphs and figures, I find asymptote readable (C++-like syntax) and powerful. Even when running standalone you can freely use LaTeX (and math!) in labels.
Comment: Now, that is a practical answer, sir !


Find SSL Certificate in use

Question: I would like to know which SSL certificate is used for accessing a certain website.
In my browser (Chrome, FF), the icon next to the URL does not show a SSL connection. Also in Chrome it states "Your connection to the site is not encrypted". In Wireshark, however, I have a number of TLSv1 packets that transfer between the site and my machine. Is there any way to find out which certificate it is?
The site contains a flash application. Can this be the reason why Chrome doesn't see the encryption?
Comment: Chances are the page loads unecrypted and the encrypted traffic is sent by the Flash application. When you load up this 'certain website' do you type `https://...` or `http://`?
Comment: no, I checked where the SSL traffic goes from and to. The IP belongs to a server of the same company that runs the website.
Comment: i type http:// and it never changes to https:// while i'm on the site
Comment: is there a way to figure out the certificate used by the flash application?
Comment: Right - you type `http` and so your connection to the server is not encrypted. As for figuring out the certificate, no idea what mechanisms Flash offers. Why do you need this information?
Answer: The SSL traffic could be requests that the Flash application is making, or any subresources on the page (such as  or

Find SSL Certificate in use


How is Triage time limit calculated?

Question: After I review the 20 triage questions, it tells me "Come back in __ hours to review more questions." However, this number has been anywhere from 5 to 11 hours for me. How is that number calculated?
Comment: Have you considered Next Midnight UTC?
Comment: @bcdan, heh, I don't live in the "UTC timezone" either. Right now we're UTC+2. At a vaguely specified point in time next fall, we'll be back to UTC+1, and so on and so forth :)
Comment: 20 reviews a day.
Comment: @FrédéricHamidi I think it is midnight UTC. I do not live in the UTC timezone, so it did not occur to me.
Comment: Take a look at the achievements dropdown, it shows the UTC time.
Comment: @Deduplicator I did not notice the UTC on the achievements. Thanks
Comment: I know I always get a little freaked out when I would see "Come back in 23 hours" :D
Answer: A Stack Exchange "Day" starts and ends at UTC midnight, as explained in this answer to this question.
The UTC time is displayed in the Achievements Menu

How is Triage time limit calculated?


Reading the name of the father of Johann Henrich Illart (Mihla, 1731)

Question: I cannot read the name of Johann Henrich Illart's father from either his baptism nor his burial record.  It looks like "S__ndal" to my eye, and if I'm reading it right, it shows him as being a "Ackerknecht" (farmhand) from Mihla.  I have recorded the names and family tree of every Illart/Illert who should have been alive in Mihla at the time, but cannot match that pattern to any name.
Answer: The first name you are looking for is Wendel. You can find each letter elsewhere: W in Wilhelm (at the top), e and n for example in begraben (right next to the name), d and l in Kindlein (line below).
The last name though is almost certainly Iffart, not Illart, so probably not related to the Illerts you have recently been looking at. Your reading of Ackerknecht as the occupation is correct.
Comment: Thanks.  You're right on the ff, as well.  I noticed another Iffart pop up in the area a couple of decades later.  I'm still planning to keep an eye for Iffarts though,  until I'm sure it wasn't just a case of the priest spelling "ll" as the similarly sounding "ff", rather than an actual separate last name.


Difference between Split Adjusted Stock price vs AdjClose

Question: I know AdjClose contains any corporate change for stock price. I am doing some mathematical analysis for stocks and I want to know what is the difference for Split-Adjusted stock price vs AdjClose and which one should I use?
Answer: It would depend how the data provider is calculating AdjClose, but taken literally, "Split Adjusted Stock price" is adjusted just for splits. AdjClose would presumably be adjusted for splits, but could also be adjusted for any number of corporate actions (e.g. dividends).
In Bloomberg, one can choose with some granularity what to adjust prices by, but you'd need to check with whoever is defining/calculating "AdjClose" for you - it's not a standard term.


Deploy separate web sites azure

Question: I have a single web project that I want deploy in Azure.
I want to create one IIS web site per country and I want to be able to deploy each web site independently (not all of them at a time). How to do this?
Answer: Well,
you have two options:

Use Windows Azure WebSites to host your websites
Use Windows Azure Accelerator for WebRoles or your own project similar to that approach.

However you have to note that the second option is a project that is no longer being supported due to avialability of Azure Websites. With Azure Websites, you can have almost everything you get with the Accelerator. You can host your websites on a dedicated instances, and manage them individually. You can update/deploy your website data via FTP/GIT/TFS/WebDeploy, whichever method you are most happy with. The only downside of websites which I see, is the lack of Startup Tasks and the ability to customize your environment (Windows, IIS settings, etc).
Answer: When you have set up your Azure account you can go the the web sites section and start the construction of your Azure web spaces, the interface in the preview is very straight forward to use and intuitive.
For deployment using the publish command in from Visual Studio 2012 (which I found the easiest) here are the steps you will need to undertake:

For each of your countries you will need to set up the web site
in azure.
Then for each of those web sites you have created go
    to their dashboard page and download the publish profile settings.
It is these settings that you can import into you Visual Studio
    solution by selecting the publish command and browsing for the
    settings profile file you downloaded and importing it.
Then in future when
    you right click on the web site in your solution and select publish
    it will publish to your web site in Azure.

I have created a fictional website for Spain below is the link you will need in order to initiate a publish from Visual Studio.

------------ EDIT -------------
For Visual Studio 2010 I met some difficulties trying to publish, in fact the publish profile you can download was not importable to Visual Studio 2010, well at least I could not figure it out.
Instead I created a deployment user by clicking on the 'Reset Deployment Credentials' link on the Azure dashboard (see the link in the image), created the user and then published via FTP from Visual Studio 2010.
What I would like to flag up is the maintenance issue of having one site for each country rather than one site with Localization, (if it is a language issue). A small change multiplied just 20 times for 20 different countries becomes a larger task and if you have lots of little changes it soon becomes a large task to maintain them all.
Comment: thanks, I'll try this, it seems the right answer. I'll mark as answered an soon I try this

Deploy separate web sites azure


Canada: can an international student file tax return for past four years

Question: I'm an international student about to graduate. I never had a work permit, no income, no SIN so never filed tax return before. Stupid enough, I just realized I can use my tuition credit, so can anyone please tell me can I have my credit for the past four years or I can only file return for the previous year? And if I can, and if you would tell me any special things to be careful of, that would be great.
Alternately wondering since I'm graduating in one month or so, do I need to try and get a ITN or SIN quickly or can I just wait till I have my post-grad work permit?
Answer: Note that Tuition, Education, and Textbook tax credit amounts can only be used to reduce tax owing and can be carried forward indefinitely to future tax years. Since you have no SIN number, I'm guessing that you haven't had any taxable income in the years that you've been a student. If that's not the case, I'm guessing you have a SIN that starts with a 9.
In any case, you can file your return for previous years right now. Assuming you would not have had any tax owing, you should not have to pay any penalties. See the Tax packages for all years page at the CRA. You must have received a T2202A slip or similar from your school for each year you've been enrolled.
Most common tax packages (TurboTax, Ufile, etc) will also allow you to prepare prior year's tax returns, although you'll likely have to mail them in as NETFILE is only valid for the current tax year.
Let me know if you need me to update this answer with any further details.


What is an inverted triangle piston skirt?

Question: The recently launched Suzuki GSXR150 boasts an inverted triangle piston skirt. From what I have been told, it seems to be MotoGP technology which has been stripped down to suit a 150cc bike. Kindly explain.
Comment: I cannot find any solid information on it, only that it provides better low end torque for the motorcycle you mention. It also provides better fuel economy. I couldn't find anything about what it exactly is or how it does what it does, though.
Answer: I am very skeptical of the claim that the GSXR150 is leveraging MotoGP technology, even the top of the line sport bikes from Honda, Suzuki and Yamaha do not leverage much of that tech other than frame and swingarm.  The new Honda RC213V-S is $184,000.  How much did that 150cc bike cost?
My point is, the inverted triangle piston skirt is not that fancy.  It's simply a piston that has a reduced circumference face against the cylinder walls.  As others have stated, the skirt drops down enough to prevent the piston from 'rocking' on the wrist pin and knocking back and forth in the cylinder bore.
Inverted triangle piston skirts have been around for quite a bit, Renault used one in the '70's in formula 1.  Yamaha used one in the '70's in a later generation of it's two stroke TZ750 dirt tracker and grand prix bikes.
As @Mauro stated in theory it could be more like a slipper piston, it basically is a slipper piston it's just not that aggressive in terms of removal of material from the skirt and surrounding area of the wrist pin, or as the islanders like to say, grudgeon pin.
I suppose it is race technology but at the end of the day it's '70's era race technology.  Most of the GSXR line has been running a similar piston configuration for well over a decade and a half, as has Yamaha, Kawasaki, Honda, Aprilia and Ducati.
Keep in mind they are calling the bike a GSXR but there are no other GSXR models that have rocker arms.  They all use under the bucket shims where the cam lob essentially rides right on the bucket over the valve stem.
What Suzuki has done with that bike is attempt to make it the most efficient it can be without spending a large investment.  They are in a friction reduction phase with the model to make it compete with all the other 150cc bikes out there, this will force the competition to, in turn, spend money to get their fuel efficiency up and in so doing perhaps create a higher cost vehicle.  Suzuki works that way as do many other manufacturers but in the end, it still has rocker arms.
Hope this sufficient, cheers.
Answer: Given the piston skirt is the bit of the piston under the gudgeon pin on the piston/conrod, it seems this is a way of reducing drag and wear on the cylinder (i.e. less contact patch) and therefore making it more efficient.
A similar principle is used in slipper pistons

A slipper piston is a piston for a petrol engine, that has been reduced in size and weight as much as possible. In the extreme case, they are reduced to the piston crown, support for the piston rings, and just enough piston skirt remaining to leave two lands so as to stop the piston rocking in the bore.
Answer: Engines with a single cylinder can be arranged at any angle but typically upright or inverted.
In Gixxer they says,
"An inverted triangle shaped piston skirt has also been utilized to increase bottom end torque, smaller and lightweight rocker arms and a reduced angle of the valves have all helped better combustion, aided by the good looking dual type exhaust."
That means that they have found a new angle to deliver the above features.
References
Comment: Do you have any references for this explanation? Would really love to read up on it more.
Comment: Could it be a way to reduce the piston weight by making the skirt triangular rather than the conventional cylinders?? Might seem like a stupid question, but just asking!! :p
Comment: This an arbitrary attribution to a configuration without any support.  Where is the supporting data?


Is there a way to be legally represented in the UK without being a resident?

Question: Is there a way to be legally represented in the UK without being a resident?
Comment: I edited out the request for a recommendation of a law firm and to focus on just the legal question. I also removed the "civil" tag because I'm not sure the OP really knows what that means or why it should be applicable (I'm assuming the question isn't just limited to legal representation for civil law cases). I don't think the remaining question is a terrible one; the answer might be obvious to someone with legal experience but not necessarily obvious to laypersons.
Answer:
Is there a way to be legally represented in the UK without being a
resident?

Pretty much anyone, anywhere in the world, who can afford to hire a lawyer can be legally represented in the U.K. without being a resident.
In order to seek most kinds of affirmative relief (other than disputing the jurisdiction of a particular court over a particular party in a particular case in the first instance), however, the non-resident must acknowledge (at least conditionally subject to a right to appeal a resolution of a jurisdictional issue), the jurisdiction of the court over the non-resident and submit to that court's jurisdiction.
In one famous recent example, the King of Dubai, Mohammed bin Rashid al-Maktoum, who is obviously not a British resident, hired a British lawyer to represent him in a custody dispute with his then-wife Princess Haya, concerning the couple's two children. After two years of litigation, a British senior family court judge, Andrew McFarlane, ruled against him and granted sole custody to his wife in this case on March 24, 2022.

And if yes, who is a reputable firm which can deal with banking
related issues.

Law.StackExchange is not an appropriate place to ask for recommendations to specific law firms or lawyers.
More generally, however, the financial industry in the U.K., including its banking industry, is highly geographically concentrated in a financial district in London called the City of London (just "the City" to insiders) which has its own mayor and governing body called City of London Corporation.
As a result, most legal professionals (barristers and solicitors alike) with specialized expertise in banking law in the U.K. have offices in or near this financial district.
Comment: +1. Also, you can find non-biased (i.e. not recommendations) listings for solicitors which cover specific legal areas on the [Law Society website](https://solicitors.lawsociety.org.uk/).


Can 19日 be read as じゅうきゅうにち?

Question: I noticed that in my dictionary 29日 is read either as にじゅうくにち or にじゅうきゅうにち but 19日 doesn't have じゅうきゅうにち reading, only じゅうくにち. Can 19日 be read as じゅうきゅうにち?
Answer: Most people (I would like to say "everyone" but just in case..) say:

「じゅうくにち」 and 「にじゅうくにち」

Those are how the NHK announcers pronounce 「19日」 and 「29日」, respectively, as well.
I am honestly perplexed to hear that your dictionry gives 「 にじゅうきゅうにち 」 as an option.
Both 「じゅうきゅうにち」 and 「 にじゅうきゅうにち 」 sound quite substandard to me.
When you really want to confirm an important date, however, you might first use the standard pronunciation and then confirm it by repeating the date using the 「きゅう」 version.  That would be quite common but if you used the 「きゅう」 version out of the blue as if it were the standard form, quite a few people would find it a little weird.
NOTE: I was only thinking of the 19th and 29th days of a month in answering your question.  If you were thinking of "(for) 19 or 29 days", then both readings would be correct and natural.
Comment: When talking about '(for) 19 or 29 days' wouldn't that technically be 19/29日間「にちかん」?
Answer: NHK has an official posting on how they mean to read this. Apparently when the numbers are read alone they use "kyuu", but when appended to a term (in a date, for example) then they use the reading "ku" for ease of enunciation.
They thus use 二{にじゅう}九{きゅう} for standalone numbers but 平{へい}成{せい}二{にじゅう}九{く}年{ねん} reading this year or 十{じゅう}九{く}日{にち} for the 19th day of the month.

Can 19日 be read as じゅうきゅうにち?


Why Windows Installer can only install a single program at a time?

Question: I have always been wondering why Windows Installer only allows you to install one program at a time. It is very frustrating not to be able to launch multiple installations, especially when setting up a new installation of Windows. What is the reason for that?
Comment: So far, none of the responses directly address the question. A good answer would explain what is fundamentally different about Windows installations compared to other systems. ¶ For instance, if it asked why Windows must reboot for updates when Linux just keeps on running for years, the explanation would be that Linux allows files that are currently in use to continue being used even after they have been removed from the file system, whereas the Windows file system was not designed to do that.
Comment: The former comment is wrong. If Windows needs reboots for updates depends on the updates, pretty much like with Linux. In both cases even live patching doesn't handle all possible cases, why all major Linux distributions contain infrastructure to tell the user about necessary restarts. Deleting files in use is possible for Windows as well of course, just have a look at `dwShareMode` for `CreateFileW` and `FILE_DISPOSITION_INFORMATION_EX` with e.g. `FILE_DISPOSITION_POSIX_SEMANTICS`. Pre-conditions are different, for Windows/NTFS first user decides and needs to explicitly OPT-IN to things.
Answer: It would be very complex to guarantee correctness, when concurrent installations take place - assuming that they share some of the files. This would need some form of transactions.

You need to lock files
It should be possible to undo intermediate changes, if the installation fails (not sure, if that's possible now?)

These concepts are known from transactional databases - but the topic isn't trivial, and you usually don't find a fully transactional infrastructure in file systems (even though journaling file systems provide a part of that). One problem is, that multiple locks can lead to a deadlock - then you need deadlock detection (or both installers will hang forever), and a way to treat that. Deadlocks can be avoided (e.g. by always locking files in the same order), but there are other problems:
If you lock all the required files up front, you get effectively what you have: One installer must wait until the other is finished. If you don't lock all required files up front, and keep on going, you risk that the "transaction" will fail. That would mean, that one of the installers would have to be restarted.
Then you may have to think about transaction isolation levels - to be fully correct, your transactions would have to be "serializable" - but that's not easy, even for many databases.
There may even be alternative strategies to deal with the problems, which circumvent full isolation, but it would usually be even harder to prove their correctness.
I believe, with concurrent installation, we would have a lot more intractable post-installation problems - especially because I don't think, an OS vendor (or a distribution) would go through all the trouble to make it 100% clean. So I would prefer not to use it, even if it were offered by the OS.
Note
But maybe what you really want is not even installing "at the same time". Maybe it would be sufficient, if you could queue up the installations, which are then executed one after the other (ideally without asking any questions in between). And that's really something, some other OS (distributions) handle a lot better.
Comment: @gWaldo: Okay, maybe you're right... Then again, I don't just want to say "It's complex, believe me (period). You wouldn't understand it anyway". Maybe the OP (or someone else stumbling on this question) is truly interested, and an answer that gets to the bottom of the problem will help him to estimate, if there's *really* a lot of complexity involved to solve something that looks so easy on its surface. Who knows?
Comment: While correct, this answer seems to me too verbose.  Someone asking why the installer service works the way it does is not likely to understand this answer.
Comment: @Rytis: I wish I had the same luck :-) - I've had installers break randomly even without running them concurrently. About multicores: There would be another way to utilize them: By using multiple cores within one installation process. That's still not always possible or easy, but can be coordinated a lot better. Overall I think, the biggest time saver is still, if the entire installation process (queue) only asks questions at the beginning and at the end. Then you can get a coffee, or do something else while the installation runs (and utilize the remaining cores for whatever you want to do.).
Comment: Very true.  That's a good point.
Comment: While all the talk about isolation sounds plausible, you can run multiple installers if they do not use Windows Installer framework. I've never had any of them break when running side by side... Maybe I'm just lucky :)

As for queueing installations, there are tools for that, but given multicore CPUs (heck, desktop CPUs can now run 8 threads...), it seems that running them side by side would be the answer (although they may still fight for I/O).
Answer: This is by design, in order to avoid having two installations manipulating the same files/folders/registry keys/etc.; it could probably have been done in different ways, but Microsoft made this choice.
Comment: Any reference to support your claim?
Answer: Concurrency: You can kick of several MSI files to install in rapid sequence one after the other using a batch file. You can not run two MSI files simultaneously in the sense that they both write to disk at the same time.
Transaction & Rollback: The reason is that part of an MSI installation is run as a "transaction" - a sequence of changes that are either committed or rolled back depending on whether the actions in the transaction list complete without error. All must complete without error, and then the transaction is committed, otherwise a full rollback of all changes occur. It follows that only one such transaction can be active at any given time.
Technical Sequences: At the technical MSI level, only the actions between the standard actions InstallInitialize and InstallFinalize in the InstallExecuteSequence are run as a transaction. No system changes are supposed to happen outside these actions, but sometimes MSI files are erronously designed to make changes in other sequences.

Links:

More elaborate explanation.
More on MSI and mutexes.
Install software parallelly with PowerShell.
Elevated rights for MSI installations (temporary admin rights).


Blender Game Engine, Falling Through Ground

Question: I'm making a first person view game, and I have a big low-poly hilly terrain.  Occasionally while testing, my character falls through the ground.  What is the best way to fix this?  I've heard that increasing the physics steps can help but I don't believe it has.
Answer: Set the physics type on your ground to triangle mesh. That should fix it, But if it doesn't not, you can also turn up the margin or extrude the ground down in edit mode.

It is possible that your ground is not calculating the collisions correctly, and changing the collision bounds on the ground should fix it.
If your problem still happens, you can also try changing the collision bounds on your character. If you are still unsure what the problem is, you can activate "Physics Visualization" to show exactly what is or is not working.

Notice the difference between these pictures. The first is using triangle mesh collisions on the ground. The second one is using box collision type.

Although there is normally no problem with box Or triangle mesh, sometimes there is still an error and the collision bounds will not detect properly. In this case it is normally a good idea to try a different type, or increase the margin.
Answer: The issue here seems to be caused because the BGE renders quads differently from the way the blender Viewport display renders them, using different vertices to split the quads into tris. This means that although the physics collision mesh is generated before runtime using the Viewport renderer's mesh, the realtime BGE generated mesh has the quads split into tris differently, leading to collision which does not match the mesh.

This can be easily fixed using the Triangulate modifier (to stop the BGE from generating its own tris at runtime) or like Anson Savage discovered using the subdivision surface modifier (which also triangulates the mesh and stops the BGE from generating its own tris)
Answer: for very fast moving objects, I have found 'floating' a object on a ray, and then using it to draw a object on the mesh is handy.
I also distort the ray end point using the linear velocity,
and use this to align to the normals AHEAD of the car, as you hit them
this way you can go as fast as you want ,
Comment: He said this was an FPS not a racing game...
Comment: Well, it would work with sonic as well. :D
Answer: the problem could be that:
if a surface is very large, its geometric center could be out of camera.
you can note that if the origin of an object is out of camera it simply disappear.
a similar process could be present with physics, if our character lands on a surface, and this surface got a face with origin out of camera view, simply the physic calculate is not processed.
Adding more faces just help the camera processing to compute two or more sure face / object collision
Answer: What fixed my problem was applying a subsurf modifier to my ground.  I tried the options given to me in the first answer, but none of them seemed to work.


Why can't collisions be elastic?

Question: I understand that in inelastic collisions thermal energy is given out, but why does that happen? Why can't they simply rebound without giving off energy? Also, why in some collisions more heat is given out than in others (i.e. what determines that one collision is more inelastic than the other)? Thanks.
Comment: It might help if you could specify what sort of collisions you are talking about - theoretical point masses in classical mechanics, extended objects, particle physics?
Comment: @Claudius I'm thinking of simple collisions like that of two blocks. So I guess I'm talking about point masses and/or extended objects (will the answer be different for extended objects?).
Answer: Given your comments, I shall attempt an answer. This obviously depends on how you model the interaction between the two particles/masses.
First, let us see what happens if we bounce two particles off each other in a simple theoretical model where the particles don't have any internal structure. To simplify things, we assume one dimension and use the following Hamiltonian:
$$ H = \frac{1}{2 } m_1 v_1^2 + \frac{1}{2 } m_2 v_2^2 + U(x_1,x_2) $$
where we define $v_i$ ($m_i$) to be the speed (mass) of the $i$-th particle and $U(x_1,x_2)$ is the interaction potential which describes how the particles interact. Usually, we want something like
$$ U(x_1,x_2) = \{ \infty\textrm{ if }x_1 - x_2 < d \quad,\quad 0\textrm{ otherwise }\}$$
So the two particles can only get within distance $d$ of each other, because otherwise the potential energy $U$ is infinite (corresponding to a physically impossible state). If you try to solve the system given by the above Hamiltonian you will notice that it only describes elastic collisions. This can be linked to the fact that it is a microscopic view: We know where each particle is and even if we tried to introduce something like 'heat', it would only manifest itself in a different speed for a given particle.
So in order to get an inelastic collision (and in lieu of more complicated microscopic systems which sometimes, especially in quantum mechanics, define special operators to model interactions which can also result in inelastic collisions), we need a different model: A macroscopic one.
Again, imagine two extended masses speeding towards each other. However, now we shall assume these masses to have an internal structure, to be composited of many small atoms, placed in a relatively rigid grid. Furthermore assume that in the beginning, there is no temperature, that is $T = 0$. This means that the atoms in each of the masses all move in the same direction and don't vibrate at all.
What happens is that these atoms (at least in our model) interact with each other very similarly to the particles in the first example.
Note that we now have many, many different particles (about $10^{24}$ rather than two) and not just one, but three dimensions. Therefore, if the two large masses collide, these small atoms will bounce off each other in many different directions (like balls bouncing off each other in different directions depending on the exact angle of collision). These 'random' movements of the atoms are caught by the other atoms around them, so in effect, they don't run off everywhere but merely start vibrating in place. And this vibration is heat.
Of course, the model can be expanded further: We could think of some atoms gaining so much momentum from the impact that they flew out of the grid and into space (the masses being damaged) or that the grid is somehow changed and the atoms moved further towards each other (the masses being deformed).
The key point, however, is that inelastic collisions are usually macroscopic rather than microscopic effects relying on the internal structure of the masses involved.
Comment: Thank you for such a detailed answer. However, I should have mentioned that I haven't done any advanced physics, but I do understand your answer for the most part. So you are saying that when two bodies collide, different atoms collide with each other at different angles and hence they start vibrating as they can't go in a single direction as a whole. That means, more irregular the surfaces of contact (especially at the microscopic level), the more inelastic it would be, right? Also, a collision can be elastic only if all the atoms collide at exactly the same angle, correct?
Comment: A collision can only be perfectly elastic if all the atoms collide at exactly the same angle and the grid formed by these atoms is perfectly rigid. This, obviously, never occurs in the real world. Crystal balls probably form the best approximation to it, but even these tend to be deformed.
Comment: Can you tell me what does a grid mean? Also, when the objects collide, the atoms are in some sense 'blasted off' in different directions but due to the prevailing attraction that those atoms have with the other atoms residing in the body, those atoms come back but they get too close to the other atoms and are again sent off by the repulsion and a kind of harmonic motion begins (which is the vibration) only this time it is a 'perfect' harmonic motion with no energy loss, right? Or is the answer related to something deep in quantum mechanics? In which case I wouldn't want to know.
Answer: Inelastic collisions are where kinetic energy is not a constant - this means some of the initial kinetic energy must have been converted to some other form of energy.
A perfectly elastic collision, for example, would be perfectly silent.
This should be giving you an idea of how it is that you don't get perfectly elastic collisions.
Any collision involves deforming the surfaces of the objects colliding - this means squashing the particles the objects are made out of together for a short time.
On the scale of individual particles - all objects can be thought of as balls connected to each other by stiff springs - shoving a bunch of the balls means that the springs compress - pressing on the balls nearby and so one until the energy spreads through the whole object. The whole thing starts to get wobbly - like a stiff jelly. Some of the wobbles reach the "surface" where they vibrate the surrounding air (sound) and energy gets lost that way. Some of the wobbles bounce around inside the object ending up all randomized (heat) ... and so not all the energy from the initial shove is available in the same form after the collision. Thus - the collision was not elastic.
Sometimes the collision was hard enough to leave a dent ... in that case the non-elastic nature should be clear.

Why can't collisions be elastic?


How does the direction of the acceleration change in non-uniform circular motion?

Question: If I consider an object moving with a non-uniform circular motion with constant angular acceleration, the tangential acceleration modulus remains constant, while the centripetal acceleration modulus changes ($a_c=Rω^2$). Does the angle that the total acceleration forms with the centripetal change? If so, does it mean that, when I  make an object tied to a rope rotate and I increase the speed, the tension (and thus the rope) constantly changes its direction?
Comment: This may help - [Intuition on centripetal acceleration](https://physics.stackexchange.com/q/755886/37364)
Answer: The acceleration written in polar coordinates is:
$$ \vec{a}= \left(\ddot{r} - r \dot{\theta}^2\right)\hat{r} +  \left(r \ddot{\theta}-2\dot{r}\dot{\theta}\right)\hat{\theta} $$
In your case $r$ is constant so $\dot{r}$ and $\ddot{r}$ are both zero and the equation for the acceleration simplifies to:
$$ \vec{a}= - r \dot{\theta}^2\hat{r} +  r \ddot{\theta}\,\hat{\theta} $$
If the object starts from rest at time zero the angular velocity is $\dot{\theta} = \ddot{\theta}t$ so we get:
$$ \vec{a}= - r \ddot{\theta}^2t^2\hat{r} +  r \ddot{\theta}\,\hat{\theta} $$
So you can immediately see that the radial component increases as $t^2$ while the tangential component is constant. We can find the angle the acceleration makes with the tangent vector because its tangent is the ratio of the centripetal to the tangential component and this gives a nice simple result:
$$\tan\phi = \ddot{\theta}t^2 $$
So at time zero $\phi=90°$ i.e. the acceleration is purely tangential, at time $t = \sqrt{1/\ddot{\theta}}$ the angle is $\phi=45°$, and as time goes on the angle tends to zero i.e. the acceleration tends to being purely centripetal.
Answer: Consider the ordinary differential equation (ODE) for the acceleration in non-uniform circular motion with constant angular acceleration.
The radial or centripetal acceleration ($a_c$) is given by $a_c = R\omega^2$, where $\omega$ is the angular velocity.
The angular velocity $\omega$ is related to the angular displacement $\theta$ and time (t) by the ODE:
$$\frac{d\omega}{dt} = \alpha,$$
where $\alpha$ is the constant angular acceleration.
Now, let's express the radial acceleration $a_c$ in terms of $\theta$ and $t$. The relation between angular displacement, angular velocity, and time is given by:
$$\omega = \frac{d\theta}{dt}.$$
So,
$$a_c = R\left(\frac{d\omega}{dt}\right) = R\alpha.$$
Now, let's consider the total acceleration $a$:
$$a = \sqrt{a_t^2 + a_c^2}.$$
Substitute the expressions for $a_t$ and $a_c$:
$$a = \sqrt{(R\alpha)^2 + (R\omega)^2}.$$
Now, differentiate this expression with respect to time $t$ to get the ODE for the acceleration:
$$\frac{da}{dt} = \frac{R\alpha}{\sqrt{(R\alpha)^2 + (R\omega)^2}}\frac{d\alpha}{dt} + \frac{R\omega}{\sqrt{(R\alpha)^2 + (R\omega)^2}}\frac{d\omega}{dt}.$$
This ODE describes how the total acceleration changes with respect to time in non-uniform circular motion with constant angular acceleration.


Keyboard shortcut for renaming tabs in the Terminator terminal emulator?

Question: In the 'Terminator' terminal emulator I can rename windows using: Alt+T. Does anyone know of a keyboard shortcut (or how to create one) for renaming tabs?
Answer: Titles can be set using:

Edit
Default Shortcut

Window title
Ctrl+Alt+W

Tab title
Ctrl+Alt+A

Terminal title
Ctrl+Alt+X

Source: the Terminator official documentation, in the Setting Titles section
Note: you may run into issues
with Ctrl+Alt+A hiding the window instead.
Right click inside the terminal and go to preferences→keybindings
and change hide_window to something else.


How to use find with already written script?

Question: I know how to find last modified files, but how do I use it with my already written script. In folder I have hundreds of files xyz_<yyyymm>, now I use $ find /home/directory/TEST/ -type f -mmin -60, but it crashes halfway.
Comment: What are you trying to do with your "already written script" and `find`?  I don't see any reference to a script in your `find` command
Comment: my script is just some sed and mv lines, i put $ find on top of it, how to make connection with "already written script" :D thx for answer
Comment: you want to do something with each file? `find ... | xargs script`
Comment: Does your script expect to operate on a file, and you want `find` to invoke your script for each appropriate file?
Comment: I have 10 files `xyz1` modified today and 20 `xyz2` modified 2 days ago. I've already written some lines that take `xyz*` file rename it and then `.zip.` it. All I need now is to take last modified files (10files from today) and execute my "already written script"
Answer: If you want to execute a script for each result of a find command, you could use xargs, but often I prefer to use -exec with find.  So you could do it like:
find /home/directory/TEST/ -type f -mmin -60 -exec /path/to/your/script {} \;

and the name of the file that find matches will be put in the {} spot for each match
Answer: If what you're trying to do is use find to iterate over numerous files and then pass each file name to a script, you can use xargs, especially if the file list is very large and you find things crashing part way through.
Here, I iterate over the current working directory looking for all files, then pass each file name to a perl script which simply prints out the name:
find . -type f | xargs -0 ./script.pl

You can adjust your find command string to suit your needs.
Comment: I got this:`sed -e 's/TIMESTAMP*\([0-9]*\)/\1/g' TIMESTAMP_old_*.csv> new.txt
sed -i -e 1d new.txt
find /home/TEST/ -type f -name "CERTIFICATE_*.csv" -exec mv {} CERTIFICATE_"$(cat new.txt)".csv \;` how to make it work on last modified files, files called CERTIFICATE are hundreds, how to take the newer one. i got trouble with understanding xargs


Can I shoot down lawless ships?

Question: In Elite: Dangerous 1.3, two new ship statuses were added in addition to "clean" and "wanted": "enemy" and "lawless". Obviously one has a green light to shoot down enemy ships, but what about lawless ships? Can I shoot them too without getting fined? Do I get anything out of shooting them?
Comment: I *think* lawless ships (except Corrupt System Defense) might have a bounty, but not in the current system (so it's like a prompt to KWS them). I'm not positive though.
Answer: You can shoot anything with a red name without being fined by the pilot's federation. Lawless, for example, appears in Arrissa's expansion system areas and it is similar to a conflict zone.
Depending on the situation these statuses appear in, you could acquire Merit Points and/or PowerPlay Points(for expansion, control, undermining, and some Powers may even offer prep).
But! If the ship you are attacking is in a different power than you but still in the same major faction (Arissa and Aisling are both Empire), you will lose Merit points for attacking an ally.
Comment: So shoot away but still pay attention to who they're working for (since lawless imperial ships are perfectly OK). Got it.

Can I shoot down lawless ships?


Python, Tkinter: store content of Entry field into a variable

Question: Dear fellow programmers,
I use Python 2.7 on windows 10 64 bits.
I have an issue with a Tkinter window. In a parent program, I want to save a file and I ask the name of the file in a Tkinter window. My problem is that I don't succeed to get this name outside of the Tkinter window. Here is the Python code:
from Tkinter import *
globalFilename = ""
class Master:
    def __init__(self, top):
        self.filename = ""
        frame_e = Frame(top)
        frame_e.pack()
        self.t_filename = StringVar()

        entry = Entry(frame_e, textvariable=self.t_filename, bg="white")
        entry.pack()
        entry.focus_force()

        saveButton = Button(frame_e, text="Save", command=self.on_button)
        saveButton.pack(side=BOTTOM, anchor=S)

    def on_button(self):
        self.filename = self.t_filename.get()
        print self.filename
        root.quit()
        root.destroy()

root = Tk()
root.geometry("100x100+100+50")

M = Master(root)
print M.filename
root.mainloop( )
print M.filename
globalFilename = M.filename
print globalFilename

All print statements in this code give nothing when I enter any text into the Entry textbox. This is not what I expect. If I enter "test" I expect "test" to appear for each print statement (i. e. four times here). I tried to go everywhere on the Internet, I tried various tutorials, I tried to copy various examples, to follow various videos, I just don't succeed in fixing this issue.
Note that this piece of code is embedded into a function called saveGame, which is used in a pygame loop.
Thanks in advance! All the best!
Comment: The `print` statements that are run _after_ `root.mainloop()` do yield whatever I entered in the entry for me.
Answer: Your code works.
The window is not drawn on the screen until you call mainloop(), so printing M.filename before that point prints an empty string (the initialization value). The mainloop() blocks until the window closes, after which 3 print statements successfully print the value that the user entered into the box.
You may be interested in the easygui module, which does exactly what your program does except you don't have to make it yourself.
Answer: Ok, as other posters told, the above code works in a vacuum. It did not work as embedded in my program because I initialized a duplicate tk() before calling my function and initialize it again. I removed this duplicate and it worked.


Easy way to show that $\mathbb{Z}[\sqrt[3]{2}]$ is the ring of integers of $\mathbb{Q}[\sqrt[3]{2}]$

Question: This seems to be one of those tricky examples. I only know one proof which is quite complicated and follows by localizing $\mathbb{Z}[\sqrt[3]{2}]$ at different primes and then showing it's a DVR. Does anyone know any simple quick proof?
Comment: Have you had a look at these notes by Keith Conrad? http://www.math.uconn.edu/~kconrad/blurbs/gradnumthy/Qw2.pdf
Comment: You can read https://kconrad.math.uconn.edu/blurbs/gradnumthy/integersradical.pdf. It is _not_ true that the ring of integers of $\Bbb Q(\sqrt[n]{2})$ is equal to $\Bbb Z[\sqrt[n]{2}]$ in general! This is true for $n=2, 3, 4$ and in fact for all $n \leq 1000$, but not for $n=1093$... !
Comment: Thanks for some very enlightening answers!
Comment: The ring of integers of a pure cubic field is entirely known, see e.g. https://math.stackexchange.com/a/3508522/300700
Answer: The short answer is no, in that you almost certainly have to perform separate checks "one prime at a time."  For that matter, there's no really slick of doing the quadratic case, either.  You either have to do some grunt work with mod-4 conditions on coefficients of minimal polynomials, etc., or build up the theory of the different, etc., and start hitting problems with bigger hammers.  When you get past the quadratic case, the grunt work becomes increasingly tedious (/impossible), and you're only left with hammers.  So you need technical lemmas on how to conclude that a subring of a ring of integers is really the whole thing, and I don't think it's possible to do that without considering the various primes which could possibly divide the index.  Keith Conrad's notes that Álvaro mentions give one solution (his Lemma 1) -- here's another slightly different approach.  At the very least, it avoids working explicitly with local rings, even if it doesn't avoid the fact that philosophically we're working locally anyway.
Let $\mathcal{O}$ be the ring of integers of $\mathbb{Q}(\sqrt[3]{2})$.  We have $\mathbb{Z}[\sqrt[3]{2}]\subset\mathcal{O}$, and we wish to show equality.  It suffices to show that for each prime $\mathfrak{p}$ of $\mathbb{Z}[\sqrt[3]{2}]$, we have $\mathcal{O}=\mathbb{Z}[\sqrt[3]{2}]+\mathfrak{p}$ (this is basically using Nakayama's Lemma to disguise a collection of local things to check with a collection of global things to check).  Since for $\alpha:=\sqrt[3]{2}$, the minimal polynomial of $\alpha$ is $f_\alpha(x)=x^3-2$, we also know that
$$
\mathcal{O}\subset \tfrac{1}{f'(\alpha)}\mathbb{Z}[\sqrt[3]{2}]=\frac{1}{3\sqrt[3]{4}}\mathbb{Z}[\sqrt[3]{2}],
$$
making it trivial to check the desired equality for everything but $p=2$ and $p=3$.  Now (this part is basically the same as in Keith Conrad's notes) we observe that it suffices to demonstrate $p$-Eisenstein polynomials $h_p(x)$ for a generator $x_p\in\mathbb{Z}[\sqrt[3]{2}]$ for $p=2$ and $p=3$.  But these are easy to come by:  For $p=2$, take $x_2=\sqrt[3]{2}$ and $h_2(x)=f_\alpha(x)$ and for $p=3$, take $x_3=\sqrt[3]{2}+1$ and $h_3(x)=f_\alpha(x-1)$.  Ta-da.
Comment: Neither are *particularly* obvious, hence my comment about front-loading the computation with theoretical conclusions.  The first of your questions is through the theory of the different:  Well-known is that if you *have* a generator $\alpha$ of $\mathcal{O}$, then the different is precisely the principal ideal generated by $(f'(\alpha))$.  The generalization is that if $\alpha$ generates only a subring, then you at least get $f'(\alpha)\mathcal{O}$ contained in the different ideal.  The second is a slightly technical piece of local commutative algebra.  I will try to find a good reference.
Comment: I was hoping to ask for a little clarification of why $$
\mathcal{O}\subset \frac{1}{f'(\alpha)} \mathbb{Z}[\sqrt[3]{2}]=\frac{1}{3\sqrt[3]{4}}\mathbb{Z}[\sqrt[3]{2}]
$$
based on the fact that $f_\alpha(x)=x^3-2$. And then why exactly in the case of $p=2,3$ is it enough to find $p$-Eisenstein polynomials for generators $x_p\in\mathbb{Z}[\sqrt[3]{2}]$?
Answer: It is inescapable that one has to do some work here. The methods sketched by Cam McLeman, and surely what is in KConrad's notes, and also in Lang's Alg No Th, are probably the minimum, because it is not always the case that the ring of integers in $\mathbb Q({\root 3 \of a})$ is $\mathbb Z({\root 3 \of a})$ for square-free $a$. Just as ${1+\sqrt{D}\over 2}$ is an algebraic integer for $D=1\mod 2^2$, ${1+{\root 3\of a}+{\root 3\of a^2}\over 3}$ is an algebraic integer for $a=1\mod 3^2$. Similarly with $3$ replaced by $p$ prime, and so on.
Comment: As a reference for this, and several special cases of this form, I strongly recommend *A Course in Computational Algebraic Number Theory* by Henri Cohen.
Answer: Notations.
Let $p$ be a prime number.
Let $n$ be an integer.
If $n$ is divisible by $p$, but not divisible by $p^2$, we write $p\mid\mid n$.
Let $A$ be a Dedekind domain.
Let $P$ be a non-zero prime ideal of $A$.
Let $\alpha \in A$.
If $\alpha$ is divisible by $P$, but not divisible by $P^2$, we write $P\mid\mid\alpha$.
Let $A$ be an integral domain containing $\mathbb{Z}$.
Let $p$ be a prime number.
Let $S = \mathbb{Z} - p\mathbb{Z}$.
$S$ is a multiplicative subset of $\mathbb{Z}$.
We denote by $A_p$ the localization of $A$ with respect to $S$.
Lemma 1.
Let $A$ be a discrete valuation ring, $K$ its field of fractions.
Let $P$ be the maximal ideal of $A$.
Let $L$ be a finite separable extension of $K$.
Let $B$ be the integral closure of $A$ in $L$.
Suppose $P$ is totally ramified in $L$.
Let $Q$ be the unique prime ideal of $B$ lying over $P$.
Let $\pi$ be an element of $B$ such that $Q\mid\mid\pi$.
Then $B = A[\pi]$.
Proof.
Let $n = [L : K]$.
Since $PB = Q^n$, $[B/Q : A/P] = 1$.
Hence for every $\alpha \in B$, there exists $a_0 \in A$ such that $\alpha \equiv a_0$ (mod $Q$).
Consider the congruence equation $\pi x \equiv \alpha - a_0$ (mod $Q^2$).
Since $(\pi, Q^2) = Q$ and $\alpha - a_0 \in Q$, there exists a solution $x = a_1 \in A$.
Hence $\alpha \equiv a_0 + a_1\pi$ (mod $Q^2$).
Similarly there exist $a_0, a_1,\dots, a_{n-1} \in A$ such that
$\alpha \equiv a_0 + a_1\pi +\cdots+ a_n\pi^{n-1}$ (mod $Q^n$).
Since $PB = Q^n$, $B = A[\pi] + PB$.
Let $M = B/A[\pi]$.
$M$ is a finitely generated $A$-module.
Since $PM = (A[\pi] + PB)/A[\pi] = M$, $M = 0$ by Nakayama's lemma.
Hence $B = A[\pi]$.
QED
Lemma 2.
Let $K$ be an algebraic number field.
Let $A$ be the ring of algebraic integers in $K$.
Let $p$ be a prime number.
Suppose $p$ is totally ramified in $K$.
Let $P$ be a prime ideal of $A$ lying over $p$.
Let $\pi$ be an element of $A$ such that $P\mid\mid\pi$.
Let $S = \mathbb{Z} - p\mathbb{Z}$.
Let $\mathbb{Z}_p$ be the localization of $\mathbb{Z}$ with respect to $S$.
Let $A_p$ be the localization of $A$ with respect to $S$.
Then $A_p = \mathbb{Z}_p[\pi]$.
Proof.
Since $A_p$ is integrally closed and integral over $\mathbb{Z}_p$,
the assertion follows from Lemma 1.
QED
Lemma 3.
Let $p$ be a prime number.
Let $f(X) = X^n + a_{n-1}X^{n-1} +\cdots+ a_1X + a_0 \in \mathbb{Z}[X]$ be an Eisenstein polynomial at $p$. That is, $p\mid a_i, i = 0,\dots,a_{n-1}$ and $p\mid\mid a_0$.
Let $\theta$ be a root of $f(X)$.
Let $K = \mathbb{Q}(\theta)$.
Let $A$ be the ring of algebraic integers in $K$.
Let $P$ be a prime ideal of $A$ lying over $p$.
Then $p$ is totally ramified in $K$ and $P\mid\mid\theta$.
Proof.
Since $f(X)$ is irreducible in $\mathbb{Q}[X]$, $n = [K : \mathbb{Q}]$.
Let $v_P$ be the discrete valuation associated with $P$.
Let $e = v_P(p)$.
Since $f(\theta) = 0$ and $p\mid a_i, i = 0,\dots,a_{n-1}$, $\theta^n \equiv 0$ (mod $P$).
Hence $\theta\equiv 0$ (mod $P$).
Since $p\mid a_i, a_i\theta^i \equiv 0$ (mod $P^{e+1}$) for $i = 1,\dots,a_{n-1}$.
Hence $\theta^n + a_0 \equiv 0$ (mod $P^{e+1}$).
Since $p\mid\mid a_0$, $v_P(a_0) = e$.
Hence $v_P(\theta^n) = e$.
On the other hand, $v_P(\theta^n) \geq n$.
Hence $e = n$.
Hence $v_P(\theta) = 1$ and $p$ is is totally ramified in $K$.
QED
Lemma 4.
Let $n > 1$ be an integer.
Let $m$ be an an integer.
Let $p$ be a prime number such that $p\mid\mid m$.
Let $\theta$ be a root of $X^n - m$.
Let $K = \mathbb{Q}(\theta)$.
Let $A$ be the ring of algebraic integers in $K$.
Then the following assertions hold.
(1) $X^n - m$ is irreducible in $\mathbb{Q}[X]$.
(2) $p$ is totally ramified in $K$.
(3) Let $P$ be a prime ideal of $A$ lying over $p$.
Then $P\mid\mid\theta$.
Proof.
$X^n - m$ is an Eisenstein polynomial at $p$.
Hence the assertions immediately follows from Lemma 3.
QED
Lemma 5.
Let $p$ be a prime number.
Let $m$ be an integer.
Let $\theta$ be a root of $X^p - m$.
Let $K = \mathbb{Q}(\theta)$.
Let $A$ be the ring of algebraic integers in $K$.
Suppose there exists $a \in \mathbb{Z}$ such that $p\mid\mid (m - a^p)$.
Then the following assertions hold.
(1) $X^p - m$ is irreducible in $\mathbb{Q}[X]$.
(2) $p$ is totally ramified in $K$.
(3) Let $P$ be a prime ideal of $A$ lying over $p$.
Then $P\mid\mid (\theta - a)$.
Proof.
$(X + a)^p - m$ is an Eisenstein polynomial at $p$.
$\theta - a$ is a root of this polynomial.
Hence $\mathbb{Q}(\theta) = \mathbb{Q}(\theta - a)$ has degree $p$ over $\mathbb{Q}$.
This proves (1).
(2) and (3) follows from Lemma 3.
QED
Lemma 6.
Let $K$ be an algebraic number field.
Let $A$ be an order of $K$.
Suppose $A_p$ is integrally closed for all prime numbers $p$.
Then $A$ is the ring of algebraic integers in $K$.
Proof.
Let $B$ be the ring of algebraic integers in $K$.
Let $p$ be a prime number.
Since $B$ is integral over $A$, $B_p$ is integral over $A_p$.
Since $A_p$ is integrally closed and $K$ is the field of fractions of $A_p$, $B_p = A_p$.
Let $I$ = {$a \in \mathbb{Z}; aB \subset A$}.
$I$ is an ideal of $\mathbb{Z}$.
Suppose $I \neq \mathbb{Z}$.
There exists a prime number $p$ such that $I \subset p\mathbb{Z}$.
Since $B \subset A_p$ and $B$ is a finite $\mathbb{Z}$-module, there exists $s \in \mathbb{Z} - p\mathbb{Z}$ such that $sB \subset A$.
Hence $s \in I$.
This is a contradiction.
Hence $I = \mathbb{Z}$.
Hence $B = A$.
QED
Proposition.
Let $p, q$ be distinct prime numbers.
Let $\theta$ be a root of $X^p - q$.
Let $K = \mathbb{Q}(\theta)$.
Suppose there exists $a \in \mathbb{Z}$ such that $p\mid\mid(q - a^p)$.
Then $\mathbb{Z}[\theta]$ is the ring of algebraic integers in $K$.
Proof.
Let $B$ be the ring of algebraic integers in $K$.
Let $A = \mathbb{Z}[\theta]$.
Let $f(X) = X^p - q$.
Since $f(X)$ is Eisenstein at $q$, it is irreducible in $\mathbb{Q}[X]$.
Let $d$ be the discriminant of $f(X)$.
$|N_{K/\mathbb{Q}}(\theta)| = |q|$.
Hence $|d| = |N_{K/\mathbb{Q}}(f'(\theta))| = |N_{K/\mathbb{Q}}(p\theta^{p-1})| = p^p q^{p-1}$.
Let $r$ be a prime number other than $p$, $q$.
Since $\mid d\mid = p^p q^{p-1}$, $r$ does not divide $d$.
Let $R$ be a prime ideal of $A$ lying over $r$.
By this, $A_R$ is a discrete valuation ring.
Hence $A_r$ is integrally closed.
Hence $A_r = B_r$.
On the other hand, by Lemma 4 and Lemma 2, $B_q = \mathbb{Z}_q[\theta] = A_q$. By Lemma 5 and Lemma 2, $B_p = \mathbb{Z}_p[\theta - a] = \mathbb{Z}_p[\theta] = A_p$.
Hence we are done by Lemma 6.
QED
Corollary.
Let $\theta$ be a root of $X^3 - 2$.
Let $K = \mathbb{Q}(\theta)$.
Then $\mathbb{Z}[\theta]$ is the ring of algebraic integers in $K$.
Proof:
$3\mid\mid(2 - 2^3)$.
QED
Comment: "Does anyone know any simple quick proof?" I gather that your answer to this question is no...?
Comment: @MTurgeon According to the answers of Cam McLeman and Paul Garrett, it seems that there's no simple quick proof. Mine is longer than others', but it's simply because I didn't omit the details of the proof.
Answer: The following is simple, but perhaps not as quick as you'd like. Hopefully I've written it such that generalizing to other examples isn't difficult. Let $\alpha = \sqrt[3]3$ and let $\mathcal O$ be the ring of integers in $\mathbf Q[\alpha]$. Recall that
$$
\DeclareMathOperator\disc{disc} \newcommand{\bZ}{\mathbf{Z}}\disc(\bZ[\alpha]) = (\mathcal O : \bZ[\alpha])^2\disc\mathcal(O).
$$
The discriminant of $\bZ[\alpha]$ is $-2^23^3$. So certainly $6\mathcal O \subset \bZ[\alpha]$ and hence I can write an $x \in \mathcal O$ as
$$
x = \frac16(x_0 + x_1\alpha + x_2\alpha^2)
$$
for some $x_0, x_1, x_2 \in \bZ$. If $x$ is not in $\bZ[\alpha]$ then one of these, call it $x_i$, is not divisible by $6$, hence is not divisible by $p$, where $p$ is $2$ or $3$. If we multiply by the integer $6/p$, then the coefficient of $\alpha^i$ is the reduced fraction $x_i/p$.
By some other simple manipulations, we can obtain an element of $\mathcal O$ not in $\bZ[\alpha]$,
$$
\frac1p(y_0 + y_1\alpha + y_2\alpha^2)
$$
in which $y_i = 1$ and all $y_j$ satisfy $0 \leq y_j < p$. Since $p$ is small there are not so many combinations to check, and if I've added correctly then the trace and norm suffice to prove that none of these can actually be in $\mathcal O$.
Added. I was going to add some more remarks in response to Prof Emerton's comments, but I stumbled upon these nice notes of by Matt Baker's that explain the local computations as simply as is possible. See Proposition 2.9 there.
Comment: Dear Dylan, You could add that a local argument at $2$ (the polynomial $X^3 - 2$ is Eisenstein at $2$) shows that $2$ can't be in the denominator, so you only have to consider a possible denominator of $3$.  Regards,
Comment: @Matt That's a good point. I wanted to avoid local methods because of how the question was posed, but maybe I will add an appendix.
Comment: why "certainly $6\mathcal{O}\subset \mathbb{Z}[\alpha]$"?
Comment: And why 'not divisible by 6' implies 'not divisible by 2 or 3'? 2 is not divisible by 6 but divisible by 2.
Comment: Dear Dylan, Ah yes, it had been a while since I read the question, and I forgot about the "non-local" stipulation.  (Of course, I wouldn't describe those methods as "quite complicated", but to each their own.)  Best wishes,
Comment: isn't the discriminant the square of the det so it's $2^4 3^6$?
Answer: Most introductory textbooks find the integers in quadratic fields and maybe cyclotomic fields, and then leave it at that. One that pays a lot of attention to cubic fields is Alaca and Williams, Introductory Algebraic Number Theory. ${\bf Q}(\root3\of2)$ is done as Example 7.1.6, starting on page 153 (and filling three pages!). Many other examples are done in detail, and Dedekind's general formula for pure cubic fields is given as Theorem 7.3.2 on page 176 (with the proof left to the reader!).
Comment: Dear Gerry, I have seen and admired your remarks on m.se. In that you provide the only comment on "Alaca and Williams," I would very much appreciate your opinion. I am looking for an ANT book for self study. One that would go after "Dummit & Foote" and a bit less than "Marcus" or "Samuel." I was also considering "Mollin." Any preferences regarding these or others would be great. Thanks, Andrew
Comment: @Andrew, I like Stewart & Tall, also Pollard & Diamond. But if you post a new question, asking for advice, you may get some very useful answers. In fact, you might check to see whether such a question has already been asked on this site.
Answer: Here's an elementary proof. It is similar to Dylan Moreland's but we will use every coefficient of the characteristic polynomial instead of computing the discriminant.
Let $D$ be a squarefree integer not divisible by $3$, let $\theta = \sqrt[3]{D}$, let $K = \mathbb{Q}(\theta)$, and let $x = \frac{a + b \theta + c \theta^2}{3} \in \mathcal{O}_K$. We want to determine the possible $x$ which do not lie in $\mathbb{Z}[\theta]$. Taking the traces of $x, \theta x, \theta^2 x$ we conclude that $a, Db, Dc \in \mathbb{Z}$. The coefficients of the characteristic polynomial of $x$ are
$$e_1 = a, e_2 = \frac{a^2 - Dbc}{3}, e_3 = \frac{a^3 + Db^3 + D^2 c^3 - 3Dabc}{27}$$
and these must all be integers. In particular,
$$27 D^2 e_3 = D^2 a^3 + (Db)^3 + D(Dc)^3 - 3Da Db Dc$$
is an integer divisible by $D$, so it follows that $D | (Db)^3$, hence $D | Db$ (since $D$ is squarefree), from which we conclude that $b \in \mathbb{Z}$. The above expression is also divisible by $D^2$, and so we conclude that $D | (Dc)^3$, hence (again since $D$ is squarefree) $D | Dc$, so $c \in \mathbb{Z}$.
By adding integer multiples of $1, \theta, \theta^2$ to $x$ we may assume WLOG that $a, b, c \in \{ 0, 1, -1 \}$. If $a = 0$, then $e_2 \in \mathbb{Z}$ implies $bc = 0$ and $e_3 \in \mathbb{Z}$ implies $b = c = 0$. If $bc = 0$, then $e_2 \in \mathbb{Z}$ gives $a = 0$, and again $b = c = 0$. So WLOG $a, b, c \in \{ 1, -1 \}$.
Now suppose that $D \equiv -1 \bmod 3$. Then by multiplying by $\theta$ we conclude that
$$\frac{a + b \theta + c \theta^2}{3} \in \mathcal{O}_K \Rightarrow \frac{-c + a \theta + b \theta^2}{3} \in \mathcal{O}_K$$
so we can work up to a signed cyclic permutation. Now $e_2 \in \mathbb{Z}$ if and only if $bc = -1$, and cyclically permuting this condition gives $ab = -1, ca = 1$. WLOG $a = 1$ since we can also work up to negation; then $b = -1, c = 1$. Now $e_3 \in \mathbb{Z}$ if and only if $(D + 1)^2 \equiv 0 \bmod 27$, which is equivalent to $D \equiv -1 \bmod 9$.
If $D \equiv -1 \bmod 3$ but $D \not\equiv -1 \bmod 9$, then we conclude that there are no elements of $\mathcal{O}_K$ not in $\mathbb{Z}[\theta]$. (Small modifications to the last part of argument tell you what happens for $D$ any residue class $\bmod 9$.)
Comment: Really nice argument. But: by replacing $D$ by $-D$ if necessary, you've allowed yourself to assume that $D\equiv-1\pmod3$, and concluded that only $D\equiv-1\pmod9$ gives the exceptional situation. But your last paragraph, standing alone, is not right, since $\frac13(1+\sqrt[3]{10}+\sqrt[3]{100})$ is an algebraic integer.
Comment: Maybe this is the "grunt work" Cam McLeman's answer mentions, but I don't think it's so bad if you take advantage of symmetries to simplify the casework as above.
Comment: Sure. I recognized perfectly well that $D=-10$ fits into your framework. But since I have your attention, I think I have a much simpler argument than any of those here; I've asked Michael Rosen to check it out, and if it's sound, I'll post it here.
Comment: Oops, sorry. I think the condition I meant to write, and what I actually get out of the proof, is $D \equiv -1 \bmod 3$ but $D \not \equiv -1 \bmod 9$. We get your example with $D = -10, a = 1, b = -1, c = 1$ in accordance with the second-to-last paragraph.
Answer: Here is an elementary method that doesn't require too many calculations. This answer is only long because every detail is given. Let $\alpha = \sqrt[3]{2}$ and $K = \mathbb Q(\alpha)$.
We begin by computing the norm and trace. Consider an element $x \in K$ where $x = a + b\alpha +c\alpha^2$. Multiplication by $x$ gives a $\mathbb Q$-linear map $K \to K$ represented by the matrix $$\begin{bmatrix} a&b&c\\2c&a&b\\2b&2c&a\end{bmatrix}$$
Thus $N(x) = a^3+2b^3+4c^3-6abc$ and $\mathrm{Tr}(x) = 3a$.
We compute the discriminant of $\mathbb Z[\alpha]$ with the basis $1, \alpha, \alpha^2$. As this is a power basis, the discriminant of the basis is  the discriminant of the minimal polynomial of $\alpha$, which is $x^3-2$. By the formula $-4p^3-27q^2$ for the discriminant of cubic polynomials, the discriminant is $-4\cdot27$.
Alternatively, the discriminant can be calculated directly as the determinant of the matrix of traces.
$$\begin{align}\begin{vmatrix} Tr(1\cdot 1)&Tr(1 \cdot\alpha)&Tr(1 \cdot \alpha^2)\\Tr(\alpha\cdot 1)&Tr(\alpha \cdot\alpha)&Tr(\alpha \cdot \alpha^2)\\Tr(\alpha^2\cdot 1)&Tr(\alpha^2 \cdot\alpha)&Tr(\alpha^2 \cdot \alpha^2)\end{vmatrix} &=
\begin{vmatrix} Tr(1)&Tr(\alpha)&Tr(\alpha^2)\\Tr(\alpha)&Tr(\alpha^2)&Tr(2)\\Tr(\alpha^2)&Tr(2)&Tr(2\alpha)\end{vmatrix}\\ &=\begin{vmatrix} 3&0&0\\0&0&6\\0&6&0 \end{vmatrix}\\ &= -4 \cdot 27\end{align}$$
Now, recall that $$\mathrm{disc}(\mathbb Z[\alpha]) = (\mathcal O_K : \mathbb Z[\alpha])^2 (\mathrm{disc}(\mathcal O_K)),$$ as clearly $\mathbb Z[\alpha] \subseteq \mathcal O_K$. Thus we know that $(\mathcal O_K : \mathbb Z[\alpha])^2 \mid (-4 \cdot 27)$, equivalently $(\mathcal O_K : \mathbb Z[\alpha]) \mid 6$.
Suppose that $2 \mid (\mathcal O_K : \mathbb Z[\alpha])$, or equivalently $O_K / \mathbb Z[\alpha] \cong \mathbb Z/2\mathbb Z$ or $\mathbb Z/6\mathbb Z$. In either case, let $x = a + b\alpha +c\alpha^2 \in \mathcal O_K$ be an element of order 2 in the quotient. Thus $2x \in \mathbb Z[\alpha]$, so $a, b, c \in \frac{1}{2}\mathbb Z$. We may assume that $a,b,c \in \{ 0, 1 \}$ because we can subtract integer multiples of $1, \alpha, \alpha^2$ and stay in $\mathcal O_K$. Notice that $N(x) = \frac{1}{8}(a^3+2b^3+4c^3-6abc)$. As the norm of $x \in O_K$ must be an integer, we have that $8 \mid a^3 + 2b^3 + 4c^3 - 6abc$. If one of $a,b,c$ is zero, the last term is zero, and $|a^3+2b^3+4c^3| \le 7$ . Otherwise $a=b=c=1$, which gives $a^3+2b^3+4c^3-6abc = 1$. Thus $a^3+2b^3+4c^3 = 0$  implying $N(x) = 0$, so $x = 0$, contradicting our hypothesis there was a element of order 2 in $\mathcal O_K/\mathbb Z[\alpha]$.
The case where $3 \mid (\mathcal O_K : \mathbb Z[\alpha])$ is similar. By definition, $O_K / \mathbb Z[\alpha] \cong \mathbb Z/3\mathbb Z$, so let $x = a + b\alpha +c\alpha^2 \in \mathcal O_K$ be an element of order 3 in the quotient. Thus $3x \in \mathbb Z[\alpha]$, so $a, b, c \in \frac{1}{3}\mathbb Z$. Similarly, we may assume that $a,b,c \in \{-1, 0, 1 \}$. Notice that $N(x) = \frac{1}{27}(a^3+2b^3+4c^3-6abc)$. As the norm of $x \in O_K$ must be an integer, we have that $27 \mid a^3 + 2b^3 + 4c^3 - 6abc$. By the triangle inequality $-13 \leq a^3 + 2b^3 + 4c^3 - 6abc \leq 13$. It follows that $a^3 + 2b^3 + 4c^3 - 6abc = 0$, implying that $N(x) = 0$, so $x = 0$, contradicting our hypothesis there was a element of order 3 in $\mathcal O_K/\mathbb Z[\alpha]$.
Now, $(\mathcal O_K : \mathbb Z[\alpha]) = 1$, as it divides 6 and cannot be 2 or 3 or 6. So $\mathcal O_K \cong \mathbb Z[\alpha]$ as required.
Comment: It should be "contradicting our hypothesis that there was an element of order 2 in $\mathcal{O}_K/\mathbb{Z}[\alpha]$" (in the quotient). The meaning of $a,b,c$ seems also to be confused with $2a,2b,2c$ (what is in $\{0,1\}$?)
Comment: Suggestion: you can use the fact that $x^3-2$ is Eisenstein in $2$ to conclude directly that $(\mathcal{O}_K:\mathbb{Z}[\alpha])=1$ or $3$. That wouldn't be so elementary, but could save some time
Answer: (Note: Corrected after @user26857: flagged some clear errors)
In this particular case we can combine divisibility and the fact that $D=2$ is small.

Consider an algebraic integer $x = a+ b \sqrt[3]{2}+c\sqrt[3]{4}$. Two steps in the argument:

Its trace $3 a$ is an integer, and

$$3x - 3 a = 3b \sqrt[3]{2}+3c\sqrt[3]{4}$$
is also an algebraic integer.
Now from $3b$, $3c$ subtract some integers so that we are left with
the algebraic integer
$$u \sqrt[3]{2} + v\sqrt[3]{4}$$
with $|u|,|v|\le \frac{1}{2}$. Now the norm
$$N(u \sqrt[3]{2} + v\sqrt[3]{4}) = 2 u^3 + 4 v^3$$
is in absolute value $< 1$ so, being an integer, it must be $0$.
Conclusion: $3a$, $3b$, $3c$ are integers.

Subtract from $x$ integer multiples of $1$, $\sqrt[3]{2}$, $\sqrt[3]{4}$ and get an algebraic integer

$$x' =a'+ b' \sqrt[3]{2}+c'\sqrt[3]{4}$$
with $a'$, $b'$, $c' \in \{-\frac{1}{3}, 0, \frac{1}{3}\}$. The norm of $x'$ is an integer. However:
$$|N(x')| = |a'^3+2 b'^3 + 4 c'^3- 3 \cdot 2 a' b' c'| \le \frac{1+2+4+6}{27}< 1$$
and we conclude $x'=0$.
Therefore $a$, $b$, $c$ are integers.


Are there official Markdown versions of the CC licenses?

Question: Official plaintext versions of the Creative Commons licenses are available. Are there similarly official Markdown versions?
Comment: @BartvanIngenSchenau As one example, the GPL family is available in many formats. For example, see the top of [GNU's GPLv3 page](https://www.gnu.org/licenses/gpl-3.0.en.html): "*The GPL in other formats: plain text, Texinfo, LaTeX, standalone HTML, ODF, Docbook v4 or v5, Markdown, and RTF.*"
Comment: My guess is no since a Google search for *[site:creativecommons.org markdown](https://www.google.com/search?q=site:creativecommons.org+markdown)* turns up about 28 results, and an exhaustive look-through shows no promising pages.
Comment: Given that I don't know of official markdown versions for any open-source license, I doubt that they will exist for CC.
Comment: @apsillers, I stand corrected.
Answer: Many licenses require that the licensed work is accompanies by a copy of the license, e.g. GPL, MIT, BSD, GFDL, …. A Markdown version that can be copied into the project documentation can then be helpful.
However, the CC licenses can be satisfied by linking to the full terms, or even only mentioning the abbreviated name for the license (like CC-BY-SA 3.0). A Markdown version that can be copied into projects is therefore not as necessary, and is not provided.
Answer: I don't believe it's official, but they do exist at https://github.com/idleberg/Creative-Commons-Markdown/.  It seems well maintained, at least at the time of this writing.
They welcome changes so if anything looks wrong, report it.
Answer: No. Creative Commons do not host a Markdown version of their licenses.
The license terms do not require that you distribute a copy of the license. If you want to distribute an official copy anyway, use the plain text version.
Comment: I have to remark that in certain countries license text has to be provided together with the licensed work in order for the license to be valid. For example in Poland linking to external license text is considered an "abusive clause". This is a legal requirement and no license text can subsume it.


How to show comment reply form

Question: I have installed ajax comments module. There is a "reply" link to show comment reply form. I want to show comment reply form under comments without click reply link. Is it possible?
Comment: Could you use jQuery?
Answer: if (you = JS) {
use document.getElementById('yourLinkID').click();
} else if (you = JS && you = jQuery){
use $('.content-type #LinkID').click();
} else {
// can't think of anything, either then an option in the UI. I don't have much experience with Drupal comments.
}

How to show comment reply form


How can you hide the title from a featured article?

Question: How can you hide the title from a featured article? I already tried setting "Show Title" to "Hide" in Article Manager but it doesn't work. This article is "Uncategorized" and only used in "Featured Articles". I'm using "protostar" Joomla's default template and Joomla 3.3.6.
Answer: If you want to hide the Title for "Featured articles" you need to specify that you want Joomla to take the configuration set from those articles. To do that go to Menu -> Main Menu -> Select the Menu which display "Featured Articles" -> Options and set Show Title to "Use Article Settings"

Now, go and find your Article in "Article Manager" -> Options and set "Show Title" to "Hide".
Answer: You have to set Show Title to Hide in the menu item that displays your featured articles, not in the article settings. The article settings will only have effect is you set Show Title to Article settings in the menu item.
Comment: Only 7 seconds of difference :) I found the answer myself so I decided to answer it for future reference. +1 anyway
Comment: Great :) It's always a little confusing with all the places you can configure the article settings, as Toni Marie pointed out. I'm glad you figured it out.
Comment: What on earth have you done to the backend template design? haha. +1 anyway :)
Comment: It's just a small plugin I built that loads an additional CSS file to personalize the backend and replace the Joomla logo with my own. I'm glad you liked it (or did you?) haha.
Answer: There are several places to set the title property.  The menu item, the category, the article manager and the article itself.
As the other answers have noted, the view and menu item are the most critical to set.
However, if you're linking out of say, a featured article blog view and you want the title hidden when you get to the article page, the menu item may not be acting on the article by the time you reach the full text page.  So you want to look at the other areas of settings to see if they're conflicting.
Ultimately, the individual article level should trump all the other views.  So it would interest me to test that result and perhaps address it as a glitch in the parameter hierarchy in the Joomla core.


Executing a long action

Question: I'm creating a PHP script that will allow a user to log into a website and execute database queries and do other actions that could take some time to complete. If the PHP script runs these actions and they take too long, the browser page times out on the user end and the action never completes on the server end. If I redirect the user to another page and then attempt to run the action in the PHP script, will the server run it even though the user is not on the page? Could the action still time out?
Answer: In the event of long-running server-side actions in a web application like this, a good approach is to separate the queueing of the actions (which should be handled by the web application) from the running of the actions (which should be handled by a different server-side application).
In this case it could be as simple as the web application inserting a record into a database table which indicates that User X has requested Action Y to be processed at Time Z.  A back-end process (always-running daemon, scheduled script, whatever you prefer) would be constantly polling that database table to look for new entries.  ("New" might be denoted by something like an "IsComplete" column in that table.)  It could poll every minute, every few minutes, every hour... whatever is a comfortable balance between server performance and the responsiveness of an action beginning when it's requested.
Once the action is complete, the server-side application that ran the action would mark it as complete in the database and would store the results wherever you need them to be stored.  (Another database table or set of tables?  A file?  etc.)  The web application can check for these results whenever you need it to (such as on each page load, maybe there could be some sort of "current status" of queued actions on each page so the user can see when it's ready).
The reason for all of this is simply to keep the user-facing web application responsive.  Even if you do things like increase timeouts, users' browsers may still give up.  Or the users themselves may give up after staring at a blank page and a spinning cursor for too long.  The user interface should always respond back to the user quickly.
Comment: Good explanation of how and why to use a message queue!
Comment: Naw, threading with PHP is rarely the solution.  Really for long running things as described either live with intermittent failed completions or take the time to use a MQ.  Gearman is again an easy option with PHP.
Comment: @ficuscr: What I've described is sort of a "poor man's message queue" (in that it doesn't do as much guaranteeing as a more robust message queue would) but it's effective in most cases.  It's possible this may even be overkill, though.  I'm not familiar enough with PHP, but does it have some way of forking off a task into a separate thread and handling the response from that task later?  Much in the same way that JavaScript callbacks work, or asynchronous C# methods?  If it does, that might be a simpler approach.
Comment: @ficuscr FWIW, threading is rarely a good solution in any language when high-volume internet scalability is needed.
Answer: You could look at using something like ignore_user_abort but that is still not ideal in my opinion.  I would look at deferring these actions and running them through a message queue.  PHP comes with Gearman - that is one option.  Using a message queue scales well and does a better job ensuring the request actions actually get completed.
Lots on SO on the subject... Asynchronous processing or message queues in PHP (CakePHP) ...but don't use Cake :)
Comment: Nice thing this tool in the link.
Answer: set_time_limit() is your friend.
Answer: If it were me, I would put a loading icon animation in the user interface telling them to wait. Then I would execute the "long process" using an asynchronous AJAX call that would then return an answer, positive or negative, that you would pass to the user through JavaScript.
Just like when you upload pictures to Facebook, you can tell the user what is going on. Very clean!

Executing a long action


Enumerating finite local commutative rings effectively

Question: Background
I am interested in writing a program to extend the sequence Number of commutative rings with 1 containing n elements. This sequence is not as well linked-to as the other three of its type, which is perhaps why it ends at 31, rather than 63, even though it should be easier.
I hope to extend it to at least 127 and hopefully 255. The powers of two are the hardest steps along the way, particularly because of the number of isomorphism classes of rings with additive group $(\mathbb{Z}/2\mathbb{Z})^n.$ Since this group has $n$ generators, a naïve algorithm would arbitrarily determine $n(n-1)/2$ products from among $2^n$ possibilities and check for associativity (supposing we use the multiplicative identity as a generator). Since associativity comes down to $n(n-1)(n-2)/3$ equations, and each one requires $4n^2$ lookups, we're looking at
$$\frac{4n^3(n-1)(n-2)}32^{(n^3-n^2)/2}$$
computations, which is already 2.3 quintillion in the case of $(\mathbb{Z}/2\mathbb{Z})^5.$
The Question
Clearly this can be improved immensely, depending on how much ring theory knowledge one wishes to give the computer. In particular, we know that there is one field, and nonlocal rings are enumerated easily from the calculations from lower powers of two, so this leaves the local case. Thus the question in full generality is

What is a computationally effective way to enumerate isomorphism classes of local commutative rings with additive group $(\mathbb{Z}/2\mathbb{Z})^n,$ given a list of all commutative rings with additive group $(\mathbb{Z}/2\mathbb{Z})^k$ for lower $k$?

In particular, would organizing the search (and sorting the generators) on the basis of the number of subrings it has of order $(\mathbb{Z}/2\mathbb{Z})^k$ for each $k$ be efficient, slow, or very difficult to program? Would the size of the maximal ideal be a better place to start? Quotients of polynomial rings by reducible/irreducible polynomials? Or something else entirely?
Answer: I'll write what I've thought of in case someone has something better.
The nontrivial part is enumerating the local rings. For a local ring $R$ with additive group $(\mathbb{Z}/2\mathbb{Z})^n,$ its maximal ideal $\mathfrak{m}$ must have precisely half the elements of the ring by zcn's answer here. And any maximal ideal is a not necessarily unital ring, so one should get the list of all non-unital commutative rings $\mathfrak{m}$ with additive group $(\mathbb{Z}/2\mathbb{Z})^{n-1}.$ Since we know $1\not\in \mathfrak{m},$ we can use 1 as the last basis element of $R,$ for which we know the whole multiplication table.
In each case, we must check that no other ideal of size $2^{n-1}$ exists in the resulting ring.


How to tell if user is actively typing in Linux?

Question: I'd like to write a little script to ask me what I'm doing at regular intervals, but I'd like it not to grab focus if I'm in the middle of writing an email or filling in a password. The two options I've come up with are (1) notify-send/pynotify which lets me pop up a notification bubble in the top right of my screen which is perfect, but can't seem to include a text entry field; and (2) zenity and similar which bring up a window with a text field, but steal focus when they do.
Comment: Another way to fulfil your goal would be to configure your window manager not to focus the notification window initially. Only a few window manager are configurable in this way, however.
Answer: Aha, xprintidle seems to be the answer to my woes. It tracks mouse movement as well as keyboard, but gives idle time in milliseconds so seems good enough.
http://www.dtek.chalmers.se/~henoch/text/xprintidle.html
sleep 10
echo waiting for me not to be busy
while [ "$(xprintidle)" -lt 3000 ]; do sleep 1; done
echo interrupting
(unset WINDOWID; zenity --title "Annoyer" --entry --text "Are we there yet?")

Answer: If in X, here is a post that contains a script monitors /dev/input/event:

https://bbs.archlinux.org/viewtopic.php?pid=691751

The important command is:
sudo hexdump -e '48/1 "%x " "\n"' /dev/input/event1 | awk '( $29 == 1) { print "PRESS: " $13 } ( $29 == 0 ) { print "RELEASE: " $13 }'

Naturally, you need to have sudo permissions, otherwise it will become what that post suggests...
Answer: What about w and tail -f dev/pts/13 where 13 is the pts of the user you want to spy from w?