Get Bitcoin historical data in the interval of minutes

Question: Can anybody tell me where can I download Bitcoin historical data? I'm able to find the daily price. But that is not enough for my project. It will be better if I can have the price data in the interval of minutes.
Answer: Here you have tool that imports bitcoin blockchain data into graph database
https://bitcointalk.org/index.php?topic=252033.0
Answer: You can get thousands of historical datasets from https://spreadstreet.io.
All datasets are available as a tab-delimited, CSV file. The datasets are a mix between raw tick data, OHLCV, spreads, mining and economic statistics. They can be used for backtesting, analysis, and charting.
Here is an example dataset. This is from Poloniex, and is the 30 min timeframe. We have lower time frames, but the files are larger than I wanted to link in this question.
Disclaimer: I am the founder of Spreadstreet.io


Why is the air smoother when you get above the cloud base?

Question: Why is it bumpier below where the clouds form and once you get above the bases the air tends to be smoothers?
Comment: Welcome to Av.SE - nice first question!
Comment: Because thermals only reach up into the clouds.
Comment: The question contains a misconception.  Actually the air can be very bumpy inside clouds.      It is more accurate to observe that the air tends to be smooth above the cloud *tops* than the cloud *bases*.  Of course if you are above cloud base and are not inside a cloud, then you are not in an updraft, but you might conceivably be in a downdraft.  Anyway to a first approximation the cloud tops (not the cloud bases) mark the top of the "mixed layer" where it is turbulent.
Answer: In some sense the question is backwards.  But, that really leads to the answer.  Clouds form when there is air movement.  For example of how clouds can form: when there is local heating, such as due to the sun heating a large black parking lot, the air over that will rise.  Flying through that air is not as smooth as in other places.  As that air rises up it expands and cools leading to an increase in the relative humidity.  If it does that enough it reaches 100% RH and a cloud forms.  But, that also leads to a decrease in the energy available to move that air up, so it doesn't keep rising up.  So, the air above clouds tend to not have as much energy and movement as below.
So, clouds form where there is air movement, and they "mark" that movement.
Comment: A suggestion to improve this answer-- actually, the latent heat released when the water vapor condenses into a cloud releases *more* energy into the column of rising air,  *decreasing* its rate of cooling and thus further *stoking* the thermal updraft.  (Google "wet adiabatic lapse rate" and "dry adiabatic lapse rate".)  This can be an important factor in the formation of thunderstorms or towering cumulus clouds.  Still it remains the case that the air is smooth above the cloud tops because the cloud tops are also the tops of the thermal updrafts.
Comment: Re "But, that also leads to a decrease in the energy available to move that air up, so it doesn't keep rising up. " -- see prev. comment-- actually, to understand why the air eventually stops rising, you have to look at the density (temperature) vs altitude profile of the surrounding atmosphere.
Comment: The fundamental problem with this answer is that it suggests that cloud formation tends to stifle updrafts, which is not true at all (except of course for effects relating to shading of the ground.)


Is 1 pixel of a height map representative of 1 vertex on the mesh?

Question: I'm trying to get my head around heightmap terrain generation. If I have a plane say 64 x 64 verts will I need to create a 64px by 64px greyscale heightmap in order to displace the geometry of the plane correctly?
Answer: You may be confusing some details. A height map is simply a 2D array of data. Each point represents 3 pieces of information: an x and y location and a number to represent the height at that point. For a simpler example, lets look at a 1D array of data that creates some 2D terrain. Each data point here will contain an x location and a number to represent the height at that point:

Pretty simple right? It's just a regular old graph. As you can see, the numbers on the x axis go up by tens. We could easily change that to go up by 100's or by .01's. Same goes for the data displayed on the y axis. We can scale those values however we like.
Basically, it's just numbers until you decide how you're going to visually represent it. So, saying a height map of 64px by 64px is already one step beyond where we need to go. Since a grayscale image is just another way to display the same data as a 3D height map. The data to represent each is coming from the same place.

Further, you don't even need a 1 to 1 relationship between data and display. You could have far more vertices than you have data points, or far fewer. They don't even need to be equally spaced.
For the most basic example: Yes, generate an array of [64][64] data points to make a grayscale image or a 3D heightmap. Each [x][y] of your array will correspond to the x, y of your vertices and the value stored in each [x][y] will represent the z value of your vertex.
Comment: That's likely a scale issue. You can try applying smoothing to the vertices after you've set them. Something like the diamond square algorithm could work.
Comment: Very clear informative answer, thank you. In effect it's just a 2D array of points being visualised.
Comment: @CaiusEugene Correct. There are multiple ways to visualize it, a simple one being gray scale images. Where the "height" value is just visualized as a color between bottom (black) and top (white).
Comment: I'm working on creating a "good looking" eroded terrain, my attempts so far are looking awful, I think I may have the wrong approach but I'm irritating through my vertices and displacing there z value based on a pixel from a greyscale image. My results are all "jagged" and don't resemble the height mapped terrains I've seen elsewhere. What could I be overlooking in this case?
Comment: Perfect solution by the looks of a quick google! Thanks @Byte56


Why is Central Admin on App server?

Question: Why is Central Admin on an application server by default?  It seems like if you wanted your app server to truly be an app server, then you wouldn't have it serving any sites. This seems like it could also be a problem for availability. If your app server goes down, then so does Central Admin. Of course this is assuming that there is only 1 app server, but most set ups I've seen, or read questions on, have 1 app server and 2 WFE's. Why not have Central admin on the WFE's?
Answer: I'm not sure on Microsoft's reasoning, but when I design farms, I purposely leave CA on an app server as it is not a high traffic site and won't affect performance of the app server.
It's the management tool for your farm, so keeping it on servers that its managing makes sense to me. It also allows you to extract a level of security by not putting it on a web front end, which could be accessed via a load balancer, instead it's on server that's behind the scenes that less users would even know about.
Just my 2 cents.
Comment: David is correct.  CA is an admin only site that has the potential to completely destroy your entire farm if misused or hacked.  In many farms, particularly Internet/Extranet farms, the WFEs are exposed to the internet and are thus subject to being hacked.  If Central Admin isn't even installed on a WFE, it eliminates the potential that a hacker will gain access to it.
Comment: I agree with David on this.  The CA aspect itself is strictly just an administrative interface, but the server it is installed on tends to be pretty important since it is the seed for your farm.  Because of that, I also make it an app server.  While SharePoint has evolved significantly over the past 12 years, and the deployments have gotten significantly more complex, this initial seed for the farm remains pretty important.
Comment: I am surprised and appreciative of the quick feedback! It makes sense that you don't want to expose CA to the web. I hadn't considered that. The case I am facing is for a company's intranet. When it comes to the intranet, this doesn't seem to provide extra security. The only difference in accessing CA from any computer on the intranet is myspwfe:8080 vs myspapp:8080. I can, however, understand how the app server would be the default. Also, you mention that keeping it on the severs its managing makes sense.... but it also manages the WFE's and then you state you don't place it on those?
Comment: in a normal intranet deployment, the WFE is addressed as something like "Intranet.domain.com" whereas the app server usually is addressed as ServerName:port.  Your point is technically correct in that it can be accessed just as easily, though it is usually far less likely to be done as nobody other than the SharePoint Admins even know the name of the app server.

Why is Central Admin on App server?


PDF Buttons missing when I save in Illustrator CS6

Question: I created a map in Illustrator CS6 which I exported to pdf. Using Acrobat 11.0.23 I created buttons which show information when the mouse hovers over the button area. If I reopen the PDF in Illustrator CS6 to change something (like the color of an area)and save it again, all the button functions are lost. Is there a method to preserve buttons made in Acrobat when saving in CS6?
Answer: Illustrator CS6 has no interactivity functions. When you open the PDF with Illustrator it does not understand any of the interactivity. So, it ignores/dumps that code. It's non-native code to the application (AI) and can't translate the Acrobat code to AI code because there's no matching functionality.
There's no method I am aware of to get Illustrator CS6 to understand, maintain, and support Acrobat 11 interactive settings.
Answer: For interactivity design and basic graphic design, InDesign is a better choice, allows for your interactivity design to be native to your source files, and of course supports direct placing of Illustrator files as well, so you can in fact use a hybrid workflow that should get you everything you need, albeit true that you won't be retaining what you did in Acrobat, you will re-create it once, and then it'll be part of your native InDesign source file from therein.
This is preferable as it allows easy one-to-many iteration and publishing.


Cancelled stamp on passport

Question: I have a friend, from Zimbabwe, that stated, some time back she wanted to visit SA and got the stamp in her passport, she then, however, decided not to travel anymore. They cancelled the stamp. Can that cause any problems when applying for a visa to go to the UK?
Comment: Did she actually go back to get the visa cancelled and marked as such in her passport? Or was the visa cancelled when entering, staying or exiting SA? You should probably include a photo of the stamp (with any personal information blacked out).
Answer: UK visa applications require you to disclose

visa refusals to any country in the last 10 years
removal or deportation from any country in the last 10 years
entry refusals to the UK in the last 10 years

Some countries (e.g. Schengen countries) make a difference between "cancellation" and "annulment" (for both entry stamps and visas). A cancellation is serious and suggests a refusal of entry, some sort of alert or fraudulently obtained visa. An annulment is a technical measure used if a document was stamped by mistake or a visa needs to be corrected. I don't know if South Africa makes a similar distinction and whether UK immigration officers are necessarily familiar with these nuances but it can generally be inferred from the stamp itself.
If by "cancelled stamp", she means that she has been refused entry or that the consulate reversed their decision then it should be disclosed and could obviously be a bigger issue than if the stamp has merely been annulled after she reported her change of plans to the consulate herself.

Cancelled stamp on passport


How can I delete pictures off Photo Stream to free up iCloud storage space?

