Find a simple formula for $\binom{n}{0}\binom{n}{1}+\binom{n}{1}\binom{n}{2}+...+\binom{n}{n-1}\binom{n}{n}$

Question:
$$\binom{n}{0}\binom{n}{1}+\binom{n}{1}\binom{n}{2}+...+\binom{n}{n-1}\binom{n}{n}$$

All I could think of so far is to turn this expression into a sum. But that does not necessarily simplify the expression. Please, I need your help.
Answer: First note that $\dbinom{n}k = \dbinom{n}{n-k}$. Hence, your sum can be written as
$$\sum_{k=0}^{n-1} \dbinom{n}k \dbinom{n}{k+1} = \sum_{k=0}^{n-1} \dbinom{n}k \dbinom{n}{n-k-1}$$
Now consider a bag with $n$ red balls and $n$ blue balls. We want to choose a total of $n-1$ bals. The total number of ways of doing this is given by $$\dbinom{2n}{n-1} \tag{$\star$}$$
However, we can also count this differently. Any choice of $n-1$ balls will involve choosing $k$ blue balls and $n-k-1$ red balls. Hence, the number of ways of choose $n-1$ balls with $k$ blue balls is $$\color{blue}{\dbinom{n}k} \color{red}{\dbinom{n}{n-1-k}}$$ Now to count all possible ways of choosing $n-1$ balls, we need to let our $k$ run from $0$ to $n-1$. Hence, the total number of ways is
$$\sum_{k=0}^{n-1} \color{blue}{\dbinom{n}k} \color{red}{\dbinom{n}{n-k-1}} \tag{$\dagger$}$$
Now since $(\star)$ and $(\dagger)$ count the same thing, they must be equal and hence, we get that
$$\sum_{k=0}^{n-1} \color{blue}{\dbinom{n}k} \color{red}{\dbinom{n}{n-k-1}} = \dbinom{2n}{n-1}$$

