Dynamic Cast fails on stack variables but not heap, why?
What is object slicing?
How do I use jpnevulator to capture and log the serial traffic between an application and hardware serial port? OK, I've been googling for hours so I obviously have not been able to understand the answers to the various questions that have already been asked about this subject.  I am hoping that, by asking the question again in a more specific way, I will be able to get an answer I can understand.  I have some application running in linux that communicates with an external device attached to a serial port.  I want be able to capture and log the data sent in both directions between the application and the device, with timestamps at the beginning of each line in the file.  As a test case, I am using minicom as the application I want to monitor, connected via a null modem cable to another computer also running minicom.  I have already confirmed that, if I type characters on either of the computers, characters appear in the other computer's terminal.  So far, so good.  I then found this question:    In the answer to this question, the program jpnevulator is suggested.  However, when reviewing the man page, I could not figure out the right way to use jpnevulator to get what I want.  Here is what I tried to do:  First, I opened a terminal window and typed the following command:  $jpnevulator --tty=/dev/ttyS0 --pty --pass --read --ascii --timing-print --file=serial.log   I saw the output:     jpnevulator: slave pts device is /dev/pts/18  I then opened another terminal window and typed the following command:  minicom -D/dev/pts/18 -b115200   Minicom opened without complaint.  However, when I typed characters in either terminal (local and remote), nothing appeared in either terminal.  jpnevulator only logged the data written to /dev/pts/18.  My expectation is that jpnevulator :   reads data from /dev/pts/18 and "passes" this data on to /dev/ttyS0 while also writing this data to the specified file. reads data from /dev/ttyS0 and "passes" this data on to /dev/pts/18 while also writing this data to the specified file.   I am aware of the remark in the faq that says "Jpnevulator was never built to sit in between the kernel and your application. I'm sorry."  However the very same faq states in the second paragraph down: "Now with a little bit of luck some good news: A little while ago Eric Shattow suggested to use pseudo-terminal devices to sit in between the kernel and your application."  That is the approach I am trying to take but I am having no success.  What am I missing?  Thanks to all in advance.  Cheers, Allan  p.s. I was successfully able to capture the back and forth traffic using the socat method mentioned in the existing question I referenced but this method did not offer any way of timestamping the traffic.  I was hoping that jpnevulator would have provided this for me. Here's the context       "Her heart leaping into her throat, she tiptoed into the salon. Such was her astonishment at seeing Mike chatting with her boss that she leaned against the wall, incapable of making another move."   Is this a phrase or what? Could it be used in other forms as well? Possibility of recovering files from a dd zero-filled hard disk I have "zero filled" (complete wiped) an external hard disk using dd, and from what I have heard: people said you should at least "zero fill" 3 times to be sure that the data are really wiped and no one can recover anything.  So I decided to scan the disk once again after I've zero filled the disk. I was expecting the disk to still have some random binary left. It turned out that it has only a few sequential bytes in the very beginning. This is probably the file structure type and other headers stuff. Other than that, it's all zeros and nothing else.  So if we have to recover any file from a zero filled disk, ...how? From what I've heard, even you zero fill the disk, you should still have some data left. ...or could dd really completely annihilate all data? What is the closed form for $\sum_{n=1}^\infty \frac1n - \frac1{n+1/p}$? A while ago, I started to look at expressions of the following form: $$ S_p:=\sum_{n=1}^\infty \frac1n - \frac1{n+1/p}, $$  where $p$ is prime, because otherwise things get too complicated for me at the moment.  What I found so far is the following: $$ S_p= p -\log(2p) - \frac12 \pi \cot\left(\frac\pi p\right) + T_p, $$ where $T_p$ contains $\frac{p-1}2$ terms $t_{p,k}$ of the form:  \begin{cases} \pm 2 \sin\left(\frac{k\pi}{2p}\right) \log\left(\sin\left(\frac{k\pi}{2p}\right)\right) \\ \pm 2 \cos\left(\frac{k\pi}{2p}\right) \log\left(\sin\left(\frac{k\pi}{2p}\right)\right)\\ \pm 2 \sin\left(\frac{k\pi}{2p}\right) \log\left(\cos\left(\frac{k\pi}{2p}\right)\right)  \\ \pm 2 \cos\left(\frac{k\pi}{2p}\right) \log\left(\cos\left(\frac{k\pi}{2p}\right)\right)  \end{cases}   An example can be found .     How does the closed form for $\sum_{n=1}^\infty \frac1n - \frac1{a+n}$ look like? (EDIT: where $a=1/p$) I am looking for a way to concatenate the strings of a field within a group by query. So for example, I have a table:  ID   COMPANY_ID   EMPLOYEE 1    1            Anna 2    1            Bill 3    2            Carol 4    2            Dave   and I wanted to group by company_id to get something like:  COMPANY_ID   EMPLOYEE 1            Anna, Bill 2            Carol, Dave   There is a built-in function in mySQL to do this Query is slow in SQL Server 2014, fast in SQL Server 2012 During the migration of one of our databases from SQL Server 2012 (SP1, CU2) to SQL Server 2014 (SP1), we have experienced some strange issues.  One of the queries that completes within seconds on SQL Server 2012 seem to be hanging on SQL Server 2014.  SELECT  DISTINCT      src.[Id] FROM     [stg].[BaseVolumes] src JOIN          [tmp].[Dates] d ON src.[CalWeek_Nmbr] = d.[CalYrWkDense_Nmbr] WHERE        EXISTS (SELECT  *             FROM                     (SELECT     ctry.[ISOCode]                  AS  [Mkt_Code]                             , so.[Code]                     AS  [SlsOrg_Code_AK]                             , so.[DistributionChannelCode]  AS  [DistChnl_Code_AK]                             , prd.[SupplierCode]                AS  [SKU_Code_AK]                             , cl6.[Code]                        AS  [CstHierLvl06_Code_AK]                             , lp.[BaseDateID]                   AS  [Dte_EK]                  FROM   [PM_APP].[edw].[BaseVolumeDayCurrent]   lp                  JOIN   [PM_APP].[dbo].[Country]                ctry    ON  lp.[CountryID] = ctry.[ID]                  JOIN   [PM_APP].[dbo].[SalesOrganisation]      so      ON  lp.[SalesOrganisationID] = so.[ID]                  JOIN   [PM_APP].[dbo].[Product]                prd     ON  lp.[ProductID] = prd.[ID]                     JOIN   [PM_APP].[dbo].[CustomerLevel6]         cl6     ON  lp.[CustomerID] = cl6.[ID]                  WHERE                        lp.[ModifiedByApp] = 1) lkp             WHERE                    src.[Mkt_Code]                  =   lkp.[Mkt_Code]                 AND src.[SlsOrg_Code_AK]        =   lkp.[SlsOrg_Code_AK]                 AND src.[DistChnl_Code_AK]      =   lkp.[DistChnl_Code_AK]                 AND src.[SKU_Code_AK]           =   lkp.[SKU_Code_AK]                 AND src.[CstHierLvl06_Code_AK]  =   lkp.[CstHierLvl06_Code_AK]                 AND d.[Dte_EK]                  =   lkp.[Dte_EK]         )   Row count:   BaseVolumes:            23108  Dates:                  18628  BaseVolumeDayCurrent:   108115503  Country:                249 SalesOrganisation:      29 Product:                18446 CustomerLevel6:         295   Wait stats showing high CXPacket, but there is one hanging task with SOS_SCHEDULER_YIELD, (print from sys.sysprocesses)   spid | blocked | waittime | lastwaittype          | cpu     | physical_io   76   | 0       | 9886044  | CXPACKET              | 13902   | 31192  76   | 0       | 0        | SOS_SCHEDULER_YIELD   | 9829719 | 83077  76   | 0       | 11248    | CXPACKET              | 11110   | 0 . . .   Attached are the execution plans from SQL Server 2012 and SQL Server 2014.       Any help much appreciated. Let $\{a_n\}$ be an unbounded, strictly increasing sequence of positive real numbers and let $x_k=\frac{a_{k+1}-a_{k}}{a_{k+1}}$. Which of the following statements is/are correct? (CSIR NET December 2014)         For all $n\geq m, \sum\limits^{n}_{k=m}x_k&gt;1-\bf{\frac{a_m}{a_n}}$   There exist $n\geq m, \sum\limits^{n}_{k=m}x_k&gt;\frac{1}{2}$      My attempt:  Analysing question in light of $a_k=k\implies x_k=\frac{k+1-k}{k+1}=\frac1{k+1}$, I feel both are correct, I doubt if  I can generalise the result in light of this one example.   Any way to prove that this true for general case?    Note: Please do not confuse  with my question. The first two options are different, I've marked the difference in bold. How do you post to an iframe? How do you post data to an iframe? I use Lasso logistic regression in order to identify a smaller subset of important variables. I start with N=51 (28/23) and 32 predictors.   So far it looks pretty promising, because I can identify four important predictors in my optimal model.   Now I would like to take those four predictors and examine them along with some control variables in a standard logistic regression.   My question is, does that analysis strategy make sense? Is there a better way to include controls or other variables that might be interesting?  For a better understanding:   Identify important variables via Lasso logistic regression Do further analysis including identified predictors and other control variables using standard logistic regression (using AIC to check model fit) Of course most languages have library functions for this, but suppose I want to do it myself.  Suppose that the float is given like in a C or Java program (except for the 'f' or 'd' suffix), for example "4.2e1", ".42e2" or simply "42". In general, we have the "integer part" before the decimal point, the "fractional part" after the decimal point, and the "exponent". All three are integers.  It is easy to find and process the individual digits, but how do you compose them into a value of type float or double without losing precision?  I'm thinking of multiplying the integer part with 10^n, where n is the number of digits in the fractional part, and then adding the fractional part to the integer part and subtracting n from the exponent. This effectively turns 4.2e1 into 42e0, for example. Then I could use the pow function to compute 10^exponent and multiply the result with the new integer part. The question is, does this method guarantee maximum precision throughout?  Any thoughts on this? Is there a way to unfold a mesh? Is there a way to take a mesh, cut it with seams or sharp edges and flatten it, so that the faces stay the same shape and size?  Making paper models is one aspect, where you could use that technique.  No, I'm afraid SZ0Return is not going to do it properly.  And misusing the UV-unwrap is only a last option.    Note, while it's an option to revert to Blender 2.49 which had a script to do this, I'd like a solution that I can use inside the current workspace. Is it proper usage to replace a comma in a list with a semi-colon in this situation (see details)? While writing a proposal at work today I needed to mention a list of things and within that list were multi-part items. It seems like replacing the comma with a semi-colon in this situation would make the sentence easier to understand, but is it correct usage?  With standard punctuation this could get confusing:       Some of my favorite things to do are   camping, playing football and   baseball, watching Laurel and Hardy   Movies, and traveling.   Proposed alternative. Is this acceptable usage?       Some of my favorite things to do are   camping; playing football and   baseball; watching Laurel and Hardy   Movies; and traveling. Hiding reputation and encouraging thinking time would improve the quality of answers on SO I've only been a member of SO for a couple of months but I must say that the site can be a bit daunting even for an experienced developer.  Part of this is because when users with very high reputations answer questions then it seems that everyone assumes that they have the right answer.  I don't want to go into the self-fulfilling nature of reputation increase for high reputation people.  But I think it is clear that people with high reputation scores get more upvotes () because people assume (usually accurately) that they are correct.    But if reputation was hidden on SO, at least for, say, the first hour after a question is asked then the probability of the best answer being upvoted the most would surely increase.  This might also require the hiding of the names of the answerers if they have very high reps!  As a second method of getting improved answers I would correlate the value of an answer (in terms of reputation gained) with the difficulty of the question.  And the simplest way to do that would be based on the time required for the question to be answered.  So if a question is answered within a minute then it is a 20% question (2 points per upvote), within 2 minutes a 40% question, within 5 minutes a 60% question and so on, on to say a 200% answer (20 points per upvote) on questions that have been hanging around for months.  This would encourage considered answers to new questions and tempt people into reducing the backlog - rather than encouraging people to sit on the 'newest questions' hoping for a gimme.  These two measures would incentivise people to answer the questions that no-one likes the look of and reduce the relative value of answering easy questions. How to choose capacitor for an IC I'm a beginner in electronics from the software industry. With some self-taught things, I'm trying to implement some basic Arduino circuits. My confusion is about capacitors mainly. My understanding about capacitors is that they act as power storage for few seconds or milliseconds.  I found that most IC's must have capacitors connected to their pins.  My confusion is how to find out which pins need a capacitor, and how to find the correct capacitor for a circuit or a capacitor for an IC.  Finally, why are capacitors necessary in a circuit in such situations? Is it correct to omit preposition before date? Eigenvalues and power of a matrix Prove there are no other solutions of functional equation $f(x+y) = \frac{f(x)+f(y)}{1-f(x)f(y)}$ I have the following functional equation. Find all continuous functions $f:(-1,1) \to \mathbb R$ such that $$ f(x+y)=\frac{f(x) + f(y)}{1 - f(x)f(y)} $$ The first obvious solution is $f(x) \equiv 0$. Another one I guessed, it is $f(x) = \pm \tan x$. I suspect, that there are no more solutions. The problem is that I don't know how to prove that.  Since we have a rational equation, I have no idea how to make any substitutions in order to get expression for $\tan x$ (as it is not a rational expression).  P.S. I can also show that it is true that (a) $f(0) = 0$ (take $x=y=0$), and (b) $f(-x) = -f(x)$ (take $y=-x$).  Update: there is a solution of this problem also here: How to shrink Windows 7 boot partition with unmovable files Sneak Damage multiplier: Does it apply to magical damage too? Example:   Dagger 1 = 18 Damage, 25 Shock  Dagger 2 = 33 Damage, no magic  Using the above, when I sneak attack and have the 15x multiple then is the damage caused by Dagger 1 is (18+25)*15 or (18*15)+25 ?  Same question with bows and arrows, does the multiplier apply to potion damage or/and the magical(enchanted)?  In other words, do the multipliers apply to the base damage only or to the final damage being caused by the weapon (base+magical+skill+potion+perks etc)?  I am confused. :-? Consider the integral equation $\phi(x)-\frac{e}{2} \int_{-1}^{1} x e^{t} \phi(t) d t=f(x) .$ Then  there exists a continuous function $f:[-1,1] \rightarrow(0, \infty)$ for which solution exists there exists a continuous function $ f:[-1,1] \rightarrow(-\infty, 0)$ for which solution exists for $f(x)=e^{-x}\left(1-3 x^{2}\right)$, a solution exists for $f(x)=e^{-x}\left(x+x^{3}+x^{5}\right),$ a solution exists  what I tried $f(x)=f(x)+\frac{e}{2} \int_{-1}^{1} x e^{t} \phi(t) d t$ $\phi(x)=f(x)+\frac{e x}{2} \int_{-1}^{1} e^{t} \phi(t) d t$ $ \begin{array}{l}L e t \quad c=\int_{-1}^{1} e^{t} \phi(t) d t \\ \Rightarrow \phi(x)=f(x)+\frac{x e}{2} c\end{array} $ $c=\int_{-1}^{1} e^{t}\left(f(t)+\frac{c e}{2} t\right) d t$ $c=\int_{-1}^{1} e^{t} f(t)+\frac{\operatorname{ce}}{2} \int_{-1}^{1} t e^{t} d t$ $c=\int_{-1}^{1} e^{t}f( t)+\frac{\operatorname{ce}}{2}\left[t e^{t}-e^{t}\right]_{-1}^1$ $c=\int_{-1}^{1} e^{t} f(t)+\frac{c e}{2}\left(2 e^{-1}\right)$ $c=\int_{-1}^{1} e^{t} f(t) d t+c$ $\int_{-1}^{1} e^{t} f(t) d t=0$ Option (3) and (4) satisfies this Relation so, (3) and (4) seems true  to me.is i am right? I am stuck  for option (1) and (2)  is there any result or theorem ?