Cannot adjust Brightness 16.04

Question: Complete newbie here. I have installed Ubuntu and love it, but the screen brighness is far too low. I cannot use the computer in the daytime. I have insalled Ubuntu single boot in an intel iMac with rEFInd.
Forgive me if I give too litle information; happy to post outputs of any commands.
Some facts so far:
The slider on "brightness and lock" has no effect at all.
I have tried installing xbacklight and the -in and -dec commands do nothing.
I changed the grub file to say:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_backlight=none acpu_osi=
  " GRUB_CMDLINE_LINUX="acpi_osi=Linux acpi_backlight=vendor"

I also tried "native" and "video" in this last line. No change.
Then I tried this solution: link
sudo apt install sysfsutils
"ls /sys/class/backlight/" returns "acpi_video0"
I don't have a folder called /sys/class/brightness.
$ lspci -nnk | grep "VGA" -A2 gives:

01:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc.
  [AMD/ATI] Whistler [Radeon HD 6630M/6650M/6750M/7670M/7690M]
  [1002:6741]

Then I tried
for i in /sys/class/backlight/*; do echo $i; cat $i/brightness; cat $i/actual_brightness; cat $i/max_brightness; done
and got:

15 15 15

I installed "indicator brightness, which shows values from 1 -15 but has no effect.
I think that what is happening is that the acpi_video0 control is given to a root or BIOS device (maybe EFI partition?)and stuck at 15, which I cannot change.
Any suggestions on what I should do to be able to use Ubuntu is daylight conditions? Much appreciated.
UPDATE: I tried to edit /usr/share/X11/xorg.conf.d/10-radeon.conf
the orginal reads:

Section "OutputClass"     Identifier "Radeon"     MatchDriver "radeon"
    Driver "radeon" EndSection

I changed it to read:

Section "Device"
          Identifier  "card0"
          Driver      "Radeon"
          Option      "Backlight"  "radeon_backlight"
          BusID       "PCI:0:2:0" EndSection

But that dodn't work: the reboot hung on "start user manager for UID 121". So I have edited the file back to the orginal from the live USB.
Any help would be much appreciated!
Answer: You can change brightness in the System Settings >> Brightness & Lock, or if you are in a laptop you can do it by fn + F8/F9 (differs in device used) if you are on a pc then maybe you can change it directly on the monitor.
Comment: Thanks, Joshua, but the slider on "brightness and lock" has no effect at all. I'm on an iMac so there are no brightness buttons on the monitor
Comment: You might want to install third-party apps, try searching google for some.
Comment: I've tried "brightness Controller" and "indicator Brightness" as apps, and tried xbacklight from the terminal. No effect.
Answer: Solved, sort of.
It appears that when installing on a mac, even if you choose the "entire disk" insallation from Ubuntu, mac architecture is left on the machine, including the EFI partition, where OS Recovery lives. This left over stuff is where brightness is controlled from.
So, to solve it, I re-installed MacOS on the machine, then re-installed Ubuntu (17.10 this time) on a new partition. To change brightness, I log in to MacOS to set the maximum brightness, then reboot into Ubuntu. The brightness controls and xbacklight still do not work, but brightness-controller (link here) can adjust the brightness up to the brightness level I was using in MacOS. I think this is because brightness-controller uses xrandr to mimic brightness, rather than actually changing the LCD backlight.
It is still a pain, but at least this way, I can set brightness and use Ubuntu in the daytime. If anyone knows of a better solution, in which I can use the system settings slider to control brightness, that would be great. for now, it is usable though not ideal.

Cannot adjust Brightness 16.04


Is there a word for "rule by criminals"?

Question: Is there a word for "rule by criminals"? Not kleptocracy, which is rule by thieves, but more broadly by criminals.
Comment: 'governed' should do the trick.
Comment: If the criminals are in control they would be able to, and generally would, manipulate the laws so that their acts are not criminal. Are you implying a moral judgement such as implied by the term "banksters"?
Comment: You'll have to elaborate on this concept of yours. Do you mean a situation where the members of government covertly engage in illegal dealings, such as bribery, embezzlement and so forth? Or in a more fictional sort of "City rules by the Thieves' Guild" sort of government?
Comment: Given the number of countries around the world that are, to all intents, ruled by criminals, there should be a word. I think 'mobocracy' normally refers to 'mob' in its traditional meaning. But perhaps it is not an inappropriate word to use for many places.
Comment: The first of the two.  Where government members engage in illegal dealings and potentially use their status to blackmail others.
Answer: Kleptocracy (or kleptarchy) does derive from the Greek word for "thief," but the English word does not literally refer to thieves. Instead it describes a common form of government corruption which features various abuses of power including, but not limited to, embezzlement of public funds.
Mafia state is a related term for governments which have close ties to organized crime. Again, it does not literally refer to the Sicilian Mafia – a mafia state can be tied to any sort of crime syndicate.
Answer: You may be interested in kakistocracy, definition from Wiktionary:

Government under the control of a nation's worst or least-qualified citizens.
Answer: This is an interesting question because it depends upon your meaning:
If you mean the government is filled with people who are not adhering to the laws of that they enforce:  this would just be a corrupt government, riddled with corruption, etc. etc.
If you mean the government is filled with people who've committed crimes, but are now functioning as a standard government that is a different story.  The government would be whatever form it took.  (e.g. A republic of thieves doesn't cease to be a republic.)
Carribean Pirate crews were well known for their democratic governance.
But, several terms have been used to describe "legitimate" governments whose members' morality was questionable.  I've seen criminocracy used in the manner you're describing.  (Also, thugocracy, and others.)  For the most part, if you use the suffix -ocracy with a criminal sounding prefix, people will get your meaning.
Answer: A crimocracy (pronounced "crime-ocracy") or criminocracy.
I've wondered about your question myself as I was interested in writing a book about this very subject, but I couldn't find an answer I liked either. These two answers are the best I could come up with. Sorry if it still doesn't help.
Answer: Through-out history this is most often referred to as an oligarchy.  Brad's definition is good too but I think this is the second time I have seen it.  Oligarchy carries the connotation of criminal/military rule.

ol·i·gar·chy:  a small group of people having control of a country, organization, or institution.
"the ruling oligarchy of military men around the president"
Comment: Oligarchy carries a connotation that is less *criminal*, and more *wealthy* (and ***maybe***) corrupt). The most common use of the term today, for example, is to refer to various Russian 'Oligarchs' as the class of extraordinarily wealthy natural resource and manufacturing tycoons that control Russia's wealth and have a large influence on the government. Many of them have been linked to criminal enterprises, but it is not a prerequisite to membership in the class.


How to watermark a folder of photographs?

Question: 1) I dont know how to write a watermark, like a copyright notice, on a photo.
2) I have a folder of photos which I wish to watermark with the same watermark.
How should I write a watermark on a folder of photographs?
Answer: 2022 Update
There are numerous applications with this feature and if you already have image processing  software you may have access to this feature.
One standout application that can easily do this is XnConvert. This is a GUI version of nconvert with facilities for batch processing, including automated watermarking, conversion and metadata editing, so that you also embed a copyright notice too.
XnConvert is essentially free for personal use but it also has a very affordable company licence price. It is available for Windows, MacOS and a variety of Linux distributions.
Original Answer
Since you seem confused, I suggest you use Picasa. This is a free software from Google. Once you have in installed, follow these simple instructions.
This can be done in Lightroom very easily and in Photoshop with a few more steps but it is overkill to spend money on an expensive software just for watermarking. Some people even do it from the command line using a shell command and free nconvert utility.
One extremely important thing to pay attention to is to watermark on export. Most people do not watermark their original files, that would not be reversible in case you need one day to make a print or a different watermark.
Comment: Recommending a software that has to be paid in perpetuity to solve a simple task is not a reasonable suggestion. Use a command-line tool like `nconvert` or if you prefer a GUI, it's `XnConvert` version.
Comment: Picasa has been depreciated use lightroom instead
Answer: For this, I think I'd use ImageMagick. It's free and oriented primarily toward batch operations like this. The ImageMagick web site has samples for doing watermarking.
Edit: As @Sean pointed out, it is worth noting that ImageMagick is a command-line based tool, so to use it you need to create the right command line. It may not be the most suitable tool for beginners, especially those who've never used command-line based tools.
Comment: ImageMagick is a very powerful tool, but it is likely beyond the skill level of all but the most computer-savvy or very determined photographers. I'm not trying to suggest it's not a good method; in fact it is likely the best way to go in terms of control over the final result. It is just a caveat I think might be worth mentioning, especially given the original asker's apparent level of computer experience.
Comment: @Sean: good point.
Answer: 1) This is simply a matter of adding your watermark on a separate layer above your photo and any adjustment layers. It can be text or a logo - anything you like. Then simply lower the opacity so the watermark isn't too prominent. You can also change the Blending Mode of the Layer to something like Overlay to help it blend in a little.
2) The simplest way is to record step 1 as an action, then use File > Batch to apply the action to a collection of images. Bear in mind that this doesn't give you any control of the placement of the watermark in every image: if you recorded the action to place the watermark in the centre of the image, it will be in the centre of every image.
Answer: Reading the answers, most of them refer to a specific program, and not an overall process, so let me address that.
First, you need to define the style for your watermark, and your copyright notice for that matter.
A copyright notice could be in your webpage as a notice, or on the image itself the IPTC metadata of the image.
A watermark can be a hidden watermark or a visible watermark.
A hidden or invisible watermark is not really a popular way to mark your image. Specialized software is needed to both embed a nonvisible watermark and to read it. And the idea behind it is like an "I got you!" Approach.
So let's focus on a visible watermark.
Here we have probably three options. An intrusive watermark, a small notice, or a signature.
A. The intrusive watermark is one that obstacle the usage of an image by placing a repetitive pattern all over it.
B. A small paragraph of text.
C. A signature is integrated as a part of the image, meant to look good.

Normally for A and C, you prepare a transparent image with only the text you want to overlay opaque or semitransparent.
For A, most likely you need a file with the same proportion of your target images but for the signature alone you can export only the signature.
And if you only want some text (B), some programs let you write it directly in some dialog box.

The next step (or probably the first one) is to back up your files. You do not want to overwrite your files by accident.

Then you need software that allows you to do a batch process.
You can see the different options the other answers provide and need to see specific steps for that program.
You do not need an image editor like Photoshop. This task can be done by some image viewers, for example:

https://www.irfanview.com/
https://www.faststone.org/
https://www.xnview.com/en/

Here is a dialog box on the batch processor. I suggest that you look for specific steps on your specific software googling for example: Irfanview watermark

On the options, you can choose the image you prepared as the watermark, and define the position, the scale, and sometimes additional transparency.
Answer: You can automate this using a Photoshop Action.
Basically you want to add a text layer, then set the layer opacity down to level that looks good (test on light and dark images).  You can add layer style "bevel and emboss".
This looks to be a pretty good tuturial on the subject:
http://www.dpchallenge.com/tutorial.php?TUTORIAL_ID=64
Comment: Thank you MikeW, Its worth it. But do i need any additional software to be installed ? Like Adobe Photoshop ..something ..! Whether it is free version ?
Comment: @Chok - Photoshop is an expensive and very powerful image application. Most people do not need all it has to offer but still get it because they do not know any better. You can get Photoshop Elements for about $100 USD which is largely sufficient for most image editing or Photoshop Lightroom for $250 which does basic photo manipulation but also manages photos and videos. It has lots of functionality and is aimed at professional photographers.
Comment: No you don't have to use Photoshop, but that was in the original tags of your question, so I assumed you were using it.  You could do watermarks with GIMP, which is free.
Answer: If you want several files watermarked at once, or a folder full of files, you can use my watermarking program SquiggleMark. (Disclaimer: I am the author of SquiggleMark)
It is free to use.
You can position your watermark, resize it, set its transparency, and watermark a bunch of files all at once. Works on Windows, Mac and Ubuntu.
Answer: I am personally doing it like this: http://www.paintshoppro.com/en/pages/watermark-photos/ it might be simpler. You should give it a try. ;)
Comment: Can you please extend your answer, quote some parts from the page?


Over which Noetherian local rings are any second syzygy module reflexive?

Question: Let $M$ be a finitely generated module over a local Cohen-Macaulay ring $(R, \mathfrak m)$ such that there is an exact sequence $0\to M \to F \to G$ for some finitely generated free modules $F$ and $G$ . Then is it true that $M$ is reflexive i.e. the natural map $M\to M^{**}$  is an isomorphism ?
Comment: Please see theorem 3.6 of the book "Syzygies , Evan and Griffith".
Answer: The answer is no.  For a nice class of examples, any local ring $(R,\mathfrak{m},k)$ with $\mathfrak{m}$ not principal and $\mathfrak{m}^2=0$ cannot have any syzygies be reflexive, for a sort of trivial reason.  Any (minimal) syzygy embeds into $\mathfrak{m}F$ where $F$ is a finitely-generated free module. As $\mathfrak{m}^2=0$, this forces any syzygy to be a $k$-vector space.  But no k-vector space can be reflexive over such a ring, as $\operatorname{Hom}_R(k^n,R) \cong \operatorname{Hom}_R(k,R)^n$ has dimension  equal to $r(R)n$ where $r(R):=\dim \operatorname{Soc} R$ is the type of $R$.  Since $\mathfrak{m}^2=0$, the socle of $R$ is $\mathfrak{m}$ which, by assumption, has dimension greater than $1$.
However, the claim is true with the additional (relatively mild) condition that $R$ be Gorenstein in codimension $1$.  Recall $M$ satisfies Serre's condition $(S_n)$ if $\operatorname{depth}_{R_{\mathfrak{p}}}(M_{\mathfrak{p}}) \ge \min\{n,\dim R_{\mathfrak{p}}\}$ for all $\mathfrak{p} \in \operatorname{Spec}(R)$. The point is, if $R$ is Cohen-Macaulay and $M$ satisfies Serre's condition $(S_2)$, then one can check reflexivity of $M$ by checking it in codimension $1$; it's a nice exercise. Note that any second syzygy in a Cohen-Macaulay ring must satisfy $(S_2)$, by the depth lemma.  From there one appeals to the fact that maximal Cohen-Macaulay modules over a Gorenstein ring are reflexive. There are several good references for this discussion; I'm partial to A.15 Corollary in Cohen-Macaulay Representations by Leuschke and Wiegand.
Comment: @DylanC.Beck For your first question, which claim do you mean? If one takes a nonminimal syzygy of $L$, then this syzygy splits as $R^n \oplus \Omega^R_1(L)$ with $n \ge 1$, where $\Omega^R_1(L)$ denotes the minimal syzygy of $L$, and so one does not have an embedding into $\mathfrak{m} F$; this embedding is equivalent to the minimality. For your second question, yes, "$M$ is a second syzygy" could be rephrased as "There is an $R$-module $L$ and an exact sequence of the form $0 \to M \to R^n \to R^m \to L \to 0$ for some nonnegative integers $m$ and $n$."
Comment: That is precisely what I suspected. I was simply clarifying that the assumption of *minimal* syzygy was necessary. Thank you very much for clarifying.
Comment: Why do you write "(minimal) syzygy?" Certainly, the claim holds (by definition) if we consider the syzygies of a minimal free resolution. Otherwise, what can be said?
Comment: By the way, when you say "second syzygy," do you mean of any $R$-module?
Answer: The answer is no.
Consider $R=k[X,Y]/(X,Y)^2$. $\dim R=0$ hence $R$ is Cohen-Macaulay. The maximal ideal is $\mathrm{Soc}(R)\cong k\oplus k$.
So there is an exact sequence $0\rightarrow \mathrm{Soc}(R)\rightarrow R\rightarrow R$, where the second map is induced by $k\subset \mathrm{Soc}(R)\subset R$. We know $k^\ast\cong k^2$, so we know $(\mathrm{Soc}(R))^{\ast\ast}\cong k^8$.  This is a second syzygy module which is not reflexive.
So what is the error in the answer above: if $0\rightarrow M\rightarrow F\rightarrow G$ is exact, then the sequence $0\rightarrow M^{\ast\ast}\rightarrow F^{\ast\ast}\rightarrow G^{\ast\ast}$ is not exact in general since $\mathrm{Hom}_R(-,R)$ is contravariant left exact.
The exercise 1.4.20 in Bruns and Herzog's book is [The converse is not true]:

If $R$ is Noetherian ring, $M$ is finite generated reflexive $R$-module, then $M$ is second syzygy.

Proof: Consider $0\rightarrow \Omega(M^\ast)\rightarrow P\xrightarrow  \pi M^\ast\rightarrow 0$. Then we have the long exact sequence:
$
0\rightarrow M\cong M^{\ast\ast}\xrightarrow {\pi^\ast}
P^\ast\rightarrow \Omega(M^\ast)^\ast$. I claim: $Coker(\pi^\ast)$ is torsionless. (A finitely generated module $N$ is torsionless if $N\rightarrow N^{\ast\ast}$ is injective. This is equivalent to $N$ can be embedded in a free module.) If the claim is true, then the result follows. Now consider $0\rightarrow M^{\ast\ast}\rightarrow P^\ast\rightarrow Coker(\pi^\ast)\rightarrow 0$.Take dual:
$0\rightarrow Coker(\pi^\ast)^\ast\rightarrow P^{\ast\ast}\cong P\rightarrow M^{\ast\ast\ast}\cong M^\ast$. Compare this with the first s.e.s, we know $\Omega(M^\ast)\cong Coker(\pi^\ast)^\ast$. Since $Coker(\pi^\ast)$ is submodule of $\Omega(M^\ast)^\ast$, the claim is true.
When the module is reflexive, in proposition 3.4 of "Representation theory of Artin algebras":

The following is equivalent for an Artin algebra $\Lambda$:
  1.$\Lambda$ is self-injective;
  2. Every finite generated $\Lambda$-module is torsionless;   3. Every finite generated $\Lambda$-module is reflexive.

Another case is:

Every maximal Cohen-Macaulay module over Gorenstein ring is reflexive.
Comment: I'm not sure how to conclude that $\Omega(M^*) \cong \operatorname{coker}(\pi^*)^*.$ Could you elaborate?
Comment: @DylanC.Beck Just because there is a s.e.s. $0\rightarrow Coker(\pi^\ast)^\ast\rightarrow P^{\ast\ast}\cong P\rightarrow M^{\ast\ast\ast}\cong M^\ast$\rightarrow 0.
Comment: Why is the map $P^{**} \to M^{***}$ surjective? Ostensibly, it is different from the map $P \to M^*.$
Comment: @DylanC.Beck They are isomorphic. I forget to say $P$ is finitely generated.In this case, $P$ is reflexive. $M^\ast$ is reflexive as $M$ is reflexive by the assumption.


I need help understanding something from a RL circuit problem.

Question: In the below example, why is the voltage source shorted for t>0, and why does it say "the 6-ohm resistor is shorted" in the paragraph about t<0? Isnt it open circuit there?
Comment: When we say the switch was open "for a long time", we mean long enough for the circuit to reach its DC steady state operating point. How do we analyze an inductor in DC steady state?
Answer: At a steady state (DC conditions), the inductor will have no resistance, and will act like a short. Since current wants to take the path of least resistance, all the current will flow through the inductor (instead of the 6 ohm resistor).
For t<0, since the inductor has 0-ohms of resistance, it's short circuiting the current path through the 6 ohm resistor.
For t>0, once the switch closes, all the current from the voltage source will take the path of least resistance through the closed switch leg (as opposed to the other leg that it is in parallel with).
Sorry if I went very basic with this explanation. Hope it helps :)
Comment: @David Think about it. If there is an ideal inductor (zero Ohms, some non-zero inductance) in parallel with a resistor, which direction will the current go? Through \$6\:\Omega\$? Or through the inductor's \$0\:\Omega\$? It's all going to go through the inductor, given enough time to overcome the inductance's reluctance to allowing changes in current. The inductor, given infinite time, looks like a dead short across the \$6\:\Omega\$ resistor. All the current will go through the "short" and not through the resistor.
Comment: @David That said, once the switch is flipped, the current through the inductor cannot be instantly changed, either. So the inductor's current starts out at the same value it was at when the switch flipped. Now, that current must either go through the \$6\:\Omega\$ resistor or else the \$3\:\Omega\$ resistor or else both of them. In this case, it is pretty obvious that about twice the proportion will go through the \$3\:\Omega\$ than through the \$6\:\Omega\$. So it should be about 2/3 amp through the \$6\:\Omega\$ and about 4/3 amp through the \$3\:\Omega\$.... at t=0. After that, it changes.
Comment: for  t<0, im confused by the terminology. If the current doesnt go through the wire containing the 6-ohm resistor, isnt that acting like an open circuit? Also, for t>0, how is it physically possible for the left side of the circuit to have its own current running separately while at the same time have current from the inductor take effect?


Can someone explain why the Compiled Batch-File detected by Antivirus as a threat?

Question: When i create a Batch-File and Compile it to an .exe file (with Bat to Exe Converter), i suffer from a problem that when i execute the .exe file of the Batch my AntiVirus pop-up as the file is a threat or a virus, but i don't have any malicious codes inside the file, just a normal Batch-File Game or something. Can someone please explain to me why is this happens and how to prevent it (Because if i uploaded the file to the Internet for the other users to use it can happen to them as what happened to me), And Thanks!
Comment: Just leave it as a bat file then? Compiled bat files are a common attack vector so your AV probably flagged it due to that since there isn't a lot of need to wrap bats in exes.
Comment: BAT file can **NEVER** be compiled in exe file. **DELETE** that Converter as soon as possible. Those "converter" just wraps the batch file in an exe.
Comment: I think that it is unlikely that the converter itself is a virus. I will point out that this scenario never works for me: *"Hey guys, I think I downloaded a virus. Go to this URL and see..."*
Comment: Just to be clear, as @Biswapriyo pointed out, these are not actually compiled. At best they are encoded. Often they are simply self extracting zip files.
Comment: That means i have a downloaded a Virus?!, that's why the AntiVirus sometimes when i execute the converter pop-up. Here is where i downloaded the converter i think it's the official website : http://www.f2ko.de/en/b2e.php
Comment: It's not a malicious website i just gived you the link to the to the website that i downloaded the software from, i will not cause any harm to anyone -_-
Comment: I'm gonna delete that Converter asap, and thank you for the advise !
Comment: That is exactly what I would say if I were trying to get someone to go to a maliscious site...   :P
Answer: no cyber security expert, but i have experienced this as well. Also this happens if you use binary executable compression tools like UPX.
It seems that these tools add signature to the executable binary that make them be detected as virus by your Antivirus software heuristic algorithm.
I quickly googled to help you out, but it turns out this is a problem for over a decade now.
Apart from simply not using these mechanisms if it is not necessary,  https://superuser.com/a/1117751/428630 offers the advice to send your binary to the AV creator in question to report a false positive. good luck!
Answer: EBGreen in the comments was pretty much spot on. Antivirus programs like to play it safe with batch files wrapped in executables as they can be used to drop malware and whatnot.
The wrapper program itself is most likely safe, but it's the method that it uses that causes the antivirus to trip.
Instead of wrapping the batch file, just develop a program that launches it for the user, drop a shortcut file in the same folder, or if it doesn't need any special configuration, just ask the user to run the batch file directly. There already exists software out there that runs directly from batch scripts.


How do these flavors of liquid smoke differ?

Question: When buying liquid smoke I'm generally faced with a choice of:

Hickory
Apple-tree
Mesquite
Pecan

How do these differ? I'm interested in knowing things that'd help me decide what to pair them with.
Comment: I've tweaked this to ask a slightly more concrete question. In our experience, when we ask "what does X go with?" answers can get a little subjective - "A and B but not C" "no, B, and C, but definitely not A!"
Answer: Mesquite is a very assertive flavor that typically goes with beef, especially fatty beef.
Pecan and hickory are stronger than apple, but milder than mesquite, and are great for pork or poultry, and work just fine with beef.
Applewood is very flexible, a bit lighter and sweeter. It's the only one of the woods you mentioned that I would consider using with fish.
Ultimately, there's no hard and fast rules - taste things and do what works for you!
Answer: Liquid smoke is made from distilling actual smoke and so, to some degree, it tastes like the wood it comes from. For example, I can detect fruity apple notes in apple wood.
Of course, the flavor of smoke itself is far more potent than any of the notes imparted by the type of the wood. In my experiments, I have found that any kind of wood (or liquid smoke) will work for my recipes but some of them are complimented by those extra notes. Again using apple as an example. I really like how apple wood compliments smoked pork.
Some woods are more strongly flavored than others. Oak and pecan are milder flavors that can be used anywhere without distracting. Mesquite is more boldly flavored and will be noticeable.
Some of the actual flavor pairings are just traditional. For example, I am more accustomed to mesquite with beef than pork. I can't say it is really better suited except that I'm used to it.
Smoking web sites will give advice on what woods work well for various applications:
http://bbqrsdelight.com/wood-flavors/
This is a good table. It is a BBQ site so it is all about smoking meat. Notice that most woods work well with any kind of meat. There are descriptions of those extra flavor notes that each wood provides. You can use this to tailor your particular dish.
Answer: Wow!  No one mentions Hickory which is the most often used smoke for Beef and Pork.  Mesquite is typically used for fish and chicken.  Applewood is for fish


Where would be the absolute most logical place in USA to observe the total solar eclipse on August 21, 2017?

Question: Cloudy weather would defeat the purpose so I am guessing that the western states would be more ideal due to greater chance of clear sky.  Isolation would also be nice.  At a camp site on or near a mountain top.  Also, are there efforts to set up mobile solar observatories in the totality path?
Comment: What do you mean by "logistical"
Comment: If you didn't make a hotel or campsite reservation, it might actually be a little too late now. But YMMV.
Answer: I assume that when considering where to view the Solar Eclipse from, you're looking for the place with the best observance of totality. This elicits two factors, the degree of totality and the time elapsed during totality. The best observed eclipse will be a total eclipse, i.e., 100% totality, and for the longest time possible.
A map of the path of 100% totality is shown below. In it, you can see that grey band that passes across the US. Anywhere within that band, you'll be able to see a 100% total solar eclipse.

If you view this interactive map from NASA, you can see two specific points along the totality band that are called out, one labeled GE and one labeled GD.
The GE marker signifies the point of greatest eclipse which is defined as:

The instant when the axis of the Moon's shadow cone passes closest to Earth's center.

The GD marker signifies the point of greatest duration, quite sensibly defined as:

The instant when the length of the total (or annular) phase reaches a maximum along the central path of a solar eclipse.

So, if you're looking for the point of 100% totality that lasts for the longest amount of time, you'll want to be at the point of the greatest duration. Geographically, this is pretty close to Carbondale, IL.
Answer: You are correct that the western states have a higher probability of clear skies.  NOAA analyzed historical data for August 21 and has a web page where they show a map indicating the chances of cloudiness in various parts of the country:

On that map, a white dot indicates a low probability of cloudiness, and the darker a dot is, then the higher the probability of cloudiness in that area.
On the same web page, they have an interactive map that shows the path of totality, and it lets you click on each dot to see the actual percentage chance that the eclipse will be visible, along with a breakdown of probabilities of clear skies, a few clouds, scattered clouds, broken clouds, and an overcast sky.
Based on that interactive map, it seems that Ontario, Oregon has the highest probability that the eclipse will be viewable at 93.3%:
Comment: Great TYVM, Maybe once in a lifetime.  Let's get it right.


How to download videos from YouTube to Google Drive

Question: I am looking for a webapp which can download videos from YouTube to Google Drive. I am preferring pure webapp not browser extension based solutions, because primarily I will use that webapp in mobile chrome browser. There is one webapp https://www.seedr.cc, which is for torrent downloads. I am looking for same, in which I will put YouTube video URL or playlist URL and it will download whole content and push it to Google Drive.
Answer: Unfortunately, under the current Terms of Service, you are not supposed to download videos from YouTube. It is supposed to be a service where you merely view or listen to the content on the website. I quote from the Terms:

The following restrictions apply to your use of the Service. You are not allowed to:

access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service;  (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;
circumvent, disable, fraudulently engage with, or otherwise interfere with the Service (or attempt to do any of these things), including security-related features or features that: (a) prevent or restrict the copying or other use of Content; or (b) limit the use of the Service or Content;

Seeing as there is no download button on the website, the website clearly does not "permit" this by default, and I would consider such a feature a "restriction" on copying content.
Therefore, one should not download YouTube videos directly to Google Drive.
Generically, I would recommend using a sync client such as Backup and Sync or InSync in order to push files to your Google Drive storage.
Answer: You can download Creative Commons licensed videos and upload them encrypted on Telegram with PGPgram (not a web app though).


Subview Doesnt AutoSize When Added to Root View Controller

Question: I have a root view controller that will have up to 10 or so subviews.
I am implementing autorotation/autosize accross the entire app.
My problem is this:
- When I allocate all the view controllers and add each as a subview to the root controller during startup, everything works as it should. The only problem is that each view controller needs time to initialize. This causes my application to load very slowly.

Instead I am trying to allocate the view controllers as they are required. Now I find that if the application goes into Landscape, and I allocate a view controller that is designed in portrait, it will autorotate but the autosize doesnt happen.
In other words as soon as the subview is added to the root controller in portrait mode it rotates and sizes correctly (and stays that way). If the subview is added when the root controller is in landscape it rotates but doesnt autosize (and view sizes remain messed up rotating back to portrait)
I have tried to force an autosize by calling SetNeedsLayout, SetNeedsDisplay, and LayoutIfNeeded but nothing works. I know i could probably do this manually by determining the root controllers orientation and resizing the subviews appropriately, but this is a lot of work for something that should work automatically.
Am I missing something? Any help would be appreciated. My project is an iPad port from an iPhone app, the iPhone app doesnt rotate so Im not sure if this may be something wrong with the 3.2 beta.
Answer: After wrestling with this for a while I added the following code to my subview. It executes  after the view is added to the root view controller. So far it seems to work.
-
<code>(void) AdjustFrame{
 UIDeviceOrientation interfaceOrientation = [[UIDevice currentDevice] orientation];
 if((interfaceOrientation == UIInterfaceOrientationLandscapeLeft)||(interfaceOrientation == UIInterfaceOrientationLandscapeRight))
 {
  CGRect applicationFrame = [[UIScreen mainScreen] applicationFrame];
  CGRect newFrame =  CGRectMake(0.0, 0.0, applicationFrame.size.height, applicationFrame.size.width);
  [self.view setFrame:newFrame];
  [self.view setNeedsDisplay];

 }
}
</code>
Comment: I wish I'd found this a couple of days ago, when I had a similar issue.  Here is my question/answer (very similar to yours): http://stackoverflow.com/questions/2659400/automatically-sizing-uiview-after-adding-to-window


Constant Variance restrictive as a general rule?

Question: Think of a linear regression model:
$$
Y=X\beta+\epsilon
$$
 where $\epsilon|X\sim N\left(0,\sigma^{2}\right)$. The vector of
parameters $\beta$ can be consistenly estimated by OLS. I have one
conceptual question here: first, $\epsilon$ has units of $Y.$ However,
when we minimize the (unweighted) squared sum of residuals, we treat
each observation the same. Conceptually, think of two different values
of $X.$ If the true conditional mean function is linear, that is
in the population:
$$
\mathbb{E}\left(Y|X\right)=X\beta
$$
then the conditional mean of $Y$ changes with values of $X.$ If
$\beta>0$ , then the value of the conditional mean grows with the
values of $X.$ However, under homoskedasticity, the variance of the
error term is assumed to be constant. However, for large values of
the conditional mean, the percentage deviation of the disturbance
decreases and tends to 0. In other words, the error dispersion becomes
more and more miniscule. If $X$ is non-stochastic, then the conditional
variance of $Y$ is $\sigma^{2}$ as well. As such, the conditional
coefficient of variaion of $Y$ is:
$$
\frac{\sigma^{2}}{X\beta}
$$
which goes to $0,$ simply as $X$ increases.. I guess my question
is isn't the heteroskedastic assumption restrictive in its basic principle.
In other words, even if heteroscedasticity is not related to the value
of the regressors, isn't this conceptually incorrect as we are imposing
that the average percentage deviation of the error term from
the conditional mean decreases without bound? Should the error term
not also be scaled by the value of $Y?$  Another way of stating is: an error of an equal magnitude means different things for different values of the regressand/regressors. An error of 1 when Y=10 is much more than an error of 1 when Y=100000; but OLS treats these as symmetric.
Answer: It appears you are describing the well-studied case of the error term being conditionally heteroskedastic, $\text{Var}(\epsilon_i) = h(\mathbf x_i)$. Usual functional forms assumed for $h(\mathbf x_i)$ are
$$ h(\mathbf x_i) = (\mathbf a' \mathbf x)^2, \;\;\;h(\mathbf x_i) = \exp\{\mathbf a' \mathbf x\}$$
These usually imply that the variance of $\epsilon$ increases with the level of the regressors, and so maintain some degree of proportionality.
After H. White developed the theory of heteroskedasticity-robust and consistent estimation without the need to specify a functional form for the heteroskedastic variance, such specifications have been largely abandoned, at least in the field of econometrics, partly because of misspecification worries due to the arbitrary assumption about the functional form of $h(\mathbf x_i$).
It is standard practice to assume an heteroskedastic error and apply White's estimator or some variant of it to estimate the covariance matrix.
Answer: If you have an application where you believe that the conditional coefficient of variation of $Y$ should be constant in $X$, then you probably want a log-log regression model like:
\begin{align}
\ln{Y} = \ln{X} \beta + \epsilon
\end{align}
$Y$ then has conditional mean and variance:
\begin{align}
E\{Y|X\} &=\exp{(\ln{X}\beta)} \cdot E\{\exp(\epsilon)\}\\
V\{Y|X\} &=(\exp{(\ln{X}\beta)})^2 \cdot V\{\exp(\epsilon)\}
\end{align}
The conditional coefficient of variation of $Y$ is then:
\begin{align}
\frac{\sqrt{(\exp{(\ln{X}\beta)})^2 \cdot V\{\exp(\epsilon)\}}}{\exp{(\ln{X}\beta)} \cdot E\{\exp(\epsilon)\}\\} = \frac{\sqrt{V\{\exp(\epsilon)\}}}{E\{\exp(\epsilon)\}\\}
\end{align}
This is invariant to $X$.
You have a minor typo in your question.  The coefficient of variation has the standard deviation of $Y$ in the numerator, not the variance of $Y$.
Answer: I think you may be confused with the term "error". Once conditioning $X$, the conditional variance does not depend on $X$ in the constant variance assumption. It only tells  you how accurate your "measurement on the each $X$" not about how accurate your "final value" itself.
Here is a simple example. Let say I measure the height of my house. I have a poor tool so whenever I measure the height, it looks like 5m +- 1m. Here my "error" looks large (it is about 20% of the height of my house.) However, let say I know my house is on a hill with exactly 1000m altitude. Then, my measure for altitude of my house is 1005m +- 1m. Hence I have a very precise number for the altitude of my house (error is less than 0.1%). However, still variances of my measurements for the height of my house and altitude of my house are same to each other.
Answer: An error of 1 when Y=10 is not much more than an error of 1 when Y=100000.
They are both the same error of 1.
The model is just stating what is. You have variables Y that are a sum of the mean term $X\beta$ plus some noise $\epsilon$ distributed according to $N(0,\sigma^2)$.
You may feel that the noise level is 'worse'. But that is a subjective term, unlike 'more' which can be objectively quantified.
Answer: The big worry seems to be that $\sigma$ is not concerned with the scale of your Y, you are specifically worried about the proportion $\sigma/Y$.
As already mentioned, classical statistics typically focuses on the magnitude $\sigma$, not $\sigma/Y$.  This, in part, is because we can simply calculate that proportion if so desired. For example, when working with zero inflated or overdispersed distributions it is not unusual to discuss the $\bar{x}/\sigma^2$, which is certainly tied to what you are interested in.
One reason (I suspect) we do not use that measure is because practitioners often scale your Y variables in linear regression. This renders the interpretation of the proposed proportion $\sigma/Y$ as universal standard very tricky. Furthermore many regressions (and ML processes) do request standardized inputs prior, which renders the estimates very similar to the measure you're requesting.
@Alecos Papadopoulos has also correctly pointed out that your concern about proportionality of $\sigma/Y$ is in the neighborhood of other concerns about heteroskedacity and heteroskedacity-robust estimators. If you find that there is strong proportionality between $\sigma/Y$, you should investigate heteroskedacity.


Homotopy between two functions to a circle.

Question: Suppose $f,g: X\to S^1$ are such that $f(x)\neq -g(x)$ for any $x\in X$. I need to construct a homotopy between these two functions. Now, the fact that $f(x)\neq -g(x)$ guarantees that there is always a unique shortest path between $f(x)$ and $g(x)$ for any $x$, suppose we call it $\omega_{f(x),g(x)}: I\to S^1$. In fact, we can think of $\omega$ as a function
$$
\omega: S^1\times S^1\times I\to X
$$
Then a homotopy will look like
$$
h: X\times I\to S^1
$$
$$
h(x,t)=\omega(f(x), g(x), t)
$$
so that indeed $h(x,0)=f(x), h(x,1)=g(x)$ for any $x\in X$. The homotopy is continuous because it is a combination of continuous functions in each variable. Have I constructed the right homotopy and is there maybe a way to find an explicit formula for $\omega$? I tried doing that but it turns out to be really complicated.
Answer: You're correct broadly speaking, but you haven't said how you know that $\omega$ is a continuous function of it two arguments. I suggest constructing the homotopy $\omega$ explicitly as follows:
For each $x$, the straight line from $f(x)$ to $g(x)$ passes through the unit disk, but doesn't hit the origin (because $f(x) \ne -g(x)$). You could write
$$
k(x, t) = (1-t) f(x) + t g(x).
$$
Evidently $k$ is a continuous function of $x$ and $t$.
Now since $k(x, t)$ is not the origin for any $(x, t)$ pair, you can radially project it out to the unit circle; that gives you the homotopy you're looking for.
Comment: $f(x),g(x)\in S^1$, and hence $(1-t)f(x)+tg(x)$ does not in general belong to $S^1$!
Comment: I think you missed the part where I said "radially project $k(x, t)$ onto the circle (by which I meant "Let K(x, t) = \frac{k(x, t)}{\|k(x, t) \|}$"); that gives a point that *is* on the unit circle. And since radial projection is continuous away from the origin, we're done.


IDA Pro 6.4 android_server processattach failed

Question: I would like to ask if anyone knows how to solve the above mentioned problem I encounter. I was reverse engineering an apk, and met a part where static analysis with IDA Pro is not enough, so I thought that I could use the android_server provided by IDA Pro to debug the .so library during runtime. However, I kept getting an error from IDA Pro when trying to attach to any process within my emulator: 'The debugger could not attach to the selected process. This can perhaps indicate the process was just terminated, or that you don't have the necessary privileges.' I used adb to push the android_server to my emulator, and then used adb shell and executed the script as root, but I'm still having this error. Any ideas on what am I doing wrong? Thanks in advance!
Answer: As mentioned, you have pushed the android_server to your emulator and executed it. So I guess you may forget forward your data from your development machine to your emulator.
As you executed the android_server, you can see Listening on 0.0.0.0:23946... in your emulator, which means android_server could kown what it should do by getting information from the emulator's port 23946.
Now, you need transfer the information from IDA to your emulator.
To do this, you need:

In IDA, click Debugger -> Select Debugger, choose a debugger accroding to your condition. For me, I choose Remote Linux Debugger.

Click  Debugger -> Process Options, and set hostname to 127.0.0.1, then set  port to 23946 or some other port you want, which your IDA could use to send information.

In your development machine, as Windows, open cmd or powershell, enter adb forward tcp:23946 tcp:23946, so that your IDA can send data to your android_server. For more details for adb forward, please see https://developer.android.com/studio/command-line/adb#forwardports

If fortunately, now, in IDA, click Debugger -> Attach to process, you may see the processes list, which means success.
Answer: I saw such issue in following situations:

When you run android_server as non-root user (without prior call to su).
When you run it with wrong working directory (as '/data/local/tmp/android_serverinstead ofcd /data/local/tmp/ && ./android_server`).

So, please make you sure that you do everything exactly in correct way:
su
cd /data/local/tmp
./android_server

Otherwise it may not work.


A Hamiltonian vector field on $\mathbb{R}^{4}$ which has closed orbit but does not have critical point

Question: Is there a polynomial  function $H:\mathbb{R}^{4} \to  \mathbb{R}$  without  critical points but the corresponding hamiltonian vector field possess at least one closed orbit?
Comment: Just to check, you are asking for the standard symplectic structure on $\mathbb{R}^4$?
Answer: Assuming you are talking about the standard symplectic structure $dx_1 \wedge dy_1+dx_2 \wedge dy_2$, the Hamiltonian $H=x_1^2+y_1^2 + (x_1^2+y_1^2-1)^2 x_2$ works.
The Hamiltonian flow has closed orbits: Let $(x_1, y_1, x_2, y_2) = (\cos \theta, \sin \theta, x_2 , y_2)$. Then $\nabla H = 2 (x_1, y_1, 0,0)=2(\cos \theta, \sin \theta,0,0)$ so the Hamiltonian flow is in direction $(-2 \sin \theta, 2 \cos \theta, 0,0)$. We see that every circle of the form $x_1^2+y_1^2=1$, $x_2$ and $y_2$ constant, is a closed orbit.
There are no critical points: If $\partial H/\partial x_2=0$, then $x_1^2+y_1^2=1$. But then $\partial H/\partial x_1 = 2 x_1$ and $\partial H/\partial y_1 = 2 y_1$ can't both be zero.
Comment: @DavisSpeyer  Thanks for your very elegant example. is it easy to investigate whether this hamiltonian is completely integrable? And another (possible) first integral satisfy this property too?
Comment: I don't know. There is no topological obstacle to having two linearly independent vector fields in $\mathbb{R}^4$ which are tangent to a $2$-torus. I don't know how to make them commute. But that might just be me not knowing a lot of symplectic tricks.
Comment: This $H$ commutes with $x_2$, so it is completely integrable. But the flow corresponding to $x_2$ makes the bounded circles into unbounded cylinders.


Belonging in the sense of belonging somewhere

Question: What is a Latin phrase to express the sense of belonging to a particular place?
How can  this be translated from English to Latin?
Comment: I added some tags to your question and then answered it, but it occurred to me right before posting the answer that I may have misunderstood your question. This might render the new tags and my answer irrelevant. Can you give an example or two of what you mean?
Answer: I suggest the word adjective localis.
It is not exactly the same as the English "local", but evidently related to it.
Lewis & Short translates it as "of or belonging to a place, local".
Some use examples are mentioned in the linked dictionary entry, including adverbia localia ("adverbs of place", Scaurus, De Adverbio et Praepositione 29.8) and localiter ("locally" or "by local inhabitants").
As always, the best translation depends on context, but the adjective localis is my best first guess for "belonging to some place".
Or did you perhaps mean phrases like "I was born here and I belong in this city"?
That would be a completely different story.
Answer: You can say it in various ways to suit the context. For example, for 'belonging to Rome', you might choose from:
Romanus natus sum — I was born a Roman
Civis Romanus sum — I am a Roman citizen
Incola sum Romae — I am an inhabitant of/at Rome


Newsletter subscription email

Question: I am facing below issue in default Magento 22.214.171.124 setup.
I have set Need to Confirm under System->Configuration->Newsletter->Subscription Option option to Yes.
Now when I am trying to subscribe newsletter via newsletter subscription box in footer, Magento is sending newsletter subscription confirmation email.
But when I am trying to subscribe newsletter subscription at the create account page while creating account, magento system is not sending any newsletter subscription confirmation email and directly setting the status as subscribed.
Comment: yes, its a default functionality. You have to set the email conformation for account creation too.
Comment: Thanks @MeenakshiSundaramR , I never realizes that it is default functionality.
Answer: This is a default functionality of Magento.
You can check here Mage_Customer_AccountController::_getCustomer()
You can enable the email conformation for creation creation.
Or else have to override the customerAccount controller to send an email conformation for the newsletter.
Answer: This is the default behaviour of Magento. Because when you made confirmation of newsletter ON, then Magento will send confirmation E-mail to the given E-mail address in order to confirm whether the given email-address is valid or not.
But for a authenticated user, CONFIRMATION is not necessary. Because he is valid user itself. Hence it is logical that, there is no need for confirmation of email address for a valid user. Hence Magento will send a success mail to authenticated user.
If you want to change this flow, then you should make a module and change the logic flow. Please have a look on this extension. It is a good place to start with.

Newsletter subscription email


How do you properly align refference images

Question: Hello everyone im quite new to blender and i have been trying to model a car for quite some time now. I have looked everywhere and didnt find an answer to my question so here it is. Every time i align thing on 2 views the 3rd is WAY off. Images are all the same scale properly aligned using the blender coordinate system(i think). How can i fix this.

edit: Here is the file
Comment: hard to see where is the problem, maybe pack your image (File > External Data > Pack All Into .blend), save and share your file? https://blend-exchange.giantcowfilms.com/
Comment: could you please show a screenshot to illustrate your problem?
Comment: [views](https://imgur.com/a/yKz36pj) here are the views
Comment: I think good models are rarely made using only 3 drawings. Finding good reference data for modelling is often harder than modelling itself. I would recommend finding the car model and taking photographs for reference yourself. Using long focal length lens to minimize perspective distortion. You would just look at them and see if the proportions in the drawings are correct. In reality, if I had an order to model a specific car I would even use photogrammetry to make my life easier, because why not?.. Unless it's a rare expensive car and I cannot find any.
Answer: It really seems like the blueprints aren't very precise, as moonboots already mentioned.
Look:

I've used basic geometry as a guide and marked just two regions which should line up, but don't. The lower right part of the hood (where your active vertex resides) is clearly to high in front view (marked yellow).
In general, it is good practice to evaluate blueprints by doing this before you start.
Here are some rough steps to follow.

Research real world dimensions of your vehicle.
Create a simple box with those dimensions as reference.
Place the blueprints inside the box and make sure they match exactly on the bounds. (Roof, tires, side mirrors, trunk, front)
Check prominent features for alignment. I.e. by using more basic geometry.

That way, you can be aware of any issues right from the start.
--
Blueprints are very often not exact and it won't be possible to place geometry perfectly in all views.
When that happens, you can for example stick to those views that match and work with a bit of offset on the one that doesn't match. Or you can go half way.
Just maintain the shape / curvature of the misaligned view as a reference.
And you should always find good real world reference images to decide on how to proceed with areas where the blueprints are off or don't show enough detail.
--
So, as far as I can see from your blendfile, you've done nothing wrong with the blueprints.
Answer: So I think you just need to select this part:

move it up:

and it looks like you're good?
Comment: i know that but i mean the verticies are off when i align them on 1 view they dont aling on the other. the hood specifically look at it from the right view it is off by a lot. how do i fix that ?
Comment: maybe it's because your blueprint is not 100% perfect, please show a precise example (one vertex that doesn't match)
Comment: it happens to every blueprint i try i must be doing something wrong here
Comment: you need to go on, your roof is a bit curvy so you need to bevel front and rear, then you'll see if it still doesn't match, there may be some slight differences, it depends on the blueprint accuracy I guess


How to install Oracle JDK 14 on my Rasberry Pi 4B?

Question: I'm trying to install jdk 14 on my raspbian pi 4b but all tutorials either show how to download open-jdk or how to download an old oracle jdk version.
I've already tried to install the .deb file without any tutorial (https://www.oracle.com/java/technologies/javase-jdk14-downloads.html) but it does not work.
pi@raspberrypi:~ $ sudo apt install /home/pi/Downloads/jdk-14.0.1_linux-x64_bin.deb
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'jdk-14.0.1:amd64' instead of '/home/pi/Downloads/jdk-14.0.1_linux-
x64_bin.deb'
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
jdk-14.0.1:amd64 : Depends: libasound2:amd64 but it is not installable
E: Unable to correct problems, you have held broken packages.

Is it even possible to install orcale jdk 14 on raspbian?
Comment: raspberry pi is not amd64  ... it's an arm chip ... download (if possible) the arm version
Answer:
Is it even possible to install orcale jdk 14 on raspbian?

The versions on the oracle site currently all appear to be x86-64 (for version 14).  Oracle java is not open source, so no one else could compile it.
So no, there is no way to install it.
Answer: Back in July 2019 Oracle Java 7 and 8 was replaced in Raspbian with OpenJDK 11 but as of now, v14 of OpenJDK was released to GA March 2020.
If you cannot find a binary suitable you may well be able to build this IF you live in the authorised list of countries and are not using it for tasks listed under the licence terms.
My understanding is that both toolkits are built to/under the Java Technology Certification Kit specification and using the Oracle version requires a commercial license from them.
Answer: As mentioned by @goldilocks and @andyroo, you shouldn't be looking at Oracle for suitable JDK for the Raspberry Pi. BellSoft has one with LibericaJDK! I have install scripts for the different versions in https://github.com/FDelporte/JavaOnRaspberryPi/tree/master/Chapter_04_Java/scripts
For JDK 14 on Raspbian OS (32 bit) it is:
cd /home/pi
wget http://download.bell-sw.com/java/14+36/bellsoft-jdk14+36-linux-arm32-vfp-hflt-full.deb
sudo apt-get install ./bellsoft-jdk14+36-linux-arm32-vfp-hflt-full.deb
sudo update-alternatives --config javac
sudo update-alternatives --config java

Update 20200921
If you want to use Java 15 on Ubuntu 64-bit: more info on https://foojay.io/blog/azul-zulu-openjdk-15-on-raspberry-pi/


Required Postal Code for users from countries that do not have a postal code

Question: The system requires an input for the postal code for all users, however the system does not require the postal code for foreign users, and some foreign users do not have a postal code. What is the best way to message the user that has no postal code to enter something. A personalized solution seems ideal, but is not available at this time.
Answer:
What is the best way to message the user that has no postal code to enter something?

A required field does this naturally. I'm from a country that does not have postal codes and I usually encounter this field on websites. I don't recall ever being instructed to enter NA if I don't have a postal code. But that's what I typically enter and it is usually accepted.
Answer: You can't ask users to make up some gibberish postal code, that will translate into a very confusing flow and really bad UX. Instead, you should ask postal code only to users that have it. To do this, ask for country first, then  show that field in a conditional mode:
if $countryWithPostalCode --> show field
else --> do not show field

And then, if you really need that field filled  (can't imagine why, since it will be gibberish, but still), you can use the same condition to fill the field internally in your back end. Like this:
if $countryWithPostalCode = true -->  do nothing
else --> fill with whatever fake code

Just in case, you can grab a list of countries with no postal codes and build the conditional view from this list.
Additionally, you could simply omit the Postal Code requirement altogether, and simply use a Postal Code API in your back-end (there are many, just do a Google search). This way, you'll also lower human error and have more accurate data


Import duty tax UK if the parcel goes back without being delivered

Question: I ordered a parcel from US (I live in UK) and so I paid import duty tax before delivery. Now, for weird reason FedEx didn't delivered the parcel to me and send it back to US. Now, technically there was no import duty tax since the goods have never been imported. Am I entitled to rembursement? Am I right?
Comment: The easiest would be to give the government agency a call that charged the import duty. You are surely not the first one this happened to. They might give you a refund, or refuse. If they refuse, I'd say the chance is 90% that they did so lawfully (if they give you a refund it doesn't matter whether lawfully or not).
Answer: The goods were imported, and then re-exported. Import duty becomes payable at the point of import, regardless of what happens to the item afterwards.


Construction of an $n$-Sphere

Question: I have been thinking about various ways to construct an $n$-sphere. Starting with $S^2$, we can construct it by taking two disks, lifting the "meat" of the disks into a third dimension and then identifying the boundaries. My intuition tells me this should be true for $S^3$ as well by taking two 3-balls and identifying the two boundaries. Should this be true for $S^n$? I.e. can we construct $S^n$ by taking two $n$-balls and identifying the boundaries? Some commentary on these constructions would be welcome as well!
Answer: Yes, that's the way to do it. The two $n$-balls are the upper and lower hemispheres of $S^n$. If you think of $S^n$ as the set of point in $\mathbb R^{n+1}$ with unit norm, then you can decompose this into two sets according to whether the first coordinate is $\geq 0$ or $\leq 0$. Each of these sets is homeomorphic to an $n$-ball by forgetting the first coordinate, giving a projection into $\mathbb R^n$ whose image is all points of norm $\leq 1$.
Comment: @TylerHG: I don't quite understand your question about the circle. Are you asking for topological reasons why the circle is irksome? Or are you just asking how this construction works for a circle? (The same way.)
Comment: Sorry ;). I see it now...forgot that a 1-ball is a segment! Kept thinking of a 0-sphere for some stupid reason

Construction of an $n$-Sphere


What does DLRS Mean as the 4th Most Common Word in ~10,000 News Articles?

Question: I just conducted a frequency distribution of ~10,000 news articles and removing punctuation and stop words (common words like "the", "a", "an", etc.) I Found that the top word after "said", "man", and "vs" is "dlrs." I assume this is an acronym for something but when I Google it all I get it some licensing agency in Maine and some security print group in Ireland. I presume that the nearly 12,000 occurrences of this doesn't refer to either of those, so what could DLRS mean in the context of news many news articles from ~2000-2010? I'm sorry if I'm at the wrong place.
Comment: Oh ya it probably means dollars.
Comment: Dollars? Dealers? Technically, it's not a word, so I recommend adding it to your ignore list.
Comment: Dlrs is not an abbreviation for dollars in the US, where we show dollars with a dollar sign ($) before numbers, and write the word out in other contexts.
Answer: It's quite impossible to know what dlrs refers to without seeing the source material, as there is no single meaning that stands out from any other.
Some uses probably represent dollars, as per Random House Dictionary; others could be various intialisms per AcronymFinder.com; it could be an obvious typo, such as for DSLR, or a more obscure one— on an English QWERTY keyboard, the letters dlrs are very close to those for does, which one would expect to be very common.
Comment: Thank you for the response and I do think that in nearly every case it means dollars (although I've never seen the acronym). I doubt that in published articles there would be no more than a handful of typos of the word _"does"_ that would get _3_ letter wrong especially considering nearly 10,000 articles. I am just rather surprised that it is such a common acronym (it occurs roughly 1.2 times per article in this set of articles) and yet I have never seen it. Maybe it quickly feel out of favor. I am young but still I read quite a bit of the news.
Comment: @DylanSiegler Just because a collection has 10,000 articles does not necessarily mean it is representative of all English. Where did those articles appear? What dialects do the writers and editors speak? What about the intended readers? When were the articles published? If it's 10,000 articles from Gibraltarian financial newspapers, it's a different corpus from 10,000 articles from Filipino entertainment websites.
Comment: They were all American or British English news articles of assorted (mostly finance related) topics.


How to create a REST API cc and bcc for Triggered Send, message Definition Sends

Question: I am in the process of using a Post Rest service for Marketing Cloud messaging services, sending a transactional email using Marking Cloud triggered send functionality. I want to add a cc and a bcc parameter but I cannot figure out the proper way to do it. Originally I put the cc and the bcc function in the options sections and added an array to it, however, those users never got their email. Then, I had the same parameter value be a string only filled with 1 email however that also did not work. Does anyone have any ideas?
Answer: The CC and BCC fields are tied to the send definition, rather than the actual message send. Therefore a fixed address for every message using that triggered send definition is the case this has been designed for.
In order to do this when setting up the triggered send via the interface, you need to put one or more email addresses in (comma separated). If you don't see the fields "CC Email Address(es)" and "BCC Email Address(es)", follow step 1 of the below instructions.
If you like to configure the send definition via API, just supply the email address or comma separated list in the string properties "BccEmail" and "CCEmail".
However, you can get around this in the following way:

Activate the CC/BCC Option in Setup

Go to Setup
Search for "Email Optional Features"
"Enable" the "BCC Emails" feature

Add a field for CC and BCC address to the triggered send's data extension. (for my example they are named "CCAddress" and "BCCAddress" and are of type "EmailAddress")
Prepare the triggered send:

Open the triggered send definition
In "Send Options" set "CC Email Address(es)" to the personalization string %%CCAddress%%
In "Send Options" set "BCC Email Address(es)" to the personalization string %%BCCAddress%%

Include the CCAddress and BCCAddress in your API call within the SubscriberAttributes (JSON path "To.ContactAttributes.SubscriberAttributes.CCAddress", "To.ContactAttributes.SubscriberAttributes.BCCAddress")

Example request body:
{
    "To": {
        "Address": "firstname.lastname@example.com",
        "SubscriberKey": "yoursubscriberkey",
        "ContactAttributes": {
            "SubscriberAttributes": {
                "BCCAddress": "email@example.com",
                "CCAddress": "email@example.com"
                "OtherDataYouMightNeedForTheSend": "asdf"
            }
        }
    },
    "Options": {
        "RequestType": "SYNC"
    }
}

Related documentation:

SOAP API Objects - TriggeredSendDefinition
Create a Triggered Email Message Interaction
Marketing Cloud  Setup - Email Optional Features
Comment: Can also check out this answer as well with similar info as above (https://salesforce.stackexchange.com/questions/72638/rest-api-cc-and-bcc-for-triggered-send)
Comment: Despite the toggle in Setup, I had to open a support case to get this fully enabled
Comment: For me it took a while for the options to become available after enabling the option.


Index on a partitioned key

Question: we have a list partitioned table. Let partitioned column be c1. We have an index on that column(c1). We are planning to drop the index. Our doubt is that if we drop the index, does it affect the performance? Suppose we are querying one of the partition. Does the oracle optimizer directly use the partition segment or rely on index(on the partitioned column) to choose the correct partition or does it perform a full table scan (going through all the segments) if we delete the index?
Answer: First, you can try to monitor index usage.
You will take the answer used index or not used.
Index monitoring can be switched on/off several times to get more information.
For example, here: https://oracle-base.com/articles/9i/performance-enhancements-9i#IndexMonitoring
Also, you can look into v$sql_plan view to see what recent queries used this index:
select s.sql_id, s.sql_text
  from v$sql_plan p, v$sql s
 where p.sql_id = s.sql_id
 and object_name = 'YOUR_INDEX_NAME_HERE' ;

Also, and most importantly, you can make the index invisible for the optimizer.
That way you can clearly see if it affects performance of your queries.
Examples - https://oracle-base.com/articles/11g/invisible-indexes-11gr1
Answer: Eduard's advice to make the index invisible would be a quick way to check.  Some background information:
It would depend on the number of partitions, and amount of data in each partition, and the percentage of data per partition. I assume you are asking whether your queries that have a WHERE clause that specifies the value of the list partition column would be affected.

If you have, say 5 partitions, and fairly even distribution of rows in each partition, the index would probably not be used.  If you have 100 partitions, likely index would be used.
If you have skewed data (IE: list partition A has 100 million rows, list partition B has 10 million rows, and the others have around 1 million rows, the index would likely help, but what would probably help almost as much is if you ensured you had statistics gathered for that column, such as the method_opt=>'FOR COLUMNS C1 SIZE 20' parameter to the DBMS_STATS.GATHER_TABLE_STATS procedure, assuming you had less than 20 partitions.  I.E.: the SIZE 20 is the size of a histogram to use for column C1 so you would want the size to be a little larger than the number of unique values of C1.

You could also do some EXPLAIN PLAN commands with hints to use/ignore the index in question and see what happens.
Comment: could you give us some arguments for your statements
Comment: Yeah, I see I may need to clarify a couple points; but the original post does not give many details.  I'll try to add some more detail on the general approach.

Index on a partitioned key


Dividing hemisphere in equally-sized patches

Question: I want to divide a sphere in equally-sized patches, meaning, the surface of all the patches needs to be the same. The way I am doing it is to divide the radius in $n$ parts, and the surfaces contained between the planes dividing the radius should be the same. I will post an example:

My question is: in the picture, is it true that the surface of the red sector is equal to the green sector? (the two sectors cover 360 degrees). This should apply if I divide the radius by $n$ parts.
My calculus
My answer is yes, but I want to be sure it is correct.
When r = 0.5*R, $\theta$ $\approx$ 0.52 rad
When r = R, $\theta$ $\approx$ 1.57 rad
$$ \int_0^{0,52} 2 \pi R^2 cos\theta d\theta$$
$$ \int_{0,52}^{1,57} 2 \pi R^2 cos\theta d\theta$$

Solving these two integrals, we can prove they are equal. This means that, if I divide the sectors vertically in $m$ parts equally distantiated, all the patches would have the same surface.
Answer: Note that $${\rm Area} \ \{ x^2+y^2=1,\ t_1<z<t_2\} = {\rm Area}\ \{
x^2+y^2+z^2=1,\ t_1<z<t_2\}$$ for $-1<t_1<t_2<2$
Comment: If the polar angle $\theta$ would be subdivided  into a number of symmetric intervals (with respect to the plane $\theta=0$), is it possible to choose such azimuthal angles $\phi$, so that the resulting points on the sphere  will be have 90 degree symmetry? Basically make all 8 quadrants have the same distribution of points on them.


an alternative to progressbar?

Question: could anybody knows any alternatives to progressbar?
Inmy project im using progressbar..I would like to change it to something like a rotating gif image which indicates the processing or someother labels which prevents the user from interacting to the program.I tried to implement the gif image by using background worker but its hanging may be coz of huge file transfer process..
So im searching for someother alternative like a label which will disable the content and prevent the user to interact with the program.
Could anybody help me on this?
Answer: You can use a Circular Progress Bar

an alternative to progressbar?


How are Falcon-9 telemetry data transmission errors handled?

Question: I understand the rocket constantly transmits the telemetry information to an engineering facility on the surface. I also understand it is normal for a transmission channel to create errors in the transmitted data. I know there are redundancy-based data error correction algorithms in place. My question is, what happens if an error is so big that it cannot be corrected by the algorithm. Does the failed packet gets re-requested from the rocket and transmitted again? Or is it considered irrevocably lost?
Answer: This is likely asked in reference to a Tweet by Elon Musk about the CRS-7 failure. Text of the Tweet is:

Cause still unknown after several thousand engineering-hours of review. Now parsing data with a hex editor to recover final milliseconds.

On Reddit, someone posted this very excellent explanation. Not a great source, but best explanation I have seen to date. Specifically, this node:

That's not how this stuff works at all. It's all transmitted CCSDS, typically. Each packet of 1024 bytes typically has it's own error correction code added, in addition to all of the other required features (frame sync markers, virtual channel encoding, etc).
Having had to do this same analysis myself many, many times, I'm guessing that the data is corrupted, particularly the frame sync markers (0x1ACFFC1D... when you do this for a living, yes that's right off the top of your head). When that happens, the Reed-Solomon correction can't really be applied because the frame could have bit slipped and that would make things worse.
So they have to go through each part of the stream in a hex editor manually offsetting things one bit at a time looking for reasonable packet contents (which is almost impossible, as the payload is PN encoded...), and then if they see that, they can then pull of the RS correction symbols and do an error correction, then decode the corrected version again. Then on to the next Kb of data... by hand. You can imagine why this takes a while.

On a Nasaspaceflight.com forum there was an interesting comment on telemetry that is worth pointing at:

Since we're talking about telemetry, I'll throw a bit of my knowledge into the ring.
I build systems that process ground and flight telemetry for spacecraft and instrument avionics (not launch vehicles).
I know nothing about SpaceX' implementation, so I won't even try to give anything specific about their vehicles.
Also, some of what I describe below for spacecraft doesn't apply to launch vehicles as there isn't any time to send commands to a launch vehicle as the launch sequence is highly dynamic and relies heavily on pre-programmed event sequences.  As far as I know, there are no commands sent to a launch vehicle during launch after liftoff, aside from an FTS destruct command.
There are standards at work for telemetry, e.g. CCSDS.  There are also as many different implementations of the 'standard' as there are manufacturers of avionics.
In  everything I work on, flight software does in fact format telemetry, packaging frames inside of headers.  There are multiple layers of framing at work, and there can be many different types of telemetry frames coming down at various rates.
Some things happen on a deterministic schedule, some telemetry can be inserted out-of-order if the priority of the data is high enough, and some things may only come down if there is available bandwidth to send it without disrupting the flow of high-priority telemetry.
Depending on the operating modes of the avionics, there can be many different rates and maps.  For example, if a spacecraft has entered safe mode (or if an emergency mode controller has taken over the operation of a spacecraft), the data rate and telemetry map can switch to fairly low bit rates (better for retrieving data on the ground if there is a pointing or power problem with the transmitters), and the maps can prioritize only critical engineering telemetry.
Many avionics systems can and do acquire data more rapidly than they send telemetry, in which case the telemetry maps define how often and what kinds of data to send.  It is not unusual to have instrumentation for developmental hardware sending telemetry and higher than normal rates.
Likewise, any anomalous condition will often times be prioritized to send that status back as a high-priority telemetry frame.
On all the flight avionics that I work on, there are multiple boxes intercommunicating to flow data that ends up send down in telemetry.  A high-energy event can (and indeed is very likely to) cause telemetry to stop being transmitted even if the avionics and flight software are continuing to acquire data.
Unlike launch vehicles, the rates and maps on most spacecraft can be commanded as well as switched autonomously by flight software.
Almost everything I work on is capable of sending unencrypted telemetry, however in flight use everything I deal with defaults to using encryption.  Aside from encryption, there can be randomization also applied.
There are no analog telemetry signals on anything I work on, and as far as I know, modern launch vehicles to not transmit any analog telemetry- it's all digitally encoded, framed, and transmitted by flight software within the avionics.
The other Jim above mentioned that this type of event could spell the end of store-and-forward telemetry, and I have my own take on this.  I don't believe that it is appropriate to ONLY log telemetry on a launch vehicle, and that engineering telemetry during the early phases of launch should be transmitted live.
I do see the value of a rugged data logger which is essentially digital storage packaged as robustly as it can be, with the intent of building a package that can survive a mishap and be recovered.  This is a very difficult challenge on a launch vehicle as they operate right on the edge of having sufficient margin to even survive as the physics of launch are very challenging.
In the scenario above where a high-energy event kills the communication between avionics, a high-rate log might be able to provide some critical insight into sensor data in a mishap, were it to be recovered.
I to expect, however, with the proliferation of sensors generating engineering and operational telemetry that there will be some lower-priority data which will always be stored and made available for downlink if conditions permit.
It is always better to get all critical sensor data down in near real time than count on retrieval after a mishap.  Picking what sensors are critical is a challenging activity.  In the words of Mr. Musk, some failures can be counter intuitive and a sensor that you thought wasn't critical can, in retrospect, be the most critical sensor needed to decipher an event chain that leads to catastrophic failure of the vehicle.
Comment: Thank you for the answer. However, it still does not answer what happens to the data packets that failed recovery by error correction algorithms - whether they get re-requested from the rocket or considered lost. Will try to ask the guy in the linked answer on the Reddit.
Comment: @VityaSmirnoff They're considered lost. Sometimes, some of it can be recovered from debris (not only during accidents, that also applies for successful launches, e.g. some tourists recently found payload fairings that washed ashore on Bahamas beach from some previous Falcon 9 mission, likely the DSCOVR one, and they had GoPro cams on them with flash storage that was returned to SpaceX and they [released this video](https://www.youtube.com/watch?v=4_sLTe6-7SE)), otherwise you'd extrapolate missing data points from those that you have. Reacquiring / replay during flight is usually not an option.
Comment: @TildalWave Thanks! I think this answers my quesion.
Comment: @geoffc Thanks! That info is very interesting.


Eigenvector Perturbation with a symmetric matrix

Question: Consider the matrix $ \mathbf{M} = \lambda_1 x x^T + \frac{\lambda_2}{2}(\mathbf{A}+\mathbf{A}^T)$, where $x \in \mathbb{R}^n$ is a unit norm vector, and $\mathbf{A}$ is a full rank matrix in $\mathbb{R}^{n \times n}$ with $\|\mathbf{A}\|_F = 1$. Let $u$ be the top eigenvector of $\mathbf{M}$, and suppose that $\lambda_1 > \lambda_2$, is there any theorem lower bounding $\langle x,u \rangle$?
Comment: I guess you also need to assume $u$ normalized? Then Cauchy Schwartz gives a trivial bound.
Comment: Yes, $u$ is normalized. But, I need a lower bound for $\langle u, x \rangle$
Comment: There is no way to constrain whether $\langle x,u\rangle$ is positive or negative since if $u$ is a top eigenvector, then so is $-u$. The best we can hope for is to get a lower bound to $|\langle x,u\rangle|$.
Answer: I assume that we have $\lambda_1 > \lambda_2 \geq 0$.
By the Rayleigh-Ritz theorem, we note that
$$
\lambda_{\max}(M) = \max_{\|y\|=1} y^TMy = \max_{\|y\|=1} \lambda_1 |x^Ty|^2 +
\lambda_2\,y^TAy,
$$
and the vector $y$ for which this maximum is attained is an eigenvector. Thus, we see that
$$
\lambda_{\max}(M) \geq x^TMx = \lambda_1 + \lambda_2\,x^TAx.
$$
Because $y = u$ maximizes $y^TMy$ over the unit vectors $y$, we have
\begin{align}
u^TMu &\geq x^TMx \implies\\
\lambda_1|u^Tx|^2 + \lambda_2 u^TAu &\geq \lambda_1 + \lambda_2 x^TAx \implies\\
|u^Tx|^2 & \geq \frac{\lambda_1 + \lambda_2(x^TAx - u^TAu)}{\lambda_1}.
\end{align}
Now, because $\|A\|_F = 1$, we have $-1 \leq y^TAy \leq 1$ for all unit-vectors $y$. Thus, we can relax the above bound to get
$$
|u^Tx|^2 \geq \frac{\lambda_1 - 2\lambda_2}{\lambda_1}.
$$

Another approach: with the assumption with $u^Tx = 0$, we want a lower-bound to $\lambda_2$. Let $\lambda = \lambda_{\max}(M)$. Define $S = \frac {1}2(A + A^T)$. We know that
$$
Mu = \lambda u \implies \lambda_2 Su = \lambda u.
$$
That is, $\lambda$ is an eigenvalue of $\lambda_2 S$. However, $\|S\|_F \leq 1$ implies that $|\lambda| \leq \lambda_2$. Moreover, we note that
$$
|x^T(\lambda_2 S)x| \leq \sqrt{\lambda_2^2 - \lambda^2}.
$$
Now, we have
\begin{align}
u^TMu &\geq x^TMx \implies\\
\lambda &\geq \lambda_1 + \lambda_2 x^TSx \implies\\
\lambda & \geq \lambda_1 - \sqrt{\lambda_2^2 - \lambda^2}\implies\\
\lambda + \sqrt{\lambda_2^2 - \lambda^2}
& \geq \lambda_1.
\end{align}
For any $0\leq \lambda_2< \lambda_1$, consider the function
$$
f(x) = x + \sqrt{\lambda_2^2 - x^2}.
$$
We note that $f(0) = \lambda_2 < \lambda_1$, but $f(\lambda)\geq \lambda_1$. So,
$\lambda_2$ must be such that there is a solution to $f(x) = \lambda_1$ over the domain $0 \leq x \leq \lambda_2$. We rewrite
$$
x + \sqrt{\lambda_2^2 - x^2} = \lambda_1 \implies\\
\sqrt{\lambda_2^2 - x^2} = \lambda_1 - x \implies\\
\lambda_2^2 - x^2 = x^2 - 2 \lambda_1x + \lambda_1^2 \implies\\
2x^2 - 2\lambda_1 x + (\lambda_1^2 - \lambda_2^2) = 0.
$$
First of all, in order for a solution to this equation to exist, the discriminant  of the equation must be non-negative. We find
$$
(2\lambda_1)^2 - 8(\lambda_1^2 - \lambda_2^2) \geq 0 \iff 8\lambda_2^2 - 4\lambda_1^2 \geq 0,\\
$$
which is to say that we have $\lambda_2 \geq \lambda_1/\sqrt{2}$
so a solution $x \in \Bbb R$ to the above equation exists. This equation has two positive roots, and the smaller of these two roots must satisfy $x \leq \lambda_2$. In other words, $\lambda_2$ must be such that
$$
\frac{4\lambda_1^2 - \sqrt{8\lambda_2^2 - 4\lambda_1^2}}{4} \leq \lambda_2.
$$
Comment: For 2, I think I've fixed the error. For 3, no I don't know of such a reference.
Comment: Regarding 1: $u$ is an eigenvector of $S$, so the Courant Fischer theorem implies that $x^TSx$ is at most equal to the second largest eigenvalue of $S$ and at least equal to the smallest. Moreover, because $S$ is symmetric, $\|S\|_F^2$ is equal to the sum of the squares of the eigenvalues of $S$.
Comment: Thanks for your solution!
I have a question regarding the final bound you derived.
If $\lambda_2 > \lambda_1/2$, then this bound would be trivial. What can we say in that case?
And, are there any conditions that we can impose to make this bound tighter?
Comment: @Rostam22 I that case, there is no statement that can be made with the same kind of generality as the bound that I give. We can make the bound tighter if something is known about $x^TAx$. For instance, if $x^TAx \geq 0$, then we end up with $(\lambda_1 - \lambda_2)/\lambda_1$ instead.
Comment: @Rostam22 Actually, I'm probably wrong to say that there is no other such statement. In any case, I've added a bit to my answer: $\lambda_2 < \frac 23 \lambda_1^2$ is enough to guarantee that $\langle u,x \rangle \neq 0$.
Comment: Thanks! I have some questions about what you did.
1. Why do we have $|x^T \lambda_2 S x| \leq \sqrt{\lambda_2 - \lambda^2}$?
2. I think you made a mistake dealing with the quadratic polynomial, because the coefficient of $x^2$ is 2, not 1.
3. In general, do you know any references where they study the large perturbations, say when $\lambda_2 > \lambda_1$?


How to specify which wallet address to deploy contract with

Question: When deploying with Truffle how do you specify which wallet address to deploy with? I know if you're using web3 you can specify web3.eth.defaultAccount but how would I do this Truffle? I read somewhere to adjust your truffle.js file and add a from but it spits an error for me. How would truffle know which address I'm using to interact with it, e.g. me using MetaMask.
Comment: Can you paste your truffle.js file, the error, and tell us which network you want to deploy to ?
Comment: I'm trying to deploy to testrpc. I'm just wondering how you can get the address that's interacting with a deployed contract
Answer: By default, truffle uses the first account but in truffle.js you can specify the account address in the from property:
module.exports = {
  networks: {
    development: {
      host: 'localhost',
      port: 8545,
      network_id: '*',
      from: '0x0c439ff0170Ab7d7Ef55f2993554eede7321c9b7'
    }
  }
}

If you want to deploy to a network other than localhost then you need to import a wallet provider and pass it your mnemonic.
Here's an example where the mnemonic is read from an environment variable and the provider is set to rinkeby testnet:
const HDWalletProvider = require('truffle-hdwallet-provider')

const mnemonic = process.env.MNEMONIC

module.exports = {
  networks: {
    development: {
      host: "localhost",
      port: 8545,
      network_id: "*"
    },
    rinkeby: {
      provider: new HDWalletProvider(mnemonic, 'https://rinkeby.infura.io'),
      network_id: '*',
      gas: 4500000,
      gasPrice: 25000000000
    }
  }
}

Comment: use the `from` option in the migration file, ex: `deployer.deploy(A, {from: "0x...."})` https://truffleframework.com/docs/truffle/getting-started/running-migrations
Comment: How to specify the account in case of HDWallet?
Answer: The 'from' field didn't work for me, instead, I went to my truffle-config.js file and inserted an additional third parameter for new HDWalletProvider.
The details are elaborated on the trufflesuite sub repo
ropsten: {
  provider: () => new HDWalletProvider(mnemonic, `https://<TESTNET NAME>.infura.io/v3/<INFURA-PROJECT-ID>`,2), //2 here means that truffle will use the wallet address at index 2 when deploying. If you have 3 wallets on MetaMask and you want to use the third wallet, the index should be 2.
  network_id: 3,       // Ropsten's id
  gas: 5500000,        // Ropsten has a lower block limit than mainnet
  confirmations: 2,    // # of confs to wait between deployments. (default: 0)
  timeoutBlocks: 200,  // # of blocks before a deployment times out  (minimum/default: 50)
  skipDryRun: true     // Skip dry run before migrations? (default: false for public nets )
},


Eclipse error mark doesn't disappear after fix

Question: I'm developing an Android application on Eclipse Juno, and using a MAC OS Lion.
When I fix some error in a xml file the error mark doesn't disappear, and it doesn't let me compile the code even if I fix it. I tried deleting it  through Window-> Show View -> Problems , but when i compile the code, the error came back. The only way i figured out to solve it is to crop all the content in the file, save the xml without errors and then paste the same code inside the xml file again, the error just go away as if there wasn't anything there.
Does anyone now why it happens?
Comment: Under Project tab , "Clean"  the project.
Answer: Grahaminn is correct in that seeing the code would be helpful in case there is something that you are missing. However, since you say that it goes away once you cut, save, and paste, I believe you did take care of the error. While I've never found an answer to the same question other than the eclipse compiler obviously has bugs, I have had the same thing happen and have had to resolve the issue in the same way. The compiler, for whatever reason, still sees the error instead of the fix. It is very frustrating but we are stuck doing what you have done until the compiler is fixed.
Comment: It's possible that the file he's trying to fix which breaks again every time he builds, is actually being regenerated (incorrectly) by his build process.
Comment: @grahaminn I agree. But there still isn't an error. He said it goes away after cut, copy, save, paste and it sounds like he isn't getting that same error any more. That's all I was saying is that he did fix the error this way. I think he is having that same issue with different errors
Answer: Update your Android development tools. That bug (Android Lint issues remain even after correcting them) was fixed in ADT 20.0.2.
If you can't or don't want to upgrade, you have the options of

cleaning the project
manually running Android Lint again.

But similar errors will occur again from time to time then.
Answer: Thanks for all the answers. My Eclipse is working properly at least until now, the only thing with still giving me headaches is the R.java file which keep disappearing sometimes , but thats due to problems with ADT i guess. I uninstalled the ADT plugin and installed it again.
Comment: You may already know this but the R.java file won't get generated if you have any XML errors


Canon printer TS8220 ink cartridges

Question: Canon printer TS8220 has stopped printing. I have tried all the suggestions to reset. The PB ink cartridge is empty. Could this be the problem, although the printer was working previously with this cartridge empty.
Answer: It would probably be helpful for alternative suggestions and answers if you write the exact error message that the printer shows in either its display or on the computer.
But yes, an empty cartridge could be the problem.
If it really worked before with the cartridge being fully empty (and not just low on ink), perhaps it was with print jobs that didn't require ink from that cartridge. But it sounds strange that it would print at all with an empty cartridge; it's quite normal for printers not wanting to print anything if one of the cartridges is empty.
Try replacing the empty cartridge with a new one and see if that solves the problem; I expect it will.
Answer: I see 2 possibilities:

In the past the PB cartridge was "low" and now it's "empty". The printer works fine when a cartridge is low, but stops when it is empty.
In the past, the driver was set to print with black in only; this was changed and now it is set to print with all inks. This should be selectable from Printing Preferences.

Canon printer TS8220 ink cartridges


Memorising the fretboard when using dropped tunings?

Question: I'm trying to memorise the notes on the fretboard so that I can more easily apply some of the chordal and scale theory I've been learning, but I downtune quite a lot (half-step down, whole step down, and sometimes with a dropped D too). I'm wondering whether in those cases it's conventional to simply override the downtuning and still refer to the Eb as an E, Ab as an A, etc. I realise the dropped D string would need specific attention, but as for the rest of the board, is that something that's done? Or is it common to be able to just offset in your head after a while?
Answer: Think of the reason you're giving names to notes: communication.
So, it depends who you're communicating with, their expectations of you, and your expectations of them.
When I play soprano ukulele, I think in terms of the guitar fretboard - the intervals between strings are the same as the top four strings of a guitar. So in my head, I play a guitar "D" shape, and my head thinks "D". But in fact, that's a G.
If I'm playing solo, that does no harm, but if I'm duetting with (say) a pianist, though, there will be problems from the start. I say "OK, we open with a D major chord", I strum my D shape, which is actually a G. The pianist plays D, F#, A, and it sounds terrible.
The same happens if you're playing with a bassist who's tuned conventionally, while you're downtuned. You shout "Louie Louie in G", you strum a G shape, which is a Gb chord. The bassist plays an actual G, and it sounds awful.
Of course if the whole band tunes up or down the same amount, then it doesn't matter.
Otherwise, you need to agree how to communicate.

The easiest thing for your fellow musicians, is for you to communicate using the real pitches. That way, they don't need to know how you've tuned your instrument.
However, if they're better at mental transposition than you are, it might be OK to shift that load onto them. "OK, guys, I'm playing with a capo on the third fret here, so when I say 'A' I really mean 'C', is that OK?"
Or you could dodge the issue by talking in relative intervals (after agreeing a key). Instead of "C, F, G", "One, Four, Five".

Orchestras have a similar problem: quite a few brass and woodwind instruments are "transposing instruments", in which the note names don't match standard pitches. Scores written for these instruments are transposed accordingly, and the conductor must remember to use the note names expected by those players, when speaking to them.
Answer: Especially if everyone in your ensemble follows suit, you can think of this as playing with a different reference ptich frequency.
Nowadays, most tuning uses a reference pitch of A'=440Hz.
You can think of down-tuning your guitar as redefining this reference pitch to be a different, lower, frequency.  For example, declaring A'=415Hz is the same as down tuning by one semitone.
As @supercat mentioned, down-tuning can also be thought of as applying  a capo on a negative fret.  In almost all instances guitar charts involving capo give the chords/notes relative to the capo.  In your case, this corresponds to referring to the open 6th string as just "E", even though you've down-tuned relative to concert pitch.
Comment: Not sure why you got the downvote.  Basically, I'd think of having a dropped tuning as being roughly equivalent to putting a capo a "negative" fret, and a capo is just a convenient way of tuning up a guitar (albeit with the consequence of reducing the scale length).  Incidentally, I've seen harpsichords and even a small pipe organ which could be rapidly switched between A415 and A440 by pulling out the keyboard, moving a spacer from one side to the other, and reinserting the keyboard, so the relation between "transposing" and changing reference pitch is a recognized concept.
Answer: If what you're trying to do is memorize the note names, then it's best to stick with one tuning, and learn the notes in that tuning before moving on to others.  Standard tuning is a good choice since it is the "standard".  Learning  the note names in this tuning will facilitate many other types of learning and communication with others within the guitar curriculum(s) and make it easier to use written notation.
We can call what you're using "standard tuning" even if it is one half step down.  In this case you are utilizing a relative tuning where the relationship between the strings is the same as standard tuning.  Imagine you don't have a tuner or reference pitch available and just tuned the strings to what you thought was "E" standard tuning.  In that case you'd call the low "E" string "E", the next string "A" etc, regardless of the actual pitch sounded.
An important exception to the above:  If you happen to be blessed with perfect pitch, then you should tune up to "E" and not "Eb" so that you associate the correct note names with the correct pitches.
Once you have a handle on standard tuning you can learn other tunings as separate entities with offsets from the standard -- if this is even necessary for your style of music and the situations you will encounter with other musicians.
There are cases where there might be good reasons not to take this approach - but - focusing on the learning process - I think it's best not to vary anything when you're tackling a challenging task like learning all the notes on the fingerboard.
Answer: I often play downtuned, and tend to keep thinking of the strings as the standard EADGBE - so you'll play a C chord (for instance), but it'll sound at a lower pitch depending on your tuning.
Obviously, if you play with other people who aren't downtuned then you'll need to get used to transposing the chords/notes you're playing to match them.
Comment: If you've no bandmates, you can call notes whatever you like!
Comment: This is largely what I had been doing, but no, thankfully no bandmates at this point in time ;)


Does SQL Server cache LINQ to SQL queries?

Question: As far as I know, in MS SQL Server 2000+ stored procedures are compiled, and run faster than normal non-compiled queries. I wonder if MS SQL Server also compiles LINQ to SQL queries, and caches that compilation, for performance purposes.
Answer: When it comes to the execution plan in SQL Server there is no major differences in speed with stored procedures vs normal non-compiled queries. See this for more information about other factors about speed.
LINQ-to-SQL generates normal paramatised queries (SQL Server knows nothing about LINQ, the app generates normal SQL) so the balance is the same. That is if you aren't using the LINQ-to-SQL functions which call Stored Procs (assuming you meant the query stuff).
You may also want to read this, which is a similar question, but focuses on the more important benefits of LINQ vs StoredProcs
Answer: SQL Server doesn't know about LINQ.
As far as I know, LINQ runs just as a library that uses the queries to generate SQL queries that are then sent to the server as SQL text commands.
Answer: As far as I know, it behaves as normal queries to SQL Server. You can always call Stored Procedures with LINQ to SQL if benefits exist for your specific case.
Answer: MS SQL Server caches the query plans for anything TSQL that is run against it. Once the plan is cached, the query will run a bit faster. I know that there is an expiration time for this cache, but I haven't asked the dba's about it.
As far as I know, MS SQL Server 2000 was the last one that compiled the stored procs. That's not done anymore. That's why a lot of inline queries are just as fast (with SQL Server 2000+).
Answer: CompiledQueries of LinQ get cached by SQL Server, that's why they are so much faster.
Normal LinQ Queries don't get cached by the SQL Server.
For testing.
Create a normal LinQ Query
Create the same compiled LinQ query.
After the compiled query ran several time, clean the SQL Cache and you will notice that it will have almost the same execution time as the normal LinQ Query the first time.
PS. You can clean the SQL Server cache with the query: DBCC DROPCLEANBUFFERS
So, to answer your question about LinQ queries and caching.
Normal LinQ queries don't get cached and should be used when you only have to run it once.
Compiled LinQ queries DO get cached by the SQL Server and will have performance improvements if you run it more than once.
I just found out about it and i think it's handy to know.
Comment: I don't believe Linq-to-SQL has `CompiledQueries`. But I googled it and I found out that Linq-to-Entities has.