Question: I have Photo Stream set up and my pictures show up in iPhoto on my Mac.  Do I have to import them to keep them permanently?  How can I free up iCloud space?
Answer: "My Photo Stream" does not consume space in your iCloud account storage quota so deleting photos from Photo Stream will not free up iCloud storage space.
If Photos.app has "My Photo Stream" turned on in the iCloud preferences, any photos that any device adds to "My Photo Stream" will get automatically imported into the Photos.app library on your Mac. They do not have to be manually imported.
In recent (2017) versions of Photos.app, individual images can be selected and deleted from "My Photo Stream", but be careful when deleting things. Photos deleted from "My Photo Stream" MAY also be removed from the local library on the device (depending on exactly how they were deleted: delete key; menu items; contextual menu; etc.), but they will not be removed from any other devices that have imported the images into their local library (which happens automatically with Photos.app on the Mac). Photos that were removed from the local library can be recovered from the "Recently Deleted" folder on the device, and are not added back to "My Photo Stream". Note that the photos visible in "My Photo Stream" can differ between different devices, perhaps due to time lag between local caches and server updates.
To reclaim iCloud storage space, remove data from other services such as Documents and Data, Mail, and iCloud backup. In particular, iOS device backups can consume a lot of iCloud space - you might consider having iOS devices backup to your Mac through iTunes rather than backing up to iCloud. This change can be made using iTunes when the iOS device is attached via a USB cable.
Answer: Open the iCloud preference pane on your Mac to get the easiest way I've found to manage the storage.
Click the Manage... button in the lower right.
This will calculate all the storage users counting against your quota and offer you details on how to clean up each category. Once you've reviewed each bin - you can decide to delete or if you would rather purchase more storage to keep what you have stored in the cloud.
My experience is people can do one step to free up significant backup space from iOS. Go to the Settings app and then iCloud > Storage & Backup > Manage Storage
Select the device you are on and then under BACKUP OPTIONS - turn off Camera Roll and possibly any other items you don't want backed up.
This means you need another way to back up your photos, but since you have a Mac - you could set iPhoto to automatically back up all photo stream contents or regularly sync the photos and videos from iOS to the Mac and then back up the Mac to a cheaper hard drive or service than iCloud.


Question about the differences of white and grey NaH properties

Question: We are having some problems with the next reaction in our lab. As you can see, is the sulfonylation of an indole in which we use NaH (60% dispersion in mineral oil) as a base. This reaction goes with good yields when the NaH is a white solid. But lately, we bought a new one (also 60% dispersion in mineral oil) but in this case its colour is grey. With this one, the reaction never completes and it goes with lower yield.
We bougth another one, because we thought that the other one came in bad conditions, and again, the product was grey.
We have also tried to wash the NaH with hexane and dry it carefully but nothing changed.
So my questions are: Do you know which is the difference between both of NaH? Where could we find the white one again? How can this happen? It's the same reactant but only with diferent colour.
Thank you so much for your help!!
Comment: I'm used to NaH (60% in oil) being grey and distrusted the material that was white - so not really any help.
Comment: I don't particularly see why this reaction should be problematic (though as raptorlane pointed out, NaH in DMF should be avoided), but you can always consider alternatives. For example, you could skip NaH altogether by performing an *N*-trimethylsilylation and reacting that with the sulfonyl chloride. It's two steps, but may end up being a cleaner and higher-yielding process overall.
Answer: Sodium hydride on mineral oil is grey. When it reacts with water, for example from air humidity it reacts to NaOH which leads to discolouration which is white. One can wash NaH  with hexane or THF to remove the oil and to increase reactivity, but unter practical consideration I did not have problems with using it directly. Pure NaH is available, but be careful when using it. Ideally this is handled only under protective atmosphere, because it is very reactive and will violently react to even traces of water. When the oil is removed, the neat hydride appears to be white. I honestly don't believe that the mineral oil is the problem for the described problem, because it is inert. More likely are:

The solvent was not dry. This reduced the amount of available NaH. Increase equivalents and or additionally dry your solvent. For example with mol sieve. You could try to use not 1 eq but 3 and see whats the result.
The atmosphere was not water free. Use nitrogen or argon with a schlenk line and dry your flasks beforehand reaction.
Did you account for the 40 Percent oil? One can easily forget this and than you have 0.6 eq instead of 1 eq in your reaction. Consider this in your calculations.
Try to increase the time for deprotonation and check if this makes a difference.
You could try to prove full deprotonation by a reaction that consumes the nucleophile fully. Check afterwards by tlc or lcms.
If possible use THF instead of DMF. I know, this is not always possible, but solvents like DMSO and DMF are not recommended with NaH, these mixtures can lead to a thermal runaway.

Explosion Hazards of Sodium Hydride in Dimethyl Sulfoxide, N,N-Dimethylformamide, and N,N-Dimethylacetamide
https://pubs.acs.org/doi/10.1021/acs.oprd.9b00276
Answer: Washing in dry pentane was my first thought, too (already visible from the freely available abstract of eEROS).
Regarding the determination of the concentration of the active reagent: in the chapter about the selection of bases, Loewenthal's Guide for the perplexed chemist recommends to determine the active concentration of $\ce{NaH}$ by titration.  So, rapidly weigh-in a sample of $\ce{NaH}$ to check in 2-propanol, intentionally add water to quench it and then titrate back with a standard solution of aqueous hydrochloric acid, all under with good swirling.
Else, if you have advanced access to a NMR spectrometer, Hoye et al. re-introduced No-D NMR spectroscopy to determine the active concentration of metal organic reagents including metal hydrides.  For greater accuracy, you might want to modify (usually increase) the $t_1$ and $t_2$ times used to collect a routine $\ce{^1H}$-NMR spectrum which sometimes works easier on elder instruments (e.g., Varian200) than e.g., Bruker's Avance DRX.  The specific times of course depend on the specific signal in the spectrum monitored.  With 16 to 32 fid collected (classical/standard probe head) you easily collect the data you need within 10 min, then integrate reference and sample signal, etc.
Hoye, T. R.; Eklov, B. M.; Ryba, T. D.; Voloshin, M.; Yao, L. J. No-D NMR (No-Deuterium Proton NMR) Spectroscopy: A Simple Yet Powerful Method for Analyzing Reaction and Reagent Solutions. Org. Lett. 2004, 6, 953–956. https://doi.org/10.1021/ol049979+.
Hoye, T. R.; Aspaas, A. W.; Eklov, B. M.; Ryba, T. D. Reaction Titration: A Convenient Method for Titering Reactive Hydride Agents (Red-Al, $\ce{LiAlH4}$, DIBALH, L-Selectride, NaH, and KH) by No-D NMR Spectroscopy. Org. Lett. 2005, 7, 2205–2208. https://doi.org/10.1021/ol0506011.
Creary, X. No-Deuterium Proton (No-D) NMR as a Convenient Method for Analysis of Organic Solvents. J. Org. Chem. 2023, 88, 11545–11551. https://doi.org/10.1021/acs.joc.3c00807 (open access).


gcp console, trying to build a project and gives no disp space error

Question: I'm trying to build a golang project on my gcp console.  However when I run the build command I get the following error no space left on device, when I run the df command I see the following.
Filesystem                         Size  Used Avail Use% Mounted on
overlay                             60G   44G   17G  73% /
tmpfs                               64M     0   64M   0% /dev
tmpfs                              7.9G     0  7.9G   0% /sys/fs/cgroup
/dev/sda1                           60G   44G   17G  73% /root
/dev/disk/by-id/google-home-part1  4.8G  4.5G   38M 100% /home
/dev/root                          2.0G  1.2G  820M  59% /lib/modules
shm                                 64M     0   64M   0% /dev/shm
tmpfs                              7.9G  940K  7.9G   1% /google/host/var/run

I'm not sure how to interpret this, and is there something I can do to free up some disk space? I assume this is the location /dev/disk/by-id/google-home-part1?  I am trying to build the go project in the /home/user1/gopath directory.
Answer: The df command is showing that you have the /home directory full. You must free some space to use it.
Filesystem                         Use%  Mounted on

/dev/disk/by-id/google-home-part1  100%  /home


Can proper classes also have cardinality?

Question: In some set theories such as ZF+GAC, in which GAC is global axiom of choice, the Von Neumann universe $V$ bijects to $Ord$, the class of ordinals. It suggests us that proper classes may also have cardinality,in the example is $|V|=|Ord|$. In addition, if we are in ZF+GAC+ALS, it seems $|V|$ is the only cardinality which is not a cardinal number. Moreover, it seems some properties such as Cantor–Bernstein–Schroeder theorem also holds for cardinality of proper classes, but I'm not sure if it is well-defined and won't cause any paradox...
Comment: I think https://math.stackexchange.com/questions/2156812/why-doesnt-it-work-for-well-ordered-proper-classes is very related to this question but it doesn't show as related. That question is about defining order type of well-ordered proper classes and this one is about defining cardinality of proper classes.
Answer: Two sets $A$ and $B$ have the same cardinality if and only if there is a bijective function $f : A \to B$. If we identify the function $f$ with its graph $F = \{ \langle x, y \rangle \in A \times B\, :\, f(x)=y \}$ then we can reformulate this to say that $|A|=|B|$ if and only if there is a set $F$ such that

$\forall x \forall y \forall y' (\langle x,y \rangle \in F \wedge \langle x, y' \rangle \in F \to y=y')$
$\forall x \forall y (\langle x,y \rangle \in F \to x \in A \wedge y \in B)$
$\forall x (x \in A \to \exists! y(\langle x,y \rangle \in F))$
$\forall y (y \in B \to \exists! x(\langle x,y \rangle \in F))$

The first two of these tell you that $f$ is a well-defined function $A \to B$ (or, rather, that $F$ is the graph of a well-defined function $A \to B$), the third gives you injectivity and the fourth gives you surjectivity.
If $A = \{ x:\phi \}$ and $B = \{ y:\psi \}$ are classes, where $\phi,\psi$ are unary predicates, then $x \in A$ really just means $\phi(x)$ and $y \in B$ really just means $\psi(y)$. So I guess you could translate the above definitions to refer to classes instead of sets. More precisely, say $|A|=|B|$ if and only if there exists a binary predicate $F$ such that

$\forall x \forall y \forall y' (F(x,y) \wedge F(x,y') \to y=y')$
$\forall x \forall y (F(x,y) \to \phi(x) \wedge \psi(y))$
$\forall x (\phi(x) \to \exists! y F(x,y))$
$\forall y (\psi(y) \to \exists! x F(x,y))$

