Avoiding damage to phone screen

Question: I don't know this is the correct platform to ask or not but I need help that how to protect your phone screen from damaging, as my phone protector always gets a crack, it really is a problem need your suggestions
Comment: Hi Laila, Welcome to Lifehacks. Do you have a case for your phone? What happened in the past (you said always)? Please edit your question to add details for someone to help you avoid the problem in the future.
Comment: You say the phone "protector" always gets a crack. Is that the phone screen itself, or something you place over it? If the latter, perhaps it is just doing its job and the screen itself has survived a knock.
Comment: It's the protector, i said always because I have changed 2 to 3 phones because of this issue,
Answer: I have used about 3 phones in last 6 years. The first one was a Nokia, whose screen I broke for 6 times; after that I used a HTC, broke the screen 2 times; currently I'm using a iPhone and have broken the screen 2 times.
Over time I have learnt that a good rubber cover is the best deal to protect the phone and screen. Buy one which has its edges coming a little bit over the bezel of phone, secondly, a hack is that just don't use any phone protection, you will be automatically be more cautious with it.

Avoiding damage to phone screen


RPi running too many accessories

Question: I am new to the PI.  I am building a pi that will have cameras, sensors and all sorts connected to it.  I am wondering even if I use an over powered power supply at 5.3v will it really be enough to run everything at full power?  If not, then how do you provide more power to the entire system?  Is there a regulated power supply for example?
Comment: You shouldn't be worried about volts. Really 5.25 is the top limit you should be feeding in there. Volts is like how fast the river flows and amp is how wide the river is. The Pi can only handle a river flowing at 5volts. The reason you can supply abnout 5.25 is because the 3.3,2.5 and 1.8 voltage regulators, REGULATE 5.25 down to 3.3 and that is thier MAX tolerance. All you need is a SWITCHING power supply. like the ones used in computers, not the cheap 1dollar USB things. Spend ~15 dollars on a 5v 2A switching power supply and everything will be fine.
Comment: You'll find that if the current draw is too high that the voltage will drop to compensate this will buy you a little leeway, but it really is best to get a supply that provides sufficient current.
Comment: makes absolute sense.  Thank you very much for the help.
Comment: I'm not allowed to comment. How much power does the kit you plan to connect to the Pi consume in total? (i.e. how many amps at 5V).
Comment: that is yet to be determined.  The entire unit has not been constructed yet, but I am certain it will require more than the 5.3v possible just to make sure that everything has enough power.
Answer: You need to learn a little bit more circuit theory!! (This also applies to many more on this site).
You need a good regulated supply (PSU) that will supply the rated 5v ±5% at 1A. There is no merit is using a PSU "rated" at more than 1A. (This should be proper supply - not a phone "charger" - many of which have poor regulation).
Internally the Pi regulates this down to 3.3v for most of its internal circuitry (as mentioned by @ppumkin). Supplying a higher input voltage will just overheat this regulator.
The excess current (1A less that used by the Pi) is used for HDMI, USB and GPIO power pins. This is limited to about 300mA (1A less ~700mA) by the on-board polyfuse. If you need more for externals, you can use a powered hub (USB) and/or provide a separate source to the externals (which only need a common ground).
There should be plenty of power for running the on-board peripherals, including the camera, although you should avoid drawing extra current via GPIO pin 1.
You can of course use a PSU rated at a higher current, provided you bypass the polyfuse, either by supplying 5V to GPIO pin 2 (although there are many other access points), bypassing the polyfuse, or simply feeding in through the full size USB ports.

RPi running too many accessories


Does a coiled wire have a higher resistance than straight wire?

Question: If you take a straight piece of wire that is insulated and coil it around a non ferrous object like piece of wood would the resistance change?
Comment: Of course not. A ferrous or non-ferrous former doesn't matter, either.
Comment: It may, depending on what you mean by "resistance".  See note on proximity effect below.  I was very surprised the first time I measured my coil impedance and found it 30% higher than expected due to proximity effect.
Answer: Everyone so far seems to have forgotten (or not heard of) proximity effect.
Ignoring the inductance of a coiled wire and only concentrating on losses i.e. the resistive part of the wire then, at DC there will be no change. However, as frequency increases proximity effect between the coils will certainly increase the resistance of a conductor.
This is very much akin to skin effect where the rapidly changing magnetic field of the wire (due to the alternating current it carries) causes the electrons to flow in the outer circumference of the wire thus all that nice copper in the centre carries very little current. Current not using the full cross sectional area of the conductor will have a higher resistance to flow.
Remember I'm not talking about inductance.
So, proximity effect is where two coils are close by and the magnetic field of one wire causes the current flow in the next wire to be even more constricted than by skin-effect alone: -

The above is with current in opposite directions. With currents in the same direction the effects are opposite to that shown above.
Answer: No the resistance only cares about the electron path through the material. Regardless of the shape or if it is wrapped around something it will not change.
On the other hand the inductance, which is related to the energy stored in the magnetic field created around the wire as current passes through it, will change with geometry and the material it is wrapped around.
Comment: I guess my thinking was the B field induced by the DC current maybe some how change the resistance of the wire. I guess if it was an AC signal than the time varying magnetic fields would induce current on the other coils?
Answer: The simple answer is no. Winding wire on a non-ferrous form will not change its resistance.
Of course, it all depends on the details. If the wire is uninsulated, and the form is conductive (copper, silver, gold, platinum, etc) the form will short out the wire turns and reduce the total resistance. Or were you thinking of insulated wire? You didn't say.
Ah, you say, but it is insulated. To be precise, it's insulated with enamel, and called magnet wire.
Well, now it gets tricky. Let's assume your reference point is a straight wire suspended between two contacts in still air. As you run current through the wire, it will heat up, even if only slightly, and for most wire materials the resistance will change. If the wire is now wound around a form of some material, the form will change the rate at which power is dissipated to the environment, and thus the resistance. A thermal insulator, such as foam, will increase the temperature of the wire. A good thermal conductor, such as silver, will tend to reduce the temperature changes, and even this effect depends on the physical details of the form to determine the long-term temperature effects. Size and shape will matter, and the result can, in principle, go either way.
Answer: Contrary to popular belief, the resistance will change - if only by a miniscule amount - because of the wire being work-hardened by winding it around the form.
From: http://www.copper.org/publications/pub_list/pdf/a1360.pdf
Comment: Sorry, I should have included some supporting documentation in my answer.  It's there now, and if you Google "work-hardened" or "cold-worked", there are zillions of hits explaining both terms, which are equivalent.
Comment: What do you mean by "work-hardened"? Maybe I just don't get it because English is not my first language.
Answer: This is one of those questions that starts the real meat of EE. The DC resistance will not change if you coil the wire, but the overall impedance will change. A components impedance consists of the DC resistance, inductive reactance and capacitive reactance, all of which get "sumed" up to form a frequency dependent electrical impedance. I would rather not get into the down and dirty details, but this wiki article sums it up pretty nicely!
Electrical impedance
Answer: Andy aka gave an awesome answer the question was so vague. Sounds like you are trying to make an inductor.. If so, I suggest you read up on inductors. If you are asking about your ac extension cord and whether or not it matters to leave the cord coiled up while trying to use it, you can test that as well. You will discover you are turning your extension cord into an inductor and depending on how many feet you have coiled up, you will notice a significant drop in the voltage, increase in impedance, and an increase in power consumption. Even with household appliances, you should never coil up your excess cord. If you do, straighten them out and enjoy the money you will be saving on your electric bill.
Comment: @CHall: Welcome to SE. The inductance of a coiled up extension cord will be very low due to cancellation caused by the opposing direction of the feed and return currents. Even if there were some inductance that would reduce the voltage and current (and reduce the power factor). The power demand would normally reduce - the exceptions being electronic _power_ controllers which will adjust their switching to _maintain_ the required power. The main problem with coiled extension leads is that of temperature rise due to lack of heat dissipation. You may edit your answer to fix any issues.
Comment: Actually, the increased impedance of the cord acting as an inductor would _decrease_ power consumption. You are correct that it would decrease voltage to the load, though. :-)


Replicate only specific records of a table

Question: I have setup a merge replication and have got a new requirement:
The records of a table should not be replicated until the [state] column is changed from 0 to 1. I have created a filter for the replication to limit replication to records with state = 1, but now the records are removed from the subscriber when the state is set to 0.
Is it possible to keep those records on the subscriber?
Answer: for replicating an specific set of data, you can create a view and replicate it.
here you can see what data you can publish
there is a small detail though:

All types of replication allow you to replicate views. The view (and
  its accompanying index, if it is an indexed view) can be copied to the
  Subscriber, but the base table must also be replicated.
For indexed views, transactional replication also allows you to
  replicate the indexed view as a table rather than a view, eliminating
  the need to also replicate the base table. To do this, specify one of
  the "indexed view logbased" options for the @type parameter of
  sp_addarticle (Transact-SQL). For more information about using
  sp_addarticle, see Define an Article.
Answer: Not with the technology you use - this is not what replication is intended to do. A filter is indeed an active filter, also removing objects. You CAN add a specific field for that that you never reset.


Speeding up loading time of large html file

Question: I am hosting a static web page, which you can visit at nswcorona.imfast.io. It is a very large index.html file with many elements (displaying geo-data), and takes about 10-15 seconds to load. I am new to web development, so I'm sure it's not optimised. I was hoping somebody could kindly help with some tips on speeding it up. You can view the source code by right-clicking on the page -> View page source. Thanks!
Answer: You should avoid using a single static page that loads all the data at once.

You only need the dots that are on the currently visible area, and you could get more e.g. from a separated JSON API that gives the places that are within a given area. This would probably make the map responsive sooner, too.
When someone zooms out, the individual dots aren't that useful anymore. You could merge some of the nearby dots to a single bigger one, showing the count instead.
Fix all the errors & warnings from the console. It's flooding e.g.

