Event log Clear options in windows 2003

Question: What are the different options to clear Event logs in windows 2003 other than opening event viewer and clearing logs one by one interactively? I don't consider powershell is an option as this also requires to be downloaded.
Answer: Source ServerFault answer Save and clear eventlogs ServerFault answer by Bart De Vos

There is a SysInternals-tool you can use for this now called PSLogList. This replaces the EventLog.pl from Windows 2K.
You would need to use the -c option to clear the logs after the command and -g to specify the file. (for some strange reason -g is not in the usage-help).

usage: psloglist [- ] [\\computer[,computer[,...] | @file [-u username [-p password]]] [-s [-t delimiter]] [-m #|-n #|-h #|-d #|-w][-c][-x][-r][-a mm/dd/yy][-b mm/dd/yy][-f filter] [-i ID[,ID[,...] | -e ID[,ID[,...]]] [-o event source[,event source][,..]]] [-q event source[,event source][,..]]] [-l event log file] <eventlog>

@file   Execute the command on each of the computers listed in the file.
-a  Dump records timestamped after specified date.
-b  Dump records timestamped before specified date.
-c  Clear the event log after displaying.
-d  Only display records from previous n days.
-c  Clear the event log after displaying.
-e  Exclude events with the specified ID or IDs (up to 10).
-f  Filter event types with filter string (e.g. "-f w" to filter warnings).
-h  Only display records from previous n hours.
-i  Show only events with the specified ID or IDs (up to 10).
-l  Dump records from the specified event log file.
-m  Only display records from previous n minutes.
-n  Only display the number of most recent entries specified.
-o  Show only records from the specified event source (e.g. \"-o cdrom\").
-p  Specifies optional password for user name. If you omit this you will be prompted to enter a hidden password.
-q  Omit records from the specified event source or sources (e.g. \"-q cdrom\").
-r  SDump log from least recent to most recent.
-s  This switch has PsLogList print Event Log records one-per-line, with comma delimited fields. This format is convenient for text searches, e.g. psloglist | findstr /i text, and for importing the output into a spreadsheet.
-t  The default delimeter is a comma, but can be overriden with the specified character.
-u  Specifies optional user name for login to remote computer.
-w  Wait for new events, dumping them as they generate (local system only).
-x  Dump extended data
eventlog    eventlog

If you are after a command you can execute remotely, you would need something like this:

psexec \\servername -c psloglist.exe -c -g application.evt application

Comment: I believe sysinternal psexec has to be downloaded first. It is not available as part of windows 2003. Can the VB script be scheduled to run at the time it is desired to run?
Comment: Yes, psexec is part of the [SystemInternals](http://technet.microsoft.com/en-us/sysinternals/bb842062.aspx) toolkit and it needs to be downloaded. I guess the VB script can be scheduled. You should ask in a comment to the answer from Ƭᴇcʜιᴇ007
Answer: You can use VB scripting and WMI (both built into Windows)...
This VBS code will attempt to backup each log to C:\temp, and then clear them (if they were backed up successfully):
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate,(Backup)}!\\" & _
        strComputer & "\root\cimv2")

Set colLogFiles = objWMIService.ExecQuery _
    ("Select * from Win32_NTEventLogFile")

For Each objLogfile in colLogFiles
    logfileName = objLogFile.LogfileName
    Wscript.Echo "Processing " + logfileName + " log..."
    errBackupLog = objLogFile.BackupEventLog("c:\temp\" + objLogFile.FileName + ".evt")
    If errBackupLog <> 0 Then
        Wscript.Echo "The " + logfileName + " event log could not be backed up."
    Else
       objLogFile.ClearEventLog()
    End If
Next

Save it into a text file (ie: LogClear.vbs), and then execute cscript LogClear.vbs to run it from a command-line.
Comment: do I have to install VB in windows 2003? if not, what is the location of executable? Hoe do you use WMI to access logs?

Event log Clear options in windows 2003


Is "not a short period" in the sentence "I spent not a short period for the math exam" correct?

Question: This is an sentence in my english essay. What I want to say here is that I spent some time on math exam. And the time I spent on it is not that much, however is not short either. But "not a short period" looks strange to me in the sentence since I never saw anyone using this before.
Comment: Do you mean you spent some time studying maths before the exam, or was this an exam with a maths paper and a literature paper, and you spend some time on maths during the exam?
Comment: Please clarify what you mean by "on [the] math exam". Do you mean that the math exam itselt took a long time, or that you spent a long time preparing for the math exam? Note that exam is a countable noun, so it needs an article (a/the).
Comment: @JamesK great minds think alike
Comment: "I spent a while" sounds much more natural.  It's not very precise, though.
Answer: Your sentence is a example of litotes.  It is rather subtle and depends a lot on context (and in speech on tone or body language).  The sense is "ironic understatement" and the purpose is to emphasise the point.
The classic example of litotes is saying something is "not bad".  The can mean anything from "satisfactory" to "excellent" depending on context and tone.
So if you say "I spend not a short time preparing for my maths exam."  That might mean "longer than expected".
You can avoid the litotes and say "I spent quite a long time".  That is not very long, but not short either.  Or "I spent enough time" (different meaning but may be acceptable). Or "I spent some time" (rather vague).
Comment: I would normally order them as "a short time" < "not a short time" < "a long time" < "quite a long time." But I agree that in certain tones, "not a short time" could mean "quite a long time"!
Comment: I would also say, it sounds (to my American ear) like a very archaic example of litotes. Perhaps it sounds more natural to a commonwealth English speaker.
Comment: If I were using litotes, which is very unusual, I'd probably say, "I spent no short period of time preparing ...."
Comment: Thank you James for your detailed explanation. That's a great help:)
Answer: "I spent not a short period" could never be correct in that context.
If you want go into tiny detail more relevant elsewhere, "no short period of time" might be acceptable…
Almost separately "I spent (any description of time) for the math exam" is not correct.
Your idea requires an auxiliary, as for instance "I spent hours
preparing…" or "… days revising" or "… weeks studying for the exam"
Comment: Thank you Robbie for bringing up the auxiliary problem. I appreciate your help!
Answer: I spent quite some time during the Math exam.
Comment: "quite some time" means a large amount of time. The question asks about a not too much/not too little amount of time.


Do I need an expansion gap around concrete laid inside a building

Question: We are laying a concrete floor inside a room in an old stone building. Do we need to leave an expansion gap around the edge? The room is open at the front so we are not insulating or anything.
Answer: Concrete has about the same expansion rate due to temperature as steel [this is why reinforced concrete does not break apart from thermal stress]. A stone walls are likely have another coefficient of thermal expansion (and perhaps some other constraints).
It is sound practice to isolate  slabs from existing structures absent a compelling reason to tie them together. A compelling reason would be structural necessity. Apathy is at the other end of the scale. Other reasons, may fall in between but generally toward the non-compelling end.
Answer: I do not think you need an expansion joint around the edge. The concrete should shrink slightly as it cures, and create it's own expansion gap naturally. However, I am not familiar with your loacale and the environmental conditions and building codes. I would suggest speaking to a professional if you're unsure. A simple phone call to your local building department may answer your question better for your area.
Comment: If you don't know, giving this sort of answer is worse than saying nothing.  Different cements have different shrinking characteristics; some cements are engineered to shrink in one direction but not another, like roadways.


Run a command on all subfolders

Question: If you have a series of subfolders (like from a to z) and want to run a command on each one of them (like rm *.pdf or ls *.pdf), how do you do that? The "manual" approach would be cd a, rm *.pdf, or ls *.pdf, cd .., cd b, ... That seems too complicated, so I believe there must be an easier approach.
Comment: Are there more subfolders than those you shall work on? So e.g. folders a to z shall be considered but subfolders _ and + shall be ignored?
Answer: Try doing this (using bash, brace expansion & globs):
rm -f {a..z}/*.pdf

or
rm -f [a-z]/*.pdf

if your shell lack the brace expansion feature.
Contrary to [a-z], {a..z} (also supported by ksh93) is not a glob, it's brace expansion, it's expanded (before globs) regardless of whether files exist or not. That's like rm -f a/*.pdf b/*.pdf..., regardless of whether a, b... exist or not. Also note that contrary to [a-z] where the range may be locale dependant (like may include é, ś...), {a..z} only works with byte ranges (and reliably only in the ASCII letter ranges, and number ranges)
(Merci Stephane Chazelas for explanations)
Comment: Contrary to `[a-z]`, `{a..z}` (also supported by ksh93) is not a _glob_, it's brace expansion, it's expanded (before globs) regardless of whether files exist or not. That's like `rm -f a/*.pdf b/*.pdf...`, regardless of whether `a`, `b`... exist or not. Also note that contrary to `[a-z]` where the range may be locale dependant (like may include _é, ś..._), `{a..z}` only works with byte ranges (and reliably only in the ASCII letter ranges, and number ranges)
Answer: For that particular example:
rm [a-z]/*.pdf

In any shell.
In the general case, with Bourne-like shells, you could put the list of directories in $1, $2... with:
set a b c foo bar...

and then loop over it like:
for i do (cd -- "$i" && cmd -- *.pdf); done

Though of course you can do both in just one command:
for i in a b c foo bar...; do (cd -- "$i" && cmd -- *.pdf); done

The point is to use a subshell (...) so that cd only affects that subcontext.
Answer: Use find. Something like the following would find all folders (no more than two folders deep), and then execute rm <pathname>/*.pdf from the folder:
find pathwithsubfolders -type d -maxdepth 1 -mindepth 1 -exec rm {}/\*.pdf \;

In my opinion the best thing to do with commands like these (you know, the ones with potential terrible consequences) is to prepend an 'echo' statement in front of the command you are trying to execute ... just to make sure it looks like what you want before you go pulling the trigger.
Comment: Not rather `-maxdepth 1 -mindepth 1`?
Comment: You quote the ";" but not the "*"?
Comment: By default in bash if a glob does not match anything it is not expanded and you get a '*' this encourages the bad habit of not quoting glob characters.  The `failglob` option changes this behaviour.
Comment: That won't work because globs are expanded by shells, not by `find` or `rm`.
Comment: Hey all thanks, you're all right. I have to escape *s and mindepth does it right. Updated my answer.
Answer: find may be the best solution but it is easily possible in shell (bash):
GLOBIGNORE=.
for subdir in *; do
  test -d "$subdir" || continue
  cd "$subdir"
  ls *pdf
  cd -
done

or even easier
ls */*.pdf

Answer: If it is just one level of directories, you can simply do
rm */*.pdf

That will delete all the pdf files in all the directories, but nothing else.
In a case like this you may want to review the list of files selected before you do the delete.  To do that try
ls */*.pdf

And if the list is long enough to scroll off the screen, pipe it through a pager, eg
ls */*.pdf | more

Answer: Well, assuming you want to remove all PDF files from the current directory and all other subdirectories beneath it, you would do something like
find -name "*.pdf" -exec rm -i {} \;

Two things to note:
1- I have added the -i switch to rm so that it prompts you before removing any file in case the find is too broad in scope.
2- I highly encourage you to read the find man page. It is easily one of my all-time favorites.
Answer: Using a perl portable solution (for Unix-likes)
perl -e '`rm -rf "$_"/*.pdf` for "a" .. "z"'

This will removes the subdirectories recursively under a..z dirs
Answer: I usually prefer xargs:
find <path> -name '*.pdf' | xargs {ls|rm|etc}

This has the benefit of adding grep or other manipulations in the middle of the pipeline, but has the disadvantage of not gracefully dealing with files that have spaces in the file or path name.
Comment: space, but also tab, newline, single quote, double quote and backslash characters.
Comment: In other words, uncommon characters, unless you're sharing a FS with windows.

Run a command on all subfolders


When motion begins, do objects go through an infinite number of position derivatives?

Question: This might be a very vague and unclear question, but let me explain. When an object at rest moves, or moves from point $A$ to point $B$, we know the object must have had some velocity (1st derivative of position) during that trip. It's also true that the object had to have accelerated to gain that velocity (2nd derivative)... if we extend this argument, is it logical to say that the object must have experienced jerk (3rd deriv.) to gain that acceleration? And so on and so forth... 3rd, 4th, 5th position derivatives? Or is my logic flawed somewhere?
Comment: No, it's not! When an object initially at point A is found at point B at a later time, there's nothing logical which forbids the object from simply teleporting to the new position when you blinked, having zero velocity the entire time. Continuity of motion is a physical law invented to explain the experimental evidence that when we examine a large number of position-time coordinates between the initial and final times, we see the positions to between the initial and final positions. Same goes for the possibility of impulse forces which produce discontinuous jumps in velocity, and so on...
Comment: Hi user92356, and welcome to Physics Stackexchange! The "soft-question" tag is really just for meta-level questions about physics (rather than any question that is "soft" in the generic sense); tags that convey the subject matter are better. I might suggest "classical-mechanics" for a start, but I don't want to make that change without your approval, as perhaps you wanted e.g. a quantum-mechanical viewpoint.
Comment: @DavidH umm... the law of conservation of mass/energy in conjunction with the lorentzian transformation prevents any discontinuities in position (under any circumstances) or velocity (without infinite forces) in the classical limit.
Comment: @JanDvorak True, and my point remains that physics is what's preventing them, not logic.
Comment: @DavidH if you suspend your belief in the conservation of mass, there is not much left to stay, and self-consistency is a pretty weak assumption in this respect. I am willing to accept relativistic effects as counter-intuitive, however, and conservation of mass is not sufficient to prevent teleportation if synchronicity is strictly independent of the reference frame (which is perfectly logical and incorrect outside of the classical limit).
Answer: In the classical mechanics picture, where an object's position is a real-valued function of the real parameter time, then yes, you are correct.
If the object is at rest over any extended interval, then it's position as a function of time over that interval is simply $x(t) \equiv 0$, which of course means $x^{(k)}(t) = 0$ for any $k$-th derivative at any time $t$ in the interval.
Suppose $x^{(n)}(t) = 0$ for all times $t$ in the interval $[t_0, t_1]$, where the object is at rest in an interval around $t_0$. Then for $t \in [t_0, t_1]$ it's position obeys
$$ x^{(k-1)}(t) = x^{(k-1)}(t_0) + \int_{t_0}^t x^{(k)}(t') \, \mathrm{d}t' = x^{(k-1)}(t_0) = 0 $$
for all $k \in \{2, \ldots, n\}$. This implies
$$ x(t_1) = x(t_0) + \int_{t_0}^{t_1} x'(t') \, \mathrm{d}t' = x(t_0). $$
The contrapositive of this conclusion tells us that if $x(t_1) \neq x(t_0)$, all time-derivatives of position must have been nonvanishing at least somewhere in that interval.1

On the side: There is more to be pondered in relation to this infinite regress of derivatives. For example, you may wonder how anything at rest could get moving at all in this formal system of mechanics. Certainly if $x$ were an analytic2 function of time that vanished over some interval, then the object could never move. Fortunately there are infinitely differentiable functions that are not analytic. However, loosening our restrictions on "valid" trajectories in this way makes for some worrisome issues regarding determinism in Newtonian mechanics, illustrated for example by Norton's Dome.

1 The wording here could be improved if you allow for discontinuities and delta functions, but the same argument holds.
2 The word "analytic" has taken on a multitude of different meanings in physics. Here I mean "converges to its Taylor series." That is, a function $f$ is analytic at a point $x_0$ if for all points $x \neq x_0$ in a neighborhood of $x_0$, the series
$$ \sum_{k=0}^\infty \frac{1}{k!} f^{(k)}(x_0) (x-x_0)^k $$
is defined and converges to $f(x)$.
Comment: The failure of determinism in Norton's dome is discussed further in [this](http://physics.stackexchange.com/q/39632/2451) Phys.SE post.
Comment: Can't you reach the same conclusion you a Taylor's series expansion in time?


Is it possible to see all shared folder list in windows?

Question: We have LAN connected different OS installed systems. If I want to see all shared folder list in windows 7 and its access level whether read or read and write, how and where can I see? Is there any option to stop all shared folders with a single click?
Answer: To view a list of all shared folders

Click the Windows button
Right-click Computer and choose Manage (requires administrative priveleges)
Traverse to Computer Management > System Tools > Shared Folders > Shares

Note: in Windows 8 and 10 the Computer Management is easy accessible through the Windows key + x shortcut, as a part of the Power User Menu
To disable file sharing

Click the Windows Logo button.
Type file sharing in the search results window, and then touch Enter.
Under "File and Printer Sharing", check to be sure that Turn off file and printer sharing is selected.
Under "Public Folder Sharing", check to be sure that Turn off public folder sharing is selected.
Click Save Changes.
Comment: Quicker (and in almost every Windows version the same) is to use the run dialog and enter **compmgmt.msc**. And then continue as described.
Comment: thx was perfect solution :)
Answer: Command Line Way
List All Shares
net share

Stop Sharing a Folder
net share sharename /delete

Stop Sharing All Folders
Write a script, and double-click it!
The following script will stop sharing sharename and Share Name 2. Replace these with your own share names. Save as stopsharing.bat.
@echo off
net share sharename /delete
net share "Share Name 2" /delete
pause

Note how share names with spaces in them must be enclosed by quotes.
Further Information
net share /?

Learn about more features including how to add shares from the command line.
Comment: I much prefer the CLI over a GUI!
Comment: That's cool thx :)
Answer: You can use Network Scanner. Tiny portable software, just input the range of ips you want to see.

SoftPerfect Network Scanner is a free multi-threaded IP, NetBIOS and
  SNMP scanner with a modern interface and many advanced features. It is
  intended for both system administrators and general users interested
  in computer security. The program pings computers, scans for listening
  TCP/UDP ports and displays which types of resources are shared on the
  network (including system and hidden).
In addition, it allows you to mount shared folders as network drives,
  browse them using Windows Explorer, filter the results list and more.
  SoftPerfect Network Scanner can also check for a user-defined port and
  report back if one is open. It can also resolve host names and
  auto-detect your local and external IP range. It supports remote
  shutdown and Wake-On-LAN.


phase portrait for ode no initial value

Question: I'm trying to make a phase portrait for the ODE y''-4y'+y=0,
I know how to solve this ODE
But I don't know how to make a phase portrait out of it.
I've looked at something about parametricplot, but still don't know how to deal with it.
Comment: You start off by writing it as a system of first order equations and then use StreamPlot. For example, https://math.stackexchange.com/questions/3593458/convert-second-order-ode-to-first-order-system
Answer: As porposed by Moo's comment the substitution y'[t]==x[t] leads to x'[t]==4x[t]-y[t]:
StreamPlot[{ 4 x-y,x},{x,-1,1},{y,-1,1}]

The ode seems to be unstable!
Answer: There is no need to do any manual work or substitution to convert the second order ODE to two first order ODE's. You can let Mathematica do that using its StateSpace function which does the conversion for you. Less chance of making an error.
ClearAll[x, y];
ode = y''[x] - 4 y'[x] + y[x] == 0;
vars = {x, y};
ss = StateSpaceModel[{ode}, {{y'[x], 0}, {y[x], 0}}, {{u[x], 0}}, {y[x]}, x];
eqs = ss[[1, 1]] . vars
StreamPlot[eqs, {x, -1, 1}, {y, -1, 1}]

Answer: One can use Solve to get the linear vector field and, optionally, its eigenbasis:
ode = {y''[x] - 4 y'[x] + y[x] == 0};
(* get Jacobian amat *)
subs = {y'[x] == p[x], y''[x] == p'[x]};
amat = {y'[x], p'[x]} /.
   First@Solve[Join[ode, subs], {y'[x], p'[x]}, {y''[x]}];
(* optional *)
evecs = Last@CoefficientArrays[amat, {y[x], p[x]}] // N //
   Eigenvectors;

(* plot *)
StreamPlot[
 amat,
 {y[x], -1, 1}, {p[x], -1, 1},
 (* optional *)
 StreamColorFunction -> None,
 StreamPoints -> {Join[
   Thread[{0.8 evecs, Red}], Thread[{-0.8 evecs, Red}],
   {Automatic}]}]

phase portrait for ode no initial value


Random effect variance with or without fixed-effects intercept

Question: I'm fitting some hierarchical models in R using lmer, and am trying to understand why the results change as they do when I either include or exclude a fixed-effects intercept term. I have already looked elsewhere on CrossValidated and the broader web, to no avail.
Some quick background to help interpretation of the below snippets: N=149 participants each viewed the same set of M=40 videos, and responded to each video in various ways; in the models below, the dependent measure is the Arousal subscale of the Self Assessment Manikin. The reason for using a random intercept for participants is, I think, self-explanatory; the reason for using a random intercept for videos as well is that I want to ensure the results can be interpreted as generalizing to videos outside of these specific 40.
When I fit the model with a fixed-effects intercept, these are the results; in both of the following snippets, the key output is the reported random effects variance for the Video intercept, along with the calculated values reported at the bottom:
> summary(lmer(SAM_Aro ~ (1 | Participant) + (1 | Video), data=dat))
Linear mixed model fit by REML ['lmerMod']
Formula: SAM_Aro ~ (1 | Participant) + (1 | Video)
   Data: dat

REML criterion at convergence: 22263

Scaled residuals:
    Min      1Q  Median      3Q     Max
-5.2073 -0.5432  0.0458  0.5935  3.5653

Random effects:
 Groups      Name        Variance Std.Dev.
 Participant (Intercept) 2.4008   1.5494
 Video       (Intercept) 0.2045   0.4522
 Residual                2.1914   1.4804
Number of obs: 5960, groups:  Participant, 149; Video, 40

Fixed effects:
            Estimate Std. Error t value
(Intercept)   5.9903     0.1469   40.77

> var(ranef(lmer(SAM_Aro ~ (1 | Participant) + (1 | Video), data=dat))$Video[["(Intercept)"]])
[1] 0.1907348

Of course, the variance of the random effects terms won't exactly match the modeled variance of the parametric distribution from which those terms are assumed to arise by the model, but intuitively, they should be close, as they are here.
Excluding the fixed-effects intercept, the picture changes drastically:
> summary(lmer(SAM_Aro ~ (1 | Participant) + (1 | Video) + 0, data=dat))
Linear mixed model fit by maximum likelihood  ['lmerMod']
Formula: SAM_Aro ~ (1 | Participant) + (1 | Video) + 0
   Data: dat

     AIC      BIC   logLik deviance df.resid
 22470.1  22490.1 -11232.0  22464.1     5957

Scaled residuals:
    Min      1Q  Median      3Q     Max
-5.2162 -0.5444  0.0471  0.5939  3.6062

Random effects:
 Groups      Name        Variance Std.Dev.
 Participant (Intercept)  2.413   1.553
 Video       (Intercept) 34.799   5.899
 Residual                 2.191   1.480
Number of obs: 5960, groups:  Participant, 149; Video, 40

> var(ranef(lmer(SAM_Aro ~ (1 | Participant) + (1 | Video) + 0, data=dat))$Video[["(Intercept)"]])
[1] 0.2189779

> 1/40*sum(ranef(lmer(SAM_Aro ~ (1 | Participant) + (1 | Video) + 0, data=dat))$Video[["(Intercept)"]]^2)
[1] 34.76858

In this case, the reported variance for the Video random intercept term increases by a factor of 170 compared with the first model. The actual variance of the terms themselves remains essentially unchanged, as expected. On a hunch, I computed the second raw moment of the terms, and it is clear that this value corresponds very closely with what was reported in the lmer summary output.
My questions are: 1) is this intended behavior on the part of lmer, or some sort of bug? And 2) if I want to report the (modeled) variances associated with each grouping variable, should I just resign myself to using the estimates from the model with a fixed-effects intercept? There's no reason in principle to disprefer it, except that the model without seems somehow cleaner in terms of interpreting the parcelling of variance components to each of the two groups plus residual.
Any clarifications on this specific issue, as well as more philosophical thoughts as to the appropriateness of using either model, are greatly appreciated.
Comment: TL;DR: What is your justification for fitting a model with random intercepts but no fixed intercept? I don't believe there can be a valid justification.
Answer: I agree with @Roland's comment.
What values does SAM_Aro take? Keep in mind that the mean of both sets of random intercepts (participant and video) is, by definition, zero. If the response variable does not have zero mean, this needs to go somewhere.


connection with oracle database in Reactjs

Question: I am doing a database project using reactjs for frontend and Oracle database for the database connection.
 Many sources for the connection of React and MySQL are available but there is hardly any source for connection with the oracle database in React.How do i do it? documentation for nodejs oracle connection is available.so i can connect with the database but how do i show results on localhost using Reactjs?
I have tried to create a simple javascript file and connect with oracle in it.I was able to get data on the console but how do i post it on localhost?
Comment: I just started a new series on creating REST APIs with Node.js and Oracle Database: https://jsao.io/2018/03/creating-a-rest-api-with-node-js-and-oracle-database/
Answer: You need apis for acting as a bridge between reactjs application and oracle db. You can use any backend stack for oracle db connection and apis like nodejs, python etc. Reactjs is not to be used for server side applications, its only for the frontend meant to be running inside a browser.


Do my emotional choices affect the story?

Question: I am playing Golden Sun: Dark Dawn and noticed that sometimes I need to give an emotional response to something that was said. Do these decisions affect anything ? Or are they purely aesthetic?
Answer: I don't think the decisions really make a difference; they're just there to let you develop your character's identity a little. Pretty much the same things will happen regardless of how you respond, but it serves as a nice aesthetic touch.
If you want a reference, I quote the following from a review:

The player is allowed to "respond" at certain points with one of 4 emotional responses (positive, enthusiastic, negative, or angry). While this has little impact on the actual game, it adds a bit of the player's personality into the otherwise mysterious silent character.
Comment: That's what I figured - I didn't see it being as nuanced as something like Mass Effect, but I wanted to make sure. Didn't want to burn any unnecessary bridges or anything. XD
Comment: @DerpyHooves If you played the first two games you'd probably find it it was weird (and funny) when all of a sudden Felix (main character for the second game) wasn't talking and Issac (main character for the first game) was blabbing away. xD
Comment: Having played each game in the series multiple times, I can attest to there not being a story difference in these choices; however, choosing unexpected responses did lead to some humorous dialogue in the first two, especially the second, which keeps track of every time you disagree with a certain character, who has a big reaction after you do it too many times. Still, that's an easter egg, and the character goes back to normal after that.


How do I learn and use optaplanner ? any detailed tutorials/videos available online apart from the ones in optaplanner website?

Question: I have a beginners level knowledge in Java , I am trying to learn optaplanner , can anyone help me finding the right resources to learn optaplanner and spring/springboot integration ,since my background is operations research I am new to spring environment.
Comment: Would you see this [link](https://www.optaplanner.org/learn/video.html) or [this](https://or.stackexchange.com/q/4835/199)? there are useful answers to this in the OR.SE forum that you can search. :)
Answer: These should help:

In the OptaPlanner documentation, section 2.4 is a specific Quick Start guide for Spring Boot. But if you're new to Spring, why not learn Quarkus instead, which is faster and supports native compilation?
The optaplanner-quickstarts repository has one Spring Boot example and several Quarkus examples. Just git clone that repo or download it.
Comment: Note: [OptaPlanner continues as Timefold](https://timefold.ai/blog/2023/optaplanner-fork)


What exothermic reaction distinguishes warm blooded animals?

Question: I would appreciate an answer specifically in the form of an exothermic chemical reaction. Namely, the one primarily responsible for generating heat in warm blooded animals that does not take place in cold blooded animals.
Comment: Don't have time for an answer, but see here, where someone asked a similar question: http://en.m.wikipedia.org/wiki/Wikipedia:Reference_desk/Archives/Science/2011_October_2#section_13. If it's not complete, it should at least get you started.
Comment: The first link on that page takes you to an explanation.  One reason is that shivering produces heat in warm blooded animals.  In mammals, which have brown adipose tissue, uncoupling protein 1 disrupts the protein gradient in the mitochondria, leading to release of some energy as heat rather than ATP.
Comment: Related: https://biology.stackexchange.com/questions/2503/is-there-a-relationship-between-efficiency-of-cellular-metabolism-and-warm-blood
Answer: Brown adipose tissue or brown fat is one of the primary ways of generating body heat, and it is only found in warm-blooded animals. It is brown due to the high numbers of mitochondria, and heat is generated by uncoupling the electron transport chain from ATP synthesis by oxidative phosphorylation.
In the typical (ATP-producing) mitochondria, an energy gradient is formed by storing protons within the inter-membrane space, and these then flow through the ATP synthase to power the generation of ATP from ADP and phosphate. In brown fat mitochondria, Uncoupling Protein 1 (UCP1 or thermogenin) forms a pore in the inner membrane, allowing the proton/electron ratio to reach equilibrium and robbing ATP synthase of its motive power. This is what generates the heat.

From Wikipedia
Comment: The heat comes from the release of the proton gradient - it's just being changed from electrical energy to heat energy. I don't know if there's a specific chemical reaction going on...
Comment: Kind of like why resistors get hot (though with them, it's electron traffic)?
Comment: @Pete - Exactly.
Answer: While all animals and even plants generate heat from chemical reactions or mechanical motion of their tissues (like muscle tissues), warm blooded animals have brown fat which has the unusual ability to generate heat directly from metabolic energy.
The particular chemical process you are looking for is performed by uncoupling proteins (UCPs).  They reside in the mitochondria and rather than use the proton gradient in the mitochondria to generate ATP, UCPs pass protons through the membrane and generate heat.
Brown fat is brown because of a relatively large iron content associated with many extra mitochondria (brown adipose tissue appears to be derived from muscle cells and not white adipose tissue).  Its a heat generating organ in humans, particularly infants.


Django: Non-ASCII character

Question: My Django View/Template is not able to handle special characters. The simple view below fails because of the ñ. I get below error:

Non-ASCII character '\xf1' in file"

def test(request):
    return HttpResponse('español')

Is there some general setting that I need to set? It would be weird if I had to handle all strings separately: non-American letters are pretty common!
EDIT
This is in response to the comments below. It still fails :(
I added the coding comment to my view and the meta info to my html, as suggested by Gabi.
Now my example above doesn't give an error, but the ñ is displayed incorrectly.
I tried return render_to_response('tube/mysite.html', {"s": 'español'}). No error, but it doesn't dislay (it does if s = hello). The other information on the html page displays fine.
I tried hardcoding 'español' into my HTML and that fails:

UnicodeDecodeError 'utf8' codec can't decode byte 0xf.

I tried with the u in front of the string:

SyntaxError (unicode error) 'utf8' codec can't decode byte 0xf1

Does this help at all??
Comment: What is the actual error that you are getting? Is it UnicodeDecodeError?
Comment: Which version of Django are you using? It's not 0.96 is it?
Comment: You need to ensure that your editor is saving the file with the encoding that you've specified.
Answer: Do you have this at the beginning of your script:
# -*- coding: utf-8 -*-

...?
See this: http://www.python.org/dev/peps/pep-0263/
EDIT: For the second problem, it's about the html encoding. Put this in the head of your html page (you should send the request as an html page, otherwise I don't think you will be able to output that character correctly):
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

Comment: I updated the problem description based on your comments. It still doesn't work...
Comment: return HttpResponse('string') is rough...it would be useful to use an HTML template where you can include the above meta, and then use render_to_response('mytemplate.html')
Comment: This solves the problem of using special chars on explicit strings in code. Thanks.
Answer: Insert at the top of views.py
# -*- coding: utf-8 -*-

And add "u" before your string
my_str = u"plus de détails"

Solved!
Comment: Your answer is a combination of [this](http://stackoverflow.com/a/4635237/383793) and [this](http://stackoverflow.com/a/4635222/383793) answer, but less complete. Editing other answers to complete them is preferred. And if not, please be at least as complete as the other ones.
Answer: You need the coding comment Gabi mentioned and also use the unicode "u" sign before your string :
return HttpResponse(u'español')

The best page I found on the web explaining all the ASCII/Unicode mess is this one :
http://www.stereoplex.com/blog/python-unicode-and-unicodedecodeerror
Enjoy!
Comment: It's still not working. Adding the comment (but not the u) gives a different kind of error. The word can now be displayed, but the ñ is replaced by a square or other strange symbol, depending on the browser. When I also include the u it won't work at all. I get "utf8' codec can't decode byte 0xf1 in position 0"
Answer: Set DEFAULT_CHARSET to 'utf-8' in your settings.py file.
Comment: the DEFAULT_CHARSET is set to utf-8 by default
Comment: This may have changed during the two years that passed between post and comment. I have taken the liberty to wait two years to say this as well.
Answer: I was struggling with the same issue as @dkgirl, yet despite making all of the changes suggested here I still could not get constant strings that I'd defined in settings.py that contain ñ to show up in pages rendered from my templates.
Instead I replaced every instance of "utf-8" in my python code from the above solutions to "ISO-8859-1" (Latin-1).  It works fine now.
Odd since everything seems to indicate that ñ is supported by utf-8 (and in fact I'm still using utf-8 in my templates).  Perhaps this is an issue only on older Django versions? I'm running 1.2 beta 1.
Any other ideas what may have caused the problem? Here's my old traceback:
Traceback (most recent call last):
  File "manage.py", line 4, in
    import settings # Assumed to be in the same directory.
  File "C:\dev\xxxxx\settings.py", line 53
    ('es', ugettext(u'Espa±ol') ),
SyntaxError: (unicode error) 'utf8' codec can't decode byte 0xf1 in position 0:
unexpected end of data
Comment: Upon study, the only two changes I needed both went into settings.py: gabi's "coding" header (already had the meta tag) and @dominique-guardiola's enforcing unicode interpretation. +1's and thanks for the help!
Answer: ref from: https://docs.djangoproject.com/en/1.8/ref/unicode/
"If your code only uses ASCII data, it's safe to use your normal strings, passing them around at will, because ASCII is a subset of UTF-8.
Don't be fooled into thinking that if your DEFAULT_CHARSET setting is set to something other than 'utf-8' you can use that other encoding in your bytestrings! DEFAULT_CHARSET only applies to the strings generated as the result of template rendering (and email). Django will always assume UTF-8 encoding for internal bytestrings. The reason for this is that the DEFAULT_CHARSET setting is not actually under your control (if you are the application developer). It's under the control of the person installing and using your application – and if that person chooses a different setting, your code must still continue to work. Ergo, it cannot rely on that setting.
In most cases when Django is dealing with strings, it will convert them to Unicode strings before doing anything else. So, as a general rule, if you pass in a bytestring, be prepared to receive a Unicode string back in the result."
Answer: The thing about encoding is that apart from declaring to use UTF-8 (via <meta> and the project's settings.py file) you should of course respect your declaration: make sure your files are saved using UTF-8 encoding.
The reason is simple: you tell the interpreter to do IO using a specific charset. When you didn't save your files with that charset, the interpreter will get lost.
Some IDEs and editors will use Latin1 (ISO-8859-1) by default, which explains why Ryan his answer could work. Although it's not a valid solution to the original question being asked, but a quick fix.

Django: Non-ASCII character


Magento2 grunt error

Question: > npm install -D load-grunt-config
npm WARN deprecated firstname.lastname@example.com: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
npm ERR! Linux 4.15.0-52-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "-D" "load-grunt-config"
npm ERR! node v8.10.0
npm ERR! npm  v3.5.2
npm ERR! code EMISSINGARG

npm ERR! typeerror Error: Missing required argument #1
npm ERR! typeerror     at andLogAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:31:3)
npm ERR! typeerror     at fetchPackageMetadata (/usr/share/npm/lib/fetch-package-metadata.js:51:22)
npm ERR! typeerror     at resolveWithNewModule (/usr/share/npm/lib/install/deps.js:456:12)
npm ERR! typeerror     at /usr/share/npm/lib/install/deps.js:457:7
npm ERR! typeerror     at /usr/share/npm/node_modules/iferr/index.js:13:50
npm ERR! typeerror     at /usr/share/npm/lib/fetch-package-metadata.js:37:12
npm ERR! typeerror     at addRequestedAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:82:5)
npm ERR! typeerror     at returnAndAddMetadata (/usr/share/npm/lib/fetch-package-metadata.js:117:7)
npm ERR! typeerror     at pickVersionFromRegistryDocument (/usr/share/npm/lib/fetch-package-metadata.js:134:20)
npm ERR! typeerror     at /usr/share/npm/node_modules/iferr/index.js:13:50
npm ERR! typeerror This is an error with npm itself. Please report this error at:
npm ERR! typeerror     <http://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /var/www/html/hosemart-web/npm-debug.log

Answer: Without knowing more about your actual context, I think it's not finding the package.json file. Make sure you have the following files in your Magento root:

package.json
Gruntfile.js
grunt-config.json

There are "sample" files usually included in the Magento root by default that can be copied/renamed in most cases.
If this doesn't help you may have grunt mis-installed or mid-configured.

Magento Dev Docs: Compile LESS using Grunt
Gruntjs.com: Getting Started
Comment: I have all the 3 files in root & I also removed sample. I had same error for time-grunt, but it got resolved by sudo npm install --save-dev time-grunt but when I try same for load-grunt-config it doesn't work
Comment: How do you mean, `npm install --save-dev load-grunt-config` does not work? What do you see in terms of error messages, etc? Did you run `npm install` or `npm install load-grunt-config`?
Comment: when I run npm install load-grunt-confi I get the error in my question

Magento2 grunt error


Is Kusha (kush) son of Lord Rama?

Question: According to Wikipedia, Lord Rama and Sita have twins named Lava (Luv) and Kusha (Kush). From childhood I have also learnt that Lord Rama had twins. While reading this question, I came across this comment that mentions that Kusha was made by Valmiki as a clone to Lava and that Lord Rama has only one son Lava. Can anyone clarify which of these is true?
Comment: It is absurd who ever said this, it is just absurd
Comment: I remember having read the comment previously. But I cannot find it now..
Comment: Keep searching for truth. It's waiting for u to discover. But be prepared to except it or else it will mess up mind. The scholar of today writers give great dicovery of our religions. Quick tempered minded people should not be involved further studies. We r now about 80years of freedoms and able to express great lord from gean pool. Try to master shiva Puranas and all answer one seeks will be prvovided.
Answer: Of course he is. The Ramayana says Sita gave birth to two sons, not that Vamiki cloned one from the other:

yāmeva rātriṃ śatrughna parṇaśālāṃ samāviśat
  tāmeva rātriṃ sītāpi prasūtā dārakadvayam [VRM - 7.66.1]
Meaning
  On the same night in which Satrughna took shelter in the hermitage,  Sita gave birth to two sons.

That same chapter then goes on to describe how the two sons get the name of Lava and Kusha.  After the birth of the sons, the disciples there informed Valmiki of this and told to protect the new born children from ghosts and demons.
So Valmiki took a grass (Kusha), cut it off (lava) into two parts and sanctified it with mantras. He instructed the women there to rub the upper part to the elder boy and the lower part to the younger boy. That is how they came to be known as Lava and Kusha. [7.66.4-7]
So some probably take that ritual that Valmiki did to save the new born twins from the effect of ghosts, demons etc. as a cloning process, but it is not. As evident from the scripture, Sita gave birth to two sons, there were no clones made by Valmiki.
Comment: @Srikanth yes it's fine, there are so many variations and stories that sometimes it creates doubt as to which one is true.
Comment: Thanks for the reference and details. I knew it but wanted to clarify it as I am newbie in terms of religion.
Comment: @BeHappy Can you tell from where you source your slokas? You seem to have both the sloka and translation for most of the Itihasas and Puranas.
Comment: @Surya Be Happy hasn't been on the site since April.  But you can read the Valmiki Ramayana in Sanskrit here: http://vedicilluminations.com/downloads/Ramayana/itx%20sanskrit/ It's in ITRANS, but you can convert it to Devanagari using this website: http://www.learnsanskrit.org/tools/sanscript
Answer: Yes, Lava and Kusha are definitely both sons of Rama and Sita.  The birth of Lava and Kusha in the ashram of the sage Valmiki is described in this excerpt from the Uttara Kanda of the Ramayana:

On the same night Satrughna housed himself in a thatch-cottage Sita gave birth to twin sons. In the midnight
  the Muni boys came to Valmiki and communicated unto him
  is auspicious intelligence, saying "O illustrious Sir, the
  loved spouse of Rama hath given birth to two sons ; do
  thou so protect them that evil spirits might not injure them."
  Hearing aring those words the highly effulgent Valmiki went there
  and attained to great delight on beholding those two highly
  effulgent sons, resembling the newly risen sun and the celestials.
Thereupon he made arrangements against the oppression of ghosts and goblins. Thereupon taking Kusa (the upper part of the grass) and Lava (the lower part) the great
  ascetic Valmiki made those arrangements. And giving
  Kusa sanctified by Mantras unto the hands of elderly women
  he said, "do ye rub the person of the elder boy with these" ;
  and giving them Lava he said "do ye rub the person of the
  younger brother with this. And according to this I shall
  name the first Son Kusa and the second Lava ; and by those
  names they shall be celebrated on earth."

And just so that there's no doubt that Rama is the father, here is what Valmiki tells Rama about the paternity of Lava and Kusha, in another excerpt from the Uttara Kanda of the Ramayana:

I tell you the truth, O Rama, that these irrepressible twin
  brothers are your sons, O descendant of Raghu. I am
  the tenth son of Pracheta, so, far from speaking untruth
  it does not even spring up in my mind. I therefore
  know the truth that these twins are thy sons.

Is Kusha (kush) son of Lord Rama?


Motorola MC9500 unable to connect to wireless network

Question: I'm trying to connect a unit to my home wireless network. I follow the setup as done at the client site but for some reason at my home network it writes an "Association timeout" error in "Wireless Status" -> "Wireless Log".
Answer: To resolve the issue I had to modify my 5 GHz wireless network settings. I changed the Security mode from WPA2/WPA Mixed Personal to WPA2 Personal (I use my 5 GHz network for mobile devices)

Other tips

When setting up the profile on the mobile device the ESSID is case SensItivE
The option to Allow WPA2 Mixed Mode on the mobile device wireless profile setup, I unchecked. Enabled resurfaces the issue above.
Soft restart the unit (some units you just hold the power button down for 5 seconds)


Contractor regraded and sodded to direct water away - grass now within 1/2 inch or at top of foundation

Question: I have just had some work done to correct a drainage problem at my house.  The engineers specs said to "lower the soil against the house (which I found out means raise the soil up because water is draining under the foundation slab) to expose a minimum of 2-3 inches of foundation."  When they finished, they had raised and graded soil so water will drain away from the foundation, and then put grass sod in, which now brings it up to right near the top of the foundation where the brick mortar meets the foundation.  Some of it is within 1/2 inch of where the house is sided instead of bricked for about 3-4 feet, and also on the east side of my house where the wall is brick.  Is this ok?  It is slanted down away from the foundation.
Comment: I don't understand why 'lower the soil' has been interpreted as 'raise the soil'; both 'raise' and 'lower' have obvious and very specific meanings. Did the engineer who wrote the specs tell you that, or did he inspect the works?
Comment: pictures please!
Answer: There might be two or perhaps three different principles at work here. First and most important is that surface water needs a clear escape path away from the house otherwise it ends up in the basement. So principle one is to slope the land away from the foundation. Second principle is to have the soil at the correct level with respect to the foundation independent of the grade slope. "Lower" the soil could mean that originally the soil was too high, although from your description this does not seem to have been a problem. So holding the grade angle away from the house, does it need raising or lowering with respect to the foundation. The third principle is that particularly on clay soils, when sod is laid freshly on a disturbed substrate there can be a lot of settling to take into account. What seems like a high level right now might quickly settle during a rain to what appears to be a more reasonable final level. If the final level is wrong then it needs to be redone. The trick is to get all three of these principles working together to produce the right final result.


Choosing (key,plain) to produce zero state in middle rounds of AES encrypt

Question: I was told in passing that (key, plain) pairs could be chosen to produce a zero state in AES encrypt in some middle round (say 5).  [The application here being to side-channel leakage assessment.]  However, I can't find any reference.  I assume such a thing could be constructed from various attacks on reduced-round AES.  Does anyone have a reference for the specific question (producing zero state) or for attacks that could be reverse engineered or refactored for this purpose?
Answer: It's quite easy to find such a key, plaintext pair.  All you need to do is:

Pick a key, any key

Expand the key using the standard AES key expansion process

Start with desired block in the middle (e.g. the all 0 block after round 5)

Compute the AES transform backwards (that is, in the decrypt direction) from that block

The final result is the plaintext block.

I don't expect you'd be able to find a reference to this procedure - it's too obvious to be considered publishable...
Comment: OK, guess I was overthinking it.  The person who said this made it seem like they knew some magic trick.


How do the various tools to convert a system image to f2fs work?

Question: Recently I've been trying to install a f2fs compatible rom to my old and slow nexus7. I got as far as flashing a new recovery image and reformatting the device partitions to the new file system, but after trying to install a couple of supposedly compatible ROMs (cm11 and slimkat) and having the tablet stuck at boot I had to revert to the stock image I was running. After some googling it seems I missed a step: "converting" the ROM image to f2fs. There are tools to do that, so I was wondering how do they work actually?
Answer: Looking at the tool described in this howto it seems that it's a simple matter of replacing the boot.img with somethink compatible with f2fs and doing a bit of text search and replace on the unzipped image, replacing the strings
format("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/system", "0", "/system")
format("ext4", "EMMC", "/dev/block/platform/sdhci-tegra.3/by-name/APP", "0", "/system")
mount("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/system", "/system")
mount("ext4", "EMMC", "/dev/block/platform/sdhci-tegra.3/by-name/APP", "/system")
mount("ext4", "EMMC", "/dev/block/platform/sdhci-tegra.3/by-name/APP", "/system")

with
run_program("/sbin/mkfs.f2fs", "/dev/block/platform/msm_sdcc.1/by-name/system")
run_program("/sbin/mkfs.f2fs", "/dev/block/platform/sdhci-tegra.3/by-name/APP")
run_program("/sbin/busybox", "mount", "/system")
run_program("/sbin/busybox", "mount", "/system")
run_program("/sbin/busybox", "mount", "/system")

respectively. (The strings may vary for different devices).
I've tried unzipping a cm-11 and a Slimkat image and the source strings are actually there so the above should work, but I had no such luck for a lollipop factory image, which after unzipping has only .img binary files.


Synonymize [modulus] and [modulo]

Question: The tags modulus and modulo refer actually to the same operation, but aren't yet synonyms. Should we synonymize them?
Comment: @Stijn: Hmmm... I see. But all questions tagged [modulus] are actually about the modulo operation.
Comment: According to [Math.SE - What is the difference between Modulus, Absolute value and Modulo?](http://math.stackexchange.com/questions/472856/what-is-the-difference-between-modulus-absolute-value-and-modulo) they may mean different things depending on the context.
Comment: From what to what though?
Comment: @Qantas94Heavy: I think from [modulus] to [modulo] is the best idea, because there are more [modulo] then [modulus] questions.
Answer: After looking at the real tag usage my personal opinion is that there are some possible solution we could examine.
For first, it would be goof to correct all the questions mistaking the usage of the tag [modulus] with the meaning of [modulo].
Then it's possible to delete the [modulo] tag and choose another word or sentence which could be more clear for the final users. i.e. [modulo-abs-value] and [modulo-rest].
We can think about it..
It could also be really useful to handle disambiguation (as wikipedia is doing) with tags.

Modulus is a term used for absolute value in complex analysis, and
  also a term used for the thing-being-divided-by in remainder
  arithmetic (actually called modular arithmetic)

Synonymize [modulus] and [modulo]


Showing points as one big point

Question: I've already made a map in QGIS, but the problem is that all the points of the coordinates are concentrated in one area in the map and I have to zoom in to see that it is several points. Is there any possible way to clearly see the points without zooming in?
Comment: Please, do not forget about ["What should I do when someone answers my question?"](https://stackoverflow.com/help/someone-answers)
Answer: Use Point Cluster rendering style - where points are closer then a certain distance (7 Millimeters in the screenshot), it will not show individual points, but a separate symbol indicating the number of points inside this cluster.
To change the appearance/style of this symbol (red circle with number) like size, color etc., click on the icon with the A next to Cluster symbol:
Comment: Another option is to use the "Point displacement" renderer that put the points on a circle or on a grid to avoid overlap

Showing points as one big point


is there any advantage in using Raspbian Buster instead of Stretch on a Raspberry Pi Zero

Question: I was wondering if are there some real advantages in using Buster on a Raspberry Pi Zero, or I should continue using Stretch
Answer: What are you doing with this Pi Zero ?
If you're doing some project without connection to internet or just locally (home automation, etc) I would say no. If no big bug endangering your project has been corrected it may no be worth the time and effort required to put again in place your project.
Now, if your Zero is hosting some web server, everything opened to the world it could benefit from kernel updates and other software updates. (Some of them could be patching vulnerability, etc).
In short it's down to safety en reliability against the time you will have to invest to update your project to this new OS.
Comment: exactly, I need it to be as light, low energy consumption, and fast as possible
Comment: I'm using it in a project without connection to internet, just a camera and a USB stick, since I have to set up a new SD card if I there are no advantages I'll install Stretch again
Comment: Are you exporting the images to your USB stick ?
I believe it falls in the first category, you may benefit by keeping the **Stretch** version which may be lighter
Comment: Keep Stretch lite


Possible to use thumb scanner to login to web application?

Question: Is it feasible to allow users to login to my web application (php/mysql) using thumb scanner? USB scanners seems available and not too expensive, but has anyone got experience with it? How to make it work with php so users instead of filling in regular username/password fields would actually be able to login by scanning thumb. Are there any opensource/relatively cheap solutions available? So far I found http://www.m2sys.com/ which looks pretty decent but is a bit expensive, considering I would need to provide initially ~400 users with scanners and all that.
Answer: This would be quite a bit less secure than what they're normally used for, though it could be useful.
You would have to write a client-side app that could communicate with the scanner, or some way for the scanner to get the fingerprint data and then pass that to the server.
However, this is where you really want (need) to do some security. You don't want to just send someone's fingerprint across the internet - that's like sending a password in plain text. Now anyone who was listening can tell you the fingerprint data and hey! logon!
A "better" way would be to have a client-side app that reads the scan data, performs some type of fingerprint analysis, then encrypt either that data or a hash and then send that information across the net.
It's probably a lot more difficult to do a secure bio-key authentication in this scenario - there are others in which it's a better fit. User/pass pairs are ubiquitous so that everyone is used to them (and 90% of your users probably use the same pair everywhere they go), and security to keep them confidential is fairly robust and relatively simple. That's what I'd stick with - it's easier for you, and easier (more familiar) for your users.


Change chord degree

Question: If a chord is at root position and it is a major scale and it is shifted to a degree that makes it a minor chord, is the chord major or minor?
example: C, E, and G is a major chord with c as the tonic. When shifted to the supertonic, D, it becomes D, F, A. So is this chord a minor chord even though the tonic chord is major?
Comment: Did you answer yourself in the first sentence?
Answer: Yes it is a minor chord.
The type of scale does not matter nor does the type of chord you can build off the tonic. Only the notes used to make the chord matter. A major chord will always consist of a root, major 3rd, and perfect 5th and a minor chord will always consist of a root, minor 3rd, and perfect 5th.
Comment: As Dom says, only the notes used to make the chord matter.  The way a major scale is built yields three major, three minor, and one diminished triads.  The chord built on the first step is major, second minor, third minor, fourth major, fifth major, sixth minor, seventh diminished.
Answer: Dom's answer is 100% correct, but I wanted to offer something else that is a little too much for just a comment; it has to do with some important musical terminology, especially between "scale"/"chord" and "tonic"/"root." (And I apologize if this is due to a language issue; as someone currently living in a foreign country, I certainly don't mean to make fun!)
Based on your first sentence, you know what a scale is. Within this scale, we can label specific scale degrees. C is scale-degree 1 in C major, E is scale-degree 3, and B is scale-degree 7. (The upper C returns to scale degree 1; in this case, there is no scale-degree 8.) Thus your question actually references changing scale degree, not chord degree. In other words, scale and chord do not mean the same thing! (Jazz musicians often confuse these due to how improvisation is taught.) Next:

"C, E, and G is a major chord with c as the tonic."

The first part is correct: C, E, and G make a major chord. However, the C here is the root of the chord, not necessarily the tonic. The tonic pitch will always be scale-degree 1 of the entire key, and the tonic chord will be the chord built on scale-degree 1. (Thus C is the tonic pitch in this particular example, so in some way your statement is correct; but I still felt like it needed clarification.)
I say all of this because I wonder if the distinction between tonic and root might clear it up. The key point:

You can be in a key where the tonic chord is major, but another
  chord built off of a different root does not have to be major.

As a quick reference, here's a little image showing the standard triad qualities in major and minor. Upper case is major, lower case is minor, and the little circle by the vii indicates it is diminished.

Now, it's possible you knew all of this and this is redundant...but I wanted to clarify it just in case!

Change chord degree


Strong Signed Assemblies

Question: I have a project I made in Visual Basic 2008 Express. I converted it from someone else's C# project, but it works. It has several DLL dependencies. I went to publish my project so I can install it on another machine and for each DLL, I get an error: "Assembly must be strong signed in order to be marked as a prerequisite." I've done some research, but am not finding a lot and what I have found I don't really understand. What does this error mean? What is the best way to resolve it? One other thing: it took me a LONG time to be able to get all my dll's to reference correctly, so I prefer that the solution has NOTHING to do with moving DLL's around because that will likely break the functionality in my main project.
Answer: If you're publishing via ClickOnce, go to the publish page and click on "Application Files". From there you should see a list of your DLL's. Ensure that the ones that are giving you trouble have their Publish Status marked as "Include" rather than "Prerequisite".
What this error message means is that the current publishing settings are going to expect all of the assemblies in question to be present in the Global Assembly Cache on the target machine before installation can take place. Since all assemblies in the GAC must be strong signed, any assembly marked as a prerequisite that isn't strong signed will give you this error.
Comment: I've looked at every tab and clicked every button in Properties and can't find it. My Publish page has location combo box, language drop down, version number and 3 buttons -- Prerequisites, Updates and "Publish Now." Prerequisites are things like .NET 3.5. Doesn't list any of my dlls.
Comment: Sounds good, but I can't find the publish page or "Application Files." How do I get there?
Comment: Right click on the project, select "Properties".
Comment: +1 solved similar problem with c# project (windows service) in VS 2005 that included an installer component - actually the error appeared at compile time without myself touching or thinking about any "publishing" settings in application properties...
Comment: I voted this up too soon.  I changed _all_ the settings to Include, and I'm still getting this issue on two of my assemblies.
Comment: @David: Are the assemblies in question (and the right versions) listed in the prerequisites?
Comment: +1 - it wasn't exactly my problem, but your follow-up explanation did open a few doors that led to my solution. Exactly what I was looking for!
Comment: If this doesn't work for you: Be sure that all of your assemblies are included in the Release build! Especially when targeting a specific platform, some of your included assemblies might not actually be checked in the Configuration Manager. Dumb, but it got me the rest of the way.
Answer: The workaround is more simple than that:

Go to your project.
Right click and Select Properties.
Go to the Security Tab.
Uncheck Enable ClickOnce security Settings.

Unless you are deploying this application through ClickOnce, you don't need to StrongName your assemblies.
Answer: Strongly named assemblies are mainly assemblies which have are signed by a cryptographic key.  This is fairly easy to do with Visual Studio and does not require re-ordering of your dependencies.
I'm using non-express Visual Studio so the steps may be slightly different for you.

Right click on the project and select properties
Click on the Signing tab
Check "Sign the assembly"
In the combo box select "<New...>"
Complete the wizard
Rebuild
Comment: I did that once and it seemed to help a little. But, then it gave an error about another dependency. I forgot the exact wording, but I did "" again and browsed for that dependency and now I get an error: "Error creating assembly manifest: Bad version of provider".
Comment: @Jason where do you see that message?  Is it a dialog box or a build error?
Comment: It was a build error in the Error tab @ the bottom. I think browsing for that dependency wasn't the right thing to do and now I can't get rid of the reference.
Answer: Check this link out...it has instructions for signing your assembly with a strong name:
MSDN: Signing an Assembly with a Strong Name
Comment: Actually, I came across that page during my research before I answered and it was one of the pages I didn't understand.
Answer: To create a strong name just go to the SDK Command Prompt or Visual Studio 200X Command Prompt then type in the following
sn -k sgKey.snk

Refer this link for details
Then associate the strong name to your assembly by running the below command
al /out:MyAssembly.dll MyOldAssembly.dll /keyfile:sgKey.snk

Refer this link for details
Answer: This just worked for me after the above mentioned solutions failed:
Remove the reference to the assembly in error, then add it again.
Answer: Check that the Target Framework is actually set to 3.5 or whatever framework you want to target. Sometimes it will error out when it's not set properly.
Answer: I found my problem to be in the .csproj  file
<Reference Include="OtherProjectNothingToDo">
  <HintPath>..\..\..\..\Pedidos\XBAP\Pedidos\Pedidos\bin\Release\Pedidos.exe</HintPath>
</Reference>

Then I removed it using notepad and it is okay now.
Answer: Using Adam Robinson's solution allowed me to publish, but I found that users could not install the project once it was published, as the end user system would complain of an inability to install, noting hard drive space.  As this seemed highly unlikely to be the root cause, I looked further into it.
Apparently the basis for my problem was that one of my references was also referencing a .dll that my project used, but a different version.  ClickOnce was not having this, and refused to copy the second version of the .dll to the user's system, citing the version already present.  Fixing it so the .dll and the project referenced the same version of the other .dll removed the error and corrected the install problem.
Answer: I just had this problem too. In my case the blabla.dll was referenced in my solution but blabla.dll was also used in another.dll which i had referenced in my project.
On checking the versions of both blabla.dll they were not the same. So i updated another.dll with the correct blabla.dll and then referenced the new another.dll in my solution. The error was gone.
In short: i was using 2 versions of blabla.dll
I hope this makes sense, if not let me know. :)
Check my blog for more detailed explanation:
Blog article
Regards, Jacob Iedema

Strong Signed Assemblies


Certificate chain

Question: For my computer to verify the identity of a certain certificate should it have all the certificates up to the root certificate?
Answer: Certificate validation requires processing a whole chain from a trust anchor (a "root certificate") down to the certificate which is to be validated. So your computer must have the intermediate CA certificates at some point.
This does not mean that your computer must store those CA certificates. Protocols which handle certificates usually include some provisions to also convey a bunch of "helper objects" which include intermediate CA certificates. For instance, in SSL/TLS, the server sends its certificate along with a bunch of other certificates which are supposed to be the intermediate CA certificates that the client may use to validate the server certificate. So the client has access to the needed CA certificates right when it needs them.
It is still a good idea to keep a local cache of intermediate CA certificates, especially on modern computers where storage is cheaper than network bandwidth.
Answer: According to RFC 2549 section 3.2, under X.509 a the certificate authority (CA) that signed a server certificate may already be stored on the client computer--if it is not, the CA's certificate will need to be signed by another CA, and so on, until the chain reaches a CA whose public key is stored on the client computer.  That one is generally a root certificate.
Under most X.509 implementations, however, there's nothing to stop you from storing a self-signed certificate, or one otherwise not connected to a "root CA" like Verisign, and using that to verify the server's authenticity thereafter.
Comment: As described in section 6 of the RFC, when the hierarchical system's working properly you don't need to manually intervene to trust anything; you will have a chain of certificates starting with one you already trust, and each verifiably trusting the next one down 'til you reach the server in question.
Comment: say certificate certA needs to be verified. Do i need to mark all the certificates between the root and certA as trusted ?
Answer: OK, there's a long answer:

The easy way - if you are only checking that the certificate came from a trusted issuer, then you only need the collection of CAs that may be issuing certificates for you.  This approach is quick and easy, but it eliminates typical best practices, like certificate status checking.
The right way - where there is a higher risk or requirement for better checking the site should (at a minimum) - rebuild the certificate path, check every certificate EXCEPT the root against a certificate status mechanism (CRLs or OCSP), verify validity date of every certificate.

If you want to do it the right way, you should have every CA that is involved in building any certificate that could be used for issuing certificates used for authentication.  When I say "rebuild the certificate path", I mean check that the signature on the certifiate matches up with the public key of the issuer, and the signature of the issuer matches with the public key of it's issuer and so forth until you hit a root certificate where its signature matches its own public key.
You should NEVER need to store the end entity certificate.

Certificate chain


How do I link 2 css files in 1 wygwam entry? is that possible?

Question: I'm using wygwam as a page building field and have a webpage built on dreamweaver attached to 2 css which are the main css and overlay tab panel css. I saw Wygwam Template links from p&t which I was thinking of linking 2 css template, is that possible?
Answer: Not sure about Wygwam, but you can always use the @import option in CSS to internally link another CSS file within the other.
Answer: You could maybe create a custom style set per the P&T docs:
https://docs.pixelandtonic.com/wygwam/using/style_set.html


Cash or nothing option question

Question: I got stuck in one exercise of binary options, it says that I have to consider a stock that does not pay dividends, the current price of the stock is 100, the volatility of it is 20%, the risk-free rate is 4%, consider that the option has a term of one year. Let S(1) be the price of the stock at the end of the contract. The option will pay 10 if 100 <S(1)<120. And it will pay 20 if S (1)> 120. It will pay 0 otherwise. Calculate the price of the option. Now I know that for the second part I will have to use a Cash or nothing call option for the price for I'm not sure what to use in the first part, I also asume that my strike price is 120, is it right? What can I do for the first part? Thanks
Comment: Isn't this the sum of two cash-or-nothing options, one struck at 100 and one struck at 120?
Answer: This is the sum of the folowing cash or nothing (also called digital or binary) options:
1-Call with strike 100 and paying 10.
2-Call with strike 120 and paying 10.
hope it helps!
Comment: Remeber the Pricing formula using Black and Scholes $\begin{align}
&\text{Cash-or-nothing call:}\quad c_{cn}=Be^{-rT}N(d_2),\\
&\text{Cash-or-nothing put:}\quad p_{cn}=Be^{-rT}N(-d_2),\\
&\text{Asset-or-nothing call:}\quad c_{an}=Se^{-qT}N(d_1),\\
&\text{Asset-or-nothing put:}\quad p_{an}=Se^{-qT}N(-d_1).\\
\end{align}$

Cash or nothing option question


How to say just want to let you know politely

Question: I am not a native speaker, is it not polite if I say

Just want to let you know

I am not sure if I told my friend before so I want to make sure she knows where the lesson will take place.
Will it be more polite if I say

Just making sure I let you know
Comment: Hello Elsa, can you provide more details? What is this "lesson"? What are you trying to tell your friend? Is this what you are trying to say: *"I just want to let you know that the lesson will take place here"* ?
Answer: The phrase itself is polite enough, but it is often used in situations where the speaker is being impolite by making the comment (such as correcting a stranger on some trivial mistake). As a result some people interpret the phrase as impolite, even though it is not, itself, impolite.
An unstated assumption of a let you know construction is that your friend doesn't know, but perhaps should already know. In this case, it's possible (though not necessarily likely) that your friend would interpret the comment as suggesting that they need a reminder because of some personal failing.
If your goal is to make sure that your friend is aware of the information, and you are uncertain if they are or not, it may be more polite to emphasize the reason you think they may not have the information:

I don't remember if I told you or not, but the lesson will be at the library.


Recent Russian language changes

Question: What are the most significant changes in Russian language in 20th-21st centuries other than orthography rules and lexicon?
Comment: http://russian.stackexchange.com/questions/8248/is-%D0%B4%D0%BE%D0%BF%D1%83%D1%81%D1%82%D0%B8%D1%82%D1%8C-used-correctly-here is a nice example
Answer: The heavily artificial, but apparently catching, trend towards indeclinable brand names and titles (driven by marketers trying to preserve what they call "brand integrity"). They're using a grammatical loophole of a sort, the implicit qualifier: работа в "Макдоналдс" rather than в "Макдоналдсе" implying в ресторанах "Макдоналдс", etc. This has led to occasional examples of people not declining anything that goes in quotes, including film and periodical titles. Personally I'm worried/grumpy about the younger generation picking up this lack of declension as intuitively "correct", but it's not such a big deal in the end.
In other "kids these days" developments, the malapropist substitution of неприкасаемый for неприкосновенный seems to be unstoppable; it's all over the media and no one cares. The latter word may go obsolete, and the former officially take on a meaning (untouchable as in immune or inviolable) antonymous to its original and strictly correct one (untouchable as in pariah).
A minor but very curious example of English borrowings influencing the Russian phonetic inventory, further than the already semi-accepted /w/, is what seems to be a palatalised glottal stop: at least one video game streamer on Twitch rendered "early drops" (a Hearthstone term) as [ʔʲо]рли-дропы (there's currently no way to even spell it standardly); this may become bigger in the future.
Answer: One trend driven by English influence is shortening some verbs and their derivatives by removing some suffixes in colloquial speech:
программировать -> программить
терраформировать -> терраформить
трансформировать -> трансформить
информировать -> информить

etc.
Comment: I'm not sure this is a recent change. Russian language has the tendency to lose parts of long words in informal speech. This way "студенческий билет" becomes "студень" in speech, but is this new?

Recent Russian language changes


How to get all multi-select user meta values and add them to an array?

Question: I am trying to grab meta_values from a user profile's multi-select field, and convert them to usernames, which I will then input into an array. Let's say that the user has selected two options (out of hundreds) that equal "4889" and "4982". These need to be converted to usernames "shop4889" and "shop4982" (simply by adding "shop" to the beginning of the selections). The results should be put into my array as follows: <code>$usernames = array('shop4889', 'shop4982');</code> Here is what I have so far.
<code>/**
 * Create Shortcode for Grabbing Users
 * Usage: [get_shop_users meta_key="stores" user_id="211"]
 */
function get_shop_users_shortcode( $atts ) {
    $atts = extract( shortcode_atts( array(
        'user_id' => um_profile_id(),  // Profile ID of franchisee
        'meta_key' => '',  // Field we will look up shop numbers
    ), $atts ) );
    if ( ! $user_id || empty( $meta_key ) ) return;

    $meta_value = get_user_meta( $user_id, $meta_key, true );
    if( is_serialized( $meta_value ) ){
       $meta_value = unserialize( $meta_value );
    }
    if( is_array( $meta_value ) ){
         $meta_value = implode(", shop",$meta_value );
    }
    return 'shop' . apply_filters("um_user_shortcode_filter__{$meta_key}", $meta_value ) . '';

    }
add_shortcode( 'get_shop_users', 'get_shop_users_shortcode' );
</code>
This code outputs text as "shop4889, shop4982", but does not work in my array properly. I'm guessing that there is a better way of calling the results?
The array needs to work with the following code, which works fine if I type in the usernames instead of calling them from the user profile.
<code>// Search these Usernames
$usernames = array('shop4889', 'shop4982');

// Fetch the User IDs
$prof_ids = array();
foreach ($usernames as $prof_id) {
    $user = get_user_by('login', $prof_id);
    $prof_ids[] = $user->ID;
}

// WP_User_Query arguments
$args = array(
    'include' => $prof_ids,
);
</code>
Answer: I figured it out...
<code>$meta_value = get_user_meta( $atts['owner'], $meta_key, true );

$store_numbers = array();
foreach ($meta_value as $store_number) {
    $store_numbers[] = 'shop'.$store_number;
}

$usernames = $store_numbers;
</code>


How to remove leaf member values?

Question: I have a dimension hierarchy that is related to multiple fact tables with different granularities. In the case of one fact table, it relates to the middle level of a three level hierarchy.
When you drill down that dimension, I would prefer to have values at that granularity and nothing if you drill down further. The default behaviour seems to be just duplicating the parent total for each of the leaf members.
I thought there was a property to control this but for the life of me I can't find it now.
Comment: I think you are thinking of HidememberIF, but that really only works on Parent-child hierarchies rather than any hierarchy.
Answer: In the cube-designer there is a tab "dimension usage" where you can set IgnoreUnrelatedDimensions for each measure group. When you set IgnoreUnrelatedDimensions to False for the measure group with the values you meant, the result should show null for levels below the granularity level.

How to remove leaf member values?


What are main reasons a typical DSGE model is called non-linear? Why are these non-linearities important?

Question: What are main reasons a typical DSGE model is called non-linear? Why are these non-linearities important? Is a non-linear model inherently less stable than a linear model? Why?
Answer: They are called non-linear because they often consist of non linear equations (although linearized approximations exist).
No matter what kind of empirical research you are doing it is important to avoid misspecification. If relationships are non-linear it's not appropriate to try to fit an linear model which identifying assumption requires linearity. If you would do so your parameter estimates would be biased.
There is nothing inherently unstable about non linear processes. In the context of DSGE models dynamic stability implies there should be no unit root in the modeled series. There is no reason why non-linear series would be more prone to have unit root than linear one.
Comment: Thanks for your answer! However, In Carl Hommes 2015 book on Expectations, it seems he considers DSGE models (being it either RBC DSGE or New Keynesian DSGE) to be linear, or (log)linearized models, on page 3 of the introduction.

He is making a distinction between the non-linear view and the random exogeneous shocks view (with a linear economic model), with both DSGE models and old Tinbergen models being examples of the latter, if I read his paragraph correctly. What are your thoughs about this?
Comment: @BeckBatucada as mentioned in my answer linearized approximation exist. Non-linear models also assume often random exogenous shocks so I am not really sure exactly what you mean by that I would have to read the whole passage. Both RBC and New Keynesian non-linear versions exists as well.
Comment: yes exactly what I though: exo shocks are combined with non-linear models in DSGE approach
maybe I'm misreading Hommes writings


ASP.NET Custom Controls

Question: How do you create a custom control (not an ASCX control) and, more importantly, use it in your project? I'd prefer not to create a separate project for it or compile it as a DLL
Answer: Server controls should be compiled into a DLL. There should be no reason to be afraid of having an additional assembly in your project, and it helps create good project organization.
ASP.NET Server controls are actually custom classes in an assembly. They do not have an "ascx" markup file associated to them.
To use a ASP.NET Server Control, you need to tell ASP.NET where to look for its class.
First, create a Class Library project and add it to your solution, I'll call mine "CustomControls.dll".
Once there, add a simple class to be your webcontrol:
public class Hello : System.Web.UI.WebControl
{
    public override Render(HtmlTextWriter writer)
    {
        writer.Write("Hello World");
        base.Render(writer);
    }
}

Build your project, and add it as a reference to your main web project.
Now, in the ASPX page that you want to use this control, you need to register it, so add this as the first line in the aspx AFTER the Page Directive:
<%@ Register TagPrefix="Example" Namespace="CustomControls" Assembly = "CustomControls" %>

Now, you should have a control named <Example:Hello> available to you. It might take it a minute to show up in intellisense.
Comment: Thanks so much! Not only did this solve my problem but also helped me mature more as a developer.
Answer: Create the class for the control and build the solution. If everything goes well the control should now be available on the toolbox.
Sometimes the VS doesn't update the toolbox. If that happens add the Register directive to the page:
<%@ Register Assembly="NAME_OF_THE_ASSEMBLY" Namespace="NAMESPACE_OF_THE_CUSTOM_CONTROL" TagPrefix="cc1" %>

then just use the control on the page:
<cc1:mycustompanel id="MyCustomPanel1" runat="server"><asp:TextBox id="TextBox1" runat="server"></asp:TextBox></cc1:mycustompanel>

Answer: If you don't want a *.ascx file, you don't want a separate project, and you don't want a *.dll file, what do you think is left?  The code has to live somewhere.
Answer: You mentioned that you wanted to avoid creating a separate project. As the other responses have indicated, it is far more common to simply create a new project to store your custom controls and reference it. It is possible, however, to register a control defined in the same project, using the regular syntax:
<%@ Register TagPrefix="Example" Namespace="CustomControls" Assembly="CustomControls" %>

Where the "Assembly" is the assembly where both the control and the page is located. This works much easier if you are using a Web Application Project, rather than a Web Site.

ASP.NET Custom Controls


How to execute command line script on a different machine from Jenkins

Question: I access Jenkins dashborad located on the server called myserver by accessing the url http://<myserver>:8080/. I have written my build steps on the build part of the job configuration page. After completing the build steps, I need to access a different server and execute a command line script. How do I run the command line script on different server from my current node?
Answer: You have basically two options. The first one is to connect to the machine you want to run the script on in a build step (for example using SSH) and run all the required commands this way. You would need to set up passworldess access (e.g. using SSH keys) for this.
The second option would be to add the second machine as a Jenkins slave, add a second job that is tied to this slave and runs the latter part of the build and tell Jenkins to run this second job when the first job is done. If you need to pass files from the first job to the second, you could make them available as artifacts and download them in the second build.
I would go for the second solution as it's conceptually cleaner. It's more work to set up though.
Comment: Thanks. I have used ssh for connecting to the second machine where I wanted to run the script. I have restricted access to the second machine, So making it as a slave was not possible.
Answer: We have what sounds like a similar situation where we run some automated tests that must be initiated on a non-Jenkins host.    For this, we use ssh and keyed authentication, which requires a bit of setup in the Execute shell step:
# generic prep
eval `ssh-agent -s`
ssh-add ~/.ssh/my-agent-key

At this point, the key is now in the ssh-agent keyring and you can ssh without needing to worry about passwords to any account and host that accepts that key.
ssh testuser@targetmachine "<commands>"

Comment: Thanks for suggesting to use SSH.


Principal Curvatures of a surface

Question: Suppose that a 3-D surface has the property that $|k_1|\leq 1$ and $|k_2|\leq 1$ everywhere, where $k_1$ and $k_2$ are the principal curvatures. Prove or disprove that the curvature $k$ of a curve on that surface also satisfies $|k|\leq 1$.
Comment: Do you mean *normal* curvature of the curve?
Comment: The's a formula relating $k$, $k_1$ and $k_2$, and it's an equality.  Find that formula and you'll have your answer.  From the way you write your question I'm assuming it's a homework question so there's really no need for any more hints than the above.
Answer: I don't think so. Take, for example, a plane, which has principal curvatures zero. Pick a small circle, with radius $R$ smaller than $1$ in that plane. The circle has curvature $1/R>1$.
Comment: I was thinking that the OP might be speaking of non-flat surfaces (by which I mean that we exclude those points on a surface which make the matrix of the II fundamental form identically zero)
Comment: Even if the surfaces are not flat, I don't think the result in the question is valid. The principal curvatures are the minimum and maximum curvatures of curves obtained by normal sections of the surface. But if you consider an arbitrary curve contained in the given surface, you could locally make the curvature as big as possible (I think).
Comment: It's probably right. I wasn't thinking of the problem, I was just making a remark (in our differential geometry class we never dealt with flat points). Even now I don't have time to think - it's almost 6am :)

Principal Curvatures of a surface


Views format: faster fields or rendered entity?

Question: I'm building some views that returns many content types that have different fields, so I'm choosing to display results as "rendered entity" instead of "Fields".
I would like to know if there are perfomance reasons to use fields or rendered entity.
Answer: If you are able to cache the views output, you should not need to think about that problem. If it is not cachable:
I would say rendered entity will cause more overhead due to rendering each field of the content you selected while with fields you could limit it to the needed fields. If rendered entity and fields equal, I would go for rendered entity with display suite.
For actual performance benchmarking try using apache's benchmarking tool for both solutions.
<code>ab -n100 -c1 http://domain.tld/path/to/view
</code>
remember to disable caches while running the tests.
Answer: I came across this thought as well when working on increasing performance on a site recently. On that particular site and view, using fields instead of rendered entity cut the time in half.
Rendered entity: 3500ms
Fields: 1500ms
This, ofcourse, can be a matter of complexity in regards to the entities. We're also using DS on that site, which might influence the results. In either case, it seems like fields is preferable if there are performance issues. It will be a hassle to maintain several different views with fields instead of maintaining one view mode.


Print money to buy and nationalise companies

Question: If there's a water company worth £4 billion making £500 million a year profit, the government "prints" £4 billion and buys the company, then every year "burns" half the profit and reinvests the other half.  Would this work or create damaging inflation in the economy?
Answer: This is a transaction where productive assets change hands, it is not a transaction that reflects production.
Moreover assume that the company oparates exactly as before, producing the same output in quantity and quality and with the same prices and with the same costs.
Then nothing has changed in the economy as regards production (and so income).
The only difference is that the previous owners of the company now have in their hand 4 billion pounds. What will they do with it?
Assume they just keep it in the bank. Then under fractional reserve banking, the bank will be able to offer more loans at a total principal value a multiple of the 4 billion. Will the bank attempt to offer more loans? If it does, will it have to offer lower interest rates to attract willing (and solvent) borrowers? The questions have no ending.
Assume instead that the owners try to spend the 4 billion by purchasing goods from domestic businesses. Is a 4 billion-increased-demand large enough to push prices up (is supply capacity at its limits and stock low) or suppliers will be happy to accommodate, no problem? The questions have no ending.
Assume instead that the owners attempt to import goods from another country...
My point is that such questions can in principle be answered only after assumptions as to the state of the economy have been clearly spelled out (i.e. only in the context of a model). Moreover, for a specific case study, the relative size of the transaction compared to the economic system matters. How is a 4-billion increase in government debt perceived by economic agents?
...and I haven't even touched and the "burning the profits" strategy proposed in the question (and it wouldn't burn it in any case, it would repay its debt to the central bank, which, granted, is the economic equivalent of destroying money).
Answer: This transaction is akin to Quantitative Easing using utility assets instead of Government bonds.  Thus, the main effect is to drive up the prices of utility companies (and other private sector assets), just as QE drove up the prices of government bonds.   This policy 'works' if the aim is to support the stock market, perhaps reasoning that this would create confidence in the marketplace and spur economic activity.
Since the 4bn is removed from the economy over time at the rate of 250mm per annum, I would expect the above effect to be temporary rather than permanent.


Why do the messages in IND-CPA have to be of same length

Question: I understand the general idea of IND-CPA, however I fail to understand why the messages the adversary chooses have to be of same length. I guess that with variable length messages there would always exist a successful attack and therefore CPA security would not exist. Can anyone guide me into a direction on how such an attack would look like?
Comment: One does not want to impose the requirement that schemes need to hide the message length (because that would probably end up being suuuuuuper inefficient).
Answer: Here is an outline of such a distinguisher would work; if you submit a one byte plaintext, then the resulting ciphertext length will follow some probability distribution (with many ciphers, it will be one fixed length; we'll consider the more general case where it is probabilistic); for this probability distribution, we'll have some $N$ where the probability of the length being less than $N$ is $\ge 0.75$.
So, we submit two plaintexts; one consisting of 1 byte, and the other consisting of $N+1$ random bytes.  If the ciphertext corresponds to the short plaintext, the ciphertext will be of length $< N$ with probability $> 0.75$; if the ciphertext consists to the long plaintext, the ciphertext will be of length $< N$ with probability at most $\frac{1}{256}$ (can be shown by the pigeon-hole principle); hence just looking at the length of the ciphertext can serve as the distinguisher.
Obviously, one way to get around this approach would be to pad out all encrypted messages to a fixed length (and have an arbitrary length bound on plaintexts).  However, this sort of thing is expensive in practice; the leaking of the plaintext length is generally considered acceptable.
Comment: Very good answer. I get the idea but don't understand it fully. Can you go into a bit more detail why you chose N + 1 for the long message and how this works out to be the 1/256 probability? Thank you very much!
Comment: @Gilrich: I specifically said that the long message was 'random', that is, randomly chosen out of the $256^{N+1}$ possible messages of length $N+1$.  We assume that the encryption method is invertible; that is, for any ciphertext, there is at most 1 plaintext message that can map to it.  There are $\sum_{i=0}^N 256^i = (256^{N+1}-1)/255$ ciphertext messages of length $N$ or shorter; hence the probability that a random long plaintext message can map to a ciphertext message of length $N$ or shorter must be less than $1/255$ (I said $1/256$, well, that's a minor error)


A cure for a disease. What next?

Question: I have invented a medicine for a very popular skin disease. After some googling I learned that there is not a known cure.
This medicine is made from extraction of a chemical change of a certain plants.
Can this medicine be patented? If yes, is it wiser to patent it or make a contract with a pharmaceutical company?
Answer: Can this medicine be patented?
Yes. You have said your medicine is new. Given there is no current cure, the medicine is likely non-obvious too. Because of this, your medicine itself could likely be patented. In addition, if the method for producing it is also new and non-obvious (which is likely true for the same reasons), the method could also be patented.
Is it wiser to patent it or make a contract with a pharmaceutical company?
This is impossible to answer, as it depends on what your commercial situation is. Both options are valid and reasonable. You should almost certainly discuss this with a patent attorney.
One valid option is to apply for a patent yourself. The downside of this approach is that this would cost quite a bit of money, since patent attorneys are pricey. Although in principle you could do this without engaging a patent attorney, this would most likely result in a patent application that will never be granted.
Another valid option is to contact a pharmaceutical company before applying for a patent. However, if you disclosed it to the company out of confidence, this disclosure would likely prevent you getting a patent in the future. So you would likely need to have them sign a non-disclosure agreement before explaining your invention. This would likely need to be prepared by a lawyer.
Comment: Very nice explanation. I think contracting with a company could get very complicated from testing to production. Could there someone (an istitution, a company or a person) that is willing to invest in this product to get it patented? I did make a contact with a person that is distributing drugs in my country and he said that if it was efficient it could benworth billions?! And I have tested it with a 100% results
Comment: There are investors who invest in medical products, however that is a bit beyond the scope of this site. Perhaps there is a business incubator in your city which can help?

A cure for a disease. What next?