Ubuntu SSLH Service Not Starting on Boot

Question: I am trying to run SSH and HTTPS both on Port 443 on an Ubuntu server. I found SSLH which seems to do the trick. My only problem is getting it to start on system boot. Supposedly, it is already setup to do. An "sudo update-rc.d sslh defaults" says it is already setup. However, rebooting results in it not starting until I start it manually with a good ol' "sudo /etc/init.d/sslh start" command. I have tried using update-rc.d to remove it and add it again. This did not work either. I was not able to find anything in the logs, but that being said, I am not exactly sure which log file would hold this kind of information. Any help would be greatly appreciated.
Answer: Did you check for symlinks in the /etc/rc?.d/ directories? Possibly this initscript "defaults" are broken, try:
<code>updates-rc.d sslh start 23
</code>
..for instance to tell it to start in runlevels 2 and 3 (which I assume is what you're booting into). After running that looks in /etc/rc2.d/ and /etc/rc3.d/ for an actual symlink. (I'm a Red Hat guy, guessing at Ubuntu being similar) If you don't see symlinks then you have to make them by hand. If you do see symlinks then it's broken at startup, you'll need to open /etc/init.d/sslh and add some logging redirects from the startup commands to see why they're failing.
Comment: The symlinks to /etc/init.d/sslh exist in runlevels 2, 3, 4, and 5. As far as adding logging redirects, how would I go about that?? I see a line that has "LOGFILE=$LOGDIR/$NAME.log" which I replaced temporarily with "LOGFILE=/var/log/sslh.log" without success. Running /etc/init.d/sslh did not create that log file. I forced it to error as well without any log file being created.
Answer: It turns out the vm I was working on was still on Karmic. I had updated packages which I thought would take care of any bugs related to init.d since they have all been listed as fixed. I did a release upgrade to Lucid and the problem went away.


2009 Civic Overheating

Question: I just bought an 09 Honda Civic with fairly low mileage. Within 3 days it started to overheat so, my boyfriend replaced the thermostat and all of the cooling lines as they were dry rotted (like I said fairly low milage on this car). The car gave me no issues for a week after all of this was done. Well, as of last night it started overheating again. Any ideas as to why would be greatly appreciated.
Comment: Do you have any history of the car services? Specifically, is the water pump ever replaced? Are there any coolant leaks visible? What is the condition of the radiator cap? Is anything blocking the air to flow into the radiator?
Comment: I have no visible leaks, that was the first thing I checked last night when it started to overheat. The radiator cap appears to be in good condition and the service records I do have on hand don't mention anything about the water pump ever being replaced. The radiator has clear airflow. My drive to work this morning the temperature gauge fluctuated between normal operating temperature and low, as it was cool with low humidity. It is now very warm and humid out, so I am dreading the drive home. I have a feeling there is going to be an overheating issue again
Comment: I have got myself home before now by putting the heater on hot and the blower full - with the windows open... can just make enough difference between a blown head gasket and not...
Comment: I see, how you tell that the car is overheating? Usually, it has power loss and the coolant may start to overflow, the radiator fan will work overtime. From your last comment I started to suspect that the gauge is not to be trusted.
Comment: @SolarMike Head gasket is a possibility, but the car has low mileage and it sounds a bit unlikely.
Comment: So on the drive home in the heat and humidity there was no overheating issues. I'm starting to suspect that my temperature sensor may be bad.
Answer: According to the comments above it seems that the water temperature system is the one to blame for this issue.
You could use some electrical contact cleaner on the terminals of the water temp sensor, because the problem might be just moisture getting into the connection. If that fails try to test the sensor with the following...
In theory you could test the sensor with a voltmeter but you have to find the specs for it. Usually they are 2 tests you do, hot and cold, in a form of e.g. : 25° = 0.5 volts and 80° = 1.5 volts
If you end up replacing the sensor, be aware that replacing the temp sender unit it will require you to drain the coolant and either put it back in or replace it.

2009 Civic Overheating


Print jobs cancelled if waiting too long?

Question: I tend to send things to print, even when not connected to my printer (via usb). This allows it to print the minute I connect the printer, which is nice when I am on my laptop. It used to work, even if I didn't connect my printer for a day or two, but now it doesn't. The print jobs seem to die after 3 hours. Any help?
Answer: Printing in OS X is handled by CUPS, the Common Unix Printing System. Older versions of OS X had older versions of CUPS. A new It's not a bug, It's a "feature" was added in CUPS 1.6, which corresponds to Mac OS X 10.8 Mountain Lion, in order to prevent stuck jobs.
The MaxJobTime option, which defaults to 10800 seconds (3 Hours), will cancel the active print job on a printer that has timed out. The next job in the queue will start, either printing or eventually timing out.
From the cups.conf man page:

MaxJobTime seconds
  Specifies  the  maximum time a job may take to print before it is canceled. The default is 10800 seconds (3 hours). Set to 0 to disable cancellation of "stuck" jobs.

Editing /etc/cups/cupsd.conf to include MaxJobTime 0 to disable this "Feature".
In my specific case, I used to be on 10.6.8 Snow Leopard until finally updating to 10.10 Mavericks, and wasn't aware of the change.
Comment: @user3439894 is there a reason you keep editing that out?


Clip raster tool with polygon will not clip raster

Question: I am trying clip a raster with a polygon (500 meter buffers around point data). The reason why I want the clip is because I want to analyze the information in the clips using the zonal statistics tool. When I run the clip raster tool it appears to be working (no error messages) but the output is not clipped - it is just the same old raster that I am starting with?
Comment: If the output is on the right, that looks clipped to me. Although it's hard to tell at such a far out zoom. You also don't need to do a separate clip to make Zonal Statistics work. Just include your buffered points layer as the Zone Layer.
Comment: Thank you - the clip on the right are just the buffered zones not clipped raster. I just edited it so you can see what I am trying to clip instead. I have many polygons that are clipping the raster.  I tried using zonal statistics without clipping but I want the majority land use in EACH clipped zone and the output with zonal statistics seem to be TOTAL values and areas - but I need the raster info for each clipped zone...
Answer: @ycartwhelen is correct, you do not have to clip the raster to zonal statistics. What I was doing wrong is I should have used Zonal Statistics as Table not just zonal statistics.


Is there a way to change the background color of the Solution Explorer in Visual Studio 2012?

Question: In Visual Studio 2010 I can use SendMessage to change the background color of the Solution Explorer just like in this question. Since Visual Studio 2012 uses WPF this method is no longer working for me. I can do this with other windows such as Class View, Data Sources, and Server Explorer but the Solution Explorer doesn't show up in Spy++.
I've looked through the SDK but haven't found anything that will allow me to change the style of this window. Using DTE2 I'm able to get a reference to the Solution Explorer but this looks to be for the hierarchy items only and not the actual tree view control or window pane.
I came across an example showing how to change the text editor colors using the IWpfTextViewCreationListener interface but as the name suggests it only works with the text editor. Is there a way to do the same thing but for other windows such as the Solution Explorer?
Answer: Check out this question: How do you change the background colour for Solution Explorer in Visual Studio 2012?

Use this Utility
http://bchavez.bitarmory.com/archive/2012/08/27/modify-visual-studio-2012-dark-and-light-themes.aspx
Use Category TreeView
Answer: Color theme editor came out
http://visualstudiogallery.msdn.microsoft.com/366ad100-0003-4c9a-81a8-337d4e7ace05


Why are iterations over maps random?

Question: From the Golang source code, they seem to follow a pretty standard implementation of hash tables (ie array of buckets). Based on this it seems that iteration should be deterministic for an unchanged map (ie iterate the array in order, then iterate within the buckets in order). Why do they make the iteration random?
Answer: TL;DR; They intentionally made it random starting with Go 1 to make developers not rely on it (to not rely on a specific iteration order which order may change from release-to-relase, from platform-to-platform, or may even change during a single runtime of an app when map internals change due to accommodating more elements).
The Go Blog: Go maps in action: Iteration order:

When iterating over a map with a range loop, the iteration order is not specified and is not guaranteed to be the same from one iteration to the next. Since the release of Go 1.0, the runtime has randomized map iteration order. Programmers had begun to rely on the stable iteration order of early versions of Go, which varied between implementations, leading to portability bugs. If you require a stable iteration order you must maintain a separate data structure that specifies that order.

Also Go 1 Release Notes: Iterating in maps:

The old language specification did not define the order of iteration for maps, and in practice it differed across hardware platforms. This caused tests that iterated over maps to be fragile and non-portable, with the unpleasant property that a test might always pass on one machine but break on another.
In Go 1, the order in which elements are visited when iterating over a map using a for range statement is defined to be unpredictable, even if the same loop is run multiple times with the same map. Code should not assume that the elements are visited in any particular order.
This change means that code that depends on iteration order is very likely to break early and be fixed long before it becomes a problem. Just as important, it allows the map implementation to ensure better map balancing even when programs are using range loops to select an element from a map.

Notable exceptions
Please note that the "random" order applies when ranging over the map using for range.
For reproducible outputs (for easy testing and other conveniences it brings) the standard lib sorts map keys in numerous places:
1. encoding/json
The json package marshals maps using sorted keys. Quoting from json.Marshal():

Map values encode as JSON objects. The map's key type must either be a string, an integer type, or implement encoding.TextMarshaler. The map keys are sorted and used as JSON object keys by applying the following rules, subject to the UTF-8 coercion described for string values above:

keys of any string type are used directly
encoding.TextMarshalers are marshaled
integer keys are converted to strings

2. fmt package
Starting with Go 1.12 the fmt package prints maps using sorted keys. Quoting from the release notes:

Maps are now printed in key-sorted order to ease testing. The ordering rules are:

When applicable, nil compares low
ints, floats, and strings order by <
NaN compares less than non-NaN floats
bool compares false before true
Complex compares real, then imaginary
Pointers compare by machine address
Channel values compare by machine address
Structs compare each field in turn
Arrays compare each element in turn
Interface values compare first by reflect.Type describing the concrete > - type and then by concrete value as described in the previous rules.

3. Go templates
The {{range}} action of text/template and html/template packages also visit elements in sorted keys order. Quoting from package doc of text/template:

{{range pipeline}} T1 {{end}}
  The value of the pipeline must be an array, slice, map, or channel.
  If the value of the pipeline has length zero, nothing is output;
  otherwise, dot is set to the successive elements of the array,
  slice, or map and T1 is executed. If the value is a map and the
  keys are of basic type with a defined order, the elements will be
  visited in sorted key order.

