What would be the most practical way for a web developer to develop on Ubuntu but test on IE

Question: I work as web developer and have Firefox and Chrome installed on my Ubuntu system.  However, most of the nightmares for web developers are getting things to work on Internet Explorer, mostly IE7 and IE8.  My entire team of developers have switched to Ubuntu and now we're facing a difficult time with testing on IE.  I'd like to be able to test from my own desktop, but not install virtualbox on each system, since that would defeat the purpose of moving to Ubuntu.  Is it possible to have windows run on a virtual box instance on one server and remotely connect to it from say 5 or 6 systems at the same time?  Or even run windows on one box and have my entire team remotely access that desktop?
Answer: Just install Windows on a machine ( or virtual machine ) and install a VNC server ( like UltraVnc http://www.uvnc.com/download/index.html ).
On the windows machine you can create the amount of users that you need, then configure the UltraVnc server to permit LogIn with Window Authentication.
Then with any VNC client (like Vinagre) from your Ubuntu desktops you can connect to the Windows machine ( using a different user for each developer ) and enjoy :)
Comment: Will this allow multiple developers to use the machine at the same time?
Comment: Sure, why not? But if each developer wants more freedom you should deploy more Virtual Machine ( on the same phisical machine also ) one for each developer.
Answer: I do web development on Ubuntu. I think there are three main scenarios.
If you need to keep an eye on IE's rendering of your HTML and CSS, you can use a site such as Browsershots. Browsershots in particular is very exhaustive but quite slow, there are a few faster equivalents that will only do most major browsers. Also, you can use VNC for this purpose. VNC is not really suitable for interaction with websites, but just fine for static rendering checks.
If you need to test interaction with jQuery-style effects and more complex things, you really need a real local copy of IE, especially if you need to see how responsive an UI is. I use VirtualBox for this. Funny ways of installing IE on Linux don't really work because font rendering and options might be different from vanilla Windows installs. If you need to do this right, you need a real Windows machine (and different Windows versions, too). For example, a tricky bit I ran into lately is when using @font-face server provided fonts. These can vary widely from one platform to the next.
And last but not least, you might need functionality testing (i.e. ¿Did this search box break in the last update?). You can do automated testing of functionality using specialized tools like Selenium or the newer Sikuli. With these you can have Windows tests running automatically on a dedicated machine, but you won't get feedback on small rendering glitches and such.
Comment: I was thinking VNC, because most of what I want is the small quirks like stuff.  We do have exhaustive testing done on a Windows machine, but that's not what I'd do for quirks
Answer: You could install IE7 with PlayOnLinux, and everyone could have their own IE install.
Answer: Being a web developer myself I see your problem, I have used one of three solutions at various times.

Use a virtual machine
Dual boot
Have a spare machine set up just for that reason, to test your work under the windows environment

There are a few other things you could try, such as remote desktop, which I believe if you use a server you can have multiple sessions at once. I just don't know how many. Or you could take a look at IEs4Linux. One of their goals is to make IE available on Linux for web developers. The biggest drawback to it is it doesn't support IE 7 and up.
Comment: I'm looking at something like remote desktop.  Is that practical?  Would Windows let me login into it at the same time with say 10 users?
Comment: I don't think it is a lot, maybe 2 users? I think that maybe OpenNingia's suggestion of using VNC, would be the optimal solution if this is the route that you want to take.
Comment: Looks like that's the way to go.  But I'll present all of them and see what the team wants to go with.
Comment: VNC overcomes the 2 log-in limit and I'm sure there is more scope for sharing a desktop, something that can come in handy.
Answer: If you prefer testing within Ubuntu, then I advice you to use WINE to install IE.
You can read the guides here:
http://www.wine-reviews.net/wine-reviews/applications/ie-7-on-linux-with-wine.html
http://www.wine-reviews.net/wine-reviews/microsoft/internet-explorer-8-on-linux-with-wine.html
If you need older IE you can use IEs4linux - http://www.tatanka.com.br/ies4linux/page/Main_Page
Answer: Also consider linie, a new project aiming to make it easy to install MSIE on Linux, using wine. That's not the same as testing on an actual Windows box or VM, but it'll get halfway there.


Touchpad stops working sometimes on thinkpad t410

Question: My touchpad stops working accidentally, what can be the problem? only rebooting helps.
Comment: same with me what could be possible reason I use Dell Inspiron 1550  with Ubuntu 11.04
Answer: In 11.10 there was a problem with the daemon which disabled the touchpad when typing.  I think this should have been resolved and certainly isn't a problem in 12.04.
In general though, including for 12.04, there are problems with the touchpad and trackpoint misbehaving on Thinkpads in recent years.  There are a few workarounds.
One is to add the i8042.reset=Y kernel parameter.  e.g.:
sudo /bin/sed -i 's/^GRUB_CMDLINE_LINUX="[^"]*/\0 i8042.reset=Y /' /etc/default/grub
sudo update-grub

... and reboot.  This makes the serial driver responsible for the trackpoints more inclined to reset itself, and seems to improve reliability.
If you have problems with the trackpoint disappearing after suspend, then the psmouse-suspend-modules package from ppa:jamesf/lenovofixes will make the system reload the relevant driver after suspend, which resolves a few issues.  i.e.:
sudo apt-add-repository ppa:jamesf/lenovofixes
sudo apt-get update
sudo apt-get install psmouse-suspend-modules


Elegant way to implement a criteria-based search page in Hibernate

Question: Using Hibernate how would you design and implement a search criteria page (which has multiple editable/selectable fields/drop-downs as search criteria) such that queries shouldn't clutter data accessor code. I mean no query-string concatenation based on conditionals and ultimately all the queries should go in a separate xml file. I've done such an implementation using IBatis's dynamic queries. Couldn't find such thing in Hibernate so I started thinking what would be the elegant way to implement dynamic criteria based page in hibernate.
Comment: As far as the performance is concerned, I believe that criterion can be much better (and more cleanly) be implemented in IBatis. Hibernate just doesn't solve this problem that much cleanly but since it atleast does an effort in providing an API to do that, i'll accept the answer
Answer: Sounds like you are looking for, unsurprisingly, the Criteria API:
http://docs.jboss.org/hibernate/core/3.5/reference/en/html/querycriteria.html
Comment: Yes, that's just what the OP is asking for +1
Answer: as I had the same issue, I developed a Generic Dao class that allows dynamically(using reflection) to create the criteria based on the values assigned to the object and query the database
e.g
            Country country = new Country();
           // these values lets say they were assigned on your servlet based on the user post
            country.setName("Luxembourg");
        // This is where your service layer starts. It gets as a param the Country object
        GenericDaoDB gDaoDB = new GenericDaoDB();

        try{
            List resultList = gDaoDB.list(country);
            System.out.println("=========Result Print==============");
            for(int i=0; i<resultList.size();i++){
                 Country resultCountry = (Country)resultList.get(i);
                 System.out.println("Name:"+ resultCountry.getName()+"  Country Code:"+resultCountry.getCountryCode());
             }
        }catch(BasisException e){
            e.printStackTrace();
        }

If you like have a look on http://sourceforge.net/apps/wordpress/jprovocateur/2010/09/23/simple-example-hibernate-query-the-database-without-hql-or-criteria/ where you can find more details and the example project.
And as it is a generic class you can use it for all your Pojos
Answer: I second Affe's suggestion, the Criteria API is exactly what you're looking for and is recommended  when dealing with dynamic queries. This is very nicely illustrated in Hibernate Querying 102 : Criteria API that I'm quoting below:

Using the Hibernate Criteria API
The Hibernate Criteria API provides an
  elegant way of building on-the-fly
  dynamic queries on Hibernate-persisted
  databases. Using this technique, the
  previous 24-line example can be coded
  more consicely and more clearly using
  a mere 8 lines of code :