The input spec uses vega-lite v4.8.1, but the current version of Vega-Lite is 2.7.0.
The compiled spec uses Vega v4, but current version is 3.3.1.


Unity set ui image as active onclick

Question: I want my button to activate an inactive ui image in the hierarchy through c# called "Responded_A" when the "Response_A" button is clicked. I assume this will use setActive in someway, but I'm just starting out and a little lost. I think some guidance here could really set me in motion. Thanks!
Answer: You can achieve this without any code using the UI
Add a additional slot to your button click event and drag the Image to the slot.
Make sure editor and runtime is set.
Then simply scroll to GameObject.SetActive
Checking the box will enable it when you click. and no check in the box will disable it when clicked
Answer: This should do the trick. Add a new script to the button and put this in it. Next you'll want to drag the image into the GameObject field in the inspector.
Then assign the Button component of the same object into the appropriate field.
<code>using UnityEngine;
using UnityEngine.UI;

public class PushButton : MonoBehaviour {

    // Assign both of these in the editor.
    public GameObject image;
    public Button button;

    void Start() {
        button.onClick.AddListener(() => {
            image.SetActive(true);
        });
    }
}
</code>

Unity set ui image as active onclick


Wordpress custom login and register page problem?

Question: I have created custom pages login page and register page in wordpress. My login page has to come when i visit the site. How do i make login page as the first page on the site. And how do i remove register and login pages from the tab structure.
Comment: what do u mean by "how do i remove register and login pages from the tab structure" could you explain it some more
Comment: do you want to restrict your site and want it to be viewed by  registered user only??
Comment: Yes actually i am converting my wordpress site into a social networking blogging site with use of budy press.
Answer: One way to make the Log In page your landing page is to go to Dashboard > Settings > Reading and find:
Front Page displays  ( ) Your latest posts
                     (x) A static page
Select your "home page" (which will be the Log In page) and your blog page appropriately in the drop down menus.
Regarding buddypress tab/menu structure...  I'm not that familiar with that.  I feel like there's some code you can just add to your child theme's functions.php to remove that sort of feature but I'm unsure what.
Answer: to restrict unregistered users use the Registered Users Only plugin by Viper007Bond or Members Only plugin by hami.


What is the difference between "match" ,"suit" and "fit"

Question: Could you tell me what is the difference between match, suit and fit. I know their usage for clothes (color,size e.t.c.), but I'm wondering about other cases. For example: When your skills don't (match/suit/fit) the vacancy or when I want to take back something to the shop because it doesn't (match/suit/fit). Thank you!
Answer: I've been thinking about this, particularly in the example of a job vacancy - it's quite an interesting question.  I think there are subtle differences between them, but it's just a matter of emphasis:

match emphasises how your skills compare to a list of skills required; so, I'm a good match for this vacancy because I can do X, Y and Z
fit emphasises how you'd fill a gap in the organisation; so, I'm a good fit for this vacancy because I can provide the skills you are short of
suit emphasises personal preference; so, this vacancy suits me because I enjoy doing X.

Like I say though, it's an interesting question - and that's just my perspective on how the words are used in practice.  Others might disagree.
Answer: For when these meanings are close (they have other meanings which are very different):

'fit' means the clothes are the right measurements for you (not too long or short). That is 'This jacket fits you well' or 'This bolt fits this nut'.
'suit' means it looks good on you or goes with your general style (probably means it fits too). That is, 'This dress really suits you'.
'match' means two pieces of clothing go well together. For example, 'the pink of the shoes matches the highlights in the collar of the shirt'.

A dictionary will show the many other meanings (eg match in a game of tennis, suit as in a jacket and pants, fit as in healthy).
Answer: You can also use 'befit' : http://www.collinsdictionary.com/dictionary/english/befit
That was the word I was looking for today
Comment: Hi SylvainPV and welcome to ELU! This is a good answer, but please consider adding the definition from the sourced website to your answer rather than just providing a link.


Which one is correct : ' this house is their ' or ' this house is theirs '

Question: I had got this question and it was very difficult for me to choose one. Please could you give me the right answer and also the reason that's correct.
Comment: This question could be answered very quickly by doing a web search. Have you tried this? What did you find? If you were confused by the answers, please explain.
Answer:

*This house is their.

This is incorrect. The word "their" is a possessive determiner (sometimes called a possessive adjective) and it is used before a noun. It can't be used alone as a predicate, as in your first sentence.
It can be used in a predicate, as long as it is before a noun:

1a. This house is their house.

The correct form for your expression is

This house is theirs.

The word "theirs" is a pronoun.
.
These are some possessives in English:
determiners
my, your, his, her, our, their
pronouns
mine, yours, his, hers, ours, theirs
(note that the form is the same for "his".)
Wikipedia "English possessive"

Pronouns
Unlike with other noun phrases which only have a single possessive form, personal pronouns in English have two possessive forms: possessive determiners (used to form noun phrases such as "her success") and possessive pronouns (used in place of nouns as in "I prefer hers", and also in predicative expressions as in "the success was hers"). In most cases these are different from each other.

In predicative expressions
When they are used as predicative expressions, as in "this is mine" and "that pen is John's", the intended sense may be either that of a pronoun or of a predicate adjective; however their form (mine, yours, etc.) in this case is the same as that used in other sentences for possessive pronouns.

[emphasis added]


Detect if UIViewController changed in UI hierarchy in iOS

Question: Is there a way to detect if anything changes on UIViewController (current view) in the whole UI hierarchy?
I would like to shut off a certain service at background when user have touch/trigger any event in current view without knowing what interaction user provided. For example, I have a network service running at background when user first land on the view, if they swipe or navigate to other page, i need to close the service before the view changes happen.
Comment: You can rely on viewWillDisappear/viewDidDisappear of current controller
Comment: in this case, i will need to find the current view controller. Any idea?
Answer: If your views number is changing you can simply use
        self.view.subviews

to check it after your operation.
If you just want to test when you first show or leave you can use ViewDidAppear() or ViewDidDisappear() to check you operation as Teja said.


Can we regularize/penalize the KNN model?

Question: While reading through KNN in detail, I was checking if there is a way to improve/penalize KNN?
I didn't find any concrete/easily understandable solutions.
Comment: What do you mean by "improve"?
Comment: One way of regularization that I can imagine is in the selection and weighing of the parameters that are used in the model.
Answer: Good question. There are many forms of regularization: $\ell_1$, $\ell_2$, early stopping, dropout, etc. $k$NN is a nonparametric model, it doesn't have parameters to penalize, drop, or way to stop training earlier.
The main point of regularization is preventing overfitting. The way to prevent overfitting in $k$NN is to increase $k$ as it leads to averaging over many points instead of memorizing the training set as in $k=1$. It also makes the result smoother, because of averaging, which is another common consequence of regularization. A similar approach  is used in decision trees where we restrict depth, minimal node size, or prune them, as means of regularization.
You can also use penalized distance metrics and in $k$NN regression more robust aggregation function, e.g. median, to make it less susceptible to outliers.


Is it possible to develop multi-platform game for mobile devices by using Construct 2?