Comment: @Dippo They made it random on purpose so developers won't write code that relies on a specific order. E.g. if you add three keys to a map and iteration order _happens_ to be `1`, `2`, `3`, you could write a test that _expects_ this order, and this test may always succeed. Then with the next Go release it _could_ fail with no apparent reason (if a new or changed map implementation would iterate in a different order)...
Comment: ...To prevent such cases, the iteration order is always random, so you won't end up with a test that relies on the order and seemingly always succeeds _now_ and would fail _later_ or another platform.
Comment: But what i don't understand is why they make it random on purpose. If i do iterate first and then add to the map, then continue the iterate, it is already random.
Comment: Maps use hashes for fast key lookups. `go` adds an initial "salt" to the hash - so incurs no performance
 penalty - but creates the illusion of randomness during multiple runs against the same dataset.
Answer: This is important for security, among other things.
There are lots of resources talking about this online -- see this post for example

Why are iterations over maps random?


Intercept in 2nd-stage Error Correction Model (ECM) regression — yes or no?

Question: When doing a two-step ECM regression, do we add an intercept in the 2nd stage regression? I've seen course notes that add an intercept in the ECM, but some do not, so I'm confused if I should include it or not.
Answer: It is true that for the theoretical derivation of the ECM, the intercept is zero. However, when estimating it, one normally does include an intercept.
In general: leaving out the intercept is almost never a good idea. See also this question
First, if the true intercept is zero, then the estimated coefficient should be close to zero, so whether or not one includes an intercept should not change the estimates too much. If your estimate of the intercept is too large (in magnitude) this may point to the fact that your model is wrong.
The inclusion of an intercept, however is important for various test statistics, like the $R^2$ which is, in general, not valid if the intercept is dropped from the specification. Also, as said by @1muflon1 if you run a regression without an intercept, the mean residual will usually be different from zero, which is highly undesirable.
Answer: That depends on the details of your particular case. In some cases no intercept can be appropriate in most it would be a mistake.
Excluding intercept forces the regression to pass through the origin, that might be appropriate if you are testing some theoretical model which tells you that the mean of the series should be zero, otherwise if you force regression to pass through the origin your errors will not be centered at zero.


Sessions and Cookies Security

Question: So the sessions are getting stored server-side, which means the client can't edit them.
On the client side the cookie gets stored and save an id to find the right session.
Now my question is. Can a random user edit his own cookie, and then enter Eg. an admin's session?
Comment: Absolutely. Even with the stock tools bundled with most modern browsers.
Comment: … but they would have to guess (or otherwise obtain) the correct session id before.
Comment: Do you know how long a session Id is?
Comment: I guess it's not clear who's cookie "edit his cookie" refers to.
Answer: In most scenarios, the data in the session is itself secure against user tampering as it is only manipulated on the server (this assumes the server itself is secure).  So there is no reason to treat the data stored in session as "dirty" as far as needing to cleanse/validate it.
The session itself is not inherently secure whether it is being propagated via cookies or via URL parameter.  It can be impersonated via a session hijacking attack. There are a number of common techniques to prevent against this, including:

using only secure cookies transmitted over SSL
using sufficiently long session ID's (most default implementation uses in modern langugaes do this by default). This makes it harder to "guess" at a valid session id value and minimize collision of session ID's.
regenerating session ID's after application login
checking against secondary data (IP address, browser user agent, etc.) to see if there are changes during a session which may indicate a hijacking attempt. Probably best to use a combination of factors here (like a change in both IP address and user agent since with mobile devices IP addresses can and do change).
active session id rotation (i.e rotate session id on each page load)
Answer: Yes, a malicious user could modify their session id (in their local cookie) and impersonate another user to hijack their session.  This is unsurprisingly called Session Hijacking.
But it is extremely unlikely an attacker could guess the correct session id.  They would need to employ techniques to steal the session id from their victim.
An example of the default PHP session id cookie:
Answer: Some general rules:

You no longer have control on any piece of data that leaves your server.
You can edit any piece of data that enters your computer as long as your user has permission to access the resource.
You can often read any piece of data that travels through your local network. If it isn't encrypted, you can even make sense of it.

As a result:

Cookies must be considered user input.
Users can always edit their own cookies.
A hacker can easily steal your cookies in an open wifi network if site doesn't use HTTPS.

There're two main dangers regarding cookies:

Unaware developers that store admin=1 and actually use the value to validate as admin
Session fixation (stolen cookies)
Comment: So it would be possible for a hacker to edit his own cookie (Change the session id), and then enter an admin's session?

Sessions and Cookies Security


How to detect whether a CA used EV for a certificate using openssl

Question: I want to download the certificate of a particular hostname and detect whether the CA used EV (extended validation) when issuing it. So far I was not able to find anything that identifies certificates as being EV. Is there any way to achieve this? Ideally using OpenSSL?
Answer: Note that EV certs are not structurally different — they are just a cert issued under a different policy. So you have to check the policy. (See EV certs on Wikipedia)
You will need to do a fairly extensive table lookup; it isn't native to openssl I'm afraid.
This is probably a duplicate of How to check if a X509 certificate has "Extended Validation" switched on?
In response to some comments below:
This attribute is in the "X509v3 extensions" field. x509v3_config(5) notes

Certificate Policies.
This is a raw extension. All the fields of this extension can be set by using the appropriate syntax.
If you follow the PKIX recommendations and just using one OID then you just include the value of that OID. Multiple OIDs can be set separated by commas, for example:
certificatePolicies= 126.96.36.199, 220.127.116.11

That's how they get into the cert.  Here is what it looks like in the cert: for example, if you examine the GlobalSign certificate protecting https://www.globalsign.com/en/ :
echo | openssl s_client -connect www.globalsign.com:443 2>&1 | openssl x509 -noout -ext certificatePolicies

This will show something like:
X509v3 Certificate Policies:
    Policy: 188.8.131.52.4.1.4146.1.1
      CPS: https://www.globalsign.com/repository/

That policy OID corresponds to the EV OID for GlobalSign.
Then, if you visit http://oid-info.com/get/184.108.40.206.4.1.4146.1.1, it's described as

{iso(1) identified-organization(3) dod(6) internet(1) private(4) enterprise(1) 4146 certificate-policies(1) extended-Validation-SSL(1)}
Comment: Alright. Thanks for that answer. However I tried that for example with the GlobalSign certificate (https://www.globalsign.com/) and their policy identifier does not show up on the wiki site. Maybe it is sufficient to grab the OIDs from the chromium source code (https://chromium.googlesource.com/chromium/src/net/+/master/cert/ev_root_ca_metadata.cc).
Comment: An OID is a unique publicly-registered ID, therefore the OID database is public, for example, here's a site that will look up an OID for you: http://www.oid-info.com/
Comment: Also is the field for the OID standardised or is it just somewhere in the certificate?
Comment: Excellent answer. With current openssl version (>= 1.1.1) instead of running `openssl x509 -noout -text -in xxx.pem` and manually searching through the output, you can run `openssl x509 -noout -ext certificatePolicies -in xxx.pem` to show only the certificate policies.
Answer: According to the Extended Validation certificate identification from Wikipedia:

EV certificates are standard X.509 digital certificates. The primary way to identify an EV certificate is by referencing the Certificate Policies extension field.
Each issuer uses a different object identifier (OID) in this field to identify their EV certificates, and each OID is documented in the issuer's Certification Practice Statement.

$ openssl s_client -connect www.globalsign.com:443 2>1 | \
> openssl x509 -noout -ext certificatePolicies
X509v3 Certificate Policies:
    Policy: 220.127.116.11.4.1.4146.1.1
      CPS: https://www.globalsign.com/repository/
    Policy: 18.104.22.168.1
^C (interrupt)

In this example, the CP extension contains three qualifiers.

The Policy value of 18.104.22.168.4.1.4146.1.1, a GlobalSign legacy CP (OID), and the Policy value of 184.108.40.206.1, a CA/Browser Forum OID, both indicate that the certificate complies with an EV policy.

The CPS qualifier gives a pointer to the URI where the particular applicable CPS for the policy may be found.

Here is an another example about DigiCert:
$ openssl s_client -connect www.digicert.com:443 2>1 | \
> openssl x509 -noout -ext certificatePolicies
X509v3 Certificate Policies:
    Policy: 2.16.840.1.114412.2.1
    Policy: 126.96.36.199.1
      CPS: http://www.digicert.com/CPS
^C (interrupt)

References:

[1]: https://en.wikipedia.org/wiki/Extended_Validation_Certificate
[2]: https://cabforum.org/object-registry/
[3]: https://www.globalsign.com/en/repository/GlobalSign_CP_v6.6_final.pdf
[4]]: https://www.digicert.com/content/dam/digicert/pdfs/legal/DigiCert-CPS-V.5.6.pdf


A graph in descriptive complexity - is $x$ already a vertex?

Question: So suppose that there is an undirected graph with edge connections known. Now in first-order logic there is quantifier $\forall x$. Then does this automatically refer to vertexes, or can we use relation like $v(x)$ to say that $x$ is a vertex?
Comment: How is universe defined? Is it dependent on the graph input given? So like if a graph is 5-vertex graph, then there is only 5 elements in universe?
Comment: Or are we allowed to form any structure out of a graph then form a language/universe?
Comment: Strictly speaking, no, though the universe (vertices, in your case) is often clear from context and might be omitted.
Comment: What are you doing or trying to express?
Comment: Yes, when describing graph properties, the universe consists of all vertices, and there's an edge predicate.
Comment: why can't we pre-add connectivity predicate then? Why is edge predicate only allowed as a base predicate and we have to build connectivity predicate using operators?
Answer: (First-order logic) formulae are independent of structures; you just have variables, predicates and possibly functions (in addition to the syntactical symbols). To decide whether a formula $\varphi$ is true in a given structure $S$ (consisting of a universe of individuals $U$ and an interpretation of predicates $I$), i.e. whether $S$ is a model of $\varphi$, you apply the semantic rules of first order logic.
Concerning your specific question: if you have $\varphi = \forall x: F$ where $F$ is some formula, then $x$ denotes exactly all vertices iff you defined your structure $S = (U,I)$ such that $U$ contains exactly all vertices. Note that if you do that and want access to the edges, then you'll need to define some predicate $e(x,y)$ such that $e(x,y) \Leftrightarrow \text{there is an edge between } x \text{ and } y$.
More generally: the quantifiers do not differentiate between elements of your universe, the predicates will have to do that. If you want to check $F$ only for all vertices but your universe contains elements that are not vertices, then you do what you suggested: introduce a predicate $v(x)$ and use $\varphi' = \forall x: (v(x) \rightarrow F)$
Comment: If you're interested in slides, [this set](http://web.stanford.edu/class/archive/cs/cs103/cs103.1132/lectures/10/Slides10.pdf) seems to do a good job of explaining first-order logic.
Answer: Let me quote from Immerman's survey on descriptive complexity: In Descriptive Complexity we view the input as a finite logical structure. A graph is a logical structure whose universe is the set of vertices and $E_G$ is the binary edge relation.
So when describing graph properties, qualifiers quantify over all vertices, and edges are encoded by a binary relation. This is the convention in descriptive complexity. If you follow some other convention then you might get different behavior.
Answer: Typically, when referring to vertices in a graph, one does by the following.  Let $G=(V,E)$ be a graph such that $V$ is the set of vertices and $E$ is the set of edges.  Then you would proceed $\forall x \in V$ etcetera.
Comment: I'd add - $E \subset V \times V$


