When to use Common Table Expression (CTE)

Question: I have begun reading about Common Table Expression and cannot think of a use case where I would need to use them. They would seem to be redundant as the same can be done with derived tables. Is there something I am missing or not understanding well? Can someone give me a simple example of limitations with regular select, derived or temp table queries to make the case of CTE? Any simple examples would be highly appreciated.
Answer: One example, if you need to reference/join the same data set multiple times you can do so by defining a CTE. Therefore, it can be a form of code re-use.
An example of self referencing is recursion: Recursive Queries Using CTE
For exciting Microsoft definitions
Taken from Books Online:
A CTE can be used to:

Create a recursive query. For more information, see Recursive Queries Using Common Table Expressions.
Substitute for a view when the general use of a view is not required; that is, you do not have to store the definition in metadata.
Enable grouping by a column that is derived from a scalar subselect, or a function that is either not deterministic or has external access.
Reference the resulting table multiple times in the same statement.
Comment: Yep. You can't self join a derived table. Worth making the point that a self join on a CTE will still leave you with 2 separate invocations of it though.
Comment: Interesting fact about CTE. I always wondered why NEWID() in the CTE changes when the CTE is referenced more than once. `select top 100 * into #tmp from master..spt_values order by 1,2,3,4 select A.number, COUNT(*) from #tmp A inner join #tmp B ON A.number =  B.number+1 group by A.number` vs `with CTE AS (select top 100 * from master..spt_values order by 1,2,3,4) select A.number, COUNT(*) from CTE A inner join CTE B ON A.number = B.number+1 group by A.number`
Comment: @cyberkiwi - Which bit? That a self join will lead to 2 different invocations? See the example in this answer http://stackoverflow.com/questions/3362043/sql-server-row-present-in-one-query-missing-in-another/3362307#3362307
Comment: @Martin - I am surprised. Can you back up that statement?
Comment: @John Thanks, I am finding http://www.4guysfromrolla.com/webtech/071906-1.shtml quite useful too
Answer: I use them to break up complex queries, especially complex joins and sub-queries. I find I'm using them more and more as 'pseudo-views' to help me get my head around the intent of the query.
My only complaint about them is they cannot be re-used. For example, I may have a stored proc with two update statements that could use the same CTE. But the 'scope' of the CTE is the first query only.
Trouble is, 'simple examples' probably don't really need CTE's!
Still, very handy.
Comment: "My only complaint about them is they cannot be re-used" -- a CTE that you want to re-use should be considered a candidate for a `VIEW` :)
Comment: @onedaywhen: Understood, but that implies a global-scope I'm not always comfortable with. Sometimes within the scope of a proc I'd like to define a CTE and use it for selects and updates, or selects of similar data from different tables.
Comment: When I need the same CTE more than once, I feed it into a temporary table and then use the temporary table as much as I want.
Comment: ok. Can you make case with some relatively complex example that can help my head around this concept?
Answer: There are two reasons I see to use cte's.
To use a calculated value in the where clause. This seems a little cleaner to me than a derived table.
Suppose there are two tables - Questions and Answers joined together by Questions.ID = Answers.Question_Id (and quiz id)
WITH CTE AS
(
    Select Question_Text,
           (SELECT Count(*) FROM Answers A WHERE A.Question_ID = Q.ID) AS Number_Of_Answers
    FROM Questions Q
)
SELECT * FROM CTE
WHERE Number_Of_Answers > 0

Here's another example where I want to get a list of questions and answers. I want the Answers to be grouped with the questions in the results.
WITH cte AS
(
    SELECT [Quiz_ID]
      ,[ID] AS Question_Id
      ,null AS Answer_Id
          ,[Question_Text]
          ,null AS Answer
          ,1 AS Is_Question
    FROM [Questions]

    UNION ALL

    SELECT Q.[Quiz_ID]
      ,[Question_ID]
      ,A.[ID] AS  Answer_Id
      ,Q.Question_Text
          ,[Answer]
          ,0 AS Is_Question
        FROM [Answers] A INNER JOIN [Questions] Q ON Q.Quiz_ID = A.Quiz_ID AND Q.Id = A.Question_Id
)
SELECT
    Quiz_Id,
    Question_Id,
    Is_Question,
    (CASE WHEN Answer IS NULL THEN Question_Text ELSE Answer END) as Name
FROM cte
GROUP BY Quiz_Id, Question_Id, Answer_id, Question_Text, Answer, Is_Question
order by Quiz_Id, Question_Id, Is_Question Desc, Name

Comment: Can't your first example be simplified down to just use a nested query instead of the CTE?
Comment: You should've added the first one without the CTE, then it's immediately apparent why is the latter useful.
Comment: Both examples could be.
Comment: `HAVING` is another way to do a late-stage filter which can be similar to using a sub-`SELECT`
Answer: One of the scenarios I found useful to use CTE is when you want to get DISTINCT rows of data based on one or more columns but return all columns in the table. With a standard query you might first have to dump the distinct values into a temp table and then try to join them back to the original table to retrieve the rest of the columns or you might write an extremely complex partition query that can return the results in one run but in most likelihood, it will be unreadable and cause performance issue.
But by using CTE (as answered by Tim Schmelter on Select the first instance of a record)
WITH CTE AS(
    SELECT myTable.*
    , RN = ROW_NUMBER()OVER(PARTITION BY patientID ORDER BY ID)
    FROM myTable
)
SELECT * FROM CTE
WHERE RN = 1

As you can see, this is much easier to read and maintain. And in comparison to other queries, is much better at performance.
Answer: Perhaps its more meaningful to think of a CTE as a substitute for a view used for a single query. But doesn't require the overhead, metadata, or persistence of a formal view. Very useful when you need to:

Create a recursive query.
Use the CTE's resultset more than once in your query.
Promote clarity in your query by reducing large chunks of identical subqueries.
Enable grouping by a column derived in the CTE's resultset

Here's a cut-and-paste example to play with:
WITH [cte_example] AS (
SELECT 1 AS [myNum], 'a num' as [label]
UNION ALL
SELECT [myNum]+1,[label]
FROM [cte_example]
WHERE [myNum] <=  10
)
SELECT * FROM [cte_example]
UNION
SELECT SUM([myNum]), 'sum_all' FROM [cte_example]
UNION
SELECT SUM([myNum]), 'sum_odd' FROM [cte_example] WHERE [myNum] % 2 = 1
UNION
SELECT SUM([myNum]), 'sum_even' FROM [cte_example] WHERE [myNum] % 2 = 0;

Enjoy
Answer: Today we are going to learn about Common table expression that is a new feature which was introduced in SQL server 2005  and available in later versions as well.
Common table Expression :- Common table expression can be defined as a temporary result set or in other words its a substitute of views in SQL Server. Common table expression is only valid in the batch of statement where it was defined and cannot be used in other sessions.
Syntax of declaring CTE(Common table expression) :-
with [Name of CTE]
as
(
Body of common table expression
)

Lets take an example :-
CREATE TABLE Employee([EID] [int] IDENTITY(10,5) NOT NULL,[Name] [varchar](50) NULL)

insert into Employee(Name) values('Neeraj')
insert into Employee(Name) values('dheeraj')
insert into Employee(Name) values('shayam')
insert into Employee(Name) values('vikas')
insert into Employee(Name) values('raj')

CREATE TABLE DEPT(EID INT,DEPTNAME VARCHAR(100))
insert into dept values(10,'IT')
insert into dept values(15,'Finance')
insert into dept values(20,'Admin')
insert into dept values(25,'HR')
insert into dept values(10,'Payroll')

I have created two tables employee and Dept and inserted 5 rows in each table. Now I would like to join these tables and create a temporary result set to use it further.
With CTE_Example(EID,Name,DeptName)
as
(
select Employee.EID,Name,DeptName from Employee
inner join DEPT on Employee.EID =DEPT.EID
)
select * from CTE_Example

Lets take each line of the statement one by one and understand.
To define CTE we write "with" clause, then we give a name to the table expression, here I have given name as "CTE_Example"
Then we write "As" and enclose our code in two brackets (---),  we can join multiple tables in the enclosed brackets.
In the last line, I have used "Select * from CTE_Example" , we are referring the Common table expression in the last line of code, So we can say that Its like a view, where we are defining and using the view in a single batch and CTE is not stored in the database as an permanent object. But it behaves like a view. we can perform delete and update statement on CTE and that will have direct impact on the referenced table those are being used in CTE. Lets take an example to understand this fact.
With CTE_Example(EID,DeptName)
as
(
select EID,DeptName from DEPT
)
delete from CTE_Example where EID=10 and DeptName ='Payroll'

In the above statement we are deleting a row from CTE_Example and it will delete the data from the referenced table "DEPT" that is being used in the CTE.
Comment: I still don't get the point. What's the difference between this and just deleting from DEPT with exactly the same condition? It doesn't seem to make anything easier.
Comment: Please correct me if I'm wrong, but the execution plan may be different, and I think that is Neeraj's point, that there are many ways to achieve the same objective, but some will have advantages over others depending on the situation. For instance, it might be easier to read a CTE over a DELETE FROM statement in some circumstances, also the reverse might be true in others. Performance might improve or worsen. etc.
Answer: It is very useful when you want to perform an "ordered update".
MS SQL does not allow you to use ORDER BY with UPDATE, but with help of CTE you can do it that way:
WITH cte AS
(
    SELECT TOP(5000) message_compressed, message, exception_compressed, exception
    FROM logs
    WHERE Id >= 5519694
    ORDER BY Id
)
UPDATE  cte
SET     message_compressed = COMPRESS(message), exception_compressed = COMPRESS(exception)

Look here for more info: How to update and order by using ms sql
Answer: One point not pointed out yet, is the speed. I know it's an old answered question, but I think this deserves direct comment/answer:

They would seem to be redundant as the same can be done with derived tables