Criteria criteria = session.createCriteria(Sale.class);
if (startDate != null) {
  criteria.add(Expression.ge("date",startDate);
}
if (endDate != null) {
  criteria.add(Expression.le("date",endDate);
}
List results = criteria.list();

Let's have a look at the use of the
  Hibernate Criteria API in more detail.

The code shown in the article speaks for itself, just have a look.
Related questions

Hibernate: Criteria vs. HQL

Resources

Hibernate Querying 102 : Criteria API
Hibernate Criteria API: Multi-Criteria Search Made Easy


Android JetPlayer Midi Playback missing notes

Question: I've been banging my head against Midi on the Android SDK all day and, although I have music running through the JetCreator all right, there's still an issue where certain notes on certain instruments just aren't playing.  It almost sounds like the octave range is capped or something.
My general hypothesis is that the default DLS file android uses doesn't support a full range of octaves...or something like that.  I tried importing gm.dls from the Windows install into the jetfile but I had the same problem so maybe that's not it.  Programmatic music is very new to me.  There's very little user-developed documentation or help in this regard...apparently DLS is really old and everyone uses soundfonts now....which begs the question why does JetCreator still use DLS?
Anyways I'm looking for a little guidance from someone who's familiar with the library.
Comment: it turns out the files i was playing were too long?  I cut them down into single loop tracks and suddenly they played just...not sure if maybe it was just a coincidence...
Answer: Given your comment, I'm guessing that you probably tried to queue too many notes to the instruments at the same time. Did you manage to get the issue fixed?


Isolate object with / numpad key Blender 2.8

Question: When I hide a mesh by pressing Numpad /, I isolate the object, but the reference image gets hidden. For some reason my image disappears.
In version 2.7 of Blender I have seen, that the isolate works well with reference images on orthographic mode.
Maybe somewhere in preferences I can find this feature?
Or it is available only in the old version of Blender?
Answer: The / key is generating a Local (isolated) view of only the selected object, while that in a sense hides other objects, it is more like a isolation chamber rather then hiding all else and then later making things visible again (in the outliner you will see that the other objects are not being hidden).
In Blender 2.7, using Background images managed in the Properties panel opened with N, found at the bottom, it was possible to have the references still visible in Local mode, as those were not managed as objects, but bound to the view.
Blender 2.8+ deals with Background images now by using empties to hold the pictures. That makes them objects, which in turn if not selected will be locked out when you have another object selected and go in Local mode by pressing /.
Solution:
Keeping the background images visible is possible by simply selecting the images, or their corresponding empties, as well as the object you want to go in Local mode with. All selected objects will be taken in Local mode and the images will stay visible.
Comment: Thank you very much for reply.But i have separate collection for references background images.I turn off selection for entire collection in order to protect my self from accidentally select and move image. I think it will be kinda annoying each time select image and object to isolate bouth of them.In 2.7 it was so handy when background image stay visible in isolated mode.


How to interpret coefficients from regularized cox regression?

Question: I have computed regularized coxph model with LASSO penalty, some of the covariates are thus omited. But I got some non-zero betas. Is it possible to interpret these values, in some similar way as those in non-regularized coxph model?
Comment: eehh, you can use it for prediction but its interpretability is questionable in my own opinion because of the bias.  I think others may disagree, and so I will let them speak.
Comment: Typically, no.  The bias imparted by LASSO means the coefficients can no longer be interpreted as the unbiased multiplicative factor by which the hazard is multiplied per unit change in the covariate.  That doesn't stop you from interpreting the coefficients as you would, but just know it won't be exactly the same.
Comment: Thanks. The value predicted is thus also not interpretable?
Comment: Is there some reason you chose LASSO for regularization instead of ridge regression? With ridge you only have the standard problems with interpreting penalized coefficients in any regression, without the additional issue of having performed variable selection.
Comment: I have chosen LASSO because I wanted variable selection. Could you please point me to some good source about  interpreting penalized coefficients in any regression ?
Answer: It depends on what you mean by "interpret."
ISLR discusses penalization/regularization in Chapter 6 in the context of linear regression, but the principles apply to Cox regression as well. The coefficients in a penalized model still represent associations of each of the predictors with outcome, it's just that the magnitudes of the coefficients have been diminished (in LASSO, with some diminished down to 0) in a way expected to improve performance of the model on new data.
What you don't want to do with LASSO, however, is to jump to "interpret" the particular set of selected predictors as being "the only important" ones. As ISLR says on page 223: "The lasso implicitly assumes that a number of the coefficients truly equal zero." In Cox models using large sets of predictors like data on expression of thousands of genes that might be the case, but it's seldom true in studies evaluating clinical characteristics and a few biomarkers.
In those types of smaller-scale studies, most of the predictors might be expected to have some relationship with outcome. LASSO will simply throw away the predictors that were least associated with outcome in your particular data sample. It could be instructive to repeat LASSO on multiple bootstrapped samples from your data, to see how much the set of retained predictors changes from sample to sample. That taught me to favor ridge regression for such studies.
There are recently developed methods for doing inference for things like estimating confidence intervals for LASSO coefficients, including those in Cox models. See the selectiveInference package in R. I would be very reluctant, however, to over-interpret the fact that your LASSO analysis discarded particular variables.


Is accessing AllProperties efficient?

Question: I'm currently storing a few values in the SPWeb.AllProperties hashtable. But I'm thinking of adding even more data into it. Before I start using it more and more though, I wondered if using AllProperties is efficient or not. Does it cache the values in memory or have to go to the db each time? Basically, does accessing SPWeb.AllProperties have any real performance penalties. Similarly, if I access SPWeb.ParentWeb.AllProperties, does that cause any performance(db) hit?
Answer: The various property bags are backed by Hashtable objects, except for SPWeb.Properties which is a StringDictionary (essentially a strongly-typed, non-generic Hashtable). SPWeb.AllProperties is a Hashtable and is prefered to AllProperties (it also does not force lowercase key values).
The performance of all these containers is excellent (see for example here). None of them are commited to the database until you call .Update() on their parent object.
The drawback for the property bags is that they are strings, and thus need [de]serialization to store anything other than text although there is no hard limit on the size of strings you store (at least no limit in the Hashtable object itself).
See here for a specific performance test of the property bags vs SPPersistedObject.
See also Managing Custom Configuration Options for a SharePoint Application.
Update: Your comment forced me to dig into the SPWeb object a bit. Wow. It's actually pretty badly implemented, SPWeb being backed by an old, inefficient COM object. Thanks for updating my assumptions.
So first, Properties and AllProperties are backed on the same object, the difference being only that AllProperties include a ToLower() on the keys when enumerating through everything to load the Array.
Second, yes Array. For SPWeb the property bag is returned as a HashTable but it's actually a simple array of object[,], completely enumerated and loaded into a HashTable directly in the .Properties get { }, so yes it's loaded completely. Fortunately for subsequent calls the getter keeps its value locally in the SPWeb object, but that also means there is an entire local copy in every SPWeb object. .Properties is loaded into a HashTable, .AllProperty is loaded into a StringDictionnary, both from SPWeb.Request.GetWebMetainfo(this.Url) (which is COM).
So, again, do NOT use it to store very large objects. It's made for short property strings.
SPFarm.Properties is a little better (SPFarm is not a COM object). This one is a true HashTable, as SPFarm is a SPPersistedObject, itself derived from SPAutoSerializingObject. So SPFarm.Update() drops all of the object into DB, including it's HashTable. Again here, the entire property bag resides in memory as soon as you create the SPFarm object, and for the object's lifetime.
Comment: Thanks for the info. I already knew that AllProperties was a Hashtable, but what I didn't know and still don't know is how and when this get's populated and if using it causes any extra overhead. Is it populated on every request? Is it populated regardless of weather I access it directly? If I access SPWeb.ParentWeb.AllProperties, would that cause any extra trip to the db or is it already in the request context. These are things that I don't seem to be able to find out. Can you give me any insight on these questions?
Comment: What do you mean "how and when this gets populated"? It takes memory storage (size of items + a small amount for internal housekeeping), there's not much more overhead but don't store 2Gb of data in them.
Comment: I mean that I assume that data stored there must be kept in the DB. So I'm just not sure when or how the data gets pulled from the DB. Is it on every request, regardless of if I access the properties or not. And is it cached or kept in memory so that if I access it repeatedly in different web controls, I'm not causing extra trips back to the db. My main concern is just that I don't want to cause extra trips to the db, and if I was going to cause extra trips to the db, then I was just going to cache the data myself instead of pulling from AllProperties each time.

Is accessing AllProperties efficient?


How to set the field in a list as current user ID?

Question: I am creating a List where one of field is required to be the current logged in user ID, requirement is specified as the the column value should contains the current logged in User Id. I am new to SharePoint so any advice in details will be really helpful.
Answer: For that, there are two fields:

Created By - This field stores the user who has created/added the list item.

Modified By - This field stores the user who has modified/edited the list item. When a new list item is added/created, the user is same in 'Created By' and 'Modified By' fields.

Thus instead of using a new user field, you can use one of them which suits you best.


Micro Usb to HDMI without MHL

Question: I've got a cable without MHL adapter. I just want to know How can I connect it with TV.
Of course I've tried much but it was incompatible. Is there any way to make it compatible.
I've Samsung Galaxy S4 and Sony Bravia, Samsung LED on other side!
IF there has to be some signal conversions, can an android app do that ?
Answer: To connect your Samsung Galaxy S4 to a TV, you need to use an 11-pin MHL cable. 11-pin MHL cables are usually Y-shaped, and state specifically that they're for Samsung phones.
That's the only way. You can't use a 5-pin MHL cable with this phone. You can't use an app or custom ROM, or any other kind of software on the phone, to get around the need for the right cable.
See How does MHL work? for more information.

Micro Usb to HDMI without MHL


Meaning of the phrase "little too"?

Question: Does the phrase 'little too' mean same as 'very', or is it mild form of very ? For instance, I am little too comfortable talking to you. Does it mean same as 'I am very comfortable talking to you' ?
Answer: First of all, it should probably be "I am a little too comfortable talking to you".
And being "a little too X" doesn't exactly mean you're "very X" - just to a degree that you consider slightly above the limit. So being "a little too comfortable" talking to someone means that you're just slightly more comfortable talking than you feel is appropriate.
Also note that depending on the delivery, it might either be a genuine concern, or a joking acknowledgement of the relationship growing.
Comment: I suspect OP has simply used the wrong construction. It's not all that easy to contrive a context where the words as presented might be credible. On the other hand, many of us might be saying things like ***It's a little too hot for me today*** - and probably most of *those* would actually be "facetious understatement", where the true meaning is *It's **much** too hot!*
Comment: You might say: **I am small and my sister is little too** (although that's not the sense of your question).
Comment: @FumbleFingers let's say you don't know someone well, you go out for a beer and start talking about some personal things. You could say "I'm a little too comfortable talking to you" meaning that you're concerned - genuinely or facetiously - that you're talking about such things comfortably with someone you barely know.
Answer: It depends on the context and the tone of the speaker/writer.
Literally, the two phrases have very different meanings. If something is "a little too ___," it means that something is just barely above an acceptable limit. For example, "the bath water is a little too hot, so I'll wait before I get in." If something is "very ___," then it means "to a high degree or extent." For example, if you say "the water is very hot," that implies that it is hotter than if you just said "the water is hot."
However, sometimes "a little too ___" can be used humorously or sarcastically to mean the opposite, implying that something is far beyond what's acceptable, especially if the speaker emphasizes "little." For example, "the gunshots were a LITTLE too close to my house" would probably mean someone fired a gun near your house and the bullets were close enough to make you very, very scared. In this case, the speaker is using understatement to emphasize just how terrified they were.
Comment: For what it's worth, a little (emphasis is not triggered yet) too(now emphasis is triggered) ____ It's kind of a way of telling something a slight euphemism implying the speaker is not seriously taking the situation but actually the situation is serious.

Meaning of the phrase "little too"?


Create a new branch at a certain revision

Question: With mercurial it is easy to create a tag at a certain revision: hg tag -r <revision> <tag-name>. But how to create a branch at a certain revision?
Answer: Preface: Mercurial branches are two types:

named branch
anonymous

Named Branch
In order to get named branch BRANCHNAME, starting at REV
hg update REV
hg branch BRANCHNAME
...
hg commit

commit is a must, because

the branch will not exist in the repository until the next commit

as noted in hg help branch
Anonymous branch
hg update REV
...
hg commit

and current branch get additional head

And as a last step, use the following command to create a remote branch and push the changesets.
hg push --new-branch

Comment: problem: when doing `hg update 679; hg branch mybranch; hg commit`, the branch mybranch will still start at the tip of branch default, not at revision 679.
Comment: @Francois - check current rev after update with `hg id -n`
Answer: You could you hg clone -r <rev>. From the command line help (run hg -v help clone):
- create a repository without changesets after a particular revision:

    hg clone -r 04e544 experimental/ good/

Comment: Clone isn't branch per se. It will (may) appear only after hg pull|push from|to SRC repo
Comment: @LazyBadger My bad, thanks for pointing that out. +1 to your answer.


Is there likely to be much nitrogen in the Moon's inner crust?

Question: Is there likely to be much nitrogen in the Moon's inner crust? My thinking is that if we can extract enough nitrogen from the moon, we may be able to build a Terran space elevator out of Kevlar without waiting for nanotube research to advance further as discussed in more detail in Where will we get nitrogen in space?
Comment: Could you explain why enough lunar nitrogen is neccessary to be able to build a Terran space elevator out of Kevlar?
Comment: Interesting question! I edited to remove the "chatty" parts, leaving just the question that needs answering. I'm curious; why specify the *inner* crust? I'm not sure I know the difference between inner and outer crust, but is there anything wrong with nitrogen from the outer crust? Thanks!
Comment: Getting to the inner crust will be a problem.
Comment: I was thinking so we wouldn't have to launch it off of earth—I don't know much about the composition of Earth's upper atmosphere though
Comment: As for inner vs outer—the lunarpedia page I read about nitrogen did not mention the outer crust, so I imagined it to be irrelevant
Comment: More accessibility would be better, but said article said the amount of known nitrogen on Luna is "trace"
Answer: This article from Nature reports that lunar nitrogen is mostly confined near the surface and apparently came from outside sources including Earth.  Probably the Moon, with almost no atmosphere and too close to the Sun to allow ammonia ice, has no native nitrogen source and thus no nitrogen beyond what outside sources can penetrate.  The abstract also suggests that the nitrogen source would be clarified by comparing our current near-side samples with future samples from the far side.


Does content-type header having a blank value in the response body, cause any security problem?

Question: I have one HTTP request which is responding with no content value (No response body).
Is it necessary to have a content-type header specified for these kinds of responses?
Comment: What makes you think this could produce a security problem? What kind of application is parsing the answer?
Comment: I read about the content sniffing attack, so I thought that it could be exploited here. The application is built in java servlet.
Comment: Even though the mime type could be wrongly deduced, there are no content here to exploit an potential vulnerability in the parser. At most one could make crash an extremely poorly written parser (usually empty content produce fail-safe behavior), but without content to control the execution flow, I fail to see how one could exploit this bug.
Comment: @A.Hersean In a browser, content type mismatches can easily lead to XSS. For example, a server might send a JPG another user uploaded without further filtering; if the browser wrongly assumes that the content type is HTML, it will execute embedded javascript.
Comment: @ManfP Yes of course. But HERE there cannot be "embedded javascript".
Answer: A Content-Type header is applicable to a response with a body per RFC 2616:

When an entity-body is included with a message, the data type of that
body is determined via the header fields Content-Type and Content-
Encoding.

By extension, it's not necessary if there is no response body, as you're describing.
It is a SHOULD and not a MUST, so it is RFC-compliant to not include that header even if there is a response body:

Any HTTP/1.1 message containing an entity-body SHOULD include a
Content-Type header field defining the media type of that body.

As @Elhitch says, when the client has to guess what the Content-Type is, it's possible it will guess wrong with negative implications.  But that doesn't apply to your use case of 'No content value (No response body)'.
Answer: Perhaps this article in the NetSparker knowledge base might be useful to you.
"[...] a missing Content-Type header which means that this website could be at risk of a MIME-sniffing attacks. [...] The problem arises once a website allows users to upload content which is then published on the web server. If an attacker can carry out XSS (Cross-site Scripting) attack by manipulating the content in a way to be accepted by the web application and rendered as HTML by the browser, it is possible to inject code in e.g. an image file and make the victim execute it by viewing the image.


If I book a multi-city flight, will they be two separate flights or all counted as one?

Question: I booked a multi-city flight from SFO-IAH, then IAH-PUJ in August, with PUJ being my final destination. The SFO-IAH / IAH-PUJ lands and depart on the same day to/from IAH. It is all under the same airline (United Airlines). Since I booked it as a multi-city, will I receive all tickets for all the flights at SFO or do I receive the first flight's tickets at SFO and then the next flight's at IAH? Will my checked-in luggage be connected from SFO all the way to PUJ?
Comment: Does the SFO-IAH / IAH-PUJ flight lands/departs the same day to/from IAH? Is it the same airline? If not, which airlines? As it stands, this should be closed for "unclear what you're asking".
Answer: Assuming that this is all on one ticket under a single confirmation number, you should receive boarding passes for both flights when you check-in at SFO and your bags should be checked through to PUJ. When you check-in, just confirm that this is the case with the agent who tags your bags.
Note that, for the reverse trip, when you fly back into the United States from an international destination without preclearence, you'll have to clear immigration and customs at the first US port of entry rather than your final destination. There, you'll go through US immigration, claim your bags, take them through customs, and then drop them off at a designated counter (just follow the signs for connecting flights) so they can continue on to your final destination.


Formal power series is Taylor expansion of rational function iff Hankel determinants vanish?

Question: Let $$ u(T)=\sum_{n = 0}^\infty a_nT^n$$ be a formal power series over a field $K$. Then why does $u(T)$ lie in $K(T)$ (i.e. is the Taylor expansion of a rational function) if and only if there is an $N > 0$ such that the Hankel determinants $$\det(a_{i + j + M}){_{0 \le i, j \le N}} = \det \begin{pmatrix} a_M & a_{M + 1} & \ldots a_{M + N} \\ a_{M + 1} & a_{M + 2} & & \\ \vdots & & & \\ a_{M + N} & \ldots & & a_{M + 2N} \end{pmatrix}$$vanish for all $M\gg0$?
Comment: Because there'd be a linear recursion for the coefficients.
Comment: You can get this result by a slight modification of the argument presented in https://qchu.wordpress.com/2012/09/18/moments-hankel-determinants-orthogonal-polynomials-motzkin-paths-and-continued-fractions/.
Answer: Call your displayed matrix $H_{M,N}$.
Theorem The following are equivalent:

$u$ is the Taylor series of a rational function.

There is a finite sequence $q_0,\ldots, q_N$, not all zero, such that for all $m\gg0$, $a_mq_N+a_{m+1}q_{N-1}+\cdots+a_{m+N}q_0=0$.

There exists  $N$ and $M$ such that $|H_{m,N}|=0$ for all $m>M$.

There exists $M$ and $N$ such that $|H_{m,n}|=0$ for all $m>M$ and $n>N$.

Proof that 1) is equivalent to 2):
$u$ is rational iff there is a polynomial $q$ with $qu$ a polynomial.  Taking the $q_i$ to be the coefficients of $q$, we are done.
Proof that 2) implies 3):  Suppose $a_mq_N+\cdots+a_{m+N}q_0=0$ for all $ m>M$.  Then for all $m>M$,  $H_{m,N}$ kills the column vector $\pmatrix{q_0&q_1&\ldots&q_N}^T$, so  $|H_{m,N}|=0$.
Proof that 2) implies 4): Exactly as above, noting that
$$H_{m,N+p}\cdot\pmatrix{q_0\cr\vdots\cr q_N\cr 0\cr \vdots\cr 0}=0$$
Proof that 4) implies 3):  Trivial.
Proof that 3) implies 2):
Let $N$ be the smallest number with the property that there exists $M$ with $|H_{m,N}|=0$ for all $m>M$.  If $M=1$, then $u$ is a polynomial and we are done.  Otherwise there are arbitrarily large values of $m$ with $|H_{m,N-1}|\neq 0$.
Claim:  $|H_{m,N-1}|\neq 0$ for any $m>M$.  Proof of claim:  Let $m>M$.  It is pretty easy to check that
$$|H_{m,N-1}||H_{m+2,N-1}|=|H_{m+1,N-1}|^2+|H_{m,N}||H_{m+2,N-2}|$$
(I'll come back and insert a proof of this displayed equation when I have a little more time.)
By assumption, $|H_{m,N}|=0$, so $|H_{m,N-1}|=0$ would imply $|H_{m+1,N-1}|=0$, whence by induction $|H_{m+p,N-1}|>0$ for all $p>0$, contradicting the last line of the preceding paragraph.  This proves the claim.
Continue to assume $m>M$.
Note that $H_{m,N}$ is an $(N+1)\times (N+1)$ matrix of determinant zero that contains a nonsingular $N\times N$ submatrix (namely $H_{m,N-1}$) and hence has rank precisely $N$.  Thus there is a unique (up to linear multiples) column vector $\overline{q}$ such that
$$H_{m,N}\overline{q}=0$$
Then $\overline{q}$ is the unique (again up to scalar multiples) column vector killed by the top $n$ rows of $H_{m,N}$ and also the unique column vector killed by the bottom $n$ rows.  Now since $H_{m+1,N}$ is also rank 1, and because its kernel must be killed by the bottom $n$ rows of $H_{m,N}$,it follows that the kernel is again generated by the same vector $\overline{q}$, and by induction $\overline{q}$ is killed by $H_{m+p,N}$ for all $p\ge 0$, so that in particular  $a_{m+p}b_0+\cdots+a_{m+p+N}b_N=0$ for all $p>0$, which, modulo a change of notation, is 2).
Edited to add:
The displayed equation above is a special case of the following:
Theorem:  Let $a,b,c,d$ be scalars. Let $\alpha,\beta$ be row vectors of length $n$.   Let $\phi,\psi$ be columns of length $n$.  Let $B$ be an $n\times n$ matrix.  Let $A$ be the following $(n+2)\times(n+2)$ matrix:
$$A=\pmatrix{a&\alpha&b\cr\phi&B&\psi\cr c&\beta&d\cr}$$
Then
$$\det\pmatrix{a&\alpha\cr\phi& B\cr}\cdot \det\pmatrix{B&\psi\cr \beta &d\cr}
=\det\pmatrix{\alpha&b\cr B&\psi\cr} \det\pmatrix{\phi&B\cr c&\beta\cr}+\det(A)\cdot\det(B).$$
Proof:  We can assume $B$ is invertible and then premultiply $A$ by
$$\pmatrix{1&0&0\cr 0&B^{-1}&0\cr 0&0&1\cr}$$
where the zeroes represent scalars, rows or columns as appropriate.  This does not affect the truth of the theorem and allows us to assume $B$ is the identity, after which row and column operations render the desired equality trivial.
Answer: I assume this question is motivated by your earlier query on Dwork's Theorem since this is the "rational function criterion" wielded towards the end of the proof of the rationality of the zeta function. In the answer I posted there, see Chapter 5 in my linked undergrad thesis for an explanation of this proof (pdf pp. 48-50) that follows Koblitz's presentation.
Or, to avoid link-chasing, here is the relevant excerpt:
Answer: This is Lemma III, attributed to Kronecker, on page 5 of Salem, Algebraic Numbers and Fourier Analysis. The book has been posted to the web by Plouffe, at http://plouffe.fr/simon/math/Algebraic%20Numbers%20and%20Fourier%20Analysis.pdf
Comment: It is also in The Taylor Series (page 321) by P. Dienes. Also attributed to Kronecker, 1881.
Answer: I am not going to add anything new, just what is my take on it. The proof consists of four really simple steps.
Step I. Determinant is zero iff there exist numbers $b_0,\dots,b_N$, not all of them zero, such that
$$\sum_{i=0}^N a_{M+i+j}b_i=0$$
for all $0\le j\le N$.
(Proof: Basically, the definition of determinant.)
Step II. Determinant is zero iff there exists a nonzero polynomial
$B(T)=b_0T^N+\dots+b_N$ such that in the series
$$B(T)u(T)=\sum_{n=0}^\infty c_n T^n$$
we have
$$c_{M+N}=c_{M+N+1}=\dots=c_{M+2N}=0.$$
(Proof: Multiplication of series.)
Step III. The series $u(T)$ is rational iff there exists $N>0$ and a nonzero polynomial $B(T)=b_0T^N+\dots+b_N$ such that in the series
$$B(T)u(T)=\sum_{n=0}^\infty c_n T^n$$
we have
$$c_{M+N}=c_{M+N+1}=\dots=c_{M+2N}=0$$
for $M\gg 0$. (Proof: just the definitions!)
Step IV. The series $u(T)$ is rational iff there exists $N>0$ such that the determinant is zero for $M\gg 0$.
Now, I cheated in the step IV: even if the determinant is zero,  the polynomial $B(T)$ may actually depend on $M$, which is wrong! Actually, this is the hard part. The standard way to fix this is to chose the smallest possible $N$, as it is done in Koblitz.


