Trying to SCP from Local Mac to Amazon AWS Linux Machine

Question: I am trying to copy a file from my local Mac to my Linux instance running on the Amazon EC2 / AWS Cloud.
I am able to connect to the server via Terminal, but am unable to get my file up to the server.
Here is what I've tried:
(yes, I replaced email@example.com with the actual server info)

scp /Users/me/Desktop/file.txt firstname.lastname@example.com:file.txt
result: Sink: scp: /Users/me/Desktop/file.txt: No such file or directory
scp ~/Users/me/Desktop/file.txt firstname.lastname@example.com:file.txt
result: scp: /home/myuser/Users/me/Desktop/file.txt: No such file or directory

So it seems that when I use the ~/Users/ ... it thinks I am trying to copy the file from the server? But when I only use /Users/ ... , it still says it cannot find the file.
Any help would be greatly appreciated.
More Info ...
Here are some additional tries I have made, all with the same result:

scp localhost:/Users/me/Desktop/file.txt firstname.lastname@example.com:/home/myuser/file.txt
scp /Users/me/Desktop/file.txt email@example.com:/home/myuser/file.txt

Is there something else I need to do to tell it to grab the file from my desktop machine?
Figured it out ...
Okay, so I was trying to do this while I was already connected to the server. It makes sense to me now, but I was connecting to the server and then trying to move the file.
Thank you for all your help and sorry for the confusion !
Answer: Generally you have to specify the path on the remote machine.
So...
scp /path/to/textfile.txt firstname.lastname@example.com:/path/to/where/you/want/it/

Comment: I have also tried that, makes no difference - and doesn't really answer the question of why it is saying it can't find the file on the local computer.
Comment: provide output of 'stat /path/to/file.txt'
Comment: If you're using the wrong syntax, you can get that error message - it's why I suggested it.
Comment: It says that it cannot stat the file... is there something I need to do to tell it to look on my local machine?
Comment: Please see edits to the original post.
Answer: looks like your default directory on remote server is /Users/me/Desktop, you should create the directory on remote server,like this:
mkdir /Users/me/Desktop

or put the file.txt to a exiting path.
ssh /path/to/file.txt email@example.com:/path/to/target/file.ext

Comment: No... /Users/me/Desktop is on my local machine.
Comment: Please see edits to the original post.
Answer: I think you gave defective path to command...
Most absolute path begins with slash "/" which means root directory. It's also applies to remote system. Check this out:
scp /path/to/read/file.txt email@example.com:/file.txt

or
scp /path/to/read/file.txt firstname.lastname@example.com:/path/to/write/file.txt

And also in your condition, you must check path if you get errors. You can check the path by type command below in your folder that where the file.txt is.
pwd

...
Anyway, if you think your file is on the right place, you can change directory to where it is and check the pwd result
if you can change your path by command below:
cd /Users/me/Desktop/

and you can list the file you want to send:
ls -la | grep file.txt
-rw-r--r--  1 me me 14320 2011-11-15 09:50 file.txt

there might be user permission issues.
Check if you can display inside the file by cat file.txt
If you do not have read permission on the file you can't send file to anywhere. First of all you must granted some permissions on that file.


Assign variable for fixed path to FSO to scan folder and subfolders

Question: I have created an excel macro, which loops through the different subfolders of a fixed parent folder. The parent folder directory does not change. I have found a code on the net, which first lets me choose the folder to scan, which is nice, but is awkward for my purpose, since I run the code several times and each time I have to choose the folder again.
Instead I would like to give the macro the fixed full path and do without the prompt to choose the folder. I have written the following code, but do not know how to adjust it to make it work the way I described. Could you give me some advise?
This is the code:
Dim MyPath As String, MyFolderName As String, MyFileName As String, strStartCell2 As String, strFolderToScan As String
Dim i As Integer
Dim F As Boolean
Dim objShell As Object, objFolder As Object, AllFolders As Object, AllFiles As Object, strFileFormat As Object, fso As Object
Dim MySheet As Worksheet

'Define variables and constants
Set strFileFormat = ThisWorkbook.Worksheets("Makro").Range("A6")
strStartCell2 = strStartCell
strFolderToScan = ThisWorkbook.Worksheets("Makro").Range("C4").Value & "\"

'Select folder
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.BrowseForFolder(0, "Please select the folder you would like to scan", 0, 0)
If Not objFolder Is Nothing Then
    MyPath = objFolder.self.Path & "\"
    ThisWorkbook.Worksheets("Sheet1").Range("B3").Value = MyPath
Else
    Exit Sub
End If
Set objFolder = Nothing
Set objShell = Nothing

'List all folders
Set AllFolders = CreateObject("Scripting.Dictionary")
Set AllFiles = CreateObject("Scripting.Dictionary")
AllFolders.Add (MyPath), ""
i = 0
Do While i < AllFolders.Count
    Key = AllFolders.keys
    MyFolderName = Dir(Key(i), vbDirectory)
    Do While MyFolderName <> ""
        If MyFolderName <> "." And MyFolderName <> ".." Then
            If (GetAttr(Key(i) & MyFolderName) And vbDirectory) = vbDirectory Then
                AllFolders.Add (Key(i) & MyFolderName & "\"), ""
            End If
        End If
        MyFolderName = Dir
    Loop
    i = i + 1
Loop

'List all files
For Each Key In AllFolders.keys
    MyFileName = Dir(Key & "*." & strFileFormat)
    Do While MyFileName <> ""
        AllFiles.Add (Key & MyFileName), ""
        MyFileName = Dir
    Loop
Next

'List all files in Files sheet
Sheets("Makro").Range(strStartCell2).Resize(AllFiles.Count, 1) = WorksheetFunction.Transpose(AllFiles.keys)
Set AllFolders = Nothing
Set AllFiles = Nothing

Probably this is simple, but i just can't figure out how to do it.
Thanks a lot in advance!
Oliver
Comment: I don't get your issue. You can just use any variable (or constant) and set the path there like: `Dim FixedPath As String: FixedPath = "C:\My\Path\to\Somewhere\"` or a constant like `Const FixedPath As String = "C:\My\Path\to\Somewhere\"`. If that does not solve please improve your question and explain where exactly your issue is.
Comment: Hello PEH, thanks for your quick answer. The fixed path is not the problem, this I already have in the variable strFolderToScan. My question is how do I get this fixed path into the code, so that the program does not ask me to choose a folder, but takes the pre-defined path instead.
Comment: You simple comment all code lines starting from `'select folder` up to `Set objShell = Nothing` and replace with `MyPath = Thisworkbook.path  & "\" & "MyFolder\"`, Followed by `ThisWorkbook.Worksheets("Sheet1").Range("B3").Value = MyPath`. Of course, you may use any (valid) path...
Answer: This is the relevant part for selecting the folder
'Select folder
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.BrowseForFolder(0, "Please select the folder you would like to scan", 0, 0)
If Not objFolder Is Nothing Then
    MyPath = objFolder.self.Path & "\"
    ThisWorkbook.Worksheets("Sheet1").Range("B3").Value = MyPath
Else
    Exit Sub
End If
Set objFolder = Nothing
Set objShell = Nothing

Especially the objShell.BrowseForFolder is the part that asks you to browse for the folder. So you need to replace that to use strFolderToScan directly. We do that by using objShell.GetFolder(strFolderToScan) to get the folder from your path strFolderToScan.
But I recommend to check if the folder actually exists, so you do not run into errors:
'Select folder
Set objShell = CreateObject("Shell.Application")
If objShell.FolderExists(strFolderToScan) Then
    MyPath = strFolderToScan
    ThisWorkbook.Worksheets("Sheet1").Range("B3").Value = MyPath
Else
    MsgBox "The folder '" & strFolderToScan & "' does not exist."
    Exit Sub
End If
Set objShell = Nothing

Comment: Hello PEH, thanks for contribution. The idea given by FaneDuru was however easier to understand for me. I nevertheless tried your code also, but wasn't successful in implementing it into my code to make it work. However, many thanks also to you!
Comment: It's just replacing the first code block in my answer with the second code block. That's it.


Possible values of a $f(x)=(ab-b^2-2)x+\int_{0}^{x} x^2(\cos^{4}t+\sin^{4}t)\mathrm{d}t$

Question: Suppose $f(x)=(ab-b^2-2)x+\int_{0}^{x} x^2(\cos^{4}t+\sin^{4}t)\, \mathrm{d}t$ is a decreasing function of $x$, $x$ is a real number. What are the possible values of $a$?
$b$ is independent of $x$.
I tried Newton Leibniz formula. How should I proceed after that?
Comment: $\cos^{4t}$ must be $\cos^4t$ for otherwise no variable for integration.
Comment: I'm assuming $\cos^{4t}$ should be $\cos^4t$?
Comment: @BrianFitzpatrick this could be an exotic operator ;)
Answer: \begin{align}
\int_{0}^{x} (\cos^{4}t+\sin^{4}t)\, dt&=\int_{0}^{x} ((\cos^{2}t+\sin^{2}t)^2-2\cos^{2}t\sin^{2}t)\, dt
\\
&=\int_{0}^{x} (1-\sin^{2}{2t}/2)\, dt
\\
&=x-\dfrac1{4}\int_{0}^{x} (1-\cos{4t})\, dt
\\
&=\dfrac{3}{4}x+\dfrac1{16}\sin{4x}
\end{align}
So
$$
f(x)=(ab-b^2-2)x+\dfrac{3}{4}x^3+\dfrac{x^2}{16}\sin{4x}
$$
And
\begin{align}
f'(x)&=(ab-b^2-2)+\dfrac{9}{4}x^2+\dfrac{x}{8}\sin{4x}+\dfrac{x^2}{4}\cos{4x}
\\
&=(ab-b^2-2+2x^2+\dfrac{x}{8}\sin{4x})+\dfrac{x^2}{4}(1+\cos{4x})>0
\end{align}
for large $x$.
So there are no $a,b$ for $f$ to be a decreasing function.
Comment: Why are you considering large $x$ only ? $f'(0)=ab-b^2-2$ can be negative, isn't it ? Could you please clarify for me ? Thanks.
Comment: It says $f$ is a decreasing function for all $x$. So I just prove that is impossible since for large $x$, $f'>0$. $f'(0)$ is trivial.
Comment: I do not see *for all* $x$. I totally agree with you for large $x$.
Comment: If not for all $x$, it should specify what $x$. The question is not precise.
Comment: Be sure that I fully agree with you. The question is effectively not precise. Cheers :-)
Comment: When you look at $g(x)=\frac{1}{16} x^2 (4 \cos (4 x)+12)+\frac{1}{8} x (12 x+\sin (4 x))$ it is always $\geq 0$ and $f'(x)=(ab-b^2-2)+g(x)$. So, it is sufficient that $ab-b^2-2 <0$ to have a portion of the function which decreases. End of the story, I bet. Cheers.


