Difference in photographs and real life?

Question: So im new to photography. I was wondering, is there a difference in how our pictures appear in, say a selfie click (from the back camera, not front) and how we look in real life. I know the mirror image factor is there, but apart from that, what other differences are present?
Comment: Everyone looks like a dork in a selfie, but some people don't always in real life.
Comment: One of the most important things to keep in mind in photography is that **the camera does not see things like you do**. You must get used to how your camera sees things in order to get the results you want.
Answer: Here's a gif made of photographs taken with different focal length with same crop factor. So the focal length alters the shooting distance and thus perspective and shape of the object (you).
You can also (ab)use white balance, colour shifts and "artistic" filters.
And finally, you can photoshop!.
Comment: The difference is due not to the focal length but to the different shooting distances needed to frame the subject with the various focal lengths. This is called *perspective*. If you use a wide angle lens to shoot from the same distance as a telephoto lens and then crop the picture to match the telephoto framing you'll also get the same perspective. For more, please see [What is the difference between perspective distortion and barrel or pincushion distortion?](http://photo.stackexchange.com/questions/85526/what-is-the-difference-between-perspective-distortion-and-barrel-or-pincushion-d)
Comment: See also: [Is there a difference between taking a far shot on a 50mm lens and a close shot on a 35mm lens?](http://photo.stackexchange.com/questions/76321/is-there-a-difference-between-taking-a-far-shot-on-a-50mm-lens-and-a-close-shot)
Comment: @MichaelClark If you are about to shoot 12Mpx picture and crop it to 100x100 px picture, you are right. If you aim to same sensor coverage, only parameter to change the perspective is focal length.
Answer: Our eyes have a look that is similar to what you'd get out of a 50 mm lens (standard lens) which is why so many people (including me) love shooting at 50 mm. Phone cameras have a much wider field of view and that distorts the image in certain ways.
Our brain also doesn't capture image by image as a camera does, it's more analog than that (somebody will sure explain better than myself). What I'm saying is that our eyes and brain work in tandem to do something like HDR, exposing different areas of our view with different levels. Which is why when we look at a room with a window, we can clearly see the inside of the room and the outside correctly exposed. Cameras tend to struggle and you can achieve results like the eye after fiddling with either multiple exposures by bracketing or in post.
Hope i helped.
Comment: The human field of vision is *much* wider than that given by a 50mm lens on 35mm film. It's easy to test: just look through the viewfinder with a 50mm lens attached, then take the camera away from your eye and note that you can see a lot more of the scene than you can through the viewfinder.
Comment: This is true, but it's just a function of how the optics of the eyepiece are designed. If you use an eyepiece magnifier, you'll find that a 50mm lens gives a bit of zoom and a slightly wider lens is "the same as the human eye". I like the look of photos shot at 50mm (or about 30 on a crop sensor DSLR) but I don't think you can say it has anything to do with similarity to the human eye.
Comment: There's a relationship between focal length, print size/viewing distance and whether the perspective in an image looks natural.

Take an image with a [FF equivalent] focal length of 10mm, and it will look really distorted in a small print. But print that image so large it fills your field of view and the perspective will appear quite normal. 50mm is simply the focal length that gives natural perspective when an average sized print is viewed from an average distance...
Comment: Yes, I probably shouldn't have said field of view, my mistake. What i meant was that when you looked through the lens of a 50mm lens, while keeping your other eye open as well, you'd see pretty much the same level of zoom. Because of that, the depth of things we see and the depth the camera perceives is similar which makes the photo look closer to real life.
Answer: Yes there is potentially a big difference because of a whole range of factors.
One of the most important is that (most) humans have stereoscopic vision and that, combined with other more subtle clues allow us to interpret the world in 3 dimensions. In a flat image we have much less to go on and have to rely on variations in light and shade, combined with our experience of the general shape of human faces to deduce their 3 dimensional shape. This can easily be distorted by lighting and exposure.
Similarly the type of lens used can distort the image compared to what we are used to with our own eyes. With extreme wide angle lenses this can be fairly obvious but more subtle distortions are harder to spot, especially as a human face has no straight lines to act as a reference.
Another effect is that when we interact with real humans they are not static and even very subtle changes in expression can have a significant difference on how a face is 'read' while a photograph just gives us one static instant, plus the fact that a moving face allows us to see different angle which helps us to form a more accurate 3 dimensional image.
A related factor is that when we know are being photographed we tend to freeze and often adopt a somewhat unnatural expression and posture, especially if the photograph takes some time to set up. Professional portrait photographs will often take dozens if not hundreds of shots just to get the one expression they are looking for and may use various techniques to distract or relax the subject.
Equally lighting and exposure can hide or accentuate details, especially skin texture and the relative hardness of softness of the contours and lines of a face, especially for things like the nose, jawline  and around the eyes.
Human skin is also difficult to photograph accurately as has a lot of very subtle variations in tone and texture as well as variations in translucency and shine.
Answer: 1) The camera photo is not a snapshot. The camera records the effects of incoming light over a fraction of a second. This means that the effects of movement are recorded in the final image.
2) Our eyes are stimulated by light and the stimulation continues for a fraction of a second after the stimulation is taken away. This affects how we see the world too. We are never viewing a static image.
3) If you hand-hold your selfie, then it will be pretty close to your face. When another person looks at you in person, they will usually be further away from you than your camera. The distance between them and you, or between the camera and you, defines the perspective - from the camera, or other person, toward you. The closer the camera is, the more distorted you will look in the photo. It is not that the camera is making a mistake, it is just that from the camera's perspective, that's how you look. In real life interactions we very rarely get that close to look at someone (except maybe a lover :D ) - which is why the selfie looks unusual.
4) Finally, some lenses will noticeably distort images also - such as fisheye lenses.
Answer: The previous answers already cover a lot of ground, but just want to say that there is no mirror image issue with photography; that is, the camera/lens won't flip a scar from the left side of your face to the right side in a photo.


Post-installation Apps Running Slow on 18.04 LTS: Discord and Steam

Question: I recently installed Ubuntu 18.04 on a second hard drive. Whenever I open up apps I added after system installation (e.g., Discord and Steam), they run super slow, but every program included in the installation runs fine.
FYI: I have 7,127,99 and 2,097,148 of mem and swap respectively; 1,931,468 of which is free with just the Terminal and Firefox open.
How would I fix this?
Comment: Since programs are loaded into RAM before they actually start, where a program comes from is not a factor. Which applications? How much RAM & swap? `free` will tell you.
Comment: The specific programs are Discord and Steam, and I have 7127992 (1931468 of which is free with just the terminal and firefox open.) and 2097148 of mem and swap respectively.
Answer: There is a problem in Discord on Ubuntu (At least at the moment). It uses 100% of the CPU so it will indeed slow things down. I do not know whether it was reported to them or not. I would imagine they know of the problem but don't have a solution yet.
As for Steam, it uses Java. Java is slow to start and run. The games are okay because they run on OpenGL with 3D handled by your video card, but the rest is that slow Java engine...
Most apps coming with Ubuntu are written in a language which compiles to binary. So that runs directly on the CPU. Some OS tools are using python, but that's likely to already be loaded and the python scripts are generally relatively small.
Answer: I may be able to help with Steam performance.  Your issue with Steam may be related to lack of GPU Acceleration by default.
Why GPU Acceleration Matters:
By default, Steam runs with GPU acceleration disabled on Linux, which can result in extremely slow performance, making it nearly unusable. Enabling GPU acceleration is crucial because it transforms Steam, making it run smoothly as it should have from the start.
Step-by-Step Guide: Enabling GPU Acceleration for Steam on Linux
Initial Sluggish Performance:
When you first install Steam on Linux, you may notice that it runs extremely slowly. This is because GPU acceleration is disabled by default, causing games, web content, and the Steam interface to perform poorly.
Open Steam:
Launch the Steam application on your Linux system.
Access Steam Settings:
In the top-left corner of the Steam window, click on "Steam" to open the drop-down menu. From the menu, select "Settings."
Navigate to User Interface:
In the Settings window, look for the "Interface" category on the left-hand side. Click on it to reveal the Interface settings.
Enable GPU Acceleration:
Under the Interface settings, you will find an option that says "Enable GPU accelerated rendering in web views." Check the box next to this option to enable GPU acceleration.
Apply Changes:
After enabling GPU acceleration, make sure to click the "OK" or "Apply" button at the bottom of the Settings window to save your changes.
This solved Steam's poor performance for me. I hope this will be the same for you.


What is the need of commodity swap if commodity forwards are available?

Question: I am just trying to understand that if commodity forwards are available, what is the use of a commodity swap. If a farmer wants to hedge his risk, he can do it via entering into a commodity forward, why is the commodity swap required at all ?
Answer: The commodity swap allows the farmer to enter into a series of forwards all at once: so one contract, instead of (say) five separate contracts. Also, the Swap strike will be (approximately) the average of the individual forwards: so from cash-flow perspective, it gives the farmer consistent prices over a prolonged period of time (and some farmers might prefer this). The individual Forwards would all have different strikes, whereas the Swap will have one strike for every month.
Comment: I understand that instead of many contracts a swap is all in one and farmer does not have to negotiate with the counterparty at all, but is there anything more advantageous in terms of margins which favors swap over forwards, or both use SIMM model and therefore margins are also the same. Also how is swap giving a series of cashflows if the farmer agrees to a physical delivery at year end. Say he initiates the agreement in Jan-2021 and agrees physical delivery in Dec-2021. So will there be not just a one time cashflow ?
Comment: Commodity derivatives tend to be OTC (unless traded on the CME directly, but those would be futures and options, rather than forwards and swaps). So I'd say that both the Swap and Forward will get the same SIMM treatment. I think the Swap would have physical delivery every month and cash-flow every month. Even if it was customized swap with physical delivery in arrears (only at year end), I believe the Swap cashflows would have to be settled every month still.
Comment: Interesting, your last point, so are you saying that even if the physical delivery in Jan 2021- Dec-2021 swap happens only in Dec-2021, the cashflows are settled every month which means he has a series of cashflow payments in or out and suppose every month he pays the rent of say tractor or a drone he uses at farm, swap can be a risk management tool for him to keep paying his rent provided the MTM is his side positive.
Comment: Did I understand your last sentence correctly as per my comment above ?
Comment: Thanks I will definitely do that once I go through some literature as well. Actually every literature i have read is only mentioning about one settlement as against a series of cashflows with physical delivery in arrears, can you point me to some literature for this use case ?
Comment: Have you read through the commodity derivatives section of Hull? https://www.amazon.com/Options-Futures-Other-Derivatives-9th/dp/0133456315
Comment: yes, but it doesn't mention anywhere about the multiple cashflows.