EDIT As Brian points out in the comments, the above is a special case of the more general Vandermonde's identity.
$$\sum_{k=0}^r \dbinom{m}k \dbinom{n}{r-k} = \dbinom{m+n}r$$ The proof for this is essentially the same as above. Consider a bag with $m$ blue balls and $n$ red balls and count the number of ways of choosing $r$ balls from these $m+n$ balls in two different ways as discussed above.
Comment: Love the formatting! +1
Comment: (+1) Nicely explained. You might want to mention that it's a case of [Vandermonde's identity](http://en.wikipedia.org/wiki/Vandermonde%27s_identity), which has essentially the same proof.
Comment: Thanks so much!!!! Your explanation was great!!!!
Answer: We have $$\sum_{k=0}^{n-1}\dbinom{n}{k}\dbinom{n}{k+1}=\sum_{k=0}^{n}\dbinom{n}{k}\dbinom{n}{k+1}=\sum_{k=0}^{n}\dbinom{n}{k}\dbinom{n}{n+1-k}=\color{red}{\dbinom{2n}{n+1}}
 $$ by the Chu-Vandermonde identity and since $\dbinom{n}{n}\dbinom{n}{n+1}=0
 $. Another way is to use the integral representation of the binomial coefficient $$\dbinom{n}{k}=\frac{1}{2\pi i}\oint_{\left|z\right|=1}\frac{\left(1+z\right)^{n}}{z^{k+1}}dz
 $$ and get $$\sum_{k=0}^{n}\dbinom{n}{k}\dbinom{n}{k+1}=\frac{1}{2\pi i}\oint_{\left|z\right|=1}\frac{\left(1+z\right)^{n}}{z^{2}}\sum_{k=0}^{n}\dbinom{n}{k}z^{-k}dz
 $$ $$=\frac{1}{2\pi i}\oint_{\left|z\right|=1}\frac{\left(1+z\right)^{n}}{z^{2}}\left(1+\frac{1}{z}\right)^{n}dz=\frac{1}{2\pi i}\oint_{\left|z\right|=1}\frac{\left(1+z\right)^{2n}}{z^{n+2}}dz=\color{blue}{\dbinom{2n}{n+1}}.$$
Answer: There is a simple combinatorial interpretation. Assume that you have a parliament with $n$ politicians in the left wing and $n$ politicians in the right wing. If you want to select a committee made by $n-1$ politicians, you obviously have $\binom{2n}{n-1}=\binom{2n}{n+1}$ ways for doing it. On the other hand, by classifying the possible committees according to the number of politicians of the left wing in them, you have:
$$ \binom{2n}{n-1}=\sum_{l=0}^{n-1}\binom{n}{l}\binom{n}{n-1-l} = \sum_{l=0}^{n-1}\binom{n}{l}\binom{n}{l+1}$$
as wanted.
Answer: Hint: it's the coefficient of $T$ in the binomial expansion of $(1+T)^n(1+T^{-1})^n$, which is equivalent to saying that it's the coefficient of  $T^{n+1}$ in the expansion of $(1+T)^n(1+T^{-1})^nT^n=(1+T)^{2n}$.
Answer: $\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$

Note that
$\ds{{n \choose k} + {n \choose k + 1} = {n + 1 \choose k + 1}}$.

\begin{align}
&\bbox[10px,#ffd]{\sum_{k = 0}^{n - 1}{n \choose k}{n \choose k + 1}} =
\sum_{k = 0}^{n - 1}
{\bracks{{n \choose k} + {n \choose k + 1}}^{\,2} -
{n \choose k}^{2} - {n \choose k + 1}^{2}\over 2}
\\[5mm] = &\
{1 \over 2}\sum_{k = 0}^{n - 1}{n + 1 \choose k + 1}^{2} -
{1 \over 2}\sum_{k = 0}^{n - 1}{n \choose k}^{2} -
{1 \over 2}\sum_{k = 0}^{n - 1}{n \choose k + 1}^{2}
\\[5mm] = &\
{1 \over 2}\sum_{k = 1}^{n}{n + 1 \choose k}^{2} -
{1 \over 2}\sum_{k = 0}^{n - 1}{n \choose k}^{2} -
{1 \over 2}\sum_{k = 1}^{n}{n \choose k}^{2}
\\[5mm] = &\
{1 \over 2}\bracks{\sum_{k = 0}^{n + 1}{n + 1 \choose k}^{2} -2} -
{1 \over 2}\bracks{\sum_{k = 0}^{n}{n \choose k}^{2} - 1} -
{1 \over 2}\bracks{\sum_{k = 0}^{n}{n \choose k}^{2} - 1}
\\[5mm] = &\
{1 \over 2}{2n + 2 \choose n + 1} - {2n \choose n}
\end{align}
where I used the well known result
$\bbx{\ds{\quad\sum_{i = 0}^{m}{m \choose i}^{2} = {2m \choose m}}}$.

\begin{align}
& \mbox{Moreover,}\quad
\bbox[10px,#ffd]{\sum_{k = 0}^{n - 1}{n \choose k}{n \choose k + 1}} =
{1 \over 2}\,{\pars{2n + 2}\pars{2n + 1}\pars{2n}! \over
\pars{n + 1}n!\pars{n + 1}n!} - {2n \choose n}
\\[5mm] = &\
\pars{{2n + 1 \over n + 1} - 1}{2n \choose n} =
{n \over n + 1}{2n \choose n} =
{n \over n + 1}{\pars{2n}! \over n!\,n!}
\\[5mm] = &\
{\pars{2n}! \over \pars{n + 1}!\pars{n - 1}!} =
\bbx{\ds{2n \choose n + 1}}
\\ &\ \mbox{}
\end{align}
Comment: It is not easy to add a new perspective to a popular sum like this one. Upvoted for originality of the approach. (+1):
Comment: @MarkoRiedel Thanks. Cross terms always suggest this approach. It's useful too for products of $\log$'s, etc...
Answer: Rewrite the sum as $\displaystyle\sum_0^{n-1}\binom{n}{k}\binom{n}{k+1}$, then by combinatorial interpretation, this is:
$$\sum_{0}^{n-1}\binom{n}{k}\binom{n}{k+1}=\binom{2n}{2k+1}$$
The right hand side $\binom{2n}{2k+1}$ is the number of ways to choose $2k+1$ from a total of $2n$. For the left hand side, divide $2n$ into two groups of size $n$ of each, then if choose $k$ from one group, then must choose $2k+1-k=k+1$ from another group, sum over all possible $k$, then you get $\sum_0^{n-1}\binom{n}{k}\binom{n}{k+1}$
Comment: What is $k$ in the rhs?
Comment: I have downvoted this answer for being (mathematically) unintelligible.
Answer: Using the estimate derived in this answer, we get
$$
\begin{align}
\sum^{n-1}_{j=0}\binom{n}{j}\binom{n}{j+1}
&=\sum^{n-1}_{j=0}\binom{n}{n-j}\binom{n}{j+1}\\
&=\binom{2n}{n+1}\\
&=\binom{2n}{n}\frac{n}{n+1}\\[3pt]
&\sim\frac{4^n}{\sqrt{\pi n}}\left(1-\frac9{8n}\right)
\end{align}
$$


Installing Ubuntu Linux and the Universal USB Installer does not show the disk to install on

Question: I'm following the youtube video to install Ubuntu as a dual-boot alongside with the Windows 8.1. I downloaded Ubuntu and Universal USB Installer and when I try to configure in Universal USB Installer, for Step 3 it does not show any other drives except my C:\ drive which contains Windows 8.1, and in the youtube videos they already have some F:\UUI or G:\UUI and etc.
Can I install Ubuntu alongside with Windows 8.1 in C:\ or how can I get other drives in Step 3? Thanks in advance!
Comment: em... i doubt this is a suitable question for so.and the question is very specified to single software. but according to my knowledge, MS spent effort on preventing secondary OS installed on the same machine as win8, so i doubt you can make it. if you can do it in this way, why not try wubi? it's easier to uninstall(according to my experience, installing linux as secondary os will lead to giving-up in the future). perhaps VM is a better suit for you.
Comment: I've always used linux live usb to make my USB sticks from windows. http://www.linuxliveusb.com/ It seems to work.
Comment: Have you inserted USB drive while following this steps to create live usb? it seems you didn't.
Comment: @RakholiyaJenish, do you mean to insert a physical USB flesh drive? Is it possible to create a separate drive to install Ubuntu on?
Answer: Universal USB installer is not used to install ubuntu alongside windows. It is used to copy ubuntu installer and make a bootable pen driver. Then using that pendrive you install the ubuntu on your harddisk.
So attach a pen drive to your system, this pendrive will be shown in the list along with your C:, choose the pendrive and USB installer will make a bootable pendrive.
Comment: How can I attach a pen drive, @AnkitGoel ?
Answer: Well to install ubuntu as dual boot alongside windows, here is a very brief idea about the steps to do it. You might need to change some of the settings (like UEFI), but it depends on your system.

Create a new partition (Any size that you want). Let it be unallocated space/unpartitioned space. (I mean don't create new partition out of it).
Next using any live USB installer (my preference are YUMI or LiLi USB creator), make your USB drive bootable.
Restart the system and live boot into your USB. (This step you might need to manually select one from boot manager, if your primary HDD is at first priority).

Now follow the steps from Install Ubuntu after Windows
Here what you are trying to do is install an OS using a USB installer.


Playing audio files with Python

Question: I am looking for a well maintained Python library with allows me to play audio files on my Raspberry Pi using the standard audio output.
So far I've tried several, but none of them seem to work. Although pyglet works on my regular computer fine, it causes an error on the Raspberry Pi. Is there a Python library which has been proven as easy to use?
Comment: Proven as easy to use is kind of relative, but I posted an alternative to pygame to  similar question on StackOverflow [over here](http://stackoverflow.com/a/25899180/2801707).  Basically that alternative is vlc.py (the libVLC Python module, which is very well maintained).
Comment: A question further down says that Pyglet works on RPi. Can you update with your error?
Answer: I recommend the widely popular Pygame. I may be wrong, but I believe that it is pre-installed on the Pi. You can use the Pygame Mixer Music Module to play audio files. I have included some example code below.
Assuming that we have an audio file called myFile.wav.
import pygame
pygame.mixer.init()
pygame.mixer.music.load("myFile.wav")
pygame.mixer.music.play()
while pygame.mixer.music.get_busy() == True:
    continue

NOTE: If this fails, please go to the terminal and update your system with
apt-get update
apt-get upgrade

and try again.
Comment: If you have more than one sound to play (which is likely) then it's better to create a pygame.mixer.Sound object for each one, then you can keep the definitions of the sound filenames in one place.
Comment: The is what I want, but my motherboard sound doesn't have a driver so I use a USB sound card.  It plays `espeak` just fine, but not this.
Answer: I needed a script to play a song from thirty seconds in in the background whilst responding to other user input. I then wanted it to end the song on some event.
I don't suppose it's particularly elegant, but I opened a pipe to a background MPlayer process.
import subprocess
player = subprocess.Popen(["mplayer", "song.mp3", "-ss", "30"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

Then, when I wanted to terminate the MPlayer process, I simply wrote "q" for quit to the pipe.
player.stdin.write("q")

Look at MPlayer documentation for all sorts of commands you can pass in this way to control playback.
Hopefully that's somewhat helpful!
Comment: This is really neat actually. [This adafruit tutorial](http://learn.adafruit.com/playing-sounds-and-using-buttons-with-raspberry-pi/overview) talks about playing sound but not stopping it.
Answer: Another option is to use mpg321 and invoke it from the command line.
apt-get install mpg321

Then in Python:
import os

os.system('mpg321 foo.mp3 &')

Pygame is almost certainly more robust, but it depends, I suppose, on what your needs are.
Comment: I thought about this myself, but I thought it wasn't very elegant, because it make pausing, volume control etc. a lot harder.
Comment: This is awfully slow.
Comment: `subprocess` is said to be the preferred method of executing commands. https://stackoverflow.com/a/450329
Answer: I would recommend pyglet rather than pygame if you don't need graphics. In my view it is simpler, more elegant, and better maintained. Then again, I expect it might be a matter of taste.
Comment: So how do you use it?
Comment: pyglet only seems to run when a display is available; running it remotely or as a daemon only for the purpose of playing sounds doesn't work.
Answer: Pygame gives you a nice and easy way to load and play sounds, on a range of channels.
Answer: You may use a number of external players through pipes.
However, you will nearly always experience a loss of speed.
There is also a problem with playback control.
I recommend you pyaudio, it works fine.
If you want to play compressed files as well, I'll be so free to point you to my module decoder.py. You can find it on PyPI.
It also uses subprocess, but calls decoders instead of players.
They do not use a lot of CPU, and some of them know how to use hardware acceleration. You can then use pyaudio or something to output the raw audio data. If you want, you can even use pygame by utilizing pygame.sndarray. In that way you can play more formats  than pygame supports.
I tried decoder.py in PyQT GUI environment, with pyaudio and also using aplay as an external player. That was on Raspberry Pi B.
Results were pretty satisfying in both cases.
The simplicity can be questioned.
decoder.py itself is very simple, but you have to combine it with other libs and that increases code lines.
There is  an example on how to play files included with decoder.py.
Answer: I'm running OSMC (Debian) and I got sound to play through my TV speakers, which is connected by HDMI. https://youtu.be/p2ljmTE67gs
My method was based on the above solution posted by @xxmbabanexx
as well as here.
Basically, I had to add dtparam=audio=on to /boot/config.txt
Comment: I think the TS meant the 3.5 mm jack when referring to the "standard audio output". Does this work for the 3.5 jack as well?
Comment: Oh I see. Hmm it probably won't, though I haven't tried it.

Playing audio files with Python


Cluster evaluation in system that implement auto determine cluster number

Question: First of all, how to know wheter document clustering result was "good" or "bad"? Not in ordinary k-means, but in algorithm that enable automatic cluster number, like g-Means.
Came across Q&A related to cluster evaluation, I found that I can implement F-measure to determine whether system giving "good" or "bad" result regarding to clustering.
Case is : you want to cluster documents. If it's you that define number of cluster, say k = 5, then it's easy to find True Positive (TP), TN, FT, and FN.
But what if my automatic system say there is k = 7, because you have some outlier documents that 'mathematically' don't match with any clusters, so the system create new cluster, thus adding number of clusters. Let's say system assign some outlier documents to cluster 6 and the rest to cluster 7.
Since document relevance is very subjective to human, the human tester can say that outlier document belongs to cluster 5. If I use F-measure, This testing result could give my sistem very bad result (accuracy).
Is there any other possible method?
Thanks for your answer.
Comment: `can implement F-measure to determine whether...` Are you implying that you have the "ground truth" information, that is, know the true clusters in your data?
Comment: Accuracy and F-measure are quality metrics for classification, not clustering. What you may want to try is [V-Measure](http://www1.cs.columbia.edu/~amaxwell/pubs/v_measure-emnlp07.pdf)
Answer: You can only compute the F measure if you have labeled data. But then you should be using classification, not clustering.
When using clustering, any use of labels is questionable. Because you say "the best algorithm produces what I already know", but then you don't need to run it at all!
Whereas a clustering tjat e.g. found clusters within your labels (probably a much better clustering result) will perform bad on your measure!


My sugar daddy is threatening to get me in trouble because he has my ssn and all my personal information is this even possible if so what do I do

Question: We exchanged phone numbers and all personal information and If I don't give him what he wants he said he could get me in major trouble what do I do I can't keep doing this? How do I know if this is real
Comment: What exactly do you mean by 'all personal information"? Date of birth? Bank account numbers? passwords?
Answer: He is blackmailing you, or attempting to blackmail you. If you do anything he wants you to do, he will ask you to do more.
So what you do is first go to the police (whatever he tries to do will be less harmful if you can show you went to the police). You don't do anything he wants you to do, under no circumstances. You then have the choice to either tell him to go f*** himself, or maybe safer to promise everything he wants and of course do nothing. Always tell him that you will do it at the next possible opportunity with some new excuse. NEVER do what he asks you to.
In the future, don't give your SSN or personal information to anyone. And remember that nobody gives you money for free unless you do this professionally and are very clever.


Find out how my server is being used for DDOS attacks

Question: I got an email from Amazon that my Amazon EC2 server is being used for DDoS attacks and they have closed all ports except SSH. This is tragical for me but I have not been able to find out how and where this attack is running. I can not find anything in cron jobs. I am using ssh key-pairs to connect to the server so it is unlikely someone can have hijacked the root account. I did have FTP on the server but I changed to SFTP now. Could it be a PHP page being used for this and how do I find the source? is it possible someone has used a root kit without the root user access?
Comment: If the server *is now* being used in an active DDoS attack, then it's as simple as checking the list of running processes. At least one of them (probably the one(s) using the most CPU is/are to blame.
Answer: It could be that someone is indeed using your instance either by rootkit or through some malicious PHP scripts. Your system is compromised now. Nuke it from orbit and restore from a trusted state (backup).

Make sure to keep your server updated and use long, complex password hashes. Disallow root login (only allow login by key for instance). Install a HIDS (host based intrusion detection system) and a rootkithunter. OSSEC is a good choice on Linux.
Comment: This answer correctly explains what you should do to recover from being compromised, but misses the original question of discovering *how* this happened. Without knowing the vulnerability, how could you prevent it recurring?
Comment: It's a good idea to first look for vulnerabilities and try to patch them up as well.
Answer: Probably your server was compromised by a web vulnerability and a php script was uploaded to it which interacts with the orders of the attacker.
You should follow this steps in order to ensure you are not going to be hacked again:

Check the server logs and identify the attacker behaviour and your vulnerability.
Try to find the malicious php script in your server, to do this dump all your files localy and compare with an old backup. It should show you the modified/new file.
Save the malicious script, it use to contain the Comand & Control IP adress, so you can send it to the police.
Restore the website from the scratch, do not use recent backup or reused scripts from compromised site. Attackers could insert a backdoor on it and you would be opening the door again.

Most important thing is to identify how they compromised your site, if you restore it with the same vulnerability the attacker's bot will scan your site again and you will have the same problem.
Also, keep your services updated, use long and complex passwords, etc...
Regards.
Answer: I would try to establish the extent of the penetration.  It may be limited to some type of script on your site they were able to abuse to create a DDOS attack.  It not that, it may be limited to a script they were able to upload that performs some bad action.
If you have a known good configuration and can determine that they didn't escape the bounds of your scripting engines (and you had your scripting engines setup securely so that they couldn't alter the system itself), then you should be ok to restore to a known good configuration of anything that the scripting engines have access to.
If you can't say for sure that your scripting engines are configured securely or if it seems they may have actually gotten direct access to the box outside of the scripting engine, then there aren't measures to contain what they could have hidden and you should nuke it from orbit as suggested earlier.
The trick is you don't want to leave any chance of a re-infection which is highly likely if they've gotten low level access since it makes it easy to leave seemingly innocuous stuff behind that will allow reinfection more easily.
Answer: Exploiting a weakness in a local application, perhaps coupled with a root kernel exloit is the likely way. It would go something like this.
1) Hacker exploits a weakness in a PHP application that lets them create files owned by the web server, and then execute that code.
2) Their malicious code would download a script that allows easier access to run commands. Downloading a perl script to /dev/shm using wget is quite common.
3) The perl script would connect out to a remote server to form a tunnel, or may accept incoming connections, so that arbitrary commands can be run more easily.
4) C source code for a root exploit would be installed, compiled and run.
5) If successful the user would now have root privileges. At this point, the firewall may be disabled, the default iptables configuration changed, and backdoors such as a modified ssh could get installed to give access despite hosts.allow settings and the like.
This only scratches the surface, but there are tools that can help with intrusion detection, and steps that you could take to harden your setup such as preventing outbound connections to arbitrary IP's at the firewall (iptables rather than EC2's external firewall), not having a C compiler in the usual place or at all, and moving tools such as wget, though a script could achieve the same so that's merely a nuisance for the hacker. Keeping a record of running processes frequently (every 5 minutes or less) can aid in post mortem analysis as can web logs. A hacker will be very likely to create files or directories in /dev/shm or /tmp, and a utility that is monitoring for unexpected entries there could catch intrusions early. Locking down your server to allow access only to yourself should unexpected items be found, particularly in /dev/shm (where there'd usually be nothing) would not be excessive.
Deploying kernel updates is strongly recommended as there have been plenty of privilege escalation exploits in Linux.


Permissions required for running extended events

Question: I've found this link: Changes to Extended Events Permission Requirements in SQL Server 2012 that mentions the need of CONTROL SERVER permission for using extended events on SQL Server 2008. I want to grant access to extended events to developers, is not any other way to do it? We are running on SQL Server 2008R2.
Answer: As Jonathan stated and the link shows CONTROL SERVER is required prior to SQL Server 2012 to create an Extended Event session. The ALTER ANY EVENT SESSION permission prior to SQL Server 2012 only allowed a user to start/stop a session, or change a current session; it will not allow them to create a session. CONTROL SERVER is required for that ability.
If this is a production system it is based on your company's policies but I would not provide a developer that level of access to anything in production. I would likely create a few different sessions that they might need for troubleshooting code in production, and then grant them ALTER ANY EVENT SESSION so they could run that as needed. They would also have the ability to then change the session as they see fit. However, be aware that even though Extended Events has less overhead than Profiler it still has overhead depending on what you are trying to capture. I would hope the developers have an understanding on what events can cause additional overhead.
Answer: Check the details in the Create an Extended Events Session Using Query Editor MSDN article. It's for SQL Server 2012, but it should be valid for 2008 too; the ALTER ANY EVENT SESSION permission should be granted.
Comment: That article does not apply to SQL Server 2008 R2 therefore you cannot assume it works the same way in lesser versions. In fact the only thing `ALTER ANY EVENT SESSION` allows in SQL Server 2008 is start/stop a session or modify a current session. It will not allow creation of an extended event session.


How are declarative languages executed by a computer?

Question: I'm getting introduced to declarative languages and am beginning to love them. In particular Haskell, a functional language, is very expressive, easy to debug. But my question has to do with execution. Are such languages compiled or interpreted? If it is the latter then I would have to choose conventional languages like C++ or Java for performance reasons. But I would love to use declarative languages for their increased productivity and ease of maintenance.
Eager to hear from the esteemed members of this community.
Answer: There's no universal answer for all languages; it just depends on what's been implemented for a particular language.  Haskell, in particular, can be either compiled or interpreted.  Some declarative languages may only have interpreters currently, but a compiler could be written in the future.
Also, don't assume that just because a language implementation is interpreted, it's unusable "for performance reasons".  Depending on the application, interpreted code may still be fast enough.
Comment: As an example about interpreted code performance, [TrufflC](https://dl.acm.org/citation.cfm?id=2647528) is a C interpreter built on top of the JVM that runs on average only 7% slower than GCC/Clang compiled C does.
Answer: By definition of declarative languages, they cannot be executed in their purely declarative form; see e.g. the An intelligent system can and must use declarative knowledge efficiently paper of J.Pitrat, or several entries of his blog e.g. "stop programming!", "CAIA, my colleague", "know thyself", etc...
So a declarative system is transforming the declarative knowledge into executable procedures, or interpreting it procedurally, or often a mix of both approaches.
J.Pitrat's mentra is that such work on declarative knowledge can and should be expressed in a declarative way (thru declarative meta-knowledge able to be applied to itself), with a bootstrapped system.
BTW, his CAIA system has lot of declarative knowledge and is bootstrapped, so translated itself into hundreds of thousands of lines of C.
You could follow his example and work on a declarative system which generates Java code, but it is a long journey... Your system will then have a "compiler" part, that is something which contextually translates some declarative knowledge into executable Java code.
Likewise, Haskell may transform (i.e. compile) some expression into several forms of code, depending upon the context, etc...


What kind of tortoise is this?

Question: Can you help me to ID this tortoise? It was walking around near to my house and then my mom found it, so we'd like to know more info. Its Straight Carapace Length is about 5+ inches. Found it in mid-Mexico (Guanajuato state). Most part of the year we have a warm weather.
Comment: Where do you live?
Comment: @canadianer just edited the question.
Comment: Could you please post the number of toes on the hind legs when you have a chance? Thanks.
Answer: The front end of the plastron (the flat 'ventral' part of the shell) is hinged, so that the turtle can enclose itself almost completely, a characteristic of box turtles.

Box turtles are turtles of the genus Terrapene native to North America (United States and Mexico). They are also known as box tortoises, although box turtles are terrestrial members of the American pond turtle family (Emydidae), and not members of the tortoise family (Testudinidae). The twelve taxa which are distinguished in the genus are distributed over four species. They are largely characterized by having a domed shell, which is hinged at the bottom, allowing the animal to close its shell tightly to escape predators.

Your turtle certainly has a domed shell. There is a lot of wear and tear on the shell, but not so much on the plastron. Box turtles can live 100 years.
From the lack of coloration on the top part of the shell and the paucity of markings on the plastron, I think it is either a Three-toed Box Turtle (Terrapene carolina triunguis), or a Mexican Box Turtle. The Mexican box turtle can grow slightly larger than the Three-toed box turtle. I can't really tell them apart. Boxturtles.com might help.

Their appearance is similar to that of the Three-toed Box Turtle.

The three-toes refers to the hind feet (which can also have four toes, to make matters worse.)

Three-toed box turtles have a domed shell which grows to an average 4.5 to 5 inches in length. The record shell length for this subspecies is 7 inches. The highest part of its carapace or upper shell is more posteriorly positioned than in the other subspecies. The dorsal and limb coloration is commonly completely absent, although some dark blotches are common in adult turtles. These areas more often being a uniform olive green or tan color.

From another site:

Shy and quiet are the traits of a Three-toed Box Turtle, both in its personality and in its coloring. Unlike the bold patterning and color seen on other eastern box turtles, the color of this species is quite subdued. Occasionally there will be a Three-toed that is more brightly colored, but for the most part they are a fairly uniform olive-brown to brown or horn color.

See also Reptiles & Amphibians
Comment: Thanks for your response, will update with the number of toes as currently  later as I'm out of town but this was a really good first approach to know it.

What kind of tortoise is this?


Either Python, PyQT, QT, or Windows Vista is finding my dll, no matter what I rename it to. Is this normal?

Question: I'm experimenting with PyQT, and I was trying to figure out how to get it to work with Firebird. I built the Firebird driver, but couldn't get it to work, so I was thinking maybe I wasn't putting it in the right place. So I tried experimenting with the SQLite driver, since PyQT came with it already installed, with working examples. I figured if I renamed all the qsqlite4.dll driver files I could find, eventually the example program would stop working when I renamed the one it was actually using. That didn't work. So I tried renaming the "site-packages\pyqt4\plugins\sqldrivers" folder to "site-packages\pyqt4\plugins\sqldrivers-old", and that did it. The example program stopped working. So I changed the folder name back, and tried renaming all the files in the folder. But the example program started working again. Then I moved the qsqlite4.dll file to a subdirectory, and it stopped working. So I moved it back, and renamed it to blah.blah.blah. And it worked again. Then I opened up blah.blah.blah with notepad++, and deleted some stuff at the top of the file, and that kept the example program from working. So I'm confused. As far as I can tell, either Python, PyQT, QT, or Windows Vista is finding the dll, no matter what I rename it to, as long as it's in the right folder. I even tried renaming it to the name of one of the other dll's, thinking maybe that would confuse it. But it only confused me. Is this normal?
edit: I'm thinking this has something to do with plugins
Answer: Yes, Qt plugin infrastructure is a fairly simple and robust one.
It attempts to load every file in sqldrivers directory. If it is successful, each dll then runs a function that registers all the features such a plugin supports.
Then, you application initalizes. If all the features it needs are available, it works properly, otherwise, some form of error or exception handling occurs.


Laser Refraction

Question: Can you take a laser beam of high intensity and refract it in a way to convert it to a safe level? White light traveling through a prism refracts into the individual wavelengths, could something similar be achieved with a high powered laser?
Comment: http://stackoverflow.com/users/52443/welbog
Answer: Perhaps you're looking for a beam expander? It takes a collimated beam and expands or reduces its size.
I make no claim as to whether it reduces the intensity to a "safe" level, but it certainly reduces intensity.
Comment: Yes you can lower to a "safe" level: you just expand it so that the eye's fully expanded pupil cannot gather more than the maximum permissible exposure (MPE) defined by the laser safety standards. This is the meaning of the "M" subclasses: e.g. class 1M is intrinsically safe *as long as you don't use optical instruments to view the beam*. The beam itself might be very powerful, but wide enough to achieve low intensity. If you viewed it with a beam shrinker, you would get back to where you began and thus your eye could gather a dangerous dose of light.
Comment: Is it possible to have a high enough energy level to melt the glass or will it always pass through?
Comment: You'll likely have to know the specific properties of your laser and the glass.
Answer: No because laser light is almost monochromatic, that is, it has only a single wavelength (that is for an ideal laser, in actual lasers some wavelengths around the main one are also included), but for the practical purposes you are mentioning, you can consider it purely monochromatic.
Updated answer from questions on comments:
1)how would you reduce the intensity of a laser already fired in mid-air?
you can put on the path some material that disperses light, this is different than refraction. Dispersion can happen to monochromatic waves. Intuitively, is like the wave crashes and bounces off in several directions.
2) What makes lasers not dangerous after they hit solid objects? Wouldn't they just reflect off in different directions? If it was reflected by a perfect mirror (without absorption or dispersion, the intensity would stay the same. But most objects are not mirrors, they are rather rough surfaces in which different parts point to different directions (at the microscopical level). This will cause a dispersion of the beam with the corresponding decrease in power per unit area. Plus most materials also absorb part of the light.
Comment: How would you go about reducing the intensity of a laser?
Comment: Do you mean using a less powerful laser, or if the refraction will reduce the power? In any case, the answer in both case is the same, because the laser is quasi monochromatic, a prism will not split the light into different wavelengths, so unless the is absorption, the laser light will not spread by refraction and will keep the same intensity
Comment: I mean, how would you reduce the intensity of a laser already fired in mid-air? What makes lasers not dangerous after they hit solid objects? Wouldn't they just reflect off in different directions?