Extending Javascript objects with CoffeeScript

Question: I want to add the ability to extend javascript objects by adding a method to the prototype.
The method will receive one or more other objects and will add all of the key/values to this.
This is what I came up with:
Object::extend = (objects...) ->
    @[key] = value for key, value of object for object in objects

or this:
Object::extend = (objects...) ->
    for object in objects
        for key, value of object
            @[key] = value

Both work as expected, and compile into the same javascript code:
var __slice = [].slice;

Object.prototype.extend = function() {
  var key, object, objects, value, _i, _len, _results;
  objects = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
  _results = [];
  for (_i = 0, _len = objects.length; _i < _len; _i++) {
    object = objects[_i];
    _results.push((function() {
      var _results1;
      _results1 = [];
      for (key in object) {
        value = object[key];
        _results1.push(this[key] = value);
      }
      return _results1;
    }).call(this));
  }
  return _results;
};

What I'm not too happy about is the whole results thing that is created per for loop which is completely redundant for my purpose.
Is there a way to get a code more like:
Object.prototype.extend = function() {
  var key, object, objects, value, _i, _len;
  objects = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
  for (_i = 0, _len = objects.length; _i < _len; _i++) {
    object = objects[_i];
    (function() {
      for (key in object) {
        value = object[key];
        this[key] = value;
      }
    }).call(this);
  }
};

Thanks.

Edit
I'm aware that I can simply embed javascript code, but looking for a coffeescript solution.
Comment: Have you noticed the `coffeescript` tag? The javascript code is the result of compiling coffeescript into javascript, I did not write that js code.
Comment: Just noticed that and removed my comment immediately... Oops.
Comment: Yuck, modifying `Object.prototype`
Comment: Yeah, I know, this was just to test a few things
Comment: The code above can be updated with a check for properties object's only and leave the properties inherited from prototype away. [JSFiddle](http://jsfiddle.net/bogdan_vq/fWzVG/1/)
Answer: You can try adding an explicit return:
Object::extend = (objects...) ->
    for object in objects
        for key, value of object
            @[key] = value
    return

That produces this:
var __slice = [].slice;

Object.prototype.extend = function() {
  var key, object, objects, value, _i, _len;
  objects = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
  for (_i = 0, _len = objects.length; _i < _len; _i++) {
    object = objects[_i];
    for (key in object) {
      value = object[key];
      this[key] = value;
    }
  }
};

Every CoffeeScript function returns the value of the last expression in the function, CoffeeScript loops are also expressions. That means that CoffeeScript has to build all that _results stuff to produce a return value for your function since you had an implicit return applying to the outer loop. If you remove that implicit return by adding an explicit "return nothing" then the CS→JS compiler seems to be smart enough to not do all that extra _results work.
Comment: Great! This is exactly what I was looking for! Though I went with my first version. Thank you.
Comment: It is better to return @ in the end to make possibility of chain calls .


pex built by pex doesn't run outside its virtualenv

Question: TL;DR
I built pex according to the guide https://pex.readthedocs.io/en/v2.1.145/buildingpex.html and was expecting it to run fine outside of the virtualenv I used to build it, but alas:
$ ~/bin/pex
env: python3.9: No such file or directory

What I tried
I am reading pex's guide https://pex.readthedocs.io/en/v2.1.145/buildingpex.html and following their first "recipe" to build pex itself

You can build .pex files using the pex utility, which is made available when you pip install pex.
Do this within a virtualenv, then you can use pex to bootstrap itself:

In an empty directory, I created a fresh venv

$ python3 -m venv venv

Activate the venv

$ . venv/bin/activate

Insatll pex

(venv) tmp $ pip install pex
Collecting pex
  Downloading pex-2.1.145-py2.py3-none-any.whl (2.9 MB)
     |████████████████████████████████| 2.9 MB 4.1 MB/s
Installing collected packages: pex
Successfully installed pex-2.1.145

Build pex

$ pex pex requests -c pex -o ~/bin/pex

Try pex interactively