Question: I have been searching some tools for multi-platform game engine which support for all mobile devices(Android, IOS, Windows, Blackberry). I found Construct 2 game engine but I am worried about weather this will support for all mobiles or not? Is it possible to build game by using phonegap? Anybody help me to get more idea about this. Or else please suggest me other tools which we can develop games from scratch HTML5, Javascript.
While searching I found these engines 1. Quintus engine 2. Construct 2
Answer: Yes, It can, but via Web technology.
But before dig in deep, I'll say that, C2 is RAD drag-n-drop gamedev tool like GameMaker by YoYoGames, but not an engine. It has It's own runtime and plugin environment but It almost not support code in javascript directly but require to make Event-Sheets for programming game logics (Plugins will be coded with javascript).
As I know, Construct 2 runtime and plugins are based on JavaScript, then first exports the project to web platform or similar thing, and Uses some good wrapper. I don't know deeply about this topic but it would be wrappers...
When you export via the Cordova option, You'll install Intel XDK and import the exported project directory to the Intel XDK, add some settings, and cloud-build.
See this tutorial article for how to export to mobile devices (Android, iOS).
On other platforms, for example C2 uses NW.js for windows, which is node.js + Webkit, and for platforms which support web technology natively (Windows Store, BlackBerry, Tizen, etc...) It might (I don't know in deep about this) export with suited settings for that platform. Quite convenient.
See this tutorial article for how to export to Windows store platform (phone, desktop).
Answer: Not sure if you checked this out:  https://www.scirra.com/
But it says here that you can develop for Windows, iOS, Android, Blackberry.
Here are a list of games made with Construct 2:
http://www.scirra.com/arcade
If you're still unsure about the engine, I recommend running simulators for each OS on your PC (using Virtual Box or etc..)
Good Luck!
Comment: Thanks for your reply. Yes I have check with https://www.scirra.com/. How to build for all platforms? can we use HTML5, JS for developing?
Comment: Yes you can, you can also build games without any coding knowledge. For more info, check out: https://www.scirra.com/construct2
Comment: Yes I have gone through document. Its fantastic. Thanks a lot
Comment: No problem! Thanks for the reputation.


ClrMD - AttachToProcess Using AttachFlag.Invasive and AttachFlag.NonInvasive Crashing

Question: I'm using the Microsoft.Diagnostics.Runtime nuget package and this is my code as I attempt to get the stacktrace:
var pid = Process.GetCurrentProcess().Id;
// Line of error
using (var dataTarget = DataTarget.AttachToProcess(pid, 5000, AttachFlag.Invasive))
{
    ClrInfo currentRuntime = dataTarget.ClrVersions[0];
    var runtime = currentRuntime.CreateRuntime();
    foreach (var t in runtime.Threads)
    {
        MessageBox.Show("Got here");
        t.StackTrace
    }
}

Question is similar to Attach to self with ClrMD? HRESULT: 0x80070057 but I go a step further and build the application using Wix. Then, I install the application on my desktop so it is running without Visual Studio and its debugger.
The messagebox doesn't show, as long as I put it after the line using (var dataTarget = DataTarget.AttachToProcess(pid, 5000, AttachFlag.Invasive)). If I put the messagebox before, the messagebox does show.
In the code, I get the error
Microsoft.Diagnostics.Runtime.ClrDiagnosticsException: 'Could not attach to pid 624, HRESULT: 0x80070057'

I think I understand why AttachFlag.Invasive doesn't work when I run the application in Visual Studio because it's being debugged, but I don't understand why that line doesn't work after I build it with Wix and install it on my Desktop.
Again, as with the attached Stackoverflow post, AttachFlag.Invasive and AttachFlag.NonInvasive don't work, but AttachFlag.Passive does work.
Answer: Like my answer in: https://stackoverflow.com/a/57790758/7122901
You can use DataTarget.CreateSnapshotAndAttach. This method creates a snapshot of the process and create DataTarget from it. Example:
var processId = Process.GetCurrentProcess().Id;

using (var dataTarget = DataTarget.CreateSnapshotAndAttach(processId))
{
}


C programming in Visual Studio

Question: Can I use Visual Studio to learn C programming? In the new project menu I can choose between Visual Basic, Visual C#, Visual C++, Visual F# and others but I don't see "C" or "Visual C".
Comment: Saying an IDE will turn you stupid to me is akin to saying a debugger or disassembler will turn you stupid. It's a tool. Know its place and know that it's no replacement for learning the fundamentals. Don't make it into bogeymen because some people use it to avoid having to learn.
Comment: Visual Studio 2013 has much better support for C than 2012.
Comment: VS only supports a subset of C89, if you need a real C compiler on windows you'll need mingw-64
Comment: @JérômeRadix though in exactly the same paragraph he says "An IDE, or "Integrated Development Environment" will turn you stupid. "   and "They are useful if you're trying to get something done"   He then says they are pointless for C (but that seems to be because he hasn't found a good one). I'm sure that if writing a GUI  / learning to write a GUI, and of course using libraries, then if there is a good IDE for C, it'd be very useful, not pointless.
Comment: I have books and video tutorials but they all have their own recommendations when it comes to the tools used to compile and write the code. I just want something I'm familiar with.
Comment: Just learn C the hard way : an IDE can slow you down when learning a new language. See the note on bottom of this page http://c.learncodethehardway.org/book/ex0.html
Answer: Short answer: Yes, you need to rename .cpp files to c, so you can write C:
https://msdn.microsoft.com/en-us/library/bb384838.aspx?f=255&MSPPError=-2147217396
From the link above:

By default, the Visual C++ compiler treats all files that end in .c as C source code, and all files that end in .cpp as C++ source code. To force the compiler to treat all files as C regardless of file name extension, use the /Tc compiler option.

That being said, I do not recommend learning C language in Visual Studio, why VS? It does have lots of features you are not going to use while learning C
Comment: Often "learning C" (or C++) is the easy part - the hard part is learning how to build useful (often GUI) applications, which requires getting familiar with all sorts of libraries and frameworks, and IDE makes this experience a lot more manageable.
Comment: I'm already familiar with Visual Studio using other languages.
Comment: Just to make sure, check that the /TP compilation flag is not set.  If the flag is set, it will build .c programs as C++.
Answer: Yes, you very well can learn C using Visual Studio.
Visual Studio comes with its own C compiler, which is actually the C++ compiler. Just use the .c file extension to save your source code.
You don't have to be using the IDE to compile C. You can write the source in Notepad, and compile it in command line using Developer Command Prompt which comes with Visual Studio.
Open the Developer Command Prompt, enter the directory you are working in, use the cl command to compile your C code.
For example, cl helloworld.c compiles a file named helloworld.c.
Refer this for more information: Walkthrough: Compiling a C Program on the Command Line
Hope this helps
Answer: Yes it is, none of the Visual Stdio editions have C mentioned, but it is included with the C++ compiler (you therefore need to look under C++).  The main difference between using C and C++ is the naming system (i.e. using .c and not .cpp).
You do have to be careful not to create a C++ project and rename it to C though, that does not work.
Coding C from the command line:
Much like you can use gcc on Linux (or if you have MinGW installed) Visual Studio has a command to be used from command prompt (it must be the Visual Studio Developer Command Prompt though). As mentioned in the other answer you can use cl to compile your c file (make sure it is named .c)
Example:
cl myfile.c

Or to check all the accepted commands:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community>cl
Microsoft (R) C/C++ Optimizing Compiler Version 19.16.27030.1 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

usage: cl [ option... ] filename... [ /link linkoption... ]

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community>

Coding C from the IDE:
Without doubt one of the best features of Visual Studio is the convenient IDE.
Although it takes more configuring, you get bonuses such as basic debugging before compiling (for example if you forget a ;)
To create a C project do the following:
Start a new project, go under C++ and select Empty Project, enter the Name of your project and the Location you want it to install to, then click Ok.  Now wait for the project to be created.

Next under Solutions Explorer right click Source Files, select Add then New Item.  You should see something like this:

Rename Source.cpp to include a .c extension (Source.c for example).  Select the location you want to keep it in,  I would recommend always keeping it within the project folder itself (in this case C:\Users\Simon\Desktop\Learn\My First C Code)
It should open up the .c file, ready to be modified.  Visual Studio can now be used as normal, happy coding!
Answer: Yes, you can:

You can create a C-language project by using C++ project templates. In the generated project, locate files that have a .cpp file name extension and change it to .c. Then, on the Project Properties page for the project (not for the solution), expand Configuration Properties, C/C++ and select Advanced. Change the Compile As setting to Compile as C Code (/TC).

https://learn.microsoft.com/en-us/cpp/ide/visual-cpp-project-types?view=vs-2017
Answer: You can use Visual Studio for C, but if you are serious about learning the newest C available, I recommend using something like Code::Blocks with MinGW-TDM version, which you can get a 32 bit version of.  I use version 5.1 which supports the newest C and C++.  Another benefit is that it is a better platform for creating software that can be easily ported to other platforms.  If you were, for example, to code in C, using the SDL library, you could create software that could be recompiled with little to no changes to the code, on Linux, Apple and many mobile devices.  The way Microsoft has been going these days, I think this is definitely the better route to take.
Comment: Your help is appreciated, seriously. Sorry for my message possibly being too harsh. I agree that your answer may be useful to someone. Now I'm just trying to give you feedback so you can write better posts. I want to say that this does not provide answer for OP's question about how to write in C with MS VS.
Answer: Download visual studio c++ express version 2006,2010 etc.
then goto create new project  and create c++ project select cmd project check empty rename cc with c extension  file name

C programming in Visual Studio


Preparing for first year CS

Question: I'm in Italian guy almost in my 30. I have a regular job as a programmer. When in school I've never been much interested nor good in math and even at the university I've been studying languages, hence something more on the literary side that on the scientific one.
When in high school I've had mostly literary classes, so, again, my current knowledge of algebra, geometry and arithmetic is quite basic.
I've always been interested in programming, though, up to making it my profession. With my growing interest in math, I'm tinkering with the idea of even getting a Computer Science or Computer Engineering degree at the university. Both rely heavily on maths and I would have to study it by myself, as I cannot afford following classes (as said before, I have a full-time job), starting from the basis that I don't have.
Before attending to it, I want to start learning math by myself, to gain the necessary base knowledge I don't currently have. Do you think it is possible to successfully study mathematics with such a short initial knowledge and not having my full day to do it?
Any general advice or book / site to get me started with the "preparation" study? What are the basic areas I should concentrate on to be prepared to the first year math exams?
Thank you in advance.
Comment: Flagged for wiki-ing.
Answer: Your first course with programming in it will probably use some functional programming language such as an ML variant, Scheme, Haskell, a LISP, etc. As I understand it, universities start with that for two reasons, (i) it works well for teaching (this is debatable, though), and (ii) whatever misconceptions and terrible habits the neophytes bring to the table from unguided tinkering with e.g. Visual Basic will be almost entirely useless, thus ensuring that you also have a good chance of beating some bad habits out of them.
The first heavy math class in a CS education (other than the typically required first course in mathematics) is probably algorithms. Curiously the math requirements for an algorithms course are rather low in the "skills" department, but high in the "mathematical maturity" department. That first course in math will teach you the method of induction and - equally important - the ability to reason mathematically.
Comment: I never did functional first. My college does java first then functional
Comment: "Imperative then functional", I think you mean.
Answer: Get a solid foundation in problem solving. Many CS educations are actually not that math heavy but often rely on what is generally know as a "certain mathematical maturity". Luckily quite a few good books exists about this subject, but none more important (and accssible/enjoyable) than:
How to solve it
If you stay clear of the graphics/optimization (and image processing) curses then you might get a graduate degree without doing any Linear Algebra, however you should properly pick up a basic book on discrete mathematics. Plus if you plan to do any programming lanugage theory you should read a book about mathematical proofs (In which case you should pick How to prove it).
And last, the only way to learn math is to do math, and in the context of CS you can get lots of good training by starting on project Euler. Finally top it off with reading a good algorithm book like The Algorithm Design Manual by
Steven S. Skiena.
Answer: I see we have something in common: we started as programmers by heart, so Your words sounds similar.
What I've discover after years of programming, influenced on my programming, scientific interests as well as career. That's way I highly recommend it to you, even it might be hard way on beginning, later, it turns out to a lot of great and challenging fun:
programming contests.
They are more about practical algorithmic. It's about problem solving, so you have to design algorithms and datastructures on your own. That's why I call them "algorithmic contests".
They develop not only programming skills. Cause They are about algorithms, they develop discrete-math, combinatorial, numerical, logical, asymptotic complexity intuition and many other skills, later, very very helpfull in turning whole CS into great fun, while keeping all practical aspects in your mind and hand at the same moment.
So, check out some programming contests available on the web, just like
http://www.spoj.pl/
where you can take "problems" and sort them by "ACC%" or "users" to get from easiest to hardest. Implementing stuff, gives your great opportunity to discover on your own, things, you later find in books. What's advantage, you will learn it with fun, and remember much longer, cause of better understanding, and knowledge about practical application - I mean, "how to implement it".
Answer: I'm currently in CS, so i could give you some titles of the books i have used over the years.
Discrete mathematics with applications by Susanna S.Epp
Calculus by Larson, Hostetler, Edwards ISBN:  0-618-14918-X I like this book the best for calc. I have like 5 calc books so...
Also You will probably be learning some sort of assembly language. I can't remember if i even had a book for that, but we use MIPS.
We had to learn java for first year programming language, which almost any book from amazon should do.
For C, once you learn java you should pick up C pretty quickly. I really don't even read this book. The class i am taking now is Haskell, ruby and prolog in one semester. So, haskell would be a nice little language to learn. Its pretty cool.
But i would definitely learn Calc and discrete math or statistics. discrete math is somewhat similar to stats so it would help.
But if a place to start right now is Calc.
Also i recommend CLEPing some of your general lower division course. This will save you money. Any REA book or even "5 steps to A 5" by mcgraw hill. While it will say AP what subject you take i found it useful for passing. I studied probably 2 weeks for one class i have never taken in my life and passed.
There are also plenty of resources out there like MIT online and Stanford online. They have free courses online.
Answer:
Do you think it is possible to
  successfully study mathematics with
  such a short initial knowledge and not
  having my full day to do it?

That depends on your university course and how faster you can learn and get skills, but you will like to devote at least 4-5 hours day, and will want to do as much exercises as you can.

When in high school I've had mostly
  literary classes, so, again, my
  current knowledge of algebra, geometry
  and arithmetic is quite basic.

You should start with that basic stuff, they are the foundations for everything that comes next and doing that way will prevent you to go back very often while you are learning the college's math. Once you get in touch with Algebra, Calculus and Discrete Math you will see how there is sinergy about programming and doing math that makes the hours worthy besides
the CS degree.
I want to give you an advice from my personal experience being a math student but like CS more ;) :
half efforts don't produce half results, you must do as more exercises as you can practicing
both theory and plumping work (when you get to lineral algebra you might remember my words),
don't let that the amount of work to-do grow bigger every week, be sure to understand the theorems (that is, dont left the desk every time you get stuck, happens to everyone). After you dive in for a couple of weeks you will start noticing the difference... you will become more analytic and insightful.

Any general advice or book / site to
  get me started with the "preparation"
  study? What are the basic areas I
  should concentrate on to be prepared
  to the first year math exams?

Consult your courses specifications, they are many books out there, first read the ones your professor recommends...
Vi auguro buona fortuna (i wish you good luck right?)

Preparing for first year CS


Animated film with a boy alone on a planet with a microphone

Question: A friend of mine has just asked if I remember an animated film (possibly from the 70s) that featured a young boy stranded on a planet with a microphone that he names Mike.
Comment: This is extremely brief, you might consider asking your friend if he remembers anything else about it that you could [edit] in, see [this guide](https://scifi.meta.stackexchange.com/a/9337/58193) for pointers.
Comment: possibly the same as https://scifi.stackexchange.com/questions/31916/80s-animated-movie-an-old-man-joins-mission-to-save-a-boy-stranded-on-a-hostil
Answer: Time Masters (1982) (originally titled: Les Maîtres du temps)

Piel, a little boy, is left marooned on the planet Perdide after both his parents have been killed by giant hornet-like aliens. Thankfully an emergency transmitter provides him with instantaneous communication with Jaffar, an adventurer who was a friend of his father. This Jaffar convinces the current passengers on his ship, an exiled prince and princess, that a rescue mission must be undertaken. Its a long way to Perdide though, so Jaffar first picks up an old technician who knows that planet. Together with two telepathic aliens they start their mission to save Piel, all the time talking to the boy and trying to avoid him walking into danger. But on the way to Perdide, Jaffar and his friends encounter a lot of trouble themselves, including a hive of malignant angels and what seems to be a traitor in their midst

I found this by Googling animated film boy alone planet microphone which turned up this other id question with the same answer. The answerer also left the following comment which led me to check it:

I've seen this, I think. Did the boy communicate with the ship via a microphone, and so refer to the voice as "Mike"?
Comment: Chailey, if this is the right answer, you can accept it by clicking the checkmark on the left.


Android authentication

Question: I'm using WordPress REST API (Version 2), and I want to authenticate Android native app with my self-hosted WordPress site.
How can I perform that using username and password ?
Answer: The best way to authenticate an app with the REST API would be to use OAuth. There's a good section  on OAuth Authentication the REST API documentation site. You will need to install the OAuth1 plugin on your site as well.
There are some gotchas with implementing the OAuth plugin on WordPress. I found this article on CSS Tricks captured some of the complexity of setting it up.
You'll need an OAuth library in your Android application as well, I've seen ScribeJava recommended more than once. In fact, here's a StackOverflow answer with a good implementation example.
If your app is just in testing mode, you could use Basic Authentication instead of OAuth, because it's easier to implement, but it's not recommended for production use because it's less secure.
Comment: Can we authenticate directly with username & password from our app or we have to redirect users to site for authentification and then redirect them to the app.

Android authentication


How can I test Remote mobile device for SMS and USSD messages?

Question: I have to test my application with some remote numbers (e.g. South African). What I will do is call an API which itself sends certain USSD message on the number. I want to check the behaviour of the mobile. Is any service available for such testing?
Answer: I did such testing with my previous telecom company.

Method 1: Search in google "receive sms online verification" you end
with number of virtual number websites, select your required country.
Method 2: If you using any specific SMS gateways then use SMPP
Protocol tool provided by the SMS platform company, it show the
status when SMS is delivered to customer.
Method 3: Make few friends from that country and tell them to check
your sent SMS status on their mobile.
Comment: What i need is sort of accessibility of the remote device. I have some third party exposed api which my application call. That APi then send ussd message to the device. I have to currently engage a remote resource who have the device to check the ussd message.
Answer: Purchase number in some service (e.g. twilio/nexmo). There you will have access to that number inbox via API provided by that service
Answer: It seems like you might be interested in our mobile testing platform called SIMTEST. It allows you to test both SMS message delivery and USSD code. We use only real SIM cards for testing, placed in physical locations worldwide (including South African Republic).
If you're interested, get in touch with us and a dedicated Account Manager will get you started with testing and answer any further questions you might have. We have extensive documentation and guides that could help you with your problem.
You can find more information about SIMTEST here: https://www.simtest.it/
If you want to get in touch, you can email us here: firstname.lastname@example.com
Comment: I have received a number of flags for this post but I have to say, even though it is self promotion it's done properly (almost perfectly.) the answer clearly addresses the exact needs of the question, doesn't pretend it isn't commercial, and doesn't pretend there's no affiliation. I honestly feel this is an acceptable answer, and will decline flags saying it is spam. (Still I appreciate the volunteers that flag because 99% of self promotion posts are poorly done and their work is invaluable to keeping the community clean!)
Comment: @corsiKa Thank you for the feedback. Since the OP was asking about a testing service and others were mentioned in the thread as well, we thought it was appropriate to suggest ours as a solution.
Comment: that's why i have upvoted the answer to negate the negative mark.
Answer: I had a similar problem. I am based out of India and was working for a US-based client for whom I was building an SMS application. I needed to test sending and receiving SMS to/from a US phone number for the application I was building using the Vonage/Nexmo SMS API.
My problem was: how could I get access to a US sim or US phone number that I could programmatically send SMS to? I have friends in the US but I couldn't ask them to check their phones for test messages.
Google Voice is unfortunately not available in my country, so that was out of the question.
I purchased a Skype US phone number, but I wasn't able to send messages from Skype to my Vonage virtual number. This is because Skype only sends SMS to select carriers in the US such as AT&T and Verizon etc. Vonage (and many other) virtual numbers are not supported. So though I was able to send outbound messages from my app (receiving on the Skype US number), I could not test inbound messages to my virtual number (webhook testing) via Skype.
Finally I found a service that works very well for my needs: TextMagic - a web app that lets you send to and receive messages from a real US phone number that you rent. I was able to successfully use this for all my SMS testing needs. I recommend using their free trial to see if it works for you - if you need a US number for testing text messages.
Comment: Good you are atleast able to work with sms. ussd testing seems still a limitation?
Comment: Unfortunately, I don't think Textmagic allows USSD, only SMS.


Is T7 promotor leaky in DH5 alpha?

Question: In my experiment I found that a GFP gene under T7 promotor in high copy number pTAC-2 vector is showing green fluorescence producing colonies of DH5 alpha under UV light. what could be the possible reason?
Comment: Did you eliminate autofluorescent activities?
Comment: Shouldn't pTAC have the tac promoter and not T7?
Comment: You got a T7 phage contamination?
Comment: Confirm your strain has DE3 or other mutated lacp? Best practice to include selection antibiotic for the lac cassette as well. Also @243 answer above. Finally Check agar for any supplements and run map on plasmid to confirm it is ptac
Answer: Consider the phenomenon of zygotic induction, as originally observed by Art Pardee, Francois Jacob, and Jacques Monod (sometimes called the "PaJaMo", or "PaJaMa" experiment): regulation of a repressed promoter can be affected by the copy number of the promoter in the cell. Put another way, if the copy number of the lac operator in the cell is high enough to bind or titrate all of the available lac repressor protein in the cell, then some of the lac promoters in the cell will be expressed.

Is T7 promotor leaky in DH5 alpha?


2 day חג and being Oleh regel

Question: Why do people who come to Israel for the shalosh regalim keep two days if there is no mention of people who were Oleh regel keeping two days during the first/second temple?
Comment: Is there a mention they kept one day?
Answer: Obviously -- so long as the Sanhedrin was declaring a new month and sending messengers -- which continued well past the destruction of the Second Temple -- anyone who happened to be in Israel on yomtov would keep one day, because they knew.
(And yes, there are those who opine "follow the locals as of today", which also means an Israeli on a one-week business trip to the US keeps two days. But let's assume, for the sake of this question, that we follow the Shulchan Aruch, R' Moshe Feinstein, and R' Shlomo Zalman Auerbach -- that you are defined by your "home" vis-a-vis how many days to keep.)
When we switched to a fixed calendar (let's assume around the year 500) and the Talmud ordered diaspora Jews to continue keeping two days, some of the parameters may have thus changed in that decree, compared to what people had been doing previously. It appears the decree was: "Diaspora Jews keep two days." Some have suggested this was a way of gently pushing folks to move to Israel, or that Jews outside of Israel needed more of a spiritual lift. We already had treatments of "local practices", for which you are defined by your home; so how-many-days-should-I-keep fell into this category as well.
(Just to make it even more fun: when they relied on messengers, who kept two days? People who lived beyond the range of the messengers. Rambam says this is estimated by the minimalist borders in Gittin Ch. 1, and therefore those are the places that keep one day of yomtov. Ritva, if I'm not mistaken, says that when the enactment changed from "keep two days if you didn't get a messenger" to "keep two days outside of Israel", they used the maximalist definition of "Israel", i.e. the borders found at the end of Bamidbar. Even though that didn't align perfectly with what the practice had been in the messenger era.)
Comment: There were also places that had messengers arrive for pesach and not sukkot. Similarly, everyone knew when shavuot was back then. Clearly the modern rule isn't exactly the same as the practice back then.
Comment: I don't think this is obvious at all. And we do see that some people who knew when the Rosh Chodesh was declared by the Beis Din would still keep two days: [Rosh Hashana 21a](https://www.sefaria.org.il/Rosh_Hashanah.21a.3?vhe=William_Davidson_Edition_-_Vocalized_Aramaic⟨=bi&with=all&lang2=en)

2 day חג and being Oleh regel


Neck swinging to barbell on eccentric of barbell row

Question: I've noticed my neck swings to the barbell when I'm doing the concentric on the lift. Is this harmful? If so, how could I stop this from happening?
Answer: If you want to correct neck position, the easiest way is to mark a fixed point on the ground before starting (so that your back and neck are in good alignment) and fix that point with your eyes while doing the rows. Can be your bottle, your cabin keys, a piece of tape or whatever.
The head tries to centre the eyes, the neck tries to align the head, so use your point of focus to help your body control your neck.
In case you are talking about a transverse movement instead of a swing (head moving forward without change of angle relative to the upper body), pulling the head back into a double chin and holding it there as default position might help.
Answer: I fixed it. The fixed position goes out of the Mind when doing the exercise as I'm doing it as ab explosive lift.
What works is, decreasing the angle about hip. As in, turn the barbell row into more of a pendlay row.


Ordinal with given cardinality (without AC)

Question: Is it possible to show that every cardinality has an ordinal with this cardinality (without the axiom of choice)? If so, how?
Comment: Please define "cardinality" in your choiceless setting.
Comment: This might be relevant for this question: [Defining cardinality in the absence of choice](http://math.stackexchange.com/questions/53770/defining-cardinality-in-the-absence-of-choice)
Answer: The statement "every cardinality has an ordinal with this cardinality" is equivalent to axiom of choice (and hence is unprovable without it). It is so because, if you think about it a little, your statement is equivalent "every set has an ordinal of the same cardinality", and so "for every set there is a bijection between it and some ordinal" and thus "every set can be well-ordered", which is well-known to be equivalent to axiom of choice.
Answer: I'm no expert, but I think no. IIRC, ordinals are linearly ordered without using any choice. If we could show your result, it would imply cardinals are linearly ordered, and if memory serves me, this implies the Axiom of Choice.
Comment: You are absolutely right. Thank you.
Answer: As suggested by Wojowu and Henno, there are two prime reasons why you cannot show that every cardinality has an ordinal with this cardinality without the use of AC:

The principle of linearity of cardinals is equivalent to AC, and if every cardinality has an ordinal with this cardinality, then, given two cardinalities, there are two ordinals with those cardinalities, one is a subset of the other and hence there is injection between representatives of these cardinalities and hence these cardinalities can be compared (thanks to Henno for this answer).
If A is partially ordered set and there exists bijection f:A->B for some set B, then f defines partial order on B with the same properties as that on A, therefore if you could find for every cardinality an ordinal with this cardinality, since every set is presumed to have cardinality then you could find bijection between a given set and some ordinal, ordering well this set. But the principle of ordering sets well is equivalent to AC.


Do nettles grow in Florida?

Question: Where can i get nettles in Florida? I have never seen them grow around here or in any stores, and i am not even sure if they grow much in the US.
Answer: What we called "stinging nettles" were the bane of my childhood in northern Florida, but they aren't  nettles of the urtica genus.  They are actually Cnidoscolus stimulosus, or bullnettle, which unlike true nettles does not have edible leaves, but the small tuberous roots can be eaten cooked like potatoes.
Urtica chamaedryoides, Urtica urens, and Urtica dioica can be found growing wild throughout the state and do have edible leaves.
Answer: The US has lots and lots of nettles. From Wiki:
Nettle is part of the English name of many plants with stinging hairs, particularly those of the genus Urtica. It is also part of the name of plants which resemble Urtica species in appearance but do not have stinging hairs.
Plants called "nettle" include:
<code>ball nettle – Solanum carolinense
bull nettle
    Cnidoscolus stimulosus, bull nettle, spurge nettle
    Cnidoscolus texanus, Texas bull nettle
    Cnidoscolus urens, bull nettle
    Solanum elaeagnifolium, bull nettle, silver-leaf nettle, white horse-nettle
dead nettle, dumb nettle
    Lamium, particularly Lamium album
false nettle – Boehmeria
flame nettle – Coleus
hedge nettle – Stachys
hemp nettle – Galeopsis
horse nettle:
    Agastache urticifolia – horse-nettle
    Solanum carolinense – ball-nettle, Carolina horse-nettle
    Solanum dimidiatum – western horse-nettle, robust horse-nettle
    Solanum elaeagnifolium – bull nettle, silver-leaf nettle, white horse-nettle
    Solanum rostratum – horse-nettle
nettle tree or tree nettle:
    Celtis
    Various species of the genus Dendrocnide
    Urera baccifera
    Urtica ferox
nilgiri nettle, Himalayan giant nettle - Girardinia diversifolia
painted nettle – Coleus blumei
rock nettle – Eucnide
small-leaved nettle – Dendrocnide photinophylla
spurge nettle – Cnidoscolus
stinging nettle
    most, but not all subspecies of Urtica dioica
    Urtica incisa
    Urtica ferox
tree nettle - see nettle tree
white nettle – Lamium album
wood nettle - Laportea canadensis
</code>
Many of those species are are indigenous to the US.
Comment: Are all of those edible?

Do nettles grow in Florida?


Is It Shirk And Kufr To Listen To Hindu Mantras?

Question: I mean listening to Hindu mantras with the intention that it will have some effect on someone or yourself. As far as I know black magic is a part of hindu religion, so I would like to know if listening to such thing with the intention that it might effect us in some way (positive or negative). If it is indeed Kufr or Shirk, then how does a person repent from it?
Answer: Recite At very First the kalma e tayyaba(1st kalma).
Then Ask Allah swt in Private and with all faith in him, "Oh lord Forgive me in the name of Holy Prophet Who is your Habib The one  with  guidance and Knowledge. I have commit the sin but I am feeling guilty and I will Never ever Perform it again Oh lord You Love your servant more than 70 times a mother does to her children . I seek refuge in You And there is No Gods To worship except You, Oh lord of Muhammad rasullahallah I seek Forgiveness".
Something like in this manner or other But never do it again Consider it a sin and a bad practice and seek his forgiveness because what Mine, Your and every creation's Lord says:-
"O my Servants who have transgressed against their souls! Despair not of the Mercy of Allah: for Allah forgives all sins: for He is Oft-Forgiving, Most Merciful. ... "O son of Adam, so long as you call upon Me, and ask of Me, I shall forgive you for what you have done, and I shall not mind."
Answer: If  black magic is found in hindu mantras and you do not denounce it, you are committing sihr, and since sihr is kufr, you are also commiting kufr if you did not denounce it
.
If you cannot denounce it by taking action, advise the people committing ths by talking, if you cannot then hate the sins the people are committing, and that is sufficient.
It is obligatory to denounce the evil by taking action, if you cannot then advise them by talking, if you cannot then hate the sin.
Comment: Since I have listened to Hindu mantras and I believed that it has some sort of Sihr and it might have an effect on Human body, how do I repent from this kind of sin?
Comment: If you did it unknowingly, you may need to leave the sihr beliefs and recite the shahadah and recite the dua in Al Adab Al Mufrad 716 which is: Allahumma ini a'udhu bika in ushrika wa ana 'alamu wa astaghfiruka lima la 'alamu.
Comment: Knowing the duas meaning and hoping that it is accepted may get the dua accepted
Comment: What if a person does it knowingly?
Comment: Then he has to repent
Comment: UPDATES: I did some research on hindu mantras and I have found that such kind of hindu mantras contain words that are clearly and blatantly kufriya in nature. I will repent to Allah and recite the Shahadah once again today. Inshallah.


I want iPhone 5s to always ring..even when head is left active

Question: Is there any way to make the phone ring when the headset is left on? My husband will take the earpiece out of his ear but leave it active. When a call comes in it rings in the earpiece and not through the phone. He hates the lag time it takes for the earpiece to connect if turned off but it also hurts to leave it in his ear. If the phone would just always ring, it wouldn't matter where the earpiece was.
Answer: I don't think that this is possible. If one has a Bluetooth headset connected with his iPhone, all audio will be played through the headset, not the iPhone. You can keep the devices paired and disconnected and that will save a lot of time when you switch to and from bluetooth headsets.
Since the software won't do what you hoped, an option would be to look into using a more comfortable or faster Bluetooth accessory or even choosing portable speakers as they often work well. Also, you might see if your phone supports Bluetooth LE (4.0) as the latency to connect drops from 100ms to 6 ms (which is how long the hardware takes to recognize a reconnect to a known device - as opposed to re-pairing two devices for the first time) to reduce the time it takes to transfer to the newer headsets.
Another option would be to get something like the Apple Watch so that you get notified of calls and alerts without needing to hear any sound and/or having the sound very close to your ears no matter what the iPhone has connected to it.
Comment: Forgive the large edit. Feel free to revert or cut it mercilessly if you don't agree with the added details/options.
Comment: I disagree, my iPhone will always ring out loud if the mute switch is off, even if a wired or wireless headset is connected to the phone.
Comment: @Mark Maybe it's a headset specific thing. What model of headset do you have and what iPhone running which version of iOS do you have?
Comment: @RedEagle2000 iPhone 6, iOS 9.2.1, My headsets are 1) Apple Earbuds, 2) Plantronics Voyager Edge, 3) Jabra Sport+, 4) Jabra Classic. It works the same way for all of these headsets.


Install OS X on replaced blank SSD in iMac

Question: I have a 2009 27 inch iMac and hard drive died. I have a new 750 GB SSD drive for the iMac. How do I get OS X installed? i have no backup or installation  discs.
Comment: Welcome to apple.stackexchange.com! Before posting a question search for an appropriate q&a – probably a dozen similar questions & answers already exist here! This is neither a forum nor reddit/apple!
Answer: The 2009 iMac does not support Internet Recovery, so you'll not be able to download and install Mac OS X directly from the iMac without any external installation medium.
You'll to acquire the installation DVD, insert it into the drive and power on the Mac while holding down the C key on the keyboard.
If you have another Mac, you could possibly download the installation DMG from the App Store and burn it to a DVD or transfer to a USB drive for the iMac.
Another option would be to request the installation discs in an Apple Store - if they still have a supported OS for sale.
A third option is to use eBay or similar to purchase a used installation disc.


Cesaro Means decrease slower than the sequence

Question: For a strictly decreasing sequence of positive real numbers, I want to show that the Cesaro means decrease slower than the sequence itself. In particular, I need
$$\dfrac{C_n}{C_{n+1}}<\dfrac{a_n}{a_{n+1}},$$
where $C_n=\dfrac{1}{n}\displaystyle\sum_{i=1}^na_i.$
This is indeed true for $a_n=\frac{1}{n}$ or $a_n=r^n$ with $r<1$.
Answer: This is false. Consider $2,1,1$ and $n=2$. Then $a_2 = a_3 = 1$ while $\frac{C_2}{C_3} = \frac{3/2}{4/3} > 1$.
Comment: I meant strictly decreasing. Sorry for the confusion, will edit.
Comment: It's still false, by continuity. Just change the sequence to $2,1,.9999$
Comment: You are correct, thanks. Where do I look for a sufficient condition? I need it for sequences like $a_n=log(A/n)^2$ with fixed A.
Comment: I think you want $\sum_{n \le N} a_n \le \frac{Na_Na_{N+1}}{N(a_{n+1}-a_n)+a_{n+1}}$ if the denominator is positive. If the denominator is negative, then the original inequality is true. So it looks false for $\log(A/n)^2$.


Import products and keeping the current id

Question: Has anyone tried importing products from another store and keeping the same ID? I'm not sure how to do identity inserts with Magento. I'm sure there has to be a way.
Comment: I don't think there is a way.. Can I ask you why you want to do this in the first place?
Comment: Well, it'll make what I have to do a whole lot easier since I'll be pushing data between two systems.
Comment: How are you currently planning on importing the products? Also I am assuming you are referring to the product_id. Are the foreign ids compatible with Magento's database column that stores the id (catalog_product_entity::entity_id), in other words is the ID always an integer of up to 10 digits?
Answer: This is specifically why SKU exists, so you don't rely on the autoincrement, primary key to do syncs between databases.
If you have no other way of identifying the products in the second database(aka non-magento one), you can use the ID from it as a SKU in the magento database.
But I don't think there are product databases that don't use sku's for identification of products.
PS:
You can load/filter products by SKU just as easily as you can with ids.
// for example, to load a product with the sku "custom_sku"
$product = Mage::getModel('catalog/product')->load('custom_sku', 'sku');

Comment: I agree.  Why would you need the increment_id to be the same?
Answer: It is possible - but the side-effects are not desirable. Basically, there are many afterSave() methods called after a new product is created (read: not updated). It is these functions that set up the required additional information in the DB (stocking, attribute, child/parent association, category assignation).
It is actually possible to set the product ID - and even make it look like it completed without error - but the reality is that further down the line; there'll be errors that cannot be explained - and it will fall on the initial import itself.
The ID really is merely for the database - not for the end user, this is why the SKU exists. You can easily keep stores in sync using the SKU - using any recognised method:

Magento Dataflow (standard import/export utility)
Magento SOAP API
Magento REST API
Aftermarket solutions (eg. uRapidFlow)

A good example is if you attempt the same process with categories; by programatically creating them and setting the ID simultaneously. The children_count parameter is overridden (event if explicitly set) by an afterSave() method.
Which allows the import to complete and for everything to see okay - but later breaks the conditional promotional rules category display. So then you are forced to run a MySQL fix to rectify it.


How do I change private network to public network in windows 10 pro technical preview

Question: Whenever I connect my LAN wire to my system, Windows 10 automatically detects it and connect to it as Private Network. How would I change it to public network since most of my applications are set to access internet in public network only.
Comment: I think there may be some conceptual issue here… a public network is an inherently unsafe one, like an internet cafe or Starbucks. Your in-house network is, in fact, a private network & you should organise your apps' connectivity accordingly.
Answer: I don't know about Windows 10, but for Windows 8 you go into PC Settings then into Network > Connections and then turn Find Devices and content to off. This should turn your network into a public one.
You can also do this via Windows Powershell. Make sure to start it elevated (Run as Administrator)

Run Get-NetConnectionProfile command to find the list of all connected interfaces. Note the interface ID of the connection that you are trying to change.
Run Set-NetConnectionProfile -InterfaceIndex [Interface ID] -NetworkCategory Public
Comment: We tried several other methods and THIS one is the only that worked. The problem with some instructions is about the difference in "Name" and "InterfaceAliase". Thank you!!!


Search Central Admin Service not activated

Question: When I navigate to SharePoint search admin central, I see Errors:
Comment: Time to look into your ULS logs to see what is struggling. :)
Answer: If search status shows as 'All Errors', there can be multiple reasons behind it. You can try following things to see if it helps:

Go to Windows services console and restart both SharePoint search service 15/16 and SharePoint search host controller one by one. Wait for sometime to see if helps.
Check in Central admin --> Application Management --> Manage Services in Server to see if both services shows as started or not.
Note: Do not perform any start or stop operation from there. Use PowerShell to restart service if it shows as Error or stopped state.
Restart the server which is hosting the admin component to see if it helps.
As part of logs, you can validate in Event logs to see if there are any error message with respect to permissions.

If nothing helps then recreate search service application to see if
  that is bringing all components in live state or not.


Embedded system - is it a good idea to run the user application as root?

Question: I'm working on a Linux powered consumer electronics. Everything user interacts with is running as root (legacy design). Should I make the application run as its own user with restrictions?
Comment: The Good Idea is to run nothing as root. But I suspect that you already know that. Maybe you should expand your question?
Answer:
Should I make the application run as its own user with restrictions?

Yes!
Answer: Yes.  This is the basic tenet of Defense in Depth.  If your application has a security flaw some place which could allow an attacker to read/write to the file system or execute code, the attack can be stopped if the user account does not have permissions to perform the actions which the attacker is attempting.
Answer: Yes. You should run as little code as possible as root. Create a user for the application, or more than one user if the application can be broken up into loosely coupled pieces. In particular, if the user enters private identifying information such as their name or credentials to an online account, or they enter private data such as their favorite recipes/TV shows/…, the private data should preferably isolated and only readable by an account that does as little as possible.
If there's any firmware update mechanism, it should run as a separate user from the main application so that if the main application user is compromised, there's still a chance to recover.
This is good not only to protect against attacks, but also to defend against bugs of non-malicious origin. And this is good even if you aren't too worried about attacks (but who isn't these days, with everything getting online), because it also makes the device more robust against accidental bricking if there's less code that's able to modify the firmware.
Answer: Dont run as root as much as possible. Still if you want to run as root check what the POSIX capabilities you really neeeds and restrict the capabilities of you root application to a basic minimum required. Otherwords, apply least privilege principle. Even if some of the vulnerabilities in your code are exploited, limiting capabilities will restrict from critical threats(for example network access).