Laser Refraction


Reading data from serial port (COM3) using pyserial module on Windows XP

Question: Before going into the problem, here is some hardware/software information:
Device accessed: Ohaus Scout Pro Digital Weight Machine (product link)
Interface used: USB (product link)
Serial Port: COM3
OS: WinXP
Python Version: Activestate Python 2.7
pyserial version: 2.5
Python recognized this serial port and had no problems opening it. I am new to python as  well as pyserial. I couldn't figure out how exactly can I read data from the serial port. I used the following code:
<code>1 import serial
2 ser=serial.Serial(port='COM3',timeout=3)
3 s=ser.read(100) #reading up to 100 bytes
4 print s
</code>
This prints nothing. During those 3 seconds timeout, I placed an object on the weighing machine and it showed 100grams on the machine. But, this data is not showing on the computer. How can I read this data using pyserial?
Answer: The baudrate is missing. You must specify baudrate. Most serial devices can not tolerate a wrong communication speed.
Comment: The problem was with the actual device. Fixed it by changing its physical settings. Thanks for the help.


Problems with Z-axis: Z-axis raised not enough at the beginning

Question: My printer had some Z-axis issue. Here are the details:
When I was printing a model, the bottom of the model got bumpy edges(as shown in pic), and the height of the model was a little bit shorter(about 5% shorter).