$ pex
Python 3.9.6 (default, May  7 2023, 23:32:44)
[Clang 14.0.3 (clang-1403.0.22.14.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> ^D
now exiting InteractiveConsole...

The documentation says:

you can use pex in or outside of any virtualenv.

Therefore, I deactivate the venv and then try to run pex again:

$ deactivate
$ ~/bin/pex
env: python3.9: No such file or directory

What am I missing?
Additional information
Platform: MacOS Ventura 13.5.1
Answer: Thanks to this SO question I learned about the --python-shebang option.
In my case, I first searched the path of the Python 3 interpreter on the system:
$ which python3
/usr/bin/python3

then re-built pex instide the VirtualEnv but specifying the shebang line with the Python 3 path on my system:
$ pex pex requests -c pex -o ~/bin/pex --python-shebang '#!/usr/bin/env python3'

Now I can exit the VirtualEnv and pex still works:
$ deactivate
$ ~/bin/pex
Python 3.9.6 (default, May  7 2023, 23:32:44)
[Clang 14.0.3 (clang-1403.0.22.14.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> ^D
now exiting InteractiveConsole...


Pass variable from theme page template to commerce-product file

Question: I am new to drupal and this is my first website in drupal.
I am looking to pass a variable from newtheme.theme to commerce-product.html.twig but I am not able to do so.
Here is my code (newtheme is name of my theme)
function newtheme_preprocess_page(&$variables) {
 $variables['product_cta'] = 'Static Text';
}

in commerce-product.html.twig
{{product_cta}}

but this is not working  the product_cta will be a call to action which will be calculated programmatically and passed to the product single page.
I am using Drupal 8 and Commerce 2.X.X
Any help is really appreciated.
Answer: You can use the next function in your theme / module:
function YOURT_HEME_preprocess_commerce_product(&$variables) {
 $variables['product_cta'] = 'Static Text';
}

function YOURT_MODULE_preprocess_commerce_product(&$variables) {
 $variables['product_cta'] = 'Static Text';
}

And show the variables in the commerce-product.html.twig file:
{{ product_cta }}

;)
Answer: Clear the cache after you created the new function if you didn't.
If It still not working, create a new module and place the preprocess_page function into the module


Confusing Widget of inline entity form

Question: Inline Entity Form ships with two widgets as Inline entity form - Single value and Inline entity form - Multiple values when I use Inline entity form - Single value, I only get add entity form and when I use Inline entity form - Multiple values I get option to add/edit both.
what I was expecting to see to have both add/edit with Inline entity form - single values with only difference of not allowing to have multivalued field in this case.
Am I missing something?
Answer: If you modify your inline entity form by writing a small module, (for this look at README and the ..api.php) you can set your default values by loading them from the entity. So your former entries are available.

Confusing Widget of inline entity form


Como pegar o nome do arquivo atual em python

Question: Fala povo,
Estou fazendo um criador de códigos para sqlite em python.
Queria saber se há alguma forma de pegar o nome do arquivo atual para poder passar direto na função.
atualmente passo o nome por parâmetros.
Answer: Você tem diversas opções na verdade. Dessas apresento-lhe três:
import os
print(os.path.basename(__file__))

import sys
print (sys.argv[0])]

print (__file__)

Existe uma discussão interessante no SO a respeito dos prós e contras do uso de cada uma. Vale a pena consultar.
Onde:

__file__ é o arquivo atualmente em execução, conforme detalhado na documentação oficial:

__file__ é o nome do caminho do arquivo a partir do qual o módulo foi carregado, se foi carregado de um arquivo. O __file__atributo pode
  estar faltando para certos tipos de módulos, como módulos C que estão
  vinculados estaticamente ao interpretador; para módulos de extensão
  carregados dinamicamente a partir de uma biblioteca compartilhada, é o
  nome do caminho do arquivo de biblioteca compartilhada.

sys.argv[0](requer importação sys) é o nome do script que foi chamado
   a partir da linha de comando e pode ser um caminho absoluto, conforme
   detalhado na documentação oficial:

argv[0] é o nome do script (depende do sistema operacional se esse é um
  nome de caminho completo ou não). Se o comando foi executado usando a
  opção -c de linha de comando para o intérprete, argv[0] será definido para a string '-c'. Se nenhum nome de script foi passado para o
  interpretador Python, argv[0] é a string vazia.

As informações que compõe essa resposta foram retiradas daqui. Agradeço ao usuário Yoel.


3rds and 6ths on guitar

Question: I've been working on 3rds and 6ths and struggled at first getting my head around the 6ths since they are, as played on guitar, really inverted 3rds.
Harmonizing in 3rds follows the diatonic chords, i.e. minor or flatted 3rds for the 2nd, 3rd, 6th, 7th. My question is, do we ever (can we?) harmonize using 6ths the same way?  So, the 2nd, 3rd, 6th, and 7th with flatted 6ths like they have flatted 3rds?  Unless I've done something wrong this doesn't quite work because the flat 6th of the 2nd isn't in the scale.  However, when played that way, it sounds more natural whereas when played sticking to the notes of the scale, thus no flat 6th over the 2nd it sounds a little "off" to my ear.  This may explain why all the 6th patterns I see are inversions.
Comment: 6ths on every instrument are inverted 3rds. And 3rds are inverted 6ths. That's how intervals work, not how guitars work.
Answer: Let's look at the 3rds intervals.
C>E, F>A, G>B. All M3. When inverted, they become m6 (rule of 9, M>m)
E>C, A>F, B>G.
Now look at m3 intervals.
D>F, E>G, A>C, B>D. All m3. When inverted, they all become M6.
Now, 6th intervals.
C>A, F>D, G>E, all M6, and D>B, E>C, A>F, B>G, all m6.
Note, all notes are diatonic, within the scale/key. Like using a note on the the white keys, and the note two keys up for all the 3rds, and notes 5 keys apart for the 6ths, regardless of major or minor.
You may be thrown with the chord name m6, though. It's a confusing name - the interval isn't m6. The chord is a minor, with a 6th note added. Making actually a M6 interval with the root. That 6th is not from the natural minor scale, but the melodic minor, classical, rising.
Answer: Intervals of a diatonic 6th just use the notes in the corresponding positions of the relative minor scale. It's worth pointing out here that since you've already correctly identified that the 6ths are inversions of the 3rds, the pattern for the diatonic 6ths is the opposite of the minor scale's thirds pattern.
In bold below are the major 3rds for a major scale:

E F G A B C D
C D E F G A B

Here are those major thirds in bold, starting on the 6th scale degree (or the 1st scale degree of the relative minor):

C D E F G A B
A B C D E F G

Finally, here are the major 6ths in bold going up the major scale. Notice that we're just placing the minor scale over the major one:

A B C D E F G
C D E F G A B

This list of 6ths is just the previous thirds list flipped upside-down (inverted), and the major 6ths are in the complementary positions compared to the major 3rds. The reason major and minor are flipped is because the inversion of any major interval is a minor one, and vice versa.

That's only good for diatonic intervals of a 6th, keep in mind. In music, there will be many harmonic situations where notes outside the diatonic set are chosen, and the topic of when to do so is both highly subjective and too lengthy to condense here.
Comment: @Jim you seem to be confusing intervals and chords.  A minor sixth above C natural is A flat.  This is not particularly relevant to the chord C-E flat-G-A.
Comment: Good info, thanks. Still curious about the b6 with the 2nd, harmonizing like 3rds, i.e. 2nd/3rd/6th/7th are minor.  I understand a minor 6th is determined by the 3rd not the 6th (1-b3-5-6) but playing 6ths, it has more of a minor tonality to me playing the b6 - like the 3rd/6th/7th have.  Playing 6ths sounds more natural to me this way  - the 2nd degree of the scale has a minor feel just like triads and 3rds.  I guess it's not truly harmonizing the scale in 6ths since the 6th of the 2nd is maj. but that's what sounds different or slightly off to me, that maj 6th with the 2nd.
Comment: Not confusing them, just trying to use chords to explain my question.  The m6 chord gets its minor tonality from the minor 3rd.  Remove that, like playing 6ths, and to my ear the minor 6th then provides that minor tonality.

3rds and 6ths on guitar


Electron ipcMain Listener defined in a class

Question: I am developing an electron application and I have rather an architectural problem in general.
Whenever I have something that needs to be done in the Main process, I do it directly in the main.js file, I believe this is wrong because I will end up with a very long monolithic file. !
Now I am adding more classes, and some of those classes should listen to an event. Let me give an example:
In my application, I should have a profile instance. This profile should be updated when the user attempt to login from the Renderer process.
Now my problems is where to create the instance of profile, and how to automatically listen to LOAD_PROFILE event for example? And do I really need to create a profile instance in Main, the only parts that I need to do in main is load and store the profile in desk. All other interaction with profile is done in Renderer.
I am new to node.js and Electron so it's fundamental architecture is a bit confusing for me.
Answer: Well, just in case someone else had the same question.
What I did is just writing the listener code in a new file and imported the file into main.js. Since the code is evaluated once at import, the listeners are registered.
"Be aware that multiple imports in some cases can lead to the code executed several times."
Please look here for reference: https://derickbailey.com/2016/03/09/creating-a-true-singleton-in-node-js-with-es6-symbols/


Proxy SSL from load balancer

Question: A server admin who is setting up a load balancer asked me if I wanted to:

Host SSL certs directly on web servers
or, Proxy SSL from the load balancer

I've only done the former implementation. Can someone compare these?
If I have a web application that requires HTTPS for certain page, will it be impacted by this choice?
Answer:
Your web server has to do all the SSL/TLS processing. It means more load on the web server, but you have full control over the certificates and end-to-end security.
Your web server can serve everything as normal web pages, offloading the SSL/TLS processing. Considerably lower load on the web server, but you don't control the certificates yourself any more and break end-to-end security.

In the end it comes down to if you trust the security of the load balancer and the network between load balancer and web server. If not, don't bother. Note that if you are running credit card transactions or something similar there are a some rather strict rules about when you may send the data unencrypted from SSL/TLS offloading to your server. Moving the certificate is not really a security advantage (somebody breaking into your web server is going to get all the data, regardless of if they can steal your certs or not).
Do you have such an overhead from SSL/TLS that you really need to offload it to external hardware?
Typically you can setup the offloading system to only provide SSL/TLS security where it is really needed.
Comment: I don't think it's a huge overhead, but it seems it would be simpler to maintain the cert in one place (the load balancer) rather than install it on each server on the farm.
However, I am wondering if, in config #2, the web application code will be able to detect whether a page was requested over a secure channel. We have certain business rules about which pages should require HTTPS connections, etc.
Comment: The systems I have worked with sets a http header which informs you that the channel was properly encrypted. There is most likely something similar on your system.

Proxy SSL from load balancer


No ressources availbable when running unit test

Question: There's a known bug in Android Studio where the app's ressources aren't available from within test classes.
The solution according to aforementioned thread is to put the following lines into the build.gradle:
task copyTestResources(type: Copy) {
    from "${projectDir}/src/test/resources"
    into "${buildDir}/classes/test"
}
processTestResources.dependsOn copyTestResources

but gradle says:
Error:(132, 0) Could not find property 'processTestResources' on project ':app'.

Where exactly do I have to put the line
processTestResources.dependsOn copyTestResources

within my build.gradle?
EDIT:
I didn't have apply plugin: 'java' in my build files yet. The problem is that in my app module's build gradle, I already have apply plugin: 'android' and trying to add the java plugin leads to
Error:The 'java' plugin has been applied, but it is not compatible with the Android plugins.

I tried puttin apply plugin: 'java' in the top level build file and then
task copyTestResources(type: Copy) {
    from "${projectDir}/app/src/test/resources"
    into "${buildDir}/classes/test"
}

Note that I added the modules directory to the from-line. This builds fine, but unit tests that need to access ressources still don't work.
Answer: I was unaware that you were using the android plugin, sorry. You're getting the error because the Android plugin defines a different set of build tasks compared to the Java plugin. So you need to pick a different build task to depend your copyTestResources task on, for example:
apply plugin: 'android'

// (...) more build logic

task copyTestResources() {
    from "${projectDir}/src/test/resources"
    into "${buildDir}/classes/test"
}
check.dependsOn copyTestResources

Also, your copyTestResources task can be a little simpler like so:
task copyTestResources() {
    from sourceSets.test.resources
    into sourceSets.test.output.classesDir
}

Comment: Thanks for your answer, unfortunately I still couldn't get my tests to work, see the edit of my answer. Perhaps you can have another look? Thanks!
Answer: There is a nice workaround to put this to work.:
https://github.com/nenick/AndroidStudioAndRobolectric/blob/master/app/build.workaround-missing-resource.gradle
With this you can drop your extra task just add the ".gradle" file i linked and apply it in your modules build.gradle.
apply from: 'build.workaround-missing-resource.gradle'

Make sure to put your assets into app/test/resources/ and reference them via their name only.
e.g.: this.getClass().getClassLoader().getResource("my-asset-file.json")
I found the solution in the ticket you linked.:
https://code.google.com/p/android/issues/detail?id=64887


Simple algebra help; shouldn't it be $-e^6$?

Question: I am solving a problem with a number of distrbution, and in counting the total distribution function, I have encountered a simple math error that I can not quite recall. need some explanation.
Why is:
$1 - [1 - e^{-0.5/0.25}] = e^{-6}$
Shouldn't it be $-e^6$?
Comment: $0.5/0.25=2$, not $6$.
Comment: Before you retype the formulas its hard to know what you mean.
Answer: Note that
$$1 - [1 - e^{-\frac{.5}{.25}}] =1-1+e^{-2}=e^{-2}$$
Answer: No. $-(1-e^x) = -1+e^x$ as multiplication distributes over addition / subtraction.


Converting from binary to hexadecimal

Question:
Convert $66.25$ to hexadecimal

I am finding it easier to convert from binary to hexadecimal so I start with writing it in binary which is: $1000010.01$ now to convert to hexadecimal we take each $4$ bits and sum it, but what about the numbers to the right of the radix point?
Comment: You do the same, leading to the grouping $(0100)(0010){.}(0100)$.
Comment: However, $66.25=42.4_{16}$.
Answer:
...what about the numbers to the right of the radix point?

You simply group them into groups of four digits, just the same as you will group digits to the left of the radix point, and translate each group of four binary digits into a single hexadecimal digit.
With digits to the left, you include leading zeroes as necessary to complete the groupings of four digits.  With digits to the right, include trailing zeroes as necessary.
I'll work a different problem, leaving your particular example ($66.25$) for you to do yourself:
$87.375$
In binary:
$1010111.011$
With groupings of four binary digits each:
$(0101)(0111).(0110)$
Converted to hexadecimal:
$57.6$

Converting from binary to hexadecimal


ggpairs formatting for points only

Question: I'm looking to increase the size of the points AND outline them in black while keeping the line weight the same across the remaining plots.
library(ggplot2)
library(GGally)

pp <- ggpairs(pp.sed, columns = c(1,2), aes(color=pond.id, alpha = 0.5)) +
  theme_bw()
print(pp)

Which gives me the following figure:
Data for reproducibility, and TIA!
> dput(pp.sed)
structure(list(Fe.259.941 = c(905.2628883, 825.7883359, 6846.128702,
1032.932924, 997.8037721, 588.9599882, 6107.641947, 798.4493611,
1046.38376, 685.2485692, 6452.273486, 730.8656684, 902.8585447,
1039.886406, 7408.801001, 2512.089991, 911.2101809, 941.3712067,
659.1069185, 1070.090445, 1017.666402, 925.3221586, 645.0500668,
954.0009756, 1022.594904, 803.5865352, 7653.184537, 1082.714082,
1048.51115, 773.9070604, 6889.060748, 973.0971769, 1002.091143,
798.9670583, 5089.035978, 2361.713222, 970.8258109, 748.3574529,
3942.04816, 889.1760124), Mn.257.611 = c(17.24667962, 14.90488024,
14.39265671, 20.51133433, 19.92596564, 11.76690074, 19.76386229,
14.29779164, 20.23646264, 13.55374658, 16.8847698, 13.11784439,
15.91777975, 20.64068844, 16.78681661, 28.61732162, 15.88328987,
19.59750367, 13.09735943, 21.59458118, 17.680152, 19.87127449,
12.8082581, 20.12050221, 17.57143193, 18.72196029, 16.21525793,
22.0518966, 18.39642397, 18.32238508, 16.17696923, 20.69668404,
17.96018218, 18.71945309, 16.50162126, 30.60719123, 17.69058768,
14.99048753, 16.28302375, 18.32277507), pond.id = structure(c(6L,
5L, 2L, 1L, 3L, 5L, 2L, 1L, 3L, 5L, 2L, 1L, 6L, 3L, 2L, 4L, 6L,
3L, 4L, 4L, 6L, 3L, 4L, 1L, 6L, 3L, 2L, 1L, 6L, 3L, 2L, 1L, 6L,
3L, 2L, 1L, 6L, 5L, 2L, 1L), .Label = c("LIL", "RHM", "SCS",
"STN", "STS", "TS"), class = "factor")), class = "data.frame", row.names = c(11L,
12L, 13L, 15L, 26L, 27L, 28L, 30L, 36L, 37L, 38L, 40L, 101L,
102L, 103L, 105L, 127L, 128L, 129L, 131L, 142L, 143L, 144L, 146L,
157L, 158L, 159L, 161L, 172L, 173L, 174L, 176L, 184L, 185L, 186L,
188L, 199L, 200L, 201L, 203L))

Answer: The GGally package already offers a family of wrap_xxx functions which could be used to set parameters to override default behaviour, e.g. using wrap you could override the default size of points using wrap(ggally_points, size = 5).
To use the wrapped function instead of the default you have to call
ggpairs(..., lower = list(continuous = wrap(ggally_points, size = 5))).
Switching the outline is a bit more tricky. Using wrap we could switch the shape of the points to 21 and set the outline color to "black". However, doing so the points are no longer colored. Unfortunately I have found no way to override the mapping. While it is possible to add a global fill aes, a drawback of doing so is that we lose the black outline for the densities.
One option to fix that is to write a wrapper for ggally_points which adjusts the mapping so that the fill aes is used instead of color.
library(ggplot2)
library(GGally)

ggally_points_filled <- function(data, mapping, ...) {
  names(mapping)[grepl("^colour", names(mapping))] <- "fill"
  ggally_points(data, mapping, ..., shape = 21)
}
w_ggally_points_filled <- wrap(ggally_points_filled, size = 5, color = "black")

ggpairs(pp.sed, columns = c(1, 2), aes(color = pond.id, alpha = 0.5),
        lower = list(continuous = w_ggally_points_filled)) +
  theme_bw()

ggpairs formatting for points only


In causal inference, why is the uncounfoundedness assumption interpreted as the treatment assignment being conditionally independent of the outcomes?

Question: In causal inference, the unconfoundedness assumption is usually stated as:
$$
Y(1), Y(0) \perp Z \mid X
$$
or
$$
P(Z \mid Y(1), Y(0), X) = P(Z \mid X)
$$
where $Z$ is the treatment assignment, $(Y(1), Y(0))$ the potential outcomes, and $X$ the covariates.
My own interpretation of the above is that: "The covariates $X$ contain all necessary information for determining which of the two potential outcomes were received."
Another interpretation I have seen is that: "Conditional on the covariates $X$, the treatment assignment doesn't depend on the potential outcomes."
This is a bit strange for me to understand as it appears to me that our focus should be on the potential outcomes, instead of the treatment assignment. Am I missing something deeper from the italicized statement above? Thanks.
Comment: Maybe [this](https://stats.stackexchange.com/a/182259/7071) will prove illuminating.
Answer: One way of thinking about this statement is to consider that the potential outcomes occur earlier in time than the treatment assignment does. Before treatment is assigned, each individual has two potential outcomes. The assignment to treatment essentially "opens the door" of one of those potential outcomes, and that is the one that then becomes the observed outcome. The only causes of the potential outcomes are covariates $X$. Treatment can't cause potential outcomes because potential outcomes occur prior to treatment; rather, treatment reveals potential outcomes (only one per individual).
If those same covariates $X$ that cause the potential outcomes cause selection into treatment, there is an association, or dependence, between treatment assignment and the potential outcomes. This is what we call confounding. The assumption of unconfoundedness means we have observed all $X$ that are sufficient to eliminate confounding (i.e., all variables that yield an association between the potential outcomes and treatment).
I think it would be far less confusing to write $Z \perp \{Y(0),Y(1)\}|X$. That prioritizes the treatment as being causally separate (i.e., independent) from the potential outcomes. This is not a statement about predicting counterfactuals; it's a statement about the treatment assignment mechanism. In particular, it says the treatment assignment mechanism is independent from (i.e., not associated with) the potential outcomes given $X$. It is this statement about the treatment assignment mechanism that allows us to estimate the treatment effect using only the observed outcomes, the treatment, and the covariates, even though the causal claim we want to make involves only the potential outcomes.
Comment: Well, that's not very general, because the potential outcomes don't have to depend on any measured covariates. They could be purely stochastic given treatment, or depend on variables otherwise irrelevant to the analysis (i.e., unrelated to treatment). It's also extra unnecessary notation. The focus in using potential outcomes notation is to identify the potential outcomes corresponding to intervened levels of the treatment. The covariates are not being intervened on.
Comment: Thanks very much for this example. It is quite clear! One thing I am always confused about is why the outcomes are not written explicitly as a function of the covariates $X$, such as: $\left(Y(Z=1,X), Y(Z=0,X)\right)$ instead of the standard $(Y(1),Y(0))$? Is there a very specific point to this?
Comment: I have a related question I was wondering if you had insight on. My understanding of unconfoundedness exists primarily through the equation: $E(Y(1)\mid Z=1,X) = E(Y(1)\mid X)$. I am trying to intuitively understand what it means for $Z$ to be independent of the outcomes in this equation. I see the equation as saying that by computing at the outcome mean at levels of $X$, the observed mean of those who were treated represents the "true" outcome mean of treatment. Is there a way to integrate the flipped statement $Z \perp \{Y(0),Y(1)\}|X$ above into this equation? Thank you!
Comment: @Noah I agree to your answer. But, would outcome $Y$ be independent of treatment $Z$ if the covariates $X$ contain a collider - $Y \rightarrow A \leftarrow Z$ - between treatment and outcome? [This](https://stats.stackexchange.com/q/625026/331772) is the link to the elaborated version of this question.


Contract has not been deployed to detected network (network/artifact mismatch)

Question: I'm having some issues determining and connecting with the right MetaMask network.
In Ganache, my RPC server is 127.0.0.1.7545 and the network id is 5777. However, when I try to create a custom RPC in MetaMask with this info, I get the following error:
The endpoint returned a different chain ID: 1337

This is my truffle-config.js:
module.exports = {
  networks: {
    development: {
      host: "127.0.0.1",
      port: 7545,
      network_id: "*" // Match any network id
    },
    develop: {
      port: 8545
    }
  }
};

I'm hoping this would match any network id as I've specified, but the console shows the following error:
Contract has not been deployed to a detected network (network/artifact mismatch)

I've already tried truffle migrate --reset, without success. I've also tried creating an explicit network for testrpc in truffle-config.js - that didn't work either.
Any help would be much appreciated!
Answer: You are seeing that error because your contract is deployed to Ganache but you are connected to a different network.
The code that you are writing to load the contract should be inside try/catch block.
inside loading contract logic:
export const loadContract = async (name, provider) => {
  // Load the contract

  // set the provider

  let deployedContract = null;
  try {
    // Get the contract
    deployedContract = await _contract.deployed();
  } catch {
    console.error("You are connected to the wrong network");
  }

  return deployedContract;
};

In the component that you are using loadContract, call it inside useEffect.
useEffect(() => {
      // Detect Provider

      if (provider) {
        // contract should be loaded when provider exists
        const contract = await loadContract("ContractName", provider);
       rLoaded: true,
       // Add More logic
      } else {
        console.error("Please, install Metamask.");
      }
    };
  }, []);

Now you need to make sure if you are not connected to Ganache, disable the button, so your app won't crash. for this create a state variable
 // You probably already have logic to get account and contract
  const canConnectToContract = account && contract;

now write a proper ui:
{!canConnectToContract && (

Connect to Ganache

  )}

  <button
    disabled={!canConnectToContract}

  >
    Donate 1 Ethreum
  </button>


Linear model intuition - why can we treat our explanatory variables as deterministic?

Question: I'm struggling to understand why, if you have a linear model, say $Y_i = \beta_1 + \beta_2 X_i + \epsilon_i$ , the $Y_i$s can be random and have a distribution, but the $X_i$'s are not. For example if you're modelling height of 10-12 year old girls with an explanatory variable of weight, obviously weight is going to have some sort of distribution among your population. This is quite a big thing to ignore, is it not, when modelling?
Comment: There are two issues: uncertainty in the measurement of weights (and heights); and heights not being determined by weights (correlation rather than causation).  In effect you ignore the first point, and then take the weight of a new girl to consider the distribution of heights associated with that weight.  Her weight is what it is, and so for predicting her height it is not a random variable
Answer: Sometimes the $x_i$ in a regression have to be considered as random, but
in the simplest cases they are not.
If you are planning an experiment to see the response (perhaps decreased
blood pressure, or decreased count of a type of bacteria in the blood) $Y_i$
that results from giving specific doses $x_i$ of a drug.
Then the experiment will be planned to give subjects carefully measured,
non-random, doses $x_i.$ These are planned in advance and known. In simple
linear regression, the resulting response for a particular subject is
$Y_i = \beta_9 + \beta_1 x_i + e_i,$ where $e_i \stackrel{iid}{\sim}
\mathsf{N}(0, \sigma^2),$ and the $\beta_i$ and $\sigma^2$ are to be estimated.
Then $Y_i$ are clearly random variables. Estimates $\hat \beta_0, \hat \beta_1,$
and $\hat {\sigma^2}$ are also random variables derived from the $n$ data pairs $(x_i, Y_i).$
Comment: So the $x_i$'s don't have a distribution because they're chosen for the experiment?
Comment: That's the _assumption._ Of course you have to know (or check to see whether) it's really true. If you're trying to see if father's heights have predictive power for son's heights, then both father's height x and son's height y might be random. (If x is random, it's sometimes called 'error-in-variables' regression, as I recall.)
Comment: Thanks so much for your help - it's a lot clearer now.


Ideas on how to create instagram like image feed website, capable of roller overs as well

Question: I am wanting to make a website which allows clients to upload images (to be part of a roll over) onto a server, which will then get displayed on the main page of the site in a Instagram-like fashion.
I have already created PHP scripts for securely uploading images; storing details in a Mysql database; displaying then on a webpage;
By Instagram-like fashion i mean the like their website, where you scroll down and up through posts and the webpage and the webpage loads further images once you reach the bottom.
So the main question is: How to create main page where the database image feed continuously loads more posts when you scroll down to the bottom.
I know I am making life hard for myself by doing this as it is way easier just to use PHP templates and make the user click onto the next set of images (rollovers), but i do like a challenge.
Answer: Grab the scroll position of the bottom of the page using JavaScript, and then make an Ajax call to load the next x number of posts when the user scrolls to a given point.
Answer: After Kai's answer i found this quite useful blog-post:
Reusable ajax script/tutorial to load more posts with get_posts


Coefficients of power series with binomial theorem

Question: I am trying to get the coefficients of the power series of $\sqrt{\frac{1+z}{1-z}}$.
Rewriting gets us to  $(1 + \frac{2z}{1-z})^{0.5}$. Now using the binomial theorem gets us $\sum_{k=0}^n {\frac{1}{2}\choose k} (\frac{2z}{1-z})^k $ but didnt get far with that.
Comment: How about rewrite to $(-1+\frac{2}{1-z})^{0.5}$, expand it with binomial theorem and use $\frac{1}{1-z}=1+x^2+x^3+\cdots$ ?
Comment: @Miscellaneous Im getting $\sum_{k=0}^{\infty} {0.5\choose k}(-1)^{(0.5-k)}(\frac{2}{1-z})^k$. Following up that $(\frac{2}{1-z})^k = 2^k (\sum_{n=0}^\infty z^n)^k$ and that ${0.5 \choose k} = \frac{(-1)^{n-1}}{2^{2n-1}n}\binom{2n-2}{n-1}$ i could simplified it a little bit but still didnt get far with that because i am still left with $(\sum_{n=0}^\infty z^n)^k$
Answer: You could write $$\sqrt{\frac{1+x}{1-x}}=\frac{1+x}{\sqrt{1-x^2}}$$ and then expand $$(1+x)(1-x^2)^{-\frac12}$$ and get $$1+x+\frac12x^2+\frac12x^3+\frac38x^4+\frac38x^5+\frac{5}{16}x^6+\frac{5}{16}x^7+...$$
This is convenient since all the coefficients occur in identical pairs...
Comment: I see i was overthinking too much. I have tried this one already and my solution was right after all (after checking the coefficients per hand). Thank you
Answer: In reply to your comment on where you are blocked, consider that
$$
\begin{array}{l}
 \left( {\sum\limits_{0 \le n} {z^n } } \right)^k  = \left( {\frac{1}{{1 - z}}} \right)^k  = \left( {1 - z} \right)^{ - k}  =  \\
  = \sum\limits_{0 \le j} {\left( { - 1} \right)^j \left( \begin{array}{c}
  - k \\
 j \\
 \end{array} \right)z^j }  = \sum\limits_{0 \le j} {\left( \begin{array}{c}
 j + k - 1 \\
 j \\
 \end{array} \right)z^j }  \\
 \end{array}
$$


Animating android progress bar

Question: I've created ProgressBar in my view, and I would like it to animate when it's value is updated. I'm runnig the code on API 23. How to animate progressBar when It's value is updated?
Here is my activity:
package com.brylkowski.cleaner.cleaner.Errands;

import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;
import android.widget.ProgressBar;

import com.brylkowski.cleaner.cleaner.R;

public class UploadErrandActivity extends AppCompatActivity {

    public static final String PROGRESS = "progress";
    UploadRequestTask task;
    private ProgressBar progressBar;
    private Handler handler;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_upload_errand);
        progressBar = (ProgressBar) findViewById(R.id.upload_progress);
        progressBar.setMax(6);
        task = new UploadRequestTask();
        handler = new Handler() {
            public void handleMessage(android.os.Message msg) {
                progressBar.incrementProgressBy(1);

            }
        };
        task.execute();
    }

    public class UploadRequestTask extends AsyncTask<Void, Void, Boolean> {

        UploadRequestTask() {
        }

        @Override
        protected Boolean doInBackground(Void... params) {
            for (int i = 1; i <=6; i++){
                Message msg = new Message();
                Bundle bundle = new Bundle();
                bundle.putInt(PROGRESS, i);
                msg.setData(bundle);
                handler.sendMessage(msg);
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            return true;
        }

        @Override
        protected void onPostExecute(final Boolean success) {
        }

        @Override
        protected void onCancelled() {
        }
    }
}

and my view:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:orientation="vertical"
    android:gravity="center"
    tools:context="com.brylkowski.cleaner.cleaner.Errands.UploadErrandActivity">

    <ProgressBar
        style="?android:attr/progressBarStyleHorizontal"
        android:indeterminate="false"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/upload_progress"
        android:layout_gravity="bottom"
        android:longClickable="false"/>

</LinearLayout>

Answer: Check this for how to make ProgressBar animation. The only modification you need is instead of applying the animation once when view is initialized, you will need to call
ProgressBarAnimation anim = new ProgressBarAnimation(progressBar, progressBar.getProgress(), to);
anim.setDuration(1000);
progressBar.startAnimation(anim);  // play animation immediately

every time you want to update value. Here is documentation for view animation.

Animating android progress bar


Input field set as 'Value=' instead of 'value='

Question: I have a project written in C# MVC using Razor templates. On one of my pages I have several input fields that contain numeric values. The Razor code that sets the values of these input fields looks like this:
@Html.Editor(Model.DesignParams[i].ParamId,
new {
    htmlAttributes = new
    {
        @Value = Model.DesignParams[i].DefaultValue,
        @class = "form-control text-right",
        @type = "text",
        id = "_" + Model.DesignParams[i].ParamId,
        uomid = Model.DesignParams[i].UOMId,
        measureid = Model.DesignParams[i].MeasureId
    }
})

The above code works fine using FireFox and Chrome and generates an input field that looks like this:
<input type="text" uomid="MBH" name="HeatOfRejection" measureid="HeatLoad"
       id="_HeatOfRejection" class="form-control text-right text-box single-line"
       value="5000.0">

But the same Razor code, identical @Model values viewed with IE generates this:
<input Value="5000" class="form-control text-right text-box single-line"
       id="_HeatOfRejection" measureid="HeatLoad" name="HeatOfRejection"
       type="text" uomid="MBH" value="" />

As you can see, there is a difference between the value= attribute generated for IE in that the value attribute that gets my actual value begins with an uppercase 'V' and the lowercase value is an empty string. I'm stumped on this...
Can anyone tell me why this is happening and possibly how to handle it?
This difference effects jQuery's ability to return the input's value with:
var value = $(inputfield).attr("value");

Maybe .val() will retrieve the input field value, but this is going to require a rewrite of core jQuery code that supports this page and others, so I wanted to ask if anyone can tell me why this 'Value=' gets created for IE only and if there is a way of overcoming the problem.
Update:
Changing @Value to @value (or just value) results in an empty value attribute in Firefox and IE:
<input type="text" value="" uomid="MBH" name="HeatOfRejection" measureid="HeatLoad"
       id="_HeatOfRejection" class="form-control text-right text-box single-line">

Comment: Why would you bind to property then try and override its value with the value of another property. Just set the value of `ParamId` to the value of `DefaultValue` in the controller before you return the initial view. A side effect of your code would be that a user enters a value (say 4000.0) then submits. If you returned the view because of (say) validation errors, the user's value would be overwritten with 5000.0 - sure way to annoy the users of your site.
Answer: You are "capitalising" the  value html attribute. Change this to lower case...
 @Value = Model.DesignParams[i].DefaultValue

as below ...
@value = Model.DesignParams[i].DefaultValue

IE is not the smartest of web browsers and there's definitely something wrong in the way Trident (they're parsing engine) validates elements' attributes as seen in these threads...
https://github.com/highslide-software/highcharts.com/issues/1978
Highcharts adds duplicate xmlns attribute to SVG element in IE
Also, as already noted somewhere else. What's the need for the Editor extension method? Isn't it simpler to just use TextBoxFor instead?
@Html.TextBoxFor(model => model.DesignParams[i].ParamId
    , new
        {
            @class = "form-control text-right"
            , uomid = Model.DesignParams[i].UOMId
            , measureid = Model.DesignParams[i].MeasureId
         })