When I used CTE the very first time I was absolutely stunned by it's speed. It was a case like from a textbook, very suitable for CTE, but in all ocurences I ever used CTE, there was a significant speed gain. My first query was complex with derived tables, taking long minutes to execute. With CTE it took fractions of seconds and left me shocked, that it is even possible.
Answer:  ;with cte as
  (
  Select Department, Max(salary) as MaxSalary
  from test
  group by department
  )
  select t.* from test t join cte c on c.department=t.department
  where t.salary=c.MaxSalary;

try this


Can proroguing Parliament have any practical effect on Brexit?

Question: Boris Johnson's advice to the Queen to prorogue Parliament has certainly generated opposition, but I am curious whether that action will have any practical implications. If Parliament hasn't come to a satisfactory conclusion about Brexit in the last three years, will three weeks really make a difference? Moreover, it seems that the MPs would still be free to speak to one another about proposed legislation, which they could then introduce when Parliament reconvenes. Or does the prorogation introduce procedural obstacles to introducing new legislation once the Parliament reconvenes? (Is anything now that possible, that would have been possible beforehand?)
Comment: These may be of interest: https://publiclawforeveryone.com/2019/01/16/why-on-earth-didnt-parliament-take-control-when-it-had-the-chance/ and https://publiclawforeveryone.com/2019/08/08/can-parliament-prevent-a-no-deal-brexit/
Answer: The government is responsible for negotiating the UK's exit from the EU (or cancelling it), so the idea Parliament could come to some kind of conclusion is really a distortion of the truth used by politicians trying to justify their actions. Parliament can only agree or reject a proposal that the government presents to it (a deal or no-deal), or pass a motion of no confidence in the government.
Parliament can however pass legislation to control the process of leaving the EU, such as by requiring the government to ask for an extension to avoid no-deal. The prorogation makes it harder to Parliament to do that. There is only 4 guaranteed days in September (starting from 03/09/2019, Parliament does not usually sit on Friday or weekends, and Tuesday the 10th is the earliest date for the start of prorogation) and perhaps 4-6 more in October for Parliament to pass legislation on this issue.
Note also that usually Parliament is not prorogued for the conference season, it is simply on recess. The crucial difference is that parliamentary services are still available, such as requesting documents and holding committees. Suspension also does not cancel any pending legislation that has not been completed, where as proroguing does. So if MPs fail to get legislation completed in September they can't finish it in October, they have to start from scratch only days away from brexit.
Comment: "Suspending" is commonly used as a synonym for "proroguing" (regardless of whether that's accurate), so it may avoid ambiguity to use a different word. Parliament refers to non-prorogue breaks as [recesses](https://www.parliament.uk/about/faqs/house-of-commons-faqs/business-faq-page/recess-dates/).
Comment: "Parliament can only agree or reject a proposal". Parliament can also oust the PM in response to a proposal.
Comment: @MSalters or lack of a proposal
Comment: @MSalters that's a good point, I'll add it.
Answer: Yes. Part of what parliament have been doing is trying to force the Executive to not do what parliment doesn't want without actually letting them do anything. (I.e. Try to force an extension, meaningful vote etc, but voting against every single option of action.) This is probably due to the fact a significant proportion of parliament just want the blame to devolve on someone else. A course of action which forced them to 'put up or shut up' is bad for this group in particular, and  since the result for many of the prevaricaters would be 'shut up' a side effect is that it's also bad for those MPs who actively seek a different solution to the one the executive is persuing.
Answer: Any parliamentary action on the Brexit process has to go through the legislative process.  The representative of the UK for the Brexit process is the government.  When the government is toppled through a vote of distrust, any elections for a new government will happen after the Brexit date.
Now there are three possible solutions for the EU/UK customs border which have to follow a Brexit:
a) None until something better has been developed and implemented.  That's the backstop.
b) The Irish Sea.  That solution was proposed by EU and accepted by May but rejected by the DUP as it would move Northern Ireland closer to Ireland.
c) The inner-Irish border.  It would be a violation of the Good Friday treaty and likely cause renewed unrests.  Nobody wants that but it would be the obvious consequence of the No Deal Brexit.  Johnson claims that he wants to use the threat of a No Deal for forcing the EU to accept a different deal.
Now assuming that Johnson is talking the truth when wanting to use the very little remaining time to enact a different deal with the EU, the only actual way to do so is option b).  Since it would throw the DUP under the bus, Johnson has to make sure that he'll keep his mandate for finishing the Brexit process even when the government breaks apart.
Prorogueing the parliament until it cannot stop Johnson from concluding the Brexit process would make sure that Johnson has the ability to tell the EU "it's either this previous deal you agreed to or a No Deal Brexit" and get this under wraps either way.  Whether or not the EU agrees to stomp over parliament and the current government coalition, he will likely have a strong standing for his next election.
Of course this theory could also explain why nobody in the EU has so far heard of any proposal by Johnson: he needs to be in a situation where he can no longer be stopped even by the DUP before making such a pitch.
Prorogueing parliament will indeed give him, as he claims, the time to negotiate such a government-breaking deal and, more importantly, implement it because there would not be time or opportunity to stop it.  When the EU clearly has only the options to accept what they had previously proposed themselves or no deal at all, there will be some likelihood that they decide for the former as the lesser evil.


How to get a 2-year old Husky/Shepherd mix to stop piddling when he's excited?

Question: My daughter is moving back in to save some money, and she currently has a 2-year old Husky/Shepherd mix. He is constantly piddling when he gets excited. I am not familiar with these breeds, nor have I ever had a dog with this much energy.  I'm looking for ideas on the best way to train him to stop peeing when excited.
Answer: Many dogs, especially puppies, urinate when they are very excited - either positively excited by the return of a loved one or negatively excited by a reprimand or fight for dominance. This behavior is called submissive urinating.
It's important to understand that this behavior is a dog's way of saying "I want to be your friend, I'll accept you as the higher ranking individual without opposing or fighting you". Even if the dog pees right on your shoes, you must not become angry and reprimand him for this gesture that is really submissive and a precautious peace offering. The dog doesn't do it to annoy you, so please don't be annoyed.
There's a very good article by WebMD that lists several possible causes and ways to train a dog not to do it. First rule out any medical reasons like urinary tract infection.

What to Do About Submissive Urination

If possible, greet your dog outside.
Toss a handful of small treats or a few favorite toys in the direction of your dog as he runs up to greet you.
Ignore your dog when you first come home and walk through the door. Wait until he has completely calmed down before interacting with him. When you finally greet your dog, do so calmly. Look off to the side instead of straight at him. Sit on the floor or squat down—and avoid looming over your dog as you bend toward him.
Teach your dog to perform a behavior, such as sit, when he greets people. First, practice the sit behavior outside of the greeting context, in a calm place, without other people around. To learn more about teaching your dog to sit, please see our article, Teaching Your Dog to Sit.
When you pet your dog, touch him under the chin or chest, rather than on top of his head or ears.
Keep play sessions with your dog low-key and play games with him that focus on toys rather than bodily contact.
If you need help, don't hesitate to contact a Certified Professional Dog Trainer (CPDT) or a Certified Applied Animal Behaviorist (CAAB) for assistance. To find one of these qualified experts in your area, please see our article, Finding Professional Help.

What NOT to Do

Do not look at your dog, touch him, bend over him or speak to him if he starts to submissively urinate or if you think he might.
Do not hug your dog or pat him on the top of the head when greeting or interacting with him.
Do not scowl or frown at your dog, especially in response to submissive urination. You should even avoid making frustrated comments, as doing so might make the behavior worse.
DO NOT VERBALLY SCOLD YOUR DOG OR PUNISH YOUR DOG IN ANY WAY. Scolding and punishment are likely to make the problem worse. The more you yell at your dog, the more he'll feel motivated to submissively urinate in an attempt to make you less angry.
Answer: On top of submissive urinating, it's critical that Husky has a fixed, stable routine. They are the Top Dog when it comes to bending the rules, constantly pushing the boundaries and looking at you with a galaxy full of guilt.
I walk my Husky 5 times a day. A -50 °F (-46 °C) blizzard is not an excuse to stay inside.
Sometimes, she needs to go more often, so she stands against the wall in front of me, signaling me, she needs to go (outside of the 4-hour interval).
It's important those signals are acknowledged, otherwise they quickly learn it won't help them and go straight to peeing.
However, peeing is merely cosmetic problem. Huskies are, primarily, a danger to themselves:

I hope you already know that they have genetically evolved to have a horrible recall (Chukchi only took care of them for half a year. They other half, they had to fend for themselves - so they had to be constantly aware of their surroundings and potential food).

Do not let him off leash unless it's an enclosed area which is husky-proof.

Regular metal fence will be climbed without any trouble whatsoever in a matter of seconds.

Fences 6' (1.8 m) short will be jumped over.

Fences higher than 6' will be dug under.

Do not tie it out on long leash outside. A rouge leaf falling off the tree might trigger the prey drive and it might break its own neck trying to catch the offensive leaf.

When walking, I realized it's much less work to put my whole hand through the leash, so it's locked above my elbow (instead of trying to hold it with your hand). Then you can use the strength of your whole upper body (and back and shoulder) to hold Husky should its prey drive kick in. Which it will.

As far as the energy expenditure, the best thing for a Husky is a daily run around the Doggie park. 90 minutes are enough for most. If that's not available, then it's possible to do exercise inside. I rotate between the following:

squeaking ball - I kick it high, she jumps and tries to catch it mid-air. She then throws it from her mouth towards me. Rinse and repeat for 30 minutes. Remove any furniture and electronics from the room.
I crouch on my knees and try to touch her paws (just don't actually grab them - she would pull back at full force and could hurt herself) - she will jump left/right constantly trying to avoid being caught, expending great deal of kinetic energy.
when she's in playful mood (that happens only when she doesn't sleep), I flip her 360 degrees while she's lying on her back. They're a bit heavy, so this might not be easy in the beginning, but she loves being flipped constantly like on a merry-go-round.
chase the Husky. We literally do it every single day. She never gets tired of it. From one room to another. Careful with their forward momentum. I'm 6'3" (191 cm) but she knocked me out few times. Getting hit by their leg feels like being hit with a baseball bat, at that speed. Including bruises or deep scratches (imagine their nails pushing against your foot at full speed - it will go through :) ).