How to get current time in milliseconds in PHP?

Question: time() is in seconds - is there one in milliseconds?
Answer: The short answer is:
$milliseconds = floor(microtime(true) * 1000);

Comment: @FredrikWendt, I think you are confusing with `time()`. `microtime(true)` on the other hand returns the current time in seconds since the Unix epoch accurate to the nearest microsecond (see PHP reference). It's actually very easy to test if you run the above code in a loop and display the milliseconds.
Comment: @JordanLev, it should be multiplication because microtime(true) returns the Unix timestamp in *seconds* as a float.
Comment: Shouldn't that be `microtime(true) / 1000` (division instead of mulitplication)?
Comment: You should take only first 13 digits, otherwise you might get a floating number in ~90%: substr(microtime(true) * 1000, 0, 13);
Comment: Faster and probably precise enough for most people is (int)(microtime(true)*1000)
Comment: Not only is `(int)(microtime(true)*1000)` faster, it's also more correct; with `round` you can end up 0.5ms in the future, with a nasty effect of -1ms time difference somewhere ;-)
Comment: @user25163 You are not absolutely right. If you expect timestamp before "Mon, 31 Oct 1966 14:13:21 GMT" and after "Sat, 20 Nov 2286 17:46:39 GMT" it will be more than 13 digits
Comment: I do not like the response from this.It's:
1.51196274127E+12
Comment: I really like this solution. Also suitable for microbenchmarking in case it does not have to be too accurate. Helped me a lot finding the bottleneck in my software.
Comment: I don't think you need to round, as `microtime(true)` only returns 4 decimals (PHP v 7.1.16)?
Comment: I have changed to floor() which indeed prevents the date from being in the future.
Answer: Use microtime. This function returns a string separated by a space. The first part is the fractional part of seconds, the second part is the integral part. Pass in true to get as a number:
var_dump(microtime());       // string(21) "0.89115400 1283846202"
var_dump(microtime(true));   // float(1283846202.89)

Beware of precision loss if you use microtime(true).
There is also gettimeofday that returns the microseconds part as an integer.
var_dump(gettimeofday());
/*
array(4) {
  ["sec"]=>
  int(1283846202)
  ["usec"]=>
  int(891199)
  ["minuteswest"]=>
  int(-60)
  ["dsttime"]=>
  int(1)
}
*/

Comment: So generally speaking `microtime()` equals `1000*time()`,right?
Comment: I see,there can be errors,but the error should be less than `1000`,right?
Comment: @COMer: Which variant you are talking about?
Comment: `microtime(true)` and `1000*time()`
Comment: @COMer: `1000*time()` won't give you milliseconds. `microtime(true)` returns a `float` which has 14 digits of precision. The seconds part already took 10, so that left 4 digits for the microseconds part. This should be enough since milliseconds only require 3 extra digits.
Comment: according to php documentation the `get_as_float` parameter was not available prior to version 5.0.0
Comment: I'm very impressed that you ran all 3 within a microsecond! What server specs are those? :D
Comment: When running `var_dump(microtime(true));`, my php (7.1.16) returns 4 decimals: `float(1523522152.2452)`. Possibly the last two digits were 0 in your case and therefore not shown?
Comment: @COMer: Based on other answers in this page, microtime(true) returns the timestamp since the Unix epoch in _seconds_. That said, I don't think this statement is wholly accurate though, since microtime(true) return value can have decimal digits, so it's not exactly integer seconds since the Unix epoch.
Answer: Short answer:
64 bits platforms only!
function milliseconds() {
    $mt = explode(' ', microtime());
    return intval( $mt[1] * 1E3 ) + intval( round( $mt[0] * 1E3 ) );
}

[ If you are running 64 bits PHP then the constant PHP_INT_SIZE equals to 8 ]

Long answer:
If you want an equilvalent function of time() in milliseconds first you have to consider that as time() returns the number of seconds elapsed since the "epoch time" (01/01/1970), the number of milliseconds since the "epoch time" is a big number and doesn't fit into a 32 bits integer.
The size of an integer in PHP can be 32 or 64 bits depending on platform.
From http://php.net/manual/en/language.types.integer.php