I thought it might be caused by the Zsteppers/mm. But after I tweaked up the Zsterppers/mm, the problem remained. I realized that the extruder raised not enough at the beginning of the printing. So I print a small cube which hight is 2mm. And the following pic is the result:

Does anyone know what might cause this?
Thanks in advance.
Comment: First check your bed height ("leveling"). If it's correct, it's likely that the carriages on your Z rails are not square with it or that the Z rails are not parallel, causing binding.
Comment: @R.. Thanks R! I leveled the bed. And the first layer printed good. How can I check if the Z rails are parallel?
Comment: Measure the distance between them near the bottom and near the top. It should be the same. But it's probably more likely that the connections between the gantry/X-axis and the carriages that ride on the Z rails are either loose or tightened down with the gantry not perpendicular to the Z axis. For me, it was that the screws connecting the X-axis to the left-side (same side as Z motor) carriage were loose.
Comment: @R.. I finally found my problem! Your answer is very helpful! My guide wheels for the Z-axis are too tight!
Answer: Here are my problem and my solution. Hope this will help others.
As @R.. suggested, I checked my carriages and as well as z-axis guide wheels(I think it is called guide wheel). And I found that the guide wheels were too tight. I can't rotate them will my fingers. So I used a spanner to adjust the eccentric nuts until the guide wheels can be rotated by two fingers. Do not make the guide wheels too loose, it may cause shaking or other problem.
Since I don't know the exact name of each part. I marked them in the pics. If you know the correct name of the parts, welcome to correct me, I will edit it in my post.
Special thanks to R.. :P
Here are the pics:
Comment: Excellent illustrated write-up.


Calculate/Measure Sideslip Angle from Heading Track and Drift Angle

Question: Is there a way to measure the sideslip angle during flight through the relationship of heading, track and drift angle? For example if you turn the aircraft into head or tailwind - does the sideslip angle equal the drift angle for establishing a steady heading sideslip through rudder and aileron input from this initial condition?
Comment: Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer.
Comment: It's a little late now as several answers have been posted (including mine), but I'm realizing that I should have asked for a clarification of *exactly* what you mean by the "drift angle".
Answer: Sideslip has nothing to do with wind, or drift. No matter what the wind is, unless you apply rudder or some other yaw inducing force, (Single engine p-factor or differential thrust on a multiengine aircraft), the aircraft will always weathervane into the relative wind, the ball will remain centered, and there will be zero sideslip.
Comment: I would argue, that this does not answer the question. The question is *how* do you identify sideslip given these inputs, not *how* does sideslip work in motorized aicraft. You sentence is not true for example for rotorcraft such as helicopters or drones
Comment: I thought that saying that it has nothing to do with wind or drift implies the answer to the question..... It is a resounding, unequivocal ***NO***! You can't use wind, heading, drift angle or anything like that to measure sideslip. The only way to measure sideslip (Helicopter or fixed wing aircraft) is with a ball or a yaw string...
Comment: ... and the sentence ***is*** true for helicopters!  ... ***and drones***. Unless there is some rotational torque on a Helicopter, like the torque from a single rotor, (Not a Chinook), or the torque from a tail rotor like on a conventional single rotor helicopter, a Helicopter ***will weathervane into the relative wind just like any other body free to move in a fluid***.
Comment: You are right that the steady-state response will go to zero for all weathervaning aircraft, but the dynamic response is very much non-zero due to factors like transient wind or wind shear and due to mismatches in torque as a result of the extensive coupling in helicopters. This last point can be very nicely seen when looking at logged Beta data (I just took a look to make sure). Steady state is practically never reached, and the amplitude can be as high as 15° either side. Additionally, a lot of drones tend to *not* weathervane, e.g. the typical Quadrotor.
Answer: No.
Drift angle is just the difference between your heading and your ground track.  There is no way to know whether an aircraft's heading is different from its ground track due to wind, or due to full rudder input by the pilot.
More information would be needed to determine whether or not there is any sideslip angle.
Answer: Yes, in theory it would work to establish the sideslip angle from the difference in heading and track angle, if you are traveling exactly into the wind or downwind. In practice, the challenge will be to exactly determine the wind velocity, and making sure your track is exactly aligned.
The answer will depend on the definition of drift. So before answer, let me introduce my definitions of these terms, so it is clear what I am talking about.

heading: the angle between the north (true or magnetic) and the x-axis of the body frame of reference of the aircraft. The x-axis is aligned with the
fuselage.
side slip: the angle between the incoming air and the plane of symmetry of the aircraft.
drift1: the angle between the motion of air, relative to the aircraft and the motion of the ground, relative to the aircraft. Ignoring tectonic plate movement, drift is caused solely as an effect of  wind.

A picture says more than a thousand words, they say:

So, if you align the track angle (relative ground motion) with the relative air motion (0 drift), and at the same time introduce a sideslip, the difference between the heading and the track, is purely caused by sideslip.
In practice, that will be extremely difficult to achieve that in a steady state.
When the track angle is not aligned with the relative wind motion, you can compute the side slip angle if you happen to know the exact magnitude and direction of the wind.
It is more practical to measure the sideslip angle by using a beta vane on the aircraft.

1
An alternative definition of drift is: drift the angle  between the x-axis of the body frame of reference of the aircraft the motion of the ground, relative to the aircraft.
In that definition, drift is the combined result of sideslip and wind.
Answer: Preface:
The external, meteorological wind creates no tendency whatsoever for an aircraft to sideslip.  Nor is sideslip an efficient or logical way to correct for a crosswind, except during the last stages of final approach, when there is a benefit to ensuring that the aircraft's heading is fully aligned with the ground track.  "Crabbing" and "slipping" are two completely different techniques-- "crabbing" is a really no more than the selection of a particular heading to fly, and normally does not involve any sideslip at all.
Here are some related ASE questions whose answers may shed some light on these points:
Is drift and sideslip angle the same in the accompanied figure?
How does sideslip indicator react during crosswind?
Since we usually fly with zero sideslip as best we can, and experience no more particular tendency to slip when flying crosswise to the wind than any other time, your questions are pretty much moot as far as all practical flying and navigation is concerned.
Still, one could imagine a theoretical situation where a navigator was provided with a precise measurement of an aircraft heading, and a precise measurement of a (small but non-zero) sideslip angle, and was interested in computing the exact ground track and drift angle.1
So to address your actual questions:

Is there a way to measure the sideslip angle during flight through the
relationship of heading, track and drift angle?

It depends on what you mean by the "drift angle".
If by "drift angle" you mean the angle between the direction of the flight path relative to the airmass, and the ground track--  i.e. the "crab angle" (or more precisely, the negative of the "crab angle") -- then the answer turns out to be "yes".  See "Calculations part 1" for more.
But if you literally mean the angle that you would measure with a drift meter-- the angle between the aircraft's heading and the ground track-- then the answer turns out to be "no".  See "Calculations part 2" for more.
The reason there is some ambiguity about which of these is the more appropriate definition of the "drift angle", is that sideslip is usually assumed to be zero in wind correction problems.  But you aren't making that assumption, so we need to decide which definition to use.
Likewise, a word about "heading" -- what we usually call "heading" in wind correction problems, is really only heading if sideslip is zero.  If sideslip is not known to be zero, a better term in many cases would be "direction of flight path relative to airmass" (dofprta).  In this answer, I'll use "heading" to mean the actual heading.    I'll also assume that that's the usage that was intended in the question.
Calculations part 1--
Here we define "drift" as the angle between the direction of the flight path relative to airmass (dofprta), and the ground track.  This is simply the negative of the "crab angle".
(Note that by this definition, "drift" is zero at all times when we are flying in still air, even if we are sideslipping.)
Sign conventions used here:
A positive drift angle means that the ground track is clockwise of the dofprta. A positive sideslip angle means that the aircraft nose is pointing clockwise of the dofprta.
"Drift angle" and "crab angle" are essentially the same thing (more precisely, the "drift angle" is the negative of the "crab angle".)
Dofprta + drift angle = ground track
Sideslip angle = heading - dofprta
Therefore sideslip angle = heading - (ground track - drift angle)
Which means that sideslip angle = heading + drift angle - ground track
So yes, with this definition of "drift angle", we can calculate the sideslip angle from the drift angle, ground track, and heading.