Comment: I should have noted that this was my first instinct, but the then my value doesn't get set in the `value=` field for any browser and ends up being 0. I wish setting @Value to @value resolved the problem.
Comment: No... I have changed it to all lowercase (@value) and also tried @StuartLC answer making it `value` without the '@', but then I get `value=""` rendered in IE and Firefox.
Comment: @Leo I don't think IE is really to blame here for not knowing what to do with two attributes of the same name. At least it treats the attributes with different capitalization as separate attributes instead of pretending they're the same attribute as the other browsers do.
Comment: @JLRishe it's totally the opposite, if we were to blame anyone it'd be IE for not following standards which clearly states that attributes are case-insensitive, therefore `Value` is the same as `value`
Comment: @Leo Do the standards say anything about what the browser should do when there are two attributes with the same name in different capitalizations? I'm guessing that's a gray area. Seems to me that IE is doing its best to accommodate the page's bogus markup as well as possible. When there aren't duplicates, IE correctly treats attributes as case-insensitive.
Comment: @JLRishe yes, they do clearly specify it...it's nothing new. `4.1.1 In content implemented using markup languages, elements have complete start and end tags, elements are nested according to their specifications, elements do not contain duplicate attributes, and any IDs are unique, except where the specifications allow these features. (Level A)`
Comment: @JLRishe BTW, I'm not endorsing writing bogus markup and I'm not an advocate for any browser. I'm just stating something that is a fact. Anyway, the question is not about HTML standards
Comment: @Leo The WCAG that you cited is a series of guidelines for publishing accessible web content. It doesn't say anything about how user agents should handle non-conformant markup.
Comment: @JLRishe geez man, you're really getting hilarious. So, what's your point? That duplicate `value` attributes are allowed in `input` tag elements? So, you reckon that it is valid html? And that html validators will let you get away with that? Mate, I don't know from what school you came from but really, do your own research, you don't really have to believe me...seriously...
Comment: @Leo At what point did my use of the term "bogus markup" give you the impression that I thought duplicate `value` attributes were valid HTML and that validators should allow them? My point is that it's _not_ valid HTML and that whatever a browser does with them (within reason) is fair game. I haven't seen any specification of what a browser is expected to do in that situation, and if you're so sure that it's a cut and dry case, then please show me something to back that up.
Comment: @JLRishe obviously you must have a very boring life. If you have nothing to do with your life, how about you look it up? BTW, don't even bother to reply mate, I'm over your babbling rubbish
Comment: @Leo Thanks for the ad hominems and baseless assertions, bro. If this is the way you react to someone disagreeing with you, I'm glad I don't have to interact with you IRL. Have a nice day.
Answer: As StuartLC points out, you are trying to get Html.Editor to do something it wasn't designed to do.
What happens when you pass a @value or @Value key to the htmlAttributes is that the rendering engine produces an attribute with that name in addition to the value attribute it's already generating:
<input type="text" name="n" value="something" value="somethingElse" />