Most importantly, and this happens roughly every other day, during chase she suddenly flips a switch and starts running around like crazy - just by herself - at super high-speed. She will tire herself within 2-3 minutes and literally knock herself off to sleep. Give her belly rubs and she will fall asleep like a baby in 30 seconds.
And just like baby, in 2 hours she will be up for round two...


content type view into hidden region

Question: I would like to create and display content type in a hidden region. The only reason to hide the region is to prevent moving the location. It is for flash file header banner that will be changed by a user by adding or modifying the content type. If it must be a block, then I suppose it doesn't much matter if the region is visible or not. Any suggestions?
Answer: If I understand correctly what you want to achieve, you could also try the Boxes module or even Panels and Panels Everywhere.
Comment: @Laxman13 - Thanks, will look at the box, but it relies on regions, much like a block, so I need to see what they mean by: "place it in a region and click 'configure' next to the box name to restrict where it shows up"

Panels, is something I thought about, though in my dev team here there is reluctance to go that route for anything with folk comparing it to the old "frames" concept. Go figure!

As things get closer, I will see how to populate a hidden region, but thus far, it seems to be module driven and not content type/views driven.
Answer: If you're comfortable in code, you may find it easier to add the flash banner in hook_preprocess_page, that way it isn't exposed to blocks admin.
e.g, template.php
function THEMENAME_preprocess_page(&$vars){
  $flash_embed_code = ''; // TODO, get flash embed code.
  $vars['flash_banner'] = $flash_embed_code;
}

Then, in page.tpl.php
if (!empty($flash_banner)) { print $flash_banner; }

content type view into hidden region


xperia SP cant move apps to sd

Question: currently i have xperia SP c5303 which is i know an outdated device but cannot change to a new phone at the moment... so the problem here is internal memory is too small and i need to move them to sd card... i've installed appMgr III and it says that the device doesn't enable users moving apps to the sd card. do note that i already root my device... the apps also tells that the manufacture had removed the function of moving apps to sd card... can I overcome this problem and change the manufacture settings? help me please because i've searched the available method but had not found one yet...
Comment: What version of Android do you have?  Are you rooted?  Have you tried link2sd?
Answer: It is not possible to move apps to SD Memory card although the device is rooted. There are workarounds for swapping internal memory and external memory but it seems to be temporary (maybe until the next boot up I think). Flashing a custom rom is recommended from my side. Visit xdadevelopers website and find your device thread for more details.

xperia SP cant move apps to sd


Updates folder and primary folder are exactly the same. Also, more types of messages of messages going straight to primary folder

Question: So this "updates" folder recently appeared, and I tried to filter a lot of messages into it, but it only works for a second before all of those types of messages go back into "primary". I'm irritated because recently more types of messages (like political ones I subscribe to or Pinterest things) are going straight to my primary folder. What do I do?
Answer: Try selecting the unwanted emails in your primary folder and dragging them to the updates folder. Gmail will send any other emails from the same sender into the updates folder and similar emails will also end up in the updates folder.


Import product with media/catalog/product folder

Question: We have 2 servers. Some changes made in the product name, category changes and custom_options in the first server.  So we need to import the products with images in the second server which is exported from the first server.  How to do products import with media/catalog/product folder images in magento import?
Comment: Could you explain a bit more what you want to achieve, because right now I don't understand why not use mysqldump / mysql load and scp of images from one server to another.
Answer: I think this is still a mess in magento. Especially because you don't want to loose the FKs on the order items, this means you can't import/export and have somehow to override the settings in the database.
What you can try (offline and localy first!) is to dump all the catalog_* tables, set magento in maintenance mode (create a maintenance.flag in root) and then write the dump back to the server.
IF the server is a copy of the old database. If they only have the same data but not the same IDs I think you are lost and the only way is to copy it over by hand, because implementing a script which does it costs more time.


Do new users actually read the rules

Question: I know when I first joined I didn't. It left me helpless, and I ended up going through 3 question bans. I have been trying to do better since, and have noticed the decrease in quality all the long time users mention around here. Question bans seem to happen a lot faster. Do the new users actually read the rules, or do they typically skip them?
Comment: No.
Comment: After which question ban did you finally break down and read the posting guidelines?
Comment: I'm voting to close this as a purely opinion-based question. There's no way anyone here can know if new users **read** the rules - logs could be analyzed to see what percentage follow links to get to them, but you can't tell they *read* them. At the very best, it could be considered a polling question that attracts a lot of "I did" and "I didn't when I joined", and that has no usefulness here.
Comment: 2 or 3 I can't remember. I know I got banned at number 3  because I was in a  serious rush and made a stupid mistake posting a question that only was missing a semicolon.
Comment: Also, I see a lot of user rage quit after their first bad question :P
Comment: I'm not trying to say that I'm perfect, I'm just wondering if the reason for these problems may be related to not reading the rules.
Comment: Yes, I think that it is. Stack Overflow has stricter rules than most Q&A sites, so people often come here and just post whatever is on their minds. It seems that as people get more accustomed to the "rules" of posting on the wide-open web, they're less likely to lurk for a time than they used to be.
Comment: Probably. It was probably very soon after my second, so I was recovering from that
Comment: I think I read (or at least skimmed) the rules before posting my first question, but I can't remember. Out of curiosity, why didn't you read the rules?
Comment: I'm voting to close this because I don't see how it can possibly be answered definitively or constructively by Meta users.
Comment: New users could answer.
Answer: No.
Stack Overflow has ~ 3.94M users. There is a badge for scrolling through the tour page - Informed.

Awarded 320703 times

Quick math shows that it 8% of the users. The tour page is presented at sign up. If only 8% of the users can make it through there, I imagine someone sitting through the full set of documentation in the help center is incredibly rare.
Comment: @Andy and your 8% doesn't count the users that just opened the tour, scrolled to the bottom for the badge, and closed the page.
Comment: Users that had already a banned account probably don't bother reading the rules again. I think that the badge count isn't a reliable way to determine how many new users read the rules.
Comment: I can confess, I had been a member for over 2 years before I went to the tour page and got that badge. But I had read what to ask, how to answer etc pages, which doesn't give the badge. But I'm not saying most of the users without the informed badge would do the same. Most definitely not.

Do new users actually read the rules


Equivalent linux command of "net start" command in windows

Question: On Windows a command like net start mysql will try to start the MySQL service. I am looking for equivalent Linux command to do that - to change the status of services through Linux commands.
Comment: It depends somewhat on what distro you're using.  Many use the scripts in `/etc/rc.d`, but Ubuntu encourages you to use `service`.
Answer: A lot of linux'es support the service command
service mysql.server start

This is related to chkconfig
[root@iceweasel init.d]# chkconfig --list mysql.server

Note: This output shows SysV services only and does not include native
      systemd services. SysV configuration data might be overridden by native
      systemd configuration.

mysql.server    0:off   1:off   2:on    3:on    4:on    5:on    6:off

Otherwise you can do it the old fashioned way
cd /etc/init.d
./mysql.server start

Comment: init.d/rc.d depends on the distro.
Comment: @Andrew totally - can you remember/know some distro's that still use the /etc/rc.d style and I'll list them and I will add them to my answer with accreditation.
Answer: Your "service" scripts are all stored in /etc/init.d, so the normal way is to use sudo /etc/init.d/mysqld start (or whatever service you want to start). Modern Linux distributions have the service command which does a similar thing, so also try service mysqld start.
Answer: Usually Linux distros have an rc script; for example:
/etc/rc.d/apache2 restart | stop
/etc/rc.d/mysqld start | stop


How to make user sign up and login on my decentralized application?(on production it should work without metamask)

Question: Assuming that user who is going to signup is not having any ethereum account so how can I generate a public, private key and address for ethereum and make use of it to make further transactions.
Users of my portal are not expected to have one ethereum account.
Answer: You can use https://github.com/ethereumjs/ethereumjs-wallet to create locally in JavaScript an Ethereum wallet. You can store this wallet to a encrypted file. Your user logs in into the application by locally uploading this file and providing the password for the encryption of the keystore.
See "How should I secure a private key in my dapp?" for more examples how you can implement the login to your DAPP.


Can a Savannah monitor see red light?

Question: Many reptiles, especially snakes, don't see red light.  However, some see more than humans, such as bearded dragons who have yellow specific color receptors.  What colors do Savannah monitors see?
Comment: I don't have time to investigate and write a full answer right now, but I was under the impression that the "reptiles can't see red light" thing was a myth.
Answer: Yes, monitor lizards can see red light. So can snakes, and other lizards, and birds, and turtles, and most mammals. However, not all of these animals can distinguish between what we would perceive as red and green light.
Now for a little background. Light is a spectrum, and neither humans nor any other animals can perceive the entire spectrum. Instead we have different receptors in our eyes that respond to different parts of that spectrum. Humans have three color receptors: what we call red, green, and blue. But since these receptors overlap quite a bit, you can't tell the whole spectrum just from what color you see. Something that looks yellow to you could be a mix of 550nm (green) and 600nm (red) light or a true 575nm (yellow) light.
What this means is that even if you didn't have a red receptor, you would still be able to see red light, but you would have a harder time distinguishing between what we would call red, green, and yellow.
Most mammals have two color receptors: blue and yellow.
Most reptiles, birds, and amphibians have four distinct color receptors, which vary a bit between species, but more or less correspond to what we would call violet, blue, teal, and yellow.
So, your monitor lizard can see red light (with their yellow receptor), but would have a hard time distinguishing it from yellow and green.
Answer: According to Professor Sam Sweet, "(savannah) Monitors are also specialized compared to other lizards in having acute long-distance (color) vision, sensitive hearing, and very well-developed senses of smell and tongue-based vomeronasal organ..."
It seems that savannah's have the entire color spectrum available to them.
Comment: I'm not sure I read that conclusion into the statement. Lizards can see color, that's known, but the pigmentation is typically blue and green which means that they see into that part of the spectrum but that doesn't translate to vision into the other side of it.

Can a Savannah monitor see red light?


What happens if I don't have enough space for the remaining resources from the season pass?