Frequency Support of Window Functions

Question: All window functions, which go from zero amplitude, up, then back to zero amplitude, are all base-band signals. Why is this? Are all functions that have this behavior always band-band aka low-pass?
Answer: A window function $w(t)$ satisfies $w(t)\ge 0$. The value of a window's frequency response $W(f)$ at DC ($f=0$) equals its integral
$$W(0)=\int_{-\infty}^{\infty}w(t)dt>0\tag{1}$$
which is clearly greater than zero because $w(t)\ge 0$. For all other frequencies we obtain the following bound:
$$|W(f)|=\left|\int_{-\infty}^{\infty}w(t)e^{-j2\pi ft}dt\right|\le\int_{-\infty}^{\infty}\left|w(t)e^{-j2\pi ft}\right|dt=\int_{-\infty}^{\infty}w(t)dt=W(0)\tag{2}$$
Eq. $(2)$ means that $|W(f)|$ cannot be greater than its DC value. Actually, it can be shown that $(2)$ is a strict inequality for any $f\neq 0$: $|W(f)|<W(0)$ for any $f>0$. This shows that $W(f)$ has a lowpass characteristic.
To give a more intuitive explanation, a rectangular window's frequency response is a sinc function, which has a lowpass characteristic. All other windows are just smoother versions of a rectangular window, which means that their spectra decay faster than a sinc. I.e., non-rectangular windows have an even more pronounced low pass characteristic than a rectangular window.
Comment: I see. That is what I was looking for. Thanks!
Comment: Matt,