Notice that this notion of classes 'having the same cardinality' coincides with that of sets when we restrict to the case where $A$ and $B$ really are sets. However, unlike with sets, this is formulated by quantifying over formulae, so we have to work in the metatheory.
Also beware that this is a definition of 'having the same cardinality', not a definition of 'cardinality'; finding a good notion for the latter might be quite difficult.
Disclaimer: There's a chance that I'm going to be told that this is a load of rubbish. And indeed it might be, ZFC does weird things with classes. But it seems like one of the possible 'natural' extensions of the notion of bijection from sets to arbitrary classes.
Comment: No, I don't think this is a load of rubbish. Classes can be seen as unary relations over the set model, so maybe we can talk about it with Higher-order language. In detail, seems we can define it by $$Ep(X,Y) \leftrightarrow \exists  F(\forall x \forall y\forall y'( F(x,y) \land  F(x,y') \to y=y') \land \forall x \forall y (F(x,y) \to X(x) \wedge Y(y)) \land \forall x (X(x) \to \exists! y (Y(y) \land F(x,y))) \land \forall y (Y(y) \to \exists! x(X(x) \land F(x,y))))$$
Comment: In which $X,Y$ are unary predicate variable symbols of type (0), $F$ is a binary predicate variable symbol of type (0,0), and $Ep$ is a binary predicate symbol of type ((0),(0)).
Comment: Oh, this is only for classes of sets, so it needs to be reconsidered too.
Answer: There is absolutely no problem with extending the definition of a cardinal to classes, except that we cannot argue within the universe about cardinals of classes as we do for sets. Every argument of the form "All classes such that ..." would be a meta-argument. Of course, one can use a stronger set theory which allows classes, but that's a slightly different story.
Besides the above point, it is not very difficult to prove that Cantor-Bernstein theorem for classes (i.e. the existence of two injections implies the existence of a bijection). And so we can really ask whether or not there is a class function with such and such properties (injective, bijective, etc.)
It is important to note that just as when removing the axiom of choice it is possible that there are surjections which cannot be reversed, without global choice it is possible to have class-surjections which do not have an inverse injection. So it is important to stick to the definition by injections, because that definition works without any use of choice.
Comment: Well, in NBG you can write something about classes, but not about collection of classes. So you can't talk about the structure of class cardinals the same we can about cardinals in ZF. But NBG does make it somewhat easier to write something like "Every two classes have such and such property".
Comment: Well, seems you are right. Besides, can the universe about cardinals of classes be argued within NBG? It seems in that proper classes can be talked easier


Data cleaning for large sample data set in multiple linear regression

