When installing mods, release does not show up in 'Use version:' list

Question: As the title states, whenever I try to install mods (Renaming folder, installing mods, etc.), the newly-created (modded) folder does not appear in the 'Use Version:' list on the launcher.
What might be wrong?
Answer: You need to rename 4 things:

The folder
The .json file
The .jar file
The "id" inside the .json file

If any of these are not changed, the version will not show up.
Comment: Oh >.> I forgot to rename the folder itself...


jQuery Datatables losing reference on pagination

Question: I currently have a table that is generated server side (Table A).  Clicking a row in Table A calls CreateTable(arrayData):
function CreateTable(arrayData){
var table = $('#tableB').DataTable({
            destroy: true,
            bFilter: false,
            bLengthChange: false,
            dt: "[-head|-body]-left",
            "data": arrayData,
            "language": {
                "paginate": {
                    "first": "First",
                    "last": "Last",
                    "next": "Next",
                    "previous": "Prev"
                }
});

$('#tableB tbody').on('click', 'tr', function () {
    //$("#tableB tbody tr").click(function (event) {
    if ($(this).hasClass('selected')) {
        $(this).removeClass('selected');
    }else{
        table.$('tr.selected').removeClass('selected');
        $(this).addClass('selected');
    }
    var rowIdx = table.row(this).index();
    SetInfo(arrData[rowIdx], null);
    });
}

Pagination and row highlighting in Table B works fine when I first click on any row in Table A.  However when I click on another row in Table A, row highlights in Table B stop working, and SetInfo() is somehow called twice.  If I again select another row in Table A, SetInfo() is now called four times, then eight etc.  When I try using (currently commented out):
$("#tableB tbody tr").click(function (event) {...}

Everything works as expected on page 1 of Table B, but not on any other pages - it doesn't seem to bind correctly.
Any idea what I might be doing wrong?
Comment: Another example that might shed some light on the issue - I've added the following:

$('#TableB').on('draw.dt', function () {
var info = table.page.info();
console.log('Showing page: ' + (info.page + 1) + ' of ' + info.pages);
});

When I click on Table A, row 1, it creates Table B with 2 pages. Clicking on Table B page 2 outputs:

"Showing page: 2 of 2"

Next, I click on Table A, row 2, it destroys and recreates Table B with 7 pages. Clicking on Table B page 2 outputs:

"Showing page: 2 of 2"
"Showing page: 2 of 7"
Comment: Clicking on Table B page 3 outputs:

Showing page: 2 of 2"
Showing page: 3 of 7"

Clicking on Table B page 4 outputs:

"Showing page: 2 of 2"
"Showing page: 4 of 7"

Next, I click on Table A, row 1 again. It destroys and recreates Table B with 2 pages. Clicking on Table B page 2 outputs:

"Showing page: 2 of 2"
"Showing page: 4 of 7"
"Showing page: 2 of 2"

Clicking on Table B page 1 outputs:

"Showing page: 2 of 2"
"Showing page: 4 of 7"
"Showing page: 1 of 2"

It's almost as though the destroyed tables are still somewhere in the DOM.
Comment: Apologies about the formatting, I'm not sure why my post isn't picking up line breaks.
Comment: This kind of question is difficult to answer without a test case. http://jsfiddle.net/ / http://live.datatables.net/
Answer: We figured it out. We put the binding in its own method and used the callback 'drawCallback':
function CreateTable(arrayData){
    var table = $('#tableB').DataTable({
    destroy: true,
    bFilter: false,
    bLengthChange: false,
    dt: "[-head|-body]-left",
    "data": arrayOfData,
    "drawCallback": BindOnClick,
    "pageLength": 5,
    ....etc.
 });

function BindOnClick() {
    //get the table object:
    var table = $('#tableB').DataTable();
    //set the row highlighting:
    $("#tableB tbody tr").off("click").on("click", function () {  //.off in order to avoid multiple bindings
        if ($(this).hasClass('selected')) {
            $(this).removeClass('selected');
       }
       else {
        table.$('tr.selected').removeClass('selected');
        $(this).addClass('selected');
        }

        //now call any method you want and pass in data
        //based on row index:
        var rowIdx = table.row(this).index();
        SetInfo(table.data()[rowIdx]);
    });
 }

Comment: A better solution is to just wrap `#tableB` with another element (`#tableBwrapper`), and then the code in your question will work if you adjust it like this: `$('#tableBwrapper').on('click', 'tbody tr', function () {`.
Comment: I actually tried wrapping my table in a .  Why would this be better?
Comment: My solution is better because the problem is being solved in the correct way, instead of having to rebind the click event every time your table changes. Also, the `drawCallback` event may be fired more often than you think, especially if you use certain features of DataTables. You will also need to make your `table` variable "global" (I can't see the rest of your code) like this: `var table; function CreateTable(arrayData){
table = ...`.
Comment: This results in SetInfo() being called multiple times per row click.
Comment: @D3v Do you know if this problem is solved in the most recent version of DataTables with state saving? I am facing a similar issue.


Make div become scrollable if content grows beyond max-height

Question: I've set my article element to a max-height of 90%, but if content inside grows beyond this value it continues to flow through and below my footer.
Is there a way that i can make #libraries become scrollable if it becomes full with content? So content doesn't go beyond my footer.
http://jsfiddle.net/bobbyrne01/oyrvbh23/1/
html

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

        <button id="libraryAdd">Add</button>
        <button id="libraryBack">Back</button>

css
html, body {
    height: 98%;
}
#libraries {
    background-color: #E6E6E6;
    max-height: 90%;
}
#libraryView {
    background-color: #A6A6A6;
    height: 100%;
}

Comment: I'm going to -1 because you could have easily put your question into Google and found the answer. Show some research effort here.
Answer: Use OVERFLOW property like this overflow:auto on your container:

html,
body {
  height: 98%;
}
#libraries {
  background-color: #E6E6E6;
  max-height: 90%;
  overflow: auto;
}
#libraryView {
  background-color: #A6A6A6;
  height: 100%;
}

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

    <button id="libraryAdd">Add</button>
    <button id="libraryBack">Back</button>

http://jsfiddle.net/oyrvbh23/2/
Answer: One solution is to use overflow: auto; to element with id #libraries:

html,
body {
  height: 98%;
}
#libraries {
  background-color: #E6E6E6;
  max-height: 90%;
  overflow: auto;
}
#libraryView {
  background-color: #A6A6A6;
  height: 100%;
}

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

Test

    <button id="libraryAdd">Add</button>
    <button id="libraryBack">Back</button>


Lots of components in a toolbox menu a bad design decision?

Question: I'm developing a website builder application and I have to design the menu with the components. It's essentially the part where the users are selecting and adding the text or image components.
I want to make it easy for the users to select the size of the components therefor I added them to the toolbox with pre selected sizes however it looks a bit cluttered to mee. How can I improve this toolbox?
The right side of the form is the editor itself. The components can be moved up and down with mouse gestures.
Answer: After looking at your example and other website builder sites I would make a few changes to make the site look cleaner. First make the Add/Remove Content significantly smaller maybe the same size as the left area next to it, also be sure to only show the Add/Remove content as a pop-up that comes from interacting with the section to the left of it and not something that is constantly on the page as it will not always be needed. I would also increase the size of the actual website portion where they can move their images etc... Your users are going to want a large area to work with on the web page itself and not be having to zoom in their browser to see what they are doing. I think a good website to kind of look at for suggestions is wix. Here is an example from their builder.

I do like the idea of pre-determined sizes, but you could also add the option for the user to stretch or shrink certain items such as images if they need a more exact size. This would enable quick use of your pre-selected sizes but also allow the user to further customize the size if it were needed. Just some suggestions, hope it helps.
Comment: Hey @nick_m, thank you for the information! It definitely helps. You are right about the might not be needed all the time part. Are you sure on the part with the dropdown like wix? People might not be used to that as much as we would like too. The resize on the fly is currently not possible technically because I want to push the app out of the door and modify it after that. I'll definitely increase the part where they modify the page
Comment: I feel that the drop down is something that you can do without if you really don't like it. The only reason I feel that the Add/Remove content should be a pop-up/drop-down is because it's not something that they will always be using on the page. Once they have all of the features on the page they may want to get rid of that and just move around items on the page until they get the effect they are looking for. Instead of having it as a drop-down you could effectively give it a minimize button enabling the user to keep it up or get rid of it upon there request.
Comment: an overlay menu is the right approach so the user can see the full layout underneath.  i would also try making the menu transparent unless the mouse is over it.  this way the user can see the full page through the menu yet still access the menu if needed.


No suspend on lid close

Question: I recently noted that my Thinkpad X1 Yoga (1st Generation) will not enter the suspend mode any more when I close the lid of the notebook.
I updated from Ubuntu 18.04.2 to 18.10 recently but I am not 100% sure if the error occured right after the update.
What I have checked:

I checked that my /etc/default/grub was not changed since I last configured it:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

I changed the /etc/default/grub following this hint (no effect):
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_sleep=nonvs"

I changed /etc/systemd/logind.conf to the following. I edited the Inhibit-entries to "yes" (no effect):
[Login]
HandlePowerKey=hibernate
HandleHibernateKey=hibernate
HandleSuspendKey=suspend-then-hibernate
HandleLidSwitch=suspend-then-hibernate
HandleLidSwitchDocked=suspend
PowerKeyIgnoreInhibited=yes
SuspendKeyIgnoreInhibited=yes
HibernateKeyIgnoreInhibited=yes
LidSwitchIgnoreInhibited=yes

I thought about the sleep mode itself being broken. But executing sudo pm-suspend in terminal will correctly initiate the suspend mode. The screen is getting dark and the power LED is flashing after a few seconds.
I checked if the lid sensor itself is broken. Since the Thinkpad uses a magetic sensor in the base and has a magnet in the lid, I tried to trigger the sensor with an external magnet. The sensor seems to work. When moving the magnet over the sensor, the screen turns black. But nothing else happens, the power LED is still on. When removing the magnet, the screen is on again.
(update) I also tested sudo pm-suspend-hybrid to check if the hybrid suspend mode is broken. This was not the case. The machine entered the suspend mode as expected (screen black + Power led flashing
(update) free -h gives the following output:
           total        used        free      shared  buff/cache   available
Mem:       7,2Gi       1,7Gi       3,7Gi       674Mi       1,8Gi       4,6Gi
Swap:      9,0Gi          0B       9,0Gi

Do you have any more ideas how to get the suspend mode working again? I would like to trigger the new suspend-then-hibernate mode on lid close.
Comment: And how is your RAM and with this update a lot could go wrong?
Comment: I'm afraid i do not understand. I've got 8GB of RAM. An Idea: is it possible that the suspend ist working, but suspend-then-hibernate is not. Is there a terminal command which initiates the suspend-then-hibernate mode?
Comment: Make sure your RAM isn't been used up And leaving nothing for hibernation. Check with `free -h`
Comment: Original post edited: marked with (update)
Answer: After performing another Core update for Ubuntu, it is working again.
It seems like there were modifications on the suspend mode or in one of the drivers. I checked the release notes for Ubuntu 18.10 and found nothing, but it looks like there were changes anyway.

No suspend on lid close


Fastest way to reach level 99

Question: I have recently bought Chrono Trigger for the virtual console on the Wii. I loved the game, got all the endings, but still don't have all my characters maxed to level **.
What is the fastest way that I can get XP for the characters?
Am I better off playing New Game+ multiple times or is there an area where there are high xp per kill monsters?
Answer: Try going to the Black Omen.
There are three time periods where you can go to there. 1,000 A.D., 600 A.D., and 12,000 B.C. It's important to start with 1000 A.D. and make your way back, because if you beat the Black Omen in 12,000 B.C., it won't be there in 600 A.D. and 1,000 A.D. since you already beaten it (you've altered the future by changing the past!).
Once you've beaten all three Black Omens, you can stay in the last time period (12,000 BC) and fight random enemies inside -- making use of the first save point there. Just can move back and forth, save your game, and then go back for more.
As a side note, your inactive party members will only gain 3/4 EXP, but if they were to gain more than one level as the result of the EXP gained, they will only gain one level (no more EXP will be carried over).
Comment: The reverse chronological order of the Black Omen is very important!
Answer: I would go in the Black Omen but first make sure you have a lot of Panceas to heal status' like poison, and sleep. Also a lot of Mid-Potions and Hi-Potions

Fastest way to reach level 99


A collection that is an algebra and countable additivity

Question:
Let $X$ be a countable and infinite set and $$\mathcal{F}:=\{A\subset X;\#A<\infty\ \text{or}\ \#A^C<\infty\}.$$
(a) Show that $\mathcal{F}$ is an algebra.
(b) Given $A\in\mathcal{F}$, defines $$\mu(A):=\left\lbrace\begin{array}{c}0,\ \text{if}\ A\ \text{is finite}\\1,\ \text{if}\ A^C\ \text{is finite}\end{array}\right..$$ Show that $\mu$ is finitelly additive, but isn't necessarily countable additive.

I'm with some problems in (b). Taking the finite and disjoint family $\{A_j\}_{j=1}^n\subset\mathcal{F}$, if $A_j$ is finite, for each $j\in\{1,...,n\}$, is easy to see that $\mu$ is finitelly additive, but i'm stacked in the other cases. Since $\{A_j\}$ is 2-2 disjoint, if we have $A_{j_0}^C$ finite, for some $j_0\in\Bbb{N}$, we get $$A_k\subset A_{j_0}^C, \forall k\in\{1,...,n\}\setminus\{j_0\},$$ hence $$\bigcup_{\begin{array}{c}j=1\\j\ne j_0\end{array}}^{n}A_j\subset A_{j_0}^C,$$ so $\bigcup_{\begin{array}{c}j=1\\j\ne j_0\end{array}}^{n}A_j$ is finite.
So, how to conclude what we want? This looks very confused to me.
Answer: Enumerate $X= \{x_n:n\in\mathbb{N}\}$ and choose $A_n = \{x_n\}$. Then $\bigcup_n A_n = X$ but $\mu(A_n) = 0$ for all $n$.
I'm not sure if I'm specifically answering your question.
Answer: The other case is that one of the $A_j$, say $A_{j_0}$ has a finite complement. Then the complement of $\bigcup_{k=1}^nA_k$  is finite hence $\mu\left(\bigcup_{k=1}^nA_k\right)=1$. It suffices to show that there is no $j_1\in\{1,\dots,n\}\setminus \{j_0\}$ such that $A_{j_1}$ has a finite complement. Otherwise, it would mean that $A_{j_0}^c$ and $A_{j_1}^c$ are both finite, hence so would be their union, which is actually $X$.
Comment: Thankyou! I didn't realize the fact that since $A_{j_0}$ and $A_{j_1}$ are disjoint, we have that its complements reunion is the entire space $X$.


How to fetch case sensitive data without using Upper, Lower, init cap functions in oracle

Question: I have a transaction table in which there is a column trans_mode which stores transaction mode for the transactions. Transaction mode contains one of the following values.
    trans_mode
    web
    app
    APP
    APP
    wEb

and there are are many more possibilities as trans_mode is varchar column.
I want to write a simple select statement like
select count(trans_mode) from tab where trans_mode='web';
or
select count(trans_mode) from tab where trans_mode='Web';

Now, I do not want to use any condition like upper(trans_mode)='WEB' or lower(trans_mode)='web' or any regular expression, and output required is the count of web transactions ignoring the case.
I think we can achieve the same using "column format" when defining trans_mode column or by using some other method. However not sure. Please suggest.
Comment: You can put a trigger on the table, that lowers (or uppers) the values upon insert or update and then only use lower (upper) case in the query. You could also define a function based index on `LOWER(trans_mode)` (or `UPPER(trans_mode)`) and then use `LOWER(trans_mode)` (or `UPPER(trans_mode)`) in the query, if you are concerned about indexing here. You could also define s constraint checking, that `trans_mode = LOWER(transmode)` (or `trans_mode = UPPER(transmode)`. That forces the user to only enter lower (or upper) case strings, so that you can rely on that.
Comment: Column format AFAIK is just an SQL*Plus option for the display of data in that client. This won't help you for comparisons the server has to do.
Answer: You can't do that with a "column format", but you can change your current sessions' NLS behaviour:
ALTER SESSION SET nls_comp = Linguistic;
ALTER SESSION SET nls_sort = binary_CI;

select *
from tab
where trans_mode = 'app';

results in:
TRANS_MODE
----------
app
APP
APP

Online example: https://dbfiddle.uk/?rdbms=oracle_11.2&fiddle=a0196bf8031e5c612b9a9f6a2de870e4
If you need the comparison to honor language specific comparison rules (e.g. ß  and SS should be treated the same in German), you can do that as well:
insert into tab values ('große');
insert into tab values ('GROSSE');

ALTER SESSION SET nls_comp = Linguistic;
ALTER SESSION SET nls_sort = XGerman_CI;

select *
from tab
where trans_mode = 'große'

returns:
TRANS_MODE
----------
große
GROSSE

Starting with Oracle 12.2 you can also use the collate option:
select *
from tab
where trans_mode = 'app' collate binary_ci

Comment: Surely, +1 for your answer. Nice solution. However, in this case, we need to alter the session every time. I want to make this easier.:)
Comment: @Tajinder: that or using `collate` in Oracle 12 are your only options.
Comment: Yes, thanks really helpful. I think in oracle 12.2 we can use collate at column level.
Answer: In Oracle 12.2 you can use collate binary_ci at column level.
CREATE TABLE transactions (
  id          NUMBER,
  trans_mode     VARCHAR2(4 CHAR) COLLATE BINARY_CI,
  CONSTRAINT t1_pk PRIMARY KEY (id)
);

insert into transactions values(1,'web');
insert into transactions values(2,'app');
insert into transactions values(1,'Web');
insert into transactions values(1,'weB');

commit;

select count(0) from transactions where trans_mode = 'web' ;

Reference link:
https://oracle-base.com/articles/12c/column-level-collation-and-case-insensitive-database-12cr2#column-level
Answer: Use COLLATE:
      select count(trans_mode) from tab where trans_mode='Web' COLLATE SQL_Latin1_General_CP1_CI_AS

Will return web and wEb
Comment: That collation name is invalid for Oracle
Comment: @a_horse_with_no_name collation may be invalid but collate isn't. I've used it in the past. Above is MS SQL...I think Oracle is slightly different syntax wise, but I'm sure he/she is smart enough to figure it out without me holding their hand.
Comment: The default Oracle sort is `Binary`, so they probably want `Binary_CI` for case-insensitive collation, as @a_horse_with_no_name mentioned in their answer.


Prove the derivative of $(a-x) / x$ by definition

Question: Hello and thanks in advance for any help!!
I currently have to get to the derivative function of $\frac{a-x}{x}$ by definition.. that is
$$\lim_{h\to0} \frac{\frac{a - (x+h)}{x+h}- \frac{a-x}{x}}{h}$$
So it's kind of a little mess for a newbie in algebra like me. I've tried turning the X into X^-1 with no results, like this:
$$\frac{a(x+h)^{-1} - 1 - ax^{-1} +1}{h}$$
Also, I've tried using a common divisor of $XH(X+H)$ or something, but it's too long to write in $\LaTeX$ (this is my first time using it and I don't feel that it's relevant to the question).
I just wanna know how to begin. That means that I don't want the full answer, just a piece of advice to get me in the right path and then work the exercise out myself.
Thanks a ton everyone!! =)
Comment: You put `$...$` around an inline formula, and `$$...$$` around a displayed formula.  Also, you can click on the "edited n minutes ago" link to see the changes, [as here](http://math.stackexchange.com/posts/155224/revisions).
Comment: Mark, how did you edit the question to render the equation?
Answer: Let $f(x) = \dfrac{a}{x} -1$. Then $$f'(x) = \lim_{h \rightarrow 0} \dfrac{f(x+h) - f(x)}{h} = \lim_{h \rightarrow 0} \dfrac{\left(\dfrac{a}{x+h}-1 \right)- \left( \dfrac{a}{x} - 1\right)}{h}$$
$$f'(x) = \lim_{h \rightarrow 0} \dfrac{ \left(\dfrac{a}{x+h}-1 - \dfrac{a}{x} + 1 \right)}{h} = \lim_{h \rightarrow 0} \dfrac{ \left(\dfrac{a}{x+h} - \dfrac{a}{x}\right)}{h} = \lim_{h \rightarrow 0} \dfrac{ \left(\dfrac{ax - a(x+h)}{x(x+h)}\right)}{h}$$
$$f'(x) = \lim_{h \rightarrow 0} \dfrac{ \left(\dfrac{ax - ax - ah}{x(x+h)}\right)}{h} = \lim_{h \rightarrow 0} \dfrac{ \left(\dfrac{- ah}{x(x+h)}\right)}{h} = \lim_{h \rightarrow 0} \left(\dfrac{- a}{x(x+h)}\right)$$
$$f'(x) = \left(\dfrac{-a}{\displaystyle \lim_{h \rightarrow 0} \left(x(x+h) \right)}\right) = - \dfrac{a}{x \times x} = - \dfrac{a}{x^2}$$
Comment: How come you never work with `align` or newline inside `$$`?
Comment: @AsafKaragila Sometimes I do. The rest of the times, I find this easier to type than `align`.
Answer: It's simpler to just put the two fractions in the numerator under a common denominator and then convert the complex fraction into a simple one:
$$\begin{align*}
\frac{\quad\frac{a-(x+h)}{x+h} - \frac{a-x}{x}\quad}{h} &=
\frac{\quad\frac{(a-x-h)x}{(x+h)x} - \frac{(a-x)(x+h)}{x(x+h)}\quad}{h}\\
&=\frac{\quad\frac{(a-x-h)x - (a-x)(x+h)}{x(x+h)}\quad}{h}\\
&= \frac{(a-x-h)x - (a-x)(x+h)}{x(x+h)h}\\
&= \frac{ax-x^2 -xh -ax -ah +x^2 +xh}{xh(x+h)}\\
&= \frac{-ah}{xh(x+h)}\\
&= \frac{-a}{x(x+h)}.
\end{align*}$$
Comment: Thanks a lot man! I would set your answer as accepted too but I can only set one =(.
Answer: If you look only at the fractions in the numerator and combine them, we get $$\frac{(a-x-h)x-(a-x)(x+h)}{x(x+h)}=\frac{(ax-x^2-hx)-(ax+ah-x^2-hx)}{x(x+h)}=\frac{-ah}{x(x+h)},$$
so if we simplify, we are looking for $$\lim_{h\to 0}\frac{a}{x(x+h)}=\frac{-a}{x^2}.$$
Comment: Not a problem. I got beat to the punch, after all. ^_^
Comment: Wow this is an awesome solution! I would set your answer as accepted too but I can only set one =(.
Answer: Take common divisor on the numerator and cancel stuff: $$\frac{\frac{a-(x+h)}{x+h}-\frac{a-x}{x}}{h}=\frac{\rlap{//}{ax}-x(\rlap{/}{x}+\rlap{/}{h})-\rlap{//}{ax}-a\rlap{/}{h}+\rlap{//}{x^2}+\rlap{//}{xh}}{x\rlap{/}{h}(x+h)}\to-\frac{a}{x^2}$$
Comment: @Gaspa Todo lo que viste en el secundario de álgebra: reducciones de fracciones, con o sin exponentes, *fracciones mismas*, las fórmulas para $$(a\pm b)^2\,\,,\,a^2-b^2$$ etc. Saludos desde México.
Comment: I can't believe you worked it out in just one line. I would set your answer as accepted too but I can only set one =(. I upvoted of course =)
Comment: Don't worry about it. It helps a lot in higher mathematics to sharpen high school algebra skills: factorisation, common divisor/multiple, binomial/trinomial expressions, etc.
Comment: I will certainly do so. Thanks a lot again. I'm guessing that since your name is Antonio, you speak spanish, do you? Muchas gracias desde Argentina che! Voy a practicar comun divisor que parece bastante util =).


MAAS - Layer 2/3 architecure

Question: I'm curious about the various network architecures that can work with mass. The docs state two layouts ( flat and split ) but they are fairly sparse as to what those are.
Unfortunately, due to a new location I am limited to one network and the nodes aren't capable of vlan tagging the pxe side...
So the main question here is: can I run on only one subnet? That is serving all purposes... internet access, ipmi, pxe, etc.. etc..
Answer: Yes, of course.
Use port forwarding for different services on the network, and create two IP scopes for separation in just one Subnet. You can also use different class of subnet, so 10, 172, and 192. You can use something like 172.31.0.1-249 and 172.24.241-249 to subnet it in one class. Port forwarding is easy, you should try to only use one service per port though.
Comment: Hmm... perhaps I asked slightly the wrong way. I'd like to used one NIC, one subnet to do all. I think you're suggesting putting two ips per interface?

MAAS - Layer 2/3 architecure


Why does my type-casting doesn't work with an object?

Question: Using Java SE 11
I'm trying to make an array of instances of different classes. I would like to access a specific method of an isntance from that array. I have used type-casting, but it doesn't work.
How to tell java, that the method I tried to access is there?
The error happens at the bottom of this code. Class BillsUtilities has the showInfo method. But java gave an error, that class Object doesn't have that method.
public static void main(String[] args) {

        Object item[] = new Object[10];
        int counter = 0;
        String newItem = "BillsUtilities";

        Date date = new GregorianCalendar(2001, Calendar.OCTOBER,12).getTime();
        int amount = 50;

        switch(newItem) {
            case "BillsUtilities":
                item[counter] = new BillsUtilities(date, amount);
                break;
            case "FriendsLover":
                item[counter] = new FriendsLover(date, amount);
                break;
            default:
                throw new IllegalStateException("Unexpected value: " + newItem);
        }

        (BillsUtilities) item[counter].showInfo();
    }

Comment: `((BillsUtilities) item[counter]).showInfo();` is what you want. (You are currently casting everything, you first need to cast and then call the method on the casted object)  But consider that in the way the code is written, it is very possible that you'll get a classcastexception if your switch case will create a FriendsLover object instead.
Comment: This answer should help: [https://stackoverflow.com/a/5762277/7994967](https://stackoverflow.com/a/5762277/7994967)
Answer: easy-peasy, japanesey!
((BillsUtilities) item[counter]).showInfo();

But in general case, next snippet is more correct:
if(item[counter] instanceof BillsUtilities)
    ((BillsUtilities) item[counter]).showInfo();


How can I pass the code contained in a variable or a const to the JSX code returned by a component?

Question: I struggle to grasp how React and JSX works together..
How can I pass the code contained in a variable or a const to the JSX code returned by a component ?
import React from "react"

export default function App() {

    const element =
pwett or some JSX code

    function Pwett() {
        return
pwett or some JSX code

    }

    // it's the same thing !
    console.log(element)
    console.log(Pwett())

    return (
        // I know how to pass the Pwett component JSX code to the JSX code returned by App
        < Pwett />

        // How can I pass the code inside "element" to the JSX returned by App ?
        // element
        //{element}
        // dunno...
    )
}

Answer: we can use the {} to output any value inside the JSX code we are returning
return (
     <>
         {element}
     </>
)


One-way switch. Why is a separate pvc conduit used?

Question: Why is it in the lighting circuit a separate earth wire is drawn in p.v.c conduit type of installation and not in steel type?
Comment: Not clear. Is it a separate PVC conduit or a separate earth wire you're talking about? Is your question about an existing installation, typical installations in a particular country, perhaps a guideline you were reading or something else entirely?
Comment: See also http://diy.stackexchange.com/a/74996/58292
Answer: Because it's legal to use a continuous metallic conduit as the grounding conductor. If the conduit is not conductive, a wire must be pulled to act as the grounding conductor.


What could I use for a tri-state control?

Question: I'm trying to think of a nice element where there are 3 states, but a simple checkbox would be a litlte overkill for what I want (I'd need two), as the states are:

Enabled
Default
Disabled

But I want the user to be able to change to this at any one time and I find tri-state checkboxeIs are too difficult to figure out how to use.
What do you think is the best way to implement this? I currently am thinking of just three buttons, but there must be something really obvious that does this which I'm more than capable of programming (I'm a programmer not a UX desginer)
Answer: I think a button with a pop-up menu would be the best answer for this. See the image below.

You can easily create a custom control deriving from a toggle button and styling it accordingly. Depending on what technology you develop in this task may be easier or harder.
Comment: Thanks, that looks really darn good! I might create two versions and see what appeals best to people. (P.S what did you make that picture in, if it's some diagramming software I'd love to have a play with it)
Comment: I'm glad you like it, I used Photoshop to create it. :)
Answer: What's wrong with just using the standard element for choosing one of multiple options - the dropdown list (or combobox or select, depending on your technology)? Or if you want, you can use three radio buttons (but I prefer dropdowns for something like this).
Why create something with non-standard functionality when something already exists that everyone already knows how to use?
Comment: True, thanks for that. Makes a lot of sense now :)
Comment: Good answer. You could also use a segmented control although that has more limited application. See https://developer.apple.com/library/mac/#documentation/UserExperience/Conceptual/AppleHIGuidelines/Controls/Controls.html#//apple_ref/doc/uid/TP30000359-TPXREF104
Comment: @AdamSmith - that's pretty much exactly what Christofian is talking about in his answer; he just isn't calling it that very Apple-centric name.
Comment: I'm using a Bootstrap+jQuery powered Segmented control at the moment which looks very similar to what Apple are saying
Comment: The link provided by Adam is not working anymore, due to a major update from Apple. Here is the current link to Apple's Human Interface Guideline, describing the segmented control element: https://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/OSXHIGuidelines/ControlsSelection.html#//apple_ref/doc/uid/20000957-CH49-SW1
Answer: Mayby something like this:

download bmml source – Wireframes created with Balsamiq Mockups
A row of buttons would work great for this purpose, and it shouldn't be that hard to make.
Comment: That's what I've got so far, I was wondering if there was anything else


How write unit test case for below in jasmine

Question:  public writeValue(item): void {

        if(item.length> 0)
        for(let i=0;i<=item.length-1;i++)
        {
            this.salesDivisionTagSet.push(item[i]);
        }

iam new to angular testing i am not able to write unit test cases for the above because of this coverage is not increasing can somebody help me with this .
Comment: Did you tried anything to write and facing problem into it?
Comment: What you have written so far? If you new to unit test cases the I advise you to learn first,
Answer: Your test case would be something like below.
it("should push when item when list is selected", () => {
    component.salesDivision = mockSalesDivision
    spyOn(component.salesDivisionTagSet, "push");
    component.writeValue([9,1]);
    expect(component.salesDivisionTagSet.push).toHaveBeenCalled();
})

As your code says item can be array or simple value. Above test case is covered for the type of array. You need to write another test case where value will be non array like below.
component.writeValue(78);
expect(component.salesDivisionTagSet.push).not.toHaveBeenCalled();


Unable to see count value in counter example using ngRx

Question: Here is the code:

state.ts

export interface AppState{
  count : number;
}

actions.ts

export const INCREMENT: string = '[Counter] INCREMENT';
export class increment implements Action{
   readonly type = INCREMENT;
}

export const DECREMENT: string = '[Counter] DECREMENT';
export class decrement implements Action{
    readonly type = DECREMENT;
}

export type All
    = increment
    | decrement;

reducer.ts

const initState: AppState = { count: 0 };

export function counterReducer(state: AppState = initState, action: Action)         {
  switch (action.type) {
    case INCREMENT:
        return Object.assign({}, state, { count: state.count + 1 });
    case DECREMENT:
        return Object.assign({}, state, { count: state.count - 1 });
    default:
        return state;
  }
}

module.ts

@NgModule({
  declarations: [AppComponent],
  imports: [
    BrowserModule,
    FormsModule,
    HttpModule,
    StoreModule.forRoot({counterReducer})
  ],
  providers : [],
  bootstrap: [AppComponent]
})
export class AppModule {}

my-component.ts

export class AppComponent {
  title = 'Welcome to the Redux Counter example';
  counter$ : Observable<number>;
  constructor(public store : Store<AppState>,){
    this.counter$ = this.store.select('count'); // <-- This is not working
  }

  increase(){
    this.store.dispatch(new increment());
  }

  decrease(){
    this.store.dispatch(new decrement());
  }
}

I am not able to see counter$ getting changed, although the reducers are getting called and the state getting changed. As my 1st ngRx project I know I am missing a very small concept while observing the Store.
can someone please help ?
Comment: Where abouts are you subscribing to `counter$`? Also, I think you need to change `StoreModule.forRoot({counterReducer})` to `StoreModule.forRoot({count: counterReducer})`
Comment: @user184994: Applying your suggestion made html `{{counter$ | async}}` as `[object Object]`. Not sure why async is not converting it.
Comment: I've added an answer below that should address that
Answer: I think you need to change StoreModule.forRoot({counterReducer}) to StoreModule.forRoot({count: counterReducer})
When you subscribe, bear in mind that this will return an object of type AppState like below:
{ count: 0 };

So when you're using async pipe, change it to:
{{ (counter$ | async)?.count }}

This will read from the object once it's been unwrapped. We add the ? to ensure that we don't get any errors before the observable has been unwrapped
Comment: That part of the setup is providing the keys and values to the store. The key is what's used in the `.select` function, so that the store knows which reducer to use, and therefore where to get the state. If we simply write `({counterReducer})`, the key is going to be the same as the variable name, i.e. `counterReducer`. If you want to be able to select using `count` as the key, you need to set the key as `count` by doing `{count: counterReducer}`
Comment: Perfect. Thank you so much. Will keep this in mind. :)
Comment: can you also please explain why we needed `count` for StoreModule. I saw `static forRoot(reducers: ActionReducerMap | InjectionToken>, config?: StoreConfig): ModuleWithProviders;` in the source code and getting confused
Comment: Thanks ! I made a mistake by casting State with AppState `constructor(public store : Store)` in the component. hence I was forced to select `count`. I removed it `constructor(public store : Store)`  and I was able to get store via keys. Many Thanks for your time.


Check for dots in the file name and remove them (on Linux)

Question: I found a bash script for my Synology NAS that is looking for *.mp4 files in a folder, strips the video out and saves them as *.m4a. (The purpose is an automatic 'YouTube to podcast converter').
for f in *.mp4; do mv -- "$f" "$(date +%Y-%m-%d -r "${f}") $f"; done
for f in *.mp4; do ffmpeg -i "$f" -vn -acodec copy "${f%.mp4}.m4a"; done

Sometimes the *.mp4 file names contain periods, e.g. 'This video...mp4', resulting in the podcast player not recognizing such files.
Is there a line I can add to the script to remove period(s) in front of the extension or to just remove them all?
Answer: Use the rename command to replace multiple consecutive dots with just one:
rename 's/\.+/./g' *.mp4

If you have perl installed and you cannot find rename, try also prename.
Comment: This is a good solution if you've got the Perl-based `rename` command.  Unfortunately, there are some under-powered variants called `rename` that don't use Perl regular expressions which are ... well, less satisfactory than the Perl-based commands of the same name.  See [How to rename with prefix/suffix](http://stackoverflow.com/questions/208181/how-to-rename-with-prefix-suffix/208389#208389) for a usable Perl `rename`.
Comment: @StefanoSanfilippo, the `${f}` is not outside any quotes: the `$()` runs in a subshell, so you effectively get a new "scope" for quotes.
Comment: Thanks for the pointer and the command line. Unfortunately my build of linux doesn't seem to support the rename command (not found). Cheers
Comment: Try `prerename`, of which `rename` is an alias. It is installed with `perl` package in Ubuntu and Debian.
Comment: What does `perl -v` says? If you cannot find it, I've pasted a copy here: http://codepad.org/IWaCTnbY
Comment: Thanks Stefano. It also wouldn't find 'prerename'. perl -v says 'This is perl, v5.8.6 built for MARVELL_88F6281' I'm not sure how to handle perl scripts, never did this before.
Comment: Nice! Download the script linked above, drop it in a folder, make it executable with `chmod +x rename.pl` and try calling it.
Comment: Noticed now: `prename`, not `prerename`! If you have `prename` you are ok.
Comment: I had to install rename using `sudo apt install rename`
Answer: Remove the extension from ${f}, then delete or substitute all dots, then add the extension back when you rename the files essentially dealing with all but the last dot:
#!/bin/bash

for f in *.mp4; do
        f=${f%.mp4}
        mv -- "${f}.mp4" "$(date +%Y-%m-%d -r "${f}.mp4") ${f//./_}.mp4"
done
for f in *.mp4; do
        ffmpeg -i "${f}" -vn -acodec copy "${f%.mp4}.m4a"
done

Obviously this only works for a single extension (.mp4 in this case).
Comment: You, Sir, are a genious. Dankeschön.
Comment: nice usage of the `--` +1 :)
Answer: Try the following, which uses tr to remove any periods in the filename:
for f in *.mp4; do mv -- "$f" "$(date +%Y-%m-%d -r "${f}") $f"; done
for f in *.mp4; do ffmpeg -i "$f" -vn -acodec copy "`echo "$f" | tr -d "\."`.m4a"; done

Comment: `convert.sh: line 2: tr: not found` It seems that my version of linux doesn't know very much linux at all..
Comment: Missing the tr utility?  That's unfortunate.  This is a common problem with stripped down embedded distributions.
Comment: @user2359595: Truly, if you don't have `tr`, your system is so hobbled that you'll have to work around any posted solution that assumes a set of POSIX utilities.
Comment: `tr` no, but `ffmpeg` yes. How nice :)
Answer: Just came across this answer here.
You can use the rename package by installing it using the following command.
sudo apt install rename

Then go to the directory containing the files and use the following command:
rename 's/\.(?!mp4$)/ /g' *.mp4


How to use where clause with different data in one column in entity framework?

Question: public ActionResult Index()
   {
     var results = db.Employee
        .Where(d => d.JOBID == "Tester"
            && d.JOBID == "Developer"
            && d.Salary =="2000")
        .ToList();

     return View(results);
  }

 Results
    NAME  JOBID      SALARY

John  Tester     4000
joy   Developer  2000
Comment: Did you mean to use `||` (or) instead of `&&` (and) because `JOBID` cannot be equal to more than one thing.
Answer: if you want to apply selection of two values from the same column you'd better use OR operator, This will list either Tester or Developer whom their salary is exactly 2000
public ActionResult Index()
   {
     var results = db.Employee
        .Where(d =>
                    (d.JOBID == "Tester" || d.JOBID == "Developer") &&
                    d.Salary =="2000")
        .ToList();

     return View(results);
  }

Answer: If you want to use the Where clause to select from one column based on multiple values, put the values you are looking for into a list first:
var jobIdList = new List<string>();

jobIdList.Add("Tester");
jobIdList.Add("Developer");

Now you can use the Contains clause to query any results that have a value in that list.
 var results = db.Employee
    .Where(d => (jobIdList.Contains(d.JOBID)
        && d.Salary =="2000"))
    .ToList();

This way your query always works the same, but you can change the results you get by changing the values in jobIdList. Want to include Managers? jobIdList.Add("Manager");, then run your query again. Now you want to remove Developers and only get back Testers and Managers? jobIdList.Remove("Developer"), then run your query and get new results. This makes your query method much more flexible. Now you get back any employee where the JOBID is in the list AND the salary = 2000. (you might look at that salary value, hard coding that might not be ideal.)


Material UI Tabs with routes

Question: So I'm using Material UI Tabs, and I'm trying when a user taps on tab it redirects him to a tab with a link but it would be still in the same main page
Example of what i'm looking for please notice the link changes as the tabs changes:

Material UI VerticalTabs
import * as React from 'react';
import PropTypes from 'prop-types';
import Tabs from '@mui/material/Tabs';
import Tab from '@mui/material/Tab';
import Typography from '@mui/material/Typography';
import Box from '@mui/material/Box';

function TabPanel(props) {
  const { children, value, index, ...other } = props;

  return (
    <div
      role="tabpanel"
      hidden={value !== index}
      id={`vertical-tabpanel-${index}`}
      aria-labelledby={`vertical-tab-${index}`}
      {...other}
    >
      {value === index && (
        <Box sx={{ p: 3 }}>
          <Typography>{children}</Typography>
        </Box>
      )}

  );
}

TabPanel.propTypes = {
  children: PropTypes.node,
  index: PropTypes.number.isRequired,
  value: PropTypes.number.isRequired,
};

function a11yProps(index) {
  return {
    id: `vertical-tab-${index}`,
    'aria-controls': `vertical-tabpanel-${index}`,
  };
}

export default function VerticalTabs() {
  const [value, setValue] = React.useState(0);

  const handleChange = (event, newValue) => {
    setValue(newValue);
  };

  return (
    <Box
      sx={{ flexGrow: 1, bgcolor: 'background.paper', display: 'flex', height: 224 }}
    >
      <Tabs
        orientation="vertical"
        variant="scrollable"
        value={value}
        onChange={handleChange}
        aria-label="Vertical tabs example"
        sx={{ borderRight: 1, borderColor: 'divider' }}
      >
        <Tab label="Item One" {...a11yProps(0)} />
        <Tab label="Item Two" {...a11yProps(1)} />
        <Tab label="Item Three" {...a11yProps(2)} />
      </Tabs>
      <TabPanel value={value} index={0}>
        Item One
      </TabPanel>
      <TabPanel value={value} index={1}>
        Item Two
      </TabPanel>
      <TabPanel value={value} index={2}>
        Item Three
      </TabPanel>
    </Box>
  );
}

I know that I have to use react-router-dom but I didn't know how to implement, any help would be appreciated.
Comment: you're looking for nested routes. this article can be a good start https://www.robinwieruch.de/react-router-nested-routes/
Answer: Create a route component or destructive the routes in App.js. Just install react-router-dom and use BrowserRouter as Route as the Parent tag. Then add routes and structure your routes for your pages there.
import {BrowserRouter as Router, Routes, Route} from 'react-route-dom'

<Router>
   <Routes>
     <Route path='/pageName' element={<pageName/>}>
     <Route path='/pageName2' element={<pageName2/>}>
   </Routes>
</Router>

Also refer react router v6 docs. This playlist would helpful to using different routing mechanism. In your case you need to watch the tutorial 8 to do the nested routes. If you're a person who familiar with v5 and want to know the changes in v6, then refer this video also.

Material UI Tabs with routes


expected primary expression before 'bool'

Question: My program says "error: expected primary-expression before 'bool'" on the function call repeatOrNot (bool); under the main function. Why is this?
bool fiveOrNot();
void repeatOrNot (bool);

int main()
{
    fiveOrNot();
    repeatOrNot (bool);

    return 0;
}

bool fiveorNot()
{
    int number;
    cout << "Enter any number except for 5.\n";
    cin >> number;

    if(number == 5)
        return true;
    else
        return false;
}

void repeatOrNot(bool repeat)
{
    if(repeat == true)
        fiveorNot();
    else
        cout << ":(\n";
}

Comment: You need a value of type `bool` in your call to `repeatOrNot`. Writing the type name makes no sense. Did you mean `repeatOrNot(fiveOrNot())`?
Comment: Inside `repeatOrNot`, you don't need to write `if (repeat == true)`, just `if(repeat)`. Both will evaluate to true if `repeat` is true.
Answer: In C++. there are so-called formal parameters and actual parameters. When you are defining a function, you are dealing with formal parameters, meaning you should only specify a type of the parameter, and (if you want to) give it some meaningfull name
void repeatOrNot(bool repeat)//<----"repeat" is a formal parameter.
//You are not passing anything to the function,
//you are just telling the compiler that this function accepts one argument
//of a bool type.
{
    if(repeat == true)
        fiveorNot();
    else
        cout << ":(\n";
}

However, when you are calling a function, you need to pass it an actual parameter, i.e. some variable of a correct type. In your case, you probably meant to pass the result of a call to fiveOrNot function. You can do it like this:
bool isFive = fiveOrNot();
repeatOrNot (isFive);//<---This is an actual parameter.
//here you are really passing a variable to your function.

or like this:
repeatOrNot(fiveOrNot());//<--the result of the execution of "fiveOrNot" will be passed into "repeatOrNot"


More specific CSS rule is not working

Question: In my following code, I have defined more specific rule for h1 as #inner h1 and less specific rule as #container h1 is also defined. But if #container h1 is put after #inner h1 then it takes effect and #inner h1 is ignored while it shouldn't be because its more specific.
Please help me in understanding the issue.
CSS:
#inner h1 { font-size:25px; }
#container h1 { font-size:15px; }

HTML:

Hello World!

Comment: No, `#inner h1` is not more specific than `#container h1`. They both have a specificity of 101 (I believe, http://www.htmldog.com/guides/cssadvanced/specificity/). Just because an element is INSIDE another element doesn't make the one inside be more specific.
Comment: @Charlie: Note that it's not literally one hundred and one - 11 class selectors, for example, won't override a single ID selector. It's more like one-zero-one.
Answer: It might be that your idea of specificity is a little off. Specificity has to be a context-free idea: since CSS can be loaded independently of HTML, you must not need an HTML document to guess which rule is more "specific". Consider this other valid example:

Hello World!

With this snippet, you would have to go against your initial guess that inner should be more specific. This means that your interpretation required context (which CSS does not have).
The point is, both rules are seen with equal specificity (h1 descendants of an element identified by an id), and the selector doesn't give higher priority to closer descendants.
In case two rules of equal specificity apply, the winner is the last one declared in the CSS.
Comment: Another thing: combinators don't contribute to specificity at all, so swapping the space for a `>` won't affect which rule takes precedence, because both combinators are of no specificity. See [this question](http://stackoverflow.com/questions/8096829/why-do-foo-bar-and-foo-bar-have-the-same-specificity-in-css)
Answer: Those both have the same specificity and as you note, the order they appear in the style sheet is the determining factor for which style rules are applied.
There are a variety of ways you could structure the rules to gain more specificity but in general I'd stay away from the !important modifier.
For more information see 6.4.3 Calculating a selector's specificity in the W3's CSS spec.
Comment: There's also a helpful article on selector specificity (there was a question similar to this yesterday), http://www.htmldog.com/guides/cssadvanced/specificity/
Comment: @ShawnTaylor no, those two have the same specificity.
Comment: Isn't #inner h1 more specific?
Answer: this is not an issue at all :) CSS parses classes one after another and the last rule overrides previous, of course if the previous is not more specific or does not include !important statements in it, you can put font-size: 25px !important; in the first so that it overrides the last rule, otherwise just change places of classes
Comment: @Mr. BeatMasta, I know but I didn't think that this question had anything to do with classes.
Comment: @Mr. BeatMasta, class in css makes me think of .container so your post was a bit confusing
Comment: Isn't #inner h1 more specific?
Comment: @Shawn, they're equal both in length and selectors themselves, if you had div#inner h1 that would be more specific
Comment: @grc, umm I consider anything like #container h1 {} a class declaration in css, don't you?
Comment: that's not class, that's a class selector for class="" attribute of html, what refers to class="" contents I consider that className rather than "class", and everything is inside {} is a class declaration
Comment: "everything is inside {} is a class declaration" I think most people consider that a styling rule.

More specific CSS rule is not working


Unable to shutdown or reboot ubuntu 20.04

Question: I recently installed Ubuntu 20.04 in my laptop. After installation my system was unable to restart and was stuck at black-blank screen. After no response i manually turn off my machine then when i booted up system it worked fine. Later when i tried to shutdown, it again got stuck at black screen then i had to again turn off my machine manually. I also do not have a dedicated graphic card on my system. It runs Intel HD graphics. Please provide me some solution to resolve this issue.
Answer: Boot your system then try to shut it down again.
When it goes black-blank screen, try hitting the F4 key.
This should display system messages and allow you to see if there's some error message. For instance, it could be a service waiting forever for termination.
If hitting F4 doesn't work, reboot again. Then, when you're on logging screen, hit the Ctrl+Alt+F1 key combination. This will display your first TTY.
Log in with your usual username (you will need sudo permissions), then try shutting down your system whith the following command :

poweroff

Again, this shoud display system messages and allow you to see if there are any errors. If it goes black-blank again, then, at next reboot, you might have a look at your <code>/var/log/syslog</code> file to determine what's going wrong.
Comment: I tried these methods but it does not seems to be working.
Comment: Now i am getting black screen with blinking underscore (_) cursor after shutting down the system. And the screen is stuck there.
Comment: That's quite weird. Can you at least log in to TTY1 with the Ctrl+Alt+F1 key combination after rebooting ?
Comment: I tried to change the brug config. and replaced "quit splash" with "acpi= off" now it seems to be working. For now atleast.
Comment: Okay. So, problem solved. :-)
Comment: Yes , by changing brig config. to "acpi=off" it only worked for some time , then I again changed brug by replacing acpi=off with "noapic", now its properly shutting down. So problem solved. Thanks for your response.
Answer: After changing the brug config. I noticed that after shutdown my system was stuck after the line "target shutdown reached", so i replaced "quit splash"  with "noapic" . Now it seems to be working fine.


Is this an insect nest?

Question: I have found this little formation of ca. 5 cm (2 inches) near my bedroom window. I have seen no insects crawling or flying around it. I'm in southern Europe (Italy / coastal Tuscany), and it is late Spring.
Is this an insect nest? Maybe wasps? Is it something that I should be wary of, or can I just try and knock it down by myself (with some precautions, by night and after spraying it down abundantly)?
Comment: what is it made of?
Comment: @jsotola It looks a bit like dry mud (as Kyle's answer suggests), but I haven't tried touching it, just to err on the safe side.
Comment: Some sort of insect.
Answer: Where I am here we call them mud daubers. They are a wasp which builds it's nest by forming wet dirt (mud). They are also called Mud Wasps. They are not terribly aggressive. Usually I just knock off the nest when I see them on my home. Cleaning off where they attach themselves can be a chore- usually it leaves a stain I cannot get off.
Comment: @FreeMan They also tend to go relatively dormant when it gets cold out, so that's the safest time to mess with them.  They'll probably be more aggressive during mid-day heat.
Comment: True, they aren't aggressive, but the sting is about 5x more potent than a yellow jacket. Also, they aren't a colony wasp. That is a single female's nest.
Comment: Usually the wasps will all return home from work in the evening. I tend to hose it down with wasp killer spray in the evening and give it a day or so to kill them, then knock down the nest. Fortunately, ours have all been outside, so I haven't worried much about staining.
Comment: Thanks! I have broken down the nest with a pole (I couldn't knock it off intact in one piece). It was completely empty, no insects. I confirm the stain does not want to come off.
Answer: This is a mud dauber nest. It is built by a wasp in the family Sphecidae, though other mud daubers with different shaped nests can be from some other families. Each cell of the nest is filled with spiders that are paralyzed. The female wasp lays one egg in the cell and the larva eats the spiders. The female flies to a pond or other water source where the bank has clay. She gathers a ball of clay and flies back to the nest. She works the clay in her jaws and adds it to the nest. She flies back and forth until the cell is finished. Then starts on a new cell. Stings are uncommon, but possible.

Is this an insect nest?


Python modules not being detected although they are installed

Question: I had an old version for Python. Then I uninstalled the old version, and install a new one - 2.7.9.
I set the 2.7.9 as my global version via pyenv but all my modules not being detected. They were installed before the upgrading. Now I uninstalled them and reinstall but still not working...
~/Projects/development$ python
Python 2.7.9 (default, Mar  3 2016, 16:42:45)
[GCC 4.6.3] on linux2
>>> from github import Github
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named github

They already reinstalled after the python upgrading! Trying to install them again, gives Requirement already satisfied error.
~/Projects/development$ pip install PyGithub
Requirement already satisfied (use --upgrade to upgrade): PyGithub in /usr/local/lib/python2.7/dist-packages
Cleaning up...

What can I do?
~/Projects/development$ pyenv versions
  system
* 2.7.9 (set by /home/user/.pyenv/version)

~/Projects/development$ python
    Python 2.7.9 (default, Mar  3 2016, 16:42:45)
    [GCC 4.6.3] on linux2
>>> sys.executable
'/usr/local/bin/python'
>>> sys.exec_prefix
'/usr/local'
>>> print '\n'.join(sys.path)

/usr/local/lib/python27.zip
/usr/local/lib/python2.7
/usr/local/lib/python2.7/plat-linux2
/usr/local/lib/python2.7/lib-tk
/usr/local/lib/python2.7/lib-old
/usr/local/lib/python2.7/lib-dynload
/usr/local/lib/python2.7/site-packages

which pip gives /usr/bin/pip.
Comment: Check that the old python is really gone by looking in the directory.  Also check `which pip` to make sure it is the new version.  Check that your `$PATH` and `$PYTHONPATH` do not contain the old directory names.
Comment: can you go to the folder pip says it is already installed to and see what is there? you may need to uninstall and reinstall modules.
Comment: I already installed and reinstalled...
Comment: See updated answer
Answer: I found the problem.
dist-packages vs. site-packages.
Using prev Python version, and also after upgrading, my packges were installed by pip to /usr/local/lib/python2.7/dist-packages, whereas the new Python I installed expects packages to be installed to /usr/local/lib/python2.7/site-packages (When manually installing Python from source, it uses the site-packages directory. See more here). I can temporary copy the modules, or just manipulate the PYTHONPATH environment variable to point to dist-packages in order to gain access to the installed packaged with the newly installed version of Python.
From here.


How to force a type to be defined by the given argument

Question: Background situation:
// Type to do the validation - not so important.
type Validate<N, S> = [S] extends [N] ? N : never;

// Note that with below line, N will have a circular constraint when using from validateName().
// type Validate<N, S> = S extends N ? N : never;

// The function to validate - how it runs as JS (or even what it returns) is not important.
// .. However, it is important that it must use a Validate type with two arguments like above.
function validateName<N extends string, S extends Validate<N, S>>(input: S) {}

Problem:
How to supplement only N but not S to the validateName (or Validate) above? We want S to remain inferred by the actual argument.
// Test.
type ValidNames = "bold" | "italic";

// Desired usage:
// .. But we can't do this due to "Expected 2 type arguments, but got 1."
validateName<ValidNames>("bold");   // Ok.
validateName<ValidNames>("bald");   // Error.

// Cannot solve like below due to: "Type parameter defaults can only reference previously declared type parameters."
function validateName<N extends string, S extends Validate<N, S> = Validate<N, S>>(input: S) {}

Working workarounds:
Workaround #1: Store the input as a variable, and use its type.
const input1 = "bold";
const input2 = "bald";
validateName<ValidNames, typeof input1>(input1);  // Ok.
validateName<ValidNames, typeof input2>(input2);  // Error.

Workaround #2: Make the function require extra argument.
function validateNameWith<N extends string, S extends Validate<N, S>>(_valid: N, input: S) {}
validateNameWith("" as ValidNames, "bold");  // Ok.
validateNameWith("" as ValidNames, "bald");  // Error.

Workaround #3: Use closure - by wrapping the function inside another.
// First a function to create a validator and put N into it.
function createValidator<N extends string>() {
    // Return the actual validator.
    return function validateName<S extends Validate<N, S>>(input: S) {}
}
const validateMyName = createValidator<ValidNames>();
validateMyName("bold");  // Ok.
validateMyName("bald");  // Error.

Edited: Modified the functions above by removing the confusing :N[] return part.
More info / the context:
I'm actually trying to build a string validator that can be used, eg. for html class names. Everything else works, except the usage is clunky (see the 3 workarounds above).
// Thanks to: https://github.com/microsoft/TypeScript/pull/40336
type Split<S extends string, D extends string> =
    string extends S ? string[] :
    S extends '' ? [] :
    S extends `${infer T}${D}${infer U}` ? [T, ...Split] :
    [S];

// Type to validate a class name.
type ClassNameValidator<N extends string, S extends string, R = string> =
    Split<S, " "> extends N[] ? R : never;

// Function to validate class.
function validateClass<N extends string, S extends ClassNameValidator<N, S>>(input: S) {}

const test3 = "bold italic";
const test4 = "bald";
validateClass<ValidNames, typeof test3>(test3);  // Ok.
validateClass<ValidNames, typeof test4>(test4);  // Error.

Answer: I might have a solution that works for you. Instead of having a Validation type, you could have a type that calculates all permutations of the possible values based on the given string union.
type AllPermutations<T extends string> = {
  [K in T]:
    | `${K}${AllPermutations<Exclude<T, K>> extends infer U extends string
        ? [U] extends [never]
          ? ""
          : ` ${U}`
        : ""}`
    | `${AllPermutations<Exclude<T, K>> extends infer U extends string
        ? U
        : never}`
}[T]

// Function to validate class.
function validateClass<N extends string>(input: AllPermutations<N>) {}

It passes the following tests.
type ValidNames = "bold" | "italic";

validateClass<ValidNames>("bold");  // Ok.
validateClass<ValidNames>("bold italic");  // Ok.
validateClass<ValidNames>("italic");  // Ok.
validateClass<ValidNames>("italic bold");  // Ok.
validateClass<ValidNames>("something else");  // Error.

But if the union gets bigger, this will become perfomance hungry. I would not advise to use this if ValidNames is a larger union.
Playground
Comment: This will probably be possible some day, when TypeScript gets partial type inference. https://github.com/microsoft/TypeScript/issues/26242
Comment: No it doesn't solve it. I need to use that `S` to do validation in the form of `Validate` . I didn't want to complicate the example / situation any further, but maybe will add more background info.  (I'm actually using it to split a string in TS, eg. "bold italic", and I have a type to do that - but it's not related to the problem at hand.)
Comment: @takaturre please edit your question to include your real example. Otherwise it's hard to help you.
Comment: I edited to provide a step bigger context. However, it does not change the core question / issue - though, of course, helps to understand and maybe someone might even come up with out-of-box alternatives.
Comment: Okay, this is much better, thanks! However I want to clarify one thing (as I'm just learning TS): Does this actually create all those valid strings, like "bold italic" and "italic bold", or just create a sort of "dynamic" type to match against? Because I considered this approach initially and came to the conclusion that this would soon get very heavy. For example consider having, say, 100 class names, then to create all those permutations....
Comment: It would generate them all when using the function. You would probably get an error if `ValidNames` is that large. I just tested it and the editor becomes unresponsive at around 10 elements.
Comment: Okay, so it's the pre-heavy-way unfortunately. In this case, I'd prefer one of my workarounds (#2 and #3). Anyway, super useful for learning TS, thanks a lot!
Answer: Solution:
I accidentally found a solution (or a clean workaround). It's the same background idea as in workaround #3, but implemented purely in TS (no extra JS). The idea is to separate the N and S parts using a "type closure": namely, to define a function with a generic N param on the left hand side, and use the S only on the right hand side.
// Create a type for validation function, separating N and S.
// .. Using the ClassNameValidator from the original question.
type Validate<N extends string> = <S extends ClassNameValidator<N, S>>(input: S) => void;

// Then we can supplement just N - without S.
// .. Note that the actual js function can be reused (eg. from a library).
const validateClass: Validate<ValidNames> = (_input) => {}

// Test.
validateClass("bold");  // Ok.
validateClass("italic bold");  // Ok.
validateClass("bald");  // Error.

Note that this solves the problem for me - though it's not strictly what was asked in the title (which seems to be currently impossible).


Freeware Plugin to View HTML source generated by ASP.NET?

Question: Are there any freeware plugins that would help me view the HTML Source generated by ASP.NET?
Comment: It might be useful to rephrase this as a question...
Comment: If you are looking for the source code to ASP.NET web pages, you can't find that using any type or plugin. That code is executed on the server and is never returned back to the end user. The only way you'll ever see it is by breaking in and stealing the source files and opening them up.
Answer: Microsoft's Fiddler2 for IE
Or Firebug for FireFox
With these you see the real source generated by ASP.NET, not the mangled source as shown in a browsers 'view source' menu option
Answer: You can use Internet Explorer's View Source button, under the 'Edit menu. Firefox has something similar under the View menu.
Edit: If you're looking for the source code for the application, you won't be able to see that no matter what you do.  The server sends the client only what it wants the client to see.  For ASP.NET, this means you'll see ASP.NET generated control IDs and the like.  If you want to do this on your own without a web browser, try Wget.
Comment: But there is some hidden code that I am unable to view by viewsource. I am asking about someplugin that will let me view that code too
Comment: View HTML is a plugin that will give you the power to see the HTML search code for a webpage.
Comment: someplugin like this one as this one is not downloadable
Answer: The Internet Explorer Developer Toolbar has many features. The Web Developer add-on for Firefox looks slick. Here is a walk through of using another add-on for FireFox.
If what your looking for is just to view the source, all browsers I am familiar with have that feature built in. Internet Explorer
Answer: You shouldn't have to look when that function is already built in to just about every single web browser out there. View Source is a standard feature.
Answer: Installing the Web Developer extension for Firefox will let you view 'generated' source (i.e. it includes changes made to the html by client side javascript etc..). Otherwise the standard 'view source' option available in any browser should suffice.


Should I build a resist set of gear?

Question: I'm working my way though Nightmare and I'm starting to get lots of drops with +resists.  Should I be saving some of these that kind-of fit with my class for later on?  Just save a particular resist set (e.g. Fire)?
Are there any encounters in Hell or up where you require a resist stat?
Comment: Just reached NM, and I have a sub-question for those replying: should I save +fire resist for molten fire chains elites?
Answer: Since Armor protects against all types of damage, it is unlikely that resist gear that you find in Nightmare is going to be better than equipment you find later on with significantly higher armor.  So I don't think it makes sense to try to hold on to resist gear over a levelling up period.  You should only grab a bunch if you need it short term, or once you've gotten high enough level that armor values won't be increasing significantly anymore.
Comment: I agree... I made the mistake of starting to invest in +30-ish resist gear on my Barbarian while running Hell, only to find out that really for Inferno, I'd want pieces with +50 or more. No sense grabbing Nightmare gear for later... you'll want better by the time you need it.
Comment: Armor reduces magic damage?
Comment: @NickT Armor reduces **all** damage. See [this SE question](http://gaming.stackexchange.com/questions/67319/how-do-armor-resistances-and-missile-melee-damage-reduction-interact) and also [this Blizzard forum post](http://us.battle.net/d3/en/forum/topic/5149150485). Short versions if you want to find an equilibrium between resistance and armor.

Should I build a resist set of gear?


getting context is nullpoint exception even though tried many solutions in service

Question: I'm trying to get context in service. I know that Service extends Context and I can get it at onCreate method. So I tried it and got error. I don't understand other example uses the context at onCreate and works, but not to me.  Also I registered my service. the error is occurred at this line in service.
player = ExoPlayerFactory.newSimpleInstance(mContext, DefaultTrackSelector())

Why the context is null even though I initialized the context in onCreate? I saw the similar problem at here Android getContext on a background Service
error
java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Context android.content.Context.getApplicationContext()' on a null object reference

activity
 override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivityMainBinding.inflate(layoutInflater)
        setContentView(binding.root)

        val musicPlayer = binding.musicPlayer

        musicPlayer.player = audioService.getplayerInstance()
        musicPlayer.player.playWhenReady = true
        mIntent = Intent(this,AudioService::class.java)
        Util.startForegroundService(this,mIntent)
        bindService(mIntent, mConnection, Context.BIND_AUTO_CREATE);
        initializePlayer();

    }

Service

class AudioService  : Service() {
    private val mBinder: IBinder =Binder()
    private var player: SimpleExoPlayer? = null
    private var playerNotificationManager: PlayerNotificationManager? = null
    private var cacheDataSourceFactory : CacheDataSourceFactory?=null
    var mContext: Context? = null
    override fun onDestroy() {
        releasePlayer()
        super.onDestroy()
    }

    override fun onCreate() {
        super.onCreate()
        mContext = this
        if (player == null) {
            startPlayer()
        }
    }

    private fun releasePlayer() {
        if (player != null) {
            playerNotificationManager!!.setPlayer(null)
            player!!.release()
            player = null
        }
    }

    override fun onBind(intent: Intent?): IBinder {
        return mBinder
    }

    fun getplayerInstance(): SimpleExoPlayer? {
        if (player == null) {
            startPlayer()
        }
        return player
    }

    override fun onStartCommand(intent: Intent, flags: Int, startId: Int): Int {
        return START_STICKY
    }

    private fun startPlayer() {

        val uri: Uri = Uri.parse("https://storage.googleapis.com/exoplayer-test-media-0/Jazz_In_Paris.mp3")
        player = ExoPlayerFactory.newSimpleInstance(mContext, DefaultTrackSelector())

        cacheDataSourceFactory = getCacheDataSourceFactory(mContext!!)
        val mediaSource: MediaSource = ProgressiveMediaSource.Factory(cacheDataSourceFactory)
            .createMediaSource(uri)
        player!!.prepare(mediaSource)
        player!!.setPlayWhenReady(true)

        playerNotificationManager = PlayerNotificationManager.createWithNotificationChannel(
            mContext,"channel_id", com.haii.exoplayerdemo.R.string.channelName,com.haii.exoplayerdemo.R.string.channelDescription,11,
            object : PlayerNotificationManager.MediaDescriptionAdapter{
                override fun createCurrentContentIntent(player: Player): PendingIntent? {
                    val intent = Intent(mContext,MainActivity::class.java)
                    return PendingIntent.getActivity(mContext,0,intent,PendingIntent.FLAG_UPDATE_CURRENT)
                }

                override fun getCurrentContentText(player: Player): String? {
                    return "description"
                }

                override fun getCurrentContentTitle(player: Player): String {
                    return "title"
                }

                override fun getCurrentLargeIcon(
                    player: Player,
                    callback: PlayerNotificationManager.BitmapCallback
                ): Bitmap? {
                    return null
                }

            } ,
            object : PlayerNotificationManager.NotificationListener {
                override fun onNotificationStarted(notificationId: Int, notification: Notification) {
                    Log.d("TAG","onNotificationStarted")
                    startForeground(notificationId,notification)
                }
                override fun onNotificationPosted(notificationId: Int, notification: Notification, ongoing: Boolean) {
                    Log.d("TAG","onNotificationPosted")
//                    startForeground(notificationId,notification)
                }

                override fun onNotificationCancelled(notificationId: Int, dismissedByUser: Boolean) {
                    Log.e("TAG","onNotificationCancelled 2")
                    stopSelf()
                }

                override fun onNotificationCancelled(notificationId: Int) {
                    Log.e("TAG","onNotificationCancelled 1")
//                    stopSelf()
                }
            }
        )
        playerNotificationManager!!.setPlayer(player)
    }

    fun getCacheDataSourceFactory(context : Context) : com.haii.exoplayerdemo.CacheDataSourceFactory?{
        if(cacheDataSourceFactory==null){
            cacheDataSourceFactory = com.haii.exoplayerdemo.CacheDataSourceFactory(
                context,
                DefaultDataSourceFactory(context, "ua"),
                MyExoPlayer.MAX_CACHE_VALUE, MyExoPlayer.MAX_CACHE_FILE_VALUE
            )
        }
        return cacheDataSourceFactory
    }

}

Answer: I`m refering from here https://developer.android.com/guide/components/services.
The thing that you are doing wrong is calling getPlayerInstance() before onCreate is called. Your oncreate is called when you either bind or start the service. Good luck


"Weird sound signature" on integrated speakers

Question: My laptop is an ASUS K555UB (i5 6200U, GeForce 940M), running dualboot Ubuntu 17.04 and Windows 10.
The speakers sound "hollow" and with weird bass on Ubuntu compared with Win10, but when using any external speaker/headphone, they sound pretty similar in both OS.
Also, ASUS provides an audio software for Windows (AudioWizard Screenshot). Without it, the sound became similar to the one on Ubuntu
Details on Ubuntu:
<code>$ pacmd list-sinks | grep sample
      sample spec: s16le 2ch 44100Hz

$ head -n 1 /proc/asound/card*/codec#*
      ==> /proc/asound/card0/codec#0 <==
      Codec: Realtek ALC256

      ==> /proc/asound/card0/codec#2 <==
      Codec: Intel Skylake HDMI

$ aplay -l
      **** List of PLAYBACK Hardware Devices ****
      card 0: PCH [HDA Intel PCH], device 0: ALC256 Analog [ALC256 Analog]
        Subdevices: 1/1
        Subdevice #0: subdevice #0
      card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
        Subdevices: 1/1
        Subdevice #0: subdevice #0
      card 0: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1]
        Subdevices: 1/1
        Subdevice #0: subdevice #0
      card 0: PCH [HDA Intel PCH], device 8: HDMI 2 [HDMI 2]
        Subdevices: 1/1
        Subdevice #0: subdevice #0
</code>
In the driver page from ASUS, there isn't any software for Linux systems.
There is any similar software alternative or workaround for Ubuntu?
I tried to install pulseaudio EQ as suggested by Olimjon, but it was already installed and it doesn't appear in the launcher.
In terminal I got this info
<code>$ pulseaudio
       E: [pulseaudio] pid.c: Daemon already running.
       E: [pulseaudio] main.c: pa_pid_file_create() failed.
</code>
Should I remove/purge current installation and reinstall? Or there is a bigger problem?
Thanks for any help
Answer: Yes, there is software called PulseAudio Equalizer.
PulseAudio Equalizer has an integrated 10-band equalizer system and provides an effective workaround for Audiowizard for Ubuntu.
To install press Ctrl+Alt+T and type:
<code>sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install pulseaudio-equalizer
</code>
I recommend you to select Headphones preset.
For more Info, check this.
Comment: It seems that it was already installed, but i'm getting errors
I'll add them in an edit
Comment: Maybe, you just run ```pulseaudio-equalizer``` from terminal?
Comment: Tried that, but it isn't registered as a command
Comment: Well, in that case, do ```sudo apt-get purge pulseaudio-equalizer``` and install it again from repo that I gave, then run ```pulseaudio-equalizer-gtk```
Comment: I suppose, this error occured because ```pulseaudio-equalizer``` is available on **Zesty** official repo, but the version is **1.1**, in **webupd8** repo it is **2.7**.
Comment: thanks! i managed to install it getting the correct version.
What i did was get the version number with `apt-cache policy `, and then `apt-get install package=version`.
I'll be testing the presets today, because the Headphone preset felt a bit wonky


apache2 restart problem

Question: When I restarted apache2 i got the below error.
<code>$ sudo service apache2 restart
 * Restarting web server apache2                                                                                [fail]
 * The apache2 configtest failed.
Output of config test was:
apache2: Syntax error on line 140 of /etc/apache2/apache2.conf: Syntax error on line 2 of /etc/apache2/mods-enabled/dav_svn.load: Cannot load /usr/lib/apache2/modules/mod_dav_svn.so into server: /usr/lib/apache2/modules/mod_dav_svn.so: cannot open shared object file: No such file or directory
Action 'configtest' failed.
The Apache error log may have more information.
</code>
Please help me to solve this issue.
I also tried installing libapache2-mod-svn, got the below errors.
<code>$ sudo apt-get install libapache2-mod-svn
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  db5.3-util
The following NEW packages will be installed:
  libapache2-mod-svn
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/87.7 kB of archives.
After this operation, 440 kB of additional disk space will be used.
Selecting previously unselected package libapache2-mod-svn.
(Reading database ... 63832 files and directories currently installed.)
Preparing to unpack .../libapache2-mod-svn_1.8.10-1ubuntu2_i386.deb ...
Unpacking libapache2-mod-svn (1.8.10-1ubuntu2) ...
E: Sub-process /usr/bin/dpkg returned an error code (1)
</code>
Comment: Do you have [`libapache2-mod-svn`](http://packages.ubuntu.com/search?searchon=contents&keywords=mod_dav_svn.so&mode=exactfilename&suite=trusty&arch=any) installed?
Comment: When I tried to install that I got the below error
Comment: 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/87.7 kB of archives.
After this operation, 440 kB of additional disk space will be used.
Selecting previously unselected package libapache2-mod-svn.
(Reading database ... 63832 files and directories currently installed.)
Preparing to unpack .../libapache2-mod-svn_1.8.10-1ubuntu2_i386.deb ...
Unpacking libapache2-mod-svn (1.8.10-1ubuntu2) ...
E: Sub-process /usr/bin/dpkg returned an error code (1)
Comment: I have updated my question muru
Answer: The issue is fixed.
First I removed apache2
$ sudo apt-get remove apache2
then I installed libapache2-mod-svn
$ sudo apt-get install libapache2-mod-svn
This is how the problem is solved.
Thanks for your support guys.

apache2 restart problem


Where is residential power voltage reduced to home level from the street line level?

Question:
What is the potential/voltage of the power line on a city street?
Where does the potential/voltage of the line drop to the indoor value, e.g., 120 V in the US?
If I need to upgrade the whole electric circuitry of a house, do I need to worry about the high voltage and if so, where does the high voltage starts to drop down to the indoor value coming into the house?
To address the concern expressed in the comment below, I am looking to hire an electrician to upgrade the electric circuitry including the panel, meter, distributor, weather head and riser. I am wondering what are actually involved and what kind of price I would expect to be charged. The house is a single family house in Sacramento county, CA, USA.
Comment: The answer is to call an electrician. If you need to upgrade the whole electric circuitry of the house and you don't know about the transformers from utility power to residential power, please don't burn your house down.
Comment: Frankly, the slant of the question and follow on comments smells a lot like "I'm planning to do something with the utility conductors and have no grasp of how dead that will make me" but ...whatever... Not to mention how dead (or homeless due to the fire) you can get messing with 240, particularly before it hits your main breaker, when you think it's 110 and that makes it "safe." If you do survive that, the utility will have a fun time suing you into homelessness anyway.
Comment: I'm voting to close this question because it's not about home improvement
Comment: I agree with @Ecnerwal - your knowledge of residential wiring seems _extremely_ thin, and that lack of knowledge can _kill_ you! If you're planning on doing this work yourself, _please_ spend a _LOT_ of time learning (a licensed electrician in the US will spend about _5 years_ of book learning & OTJ apprenticeship) **before** you start, or plan on hiring this out. We'd love to answer your questions, but you have to be alive to ask them
Comment: @Ack: It is about home improvement as I have now stated the reason.
Comment: What is missing here is clarification of **intent**: Is this: *I am going to get some serious electrical work done (professionally, properly, in coordination with utility, permits, etc.) and am just curious as to how/where voltage gets converted to my usual 120*, which is 100% a good reasonable safe question, **or** is this *Hmm, I want to try and bypass the meter (but can't tell you that) or I want to see if more voltage would be "better" (but I can't tell you that), so I'm wondering when/where/how something other than 120V gets to/is near my house* **which would be a bit of a problem**.
Comment: This is also very broad with 3 questions. The first 2 could be considered related enough for one question (though off-topic), while the 3rd is related (because it's talking about electricity), but shutting off power to the house is unrelated to transmission line voltages.
Comment: @Hans _Why_ do this? Do you just have nothing better to do with your time? Seems like an absolute waste of time, effort, and money.
Comment: @Ack: I added the reason for the question.
Comment: @Ecnerwal: I just edited my question to address your concern.
Comment: @Hans -- perhaps it'd be better to ask "what's involved in an electrical service upgrade?" directly instead of coming at your real question "through the back door" so to speak...
Comment: @ThreePhaseEel: Well, the voltage question itself is an offshoot of the main question. Then people start to ask me why I asked the voltage question. This is the answer which is now accused of being distracting. It is hard to please everyone. I actually do not understand how and why the original voltage question itself is off topic.
Comment: @Hans -- basically, you were asking about something that's a function of the utility's system -- for anything you do with a house, you can treat the utility as a "black box" that supplies the nominal mains service voltage.  anything higher than that is contained entirely within utility gear :)
Answer: The power delivery utility company distributes the AC power to locations away from the power generating stations using high voltages. This is done to help minimize the amount of power loss in the distribution wires and cables. The power loss is always related to the amount of current being distributed to the loads. For each doubling of the voltage used in the distribution network the amount of current for the same load is cut in half.
The voltage levels used will depend in part upon the type, location and distance that section of the power grid needs to deliver electrical power to the consumer loads. Voltages can be in the 1000s of volts.
When high voltage power distribution reaches a residential neighborhood or a business center transformers are used to step the high voltage down to the voltages used in the homes and businesses. Pictures of some typical power transformers are shown below. Typically these transformers are owned and maintained by the power delivery utility company. When you would need service at a particular current level the power company will deploy the proper transformers and then provide a power line connection from the transformer to the electrical usage meter which would be on or adjacent to the home or business.
Typical Transformers:

Picture Source

Picture Source

Picture Source
Comment: +1. Nice answer. Thank you.
Answer: In most places in the US, residential power comes into the meter at 240V/120V - three conductors, 2 hot and 1 neutral. The hots are 240V apart (there are some situations where they may 208V or some other value, but 240V is most common) and the hots are each 120V from neutral.
Typically there will be a transformer either on a pole or in an underground vault or on a street corner which transforms power from some higher voltage to 240V. But you don't need to worry about that. Your utility provides 240V, and how it gets there is up to them. In some large buildings, that transformer may even be inside the building, but you, as the ordinary consumer, only get 240V/120V.
If you have to upgrade the entire electrical system of a house, the safest thing to do is often to have the utility pull the meter (or lock it out in some fashion). That will make your main electrical panel "dead" so that it can be replaced safely. Once you have a new main panel with a shutoff of some sort (either a main breaker or a separate shutoff switch) then any additional work can be done with the meter connected and power "live" to the house.
Comment: @Hans The next step depends on the population density and other factors (as how much high the poles can be in the area). Here in Europe, it is called "intermediate voltage grid" and can be anywhere from 1kV (legacy setups in a small vilages) up to 35kV for a brand new, power-hungry building complex. It is probably the same in US. Usually, you don't have to deal with the intermediate voltage, unless you are a big industrial power consumer that has its own power transformers and get the power directly at the higher voltage (it is cheaper).
Comment: It could 240V for anywhere from your closest pole to several houses down the street. Then it will jump up to something higher - potentially multiple steps, possibly as high as 13,000V. A lot depends on the particular utility and how far you are from a power substation.
Comment: @Paul_Pedant  To be a pedant, the house supply is tapped off of **one** of the three phases (using **two** of the three *wires*).  The grid is all delta, so the phases are the three line-line combinations (ie: A-B, B-C, C-A)
Comment: In addition, you will notice (in the photos) that things come in threes. Most power companies run 3-phase supplies (plus an earth safety) down your street with 415 (or 208) volt AC. Your house supply is tapped off any two of the three phases, which reduces the phase voltage by a factor of sqrt(3).
Comment: Just curious, so is the voltage of the power line on the street much higher than 240V? How high is it?
Comment: @Paul_Pedant, 3-phase power doesn't always have an earth connection, and even when it does it's not for personal safety.
Comment: @J..., The grid isn't always delta. Sometimes it's WYE, but the higher voltage or longer distance transmission the more likely to be delta.
Comment: @Ben Ok fair, but where the grid is WYE it won't supply a neutral so it's effectively still a three wire system - you never get a line-neutral phase on the grid side of a consumer transformer, I don't believe.
Comment: @J..., I think you can get both as noted [here](https://www.powerandtest.com.cn/service-and-support/app-notes-faqs/~/-/media/ametekprogrammablepower/files/pdfs/ac-power-distribution.pdf). (Pages 4 and 5). Note that 480 is a commercial/industrial voltage, not residential.
Comment: @Ben Yes, but that's consumer side.  Of course you get a neutral where it's going to be used, but it's the same story as the 120/240 split for residential, the grid is delta (or wye without neutral) behind the consumer transformer, it only becomes WYE (with neutral) at the consumer side of the distribution transformer, not on the grid side.  There's never a need to have the extra wire for just distribution.
Comment: +1. Informative answer. Thank you.
Answer:
What is the potential/voltage of the power line on a city street?

Usually distribution 2300, 4160, 12.47k, or 13.8k, but can be higher. Transmission would be higher and can be run around city streets, but would generally go to a substation.

Where does the potential/voltage of the line drop to the indoor value, e.g., 110 V in the US?

As shown by Michael, there are transformers that convert the higher voltage to lower voltage to your house. The voltage to a residence is 240V, but between two lines. The 120 (110) that you refer to is between one line and neutral.

If I need to upgrade the whole electric circuitry of a house, do I need to worry about the high voltage and if so, where does the high voltage starts to drop down to the indoor value coming into the house?

The lower 240V lines will start at the transformer. This is either on the pole, or on a padmount transformer. In a residence, the voltage would only be 240V.
If you are modifying or updating in your residence, you'll either use 120V (single pole), or 240V (double pole). You would choose based on the need of the line. Generally, you'll always use a single unless it's a high load device such as an electric oven or air conditioner. Devices are built for a voltage and you'll just need to supply what they need. When in doubt, you can ask at a hardware store, or get  help from an electrician.
Comment: +1. Informative answer. Thank you.


The cuspidal cubic $\{(t^2,t^3)| t\in\mathbb{R}\}$ is not a regular submanifold of $\mathbb{R}^2$.

Question: I want to figure out why $\{(t^2,t^3)| t\in\mathbb{R}\}$ is not a regular submanifold of $\mathbb{R}^2$. There are some posts discussing this (like this post). But I do not quite understand them. So I want to directly apply the definition. Here is my proof. Is it correct?
We claim that for $p=(0,0)$ in the above set, there is no diffeomorphism $\varphi: U=(x^2+y^2<\epsilon^2)\to V$, $(x,y)\mapsto (u(x,y),v(x,y))$ s.t. for $x^2+y^2<\epsilon^2$, $u(x,y)=0\iff x=t^2$, $y=t^3$ for some $t$. $\varphi$ is a diffeomorphism $\implies$ $u$ is $C^{\infty}$, and $u_x$, $u_y$ can not be both zero at $p=(0,0)$. In any neighbourhood of $(0,0)$, $x=t^2$, $y=t^3$ does not give a function $y(x)\implies\ u_y=0$ (otherwise this contradicts the inverse function theorem). Hence $u_x\ne 0$, and in some neighbourhood of $p=(0,0)$, $x=t^2$, $y=t^3$ gives a $C^{\infty}$ function $x(y)$ since $u$ is $C^{\infty}$. But $x(y)=y^{\frac{2}{3}}$ is not $C^{\infty}$. This is absurd. Hence such $\varphi$ does not exist, and $\{(t^2,t^3)| t\in\mathbb{R}\}$ is not a regular submanifold of $\mathbb{R}^2$.
Answer: This is a proof inspired by others. In the following Tu means An Introduction to Manifolds by Loring Tu, the second edition.
Assume the contrary: $S=\{(t^2,t^3)| t\in\mathbb{R}\}$ is a regular submanifold. Since the map $t\mapsto (t^2,t^3)$ viewed as a $\mathbb{R}\to\mathbb{R}^2$-map is $C^{\infty}$ and we assume $S$ is a regular submanifold, we yield $t\mapsto (t^2,t^3)$ as a $\mathbb{R}\to S$-map is $C^{\infty}$ (cf. Tu's Theorem 11.15). Hence the map $c:\mathbb{R}\to S$, $t\mapsto (t^2,t^3)$ is a curve on $S$. Let $i: S\to\mathbb{R}^2$ be the inclusion map. By Tu's Proposition 8.18,
$$i_{*,(0,0)}(c'(t))=\frac{\mathrm{d}\ i(c(t))}{\mathrm{d}t}=\frac{\mathrm{d}\ c(t)}{\mathrm{d}t}=(0,0).$$
This implies $i_{*,(0,0)}$ is not injective. Thererfore $i$ is not an immersion at $(0,0)$,  contradicting the fact that the inclusion map of a submanifold is an embedding. (cf. Tu's Theorem 11.14).


Error Booting Ubuntu / Windows 7 on Laptop

Question: I tried a lot of guides and walkthrough I found on the net, but my problem still persist:
I installed the UBUNTU 14.04 LTS release, and installed side by side my Windows Installation.
When I finish the installation, I reboot the computer and grub goes in rescue mode telling me "error: unknown filesystem".
I already restarted the computer e tried to repair by boot-repair, but I still have the same issue.
BootRepair log
However I think the GRUB doesn't go on stage 2 because it try to read the partition and give the error message.

EDIT: Still no answers???
Comment: Boot-Repair's log of grub's reinstall says no error and it reinstalled in i386-pc platform which is the BIOS version. Did you use ext3 instead of ext4 for a reason. It should still work but ext4 is much better. Is BIOS set for AHCI? Or is system so old that it does not have AHCI and then you may have issues with any boot files beyond the IDE limit of 137GB, but that is for some very old BIOS.
Comment: I used ext3 just to make a try, with ext4 I've the exact same result. I tried also to execute the command "ls" on all partitions, but I get always the error "Unknown Filesystem"
Comment: I'll double check the AHCI thing, but I think it's not that old. However i'll give it a chance
Answer: Did you install Ubuntu in UEFI MODE?
If you didnt install ubuntu in UEFI mode, it wont update grub and detect your Windows partition folder, since your ubuntu is in Legacy.
Try changing boot order through BIOS - > UEFI/Legacy and set windows to first
Try enable/disable secure boot
Comment: No, the Laptop where I Installed it, has no UEFI support.
Comment: Did installation completed successfully?
Can you boot into windows?
Comment: try regenrate grub file or update grub2
Comment: I already did twice without success. The message I have is always "unknown filesystem"


Renaming the recent directory with spaces in its name

Question: I am trying to rename the recent directory with spaces in its name.
$ mkdir "foo bar"
foo bar
$ ls -c | head -1
$ mv $(ls -c | head -1) foobar

Getting the following error:
mv: target 'foobar' is not a directory

Comment: Put double quotes around an expression, that contains a variable, because it may contain special characters. And this time it contains a space character: `mv "$(ls -c | head -1)" foobar`
Comment: You really shouldn't use `ls` for things like this - see [Bash pitfall #1](https://mywiki.wooledge.org/BashPitfalls#for_f_in_.24.28ls_.2A.mp3.29)
Answer: Your immediate problem is that the command substitution is unquoted, leaving the mv command with:
mv foo bar foobar

... where mv is expecting "foobar" to be a destination directory for the (presumably non-existent) files "foo" and "bar". You don't want to solve this problem by putting quotes around the command substitution because parsing the output of ls is a headache you don't want to deal with. Consider:
mkdir $'newline\nhere'

... which ls -c | head -1 reports as simply "newline" instead of the proper name.
Of course, to solve the immediate problem, simply quote the directory the same way you did when you created it:
mv "foo bar" foobar

If there's only one mistakenly-named directory and you want to rename it to something specific, you could find a matching wildcard and then manually rename it. Test with ls -d *wildcard* until you get just the one errant directory and then run:
mv *that-wildcard* the-new-name

If the mistaken directory name is too difficult to pin down with a wildcard, you could use a shell loop to rename every directory that has spaces in it:
for dir in *\ */
do
  [ -e "${dir// /}" ] && continue
  mv -- "${dir}" "${dir// /}"
done

This generates a wildcard-expanded list of subdirectories that have a space in them; the directory restriction is achieved with the trailing / in the wildcard. Each of those directories is then tested to see if the new name already exists; if so, we skip it to avoid clobbering files or moving directories underneath others. If we're all clear, then mv will rename the directory using parameter expansion to replace every space with nothing.
Another alternative would be to use the zsh shell's feature where it can sort ("order") filename expansions by modification time. You could rename the most recently modified directory that has spaces in it using:
zsh -c 'mv -- *\ *(/om[1]) newdir'

This uses the same "has a space in it" wildcard from before, but adds "Glob Qualifiers" in parenthesis. Those are:

/ -- restrict matches to directories
om -- order the matches by modification time (newest first)

We then select the first entry in that list with [1] as the source directory to rename to "newdir".