or
<input type="text" name="n" value="something" Value="somethingElse" />

In both cases, you're giving the browser something bogus, so it can't be expected to exhibit predictable behavior.
As alluded above, Html.Editor has functionality to generate the value attribute based on the expression argument you pass to it. The problem is that you are using that incorrectly as well. The first argument to Html.Editor() needs to be an expression indicating the model property that the editor should be bound to. (e.g. the string value "DesignParams[0].ParamId") Nowadays, the preferred practice is to use the more modern EditorFor that takes a lambda function, as StuartLC showed in his post:
@Html.EditorFor(model => model.DesignParams[i].ParamId, ...)

Answer: You shouldn't be using invalid Html attributes in this way. Use the data- attributes in Html 5.
Also, your use of @Html.Editor(Model.DesignParams[i].ParamId (assuming ParamId is a string) deviates from the helper's purpose, which is to reflect the property with the given name off the Model, and use the value of this property as the Html value attribute on the input. (MVC will be looking for a property on the root model with whatever the value of ParamId is, which seems to silently fail FWR)
I would do the defaulting of Model.DesignParams[i].ParamId = Model.DesignParams[i].DefaultValue in the Controller beforehand, or in the DesignParams constructor.
@Html.EditorFor(m => m.DesignParams[0].ParamID,
   new {
      htmlAttributes = new
        {
            // Don't set value at all here - the value IS m.DesignParams[0].ParamID
            @class = "form-control text-right",
            @type = "text",
            id = "_" + Model.DesignParams[i].ParamId,
            data_uomid = Model.DesignParams[i].UOMId,
            data_measureid = Model.DesignParams[i].MeasureId
        }

Note that this will give the input name as DesignParams[0].ParamID, which would be needed to post the field back, if necessary.
Here's a Gist of some example code
(The underscore will be converted to a dash)
Use data() in jQuery to obtain these values:
var value = $(inputfield).data("uomid");

Comment: Thank you for this. It's very helpful. Are you saying that you think this will fix the issue I posted? I mean, you are likely pointing me to the 'proper' way of handling my custom attributes. It's good advice, but do you think it will resolve the issue?
Comment: [Data attributes](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Using_data_attributes) in html 5 provide a standard way of appending custom attributes to html elements, without resorting to hacking our own custom attributes. And the jQuery support via data makes it simple to scrape them off (remember to omit the `data-` prefix with `.data()`)
Comment: @rwkiii I've added some sample Gist code to give alternative ideas on using creating the input field, with the value correctly set.
Answer: Editor works with metadata. then you need to more about this,
http://aspadvice.com/blogs/kiran/archive/2009/11/29/Adding-html-attributes-support-for-Templates-2D00-ASP.Net-MVC-2.0-Beta_2D00_1.aspx
But the easiest way is go with
@model Namespace.ABCModel

@using (Html.BeginForm("Action", "Controller", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
 @Html.TextBoxFor(model => model.DesignParams[i].ParamId, new { @class = "form-control text-right",     uomid = Model.DesignParams[i].UOMId, measureid = Model.DesignParams[i].MeasureId })
}

Comment: value will be automatically set with this way, I will edit my answer for more explanation
Comment: Where does the value attribute get set in your example?


Http-01 Challenge failed and Connection refused

Question: I just bought a new server, and want to follow this for www.pretty-formula.com.
Here is the record I added to pretty-formula.com:

In the server, ufw status returned Status: inactive.
After putting pretty-formula.com in related files, I got this error:
root@iZj6ce932fiflob4gudnajZ:~/nginx-certbot# ./init-letsencrypt.sh
Existing data found for pretty-formula.com. Continue and replace existing certificate? (y/N) y
### Creating dummy certificate for pretty-formula.com ...
Generating a RSA private key
......+++++
.........+++++
writing new private key to '/etc/letsencrypt/live/pretty-formula.com/privkey.pem'
-----
failed to resize tty, using default size

### Starting nginx ...
Recreating nginx-certbot_nginx_1 ... done

### Deleting dummy certificate for pretty-formula.com ...
failed to resize tty, using default size

### Requesting Let's Encrypt certificate for pretty-formula.com ...
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator webroot, Installer None
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for pretty-formula.com
http-01 challenge for www.pretty-formula.com
Using the webroot path /var/www/certbot for all unmatched domains.
Waiting for verification...
Challenge failed for domain pretty-formula.com
Challenge failed for domain www.pretty-formula.com
http-01 challenge for pretty-formula.com
http-01 challenge for www.pretty-formula.com
Cleaning up challenges
Some challenges have failed.

IMPORTANT NOTES:
 - The following errors were reported by the server:

   Domain: pretty-formula.com
   Type:   connection
   Detail: Fetching
   http://pretty-formula.com/.well-known/acme-challenge/-yXehDZroR0bFBusF3tEM9Ja9tD1XEXDmAiDnWgP6u8:
   Connection refused

   Domain: www.pretty-formula.com
   Type:   connection
   Detail: Fetching
   http://www.pretty-formula.com/.well-known/acme-challenge/KbU_eUlIBexvG1zqN-UKB7lhdiIc7MEOYar1w-vlPNs:
   Connection refused

   To fix these errors, please make sure that your domain name was
   entered correctly and the DNS A/AAAA record(s) for that domain
   contain(s) the right IP address. Additionally, please check that
   your computer has a publicly routable IP address and that no
   firewalls are preventing the server from communicating with the
   client. If you're using the webroot plugin, you should also verify
   that you are serving files from the webroot path you provided.

### Reloading nginx ...
cannot exec in a stopped state: unknown

It's a new server and a new domain, I don't understand what's blocking. Does anyone know how to investigate further?
Answer: You have to improve your skills in delimiting this kind of problems. You should check things in an order and rule out possible causes one at a time. Now, you are rushing to the http-01 challenge before you have checked all the prerequisites.
Let's start from the suggestions related to the error found from its own notes, as it already suggests a suitable approach.

To fix these errors, please make sure that your domain name was
  entered correctly and the DNS A/AAAA record(s) for that domain
  contain(s) the right IP address.

This is the DNS level and it's easy to test using dig or nslookup, e.g.
$ dig pretty-formula.com

;; ANSWER SECTION:
pretty-formula.com.     379     IN      A       126.96.36.199

This was expected as this is the IP address from your screenshot. It's not a DNS problem.

Additionally, please check that your computer has a publicly routable IP address

Yes, 188.8.131.52 is a publicly routable IP address. It's also answering to ping, which is just a method to find it's reachable from the routing perspective. It's not a routing problem.

and that no firewalls are preventing the server from communicating with the  client.

The server is not listening on HTTP port 80:
$ nc 22.214.171.124 80 -vvv
nc: connect to 220.127.116.11 port 80 (tcp) failed: Connection refused

Now, it's harder to tell what's the reason.

Firewall. You said the firewall is not enabled. You could try and access the web server from itself. If you can connect the server this way, it's probably a firewall issue. E.g.
curl http://126.96.36.199/
curl http://127.0.0.1/

If you can't connect your server from itself either, make sure that Nginx is started and it's configured to listen on port 80. It's possible that your web server is not running.

If you're using the webroot plugin, you should also verify that
  you are serving files from the webroot path you provided.

After you have fixed the previous problem, you may face new problems regarding the web server configuration. If the webroot is /var/www/certbot, you must ensure that http://pretty-formula.com/.well-known/acme-challenge/ goes to file system path /var/www/certbot/.well-known/acme-challenge/.
It's a bit strange that there's Existing data found for pretty-formula.com. if this should be a new domain. It might be that this is not the first time you tried this. You have multiple alternatives to handle this:

remove the previous configuration from /etc/letsencrypt/renewal/pretty-formula.com and start over OR
alter the configuration on /etc/letsencrypt/renewal/pretty-formula.com to match your Nginx configuration OR
configure the Nginx to match the configuration on Let's Encrypt.
Comment: Thank you for this long answer...


Invoking build script written in Msbuild using Perl

Question: Is it possible to execute Msbuild commands from perl?
In powershell i use to retrieve all the Visual studio 2010 environment variables then call Msbuild commands directly.
<code>function SetVS2010()

{

    $vs100comntools = (Get-ChildItem env:VS100COMNTOOLS).Value

    $batchFile = [System.IO.Path]::Combine($vs100comntools, "vsvars32.bat")

    Get-Batchfile $BatchFile

    [System.Console]::Title = "Visual Studio 2010 Windows PowerShell"

}

function Get-Batchfile($file)

{

    $cmd = "`"$file`" & set"

    cmd /c $cmd | Foreach-Object {

        $p, $v = $_.split('=')

        Set-Item -path env:$p -value $v

    }

}

SetVS2010

Function Update-VersionInfo {
    &"$MsbuildBinPath\Msbuild.exe" $MSBuildFile /t:UpdateVersionInfo $Logger $AllErrLogger
}
</code>
It was a great help. Whether the same can be archived in perl?
Answer: perl has standard facilities like system() (Execute a command in subshell) and exec() (executes a command that replaces the executing process). Other process handling facilities are in the Win32:: namespace. I see no reason why you should not be able to run Msbuild commands using a combination of the aforementioned facilities.
You will have to manuipulate the command's environment with a trick similar to the one you are using or you might be able to get the desired effect by simply manipulating the environment of the perl process (by accessing %ENV).


Need help on real analysis proof problem on sequences.

Question: Prove or give a counterexample:If $ad-bc\neq0$ and $ax_n+by_n \rightarrow L$ and $cx_n+dy_n \rightarrow M$, then $x_n$ and $y_n$ both converges.
My proof:

I found a counterexample for this problem. If we let $x_n=\frac{n}{2}$
  and $y_n=-n$, then we can have $a=2, b=1$. Then, $ax_n + by_n$
  converges but $x_n$ and $y_n$ are divergent.

I am convinced my counterexample is valid, but the problem giving me $ad-bc \neq0$ makes me worried I am not doing this correctly. I feel like I have to use that inequality somehow.
Comment: For a counterexample, you need to specify $a,b,c,d$, not just $a,b$.
Comment: And then you need to check that, for some real numbers $L,M$ both of the limits $ax_n+by_n \rightarrow L$ and $cx_n+dy_n \rightarrow M$ hold.
Comment: Hint: $ad - bc \ne 0$ means that for every $r$ and $s$, the equations $au + bv = r; cu + dv = s$ have a unique solution $(u, v)$. In fact, you can write $u$ and $v$ in terms of $a, b, c, d, r, s$ in a pretty simple way.
Comment: @quasi Then can't I made $c=4$ and $d=2$?
Comment: @quasi I see, because for my case, the sequences will all converge to 0.
Comment: @John Huges Then I must replace $u$ and $v$ with sequences $x_n$ and $y_n$? But isn't your statement only valid for constants $u,v$? Would this also work for sequences as given in the problem?
Comment: @user3000482 If you take $c=4$ and $d=2$, then $ad-bc=0$.
Answer: Let $n \in \{1 , 2 , \ldots\}$ and we consider
$$
X_n = a x_n + b y_n \qquad Y_n = c x_n + d y_n\mbox{.}
$$
We know that $\lim_{n \to \infty} X_n = L$ and $\lim_{n \to \infty} Y_n = M$, so
$$
\lim_{n \to \infty} \left(d X_n - b Y_n\right) = d L - b M\mbox{,} \tag{1}
$$
but obviously
$$
d X_n - b Y_n = (a d - b c) x_n \quad \mbox{ for all } \quad n = 1 , 2 , \ldots \tag{2}
$$
Then, from $(1)$ and $(2)$, you obtain that
$$
\lim_{n \to \infty} x_n = \lim_{n \to \infty} \frac{d X_n - b Y_n}{a d - b c} = \frac{d L - b M}{a d - b c} \in \mathbb{R}
$$
because $a d - b c \neq 0$. Equally,
$$
\lim_{n \to \infty} \left(c X_n - a Y_n\right) = c L - a M\mbox{,} \tag{3}
$$
but obviously
$$
c X_n - a Y_n = (a d - b c) y_n \quad \mbox{ for all } \quad n = 1 , 2 , \ldots \tag{4}
$$
Then, from $(3)$ and $(4)$, you obtain that
$$
\lim_{n \to \infty} y_n = \lim_{n \to \infty} \frac{c X_n - a Y_n}{a d - b c} = \frac{c L - a M}{a d - b c} \in \mathbb{R}
$$
because $a d - b c \neq 0$. Finally, ${\{x_n\}}_{n = 1}^{\infty}$ and ${\{y_n\}}_{n = 1}^{\infty}$ both converge.
Comment: But aren't you making assumptions that $x_n$ and $y_n$ are convergent in the first sentence?
Comment: Now not, I only use that ${\{X_n\}}_{n = 1}^{\infty}$ and ${\{Y_n\}}_{n = 1}^{\infty}$ converge.
Answer: $$\text {We have } \quad \binom {a\;\;b}{c\;\;d} \binom {x_n}{y_n}= \binom {L+e_n}{M+f_n}$$ where $e_n \to 0$ and $f_n\to 0$ as $n\to \infty.$ Since $ad-bc\ne 0$ we have $$\binom {x_n}{y_n}=(ad-bc)^{-1} \binom {\;\;\;d\;\;\;-b}{-c\;\;\;\;\;a} \binom {L+e_n}{M+f_n}=$$ $$=(ad-bc)^{-1}\binom {\;\;\;d\;\;\;-b}{-c\;\;\;\;a}\binom {L}{M}+(ad-bc)^{-1}\binom {\;\;\;d\;\;\;-b}{-c\;\;\;\;a}\binom {e_n}{f_n}.$$


Disabling content behind an in-page dialog in WPF

Question: I have some simple code for popping up a "dialog"-like thing over part of my application window. The idea is, the user must dismiss the dialog before continuing to work with that part of the page.
This works by hovering a large semi-transparent rectangle over the part of the page that is supposed to be disabled - which does a nice enough job of blocking clicks to the region. You see this sort of thing a lot in WPF and Web apps, I think.
The problem I have is, the user can still reach all those juicy blocked controls by tabbing to them using the keyboard. "No problem", I hear you say, "just set the IsEnabled on the panel to  false, thereby blocking keyboard access".
Unfortunately, disabling the controls:

Doesn't look very nice
Tends to have unintended consequences with custom styles and bindings further down the tree

So, is there a better way to disable a part of the page, without setting the "IsEnabled" property, such that it doesn't change the visual appearance of any of the controls?
Thanks,
Mark
Answer: Can you put your "dialog" XAML in a popup window? Then, call ShowDialog() on the window to make it a modal window? If you don't want your popup to look like a standard window, you could always syle it to remove borders, etc.
Comment: No, the popup needs to be in-page, not as a top-level window.
Restyling a dialog doesn't have the same UI behaviour - specifically, I only want to disable part of the "parent" window.
Answer: I solved this by subscribing to the PreviewGotKeyboardFocus event, from the parent element in the tree, and then handling the event such that focus never gets passed to the children.
Also, I had to explicitly remove focus from the "disabled" controls as well, of course.


How can I extract the value of only one value along with the key in a dictionary?

Question: For example,
books={1001:['Inferno','Dan Brown','Anchor Books','Thriller',42.00,70],
       1002:['As You Like It','William Shakespear','Penguin Publications','Classics',20.00,54],
       1003:['The Kite Runner','Khaled Hosseini','Bloomsbury Publcations','Fiction',30.00,70],
       1004:['A Thousand Splendid Suns','Khaled Hosseini','Bloomsbury Publications','Fiction',35.00,70],
       1005:['The Girl on The Train','Paula Hawkins','Riverhead Books','Fiction',28.00,100],
       1006:['The Alchemist','Paulo Coelho','Rupa Books','Fiction',25.00,50]}

How can I display only the key and the book's name?
Comment: if you want all keys value as a list of tuples use `[(key, val[0]) for key,val in books.items()]`, if you want a dictionary of `key:bookname` use `{key: val[0] for key,val in books.items()}`
Comment: Which key and which book? Or do you want to iterate over all the keys?
Answer: If you want all the key and the book names:
books={1001:['Inferno','Dan Brown','Anchor Books','Thriller',42.00,70],
       1002:['As You Like It','William Shakespear','Penguin Publications','Classics',20.00,54],
       1003:['The Kite Runner','Khaled Hosseini','Bloomsbury Publcations','Fiction',30.00,70],
       1004:['A Thousand Splendid Suns','Khaled Hosseini','Bloomsbury Publications','Fiction',35.00,70],
       1005:['The Girl on The Train','Paula Hawkins','Riverhead Books','Fiction',28.00,100],
       1006:['The Alchemist','Paulo Coelho','Rupa Books','Fiction',25.00,50]}

for key, (book_name, *book_info) in books.items():
    print(key, book_name)

Output:
1001 Inferno
1002 As You Like It
1003 The Kite Runner
1004 A Thousand Splendid Suns
1005 The Girl on The Train
1006 The Alchemist

EXPLANATION:
Here * operator is used for tuple packing or unpacking. For e.g.:
>>> book = ['Inferno','Dan Brown','Anchor Books','Thriller',42.00,70]
>>> book_name, *book_info = book
>>> print(book_name)
Inferno
>>> print(book_info)
['Dan Brown', 'Anchor Books', 'Thriller', 42.0, 70]

So here the first element of the list is assigned to book_name, then the rest of the elements are packed into the book_info using the * operator.
So when you are iterating over books.items, for each iteration you get the key, value pair. For the first iteration, the key,value pair would look like this:
>>> pair = (1001, ['Inferno', 'Dan Brown', 'Anchor Books', 'Thriller', 42.0, 70])
# so,
>>> key, (book_name, *book_info) = (1001, ['Inferno', 'Dan Brown', 'Anchor Books', 'Thriller', 42.0, 70])
>>> print(key)
1001
>>> print(book_name)
Inferno
>>> print(book_info)
['Dan Brown', 'Anchor Books', 'Thriller', 42.0, 70]

First value in the tuple is assigned to key, and the second value in the tuple, which is a list, gets assigned to (book_name, *book_info).
Reference:
PEP 3132 -- Extended Iterable Unpacking
Otherwise, if you have a key:
#say:
key = 1001
print(f'{key} : {books[key][0]}')

Output:
1001 : Inferno

Unpacking Example
>>> book_ids, book_names = zip(*[(key, book_name) for key, (book_name, *_) in books.items()])
>>> book_ids
(1001, 1002, 1003, 1004, 1005, 1006)
>>> book_names
('Inferno',
 'As You Like It',
 'The Kite Runner',
 'A Thousand Splendid Suns',
 'The Girl on The Train',
 'The Alchemist')

Comment: Upvote partially because it's right but mostly because I *love* f-strings :-)
Comment: @ArunimaS.K. please check the edit, I have added a reference to the Python docs on packing and unpacking.
Comment: What does *books_info mean? Where did we get that variable from?

Pretty new to python, sorry if this is a dumb question.
Comment: It is called packing/unpacking in Python. I will explain, let me edit.
Answer: If you know index of book name and it will always be at the same place. you could do something like this:
for key, book_data in books.items():
    print key, book_data[0]

Answer: Just access the relevant book key and get the 0th element of the value list.
key = input("What is your book key?")
print (key, books[key][0])

Answer: One liner answer:
[print(key,books[key][0]) for key in books.keys()]


Turing Machine to compare multiple binary numbers

Question: I was wondering how to construct a Turing Machine for
<code>A<B<C<D...<N
</code>
with all numbers (A,B,C,D,...,N) being positive binary numbers.
These are a couple examples of how the machine should work:
1001 - Accepts because there is only one number
0<1 - Accepts
0010<1000<0001 - Doesn't accept because 1000!<0001
0100<1010<1010<1000 - Doesn't accept because 1010!<1010
I've tried methods that work to compare only two numbers but I can't seem to find a way to compare multiple (should work for infinite number of inputs) numbers.
Comment: Why do you need to compare more than two numbers? If `A < B` and `B < C`, then `A < C`. You should therefore only need to compare each consecutive pair of numbers until you reach the end of the input.
Answer: Here is a high-level block diagram for solving this problem. You can implement these blocks by using block feature of JFLAP.

Blocks Description
Done? : This block decides whether all comparisons are done, if yes, it accepts, otherwise, it goes to compare the very next two numbers.
A<B : This block is responsible to compare two binary numbers, the one that cursor is pointing at the first digit and the next one. You can use '<' as the separator between A and B and the next number.
cleanup: during the comparison, you might marked 0's and 1's to something else. This block clean up everything and prepare everything for the next comparison.
Hopefully, this gives you an idea to solve the problem.


How can I construct a numeral system that represents the real numbers on a logarithmic scale?

Question: I recently read this relatively old article, which argues that humans, along with most animals, have an innate intuition for logarithms, and tend to imagine numbers in a logarithmic, rather than linear way.
This seems to imply that children need to "un-learn" their intuition for logarithms when being taught standard base counting. So, my question is:
As an alternative to the linear "base-10" counting system, is there a numeral system capable of representing the real numbers on a logarithmic scale (possibly using different symbols), that may be more intuitive for humans to understand?
Comment: It's called a slide rule
Comment: @Zack, You had deleted an interesting question I had intended to answer. I'd rather you repost it than make my own repost. We can discuss it in SE chat in [this gallery room](https://chat.stackexchange.com/rooms/67114/chat-between-zack-and-mark). A mod or I will delete this comment for being off-topic soon.
Answer: Is the current system really "linear", though?
The length of a number (when written down) is actually approximatelly the logarithm (base $10$) of the number, which is why in a way, $10000$ is closer to $100000$ than it is to $100$...
Comment: When I originally thought about this, I was considering a system where you would have individual symbols for powers of ten, and representing non-powers of ten would involve something equivalent to a radix (decimal) point. I would argue that base ten isn't really logarithmic, because counting numbers (as in 1, 2, 3, 4, etc) is linear.
Comment: @Zack What you are considering is scientific notation, with some invented symbols.
Answer: Interesting question. The article suggests that the logarithmic perception built into the nervous system is for the intensity of a stimulus. But the numbers we write down are for counting things - and they are usually small numbers.
When scientists need to grapple with numbers that cover a large range (near $0$ to very large) they use scientific notation, which is in effect logarithmic.


CEDET: storing tags manually

Question: I'm using ECB with Cedet - and semantic search engine stores tags about the files I visit in its cache files.
I'm also using ECB's left-symboldef layout - which shows definition of the tag the cursor is on. In order to do that semantic opens the file where the tag was defined.
The problem is - semantic opens almost all of my python scripts all the time - since I have parser defined in all of them - when I parse command line arguments with argparse... So I'd rather stop semantic caching my files automatically, and do it manually with C-c , , on my libs only.
So my question is - how do I prevent semantic from storing cache? I should still be able to use the existing database (which I'll collect manually).
Comment: Or maybe I got it all in a wrong way?
Answer: To prevent the automatic parsing of other files in idle time, you can set:
(setq semantic-idle-work-parse-neighboring-files-flag nil)

and if it is pulling them in via includes, you can do this:
(setq semantic-idle-work-update-headers-flag nil)

This is actually the default, and it gets set to true if you use one of the canned configuration options for regular or gaudy code helpers.
In order to not parse all the files, but still let ECB find tag definitions, you will probably need to use a GNU Global database.  See semanticdb-enable-gnu-global-databases for more.
Comment: You can manually save with semanticdb-save-all-db.  There is no option for disabling save during idle time.  If you disable the parsing of neighboring files, however, it won't need to save anything, and thus won't get in your way.
Comment: Thank You for Your answer. A note though - I want semantic to parse files - but I don't want it to store chache files. I want to store chache files manually - on invoking `C-c , ,`.
Comment: Thanks Eric. But what about files I open myself? Will it store the cache for that files? I want semantic to parse them - but no storing. I'd like to store cache manaully - on invoking `C-c , ,`.
Comment: You can disable saving by disabling global-semanticdb-minor-mode, but when it is active, everything that you open will be saved.  If you re-enable after it has been disabled, it will only save open buffers, or buffers that were previously saved in the current directory.  This case is untested though, so YMMV.

CEDET: storing tags manually


Small question about $\mathring{A}$

Question: I have a small question on topology, I have a space $E$ with this topology $$\theta=\{G\subseteq E, \mathrm{card}(E\setminus G)<\infty\}\cup\{\emptyset\}$$
such that $\mathrm{card}(E)=\infty$
I want to find $\mathring{A}$ where $\mathrm{card}(A)=\infty$ and $\mathrm{card}(E\setminus A)=\infty$.
Comment: Since $\mathring{A}$ is open, it's either $\emptyset$ or it's (infinite and) cofinite. Because $\mathring{A} \subseteq A$, the complement of $\mathring{A}$ contains the complement of $A$, which is infinite.
Answer: Let $U$ be an open set contained in $A$; if $U\ne\emptyset$, then $E\setminus U$ is finite. However, from $U\subseteq A$ it follows $E\setminus U\supseteq E\setminus A$. Hence…
Comment: @Vrouvrou You're welcome! While the cofinite topology seems rather dull, it can be used for several examples and counterexamples as well as for proving that Tykhonov's theorem is equivalent to the axiom of choice.

Small question about $\mathring{A}$