Question: I have 70,000 observations for my dependent variable. I have 12 independent variables. After removing zero value and error and missing value form my data set, my data reduced to 4000. Can I still do the multiple linear regression with this data set? I think 4000 data is more than enough for 12 independent variables, but I am not sure whether removing almost 90% of observations will harm my regression or not?
Answer: We'd probably need to know more about the nature of missing and the design of the study.
Generally, if the missing pattern is random, then your regression of n=4000 would still be representative. However, if the missing is associated with both outcome and exposure, then they will become confounders that are unaccounted for. In that case, even you have 4000 and only 12 independent variables, your regression results will very likely be off, over even plain misleading.
Having said that, you really need to explain why such a drastic cut. Some research designs invite a lot of missing. For instance, online questionnaires with price draw usually have this magnitude of missing. Most online respondents may just enter the survey, click through all questions without answering, and leave their e-mail to enter to lucky draw. Some other, like face-to-face interview, should never have missing this prominent.
If it's secondary data, then I'd recommend you to consult their study design documentation. Some study would only take a subset for further investigation, and may create an illusion that the others are all missing. For instance, a health study may collect all height and weight of the participants, but only random selects 10% of them for a blood test due to cost.
Studying the original questionnaire may also help. Some data may record N/A as missing. If you have accidentally chosen a question after a certain skip pattern, you may lose a lot of sample. For instance, there could be a question asking if the respondent had tried crack cocaine, and if yes, then there are a few more follow-up questions. If you have picked one of those follow up questions, big time missing can happen.
Based on what the nature is, you can address them differently in your report. But how and what to say about this problematic missing rate would depend on your study and the questions.
Comment: Thanks for your reply. Actually the data that I am working with is not from the questioneares, it's the data collected form GPS to record the place of the vehicle. there are several occassions when the GPS does not record the place of the vehicle, especially in CBD area. My independant varibles come from the GPS data, for example speed. Do you think this is the random missing pattern or not?
Comment: @rose If you know that the signals tend to be missed in CBD areas, then chance is it's probably not random. There are two points here: 1) if it's time series data tracking many travellers, then there are techniques and assumptions you can apply to estimate the missing values; and 2) because it involves spatial sampling, I think you should also revise this question with more emphasis on the spatial aspect, and consult the [GIS board](http://gis.stackexchange.com/). But do not copy and paste the same question, that'd be counted as cross-posting and is generally not recommended.
Answer: It's not a simple yes/no answer, but most people will be skeptical and will be hesitant to trust your study.
Non-random missing data are what would make it an issue. You can identify non-random missing data by making a new binary variable that identifies whether the case has any missing data across all your variables in the model. For example, if subject #1 has at least 1 missing data, identify subject#1 as "N". If subject#1 has the full set of data, identify as "Y". Now, you can compare the Y and N groups on all the variables you have in the model (use graphs). Look at the central tendency, as well as the spread. If there is any difference, it's a problem.
There may be one or two variables that are reducing your sample size by a lot. It's your choice, but you can identify those variables and remove them from the model to limit loss of data, especially if those variables are not as important as the others.
Comment: Thanks for your reply. As i am working with GPS data, whenever the GPS does not detect the location of vehicle, my depandant and all independant variables become zero, because the independant and dependant variables calculated based on GPS information.


$\epsilon - N$ proof of $\sqrt{4n^2+n} - 2n \rightarrow \frac{1}{4}$

Question: I have the following proof for $\lim_{n\rightarrow\infty} \sqrt{4n^2+n} - 2n = \frac{1}{4}$ and was wondering if it was correct. Note that $\sqrt{4n^2+n} - 2n = \frac{n}{\sqrt{4n^2+n} + 2n}$.
$$\left|\frac{n}{\sqrt{4n^2+n} + 2n} - \frac{1}{4}\right| \\
= \left|\frac{2n - \sqrt{4n^2+n}}{4(\sqrt{4n^2+n} + 2n)}\right|=\left|\frac{\sqrt{4n^2+n} - 2n}{4(\sqrt{4n^2+n} + 2n)}\right|\\
 = \left|\frac{n}{4(\sqrt{4n^2+n} + 2n)^2}\right| \leq \left|\frac{n}{4(4n)^2}\right| = \left|\frac{n}{64n^2}\right| \\
= \left|\frac{1}{64n}\right| < \epsilon \\
\implies n>\frac{1}{64\epsilon}$$
Comment: Seems quite right, though the final implication must be in the other direction.
Comment: It's wrong, for the reason Yves gave.
Comment: Did you finish this problem @user100000001?
Answer: You want to show that $\lim_{n\rightarrow\infty} \sqrt{4n^2+n} - 2n = \frac{1}{4}$. To do this, I would split up the analysis into scratch work and the formal proof.
For the scratch work, you need to find a suitable upper bound. You have done this by showing
\begin{align}
\left|\frac{n}{\sqrt{4n^2+n} + 2n} - \frac{1}{4}\right| &
= \left|\frac{2n - \sqrt{4n^2+n}}{4(\sqrt{4n^2+n} + 2n)}\right|\\&=\left|\frac{\sqrt{4n^2+n} - 2n}{4(\sqrt{4n^2+n} + 2n)}\right|\\&
 = \left|\frac{n}{4(\sqrt{4n^2+n} + 2n)^2}\right| \\&\leq \left|\frac{n}{4(4n)^2}\right| \\&= \left|\frac{n}{64n^2}\right| \\&
= \left|\frac{1}{64n}\right| \\&< \epsilon
\end{align}
which means that $n>\frac{1}{64\epsilon}$ is the upper bound.
For the formal proof:
Let $\epsilon>0$ (you need to fix $\epsilon$ as a small positive constant). It follows from $\frac{1}{\epsilon}>0$ that $\frac{1}{64\epsilon}>0$. Then by the Archimedean property there exists a $N\in\mathbb N$ such that $N>\frac{1}{64\epsilon}$. Then if $n\geq N > \frac{1}{64\epsilon}$, we have
$$\left|\frac{n}{\sqrt{4n^2+n} + 2n} - \frac{1}{4}\right|\leq \frac{1}{64n}<\epsilon $$
where the last inequality follows from
$$n\geq N > \frac{1}{64\epsilon} \implies n>\frac{1}{64\epsilon} \implies\epsilon > \frac{1}{64n}$$
Answer: Like the other commenters have mentioned, the implication is in the wrong direction. Since you want $|\frac{1}{64n}| < \epsilon$, you are required to have $n > \frac{1}{64 \epsilon}$. In other words, $n > \frac{1}{64 \epsilon}$ implies  $|\frac{1}{64n}| < \epsilon$. What you have written is the other way around.
Answer: You did the scratch work correctly. But I wouldn't call this a proof (of course it contains all ingredients of a good proof!).
You didn't introduce $\epsilon$. Of course, everyone knows what you mean but one should write it out if one wants to be fully rigorous.
So, your proof should read:
Let $\epsilon >0$. Let $N$ be an integer greater than --insert your choice for $N$ here--.
If $n \geq N$, we have
--insert your estimations here--
Thus, by definition of limit, the result follows. QED


DataTables in VisualForce Page, Setting swfPath as Static Resource

Question: I have been working with the DataTables library in VisualForce and have everything working except for the export features. I followed the sample initialization on the DataTables website, but am getting an error that ZeroClipboard.js is undefined in the TableTools.js file.
However, I have checked and re-checked multiple times and the zeroclipboard.js is listed as a resource in the Chrome.
The only thing I am doing differently, and was not able to determine in adapting the function to VisualForce was how to properly call the swf file. Currently I am hosting the file on a local server and referencing it explicitly in the function. Could this be my issue? The error above does not seem to be related, but it is the only thing left I think after extensive troubleshooting.
Does anyone know how I can make the swf file a static resource in Salesforce and call it that way from the function so the file is on the same server as everything else?
Below is my current function setting up DataTables (Question in reference to the swfPath: call, how do I do this with a static resource?)
<code>var oTableTools = new TableTools( oTable, {
    "sSwfPath" : "www.MyWebsite.com/resources/copy_csv_xls_pdf.swf",
    "buttons": [
                "copy",
                "csv",
                "xls",
                "pdf",
                { "type": "print", "buttonText": "Print me!" }
               ]
});
$('#demo').before( oTableTools.dom.container );
</code>

Answer: You can do this by uploading swf file(you can find this in the media/swf/copy_csv_xls_pdf ) as a static resource in salesforce and then accssesing it
For example
<code> oTable = $('#example').dataTable(
            {
                "iDisplayLength": 20,
                "sDom": '<C><"H"T><"clear"><"H"l>t<"F"ip>',
                "oTableTools": {
                "sSwfPath": "{!$Resource.SWF_File}"
                },
                "oColVis":
                {
                    "activate": "mouseover"
                },
                "bAutoWidth": false,
                "bJQueryUI": true,
                "sPaginationType": "full_numbers",
                "aaSorting": [[ 2, "asc" ]] ,
                "bLengthChange": false,
                "bFilter": true
</code>
Comment: The static resource SWF_File consists copy_csv_xls_pdf.swf


Having a difficult time figuring out if linear equations is true or false.

Question: I'm having a very difficult time figuring out if these linear equations are true or false:
$$
x + 2y > 6\\
x - y < 3
$$
How do you identify if these equations are true or false? At first I thought I was supposed to write out the solution, then once I get the answer I was supposed to say if it was true or false. Is that right?
I created this graph identifying both inequalies, but I just don't know how to figure it's true or not. If anyone could help that would be great.
Comment: A solution is precisely that which makes the linear inequalities hold true.
Comment: By checking false or true do you mean to verify if a point plugged in those equation to check if it satisfy it or not?
Comment: @mann Yes! I'm supposed to graph my answe after.
Comment: For that it's relatively simply Let us take your inequality $x-y > 3$ for example , and let's consider the points $(5,1)$ and $(3,1)$ If you plug in point one, you will get $5-1>3$ or $4>3$  , now is $4>3$? Of course it is hence the equality is true for $(5,1)$  , similarly for $3-1>3$ or $2>3$ , now is this true at all? NO! Hence the equality is false for $(3,1)$. In general you can do it for any point. @victoria
Answer: An equation (or, in your case, inequality) is not something that is true or false. An equation is something that can be either true or false, depending on the value of the variables that appear in the inequality.
For example, the inequality $\sin(x) > 0$ is true if $x=\frac\pi2$, but it is not true if $x=0$. Some inequalities, like $e^x<0$ are never true, and others, like $x^2\ge0$ are never false (for real values of $x$).
In your case, you probably need to find all of the values $(x,y)$ for which both your inequalities are true. To do that, I suggest you draw the sets
\begin{align*}
S_1 & = \{(x,y)| x+2y>6\}\\
S_2 & = \{(x,y)|x-y<3\}
\end{align*}
to see where they intersect.
Comment: I aligned the equations for sets $S_1$ and $S_2$ to make your answer more legible.  You can see how I did it by right-clicking on the equations, then selecting Show Math As TeX  Commands.
Comment: @N.F.Taussig Thanks for the edit. The tutorial is unnecesary, though (as 28k of experience should tell you :P)
Answer: A mathematical inequality, just like any other mathematical statement using a relation, can be either true or false based on a set of criteria. If the statement contains only numbers and no variables, then it is either true or false, definitively. For example, we always know that $0<2$ is true, or $2<0$ is false.
However, say we define a statement with a variable with a relation, like for example $x=2$. If I were to ask you if that statement were true, you'd probably be puzzled. What do I mean, is this true? What I'm really asking is, for what values of $x$ is this statement true? Trivially, we can see that if $x$ is 2, then the statement is true and if $x$ is 3 or 4 or any other number, the statement is false.
We can extend this to your system of inequalities the exact same way. We can't ask "is this system true or false" because the answer to that depends on our choices of $x$ and $y$. There are some values of $x$ and $y$ that will make the given inequalities true, and there are some values of $x$ and $y$ that will make them false.
In this case, we can solve for $y$ and try to visualize the region of solutions. Here we find $y > x-3$ and $y > \dfrac{6-x}{2}$. So then any point that is greater than those lines will satisfy either equation. When you graph the equation and found the overlapping areas of inequality, you find where both inequalities were true, and thus the system. Notice that there are some areas where no points work, this is where the values of $x$ and $y$ will produce false mathematical statements. For example, $x = 3$, $y = -1$ makes the system
\begin{align*}
-1 &> 3 \quad \text{False.} \\
-1 &> \frac{3}{2} \quad \text{False.}
\end{align*}
It gets a little more complicated to find the areas with multiple variables and dimensions, but essentially the same principles hold. It is also useful to note that there are systems of equations (and inequalities) that are always true (eg. $y^2 \geq 0, x^2 \geq 0$), and systems that are always false. (eg. $y > 0, y \leq 0$.) But most of the ones you find in applications are false and true in different regions.
Answer: Hint: It would be helpful to sketch the lines
$$
l_1\colon \quad y=\frac{6-x}{2}\\
l_2\colon \quad y=x-3
$$
and check when the following two conditions hold true jointly:
$$
y>\frac{6-x}{2}\\
y>x-3
$$
Comment: I just added a graph to my question if you would like to check it out.
Comment: Well @victoria, I got confused before, yes, that's correct!


Fitness Exercise Database / API

Question: Im looking for a online database / API where i can pull information about some fitness exercises with basic information like difficulty, name, how to do it, etc. I hope you get my point. I saw one question about this topic but i couldn't find any good results with the answers that were postet there so i thought i ask a new question with the faith that someone got something "newer" for me. appreciate any help :)
Comment: Hmmm.. it seems like USDA has most of the data you are looking for encapsulated in their `SuperTracker` tool at https://www.supertracker.usda.gov/physicalactivitytracker.aspx -- I would consider contacting them to see about getting the data behind this tool.
Answer: If scraping* is a possibility, ExRx has hosted a well-structured exercise website for a long time (19 years!)
From the Exercise Directory, each muscle group is clearly listed. For example, Upper Arm.
Each exercise is also clearly listed, for example, Tricepts.
In the HTML source of each page, you'll also see pretty clearly the text and images/videos that you may want to collect. For example:

Depending on your use case, web-scraping may or may not be a useful way to collect and use data.
Comment: From their terms: "Automated scraping or manual copying of content is prohibited"
Answer: Wger seems to provide an API for this, complete with info about the muscles exercised and the equipment needed.
Unfortunately, it doesn't seem like it offers an extensive repository of exercises.
Answer: https://github.com/yuhonas/free-exercise-db has around 800 exercises and can be downloaded as JSON.
https://rapidapi.com/justin-WFnsXH_t6/api/exercisedb/ also exists but it's behind a paywall after 400 requests each month.

Fitness Exercise Database / API


Open URL in NEW Microsoft Edge window

Question: I'm writing an application (using C#) which needs to open provided URL in a NEW window of a specified web browser.
The only browser I have problems with is Microsoft Edge.
Opening a page using browser exe doesn't work at all. Browser window does not even appear.
Process.Start("C:\Windows\SystemApps\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\MicrosoftEdge.exe", "https://google.com");

I've searched over the internet and found another way:
Process.Start("microsoft-edge:https://google.com");

This code opens the page, but attaches it to an existing window, if any.
Is there a way to open the page in a NEW window?
Answer: I am joining the line of desperate users of this program.
Here are my findings from today searching of such simple job (for normal browser).

Bat file - no go
Using direct call for microsoft-edge:"url" or calling for 3rd party utility is resulting all the same. Still working "nicely" but once you want more tha one site, it will add up another TAB.

    @echo

    EdgeLaunch.exe "http://www.idnes.cz"

    EdgeLaunch.exe "http://www.seznam.cz"

    exit

Sources:
EdgeLaunch: http://www.edgemanage.emmet-gray.com/Articles/EdgeLaunch.html
EdgeLauncher: https://github.com/MicrosoftEdge/edge-launcher

Power shell script
WARNING: as an research I am bypasing the security policy for the execution

    Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Bypass -Force;

    Start-Process -FilePath "msedge" -ArgumentList "http://idnes.cz"
    Start-Process -FilePath "msedge" -ArgumentList "http://novinky.cz"

FUN FACT: if you leave the URLs blank, it will open new-windows. Once you add valid url...again in tabs.

HTML-Javascript - seriously?!!! - nearly working
For all the shitty as it sounds. It is working nearly, but.
Such popups are normally restricted. And even when I 20 times allowed pupus from local html file. Edge somehow ignores this eevery new startup. (omfg)

But, ok classic HTML structure, and a script on the page with:
 params  = 'width='+screen.width;
 params += ', height='+screen.height;
  params += ', top=0, left=0'
 params += ', fullscreen=yes';
 params += ', directories=yes';
 params += ', location=yes';
 params += ', menubar=yes';
 params += ', resizable=yes';
 params += ', scrollbars=yes';
 params += ', status=no';
 params += ', toolbar=yes';
 params += ', show=yes';

window.open("http://idnes.cz",'window1', params);
window.open("http://novinky.cz",'window2', params);

Desperate fact: It opens the windows on a second manual attempt. But. Once you set "status=yes" attribute. It will again be the TAB.
Thats all I got from internet. Nobody with solution of simply opening 2 damned windows with some webpages.

Open URL in NEW Microsoft Edge window


How to calculate the distance of multiple points to a line in QGIS

Question: I'd like to do a regression analysis of magnetic susceptibility measurements taken at several sample points to a nearby road. The purpose is to see if proximity to the road correlates with higher magnetic susceptibility. For this to work I need to know how far each point is from the road. I've added a vector line over the road to provide something to measure against. Can anyone recommend how I should proceed from here. Ideally I'd like something that will measure all of the points en mass as it would be tedious to measure each one individually. I tried the distance matrix but it can only measure the relationship between points, not between points and a line.
Answer: Your measurements are a point layer, if I understood correctly. Create a new attribute on this layer with Field Calculator with this expression and replace line_layer with the name of the line layer. The expression looks for each point which is the nearest line on the layer line_layer, then identifies the cosest point on this line and returns the length measurement to the current point:
distance(
    $geometry,
    closest_point(
        overlay_nearest ('Output least cost path',$geometry)[0],
        $geometry
    )
)


Can a photon attract another photon?

Question: Now since Photons have energy too, is it possible for these particles to gravitationally attract each other.
Comment: Related: https://physics.stackexchange.com/questions/6197/do-two-beams-of-light-attract-each-other-in-general-theory-of-relativity
Comment: https://physics.stackexchange.com/questions/22876/does-a-photon-exert-a-gravitational-pull?noredirect=1&lq=1
Answer: Photons are not "particles", in the sense that they are not objects. They have some particle properties, that are referenced as such in order to do calculations and make predictions treating the photon as if it were a particle. The photon is the unit or quanta of the redistribution of the electric field when the source or sources of the field move. As such, it doesn't make any sense to think of this as an object, the photon and the electromagnetic wave is just a mathematical description of this realignment.
It is certainly possible for electromagnetic waves to interfere with one another, but this is very different from gravitational attraction.

Can a photon attract another photon?


Amount of carbon captured in photosynthesis by a plant

Question: Is it more proportional to the mass or the volume of the plant? I thought it might be helpful to think on the cellular level here. Even a reference to an external explanation would be useful.
Comment: Welcome to Biology.SE! Unfortunately, I'm having some difficulty understanding the context of your question. Can you please elaborate on the background of this question and why the standard description of carbon capture hasn't solved this problem for you?
Comment: I guess I'd loved a unified explanation on the level of cell biology. I mean I've phrased the question in what I thought was a pretty good way. Why can't I find it? Even a link to your favorite technical resource would be lovely. Search engine optimization is not doing it for me
Comment: The effective carbon capture of a plant involves not just the plant itself but the system that it is part of. Perhaps start by reading up on carbon farming and see if what you find either answers the question behind your question or else allows you to refine it to be more answerable? https://en.wikipedia.org/wiki/Carbon_farming
Answer: Welcome to Biology.SE! I am not entirely sure what your are asking but here are some places you might want to start:
Photosynthesis Molecular Biology
If you want to know about the number of sugar molecules created 'per photon' by photosynthesis you can explore the light-dependent and light-independent reactions used in photosynthesis. In particular you might want to look at the Calvin Cycle and how NADPH is used there and how NADP is reduced to NADPH in the light-dependent reactions.
Carbon Capture Efficiency
You might be interested in the variation between plants in carbon capture efficiency, i.e. not all plants are equally 'good' at photosynthesis. To think about this you might want to look at different photosynthesis mechanisms (C3 vs C4 and CAM; different forms or amounts of Rubisco enzyme) or you might want to look at sunlight 'capture' mechanisms (photosystem I and II and the accessory pigments like chlorophyll and carotenoids) or even at adaptations to different light environments (trichomes, leaf shape, etc).


SIM800L V2 not responding to AT Commands from Putty over USB-To-TTL PL2303

Question: My SIM800L V2 RoHS (the blue one) although it connects to the network and registers just fine, it's not responding to AT commands sent over the PL2303 (USB-STC-ISP) USB-To-TTL Adapter through which it's hooked up to the PC, I used multiple Serial communication software/terminal (Putty, RealTerm, Termite, eltima serial port monitor...etc) and i made sure that every terminal would send using both NL and CR (CR/LF as it is labeled in some of them, basically "\r\n" at the end of each command) and i also tried communicating over most common baudrates (9600, 115200, 57600, 38400, 19200...etc) but none of them got a response so the terminal/software being used is not the problem, so i thought maybe the problem is with the PL2303 so i tested it using the loopback method (connecting Both the TX and the RX of the adapter to each other) and i got a response through Putty, i also connected the ground (GND) of the adapter to the second ground (GND) pin of the SIM800L module (as showen in the diagram below) but still nothing, so i'm not sure what the problem is exactly. I hope somebody can help me here, that would be very much appreciated, thanks in advance.
Comment: Did you try swapping TX & RX?
Comment: @brhans Although it didn't make since but i already tried that, and still no response.
Answer: First thing to do is open the datasheet of the sim800l and ckeck that your board meets the requirements for the serial port. There are different recommended designs based on the voltage of the supply.
Next, is your ac/dc adapter outputing the same voltage as the logic level of your serial to usb adapter?
From the datasheet again, the module might be in auto baudrate detection, in which case it wants to recieve "AT" before anything else.
I see two different ground sources connected together here, which is dangerous for ground loops. you could have damaged your device doing that depending on the design they did.
If everything checks out and your supply to the module is good, I would plug a logic analyser on tx and rx to see if anything happens there.
Comment: The Gnd points are connected together on the board, this is not a problem. This is very typical for USB connected peripherals with power pack supplies.
Comment: @AntoineLev thanks for the response, first, i couldn't find the datasheet for this model but based on bits of info i gathered from the internet, yes this sim800l meets the serial port requirements and already has a built-in regulator circuit and TTL level converter on board so it would work fine on 5v (btw the ac/dc adapter is 5v 5a), second for the auto baudrate, again no datasheet however the command i'm using to test it is the "AT" command, third for the ground loops thanks for warning me i didn't know that, but i tried connecting them both to the adapter ground but that didn't help.....
Comment: ....finally for the logic analyzer, i don't own one and don't know of any way i can get my hands on one atm, is there any other way i can test this?
Comment: @JackCreasey thx for the clarification, at first i didn't connect the gnd pins but then i read on a forum that they both need to have a common ground in order to be able to communicate properly.
Comment: as jack said the ground is probably ok, It was just things from the top of my head I would check in your position. Here is the datasheet : https://img.filipeflop.com/files/download/Datasheet_SIM800L.pdf
Comment: thanks for the datasheet, i had a look at it, but couldn't find anything of use since it's the datasheet of the chip not the module.
Answer: SIM800L won't respond to AT commands
I'd suggest you do the following:

Connect RxD and TxD on the USB-->serial adapter together (not connected to the SIM800L)
Use whatever software you use on the PC to check the adapter operation. You have a loopback so anything you type in should be reflected on the screen.
Ensure the power supply for the SIM800L is between 3.7 and 4.3V (it won't work at 3.3V and may catastrophically fail at 5V). The supply must be able to provide peak current of about 2A when connected to the network.
Connect the serial connections (you appear to have them correct).
Configure you serial connection to send CR/LF.
Send atCR/F or ATCR/LF twice. You should get AT?CR/LF echoed back.

The modules are nearly universally shipped with autobaud turned on. It would be highly unlikely to see any other configuration.
If you have EVER had the module supply connected to 5V, it is likely the module is burned. However, the serial pins are able to connect to both 3.3V and 5V serial pins without damage.
Comment: I tried everything you mentioned, the loopback test, the power supply is 5v5a (I tried 5v2a but that wasn't enough current for some reason), this module is supposed to be able to handle 5v since it has built in regulator circuit, as for the commands you mentioned, those are the commands I've been testing with, and I tried sending both of them twice with no results. So basically the only two possible solutions I can think of are, first resetting the module through the reset pin, however I don't think that would do much....
Comment: .... Second, buying a new one and testing if the current one is defective, but I'm not sure if only the tx and rx pins can suddenly start malfunctioning, I'm guessing if that happens it would affect the whole module and it wouldn't even turn on, but it's still a possibility. However there's a third situation that I can think of which is that I'm not connecting the module with the ttl USB adapter correctly, if anyone has any insight on that please elaborate.


Revert error is calling when it shouldn't be in React front end with ethersjs

Question: I am creating a crowdfunding dApp and am trying to figure out why a revert error is being called on the pledgeToCampaignfunction every time I click a button to pledge ether. I'll lay out the error, my React code, and Solidity code for the function being called.
Here is the full error I get when I click the "Pledge" button that calls onclick={pledgeToCampaign}:
Error: cannot estimate gas; transaction may fail or may require manual gas limit [ See: https://links.ethers.org/v5-errors-UNPREDICTABLE_GAS_LIMIT ] (reason="execution reverted: Has ended", method="estimateGas", transaction={"from":"0x90BadE35Da052450B01e99b38Cbb550BC3f1dD58","to":"0x882978f7Afef5bc38c73461f4Bf096e5dF03Ef5C","data":"0x1f6dbc500000000000000000000000000000000000000000000000000000b5e620f48000","accessList":null}, error={"code":-32603,"message":"execution reverted: Has ended","data":{"originalError":{"code":3,"data":"0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000948617320656e6465640000000000000000000000000000000000000000000000","message":"execution reverted: Has ended"}}}, code=UNPREDICTABLE_GAS_LIMIT, version=providers/5.7.2)
    at Logger.makeError (index.ts:271:1)
    at Logger.throwError (index.ts:284:1)
    at checkError (json-rpc-provider.ts:79:1)
    at Web3Provider.<anonymous> (json-rpc-provider.ts:644:1)
    at Generator.throw (<anonymous>)
    at rejected (json-rpc-provider.ts:1:1)

The revert error Has ended doesn't make any sense because the campaign I am trying to pledge to is active and the end date isn't for another month. I know that the pledgeTo function on the smart contract works properly because on Etherscan I can pledge to this same campaign ID without an error.
Here is the Solidity code just in case:
  // Function to pledge to a campaign
    function pledgeTo(uint _id) external payable {
    Campaign storage campaign = campaigns[_id];
    require(block.timestamp >= campaign.startAt, "Hasn't started");
    require(block.timestamp <= campaign.endAt, "Has ended");
    // Prevent reentry
    campaign.pledged += msg.value;
    pledgedAmount[_id][msg.sender] += msg.value;
    // Emit Pledge
    emit Pledge(_id, msg.sender, msg.value);
    }

My theory is: I am not properly passing the campaign ID to the pledgeToCampaign function. Meaning it's trying to pledge to the 0 campaign, which has obviously expired. Instead of the campaign that I would be currently trying to pledge to, which in this case is 6.
Here is my React function to call the writeable function pledgeTo from the smart contract:
// I separated all the writable functions in a separate configs file to export
// Imports for ethers and Contract ABI

// Pledge to a campaign
export async function pledgeTo(signer, amount) {
  const factory = new ethers.Contract(contractAddress, CrowdGaming.abi, signer);
  return factory.pledgeTo(amount);
}

I believe my error is I need to pass an id as an argument/value because on Etherscan, I have to pass an id and the amount in ether in order to submit the pledged amount to the campaign. But I'll explain why that doesn't work for me:
On my front-end, here is how I set up the pledgeToCampaign function:
// imported the pledgeTo function from configs

  // Pledge to campaign
  async function pledgeToCampaign() {
    const amount = ethers.utils.parseEther(
      document.getElementById("eth").value,
      "ether"
    );

    try {
      const tx = await pledgeTo(signer, amount);
      setTxHash(tx.hash);
      console.log(tx.hash);
    } catch (err) {
      console.log(err);
      setErrMsg(`Uh oh, an error occurred!`);
    }
  }

I have an input field for someone to enter an id number and then the code properly displays that campaign.
  // Get campaign by ID
  async function getCampaigns() {
    const id = document.getElementById("id").value;
    // ethers contract METHODS
    const campaign = await contract.campaigns(id);
    setCampaign(campaign);
  }

But when I try to add const id = document.getElementById("id").value; into the pledgeToCampaign function, specifically at the line:const tx = await pledgeTo(signer, id, amount);, I get an error that says there are 1 too many arguments, as it expects 2.
When I remove the signer from both the pledgeTo and the pledgeToCampaign functions, I get an error that says requires signer.
So to summarize, I believe my issue lies in not properly calling the right id into the either the pledgeTo and/or pledgeToCampaign functions, as it's probably just trying to pledge to campaign 0 every time.
If anyone could help me solve this that would be great!
Answer: You should use const tx = await pledgeTo(signer, id, amount); and modify the function like this:
// Pledge to a campaign
export async function pledgeTo(signer, id, amount) {
  const factory = new ethers.Contract(contractAddress, CrowdGaming.abi, signer);
  return factory.pledgeTo(id, {value: amount});
}

Notice that to send ETH like msg.value, we need to write the amount separately like this {value: amount}. You can also add additional parameters like gasPrice and gasLimit in the same way (they are optional though):
  return factory.pledgeTo(id, {
    value: amount,
    gasPrice: ...,
    gasLimit: ...,
  });

Comment: That worked and makes sense! Thank you!


Searching for text in sql server stored procedures

Question: I have created a program that allows me to search for keywords inside the code of stored procedures, functions, tables etc. in SQL Server generated text files. I am looking for a way to find out where a search term (i.e "ADMIN.TABLE) is being referenced in all the code files. I use LINQ to find references. For example when I search for ADMIN.TABLE, I will list the name of the text files that contains a referenceto the search term "ADMIN.TABLE" somewhere in the text. However, the search is not absolute in that unless you include different variations of the ADMIN.TABLE you will not find all references. So to find all references I need to do something like this:
1) Search for "ADMIN.TABLE"
2) Search for "[ADMIN].TABLE"
3)Search for "ADMIN.[TABLE]"
4) Search for "[ADMIN].[TABLE]"
I am thinking of using a regular expression pattern, but I am not sure how to construct one that will cover the different combinations listed above. Any help would be appreciated.
Regards,
Tor
Answer: I think you may be reinventing the wheel a bit. Have you looked at sp_depends? I will list all of the objects which depend on a specified table.
I realize that you're working with text files, but if you could generate the sp_depends results along with the scripts, that might solve your problem.
Answer: Try this, it will loop through all the files in a directory and scan them using a case-insensitive regular expression (you could change the Directory.GetFiles call to only search the directory without checking sub directories by changing the search option):
<code>        string pathWithSqlFiles = @"c:\sqlfiles\";
        string[] files = System.IO.Directory.GetFiles(pathWithSqlFiles, "*.sql", System.IO.SearchOption.AllDirectories);
        string regexToSearch = @"\[?admin\]?.\[?table\]?";
        foreach (string file in files)
        {
            string fileText = System.IO.File.ReadAllText(file);
            System.Text.RegularExpressions.Match match = System.Text.RegularExpressions.Regex.Match(fileText, regexToSearch, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
            if (match.Success)
            {
                // do logic to handle the matched text
            }
        }
</code>
Answer: Eh... ? means match previous group 0 or 1 times.  Both [ and ] have special meaning, so you have to escape them with .  So:
<code>new Regex(@"\[?ADMIN\]?.\[?TABLE\]?")
</code>
Would do was you ask.
Answer: If you are not set on how to go about it, you may want to parse the sql scripts and then use the object model to specifically find schema=admin && table=table.
Option 1:
Generate the estimated query plan and parse the table references out of it. If you're on sql 2005+ you can get it as xml and query like:
<code>;WITH XMLNAMESPACES (default 'http://schemas.microsoft.com/sqlserver/2004/07/showplan')
select
    t.n.value('./@Database', 'sysname') as DatabaseName,
    t.n.value('./@Schema', 'sysname') as SchemaName,
    t.n.value('./@Table', 'sysname') as TableName,
    t.n.value('./@Column', 'sysname') as ColName
from @x.nodes('//ColumnReference') as t(n)
go
</code>
Option 2:
If you want to do this work on the client side and have sql2008, add a reference to C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Microsoft.SqlServer.SqlParser.dll and do like
<code>    SqlScript script = Parser.Parse(@"create proc sp1 as select 'abc' as abc1");
</code>
Then you can process script.Xml and look for a node like
I'm sure you can find it strongly typed in the object model too since I see SqlTableRefExpression in the assembly, but I'm not positive where to drill down to.


What's the real benefit of meta-modeling?

Question: After reading several texts about meta-modeling I still do not really get the practical benefit. Sometimes I think it is only an interesting mind game but no useful tool. Sure it is wise to clarify your modeling vocabulary: some may say class where others say entity or concept, but this is just simple documentation your modeling terminology. Meta-modeling, as I understand it, is more complex, as it tries to formalize and abstract modeling. Some good examples are  Keet's formal comparison of conceptual data modeling languages (UML, ERM and ORM) from academia and the Meta Object Facility (MOF) from industry. To me MOF looks as impractical as CORBA, which was also created by OMG. In theory you could use meta-modeling to transform and integrate models in different modeling languages, but is anyone actually doing this?
Comment: all those **Big 3** consultants need some reason to bill those big dollar hourly wages! Think of them!
Comment: The real benefit of meta-modeling is describing large systems. For small systems, I think that class diagrams suffice.  But it takes a good architect to keep things as simple as possible, even in large systems.  CORBA is the poster-child for what happens when systems are over-architected.
Answer: I can give you an example of when meta-modeling was useful at my workplace. In the 1990s, the company where I worked grew quickly by acquisition. With each acquisition, new staff, systems, databases and data were added. By 2004, the IT department employed almost 5,000 people and had a yearly budget of 10^9 USD. Many of the smaller companies we merged with had their data in MS Access, MS Excel, Fox Pro. Many of the large companies had flat files on the mainframe, hierarchical databases, huge DB2 installations running on OS/2... and everything else under the sun. Other than the general ledger, no serious attempt was made to consolidate any of this data.
At some point in time, someone woke up and realized there little control of corporate data and that the lack of control represented a huge risk to the company. It was time to clean house! But where to begin? Even a simple idea like "customer" meant something different to every group. The "customer" entity used by the legal department had almost no overlap with the "customer" used by the sales office, and those "customers" had nothing to do with the "customer" used by finance. How do you sort out a mess like that?
The approach we took started with backing up a step. Rather than put 30 people in a room and watch them fight for their own definition of what "customer" meant, we started with meta-modeling. We tackled questions like "what is a semantic attribute?" or "what are entities and how should their names be formatted?".
It was easier to gain consensus about abstractions like "class" and "relationship" than about actual operational data. But once the stakeholders had consensus on fundamental terms, we could move down the latter of abstraction, gradually getting more and more concrete. Eventually we had a common framework for describing corporate data and were working toward a common data dictionary.
Comment: Thanks, that's a good use-case and sounds usesfull: analysis of *existing* systems instead of top-down über-modeling for planned systems.
Comment: I think meta-modeling might be useful in certain circumstances for planned systems. If there are many people designing the data system and each person has a different ideas about how the design should look, meta-modeling could still be used to build consensus and ensure consistency. See Robert Harvey's comment from November 2011.
Answer: You have different layers of abstractions. MOF is the highest, then using a transformation you get UML or BPM models, then views. Modelers usually talks about M0,M1..M3
I think that with new technologies traditional barriers between metamodelling and modeling is disappearing. Let's consider EMF (eclipse modeling technology). Ecore is a kind of MOF then using EMF serialization you get an UML model, then using GMF you get graphical representations.
Comment: I agree that EMF is only for developers and using EMF tags in the java code in order to keep a model live synchronize with the code is not what should be done. You can try Omondo metamodeling which has totally changed EMF core in order to adapt it to UML. I mean that you create your graphical views, java code and a single model directly in xmi. The graphical diagrams are extracted from the saved xmi which is also the model.
Comment: Do modelers actually create meta-models on M0? As far as I understand EMF and Ecore, it is hard-coded in the software. You make use of XMI to create concrete models, but you never do meta-modeling (unless you are one of the developers of EMF).


Converting Hunter: The Vigil to nWoD 2nd Edition

Question: I would like to run Hunter: The Vigil with the God Machine Chronicle rules. Hunter has not yet been updated yet for the new rules, but how hard would it be to convert the rules a bit myself? The PCs in Hunter a pretty much mortal, so I am thinking the rules would follow the core book more closely anyway? Can someone tell me of potential issues I would run into by doing this? Thanks.
Comment: It looks like I can maybe use the "Mortal Remains" rules on http://rpg.stackexchange.com/tags/nwod-god-machine/info to do a conversion?
Answer: The book Mortal Remains contains rules for updating Vigil to 2.0 rules, as well as Dread Powers for monster types not covered in the other books.
Use those conversion rules.
The only real issue you would run into if you don't use the Mortal Remains rules is how to adjudicate Integrity with Hunters' ability to replace "morality sins" in service of the Hunt.
Comment: mmm... as an adendum mortal remains updates all of the Endowments, though the tweaks are minor, it also updates Practical XP to the Beat system. However the biggest hunter things, such as Profession, was moved into Core in GMC, so...


Gnome Terminal appearance

Question: Is it possible to get the gnome-terminal in GNOME 3 to be borderless, similar to how urxvt looks? Without the big top of it that says Terminal with your working directory or the menu bar?
Answer: You can disable the menu bar for gnome-terminal in its application menu (in Gnome 3 this is a drop down in the top bar). You can also edit your default profile to not include scroll bars, the menu bar, etc in net terminals.
Beyond that, the window chrome (the border, title bar, etc) are decided on and drawn by your window manager (in Gnome 3 this is Mutter). I don't think there is an easy way to make Mutter not draw borders on some windows, but you can check the Gnome extension library for something that does that.
Comment: This is not about the menu bar, but about the header bar. The version in Ubuntu 20.04 (I saw that your answer is much older than that), gnome-terminal draws the header bar, and its own window borders, even though I am not in Gnome. I suppose Gnome considers that the use of gnome-terminal outside of Gnome is unsupported.
Comment: @Gauthier I'm quite aware what the question was. The thing you are calling the header bar is still considered window decoration and drawn by system libraries not the app. The situation has changed since this answer now that CSD (Client Side Decorations) are a common thing. How to turn them off now in Gnome (or on behalf of Gnome libraries no matter your DE is) I don't know. I can say that when I run `gnome-terminal` on my system under `awesome` that there is not only no menubar (because I disabled it) but there is no header bar or other decorations (which I have disabled in Awesome WM).
Comment: Thanks for this clarification! I'm in a similar situation, where my xmonad and dwm have never drawn title or header bar for me. I recently ran `startx` manually from a tty (ctrl+alt+f3), and since then my gnome-terms in xmonad displays header bars and window borders. But not in dwm?!
Comment: @Gauthier I think the way this works is that the toolkit libraries (GTk/Gnome stuff that draw the window in this case) first *ask* whether the DE is going to draw decorations or not. If it gets told no, then it draws them itself. If it gets told yes, it doesn't do anything — which is what your `dwm` and my `awesome` are telling it. Even though they don't plan an drawing decorations themselves, they tell apps that it's taken care of so they don't try to take it on themselves. I'm sure there is a way to toll the libraries to always assume a yes answer too, but I don't know what that is.
Answer: Enabling compiz, will give a large selection of effects like borderless windows.
I am using Terminal without window border also, I don't use compiz, but when I open my terminal window, I click on F11 to make it full screen.
If you want to hide the menu bar also, click on : "View" -> disable "Show menubar".

Gnome Terminal appearance


Effectively using singing games for vocal training

Question: What are productive ways to use the "Rock Band" video game as part of a vocal training regimen?
Are there any bad habits/practices that singing along with this type of game tends to promote?
Comment: I believe that this is different from [this similar question](http://music.stackexchange.com/questions/6219/is-it-possible-to-use-video-games-to-help-improve-ones-singing)  in that the answer, will (hopefully) focus on how to make the best use of these games.
Answer: I'm not sure how far a vocal game will get you, at least the ones that exist now. The main problem  is they cannot give you feedback beyond pitch (and maybe rhythm). So any errors or deficiencies in technique may never get corrected.
That said, if you have a basic understanding of technique already, then games could be a fun way to practice.
Answer: You'll have to have a basic understanding of vocal technique in order to have any chance of improvement as they do not provide any advice and vocal coaching. I would recommand personnaly to take lessons or online lessons. Self-teaching yourself singing could get you real bad habits which could impact your progress dramaticaly.


Can berryboot detect an already-existing OS on a USB drive?

Question: A simple question, I hope:
I have one Pi and I'm thinking about getting a second one, and would like to do as much preparation as I can before the second one arrives.
If I use berryboot on a Raspberry Pi to install an OS to a USB hard drive, and then move that USB hard drive to a second Raspberry Pi, will berryboot be able to detect the already-installed image so that I can select it without initiating a new install?
Answer: I don't know, if this is still of your interest.
I have a pi with Raspbian installed on an external HD.
Just got a PI2 and didn't want to make a complete new install.
So I did the following.

Backup everything to a PC with rsync
used rsync to copy SD-Card to a new Micro-SD
download the newest berryboot ZIP for PI2
extracted the content and copied with overwrite everything to the Micro-SD
started the PI2 and skipped every Option (choosing Cancel or X)
ended up in berryboot with blank OS-List
opened cmdline.txt and added datadev=sda1 qmap=de (you may change this to your needs)
restarted the PI and - voila - it shows up my Raspbian on SDA1 and also boots into it
Answer: TL;DR: you'd have to move the original BerryBoot SD card with it, but it should work.
From the way I read the documentation, it doesn't appear that BerryBoot can auto-detect what OSes are installed on a hard drive. In that sense, you wouldn't be able to install BerryBoot on a new card and get it to autodetect an already-installed image.
However. If you used the BerryBoot card that you originally installed the OS with in the new Pi, then yes, it's almost guaranteed to work! All Pis of a given model have the same hardware, more or less.
If you wanted to swap the HDD back and forth between Pis, you'd either have to keep swapping the one BerryBoot card OR clone the card using something like dd.
Comment: you could also clone just the BerryBoot partition onto a new card
Comment: I guess I could clone the original card, but I've got a whole other OS there that doesn't need to be on the new pi.  Maybe I'll suggest this as a feature request for the berryboot devs.  Alternatively, I could just install my new OS on the hard drive, configure-as-desired, back up all the changed files.. then install on the second pi from scratch and restore the backed-up files. Clunky and probably wouldn't save any time, but feasible.
Comment: Yeah, or I could just buy the new sdcard in advance. There are solutions. I was just hoping I could do it the laziest way :)


What is a good sugar substitute for baking?

Question: I'm curious about what I can use for a sugar substitute while baking. I'm not interested in artificial sweeteners. For instance, I've found that apple juice works well in some muffins. Are there any substitutes that work particularly well with other baked goods? Any general rules for selecting a substitute?
Comment: Does "sugar" mean table sugar or sucrose here? Or do you include all mono- and di-saccharides and generally those that impart sweetness and humans can metabolise such as glucose, fructose, lactose... ?
Comment: apple juice like most juices is just a big pile of sugar with some water in it.  Your body doesn't have the slightest clue whether the sugar is from juice, coke, or a big spoonful from a bag.
Answer: It's going to depend greatly on what you're baking.
Sugar serves several different purposes beyond just providing sweetness.  Besides sweetness:

tenderness by interrupting and minimizing gluten formation.  Sugar promotes spread in cookies
Retain moisture and extend keeping quality (in baking sugar is actually considered a "liquid" ingredient due to its hygroscopic qualities - the ability to pull moisture from it's surrounding atmosphere).
Promotes browning and caramelizing
Assists in aeration and leavening (as in creaming butter and sugar to aerate the dough)
stabilizes egg whites
Provides food for yeast growth and fermentation

In some instances you might be able to use a syrup (honey, corn syrup, molasses, etc.) but not in all cases.  For instance the granular nature of sugar is necessary for aeration of cookies and cakes because the jagged edges create air pockets as they pass through the fat.
Syrups primarily serve the purposes of sweetening, browning, and moistening.  Honey could be used in muffins that are being made using the muffin method (aka two-bowl method) because this method would use a liquid fat (melted butter/oil) but not in the creaming method (producing a more cakelike structure from the creaming process).  When using syrups you have to account for the addtional moisture that they provide.
From:  "How Baking Works" (Paula Figoni)
"The National Honey Board recommneds the substitution for using honey in place of granulated sugar.  This accounts for both the amount of water in honey and for its intense sweetness:  use 1 pound honey in place of 1 pound granulated sugar; reduce water (or other liquid) in the formula (recipe) by 2.5-3 ounces."
Overall, when making substitutions of ingredients that are critical to the structural and eating qualities you probably will not be able to replicate the same results with the substitution.  In the end, it will often be a case of "what is the next best thing" and realizing there will be quality differences in the finished product.
Comment: Let me know how your experiments turn out!
Comment: Great, that's something to chew on. I think I see some experimentation in my baking future. Thanks for the info.
Answer: Stevia is a natural sweetener that doesn't contain sugar.
http://en.wikipedia.org/wiki/Stevia
It's been getting a lot of attention in the low carb camp lately.
Comment: yes, Stevia is extremely sweet but it will not work the same as sugar in baking.
Answer: I have just been reading "Naturally Sweet", a cook book by America's Test Kitchen. I got it from a local library. It explains how their cooks went through a lot of recipes and tried to find alternatives to baking with processed cane sugar. They found that using alternatives not only affected taste, but also texture in baked foods.
The beginning of the book explains the cane sugar processing process, and also explains the alternative sweeteners the cooks used. Some substitutions were honey or fruit like ripe bananas. But, others were Sucanant and coconut sugar. These latter alternatives are a lot more expensive than processed cane sugar. In some cases, the cost was almost ten times more expensive from my store research.
Then in each individual recipe the authors/cooks explain how they tested the recipe with alternative sweeteners and what other ingredients they found they needed to add. For example: the granola bar recipe needed a binder. They found that using Sucanant somewhat bound the ingredients when it melted during baking; but, they added egg whites to make the binding better.
I think the book is definitely worth getting from a library as it has a lot of recipes, and also because it has explanations about the different sugar substitutes and their testing processes.
I should also note that in each recipe the authors/cooks list the opposite substitution. That is, they give the changed recipe using the alternative sweetener, and then list the cane or brown sugar equivalent of what you could use instead. The authors/cooks also list the different amounts of sweeteners you need to use as it is not a 1:1 ratio.
I want to try some of the reworked recipes and see how the step by step testing process of altering the recipes by using substitute sweeteners and added ingredients make a taste difference in the end product. I plan to use the recipes that use honey or fruit, not the expensive substitutions like Sucanant. One reason I want to try some of the recipes because one review I read said that the chocolate chip cookie recipe was really outstanding.
Answer: I know you are not vegan, but Isa Chandra Moskowitz has terrific baked goods recipes that often use maple syrup, with fantastic results. http://www.theppk.com/
Answer: My basic wheat bread recipe calls for either sugar or honey; the differences are subtle.  However, the extra moisture of the honey is overwhelmed by the variation in how much flour it needs from batch to batch; more precise recipes may require a bit of tweaking.
If it's glucose that you need to avoid, fructose works really well in most cases, particularly because it can be obtained as the same white granules.  It's sweeter than sucrose, so you usually want to cut the amount by about a quarter.  That has the side effect of reducing some of the calories from your baked goods, but can affect texture or browning in certain recipes.  The differences are more pronounced in candies and ice creams, but baking should be just fine.
Answer: Splenda sells bags that work 1:1 as a sugar substitute (though sometimes i seem to need more). Doesn't taste quite the same but I think it's better than eating sugar.
Comment: Yes the do but even the Splenda folks indicate that Splenda is best used where it's only needed as a sweetening element such as custards, gelatin, etc.  I assisted the foodservice division a couple years ago during some training they were doing for field sales managers and the main message was that it will not assist in browning, rising, or caramelizing.  For instance you could use it in custard but if you're wanting to do creme brulee, you couldn't use it for caramelizing.

As substitutions go I'm more comfortable eating the real thing and cutting back on portion size but to each their own.
Answer: If you intend to use it primarily fro sweetening, moisturization or browning, you can use date syrup. Around here it's called Silan. It's somewhat similar to honey in texture, but has a darker colour, and lacks the sharp after-taste of honey, and is made of dates.
I'm not sure how it caramelizes, and I suspect it wil do you no good for aeration or stabilizing egg-whites.
I don't really bake (bad at chemistry) but I do use date syrup for sweetening recipes when cooking. It's actually very sweet, and I find it easier to work with than sugar.
Answer: Agave Nectar is a great alternative to sugar.
It may be used to replace any wet sweetener such as honey or corn syrup, but consider that it is sweeter than honey so reduce the amount used by about half depending on your tastes.
As a replacement for sugar, reduce the amount of agave by 1/4 to 1/2 depending on your tastes.
(I do not like super sweet goods and often reduce by 1/2) and reduce the amount of liquid in the recipe by a quarter cup.
The taste is wonderful and the product is light and nutritious.
Answer: You can use grated jaggery or molasses as sweetener in cakes. Instead of beating powdered sugar with egg, you can try with jaggery, it came out to be beautiful , and sweet. But I think it is best to try them with chocolate cakes. I have a recipe chocolate cake with jaggery on my website.
You can also use dates.
Comment: Seasoned Advice has a community consensus that we will not make health claims, for various reasons, including that solid scientific evidence often is unavailable. I have therefore removed the health claims in your post.
Comment: You mention dates, it may be helpful to add details how a reader should use them to sweeten cakes.


Can I play the RoD expasion content using the original D3 game disc?

Question: I have both versions of Diablo 3 for the Xbox 360; the original game disc, and the Ultimate Evil game disc, would I be able to download all content from the Ultimate Evil edition onto my Xbox 360 and use the original Diablo 3 disc to play the expansion? My Reaper of Souls game disc is all scratched up and freezes on the opening loading screen.
Answer: If you own the individual DLC packs, separate from the Ultimate Edition, then yes. If not, you will have to purchase them separately.
Additionally, you can repair the disc (most video stores and game stores provide this service, for a fee).
Comment: Correct, these are technically different games and you can't use the DLC across both games. Ultimate evil edition doesn't have "DLC" - technically it's all included.


How to correct for correlation at baseline between predictor and "DV"?

Question: So say I am testing the predictive value of a predictor towards a "DV" within a survey data-set, between two time-points. Say also that I have measurements of both variables at all time points and that I can see that the DV and the predictor correlate at baseline. If I use linear regression or pearson correlation to evaluate the associaton between the predictor at baseline and the DV at a later time-point, do I need to correct for the correlation at baseline? I figure that if I do not correct, somehow, for this initial correlation I am not only testing prediction of the DV but also the test-retest-reliability of the predictor. Hope I am making sense.
Comment: I've started some discussion [in the chat room](http://chat.stackexchange.com/rooms/18/ten-fold) about making appropriate tags for such questions. I provide a useful set of related questions in there you might be interested in (there are a handful of related questions and references you might be interested in). In particular I would recommend viewing the answers to [Best practice when analysing pre-post treatment-control designs](http://stats.stackexchange.com/q/3466/1036).
Comment: Well, there's no real control-group in my example, but maybe the information in your link still applies if I only understand it well enough?
Answer: There are two general ways to do this.  Method 1 is to use the baseline measurement as a covariate in a linear model, as in
$\small measurement_2 = B_1 * measurement_1 + B_0$
Method 2 is to use the difference score as the dependent variable in an intercept-only linear model, as in
$\small measurement_2 - measurement_1 = B_0$
Method 1 is generally more powerful than method 2.  You can see this by realizing that you can derive method 2 from method 1 by adding measurement1 to both sides of the equation, as in:
$\small measurement_2 - measurement_1 (+ measurement_1) = (measurement_1) + B_0$
Effectively, method 2 assumes that the coefficient ($\small B_1$) of $\small measurement_1$ is equal to 1.  Because, by definition, linear regression finds the linear combination of coefficients that minimizes error, method 1 must of necessity be more powerful than method 2.  However, there are some instances where you might want to use method 2, particularly when, for example, you have a second variable (say a dichotomous variable, such as a randomized intervention) on which there are pretest differences on your variable of interest.  In this special case,  method 1 will yield biased results for the test of the effect of the intervention, whereas method 2 will be unbiased.
See Van Breukelen (2006) for more details.


Changing color of my directories listed by my directory

Question: I tried changing the color/attributes of directory listings of ls command by editing .dircolors file but it doesn't work.
Before that it is worth mentioning that i have added the below changes in the bash.bashrc file.
# enable color support of ls and also add handy aliases
if [ "$TERM" != "dumb" ]; then
[ -e "$HOME/.dircolors" ] && DIR_COLORS="$HOME/.dircolors"
[ -e "$DIR_COLORS" ] || DIR_COLORS=""
eval "`dircolors -b $DIR_COLORS`"
alias ls='ls --color=auto'
#alias dir='ls --color=auto --format=vertical'
#alias vdir='ls --color=auto --format=long'
fi

Also , added the below code in bashrc for specifying the dircolors file path.
d=.dircolors
test -r $d && eval "$(dircolors $d)"

I just got a vague idea about these things as am just beginning to work with ubuntu.
So can someone please help me find out the reason about why am not able to change colors of ls command?
Answer: You seem to be doing some of the tests and evals multiple (unnecessary) times.  Here's the standard idiom present in Ubuntu skeleton .bashrc files:
if [ -x /usr/bin/dircolors ]; then
    [ -r ~/.dircolors ] && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
fi

This tests whether the dircolors program is available (and executable by you) on your system.  If so, then it checks whether the .dircolors file exists (and is readable) in your home directory.  If so, it executes the dircolors command using your .dircolors file as input and evaluates the output (which basically just sets the LS_COLORS environment variable).  If you don't have a .dircolors file, then it executes dircolors with the default colors (and once again evaluates that output).
When it's done you can check the settings it produced:
echo $LS_COLORS

You can read a bit more about what all these colors mean by running:
dircolors --print-database


What is the spectral efficiency of OQPSK modulation?

Question: Offset Quadrature Phase Shift Keying (OQPSK) like QPSK transmits two bits per symbol. However, because of the offset on the quadrature component there are two transitions per symbol. Does this not double the bandwidth of each symbol, leading OQPSK to be more similar to BPSK in terms of spectral efficiency? This would make it 1 bit/s per Hz?
Answer: The spectral efficiency is the same as QPSK.
Consider the I and Q streams separately. Each has a certain bandwidth $B$. Shifting or delaying the stream does not change its bandwidth. So, shifting one of the streams relative to the other does not affect the overall bandwidth.
Comment: The I and Q signals are modulated separately and summed together (in this case, in quadrature with each other.) Summing two signals is never going to have a multiplicative effect on their bandwidth... the two signals just overlap each other. So the bandwidth has to be the same as the I or Q component by itself. Correct?
Comment: @Chris_F That's correct.


Weird issue with LMB on caps lock

Question: Running Linux and using a small Python script globally in Xorg to bind left mouse down + up to the caps lock key. I use this because of RSI and the buttons on my trackball are crap.
It just works with everything. But in Blender it only works in some situations.
For instance selecting objects in Object Mode doesn't work, but it of course works using the real left mouse button. Dragging to select works though, although only some areas of the viewport will let caps lock activate the drag region.
I'm using pyautogui.mouseDown() and pyautogui.mouseUp() when caps lock is pressed and released. And using pynput.keyboard.Listener() to listen for events.
Anyone got any ideas to make it work? Script below.
<code>#!/usr/bin/env python3

from pynput import keyboard as keyb

CAPS = keyb.KeyCode(16777215)

def on_press(key):
    if key == CAPS:
        return pyautogui.mouseDown()

    pass

def on_release(key):
    if key == CAPS:
        return pyautogui.mouseUp()

    pass

with keyb.Listener(on_press=on_press, on_release=on_release, suppress=False) as listener:
    listener.join()
```
</code>
Answer: Ah, tried setting it with xmodmap and it works!
<code>xkbset m
xmodmap -e 'keycode 66 = Pointer_Button1 Pointer_Button1'
</code>

Weird issue with LMB on caps lock


Sort by title asc on Solr not working as expected

Question: When trying sort search results in Solr using title (alphabetical) asc or desc does not work as expected and not sorted.
Answer: title_t is a text_general field in Solr. Which is tokenized field so sorting will not work. If you want sorting then the field needs to be of string type (with _s suffix)
You can try a few things-

Create a computed index field that is of string type and apply sort on that.
Convert the title field from text to string via Sitecore patch config and apply sort
Create a copyField in Solr from text to string and then apply sort order on the string field.
Answer: I agree with @Surya and just putting brief details to provide more context to achieve it.
Solution 1
When you want to sort on a specific field, always make sure the field isn't tokenized within Solr, and that the casing of the values is always the same, Test would be sorted differently then test.
This means that when you want to sort on Title, you should add an extra field that isn't tokenized, and that is lowercase. You can create a Computed Field. so that the Solr schema does not have to be edited manually.
First of all, we create a Computed Field class, which uses the ReferenceField as a reference to the field from where it should take the value from.
namespace Example
{
    public class SortReferenceComputedField : IComputedIndexField
    {
        public string FieldName { get; set; }
        public string ReturnType { get; set; }
        public string ReferenceField { get; set; }
        public object ComputeFieldValue(IIndexable indexable)
        {
            var indexItem = indexable as SitecoreIndexableItem;
            var field = indexItem?.Item?.Fields[ReferenceField];
            if (field != null && field.HasValue)
            {
                return field.Value.ToLower();
            }
            return null;
        }
    }
}

After that, all we have to do is register the Computed Field by adding a configuration file. Please note that you can use the same SortReferenceComputedField type for each field that you want to be able to sort on.
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:search="http://www.sitecore.net/xmlconfig/search/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
  <sitecore role:require="Standalone or ContentManagement or ContentDelivery" search:require="solr">
    <contentSearch>
      <indexConfigurations>
        <defaultSolrIndexConfiguration type="Sitecore.ContentSearch.SolrProvider.SolrIndexConfiguration, Sitecore.ContentSearch.SolrProvider">
          <documentOptions type="Sitecore.ContentSearch.SolrProvider.SolrDocumentBuilderOptions, Sitecore.ContentSearch.SolrProvider">
            <fields hint="raw:AddComputedIndexField">
              <field fieldName="sorttitle" referenceField="title" storageType="no" indexType="untokenized">Example.SortReferenceComputedField, Example</field>
            </fields>
          </documentOptions>
        </defaultSolrIndexConfiguration>
      </indexConfigurations>
    </contentSearch>
  </sitecore>
</configuration>

As you can see in the example above, we create a new field called sorttitle that uses the value from the title field. For the last step, just go to the Title Asc and Title Desc sortings, and make sure that the facet that is used there, points to the newly created sorttitle field.
Solution 2 (Not recommended)
Another way is directly update the managed-schema within Solr.
It is possible with Solr, to create a new field type with the LowerCaseFilterFactory and the TrimFilterFactory as indexing analyzers, and then use a copyField definition to create the field.
Note: This is not a recommended way as you have to (manually) edit the managed-schema within Solr and changes will be overwritten when the next time managed-schema is populated from Sitecore, cumbersome to maintain the manual schema changes.
Hope it helps!
Comment: thanks it works for me , but there's odd behavior when page load first time search result displays only 3 items while i configured page size parameter to be 8 , do you have any idea?
Comment: I'm glad to hear that it works for you, If this answer or any solved your issue or helps to resolve it, please mark it as accepted for the community. For more details https://sitecore.stackexchange.com/help/someone-answers