The size of an integer is platform-dependent, although a maximum value of about two billion is the usual value (that's 32 bits signed). 64-bit platforms usually have a maximum value of about 9E18, except for Windows, which is always 32 bit. PHP does not support unsigned integers. Integer size can be determined using the constant PHP_INT_SIZE, and maximum value using the constant PHP_INT_MAX since PHP 4.4.0 and PHP 5.0.5.

If you have 64 bits integers then you may use the following function:
function milliseconds() {
    $mt = explode(' ', microtime());
    return intval( $mt[1] * 1E3 ) + intval( round( $mt[0] * 1E3 ) );
}

microtime() returns the number of seconds since the "epoch time" with precision up to microseconds with two numbers separated by space, like...
0.90441300 1409263371

The second number is the seconds (integer) while the first one is the decimal part.
The above function milliseconds() takes the integer part multiplied by 1000
1409263371000

then adds the decimal part multiplied by 1000 and rounded to 0 decimals
1409263371904

Note that both $mt[1] and the result of round are casted to int via intval(). This is necessary because they are floats and the operation on them without casting would result in the function returning a float with a loss in precision.
Finally, that function is slightly more precise than
round(microtime(true)*1000);

that with a ratio of 1:10 (approx.) returns 1 more millisecond than the correct result.
This is due to the limited precision of the float type (microtime(true) returns a float).
Anyway if you still prefer the shorter round(microtime(true)*1000); I would suggest casting to int the result.

Even if it's beyond the scope of the question it's worth mentioning that if your platform supports 64 bits integers then you can also get the current time in microseconds without incurring in overflow.
If fact 2^63 - 1 (biggest signed integer) divided by 10^6 * 3600 * 24 * 365 (approximately the microseconds in one year) gives 292471.
That's the same value you get with
echo intdiv( PHP_INT_MAX, 1E6 * 3600 * 24 * 365 );

In other words, a signed 64 bits integer have room to store a timespan of over 200,000 years measured in microseconds.
You may have then
function microseconds() {
    $mt = explode(' ', microtime());
    return intval( $mt[1] * 1E6 ) + intval( round( $mt[0] * 1E6 ) );
}

Comment: Now there is a parameter for microtime function, if it is set to true, it's return the seconds and milliseconds since 1st of january in 1970, 0 hour 0 minutes 0 seconds as float. Here is an example: microtime(true) // 1553260455.7242
Comment: why not just:
`
function getMilliEpoch(){
    $mt = explode(' ', microtime());
    return $mt[1] . substr($mt[0], 0, 5) * 1000;
}`
Comment: @kukko yes, but due to **limited precision** of the float type, calculating the number of millicesonds from microtime(true) will result in a **slightly inaccurate value**
Answer: As other have stated, you can use microtime() to get millisecond precision on timestamps.
From your comments, you seem to want it as a high-precision UNIX Timestamp. Something like DateTime.Now.Ticks in the .NET world.
You may use the following function to do so:
function millitime() {
  $microtime = microtime();
  $comps = explode(' ', $microtime);

  // Note: Using a string here to prevent loss of precision
  // in case of "overflow" (PHP converts it to a double)
  return sprintf('%d%03d', $comps[1], $comps[0] * 1000);
}

Comment: Is not it return the server time?
In my case I see the stored time in db is my local browser time.
Suppose, my sever timezone is EST+3 and my browser time is GMT+6, While I submit a form from GMT+6 location, I see the stored time is GMT+6 time equivalent millisecond. So, What is the problem? :(
Answer: Shortest version of string variant (32-bit compatibile):
$milliseconds = date_create()->format('Uv');

Comment: This one-liner should have more votes.
Comment: Yes, very true. Seems not only easier to read but also safer in terms of mixing up whether to divide or multiply by 1,000
Answer: echo date('Y-m-d H:i:s.') . gettimeofday()['usec'];
output:
2016-11-19 15:12:34.346351
Comment: microseconds should be zero padded: `$timeofday=gettimeofday(); echo sprintf("%s.%06d", date('Y-m-d H:i:s', $timeofday['sec']), $timeofday['usec']);`
Comment: This uses the same timestamp: `$t = gettimeofday(); echo date('Y-m-d H:i:s.',$t['sec']) . $t['usec'];`
Answer: Use microtime(true) in PHP 5, or the following modification in PHP 4:
array_sum(explode(' ', microtime()));

A portable way to write that code would be:
function getMicrotime()
{
    if (version_compare(PHP_VERSION, '5.0.0', '<'))
    {
        return array_sum(explode(' ', microtime()));
    }

    return microtime(true);
}

Answer: This works even if you are on 32-bit PHP:
list($msec, $sec) = explode(' ', microtime());

$time_milli = $sec.substr($msec, 2, 3); // '1491536422147'
$time_micro = $sec.substr($msec, 2, 6); // '1491536422147300'

Note this doesn't give you integers, but strings. However this works fine in many cases, for example when building URLs for REST requests.

If you need integers, 64-bit PHP is mandatory.
Then you can reuse the above code and cast to (int):
list($msec, $sec) = explode(' ', microtime());

// these parentheses are mandatory otherwise the precedence is wrong!
//                  ↓                        ↓
$time_milli = (int) ($sec.substr($msec, 2, 3)); // 1491536422147
$time_micro = (int) ($sec.substr($msec, 2, 6)); // 1491536422147300

Or you can use the good ol' one-liners:
$time_milli = (int) round(microtime(true) * 1000);    // 1491536422147
$time_micro = (int) round(microtime(true) * 1000000); // 1491536422147300

Answer: PHP 5.2.2 <
$d = new DateTime();
echo $d->format("Y-m-d H:i:s.u"); // u : Microseconds

PHP 7.0.0 < 7.1
$d = new DateTime();
echo $d->format("Y-m-d H:i:s.v"); // v : Milliseconds

Comment: In php <7.1 new DateTime() microseconds are always 0 see https://www.php.net/manual/en/migration71.incompatible.php.
Answer: try this:
public function getTimeToMicroseconds() {
    $t = microtime(true);
    $micro = sprintf("%06d", ($t - floor($t)) * 1000000);
    $d = new DateTime(date('Y-m-d H:i:s.' . $micro, $t));

    return $d->format("Y-m-d H:i:s.u");
}

Answer: $timeparts = explode(" ",microtime());
$currenttime = bcadd(($timeparts[0]*1000),bcmul($timeparts[1],1000));
echo $currenttime;

NOTE: PHP5 is required for this function due to the improvements with
  microtime() and the bc math module is also required (as we're dealing
  with large numbers, you can check if you have the module in phpinfo).

Hope this help you.
Answer: $the_date_time = new DateTime($date_string);
$the_date_time_in_ms = ($the_date_time->format('U') * 1000) +
    ($the_date_time->format('u') / 1000);

Comment: While this code snippet may solve the question, [including an explanation](//meta.stackexchange.com/questions/114762/explaining-entirely-code-based-answers) really helps to improve the quality of your post. Remember that you are answering the question for readers in the future, and those people might not know the reasons for your code suggestion. Please also try not to crowd your code with explanatory comments, this reduces the readability of both the code and the explanations!
Comment: Is that actually like padding three zeroes to the right?
Comment: Not at all. It convert both part to milliseconds and give the sum. So it is more accurate than add zeros.
Answer: This is my implementation, should work on 32bit as well.
function mstime(){
    $mstime = explode(' ',microtime());
    return $mstime[1].''.(int)($mstime[0]*1000);
}

Answer: If you want to see real microseconds, you will need to change the precision setting in php.ini to 16.
After that, microsecond(true) gave me the output of 1631882476.298437.
So I thought that I need to divide the remainder (298437) with 1000, but in fact, the remainder is 0.298437 of a second. So I need to multiply that by 1000 to get the correct result.
    function get_milliseconds()
    {
        $timestamp = microtime(true);
        return (int)(($timestamp - (int)$timestamp) * 1000);
    }

Answer: I personaly use this:
public static function formatMicrotimestamp(DateTimeInterface $dateTime): int
{
    return (int) substr($dateTime->format('Uu'), 0, 13);
}

Comment: why not just `$dateTime->format('Uv')` ?
Answer: When getting milliseconds we expect to see 3 digits:
$milliseconds = round(microtime(true) * 1000) % 1000; // e.g. 435

which is essentially an analogue of the implementation in JavaScript:
var milliseconds = (new Date()).getMilliseconds(); // e.g. 435

Answer: Use this:
function get_millis(){
  list($usec, $sec) = explode(' ', microtime());
  return (int) ((int) $sec * 1000 + ((float) $usec * 1000));
}
Bye


How to fit the application for both config like portrait,landscape in android?

Question: I have done my application in portrait configuration. When I load my application in device its coming portraint configuration. But in landscape mode i keep missing some controls. How can I  fix the screen for both configurations?
Answer: This question was asked before: here
If you are a beginner, you might find the following useful(read up):
Developing orientation aware Android apps
Answer: You probably have to define different layouts for landscape and portrait. You could force android to choose the proper layout depending on orientation. You could put landscape layout xml files in "res\layout-land" and portrait in "res\layout".
Of course it's always good idea to use RelativeLayout, but it depends on your application.
Regards!
Answer: Check this out. Google has released a tutorial about this recently: https://developer.android.com/resources/samples/MultiResolution/index.html


Wireless Security Pen testing Setup

Question: I had a Asus N82J laptop with a dual boot setup.  I boot into Kali and Windows 7.  Long story short because of my dual boot with Grub I corrupted my HDD the operating system kept moving blocks of memory around.  I've obtained a new SSD and 2nd drive HDD and starting from scratch.  I still want the functionality of Kali Linux to see my wireless.  I've install VMWare work station 10 and I have a VM with Kali in it with a Windows 7 host.  I have a USB external Alfa antenna AWUS036NH which seems like a bit of work getting the drivers for this.  Is this the best setup for wireless pentesting?  Or is native Kali Linux the best route?  I have to have a Windows OS as I'm a MS developer.
Answer: As VMWare workstation provides USB Passthrough, it should be fine using USB wireless cards and doing testing from a kali/linux Virtual Machine.
I say should as there's always a risk of bugs in how VMWare passes the data through to the guest VM, so it could have an impact in some circumstances.  That said, my experience of VMWare Workstation and using USB devices in guests has been pretty positive, so yep overall I'd say that's a reasonable solution to your problem.
Comment: Thanks for the response it took me a while to build the dual boot system and at the end of the day I'd do it again but no way to cleanly back it up.  I'll keep going forward with this build with the VMWare. Thanks again.

Wireless Security Pen testing Setup


last  vs on

Question: Is it more correct to say:

Your service expired last June 1, 2017

as opposed to

Your service expired on June 1, 2017

If yes, why?
Comment: https://english.stackexchange.com/questions/224398/in-writing-dates-when-should-last-or-on-be-used
Answer: In this case, I believe that saying

Your service expired on June 1, 2017

would be more correct, since there is no other June 1, 2017, so why would it be necessary to clarify that it was last June 1, 2017?
It would however, be more proper to use last if you omitted the year, or, in other words, you stated:

Your service expired last June 1st.
Answer: In this context, last is a relative term -- it describes the most recent event that would fit.  For example, one might say I saw him last Tuesday.  Here, last indicates that the Tuesday you're referring to is the most recent previous one, not some other Tuesday.  If you are using a full date (month, day, and year) then last is not necessary.  Your service expired last June would make sense; your example, while not grammatically wrong, is awkward.
On the other hand, on refers to a specific date (identified either by using a full date as you have or by context.)  If a full date is not specified, then it is generally assumed to apply to either the most recent or next event.  He will arrive on Tuesday would imply the next occurring Tuesday whereas He arrived on Tuesday implies the most recently occurring Tuesday (due to the use of past tense.)
So, to sum up:
Last -- the most recent occurrence, used without a full date
On -- a specific date, identified either by the use of a full date or by context.
I hope this helps.
Answer: I think it depends how recently the service actually expired. If in the relatively recent past, say less than six months, then I think "Your service expired on June 1, 2017" is better. "Last June 1, 2017" implies that it was last year, or in the more distant past.

last  vs on


Reusing codes when selling game

Question: When selling a game with a bonus code still in date, can this code  be used by the person who buys it if I've used the code myself
Comment: Generally speaking, no. A code that's been redeemed can not be redeemed again. Exceptions may exist, but it's safe to assume that your code is invalid
Comment: On-topic but really bad question.
Comment: Since you tagged Uncharted 4, no, that bonus code can't be reused. Also how is this pirating, I'm confused @rivermont.
Answer: No. The bonus codes are only redeemable once.
Infact, these codes are often supplied as a bonus for the first-hand buyer. The idea would be that the user purchasing the game second hand would not be able to reuse the code, and would then purchase the content from the relevant online store, if they wished to play it. In turn,developers would at least see some profit out of the particular user, where as they do not recieve any profits when a game is sold second hand. There was actually talks of making this unique code a requirement to play, so second hand games would still require the user to 'pay tithe'. Some games employed a similar mechanic on the online component, where the bonus code would be a requirement to play online.
Almost every form of redemption code, in regards to video games, comes with an express one-time use.
Consider if this was not the case; DLC codes would sweep across the internet almost as soon as it was released, and users would be able to reuse the same key, effectivley allowing everybody to play without actually paying for the content. In turn, the developers would realise they were not making money, which makes a big impact on wether they make the game/DLC, in the first place.

Reusing codes when selling game


reincarnation manhwa where the mc reincarnate into a sick side character

Question: I couldn't forget about this story for a long time since I restarted my phone. Here's what I can remember. The mc became a character in a novel she usually read and the character isn't the mc of the novel. Better yet, the character was sick and would sometimes throw tantrum to the maids because of her sickness. Knowing the character she possessed is going to die, she did everything she can to stay alive. There was also an episode where she read a letter from her father who supposedly left her, and breakdown crying because the character's memories and hers became one. I don't know how to explain. Oh and the ml of the novel she read was the servant her character apparently abused and became her father's adopted child I think. The father also eventually came to see her after knowing she got a lot better because the mc took control of the character.
Comment: Hi, welcome to SF&F.  Where and when did you read this?
Comment: Do you recall the hair colour of the female lead and/or the male lead?
Answer: This is likely I'm All Out of Health!. It is licensed by Tapas.

Ninenya Seiah's misfortunes began from birth, owing to her mother's traitorous reputation and subsequent death. Ninenya was thus banished from the noble Seiah family and forcibly separated from her father, Lord Rubenio Seiah. In extremely poor health, Ninenya has mere months to live. To save his daughter, Rubenio enlists the mysterious Count Adelman as her protector. Ninenya must now work with Adelman to improve her poor health and stop her from becoming the victim of a deadly family feud.

The main character reincarnates as a background character within a novel - this character dies from her sickness, and at her funeral, her father meets the female lead of the original story.
Her sickness is so severe she is perpetually bedridden and can barely eat even the blandest soups. After reincarnating, the main character forces herself to eat soup and medicine in order to force her sickly body to recover.

I'm not sure if this qualifies as a "tantrum". She is rather belligerent with regards to trying to fix her body, but not really in a childish way. There are several such scenes like this, where she tries to force herself in some way and the maids disagree.
The letter scene may be in chapter 19. She reads a simple letter from her father and experiences a sudden outburst of unexpected emotion.

The dialog after the fact is a bit ambiguous as to whether this is the first letter or not. I got the chapter number from a review on anime-planet, not from reading every chapter. There may be a better match for the "character's memories and hers became one" part.


Nginx Development vs Stable

Question: Does anyone know the major differences between the Nginx Development and Stable editions? I know that there is a risk of bugs etc. in development. But I was more concerned with performance/features.
Answer: I'm not a big nginx pro, but in my experience development version is usable enough(no chashes so far) and it also had a fixed bug with 201 response code while the stable one hang when i was trying to give 201 from the backend server. In this particular situation dev version was helpful.
Anyway, potential risk of bugs I think is a serious reason to go and stick with stable version, even if it might be less performant.
Answer: The "development" branch is also called "mainline".
According to Nginx (quoted repeatedly on their site, here is one example)

Note that stable does not mean more reliable or more bug-free. In fact, the mainline is generally regarded as more reliable..
  We recommend that in general you deploy the NGINX mainline branch at all times.

The reason to use the stable is mostly for plugins - the stable won't change anything a plugin might be relying on.
While stable is theoretically more likely to be abused by a minor bug that hasn't been back-ported, mainline is theoretically more likely to have a 0-day or overlooked bug that made it through testing and early deployment.
IMO neither of those should be part of your initial calculations. You should have a backup and ideally a rollover server in any case.

Nginx Development vs Stable


If the expansion of the Universe accelerates, why its horizon does not shrink?

Question: In de Sitter (expanding) universe to which our universe asymptotically approaches, the higher the rate of space expansion, the smaller the radius of the cosmic horizon. Why then our universe is thought of being accelerating expansion yet its radius is not thought to reduce?
Comment: My understanding is that it *is* thought to reduce. Do you have a reference that says otherwise?
Comment: @Asher Holographic principle usually assumes that the total entropy of the universe is equal to the area of its boundary. Since entropy of universe grows, the horizon area also should grow. For instance, this answer by Ron Maimon claims the entropy of the universe is equal to the area of the cosmological horizon in Planck units: http://physics.stackexchange.com/a/36121/1186
Comment: @Anixx some people think that the area of the cosmic horizon puts a *bound* on the total entropy of the universe (though people argue about that point), but the actual entropy of the universe is much lower than that bound.
Comment: it expands in meters since the rate of expansion is positive, but the matter moving inside the horizon is becoming increasingly redshifted
Answer: A de Sitter universe is a cosmological solution to Einstein's field equations of General Relativity which is named after Willem de Sitter. It models the universe as spatially flat and neglects ordinary matter, so the dynamics of the universe are dominated by the cosmological constant, thought to correspond to dark energy in our universe or the inflaton field in the early universe.

Mathematically
A de Sitter universe has no ordinary matter content but with a positive cosmological constant ($\Lambda$) which sets the expansion rate, H. A larger cosmological constant leads to a larger expansion rate:
$H \propto \sqrt{\Lambda}$,
where the constants of proportionality depend on conventions.
It is common to describe a patch of this solution as an expanding universe of the FLRW form where the scale factor is given by
$a(t) = e^{Ht}$,
where the constant $H$ is the Hubble expansion rate and $t$ is time. As in all FLRW spaces, $a(t)$, the scale factor, describes the expansion of physical spatial distances.
To examine the de Sitter Universe to Cosmic Horizon further we need to define Cosmic or Cosmological horizon.
https://en.wikipedia.org/wiki/Cosmological_horizon
A cosmological horizon is a measure of the distance from which one could possibly retrieve information. This observable constraint is due to various properties of general relativity, the expanding universe, and the physics of Big Bang cosmology. Cosmological horizons set the size and scale of the observable universe.
There are a number of different horizons referenced in the Wiki link above. {Interesting reading} Let's look at a couple the Hubble Horizon and Event Horizon here :
1 Hubble Horizon
One can define a so-called "Hubble Horizon" which shows roughly how far light would travel if space were not expanding. This size is
$\chi = c t$
where t is the lookback time since the Big Bang (otherwise known as the age of the universe) which, according to the Friedmann Equations, is:
$t = \int^{a}_{0}{\frac{da}{H_0 \sqrt{\Omega_R a^{-2} + \Omega_m a^{-1} + \Omega_k +\Omega_\Lambda a^2}}}$
where $H_0$ is the Hubble Constant and the $\Omega$ density parameters are, in order, the density of radiation, matter, curvature, and dark energy scaled to the critical density of the universe.
Today, roughly:
$\chi_0 = \frac{c}{H_0}$
yielding a Hubble horizon of some 4.2 Gpc. This horizon is not really a physical size, but it is often used as useful length scale as most physical sizes in cosmology can be written in terms of those factors.
2 Event Horizon
The particle horizon differs from the cosmic event horizon, in that the particle horizon represents the largest comoving distance from which light could have reached the observer by a specific time, while the event horizon is the largest comoving distance from which light emitted now can ever reach the observer in the future. The current distance to our cosmic event horizon is about 5 Gpc, well within our observable range given by the particle horizon.
In general, the proper distance to the event horizon at time t is given by
$d_e(t) = a(t) \int_{t}^{t_{max}} \frac{cdt'}{a(t')}$
where $t_{max}$ is the time-coordinate of the end of the universe, which would be infinite in the case of a universe that expands forever.
For our case, assuming that dark energy is due to a cosmological constant, $d_e(t_0)$ < $\infty$.
For perspective :
{Because our Universe entered the Dark Energy Dominated Era a few billion years ago, our universe is probably approaching a de Sitter universe in the infinite future. If the current acceleration of our universe is due to a cosmological constant then as the universe continues to expand all of the matter and radiation will be diluted. Eventually there will be almost nothing left but the vacuum energy, tiny thermal fluctuations, quantum fluctuations and our universe will have become a de Sitter universe.}
The exponential expansion of the scale factor means that the physical distance between any two non-accelerating observers will eventually be growing faster than the speed of light. At this point those two observers will no longer be able to make contact. Therefore any observer in a de Sitter universe would see event horizons beyond which that observer can never see nor learn any information. If our universe is approaching a de Sitter universe then eventually we will not be able to observe any galaxies other than our own Milky Way (and any others in the gravitationally bound Local Group, assuming they were to somehow survive to that time without merging).
So what do we glean from the above "de Sitter" Model of our Universe. 1. It is expanding exponentially, the space within the mater is growing exponentially so the mater is finding itself exponentially far away from other non-gravitationally attracted matter. Moving much faster then the speed of light. $a(t) = e^{Ht}$   2. The mathematics of this model provides for a spatially flat universe.
Now let's examine your statement and question.

In de Sitter (expanding) universe to which our universe asymptotically approaches, the higher the rate of space expansion, the smaller the radius of the cosmic horizon.

The de Sitter universe is expanding  at $e^{Ht}$ Where $H$ is the Hubble Constant and $t$ is time.
The distance of Hubble Horizon {Cosmic Horizon} is given by
$\chi_0 = \frac{c}{H_0}$ {keeping in mind $H$ is approaching a constant}
Now assuming that the distance $\chi_0$ is equal to the distance in all directions to this horizon we can conclude that $\chi_0$ is equivalent to the radius of a spherical event horizon, from the point of view of the observer, the radius of the "Hubble Sphere". {See Hubble Sphere below}
Since $\chi_0$ = $c/H_0$ ,is a quotient of two constants $c/H_0$, it too is a constant.
Therefore the radius of the cosmic horizon is {approaching} a constant {for the current value of $H_0$ and in the general sense, as $H$ approaches a constant.}
{See reference below $H$ is approaching a constant}
This also answers your Title question
If the expansion of the Universe accelerates, why its horizon does not shrink?
Since $r_{HS}$ is a approaching a constant, the horizon approaches a constant as the Universe expands at an accelerating rate, $e^{Ht}$.

Why then our universe is thought of being accelerating expansion yet its radius is not thought to reduce?

Now to answer your next question. The radius of the spatially flat and expanding Universe is not the same as the radius of the Cosmic Horizon we just examined. The Cosmic Horizon is about a 4.2 GPC - 5 GPC radius and is governed by the speed of light and the hubble constant. This is a lot smaller than the entire universe which is expanding exponentially away by space filling in the matter of the universe that is non-gravitationally bound. We conclude that the Cosmic horizon radius is not equal to the de Sitter Universe's radius, it is that simple. They are different radii.
The cosmic radius is {approaching a} constant {as to $\frac{c}{H_{later}}$} while the other the radius of the de Sitter Universe is increasing as the spatially flat universe is expanding at $e^{Ht}$.
Additional References
Value of Hubbles Constant -
As of 2013 -
https://en.wikipedia.org/wiki/Hubble%27s_law
67.80±0.77 km/s/Mpc.
As of ~2010 -
https://www.cfa.harvard.edu/~dfabricant/huchra/hubble/
Best value for the local $H_0$ determination is around
71 (+/- 7) km/s/Mpc.
{See : https://en.wikipedia.org/wiki/Hubble%27s_law
$H_0$ is Hubble's constant and corresponds to the value of H (often termed the Hubble parameter which is a value that is time dependent and which can be expressed in terms of the scale factor) in the Friedmann equations taken at the time of observation denoted by the subscript 0.
Hubble Sphere -
In cosmology, a Hubble volume, or Hubble sphere, is a spherical region of the Universe surrounding an observer beyond which objects recede from that observer at a rate greater than the speed of light due to the expansion of the Universe. The Hubble volume is approximately 1031 cubic light years.
The proper radius of a Hubble sphere (known as the Hubble radius or the Hubble length) is $c/H_0$, where $c$ is the speed of light and $H_0$ is the Hubble constant. The surface of a Hubble sphere is called the microphysical horizon, the Hubble surface, or the Hubble limit.
Hubble's law is considered a fundamental relation between recessional velocity and distance.
For distances D larger than the radius of the Hubble sphere $r_{HS}$ , objects recede at a rate faster than the speed of light (See Uses of the proper distance for a discussion of the significance of this): $r_{HS} = \frac{c}{H_0}$
Hubble Parameter approaching a Constant Value over time:
Answer by Pulsar - 06-02-2014
Let's first derive Hubble's Law. Consider a galaxy at present distance $x$ from us. Then, if the local velocity of the galaxy within its cluster is ignored, its cosmic distance will change over time as
$$
D(t) = a(t)\,x,
$$
where $a(t)$ is the so-called scale factor. If we take the time derivative of this equation, we get
$$
\dot{D} = \dot{a}\,x = \left(\frac{\dot{a}}{a}\right)\,ax,
$$
which we can write as
$$
v = HD,
$$
where $v = \dot{D}$ is the recession velocity and $H = \dot{a}/a$ is the Hubble parameter. This is the famous Hubble Law. In other words, the Hubble parameter is a ratio of two quantities. The expansion of the universe implies that $a(t)$ increases over time, and $\dot{a}>0$. In fact, the expansion of the universe is accelerating, which means that $\dot{a}(t)$ increases over time as well. However, the ratio $H = \dot{a}/a$ decreases, because $a(t)$ increases more rapidly than $\dot{a}(t)$. The expansion rate of the universe is not high enough for $H(t)$ to increase.
Note that if the expansion were exponential, $a(t)\sim\exp(Ht)$, then $H$ is constant. In the standard cosmological model, the universe is evolving towards a state of exponential expansion, dominated by a constant dark energy density. In other words, if the standard model is correct, the Hubble parameter is slowly converging towards a constant value, and the expansion rate of the universe is increasing towards an exponential rate.
*** Answer is now complete
Answer: The confusion between shrinking, constant, and expanding horizons is mainly caused by the fact that the "spatial radius of horizon" or "spatial slice of space-time" are simply not invariantly defined concepts. There is one coordinate system in which the horizon has a constant diameter, but in the coordinate systems to which the $\Lambda$-FLRW coordinates converge it is not so.
First, let us see the "static" coordinate system:
$$d s^2 = -(1-\Lambda R^2/3) d T^2 + (1-\Lambda R^2/3)^{-1} dR^2 + R^2 d \Omega^2$$
I.e. the horizon is at $R=\alpha=\sqrt{3/\Lambda}$. The position of the horizon is static as is the whole metric. These coordinates are in fact "Schwarzschild-like" because surfaces of constant $R,T$ are spheres with constant curvature $1/R^2$ quite like in the Schwarzschild-coordinate case.
However, other sets of coordinates will give you FLRW universes with the spatial curvature $k=-1,0,1$ which are not static with respect to the cosmological time coordinate:
$$d s^2 = - d t_{-1}^2 + \alpha^2\sinh^2(t_{-1}/\alpha) (d\rho^2 +\sinh^2\rho d\Omega^2) $$
$$d s^2 = - d t_{0}^2 + \exp(2t_{0}/\alpha) (dx^2 +dy^2+dz^2) $$
$$d s^2 = - d t_{1}^2 + \alpha^2\cosh^2(t_{1}/\alpha) (d\chi^2 +\sin^2\chi d\Omega^2) $$
In all these coordinates, the $t_{-1,0,1}=const.$ hypersurfaces represent congruences of observers on a constant-curvature space-like hypersurface in spacetime and $t$ the proper time of the observer at a given point of the congruence.
If we take an intersection of the $R=\alpha$ horizon with the $t_{-1,0,+1}$, we get a 2D space-like surface we might like to call the "formal horizon". The formal horizon indeed does expand or shrink depending on the curvature slicing we choose and the epoch the congruence is in (note that there is a "bounce" epoch at $t_{\pm 1}=0$ for the curved congruences), but this is only an effect in certain coordinates, with respect to a certain congruence of observers. In the expansion epoch we are in, the formal horizon certainly shrinks, but from the point of another set of moderately natural coordinates, it will be asymptotically constant.
(As to your comments, remember that thermodynamics require a specification of a time coordinate. The cosmological $t$ is the proper time of the cosmic fluid so it is good for determining the short-range thermodynamical properties of the fluid itself, but one must be very careful in thermodynamical arguments about other quantities.)
Answer: The entropy of the universe only grows if it is a closed system. You are likely mixing two different concepts: the radius of the entire universe, that keep growing and the cosmological horizon of a particular observer, which does not define any physical border, just a causal/observable one.
The entropy inside the observable universe (and its radius) does not grow, and actually, by the holographic principle, the entropy gets actually reduced. This is because of the reduction of mass and energy and of available microstates as the radius diminishes.
The extreme case will be in the future if the big rip happens, every fundamental particle and every black hole will become isolated from the rest of the universe, so each disconnected part of the universe will in fact have very low entropy.


snmp server and/or switch, help

Question: i own and have configured a c2950-24 L2 switch. upon starting it up it asked if i wanted to configure snmp. i followed threw some steps but i have no clue how to actually use snmp. my switch logs when an Fa port is up or down and that's it. i also have freeNas which has snmp on it. do i make the server control the switchs' protocol or something how does that who interface and communication work, as well as setting up traps on the switch with FreeNas. i'm at a complete lose.
Answer:
but I have no clue how to actually use snmp

For the devices you describe, you can safely ignore SNMP.  You would normally use it to monitor the performance of network devices (and others), but with just a couple of devices, there's little point.
If you're really interested, there are lots of resources on the web to learn about snmp.  you should know it's slowly being replaced by NETCONF/Yang.
Comment: this is all for practice and learning, just i ended up really confused about it. and now a day it can be hard to learn about specific problems without asking a real person
Answer: Like the previous answer says, SNMP is mainly used for monitoring the condition of the switch or the NAS (or some other device). Different devices supporting snmp will have an agent program installed that standardizes information about the device and its current settings/ status into an SNMP compliant format.
Then using an SNMP client such as a network monitor,you can inspect all the different data about the device (reading), and depending on the specifics, make changes to the device using SNMP (writing).
The exact specifics of how this happens have some differences across devices and SNMP protocols, thought the core functionality of SNMP is consistent overall.
https://www.youtube.com/watch?v=iZlAyIq_mrU
Here's a quick video that gives a bit more clarity and context!

snmp server and/or switch, help


Unable to associate company's Wi-Fi certificate with our Wi-Fi network

Question: I have a tablet running Android 4.0.3 that I'm trying to connect to my company's Wi-Fi that uses a security certificate.  I've obtained the certificate and successfully installed it on my tablet but when I go to the Wi-Fi settings to connect to the cooresponding Wi-Fi network, there is no where for me to specify to use the certificate for authentication.  Is this an issue w/ this version of Android, am I doing something wrong, or is there something wrong at the cert level.  We use the same cert on iPhones/iPads (converted for ios use) and the cert specifies which Wi-Fi network to connect to so I assume that is what's supposed to happen on my tablet.  Any help would be appreciated.
Comment: I can't check on ICS right now but on 2.x the popup when you click to connect to a new network has dropdowns for both CA and user certificates.  You should try adding the network rather than relying on the cert to specify it, at least.
Comment: unfortunately when I go to manually add the network there is still no option for choosing certificates but I think I see the problem.  The network is showing as secured using WEP.  Another nearby network shows as secured with 802.1x and when I attempt to connect to that one I get the dropdowns for adding a certificate.  Sounds like it's the way our wifi network was set up and secured that's the issue.
Comment: so further testing and info from the admin who configured our company's wifi is that I should manually set it up as an 802.1x PEAP type network using PAP as the phase 2 security.  I can then add the cert but once I save the network it shows as out of range.
Answer: The option to choose a certificate is available with enterprise encryption (802.1x).
Judging by your comment, your android thinks it is using a different encryption method than it should, so have you attempted manually adding the network, and specifying the encryption type?
Please bear in mind that not all wifi cards and devices support that encryption method.
Answer: Try ProxyDroid from the Play Store. It might solve your problem.
Comment: Could you please give some more details on *how* the mentioned app is supposed to solve the issue? Thanks!


Unusual fuel consumption

Question: So I haven't been driving for a very long time only about a year or so, and my car is an Eagle vision Esi 1994.
I just replaced my inner and outer tie rods and put oil into the car, I haven't had any work with rebalancing or rotating tires(which is my next thing to do) but lately my car has been going thru gas a lot faster than it use to and I'm not sure what's causing it
Also to mention I did replace the spark plugs 5 mmonths ago, all the tires have tread.
I'm not sure what could be causing it?
Anyone have advice or tips?
Comment: Start a log.  Let us know the EXACT fuel economy.  Fill the tank, check the odometer.  Drive a few miles, fill the tank again.  One other thing... high percent ethanol gasoline doesn't age well in a tank.  You definitely don't want to fill a tank with that stuff and let the car sit for a year.
Comment: Sounds like it is due for a good service - oil& filter, fuel filter, air filter, checking tyre pressures etc and then measure the fuel consumption.
Comment: Okay, I'll do some more. Checking and change the filters out. Also the oil filter was changed the last time I did an oil change, which its been less than 10,000miles so far.
Answer: If you did not align the wheels after the tie rod replacements, the wheel angles can easily be off quite a bit. If the toe angles are opposing, plenty of resistance will be created. Certainly enough to cause a noticeable increase in gas consumption. It's like pushing a shopping cart with a sticky wheel at the grocery, takes extra muscle.
Answer: Without knowing any more than you've provided. we're just guessing. Have you checked the Overhead Travel Information System (OTIS)? It provides instant fuel usage as well as average fuel consumption. At least find out what the car itself thinks your mileage is.
The 3.3L averages 21 MPG while the 3.5L averages 19 MPG. Assess your mileage against these reported values to get a benchmark. Also, don't forget to check the EGR valve. A valve stuck open, or filled with crud, can affect your mileage.

Unusual fuel consumption


Adding nodes to a line by interval in MapInfo

Question: I am a MapBasic beginner, and I just want a simple .mbx or tool that can add nodes to a line by interval (say every 50m). I don't really need it to have a start point or end point (or maybe it is necessary to have that for the code to work, not a problem). Just maybe a dialog box that lets me bring in the line table and specify my interval, that's it.
Answer: Have a look at the free tool ToolBox from Routeware.
You can find it on their download page.
And there's a description of the features on the Toolbox 1.07 page. Look for the Add Nodes feature.
And if you want to have a look at the sourcecode, you can download that from the same site, too


Recent loanwords from other languages than English?

Question: Are there in French recent loanwords from languages other than English? By "recent", I mean the past 50 years or so.
Comment: The only one I would date as "recent" is [wesh](https://dictionnaire.lerobert.com/definition/wech) from Aarabic. There are probably more.
Comment: Can you narrow down your question somewhat? 50 years is a long time. There have probably been thousands of new non English loanwords in food, culture, science, etc.
Comment: @guillaume31 Thousands? Could you give, say, five of them?
Comment: @user1387866 Graffito gave more than a dozen for food and sports only
Comment: @guillaume31 Yes, he did. What Graffito answered is exactly what I was asking for.
Answer: In culinary field, Le petit Robert added a lot of dishes names since 1967.
Examples : basmati, carpaccio, falafel, houmous, maki, margarita, mojito, panini, plancha, surimi, tiramisu.
Sports and Martial arts examples : Bouzkachi (Afghanistan), Capoeira (Brasil), Krav-maga (Israel).


Help setting up php for Eclipse

Question: I'm trying to set up Eclipse for php web development.  What I would like to do is preview a php web page from within Eclipse, but I cannot figure out how to do this.  Is there an integrated web server of some sort that allows this, or do I have to set up IIS/Apache to do it?  If so, do I have to have my php files in the web servers path, or does Eclipse auto deploy the files to the local web server?  Any information or links would be very much appreciated.
Comment: this question is a top Google hit for "eclipse php setup", but it's a bit outdated. Does anybody know a good setup guide for Eclipse Luna (2014 edition)?
Answer: There is a plugin for Eclipse called PDT which makes PHP development a breeze.
For an overview on how to install it, you can refer to the Eclipse website:

http://wiki.eclipse.org/PDT/Installation#Eclipse_3.4_.2F_Ganymede_.2F_PDT_2.0

To actually view the PHP scripts running, I would imagine that you'd have to have some sort of server already installed and running. You could probably set the workspace location to be in the server path, and then view the files through localhost. But maybe the PDT package takes care of some of that for you.
Answer: I will make it Very Easy ;)
(1) Go to Eclipse home:  http://www.eclipse.org/downloads/  and download Eclipse      Classic  (Current May/2013 version is 4.2.2)
(2)
One you have eclipse fired-up in you machine Do followings : Help > Install Software

Than,  Click On Add
Finally, Add this link:  http://download.eclipse.org/releases/indigo  for all the list of Add-Ons
and pick PHP under Web Addon (Should be last in the list) and Install it.
Restart you eclipse + thumbs-up to my Ans. and Start Coding ;)
Answer: I setup apache/php/MySQL on my windows PC, so that testing environment is not totally unlike my servers (excepting the OS, but 90% of the time that's okay). I create alias's in the Apache configuration to the Eclipse workspace, and just hop between the browser and eclipse. The URL for testing is something like:
<code>http://localhost/project_name/file.php
</code>
While this isn't ideal, it is a fairly consistent/smooth process that doesn't require a great deal of configuration within Eclipse.  I keep thinking there should be a better way, but I honestly don't think I'm burning enough time to justify the research.  Once the setup is done, I don't really loose more time after that, and I can control which version of PHP I'm running on my system.
I don't tend to like integrated browsers for testing of web applications anyway.  Every time I've dealt with one, it was completely different from a "real" browser that I had to completely retest anyway.  At least this way, I have my Firefox testing done when I'm through the first pass of the logic.
Answer: try easyeclipse, it the easiest Eclipse setup i've found
"EasyEclipse for LAMP:
For PHP, Python, Perl, and Ruby development with a web server and a database"
Answer: I would also recommend downloading and installing WAMP server which is a really easy all in one Windows equivalent (windows, Apache, MySQL, PHP) of what you are likely to have with a commercial web host. See http://www.wampserver.com for details and download.
As well as pdt which had already been mentioned other alternatives are phpeclipse and aptana studio which is based on eclipse.
Answer: Visit this website https://eclipse.org/pdt/. Go to where it says 'Update existing Eclipse'.
The procedure is this "In Eclipse, click Help -> Install New Software and work with *: http://download.eclipse.org/tools/pdt/updates/3.6"

Help setting up php for Eclipse


Macbook's keyboard gets hanged

Question: I bought a used macbook which does not have some screws of its casing. The buttons of the keyboard stop working at times. Only the power button works. When I restart, it starts to work fine. What could be causing this?
Answer: First of all, you bought it used with screws missing, so I'd recommend taking it to a shop or a friend that knows what he's doing to check to make sure all the hardware is there and if so, not damaged.
Second, test a different keyboard on the computer, usb keyboards are all the same, if it hangs still, rule out the keyboard.
If hardware shows fine, and changing keyboard does nothing, the next step, reinstall the OS.

Macbook's keyboard gets hanged


How to transform Vim configuration into Emacs one?

Question: I need to setup Emacs editor by preparing the ~/.emacs configuration file. I have been using Vim for years and now I want to switch to Emacs for various reasons that are out of scope of this post. To do so, I need to reproduce in Emacs all the functionality of Vim that I worked out over years of using it. In other words: I want to transform my ~/.vimrc configuration file into the equivalent ~/.emacs configuration file. I include my ~/.vimrc with all settings commented in this post.
I know that my ~/.vimrc contains quite a lot of settings, but I have already figured out how transform some of them, and I am also aware that some of the settings don't really need to be transformed. Unfortunately, most of them are still beyond my current knowledge of Emacs configuration.
Here is my ~/.vimrc:
" Configuration file for Vi Improved, save as ~/.vimrc to use.
set nocompatible " Vim mode instead of pure Vi
set encoding=utf-8 " encoding used for displaying file
set fileencoding=utf-8 " encoding used when saving file
set nobackup " do not keep the backup~ file
set confirm " confirm :q in case of unsaved changes
set ruler " show the cursor position all the time
set textwidth=80 " wrap lines automatically at 80th column
set tabstop=8 " set tabulator length to 8 columns
set expandtab " fill tabs with spaces
set softtabstop=8 " backspacing over 8 spaces like over tabs
set shiftwidth=8 " set indentation depth to 8 columns
set backspace=indent,eol,start " backspacing over everything in insert mode
set nojoinspaces " no extra space after '.' when joining lines
set incsearch " do incremental search
set ignorecase " do case insensitive search...
set smartcase " ...unless capital letters are used
set hlsearch " highlight search results
set showmatch " highlight matching braces

filetype on " enable file type detection
filetype plugin on " load the plugins for specific file types
filetype indent on " automatically indent code...
set cinoptions=:0g0 " ...but don't indent case labels and access modifiers

syntax enable " syntax highlighting
set background=dark " dark background for console
colorscheme solarized " set color scheme, must be installed before use

" characters for displaying non-printable characters
set listchars=eol:$,tab:>-,trail:.,nbsp:_,extends:+,precedes:+

" tuning for gVim only
if has('gui_running')
    set number " show line numbers
    set columns=84 lines=48 " GUI window geometry
    set guifont=Monospace\ 12 " font for GUI window
    set background=light " light background for GUI
endif

" automatic commands
if has('autocmd')
    " file type specific automatic commands

    " don't replace Tabs with spaces when editing makefiles
    autocmd Filetype makefile setlocal noexpandtab

    " press F5 to call `indent` for C and C++ source code files
    autocmd FileType c,cpp noremap <F5> :%!indent -kr -brf -nut<cr>
    autocmd FileType c,cpp inoremap <F5> <Esc>:%!indent -kr -brf -nut<cr>

    " tuning textwidth for Java code
    autocmd FileType java setlocal textwidth=132
    if has('gui_running')
        autocmd FileType java setlocal columns=136
    endif

    " disable automatic code indentation when editing TeX and XML files
    autocmd FileType tex,xml setlocal indentexpr=

    " clean-up commands that run automatically on write; use with caution

    " delete empty or whitespaces-only lines at the end of file
    autocmd BufWritePre * :%s/\(\s*\n\)\+\%$//ge

    " replace groups of empty or whitespaces-only lines with one empty line
    autocmd BufWritePre * :%s/\(\s*\n\)\{3,}/\r\r/ge

    " delete any trailing whitespaces
    autocmd BufWritePre * :%s/\s\+$//ge
endif

" general key mappings

" center view on the search result
noremap n nzz
noremap N Nzz

" press F4 to fix indentation in whole file; overwrites marker 'q' position
noremap <F4> mqggVG=`qzz
inoremap <F4> <Esc>mqggVG=`qzza

" press F8 to turn the search results highlight off
noremap <F8> :nohl<cr>
inoremap <F8> <Esc>:nohl<cr>a

" press F12 to toggle showing the non-printable charactes
noremap <F12> :set list!<cr>
inoremap <F12> <Esc>:set list!<cr>a

Comment: Ask the emacs help list if you don't get an answer here: https://lists.gnu.org/mailman/listinfo/help-gnu-emacs
Answer: Unfortunately there's no automated way to do this.  Have you have probably made progress and/or no longer need this answer?
Your question isn't very specific. You mention you have already figured out a lot of your conversion, and some don't need to be transformed. Which still do?
There is a vim mode for emacs called evil that might be interesting. They have a youtube video too.


What is mind according to Hinduism?

Question: What is the concept of the mind according to Hindu scriptures? As far as I understood, it is something very small in the head to which the brain reports to. And our visible universe is the reaction of the mind. Am I correct?
Comment: The Mind is not a physical object residing in the brain, rather it is a subtle entity. The Mind is subtler than the subtlest and denser than the densest. The Mind is not many, but One. The Mind is another name for Ego or Ahamkar. The source of this delusion is the Mind. This is called the Cosmic Mind. The same Mind perceives itself as different Minds. There is something beyond the Mind, from where the Mind derives its existence, and that is who You really are. Good q.
Comment: Where is it located? How can one imagine it?
Comment: Sri Ramana Maharishi says that thoughts arise from the Heart (the spiritual heart, which Maharishi said was on the right side of the chest). However different sources would say different things about the seat of the mind. 'How can one imagine it?', how to imagine the Mind, with your mind? The Rishis say to focus on the thought, whenever a thought arises, ask yourself 'from where does this thought arise?', 'who is the one that is thinking?', 'is there something about me that is independent of thoughts?'. Some say one can focus on the void between 2 thoughts. That silence is God.
Answer: The following are excerpt from the Sri Ramana Maharshi's teachings - Talks with Sri Ramana Maharshi.  This may be helpful.
In answer to a question by a long resident attendant Sri Bhagavan said:

"Everybody complains of the restlessness of the mind. Let the mind be found and then they will know. True, when a man sits down to meditate thoughts rush up by dozens. The mind is only a bundle  of thoughts. The attempt to push through the barrage of thoughts is unsuccessful. If one can by any means abide in the Self it is good.
For those who are unable to do so, chanting or meditation (Japa or dhyana) is prescribed. It is like giving a piece of chain to an elephant to hold in its trunk. The trunk of the elephant is usually restless. It puts it out in all directions when taken out in the streets of the town.  If given a chain to carry the restlessness is checked. Similarly with the restless mind.
If made to engage in japa or dhyana, other thoughts are warded off: and the mind concentrates on a single thought. It thus becomes peaceful. It does not mean that peace is gained without a  prolonged struggle. The other thoughts must be fought out.
Answer: Mind is known as Manas (Sanskrit word)in Vedic philosophy-now popularly known as Hinduism. Manas is the co-ordinator of 10 Indriyas (5 Gyana Indriyas + 5 Karma Indriyas) and serves as the conduit of external information to the Intelligence (Dharma Bhoota Gyana) of the conscious self-Jiva. Manas along with 10 Indriyas come out of Satvic Ahankar during the process of creation of the Universe. Manas has two more states called 'Chitham'(Analytical) and 'Buddhi'(Decision).
Comment: *Buddhi* is not a state of the mind but transcendental to mind/Mann. This is mentioned in a verse of Gita.
Comment: manas is separate from buddhi and chitta. these three along with ahankar together form antahkaranas.
Answer: Well, mind is a vast topic to study and understand. There is a good book Mind According to Vedanta by Swami Satprakashanand on this topic. The paid version is available online.
Writing a little from memory about what I remember now:

The book presents Vedantic concept of mind, that it is different from body and soul (and little more), and how it differs from
Western concept. And also shows where Western concept has flaws.
The mind is the seat of internal perception (antahakarana) just as
the 5 sense organs are the seat of external perceptions.
Involvement of mind is necessary for eyes to see (and notice), ears
to listen (and understand) and other sense organs to perform
properly.
Four functions of the mind are (suppose you see a chair, now how does
your mind function):

Manas (on seeing a chair, what is this ?)
Chitta (mind searches its storage of impressions to find out such similar structured object)
Buddhi (it decides that it knows it)
Ahamkara (I-maker, i know that this is a chair)

Every time we see anything (and literally anything), the mind performs these four functions.
The mind stores all our impressions, even of past lives. Even a simple act such as walking leaves some impression on our mind. These impressions are
source of our memory. It is through these impressions that we develop
likes and dislikes.
Purity of mind is of utmost importance for concentration of the mind.
Our (unless we are enlightened) subconscious mind has many
undesirable (bad for spiritual progress) impressions. The fight to
purify this subconscious mind is to be fought at conscious level.
That is, we have to attempt not to feed our mind with bad thoughts.

I do not exactly remember what the book says about its position in the body.
Anyways, the book surely answers your question in detail. It is a good read.
Answer: strong text
Mind according to Veda, Upanishad, and Gita:
The mind is the most complex of the 11 basic human senses (5 cognitive, 5 functional, and mind). Because, just as the 5 cognitive sense organs (eyes, ears, nose, tongue, skin) and the 5 functional organs (hands, feet, anus, genitals, and mouth (speech) etc. can be detected externally, their activities can also be seen. But the mind is like other senses, cannot be detected and cannot be seen. The sense organs and functional organs are fundamental and their functions are also fundamental. That is, they cannot do the work of one another. Just as the eye cannot do the work of the foot, so the work of the foot cannot do the eye. Similarly, the work of the anus cannot do the ears,  just like the ear cannot do the work of anus. But the mind can do many things simultaneously. Like the mind can think about several things at the same time. The mind can feel happiness, sadness, pleasure, pain at the same time.  The mind can see many things unseen by the mind eye through imagination. Again, the mind can perceive the soul in its innermost place. This is that egoism, self [I, My] all originate in the mind. Sin - virtue, doubt - faith, truth - falsehood, righteousness, unrighteousness, good - evil etc. are perceived in human mind. Human mind changes frequently. That is why the mind itself does not know what the human mind is thinking. So, philosophers say, human mind is very strange. This happens because the human mind is compound and complex. According to the Vedas, the human mind is considered to be composed of five basic elements. These elements are - Manas, Ahankara, Chitta, Buddhi and Atman.
Kath Upanishad verse [1:3:3] says about the mind:
Sanskrit verse:
आत्मानँ रथितं विद्धि शरीरँ रथमेव तु ।
बुद्धिं तु सारथिं विद्धि मनः प्रग्रहमेव च ॥ ३ ॥ Kath Upanishad verse [1:3:3]
English sloka"
ātmānam̐ rathitaṃ viddhi śarīram̐ rathameva tu |
buddhiṃ tu sārathiṃ viddhi manaḥ pragrahameva ca || 3 || Kath Upanishad verse [1:3:3]
Meaning: "Know the soul as the master of the chariot; the body as the chariot; the intellect as the driver; and the mind as the bridle." Kath Upanishad verse [1:3:3] s
Indeed, the mind is the bridle horse. Only when this bridle of the mind is controlled by the intellect, the mind becomes calm, serene, and fearless. And it is with this calm, serene, and fearless mind anybody can make impossible possible.
Dhiren Chandra Das. Bangalore.
Comment: As it's currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer).
Answer: Mind is an instrument that acts as the link between the sense organs and the Self according to Advaita Vedanta.

In any external perception four distinct factors are involved: the
object, the cognate sense-organ, the mind (antahkarana), and the
knowing self. In the absence of any of these no perception is
possible. Of these four the self alone is intrinsically luminous,
being of the nature of consciousness; the rest are devoid of
consciousness. It is the light of the self that manifests the object.
So the self must be connected or related with the object. The mind
conjoined with the sense-organ brings about the relation. The self is
the perceiver, the knower per se. As such it is distinct from the
mind, which is knowable. …………….
In Western thought a clear-cut distinction between the mind and the
knowing self is hardly noticeable; generally, mind is viewed as
characterized by consciousness. But it is the consensus of Hindu
philosophers that the self (atman) and the mind (antahkarana) are
altogether different. Mind is an internal instrument of the knowing
self; there is no consciousness inherent in it. …………….
Each sense-organ is produced by that very subtle element whose
distinctive property it has the power to reveal. For instance, the
organ of hearing is composed of the sattva aspect of subtle akasa,
whose specific property 'sound' is manifested by it. Similarly, the
organ of touch is composed of the sattva aspect of subtle vayu, whose
specific property 'touch' is manifested by it. ……
The subtle aspect of all the five subtle elements (akasa, vayu, tejas,
ap and ksiti) being combined produces mind (antahkarana), which
therefore is material and has constituent parts. While sattva is
predominant, rajas and tamas are overpowered. Basically, constituted
of the finest and purest essence of matter, mind (antahkarana) has the
special capacity to expand and contract and take the form of any
object of knowledge, howsoever large or small, gross or fine, it may
be. It can move instantaneously, so to speak. Though seated in the
heart it pervades the whole body in the waking state. In dream state
it recedes more of less to the subtle body. In deep sleep it is
withdrawn to the causal body.
…………..
But, according to Vedanta mind is finite, that is, of medium magnitude
(madhyama parimana).So it can be connected with one or more organs at
the same time…….
…but Vedanta distinguishes the individual mind from the cosmic mind,
which belongs to Brahma, the World-soul, who presides over the cosmos.
According to both Samkhya and Vedanta mind is a product and,
therefore, not eternal.
Being composed of the subtlest and most transparent substance and
closest to the self, mind (antahkarana) receives the light of
consciousness that belongs to the self and is illuminated by it. With
no light of its own it appears luminous…….
Mind is connected with the organs by means of the central nervous
system, of which brain is a part. It is through the mind that the
light of consciousness is transmitted to the sense-organs, which being
made of sattva substance have the special power to receive the light.
Thus they serve as the organs of perception. The light of
consciousness radiating from the mind enables the motor-organs to
function. All external perceptions, all actions, are due to the
radiance of consciousness received by the organs from the luminous
self (atman) through the mind. In dream state when the radiation
recedes from the body none of the ten organs can function, but the
mind continues to operate. In deep sleep when the radiance recedes,
even from the mind, all mental operations including egoism comes to
dead stop. Says Vidyaranya: 'Mind, the leader of the ten organs, is
seated in the orb of the lotus of the heart. It is the inner
instrument (antahkarana), since it cannot by itself deal with external
objects without the organs (indriyas).'
Of the three aspects of mind (antahkarana), cognitive, affective, and
conative, the cognitive is basic. It underlies the other two. Feeling
and willing are invariably associated with some kind of cognition.
Vedanta stresses the cognitive mind and takes into account its four
states or functions (vrtti): deliberation (manas), determination
(buddhi), egoism (ahankara), and recollection (citta). In every
external perception these four are involved. On seeing a chair a
person does not at once determine it as a chair. In the beginning he
is vaguely aware of it as something. He is in an indecisive state. So
he cogitates 'what is it?', 'what is it?' This function of
deliberation is manas. Then he searches within and recalls some past
impression akin to it. With this recollection he cognizes the object
as 'this is a chair'. This function of determination is buddhi. The
function of recollection is citta. With the knowledge 'This is a
chair' arises the knowledge 'I know the chair'. This is the function
of egoism. Because of the rapid succession of the four functions they
seem to be instantaneous. The four functions represent four different
states of the mind. Most Vedantins recognize two main states of the
mind; deliberative (manas) and determinative (buddhi). Vedanta-sara
includes ahamkara in manas and citta in buddhi. Like 'antahkarana' the
term 'manas' is sometimes used for entire mind, and so is the term
'citta'.

Methods of knowledge according to Advaita Vedanta by Swami Satprakashananda

What is mind according to Hinduism?


What is the case of using Buffer.allocUnsafe() and Buffer.alloc()?

Question: I am confused about using Buffer.allocUnsafe() and Buffer.alloc() , I know that Buffer.allocUnsafe() creates a buffer with pre-filled data or old buffers, but why do i need such thing if Buffer.alloc() creates a buffer with zero filled data
Comment: I guess flushing the buffer takes time. If you need performance and you know you will completly fill the buffer anyway, there would be no need to flush it first.
Comment: Thanks for your comment
Answer: In Node.js Buffer is an abstraction over RAM, therefore if you allocate it in an unsafe way, there is a high risk of having even some source code in the buffer instance. Try running console.log(Buffer.allocUnsafe(10000).toString('utf-8')) and I guarantee that you will see some code in your stdout.
Allocation is a synchronous operation and we know that single threaded Node.js doesn't really feel good about synchronous stuff. Unsafe allocation is much faster than safe, because the buffer santarization step takes time. Safe allocation is, well, safe, but there is a performance trade off.
I'd suggest sticking to safe allocation first and if you end up with low performance, you can think of ways to implement unsafe allocation, without exposing private stuff. Just keep in mind that allocUnsafe method has the word unsafe for a reason. E.g, if you are going to pass some compliance certification like PCI DSS, I'm pretty sure QSA will notice that and will have a lot of questions.
Comment: I want to add that if you are 100% sure you are overwriting all data it is perfectly safe to use unsafeAlloc. E.g a copy operation. `const bufferCopy = Buffer.allocUnsafe(oldBuffer.length); oldBuffer.copy(bufferCopy);` Which is one of the perfect use cases for `allocUnsafe`.
Comment: Yep the Buffer API runs outside the V8 heap meaning it directly allocates RAM memory (which may be  not empty if we use unsafe methods)
Answer:
Buffer.alloc(size, fill, encoding) -> returns a new initialized Buffer
of the specified size. This method is slower than Buffer.allocUnsafe(size) but guarantees that newly created Buffer instances never contain old data that is potentially sensitive.
Buffer.allocUnsafe(size) -> the Buffer is uninitialized, the allocated
segment of memory might contain old data that is potentially
sensitive. Using a Buffer created by Buffer.allocUnsafe() without completely overwriting the memory can allow this old data to be leaked when the Buffer memory is read.

Note: While there are clear performance advantages to using Buffer.allocUnsafe(), extra care must be taken in order to avoid introducing security vulnerabilities into an application