I have to disagree with you here (assuming I am understanding your terminology correctly).  The eigenvector window when applied to a pure complex tone, simply slides the profile up the spectrum, shape and size intact.  Thus $|W(f)|=|W(0)|$ for all $f$.  As the church lady would say:  "Isn't that special?"
Comment: @CedronDawg: You mean $w(t)=e^{j\omega t}$?
Comment: No, I think I misunderstood what you are saying.  The profile of the eigenvector has a peak in the center, and it is indeed bigger than any of the side bins in magnitude.  If you apply the window to a pure complex tone $x[n]=e^{i\omega n}$ then take the DFT, the profile is preserved.
Comment: @CedronDawg: Yes, but how can $|W(f)|$ be constant then?
Comment: @CedronDawg: If $w(t)\ge 0$ is satisfied, it follows that $|W(f)|0$.
Comment: No, you're right, the center is taller than the sides, I did misunderstand what you were saying, sorry.
Answer: From the seminal paper on the subject by harris:

"On the Use of Windows for Harmonic Analysis with the Discrete Fourier Transform. FREDRIC J. HARRIS"
I've recently discovered a new family of windows.  They are very special.
The Zeroing Sine Family of Window Functions
You can think of them as the discrete version of the Raised Sine Windows (Equation (25b) in harris' paper).
These windows literally zero out the sample values to achieve this effect.
Comment: And how are they?
Comment: Those window functions are cool! Submit a letter to IEEE!
Comment: I have no respect for the IEEE.
Comment: How come? -------------------------
Comment: Because I tend to see things as they are.
Comment: This is not the place for that discussion.

Frequency Support of Window Functions


Could there be lead in the finish of a mid-century piano?

Question: I have an old british piano from the 1950s with some kind of varnish/lacquer/shellac finish. I wasn't thinking and sanded it down (which messed it up but that's another story), and now I'm worried I might have created lead dust. I read that lead acetate was used as a drying agent in certain finishes up to the 1970s. Is there legitimate reason for me to be worried?
Comment: Welcome to WW-SE. The only way to know for sure is to get a testing kit and test for lead. I don't think this is answerable unless you can tell us the maker/model of the piano and if it still has the original finish. And even then someone has to know if that maker used lead paint or not. Other than that: Maybe, maybe not. If you want to be sure get it tested.
Answer:
Could there be lead in the finish of a mid-century piano?