For example if you turn the aircraft into head or tailwind - does the
sideslip angle equal the drift angle for establishing a steady heading
sideslip through rudder and aileron input from this initial condition?

It's a little unclear what "turning the aircraft into the wind" means.  Here we'll assume that the questioner is envisioning that we have changed the flight path so that we are flying directly into the wind, before beginning a sideslip.
If we start by flying directly into the headwind (or tailwind), with zero sideslip, then heading, dofprta, and ground track will all be the same, and drift angle (and crab angle) will be zero.  From this point --
a) If we keep the dofprta constant, and establish sideslip by changing to a new heading (while countering with bank to avoid any turn), then ground track will remain constant, and slip angle will equal heading - dofprta (which will also be heading - ground track), and drift angle (and crab angle) will be zero.  (Using these terms as defined above.)  So when we establish a sideslip while keeping the dofprta and the ground track pointing straight into the wind, the sideslip angle does not equal the drift angle.
b) If we keep the heading constant, and establish sideslip by using the controls in such a way that the flight path (dofprta) curves (turns) a bit before stabilizing in a slightly different direction, the situation has gotten considerably more complicated.  Since the flight path (dofprta) now has a crosswind component, so does the ground track.  The drift angle can no longer be zero.  For a given angle between the wind direction and the dofprta, the resulting ground track (and therefore the drift angle) will depend on the relationship between the wind speed and the airspeed.  It will still be valid to say that sideslip angle = heading + drift angle - ground track, which means that drift angle = ground track + sideslip angle - heading.  So as far as case b) is concerned, as to your question "does the sideslip angle equal the drift angle?", the answer is "only in the specific case where the ground track and the heading are the same."  But with the airplane pointing straight into the wind, this can actually never happen unless the sideslip angle and the drift angle (as we've defined it here) are zero.  For all other cases, the answer to your question is "no -- when the airplane is pointing straight into the direction of the external, meteorological wind, the sideslip angle can not equal the drift angle".
In fact, regardless of wind direction or speed, it is always true that if the ground track and the heading are the same, then the sideslip angle must be equal to the drift angle, as we've defined it here, and vice versa.  (There's no reason to ever fly an aircraft in this manner-- except on final approach, using the wing-down method of crosswind correction!)  With a little reflection on the dynamics of wing-down crosswind landings, it becomes immediately obvious that to fly in a straight line with the ground track equal to the heading, with a sideslip angle other than zero, then the following must be true: 1) The ground track and heading cannot be directly aligned with the wind.  2) The direction of the flight path through the airmass (dofprta) cannot be directly aligned with the wind.  3) The dofprta must lie somewhere between the ground track and the wind direction.  These conditions were not met in cases a) or b) above, hence the "no" answer to your question "does the sideslip angle equal the drift angle?" for either of these cases.
Calculations part 2--
Here we define the "drift angle" as the angle that we would measure a drift meter-- the angle between the aircraft's heading and the ground track. (This is arguably the best or at least the most widely-used definition of the "drift angle"-- for example, in the wing-down crosswind landing referenced immediately above, we would normally say our goal is to land with "zero drift", and this concept isn't really fully compatible with definitions used in part 1.)
(Note that by this definition, "drift" is not zero when we sideslip in still air.)
Sign convention used here:
A positive drift angle means that the ground track is clockwise of the heading. A positive sideslip angle means that the aircraft nose is pointing clockwise of the direction of the flight path relative to the airmass (dofprta).
Dofprta + (drift angle + sideslip angle) = ground track
Sideslip angle = heading - dofprta
With these equations, there's no way to state the sideslip angle purely as a function of the drift angle, ground track, and heading.  All we can say is that Ground track = heading + drift angle, regardless of the sideslip angle.  The "drift angle" gives us no new information that we don't already know from the heading and the ground track.
Therefore with this definition of "drift angle", there is no way to calculate the sideslip angle solely from the drift angle, ground track, and heading.

For example if you turn the aircraft into head or tailwind - does the
sideslip angle equal the drift angle for establishing a steady heading
sideslip through rudder and aileron input from this initial condition?

Again it's a little unclear what "turning the aircraft into the wind" means.  Again we'll assume that the questioner is envisioning that we have changed the flight path so that we are flying directly into the wind, before beginning a sideslip.  This introduces additional constraints to the situation.  While flying directly into the wind or directly downwind, if we initiate the sideslip in such a way that the ground track (and therefore the dofprta) remain constant, rather than simply initiating a bank while holding aircraft heading constant, then and only then with this definition of "drift angle", can we say that the sideslip angle is also the drift angle.  (Actually, there is one other case where we can make the same observation: if we know there is zero wind.)
Footnotes:

