How do you breed villagers in minecraft?

Question: I have always wanted to know how to breed villagers in Minecraft, i have tried looking it up, but it came up with loads of useless, out-of-the-topic things.
Answer: Villagers automatically breed when certain conditions are met.
First, make sure there are more beds than there are villagers. Second, be sure there is a bell in your village, otherwise they will not stay in the area and will wander in search of a bell. Third, be sure there are profession blocks that new villagers will be able to use (only one villager can be bound to each profession block). Also, make sure the area is safe, as villagers will sometimes not breed if there is a risk of death.
Finally, make sure there is a wheat field, and at least one farmer villager. The farmer has to collect wheat to make bread, which will then be distributed amongst the villagers. When you see a villager throwing bread to another one, this means they are breeding. Watch for baby villagers, and try to ensure that they live to adulthood!
Comment: I have been able to breed villagers with just an extra bed and some food.
Comment: That would be the old breeding system, prior to 1.14 (Village & Pillage update). The new system is much more complex, as you can see from my answer. Pre-1.14 breeding is much simpler. The answer below mine explains that system well.
Answer: The basic conditions under which villagers decide to breed are (from the top of my head) as follows:

The two villagers that you intend to breed need to have food (carrots, bread, pumpkins etc.) => easiest to achieve to have carrot farm around and have that regularly drop carrots onto you villagers.
The "village" needs to have more beds than villagers. Village in this case means the technical thing the game recognises as a village. This term does not mean that you need houses etc.

Unless you want to mass produce villagers for something like a trading setup you are fine with some villagers in a fenced in place that is well lit, so zombies cannot come in. Give them a few beds and toss them a bunch of food. You might as well make one of them a farmer and have them grow crops themselves.
All these changed with the village and pillage update (1.14 for Java-Edition) to what you see above. You used to have to have sky access or a bunch of doors under a roof instead of the beds.
For more details you should always go to the official minecraft wiki


Find out if "Further reproduction prohibited without permission" document is original

Question: There are many documents containing "Reproduced with permission of copyright owner. Further reproduction prohibited without permission". I'd like to read those which were legally uploaded. However I am unsure about how I can determine if the uploaded copy on a webpage is the original, the single reproducible copy or a further-copied pirate copy. Do you have any tips? If it's not possible to determine this, would the legally wiser choice be to read the document or to assume that it's an illegal copy?
Comment: This is a question about how one can know what is and what is not legally permitted, and so about the law, in my view.
Comment: Is the OP trying to decide what it is legitimate to copy or to *read*?
Comment: I'm voting to close this question because document verification is not a question about the law.
Answer: It does not matter whether the document is authentic, because it is true, by law. Under copyright law, you must have permission of the copyright holder to copy any protected work (original creative work not created as a work of the US, as an example under US law). This is true whether or not the copyright holder tells you that copying requires permission.
A matter for more concern is "false permission", where a person without the right to grant permission utters something that the courts would usually interpret as being "permission", for example releasing a Harry Potter book under CC-0. The legal requirement is that you have actual permission, not that a prohibition was not communicated to you.
It is in your interest to know whether the actual person making available a work under some license actually has the right to grant a license. But there is no way to know for certain who holds copyright. You can, however, attempt to determine that a work has been registered with the US copyright office, looking here. Works are still protected when not registered, so failing to find a copyright registration does not guarantee that the work is "open access". It would tell you who the registered copyright holder is.
There is no "innocent infringement" defense, but under §504(c)(2), your liability for statutory damages can be reduced to as little as $200, if you can prove that there were no indications that the work is protected.
Comment: Excellent answer, but just to clarify: Am I right in understanding that the "you" throughout (eg in "your liability for statutory damages") means someone *redistributing* the work, not merely someone *reading* it as OP described?
Comment: I don't think the question asks is whether it is legal to read a pirated online work. AFAIK the answer to that question is theoretical and lacks pertinent case law, at least in the US. Reading a work online does technically involve making a copy.
Comment: I agree, I don't think the question is asking about the legality of reading — but it is *written from the perspective* of a reader ("I'd like to read those which were legally uploaded", "…would the legally wiser choice be to read the document…") so it seemed worth clarifying which rôle you mean by "you".
Answer: Trick question: you can't read the single original copy "legally", because it's stored on a hard disk in a datacenter and you have to make multiple copies of it to even get it to your computer.
This sounds silly but has been used in court in various situations, and eventually got a specific exemption ("technical copies") in EU copyright law.
Comment: It makes sense to have this exemption, however if the allowed copy was one on paper and not an electronic one, that would make all electronic copies illegal. That's what I was curious about: is the original legal copy a material one or a digital one?
Answer: Even if someone already violated the direction not to make further copies, that does not make it unlawful to read the document. Just as if someone makes and sells a pirate copy of a book, it is not copyright infringement to buy that pirated copy, nor to read it. It would be to re-sell it, however.
It is not technically easy to create a digital document where copying (or unauthroized copying) can be easily detected. Indeed the best way is for the copyright owner to state, separately, where an authorized copy may be found, and to declare that all other copies are unauthorized.
Comment: Note under Australian law, it's also copyright infringement if you download it.
Comment: Do you have any case law support for the claim that downloading a pirated work without redistribution is legal?
Comment: @user6726
 I did **not** say that "downloading a pirated work without redistribution is legal". I said that **reading** a copy is legal, and **buying** a physical copy is legal  Downloading is arguably making a copy. Downloading to a cache for reading purposes only is making a technical copy, and is not infringement by statute in many but not all countries. Downloading for future reading is probably infringement, but often no action would be taken in the absence of further distribution or reuse.
Comment: How do you read an online work without downloading it – as you admit? I'm just looking for any legal support for the claim that reading a pirated work is legal. Focus on US law
Comment: @user6726 If someone has made a physical copy, say by printing out the document, that person has probably committed infringement, but someone else who reads it has not. I incline to think that merely displaying a copy for reading purposes without storing it is not truly downloading it, but I will need to check for case law if this is technically infringement in the US.


Selecting multiple notes in Guitar Pro 8

Question: In Guitar Pro 8 is it possible to select more than one note at the same time; i.e. random notes in different bars - to copy and paste into another instrument line?
Answer: not random notes, but yeah, just highlight the notes and copy into the other instrument.
could you give more detail though on what you want?
if you want to omit notes to the new instrument just press "R" and that'll create a rest where that note is. as far as randomly generated notes, you'd need to export as midi, write some python script to delete random notes, and then reimport it but that i dont find would be worth the effort for most cases.
Answer: As far as I know, this isn't possible. Your best workaround is to copy everything and delete the stuff inbetween.


Why doesn't Elrond stop Isildur in Mount Doom?