The short answer is yes, some lead might be present.
Not with shellac
If in its original finish the piano is unlikely to be coated in shellac because it was obsolete as a commercial finish long before the 50s. However its use is still a possibility and since it is very easy to test for shellac that should be the first thing you should do. Of the three finish possibilities only shellac is soluble in alcohol.

If you discover it is shellac on all parts of the piano you're done.

If you find it's not shellac there's no point in trying to distinguish further if it is varnish or lacquer because both might contain some lead drier.
If it's not shellac, then what?
As @Max rightly points out in the Comments the next step would to buy a lead-test kit and use as directed. If the instructions don't specify be sure to test multiple spots as there could have been local, or complete, refinishing during the piano's lifetime.
If the test is positive for lead, don't panic
Unless there are infants or young children (under 5) in the house, or you or your partner are pregnant, there's no need for excessive concern.
I'm not suggesting you be cavalier about the dust (which you'll want to clean up carefully, wearing a mask!) but do be realistic.

This is a one-time exposure to a small amount of sanding dust.
Second, the lead compound would represent only a tiny proportion of this small quantity of sanding dust — possibly as low as 0.25% — so this situation is not at all like sanding lead-white paint which is packed full of lead (it was a primary ingredient, not an additive).
To further put your mind at rest, bear in mind that old varnish or lacquer don't have regs concerning their removal as there are with lead-white paint. This does tell us something.
Answer: According to a Wikipedia article on lead-based paint in the United Kingdom:

Lead (lead naphthenate) was added as a drying agent to some types of
paint to ensure the paint surface hardened. In the 1960s this
practice was phased out for ordinary paint available to the general
public, however its use has not (so far) been banned by legislation.

So it's certainly possible that the finish on your piano might contain lead, even if the piano were brand new. Whether to worry at this point is a matter of opinion, but I think there's reason to be concerned enough to take the next step and find out for certain.
While it might help to know more about the type of finish on the piano in question, the only way to know for certain whether there is a problem is to test using a lead test kit. They're inexpensive and available at any home center (Lowes, Home Depot, etc.).


Distinguishing Gamma-rays and stars from each other in nebulas

Question: How do you tell the difference between a gamma-ray burst and a star just from a picture of a nebula, in which it cannot flash on and off here and there?
Comment: What? How does it vanish from pictures in the future?

@CrazyBuddy, I know that, but I heard GRBs go off every .33 seconds in the Crab Nebula, therefore if you see a picture of a Crab or any other nebula, then surely you would think that some of the glowing orbs in the picture aren't stars, and maybe just one is a GRB. It seems logical in my perspective.
Comment: Well, one way is that it won't be in pictures from the past, and will vanish from pictures in the future. It will also have a different spectrum than a star. GRBs emit mostly gamma rays (hence the name) while stars have very different (roughly thermal) spectra.
Comment: @William, what do you mean by "from a picture of nebula"... [Wikipedia](http://en.wikipedia.org/wiki/Gamma-ray_burst) says GRBs are emitted from supernovae, neutron stars, quark stars and black holes.
Answer: Observations are not made with a single photograph frame, they're made over longer periods of time (for example, a friend takes observations of Herbig stars over 2 minute periods in the J-band with Gemini North). The emissions from stars range from UV to IR (depending on your opinion, it could also range from IR to UV ;) ), these emissions are continuous (though periodic variances can be observed, hence the term "variable stars", but we'll ignore that class for now), so taking an observation now should give you (roughly) the same data any time later
Gamma-ray bursts, on the other  hand, last for no more than 10 seconds (this type are called long-duration GRBs with short-duration GRBs taking less than 2 seconds) and then disappear (quiescence)--there are a class of objects called soft-gamma repeaters (SGR) that periodically (albeit irregularly) emit gamma-ray bursts, but not at the same flux as traditional GRBs, so they're not quite the same thing1. Below is an example of a long-duration GRB light curve which shows how quick/efficient observations of GRBs need to be,

(source)
Side note: The above is actually the last GRB detected by the BATSE detector on the Compton Gamma-ray observatory (CGRO) before it went offline in 2000.
The next obvious difference is the energies of the photons received. Gamma ray bursts have huge fluxes in, well, the gamma-ray regime:

(source)
A study done a few years ago (arXiv preprint) using the Fermi space telescope looked at a few T-Tauri stars. The results (found in Table 2 of the paper) show fluxes on the order of $10^{-11}\,{\rm erg/cm^2/s}$, compared to the above $\sim10^{-5}\,{\rm erg/cm^2/s}$ for a GRB. So while gamma-ray emissions may be found in stars (particularly young ones)2, they're not at the same energy or duration as GRBs.
TL;DR:
We can tell the difference between a star and a gamma-ray burst based mostly on the energy of the signal received, but also the duration of the signal.