Here one is tempted to consider the case of a multi-engine aircraft with one engine failed, or with one engine intentionally shut down for enhanced range, but we must remember that in such a case the deflection of the slip-skid ball does not actually indicate the sideslip angle of the aircraft, i.e. the angle between the aircraft heading and the oncoming relative wind-- so how would the sideslip angle be known?  And to the extent that it were known, why would it be allowed to be other than zero?
Comment: Your explanation is sound, but the answer to the question, (as it is worded...) is NO.  You cannot compute a sideslip angle from heading, track, and drift angle.
Comment: But the question wasn't about "DOFPRTA"...  You state: "Since we usually fly with zero sideslip as best we can, and experience no more particular tendency to slip when flying crosswise to the wind than any other time, your questions are pretty much moot as far as all practical flying and navigation is concerned."  This would seem to bolster my point.
Comment: Well, my comment stands.  I think you have way over-answered a pretty simple question, going as far as inventing a new term to justify a possible yes answer…
Comment: (Continued in chat https://chat.stackexchange.com/rooms/140720/discussion-between-quiet-flyer-and-michael-hall )
Comment: (Sorry, thought there was nothing more to say, but a new answer inspired a little more thought-- realized I hadn't specifically addressed the second sentence in the question, for the alternative (second) definition of drift -- )
Comment: Might also be worth noting the *impracticality* of any technique that requires flying exactly into the wind or exactly downwind... and probably should replace the clunky "dofprta" with something like "air track" or "direction of airspeed vector" -- but answer is telling me it is tired and needs to rest a while --
Comment: Deleting comments, replying in the chat
Answer: Terminology makes for such good internet discussion!

Calculate/measure sideslip angle

That means one plans to fly uncoordinated, using a sideslip to hold heading.  While this technique works to keep the nose centered on the runway when landing, it is not the best way to fly a crosswind over distance.
What is more efficient is to fly a coordinated heading and let the wind "correct" the groundtrack.

the coordinated airplane has no crosswind relative to the airmass, the vector sum of aircraft velocity/direction and windspeed/direction determine groundtrack.

So, ground track is based on these two components, not the orientation of the aircraft.  That's what this helps a pilot/navigator do.
Regarding calculation of bank angle vs crosswind in a slipping condition, side force from wing is readily available by decomposing the lift vector as sine bank angle × Lift.  But one should keep in mind that crosswind forces are created by drag, essentially the wind hitting the side of the plane.
It would be easier to measure bank angle vs crosswind for a given aircraft, and one could expand the study to crab configuration, power on and off (I can see the graphs on slides and overhead projector already!), but, as wind varies, pilots generally must pilot by constantly adjusting control inputs to the weather conditions, not with data graphs.


Why don't my muffins rise and develop tops properly?

Question: I would like to make muffins that have that "spilled over" look that shop bought muffins have, but no matter what I do, the ones I make always look flat or only just reach the top of the paper cases.
What can I do to make the muffins rise more and have wide tops?
Comment: What's the problem with putting more batter in each cup?
Answer: There are many reasons why muffins might not rise as expected; I'll list the ones I know of in order of probability:

Over-mixing the batter.  You'll know that you've done this if the muffins also turn out tough and chewy.  This prevents rising because the gluten network is too tight to expand around the gas bubbles.
Under-mixing the batter.  You have to develop some gluten, otherwise there's nothing to trap the gas bubbles and the muffins will just deflate before they get any rise.  It's a lot easier to over-mix than under-mix, but if you drastically under-mix and don't even bother to get all the dry ingredients wet, then you won't get any leavening action at all.
Not enough leavening agent. This can happen with unsifted flour (sifting also helps incorporate air), using the wrong type of flour (especially if the recipe calls for self-raising), or using old or improperly-stored flour or baking soda/powder.  You should be able to see some bubbling action before you pop the muffins in the oven; if you don't, you might have this problem.
Improper substitution of baking soda for baking powder.  A lot of people think these are the same, but they aren't.  Both use sodium bicarbonate, which is what produces the CO2 bubbles but needs an acid in order to do it.  Baking soda is intended to be used with mixtures that are already acidic; baking powder has an built-in acidifier, usually cream of tartar, which reacts with the water as soon as you incorporate it.  If you ever substitute baking soda for baking powder, you need to add cream of tartar or some other acid/acidifier.
Not resting the batter, or resting too long.  If you use double-action baking powder (the norm, e.g. Magic brand) then you are supposed to rest for 5-10 minutes to allow for the first action.  If you use single-action baking powder, you must get those muffins into the oven right away or they'll start to collapse.
Finally, and this might be stating the obvious - not filling the tins enough.  It's possible that the muffins are rising just fine, but they're not supposed to double in size like bread or triple like pastries; you should be filling the tins at least 3/4 of the way up if you want tops.
Comment: I have found that most muffin recipes I have baked say they make 24 muffins, but I always fill them so full that I only get 17 or so, but I get the bakery style tops. :)
Answer: I have to say, my muffins always turn out fabulously. I don't think there is anything wrong with using baking powder. My recipe states I use self raising flour and baking powder(not soda) and I have perfect muffins.
Can you list what ingredients you use please?
Try placing your baking tray at the lowest point in your oven rather than middle as the muffins will brown before fully cooked thus resulting in non rising.
Hope this helps a little.
Answer: Higher baking temperature. I never got nice tops until I raised the temp to 425-450 for the first few minutes until they set (~7-10 for jumbo cups), then turn it down to 375-350.
Answer: I have always found that when mixing the batter, the mix needs to stand for at least 15-20 minutes so that it can expand.  Only then do you put the mix into the muffin pan and into the oven. This insures that the muffins will rise, stay moist inside, and taste real good.


Was it common practice in 1940-60 to coat copper cold water pipe from the mains with a thick material that set up hard, possibly cementitious?

Question: I am trying to find out what is coating the outside of the 3/4 copper domestic cold water supply pipe in my basement. The house was built around 1950. The length of copper pipe that runs from an ell after the meter up to the floor joists above has been coated with some kind of very thick gunk, about 1/8" thick, possibly some kind of cementitious paint or just plain paint. A lot of it appears to have flaked off, and there are also some short sections of the pipe that do not have this gunk anywhere on them.  Was it common practice to coat that supply pipe from the mains, and if so what was the purpose?
Comment: Is the back of the pipe (facing the wall) also coated?   If not, it was probably just a sloppy job at coating the wall.
Comment: maybe it is accidental
Comment: @jay613: The rear side is not entirely free of it but it has far less, so I think you may be right. In the late 1980s, previous owners had the basement remediated after removal of rigid asbestos insulation from around the hydronic heating pipes, and that included painting the walls to encapsulate any asbestos fibers.
Comment: probably keeps it from sweating as much on humid days by insulating the metal some. Not common afaik, but not a bad idea if it helps.
Answer: From your photos it looks like the same material as the walls. Some sort of masonry paint is my best guess.


Why do microcontrollers always need external CAN tranceiver?

Question: For example in STM32 MCUs, the CAN pins are CAN RX and CAN TX. Therefore to transform it to CAN H and CAN L, we need to use external CAN tranceiver. What's the purpose of it? Wouldn't it be easier to connect CAN H and CAN L directly to MCU, without using CAN tranceiver at all?
Comment: Please note that MCUs with built-in CAN PHY do exist so MCUs do not always need an external PHY chip. It's just more common.
Comment: https://electronics.stackexchange.com/questions/30564/is-a-can-enabled-microcontroller-sufficient-to-drive-a-can-bus
Answer: While I don't know the particulars of designing and fabricating these respective circuits, my expectation is this:
CAN interfaces must handle relatively high currents (>100mA), which requires relatively large area transistors on the die.  This isn't a problem in and of itself, but it's an inelegant solution: one corner of the die might have potentially quite high power dissipation, potentially affecting sensitive circuitry beside it.  Sensitive elements include ADCs, voltage references, clock oscillators / PLLs, etc.
That said, there are examples of relatively sensitive and complex circuitry paired with power devices; protected MOSFETs are an example, integrating a temperature and current sensing circuit onboard an otherwise ordinary power transistor.
But there is one thing that you will have a much harder time accounting for: voltage.  CAN terminals are rated over ±20V, well beyond the breakdown voltage of any ordinary CMOS logic processes.
Voltage still isn't a deal-breaker per se: there are relatively complex ICs with multiple voltage domains.  Advanced DC, stepper and PMAC/BLDC motor controllers for example, either contain the controller, and gate drivers for external power transistors (typically the drive domain is rated 6 to 18V), or the transistors are integrated onboard as well (on-die or multi-chip co-packaged).  Now, knowing which way they're build (again, not having designed these exact devices), isn't easy, but some are publicly known (by x-ray or destructive examination, or occasionally documented as such), and many we can reasonably suspect based on their design.  ST's powerSTEP01 comes to mind: multi-pad packages like these are almost always characteristic of multiple dies.  Most likely the peripheral pads are discrete power transistors.  Whether they integrate control and drive on one chip (center), or have separate driver chip(s), isn't clear.
But what can be a deal-breaker, is using a multi-domain process, plus all the process optimization that is necessary to realize an MCU.  The most difficult of which are high-density SRAM (and logic in general), DRAM if applicable, and analog circuitry (ADC, reference, amplifier or comparator, PLL, etc.).  MCUs are quite complex these days, and that's a reflection of the decades of process optimization that has allowed such a diverse toolkit to be placed on one die.
And keep in mind, especially in anything faster (≥ 60MHz or so), and even in slower families these days -- "MCU process optimization" already includes multiple voltage domains, even if they're largely hidden from the end user!  There aren't many pure-3.3V devices these days, I think; many (most, even?) use an internal low-voltage core for much of the CPU, RAM and peripherals, with only the IO pins still running at VCC.  (Case in point: the AVR-DA family just barely mentions its internal voltage regulator, across a couple pages in the datasheet; it doesn't even need an external bypass capacitor, it's nearly invisible to the user!)  So it's an even bigger ask to have not just two, but three or more, very different, voltage domains across a single chip, while still having effective digital and analog functionality in at least one of those domains.
Also not to mention, support features like ESD protection -- not mentioned, partly because it may be assumed as part of the voltage domain (typically using standard foundry structures, is my understanding), and because these things are tightly controlled IP that no one shares publicly.  But do appreciate that, whereas a generic logic chip might be rated 1 or 2kV (HBM), an interface might be specified at 8/15kV (IEC 61000-4-2 contact/air discharge).  And higher ratings, of course consume more die area.
(Emphasis on "might": I've seen RS-232 and 485 interfaces, for example, rated for merely 2kV ESD.  I've seen others rated over 15kV.  Always check the datasheet!)
Or that, due to the large size transistors required, or the higher voltage rating, the CAN interface might not be reusable for general-purpose configurable use (GPIO), at least not with the same speed (due to capacitance of those transistors).
And it still doesn't include every case, because isolated CANbus might be desired, and that's harder to do with the raw bus, than it is on a pair of logic-level signals.  And logic-level signals mean the pins can be reused for other functions as needed (GPIOs).
So, while it might be possible, the barrier as always is economic: how much are you willing to pay -- as the manufacturer doing the painstaking optimization work, and ordering extra masks to produce the multi-domain chips; or as the potential customer, to whom these costs are passed on?  If that cost is greater than the alternative, it's a no-go.  There are many more limitations than purely physical ones; such a chip might be physically possible, but it must also be economically feasible to produce, and in enough demand that sales recoup those costs (or reasonably expected to sell, since we're talking things that might not exist in the market yet).

Similarly, we might ask about other common interfaces.
What about USB?
USB is commonly available.  The pin I/O levels are comparable to most logic levels, and as long as the process can support differential comparators (or LVDS receivers, or something suitable for lower voltage or precision logic input thresholds), a Full Speed interface should be promising; and if adequate speed is available, High Speed as well.  ESD ratings are not usually very strong, but USB requires shielded connectors, which provide some physical protection.
Ethernet?
I've seen more MACs than PHYs, but I have indeed seen integrated PHYs in MCUs.  These have similar signal levels to RS-485 or CAN (i.e., 1 to 2V into a nominal-impedance transmission line), but thanks to line isolation and termination, and better-controlled drive strength, the high voltage and current ratings can mostly be avoided.  The structure is still relatively large and powerful (a typical Ethernet PHY consumes a few hundred mA at 3.3V), and probably most manufacturers don't want to commit the space, and potential power consumption, if it's not always needed; hence the PHY-less strategy being more common.
High speed interfaces: PCIe, HDMI, etc.?  Yes indeed; these are low level logic structures, made complicated by their high speed and complex coding (well, PCIe moreso), but there are many application processors which integrate them.  A natural fit, after all, and in high demand for embedded computing applications; take any Raspberry Pi for example.  Or cell phone, for that matter!
RS-232: I'm not aware of any examples.  This is quite an old interface that's probably not worth supporting on-chip, even though it is quite a common use-case; at least for development and light industrial applications.  You just don't get much bang for your buck; it's a slow interface.  The ±15V (and up) operating range is the trick here; currents are quite modest.
RS-485: lumping this in with CAN, as the levels are quite similar (indeed, the earliest CAN devices were apparently based upon RS-485 drivers).
Gate drivers: I don't recall part numbers, but I believe Microchip had some PICs with particular focus on switched power applications, for example?  PICs are rather simple MCUs, though, so this might not be very unexpected.

But again, these are largely my suppositions, or things I've picked up on over the years.  Nothing to put too much confidence in.  Consider this more of a jumping-off point for further research.
Comment: If you integrate a CAN transiver into the die, you probably can't use this pins for anything else. With CAN RX and TX you can multiplex it and use the pins for something else when the application doesn't need CAN.
Comment: Another point you did not cover is that with a bus like CAN connecting separate devices in a potentially nasty environment, one will often want galvanic isolation, which is both something that's easily done on the logic-level TX/RX signals and something not easily built directly into the MCU. (For Ethernet, this is mostly handled by the magnetics.)
Comment: @12431234123412341234123 also a good point.  It's... not too big a deal, it's only two pins -- well, two pins per interface anyway; many devices with USB have it on dedicated pins as well, though usually only the one port, so there is that.
Comment: +1 for pointing out the economics: the whole point of general-purpose microcontrollers, as opposed to application-specific integrated circuits, is to be used in a wider variety of applications, which necessarily means economic tradeoffs.
Comment: I always thought CAN was a development from RS-485.  Its almost RS-485 with arbitration free bus contention, a CRC-15 and the final ACK bit to make sure your message was actually heard. The bus off when the error counters mature (which are like leaky buckets more than counters) is a nice final touch.
Answer: It would be terribly expensive to build a CAN PHY which can directly handle the electrical requirements of a CAN bus directly into a general purpose MCU. Same goes on for any other electrical interface, such as RS-485 or RS-232, Ethernet or whatever. Only some specialized MCUs could have direct CAN bus connection and they do exist. For example the STM32 can't work with 5V power supply required for CAN PHY driver.
It is far more easier to make the MCU more generic and only to have the CAN bus logical level controller, and have the 3.3V logic level connections to CAN PHY which provides the interface to physical wires with high power transistors and protection components, and make it compliant with differentially transmitting and receiving the 5V bus voltage levels.
Comment: There is an LPC11C22 with on-chip tranceiver.
Comment: @Jeroen3 I did say only specialized MCUs could have built-in CAN PHY and thus that MCU is clearly specialized for applications where MCUs communicate with CAN bus.
Answer: The CAN transceiver needs some adaptability that the microprocessor may not be able to support.  Depending on which CAN transceiver chip you choose, you can get additional control over:

Slope Control, if you care about the shape of your edges.
Mixed Voltages, such as logic at 3.3 V and CAN bus at 5 V.
Power Standby, where you can save a bit of power by putting the transceiver in standby.
Power Wake-Up, where the transceiver can detect certain frames and turn on/off pins.  Some of these are also tailored for working on a couple different power domains.  The idea is that logic power is completely powered off, but the transceiver is on an always-on supply and a certain frame can cause the transceiver to enable the logic power supply and boot the microcontroller.
Electrical Isolation, if you want electrical isolation in the transceiver (where you don't want your device to share the ground of the CAN bus or devices on its far end, like certain engines).

And so on.  I can buy a variety of transceivers that accomplish the functions above, which is all flexibility that would be lost if it was buried in the MCU.
Comment: Many MCUs have configurable drive strength or edge slope; could you explain how your first point differs from this? Also there are compliant 3.3V CAN transceivers, could you explain the second point?
Comment: Electrical isolation, like on EVs too - they use CANbus.
Comment: @TimWilliams  For slope control, check pin 8 of the MCP2551, and I've never seen a CAN MCU offer slope control ON THE BUS because it would be talking on the far side of the transceiver chip.  For the voltage part, check pin 5 of the TJA1042T/3, which lets you run logic at 3.3V and run 5V on the bus.
Comment: I mean if it was integrated -- surely the same methods that are used to set GPIO speed, could also be used for CAN PHY devices if they were/could be integrated?
Comment: Eh, there are many things a catalog of CAN transceivers lets you do, and it would be counter-productive to have the MCU limit your options.  The current paradigm is very nicely modular.  Any MCU that tried to integrate the transceiver could only lose sales over it.
Answer: The technology to put the CAN driver on the processor is possible but it is currently not cost effective. This is because of the current etc the bus requires. The silicon area needs to be much larger and robust to support this, much larger than that required for a processor.
There are several 3V3 CAN drivers available. This can be checked by searching for: '3V3 can drivers". They can be mixed on the CAN bus with both 5V and 3.3V systems. This capability saves an extra 5V power supply in some designs.
As far as the CAN bus it is a differential bus. Depending on the system the voltages will vary. It is the relationship of CAN H to CAN L that determines whether it is a 1 or Zero not the absolute voltage.  CAN 0 is the dominate state which is used in arbitration and acknowledgement.
Answer: Also you may want to choose different types of CAN transceiver for different environments. Some CANTXRs are capable of coping with plus/minus 80V on the inputs (i.e. miss-wiring, sticking power onto the CANbus at say 50V, won't damage them).
You pay extra for the tough ones, but it's better than having all the devices on the CANbus wrecked because someone wired an installation incorrectly and turned it on.


Is optimization necessary when code generation is targeting a runtime with JIT?

Question: I'm planning on writing a programming language targeting the .NET platform which led me to start thinking about the code generation aspect of targeting such a platform. I'm new at writing compilers but I know there is optimization done as one of the phases in compiling (or there can be). I started to wonder about the any benefit to spending time optimizing the output (in this case CIL but this would apply to the JVM too) because the JIT compiler and things like the JVM's HotSpot could optimize at run time. Is there any benefit from optimizing the generated code (CIL or the JVM equivalent) when targeting .NET or JVM since the JIT will already optimize?
Answer: It depends. There are countless optimizations. Any given compiler (your compiler, the JIT compiler, or any other compiler) necessarily implements only a subset of those. This choice depends on available time, typical/expected input code, priorities, etc. and therefore the engineers who built the JIT compiler may have selected optimizations which work well for the programs they were expecting, but not so well for the kind of program you care about.
You will have to determine what optimizations the JIT compiler misses. The way to do this is, of course, empirical: Actually write programs, letting the JIT compiler optimize them (be sure to do this part properly - disable debugging, compile for release, choose realistic benchmarks, etc.), and then inspect the final machine code. Look for unexpected code (you will, of course, need assembly knowledge for this) and determine if it's a missed optimization or if the JIT was smarter than you thought.
If it is a missed optimization, you have another problem: You can't output the machine code you want, you have to generate different IL instead.
A missed optimization is probably due to a language feature the VM doesn't know (e.g. multi methods on the JVM). You lowered it into the VM's terms during compilation but the translation you chose doesn't sit well with the JIT's order of passes, heuristics, etc.
As you can't just output machine code yourself, you must now find an alternative IL fragment for the same input language code. Ideally, one which the JIT compiler does handle well. Finding that may be an exercise in imagination, but it's not technically hard, just guesswork interleaved with benchmarking.
As another answer points out, JIT compilers work under time constraints. This may lead to optimizations that could happen being missed (e.g. constant propagation running out of time), but as the creators of the JIT compiler faced the same problem, this probably isn't too severe if you don't create much larger/more complicated code.
If you create such bad code that the JIT compiler can't fix it all, then you have to duplicate its optimizations in your AOT compiler. I'm not convinced that this is a likely scenario though, and even if it happens even very simple optimizations should mostly fix the problem.
So, in summary: Start with a straightforward translation, then seek out missed optimizations and either make it easier to optimize for the JIT compiler, or do it yourself (if possible - adaptive optimization is much harder in an AOT setting).
Comment: Thank you very much for your answer. It makes a lot of sense.
Answer: I think this question is hard to answer in general.
For example, the F# compiler performs a tail call optimization, because having tail-recursive functions is common in that language, the F# compiler can do a better job at optimizing them in some cases than the JIT compiler and some versions of the JIT compiler don't perform the optimization at all.
So, your language might have some common operation whose straightforward implementation wouldn't perform well. In that case, it makes sense emitting IL code that's optimized.
What I think you should do is the same as when you're writing a normal program: first write your code in a way that is simple and readable. Only if something doesn't perform well, attempt to optimize that. It might be worth considering that you might need some optimizations in the future and make your code modular enough, so that you don't have to rewrite half of it because of some optimization. But for now, that should be enough.
Writing a compiler is hard enough job already (even if you're targeting an IL). Finish it first and think about optimizations later.
Comment: Thanks for your response. You make a good point about language specific optimizations that wouldn't be done in the JIT, it is definitely something I didn't think about.
Answer: Generally, JIT compilers have some thresholds governing how much optimization they will attempt to perform.  These may be based on the size of a method's IL and/or the amount of time already spent JIT compiling the method.  So yes, IL which has already been optimized may benefit from further JIT optimization.  As always, there is a trade-off: how much time do you want to spend adding AOT optimizations to your compiler (and testing/maintaining them) versus how quickly your code can be JIT compiled, and with what level of optimization.
The magnitude of the improvement depends largely on how much simpler (and smaller) the AOT-optimized IL is relative to the unoptimized IL, as well as the thresholds governing the JIT compiler (which, at least for the Microsoft CLR, are not widely known).  The only way to find out is to do some testing yourself.


Package Substation below the VORTAC Counterpoise

Question: Is it recommended to install a 100 KVA 13,800/400 Volts, 3 Phase,  60 Hertz Package Substation beneath the VORTAC Counterpoise Metallic Grids and what will be the effects if the substation is already energized with the VORTAC also in operation?
Comment: This seems like the kind of question that should really be asked of an engineering consulting company, most likely an electrical engineering firm with experience in RF analysis and shielding and, ideally, aviation and its associated regulations—not a bunch of Internet randos.
Answer: No. This is a very bad idea, for the following reasons.
First of all placing a very large chunk of metal under the counterpoise grid will affect the uniformity of the radiation pattern of both the unidirectional and the omnidirectional signals being transmitted by the VOR station.
Secondly there is a risk of coupling RF currents into the substation and the power leads coming into and out of it. This may upset the switching and regulation hardware inside the substation, as well as turning the power leads into antennas, further disrupting the pattern uniformity of the transmitted signals.
Part of the test & qualification process for such a construction project will be to collect RF field uniformity data in the complete 3D space surrounding the VOR all the way out to its maximum intended range in the complete absence of the substation, repeating the test with the substation under the grid but with power disconnected, and once again, with power connected.
Note that there are both commercially-available and freeware antenna simulation software packages available with which the effects of the substation on the VOR signals can be predicted. I recommend that you halt the construction project until after you have run the models and proven to the aeronautics authority that the substation will not perturb the VOR an any way.


Can't connect dumped MongoDB with Rails 3.1 and Mongoid

Question: A Rails 3.1 app is running locally fine with MongoDB and mongoid (until I don't modify anything).
I need the production DB so I dumped it properly. Now I need to configure the Rails app to connect or use this new dumped database.
I copied all the Mongodb's BSON files into the folder where my local Mongo (which started by 'mongod' command) looking for (/data). All files in one folder (/data/e).
How to configure MongoDB or Rails or mongoid.yml to use specifically that folder which I moved there?
+++
Additional info:
Made mongodump successfully. Now I need to import it to the testserver, probably with mongoimport. How to do that?
Answer: You don't do that. To dump/restore a MongoDB database, you should use the mongodump and mongorestore utilities


Screw toilet flange to broken floor

Question: What do I do in situation as on the scheme below?
As you can see flange bolts are just hanging in space.
Do I fill space between cement floor and pipe with new cement and then screw bolts to it?
Other options?
Answer: In the situation where a toilet flange is in the drain pipe through a concrete floor, there does not have to be any bolts holding the flange down.
The pipe will be held tight in the concrete and the flange glued to that.
For your particular situation, I would fill in the gaps with a little cement or even thin set. No bolts are needed except those to hold the toilet.  Keep the cement out of those slots.
Comment: I think it depends on your flange.  Some are very secure, others not so.  But I'm with RMDman—fill in the space and fasten your flange down.  What you fill with depends on how big the void is.

Screw toilet flange to broken floor


Is a single infoleak enough to break ASLR if you don't have access to the binary?

Question: With a single infoleak and access to the binary you can calculate the other addresses. Is this still possible when you don't have access to the binary?
Answer: Possibly. It would depend on the leak and the type of address leaked. For example, an address for the heap, stack, or executable segment of the binary are of little use for conventional exploitation without their context and knowing the offset from the base.
However, it may be possible to determine the type of address just by looking at it, and some useful information can still be obtained; especially return addresses on the stack. If it appears to be an address from the binary's executable page, that may give you an idea of the addresses used for code in the binary. If it's also possible to exploit a buffer overflow, an attack with something like BROP may be possible.
If a pointer to libc is leaked, it may be possible to determine the version of libc and what the pointer points to (IIRC, the lowest n bits of the address aren't affected by ASLR and can uniquely identify the libc function), possibly with some educated guessing and by searching the libc database. Once offsets are calculated, this combined with a buffer overflow could allow you to perform a ret2libc attack to call any function in libc and gain code execution.


Spivak Ch1 Proof Critiques

Question: I've started working through Spivak's Calculus.  I'm going into senior year after this summer, took the AP Calculus BC test last year, and wanted to get a firmer foundation in calculus before I take Calculus III next year.  I'm still struggling through Chapter 1, unfortunately.  I understand the reading material, but there are quite a lot of problems to do.  A lot of them are repetitive and not very difficult, but very long, so I found a syllabus online and I'm doing those as well as all of the ones marked with asterisks.  I have no prior experience writing proofs though, so I'd like to verify that I'm doing them acceptably.  The first one turned out terrible convoluted, and I'm sure it could have been done with much more brevity.  I'm still not quite sure what I'm allowed to assume other than the postulates given.
I'm not sure how I should link it, is Google Drive okay?
Answer: You wish to show that $$0 < a < b \Longrightarrow a < \sqrt{ab} < \frac{a+b}{b} < b$$
Since $0 < a < b$, we can multiply by $a$ and get $0 < a^2 < ab$. Then we take the principal square root, giving $ 0 < a < \sqrt{ab}$. This shows the first inequality.
Now, expanding $(\sqrt{a} - \sqrt{b})^2 > 0$, it gives $a + b - 2\sqrt{ab} > 0$, which in turn gives $(a+b)/2 > \sqrt{ab}$. This shows the second inequality.
Now, again considering $0 < a < b$, we multiply by $1/2$, giving $ 0 < a/2 < b/2$. Now, we add $b/2$. This gives $b/2 < \frac{a+b}{2} < b$. This shows the third inequality.

Spivak Ch1 Proof Critiques


Can anyone help identify this, possibly Greek, type of uniform/dress?

Question: I found this old picture of my great great grandfather and my mother isn't sure what he is wearing. She did say we have some Greek roots from one side of the family. Thank you!
Comment: Do you have any other information? The more you can tell us, the more likely it is that someone can help you. For example, do you know when your great great grandfather was born, or how old he was in this photo? Are there any clues on the back of the photo as to when or where it was taken?
Comment: I initially thought it might be Ottoman Empire, but the crown & crossed hammers/picks on the belt buckle would most likely negate that. Was your great great grandfather involved with mining or tunneling?
Comment: Also, what *fraternal organizations* might your grandfather been a member of? My initial reaction, given the unusual plinth just to your grandfather's right, is that this might be fraternal regalia of some sort.
Answer: Your great great grandfather is wearing the miners habit or berghabit in german which is used because he is a member of a mining association. The photo dates from before ww1. The uniform could depend on different associations. They are still worn today.
Comment: OK. 2nd pic pretty spot hitting.  Could you include the insignia, 'left claw' - a shield… and further describe verbally what _you_ see visually…: buttons do not match as do not feathers…
Comment: As I've said before the uniform could be different with each mining association.


Is a raised floor viable and safe in a basement bathroom?

Question: A contractor wants to build a raised floor for my bathroom basement that he is building for me instead of breaking the concrete. The plumbing would be underneath the floor. Is this a viable and safe alternative to breaking concrete? Or does he just want to keep the costs down for himself?
Comment: Is this something he has already given a price on? If adding the bathroom included everything set at floor level, not raised, hold him to it. Unless the waste line going out to the sewer/septic isn't low enough to get fall to get out the house properly. Then an ejector pit will be needed, that's expensive. Long and short of it, if he has a contract, and he is changing the scope of work, then a price change has to go along with it. If it is by the hour, then there will be a cost saving that you may realize. I would not do the raised floor if at all possible, all for the reasons Ecnerwal mention
Answer: Why does he need to move the plumbing in the first place? My guess is that its simply because the drain in the concrete is in the incorrect place? I finish basements professionally for a living. Very rarely do you have the luxury of the base plumbing being in the exact right location. In almost every job that I do we move the tub/shower drain.  If you are using an experienced, professional plumber, this is a no brainer. Unless, of course their is a grade issue where he can't get the proper fall. However, if there is an existing drain under the concrete, this is a very unlikely situation. If we are moving plumbing less than 3' we use a jack hammer. if it's more than that, we saw cut. The previous reply is correct about the dust and mess of concrete saws... and it's more expensive (typically). If you are tiling the floor, just ensure that your concrete patch is very level (or just below the concrete grade) and then level quick the patch after the concrete is done. The fact that a jackhammer makes a 'jagged edge' hole is ok if you are installing flooring over it, as long as the patch is level.
For time and costs... my plumber charges $75 per hr for jackhammering (usually doesn't take more than an hour). Labor and time to rebase the drain into the correct location - $200-$350. Concrete patch - Less than $100.
To me its a no brainer... do it the right way, move it and repair the concrete. If your contractor has an issue with that, he may not be a contractor you want to finish this project for you.
Answer: Keeping the costs down for himself might keep your costs down as well.
However, I would generally be dubious about this approach for two reasons - one is having a step up/down at or in the bathroom, which might well cause a fall. Another is lack of headroom in the bathroom - most basements (not all, perhaps yours is a tall one) are already cramped for ceiling height, and a low ceiling is annoying, especially if there is a shower in the bathroom.
It's hard to be definite without considerably more information - there could be an issue with sewer line height that is a additional reason to raise the plumbing, for instance, though that can be managed in other ways - however, they involve pumps and sewage, and when sewage pumps fail (they always do, eventually) it's a stinky mess to deal with.
Concrete saws make a much neater and quicker job than "breaking concrete" (visions of jackhammers) by the way.
Comment: Concrete saws generate huge amounts of dust, and even when water is used, still throw mud all over the place. I would disagree that its neater than just breaking up the concrete. Easier maybe, but definitely not neater.


How can I use two models in my custom component view in Joomla4?

Question: I need to use two models in a view for my custom component in Joomla 4.
I saw this post for Joomla 3, but it seems that there isn't getInstance() in the base Models anymore.
How I could do it ?
Answer: Assuming that the second model that you want to use is in your extension then you can create an instance of the model with the following command. In the example Articles is the name of the name model and will look for class ArticlesModel in your extensions /Model directory while the Site designates where to find the model, eg. Administrator, Site or API.
$model = $this->getMVCFactory()
    ->createModel('Articles', 'Site', ['ignore_request' => true]);

The second param allows you to have single model in the backend of your component and use it in either the Front-end or API of your extension, rather than having to have duplicate models.
If you want to access the Model of another extension then you have to first load or boot the other extension and then create an instance of the Model. This example would allow you to access the Articles model of com_content Front-end.
/** @var \Joomla\Component\Content\Administrator\Extension\ContentComponent $contentComponent */
$contentComponent = Factory::getApplication()->bootComponent('com_content');

/** @var \Joomla\Component\Content\Site\Model\ArticlesModel $model */
$model = $contentComponent->getMVCFactory()
    ->createModel('Articles', 'Site', ['ignore_request' => true]);


PCIM176J panel meter

Question: I scored a couple of panel meters stamped PCIM 176J.  Anyone have a datasheet for this thing? Google found nothing.
Answer: It's probably from the 1980s pre-internet era. A quick Google search finds it is a panel meter made by "Printed Circuits International".
Most such digital panel meters of that era were based on the ICL7106 chip and are fairly standardized. You may have better luck simply looking at the connections and figuring it out. There should be power, analog input and some way of actuating the decimal points.

PCIM176J panel meter


WSO2 claim extention using custom claim handler

Question: How can we add custom claims to the ID token of WSo2.(claims which are stored in the different tables of WSO2 database)?
explanation:
The requirement is to add some additional claim values which are specific to the organizational information of the user(which will be stored in other tables and not in the user attribute table).
how do we write a custom claim handler to do the same?
Answer: You can write a custom claim handler and inject the values from the claim handler. Please follow this documentation to know how to deploy a custom claim handler.
You can find a sample source code here.


Will a 3000/3200 Mhz Sodimm RAM work on my 2933 Mhz Laptop?

Question: I have an Acer Nitro 5 and it has 2 slots of Ram (1 being used). On the task manager it says it's using a  2933 Ghz RAM. I have read somewhere that 2933 is really rare to find (in fact even impossible) in the market and that a 3000/3200 would still work but will be slowed down to 2933. Is that correct? I'm fairly new at hardware stuffs. Thank you!
Answer: That is correct in theory, but I have not tested it myself. But Linus Tech Tips does have a video about mixing memory and his conclusion was that in dual channel mode (2 sticks) it does not matter most of the times.
Video: https://www.youtube.com/watch?v=bTS0ybQ3lCI&


Store view base URL in database?

Question: I have the problem that my main site is not working, while my other store view is working. I have an idea that it might be because the base URL i wrong. Therefore I would like to see the difference between my store views base URLs in the database. How do I find them?
Answer: There are 2 methods to viewing the base url. (if that is what you are looking for)
Easiest: In the backend go to System > Configuration > Web Then click on the Secure/Unsecure URLS and ensure they are correct.
Method 2: You can view them in the database.Open the database you want, view the table 'core_config_database' and you should see two fields web/secure/base_url and web/unsecure/base_url, edit them as you wish but remember the trailing / or they will not work.  Most people use PHPmyAdmin for this but I would suggest locking it to your IP then disabling it once you are done.
Comment: I need to see the base URL for the store views and not the overall base URL :)
Comment: ahh my mistake, this link may be of use then 'http://www.magentocommerce.com/knowledge-base/entry/tutorial-multi-site-multi-domain-setup'

Store view base URL in database?