JavaScript difference between function and new function

Question: The following JavaScript code is very confusing to me. Could anyone help me understand. Why does PersonY not have prototype property.
PersonX = function(){};
PersonY = new function(){};
alert(PersonX.prototype);
alert(PersonY.prototype);

Comment: Use `function`, not `new function`.
Comment: Just do [never ever use the second construct](http://stackoverflow.com/q/10406552/1048572).
Answer: PersonX = function(){};

Places a reference to an anonymous function into PersonX. PersonX points to a function.
PersonY = new function(){};

Places a reference to a newly constructed instance of an anonymous constructor function into PersonY. PersonY points to an object.

Regarding the prototype, PersonY has one. However, since there were no properties and methods attached to the constructor before nor after instantiation, it has a blank prototype*.
You can actually check PersonY's prototype by doing console.log(PersonY). You will see that it has a prototype property (I see it as __proto__ in Chrome) which is "blank". But it has 2 hidden properties, constructor which is the constructor function that made the object, and another __proto__ which leads you to the next "chain link" which would be the Object object.
*Not really blank since prototype is a chain. This prototype level may be blank, but the next higher prototype may have, or in this case, does have properties and methods.
Object prototype -> Constructor prototype -> Your Instance will have:
- toString()        - blank                  - toString()
- hasOwnProperty()                           - hasOwnProperty()
- and more...                                - and more...
                                             - ...but nothing from Constructor

Comment: Yes. `typeof new function(){} => "object"`
Comment: @rkmax You can't compare them. Both do different things.
Answer: That's because it is actually a object instantiated in memory as a copy of the function; the prototype really only has meaning in the context of a creation of the instance, so once it is created, there is no logical construct for what that means.


Does a Dissertation need to be one big cohesive story?

Question: I'm late into my 5th year of study. The first project I worked under as a graduate student lasted 2 years and I published 1 paper and presented at a handful of conferences. The advisor for this project is my personal/academic advisor (not the chair of my committee, since he is in a different dept). The project I am presently working on, the chair of my PhD committee is heading up (different guy).
My physics department formally requires only 1 publication for graduation.
My first dissertation proposal was on the first project. I rewrote a 2nd proposal entirely based on the 2nd project. Both were approved by the committee.
The two projects are related in that they are MRI related and at high field strength but that's about it as the first project was about human imaging and the second has to do with MR microscopy.
The chair of my committee does not want me to include this first paper in my dissertation at all. Essentially requiring me to write 3 cohesive microscopy papers for the dissertation (1 is almost done atm)
....
My question is: does a dissertation need to be a cohesive story or shouldn't it just represent the many different things I have learned/contributed to in my PhD? I would like to include the first paper I published as a chapter even though it has little in common with the rest of my dissertation. I have heard of this happening to other students and they simply put them into the dissertation as various chapters even though they may not relate.
It seems to me that the two topics are about imaging two different subjects (humans vs plants/cells/mice) but fall under the same umbrella of MRI at ultrahigh field.
Comment: I can only speak of computational mechanics. In France and in Belgium it is a cohesive story, while in the Netherlands it is a collection of published/submitted papers with few pages of introduction and conclusions.
Answer: The dissertation needs to be whatever the thesis committee needs it to be. It's rare that anyone besides them will ever read it, so theirs is the only opinion that matters.
You should work with your committee through your advisor to decide on a format for the dissertation.
If you have other work that doesn't fit in their vision for the dissertation, it's far more important and useful to your future career and the rest of the scientific community that it is published (for most fields, as a journal article), so I wouldn't worry about it too much as long as you can graduate.
Comment: @JochenGlueck Sure, maybe it varies a bit... The only times I find myself relying on a thesis is when somehow the paper itself is unobtainable, which usually raises a question about *why* it was never properly published - did peer reviewers find an error, did the authors just not care enough to get it published, etc. I think it's certainly worth polishing a thesis as if someone might read it, but mostly I don't want OP to think that something they leave out of their thesis somehow prevents them from getting credit or exposure for it.
Comment: Upvoted for the first sentence. I'm not so convinced, though, about "It's rare that anyone besides them will ever read it". I read this claim from time to time on this site, but it doesn't fit my experience: I find myself looking into other people's PhD theses quite often, and I also know of colleagues who do the same. One nice thing about PhD theses is that they are often less concise than journal articles, so there is a lot of space for additional remarks, counterexamples to somewhat natural but maybe not super-important questions, partial results, and so on.
Answer: This is largely field dependent. Usually a dissertation is on a single topic or a small set of interrelated topics. It might be a single document (typical in math) or it might be a collection of papers (common in health fields IIRC). It is unlikely, but not impossible, to be a set of unrelated papers; papers on unrelated topics.
But it is your advisor who is likely the only one whose opinion is important here. There may also be a committee who must decide (vote) to accept or reject your dissertation. If they don't approve your dissertation then you are unlikely to be given a degree. So, you need to talk to them. Learning this five years in isn't very professional, however, but I'll put that on the advisor, not yourself.
A dissertation is "normally" cohesive in some sense, but that is a judgement call. Work it out with the advisor.


UART pins interfacing with Barcode without handshaking signals

Question: I am concerned about bar code interface with LPC1768/LPC1769 controller.. If I use only UART-TX, UART-RX, GND pin of controller only to interface with barcode scanner module which has UART or RS232 option( without mapping handshaking signal),
i) is it possible to communicate with barcode device.
ii) What should I do with RTS/CTS if they are not used.
Comment: To answer that we need to know a lot more about the whole environment. You need to check the specification of the scanner. How fast can it send/receive. Does it support XON-XOFF. What is it connected to (probably a computer). How fast is that computer, how long does it take to process one scan code etc. etc.
Comment: Ok thanks for reply. My query is , if assumed data rate is not issue to LPC1768 and barcode, what pin status is required for CTS, RTS pin of controller LPC1768 to establish connection with barcode.
Comment: Add that to the question. Your actual question is: What should I do with RTS/CTS if they are not used.
Comment: Most modern RS-232 implementations run at speeds that are well within the range that modern devices and controllers can handle without handshaking (HW or SW) if they are not under heavy load.  You would traditionally connect HW handshake inputs to asserted outputs from one of the devices if you are not using them.  The exact useage of the handshake has been rather implementation specific because the standard was developed for slow modems and faster computers a long time ago, the handshake is traditionally there to pause the computer but these days it is often to pause the device.
Answer: Most barcode readers can be configured to send automatically, so you will only need the RX pin on your microcontroller.
The unused barcode reader input pins should be tied to voltages that indicate a ready state. (on rs232 this was high, so on a UART it would be low (grond)) unused outputs should be left unconnected.