1 This is probably where your confusion of the Crab nebula being a GRB, it's often considered an SGR.
2 It's actually believed that the gamma-ray signal in the T-Tauri stars stem from the acceleration of protons or electrons at magnetic reconnection events in the accretion disc, rather than from the star itself, so this statement might be misleading.
Answer: GRBs have a spectra far more Red-shifted than that of a star.. In fact, GRBs have such an unique spectra that nothing matches with it. Its profile has one or two high peaks of 1/2 seconds during which most of the energies will be emitted.. An ordinary star would be bright in optical wavelength... But, doesn't have any crazy peaks & hence won't be extremely red-shifted (Otherwise, we won't be able to see them) A GRB's redshift can be measured only with the afterglow when the initial gamma ray flare would be over. Also, Crab nebula doesn't host GRB phenomenon... It only flares up because of some abnormal neutron star spin-down or magnetic disturbances. And we're able to catch the ultra high energy gamma ray photons from Crab only because it's so nearer to us than any GRB you can name of... GRBs are always highly red-shifted extra-galactic explosions.


How many photons exist in another dimension spaces?

Question: As I understand, there are 2 types of photons in our (3+1) space with photon helicity $\pm 1$. How many photons exist in another spaces like (2 + 1) or (1 + 1)? Can we apply the same for gravitons?
Comment: I'm not sure if spin hence helicity is even meaningful in n<3 dimensional space.
Comment: It might be simpler if you ask just about photons. A lot of people know the answer to that question. One could ask how many polarizations _gravitational waves_ have in other dimensions, and somewhat less people would know that, but probably still someone on this site could answer. But given that gravitons are not well-accepted to exist, adding that second question makes the answer a whole lot more complicated and significantly reduces the number of people who would be willing to answer. There might be solid answers in string theory or perturbative quantum gravity though.
Comment: ok, I'll be satisfied just by photons
Comment: I don't think photons exist at all in dimensions other than 3+1. In 2+1 even the distinction between bosons and fermions seems to be lost (and instead there are "anyons"). The meaning of symmetric and anti-symmetric products is completely different in n>3, yet again, so I don't even know how one would form something similar to classical electrodynamics in which formulas with differential operators like rotB could appear. The cross product doesn't even exist in any other than dimensions 3 and 7, I believe...
Answer: In the space (2+1) we introduce the tensor
\begin{equation}
    F^{\mu \nu}=\left(\begin{array}{ccc}
0 & -E^x / c & -E^y / c \\
E^x / c & 0 & -B \\
E^y / c & B & 0
\end{array}\right)
\end{equation}
As a consequence, the magnetic field is no longer a vector, but a scalar. Maxwell's equations are then written in the form
\begin{equation}
    \begin{aligned}
& \partial_\nu F^{\mu \nu}=\mu_0 j^\mu, \\
& \partial_\nu \tilde{F}^\nu=0,
\end{aligned}
\end{equation}
where $j^\mu$ is surface current. By differentiating the first equation we can obtain an analogue of the continuity equation
$$
\partial_\mu j^\mu=0,
$$
Maxwell's complete equations would look like:
\begin{equation}
    \begin{aligned}
& \boldsymbol{\nabla} \cdot \boldsymbol{E}=\frac{\sigma}{\epsilon_0} \\
& \boldsymbol{\nabla}_{\perp} \cdot \boldsymbol{E}=\frac{\partial B}{\partial t}, \\
& \boldsymbol{\nabla}_{\perp} B=\mu_0 \boldsymbol{j}+\frac{1}{c^2} \frac{\partial \boldsymbol{E}}{\partial t},
\end{aligned}
\end{equation}
Where
\begin{equation}
    \nabla_{\perp}=\left(\partial_y,-\partial_x\right)
\end{equation}
From this, in a similar way as for our space, wave equations are obtained
\begin{equation}
    \nabla^2 \boldsymbol{E}-\frac{1}{c^2} \partial_{t t}^2 \boldsymbol{E}=\frac{1}{\epsilon_0} \nabla \sigma+\mu_o \partial_t \boldsymbol{j},
\end{equation}
\begin{equation}
    \nabla^2 B-\frac{1}{c^2} \partial_{t t}^2 B=\mu_0 \nabla_{\perp} \cdot j
\end{equation}
If there are no charges, then the equations are independent of each other and you can get a whole set of photons with different phase shifts of the two waves. In space (1+1), the EM field tensor will look like:
\begin{equation}
F^{\mu \nu}=\left(\begin{array}{cc}
0 & -E \\
E & 0
\end{array}\right)
\end{equation}
and Maxwell's equations will be
\begin{equation}
    \frac{\partial E}{\partial x}=0
\end{equation}
The wave equation will be
\begin{equation}
    -\frac{\partial^2 E}{\partial t^2}+\frac{\partial^2 E}{\partial x^2}=0
\end{equation}
Given the constant field, photons will not exist in (1+1) space.


Resampling large dataset

Question: I have learned that resampling e.g. bootstrapping could give us better results for some problems. If we have a huge data set (millions of values) does it make sense to do some kind of resampling or these methods are only suitable when the data set is not that big?
Comment: Do you mean in your last sentence "or are these methods only suitable when the dataset is not that big?"
Comment: From *Elements of Statistical Learning* chapter on Model Assessment and Selection: "The methods in this chapter are designed for situations where there is insufficient data to split it into three parts." They go on to describe cross-validation and bootstrapping.  In my professional experience, data was plentiful and training/validation/test splits were used for model assessment, and I haven't seen anyone bring cross-val or bootstrapping results to weekly reports.
Answer: There is no reason why bootstrapping would be inappropriate with a large dataset, if inappropriate means deliver bad results because of the size.  However, depending on how large the dataset and how complex the calculations that need to be done, there might be cost or efficiency problems.
Comment: The correctness of this reply depends on the application.  For a concrete example (large dataset, expensive parameter to evaluate) see http://mathematica.stackexchange.com/questions/2889/randomvariate-with-a-discrete-distributions.  A solution was available there *solely* because the bootstrap samples could be efficiently calculated.
Comment: Yes, @whuber is right, there is at least one potential reason it might be inappropriate which is cost/efficiency.
Comment: Maybe philosophic question, but when we have a BIG dataset can bootstrapping give us anything more? Could you please mention some applications? We have a big collection of sensor data.
Comment: Yes, I haven't given you a particularly good answer I know.  Whether bootstrapping *adds* anything to traditional techniques does depend on a range of issues of which sample size might be one but more important are underlying distribution, adequacy of your model, how well your data answer your research questions, etc.
Answer: Since you have a huge dataset, you have the ability to validate many ideas on totally clean data.
Keep a large portion at the side and go and try many ideas.
You have a great "sit belt" that will prevent you from huge mistakes without having to worry about the dependencies of cross validation, overuse of specific samples and so.
You are risking time, not performance.
As for the specific question of bootstrapping.
Bootstrapping is usually used in order to reduce the variance of the model.
You have a large dataset so the variance of the DATA should be low.
However, it is possible that you use a classifier that its variance will be high so bootstrapping will help you.
neural nets, classication and regression trees, and subset selection in linear regression are considered unstable (here , as self reference of Leo Breiman in  Bagging Predictors)
Also, in many cases the dimensionality of the data is extremely high and your dataset doesn't cover it well enough.
When your dataset is imbalanced many classifiers might give you a prediction that is quite similar to the majority rule. Using bootstrapping might help but in such cases I would recommend using technique like boosting that deliberately forces the learner to focus at areas of interest.
Another benefit of bootstrapping is getting a confidence level for the prediction.
However, since most classifier provide confidence this is usually not the reason to use bootstrapping.

Resampling large dataset


What is friendship affinity?

Question: The Summoner class has one or two skills about increasing friendship affinity, and I've also seen one or two messages about affinity increases after summoning a Friend. What is are the benefit and effects of affinity, and what actions will increase it?
Answer: If you look at this site, you can read that Ogogin and Matoda seem to have the answers for you.
It seems that

Standing to the ingame tutorial, friendship only increase the strength of the attack executed. You can't summon a friend twice without street/spotpassing him again, unfortunately (it would have been great, but nothing).

And

they'll only ever go past 9999 strength if the original sent attack was using Bravely Second in the first place"
Comment: That explains why I've got a friend with a listed damage of 17k - they must have used Bravely Second to get an extra attack in.

What is friendship affinity?


Hosting and accessing web pages on ubuntu virtual server

Question: I am just a beginner. I have installed an Ubuntu virtual server 14.03 on a widows 8.1 host.I have lamp server ,phpmyadmin installed and working fine. I can access files on both the host and guest machine through putty and winsp. I just want to know for a start how host web pages from the host and access them from the browser. Please help.
Answer: Go to browser and type http://localhost/, it's a default virtual host and files located in /var/www/html directory. For creating simple virtual host like example-com, follow these steps:

Open /etc/hosts and add to the end 127.0.0.1 example-com.
Create directory /var/www/example-com: sudo mkdir /var/www/example-com.
Copy index.html and other files from /var/www/html to /var/www/example-com.
Create example-com.conf in /etc/apache2/sites-available and add this code:

<VirtualHost *:80>
    ServerName example-com
    ServerAlias example-com

    DocumentRoot /var/www/example-com

    <Directory /var/www/example-com>
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

Enable virtual host: sudo a2ensite example-com.conf.
Reload Apache: sudo service apache2 reload.
Go to browser and type http://example-com/.
Comment: I thank you very much for your detailed and timely explanation


Pocohud and Hoxhud Compatibility

Question: I currently have HoxHud, and find it very useful, but I recently I have seen some players reporting useful messages in the chat such as health replenishment and warnings of 3 downs. I would like to get Pocohud for that feature of reporting things into the chat but prefer the HoxHud GUI and features such as not having to hold down F to interact with pagers or lock picking. I was wondering if their was a way to install both mods, but keep the HoxHud GUI and core features, and also have the Pocohud chat feature. Also I should mention that I do not currently have Pocohud installed, only HoxHud.
Comment: I've heard of people that run both, but I think it requires a bit of hacking in order to enable both at the same time, since they both write the same file for loading their individual scripts.
Comment: Could you link me to a guide on how to do the 'little bit of hacking' please?
Comment: Please avoid using HoxHud, it crashes often and the anticheat deletes your bags every time a new heist is released.
Comment: This post is old, I only use PocoHud now.
Answer: They should work fine installed alongside each other. PocoHud won't disable HoxHud's features. Since you already have HoxHud, just download PocoHud, and follow the instructions in installation.txt to install it. From installation.txt: "You should see a folder named 'poco' inside the 'PAYDAY 2' game folder. If you intend to use HoxHud simultaneously, always keep HH's DLLs."
To configure PocoHud, press backspace in-game. Go to PocoHud Options » Chat to configure PocoHud's chat options. The rest of PocoHud's features can be disabled in its options.

Pocohud and Hoxhud Compatibility