Game industry layoffs?

Question: I want to be a game programmer and it's come to my attention that people who work in this industry are laid off/fired every few years. Can someone please tell me how to deal with this? Thanks
Answer: Sebastian, you are in for a reality check. You make it sound like layoffs happen only in the game industry.
You may want to have a look at what happens in other industries. Many jobs disappear, Many companies go bankrupt or downsize. Intel just announced major layoffs. Microsoft had them in the last years.
You cope by finding another job. This is not Japan in 1920 where jobs were assumed to be for life. This is the year 2016 and you are explicitly NOT guaranteed a job for life. Many jobs will disappear in the next years.
Want guarantees? Be much better than your peers (and in programming I have seen standards go down to incompetence in the last 15 years, sadly) and you will not be fired first.
Answer: As game developer you might be hired for a project, or you might be hired by a company that files for bankruptcy after disappointing sales of a single title. That's like working for a start-up in any other industry. You also might be hired by a humongous soul-crushing entity which provides job security but low wages and very little artistic freedom, so you might decide to quit on your own.
Personally, I don't think I'll ever commit myself to any industry for several decades. Don't tie yourself to an industry. You get skills. These skills may be especially valuable in one place, but they are still valuable in lots of other places.

Game industry layoffs?


Attach file in live agent and send to customer

Question: I am using salesforce live agent in service cloud. During chat with customer I want to attach record or files from my desktop and send to customer. Right now there is option to attach a record and send to customer . When I select a record and click on send button..following things happen.
 File transfer request sent for Contact: External Page
But It never goes to customer and status remain like this untill we end chat.
Can anybody help on this..?
Comment: How are you "selecting a record and clicking on the send button?" Is this custom functionality  you have built?
Comment: Now its standard one. While chatting you can search and attach record and send those records
Comment: Do you have any screenshot of that feature? I have never seen it before.
Answer: As of now Salesforce allows supports only transfer of Files from Visitors to the Agents.
Please take a look at link::
https://help.salesforce.com/articleView?id=live_agent_transfer_files.htm&language=en_US&type=0
The option you clicked initiated the transfer of file. On click of it, the visitor's livechat window shows  a additional box where in visitor can upload files. So the functionality that you tried out is the functionality to transfer files FROM visitor TO agent.
Salesforce does this file request initiation from Agents(rather than providing visitors direct option) to ensure that files reach salesforce only with consent of the Agent and avoid unwanted files,spamming by customers.
Answer: it seems to be a known issue (i.e. BUG) on firefox:
https://success.salesforce.com/issues_view?id=a1p30000000T5ilAAC
Answer: I came across same issue and found that Agent File Transfer Enabled was not checked in Live agent configuration.


Why don't GPU miners work with open source drivers?

Question: What kind of special functions are used such that the open source AMD or Nvidia drivers don't work for any GPU miners?
Answer: GPU miners use the GPU programming framework, which is usually proprietary (like CUDA for Nvidia cards).
Therefore to use the GPU programming capabilities with the open source drivers (probably with the OpenCL framework), the people working on the drivers have to reverse engineer how the card works internally. And so far the open source drivers' support for OpenCL is too immature/slow to be usable for GPU mining.


A movie about an alien and an alien cop that chases him