Why can't we uncensor all editions of Sefer Vayikra?

Question: I heard according to our sages of blessed memory that certain editions of Sefer Vayikra were censored in Europe, because it says in Sefer Vayikra when the end comes Edom (The West/Christianity) will be defeated by Paras (Iran), so when Christians in certain areas of Europe found out about it our sages of blessed memory had to censor Sefer Vayikra in fear of Christian retribution, by changing Edom (The West/Christianity) being defeated by Paras (Iran) to Paras (Iran being defeated by (The West/Christianity), so why can't all editions of Sefer Vayikra that were censored be uncensored now a days since we are no longer under threat by Christian retribution in our current day in age.
Comment: What censorship do you mean. Do you mean the censored parts of the **Talmud**? The Torah itself was never censored.
Comment: @kouty certainly you shouldn't totally change the question without asking the op.especially when he is still active here.
Comment: To clarify, there was indeed much censorship; often self-censorship, in Christian Europe, out of fear of offending the Church authorities. However, there were no changes to the Torah as part of this. What were often changed, were prayers and poems; often beseeching God to save them from, and defeat, their enemies. This sounds closest to the the sort of textual changes you are describing, and I am guessing, that this is what you originally heard.
Comment: I think you mean "אמר רבי יוחנן משום ר' יהודה ברבי אלעאי עתידה רומי שתפול ביד פרס קל וחומר ומה מקדש ראשון שבנאוהו בני שם והחריבוהו כשדיים נפלו כשדיים ביד פרסיים מקדש שני שבנאוהו פרסיים והחריבוהו רומיים אינו דין שיפלו רומיים ביד פרסיים"
Comment: https://he.wikisource.org/wiki/%D7%99%D7%95%D7%9E%D7%90_%D7%99_%D7%90
Comment: @ShmuelBrin I edited with your link
Comment: @kouty editing the answers into questions just confused everybody. It also hurts readability.
Comment: What censorship do you mean. Do you mean the censored parts of the Talmud? The Torah itself was never censored. – sabbahillel 11 hours ago _____________________ sabbahillel Yes – arthurlerner 8 hours ago
Answer: Your premise is mistaken. The Torah/Bible was never censored. This has been proven by the fact that modern Jewish Torahs scrolls closely match the writings of the Dead Sea Scrolls. The Dead Sea Scrolls are recognized by all scholarly authorities to predate Christianity by several hundred years. And while there are minor differences between our current writings and the Dead Sea Scrolls, none of those differences have to do with censorship from Christianity.
For more info see: http://www.deadseascrolls.org.il/learn-about-the-scrolls/introduction
Comment: Yeah I was wondering. To my knowledge Torah has never been censored. Ever.


Oracle: TRUNCATE sometimes takes ages

Question: Usually, truncating a table takes 5-10 seconds. But when several people work on the same DB instance (but different tables), the operation can take more than an hour. How do I debug this?
Answer: Locks on the table or on data dictionary resources used by the 'truncate table' command could cause this.  The system could possibly be waiting around for a resource to be released before it can do the truncate.
Check whether the session is blocked waiting for a lock to be released.
Take a look at the queries described in orafaq.com/node/854 or dba-oracle.com/t_locked_rows_user_locks.htm to find out which locks might be blocking.
Comment: I don't have any to hand but there are lots of Oracle resources on the web with scripts that do this type of thing.  Take a look at the queries described in http://www.orafaq.com/node/854 or http://www.dba-oracle.com/t_locked_rows_user_locks.htm for some examples.  Google is your friend here.
Comment: Can you tell me some SQL that I can run to see what is happening?
Answer: When using SAN storage, the filesystemio_options parameter setting should be reviewed.  Setting the parameter to SETALL or ASYNCH alleviates log file sync waits during the truncate execution.
On a busy system, running additional DB writers is recommended as well.

Oracle: TRUNCATE sometimes takes ages


Difference between $R^{a}_{bcd}$ and $R_{abcd}$ Riemann tensor types

Question: What is the intuitive, geometrical meaning regarding the usual mixed Riemann tensor $R^{a}{}_{bcd}$ with respect to its purely covariant counterpart $R_{abcd}$?
Comment: Possible duplicate: [Physical meaning of the Riemann curvature tensor with all 4 lower indexes](https://physics.stackexchange.com/q/764908/2451)
Comment: The question you attach doesn't seem to ask the question.
Answer: There is no deep intuitive geometrical meaning behind a Riemann tensor with some indices moved up/down. You could say that the two variants are "dual" to each other, loosely speaking. The only new information that arises from raising or lowering an index is the underlying metric tensor. So that's where your geometric interpretation can come in, if you want to think in that way.
As an example, consider the simplest vector you can think of: the infinitesimal position coordinates $dx^\mu$. What is the geometrical meaning of $dx_\mu$ compared to $dx^\mu$? They represent the same physics, but are still dual to each other. They are dual in the sense that when you combine the them and contract the indices, you get a scalar quantity. In special relativity, you will get $ \eta_{\mu\nu} dx^\mu dx^\nu = ds^2$, where $ds^2$ is a scalar quantity that represents the (square of) the proper time. The metric tensor $\eta_{\mu\nu}$ makes the inner product work.
This idea can be generalized to any tensor with any number and positioning of indices, like the Riemann tensor. So raising or lowering indices is, fundamentally, just another way of defining an inner product under the hood, and also defining some kind of scalar.
The important question, then, is does that scalar represent something physically/geometrically?

For $dx^\mu$, the constructed scalar represented proper time.

For momentum $p^\mu$, the constructed scalar represents the mass.

For the metric tensor itself $g_{\mu \nu}$, the constructed scalar represents the number of spacetime dimensions.

For the Riemann tensor, there are four scalars you can construct from a pair of Riemann tensors, three of them being $R_{\mu \nu \rho \sigma} R^{\mu \nu \rho \sigma}$, $R_{\mu \nu} R^{\mu \nu}$ and $R^2$. The first one is often used as a measure of curvature. Another interesting scalar that you can create from a combination of these is the Gauss-Bonnet term.


Sharing Playstation Now with Vita

Question: We have a PS4 and a couple of playstation network accounts.  My account has a PS Now subscription.  My son has a subaccount on our PS4 and he's able to play PS Now games on it.  He also has a Vita that is attached to his PSN account.  Can I share the family PS Now account with my son on his Vita?
Answer: PlayStation Now can be shared on the PS4 because your account is the subscriber, and is on the same PS4 as your child's sub-account. However, on the PS Vita, only one user is supported and cannot be changed. As a result, your PlayStation Now subscription cannot be shared with the PS Vita, only the PS4.
The only way to get around this would be to sign-up to PlayStation Now on the sub-account, so you can access it on both the PS Vita and PS4. As your account will also be on the PS4, you'll be able to share the subscription.
Note: I've not tested this myself, but based on how the users work on both consoles and the sharing policies on the PS4, it should work in theory.
Comment: On a PS4 all subscriptions and games of the Primary User get shared will all other accounts on the machine. If they were to get the subscription on a sub-account they'd need to change primary user (if the family account is currently the primary user, which I assume it is). Another option would be to change the user on the Vita to the family account, though it wouldn't be his son's account. It all depends on how important the PS Now is on either account (is his son the only one that uses it) and is it important that his son plays on his own account on the Vita.
Answer: Unfortunately you cannot. The only reason he can play it on the ps4 is because your account is set as home.  But the vita only supports one account at a time, so this alone will keep you from gamesharing with a vita.  Sony really messed up a fantastic lil handheld.
Comment: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).
Comment: Hi David, did you read the other answer? This doesn't really add anything new to it.

Sharing Playstation Now with Vita


Can I do panel regression if all my covariates are time-invariant?

Question: We have a data set where our outcome of interest varies over 10 years, but the explanatory variable of interest and all of the potential confounders are time-invariant. I am quite certain that a panel regression is not possible with this data set but want to be sure I'm not missing something. With a fixed regression all the covariates drop out and the assumptions of random effects do not hold with these data. And practically speaking, does there not need to be at least some variation in the explanatory variables to model the relationship with a time-varying outcome?
Comment: Are all your EVs & covariates identical, or different from each other but constant over time? There should be no problem w/ panel / longitudinal models if the EVs vary amongst the study units but do not vary over time. This situation is quite common in biomedical research.
Comment: Fixed effects is one way of dealing with time-constant unobserved confounders, but not the only one. Perhaps you can think of an instrumental variable?

But it may well be that the causal effect you are after is simply not identified in your data. If so, you would have to be content with prediction and description.
Answer: Under some assumptions you can recover the coefficients of time invariant variables in fixed effects regressions. The reference for this would be Abowd et al. (1999). Even though their model is for hierarchical panel data the logic should also apply to the standard panel data setting. If you have a regression of the form
$$y_{it} = x_{it}\beta + \theta_i + \epsilon_{it}$$
where $y_{it}$ is the outcome, $x_{it}$ are the time-varying observed variables, $\theta_i$ are the individual fixed effects, and $\epsilon_{it}$ is a stochastic error term. Let
$$\theta_i \equiv \alpha_i + u_i\eta$$
where $u_i$ are observed time-invariant individual characteristics with the corresponding vector of regression coefficients $\eta$, and $\alpha_i$ is the unobserved time-invariant heterogeneity. Estimate the first equation with the standard fixed effects estimator. Then Abowd et al. (1999) obtain the overall individual heterogeneity component as
$$\widehat{\theta}_i = \overline{y}_i - \overline{x}_i\widehat{\beta}$$
The bar variables have been averaged over time for each individual. Now take the above equivalence and regress
$$\widehat{\theta}_i = \text{constant} + u_i\eta + \text{error}_i$$
In order to identify the vector $\eta$ (the coefficients of your time-invariant observed variables), you must assume that $Cov(\alpha_i, u_i) = 0$. This is important. Given that $\alpha_i$ is unobserved it is included in the error term $\text{error}_i$ and therefore causes omitted variable bias if $Cov(\alpha_i, u_i) \neq 0$. Except for this you also need the strict exogeneity assumption $E[\epsilon_{it}|x_{it},\theta_i] = 0$ which you generally require in panel data methods.
The alternative, as mentioned by CloseToC in the comments, is to find an instrument for your variable of interest. However, for that you need some other sort of variation in the data, e.g. your variable does not vary over time but it varies for different states. Finding good instrumental variables for such cases is difficult in general.


Compact semismple Lie group.

Question: Let $G$ be a connected Lie group with a compact semisimple Lie algebra. It is well known that the Lie algebra then can be written as the product of compact simple Lie algebras which are classified by Dynkin diagrams. I would like to know what we can say on the level of Lie groups, i.e. is it true that the Lie group then can be written as a product of compact simple Lie groups?
Answer: No, one has to take into account coverings. The smallest counterexample is $SO(4)$, which is not such a product, but whose universal cover is a product $Spin(4) \cong SU(2) \times SU(2)$.

Compact semismple Lie group.


ConEmu Transparent Background?

Question: There's a transparency option but that makes the whole window transparent. Is there a way to get the background to be transparent and not the borders nor text?
Answer: It's not possible in the current version. May be later (exists in RoadMap), but this requires much coding...
Comment: they 'could' possibly just copy the code from Console2, which already has this available and is open source. Mintty also offers the same option and is open source too.
Comment: I also don't know why but my ConEmu window disappears every once in a while, for some reason...
Comment: Console2? Really? Show screenshot. Also, ConEmu can't disappears without reason. May be your shell was terminated. Not ConEmu.
Comment: Haha it's interesting how I said "They", but then I noticed your icon, checked out your account and found out that you're the developer! But yea, console2 can do it and that's the only leverage it currently has over your emulator. It's presented in their one and only screenshot here: http://sourceforge.net/projects/console/
Comment: ConEmu does the same thing with transparency. I can draw in photoshop anything... Provide your own screenshots where Console is good and ConEmu transparency is worse.
Comment: **And** you may easily to be convinced, that borders and text **are** transparent on SF screenshot. What leverage you are talking about, heh? :-P
Comment: I just tested it, and yes you're right. Console transparency is the same as ConEmu, and I do sincerely apologize. :) mintty is also the same thing.

ConEmu Transparent Background?


How does doping affect the color of a semiconductor?

Question: Does P/N doping a semiconductor affect the color in some straightforward manner?  Say the material starts as a yellow color and it is p doped, what can we expect from this information or what information do we really need.
Comment: Diamond does change color. Silicon is dark and shiny regardless of doping.
Answer: Dopant affects band gap of material. The band gap determines the wavelength of light that the material absorbs. The color of material depends on what light it absorbs.
Maybe P/N dope affects color of material. If you draw the band gap of material using any method (Density functional Theory or etc), you can predict color of material some extent.
In real world, color of material is more complex than I said. I don't know if it can predict the color of matter perfectly.
Comment: No. Doping does not change the band gap.
Comment: I was wrong. In 2D BP, potassium doping changes band gap, so I did think it is general phenomenon.
Comment: @Pieter Doping does change the band gap technically though?  Although it will depend on thermal effects, I believe P doping introduces empty electron holes which are easily excited into, but this does decrease the band gap does it not?  It may be a slight effect though.
Comment: @TristanMaxson Doping introduces states in the band gap. Shallow donors or shallow acceptors are close to band edges, but the concentrations are far too low to change the band gap.


Reset Python version to default

Question: Regrettably, I followed a tutorial and set PYTHONPATH to qgis\apps\python. After doing so, typing python -V in the OSGeo4W Shell gives Python 2.7.14.
Previously, the result was Python 3.7.0, which is the version I want.
I deleted the PYTHONPATH variable and rebooted my pc, but version 2.7 remains the default in the shell.
How can I restore Python 3 to the default again.
Comment: You can check your PATH environment variable, the python version you are getting now is the first one your PATH can find, in this case 2.7
Comment: It would be nice if it were that simple, but that's not it. The python version on my system is 3.7.3, and that takes first place. I don't use version 2 since its end of life. The python I am accessing is associated with qgis, which has both version 2 and 3, and runs from the OSGeo4W Shell.
Comment: I just found the solution.
Answer: I found the answer in this post.
I just needed to run py3_env.
Now python -V returns Python 3.7.0

Reset Python version to default


Why should I zero-pad a signal before taking the discrete Fourier transform?

Question: In an answer to a previous question, it was stated that one should

zero-pad the input signals (add zeros to the end so that at least half of the wave is "blank")

What's the reason for this?
Comment: Well it's a very general question.  You can zero pad to make something a power-of-2, you can zero pad to make circular transform behave like non-circular transform, you can do it to resample a signal, to change frequency resolution, etc. etc.
Comment: It depends on what you're doing.  This could have been a comment on my answer.  I added some explanation to it.
Comment: @endolith: I initially thought to put it as a comment, but I think the question may be of general interest, and that it would be a pity if a good answer to it was buried in comments somewhere. If you disagree, I'll delete this question.
Comment: Also related: http://dsp.stackexchange.com/questions/331/frequency-domain-zero-padding-special-treatment-of-xn-2
Answer: Zero padding allows one to use a longer FFT, which will produce a longer FFT result vector.
A longer FFT result has more frequency bins that are more closely spaced in frequency.  But they will be essentially providing the same result as a high quality Sinc interpolation of a shorter non-zero-padded FFT of the original data.
This might result in a smoother looking spectrum when plotted without further interpolation.
Although this interpolation won't help with resolving or the resolution of and/or between adjacent or nearby frequencies, it might make it easier to visually resolve the peak of a single isolated frequency that does not have any significant adjacent signals or noise in the spectrum.  Statistically, the higher density of FFT result bins will probably make it more likely that the peak magnitude bin is closer to the frequency of a random isolated input frequency sinusoid, and without further interpolation (parabolic, et.al.).
But, essentially, zero padding before a DFT/FFT is a computationally efficient method of interpolating a large number of points.
Zero-padding for cross-correlation, auto-correlation, or convolution filtering  is used to not mix convolution results (due to circular convolution).  The full result of a linear convolution is longer than either of the two input vectors.  If you don't provide a place to put the end of this longer convolution result, FFT fast convolution will just mix it in with and cruft up your desired result.  Zero-padding provides a bunch zeros into which to mix the longer result.  And it's far far easier to un-mix something that has only been mixed/summed with a vector of zeros.
Comment: The last paragraph is the key answer to the original question, although I think it could be stated more clearly. Zero-padding in the context of correlation or convolution can be done to ensure that implementing the process in the frequency domain yields *linear* instead of *circular* convolution/correlation. However, doing so is not a requirement if you're willing to do some bookkeeping work on the side, like in the overlap-save and overlap-add algorithms.
Comment: Indeed; multiplication of the DFTs of two signals does always implement circular convolution. I should have worded it differently: you stuff zeros at the end of one signal to ensure that the result obtained by circularly convolving them is the same as what you get if you linearly convolve them (assuming that linear convolution is what you want, which is usually the case).
Comment: @Jason R: Actually, they are both circular convolution.  A normal (non-pruned) FFT does all the multiplies and adds for the wrap around part of the result.  It's just that in the sufficiently zero-padded case, all those multiplies and adds are of the value zero, so nobody cares about the nothing that is computed and wrapped around the circle.
Answer: There are a few things to consider before you decide to zero pad your time-domain signal.  You may not need to zero pad the signal at all!
1) Lengthen the time-domain data (not zero padding) to get better resolution in the frequency domain.
2) Increase the number of FFT points beyond your time-domain signal length (zero padding) if you would like to see better definition of the FFT bins, though it doesn't buy you any more true resolution.  You can also pad to get to a power of 2 number of FFT points.
3) When fiddling with the FFT points (in the previous point), make sure your frequency points end up where you want them.  The spacing of the points is $f_s/N$, where $f_s$ is the sampling frequency and $N$ is the number of FFT points.
There are some nice figures illustrating these points at http://www.bitweenie.com/listings/fft-zero-padding/
One last thing to mention:  If you zero pad the signal in the time domain and you want to use a windowing function, make sure you window the signal before you zero pad.  If you apply the window function after zero padding, you won't accomplish what the window is supposed to accomplish.  More specifically, you'll still have a sharp transition from the signal to zero instead of a smooth transition to zero.
Comment: upvote for the good link
Answer: In general zero-padding prior to DFT is equivalent to interpolation, or sampling more often, in the transformed domain.
Here is a quick visualization of how the opposite works. If you sample a bandlimited signal in time at higher rate, you get a more 'squashed' spectrum, i.e. a spectrum with more zeros at both ends. In other words, you can obtain more samples in time by simply zero-padding in frequency after DFT'ing, and then IDFT'ing the zero-padded result.
The same effect holds in reverse when zero-padding occurs in time. This is all because the perfect signal reconstruction is possible as long as a signal is bandlimited and sampled at least at the Nyquist rate.
The term 'resolution' depends on how you define it. For me, it means how well the two adjacent points of observation in time or frequency can be reliably (statistically) discriminated. In this case the resolution actually depends on the DFT size due to spectral leakage. That is, smaller the window size, more blurry or smeared the transformed signal, and vice versa. It is different from how often you sample, or what I term 'definition'. For example, you can have a very blurry image sampled at high rate (high definition), yet you still cannot obtain more information than sampling at lower rate. So in summary, zero-padding does not improve resolution at all since you do not gain any more information than before.
Answer: If one has any interest in the spectrum of the windowing function used to isolate the time-domain sample, then zero-padding WILL increase the frequency resolution of the windowing function.
If the time signal is $x(t)w(t)$, where $w(t)$ is the windowing function, then the overall spectrum is $X(f) * W(f)$, where $*$ inidicates convolution.
If your windowing function is a simple rectangle (an extraction of some set of values from $x(t)$.  Then $X(f)$ is the sync function.  So, for example, if Nfft is the same as the width of your rectangle, and you had a sinusoid at precisely one of the bin frequencies, then the samples of the sync function that would appear centered on that bin happen to fall exactly at the off-peak zero crossings, and you don't see the shape of the sync in the spectrum at all.  If you now zero pad your data going into the FFT, you'll see some samples at places other than the peak and the zero crossings, revealing the shape of the sync function in the resulting spectrum.  So of what use is zero-padding?  It is certainly of educational use in revealing the nature of the discrete transform of windowed signals, which is the usual case.  In a practical sense, it could be useful in any case where you are interested in the spectral shape of an isolated envelope riding on a carrier wave.
Answer: There can be different reasons for this depending on any processes carried out before and after the Fourier transform. The most common reason is to achieve greater frequency resolution in any resulting transform. That is to say that, the larger the number of samples used in your transform, the narrower the binwidth in the resulting power spectrum. Remember: binwidth = sample_frequency/transform_size (often called window size). You can imagine from this, that as you increase your transform size, binwidth reduces (=better frequency resolution). Zero padding is a way of increasing the transform size without introducing new information to the signal.
So why not just take a bigger transform without zero padding? Would that not achieve the same effect? Good question. In many cases you may want to analyze a stream of time domain data, for which you may be using a short time Fourier transform (stft). This involves taking a transform every N samples according to the time resolution you need in order to characterize changes in the frequency spectrum. Here in lies the problem. Too big a window and you will lose time resolution, too small a window and you will lose frequency resolution. The solution then is to take small time domain windows giving you good time resolution and then zero pad them to give you good frequency resolution. Hope this is useful for you
Update
I did not explain this well. I should have clarified it better. Referring to a windowed transform, indeed you get no 'actual' greater frequency resolution but for visualisation purposes (reading the power spectrum with the eye) it can provide clearer results. Using the critical sampling rate, each side lobe occupies a single bin, which depending on the graphing technique could be misleading. Zero padding provides an interpolated frequency spectrum which may be more revealing. Additionally, if you are using a simple peak picking method for frequency estimation, the spectral interpolation effect of zero padding will give you a spectral sample closer to the true peak of the main lobe. This link provides some useful diagrams: http://www.dsprelated.com/dspbooks/sasp/Practical_Zero_Padding.html
Comment: This answer is not correct. Zero-padding does not improve frequency resolution at all; it merely interpolates between the outputs of the smaller transform. You can think of zero-padding as adding more frequency bins that have the same bandwidth as they do with the smaller transform; therefore, from a filter bank perspective, their passbands overlap.
Comment: If it helps understanding: You can also do the opposite: take the FFT of a signal, then zero-pad the result, and inverse FFT.  This will have the effect of interpolating the original signal.  But of course the signal will still be the same signal, with the same Nyquist bandwidth.  Interpolation won't give you more higher frequency information than was originally there.
Comment: @Jason R - You are right, my answer was misleading, I have attempted to clarify above on the original post. I should not have stated that zero padding increases frequency resolution.
Answer: I did not see these mentioned in the prior good responses so I will add the following additional important reasons for zero padding:
Radix-2 algorithms are more efficient so zero padding out to the next power of 2 (or power of 4 in some cases for radix-4), or more significantly avoiding any large prime factors can improve real time performance. Also when using the FFT for analysis, zero padding is often done to compute samples of the DTFT, such as determining the frequency response of a FIR: compare fft([1 1 1 1]) to fft([1 1 1 1], 512) which is identical to freqz([1 1 1 1]).


Drupal site that points to a non-drupal .html page

Question: I'd like to configure my Drupal 6's site's front page to be "foo/index.htm", a hand-coded html file. But when I put that relative URL into Home › Administer › Site configuration › Default Front Page, it complains "The path 'foo/index.htm' is either invalid or you do not have access to it." It's a unix filesystem and everything is world-read, and the directories are world-execute. What could be the problem here?
Answer: The issue is the path in question here must be a valid Drupal path, not a Unix path/filename.  I'd suggest investigating hook_menu() as a first step of learning about Drupal paths, callbacks and so forth.
Answer: The code that is causing that error is part of the form validation handler for the form you are submitting. (See system_site_information_settings_validate().)
// Validate front page path.
if (!drupal_valid_path($form_state['values']['site_frontpage'])) {
  form_set_error('site_frontpage', t("The path '%path' is either invalid or you do not have access to it.", array('%path' => $form_state['values']['site_frontpage'])));
}

drupal_valid_path() considers the passed path valid if:

It is <front>
It is considered external, i.e. an absolute path starting with the protocol string
It is a path defined from a module

Notice that the form validation handler doesn't check the value for the front page path is a relative path, but drupal_is_front_page() contains the following code.
$is_front_page = ($_GET['q'] == variable_get('site_frontpage', 'node'));

This means the path for the front page needs to be relative.
Answer: I would actually look at modifying the .htaccess file to serve your HTML file instead of Drupal's index.php when someone attempts to visit your homepage.
If you look at the .htaccess file provided by Drupal, it only serves index.php when a file or directory does not exist on the server (lines 109-113). You can put a new rule right before that and tell Apache that rule should be the last rule run (which will skip any remaining rules if the conditions are matched). I think the following should work (based on the answer Htaccess rule to redirect domain to index.html):
RewriteRule ^$ foo/index.html [L]

As long as that rule runs before the Drupal rule that routes all traffic through index.php, it should serve your homepage instead of the default Drupal homepage. This will work as long as your homepage has a URL like http://www.MYDOMAIN.com/ and the user doesn't type anything else (like index.php or index.html). You'll also need to make sure that all links to the homepage inside Drupal point to the correct URL (for example, the logo link, etc).
Also, because this is a modification to the .htaccess file, you'll need to make sure to copy the change over to the new .htaccess file when doing Drupal core updates.
Answer:
Use Front Page module, in the configuration page, 'Home links' tab, set to 'xxx.html'.
Done.


Referencing New Cells When Original Selected Cells are between unwanted cells

Question: We have a Google sheet that we want a set number of rows and columns to be referenced into another sheet. However, those rows and columns are in the middle of the original sheet, and we want additional entries to populate in the new sheet without any outside cells from the selected cells in the original to populate in the new sheet.
Answer: You are probably looking for IMPORTRANGE
From the ImportRange functions page

Imports a range of cells from a specified spreadsheet.
    Sample Usage
    IMPORTRANGE("abcd123abcd123", "sheet1!A1:C10")
    IMPORTRANGE(A2,B2)
    Syntax
    IMPORTRANGE(spreadsheet_key, range_string)
spreadsheet_key - The long sequence of characters in the "key=" attribute of the URL. In the new Google Sheets, use the entire URL.
The value for spreadsheet_key must either be enclosed in quotation marks or be a reference to a cell containing the appropriate text.
    range_string - A string, of the format "[sheet_name!]range" (e.g. "Sheet1!A2:B6" or "A2:B6") specifying the range to import.
The sheet_name component of range_string is optional; by default IMPORTRANGE will import from the given range of the first sheet.
The value for range_string must either be enclosed in quotation marks or be a reference to a cell containing the appropriate text.
Notes
    A maximum of 50 IMPORTRANGE calls are supported on a single spreadsheet. This limit is removed in the new version of Google Sheets.
    In the new version of Google Sheets, spreadsheets must be explicitly granted permission to pull data from other spreadsheets using IMPORTRANGE. The first time the destination sheet pulls data from a new source sheet, the user will be prompted to grant permission. Once access is granted, any editor on the destination spreadsheet can use IMPORTRANGE to pull from any part of the source spreadsheet. The access remains in effect until the user who granted access is removed from the source.

If you can't find the key, you can use the URL of the sheet you are referencing.
If I misinterpreted your question, let me know.
Comment: It sounds to me like the OP is trying to import multiple ranges of cells at once so that it DOESN'T import a specific range, eg. import Rows 1-5 but NOT 3. I think IMPORTRANGE is on the right track, but a way to exclude a given range would need to be implemented into the function somehow.
Comment: Spent a few hours trying to find a way to do this. Couldn't find one. Closest way is to make an array for each column or row.
Comment: Well, the OP never clarified anything so +1 for your effort.


Building a Time Series Model

Question: I am working on building a time series model, but the dataset I have only has date features for the year; the month and date are not available. What would be a suitable model to use and is it even possible? The dataset is an Excel file from different years I have merged into a single sheet with records for each year arranged in alphabetical order.
Answer: The first question about applying time-series models is whether you can detect some patterns by yourself or not.
For instance, if you find that the values rise every last week of the month, then you might expect time-series models to be useful.
But if your data is too coarse to extract anything interesting because of external and unpredictable impacts (ex: economic crisis, accident in several stations, etc.) the added value would be too limited.
In addition, you should gather enough data to teach the model patterns. Consequently, if you only have weekly data, you should have at least 3 years (~150 records) to teach the model some patterns due to seasonality and the impact of special events (ex: stock market crash).
You could add some external data like weather or other products associated with your values. This would improve the model prediction quality.
Comment: Thanks a lot for that input @Nicolas Martin I have over ten years worth of data however I am skeptical about the format the data is in as it is arranged alphabetically and not chronologically with only the features displayed above, would it be possible to create a time series model from this data as It is almost impossible to arrange it in its original chronological order after collection from source, and what model could accommodate for this thanks.
Comment: Does it make sense to predict data alphabetically ? If not, you should order your data with a dataframe for example. https://www.adamsmith.haus/python/answers/how-to-sort-a-pandas-dataframe-by-date-in-python
Comment: Just as I suspected thanks alot for your input @Nicolas Martin
Comment: You're welcome @Kev_Dev1. If the answer is valid, could you accept it please?
Comment: For sure let me do that.

Building a Time Series Model


Relation between UnitOfWork and DataMapper

Question: I have been studying DDD for 1.5 weeks now, and I came a cross the use of the Unit Of Work pattern together with Data Mapper pattern. I understood why they are both important and when to use them but, I couldn't find anywhere how the Data Mapper can "know" that a save method, for example, was called in the middle of a transaction or not. Is there something wrong with the Data Mapper being aware of the Unit of Work? Something  tells me that is not the right way to go.
Answer: The boundary for a Unit of Work is time.  It answers the question: What all are we changing in this one transaction?
The boundary for a Data Mapper is space.  It answers the question: What all is part of this one data structure?
The unit of work is used to prevent hitting the database too often by sending every little chunk of info one at a time.  The data mapper translates the structure of those little chunks in memory to the structure of those little chunks on disk, and vise versa.
These don't need to know about each other.  A single unit of work may involve many data mappers.  A single data mapper may involve many units of work.  The two are orthogonal to each other.
Comment: But when Martin gives an example of implementation for the Unit Of Wok on his commit method, to add the new created objects he simply loops through them and calls the save method on the right Mapper. So if the Mapper is not aware of the Unit how is it suppose to know to treat the saves as a transaction?
Comment: That's an implementation choice.  Absolutely no reason it has to be done that way.  A Unit of Work is just everything you want to tell/ask the database at once.  The only limitation on work is getting to a point where you don't know what to do next until it's work is done.  Where the data mapper puts its data is really not a concern in this context.
Answer: The data mapper has to know about the unit of work. You would typically pass the UoW to the mapper using DI.

I understood why they are both important and when to use them but, I couldn't find anywhere how the Data Mapper can "know" that a save method, for example, was called in the middle of a transaction or not.

A single UoW instance represents one active business transaction, the fact that the mapper has a valid UoW instance implies that you are in a business transaction and things are not committed yet; also whether the transaction is committed or not is of no concern to the mapper. UoW lifetime management happens at a higher level (E.g for a web app it is usually UoW er request).
Comment: Dependency injection
Comment: Sorry, what do you mean by DI?


LAURA/LORETA source localization in Matlab

Question: Is there a Matlab toolbox for doing source localization using LAURA or sLORETA within Matlab (not requiring additional software like LORETA-KEY, etc.)?
Answer: The open-source Matlab package called Fieldtrip has a source analysis function in which you can specify the method you want. These include both sLORETA and eLORETA.
In case you did acquire LOERTA-KEY, you also import sLORETA files into Fieldtrip and continue further analyses.


Will a Smart Thermostat Work with this Setup?

Question: I currently have a thermostat with two wires: a C wire that powers the thermostat and an R wire that controls both the heater and central air. It's my understanding that smart thermostats won't work with this type of 2 wire setup. I've been trying to research this and not coming up with much. I did see an article about plugging the R wire into the RH terminal and connecting a jumper wire to the RC terminal. Could this work?
Comment: On the thermostat I switch between heating and cooling by the the touchscreen.  It is a Pro1:
 Model#955WHhttps://www.pro1iaq.com/images/900Manuals/PM-955WH-IM-Installation-Manual-Alitho-1845.pdf
Comment: Are you sure there are only 2 wires?
Comment: For smart thermostat to work  you would have at least 4 wires, two in and two out. If you have only 2 wires coming the smart thermostat will not work. In that case you only need dumb turn dial thermosat
Comment: I just don't see how two wires can control two devices (except with lots of smarts, but that is not the case normally). I would expect a minimum of 3 wires - some sort of common + heat + cool.
Comment: I added a picture if that helps any.
Comment: Is there a model # on the thermostat? To switch between cooling and heating, do you do everything from the thermostat? Or do you have to flip another switch at the central equipment as well?
Comment: If your current setup works, then leave it alone for a few months. The beginning of winter is *not* the time to be experimenting with your heating system.
Answer: This is not a typical thermostat. It is, arguably, already a smart thermostat. Based on the manual link added in comments, this is a Pro1 955WH.
All the traditional connections (RC, RH, C, Y, G, etc.) are in a base unit which is hardwired within several feet of the HVAC equipment. The thermostat is actually a wireless remote, but it can (and generally should) be connected with a pair of wires to provide power instead of relying on batteries.
Replacing this with a Nest or other advanced smart thermostat (e.g., internet monitoring and control) would either require running a new multi-conductor thermostat cable or replicating this setup by placing a base unit near the HVAC equipment and a thermostat remote ("zone") in the preferred thermostat location.
If you replaced the existing thermostat with a 2-wire (presumably heat or a/c only) thermostat, it would not operate the HVAC equipment in any way.
Update based on picture of base unit and comments:
You should be able to either put a new thermostat in place of the base, or splice in 18/5 (or even more wires if you want to future-proof) cable from the base location to the desired thermostat location. If you are going to do that, I would recommend first doing a trial install of the new thermostat in the base location. Assuming it works - heat, cool, fan all turn on/off as expected - then use wire nuts to attach the new cable to the old wires and run the new cable to the desired location and install the thermostat there. While thermostat wires do not need to be in a junction box, putting the wires and connections inside a small junction box may be a good idea just to keep the connections out of harm's way.
Comment: Okay now that makes some sense to me!  I've seen the unit in the basement but didn't realize that's what it was.  Are you aware of any base units that would be compatible with the Amazon smart thermostat:  https://www.amazon.com/dp/B08J4C8871/ref=twister_B09DFNGW8N?_encoding=UTF8&th=1   Lastly, my thermostat doesn't require batteries to work, I just tested this by pulling the batteries out and putting it back on the wall and it worked.
Comment: Sorry, I don't know anything about the Amazon thermostat. Correct that your thermostat does not need batteries - the pair of wires connecting the base and the thermostat provides power.
Comment: Ahhhh. So the approach I "just invented" is, in fact, already in use. Figured it ought to be possible, had started wondering why the smart thermostat I'd seen didn't use it -- probably they just didn't want to license the patent. MANY thanks for the education!
Comment: Patent license costs are definitely an issue with some of these things. But there are often installation issues that make wired better (don't have to worry about steel doors or thick walls in between) or wireless better (don't have to deal with wires, except power). No one-size-fits-all solution.
Answer: Ruskes is slightly off -- a smart thermostat doesn't REQUIRE Y, W, and G any more than a dumb one does. However, like other modern thermostats, it is designed to be able to take advantage of these more precise controls if the HVAC system exposes them and the thermostat cable has the wires to make them available. You can use a smart thermostat in an older system that has only heat/no-heat, it just won't be as versatile. And you'll have an issue getting power to it.
Unfortunately most of the "smart" thermostats draw too much power to run from batteries, and generally they try to get their power from the system they're controlling. That, obviously, requires a few more wires, which means you need to think about using the existing wire to pull a replacement cable through the building. If you're lucky that can happen fairly smoothly, but don't bet on it being a simple straight-line pull. (I replaced the 4-wire runs in my house with 7-wire a year or two ago, but to do so I had to access the upstairs thermostat's wire from the attic since it went up there and then back down into the wall.)
Some smart thermostats have a way to run off a special plug-in power supply without having separate 24V power in the thermostat wires. But I'm not sure whether any of those will work all the way down to a two-wire configuration. (I can see how they might, using the same pair of wires for power and digital signalling, but I don't know the details of how they're implemented and I haven't tried using them.)
All I can suggest is contacting the manufacturers, telling them what you have to work with, and asking them if there's an adapter that will let you use their product with this system without replacing the wiring.
Or just go for an older-style clock-thermostat, which will run on batteries. That won't give you remote control of heating or the fanciest controls, but it will let you set separate temperatures for weekday sleep, weekday waking, weekday working hours, weekday evenings, weekend sleep and weekend days, and let you set the times of the day at which each of these is selected. That's enough to let you achieve some nontrivial savings on heating costs. And clock-thermostats are CHEAP these days.
Comment: Phantom power -- sorry, sound technician term. Actually a slightly different concept, too. In this case I'm actually speculating that it's something closer to X10 signalling, or coupling a higher-frequency signal in, or perhaps just pulsing the current draw -- with modern electronics there are multiple solutions to pushing a signal on top of the power pair, as long as the devices at both ends agree on how it's going to be done.  No, I didn't "just invent" any of this.
Comment: Depends on how they set this up. My impression is that this is a "phantom power" kind of situation, where digital signalling is imposed onto the same wires carrying the power and at the power supply those signals are converted back into opening and closing a relay. That's certainly doable, and if I was designing this retrofit adaptation that's exactly what I would have done. As to whether it's how the manufacturers actually addressed this use case -- as I say, I haven't worked with these, only seen some  installation docs; ask the manufacturer, or get one and reverse-engineer it yourself.
Comment: @Ruskes Not "just invented". Power and signal on same line is quite common for phones and many other things. As far as I can tell, this particular thermostat actually uses a wireless (not "WiFi") signal but the concept is quite valid.
Comment: @manassehkatz-Moving2Codidact maybe before digital/wireless age
Comment: (Actually, if you're gong to go that route, it might even be possible to push the full 7-wire signal and power through the single pair. That one I *am* inventing on the fly. Except that we've just been told it's already in use by this very thermostat; see other answers. Digital is actually easier to piggyback on power than analog.)
Comment: @keshlam Definitely better to handle actual HVAC in base - allows for multiple thermostats, sensors (temperature reading but no user interface), remotes, etc.
Comment: These days some of that can be handled in the smart thermostat itself -- some of them can have remote temperature sensors tied to them by radio, though they're still only controlling the one heating zone they're directly attached to. Fancier logic is certainly possible, and would want to be centralized somewhere.
Comment: Thanks to everyone for helping me figure this thing out!  Clearly I don't have the normal setup.  I also don't have any manuals from when this was installed.  Anyways, I found the power unit attached to my heater, pulled the face off, and took a picture of the wiring connections (added to post).  It looks to be typical thermostat 18/5 wire.  Couldn't I just splice a new piece of 18/5 onto this and run the wire up to a new thermostat?  There's already a hole in the basement ceiling where they pulled the original wires through.
Comment: My home only has 1 zone so just need to wire 1 new smart thermostat.