WPF: Handling bubbling events only from one specific content

Question: Now I'm about to learn RoutedEvents. I understand bubbling and tunneling and all. But I have a little problem I'm not sure how to handle.
I've got a ItemsControl in my own defined UserControl ( inherits TabItem ). This itemsControl could be a ListBox or some selector not decided yet ( depends what is best with this solution ).
Now when one item there is selected ( Not sure yet what the best selection method would be, perhaps doubleclick ) I need to capture the event in the TabControl that holds my UserControl. Thankfully as my userControl is put into the XAML visualtree the bubbling event flows up and events can reach the TabControl. However I still have a few problems with implementing this.
1) Let's say I set it as MouseDoubleClick I don't wan't other DoubleClicks ( like in other tabs or outside the ItemsControlItems ). I guess you can always do a check where the events coming from to ensure it's the right one but I don't feel it's the right way and it could be asking for trouble.
2) If I set the event to SelectionChanged and the ItemsControl to ListBox I would have to ensure the ListBox itself doesn't handle it so it can reach the tabControl. How would I do that?
3) Same as 2) but the TabControl is a selector itself so it would raise it's own selectionchange events wouldn't it. how would that work. Would the handler grab both from the listbox and the TabControl?
4) Not sure what ItemsControl I should use. If i'm only using it to doubleclick the item and then handle the event wouldn't ListBox be too much. It has many effects that would be undisireable like selection and such. Is it better to define your own ItemsControl or maybe use ListBox and overwrite some of it's properties like selection ( how would one do that? )?
5) The source of the event would be the ItemsContainer but I wan't the item itself. There is a easy way to get access to it isn't there?
6) Let's say I put a button and in the DataTemplate I wan't to attach the ID of the object through the button and capture it where the button click is handled to identify what item it was. Is there a property do do that or would I have to define it myself?
7) Would the best course of action here maybe to create my own event?
Your take on this issue and comments on what process is best to take here is appriciated.
EDIT: Decided to add little bit more info as asked.
What I'm aiming for; when I start the program I have a TabControl with 1 tab in it. This tab is different from the rest of the tabs will be because it holds a list of objects (CompanyModel). This list is the ItemsControl I mention. When you press one company from this list a new tab is added with info about that company.
My solution was to create a TabItem collection as a source for the TabControl. Then I would define my 2 types of TabItems in a seperate XAML source file (not sure what to call it, basicly add new usercontrol). One is the initial where thhe list appears, the other one takes in a CompanyModel as a constructor parameter and shows info about that.
This works while I don't like the idea of defining the company list tabitem seperatly I can't define it under the tabcontrol because I can only have defined items or sourced, not both.
I've tried this idea by putting a button on the List DataTemplate that bubbles the Id of the company selected up to the TabControl, handling it there and adding a new TabItem with the CompanyModel. That was just a solution to try it and has problems like if I add anpther button to the CompanyTabs I would grab them aswell in the TabControl.
So my problem could be solved by finding a good way to bubble a event from the original listTab or If I would be able to define the tab in the same place as the TabControl.
I know that one other solution would to have the list seperate from the TabControl but others would like to see how this comes out and I would like to learn how I would do this.
Comment: 2) Why do you want to handle it in the TabControl? 5) `The source of the event would be the ItemsContainer but I wan't the item itself` what does that mean?  ...  Need some more detail on what you're trying to achieve.
Comment: I'm throwing TabItems into a collections dynamically on runtime and that collection is the itemssource for the TabControl. So I have defined my own TabItem that takes a object I'm showing as a constructor parameter. So when I press the item on the list it needs to create the new TabItem with that item as constructor parameter and add it to the TabItem list. I have no access to this list from the tabs themselves so I have to bubble it upwards towards the TabControl.

Well the other thing ain't so crucial, propably something I can find out myself. I wan't access the CompanyModel not ListBoxItem
Answer: please have a look in this blog, may be it will helps u.
http://blogs.u2u.be/diederik/post/2009/09/09/In-WPF-SelectionChanged-does-not-mean-that-the-selection-changed.aspx


See latest added data in MySQL DB, Debian

Question: Is there any way I - via any commmand - can see which data have last been added to a MySQL DB and when that data was added?
Dist: Debian 7.0 (wheezy)
Answer: Not directly. However there are two ways you could get this information:
A. Use of logs
MySQL provides the ability to store changes in a "log". This is primarily used for replication and backup.
Prior to 5.0 this was an ASCII format containing all SQL statements that actually made changes to the data - http://dev.mysql.com/doc/refman/4.1/en/update-log.html
However, 5.0 and later move to a binary log format which would require some type of analysis (though this is no doubt possible either through a standalone utility or using a second replica of MySQL to just see changes processing is outside the scope of my knowledge and this answer) - http://dev.mysql.com/doc/refman/5.0/en/binary-log.html
B. A messier approach would be to check for file update times (these binary files are where the databases are stored on disk). Theoretically you could see which DBs have been updated (files updated with timestamp - though this is liable to be imperfect owing to indexing and other non-update changes), and then look at the individual databases.
Using this approach would only indicate which databases might have been updated and certainly not indicate to what extent or which tables.
An alternative may be a custom script that gets a list of all your tables and stores perhaps the highest primary key (for auto increment keys), or the number of rows, then periodically checks again (all of this can be easily automated as MySQL provides commands to describe table structure etc).


Max/Min Problem

Question: For $x$, $y$, and $z$ positive real numbers, find $\frac{z}{x}$ such that $(x,y,z)$ achieves the maximum value of $$\sqrt{\frac{3x+4y}{6x+5y+4z}} + \sqrt{\frac{y+2z}{6x+5y+4z}} + \sqrt{\frac{2z+3x}{6x+5y+4z}}.$$ I found that the maximum value was $\sqrt3$ from Cauchy's Inequality, but I don't know how to actually achieve the maximum. I know that the terms must be proportional, but I don't know how to go from there. Any help on how to proceed would be greatly appreciated, thanks!
Comment: Why don't you post your working, then it would be easier to pinpoint how to get it.
Answer: Here's how I would go about it: As the expression is homogeneous, we can set $6x+5y+4z=1$ WLOG.  Then CS inequality gives:
$$(\overline{3x+4y}+\overline{y+2z}+\overline{2z+3x})(1+1+1)\ge \left(\sqrt{3x+4y}+\sqrt{y+2z}+\sqrt{2z+3x} \right)^2$$
So we get $\sqrt{3x+4y}+\sqrt{y+2z}+\sqrt{2z+3x} \le \sqrt3$ and equality is possible iff
$\dfrac{3x+4y}1=\dfrac{y+2z}1=\dfrac{2z+3x}1 \implies x:y:z = 1:3:6$
Comment: Shouldn't it be $\sqrt{1+1+1}$ instead of $1+1+1$?
Comment: @YuiToCheng It is correct as written.
Answer: It's $(a+b+c)^2\leq3(a^2+b^2+c^2)$
The equality occurs for $3x+4y=y+2z=2z+3x$.

Max/Min Problem


Can I use single walled stove pipe for my wood stove?

Question: I have a wood stove that I'm going to use in my work room that is on the first floor of my house.  I was planning on running it out the side of my house and then the chimney go up next to my house.  I have a wall thimble to go through the wall, but my question is, can I use single walled pipe for the chimney?  It wouldn't be touching the house.
Answer: As a wood stove owner I can tell you this is a bad idea.  You need to look carefully at the wood stove manufacturer's requirements, but most wood stoves need a large draft to operate correctly and loss of heat through a single wall pipe causes too much loss of draft as well as creosote problems eventually leading to a chimney fire, if you can manage to keep your stove lit.
Answer: Whatever type of pipe you use, make sure you maintain proper clearance. It's more than just a question of "touching", and single-walled pipe may have clearance requirements of 18 inches. Double-walled pipes are less, maybe 6 or 8 inches.
Having said that, single-walled pipe is probably not a good choice for the outside chimney. The concern is not so much heat causing the house to catch on fire (because you must maintain the aforementioned clearances), but that cold outside air will cause the exhaust gasses to cool, which will make it hard for the stove to vent properly. You want the hot exhaust gases to pass up through the chimney quickly, but if they are cooled once they exit the building you can get the colder gases trying to sink back into the stove. Poor draft leads to smokey, hard-to-start fires, creosote buildup, and possibly flue gases backing up into the room. Just did some quick research and it turns out that both single- and double-walled stovepipe are only permitted indoors. When you transition to the outside through an insulated thimble you must use "Class A Chimney", which is an insulated product.
Finally, if your stove or local building codes require double-walled or something else specific, that's your answer right there. A neglegantly-installed wood stove is a huge fire hazard, and I doubt your homeowner's insurance would cover a fire caused by an illegal stove installation.


Unable to create tags?

Question: I am trying to post a question but it says I don't have a high enough reputation to create tags, so I try posting without tags but they are required.  What gives?
Answer: It appears you have found the answer yourself, but I will answer in case anyone else comes looking.
You must use already existing tags.  This was likely problematic since when you asked this question the site was brand new, so almost any tag would be a new tag.
Comment: Yeah, I was trying to ask before any questions had been made.  There weren't any tags =\

Unable to create tags?


How could I get an account with high privileges?

Question: I have FTP account on server and an account as Magento user.
Is it possible with these codes to gain a Magento account with administrator privileges?
Answer: Short answer: NO.
Long answer:
FTP credentials have nothing to do with the application.
And in Magento, the frontend users (customers) are separate from the backend users.
So having a customer account does not give you access in any way to the backend and the other way around.
Off topic: Did you find some FTP credentials and you want to take over someone else's website? :).
Comment: Reply to off-topic answer: the service provider is making an arm wrestling with the merchant and it doesn't leave the administrator access at the moment
Answer: Short answer: YES.
Long answer: If you have FTP access, you can gain access to whatever you want. You can manipulate the authentication mechanism, you can hardwire a specific set of credentials to be accepted and grant full admin rights. You can build pages which will output what ever data you want from the database.
Answer: Yes you can.
from app/etc/local.xml get the database credentials and write a small php script to execute the MySQL command listed here https://www.atwix.com/magento/reset-admin-password-mysql/
then run your php script, et voila!


Change Field Type from File to Image

Question: I created a field with the field type "file" I now have to convert this to "image" field type. The field has already content so I cannot not delete and recreate a new one. How can I do this programatically using the hook_update in my module?
Answer: Hook update performs an update on a node, it wont be too useful in your case. When you create a field it creates a table in the DB with appropriate datatypes. You cannot just change the datatype of a field without going down the line and changing all the details, including the data in most cases. which trust me is a huge pain in the ass.
I've had to do this before but what i ended up doing was creating new field with the datatype I wanted, then used View Bulk operations Execute arbitrary PHP script and ran custom php to get the FID from all the File and then add it to the new field. I think there was a user reference for each file as well, so the fidelity is there to transfer your data between fields. Then delete the old field
Worst case scenario, find ways of limiting what types of files(image only) your file upload field can upload.
Comment: I thought this would be more easy, I may reconsider the changing of the file type :)
Answer: I did the "inverse" to change from iamge to file to use the multiupload widget on images gallery without loose any pictures.
UPDATE `my_databse`.`field_config` SET `type`='file' WHERE `id`='7';