Question: Might be a little vague - from what I recall it might be mid 80's to early 90's, English speaking, american origin, live action movie, about an (evil) alien that uses humans as hosts (and can change his host), the alien itself looks like a small (half-basketball size) grey blob, and he's chased by some sort of an alien cop (humanoid) that has a silver phaser-looking gun that shoots a red ray/laser,I remember the final scene being the injured alien cop shooting the exposed alien blob, which had just exited his dying host on some sort of conference stage/platform, I was pretty young so I can't recall much more.
Any help would be much appreciated :)!
Comment: @TommySM [Our policy](http://meta.scifi.stackexchange.com/questions/7065/) is to close ID questions as dupes when they're looking for the same work; having the two questions linked together actually *helps* searchability, because now your memory of the film and Major Stackings' are both here with a great big notice saying "These are the same thing"
Comment: Since both questions have the same accepted answer (*The Hidden*), then they are considered duplicates. This won't delete your question, so it remains searchable and able to help others who may be looking for the same movie.
Comment: same movie, but the explanation details I remembered differ, and (imho) seem more  detailed. should that be considered a dup? since people looking for it might find it easier to relate to this explanation?
Comment: From the title, I would've guessed "I Come in Peace" starring Dolph Lundgren... although I prefer to remember it by its original title of "Dark Angel".
Answer: This should be the movie The Hidden from 1987 starring Kyle MacLachlan.

An alien parasite with the ability to possess human bodies goes on a violent crime spree in LA, pursued by a human cop and an alien cop inhabiting a human body.

you can find the full movie on youtube.
the final scene where you see the alien parasite exit his dying human body and it is killed with a small silver laser gun is at 1:28:30
Comment: Apparently based on the Hal Clement book "Needle".
Comment: Notable for Claudia Christian in a prominent role. She later played Susan Ivanova in _Babylon 5_.


Possible legal repercussions for ignoring reasonable accommodation requests

Question: A candidate requests certain accommodations for the job interview, for instance to perform interaction with the interviewer in written. (Speaking is not an essential requirement for the job in question; the candidate can hear and speak, but it's a significant extra effort for them and thus constitutes an undue disadvantage).
What are possible legal repercussions for the company if one of the interviewers ignores these requests and keeps on speaking to the candidate?
Comment: your question begs the question by assuming that holding an interview without speech is "reasonable."  That is a question for the courts, and certainly isb't a given.
Comment: @TigerGuy you wouldn't ask a mute guy to talk, would you?
Comment: I would ask a mute person for advice on how to conduct the interview.
Answer: Note that while a person can request a specific accommodation, an employer or potential employer is not required to grant the specific accommodation requested. Some other accommodation which (the employer claims) will meet the expressed need can be offered instead. Also no accommodation need be offered if it would impose an "undue burden" on the employer.
The normal expectation is that there will be a back-and forth until the employee (or applicant) and the employer agree on an appropriate accommodation. Where there is agreement but the agreement is then violated, the normal first response is to make such adjustments as will restore the agreed accommodation. Only if that fails will a legal complaint be heard. There is no automatic penalty for violation of an accommodation  agreement, it will depend on the facts ass assessed by the Commission and perhaps later by a court. Possible penalties can include an order to employ or reinstate a complainant, back pay, costs and legal fees, and money damages, which can be up to $75,000 per violation, as the court deems just.
The relevant law is 42 U.S. Code § 12112. This provides (in relevant part):

No covered entity shall discriminate against a qualified individual on the basis of disability in regard to job application procedures, the hiring, advancement, or discharge of employees, employee compensation, job training, and other terms, conditions, and privileges of employment.

The section goes on to define "discriminate against a qualified individual on the basis of disability" as including any of several acts, including:

(b) (5) (A) not making reasonable accommodations to the known physical or mental limitations of an otherwise qualified individual with a disability who is an applicant or employee, unless such covered entity can demonstrate that the accommodation would impose an undue hardship on the operation of the business of such covered entity;
...
(7) failing to select and administer tests concerning employment in the most effective manner to ensure that, when such test is administered to a job applicant or employee who has a disability that impairs sensory, manual, or speaking skills, such test results accurately reflect the skills, aptitude, or whatever other factor of such applicant or employee that such test purports to measure, rather than reflecting the impaired sensory, manual, or speaking skills of such employee or applicant (except where such skills are the factors that the test purports to measure).

42 U.S. Code § 12111 defines "Reasonable accommodation" and undue hardship" as follows:

(9) Reasonable accommodation The term "reasonable accommodation" may include—
(9) (A) making existing facilities used by employees readily accessible to and usable by individuals with disabilities; and
(9) (B) job restructuring, part-time or modified work schedules, reassignment to a vacant position, acquisition or modification of equipment or devices, appropriate adjustment or modifications of examinations, training materials or policies, the provision of qualified readers or interpreters, and other similar accommodations for individuals with disabilities.
(10) Undue hardship
(10) (A) In general
The term "undue hardship" means an action requiring significant difficulty or expense, when considered in light of the factors set forth in subparagraph (B).
(10) (B) Factors to be considered In determining whether an accommodation would impose an undue hardship on a covered entity, factors to be considered include—
(10) (B) (i) the nature and cost of the accommodation needed under this chapter;
(10) (B) (ii) the overall financial resources of the facility or facilities involved in the provision of the reasonable accommodation; the number of persons employed at such facility; the effect on expenses and resources, or the impact otherwise of such accommodation upon the operation of the facility;
(10) (B) (iii) the overall financial resources of the covered entity; the overall size of the business of a covered entity with respect to the number of its employees; the number, type, and location of its facilities; and
(10) (B) (iv) the type of operation or operations of the covered entity, including the composition, structure, and functions of the workforce of such entity; the geographic separateness, administrative, or fiscal relationship of the facility or facilities in question to the covered entity.

Under 42 U.S. Code § 2000e–5 and subsequent sections informal measures are normally first attempted to remedy any violation. If those fail, remadies can include injunctions against continued discrimination, awards of back pay (not relevant when the person was never an employee) orders to employ a person, awards of costs and legal fees, and other damages. No specific remedy is automatic, there is wide discretion.
Comment: "Some other accommodation which (the employer claims) will meet the expressed need can be offered instead." - what if the HR manager simply ignored the request?
Comment: Then a complaint could be brought before the commission or a court. Issues in such a case would include: whether the applicant had a disability as defined by the act; whether an accommodation was needed under the act and th facts; whether the requested accommodation was reasonable; and if some other reasonable accommodation was available that would have allowed the applicant to participate in a nondiscriminatory manner. Depending on the findings on these issues, an injunction might issue and/or money damages be assessed. If HR responded with reasons for denying a RA, the case might be harder
Comment: Ok. What would be possible alternative accommodations for the example in question, for instance? I'm still struggling to understand how all this works in general.
Comment: @Asterea  I don't know enough about the kind of disability in nthe example to suggest what an alternative accommodation might be. There might be no effective accommodation in that case. But a person who asked for an ergonomic chair might be offered more frequent work breaks instead; a person who wanted a larger computer monitor might be offered magnifying glasses; one who wanted alterations to a building for wheelchair access might be offered an office an a newer adjoining building. It is always case-specific, and sometimes the offer is not acceptable. [...]
Comment: @Asterea [...] The law encourages a free-form dialog in which employer and employee  consider what accommodation will let the employee work on a non-discriminatory basis without overly burdening the employer. Each party is supposed to be open to considering alternatives, and neither is given a veto over the ultimate solution. If they cannot agree, a formal case may be brought, usually by the employee. Normally a case is brought before the Commission, and only if that does not work is an actual court case brought.
Comment: Thanks. Think of someone who has hearing problems or stuttering, for instance.
Comment: @Asterea Yes, use of writing might work, or a hearing aid or microphone, extra time, or some other measure designed to avoid the problem. If one party is unreasonably inflexible, that might harm that party's case in later proceedings. So might violations of the agreement on an accommodation.
Answer: An employer must make reasonable accommodations even during the interview phase. If they do not, they can be subject to legal sanctions, if the court finds that there refusal to accommodate was unreasonable, meaning that the accommodation did not impose an undue burden on them (for example the request is too difficult or expensive). The penalty can be up to $75,000 for a single violation, is it is found that there was a violation.


How do I fill the current selection with color?

Question: I remember there's some option allow you to fill current selection with colors , but I couldn't find it anymore
Comment: Paint in selection creates a shadow around the boundary! How can one get rid of that?
Answer: All you must do in GIMP is use the Fill Bucket tool, holding down shift will toggle between the 'fill similar color' and 'fill whole selection' options.
Comment: Paint in selection creates a shadow around the boundary! How can one get rid of that?
Comment: FYI, in order for the Bucket Fill gadget to work correctly, you need to ensure that the proper layer is selected...
Comment: After I select a rectangle selection with the rect select tool, when I click on Bucket Fill tool, my selection disappears...! So :\ I cannot fill it.
Answer: You can fill the current selection with either the foreground color or the background color from the Edit menu. Ctrl + , and Ctrl + . respectively on the keyboard.
Comment: This is the real accepted answer.
Answer: Just change the foreground or background color to the color of your choice and then just drag it to your image, any part will do because whenever there is a selection on an image, any action done on the image is assumed to be on the selection. Dragging the color to any part of your image, selected or not, will fill the selection with that color.


Euler's formula proof with Calculus

Question: I was reading this source here and it provides a proof of Euler's formula using calculus. Although I technically understand the reasoning, I can't quite wrap my head around one particular step: if $f(x)= \cos(x)+i \sin(x)$, then $f'(x)=if(x) \implies f(x)=e^{ix}$. I can kind of get this, as derivating $e^{ix}$ gives $ie^{ix}$, and I know that $e^x$ is the only non-constant function s.t. $f'(x)=f(x)$. Is there a more clear way to think about this step? Can we extend that property of $e^x$ to when it has more in the exponent? And why does it have that property anyways? Would there be a way of obtaining this step without simply knowing that $e^{ix}$ would work?
Comment: There are a lot of questions here. At least 4. What are you *specifically* wanting covered here?
Comment: @BrevanEllefsen Just a general grasp of the thing, really. A better intuition for how and why this step can be and is done.
Comment: The slightly more general formula that is necessary here is $f'(x)=af(x) \leftrightarrow f(x)=Ke^{ax}$ (don't forget factor $K$)
Comment: Some important intuition in the background of this: think of differentiation as being a $\pi/2$ shift: for example, when you differentiate $\cos$: $\cos'(x)=-\sin(x)=cos(x+\pi/2)$; the same for $\sin'(x)=\cos(x)=sin(x+\pi/2).$
Comment: @Vedvart1 I threw up some super short answers to your questions. Since your posts is so broad my answers are pretty broad, but let me know if they help at all.
Answer:
Can we extend that property of $e^x$
   to when it has more in the exponent?

Yes we can.

And why does it have that property anyways?

Good question. This is because complex derivatives work almost exactly the same as you are used to real derivatives working. Take the formula for the complex derivative as an example
$$f'(x)=\lim_{h \to 0} \frac{f(z+h)-f(z)}{h}$$
Where $h$ and $z$ are complex numbers. You can go ahead and plug $e^z$ into this function and find it is complex differentiable. The proof is pretty much exactly the same as in the real case. If you want a more geometric approach then I recommend this video.

is there a more clear way to think about this step?

Depends on your definition of clear. I think the proof you provided is far clearer than what I am about to post, but perhaps you are defining clarity as rigor? Here is a proof from Wikipedia that is much more formal and explanatory, but I feel it is less clear. Let me know what you want here and I can adjust.

All complex numbers can be expressed in polar coordinates. Therefore, for ''some'' $r$ and $\theta$ depending on $x$,
  $e^{ix} = r (\cos \theta + i \sin \theta)$
  No assumptions are being made about $r$ and $\theta$; they will be determined in the course of the proof. From any of the definitions of the exponential function it can be shown that the derivative of $e^{ix}$ is $ie^{ix}$. Therefore, differentiating both sides gives
  $i e ^{ix} = (\cos \theta  + i \sin \theta) \frac{dr}{dx} + r (-\sin \theta  + i \cos \theta) \frac{d\theta}{dx}$
  Substituting $r(\cos\theta + i\sin\theta)$ for $e^{ix}$ and equating real and imaginary parts in this formula gives $\frac{dr}{dx} = 0$ and $\frac{d\theta}{dx} = 1$. Thus, $r$ is a constant and $\theta$ is $x+C$ for some constant $C$. The initial values $r(0)=1$ and $\theta(0)=0$ come from $e^{0i}=1$, giving $r=1$ and $\theta = x$. This proves the formula
  $e^{ix} = 1(\cos x +i \sin x) = \cos x + i \sin x$

There is something important to note in this paragraph that you are neglecting; we have to solve for the constant of integration. When we solve $y'=y$ we find that $y=ke^x$ and thus we must have some initial condition to solve for $k$.

Would there be a way of obtaining this step without simply knowing that $e^{ix}$ would work?

We have to know some properties of $e^x$ to ever prove Euler's Formula. Here we just use the fact that $ke^x$ is the only non-constant solution to $y'=y$, which is a pretty natural condition if you ask me.
Comment: This is very helpful, just what I was looking for. How exactly do we know (for the last part) that $ke^x$ is the only non constant solution to that? Continuity implying differentiability is also intuitive, but then you have the Weierstrauss function. How do we know there isn't some strange function out there that also satisfies it?
Comment: @Vedvart1 It doesn't actually matter if any other functions satisfy it; if they did, they would have to also be equal to $\cos(x) + i\sin(x)$. Knowing whether examples other than $ke^x$ is not necessary. That being said, it isn't too hard to show that $ke^x$ is the only "nice" function that satisfies the functional equation $y'=y$ (the key property being everywhere differentiability)
Comment: Brevan, what you've missed is that the logic is completely circular.  How have you defined the function $e^{ix}$?  We know that $f(x)=\cos(x)+i\sin(x)$ and that $f'(x)=if(x)$.  The solution as given by $e^{ix}$ is just symbolic.  We don't know (yet) that this is the number $e$ raised to the power $ix$.  And none of its properties is yet described.  And we need to do a lot of work to show that it has the same properties as the function with which we are familiar.  In most introductory treatises, we define $e^{ix}$ as $\cos(x)+i\sin(x)$ and proceed from there.
Comment: @Dr.MV I'll agree that simply defining it first is a generally better way to go in introductory texts, but I prefer to follow the approach of first choosing a definition for $e$, then defining real exponentiation, then defining the real derivative and subsequently the complex derivative, and finally prove some uniqueness theorems for differential equations involving complex functions. Assuming you defined in there what a complex function is (i.e., what does $z(x,y) = f(x)+if(y)$ mean?) we can be careful to avoid circular logic... it is just a tedious process.
Comment: @Dr.MV Given the OP is just learning this stuff I think an overload of rigour would be a bad thing, perhaps even off-putting. As such, I favored an arguably circular approach in order to keep complexity down :) I could always prove my argument isn't circular, but I'll leave it to someone else to write down all the steps if he/she desires.
Comment: It's really not more difficult to simply begin by stating the $e^{ix}=\cos(x)+i\sin(x)$.  Then, we can show that $e^{ix}$ satisfies the usual properties of the real exponential function.  Furthermore, we can show easily that $e^{ix}$ is differentiable with derivative $ie^{ix}$.  This is much more preferable to the heuristic and flawed approach as given in the reference.
Comment: @Dr.MV Hmm... I will have to just disagree with you here then. Your suggestion is easier for proving the properties of $e^{ix}$, but I don't think that is enough reason to invalidate a heuristic approach on its own. I also wouldn't say the proof is "flawed" except in that it leaves out a lot of justifying details which would bog down the proof. I cite a slightly more rigorous proof from Wikipedia in my post, but I feel that the OP's answer is far more beautiful. Given that I know each step can be justified I am fine with the OP's proof (though the justifications might not be easy)
Comment: Brevan, you're missing the point.  What is $e^{ix}$ in this development?  It's $f$, that's all.  You cannot assign attributes to it as an exponential function simply because you've treated $i$ as if it were a real number.  The development is indeed flawed.
Answer: As a complement to the explanation of @Brevan Ellefsen.
Have a look at the figure below. It explains geometrically that $e^{ix}$, imagined as a turning vector at unit speed, has a unitary "speed vector" turning at the same speed, orthogonal to it.
This illustrates the fact that differentiation is equivalent to a $\pi/2$ shift, i.e., in geometrical terms, a $\pi/2$ rotation.
If you analyse it in a separate way:
$$\begin{cases}\cos'(x)=-\sin(x)=\cos(x+\pi/2)\\ \sin'(x)=-\cos(x)=\sin(x+\pi/2)\end{cases}$$
But this boils down to say that the derivative of $e^{ix}$ is $ie^{ix}$, which is interpretated as $e^{ix}$ "turned by" $\pi/2$.
Answer: For your last question, consider a differential equation of the form
$f: \mathbb{R} \to \mathbb{C}$ and $\forall x \in \mathbb{R}$ $f'(x) = kf(x)$ where $k \in \mathbb{C}$ and $k \neq 0$.
(Ah! I will still make use of the fact that $e^{kx}$ is a solution but rather, in a different manner)
Consider the following function $g : \mathbb{R} \to \mathbb{C}$, $g(x) = e^{-kx}f(x)$
Since, both exponential function and $f$ are differentiable, so $g$ is differentiable. Hence $g'(x) = -ke^{-kx}f(x)+e^{-kx}f'(x) = e^{-kx}(f'(x)-kf(x)) = 0$ $\forall x \in \mathbb{R}$. Therefore, $g$ is a constant function. Hence,   $g(x) = e^{-kx}f(x) = c \implies f(x) = ce^{kx}$
Answer: Complex differentiation follows exactly the same process like with the real argument except that we now regard $i$ as an imaginary constant.
I am posting a bit different not suitable for teaching but as it appeared to me long time ago, so am ready for a bit of down-voting.
If we wish to work on basis of circular trigonometric functions,
$$f(x)= \cos(x)+i \sin(x)$$
$$f'(x)= -\sin(x)+i \cos(x) = if(x) $$
the above is rotation by $ \pi/2$ in complex plane. And,
$$ f''(x)=-f(x)  \rightarrow f''(x)+f(x) = 0 $$
The above is real rotation of period $2 \pi $ in complex plane.
But if we wish to work on basis of hyperbolic functions we can consider differentiation with respect to $ i x$ instead of real $x$ and apply Chain Rule ( divide by the constant $i$).
$$f(x)= \cosh(x)+i \sinh(x)$$
$$ f'(x)= \cosh(x)-i \sinh(x) $$
which is complex conjugate of $f(x).$ And
$$ f''(x)= -\cosh(x)-i \sinh(x)  =-f(x), \rightarrow  f''(x)+f(x) = 0 $$
which is still the same rotation in the complex plane, argument change notwithstanding.

Euler's formula proof with Calculus


Prove that every triangle-free graph on n vertices has chromatic number at most 2√n.

Question: How do I start the proof? Do I start by creating any triangle free graph or is there a theorem that I need to use?
Answer: The easiest way to do this is with the probabilistic method.  I'll give you a quick outline:

Prove that every triangle-free graph has at most $\lfloor n^2 /4\rfloor$ edges.
Randomly color each vertex of your graph, independently and uniformly with $\lfloor 2 \sqrt{n} \rfloor$ colors.
Calculate the expected number of edges that are incident on vertices of the same color.
Conclude that there exists a proper coloring with $\lfloor 2 \sqrt{n} \rfloor$ colors, implying that the chromatic number is $\leq 2 \sqrt{n}.$

EDIT (~4 years later): I don't think this sketch works, I honestly have no idea how I imagined it did.  Here's a more legitimate one.
Let's prove it by induction:

Show that since G is triangle free it has an independent set of size $\sqrt{n}$ [Hint: if there is a vertex of degree $\sqrt{n}$ its neighbors form an independent set; if all vertices have degree $< \sqrt{n}$ how big is the biggest independent set?].

Color your biggest independent set.  You now have a graph on $n-\sqrt{n}$ vertices that you want to color with $2\sqrt{n} - 1$ colors, which follows by induction.
Comment: I tried to follow the outline, but I got stuck between steps 3 and 4. With $2\sqrt n$ colors and $n^2/4$ edges, I get $\frac1{2\sqrt n}\cdot\frac{n^2}4$ for the expected number of edges that are incident on vertices of the same color. Is that right? How do I conclude from that that there is a proper coloring with $\lfloor2\sqrt n\rfloor$ colors?
Comment: By the way, where do we use "triangle-free", besides step 1?  Because of course a graph with $n$ vertices and $n^2/4$ edges can have chromatic number much bigger than $2\sqrt n$.
Comment: @bof, thanks for commenting, I haven't the slightest idea what I was thinking.  I think both of your criticisms are valid; I must have made some calculational mistake at the time.  I replaced it with a legit proof.
Comment: I wasn't expecting to hear from you so soon, and I've already started composing my own proof, so I'll finish it and post it even if it's the same idea as your corrected proof.
Answer: Let $G=(V,E)$ be a triangle-free graph on $n$ vertices, and let $k=\lfloor\sqrt n\rfloor$. I will show that $\chi(G)\le2k$. I assume that $n\gt8$ (and so $k\ge2)$ the smaller cases being trivial.
Let $\mathcal S=\{S_1,\dots,S_m\}$ be a maximal collection of pairwise disjoint independent sets of cardinality $k$; then $mk\le n\lt(k+1)^2$, so $m\le k+2$.
Let $S=S_1\cup\cdots\cup S_m$ and let $T=V\setminus S$, so that $\chi(G)\le\chi(G[S])+\chi(G[T])$.
Because $\mathcal S$ is maximal, $T$ contains no independent set of cardinality $k$. Since $G$ is triangle-free, this means that $G[T]$ has maximum degree less than $k$. It follows that $\chi(G)\le\chi(G[S])+\chi(G[T])\le m+k$.
Case 1. If $m\le k$ then $\chi(G)\le m+k\le2k$.
Case 2. If $m=k+1$ then $|T|=n-|S|\le(k^2+2k)-(k+1)k=k$ and $\chi(G)\le\chi(G([S])+\chi(G[T])\le(k+1)+(k-1)=2k$, unless $G([T])$ is a complete graph of order $k$. But in that case we have $k\le2$ (since $G$ is triangle-free) and $n\le8$, contrary to our assumption that $n\gt8$.
Case 3. If $m=k+2$ then $|S|=k^2+2k=n$ and $S=V$, so $\chi(G)=m=k+2\le2k$.


Does the monk have any ranged damage skills?

Question: I know that the monk is clearly optimized for up-close work as a tank.  What I'm wondering, though, does the monk has any skills with any range greater than touch?  If everything is touch only, what is the greatest extent of one of his AOE powers?
Comment: possible duplicate of [What are the ranges of each skill?](http://gaming.stackexchange.com/questions/70960/what-are-the-ranges-of-each-skill)
Answer: The Monk has many many abilities that extend beyond melee/touch range. There are a few runed skills (like Hand of Ytar) that behave like fully-ranged abilities, but most of them focus on the mid-range. The Monk excels at quickly closing the gap to monsters, gathering them up, and then beating them down and debuffing them.
Here are all the Monk skills that reach beyond melee:
Ranged attacks:

Deadly Reach - slightly greater range than melee
Deadly Reach(Piercing Trident, Scattered Blows) - these runes extend the range further
Crippling Wave (Tsunami) - Every 3rd strike reaches out to range
Way of the Hundred Fists (Windforce Flurry) - Every 3rd strike reaches out to range
Lashing Tail Kick (Spinning Flame Kick): Summons a small fire tornado that hits enemies in a line
Lashing Tail Kick (Hand of Ytar): Changes into a ranged attack that also slows
Wave of Light (all runes): All forms of this skill do ranged damage
Breath of Heaven (Circle of Scorn): heals allies and damages enemies
Sweeping Wind (all runes): All versions of this let you hit the area around you. Runes allow you to extend the radius and spawn ranged lightning tornadoes.
Mantra of Conviction (Submission): This version damages nearby enemies, like Sweeping Wind.

Gap-closers:

Fists of Thunder (Thunderclap): Technically melee, but you teleport to the target.
Way of the Hundred Fists (Fists of Fury) - Adds a dash to the first strike
Dashing Strike (all runes): All versions of this let you charge a remote target.
Cyclone Strike (all runes): All versions of this let you pull in remote enemies. A rune lets you extend the range.
Seven-Sided Strike (Sudden Assault): This lets you teleport to the enemy, like Fists of Thunder.

Ranged damage reflectors:

Serenity (Instant Karma): reflects damage at range
Serenity (Reap What Is Sown): damages enemies in AOE based on prior incoming damage
Mantra of Retribution (Retaliation): This reflects ranged damage to attackers.
Comment: Finished the post, and reformatted it to better answer the question. Thanks @DavidYell!
Comment: Also I'd include `Dashing Strike`+`Flying Side Kick` as it allows you to attack a target from quite some distance away. However not strictly a sustained ranged attack.
Comment: you're missing Mantra of Conviction/Submission, which does 30% damage per second to all enemies within 20 yards.  It's fun it works through all obstructions and can damage enemies far above or below you.
Comment: @fcrick Updated, thanks! I don't have that rune yet, now I can't wait to try it!
Answer: Deadly Reach projects force "over a short distance" with every third strike extending to 25 yards.  With the Scattered Blows rune, it will hit up to 6 enemies within 15 yards for 170% weapon damage as lightning.


Separable extensions of henselian fields

Question: Let $(k,v)$ be a henselian field, with $\mathcal{O}$ and $\bar{k}$ being respectively its valuation ring and its residue field. If $K/k$ a finite separable field extension (on which $v$ thus extends uniquely) is it true that the finite field extension $\bar{K}/\bar{k}$ is also separable?
Answer: The answer to your question is no. Start with the field called $\mathscr{E}$ in $p$-adic Hodge theory. It is the set of Laurent series $\sum_r a_i t^r$ such that $a_r\in \mathbf{Q}_p$ satisfy $|a_r|\to 0$. This is a complete DVR with respect to the valuation $v(\sum a_r t^r) = \inf_r v_p(a_r)$. Note that the residue field of $\mathscr{E}$ is $\mathbf{F}_p(\!(t)\!)$.
The extension $\mathscr{E}\to \mathscr{E}$ induced by $t\mapsto t^p$ is finite separable, but the induced extension of residue fields is $t\mapsto t^p\colon \mathbf{F}_p(\!(t)\!)\to \mathbf{F}_p(\!(t)\!)$, which is not separable.
Comment: For *any* henselian dvr $\mathcal{O}$, *any* finite extension $\overline{k}'/\overline{k}$ is the residue field of a finite separable $k'/k$. Indeed, using a tower reduces us to when $p:={\rm{char}}(\overline{k})>0$ and $\overline{k}'=\overline{k}(a_0^{1/p})=\overline{k}[t]/(t^p-a_0)$ with $a_0\in\overline{k}-\overline{k}^p$. Then for $a\in\mathcal{O}^{\times}$ lifting $a_0$ and a uniformizer $\pi\in\mathcal{O}$, $f:=T^p-\pi T-a\in k[T]$ is separable irreducible with $k':=k[T]/(f)$ having residue field $\overline{k}'/\overline{k}$.


Defining and Non defining Relative clauses

Question: Is the following sentence a define or not defining relative clause. Since, when we remove the part enclosed in commas, the remaining part doesn't make sense, I think it is a defining relative clause but my teacher says that whenever there is anything enclosed in commas in a sentence it becomes a Non Defining Relative clause.
Sentence:"The children,who shouted in the street, were not from our school"
Comment: The version with commas presupposes that we already know which children are meant (independently of any shouting); it says that those children were not from our school, and it adds parenthetically that they shouted in the street. The version without commas specifies which children are meant by saying they're the ones who shouted in the street.
Comment: Removing the nonessential information still has the sentence make sense: *The children were not from our school.* So, your supposition is wrong.
Answer: With commas it makes a different sense. The commas show that the writer wants you to lower your voice when you say ",who shouted in the street," because the writer wants that to be additional information. The writer could have written "The children were not from our school. They shouted in the street," but that would not be so neat.
If you are the writer, and if you want that meaning, you can put in the commas, and the reader will lower their voice and make it a Non Defining Relative Clause.
But, if you are the writer, and you want a different inflexion, (Oxford Dictionaries inflexion .2.) and you want a Defining Relative, then you must leave out the commas.


Is port 139 still vulnerable?

Question: Since the NetBIOS vulnerability is quite well-known a long time ago and heavily popularized, patches have been already released. So, is opening this 139 port OK now?
Answer: Ports are not vulnerable, they are just ports.  Services that listen on particular ports may have remotely exploitable vulnerabilities, or misconfiguration of services that listen on particular ports may lead to unintended consequences.  The last remote exploits that targeted NetBIOS/139 were in the Windows NT/2000 day to the best of my recollection.
Port 139 is typically used for file/printer sharing, including directory replication with Active Directory, trusts, remote access of event logs, etc.
So... if you just block port 139 on a Domain Controller just because you read somewhere on the internet that that port is "bad", or because you are following some generic hardening checklist you found on the internet; you will kill AD replication.  If you block 139 in a typical business network, you will lose the ability to do much of anything on a remote computer (remotely manage clients/servers, install software, share printers, files...)  Not good in a managed environment, unless you like sending a technician onsite anytime you need to do something to a computer.  Heck, you could be SUPER secure and just disable network cards altogether, and use floppy disks to move bits around.  You could disable port 80 on your Apache Web Server because of the possibility of cross-site-scripting vulnerabilities.  You could block port 1433 to reduce instances of SQL injection attacks.  (all right, I'll quit now ;)
The key is understanding the purpose and requirements of the services enabled on your network, understand the threats that face them, and understand appropriate mitigations.
Do you want to take your Domain controllers and put them on an internet facing network connection without blocking/filtering access to port 139 (or many other ports)? Do you want to plug a home computer with Windows ME and file/print sharing enabled directly into your cable modem without having a router filtering connections or a firewall enabled on your computer? Of course not.
A great book that covers much of this information (including the "Why's" behind the security decisions you must make) is Protect Your Windows Network: From Perimeter to Data by Steve Riley and Jesper Johansson.
Answer: It might be. The problem is no one can say if something is OK, just that there are no current known exploits. Someone may have found a new one and not reported it. You may be missing a patch on your server. The server may be configured incorrectly and has opened a hole.
This isn't just a NetBIOS problem, it's for anything, be it Apache, BIND, Sendmail, Exchange, anything that's connected to a network. The basic rule of thumb is don't open ports to external connections unless you have to.
Answer: It rather depends on what you have got listening on 139. The vulnerability of a given port depends entirely on the software that an attacker can reach via that port.
Presumably this question doesn't come out of nowhere, so you must have a reason for wanting to open this port. Somebody wants to use it, right? So you need to find out what software they want to run, find out it's patch level, investigate known vulnerabilities and make a judgement.
If you're talking about a firewall that protects more than one server, you could also look at rules that only allow 139 traffic to a specific server.
Comment: Exactly - apart from the fact that when I wrote my answer, I didn't have Sean's answer to refer to. If you read what I said, you'll find that I'm saying exactly the same thing. "The vulnerability of a given port depends entirely on the software that an attacker can reach via that port. "
Comment: Ports are not vulnerable.  The software that is listening on them could be.  See answer by Sean Earp.
Answer: (This may already be covered. One reference to using NESSUS for checking this.)
Some other references to port 139:

Current SANS report on port 139 and recent attack data
ISS Net Security center
Comment: Further, from the SANS data, "These protocols permit a host to manipulate remote files just as if they were local. Although this is a powerful and useful feature of Windows, improper configuration of network shares may expose critical system files or may provide a mechanism for a nefarious user or program to take full control of the host." So, its not just MS vulnerabilities that matter.
Comment: sofaq related: Any one know why my user link did not get copied when this post was moved from SO to SF-Community-wiki?
Answer: "Do you want to take your Domain controllers and put them on an internet facing network connection without blocking/filtering access to port 139 (or many other ports)? Do you want to plug a home computer with Windows ME and file/print sharing enabled directly into your cable modem without having a router filtering connections or a firewall enabled on your computer? Of course not."
The answer would be this:

Open the port on local trusted network interface (unless windows file/printer sharing services aren't provided/applicable to your server)
Close the port on internet facing interface (even if behind firewall)

That is assuming you are sitting on a windows server domain controller of course, for anything else opening this port up would be ridiculous (for its intended use anyway!).
Note the windows service that uses this port will only listen on port 139 of the default IP address of the enabled NIC, not any of the other assigned IP's.
Answer: I would advise against opening port 139 directly to the Internet.  We receive dozens of port scans on our firewall every hour looking to see if 139 is responsive.  If you must open it on an Internet-facing system, at least block traffic to it by default and only allow hosts you trust, and/or install something like fail2ban to block potential brute-force attacks.

Is port 139 still vulnerable?


Can someone else manufacture and sell implementations of your invention while your patent is pending?

Question: So after one submits their patent application, the status of the patent is pending.
At this point, can someone else still user your invention?
Answer: If you file a European Patent you will get a provisional protection after publication, as it is described in Art. 67 EPC. If a state requires so, your provisional protection may start from the publication in a local language, e.g. after translation in the given language is provided. Art. 67 EPC is referring to Art 64 EPC which describes the inventors rights after grant.

Art. 67(1) EPC:
A European patent application shall, from the date of its publication, provisionally confer upon the applicant the protection provided for by Article 64, in the Contracting States designated in the application.

Art. 67(2) EPC:
Any Contracting State may prescribe that a European patent application shall not confer such protection as is conferred by Article 64. However, the protection attached to the publication of the European patent application may not be less than that which the laws of the State concerned attach to the compulsory publication of unexamined national patent applications. In any event, each State shall ensure at least that, from the date of publication of a European patent application, the applicant can claim compensation reasonable in the circumstances from any person who has used the invention in that State in circumstances where that person would be liable under national law for infringement of a national patent.

That is, in countries where no translation into a local langue is required, you may sue the infringer based on your provisional protection  18 months after filing the application. If however your application does not get granted, they can and most probably will sue you back.
Answer: Certainly - your right to try to stop them from doing so only exists the day your patent is granted. In the US you get rights at that time to try to get back royalties under some circumstances including that they were put on notice as to your claims.


Taking the input and output of a terminal

Question: How can I take the input and the output of a terminal? To be more specific, what I want to do is to take everything that is typed in the terminal, and everything that the "terminal" types (in real time).
Answer: script should be what you are looking for (man page).
Start a logged session with script /path/to/your/logfile, every command and its output will be logged into the logfile.
If you need timing info for a realistic replay, use script -t=/path/to/your/timingfile /path/to/your/logfile. Afterwards, you can replay the log using scriptreplay /path/to/your/timingfile /path/to/your/logfile.
Answer: Copy/paste method usually works for simple input/output.
In case you'd like to monitor what's going on within another terminal window try tmux.
You may find more here


Assign Multiple roles to Ubercart Product

Question: I am using ubercart and Roles module to sell some roles on my drupal 7 site.
I wonder whether I can sell multiple roles with a single product, I tried to add multiple roles to a single product under features, but after purchasing a product I found only one role is assigned to the purchaser, Is there any way I can assign multiple roles.
Answer: Yes, the UC Roles module can assign multiple roles on purchase. All you need to do is add each role assignment you want at /node/XXX/edit/features.
If the roles aren't being assigned after purchase, you might want to check the SKU options you have for each feature. It could be that your product purchase is a SKU that isn't configured for role assignment. If that isn't it, you should check to make sure that your checkout rules are configured to set the right order status to trigger role assignment.


PSpice - simulation worst case - delay on AND gate?

Question: I have a question to someone who is familiar with PSpice analysis. I have a simple circuit as below and everything works good with "typical" simulation - dstm1 gives positive impulses continously and couter 74393 count till output A and C have high signal, then via AND and OR gate signal reset 74393 counter. When I change simulation to "worst case" I have situation when output C has high signal and in the meantime it is rising signal on output A and clr (counter reset). Is it possible to make some delay on AND gate? Or is it other way to fix worst case simulation to make it works properly? Thank you in advance for any advices.

Typical:

Worst case:

Worst case with lower frequency:
Comment: It looks like your clock frequency is too high for operation under worst-case conditions. What makes you think that the simulation results are incorrect? Can you point to a specific delay in your simulation that exceeds the datasheet maximum value?
Comment: Thank you for your answer. I have edited my post and added worst case simulation with lower frequency of clock - no positive results. The point of this exercise is to find out how to modify given circuit to make it works also with worst case simulation.  I'm not sure but in my opinion it seems that maybe there is some delay needed on AND gate but I'm not sure whether we are able to create it.
Answer: You have combinational feedback, from the outputs of the 393 through the AND gate and OR gate back to the CLR input of the 393. This is an inherently dangerous design style. Adding delay at the AND gate is not a good fix.
I'm not sure what it is you are trying to make this circuit do, but you might need to replace the OR gate with another AND gate so the the counter is only reset when clr_1 is also high. Then make sure that the delay between the falling clock edge and the assertion of clr_1 is long enough to allow the counter outputs and the first AND gate to reach their final values.
Comment: Second AND gate could be the good solution but counter need CLR signal at startup to start counting output signals - how to do that? To be honest - the point is to make this circuit works using typical and also worst case timing model. 74393 has to count till high signal will be at output A and C and then counter should reset and make another the same circuit. I can modify circuit components, values of parameters of all components and so on. It is an excercise from my studies.


Short story about a series of letters or emails written by a sister to her brother about a TV show

Question: They watched the TV show as children in the 1950's. I read it in a science fiction magazine in the last 15 years. It was in either Asimov's, Fantasy and Science Fiction, or Analog. They saw only a limited number of shows and it had an "alien" host. They never met anyone else who saw the show. The sister spent her lifetime attempting to discover the history of the show and only occasionally discovered a small piece of evidence. In the end she never did discover anything about it. The implication was that it was not a TV show but really a transmission from an alien.
Comment: Just making sure here: you're not talking about Candle Cove, are you? http://www.creepypasta.com/candle-cove/
Comment: It is not Candle Cove. I looked up Candle Cove and there are similarities, but it is too short, and the time frame of the show was not right. The 1950's setting in the story I am looking for fits very well because TV reception was often grainy, in black and white, with frequent horizontal/vertical "rolling". Those qualities (I don't remember if they were explicitly mentioned in the story) added to the uncertainty on whether it was a real show or an alien transmission. Thanks for the suggestion, though.
Comment: Was pretty sure that was the case, but since it was similar enough and leapt to mind, I thought it was worth eliminating as the obvious.
Answer: I found it in the September 1998 issue of Fantasy and Science Fiction. It is "Mr. Goober's Show" by Howard Waldrop. The intro to the story by the FSF editors say it was originally published in "Omni Online" shortly before it ceased publication. Thanks to everyone for looking.
Summary from this review:

An old man called Eldon recounts a mystical childhood experience that he and his sister Irene shared.  While staying at their Aunt Joanie's house, they encounter a mechanical television set that only plays one show: Mr. Goober.  Eventually, their aunt gets rid of the television, but their curiosity about learning more about this Mr. Goober is too much, particularly for Irene.  However, as a series of letters to Eldon reveal, Irene's foray into the world of television as an adult slowly breaks her spirit down, while the discovery of what lies behind Mr. Goober may be too much for her to handle.  So Eldon is forced to carry on the search in her memory, fruitlessly asking people over and over if they ever knew about this one show…

It is available on the Omni Magazine website.


Is it correct to do hyperparameter tuning based on validation error and not test error?

Question: I am new in Statistics and Data Science.
I would like to use "academic" data for training and testing for overfitting.
However, I would like to get the classifier accuracy from "real-world" data and do hyperparameter optimization based on the score obtained with this data (instead of the usual grid search with cross validation).
Would it be correct?
Comment: Note what is a hyperparameter given here: http://stats.stackexchange.com/questions/133067/what-exactly-is-a-hyperparameter
Answer: It's not really clear what you are asking, but:

any data you use for training your data, including hyperparameter selection, should not be used for testing
any data you use to train models that you use in an academic paper, from whatever sources, should be cited; this includes data used "only" for hyperparameter selection
use of additional data sources could be considered a type of augmentation, I suppose, but in any case whether you consider it an additional dataset, or augmentation, if you are using it in an academic paper, you need to state/cite these sources/augmentations. This lets people reproduce your results, and understand clearly what you did

If your goal is to train a model for eg an Android app, that you are writing yourself, and selling yourself, then citations would be less critical, unless you are using someone else's licensed/copyrighted data, which might require attribution/citation/license payments/etc. In that case, what you care about is generalization, runtime prediction performance. You'll want to keep a set of test data separate from whatever you used to evaluate hyperparameters etc, in order to evaluate your model. You can only use test data once in theory, or a few times, in practice, before it becomes "worn out", since you'll basically start to overfit your hyperparameters, and/or model selection, against your test set.


What is the best formatting to quote an LLM/ChatGPT question/answer?

Question: Say I want to mention what ChatGPT said. How is the best way to delineate what is the prompt and what is the response?
Comment: Why mention it at all? It's hard to imagine when it would be useful.
Comment: Pet peeve: questions that respond to the "describe your efforts to solve the problem so far" exhortation with "I asked ChatGPT but it didn't work". I don't think this site should become a fixer-upper for broken ChatGPT spew. Most answers require some degree of understanding to apply and use, and if the asker doesn't really understand what's going on in ChatGPT's output (they usually don't), it's typically a big uphill battle to get them to understand my solution, if the problem is even clear enough to be able to provide one. Generally, when asking: take a step back, build up understanding.
Comment: @HolyBlackCat Questions/answers that are directly about ChatGPT/LLMs (e.g: [1](https://genai.stackexchange.com/q/18/8), [2](https://meta.stackexchange.com/q/395985/287788), [3](https://ai.stackexchange.com/q/38270)) would probably be the least controversial, albeit niche, use for quoting text from an LLM
Answer: I'd say... don't bother.
If it's wrong - it's what people expect and you're better off asking the question you actually want to ask.
If it's 'correct' but the explanation makes no sense - it might not be correct.
Considering the attitudes towards LLMs here, I suspect it would be more of a distraction.
If you must I think simply using that as a framing for your question.
"I asked ChatGPT about the best way to frobulate an turboencombulator, and it suggested deep frying the matrix of leadership - wouldn't this potentially cause a crack in the denatured endoframe?" for example.
Use the GPT prompt/response as framing but your actual question matters more. Or just ask your actual question here.
Comment: It's rather superfluous as framing, too, unless the question is "why does ChatGPT answer this". Just don't mention ChatGPT at all.
Comment: in which case it turns into "I read a thing, is it true?" - the point of framing it in this specific way also sneakly forces you to show you at least understand the underlying problem a little
Answer: First, does ChatGPT (et al.) have anything meaningful to say?  You need to understand how (un)welcome and (un)helpful ChatGPT's input would be at a given site.  Does quoting ChatGPT improve your post?  ChatGPT, for instance, is awful at maths.  So if you're discussing maths, you'd almost certainly be better off not quoting ChatGPT, for the same reason you'd be better off not quoting a toddler.
While ChatGPT is not good at saying things which are factually true, it is, however, adept at saying (not necessarily true) things in very crisp and precise language.  This makes ChatGPT far more useful for e.g. language learners, who care less about factual accuracy, and more about grammatical accuracy and its usefulness for practicing language.
I've quoted ChatGPT (et al.) in various ways, so I'll explain how I do it.  But I would emphasize here, my questions are seldom/never like:

ChatGPT said [foo]; is this wrong?

Instead, I mention ChatGPT as one of multiple attempts to find the answer independently:

My textbook says [foo].  I don't fully understand what it means by [bar].  I asked ChatGPT to explain it, and it said "...", so I guess ChatGPT thinks [...].  I Googled the question, and found [something], which suggests [...] is correct.  So my current understanding is [...] but this may be incorrect.

(See this question for an example of what I mean here; here I quote my textbook, two different AIs, three examples found through Google, and two dictionaries.)
For questions:

Sometimes I make a judgement call and don't bother mentioning it.  I mull over things with ChatGPT all the time, but sometimes it's just not helpful.  (E.g. I asked ChatGPT this question, but it didn't say anything useful, so I didn't quote it.)

Sometimes I'll state my current thoughts on the question, and state that I asked ChatGPT and paraphrase what it said (i.e., say what it said in my own words).  (E.g. in this question I summarized my conversation with ChatGPT in a sentence.)
Note that LLMs nowadays come with a "share" link, so you can copy/paste a URLs for citation, like this, which can strike a good balance between accuracy and succinctness.

Sometimes I'll quote the pertinent part of what ChatGPT says as succinctly as possible, perhaps with inline quotes, or perhaps using block quotes.  However I generally would not exceed one sentence when quoting ChatGPT, otherwise it'll drown out the actual question.  (E.g. this question I blockquote a ChatGPT sentence.)

For answers:
I don't use it too often for answers; if I find myself asking ChatGPT too many questions, I'll likely just assume I'm not the best person to answer.
But sometimes I use LLMs for writing example sentences in answers like this.  I might get the LLM to write 30 example sentences, and I'll carefully select the most useful ones.  LLM-generated example sentences are of better quality than those found in databases or via Google.
Comment: If an LLM gave a correct, trustworthy answer, why ask here .
Comment: So very much the issue here is the somewhat untrustworthy nature of LLMs. Its not "I don't understand this" it is "The black box is giving me words that may or may not be right"
Comment: Yes, just like with other resources (e.g. Google, textbooks, teachers), if I find the answer though an LLM, I wouldn't ask at Stack Exchange.  After all, it takes time to prepare a question to post at Stack Exchange.  Of the 30+ questions I ask ChatGPT daily, I might ask one at Stack Exchange, where I feel I didn't get a suitable answer through ChatGPT nor the myriad other resources I use in conjunction with ChatGPT.
Answer: The best way to delineate the prompt and the response is to post them elsewhere, not on Stack Exchange, then ask your question on the appropriate site without including anything from ChatGPT in it.
Keep that line between the AIG content and this network big and bright and unbreached, and you'll be fine.
The vast majority of AI output is either trivial or incorrect or irrelevant, as far as the collective experience on the network is concerned. It's worse than nonsense because it looks correct despite making up facts and figures, quoting sources that don't exist, or creating code that could never work.
The only useful answer you will probably get to "what does this response mean, can I use this response?" is "it's gibberish, no, you should just ask your actual question here in the first place".
Comment: +1 but LLM Transform models are not considered AIG, they are classified as GenAI .
Comment: "AI generation" is the same thing regardless of what order you put the words, the only difference is how the bullshit gets turned and spread.
Comment: I guess Augusto (and me) mistook "AIG" (or in this case, [GAI](https://en.wikipedia.org/wiki/Generative_artificial_intelligence)) as [AGI](https://en.wikipedia.org/wiki/Artificial_general_intelligence)


Number of different values that obtain from a given set

Question: Suppose $S=\{1,2,\dots,7\}$, already we know that, $S$ have $2^7$ subsets. But the problem is, when we multiply elements of each subset $S$, how many different value we can obtain from multiplication of elements of each subsets? In $2^7$ subsets, some of them are equal, for example, for subset of size 2, $3\times 4=6\times 2$. Are there a simple way that eliminate the duplicate values for any subsets?
Comment: It's usually nice to add some context (from where is this problem) and some thoughts or early attempts you've done. As a hint, I'd start with writing the possible factorizations in primes of numbers you can obtain from the set $S$.
Comment: Every number you get is a divisor of $7!=5040$. But you can't get every divisor of $5040$, e.g., you can't get $9$. That should get you started.
Comment: That is already a huge hint.  The hint in more words again is that the odd multiples of $9$  who are divisors of $7!$ are not possible.  Can you think of any others who are not possible?  Can you prove that?  Note that the only prime factors possible in the results are $2,3,5,7$ which limits the search considerably.
Comment: Now... $7! = 2^4\cdot 3^2\cdot 5\cdot 7$... The number of factors of a number is well known to be the product of one more than each of the exponents in the prime factorization... in this case $(4+1)\cdot (2+1)\cdot (1+1)\cdot (1+1)=5\cdot 3\cdot 2\cdot 2 = 60$, and the number of these which are not possible you can count simply as well and remove from the count.
Answer: $7!=2^4\cdot 3^2\cdot 5^1\cdot 7^1$ has $(4+1)(2+1)(1+1)(1+1)=60$ divisors
Of these, the divisors who are multiples of $2^4$ but not multiples of $3$ are not possible to make (as $6$ would have been needed for that last factor of $2$ and would have brought a factor of $3$ along with it) as well as the divisors who are multiples of $9$ but not multiples of $2$ are not possible (for a similar reason).
There are $2\cdot 2 = 4$ factors who are multiples of $2^4$ but not multiples of $3$ (seen by looking at factors of the form $2^4\cdot 3^0\cdot 5^z\cdot 7^w$) and similarly there are $2\cdot 2 = 4$ factors who are multiples of $9$ but not multiples of $2$ (looking at $2^0\cdot 3^2\cdot 5^z\cdot 7^w$).
As such the total will be
$$60 - 4-4 = 52$$
Answer: Since $1$ has no effect in the multiplications you can put it aside. Put the number $6$ aside for now. Factorize all the other numbers. The multiplication of the elements of any nonempty subset of $\lbrace 2, 3, 4, 5, 7 \rbrace$ would be of the form
$$2^{x} \times 3^{y} \times 5^{z} \times 7^{w} $$ where $x$ and $y$ and $z$ and $w$ are whole numbers and $0 \leq x \leq 3$ and $0 \leq y \leq 1$ and $0 \leq z \leq 1$ and $0 \leq w \leq 1$. As a result of the multiplication principle, you can say that there are $4 \times 2 \times 2 \times 2 = 32$ such multiplications. Now what if we play the number $6$ into the game? Then any multiplication would be of the form
$$2^{x + 1} \times 3^{y + 1} \times 5^{z} \times 7^{w} $$ where $x$ and $y$ and $z$ and $w$ are whole numbers and $0 \leq x \leq 3$ and $0 \leq y \leq 1$ and $0 \leq z \leq 1$ and $0 \leq w \leq 1$. However, if $0 \leq x \leq 2$ and $y = 0$ no new state will be generated and vice versa so you should suppose either $x = 3$ or $y = 1$. You can deduce from the inclusion-exclusion principle that the number of the new states will be $2 \times 2 \times 2 + 4 \times 2 \times 2 \; - 2 \times 2 = 20$. So overall the answer would be $32 + 20= 52$.
Comment: You overcounted the divisor $1$.  It appeared in not only your first case (*where you considered only the divisor $1$*) but also in your second case where you considered divisors of the form $2^x3^y5^z7^w$ in the case of $x=y=z=w=0$.  Note, the empty-product is equal to $1$.
Comment: @GerryMyerson That's right. I should pay more attention to these things.
Comment: Yes. I made a mistake. You're right. I'll edit it. Good point.
Comment: @Emad, I wish you had let OP work it out from the comments, instead of spoiling the fun by writing it all out yourself.


Removing Javascript from HREFs

Question: We want to allow "normal" href links to other webpages, but we don't want to allow anyone to sneak in client-side scripting.
Is searching for "javascript:" within the HREF and onclick/onmouseover/etc. events good enough?  Or are there other things to check?
Answer: It sounds like you're allowing users to submit content with markup.  As such, I would recommend taking a look at a few articles about preventing cross-site scripting which would cover a bit more than simply preventing javascript from being inserted into an HREF tag.  Below is one I found that might be useful:
http://weblogs.java.net/blog/gmurray71/archive/2006/09/preventing_cros.html
Answer: You'll have to use a whitelist of allowed protocols to be completely safe. If you use a blacklist, sooner or later you'll miss something like "telnet://" or "shell:" or some exploitable browser-specific thing you've never heard of...
Answer: Nope, there's a lot more that you need to check.
First of the URL could be encoded (using HTML entities or URL encoding or a mixture of both).
Secondly you need to check for malformed HTML, which the browser might guess at and end up allowing some script in.
Thirdly you need to check for CSS based script, e.g. background: url(javascript:...) or width:expression(...)
There's probably more that I've missed - you need to be careful!
Answer: You have to be extremely careful when taking user input. You'll want to do a whitelist as mentioned, but not just with the href. Example:

or
click meh

Answer: one option would be to disallow html at all and use the same sort of formatting that some forums use.  Just replace
[url="xxx"]yyy[/url]
with
yyy
That'll get you around the issues with mouse over etc.  Then just make sure the link starts off with a white-listed protocol, and doesn't have a quote in it (" or some such that might be decrypted by php or the browser).
Answer: Sounds like you're looking for the companion function to PHP's strip_tags, which is strip_attributes.  Unfortunately, it hasn't been written yet.  (Hint, hint.)
There is, however, an interesting-looking suggestion in the strip_tags documentation, here:
http://www.php.net/manual/en/function.strip-tags.php#85718
In theory this will strip anything that isn't an href, class, or ID from submitted links; seems like you probably want to lock it down even further and just take hrefs.

Removing Javascript from HREFs


How do I access my angular scope from jQuery dialog buttons?

Question: http://plnkr.co/edit/Rf0VItthVBg6j0z7KudO
I'm using a jQuery dialog and want to use the dialog buttons, but I don't know how to get at the scope to trigger a (currently non-existent) $http or $resource call back to the server with the updated model when the jQuery dialog button is clicked.  I feel as if I'm going about this wrong, but I don't know what direction to go here.
Answer: You can use Angular functions to find the scope attached to an element and call a function on it.  I prefer to really abstract it away and find the root of the ng-app and broadcast an event into the app so that the outside-code doesn't know about the specifics of the inside code except for the event that you broadcast.
angular.$externalBroadcast = function (selector, event, message) {
    var scope = angular.element(selector).scope();

    scope.$apply(function () {
        scope.$broadcast(event, message);
    });
};

Then, from any code, you can call something like:
angular.$externalBroadcast('#app-container', 'doSomething', parameters);

And inside the app, I'd do something like this:
$rootScope.$on('doSomething', function(parameters) {
    // handle the external event.
});

If you don't like this approach, just get the scope:
var scope = angular.element(selector).scope();

And do something with it.  Just make sure you call scope.$apply or else the digestion cycle won't happen.
Comment: In the above situation is there a way to get a factory or a directive scope?
Comment: Nvm. It seems that the scope you get is the rootScope. I attached the service to the root scope and was able to call it just how i needed. Thanks for this!
Answer: Best way is to add directive to control. It is a bad idea to add jQuery with angularjs along side. Directive are made to do this kind of manipulation.
Here's I have modified your plunkr to show you what you can do with directives.
app.directive('date', function() {
  return {
     restrict: 'A',
     require: '^ngModel',
     link: function(scope, elm, attrs, ctrl) {
       var dp = $(elm);

       dp.datepicker({
         onSelect: function(dateText) {
           scope.$apply(function() { // Apply cause it is outside angularjs
            ctrl.$setViewValue(dateText); // Set new value of datepicker to scope
           });
        }
       });

       scope.$watch(attrs.ngModel, function(nv) {
         dp.datepicker('setDate', nv); // Update datePicker date when scope change
       });
     }
  }

Comment: My question has nothing to do with the date picker and is all about the buttons you can add to the jQuery dialog being able to call a controller scope method.


How can Stolen Laptop tracking softwares survive OS reinstall?

Question: Some softwares such as Computertrace claim that it can survive on a laptop even if the thief successfully reinstalls the operating system, reformats the hard drive, or (in some laptop models) swaps out the hard drive. How could this happen? Won't all the data associated by the software with the computer be erased?
Comment: Can you list an example or two of actual program names?
Comment: I cannot substantiate this claim which is why it's a comment, but I would assume the tracing comes from a variety of methods outside of the standard OS (thus harddrive). For instance, you could simply put a gps chip on the motherboard and ping it as necessary. Software-wise, you could potentially add some firmware to the motherboard and components that would survive a standard reformatting. This software could be something as simple as a quick ping to an auth server somewhere...
Answer: Some software vendors partner with BIOS makers (e.g. Absolute) so that even if an operating system is re-installed, on network connection, the BIOS may be able to send back relevant information. Many of these products are gimmicky, for example LoJack can be blocked at a firewall/network level that will disallow it from phoning home.
These types of software are primarily aimed at someone needing low level security versus highly secured laptops/network/data whose attackers are determined threat actors. Meaning, they're aimed at someone likely to be exposed to say common theft (drug user, someone taking it to a pawnshop), versus someone on a state level who would likely remove the disk for data. (Remember data is worth a lot more than a laptop).
EDITED
I needed to expand on this a little on the downfalls of using applications like these. When applications like these DO detect the location of a laptop, the reality is, what can they do, and what are they determining for you? They will retrieve a network based location nothing more. They will not give you information on how to get the device back, so most offer a "wipe data now" feature, which works (again) for low level attackers. The reality is, they will return output to you stating: "Your machine is located on network 10.10.10.1" which means little given that any ISP will not give you information on say one of their users using DHCP on that network. For that you would need a court order.
Nowadays, you can modify Team Viewer to act as a similar "phone home" application if you modify your registry. In modifying your registry, you can remove the visuals showing Team Viewer from the toolbar, from the process manager, and so forth. Malware authors have taken to do this at times.
Comment: Yeah, the key here is that these methods are not foolproof and often times just gimmicks... Bottom line is that if a knowledgeable attacker has physical access to a device, they can most often do **whatever** they want.
Answer: Some laptops are equipped with Intel Anti-Theft technology (part of vPro, see a guide here).
The features are built directly into the processor and the BIOS and can take separated control of the on-board NIC, Wifi card and 3G modem independent of the OS. Technically, once setup (inside the OS), the features don't even need a disk to run.
The concept is similar to Baseboard management controllers commonly found on servers.


Database of English synonyms

Question: I am looking for a database of English synonyms or thesaurus (text file or anything convertible to it or web service with API). Please, don't offer a word-by-word websites (like synonym.com).
Answer: Here is a list of APIs that can be used the following way to retrieve synonyms:

API call: http://words.bighugelabs.com/api/2/{api key}/hello/json
The details are here: http://words.bighugelabs.com/api.php

API call: http://api-pub.dictionary.com/v001?vid=<VID>&q=hello&type=synonyms
the details are here: http://content.dictionary.com/api (Note: "We are selective about our API partners and approve use as well as develop terms on a case-by-case basis.")

API call: http://www.abbreviations.com/services/v1/syno.aspx?tokenid={token}&word=hello
the details are here: http://www.abbreviations.com/synonyms_api.php (see also its entry on programmableweb.com)

API call: http://watson.kmi.open.ac.uk/API/term/synonyms?term=hello
the details are here: http://watson.kmi.open.ac.uk/API/explain-syn.html

API call: http://thesaurus.altervista.org/thesaurus/v1?word=hello&language=en_US&key={key}&output=json
the details are here: http://thesaurus.altervista.org/
Comment: Great list! The Princeton Wordnet website also has a list that might be useful: http://wordnet.princeton.edu/wordnet/related-projects/#web
Answer: Check out this post on stackoverflow; it has a lot of good information on synonym web services.

Database of English synonyms


How do I sort lines based on a text property?

Question: I would like to tag lines with a certain text property and then sort all lines with that text property to come to the top. How can I sort based on having a text property rather than a pattern match?
Comment: Did either of the solutions below work for you?
Answer: This solution uses a simple trick; instead of moving lines you care about to the top, move the other lines to the bottom.  This preserves order without any extra book-keeping and allows us to use the g/ command which processes lines in order.
function! LineHasProp(line, type) abort
  return !prop_list(a:line)->filter({_, v -> v.type ==# a:type})->empty()
endfunction

:g/^/if !LineHasProp(line('.'), 'type')|m$|end

Answer: There's nothing like that built in. A custom function would be necessary. An actual general sort would be fairly involved but I can provide you with a function that will do the one specific thing you mention: move all lines with a certain text property to the top of the buffer. (Since "a certain text property" is ambiguous I'm assuming that you mean text properties with a specific type.)
func! TextPropsToTop(type) abort
    let l:cnt = 0  " num lines found with TP of specified type
    1 " cursor to beginning of buffer

    " Search forward from current line
    let l:props = prop_find(#{type: a:type})
    while !empty(l:props)
        " move found line to below the last moved line (maintaining order)
        exe l:props['lnum'] . "move " . l:cnt
        let l:cnt += 1
        " move cursor back to where we found last TP
        exe l:props['lnum']
        " search for the next one
        let l:props = prop_find(#{type: a:type})
    endwhile
endfunc

Call like so :call TextPropsToTop("TpTypeName").
The comments should help explain everything. As they say this maintains the order that the targeted lines have in relation to each other.
It's tested but not what I'd call exhaustively.
Just to compare/contrast to the other answer here...while the other is nice and compact this one doesn't iterate over every line in the file; it processes only lines with the specified TP type. Presumably target lines make up a small percentage of total lines so there's something to be said for this kind of efficiency, especially in large files. (Assuming prop_find() is properly optimized!)
Comment: It is not specified in the question but I suppose using "move" is necessary, since otherwise the text props will not follow the text (if using e.g., setline)
Comment: @Mass Actually, AFAIK, any kind of direct movement of a line loses its text properties. They only stay if the line is moved as a result of _other_ lines being added/deleted. I tried `:move`, `:sort`, yank/put, etc...with several versions of Vim...TP is gone in every case. (In the case of your answer that would mean TPs with types other than the target type will be lost.) I'm thinking (hoping?) OP is just using the TP as temporary markers and won't be bothered by this.
Comment: (Not yank/put but delete/put, I meant.)
Comment: Oh.. surely that is a bug?  Marks definitely move with `:move` and text props are supposed to be better marks..
Comment: @Mass It surprised me, too, but I tried it on three different platforms with builds new and old. It's hard to believe that if it were a bug it would go unaddressed for so long. (The documentation is not clear as to what to expect.)


Ethernet connection not detected

Question: my Ethernet connection somehow stopped being detected by Windows and Ubuntu on my laptop(Dell Inspiron M5010) all of a sudden after just another reboot. The local area connection is not showing up in network connections. Due to this I'm not able to connect to my broadband internet connection. I've tried updating drivers, checking device managers and stuff, but it's just not there! As if my network card is absent! I have no idea how to fix it, if it can be fixed at home somehow, it'll be absolutely great. It's not a problem if I need to open up the laptop for whatever reason. Please ask if there is some additional info I need to provide.
Thanks in advance.
Comment: In linux, does either the `lspci` or `dmidecode -t baseboard` commands list the device?
Answer: Although your question was asked over a year ago, I thought I'd post the resolution that worked for me while it was still fresh in my mind.
My situation was that I had upgraded a Dell Inspiron N5010 from Windows 7 Home Premium (SP1, x64) to Windows 10 Home and noticed after doing so that the NIC was not showing up in Device Manager. Now, I'm not sure if I had installed the NIC driver prior to upgrading to Windows 10. In fact, based on the drivers I downloaded/needed from Dell when I did the clean Windows 7 install, I very well may NOT have installed the NIC driver prior to the upgrade. I was using WiFi for network connectivity and Device Manager did not show the NIC with an exclamation point in Device Manager while doing the Windows 7 clean install (so I did not see the need for it at that time).
Whatever the case, I verified it was 'Enabled' in BIOS which it was. I then downloaded the Windows 7 x64 driver from Dell and installed it but got an error message while doing so that it couldn't find some file. That install did seem to complete normally once I clicked 'OK' but there was still no NIC in Device Manager, even after a reboot.
What did it for me was I downloaded the Windows 8/8.1 NIC driver from Realtek (the RTL8103T in my case) and installed that. During the install (a 'Repair' install as it automatically detected that there was a driver already installed), a message popped up stating that it couldn't detect the NIC and that I should plug in an Ethernet cable because the NIC could be in a 'Deep Sleep' state. I plugged in an Ethernet cable, waited for a few seconds and when the message window didn't go away automatically, I clicked 'OK'. The installation completed successfully and the NIC was then listed in Device Manager, even without a reboot.

Ethernet connection not detected


solution of x and y for non standard eclipse equation

Question: with my basic math knowledge and search I found out that for a standard eclipse equation $x^2 / a^2 + y^2/b^2 = 1$, we can find out $x$ and $y$ by setting $y$ and $x$ intercept $0$.
But if the equation is of the form $x^2 + xy + 41y^2 = n$, how do we make a standard formula for $x$ and $y$ ?
Comment: Please correct "eclipse" to "ellipse". And try to use MathJax in formulas.
Comment: Maybe this would help https://math.stackexchange.com/q/1011192/463578
Comment: To compute the semi-axes of the ellipse, consider a generic line through the origin $y=mx$ and find its intersections $(x(m), y(m))$ with the ellipse as a function of $m$: minimum and maximum of $x(m)^2+y(m)^2$ will give you the squares of the semi-axes.
Answer: Note that in a more general form, your equation is of the form:
$${\alpha _1}{x_1}^2 + 2{\alpha _2}{x_1}{x_2} + {\alpha _3}{x_2}^2 = {\alpha _0}$$
which using the matrix notion, may be written as:
$$\left[ {\begin{array}{*{20}{c}}
  {{x_1}}&{{x_2}}
\end{array}} \right]\left[ {\begin{array}{*{20}{c}}
  {{\alpha _1}}&{{\alpha _2}} \\
  {{\alpha _2}}&{{\alpha _3}}
\end{array}} \right]\left[ \begin{gathered}
  {x_1} \hfill \\
  {x_2} \hfill \\
\end{gathered}  \right] = {\alpha _0}$$
Now, assuming a general linear transformation of the form $Y = LX$, where $X = \left[ \begin{gathered}
  {x_1} \hfill \\
  {x_2} \hfill \\
\end{gathered}  \right]$, one may re-write the original equation as:
$${Y^{\text{T}}}{\left( {{L^{ - 1}}} \right)^{\text{T}}}\left[ {\begin{array}{*{20}{c}}
  {{\alpha _1}}&{{\alpha _2}} \\
  {{\alpha _2}}&{{\alpha _3}}
\end{array}} \right]{L^{ - 1}}Y = {\alpha _0}$$
Using eigen-decomposition, the symmetric coefficient matrix could be re-written as:
$$\left[ {\begin{array}{*{20}{c}}
  {{\alpha _1}}&{{\alpha _2}} \\
  {{\alpha _2}}&{{\alpha _3}}
\end{array}} \right] = PD{P^{\text{T}}}$$
where $D$ is a diagonal matrix. Substituting in the equation on has:
$${Y^{\text{T}}}{\left( {{L^{ - 1}}} \right)^{\text{T}}}PD{P^{\text{T}}}{L^{ - 1}}Y = {\alpha _0}$$
By factoring, one may write the above as:
$$\left( {{P^{\text{T}}}{L^{ - 1}}Y} \right)D\left( {{P^{\text{T}}}{L^{ - 1}}Y} \right) = {\alpha _0}$$
Since in the final form, no cross terms (e.g. ${y_1}{y_2}$) are allowed, one must enforce:
$${P^{\text{T}}}{L^{ - 1}} = I$$
which leads to:
$$L = {P^{\text{T}}}$$
So in summary, you should decompose your coefficients matrix, and the linear transformation matrix which is simply ${P^{\text{T}}}$ would transform your equation into your desired canonical form.
Comment: An older way of saying this: rotate the coordinates. In $x^2 + xy + 41y^2 = n$, the axes of the ellipse are slightly tilted with respect to the $x,y$ axes.


Non-delaunay triangulation of a set of points and its convex hull boundary

Question: I have a set of n random points on a 2D plane, and its convex hull boundary. Some points lie interior to the convex hull boundary. I want to triangulate this in a non-delaunay random fashion, such that it conforms to the points interior to the convex hull boundary (the points inside are vertices of the triangulation) and the convex hull boundary itself. Any ideas would be appreciated.
Answer: I think I might have found a solution.
Given the convex-hull boundary, I can find out all the points that are purely inside the convex-hull boundary. Next, I find the points on the convex hull boundary with the maximum and minimum x-coordinates. Next, I sort all the internal points by their x-coordinates. If these points exist in an appropriate data structure, such as a Doubly Connected Edge List, I add edges between consecutive points in the x-coordinated sorted order. Further I connect the left most point of the convex hull boundary to the left most point of the internal set, and the right most point of the convex hull boundary to the right most point of the internal set. This forms 2 monotone polygons that each can be triangulated in O(n).
Comment: This site is based on dialog : please react to my answer about median line.


Three different definitions of Modular Tensor Categories

Question: I have found three different definitions of Modular Tensor Categories. I want to know if anybody can give a sketch of proof for their equivalences (some parts are easy of course)
A Modular Tensor Category $\mathscr{C}$ is a semisimple ribbon category with finite number of isomorphism classes of simple objects, such that (all three conditions are apparently equivalent) either

(Turaev) The matrix $\tilde{s}$ with components $\tilde{s}_{ij}=\mathrm{tr}(\sigma_{{X_i}X_j}\circ \sigma_{{X_j}X_i})$
  is invertible (trace is quantum trace, $\sigma$ is braiding
  isomorphism and $X_i$ are simple)
(Bruguieres, Muger) Multiples of unit $\mathbf{1}$ are the only transparent objects of the category. (An object $X$ is called
  transparent if $\sigma_{XY}\circ\sigma_{YX}=\mathrm{id}_{Y\otimes X}$
  for all objects $Y$.)
Our premodular category $\mathscr{C}$ is factorizable. The fucntor $\mathscr{C}\boxtimes \mathscr{C}^\text{rev}\to
 \mathcal{Z}(\mathscr{C})$ is an equivalence of categories.

The first two definitions I understand very well. The last one though I have no idea what it even means and what are these symbols and what functor?
But in any case I'm mostly interested in a sketch of proof for equivalence of these definitions (and maybe an explanation of the meaning of the last one). For example it is quite trivial to show that Turaev results the second one. It is just some linear algebra basically and some graphical calculus. The converse though I couldn't figure out.
Answer: In his paper Non-degeneracy conditions for braided finite tensor categories, Shimizu shows the equivalence of these definitions in the non-semisimple case.
Of course, the $s$-matrix doesn't work there, but it is not hard to show (and I believe he does that) that in the semisimple setting, non-degeneracy of the $s$-matrix is equivalent to non-degeneracy of the Hopf pairing of Lyubashenko's coend.