Question: I don't have the storage for my Dark Elixir from the clan pass. How do I burn Dark Elixir when I have Town Hall 7?
Answer: I am a TH9 CoC player, and I got confused also the first time when I saw the overflowing Season Bank Loot. But the thing is that the EXTRA loot still stays. Like your Storage of Gold is 4,000,000 and you have 3,000,000. Your season bank is 5,000,000. So you then have 8,000,000 gold even if your storage is only half the cash. But when it becomes 7,999,999 gold, it's not becoming 8,000,000 again.
Comment: As it's currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer).
Answer: I suggest you make armies that are almost 100% made of dark elixir troops.
You can also upgrade your hero.
As well as upgrading your dark elixir storage.
Continue doing so until you have enough space for your dark elixir.
Good luck!
Answer: It will fill the empty storage, and any remaining that you earn will fill it again as space frees up. After that, you can't collect more Dark Elixir from the Drills.
If you aren't sure about how to spend the dark elixir, just rush your TH to Level 9 where you need a lot of dark elixirs to upgrade your heroes alone.

What happens if I don’t have enough space for the remaining resources from the season pass?


Tootsie Roll Flavor

Question: Tootsie rolls dont quite taste like chocolate. They have a "cocoa" and "subtle fruit flavor" according to their website. What are the fruit flavors that makes them so unique? I've seen orange extract listed for homemade versions but that doesn't seem quite right.
Comment: No, they don't taste at all like chocolate to me. Years ago, wondering why I hate the taste of Tootsie Rolls so much, I read the ingredients. At that time, they listed molasses. That explained it perfectly at that time.... Don't know about now.
Comment: For whoever voted to close -- "What are the fruit flavors that makes them so unique?" is not opinion based.  Now, if we were trying to describe the flavor of wine, *that* would be opinion based.  ("stone fruit with vanilla and a touch of pepper" ... wtf?)
Comment: Are you sure you aren't seeing the flavorings for the fruit flavored tootsie rolls? https://www.amazon.com/Tootsie-Fruit-Rolls-Assorted-Flavors/dp/B000Q6R05G These are not chocolate flavored at all.
Comment: @Catija no Im not making that mistake
Comment: this question belongs on Philosophy SE.  Rilly.  The taste of an orange is natural.  The taste of a tootsie-roll is *sui generis* and man-made.  and sublime.  see also "Nutella" and "Marmie".
Comment: marmite,  not marmie.
Answer: Tootsie rolls are taffy (sugar boiled with butter/oil, a lot like caramel but lighter in texture) flavored with cocoa powder and "natural and artificial flavorings".
It gets a light chocolate flavor from the cocoa powder. The flavorings are a trade secret which probably does include some sort of citrus flavor, among many others.

Tootsie Roll Flavor


throw exception from a JSP

Question: Is it possible to throw an exception in a JSP without using scriptlet code?
Answer: You really shouldn't be doing anything at the JSP layer that explicitly throws exceptions.  The reason you don't want to use scriptlets in JSPs is because that puts application logic in your view.  Throwing an exception is inherently application logic, so it doesn't belong in your JSP, scriptlet or not.
Answer: You can throw an exception if you do this:
<c:out value="${1/0}" />

or something that is similarly "illegal"
Ideally though, since JSPs are associated with the view...you don't want to throw an exception. You want to catch them with <c:catch>
Answer: You could have a bean with a getter method that throw the code, then have the JSP access the bean property. I'm not sure that'd be an actual improvement over a scriptlet.

throw exception from a JSP


Media Transferred via WhatsApp