id=7 is corresponding to he field I wanted to change.

Hope it could help.

Change Field Type from File to Image


AUC for test data less than training data

Question: I split the training data into a train (75%) and test data (25%). I got an AUC for test data less than training data. does this mean overfitting ?
Comment: It's no surprise that the model predicts the data it was fit to more effectively than a new data set.
Answer: It's hard to detect overfitting with just one data point. Overfitting happens when the performance on the training set is improved but the performance on the test data gets worse. What you got is consistent with overfitting but it could also be due to some other random difference between the training and test data.
Comment: Not necessarily. You don't have enough information to know if you are overfitting or not.
Comment: So its would be not a problem if I got an AUC for test data greater than AUC for training data ?
Answer: The training set should in general fit the data better than the testing set. This is because this set is what your model was built on, so it has already "seen" that data, and fit itself to it. The testing set, by contrast, has not yet been "seen," and because of this should nearly always have a worse fit. In fact, this is the point of having a testing set--to test your model against unexpected data it may encounter when it is applied.
To verify that your model is good, consider running it multiple times with the data partitioning re-generated each run. This is one way to "cross-validate" your model's fit and robustness. If the results are stable, you likely didn't overfit. If they change significantly, your model does indeed do this.
As to partition size, it does not directly indicate overfitting. Partitions of 50-50, 60-40, and 80-20 are all common. However, your hunch is right in that you do make a trade-off. A larger proportion of data going into a set will always yield a more accurate model in relation to that set. By having a larger proportion of data in the training set, you allow your model to examine more cases and be more "prepared" for what it may encounter. However, yes, this can potentially create overfit as the models begins to mimic the training set too closely.


Are there any official technical specs for the Eastern Alliance destroyer?

Question: In the original Battlestar Galactica series, they come across the destroyer for the Eastern Alliance. Are there any official technical specs for the destroyer at all? I know they mention star speed, however no explanation I have seen mentions how fast that is. Maybe light speed? I read that they had a crew of six or seven, meaning they are on watch all the time, which makes no sense at all to me.
Answer: I never had the impression that it could go that fast as in light speed. The term "star speed" may be used as to indicate a sub light speed which is what I gathed where their level of technology is at possibly. I also presume that the Eastern Alliance technology is on par with the West. Apollo mentioned that the Galactica was capable of getting to Terra at light speed and he recieved a surprised response by Western officials stating that he had space vessels that were capable of attaining light speed.
Comment: This seems pretty speculative. A good answer should be based on something more concrete than impressions or presumptions. The question specifically asked if there were any official tech specs for the Destroyer.


Castle Active Record - Validation and Relationships

Question: I have two models: foo and bar. Foo has a bar object. Foo and bar have validation rules. If I call Foo.isValid() it doesn't validate bar too. I need to validate bar with isValid. How does Castle Active Record Validation work for relationship? Do you have any example or documentation? The official site has a poor documentation and nothing about validations and relationships.
Thank you.
Answer: IIRC ActiveRecord validates nested components (i.e. value types), but not relationships.
If it did, it would have to check for proxied objects. If it initialized proxied objects it would be pretty catastrophic, potentially fetching the entire database. If it didn't, then it would break proxy transparency, and validation would be somewhat unpredictable or at least very tricky. Either way, it's very probably not what you want. But if you really know what you're doing, you can override the default validator.


Using calculus of residues, prove that $\int z^2log[(z+1)/(z-1)]dz$

Question: Using calculus of residues, how can it be proven that
$$
\int z^2\log\left[\frac{z+1}{z-1}\right]\;dz
$$ taken round the circle $\left\vert z\right\vert=2$ has the value $\frac{4\pi i}{3}$?
Comment: How about the branch of $\log$?
Comment: @user64494 the given integrand shall have singularities at $z=1,-1$. but they are not poles. how do i use residue theorem ?
Comment: @ Aman Mittal : My question is about the definition of the integrand and its branch cuts.
Answer: Note: I'm assuming that $\log \frac{z+1}{z-1}$ is defined on $\mathbb{C}\setminus [-1,1]$, or at least that a branch-cut that lies entirely inside the disk $\{ z : \lvert z\rvert < 2\}$ is used. For arbitrary branch-cuts intersecting the contour, the integral depends on the exact choice of the branch-cut.
One way is to substitute
$$w = \frac{z+1}{z-1}.$$
The circle $\lvert z\rvert = 2$ becomes $\left\lvert w - \frac{5}{3}\right\rvert = \frac{4}{3}$, and since
$$z = \frac{w+1}{w-1},$$
we have $dz = -\frac{2dw}{(w-1)^2}$, but the circle $\left\lvert w - \frac{5}{3}\right\rvert = \frac{4}{3}$ is traversed clockwise, so overall we get the integral
$$2\int_{\lvert w-5/3\rvert = 4/3} \frac{(w+1)^2\log w}{(w-1)^4}\,dw,$$
which has a pole of order $3$ (the numerator has a simple zero in $1$ from the $\log$ factor) in $1$ as the only singularity enclosed by the contour. That integral can be evaluated by the residue theorem in the usual manner.
Taking the principal branch of the logarithm, we can expand the numerator
$$\bigl((w-1)^2 + 4(w-1) + 4\bigr)\left((w-1) - \frac{(w-1)^2}{2} + \frac{(w-1)^3}{3} + O\left((w-1)^4\right)\right)\\
 = \dotsc + (1 - 4\frac{1}{2} + 4\frac{1}{3})(w-1)^3+ \dotsc,$$
so the residue is $\frac{1}{3}$. Choosing a different branch of the logarithm doesn't affect the residue, since only the coefficients of $(w-1)^k$ for $k\in \{-4,-3,-2\}$ change.

Another way to evaluate the integral is to rewrite and expand the logarithm
$$\log \frac{z+1}{z-1} = \log \frac{1+z^{-1}}{1-z^{-1}} = 2m\pi i + 2 \sum_{k=0}^\infty \frac{1}{(2k+1)z^{2k+1}}.$$
Since the Laurent series converges uniformly on the contour, we can interchange summation and integration, and obtain
$$\int_{\lvert z\rvert = 2} z^2\log \frac{z+1}{z-1}\,dz = 2m\pi i \int_{\lvert z\rvert = 2} z^2\,dz + 2\sum_{k=0}^\infty \frac{1}{2k+1}\int_{\lvert z\rvert = 2} z^{1-2k}\,dz = \frac{2}{3}\int_{\lvert z\rvert = 2} \frac{dz}{z}.$$
Comment: @ Daniel Fisher: Can you explain your choice of the branch of $\log w$ in detail, especially the branch cut??
Comment: Since in the transformed integral, everything lives in the right half-plane, any branch of the logarithm defined there will do (as mentioned, the integral is the same for all choices). I mentioned the principal branch, so I'd say the branch-cut is $(-\infty,0]$ if necessary, which is good, because the image of $[-1,1]$ under $z\mapsto \frac{z+1}{z-1}$ is $\{\infty\} \cup (-\infty,0]$, and $[-1,1]$ is the natural choice of the branch cut for the original integrand. Any branch cut from $-1$ to $1$ that doesn't intersect the contour will work the same, however. Yes, it is not explicitly stated
Comment: that the branch cut shall not intersect the contour of integration, but from time to time I make reasonable assumptions beyond the explicitly stated facts.


What is the Best way to run an airdrop on EOS?

Question: How can I issue my tokens and distribute them to the Genesis accounts? Any help will be greatly appreciated
Answer: There are a load of considerations first off and it may be good to take legal advice. However, once you have decided to do your airdrop then technically it is not very tricky.
First buy some RAM and stake a couple of thousand EOS on CPU and a little on net.
You'll need a token contract which you can deploy (you can reuse the eosio.token code). Then deploy it and issue the tokens to a main account for airdropping purposes.
The genesis snapshot is available in a load of places - all you need to do is run transfers to all the accounts. Bash script cleos commands or eosjs best for this.
For eosDAC we had a very specific other distribution so we dropped our tokens in a frozen (no transfers allowed) state for validation. This is handy if you want to make sure you don't missed anyone out. eosDAC has a powerful drop/verification script here - https://github.com/eosdac/DACtools/tree/master/drop%20tool which can be configured for quite rapid airdrops.
Answer: See the following links.
Tools and examples for air drop are provided.
https://github.com/EOSEssentials/EOSDrops
https://github.com/grogn/airdropExamples/tree/master/EOS/contracts


how to save data filled in pdf using ABCpdf or EOPdf in asp.net?

Question: I have a Pdf with input fields and i want to save the data filled in these field and the output should be a pdf i have searched on net but still notable to find helpful code... or any other example. Please help me as soon as possible. thanks in advance
Answer: abcPDF is useful for this, you can get the data from the PDF using one of the examples in their help file. You can use the same tool to read out the form fields and then write them back into another copy of the document.
Alternatively you can probably use the Stamp() method they provide to lock the fields into the document and save it.
You can try abcPDF for free for 30 days.


Can you activate the whole pixel on LCD?

Question: I'm working on a project where I'm trying to display the level of a filled tank through ultrasonic, then displaying it on a 16x2 LCD. I'm trying to do it through the whole LCD Pixels, such that when the tank level is full, the first 5 pixels are activated (as what happens when you connect the LCD initially without having any code for it, the whole pixels are turned on, giving 16x2 white rectangles, as shown in the picture below). Is there a way to activate an entire pixel on the LCD?
Comment: You can define **your own** characters. Make a character that has all the pixels you want set.
Comment: that picture shows all of the pixels in the first line activated ... there are no in-between pixels
Comment: You can define your own characters to display. Is that what you want?
Comment: @Majenko Nope. My issue is not to display characters. However, I want to display the white rectangles, as shown in the picture. Is there a code to activate the entire rectangle pixel?
Comment: @Majenko Oh I see. I assumed there was an easier way, since it just activates the entire rectangular pixel. Thanks for your help!
Comment: Check the datasheet for your display. It should give you the predefined characters. One might be a solid block.
Answer: The LCD is made up from 32 characters each is 5x7 pixels in size, with a 1 pixel gap between each character.
You can never put anything in the gap between the characters, as there is just nothing there.
But what you can do is define your own characters to fit within the 5x7 pixel rectangles.
Some variants of the HD44780 have character 255 as a solid block, but not all (it depends on what language the ROM is).  If you have one that has that character you can just print it with lcd.print("\xff") or lcd.write(255).  If it doesn't it will print ÿ instead. In that case you will have to define your own character.
One benefit of defining your own characters is that you could then do partial blocks to give you a higher resolution.  Here's an example:

You can find that example and the code that goes with it here.
Answer: The LCDs like the one you picture display characters. That is all they do. You can't address the pixels in the display.
And as a point of clarification, you are talking about the 5 pixel by 7 pixel character blocks on the display as if a character is a pixel. It's not. A character block consists of 5 x 7 pixels.
Some versions may have a pre-defined solid block character, as Majenko said in their answer. You could print as many of those solid blocks as you want.
You could also define a single custom character that displays a solid block and print as many of those as you want.
As a third option (again from Majenko's excellent answer) you could define 5 different custom characters, each with a different number of columns of pixels filled in. You could then write code that displayed solid blocks for all but the last character, and then one of the 5 partly filled custom characters, and get a finer resolution of simulated bar graph.
All that said, remember, the LCD display can only display 5x7 blocks with blank space between. The LCD is built without any pixels between the characters, so there will always be blank spaces.
There are other pixel displays you could use. (I've seen OLED displays where you can control every character individually.)


Characters not displaying correctly in different browsers

Question: I used certain characters in website such as • — " " ' ' º ©.
I found that when testing to see what my website looked like under different browsers (BrowserLab)
the afore-mentioned characters are replaced with �.
I then changed the charset in the webpage header from:
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

to
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

Suddenly all the pages have the above mentioned characters replaced with a ?.
Even more puzzling is this is not always consistent across and even within the same page, as some sections display the character • and © correctly.
In particular, I need to replace the character • with one that will display across browsers, can anyone help me with the answer? Thanks.
Comment: Welcome to the wonderful world of Unicode encodings!
Answer: You should save your HTML source as UTF8.
Alternatively, you can use HTML entities instead.
Comment: I am going through the pages and replacing with the HTML entities as suggested. It seems to renders correctly under different browsers. I will need to remember to do replacement of HTML entities in my other subweb sections before I change the charset to utf-8. Not sure if I need to replace © with © in my
Answer: The source code needs to be saved in the same encoding as you're instructing the browser to parse it in. If you're saving your files in UTF-8, instruct the browser to parse it as UTF-8 by setting an appropriate HTTP header or HTML meta tag (headers preferable, your web server may be setting one without you knowing). Use a decent editor that clearly tells you what encoding you're saving the file as. If it doesn't display correctly, there's a discrepancy between what you're telling your browser the file is encoded in and what it's really encoded in.
Answer: Check to see if Apache is setup to send the charset.  Look for the directive "AddDefaultCharset" and set it to Off in .htaccess or your config file.
Most/all browsers will take what is sent in the HTTP headers over what is in the document.
Answer: If you're using Notepad++, I suggest You to use Edit Plus editor to copy the text (which has the special characters) and paste it in your file. This should work.
Answer: Yes I had this problem too in notepad++ copy and pasting wasn't working with some symbols
I think SLaks is right
HTML entities for copyright symbol   &#169


Puppet Server hostname 'puppetmaster' did not match server certificate

Question: I'm trying to install puppet7 master and a client on 2 VirtualBox VM's following this guide https://tecadmin.net/how-to-install-puppet-on-ubuntu-20-04/. When I start puppet on the client I get this error. Note the trailing period.
Server hostname 'puppetmaster' did not match server certificate; expected one of puppetmaster.

Listing certnames on the master
sudo /opt/puppetlabs/bin/puppetserver ca list --all
Signed Certificates:
    puppetmaster.

How can I fix the mismatch?
edit: Attempting to run the commands suggested below I get
mark@puppetmaster:~$ puppetserver ca clean --certname puppetmaster.
Traceback (most recent call last):
    9: from /opt/puppetlabs/server/apps/puppetserver/cli/apps/ca:5:in `'
    8: from /opt/puppetlabs/puppet/lib/ruby/vendor_gems/gems/puppetserver-ca-2.3.6/lib/puppetserver/ca/cli.rb:100:in `run'
    7: from /opt/puppetlabs/puppet/lib/ruby/vendor_gems/gems/puppetserver-ca-2.3.6/lib/puppetserver/ca/action/clean.rb:91:in `run'
    6: from /opt/puppetlabs/puppet/lib/ruby/vendor_gems/gems/puppetserver-ca-2.3.6/lib/puppetserver/ca/action/clean.rb:103:in `clean_certs'
    5: from /opt/puppetlabs/puppet/lib/ruby/vendor_gems/gems/puppetserver-ca-2.3.6/lib/puppetserver/ca/action/clean.rb:103:in `new'
    4: from /opt/puppetlabs/puppet/lib/ruby/vendor_gems/gems/puppetserver-ca-2.3.6/lib/puppetserver/ca/certificate_authority.rb:26:in `initialize'
    3: from /opt/puppetlabs/puppet/lib/ruby/vendor_gems/gems/puppetserver-ca-2.3.6/lib/puppetserver/ca/certificate_authority.rb:26:in `new'
    2: from /opt/puppetlabs/puppet/lib/ruby/vendor_gems/gems/puppetserver-ca-2.3.6/lib/puppetserver/ca/utils/http_client.rb:25:in `initialize'
    1: from /opt/puppetlabs/puppet/lib/ruby/vendor_gems/gems/puppetserver-ca-2.3.6/lib/puppetserver/ca/utils/http_client.rb:156:in `make_store'
/opt/puppetlabs/puppet/lib/ruby/vendor_gems/gems/puppetserver-ca-2.3.6/lib/puppetserver/ca/utils/http_client.rb:156:in `add_file': system lib (OpenSSL::X509::StoreError)
mark@puppetmaster:~$ sudo puppetserver ca clean --certname puppetmaster.
[sudo] password for mark:
sudo: puppetserver: command not found

I successfully ran the commands in the answer but the incorrect certificate was not removed.
mark@puppetmaster:~$ sudo -i
[sudo] password for mark:
root@puppetmaster:~# puppetserver ca clean --certname puppetmaster.
Certificate for puppetmaster. has been revoked
Cleaned files related to puppetmaster.
root@puppetmaster:~# puppet ssl clean
Notice: Removed private key /etc/puppetlabs/puppet/ssl/private_keys/puppetmaster..pem
Notice: Removed public key /etc/puppetlabs/puppet/ssl/public_keys/puppetmaster..pem
Notice: Removed certificate /etc/puppetlabs/puppet/ssl/certs/puppetmaster..pem
root@puppetmaster:~# puppet resource service puppetserver ensure=stopped
Notice: /Service[puppetserver]/ensure: ensure changed 'running' to 'stopped'
service { 'puppetserver':
  ensure   => 'stopped',
  provider => 'systemd',
}
root@puppetmaster:~# puppetserver ca generate --certname puppetmaster --ca-client
Successfully saved certificate for puppetmaster to /etc/puppetlabs/puppet/ssl/certs/puppetmaster.pem
Successfully saved certificate for puppetmaster to /etc/puppetlabs/puppetserver/ca/signed/puppetmaster.pem
Successfully saved private key for puppetmaster to /etc/puppetlabs/puppet/ssl/private_keys/puppetmaster.pem
Successfully saved public key for puppetmaster to /etc/puppetlabs/puppet/ssl/public_keys/puppetmaster.pem
root@puppetmaster:~# puppet resource service puppetserver ensure=running
Notice: /Service[puppetserver]/ensure: ensure changed 'stopped' to 'running'
service { 'puppetserver':
  ensure   => 'running',
  provider => 'systemd',
}
root@puppetmaster:~# sudo /opt/puppetlabs/bin/puppetserver ca list --all
Signed Certificates:
    puppetmaster.       (SHA256)  0B:E3:DC:2D:52:27:D9:D9:A1:18:9D:AB:74:07:50:86:E5:7C:32:5C:6F:A1:23:75:3D:4C:C3:90:7D:4D:08:BF   alt names: ["DNS:puppet", "DNS:puppetmaster."]  authorization extensions: [pp_cli_auth: true]
    puppetmaster        (SHA256)  06:EF:8C:3C:6D:83:CA:7A:C9:A4:39:02:DA:7B:F5:E6:D4:3C:27:B3:80:82:EB:4D:C0:92:99:37:F3:D2:96:F2   alt names: ["DNS:puppetmaster"] authorization extensions: [pp_cli_auth: true]
root@puppetmaster:~# sudo /opt/puppetlabs/bin/puppetserver ca sign --all
Error:
    No waiting certificate requests to sign

On the agent, I still get the same error
mark@puppetclient:~$ sudo systemctl status puppet
[sudo] password for mark:
● puppet.service - Puppet agent
     Loaded: loaded (/lib/systemd/system/puppet.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2023-01-16 16:53:07 UTC; 1min 6s ago
       Docs: man:puppet-agent(8)
   Main PID: 654 (puppet)
      Tasks: 1 (limit: 2237)
     Memory: 83.4M
        CPU: 1.485s
     CGroup: /system.slice/puppet.service
             └─654 /opt/puppetlabs/puppet/bin/ruby /opt/puppetlabs/puppet/bin/puppet agent --no-daemonize

Jan 16 16:53:07 puppetclient systemd[1]: Started Puppet agent.
Jan 16 16:53:13 puppetclient puppet-agent[654]: Starting Puppet client version 7.21.0
Jan 16 16:53:13 puppetclient puppet-agent[654]: Server hostname 'puppetmaster' did not match server certificate; expected one of puppetmaster., DNS:puppet, DNS:puppetmaster.

Answer: I'm not sure how you ended up at the point you did, but I agree that the trailing period in the server's certname looks like the source of the issue.  You probably need to regenerate the server's agent cert. (The agent cert is used to authenticate machines to each other, both client and server).  The linked docs provide more detail, but the basic steps are:

Revoke and remove the current server certificate
puppetserver ca clean --certname puppetmaster.

Remove the agent-side copy of the cert and its associated metadata
puppet ssl clean

Stop the puppetserver service.  You may use the appropriate service-management tool directly (systemctl for Ubuntu 20) but Puppet recommends using puppet resource:
puppet resource service puppetserver ensure=stopped

Generate a new, signed certificate for the server:
puppetserver ca generate --certname <new-certname> [--subject-alt-names <comma-delimited-DNS-names>] --ca-client

When you do this, make sure that either the specified --certname or one of the specified --subject-alt-names, if any, exactly matches the name your clients will use to connect to the server.  Note also that if you specify a certname explicitly in the server's puppet.conf then it, too, will need to match the certname specified here.

Although it's not technically part of regenerating the cert, presumably you will afterward want to

Restart the puppetserver service.  For example, via
puppet resource service puppetserver ensure=running

Comment: @markhorrocks, `sudo ` gets you a clean environment for the command.  Instead, use `sudo -i` to obtain a root shell with all the default environment configuration, and run the appropriate Puppet commands there.  Also remember this if ever you want to run `puppet agent` from the command line.
Comment: @markhorrocks Based on your current question information and the answer above, I would hypothesize that step 4 in the answer was unsuccessfully executed since the cert is associated with the incorrect name (but perhaps correct SANs).
Comment: Please see error above. I followed the guide exactly on Ubuntu 22.04.
Comment: The error on the client persists, see edits to my question. A client reboot did not help.
Comment: @markhorrocks, Make sure the server's `puppet.conf` does not specify `puppetmaster.` as that machine's certname, as already described in this answer.  If you apply a change, then restart `puppetserver` afterward.  You may also need to [clean out the client's certificates](https://www.puppet.com/docs/puppet/7/ssl_regenerate_certificates.html#clear_regenerate_certs_for_agents), which may include a copy of the server's old cert.  I had supposed that the old server cert would not be kept because of the previous rejection, but that's not certain.
Comment: Alternatively, @markhorrocks, you might have better luck if you used fully-qualified hostnames as I [recommended previously](https://stackoverflow.com/a/75135843/2402272), both as the machines' own sense of their hostnames and in your Puppet certificates and configuration.


post processing in PCA and making sense of an example

Question: The example is as follows:
A bunch of doctors were asked to score a list of desirable characteristics of sales representatives. The questions were like: "in-depth knowledge about his/her product", "respectful of my time" etc. The goal is to understand if there are groups of doctors that value one type of traits more than the other type of traits and maybe target those doctors differently
Dataset generated:
$\mathbf{D}$ of dimension $\mathbf{d} \mathbf{x} \mathbf{q}$ where $\mathbf{d}$ is the number of doctors and $\mathbf{q}$ is the number of questions.
Approach:
A PCA is run and top 3 principal components are extracted. The pic is a bit blurry but, in the lecture I have referenced it is represented as follows:

Questions:

The lecture mentions: These are not exactly the output of the PCA but once you have identified the top 3 principal components you run a postprocessing step in which you rotate the 3 principal components to ensure they have high values in some group of questions and low values in some other group of questions. This way the principal components are interpretable. How is this rotation of principal components achieved?
How does the above post-processing help make the principal component analysis more interpretable? Is it because the doctors with higher projections on the rotated principal component 1 value medical knowledge more?
Why is this dataset in the image represented like this? It gives the impression that the rows represent something. Is there any way to interpret the rows in the image?
Any idea where this example is taken from? This seems like a good example of learning practical ways to use PCA. If not, could you reference some other similar practical example where PCA is used to understand the high dimensional data?
Answer: I find it useful to decode PCs using stepwise regression.  Examples are here and here.


Who owns the replicant hookers?

Question: I assume they primarily offer their services to humans but of course we see an exception when the arrangement Joi effected occurs. The "doxies" (as I think they are referred in the script) seem to have a lot of freedom of movement, but I do not believe replicants who do not have owners (K's owner, for instance, is either his superior or the police department itself) are allowed to live on their own. So is there any indication that, for example, a human has purchased several and makes his living off of them?
Comment: @releseabe - It's replicant owners all the way down
Comment: I'm guessing the answer is replicant pimps
Comment: "Who replicant dis be?"
Comment: @Valorum: all kidding aside, that is not a very good guess. I believe replicants must be owned and by humans. These hookers do not exist in secret.
Answer: Self-owned, according to the actress that portrays Mariette.

Mariette is a Doxie, a Replicant pleasure model designed to satisfy
sexual urges. Mackenzie Davis plays the seductive yet sweet Replicant
ordered by Freysa to uncover information about K. "Mariette is a part
of an organization of hopeful Replicants," explains the actor. "They
know there's a future for them, that they're not disposable." Denis
Villeneuve selected Mackenzie Davis early in the casting process. "She
was the most obvious choice for the role. She's one of the best
actresses of her generation, plus she looks like she could be Daryl
Hannah's little sister." Although she plays a Doxie, the character
created by Mackenzie Davis is playful and a little mischievous. "Being
on that set was surreal. Once in a while, I'd look around and think,
'Oh damn, this is the coolest thing in the world.'"
The Art and Soul of Blade Runner 2049

Under the circumstances, since Replicants aren't people, I think we can reasonably assume that their organisation has a nominal human owner somewhere along the chain.

Who owns the replicant hookers?


What does 'Baked-in' mean?

Question: I've come across the phrase multiple times the past month or so, usually when talking about functionality. Is this any different than saying 'built-in', or carry with it any specific connotations?
Comment: This question appears to be off-topic because it is about terminology, not programming.
Answer: From dictionary.com:

a. (Computers) to incorporate (a feature) as part of a
  system or piece of software or hardware while it is still in
  development: The location-tracking service is baked in the new app.
  Security features come baked into the operating system.
  b. To include
  as an inseparable or permanent part: Baked into the price of the
  product is the cost of advertising.
Answer: Your assumptions are correct. It pretty much means that you don't have to do anything special to install this functionality. It's built in. Already there.
Other variants are:

Rolled in
Built in
Native
Comment: In my experience 'baked in' has slightly more negative connotation when compared to 'built in'.  If something is built in then you get it for free, but if something is baked in then not only do you get it for free, but it actually might be difficult to take it out or to disable that feature. It has been included `as an inseparable or permanent part`.
Comment: "You get it for free."

What does 'Baked-in' mean?


How long ago could we have gone to Mars?

Question: In the online show Pioneer One, part of the premise is that decades ago the USSR sent a secret expedition to Mars.  Setting aside the problems of keeping such a feat a secret for decades, this seems unlikely to me.  Did we have the technology decades ago (back when the space race was going on) to safely transport people to Mars?  Ignore the difficulty of bringing people back, as the mission in the show seems to be a one-way trip.
Comment: This seems more like a "Science Fact" question, than Science Fiction. That said, an interesting question! =)
Comment: This is essentially asking if a work's premise is reasonable, [currently on-topic](http://meta.scifi.stackexchange.com/questions/350/what-questions-are-on-topic-and-what-questions-are-off-topic/355#355).
Comment: I'll be fine if it's migrated to a more appropriate SE site, but I don't know of an alt-history one, so I think it's on topic for SF&F.
Comment: @neilfein, Just to clarify, I wasn't criticising the OP or the question, merely putting forward an opinion. This questions current sole up-vote is from me and I'm looking forward to reading the answers it gets! =)
Comment: If an expedition was kept secret, couldn't the development of all the required technology also be kept secret?  I don't see how this could have a meaningful answer.
Comment: @TonyMeyer I guess I assumed this would start with an analysis of the actual technological accomplishments of the space race.  Assuming all of that still happened, how quickly could viable, safe technology be developed that would allow a mission to Mars?  If we started with technology from the space race and kept the space department budgets up what tech would we develop and when that would allow this to happen?  I suppose it doesn't help that we still haven't gone to Mars in reality, but I think a reasonable sketch of this is possible.
Comment: @Rob - My remark was in reponse to the close votes; I'm a little puzzled why this question is being voted-to-close.
Comment: I'd not heard of Pioneer One before and on visiting the web site I was surprised to see it features Heston Blumenthal in the ad for Episode 4. It may be a risky trip but at least they get good food.
Answer: Yes. Definitely.  The technology existed.
That is a book written by Robert Zubrin and David Baker called the Case for Mars, detailing a plan to go to Mars called the Mars Direct plan.  It uses current space propulsion technology.  A slightly modified version of it was the plan that NASA was, in theory, working on implementing with George Bush's space vision.  I haven't checked, but it's probably been killed by now.
All or most of the technology used in the plan was available in the '70s.  Until a decade or so ago, we'd basically stagnated in human space flight.  And we still haven't made very much progress since then.  Must of what we're still using is 1970s era technology, sadly.
Comment: The Bush plan, BTW, hasn't officially been killed, but it's not currently getting much funding...
Comment: Yup. I don't think the point can be made strongly enough that it used technology which was CURRENT in the 70's. No Star Trek required - just a lot of will and money. One of the points CFM makes is that when the decision makers went to NASA for a plan, they returned a "Battlestar Galactica" spare-no-expense plan which essentially killed the possibility of a mission. I personally think we should pursue the whole "build a refueling station on Mars" approach the book proposes - that would be a useful thing regardless.
Answer: We have the technology, and have for some time, to send people into orbit, along a calculated trajectory.  We have been able to calculate the trajectories of the planets in our solar system with the required level of precision.
We have the technology to purify/recycle air and water for long enough, given a large enough vehicle (to hold the supplies).
We can land in an earth-like atmosphere, though not with absolute precision.
The problem would occur during the actual landing on the surface of the planet - I don't believe the Russians had the technology even 20 years ago to do a controlled ground landing in atmosphere (especially atmosphere we don't know much about).
Controlled ground landings are difficult, requiring careful entry vectors, careful study of the atmospheric conditions, and a well-prepared landing surface.  Mars would have none of those.
They could reach it and orbit it, yes, but it would take a while to get there.  By the time they touched down (if they survived re-entry) their legs would be weaker than jelly, their bones would be brittle as 75-year old men's, and they'd have to set up an environment that could support human life before their limited air supplies ran out.
Then they'd have to deal with the MoonMars Dust
Comment: heck, the Russians don't even do controlled ground landings today, do they? Don't they still use the Soyuz era parachute-drop tech?
Comment: @JustJeff: I don't know, and I couldn't be arsed to look that up.  I'm sure they CAN create such a vehicle, in any case - the tech isn't that difficult to recreate, now that the US has proved the concept and provided such excellent examples.
Comment: well, one thing you have to admire the Russian program for, they don't spend money on frills when they have something that works. wish NASA could learn to contain scope like that.
Comment: The current Mars Mission plan is the [Mars Direct](http://en.wikipedia.org/wiki/Mars_Direct) plan.  The technology used all existed in the '70s.
Comment: @JustJeff - Google "Buran". Mind you, I wouldn't be surprised if most of its technology was "apprpriated" from USA, but still, it pefformed a PILOTLESS controlled flight+landing way before X-37
Comment: of course, even though they can/have done controlled landings for quite some time, it doesn't change the fact that it would be harder to do in an unknown atmosphere (like Mars) without a prepared landing area and the centuries of study of weather patterns.


Evaluating $\int_0^\infty \frac{\log t}{1+t^2}\,\mathrm dt$ using residues

Question: I want to integrate $$\int_0^\infty \dfrac{\log t}{1+t^2}\,\mathrm dt$$ using the residue theorem. The poles are at $i,-i$. If the integral were from $-\infty$ to $\infty$, I would consider integrating along the semicircle with large radius $R$ and centered at the origin. But here it is from $0$ to $\infty$. What contour would be good to integrate along, if any?
Comment: maybe a wedge...
Answer: You can use a keyhole contour about the positive real axis, but you would consider the contour integral
$$\oint_C dz \frac{\log^2{z}}{1+z^2}$$
where $C$ is the above described keyhole contour.  The integrals over the large and small arcs about the origin vanish as the respective radii go to infinity and zero.  Thus, we have that the above contour integral is equal to
$$\int_0^{\infty} dx \frac{\log^2{x}-(\log{x}+i 2 \pi)^2}{1+x^2} = -i 4 \pi \int_0^{\infty} dx  \frac{\log{x}}{1+x^2}+4 \pi^2 \int_0^{\infty} dx \frac{1}{1+x^2}$$
This contour integral is also equal to $i 2 \pi$ times the sum of the residues at the poles $z=e^{i \pi/2}$ and $z=e^{i 3 \pi/2}$:
$$\frac{i 2 \pi}{i 2} \left ( -\frac{\pi^2}{4} +\frac{9 \pi^2}{4}\right ) = 2 \pi^3$$
Setting the above two expressions equal to each other, you can show that the desired integral is zero.
Comment: Thanks, but I'm confused where the expression $\int_0^{\infty} dx \frac{\log^2{x}-(\log{x}+i 2 \pi)^2}{1+x^2}$ comes from.
Comment: From the multivaluedness of the log.  Going back along the real axis, $z=x e^{i 2 \pi}$.
Comment: Actually, for the small arc over the origin, the $\log$ value is large in magnitude. Why does the integral vanish there?
Comment: Because $\lim_{x\to 0} x \log{x}=0$.


Zend Framework findBy magic method?

Question: Instead of using $this->fetchAll('email = ?',$email)->current() inside the model class, is there a way to do $this->fetchByEmail($email) or $this->findByEmail($email) ?
There's already a magic method like this for Zend_Log, where instead of $myLogger->log("Something went wrong",Zend_Log::CRIT) you just write $myLogger->crit("Something went wrong") and it automagically gets mapped ( via some funky reflection in the __call() method ).
Does anybody know if there is something like that in any of the Zend_Db classes, or am I going to have to write something to do this for me?
Answer: For the particular functionality that you want, you'll need to build a custom function. Honestly, the logic behind the magic __call() function isn't all that difficult.
Something like this should do the trick:
public function __call($function, $args)
{
    // Expects findBy to be the first part of the function
    $criteria = substr($function, 6);
    $criteria = strtolower($criteria);

    $select = $this->select()
                ->from($this->_name)
                ->where($criteria . ' = ?', $args);
}

Obviously if you want it to handle more complex cases like arrays or multiple criteria parameters, you would need to implement better checking but this should provide the basic idea.
Answer: According to the documentation you have to do it by yourself
http://framework.zend.com/manual/en/zend.db.table.html#zend.db.table.extending.finders
So I suggest create your own or use the one posted by gabriel1836

Zend Framework findBy magic method?


Memory alignment is always power of 2

Question: I've found the memory alignment is always equal to power of 2. Google said that such amount of alignment allows modern computers to perform read more fast. Ok, what exactly problem we would gain if we set amount of alignment is power of 3? To be more specific I would like to know what exact hardware architect aspect require the alignment to be a power of 2.
Comment: The reason for using powers of 2 is that internally CPU's are using binary coding. In binary is very easy to encode powers of 2, basically switch the 1 one wire to the left.
Answer: Modern computer memory is conceptually addressed as bytes, but the real hardware transfer is done in a multiple (a power of 2) of bytes. To do this, the last few bits of the address do not take part in the actual transfer, but are (optionally) used inside the CPU to select one (or more) of the transferred bytes.
A consequence of this scheme is that what is transferred is a block of bytes (the size is a power of 2) that is aligned at a multiple of the block size. If the CPU wants a data block that does not fit this constraint, more than one block read is needed, and the CPU must reshuffle the content of the blocks to get the data it needs. A CPU can do without such reshuffling hardware (and the associated loss of time) by requiring that data is suitably aligned.
In short: 2^N alignment matches what is easy and fast in hardware.
Comment: 80x86 processors have always been able to do unaligned byte reads, unlike older ARM architecture, which would throw an exception.  However in the case of the 80x86., there was a performance penalty -- but not anymore. In the article [Data alignment for speed: myth or reality?](http://lemire.me/blog/archives/2012/05/31/data-alignment-for-speed-myth-or-reality/) experiments show there is no longer any penalty whatsoever reading unaligned data with the Core7 processor.
Comment: In addition to the aligned nature of data access chunks, there is also the constraint of cache block chunks (having to check two tags) and page granularity (having to check two TLB entries). While not all unaligned accesses will cross such boundaries (just as smaller accesses need not cross access chunk boundaries), handling such block and page crossings adds complexity.
Answer: Try counting up in multiples of 10.  It's very easy: 10, 20, 30, 40, 50, 60, ...
Now try counting up in multiples of some other number, like, say, 7: 7, 14, 21, 28, 35, 42, ...
You'll notice that, in base 10, it's a lot easier to count up in multiples of 10 (or 100 or 1000) because you can just count up in increments of one and append one or more zeros to the end of the numbers.  Counting up in multiples of 7 is a lot harder, because there's no such easy rule, and you'll end up having to do some non-trivial arithmetic (especially after you get past the small multiples of 7 you may have memorized while learning the multiplication table in preliminary school).
It works the same way for computers, except that all modern computers use base 2 instead of base 10 internally (because binary digits are easy to represent electronically; you just have two states: 1/0, on/off, high/low).  Thus, for computers, counting in steps of 2 (or 4 or 8 or 16, etc.) is very easy, whereas counting in steps that are not powers of 2 requires more complex arithmetic.
Comment: @markt: Exactly. I used base 10 in the example, because (most) humans count in base 10. Computers count in base 2, which is why it's easy for them to count up by powers of 2, but harder to count up by, say, 3 or 7 or 10.
Comment: Your example only works in base 10.  In base 7, counting up by 7 is just as trivial.
Comment: I get that, but my point was that it's only hard to count in 7's in base 10 because it's not base 7.  You're not incorrect, but your example is bad because it doesn't (clearly) explain that the problem isn't the values, it's the non-ideal match between the values and the base that they're expressed in.

Memory alignment is always power of 2


What actually happens to electrons in a circuit when work is done at a component?

Question: As the title. Between when voltage is higher; before the electrons reach the component, and afterwards.
Comment: The first thing to realize is that electrons don't move very much.  What you think of as "current" is actually a neighbor-bumping-neighbor effect that propagates at a fair fraction of the speed of light, and while electrons bounce around quite rapidly in place, their actual net movement is a snail's pace.
Comment: I'm going to try to add some context to what I think the OP is asking: what does it mean when an electron has more voltage and energy? The electron's charge doesn't change, doesn't really move down the wire any faster, its temperature/vibrations don't really increase (I think), so how what form is this extra energy in the electron taking? Perhaps the energy isn't really in the electron at all, but in the electric field trying to shove the electron?
Comment: What do you mean by "work is done"?  Let us take an example: the electrons flowing in a circuit with a boiling kettle's "heater" element. In this case the electrons find that the heater element has a "friction" (resistance) which makes it hard for the electrons to pass through. Long story short, friction causes heat, electrical energy transforms to heat energy, heat boils water, and you make your coffee, and work is done. Cheers.
Comment: Electrons are still electrons prior to feeding into the load as they are when leaving the load. I think you are thinking about maybe what aspect of an electron changes after it has passed through the load?
Answer:
What actually happens to electrons in a circuit when work is done at a component?
Between when voltage is higher; before the electrons reach the component, and afterwards.

In both cases, the electrons are still there, and are still electrons, and are still moving in much the same way, and have the same sort of density.
Consider a bicycle transmission, with the bicycle chain being the loop of conductor that goes in a closed circuit between generator and load. The links are electrons. The chainwheel provides the energy. The chain does work on the rear sprocket when it moves.
The only difference between the two sides of the chain is the tension, that's what allows its movement to do work.
The only difference between the out wire and the return wire is voltage, an expression of the potential energy per unit charge, that's what allows the flow of current to do work.
And as transistor says in comments, the result is felt at the rear wheel immediately, even though the chain links move slowly. Well, nearly immediately. The transmission occurs at the speed of sound in the chain material, just as the transmission occurs at the speed of light along the wire.
Comment: And note that the effect at the rear wheel is felt immediately pressure is applied on the pedals even though the links are relatively slow in moving from the wheel sprocket to the driving chain ring.
Comment: @Transistor Not quite immediately, but let's not throw the transmission line stuff at the OP ;)
Comment: I'm very much a fan of the bike chain analogy, it conveys quite well that the power isn't "inside" the links but in the forces between them. And that it has to be a circuit.
Comment: @DKNguyen Well, I was responding to Transistor's comment, and the bike chain analogy does lend itself to the propagation question so well, as does the hydraulic analogy.
Answer: On the negative side of the load, where the electrons enter, they are a little closer together on average (assuming similar materials) than they are on the positive side of the load where they exit.  That is essentially what it means for the (electrostatic) voltage to be lower.
The "compression" of the "electron gas" holds potential energy, and as each unit of charge moves through the load and "expands", this energy is lost to the load.
Note, though, that the electrostatic force is incredibly powerful, so the difference in electron density is very small, and is determined by the volume and self-capacitance of the circuit elements.
Comparing to @Neil_UK's answer, which is also correct, it's like how the links on the top of a bicycle chain are stretched a very little bit by the tension.
Answer: Let's stay in a classical context.
At first, let us consider what happens to an electron subject to an electric field in a vacuum. the electron will experience a force F = q E that will cause it to accelerate (or decelerate, depending on its initial conditions). Potential energy is converted to kinetic energy or viceversa.
If the electron has a lower potential energy at its final position with respect to its initial position, it will have gained kinetic energy.
Now, let us consider electrons in a resistive conductor (such as a resistor, but also the copper wire connecting it to a battery) inside a DC closed circuit.
We know that when a current is flowing in the circuit, inside the conductor there is an electric field E that follows the path of  the conductor and has a magnitude compliant with Ohm's law (in its local form) \$E = j/\sigma\$.
This field is created by surface charge whose density changes in correspondence of gradients of permeability and conductivity. The charge on the lateral surface of the copper conductor and at the abrupt interfaces between copper and the resistive material is responsible to make the electric field complying with Ohm's law. In the following I will consider a resistor of the same cross section of the wires and built with a material with much smaller conductivity \$\sigma\$. (Note that even when the resistor is composed of the same material as the wires but differs in cross section, surface charges will develop where the shape changes in order to 'steer' the field lines inside the smaller section. In this case the current density will increase and since the material has the same conductivity, so will the electric field inside the resistor)
When both wires and resistor share the same cross section, the current density is the same in every point and the effect of the surface charge at the boundaries is to make the electric field inside the copper and the resistive material much different in magnitude. This will result in a different value of electric potential energy and, of course, of electric potential along the circuit path.
At first it might look like we are in the same condition as in a vacuum: the electrons inside the material are subject to an electric field E, and we should expect them to accelerate. And indeed they do, but then, in the classical model of conduction, they also bump against the lattice of ions the material is made of. The 'macroscopic' effect is to hide the sudden accelerations and deceleration due to the effect of the field and the collisions, leaving the illusion of an overall constant drift velocity that is reflected in the constant current density \$j = \sigma E\$.
The electrons that 'enter' the resistor with an higher potential energy will move at the same average speed as those that exit it at a lower potential energy, so their loss of potential energy did not raise their (average) kinetic energy. So, where did their energy go?
It was transferred to the lattice of ions: instead of simply converting potential energy into kinetic energy of the electrons like it would happen in a vacuum, the potential energy is transformed into disordered kinetic energy of the lattice atoms. The resistive conductor heats up.
The surface charges at the resistor's boundary create a stronger field inside it that will make the difference in potential energy change much bigger than in the good conductor: the greater loss of potential energy along the path that goes through the resistor corresponds to a greater gain of thermal energy of the material's lattice. The resistor will heat up, the copper wires will not.
 Note that in this classical model, the electrons are basically non-interacting with themselves and the magic is worked by what is basically stationary surface charges (that is distributed along the circuit with relaxation times the very moment the circuit is closed). Conduction electrons are not like hard balls in a conduit and there is no 'linkage' or 'tension' between them as in the links of a chain. Moreover, the different value of the electric field inside the resistor is caused by the distribution of surface charge (either at the lateral surface of at the boundaries between different materials) and not by a different density of the 'electron fluid'.
Answer: They have more potential energy.
an electron in a circuit before it goes through a resistor, and towards the negative terminal, will have higher potential energy, as it moves towards the negative terminal it will dissipate the potential energy and converts it to heat (in case of wire or resistance).
Consider a positive charge in an electric field, the charge will move from the positive side (the one with higher PE) to the negative side (one with lower PE).
Same with a mass in air, it will move across the gravitational field from a position of higher potential energy to a position with lower potential energy.


How do i generate a documentation for a 1-file python project (script, no module) with sphinx?

Question: I have a python project which is stored in one file, it's a command line tool.
I've managed to generate a documentation with sphinx allready, but how do i determine that my file is a script and not a module?
Answer: There are multiple options for documenting command line tool written in Python:

helpstring shown directly by the command
README.rst written in reStructuredText and converted to html by rst2html
Sphinx documentation

(I do not claim, this list is complete)
helpstring printed from command line
This is by far the most accessible form of documentation as everyone, who installs the program can show it up.
I highly recommend using docopt for parsing command line, as it brings you best of all - having docstring in your source code (as module docstring) and at the same time on command line.
You can see my post in SO https://stackoverflow.com/a/23304876/346478 or here you see sample from project itself:
"""Usage:
quick_example.py tcp <host> <port> [--timeout=<seconds>]
quick_example.py serial <port> [--baud=9600] [--timeout=<seconds>]
quick_example.py -h | --help | --version

"""
from docopt import docopt

if __name__ == '__main__':
    arguments = docopt(__doc__, version='0.1.1rc')
    print(arguments)

When running from command line:
$ python quick_example.py -h
Usage:
  quick_example.py tcp <host> <port> [--timeout=<seconds>]
  quick_example.py serial <port> [--baud=9600] [--timeout=<seconds>]
  quick_example.py -h | --help | --version

There are other argument parsers, like plac or argparse. Personally I like the most docopt.
README.rst written in reStructuredText and converted to html by rst2html
Writting README.rst is very easy and has advantage, that on github and bitbucket, you get great readable introduction to your project as it gets rendered automatically.
It is also much simpler than Sphinx project, you do not have to use multiple files, have just one.
When you install docutils:
$ pip install docutils

you get bunch of commands, which let you convert README.rst into something nice. The only command I use from this set is rst2html (on Windows it goes as rst2html.py and you have to play a bit to make it working, but it is definitely worth).
Creation of html for of your README.rst:
$ rst2html README.rst README.html

I do it from my vim editor, where it goes even simpler :!rst2html % %.html what produces README.rst.html file.
Sphinx documentation
I consider Sphinx great extension of reStructuredText and have authored couple of technical booklets with that - it offers great cross referencing syntax, I like it.
But for command line tool I would consider it overkill.
For description how to use Sphinx, refer to their great documentation.
Conclusion
Sphinx is great, but seems to be overkill for command line tool.
reStructuredText README.rst shall be obligatory part of any Python project regardless of the size, put there all what you think is handy when you forget everything about the project.
On the other hand, I have provided set of pages to my users in html and I am not sure, how often they really read it. People are lazy.
Documentation over help option on command line seems to work best for me. At the moment, you need the help (typing on command line), you have it there. And with packages like docopt it can be perfectly in-line with docstring inside your source code.
And if you want to invest into your users, teach them less (or more) command with those few hot keys to search / for a string, jump to the next occurrence n, back one occurrence N, to the top gg or bottom G. h or H be your friend and q your security break.
Enjoy living on command line.
Comment: thanks for your detailed answer, i allready thought that sphinx is an overkill for this. I figured out that my .rst file had an entry "test module" which caused that the headline in my help was "test module". That's the reason why i thought i have to configure it differently.
Comment: How do i generate the README.rst without sphinx? What i want is an overview about the things in my script (classes, methods etc.) and parsed docstrings.


Finding changes for table-valued function definition on SQL Server

Question: I had a Table-Valued Function in SQL Server and someone from my colleagues has altered it unexpectedly. How can I restore previous version easily? Is there any way to find the previous version?
Comment: You might be able to find the ALTER FUNCTION event in the default trace, but you probably won't still have the original version, so it won't help you. You can also capture these things with a DDL trigger, but you'd have to do that in advance. This is why we take, test & save backups (and also a strong case to consider source control). They're the things you don't think you need until someone screws you over.
Comment: Do you have a backup of your database?
Comment: I didn't have the backup for the version which worked correctly. Is there any tool which shows changes from something like change logs?
Answer: The answer is unfortunately no. Without some form of source control or a functional back-up to go to you are kind of out of luck. As soon as you push execute on that alter statement you have changed that table/function/view/StoredProc. For future precautions you should probably have nightly back-ups make sure only the appropriate people have the user permissions required to make database changes. Also you want to make sure you have source control and are following a proper procedure for testing and deployment to make sure this does not happen in the future.
Answer: The answer – as always – is maybe :)
If you use the 'FULL' recovery model, And you have earlier full database backup,
You have the option to perform a log backup, and then do a restore to a point in time – to the moment before the function was altered.
Restoring to a different database name and file names will allow you to extract the code you were looking for and apply it to your current database without losing other (later) changes.
If you don't use the 'FULL' recovery model, Or you can't use this method for some other reason,
Then I'm sorry, I don't know of any other way.
I suggest you take Aaron Bertrand's advice for next time (there will always be a next time...)


SOQL for Winter 20 Where is this used functionality

Question: Hi I would like to know how I can query the "Where is this used" relationship via SOQL. Generally, Metadata information on Fields can be found in FieldDefinition and Entity Particle tables, but can the new functionality be queried yet? If not, can I get the info by code, I think Apex DescribeFieldResult does not have apropriate methods...
Answer: Yes, after winter20 release we can query metadata decencies using tooling API. So while running this query, "Use Tooling API" checkbox must be checked in developer console.
SELECT MetadataComponentName, MetadataComponentType
FROM MetadataComponentDependency
WHERE RefMetadataComponentType = 'ApexClass'
AND MetadataComponentId = '00NXXXXXXXXXXXXXXX'

Comment: Ok, that seems to be it. In order to see the relations you have to add the "Ref" fields: SELECT MetadataComponentName, MetadataComponentType, MetadataComponentId, RefMetadataComponentId, RefMetadataComponentName, RefMetadataComponentType
FROM MetadataComponentDependency
Answer: Here's some documentation for you:
https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/tooling_api_objects_metadatacomponentdependency.htm
As someone already mentioned, you can query it using Tooling API.
Answer: You cannot do the "Where is this used" query against the MetadataComponentDependency object for out-of-the-box fields like Account.Name at this time.  You can do it for custom fields.
You can do these queries through the Developer Console's Query Editor if you check the "Use Tooling API" checkbox.  You can also use the REST API, for example, through the Workbench REST Explorer.
STEPS:

Get your SObject Id.  For out-of-the-box SObjects like Account, the Id is just the SObject name, e.g. "Account".  You can find custom SObject Ids with this tooling query: SELECT Id, DeveloperName FROM CustomObject. The corresponding REST API path is: /services/data/v48.0/tooling/query?q=SELECT+Id,DeveloperName+FROM+CustomObject
Use that Id to get your SObject's fields: SELECT Id, DeveloperName FROM CustomField WHERE TableEnumOrId = 'Account'. The corresponding REST API path is: /services/data/v48.0/tooling/query?q=SELECT+Id,+DeveloperName+FROM+CustomField+WHERE+TableEnumOrId+=+'Account'
Finally, use one or more of those fields' Id values to view usage.  Here is a sample query for CustomField with the made-up Id value of 00N123456789012AAA: SELECT Id, MetadataComponentId, MetadataComponentNamespace, MetadataComponentName, MetadataComponentType, RefMetadataComponentId, RefMetadataComponentNamespace, RefMetadataComponentName, RefMetadataComponentType FROM MetadataComponentDependency WHERE RefMetadataComponentId IN ('00N123456789012AAA'). The corresponding REST API path is: /services/data/v48.0/tooling/query?q=SELECT+Id,+MetadataComponentId,+MetadataComponentNamespace,+MetadataComponentName,+MetadataComponentType,+RefMetadataComponentId,+RefMetadataComponentNamespace,+RefMetadataComponentName,+RefMetadataComponentType+FROM+MetadataComponentDependency+WHERE+RefMetadataComponentId+IN+('00N123456789012AAA')

Part of the reason I have provided those REST API paths is because the Developer Console Query Editor never returns more than one row for me for that final query.  (It will say it has many "Total Rows", but then it displays only one.)
Comment: For the Developer Console Query issue you mention, try removing "Id" from the list of columns you are querying.  Many of the Tooling API SObjects (and MetadataComponentDependency appears to be one of them) don't have a real Id column, and will return the "null" id of "000000000000000AAA" for every row, in which case Dev Console will only display the first row.  Removing it should allow you to see all rows of the result..


LibGDX - How to export a texture as a .png onto, say, the desktop

Question: I'm making a game in which I need to export a texture which the user has edited as a .png into a specified location. I'd like it if I could have the default saving window thing (like on other apps when you do cmd+s). If this isn't possible, is there any way in GDX to export a texture (as a .png) to the computer (and preferably not the assets folder)
Answer: One way of achieving this would be to save the portion of the screen where they've made their edits by taking a screen shot using the ScreenUtils.getFrameBufferPixmap method and then dumping the Pixmap data to a file using the PixmapIO class that can write PNGs from a Pixmap.
public class ScreenshotFactory {

private static int counter = 1;
public static void saveScreenshot(){
    try{
        FileHandle fh;
        do{
            fh = new FileHandle("screenshot" + counter++ + ".png");
        }while (fh.exists());
        Pixmap pixmap = getScreenshot(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), false);
        PixmapIO.writePNG(fh, pixmap);
        pixmap.dispose();
    }catch (Exception e){
    }
}

private static Pixmap getScreenshot(int x, int y, int w, int h, boolean yDown){
    final Pixmap pixmap = ScreenUtils.getFrameBufferPixmap(x, y, w, h);

    if (yDown) {
        // Flip the pixmap upside down
        ByteBuffer pixels = pixmap.getPixels();
        int numBytes = w * h * 4;
        byte[] lines = new byte[numBytes];
        int numBytesPerLine = w * 4;
        for (int i = 0; i < h; i++) {
            pixels.position((h - i - 1) * numBytesPerLine);
            pixels.get(lines, i * numBytesPerLine, numBytesPerLine);
        }
        pixels.clear();
        pixels.put(lines);
        pixels.clear();
    }

    return pixmap;
}
}

The snippet above is snagged from Take a Screenshot for libGDX on github. It should be easy to modify it to take only a portion of the screen or to change it to work on a Pixmap grabbed from another FrameBuffer.
Comment: But how would I export this to _anywhere_ on the computer, not just assets, for example onto the desktop.
Comment: Use the following path with the FileHandle: System.getProperty("user.home") + "/Desktop/picname.png" , but keep in mind that this is not guaranteed to work in every case. There are already separate questions debating this topic on stackexchange, just search a bit!
Comment: The constructor I've used on the `FileHandle` class is the one that sets the type of file to `Absolute`, this means you can specify a full path to a folder anywhere on your machine. It won't be portable beyond the Desktop version, but I guess that's not something you care about in this case.


In the Revolutionary War, why did General Howe attack Philadelphia, instead of continuing his march to join General Burgoyne?

Question: General Howe, had previously captured New York City and originally proposed to move north, where Burgoyne was. What caused the change of plan?
Comment: This appears to be covered by the [Wikipedia](https://en.wikipedia.org/wiki/Philadelphia_campaign#Howe.27s_evolving_plans) article on Howe's actions.
Comment: I took the liberty of restating the question somewhat, but there were non-trivial issues of miscommunication with London.
Answer: General Howe had originally proposed to London to move north to support Burgoyne (and hopefully split off the four New England states and New York from the southern colonies). He thought better of this and proposed to attack Washington at Philadelphia, because this was the "principal" American army, and attacking such an army followed the classic tenets of warfare. London gave the okay on the condition that Howe also sent a force from New York City to support Burgoyne. This he did (nominally) by sending Sir Henry Clinton north, but with insufficient force to reach Albany.
What ultimately defeated the Burgoyne Expedition was the fact that the local colonial leaders eventually raised a militia army of over 15,000 men that surrounded him at [Saratoga][3]. This was larger than Washington's army, which is to say that it was a totally unexpected result. More to the point, these Americans were able to fight Burgoyne from behind bushes and trees, the kind of battle in which the Continentals excelled, rather than in open field.
With the benefit of hindsight, the ultimate result was a case of "win one, lose one," not the worst result in the world. Moreover, the British never expected to "lose one," at Saratoga. If they had followed the original plan, they might have lost both Burgoyne's and Howe's armies in the wilderness and with them the war. Instead, they ended up with the American capital and the defeat of the "main" American army as contemplated by Howe. Without the offsetting American victory at Saratoga, this would have been good enough to win the war.
Comment: Your last sentence engages in some speculation. (Though as counterfactuals go, it's not a bad one).
Comment: @KorvinStarmast:Of course we can't know if it would actually win the war. I said that it would have been "good enough" to win the war, (from the "book" point of view that General Howe was using).


CMake, how to set different value in a configure_file in Build vs Install

Question: I have a simple CMake project with CTest and CPack. It uses the Lua C API to load and execute an script file called script.lua.
This script will be in different location when built vs when installed/packed, it's location would be:
[build]  : ${CMAKE_CURRENT_SOURCE_DIR}/src/scripts
[install]: ../scripts (relative to app which is in bin directory)

What I'm trying to achieve here is to have install step regenerate configure_file then rebuild using new configure_file and only then proceed to do the normal install step and of course revert the configure_file back to it's original state afterwards.
Any help regarding this issue is appreciated.
Answer: My understanding is that CMake's configure_file command has its full effect during the execution of the cmake program.  It has no representation in generated makefiles, or whatever other build system components cmake generates.  Thus, if you want to configure a file differently for installation than for pre-installation testing,

You would need to perform completely separate builds (starting with executing cmake) for the two cases, and

You would need to use some attribute of the cmake command line or execution environment to convey the wanted information, such as using a -D option to define a CMake variable on the command line.

I advise you not to pursue this route.  Aside from being overcomplicated, it's also poor form to install a different build of the software than is tested.
You have a variety of alternatives that could serve better.  Among those are

Give the program itself the ability to accept a custom location for the Lua script.  That is, make it recognize a command-line argument or environment variable that serves this purpose.  Make use of that during pre-installation testing.

If indeed the program is using a relative path to locate the script at runtime, then just (have CMake) put a copy of the script at the appropriate location in the build tree, so that the program will find it normally during testing.


15.10 Reinstall Failed did Clean Install

Question: I backed up /home to external drive and did clean install 15.10 because upgrade from 15.04 got interrupted. Now the system is up and running but most of system icons and folder icons are missing. In addition the applications in /Home folder are not "installed" such as VirtualBox etc. Are there any solutions available or I must reinstall all apps new. Thanks for helping.
Answer: You have to install all the applications again, because you only installed  the basic Ubuntu system. Additional applications you had installed on your previous system are still missing, because /home only contains your users' settings, but no system-wide settings or applications.
When you copy back the /home folder, the settings for the new installed applications are already set though.
Comment: Thanks so much. All apps are back as before except the folders appear like simple text documents and some system icons. Is there something missing? I am running Unity Desk Top. I also had different desk top environments before but they are all missing. Thanks for helping.
Comment: @AJ-FIN : You can "repair" Unity by reinstalling the desktop environment - open a terminal and execute : sudo apt-get update | sudo apt-get install --reinstall ubuntu-desktop | sudo apt-get install --reinstall unity
Comment: Thanks so much. All is working. I have tried to reinstall Skype call recorder without luck. I am getting this message: dependency is not satisfiable "libid3-3.8.3c2a" . Tried sudo apt-get install -- Did not work and same with gdpkg and synaptic. Any ideas what to do? Thanks
Comment: @AJ-FIN : You're welcome - I am glad that you got your main problem solved ... and skype : there are many answers regarding skype and dependencies on this platform - search for them and if the solutions don't work in your case, just ask a new question ... enjoy ubuntu experience !:)


Link2SD doesn't really move the apps

Question: I have link2sd with granted root permissions and a partitioned SD card, but when I give Create Link to SD on some big app, it creates just few small files there, like 20-30mb, but the big files of the applications which some are more than 1Gb don't get moved to the second partition... is this supposed to be this way?
Comment: Have you selected to move all 3 things? I believe it doesn't move the data (it doesn't move something, that's for sure).
Comment: yes, everything is selected
Comment: anyone please ?
Comment: Maybe the obb files?
Answer: the apk file is stored in the internal memory still, it's in the 'data' folder.  I don't think you can do much about that with earlier versions of android but if you find a way then please let me know!
Comment: the best and easiest solution I have found so far is an app from the market called Folder Mount, it moves all the big files of some games, like for example N.O.V.A. has a file which is 1.90gb, to the SD card, without requiring you to partition the sd card or anything. Still it doesn't move the whole app, but it suits me fine for now

Link2SD doesn't really move the apps


Is it possible to take over a WordPress site if the old administrator is MIA?

Question: I do have a username and password, yet cannot make key changes through the dashboard.  For ex. I have not been able to change the site header image.  I've gone through the steps I've found online to how to do it, yet even though it shows that I've changed the header (via the dashboard), it has not effected the live site at all.  I am a total newbie to wordpress but am taking courses so I can help my friend with his non-profit.  The previous website administrator is no longer available and I cannot reach them.  I've also tried looking for the site on Github and cannot find. Website is pc4ih.org.  Any guidance would be GREATLY appreciated!
Comment: The reason why it won't show up is due to caching both server side (if the site is using a caching plugin) and locally in your browser. Clear both. For local, browswer cache, hold the shift key down while clicking the refresh icon (half circle with the arrow in the browser bar). You will have to look in your caching plugin docs to learn how to use it, probably a checkbox to turn it off and then save the settings. Turn it back on when you are done editing.
Comment: Thank you, Christina.  I did clear both browser and and wp caches and unfortunately, nothing has changed. I guess I'm just trying to understand what kind of changes can be easily made through the dashboard without any php or previous wp experience or whether I can't do anything without these first.
Comment: If you need to change the appearance of something, you would use CSS. If you need to add something that is in the header, footer, or not in the content area, you will need some php skills. The site header image could be added with php OR the customizer (Appearance > Customizer), or through CSS. You can upload a new one but the site won't reflect any change unless you point to the new file. Due to the way that WordPress organizes by date, you would not be able to upload a same named file because it is automatically put in a different directory for this month.
Answer: If you have FTP access than you can set password with
<code>wp_set_password('password', 1);
</code>
https://codex.wordpress.org/Resetting_Your_Password#Through_FTP
https://codex.wordpress.org/Function_Reference/wp_set_password
or via database if you have access to phpMyAdmin according to http://www.devlounge.net/publishing/reset-a-wordpress-password-from-phpmyadmin
Comment: Thank you.  I do already have an administrator password.  I'm not able to change the header, regardless.  It shows in the dashboard as changed to the correct one, yet on the site, it shows the old header which says NMGH. The new one has the initials PCIH.  Very frustrated.
Comment: It's an image https://imgur.com/a/uDZhY that might be part of the theme. It could be hardcoded in `wp-content/themes/the-cause/header.php`


import bitcoin seed

Question: Hello everyone I need to know in which wallet I can import my seed like the one in the next photo which is an example, it is not the real one, I do not remember which page years ago gave me this as a seed and I found it after believing it lost and I want to recover My funds in which wallet I can do, greetings
Answer: First, you can edit your question instead of answering to it to add details.
Second, what you provided is not a seed as in BIP32 seed from which you get a master key and then can derive other keys from it.
This is a private key, as in the private key of a private-public key pair.
An answer to your question is the Bitcoin core implementation wallet allows you to import a single priv key with command importprivkey:
bitcoin-cli importprivkey 5JtfaH........

Answer: You can download the Electrum wallet, which is very user friendly. (Link: https://electrum.org/#download)
Once you've set up the wallet you can do Wallet > Private Keys > Sweep to send your coins to your new wallet, and then spend them.

import bitcoin seed


How to fix choppy Bluetooth audio in Windows 10 Boot Camp with MacBook Pro?

Question: I have the following hardware and software:

MacBook Pro 2017 (MacBookPro14,2)
Windows 10 Pro (10.0.18363 Build 18363)
1Mii B06 Plus Bluetooth Receiver
B&O PLAY by Bang & Olufsen Beoplay H8i Wireless Bluetooth On-Ear Headphones

And when connecting to any Bluetooth audio device, the sound is choppy, (or for SEO: patchy, laggy, interrupted) in exactly the same way for each device. The sound will "pop" every 1-3 seconds, followed by a short 0.1-0.3s gap in the sound.
I also have to completely unpair and re-pair any Bluetooth audio devices every time Windows is booted, just to get it working in the first place.
I was able to boot in to Windows once where the audio worked perfectly, without any choppiness. But I haven't been able to reproduce that ideal scenario.
This installation of Windows 10 Pro is extremely clean and only a week old.
Here are a list of solutions that I've tried:

Enabling "Bluetooth Calibration" or just disabling wifi altogether: Someone said that the wifi is likely interfering with the Bluetooth, and to enable "Bluetooth Calibration" for the wifi adapter. I couldn't find that feature, but I figured disabling the wifi adapter completely would fix the issues. The audio still chops with wifi disabled.
Closing the "Manage Bluetooth" screen: This helped make the choppiness less frequent, but it still occurs. From Jon Leigh's solution, where he says:

Joris reported below that he's getting the same issue on his windows PC that isn't running under Bootcamp! So the issue is more widespread than first thought. Poor show Microsoft!

Disabling Bluetooth "Avrcp Transport" devices: This only works if there are multiple conflicting devices. Disabling the only "Avrcp Transport" device that corresponds to the Bluetooth audio device being used will just disable the audio altogether.
Running the System File Checker tool: I ran various file system checkers, mentioned in Microsoft's guide: Use the System File Checker tool to repair missing or corrupted system files:

    PS C:\> DISM.exe /Online /Cleanup-image /Restorehealth

    Deployment Image Servicing and Management tool
    Version: 10.0.18362.1

    Image Version: 10.0.18363.778

    [==========================100.0%==========================]
    The restore operation completed successfully.
    The operation completed successfully.

    PS C:\> sfc /scannow

    Beginning system scan.  This process will take some time.

    Beginning verification phase of system scan.
    Verification 100% complete.

    Windows Resource Protection did not find any integrity violations.

      5. [Update Bluetooth drivers][8]: Windows says "The best drivers for your device are already installed", so it has no effect.

Answer: The solution was to buy a USB Bluetooth adapter.
Nothing else worked, including avoiding using 2.4 GHz Wi-Fi.


Meter Main Wood Shiplap Siding

Question: Aesthetic opinions aside, are there any problems with mounting a meter main box directly to vertical shiplap pine siding? Perhaps with blocking behind the sheathing at attachment points. This is not a DIY endeavor—just want to know what to direct my contractor to do, as I've heard varying perspectives.
Answer: If it will be kept adequately dry by building structure and/or climate, should be fine. If the siding rots out behind it it's a pain to fix, so a patch of something that won't rot out behind the meter may be useful if the wall tends to get water on it from inadequate eave overhang or prevailing winds, frequent heavy fogs, etc.
In most buildings that's a long-term problem, but for some it might not be a long enough time for it not to be your problem.

Meter Main Wood Shiplap Siding


Using Merge in ModelBuilder of ArcGIS Pro

Question: I am relatively new to ModelBuilder.
I am trying a basic task using the merge function.
I have a folder which consists of a lot of shapefiles. Each shapefile from the folder needs to merge with file 'Punkte.shp' (if it is a point), 'Linien.shp'(if it is a line)  or to 'Flaeche.shp' (if it is a polygon).
What mistake have I made in my model? It is important that I get the output file with name (inputfile_) corresponding to the input file name from the data.
I tried with iterator (Iterate Datasets and Iterate feature class), both has shown error.
I have only Basic version of ArcGIS Pro.
Answer: I would say your model logic is flawed. Look at the help file to see that the Merge tool takes a LIST of datasets as input. Your model is attempting to run the Merge tool on every loop of the iterator. This is a very inefficient way to run and will likely cause problems.
You need to read the help file and understand what the collect tool does and sub-modelling. There are many examples on this site.
I would have a sub-model that collects only the point data and creates a LIST of point datasets that feeds ONCE into a merge tool which is in the master model.


Contour integration of $\cos z^2$

Question: I must calculate $\int^\infty_0\cos x^2 dx$, so I need to integrate $\cos z^2$ along a convenient closed path. Since $\cos z^2=\frac{e^{iz^2}+e^{-iz^2}} 2$, it seems to me that the only two useful paths could be 1) the one consisting of the segment $[-r,r]$ and the upper half of the circle of radius $r$ centered in $0$; 2) the one consisting of $[0,r]$, of $R=\{z\in \mathbb C: z = it$ for some $t\in [0,r]\}$ and of the quarter of circle necessary to close the path. However I must have misunderstood something at this point, because I have this problem: the function is entire, so the integral along a closed path (so both 1 and 2) is zero; if I call $I_r$ the integral $\int^r_0\cos x^2 dx$, I have that for 1) $\int_{[-r,0]}\cos z^2dz=I_r$, and for 2) I have $\int_R\cos z^2dz=iI_r$. So in both cases the integral along the arc of circle must be different from zero, or I'd have $I_r=0$, but it seems quite difficult to calculate it. Am I wrong with something? Thank you in advance
Comment: Write $\cos (x^2) = \operatorname{Re} e^{ix^2}$ and take contour 2). [If you use $\cos (x^2) = \frac{1}{2}(e^{ix^2} + e^{-ix^2})$ you need different contours for the two exponential terms.] The integral over the arc tends to $0$ as $r \to \infty$, but the integrals over the two rays don't. And the integral over $e^{i\pi/4}\cdot [0,+\infty)$ becomes something (hopefully) familiar.
Comment: Parametrise $z = r e^{i\varphi}$ ($0 \leqslant \varphi \leqslant \pi/4$). The modulus of the integral over the arc is $$\biggl\lvert\int_0^{\pi/4} \exp \bigl(i r^2e^{2i\varphi}\bigr)ire^{i\varphi}\,d\varphi \biggr\rvert \leqslant r\int_0^{\pi/4}\exp\bigl(-r^2\sin(2\varphi)\bigr)\,d\varphi \leqslant r\int_0^{\pi/4} \exp\Bigl(-\frac{4}{\pi}r^2\varphi\Bigr)d\varphi < \frac{\pi}{4r}\,.$$
Comment: Thank you I didn't thought of taking only the real part
Comment: Sorry I don't understand why the integral along the arc tends to $0$: if I consider $\cos(t+ikt)$ for a fixed non negative real $k$ and $t\in\mathbb R$, I have that for $t\to\infty$ it is very close to $e^{kt}e^{-it}$. This last function assumes real values infinitely many times and their module increase as  $t\to\infty$ for every $k$. I'm not saying that this implies that the integral can't turn out to be zero, but it's not clear to me why. Thank you
Comment: Actually I should have said "for infinitely many $t\ge t_0$, for every $t_0$"
Answer: You don't even need to use complex analysis.
$$e^{ix} = \cos{x} + i\sin{x}$$
$$e^{-ix^2} = \cos{(-x^2)} + i\sin{(-x^2)}=\cos{x^2} - i\sin{x^2}$$
So now if we integrate:
$$\int_{-\infty}^\infty e^{-ix^2}dx = \int_{-\infty}^\infty \cos{x^2}dx - i\int_{-\infty}^\infty \sin{x^2}dx$$
Gaussian integral is: $$\int_{-\infty}^\infty e^{-ax^2}dx = \sqrt{\frac{\pi}{a}}$$
So if we take $a=i$:
$$\sqrt{\frac{\pi}{i}} =\int_{-\infty}^\infty \cos{x^2}dx - i\int_{-\infty}^\infty \sin{x^2}dx$$
Know to clean up: $$\sqrt{\frac{\pi \cdot i}{i\cdot i}}= \sqrt{-\pi i} =\frac{i\sqrt{2 \pi}}{2}(\pm(1+i))$$ however, both integrals are positive so we take $-(1+i)$ and get:
$$ \int_{-\infty}^\infty \cos{x^2}dx - i\int_{-\infty}^\infty \sin{x^2}dx = -\frac{i\sqrt{2 \pi}}{2}+\frac{\sqrt{2 \pi}}{2}$$
Taking real and imaginary parts together we get:
$$\int_{-\infty}^\infty \cos{x^2}dx = \int_{-\infty}^\infty \sin{x^2}dx = \frac{\sqrt{2\pi}}{2}$$
Answer: $$\int_{0}^\infty cos(x^2)dx\buildrel{x^2\rightarrow z}\over{\overbrace{=}}\frac{1}{2}\int_{0}^\infty cos(z)z^{-\frac{1}{2}}dz=\frac{1}{2}\mathfrak{R}\left(\int_{0}^\infty e^{iz}z^{-\frac{1}{2}}dz\right)$$
We choose a quarter of the complex plane with a quarter cirlce deformation in the origin as our contour and define $f(z)=e^{iz}z^{-\frac{1}{2}}$
$$\oint{f(z)dz}=\left(\int_{r}^R+\int_\Gamma+\int_{iR}^{ir}+\int_\gamma\right) f(z)dz$$
Since there are no poles inside the contour $\oint{f(z)dz}=0$
Using the Estimation Lemma, it's easy to show that$\int_\Gamma f(z)dz\rightarrow0$ when $R\rightarrow\infty$ and that$\int_\gamma f(z)dz\rightarrow0$ when $r\rightarrow0$.
Hence:
$$\int_{r}^R f(z)dz=-\int_{iR}^{ir} f(z)dz\buildrel{z\rightarrow it}\over{\overbrace{=}}i\int_{r}^{R} f(it)dt$$
$$\int_{0}^\infty e^{iz}z^{-\frac{1}{2}}dz=ie^{-\frac{i\pi}{4}} \int_{0}^\infty e^{-t}t^{-\frac{1}{2}}dt=\frac{i}{\sqrt2}(1-i)\Gamma\left(\frac{1}{2}\right)=\frac{1+i}{\sqrt2}\sqrt{\pi}$$
Therefore, it's possible to conclude that:
$$\int_{0}^\infty cos(x^2)dx=\frac{1}{2}\mathfrak{R}\left(\frac{1+i}{\sqrt2}\sqrt{\pi}\right)=\frac{\sqrt{\pi}}{2\sqrt2}$$
$\textbf{Addendum:}$
If you don't need to provide a proof about this result, you could use the Mellin Transform of cosine and the result would be immediate:
$$\int_{0}^\infty cos(x^2)dx\buildrel{x^2\rightarrow z}\over{\overbrace{=}}\frac{1}{2}\int_{0}^\infty cos(z)z^{-\frac{1}{2}}dz=\frac{1}{2}\mathscr{M}\left(\cos(z)\right)_{s=\frac{1}{2}}=$$
$$\frac{1}{2}\left(\cos(\frac{s\pi}{2})\Gamma(s)\right)_{s=\frac{1}{2}}=\frac{\sqrt{\pi}}{2\sqrt2}$$
http://mathworld.wolfram.com/MellinTransform.html
https://en.wikipedia.org/wiki/Mellin_transform

Contour integration of $\cos z^2$