Question: In The Lord of the Rings: The Fellowship of the Ring Elrond tells Isildur to throw the ring into Mount Doom, but when he doesn't do so, he doesn't try and stop him by force or any other means.  Why is this? He could have destroyed the ring with one arrow to the heart of Isildur.
Comment: See [this question on scifi](http://scifi.stackexchange.com/questions/38417/why-didnt-elrond-or-c%C3%ADrdan-take-the-ring-from-isildur-by-force-and-destroy-it)
Comment: @michael Great answers, main difference in book they were at battlefield so matter of being corrupt during travel, chance of war between man & elf. However, movie they were that mount doom already so just one arrow would have worked
Comment: Then: (a) because it didn't happen in the book, and/or (b) because then there wouldn't have been a movie.
Answer: In Universe
First of all the answer mentioned in the comments from SciFi SE covers in-universe why Elrond wouldn't want to risk taking the ring from Isildur
Summary - The ring is dangerous and has destroyed everyone who has tried to take it from another individual (Smeagol, Boromir, etc)
So why didn't Elrond just shoot him and make him fall into Mt Doom
Well here are a few of reasons I can think of:

Elrond can't just kill the High King of Gondor without major fallout.
Elrond is the epitome of righteousness and justice, but he's still not perfect
Don't underestimate the power of the One Ring - even when it finally did get destroyed, it wasn't simply because Frodo decided to toss it in. It required the death of Smeagol and even Frodo came to the point of decision and chose not to destroy it, even after having given up his own will and deciding to make the entire journey across the marshes and into Mordor all at the risk of total peril and facing certain failure and death. And Sam was powerless to force him to do so, not only because of his love for him but Frodo would have destroyed him had he tried.

Out of Universe
The movie is based on the book and must follow the story at least enough for there to still be a story. In the books, they are not in Mount Doom when Isildur refuses to destroy the ring so it would not have been as easy for Elrond to simply push him into the flames.
From a story persepctive:
Destroying the One Ring isn't supposed to be easy
The characterization of The One Ring was meant to make it seem invincible and nearly impossible to destroy due to its ability to influence the hearts of men, elves, wizards, dwarves, etc. This scene is a part of that character development of The Ring and making it seem impossible to destroy.
Comment: A slight addition: the Ring has destroyed everyone who has tried to take it from another, **except Isildur**. Now having the Ring, it's unfathomable exactly how much power Isildur now wields on top of already having been able to best Sauron with the Ring. That's not something Elrond can easily overcome.


Simulate non-stationary time series with cointegration

Question: how can I simulate/generate two non-stationary time series (with unit root) so that they can be also cointegrated (using R or Matlab).
Thanks in advance.
Comment: See http://quant.stackexchange.com/a/1038
Answer: Two cointegrated series contain a single unit root. Each series can be formulated as the sum of a common unit root plus a stationary component. Most textbooks covering cointegration will cover such formulations - see Hamilton's (1994) discussion of Phillips' "triangular representation" of a cointegrated vector, for example.
Simulating is likely to be easy (depending on other features you may need, of course). For example, simulate one non-stationary series, and construct a second series as the sum of the first and a stationary variable. Viola! Cointegrated.
Answer: Simulate Random Walk Series
We can now simulate a random walk series in R as shown below:
RW <- arima.sim(model= list(order = c(0, 1, 0)), n=200)
We can plot the newly generated series as well using the plot.ts() function.

plot.ts(RW,main="Random Walk", col=4)

Random Walk with Drift

RW_drift <- arima.sim(model= list(order = c(0, 1, 0)), n=200, mean=1,sd=5)
plot.ts(RW_drift, main="Random Walk with Drift")

or you can use by installing the package "extraDistr"

library(extraDistr)

random_walk<-cumsum(rsign(10000))
plot(random_walk,type='l',xlab='Time',ylab=expression('x'[t]),main='Random Walk')

Trend Stationary Process using following commands

white_noise<-rnorm(100,0,40)
trend<-3*(1:100)
x_t<-trend+white_noise
plot(x_t,type='l',xlab='Time',ylab=expression('x'[t]),main='Trend Stationary Process')


Which skills are required for a tester with only one year of experience

Question: I am asking about what skills should a test engineer with one year test experience have?
Comment: You should add some context to the question to get a better answer.
Are hiring? looking for a job with one year experience behind you? just finished school?
Comment: Required by who or what? Without that information the question is too broad.
Answer: Doesn't matter for how many years a person works as a software tester. He/she must be,

Critical thinker
Keen observer
Good at bug advocacy
Ever learning
Able to adapt, improvise and overcome hurdles
Able to extract domain knowledge from team, and other resources

And the list may go on and on depending on how many people add to it
Answer: According to me 1 year experienced tester should have following skills :
1 - Create test case
2 - Create test scenario
3 - Able to understand requirements easily
4 - Should be capable to use any good bug tracking system [Depends on company
where tester works]
5 - Analysis skill improvement
6 - Bug life cycle understanding
7 - Software life cycle understanding
8 - Theory knowledge of all basic testing concepts and models
Above list is according to me. Each and every company has diff. requirements and diff. expectation when they hire tester so May be there can be like above or diff.
Answer: According to me, these skills are important:

Flexibility: Tester should be flexible enough to take up any task. Example, one should be able to work on manual, automation and other types of testing (mixed roles).
Knowledge (1-2 years): In terms of knowledge, other answers have covered most of the aspects (SDLC, STLC, QA Processes, Defect life cycle, Analytical Skills, Test Cases and Test Scenario, Quality Center).
Good Communication Skills: This is a plus point if the role requires interacting with the client.
Team player & learning attitude: Self-explanatory. One should continuously develop their skills.
Domain Knowledge (1 year old?): 1 year is good enough to get some basic domain knowledge (HR, Banking, Insurance. etc)
Certifications - Again this is just a plus point (probably Istqb).
Answer: This is very subjective and depending on the job and product, but there are some essential skills.
Basic development skills
Understanding the life of a developer is import to be able to connect to them and really assist them. Secondly automation of tests is becoming ever more important in a world with a focus on continuous delivery.
Quick learner
From new tools, applications, techniques and of-course domain knowledge. You need to be able to truly understand requirements and adapt quickly to the changing world around you.
Loose the ego
Testers have no value for ego, be able to clearly communicate with developers, clients, managers. You are here to assist them in improving quality from requirements until delivery.
If you have these three you will probably have a great career as a Software Test Engineering.


Broken Drywall Corner in Shower

Question: I had someone replace my bathroom ceiling, and I was just sanding and painting.  I found that the corner of the drywall is broken off & there is also another gap that seems a bit big for caulking.  I think I can maybe just add a little compound on gap, but I'm not sure how to fix the corner given I can't put anything on the shower tile.  Any suggestions (other than having to schedule a guy to come back)?
Comment: Welcome to DIYSE. It's not clear what I'm looking at. Is that the wall-ceiling junction, or is there a tub in the photo?
Answer: I added compound in the gap and that seems OK.  I folded up some paper drywall tape into the corner to fill the depth, and then put compound on that too.  Both had some mesh tape in there so I think it will be OK.  Thanks to anyone who has been giving this thought!
Comment: Normally you'd fill void with compound to make it more solid, but with the mesh tape it should be ok.
Comment: I'd have called the guy back as much as I hate mudding drywall, but I think you did well.

Broken Drywall Corner in Shower


Im an amateur depelover, where can i share my small tricks for elementary os loki?

Question: I have said all in the title, I have programed a few scripts in perl to personalize the desktop a bit, and I'd like to share it with others because isn't enough programs to do this stuff.
Comment: Care to share a link to your stuff? I'd like to check them out.
Answer: You should consider building apps for the App Center. If you have scripts you'd like to share you can share them on GitHub Gist. I have an elementary install script on there and it's saved me a ton of time.
Check out the Getting Started guide written by the elementary developers. Also check out Egee's videos on getting started with GTK & Vala development in elementary.
Comment: Care to share a link to your stuff? I'd like to check them out.
Comment: I don't have much in the way of elementary apps, but a lot of my work and partial work is on github: https://github.com/PretzelJones?tab=repositories I also have som scripts for elementary on github gist https://gist.github.com/PretzelJones


What should I know to prevent relay attack on NFC?

Question: I am doing thesis on "NFC relay attack" in my BSc last year. I have studied 10-15 papers and learned the basics of NFC and relay attack. Still I am no where near to understand how relay attack is performed on NFC and how the protocols work in NFC. What should I learn to know how the Relay attack is performed and how the NFC protocols are related to the attack?
Answer: I would stop focusing on 'relay' and do more research into MITM or man in the middle attacks. A relay is essentially just a MITM. Also initially I may even back off of NFC and just study MITM attacks on something that is more thoroughly documented, such as regular MITM over tcp.
When ever I am having trouble wrapping my head around a particular topic I try and create a lab to accomplish this. Research how to implement MITM attacks, specifically with NFC. As you work through that problem you will become intimately familiar with the concepts of the attacks as well as the protocols involved in NFC
Answer:
Security is an essential aspect of the success of NFC technology. The
  high interoperability of the popular collection of standards must be
  integrated with appropriate mechanisms to protect data.
Implementation of security mechanisms to a tag requires analysis of
  costs versus benefits. There are various solutions that imply
  different economic and computational costs, therefore it is crucial to
  understand exactly what information has to be protected and which are
  the main threats.
Newer tags have security functionality built into the chip but are not
  a part of the NFC tag specification; the principal objectives to
  pursue for data protection are:

Authenticity
Integrity
Confidentiality

Principal menaces are represented by an attacker's ability to
  intercept and manipulate the data without detection. In both cases,
  the above principles are violated.

you should definitely read this. it might clear stuff on NFC- http://resources.infosecinstitute.com/near-field-communication-nfc-technology-vulnerabilities-and-principal-attack-schema/#gref


Never content: What is the most changed post?

Question: What post has the longest list of revisions on all SE sites? Where is this information available?
Comment: Probably "never satisfied", @dawny - a post that perpetually inspires improvement (or at least change).
Comment: No, it's not "fun". Many feature requests have "no real use", and are just "nice to have" things, plus there are many requests for interesting stats. This does not make them fun. memes are fun. Building castles with  is fun. Etc.
Comment: What did you mean by `Never content`?
Comment: yeah, I like the sound of "never content" but it meant what @Shog9 said
Comment: **Please stop adding totally wrong tags, it's considered vandalising the post, no different than changing it to "fsdmfksjkf"**
Comment: @ShadowWizard   This is fun because it has no real use, and in the answers, it was pointed out that edit is not very precise in describing this.
Answer: I didn't search other sites yet, but this post on Stack Overflow seems a winner to me. It has a whopping 753 revisions!
You can run this query on SEDE to get the results:
select PostId [Post Link]
,      count(*)
from   posthistory
where  posthistorytypeid in (4,5,6,7,8,9,24)
group
by     PostId
having count(*) > 100
order
by     count(*) desc

If you don't want to include rollbacks, you can exclude PostHistoryTypeId 7 to 9 (which are all rollback types). The most edited post seems to be this post on MSE.
Comment: I have to wonder how an edit war was allowed to continue for more than 700 revisions.
Comment: @DavidZ Most of them happened within a few hours. (That's dedication!) Then the post picked up a couple flags and they were handled by a mod. (I also vaguely recall that we have a "there's probably an edit war" auto-flag, but I remember it exists because I remember fixing it, so I presume it was broken at the time and didn't light the proverbial bat signal when it should have.)
Comment: Do notice that this query has slightly higher counts on some posts as events are rolled up in one revision, indicated by the same revisionguid. An extreme case is [this one](http://ru.stackoverflow.com/posts/209942/revisions)
Comment: "edits" is the wrong word, since most are rollbacks (most likely that post also got the longest edit war ever.). Since OP here asked for revisions, not edits, the answer is still correct. :)
Comment: that's so funny :D some people are very passionate about their revisions - may the edits be ever in your favor
Comment: I had to edit it because the highlighting formatting wasn't working.
Comment: Uhm, yes. That is pretty extreme @rene.
Answer: The answer from Patrick is a reasonable indicator that doesn't hammer the SEDE database to much. It does report higher (sometimes way higher) counts for some posts then the actual /revisions page will show you. This is caused by the fact that some title, body and tag events will be rolled up in one revision, indicated by the same revisionguid, The following query examines all available databases in SEDE and counts the actual revisions per post, including tag wikis:
-- result table, don't rename and keep the site column
create table #results ( site nvarchar(250)
                       , post int
                       , title nvarchar(250)
                       , revcnt int);

declare @sql nvarchar(max) = ''   -- holds build up sql string

-- build one biq union sql, for each db
select @sql = @sql
+ iif( len(@sql) > 1
     , 'union'
     , 'insert into #results'
) +
-- here goes the per site query, fully qualify the database objects
N'
select ''' + name + '''
     , postid
     , (select (case when q.title is null and q.parentid is not null then
                  ( select title
                   from ' + quotename(name) + '.dbo.posts mq
                   where mq.id = q.parentid)
               else title
               end) as qtitle
        from ' + quotename(name) + '.dbo.posts q
        where id = postid ) as nqtitle
     , count(*) as cnt
from (select postid
           , revisionguid
      from ' + quotename(name) + '.dbo.posthistory ph
      where ph.posthistorytypeid < 10 -- all edits
      group by postid
             , revisionguid
      ) as data
group by postid
having count(*) > 10
'
from sys.databases
where database_id > 5
-- and (name not like '%.Meta' or name = 'StackExchange.Meta')

--print @sql

-- execute it
exec (@sql)

-- show results
select top 10000
       site
       ,
       -- URL builder from Lamak http://stackoverflow.com/a/38129701
      'http://'
      + case PARSENAME(site,1)
        when 'audio' then 'avp'
        else PARSENAME(site,1)
        end
      + coalesce('.'
        + case PARSENAME(site,2)
          when 'audio' then 'avp'
          else PARSENAME(site,2)
          end , '')
      + IIF(patindex('%.MathOverflow%',site) > 0
      , ''
      , coalesce('.' + PARSENAME(site,3), '')
      )
      + IIF(patindex('%.MathOverflow%',site) > 0
      , '.net'
      , '.com'
      )
      + '/posts/'
      + cast(post as nvarchar)
      + '/revisions'
      + '|'
      + case when title is null
             then 'tag wiki:' + cast(post as nvarchar)
             else title
        end as [Post]
      -- rest of columns
      , revcnt as [Number of revisions]
from #results
order by revcnt desc

drop table #results

When run today the result looks like this:

For a per database query you can use this version
Comment: @Adamawesome4 you are asking for the most changed post, aka revisions. That is the number shown on the post revision page. If you look at this [one](http://ru.stackoverflow.com/posts/209942/revisions), it shows 308 revisions but if you take that same post and look at the [posthistory](http://data.stackexchange.com/ru/query/520562) events you'll find 924 rows. Patrick his query will report the 924, mine reports the 308. I role-up multiple revisonguids. So that  is why I say mine is (functional) more accurate because it matches the *changes* users can check on any post they see.
Comment: Sorry, but I'm awfully uneducated in this (and probably need more sleep), but how is this more accurate than Patrick's answer?


How to remedy an over-brined turkey?

Question: Left turkey in brine too long.  The meat is very salty and I want to remove the salt.  I do not know what to do to reduce the taste of salt.  What is the process to reduce the overly salted taste?
Comment: Welcome to Seasoned Advice! Please don't post additional information in answers - we have a rather strict format. I would suggest that you think about [registering your account](https://cooking.stackexchange.com/help/why-register) and you can also [merge them](https://cooking.stackexchange.com/help/merging-accounts). As for all new users, I recommend you take the [tour] and browse through our [help], especially [ask] and [answer], to learn more about how the site works.
Comment: Next time, I'd suggest dry brining (rubbing salt on the dry outside of the bird) and starting not too early before cooking. And make sure your bird isnt pre-brined or injected with saline beforehand.
Answer: Unfortunately, there's no easy way to get salt out of meat (or other types of food) once it's there.  If the turkey weren't cooked yet, it's possible to try to put it in pure water (rather than brine), and gradually some the salt will come back out into the water.  After sitting for a while, replacing the water with more fresh water can speed up the process.  (This is the process sometimes used for desalting pickles that are fermented in very salty brine, but it only can do so much.)
In reality, though, that's not going to help much with moving salt out and could take days, during which your turkey will go bad.  I'm assuming since you tasted it that you've also already cooked your turkey.  So what now?
Unfortunately, I think the only realistic thing to do with leftovers here is to use them to flavor other dishes that are not naturally salty.  For example, you could make a gravy without salt and add the turkey meat to it to simmer, then the salted meat can provide some salt to the gravy for open-faced sandwiches or something.  Or make turkey soup using unsalted broth/stock, but add the turkey meat, which will release some of its salt into the liquid while the soup simmers.
As it's difficult to remove salt, really what you're trying to do is dilute its flavor by adding the turkey meat to other unsalted (or low-salt) things.

How to remedy an over-brined turkey?


Consequences of not attending a conference

Question: So I did research over the summer and applied to and got funded to go to a conference in Hawaii. I would have to leave to the conference early Wednesday morning and wouldn't return until about 1am Monday morning. The main problem I have is that since I'll be expected to be at the conference for most of the day and be pressured into having fun by my peers during the night, I don't think that going to this conference would help my goal of getting an A on the test's I have to take on Monday/Tuesday. I told my professor that this conference would be a burden on me and my studies so I wouldn't be able to go. She replied and said "I was making a huge mistake and that I would have to face financial and other consequences for my decision." Is she trying to scare me or can the university punish me financially for wasting funding money that I earned In order to attend to my studies. It's not like I'm blowing this conference off because "I'm not feeling it" Going to this conference would really set me back in all of my classes. Any advice, this is really stressing me out.
Comment: I'm not sure if your worries are justified. You get to decide which sessions and social activities you attend; nobody will care if you're missing most of them. In fact, I know more than one researcher who claims to be more productive during conferences, as they're freed from the interruptions of their usual environment.
Comment: If your goal is to have an academic research career, the professional connections you can make at conference will have a greater and a longer lasting value than an A on any single test
Comment: You say "all of my classes", but even though I know some PhD programmes have classes in the early years, it is not clear from your question if you are in currently at the Masters or PhD level. Also, was it a conference with a peer reviewed submission, or not? And finally, in every case, _not spending_ funding money which was granted for any reason (and surely for something as "after some more consideration, I've changed my mind" makes it _much less likely_ for the same funding source to ever consider funding that same person and even lab again.
Answer: I suggest that you go and make the best use of the time, both at the conference and otherwise. You have a long plane ride in both directions. You have evenings if you forgo socializing. You have time between sessions to review course material if you have some notes on index cards or otherwise that are easy to carry.
You might even be successful in begging to put off the exam(s) for a day or so.
And, as others have said, if you have had a paper accepted then you have an obligation to present it. Making your advisor happy is worth something also.
And remember that in the last analysis, for moving on to grad school, more than your grades will be considered. Most especially letters from your advisor.
Comment: Actually, I hope you _did_ go, since you asked for advice so late.
Answer: First, you have to check the conference website. Most (if not all) conferences state clearly that submitting a paper REQUIRES at least one of the authors to attend to present the paper, and that if you do not, your paper is out (will not be included in the proceeding), so you have to look for another place.
Everyone is busy, but we must plan and respect others. The attendees' time is also valuable as yours. When they come and found many people behave like you, wouldn't this be a waste for their time and money?
Remember that you are building your own reputation. So by breaking your word you give the organizers and attendees (who are your fellows) a bad impression.
To me, frankly, how can I take you seriously as a researcher if I can not trust your promises? If you break your promises in attending the conference you can also break many rules in your research.
Comment: @Buffy OP got the request for funding accepted, that makes a strong enough point. That money may now not be available to some other student, depending on financial deadlines of the department. The reaction of the prof seems to indicate that dropping the ball on this might create problems for her.
Comment: It wasn't clear, actually, whether the OP had a paper accepted.
Answer: In addition to the answer by None, who correctly identifies that the paper will most likely not be included in the conference proceeding if none of the authors attend, there can be additional repercussions.
As far as I know, all the peer-reviewed conferences (in Computer Science) require at least one author to attend the conference and present the work in order to publish it. The session chairs will take note of any no-shows. The people that have not shown up can get blacklisted from all the conferences by the same publisher.1
Sending a replacement presenter is usually acceptable. If an author registered to attend but was unable due to last-minute developments (travel documents, illness, etc) they are required to prove that they have made a good-faith attempt to attend - or at last communicate this to the organisers who then may ask for proof (i.e. booked flight tickets, or a document showing you applied for a visa, or similar). I don't know what the official policy is if the author decides to retract the paper and not attend due to personal reasons (e.g. exam, friends birthday party), but in case of professional reasons I would still recommend notifying the organisers with the hopes of avoid or soften future negative consequences (e.g. it was not possible to obtain travel funding in the end).
While I do not through which mechanics this is enforced exactly, similar repercussions exist for not spending the granted funding money (or trying to re-purpose it in case of purpose-specific grants). I have often heard it said that not spending the grant money would diminish the chances, or even prevent the person from applying for funding with the same source again (occasionally resulting in a big project dinner to spend the "leftovers" around the end of the project).
1 This is true at least for IEEE conferences (IEEE being one of the larges Computer Science publishers), as I had it confirmed by a session chair at a large international conference.


PDE Fourier transform(heat equation)

Question: I solved the heat equation using the fourier transform method and got my solution to be
$$u(x,t)= \int_{-\infty}^{\infty}\frac{1}{\sqrt{4\pi kt}}\exp(\frac{-(x-y)^2}{4kt})\tag{1}$$
however I have intial condition $u(x,0) =\phi(x)$ . I can't seem to show how the intial condition is satisfied
Answer:
Here, we present a way forward that does not rely on knowledge of the theory or generalized functions (i.e., distributions).  Rather, we apply standard tools from real analysis.

Starting from the integral expression for $u(x,t)$, we have
$$u(x,t)=\frac{1}{\sqrt{4\pi kt}}\int_{-\infty}^\infty \phi(y) e^{-\frac{(x-y)^2}{4kt}}\,dy$$
Enforcing the substitution $y\mapsto x+\sqrt{4kt}y$ yields
$$\begin{align}
u(x,t)&=\frac{1}{\sqrt{\pi}}\int_{-\infty}^\infty \phi(x+\sqrt{4kt}y) e^{-y^2}\,dy\\\\
&=\phi(x)+\frac{1}{\sqrt{\pi}}\int_{-\infty}^\infty \left(\phi(x+\sqrt{4kt}y) -\phi(x)\right)\,e^{-y^2}\,dy\\\\
\end{align}$$
If $\phi(x)$ is continuous and bounded, then the Dominated Convergence Theorem guarantees that
$$\begin{align}
\lim_{t\to 0^+}\int_{-\infty}^\infty \left(\phi(x+\sqrt{4kt}y) -\phi(x)\right)\,e^{-y^2}\,dy&=\int_{-\infty}^\infty \lim_{t\to 0^+}\left(\phi(x+\sqrt{4kt}y) -\phi(x)\right)\,e^{-y^2}\,dy\\\\
&=0
\end{align}$$
Therefore, we have
$$\bbox[5px,border:2px solid #C0A000]{\lim_{t\to 0^+}u(x,t)=\phi(x)}$$
as was to be shown!
Comment: Since $\phi$ is bounded in absolute value, say by $M>0$, then surely the integrand is less than $g(y) = 2Me^{-y^2}\in L^1$.  And the DCT applies.
Comment: Hi, I know its too late, but I dont understand why does it follow from the continuity and boundedness of the function $\phi$ that you can use Dominated Convergence Theorem. For that Theorem you need some integrable function $g$ such that $\phi_n \leq g$, right?
Comment: Oh, thank you, I understand now. :)
Answer: You should have gotten $$u(x,t) = \int^\infty_{-\infty} \frac{1}{\sqrt{4\pi k t}} e^{\frac{-(x-y)^2}{4kt}} \phi(y) dy;$$ i.e., the initial condition should be included in there. Then $u(x,0) = \phi(x)$ since $\frac{1}{\sqrt{4\pi k t}} e^{\frac{-(x-y)^2}{4kt}} \to \delta(x)$ as $t \to 0^+$ in the distributional sense, where $\delta(x)$ is the Dirac mass centered at $x$ (any decent early graduate level PDE book should have a proof that the heat kernel tends to the Dirac mass).

PDE Fourier transform(heat equation)


FIPS 140-2 Compliance SHA256Managed and SHA256Cng in .NET

Question: I'm currently performing some analysis and one of the finer details that had me puzzled was the following. What is the difference between SHA256Managed and SHA256Cng in regards to SHA256Cng meeting FIPS 140-2 Compliance? I know the outputs from both Hashing algorithms is identical but I was hoping someone could provide me a more detailed explanation as to what deems it to be FIPS 140-2 Compliant.
Answer: FIPS compliance doesn't just mean that the output is validated, it also means that you perform e.g. startup tests to see if the algorithm works as intended. So there is an implementation part to it as well:
From FIPS 140:

Required and optional interfaces. Specification of all interfaces and of all input and output data paths.
Power-up tests: cryptographic algorithm tests, software/firmware integrity tests, critical functions tests. Conditional tests.
Configuration management system. Secure distribution. Functional specification.

FIPS 140 compliance is for cryptographic modules. The hashing is just a small part of it. It doesn't just target functionality, but also how it has been designed, documented, maintained, etc.
Comment: Thanks for the input that makes more sense. I was hoping someone would know the exact specifics of what differs between the two based on the criteria you listed from FIPS 140 though.


Filtering Google Maps Markers By Category Using GeoRSS

Question: I've got a map set up displaying markers from a geoRSS file. These markers are grouped by category. What I'd like to do is set up text links for the categories that, when clicked,  hide all markers except for those in the associated group. Not sure where to start with this.
Answer: I've not worked with geoRSS before, but see this tutorial for how to go about filtering markers by category. There's a version for V3 here - hope that is close to what you're looking to do!


Automatic Tissue Dispenser

Question: My father is a software engineer and yesterday he asked me a question to test me, that I cannot, for the life of me, seem to figure out. He told me that I need to make a tissue paper dispenser that, upon activation, would dispense tissue paper of only length 15cm. Now suppose I have a tissue roll of 7.5 cm with a hole in the center of the roll with a radius of 3 cm, height 15 cm and the thickness of one sheet of tissue being 0.1mm. The tissue paper roll would go onto a stand and that stand is controlled by the rotations of a motor fixed to it. Now you tell me, how would this machine of yours work. Would the rotation of the motor in order to dispense be angle of rotation dependent or would it be time dependent? How would you account for the continuously changing radius of the toilet paper? What would be the formula, rather, algorithm you would use for this rotation of the motor and the continual change of radius, considering you need some buffer length of tissue from the roll to the cutter?
Comment: I'd be more concerned about how to stop the paper tearing then the loose end sticking to the roll messing with the feed. When I need toilet paper and none comes out, that is much worse than if 20cm comes out when it should be 15cm.
Answer: Use two drive rollers with the paper gripped between, then drive the rollers with a stepper motor or even a cam and switch to control the length.
That way the diameter of the supply roller is moot.
Comment: What about those crappy rolls where it is so tight or mashed it tears when you pull on it? Though I suppose the paper tearing at any point by mistake or the user could leave the loose end stuck to the roll even if it was on a spindle and not pull rollers.
Answer: A partially non-contact method would be to use the components and circuit of an optical mouse. A roller on the surface roll would keep the mouse circuit a uniform distance from the material on the roll, while the circuit provides a measurement reference. When one considers that some optical devices advertise four hundred dots per inch, one could expect excessive accuracy in the dispensing.
Answer: If you want to use an angle sensor you could use a second distance sensor to measure roll diameter before you start dispensing and just assume the diameter is constant as you roll out one sheet rather than doing a spiral calculation. Because accuracy isn't that important, the sheet is short, and the paper is very thin relative to  the diameter of an empty roll, let alone a full roll.
Answer: Use a surface drive; the radius wouldn't matter.

Automatic Tissue Dispenser


What can I do with an SQL shell using SQLMap?

Question: I was just messing around with SQLMap on Kali and I have now got an --sql-shell on the main database. With this, I wondered what I can do now with this access. How would I insert data into the database et cetera is this possible?
Comment: Look up "privilege escalation." Obviously, you should also learn how to use SQL.
Answer: Typically, one would use either the --sql-query flag (one line at a time) or your --sql-shell flag (which provides a SQLi REPL, or interactive shell) to test out functionality of the found SQLi against the target RDBMS' capabilities. This is often only needed when outside of the scope of what sqlmap can already perform, capability-wise.
Two prominent examples are:

https://websec.ca/kb/sql_injection#MySQL_Reading_Files

Finding the base directory for LOAD_FILE() by using select @@datadir against MySQL / MariaDB.
Hoping for the default file size allowed or querying it for a fit using select @@max_allowed_packet in this same attack scenario.

https://websec.ca/kb/sql_injection#MSSQL_Server_Hostname

Querying an MS-SQL Server Hostname (select @@servername) or even the productversion/productlevel/edition. In MySQL / MariaDB this same command would be select @@hostname from the sql-shell REPL.
Answer: What can you do with SQLmap?
Your question is What can I do with an SQL shell?
Short answer: (almost) anything!
Nuanced answer: depending on the rights of the user that is running on your end-point, almost nothing, something or possibly anything.
But, the only right question would be:

What should you do with SQLmap?
SQLMap is not something that you should be "messing around" with and to "insert data" with. That affects the integrity of the database. Inserting, deleting or altering even a small thing, makes the database corrupt. Either way you have ethical intentions or have no idea what you're doing.
SQLmap it selfs states the following for a good reason:

Usage of sqlmap for attacking targets without prior mutual consent is
  illegal. It is the end user's responsibility to obey all applicable
  local, state and federal laws. Developers assume no liability and are
  not responsible for any misuse or damage caused by this program.
Source: http://sqlmap.org/

Be ethical!
It's good you're interested in information security and "playing around" with tools like "Kali" and "SQLmap" will give you powerfull skills. But use them good! Hopefully, in the best case you do that on a test environment that you own and run. Or in a second best case on a target that you have upfront permission from to test. WebGoat is a good example of such project: https://github.com/WebGoat/WebGoat.
Hacking is only legal when you have upfront permission and understanding with your customer about how, where and when you'll perform the test. This is called Ethical Hacking, the only way of "legal" hacking. Also the understanding usually includes defined testing borders about what you can and especially cannot do. Borders that should not be crossed. Mostly part of this borders are quite simple, proof a vulnerability or risk (even theoretically) by not altering, inserting or deleting any of it's data (in other words, read-only), unless you have explicit permission to do so.
Furthermore, I'd like to advice to only practice your SQLmap skills in one of the following three cases:

You own the environment (it's your test environment, in order to gain skills with the SQLmap tool)
You have upfront permission of the target you're hacking. Having a clear understatement of two parties about rules and borders.
You stick to Bug Bounty programs like on HackerOne and BugCrowd accepting and respecting the rules of the specific program.
Answer: If the sql user has write permission on the table you can use an INSERT INTO command to insert data into the table.
On w3school you can find more info on how to write sql-statements.
Answer: With the SQL Shell in SQLMap You do almost all the things that you could do in a local SQL Database. Like Querying the database for data, modifying data, until the user you got access as has the necessary permissions to it.


Following up after technical test

Question: I have a question regarding my job search. Recently a recruiter got back to me after a job application and requested to complete a technical test which I did on the same day and then advised him on email of completion. It's been a week now and I haven't received any acknowledgement email. Should I follow up with him at this stage or is it too early? How exactly should I phrase my follow up email?
Comment: Remember there are many applicants. You don't know the criteria for selection. If the recruiter likes you or you are selected , i guarantee you he will call you. No need to follow up in my opinion
Comment: I would call to follow up if they have not responded to email.
Answer: I think this can be expanded beyond just following up after a test. I would say that in general, it is worthwhile to either send a followup email or make a followup call when it has been more than a week since hearing from a potential employer during the hiring process.
The worst thing that happens is they tell you they aren't interested in hiring you, and if that is the case then it is better to know than not know.
The list of good things that could happen from a followup is long. It shows them that you care about getting that job, it may push them to making a decision more quickly, it may remind them to take a look at your test results, and many more things I am probably not thinking of.
Now that said make sure you word the followup in a way that doesn't make it seem like you are trying to rush them or are getting impatient. Something like "Hello, this is [insert name here], I haven't heard from you since my last email so I just wanted to contact you and make sure you had a chance to look over my online test results" is a lot more likely to evoke a positive response than "Hey, why haven't you gotten back to me yet?"
Comment: Ok, so I did a follow up and still no reply. Should I call him up or assume it's a silent rejection? Thanks.
Comment: The way I see it, either they are silently rejecting you, or they are so bad at communication and organization that you don't want to work there anyway. Either way, I would move on at this point

Following up after technical test


what cpu will work with hyper v

Question: how do i verify if a cpu has the necessary requirements to run hyper v ?
Answer: From the Hyper-V FAQ:
<code>Q.  What are the system requirements for Hyper-V?

A.  In addition to the systems requirement for Windows Server 2008,
    the two key requirements for the Hyper-V platform are the need
    to ensure that the server is a 64-bit environment and supports
    hardware-assisted virtualization (Intel VT or AMD-V) technology.
</code>
http://www.microsoft.com/windowsserver2008/en/us/hyperv-faq.aspx
Answer: You can use a tool called SecurAble which will tell you if your CPU supports Virtualisation Technologies, which is what you need to run Hyper-V.  It will also tell you the number of bits supported by your CPU and if it supports DEP
Comment: +1 for SecurAble if you already have the CPU in question in a running machine.  Here is the web page explaining SecurAble:

http://www.grc.com/securable.htm
Answer: Your CPU must support Virtualization extensions.  An easy way to check this is to search for your CPU model number in Google and look for a NewEgg.com link (this will find old models, unlike NewEgg's search).  Check the "Virtualization Technology Support" field.
Be aware that this feature is typically disabled by default in the BIOS.
Comment: Extension names for Intel are VT-i and VT-d. For AMD it's AMD-V.
Answer: A great site to see if your intel-cpu supports virtualisation is the Intel Processorfinder, the cheaper cpu's often doesn't support VT.
Almost all recent AMD processors support AMD-V.

what cpu will work with hyper v


In Magento2 graphql i want to add a field to the root query of the Magento GraphQL API called `isLoggedIn`. This should return `Boolean`

Question: In Magento2 graphql i want to add a field to the root query of the Magento GraphQL API called isLoggedIn. This should return Boolean whether the customer is logged in or not.
Answer: I couldn't find any GraphQL API Query named with "isLoggedIn" on Magento2 devdocs. Hence, I would not able to provide you the exact code to achieve your requirements.
However, I can explain you the concept vise. First, you need to create one file named as "schema.graphqls" in etc folder in your custom module (please create custom module if not exist any).
In this file, suppose if you want to add an additional field at root level of "Cart Query" then you need to write as below:
type Cart {
    extra_fields: YourExtraFields @resolver(class: "\\Namespace\\Modulename\\Model\\Resolver\\YourExtraFieldsResolver") @doc(description:"Additional custom fields used in the project.")
}

type YourExtraFields {
    field_first: Int! @doc(description: "The first field number count")
    field_second: Boolean! @doc(description: "The second field flag")
}

Now, you need to create a resolver file at the given path in model folder. In that file you just need to write your business logic and need to return all field values added in "YourExtraFields" schema.
Once the code is done, you can check in Altair and your new field(s) would be displayed in the respective api schema. I have done this on number of times in my project.
Let me know if you need any further assistance.
Happy to help!
Comment: Thanks for answer. Does it check whether the customer is logged in or not? Can you send me this small magento module having above mentioned functionality. I am new to magento graphql, so I have little beginner technical knowledge about it.
Comment: @SanaullahAhmad, if you are using any existing customer graphql api then you can access customer object  and you can check/use its properties. However, if you are building a new custom GraphQL api then you will to write whole business logic by your own. I will surely share some piece of demo code once I get some free time.
Answer: As @Pratik explained how to do it, For further info do look into Magento resolvers
Which goes into your
type Cart {
    extra_fields: YourExtraFields @resolver(class: "\\Namespace\\Modulename\\Model\\Resolver\\YourExtraFieldsResolver") @doc(description:"Additional custom fields used in the project.")
}

Hope it helps.


Is a good practice to create a local variable and assign a field's value

Question: Suppose we have a class with a field x. It is a value type, not an entity (let's say int or string). We create an instance method and use the field, not changing its value.
Is it a good practice to create a new local variable and assign the x's value to it? Consider the following example in pseudocode:
private instance-method(n) {
  const float x = this.x
  float y = x * x + math.sin(x)
  y += this.monte-carlo(this.space, x, n)
  this.result.y = y
}

I could use this.x * this.x + math.sin(this.x) instead, but I think it's less readable as there are too many this words. On the other hand, it is an extra line of code, which doesn't bring about much. And as regards forcing x to stay const, in most languages we can force it anyway in other ways.
What are pros and cons of such an approach? Is it a good practice? Does it make the code more readable or less readable?
Answer: In general, no, it's not usually a good practice.  I'm curious, though:  What language are you using?  Most common programming languages will allow you to refer to a member variable without requiring "this." ... and I don't know of any that allow using a hyphen in a variable or function name.
Comment: In Typescript you also have to use `this` AFAIK
Comment: Python doesn't allow that. You have to use `self.x`. Of course hyphen isn't allowed, but I think it's nice to use hyphens in pseudocode
Answer: If it helps readability, I would consider it good practice. In your example, the readability isn't affected that much so it could really go either way. But in general, optimizing for readability first is good practice.
I think this answer helps sum it up:

Code is read much more often than it is written, so you should take pity on the poor soul who will have to read the code six months from now (it may be you) and strive for the clearest, easiest to understand code. In my opinion, the first form, with local variables, is much more understandable. I see three actions on three lines, rather than three actions on one line.

https://softwareengineering.stackexchange.com/questions/339384/should-we-eliminate-local-variables-if-we-can


Delete files ending in -Copy

Question: I accidentally copied A LOT of files to the same directory, and they now all end in - Copy, like i would have a file called song.mp3 and another one called song - Copy.mp3. Is there a quick and easy way to remove all the copies?
Answer: Click in the blank space in the address bar of File Explorer, type cmd, and press Enter. A command prompt window appears. Type del "* - Copy.*" and press Enter. That command erases (permanently!) all files whose titles end with - Copy.
If you're worried about transcribing the command incorrectly, you can make a copy of the whole folder first.
In the future, you can press Ctrl+Z to undo a copy operation as long as you perform no other file management operations in the intervening time.
Comment: thanks! I missed the closing quotation the first time, and I'm using Recuva to recover them all (its going to take a while, a few GB of songs). I'll test your command after its done!
Comment: @Jeffmagma The closing quotation actually doesn't matter, but the opening one certainly does. `del` should have given you a warning before erasing all files in the folder, though. Interesting.
Comment: I thought the first one was a stray quotation and i thought the prompt was normal... seems like I have quite a bit to learn about these commands

Delete files ending in -Copy


Looking for a short story about staged military conflict as performance

Question: Looking for a short story about a group to troupe fighting staged military conflict as performance for assessed points. It isn't Mack Reynold's "Mercenary", and contains a reference to another "troupe" performing a "battle of Maldon" scenario
Comment: Are the members of the troupe humans or androids?
Comment: Is the "staged military conflict" a tank battle, or is it a battle of horse cavalry, or spaceships with force fields and ray cannons, or bows and arrows, or what?
Comment: They are human. Troupe appears to be about platoon size, narrator appears to be sergeant-equivalent. Background scenario is similar in some ways to "Mercenary" in that conflicts are fought within restricted areas using regulated types of hand weapons and assessed or marked by some sort of adjudicator.
Answer: I believe this is "Curtains" (1974) by George Alec Effinger.  First published in Fantasy & Science Fiction, it was anthologized in Haldeman's Study War No More.
Performing troupe fighting a staged military conflict (Sargent Weinraub is reading a review of their last performance):

"'And then there's Delta Company,'" said Weinraub, continuing to read from the magazine, "'a rather shabby troupe seemingly dedicated to defending our borders in the tritest ways imaginable. This week, in preparation for the first great offensive of the war, rumored to be a massive invasion of the European enemy's homeland. Delta Company attempted to consolidate its gains of the previous months. There was no secret about the importance of this performance. But, for some reason, the company dragged out the oldest, silliest ploy known to modern warfare. Dressed in civilian clothes, the company divided itself into two equal "gangs" and staged a sort of teen-age street fight. I don't know about my colleagues, but I myself have grown excessively weary of such tired examples of low-level creativity.'"

Another troupe performing the Battle of Maldon:

"I don't know," said Sgt. Weinraub. "Some South American company did the Battle of Maldon thing. You know, a losing cause but loyal warriors, fighting to the last man to avenge the death of their stupid leader. I would have figured that would really tickle the audience, the whole company of them going out in a huge blaze of glory. But the review just said something about 'pyrotechnic nonsense.' They want simple basic stuff these days. The tear-jerkers aren't getting points anymore."

You can read the story as originally published in the August 1974 copy of F&SF at the Internet Archive.


Prevent smart reply buttons appearing for Gmail users who receive my emails

Question: Is there any way to add content to an email that will prevent the smart reply buttons from showing in a Gmail recipients mailbox? I am sending emails to clients that I do not want the smart reply buttons to show up in their Gmail app as they are incorrect and misleading.
Comment: As of October 2018, it's [finally possible to turn this feature off in your own inbox](https://webapps.stackexchange.com/a/121319/45078), but there doesn't seem to be any way to stop the fake-reply buttons appearing in your recipients' inboxes. If your clients dislike the feature, you can suggest they turn it off themselves using that linked setting.
Comment: Checkout [Resources for Senders](https://developers.google.com/gmail/design/) from Google Developers
Comment: @Rubén i looked through it but couldnt find anything specific to the smart reply buttons. looks like i would be able to add my own actions but the smart reply buttons would probably still show
Comment: @jeffreypriebe I think this is the opposite problem.  In the proposed duplicate, the user is trying to get rid of the icons from their *own* inbox.
Comment: @jonsca, you are absolutely correct. I was moving too fast, *this is not a duplicate* - a logician could tell us what it actually is.
Comment: @jeffreypriebe It is absolutely no problem whatsoever.  I did the same thing on an SO question last night :) Thanks for your diligence.
Answer: As of October 2018 you can now make a change to your settings that will prevent this feature appearing on emails you receive. That change will apply to emails even if they aren't from Gmail users.
You can think of it a special filter that is applied to incommoding emails. If the application believes the smart_reply filter applies, then you will see the smart reply options when you read the email.
Because it is a special filter on incoming email, you have no ability to modify settings on the recipients Gmail account. If they allowed you that power it would be dangerous.


How to get a construction paper look in photoshop or illustrator

Question: I am looking to create some graphics or logos that look and feel very much like that thicker colored construction paper in photoshop or illustrator cs6
Example here:  http://dribbble.com/shots/908746-EOY-2012-Hot-Springs?list=users
and here : http://dribbble.com/shots/133424-Marina?list=users
Any thoughts here?
Comment: Te easiest solution is to merely find a texture and overlay it.
Comment: Do you have an example of the texture you're looking for?
Answer: Illustrator:

Fill a shape with the desired color.
Create a second fill via the Appearance Panel. Make the second fill black. Highlight this fill in the Appearance Panel.
Choose Effect > Texture > Grain. The settings below are a good starting point. Lower the intensity if you want more grain.

Now set this black fill to Multiply for the Blend mode and reduce the opacity so the grain is less prominent.

You can repeat the fills with various grain settings to enhance the texture if you'd like.

Photoshop:

new layer above contents
Fill new layer with black
Filter > Noise > Add Noise and adjust settings so there's small amount of white noise.
Image > Adjustments > Invert
set Noise layer blending mode to Multiply and reduce the opacity to your liking.
If you want this on a shape, then Option/Alt-click between the two layers.
You can further enhance the grain by repeating the above steps and scaling the noise layer up to create larger "clumps" of noise. There's an answer to this question which will provide some detail on adding grain to images in Photoshop.
Answer: Those are raster texture images placed in Illustrator. Probably scans of actual paper. Scott's answer will do in a pinch but that's not what's going on in the samples you provided. They're a little more convincing than Illustrator's effect.
SubtlePatterns.com has some very nice paper textures to choose from. You could also try your hand and building your own tileable texture.
I've done a screen shot version of how to quickly create a tiled patten before. Here's the quick run down.

Place the texture of your choosing
Use a transform effect to move and duplicate the linked/embedded file horizontally with as many duplicates as needed.
Apply another transform to cover the vertical dimension
Apply a clipping mask to restrict the texture to your desired area
You can apply a background color to the clipping mask and blend the placed text into it
Answer: I think this tutorial will help you:
http://www.youtube.com/watch?v=cXaMpsZIk9Y
It goes into detail about how to create a distressed texture. It uses a halftone effect, but you don't have to do that.


How to add two dependent random variables?

Question: I know, I can't use convolution.
I have two random variables A and B and they're dependent.
I need Distributive function of A+B
Comment: It's not a dumb question Mesko, but what people are pointing out is that it needs more information.  The answer depends on *how* $A$ and $B$ fail to be independent.  A full description of that is given by the joint distribution of $A$ and $B$, which is what vinux asks.  Xi'an is probing a little more delicately but really seeks the same kind of information in order to help you make progress.
Comment: If A and B are dependent, then joint distribution of A and B is required to arrive distribution of A+B.
Comment: I do not understand your question. What do you know and why can't you use convolution?
Comment: I know Distributive function of A and B.
f A and B are two independent, continuous random variables, then I can find the distribution of Z=A+B by taking the convolution of f(A) and g(B):
h(z)=(f∗g)(z)=∫∞−∞f(A)g(z−B)dA

But what can I do, when they're not independent ?
I am sorry, if this is dumb question.
Answer: As vinux points out, one needs the joint distribution of $A$ and $B$, and
it is not obvious from OP Mesko's response "I know Distributive function of A and B"
that he is saying he knows the joint distribution of A and B: he may well
be saying that he knows the marginal distributions of A and B.  However,
assuming that Mesko does know the joint distribution, the answer is given below.
From the convolution integral in OP Mesko's comment (which is wrong, by the way), it could be inferred that
Mesko is interested in jointly continuous random variables $A$ and $B$  with joint probability density function $f_{A,B}(a,b)$. In this case,
$$f_{A+B}(z) = \int_{-\infty}^{\infty} f_{A,B}(a,z-a) \mathrm da
= \int_{-\infty}^{\infty} f_{A,B}(z-b,b) \mathrm db.$$
When $A$ and $B$ are independent, the joint density function factors into the
product of the marginal density functions: $f_{A,B}(a,z-a)=f_{A}(a)f_{B}(z-a)$
and we get the more familiar
convolution formula for independent random variables.  A similar result
applies for discrete random variables as well.
Things are more complicated if $A$ and $B$ are not jointly continuous, or
if one random variable is continuous and the other is discrete.  However,
in all cases, one can always find the cumulative probability distribution
function $F_{A+B}(z)$ of $A+B$ as the total probability mass in the region of
the plane specified as $\{(a,b) \colon a+b \leq z\}$ and compute the probability
density function, or the probability mass function, or whatever, from the
distribution function.  Indeed the above formula is obtained by writing
$F_{A+B}(z)$ as a double integral of the joint density function over the
specified region and then "differentiating under the integral
sign.''
Comment: This is related to my comment and [answer](http://stats.stackexchange.com/a/21492/7224) on [another question](http://stats.stackexchange.com/q/21335/7224) dealing with joint distributions a few days ago.
Answer: Beforehand , I don't know if what i'm saying is correct but I got stuck on the same problem and I tried to solve it in this way:
express the joint distribution using the heaviside step function:
$$
f_{A,B}(a,b)=(a+b) H(a,b) H(-a+1,-b+1)
$$
or equivalently
$$
f_{A,B}(a,b)=(a+b)(H(a)-H(a-1))(H(b)-H(b-1))
$$
Now you can perform the integral without caring about limits of integration.
This is the wolfram rapresentation of the joint : A
Computing the integral I have : B
Plotted : C
That's the function :
$$ f(z)=\left\{\begin{matrix}
z^2 \qquad \qquad  \; \quad for \quad 0\leq z \leq1\\ 1-(z-1)^2 \quad for  \quad 1\leq z \leq 2 \\ 0 \qquad \quad \; otherwise
\end{matrix}\right. $$
and it's normalized as you can easily check.
Comment: The question did nt seem to be specific enough about the joint distribution to get an answer.  How did you come up with one.?
Comment: +1 for correctly solving the alleged counterexample in @cdlg's answer and showing that the calculations _if carried out correctly_ do give the correct answer, and not the erroneous s results in cdlg's answer.  I can't believe that that answer has received two upvotes.


How to copy or move to folder in Nautilus 2.30.1 like in Windows Explorer?

Question: How to copy or move to folder in Nautilus 2.30.1 like in Windows Explorer? The only such options available in the context menu point to Home or Desktop, when I want to copy or move to another folder or drive.
Comment: You mean the "Send to" option in Explorer? Why would Nautilus necessarily have that?
Comment: And for those of us who, when they need to copy a file in Windows Explorer, start zsh in mintty: how do you copy a file in Windows Explorer?
Comment: This is a good question, I've been looking for this too. In Windows Explorer it is nice that you can right-click-drag to the destination and then choose between copy/move. Sure you can click on copy/cut and then paste at the destination, but that's a lot of clicking. I see an answer below says there is middle-click-drag in nautilus for the same effect, can't wait to try it.
Comment: @mohand: On the stackexchange sites it is custom to select one of the answers and to mark it as the accepted answer. Just click the checkmark below the ratings for an answer on the answer that you feel best answers the question. For instance, to select Janos' answer to drag with the middle mouse button, check the checkmark that appears under his rating when you hover the mouse there. Thanks!
Answer: What do you mean by "like in Windows Explorer"? Can you not select Copy / Move from the context menu (right-click menu) and then select Paste at the destination? If you want to add "shortcut" or "favorite" directories you can add them to the left-side pane, just as you had a list "Send to..." in Explorer. Dragging to these folders in the pane will Copy / Move your folder or files.
Answer: You can also drag with the middle button, Nautilus will ask for copy/cut/link
Comment: not anymore in later versions of nautilus
Answer: It sounds like you're pretty new to Linux. It takes a while to understand the principles (well, some distributions take longer to understand). Keep your head up!
After a while you'll see that the command line is pretty neat. You can copy/move files with the following commands.
Copy:
cp /path/to/file/you/want/to/copy/foo.txt /path/where/to/copy/it/foo.txt

Move:
mv /path/to/file/you/want/to/move/foo.txt /path/where/to/move/it/foo.txt

If you're interested, have a look at http://linuxcommand.org/lc3_learning_the_shell.php.


How can you fly your own military jet in terms of altitude and acrobatics?

Question: So I know that you can legally buy and fly a military jet like the Mig-29 and the SU-27 https://www.wired.com/2010/01/own-the-coolest-jet-on-your-block/ and https://www.thedrive.com/the-war-zone/29292/you-can-buy-paul-allens-mig-29-fulcrum-jet-fighter. But practically can you fly it? I mean how high can you climb? How fast can you go (I know no supersonic flights are allowed above land, but what about sea)? Can you do barrel rolls and pull Gs? Also, can you use it to fly internationally (assuming that you can attach external fuel tanks in the first place)? Can you actually have fun with it lol?
Assume that money is no issue.
Answer:
But practically can you fly it?

Sure.

I mean how high can you climb?

As high as you want, assuming you have an oxygen delivery system (14 CFR 91.211, note that "civil aircraft" means "any aircraft not a public aircraft" means "any aircraft not owned by the government," so you can't get out of it that way) and assuming both you and the plane are certified for IFR flight (14 CFR 91.135).

How fast can you go (I know no supersonic flights are allowed above land, but what about sea)?

Below 10,000 MSL no faster than 250 KT, and below a Bravo shelf or near a Charlie/Delta airport no faster than 200 KT, unless the minimum safe airspeed for the aircraft is higher than that (14 CFR 91.117). For supersonic flight see 14 CFR 91.817, 91.819, 91.821.

Can you do barrel rolls and pull Gs?

Assuming the aircraft is certified for aerobatic flight (or perhaps if it has an experimental certification), yes, as long as you comply with the restrictions in 14 CFR 91.303; or failing that, submit an application for a waiver of Part 91 rules (FAA Form 7711-2) (see also) and get such a waiver.

Also, can you use it to fly internationally (assuming that you can attach external fuel tanks in the first place)?

Yes, if you comply with each country's respective airspace/border entry rules.

Can you actually have fun with it lol? Assume that money is no issue.

Depends what you think is fun.
Basically there are no special rules for ex-military aircraft; if you can legally get your hands on one, and if you can legally fly it, you can do whatever any other aircraft is allowed to do as long as you follow the rules any other aircraft has to follow.
Comment: @RalphJ IFR aircraft can request a 3D block of airspace for maneuvers. The details of how is a new question.
Comment: *"Basically there are no special rules for ex-military aircraft"* I'm not sure this is entirely true. Typically to be able to fly recreationally, they need to be certified or experimental, which means that they really can only be certified under "experimental / exhibition". This places a lot of restrictions on what you can do with them...
Comment: @RonBeyer Fair point, let's say "There are no special rules for ex-military aircraft beyond the restrictions placed on any other experimental aircraft."
Comment: Thanks a lot...
Comment: Well... it's a clear day & you can fly VFR below 18,000' and do acrobatics in anyplace sufficiently away from airways & airports & such things.  BUT, what if you want to do acro up into what's normally the flight levels??? The military has MOA's and restricted areas to do exactly this; how can a civilian jet get access to a block of airspace he's allowed to use & maneuver in that extends above 18,000'? Is there a way to coordinate that with ATC (in advance) for specific lateral limits up to some specified higher altitude?
Comment: I ask because I don't ***think*** you could loop a T-38 between 10,000' and 180, and you most certainly couldn't do it at only 300 knots at the bottom (which was that aircraft's waiver to 250-below-10). Fast jets need ***lots*** of room for vertical maneuvering!


Vector Imported curves not moving on Z axis

Question: I wanted to make some 3D infographics, so I imported some vector images into blender via Inkscape. Normally, I can edit and move the points on a curve through all three dimensions, but for some reason these will only move on the x and y axes.
I want to make the arrows point up and around as well, but this kinda impedes it.
Answer: Using a 2D curve implies that the Local Z coordinate of each control point is 0.

From the Blender manual's page about the topic:

By default, new curves are set to be 3D, which means that Control Points can be placed anywhere in 3D space. Curves can also be set to 2D which constrain the Control Points to the Curve's local XY axis.

In a 2D curve you can't even set it's origin's Z coordinate with the 3D cursor. It is forced to lay on the plane where the the control points are.
You should switch the curve nature to 3D to be able to move them up and down.
Comment: I think I tried that before, and the plane that was created from the points got totally bizarre. I'll try it again though....
Comment: I know, handlind 2D curve is much easier. Their are just 2D. When converting to 3D curves, there are more things to consider to make it look right.
Comment: So would it be easier to fix these curves, or just hand model my own using the others for reference? I added the what it looks like up there.
Comment: It depends on which way you are going to use them, your projet's goals... Anyway I would use them, the difficult part is handling a 3D curve, not drawing the 2D contour.
Comment: Consider that until you don't have faces the Solidify modifier can't help. http://postimg.org/image/4k9pkwt4d/ And remember to adjust the Normal size with an appropriate value for your geometry size


Which is better tool for Blackberry application development?

Question: Which gui development option gives a optimized and faster gui for Blackberry applications?
BB tools,J2ME tools,or any other UI toolkit like LWUIT ?
Answer: The BlackBerry UI classes, without a doubt.  You get access to all the BlackBerry specific UI stuff - the BB keycodes, special keys, events, better control over your app's menus, touch screen stuff for the Storm, integration with all the components on the BlackBerry (browser, maps, homescreen icons).  Better application life cycle support, including running in the background.
You may be tempted to use the J2ME classes or LWUIT if you're very interested in porting to another J2ME platform but trust me you'll kick yourself for it later.  If portability is a concern, better to separate the more platform-independent parts of your app (business logic, networking) into separate packages and build two UIs.  Also if you're like everyone else you'll want to port to iPhone before any other J2ME platforms anyway :)
Edit: Remembered I also wrote a blog post about this a while back - lots of the same info, but some more details that might help
Comment: Good advice re: separate UIs, LWUIT performance is terrible on the BlackBerry anyway!
Answer: I am currently dealing with this issue, i have an app targeted for J2ME using LWUIT and ported LWUIT to blackberry, the peformance is not encouraging, i think seperating business logic is the way to go. Now looking into RIM UI's.


Build different products out of common base (Java)

Question: I'm looking for a way of packaging different products out of a common base.  This could be, for example, for packaging a light version of a product or a specially customized edition.
The differences between my different products are mainly the following:

Producing different configuration files (text files) out of a single one (could be slight differences or larger blocks removed, added, etc.)
Filtering (removing), adding or overriding groups of files (help files, entire modules, etc.)

I'm exploring different solutions related to either Maven or Ant (or whatever else).  For example: using a velocity plugin to generate the different config files at build time.
I'm wondering though if there are better tools to adress that kind of problem.  There are lots of commercial products out there that are distributed in different "flavours" so I'm thinking there must be existing tools or best practices for creating different packaging like that.
Any insight would be appreciated!
Comment: have you checked out what Maven2 'profiles' can do for you? It will at least be able to set different values for configuration properties.
Answer: The maven-shade-plugin is your friend, combined with profiles. You can use it to merge disparate JAR files and things like META-INF spec files.


Should questions asking for book recommendation be on topic?

Question: We all need to learn, and sometimes a book is our preferred method. Should questions asking for book recommendations be on topic?
Answer: Questions about "which book" have the same issues as product recommendation questions. Mainly that there are multiple correct answers, they attract spam and people accidentally getting flagged for spam, they are regional, change over time, and opinion based. This would be better asked in the chat room, or to simply compare the product reviews from an online retailer.
Answer: Sometimes books are timeless. Some techniques written in those books will last longer than this site probably will. With that in mind, I agree that book recommendations could encourage spam. I'm wondering if this would be something which could be worked into a blog. Such as, someone buys a book, finds it useful, then is willing to write a blog entry about the book based on its merits. It would keep it off the main site, but allow the information to be known. If someone found a book to be particularly helpful or non-helpful, it would go in here. A blog could be used for a lot more than that, as well. I know some episodes of TV DIY shows could get reviewed, or in particular a write-up about how to do things which wouldn't really fit in with the SE Q&A model.
Answer: A book is a tool, meaning a device that helps you accomplish a task. If someone is looking for know-how on how to get started with home improvement projects then a good book on the subject is of a huge value.
Comparing product reviews from online sellers is iffy, people get paid to write and spam those too.
If worried about spam you deal with it as it comes up. If no one asked for a book suggestion and someone posts one then you can pretty much call it spam. Saying you won't do item X becuase of item Y strikes me as a bit silly.


Nested directory depth limit in ext4

Question: Is there any limit for the maximum nested directories in the ext4 filesystem? For example ISO-9660 filesystem AFAIK cannot have more than 7 level of sub-directories.
Answer: There isn't any limit inherent in the file system design itself, and experimentation (thanks ilkkachu) shows that directories can be nested to a depth exceeding limits one might naïvely expect (PATH_MAX, 4096 on Linux, although that limits the length of paths passed to system calls and can be worked around with relative paths).
Part of the implementation apparently assumes that the overall path length, inside a given file system, never goes above PATH_MAX; see the directory hashing functions which allocate PATH_MAX bytes.
The only directory-related limit which seems to be checked in the file system implementation is the length of an individual path component, which is limited to 255 bytes; but that doesn't have any bearing on the nested depth.
Comment: `PATH_MAX` isn't really the maximum overall path length, but (IIRC) the maximum path length accepted by a system call. I don't know how that works with the hashing functions, but e.g. something like this works on my Debian (if slowly): `d=abcdefghijklmnopqrstu; for i in {1..999}; do echo $i; mkdir $d; cd $d; done`. The resulting path is 21983 bytes long, as shown by Bash's `pwd | wc`. (Maybe I should have tried to see if `/bin/pwd` croaks on it)
Comment: @ilkkachu But you'll get **File name too long** if you for example **ls** one of the directories with the length above 4095.So yes looks like that's the limit of what a syscall can handle not what the filesystem can handle.You just have to select one directory at a time like what ```rm -rf``` would do.It doesn't cause any error and can remove all the subdirs successfully.Thanks for pointing that out.
Comment: @ParsaMousavi, yes. Keeping track of the length of the name of a whole path, or just the nesting depth itself would seem to be rather difficult, since we can rename directories at any time (making the name of that subtree longer), move directories inside others (changing the nesting depth of everything in that subtree), and probably most problematically also mount filesystems at an arbitrary depth. Related post I stumbled upon: https://eklitzke.org/path-max-is-tricky
Comment: @ilkkachu Also feel free to post your thoughts as an answer.
Answer: According to ext(4) man page, section about dir_nlink

Normally, ext4 allows an inode to have no more than 65,000 hard links. This applies to regular files as well as directories, which means there can be no more than 64,998 subdirectories in a directory (because each of the '.' and
'..' entries, as well as the directory entry for the directory in its parent directory counts as a hard link). This feature lifts this limit by causing ext4 to use a link count of 1 to indicate that the number of hard links to a directory is not known when the link count might exceed the maximum count limit.

In other words, if dir_nlink feature is enabled - there is no limit, otherwise -- 64k subdirs. You can check if this feature is enabled with sudo dumpe2fs /dev/sda1 | grep --color=always dir_nlink. It can be disabled, possibly for compatibility with legacy systems via tune2fs.
Other Sources:

What is the maximum number of subdirectories allowed in Ext4?

Which "features" of ext4 existing ext4 partition uses?
Comment: Although your answer is totally correct , but my question was about **nested directory depth** not the max number of subdirs possible.However thanks for attention.
Comment: They asked about nesting depth, you answered about nesting breadth. I think it is better to ask for clarity than to guess what is wanted. That way we help people to ask better questions, and we can give better answers.
Comment: Very good, but did you read the question.
Comment: @ctrl-alt-delor Yep, question read I did. Admittedly there are moments where I do not, but for this particular one I did. And over the course of last 6 or so years on SE network I think I've learned that a lot of it is guesswork to find out what OP really wants; nested directories and subdirectories are essentially the same term, yet somehow even here OP believes it to be different.

Nested directory depth limit in ext4


Licensing c program

Question: How would i licence my c command line program, e.g limited functionality without a serial number?
Answer: Depends what licensing means ...
Write the license text into the source code resp. show the license text when installing or starting the program.
If you want prevent users from copying the program, things get complicated, you might need some hardware dongle.
Or just make it GPL and give the source code away ...
Answer: Include a EULA (End User License Agreement) in your program which users will have to accept while installing/using your application. You can get lots of sample EULAs in Internet. Replace the Names appropriately. But remember, you are gonna do things at your own risk. Read the EULA well, modify it to suit your needs.

Licensing c program


Random IQ Matrix question

Question:
Found this picture in a random Whatsapp group. Someone said it's from one of the free online Mensa tests. Exact source unknown.
Comment: With the tiny amount of information in this grid, and no completely obvious pattern, it feels to me like a minimal description of the finished grid would just be its literal enumeration rather than a description by pattern, regardless of the final tile.
Answer: Here's my take:

 c. The image is a 3d cylinder which is rotated about the x-axis (left-right). I get this from the point in the middle of the white circle which seems to indicate the tip of the tapered point. The pattern is "do nothing, front up $90^\circ$, rotate $180^\circ$, tip down $90^\circ$" and repeat, and read from left to right, top to bottom. This makes the next object c.
Comment: It's clearly C. My attempt to express it, in case OP is hesitating. If you run from left to right and from top to bottom the whole matrix, the pattern is rotate the object towards z (the imaginary horizon on your screen) 0°,90°,180°,-90°,0°,90°,180°...
Comment: @user65573; or $0^\circ,90^\circ,180^\circ,270^\circ,360^\circ,450^\circ,\dots$.
Comment: Right! good one! Just in front of my eyes! Then this is the definitive synthesized pattern.
Answer:
 Option b.)

On the grounds of:

 Exactly 1 change of symbol in each row moving from left to right
Answer: Here is the answer

 C

Here is the method

 The two symbols on the left and center in any row, add to create the right symbol. Once you add the symbols in the third row, you would have to perform arithmetic with the symbols that are shown in 1st and 2nd columns in 1st row and 2nd and 3rd columns in the 2nd row. If the symbols with the opposite orientation add, they cancel out. But if the symbol is being subtracted, that symbol's orientation must be reversed and henceforth added. If the symbols with the same orientation add, they simply produce the same symbol. This logic would give us option C.

Random IQ Matrix question


Nuance of 天下 and 地上 in the sense of the entire world

Question: If I think really hard I tend to feel 天下 emphasizes the physical geographic range and 地上 is more about being conceptually humanly or worldly, ie only excluding what is "out of this world". For one, 地上最強 is usually more frequent than 天下最強, but I'm unsure if they really differ in that way.
Answer: 天下

literally "under the (same) sky", "under the sun", or "the whole world insofar as 天 extends"
since 天 also has "world order" meaning, what people using the word are concerned is virtually "the whole world we know" or "wherever our society spreads out"
it's basically a secular idea about the visible world that isn't associated with any otherworldly imagination
outside fantasy worlds, the word has been reserved for East Asian regions; the original usage was about the world in whose center lies China, but at least Japanese and Vietnamese tend to apply it to their own territories

地上

literally "overground", "surface", or "(all) on the earth"
could be a synonym of "world" (= 世界), but also likely to be confined to its literal sense: earthly world as opposed to heavenly or nether world, or all over the land as opposed to sky or sea

e.g. in Castle in the Sky and Cave Story, this word is contrasted to "the flying island"
e.g. in One-Punch Man, this word is contrasted to "sky", "sea" and "underground" (of each territory of monsters)

of course the word has much more mundane meanings that English "ground" or "surface" has

地上最強 is usually more frequent than 天下最強

It's an interesting point. Indeed we often use 最~ with 地上 but hardly with 天下, though we tend to combine "incomparable" with 天下 (天下一, 天下無双 etc.), which in turn rarer with 地上. Maybe it has something to do with the nuances that 天下 contains some implicit hierarchical order, but 地上 just looks around the world plainly.


Why is it difficult to port games from consoles to PC?

Question: PC ports of console games often come out a month or two later. Why is this?
Games are written in languages that compile on PCs too, so the game logic should compile without issue. What's holding them back then? Is it rendering code or what?
Comment: It is probably due to publishing deals. They get payed from e.g     Sony for making an ps3/ps4 exclusive title.
Comment: I am talking about games which come out for some consoles. They say that the 'port' will come out X months after the console release. The question is what is the reason they wait. I mean, marketing can have something to do, but I am interested from the programmer's side.
Comment: But Aurus is right, that is the most likely answer. Porting code from the consoles to PC is not trivial for multiple reasons. Most games that come out for PC briefly after a console release were designed for the PC in the first place, or at least the underlying technology supports an easy port. Otherwise a couple of months would probably not be enough
Comment: Regarding your comment "games are written in languages that compile on the PC" has not always been true.  In particular, I would like to modify a famous quote, "Consoles and PCs may all be computers, but not all computers are created equal".
Answer: There are a number of reasons why a PC port can take a while. (I apologize if I seem to be repeating myself somewhere; this is sort of written on the fly.)
Adapting controls and gameplay
When you're playing on a console, this alone puts certain limitations on what you can do, since all the user has is a gamepad.
Just creating 1:1 mappings between keyboard keys and controller inputs is not always a good idea - if even possible - so sometimes it takes longer to figure out a good solution.
Hardware abstraction/Fragmentation
When you develop for e.g. a Wii U, you know exactly how a Wii U behaves, because all Wii Us are identical. This is not true for PCs; you have many different graphics cards and CPUs, and sometimes something won't work on some of them. It takes a lot of testing to uncover these bugs, and fixing them also takes time.
If you've never used your engine to make a PC version, you also need to code your hardware abstraction accordingly. Some games want to support multiple DirectX versions and OpenGL for Linux/Mac, and all of that takes time to write if it hasn't been done before.
Resource contention
On consoles, the game doesn't have to compete with an OS for resources, etc. - not a whole lot of stuff goes on in the background.
On a PC, you have the OS running, you have a plethora of background programs, and this all means you won't get as large a share as you were hoping for. This means you sometimes need to perform additional optimizations, especially for players on lower end systems
Improving assets
With a console, you have a fixed target, so you write shaders, etc. to match that target.
On a PC, some graphics cards support more advanced features, and maybe you want to use a better shader for those. Well, that means you'll have to write that shader.
Platform-specific stuff
Console SDKs may have a lot of convenient features that don't map over easily to a PC - for example, it might provide access to hardware timers or a good sound API.
Those things aren't usually available on PCs; you need to use other ways of accomplishing those things and maybe that changes how you have to abstract the platform differences.
Comment: Related to controls, user interface, you can still see this a-lot, where the menu on a PC desktop doesn't even work with the mouse, e.g they've done 1:1 mapping from d-pad to keyboard. Another potential issue is shader languages and driver support.
Comment: Good answer overally. However, in cases where developers want to squeeze maximum performance out of the consoles, a low level layer of platform specific code is usually not enough, the game itself must be engineered to leverage the strong attributes of the hardware of the console, which isn't necessarily the ideal solution for the PC too!
Answer: A simple reason is that a console has a single set of hardware that is the same per console.
Your XBox, PS3 and Wii all have the same hardware as your neighbours XBox, PS3 and Wii. However your computer has a different CPU, different graphics card, different amount of RAM, in fact the whole configuration and Operating system settings, installed drivers could all be a completely unique permutation that no other person in the world has.
This is what makes it difficult to port to a PC. You need to account for every possible piece of hardware within your minimum system requirements and above. That is a tricky and difficult process to program and debug. It is very hard for developers to know every configuration to program for and near impossible to run tests on these configurations.
Once they develop it for PC there is extensive testing done in house by the devs but it also can be reliant on beta testing from users for upwards of a couple of weeks to a few months. This outsourcing of tests with beta players before the port to PC is officially released is typically why you see the gap on release dates between Consoles and PC.
Answer: Porting code to a new platform takes time. Creating a nanosecond timer for Xbox 360 (I've never developed in XNA) is going to need a different implementation than the same nanosecond timer in Linux, Mac, or Windows. Now imagine you have hundreds of these types of functions that need porting, thousands if the engine is massive enough.
It can easily take a month or two of coding to add in these different implementations for the new platforms. On top of this, you can't always use the same libraries on Xbox 360 as you can on Windows, Playstation 3, or some other platform. This means you potentially have to use a whole new library to do the same thing you did on the Xbox 360 version.
Overall, these kind of things add up into a large amount of time. Porting to a new platform is rarely easy for large AAA titles.
Answer: It has almost nothing to do with being hard in many cases.
It just isn't a priority.  They're cranking to just barely get out the door in time.  Every minute difference takes time to account for.  If you can release on a few consoles or the PC by a deadline, do that first, then wrap up the ports.  Release early, make more money.  Generally the consoles have done better for boxed games this last generation, though it has started to shift- the new consoles might turn that around.
Also, in some case, console makers give benefits to exclusive releases, so the publisher gets a discount or some such if they release on a particular console first and other platforms later.  Nothing technical about it.
Answer: Initially, games are harder to make on a console than on PC. On top of it, consoles have very different specs and different hardware between nintendo, sony and microsoft, which not only result in different performance, but also means different bottlenecking issues.
Usually, game will just tweak their engine to maximize quality and performance on each console.
When adapting to PC, there are other problems. Consoles are homogenous, meaning all consoles have the same hardware (all PS3 have the same hardware performance). When you make your game for PC, you target a minimum spec, but you also allow the user to increase quality for more powerful PCs. Games targeted for PCs are less optimized, but are easier to make for programmers.
Programming on console have one advantage, it allows programmers to maximize performance, so any console game will always perform nicely.
On a PC, it's worse, because there are many hardware out there, but granted, it's more freedom, the best resulting looking game will always be on PC, because PC is always at the bleeding edge, at a cost.
Porting a game from console to PC can be tricky, because console are designed for game performance, while PC are not, but overall, it's far easier to port a game from console to PC than the opposite, because console have very much less memory, something like 2 or 4 times less.
Changing the code to adapt to this memory restriction will mostly always mean a complete re programming.
I don't think it's hard to port a game from console to PC, it's just a matter of API. Companies and programmers who work only with consoles will have a hard time porting to PC, because they're not used to it, but also because they constantly adapt to console API, so that means their code will often answers the console compiler restriction, and not necessarily care for PC apis.
Of course, engines can be programmed to run on all consoles and PCs, once it's done it's easier, it's better than telling your programmers to port the engine to PC after they've been told it was never planned for 3 or 4 years.
TL;DR consoles are homogenous and last one console generation, PC are heterogenous, and hardware and API constantly evolves. Costs are spread between programming and hardware building, which are compromises.
One good thing would be to allow all hardware to run everything, but console prices are compensated because game companies pays console manufacturers a license, so they lock their hardware to run only game companies who pay. It's messy.