Question: I would like to know when I get a photo or a song transferred via whatsapp where is it stored on the device.
Answer: From the Windows Phone WhatsApp app, you can only send messages, pictures from the pictures hub, audio notes and videos you have taken from the WhatsApp app. There is no option to send a song (and I'm not sure if you can receive one unless its recorded using the audio note option in the app).
Having said that, to access any file (picture, audio or video) sent or received, go into the chat thread > tap the ellipsis <code>...</code> > tap info > swipe the screen horizontally. All the files sent by a contact will be stored there.
For picture files, if you long press the file in whatsapp, you'll get an option to save. If used, the picture file will be saved to your pictures hub > albums > 'saved pictures' album. Audio and video files do not have an option to explicitly save them.
Comment: @user5220, please what is the gallery that you are talking about?
Comment: I have sent the audio to myself on WhatsApp. After doing so I was able to view it in the gallery.
Answer: Actually such audio and video files are saved on phone but there is no direct way to access them. However you can use a file manager app to list them out. I am using Lumia 535 (WP-8.1,RM-1090) and I can access all my audio/video files via a file manager app namely Metro File Manager. I can access all the media which I have downloaded from Whatsapp via path Phone\Pictures\WhatsApp. It is worth to note that although the folder is located in Pictures, it will hold all types of media shared via WhatsApp.

Media Transferred via WhatsApp


When do you get disconnected from your current game in diablo 3?

Question: When you go afk while in a game you'll get disconnected after some time. My question is how long is this time, and does it affect the time it needs to disconnect you if you either let the game run as it is, or pause it by pressing escape?
Answer: I did some research, and experimenting within my own game, and found out the following. I am not 100% sure of the accuracy of all of the above, it's to the best of my knowledge.
Multiplayer

There is no disconnect timer.

Singleplayer

There is a 30 minute disconnect timer.
The timer is in effect in towns.
The timer is in effect out of towns.
The timer is in effect when unpaused.
The timer is in effect when not paused.
This mechanic has been complained about extensively, and might be changed in the future.

Most of the information I found can be found here: http://us.battle.net/d3/en/forum/topic/5890100171
As well as here: http://us.battle.net/d3/en/forum/topic/7004458323
Answer: Just tested it, you get disconnected after 30 minutes.


Pokemon damage multiplied

Question: When a pokemon card says 20x the number of energy do you do 20 damage if there is no energy on a pokemon or would it be zero? Mewtwo for example, is it 20 plus the number of energies?
Comment: Isn't it obvious already? Times is different than plus. And, mewtwo also requires 2 colorless energy for x ball. so, it always has a minimum of 40 damage, before applying any additional effect.
Comment: Maybe it's obvious to people who play Pokemon, but... what is the card you're asking about?
Comment: If your attacking pokemon don't have any energy attached to it, you just can't attack. If the pokemon you're attacking don't have any energy attached to it, then it would be just 0 or no effect.
Answer: Let's say you talk about this Mewtwo : http://pokeplayer.com/cardex/next_destinies/98-mewtwo-ex
If Mewtwo has 2 energies and the Defending Pokémon has 0 energies, that would do 20 × 2 = 40 damage.
If for a weird reason you were able to use X Ball without having any energy attached, and 0 energies on the Defending Pokémon, that would do 20 × 0 = 0 damage.
Answer: Well, you shouldn't be able to, since it would cost energy to do so, but if you were to somehow, then yes, it would be a zero. So, it's a simple answer.
Answer: Simple three-step process

you must meet the energy requirements to make an attack
calculate the damage based on the attack's text directions, which are often dependent on number of energies attached.
apply the effects of any tool cards and weakness/resistance

e.g., the Mewtwo.

you must have at least two energies attached to attack
assuming you have two energies attached and your opponent has none, you deliver 40 damage, which is the minimum possible (at this step).
your opponent has a choice helmet and is a fighting pokemon with 2x weakness to psychic. the damage is reduced by the tool card, but increased by its typing. you do the math.
Answer: There are two different kinds of damage modifiers common on Pokémon cards.

x modifier.  These do an amount times a multiplier, but have a zero 'base' attack damage.  The MewTwo likely mentioned here does 20x damage, which would have a zero base.
+ modifier.  Ultra Necrozma GX has an attack like this, Photon Geyser, which does 20 damage plus 80 more damage for every basic psychic energy card discarded.  So if Ultra Necrozma had a Double Dragon energy attached, and no other energy, and used Photon Geyser, it would still do 20 damage.

Pokémon uses these symbols consistently on the cards.  If there is an x after the big damage number (printed on the same line as the attack name), then there will be a 0 base damage; if there is a + then there is that number plus additional damage mentioned in the card text (sometimes a multiplier, sometimes just a set amount).

Pokemon damage multiplied


Apple iPhone Security

Question: How difficult it would be to install an application that could record users keystrokes on an Apple device, for example, an iPhone X, and send it online without the knowledge of the user.
Comment: Keyboard apps can transmit keystrokes, but the user must explicitly allow *Full Access* to the app.
Answer: This answer will only explore privilege escalation to install the keystroke logger at root level or above. Other options are offered as part of parental controls or custom keyboards, but I will not explore those.
For the most part, performing clandestine keylogging I believe to be effective must be installed and operated with "higher privileges". This would for the best part involve privilege escalation which involves "exploiting a bug, design flaw or configuration oversight in an operating system or software application to gain elevated access to resources that are normally protected from an application or user".

The privilege elevation could be archived by iOS jailbreaking, a method of privilege elevation with the purpose of removing software restrictions imposed by Apple. Jailbreaking will allow root access to iOS which will allow us to install a keylogger within iOS's file system. Which will make the device seem like nothing has changed, and it's a stock version of iOS shipped by Apple. This is not the scenario, the kernel verifies the file system on startup against checksums. Hence, we must reverse engineer and rewrite the kernel with a "custom" kernel to allow for this privilege elevation and the keylogger at root level to be maintained.
If the kernel is not patched for the modified file system it will not boot. The difference can be explored further by reviewing the difference between tethered and untethered jailbreaking.
With this knowledge, software keylogging on the kernel or root level is possible. Despite the pedanticism that must be dealt with to get this level of "undetectable" access on Apple iOS, it's completely possible.
With the use of reverse proxy(s), VPN and/or a darknet service, the keylogger can "phone home" reporting the intercepted keystrokes, without risking their anonymity.

Apple iPhone Security


Add New Sub Site from the WordPress back end then in sub site options table option_value must be with https

Question: I installed multi site setup for the domain https://uninfo.org but when i add new sub site from the back end it is creating but in sub site WP-options table it created with HTTP rather then https because i have setup https on all sub domain or main site even sub site also working with when i have manually updated site URL i need to auto functioning it on the time of 'add new sub site' & in sub site option table show sub site URL with https.
Kindly revert me appropriate answer anyone
Answer: You Can try force SSL with any 3rd part plugin or hardcoded in wp-config
https://wordpress.org/plugins/really-simple-ssl/
Comment: Yeah, you can. But you should not. You should configure SSL once and not force it every time someone visits your site...


Does the protagonist need a name?

Question: Does the main character in a short story need a name? My story gives lots of other details about the character.
Comment: Is the story in third or first person?  Or...second??
Answer: Can you do this? Of course. There's no law against it. The Novel Police will not break down your door and arrest you for failing to give your hero a name.
But why do you want to?
If you have some good reason, then sure. Like, My protagonist represents all humanity, and so he has no name because he is a generic person and not an individual. Or, My protagonist has no name because, as I tell the reader in the first paragraph, he is keeping his identity a secret. Etc.
But if your reason is, Because I saw it in this other story and it seemed like a cool idea. Or, Because I can't think of a good name. I'd say, don't. Make up a name.
There are plenty of times when it is a good idea to break the conventional rules. Break the rules when it serves to make a point. Break the rules when following the rules creates a problem. But don't break the rules just so you can say, Look! I'm creative and original! I broke the rules! This almost never works.
Answer: Important characters in many books are left unnamed, but (in my opinion) it's a bit risky. Unless your narrative is gripping and fast enough to divert the attention of the reader away from the name, or lack thereof, it feels fake. 'Fight Club, for example, is a splendid example of an unnamed protagonist. You could also call your protagonist by their profession or a trait, if you find you need other characters to call out to your protagonist.
Characters with no names
Check this out, it might be a similar question
Answer: You can manage without one, but I'd recommend against it, unless you have a compelling reason.
A protagonist without a name is often awkward to write, and certainly awkward to think or speak about. A character's name is a pretty basic, fundamental aspect of their identity; there's something weird and forced about deliberately avoiding revealing his name. There's also the simple fact that the reader expects to get a name; if the reader doesn't get one, he's going to think that's a little odd.
These are all things you can overcome, certainly in a short story that can stand a little weirdness. That might be worth doing - if you have a good reason for it.
That's what's happening in the examples some of the others have given:

In Rebecca, the protagonist has no name; she's only known as "the second Mrs. De Winter." That emphasizes how her own name has become unimportant; her identity is being subsumed in her marriage, how she's constantly being compared and contrasted to Rebecca.
In Fight Club, there's good reason to conceal the protagonist's name - there's a major twist involving it at the climax. It also represents how the character feels hollow, fading away, a nobody.

Those are good reasons to leave a character nameless. If you have a good reason, a short story can certainly bear that weight. But if you just don't have a name for them, or if having a nameless character is just an arbitrary decision, then you're probably better off choosing some name and avoiding the issue.
Comment: For a short story I once wrote, I had a character who had no name for reasons that would spoil the reveal.   I had to refer to the character only by the pronoun "It" or by various vague attributes alluding to the monstrous nature of the character like "the monster" or "the beast."   One of the reasons for the lack of a name was because the plot relied on the general public having no real knowledge of what It was, looked like, or was capable of doing (specifically hiding in plain sight).
Answer: Presently, the most talked about television show is the Star Wars series "The Mandolorian" which is about a member of the Mandolorian Culture and his adventures with a young member of the species to which Jedi Master Yoda belongs to.   At time of writing, four episodes have been released and neither character has been named on screen and no allusion to a real name existing for future revalation has been named.   Fans have taken to calling the titular character "Mando" when refering to him.  Even more bizarre is that, because George Lucas has refused to give much details on Yoda's species (still unnamed) and the fact that the young member of his race represents the first major development of the race in 20 years (the last being the revalation of a female member Yaddle in 1999's Phantom Menace) fans are refering to the child partner of Mando as "Baby Yoda" as a short hand for "Unnamed baby of the unnamed race of people Yoda comes from".
Of course, "The Mandolorian" was sold as a Space Western (the producers actually call it a "Space Samurai" film, more on this later) and with the Dollars Trilogy being a main source of inspiration.   The trilogy is a series of three movies portraying Clint Eastwood's character known to film fans as "The man with no name" as he was never given a real name in the three films.
The first entry of the Dollars Trilogy ("A Fistful of Dollars") was an adaptation of the Kurosawa Japanese Period Piece (Jidi Geki) "Yojimbo" which featured a similar plot only with Samurai instead of Cowboys.  The character that inspired "The Man with No Name" was Toshiro Mifune's "The Ronin with No Name".  This isn't uncommon.  Many tropes and archtype characters in Samurai films have a similar Western counterpart and many Hollywood fans of Kurosawa felt this was the best way to share these stories with Americans.  The Magnificent Seven was similarly adapted from the Seven Samurai.  That said, one Hollywood director bucked this trend and decided to make an adaptation of a Kurasawa film "The Hidden Fortress" (about a Princess and her General leading an epic fight against Imperial forces... from the point of view of the comic relief) into a little sci-fi film called "Star Wars" (In case you were wondering why R2-D2 and C-3P0 were so prominent in the opening of "A New Hope" or where in the world Lucas got the word "Jedi" from).
These aren't the only works with similar names.   X-File's persistent foes, the group known as The Syndicate, never had their real names revealed, save for the leader.   The members were only known by descritive names such as "The Well Manicured Man", "The First Elder," "The Second Elder," and the personal foe of Mulder, "The Cigerette Smoking Man" (aka Cancer Man aka Morely Man(prefered fiction brand "Morely" of his trade mark addiction.  The name comes from a prop shop that specializes in prop generic name packaging that looks like real products).   Additionally, there were two informants to Mulder in the series from within the Syndicate known only by false names they gave to Mulder, Deepthroat and Mr. X (the former was derrived from the real life informant on the Watergate scandle and the later was named for the X shape of Duct tape Mulder would tape to his window when he needed to contact Mr. X).  There is some argument of main character status, but one episode of titled "Musings of a Cigarette Smoking Man" purports to be the (mostly true, but we don't know where the fictional parts occur) back story of the titular character... and never once uses his real name in the course of the story (we do learn he wrote a novel about his life, with his fictional self named Jack Collette and his pen name as Roman A. Clef.  The former is definitely not his name as the later is a pun on "Roman à clef" which is a fictional character who represents a real person.  CSM uses the Roman à clef Roman A. Clef to write about Jack Collette who is a Roman à clef  of Roman A. Clef... which is a Roman à clef for whoever the CSM really is.")
Answer: It's a lot easier to think of the character if s/he has a name, but it isn't strictly required. In Daphne DuMaurier's Rebecca, the first-person narrator is never named, and is only known as "the second Mrs. De Winter."
Comment: I don't have the book on me, but I believe the main character in Roald Dahl's "The Witches" has no name, which is okay since it is in first person
Answer: Some of the most beloved stories are fairy tales where the characters are not named. They're the princess, the wicked witch, the boy, the big bad wolf, and so on. (Aimee Bender writes some fantastic stories with unnamed characters.)
So no, names are not necessary. However, you'll have to evaluate for yourself whether naming your own characters will work better for your story.
Comment: I would say this is more archtypes accept that the the "Three Brothers" with the cunning youngest brother prevailing in his attempt to win is a memeatic staple and can be found in literature the world over and predates contact with other civs.  Typically the third brother is always only known as "They Youngest" or "the Third Brother"
Answer: There are situations in which having a nameless character works, but it takes a lot of skill to bring off. The best example I can think of is the nameless hero of the Clint Eastwood spaghetti Westerns. The lack of a name made him, IMHO, both more and less than a man.
Another example I remember is a story printed in Analog during the 70s or early 80s. The protagonist was a girl and the other major character was her parrot. No names needed for her. I think it worked because of her isolation.
However, it's been done badly many times. For example, the writer of the web comic A Girl and Her Fed tried to have the two protagonists (the girl and the fed) be without names. She called him Sparky and he didn't use a name for her. It worked when it was just the two of them, but it started falling apart when there were more people.
The fed was quickly given a name when his boss had to have somebody get him on the phone. The girl stayed mostly nameless for the first part of the story. After that she just gave up on it. It can sound very stilted to avoid names all the time.
Answer: The fact that you're writing a short story gives you more leniency with this than a novel or a novella.
If you're writing in second person, DO NOT give your protagonist a name!  It will be very immersion breaking if you're addressing the reader as the protagonist and then give the protagonist a name that isn't the reader's name.
However, if you're writing it in third person not naming the protagonist will cause you to have to come up with a variety of alternate ways to refer to the protagonist without using their name.  That will get awkward and will likely piss off several of your readers.
But, if you're writing in first person, you can probably get away with without naming your protagonist depending on how much they interact with other characters.  If there's a lot of interaction with other characters it will get weird if the protagonist's name never comes up.

Does the protagonist need a name?


Can hydrogen and oxygen gasses be turned back into water?

Question: I electrolized water today, and got hydrogen. And I have a bottle of oxygen. Can I combine those to get myself water? I know $\ce{H2O}$ is super pure water, but I just want to try. Is this too idiotic to ask or can it be done?
Comment: You don't need to heat it up. You just need a spark. Don't do it at home unless you have done proper research, this reaction is very exothermic and can potentially be dangerous.
Comment: Yes. If you heat up hydrogen in oxygen, the hydrogen will undergo combustion to give you water: $\ce{2H2 + O2 -> 2H2O}$
Comment: As @orthocresol states, do some research first. I did this every year with my students. Do the "burning" in a plastic bottle of no more that 2 mL volume. I've done it with 4 mL and it's scary. You'll get a loud POP and the bottle will show traces of moisture inside. The explosion you experienced was water being created. But the water created was a gas so you probably saw no evidence of it. Also, as a liquid  the water produced would be a very small volume compared to the gases used.
Comment: I tried sparking it but the Hydrogen just exploded.i guess the amount H/O was wrong.And i also tried it with a neon transformer and made plasma but it just somehow all disappeared.I trued both in and without vacuum, nothing worked sadly.
Comment: You can run the hydrogen gas through a platinum sponge exposed to air - the hydrogen will burn instead of exploding (if done properly). Or use a hydrogen fuel cell for the most 'peaceful' reaction (electricity will be a nice bonus).
Answer: When hydrogen burns, pure water is created; the reaction is exactly the reverse of the electrolysis and shown in the equation below.
$$\ce{2 H2 + O2 -> 2 H2O}$$
If you just have hydrogen, then it will burn with a flame as you might know from a methane gas flame. However, once you have a certain mixture of hydrogen and oxygen gas in your container, the reaction becomes explosive. If you have the exact stoichiometric mixture of $2:1$, the reaction is a very strong (and loud) explosion; a tiny amount created a louder bang in Munich's chemistry lecture hall than all other explosions the experimentors showed on that day.
The fact that hydrogen burns to give water and only pure water (vapour) was one of the main points used to try and sell hydrogen-powered cars, since water vapour is environmentally friendly and does not cause global heating like $\ce{CO2}$ does.

The electrolysis/explosion difference shows how different conditions for forwards and backwards reaction can be.
It bears repeating: do not attempt the combustion at home unless you know exactly what you are doing!
Comment: Good points. Industry everywhere is looking at hydrogen-fueled combustion these days. One problem: hydrogen burns so hot it creates high nitrogen oxide concentrations in air. New combustion technologies have been developed to counteract that.
Comment: Water vapor is a green house gas and is responsible for raising the temperature to livable level, changing CO2 is a modifier Also burning H2 in air also forms nitrogen oxides.
Comment: @jimchmst water vapour is a greenhouse gas but one that is abundant in the atmosphere as is, that often reaches saturation levels (clouds, fog) and thus creating additional water barely influences global warming. This is especially true since most hydrogen gas is created from water by electrolysis. The same is decidedly *not* true for carbon dioxide.
Answer: Note that the reaction is exothermic so the water you make is going to be a gas. The reaction has a reasonably high kinetic barrier, so just plain heat is not enough. You need some free radicals from a spark or a flame to initialize the reaction.
Do be careful. This reaction is an explosion.


Cycling speed and fitness

Question: I have a number of health issues (including heart) but love cycling and am determined to train for a long distance ride. I am 68 years old and a beginning cyclist. I have worked up to a distance of 20kms at an average speed of 10-12 km per hour, which feels as though I am really pushing myself, especially if there is wind. My question is: Is it possible for me to improve on this speed over time and with more riding practice? If so, how would you recommend I proceed?
Comment: Are you using a heart rate monitor and has your doctor given you target heart rate ranges and cleared you for training?
Comment: No I'm not using a heart rate monitor. I have high blood pressure controlled by medication and natural methods and use a home testing machine to keep it in check. I have had several heart 'events' since having open heart surgery to remove a tumour about seven years ago, but after lots of testing, doctors were unable to find a cause. I'm therefore pretty much on my own as far as clearance is concerned, since no one knows how far I can push myself. I play the bagpipes, so must be reasonably fit and whenever I feel any chest discomfort, I take a break. That is the best I can do :)
Comment: Sorry, I can't be of any help as this is beyond my knowledge and probably beyond the scope of the site. There are monitored cardiac exercise programs that would let you know what you can do safely. At the very least I would use a heart rate monitor to see what "pushing" yourself looks like on your heart rate.  Good luck.
Comment: @BackinShapeBuddy ...thanks for your advice. I will get myself a heart rate monitor so I can see what is happening when I ride. I really just wanted to know whether more riding practice at my current levels would lead to improved speed and endurance over time or whether I would need to change something for it to improve.
Comment: In a hospital it is possible to do a stress test. That would maybe be a good idea because you are constantly being monitored by doctors and they can find out how much you can push yourself. With a heart condition, i don't think that is something you should be doing by yourself.
Answer: It's not really possible to hand out a speed to you and say "this is how fast you should ride".
If we're talking about a competitive level cyclist, I think you'll find that most riders are comfortable holding a ~32km / 20mph pace for several hours at a time, on flat surfaces. In fact if you look at the RAAM (Race Across America) you'll see average paces frequently crossing over 15MPH, and that's riding 8 days pretty much consistently. So a bit slower than a training ride, but that's averaging in big mountain climbs and obviously an incredible distance (2,000+ miles).
In the RAAM male 60-69 age bracket, the speed drops to ~11.5 MPH (again, for 8 days straight).
In 1989, Greg LeMond did a 24km time trial at an average speed of 54.545 km/h, or 33.9 mp/h.
Three things I'd recommend for you if you'd like to increase your speed:

Make sure you have a good bike and you're properly fitted to it. Once you know how you're supposed to fit on a bike you'll see that most people riding around are either scrunched up or too spread out, and usually their seat post is far too low.
Train with faster cyclists. As you can see from the links above, there are plenty of fast riders in every age group. In any good size town there are bound to be some group rides that will give you better bike handling skills, plus force you to maintain a pace that you might not otherwise hold.

2.5. Also in a group setting you'll benefit from drafting, where you'll be riding in the wind shadow of people ahead of you, getting you more comfortable with speed.

Consider getting a pair of rollers. Rollers, with a fan in front of you and a mirror to your side will help you a lot in riding fast and getting your form dialed in. Rollers in particular are a great way to get rid of hobby-horse-hips and smooth out your strokes. Rollers are also one of the preferred ways to warm up before a race because you can ride 20 feet from the start line, and toss them in your car with a couple of minutes before the gun.
Answer: Yes, it's possible to get faster. Initially, all you have to do is just keep riding, and you will improve, and that is what I recommend to start.
Also make sure that you know how to use your gears effectively. Many beginners ride in a gear that is very hard to push and get tired easily. Generally, you want to be turning your feet at 80-90 RPM.

Cycling speed and fitness


Two dependent Flags in my Application

Question: I have a rating website and on every node i have two separate flags, one is Like, and another one is disklike, so that i can get a count of how many people likes that particular div and how many of them dislikes them. What i want to achieve is, that say if someone likes a node, the dislike should be disable or even invisible  , and vice versa. I am using a view to show the nodes a the moment, so will i have to uses pre process of views to do it or what is the way going about it?
Answer: I would start by looking at the Flag Module Documentation and look into several of the ways you might accomplish this:

You can hook into the Flag Module via PHP, so, in preprocess, you can see if a node has been flagged by either the like or dislike flag (or none yet) and display just the one or both of them when the node is displayed.
You can also hook into the Flag Module via Javascript:  it provides two events you can act upon, so, for instance, after a user has clicked on a flag, you can via jQuery hide the other flag.

And of course, with Views, you can filter on whether or not a node has been flagged by a particular flag or not and then list them accordingly.

Two dependent Flags in my Application


In auto transmission second gear stuck for few minutes

Question: Nissan sunny car 2005 with auto transmission my car is stucking in second gear for few seconds during my 20km trip it will stuck one time then it will not moving  more than 40 speed so what symptoms i changed transmission fluid.i can prefer to repair auto transmission unit or i need to change complete unit please suggest me thanks.
Answer: It sounds exactly like your car has switched into emergency mode after an error had been detected. The limited speed allows to arrive to the service safely. The solution may be plugging in the diagnostic device to the on-board computer and deleting the errors. The devices are really expensive, so i recommend to use service of mechanical service which ownes one.
The emergency mode may have been caused by various reasons. In my W168 Mercedes the same problem has been caused, as i've been told, by malfunction of gearbox's control unit which been constantly generating error and causing emergency mode. I've heard about a guy who repaired the same CU on his own, but unfortunately my mechanic seen only solution in replacing the whole unit.


Can I use two 30amp breakers instead of one 60amp?

Question: I bought a heater (ecosmart11), it needs 60amp. In the building I live I can't change the wiring from 40 to 60 (I bought the place, tho). So my 60amp breaker is useless. But, I can put two 30amp breakers. If I "split" the cable and instead of black, red and green, I have 6 cables, and plug in each group on each breaker, with it works?
Comment: Absolutely not.
Answer: You definitely do not want to do this. One of the reasons is if one of those 30A breakers were to trip it would leave the other half of the circuit to carry more current than it would normally be safe for it to handle.
Sure you might say that if the second breaker circuit saw a current overload then that breaker would also trip but this is not always assured. A 30A breaker is not going to instantly trip at say 30.001A. Whatever operating margin that second breaker would allow continued current to flow to the load overrating the 30A conductor on that half of the circuit.
So do this right and install a 60A breaker and new wiring suitable for 60A circuit.
Answer: The issue isn't the breaker - that's the easy part - it's the wire.
If the wire is only sufficient for 40A, there's no way around that.  If you ran two 30A breakers in parallel on that wire, it would still be overloaded, and you'd have additional code compliance / safety issues detailed in another answer.
You can run heavier loads on a wire by increasing the voltage with transformers, but that is not likely practical in your situation.
Answer: Nope. The EcoSmart 11 goes back to the shop, and you get an EcoSmart 8 and a low-flow shower head.
Simple as that, if you are not willing to upgrade the wire. The root problem is the wiring in the wall is too small to be safe at 60A.
Answer: In addition to (and because of) all of those technical reasons, it is illegal to do what you propose.


Can I buy a 24v transformer with a dedicated common c-wire feed?

Question: I have an oil furnace that feeds hot water to baseboard in four zones in my house and also to a hot water tank for tap water.
There is a 24vac transformer with two output wires that feed power to the electric zone valves.
I want to change one thermostat in a bedroom to a Wifi unit that needs a c-wire.  I have read that I can connect the c-wire to the transformer (power stealing), but that is not recommended. I have 5 wires running to the old thermostat, but only Rh and W are connected.
I think a good option would be to just replace the old transformer with a modern one. Why is it that I cannot find an HVAC transformer that has a dedicated common terminal? To me this makes more sense then adding a second transformer.
Any recommendations?
Comment: Every HVAC transformer has a 'common' terminal. The 'common' terminal is whichever of the 2 terminals is *not* connected to the R terminal on your thermostat.
Comment: Are you referring to some sort of transformer/relay combination device when you say "transformer?"
Comment: No weird situation. The answer below looks correct to me. I have R and W, so I should connect my C from the thermostat to the transformer at the same terminal as W.
Answer: Um, I don't know where you got the term "power stealing".  What you describe as that, is exactly the normal way to do that thing, and the right way... unless you are aware of some capacity issue on the transformer (as is sometimes seen in transformer-relay combos).
As far as the R and C terminals, any HVAC transformer has two pins on the 24V side... They are R and C.  The one that is not R is C.
Comment: I realize my error now. Power stealing is when a thermostat taps a small amount of power from the R and W lines to charge its internal battery.  I'm amazed with all the write-ups about adding a c-wire, nowhere have I seen someone explain so simply how to wire my situation. Thanks!


Difference between family name, name at birth and first names?

Question: I'm filling an English document and I'm being asked to complete my family name, then my name at birth and then my first names. Does anyone know the difference between these 3 concepts? My guess is that my family name is my last name, my name at birth is my complete name at birth, and my first names are everything but my surname. Is that correct?
Comment: You should really inquire with the agency that created (or will process) the form.
Comment: Is it really plural first ***names*** on the form??
Comment: @Jim, yes, it is.
Answer: Here's the common usage of those terms but for a specific form check with whoever is asking for the form to be filled out.
Family name is the part of the name you share with your family, often called "last name" or "surname" in English (though that's less accurate since some cultures put the family name first).
Name at birth would be your full-name on your birth certificate (usually the same unless you've changed your name).
First Name is your given name (strange to see a form that mixes "first name" and "family name") if it says first names (plural) it might include all other names other than your family name (eg middle names).
Comment: First name**s** includes those also called *middle names* - basically all names in order except for family name. Also, some people actually go by their first middle name, so First Name isn't necessarily the given name. So they might have Paul as their Firstname, but David as (one of) their middle names, used as their given name. In short, everyone might be different ¬_¬
Comment: Name at birth implies *Maiden Name* or even name before you changed it at some point.
Comment: @DavidM that'd be the most common reason to change your name but people change names for reasons other than women who get married so "Maiden name" doesn't cover all of it.
Comment: @Mike not disagreeing with your answer. Expanding upon it.
Answer: "name at birth" is probably family name (last name, surname) at birth, as some people change their family name on marriage.
I don't think it would expect your full name at birth in that box, at least in the UK - but does the length of the box give any indication?
Answer: They are attempting (poorly in my opinion) to come up with a way of getting full accurate name information that would apply cross culturally. In some cultures, the concept of "first name" is different than other cultures, especially those where the family name is said first, FOLLOWED by the given name. In some religions, you have a "birth name" but also a "Christian name" given to you at Baptism or Confirmation. Different again is the fact that some families will have official "first names" on the birth certificates, but everyone inside of the family uses what others would consider "middle" names. My wife's family from South Dakota was like that; her mother's name was Virginia, but everyone in the family called her Fay. Her aunt's name was Nancy, but everyone called her Ruth. In both cases those were their middle names. Confused the heck out of me until my wife explained it.


Cash flow mapping on multi curve framework

Question: I am trying to map cash flows according to FRTB pillar dates, on an Interest Rate Swap fixed Vs Euribor 6 months. Using the sensitivity preserving approach, under the OIS framework, this has to be done with respect to both the discounting rate sensitivity (i.e. Eonia), and the forward rate sensitivity (EUR 6m).  Unfortunately I cannot find a way to interpolate cash flows with respect to the forward rate, since the sensitivity is not expressed as a function of the cash flows. I'm actually starting to think this cannot be done!
Does anyone have any idea?
As always, any help would be very much appreciated.
Thanks!
Answer: From recollection don't you only map the fixed cashflows?
If the 6m rate is 1% and your swap is at 0.5% then on a notional of 100 you map:
6m curve @6m: +1
OIS curve @6m: -0.5
If the 6m6m forward rate is 1.25% then on an 1Y irs struct at 2% your flows would be:
6m curve @6m: +1
OIS curve @6m: +1
6m curve @1y: +1.25
OIS curve @1y: +0.75
On a flat curve, with a swap that was at market, you would not record anything to the discount curve (which is true) and for a steeper curve, and/or with a swap that was way off market you be recording much more elements to the OIS discounting curve, (which is alos practically true).
Comment: Thank you for the answer, but I did not understand your point. Actually, both legs are OIS discounted, therefore the market convention doesn't come in place. The main problem is that, considering FRTB dates (i.e. 3m,6m, 1y, 2y, 3y, 5y, 10y, 15y, 20y, 30y), how do you interpolate cash flows, preserving sensitivity with respect to the forward rate? Do I have to assume that the forward rate is going to be computed over the whole period (i.e. for 5y cash flow, it would be the forward 3 to 5 years) ?


Good format for library of chess positions w/tags?

Question: I'd like to create a library of chess positions with associated tags. For example, one position might be tagged "Tactics", "Counterplay", and "Knight Forks". The goal is to be able to search the positions by tag to create examples/exercises for a specific idea without spending a huge amount of time digging up new positions. Does anyone know of a program/format that would be well-suited for this?
Comment: What platform? Windows,  Mac,  Linux?
Comment: Not my area of expertise, but I would have thought that an XML database of FENS, motifs etc. would do the trick.
Comment: @bad_bishop I was thinking similarly,  either a csv file or a lightweight database
Comment: I'm using Windows. Thanks for the comments - I was hoping there would be an existing program that does this, but building a database like you suggested should be feasible even for my programming skills.
Answer: You could use a MySQL database with a column for the fen string and a column for the category. MySQL pairs well with php, perl, and python depending on what you w
ant to use the database for (such as a website or something you can just use personally through a browser), a WAMP server can make this easier to set up.
Answer: Chessbase.
It has a build in Medal system, and positions are searchable by piece maneuvers, text, fuzzy position searches, etc.
Why reinvent the wheel?
Answer: I suggest to read about Extended Position Description(EPD), a format based on Forsite Edward Notation (FEN) with specifications to store additional information.
In chessprogramming,
there is a EPD syntax description of this standard.
It allows to record comments in fields c0 through c9, that are appropriate
for your purpose.
Several years ago, EPD2diag version 1.5p5
was a good option to edit, save, analyze and annotate epd files. Now is
older but could give you an idea of what can be obtained with such a program.


Credit card payment cashed but not credited to my account

Question: So my credit card company cashed my payment check on 12/8, still hadn't posted to my credit card on 12/15 So I called customer service. Sent them a copy of the cancelled/cashed check proving they received my money by upload and fax. Initially they told me they would have it fixed within 24-48 hours, I called today and now they are saying it should be resolved by 1/2/18. Is there any recourse I have, any law that they can take that long to apply the money to my account when they have proof they received it?
Comment: Are you being charged interest/fees for the period 12/8 - 1/2?
Comment: Yes, they have charged interest in the interim. I'm told they will credit it back once they finish their research.
Comment: Is it AMEX? They often take a week or more to 'process' the payment until it appears.
Answer: Assuming you are in the US (please tag your question with a location if this is incorrect), the Consumer Financial Protection Bureau exists to make sure you're treated fairly with this sort of matter.
See What should I do if my payment does not show on my credit card statement?

You should let your credit card company know if your payment does not
  show on your statement. You can call the card company to try and
  resolve the issue quickly. However, in order to protect your rights
  you must send a written billing error notice

The date they have advised they will have it resolved by may be before or after your next statement is created.
If they have resolved the issue and correctly backdate the credit for your payment before the statement posts, then you shouldn't have to do anything - all the interest charges and fees should be correctly recalculated. That said, you should still check carefully to make sure everything was properly corrected and let them know if they missed anything.
If they do not resolve the issue until after your next statement has been created then you should expect to see a credit on the following statement, to offset any interest that you were incorrectly billed. They should also back off any fees that are a direct result of incorrectly dated payment receipts.
Most credit card companies have thousands of customers, so this probably isn't the first time this has happened and I expect they are following a well defined procedure to correct the problem. For example, they may have mis-transcribed your account number and the funds may just be sitting in a lock box waiting to be allocated to an account. Financial institutions in the US are periodically audited by the CFPB to make sure they aren't being lazy when it comes to this sort of problem.
Give your provider some time to resolve the issue, but don't be afraid to enlist the help of the CFPB if they are taking too long. In either case, if the payment is not shown on your next statement, with the correct date, it would be wise to send in the written billing error notice to protect your rights.


Using "an out of line train" to describe a train which is going out of rails

Question: I want to describe a train which is going out of rails. In Farsi/Persian language we say an "out of line train" but I am not sure about English. I found something about out of rails not out of line or lines. Also, there is a doubt that can I use it for broken trains too which are not in use anymore?
Answer: If I'm understanding you correctly, you are referring to a train that is being removed from service, and not to a train that has derailed from the tracks. If I'm right about that, then the word decommissioned might apply:

decommission (v.) to stop using something such as a weapon, ship, or nuclear power station (Macmillan)

If you are instead referring to a train that is off the tracks (due to a mechanical malfunction), you would say the train has derailed, or is off the tracks, or is off the rails, although that last expression is also a euphemism for "going insane", much like off his rocker. As Ozzy Ozbourne sang: "I'm going off the rails on a crazy train!"
Comment: @user37324 -- I doubt that a native speaker of US English would immediately understand "out of line" for a train that is off the tracks.  (I understand "out of line" usually to mean "misbehaving", which wouldn't be applicable to a train or other inanimate object.)
Comment: Can I use "out of line" train for a train that has derailed from tracks? And thanks for suggesting decommissioned for a train is being removed from service.
Comment: @barbarabeeton Thanks! As I said it is a Persian term and I translated it word by word in English to find if it makes sense or not and found it.


Karaf 2.3 Camel 2.10 : Is it possible to switch to Spring 3.1?

Question: Is it possible to use Spring 3.1 on Karaf 2.3 without worrying about breaking anything ?
Answer: I have struggled a bit with this very issue. Basically we are using Camel 2.10.1, Spring Integration 2.1.3.RELEASE (yes I know two integration frameworks), and we were using Spring 3.1.2.RELEASE, activemq 5.7.0 and Karaf 2.3.0. As Claus says with OSGi it is always a worry and especially when you do not have control over

third party OSGi manifests
Karaf feature descriptors (this is slightly less of a worry as you can get around this by creating custom distributions).

We also use Spring DM so you have basically three flavours of Spring available 3.0, 3.1 and 2.5.6. You can end up with three versions of spring-core installed for example through transitive dependency resolution or otherwise and depending on startup ordering etc., you can run in to nasty 'uses" constraints which are always a pain and sometimes not so easy to solve.
What we ended up doing is aligning with Karaf and jettisoning Spring 3.1.2.RELEASE in favour of 3.0.7, this was easy in our case as 3.0.7 was fine.
In general I have found that aligning with what the container offers out of the box to be a reasonable strategy in dealing with dependencies.
Comment: please consider to format your answer a bit - one big bunch of unstructured lines is hard to read ;-)
Answer: With OSGi there is always a worry :(
Camel supports both Spring 3.0 and 3.1. So from Camel point of view you should be okay. Karaf comes out of the box with Spring 3.0.7, and you would need to re-configure Karaf to use Spring 3.1.x instead.
IMHO this is wrong (eg Karaf exposing Spring 3.0.7 out of the box), as I believe Karaf should not force users into a specific Spring version. But let end users freely choose what Spring they want to use. And even have Spring 3.0, 3.1, and 3.2 run side by side, as needed by your applications deployed in the container. Or at least Karaf should IMHO make it much easier to choose which Spring versions to expose/use out of the box.
There is discussion on the Karaf @dev mailing list about this issue, and how to address this.
http://karaf.922171.n3.nabble.com/Apache-Karaf-2-3-0-very-close-tp4026295.html
and here
http://karaf.922171.n3.nabble.com/Re-3rd-Party-Feature-Definitions-tp4026366.html
Raise your voice on these mailing lists as the Karaf team is listing there!
Answer: Well there is a Spring31 feature available with Karaf 2.3.0.
It might see sub-optimal to provide it as a optional feature but right now the std. features regarding spring for the 2.3.0 line is the spring 3.0.x feature.
For Out-Of-The-Box support you'll need to wait a bit for Karaf 3.0


Alternative to Photoshop that can handle smart objects

Question: I would like to edit a simple PSD with a smart object like this one.
I only need to replace the smart object with a screenshot of an app and export the image as a PNG or JPG. Is there an alternative to Photoshop available that can do this? (I'm using Windows 8.1 and I don't need any other of the advanced Photoshop features)
Answer: The question should be Alternative to Photoshop that can handle Photoshop smart objects beaucse the term smart object is used by a variety of programs.
But the answer to your question is no, currently there is no other graphics editor that can handle or convert Photoshop smart objects.
Comment: Photoshop Elements does not fully support Smart Objects. While you can open files that already have Smart Object layers, you cannot create Smart Objects nor open the files embedded as Smart Objects (I guess that is what you would want to do in order to replace it with your own).
Comment: What about Photoshop Elements?
Answer: Probably you are limiting your options here. You are limiting to PSD files and Smart objects. And that does not give you much choices.
If you are open to another options:
Use any program that uses layers (or at least objects)
1) There you can use gimp for example.

Resample your png or jpg and paste it into your background.

2) Use any layout program. Scribus, page plus (Or corel or ilustrator, which are again too powerfull for your needs.)

Make a layout with a linked image.
You now can update that linked image and export your file.


If sun-rays also contain any X-rays why we can't see the inner organs of the human body through these rays?

Question: Nobody has been able to find an answer how anybody may be able to see the inner organs of the human body as Natalya Demkina is able to see. In this context, I want to mention that the same way as we are able to see things in the light of an electric lamp or the sun-rays even though our eyes don't emit the visible band of the electromagnetic rays may it not be possible for her to see the inner organs of other people because the sun-rays contain X-rays also. According to me, it is wrong to say that since human eyes can't emit X-rays she may not be able to see the inner organs of other persons the same way as we are able to see everything even though our eyes don't emit the visible band of the electromagnetic waves. I want to know whether it may be possible that her brain's circuitry may be allowing her to see the inner organs through the X-ray band of the sun-rays unlike the rest of us or not. The chances of her having some special brain-circuitry of this type can't be ruled out according to me.
Comment: I'm voting to close this question as off-topic because it appears to be about the abilities of a Russian psychic, and only tangentially related to astronomy.
Comment: I agree that this question is not related to astronomy. But  AtmosphericPrisonEscape has answered my question very well. I express my thanks to AtmosphericPrisonEscape. Since I got an answer I don't mind if it is removed from the astronomy segment of stackexchange.com.
Answer: X-Rays from the sun don't reach the Earth's surface, as our atmosphere is opaque to this kind of electromagnetic radiation.
This is why X-Ray observatories like the Chandra telescope have to be placed in space. Thus it is excluded, that anybody having an ability to see X-Rays would see people's inner organs.
The other issue is that in general, human physiology doesn't allow to see electromagnetic radiation this energetic. Our abilities to see high-energetic radiation ends at the violet colour, which is where UV radiation has it's name from. X-Rays are even more energetic than UV.


How can I take a picture of something small and print it out so the item in the picture is the same size as the item actually is?

Question: I am trying to print a picture of a product my company is selling. I want the product in the picture to be the same size as the product actually is. How can I accomplish this? The paper is going to be the paper that comes out of a standard printer if that matters.
Answer: The easiest way to print a picture that is the same size as your small something is to hire me as your graphic artist to do it for you.
Here's the method I would use:

Take a picture of the something — that you like (The right angle, good lighting, sufficient detail to show texture, background, props, etc.)
Print it. The "Scale" of this original print is 100%. (Scale shows in the printer's print dialog when you select "Print.")
Measure both the actual something and the picture view of the something. (If you show the something top to bottom, measure the something from top to bottom, say.)
Compare the print size to the original size.
If your something is bigger than the print, increase the scale of the print to greater than 100%. If your something is smaller than the print, decrease the scale of the print to smaller than 100%
Print the Actual Size by using the equivalent change of scale to the original size.
Admire your fine job.

You can do this by trial and error; but, (Lifehack) you can calculate the % by dividing original size by the photo print size you first made.
For Example: If your something is 20mm across and your print showed it as 60mm across. Print your Actual Size copies using a Scale of 33%.Original size (20mm) / Photo Copy size (60mm) = Desired copy scale to reproduce Actual Size as requested.
Good Luck.
Comment: @WeatherVane There's no 'only-way' to accomplish most things. Please submit your answer to the question so that I (and others) can find out how to use your technique.
Answer: Pretend you are an archeologist and place a measuring scale beside the object when you take the photo. Then try different printouts to find the correct magnification. You don't have to worry about camera zoom or distance.
Answer:
In this example, the product is a book that is 6 1/2 inches tall. Once you have a picture of it on your computer, You just need to do a bit of image editing, knowing that a standard printer paper size is 8 1/2 by 11 inches. Download, install, and run the free desktop version of Paint.net, then open your image in the program.

Using Image>Crop to Selection, remove excess parts of the image, so that the product spans the full height of the image. Next, using Image>Resize, adjust your image to a height of 6.5 inches (Maintain aspect ratio). Still in Paint.net, use File>New to open a new blank image, adjusting it's size to be 8.5 by 11 inches. Now, using copy and paste, select and copy your product image onto your blank image. That's it. You can now select print from within Paint.net, or save it to an image file, to be printed as needed.
Comment: https://www.getpaint.net is the direct link to paint.net's own site. It'll get you the latest version, and its probably a better idea than a mirror


Robert Harvey's reputation history is lying?

Question: There were no net reputation changes that day, but it says -2. I don't know if it's appropriate to ask this, but what happened? And why is it lying?
Answer: -2 is a couple downvotes, which I don't think are public to other users. Could also be something like a suggested edit being accepted then later deleted. Voting fraud can also sometimes cause weird reputation changes. Back then, reputation was sometimes recalculated after the fact, so it wasn't always clear how it tied to an action.
Comment: So they downvoted two answers


Which one is more acidic – 3,5-dinitrophenol or 4-nitrophenol

Question: I'm confused because in 3,5-dinitrophenol, the inductive effect is dominating whereas in 4-nitrophenol the mesomeric effect dominates. So which one should we consider for acidity?
Comment: Part of the answer depends on why you're asking. If you want to know the answer for which is acidic, you just look it up or measure it. You can't always determine the relative magnitude of competing effects in chemistry (unless you've got amazing intuition and/or experience), so you might not be able to determine the answer just by thinking about it.
Answer: As Zhe's comment points out, intuition does not count for much here, unless you have enough actual experience working with these systems to know what is more acidic. There are some things which cannot be predicted a priori using simplified models.
The only way to find out is to look up the data. The acidity constants of some of these phenols are tabulated in J. Org. Chem. 1998, 63 (19), 6680–6688. 4-Nitrophenol has a $\mathrm pK_\mathrm a$ of $7.14$, and 3,5-dinitrophenol a $\mathrm pK_\mathrm a$ of $6.73$, in aqueous solution.
Answer: I have used MarvinSketch 17.28 to estimate the acidic strengths of substituted nitrophenols, as measured by their $\mathrm pK_\mathrm a$ values.
$$\begin{array}{cc} \hline
\text{Substitution} & \mathrm pK_\mathrm a \\ \hline
\text{2,4,6-trinitro} & 2.344 \\
\text{2,4,5-trinitro} & 3.224 \\
\text{3,5-dinitro} & 6.238 \\
\text{4-nitro} & 7.075 \\
\text{3-nitro} & 7.892 \\ \hline
\end{array}$$
It is evident that 3,5-dinitrophenol is more acidic than 4-nitrophenol.
The relative acidities of the meta- and para-monosubstituted nitrophenols are in line with predictions based on resonance arguments.
Comment: MarvinSketch seems to get most of those pKas fairly accurately, but I'm surprised at how bad the number for picric acid is.
Comment: Picric acid has pka about 0.7