Tracking if event "B" fires after event "A"?

Question: I've been trying to figure this out with the Event Flow report but my issue is that I don't care if event "A" is the first event fired in the session. I just need a way to count how many times event "A" fires followed by event "B". Does anyone know how I can achieve this? I would love it if I can make this a goal, but I'll take what I can get at this point.
Answer: There may be a better way to do this but it appears by creating a custom sequence segment seems to get me the data I need.


Open poll results in popup / overlay

Question: I'm using the Poll module in Drupal core (also using Poll blocks and Ajax poll).
As designed, when I vote I'm taken to the results page, but I'm wondering if it's possible to display the results as a popup on the front page, where the poll block is.
I searched a bit and I know something similar can be done with lightbox2, colorbox, colorbox node, etc., but these solutions require that I assign a class or rel attribute to an anchor tag, and then open whatever URL I enter as a popup. However, the poll calls the results page on clicking the submit button. Is there a way I can change this to accomplish what I need?
Answer: Please check answer. I think this may help you toy solve your problem.
ANSWER LINK

Open poll results in popup / overlay


Who scored the opening Star Wars fanfare for Disney+?

Question: At the beginning of The Mandalorian (and perhaps other Star Wars content, I don't know), an opening fanfare plays in the vein of what happens at the beginning of the MCU films. Over the fanfare are several images of Star Wars characters, such as C-3PO, a scout trooper, an x-wing pilot, and the Mandalorian. Who scored this fanfare? Could it be John Williams, Kevin Kiner, Michael Giachinno, or someone else entirely?
Answer: With the release of Kenobi, we can see that this was specific to The Mandalorian, as Kenobi does not have that fanfare. While the score for The Mandalorian was written by Ludwig Göransson, the score for Obi-Wan Kenobi was written by John Williams and does not contain such an opening fanfare. Thus, it is apparent that this is not an MCU-style opening fanfare for all Disney+ Star Wars content. The intro style remains the same, but the music changes.
Edit: With the release of Andor, it appears that this intro fanfare is becoming an MCU-style fanfare intro for Star Wars content and that Obi-Wan Kenobi was simply an exception.
Answer: The Music to The Mandalorian is scored by Swedish composer Ludwig Göransson.
Link to Warm or Cold song.
Comment: until a new series begins, we can't know for sure if this is part of the Mandalorian series or similar to the MCU Marvel opening tag sequence. Since the score for every episode of the Mandalorian is available on streaming, and this opening is not part of the releases, I think this answer is incorrect for the question as asked


Fine tuning CNN with imbalance data gives good results - not sure why

Question: I'm fine tuning with caffenet for a 3 classes classification problem. I have 100 instances of class A, 90 instances of class B and 30 instances of class C. I thought that my net would be biased toward classes A and B but I'm actually getting quite good results. I know that caffenet doesn't take care of imbalance data for me. Maybe it has to do with the fact that my entire train set fits into one batch? Or maybe it has to do with the fact that I'm not really training from scratch but mostly using caffenet's already learned weights? Thanks
Comment: Your situation is not that imbalanced. When I think of imbalanced I think of ratios closer to 50:1 or 100:1. Think ratio of people with cancer to general population.
Answer: Are you getting good results on your training or your test set? If it's only the first then you are overfitting, but if it's the second it will not have to do with the fact that your whole training set fits in your batch, the gradients still have a strong pull towards the dominating class(es). But having the pretrained weights will help a lot if the classes are relatively easy to seperate. It will also help if your dataset is similar to the one it was pretrained on, because the intermediate layers that do feature extractions have learned valuable filters for your problem instance.
Comment: Thank you. I am getting good results on the validation set. I'm doing cross validation BTW. of course I see over fitting on the training at some point because it's such a small data set.
Comment: Well then it is the second part, I added a tiny bit more to my answer
Comment: Thanks. I don't know how similar my data set is to ImageNet.. caffenet sees my images as 'coil' or swirl. So maybe it's because the model can't get biased after 80 epochs on 200 images (when it reaches top accuracy)?


preg_replace PREG_BAD_UTF8_ERROR

Question: i have an annoying problem with preg_replace and charsets. I'm doing a couple preg_replace in a row but unfortunate the first time any special character like äöüß is inserted by preg_replace i'm getting PREG_BAD_UTF8_ERROR on subsequent calls.
Beside that the special characters inserted are displayed just fine, they just break any subsequent preg_replace call. Is preg_ utf-8 only?
The text preg_replace is working on is coming from MySQL Database, also the replacement is crafted in the php file with values from MySQL. mb_detect_encoding() says ASCII for the text until the first replacement with special characters, it then detects UTF-8, so it changes and this might be the problem.
For your information i'm working with iso-8859-1 encoding (PHP, MySQL, meta-charset). Furthermore i have a workaround with htmlentities on the replacement string that is working for now.
Any ideas on how to solve it?
Answer: What you are looking for is probably mb_ereg_replace. It handles multibyte encodings and should perform fine with differrent ones. Be sure to use mb_regex_encoding along with it.

preg_replace PREG_BAD_UTF8_ERROR


Remove nav_menus from customizer using a theme

Question: Is there a way to remove the "Menu's" or in dev language nav_menus from the customizer?
I have tried $wp_customize->remove_section('nav_menus'); but that did not work.
$wp_customize->remove_section('nav_menu'); (removed s) did also not work.
$wp_customize->remove_section('menus'); did also not work.
$wp_customize->remove_section('wp_nav_menus'); didn't work either.
Please help me out here!
Comment: Where did you add this code ?
Comment: @Sumit I have tried adding it at the top of function.php, at the bottom and in the middle. None worked. I mainly tried adding the `nav_menus`.
Comment: Are you there, @Sumit?
Comment: Yes this is a good tricky question since this [filter](https://developer.wordpress.org/reference/hooks/customize_loaded_components/) does not work in theme. I am busy a bit will try to find a solution later. Hope someone else may know this ;)
Comment: @Sumit Okay, no problem!
Answer: This is panel not section so remove_section() will not work in this case. However you can use function remove_panel() but it will trigger a notice saying

Notice: WP_Customize_Manager::remove_panel was called
  incorrectly Removing nav_menus manually will cause
  PHP warnings. Use the customize_loaded_components filter instead. Please see Debugging in
  WordPress for more information. (This message was added in version
  4.5.) in \wp-includes\functions.php on line 3897

Now customize_loaded_components filter says

This allows Core components to be excluded from being instantiated by
  filtering them out of the array. Note that this filter generally runs
  during the 'plugins_loaded' action, so it cannot be added in a theme.

So there is no straight way for removing menu section from customizer and using theme but if you like then I found a solution (May be not so good) which works without any warnings and errors.
In class WP_Customize_Nav_Menus constructor check for
if ( ! current_user_can( 'edit_theme_options' ) ) {
    return;
}

And then register all the action/filters for nave menu section thus removing all those filter/action can do the trick. But for removing those filters/action we need the same object which was used to register them. And yes we have it in customize_register action callback.
You can add this code to your theme functions.php
add_action('customize_register', function ( $WP_Customize_Manager ){
    //check if WP_Customize_Nav_Menus object exist
    if (isset($WP_Customize_Manager->nav_menus) && is_object($WP_Customize_Manager->nav_menus)) {

        //Remove all the filters/actions resiterd in WP_Customize_Nav_Menus __construct
        remove_filter( 'customize_refresh_nonces', array( $WP_Customize_Manager->nav_menus, 'filter_nonces' ) );
        remove_action( 'wp_ajax_load-available-menu-items-customizer', array( $WP_Customize_Manager->nav_menus, 'ajax_load_available_items' ) );
        remove_action( 'wp_ajax_search-available-menu-items-customizer', array( $WP_Customize_Manager->nav_menus, 'ajax_search_available_items' ) );
        remove_action( 'customize_controls_enqueue_scripts', array( $WP_Customize_Manager->nav_menus, 'enqueue_scripts' ) );
        remove_action( 'customize_register', array( $WP_Customize_Manager->nav_menus, 'customize_register' ), 11 );
        remove_filter( 'customize_dynamic_setting_args', array( $WP_Customize_Manager->nav_menus, 'filter_dynamic_setting_args' ), 10, 2 );
        remove_filter( 'customize_dynamic_setting_class', array( $WP_Customize_Manager->nav_menus, 'filter_dynamic_setting_class' ), 10, 3 );
        remove_action( 'customize_controls_print_footer_scripts', array( $WP_Customize_Manager->nav_menus, 'print_templates' ) );
        remove_action( 'customize_controls_print_footer_scripts', array( $WP_Customize_Manager->nav_menus, 'available_items_template' ) );
        remove_action( 'customize_preview_init', array( $WP_Customize_Manager->nav_menus, 'customize_preview_init' ) );
        remove_filter( 'customize_dynamic_partial_args', array( $WP_Customize_Manager->nav_menus, 'customize_dynamic_partial_args' ), 10, 2 );

    }
}, -1); //Give it a lowest priority so we can remove it on right time


Light affect just one object of your model without using the compositor?

Question: Is there a easy and fast way to make an area lamp for example affect just one part of your model
I got a model of a hardware with a display and I would like the display to be affected by the area light but not the hardware.
Comment: Separate lighting for different parts of an object and without the Compositor - for this effect?  Was done in 2.77 but should be equally as possible in more recent versions.

Link -

https://1drv.ms/u/s!AtkhCKZLZs_Pg21iJJHm5Rc6YJ5i?e=RmAWqD
Comment: You can do stuff like this sometimes.  It's easiest when you can isolate one type of ray to be a sort of 'sentinel' for the behavior you want to trigger, but in this case I'd say the easy and fast solution is to use two render layers and an *Alpha Over* in the compositor.
Answer: You could just render them separately. It may or may not take longer since you have to render twice. But since they're separate images, you can change one without affecting the other.
The first render could have just the hardware and the display with no area lamp, or just the hardware if you don't need the shadow of the display cast.
Then on the second render, just the display and the area lamp. If it helps, just put these three objects in different layers and then toggle the render icon at the right side that looks like a picture camera.
Then combine the 2 renders in the Video Sequence Editor as image/image sequence/scene/clip and so on.


Is this statement grammatically correct - "I have spent too long confusing nice for good"

Question: My confusion is whether the right way of writing this would be "confused X with Y" or "confused X for Y"
Answer: The relevant sense of confuse (verb) is #5 in OED:

To mix up in the mind, to fail to distinguish, erroneously regard as identical, mistake one for another; = CONFOUND v. 7.

The one example given with preposition uses with:

1862   J. Ruskin Munera Pulveris (1880) 29   We in reality confuse wealth with money.

Note that the definition itself features mistake . . . for.
There is little rhyme or reason to the association of certain words with certain prepositions in English (and no definitive reference work on the matter, such as I believe Duden has provided for German), but strong preferences have indeed established themselves. I would suggest using with with confuse and for with mistake:

I have spent too long confusing nice with good.
I have spent too long mistaking nice for good.

See also this ngram of relative frequencies in books scanned by Google and published 1800–2000.
Answer: With is correct when using 'confused'. You might use for with 'swap' or 'exchange', but confusingly enough you could also use 'with' in those cases as well.
Answer:
I have spent too long conflating nice and good.
Conflation occurs when the identities of two or more individuals,
  concepts, or places, sharing some characteristics of one another, seem
  to be a single identity
Comment: I meant the statement not in the way of thinking the two to be the same, but mistaking one for the other. In that, whenever I saw someone nice, I thought they were also good. Is it still conflating?


Pulse Audio microphone from my laptop gives of a sound even when silent

Question: Whenever I try and use the microphone on my pc, it gives off this really loud noise. Even when silent, when I go to pulse audio volume meter, it shows that there is some sound when there literally is no sound at all. And since many people have issue with pulseaudio, I thought maybe it was a pulse audio issue but even after uninstalling pulse audio and using alsa, the issue still remains. Any help would be immense.
Answer: Since removing PulseAudio had no effect, then it seems the problem is not related to PulseAudio at all.
Instead, this looks like a possible problem with ALSA mixer default settings for your hardware, or perhaps a hardware problem.
What kind of microphone are you using? Is it a built-in one (like most laptops have) or is it something you have bought separately and plugged in? If separate, have you checked that it works with another computer or other device?
Then check the ALSA mixer settings, using alsamixer or similar. If PulseAudio is installed, you'll normally see the simplified mixer of PulseAudio if you don't specify the soundcard to use with alsamixer -cN where N is a number, starting from 0.
If your mixer settings include "Loopback Mixing" or "What U Hear" or similar setting that allows you to record both incoming audio from microphone and computer-generated sounds together, try turning that setting off: on some sound chips this is a known-noisy signal path (hardware bug).
Also, set the volume slider of any input channel you aren't actually using fully down, and mute the channel if possible: this will minimize the chances of unused audio inputs picking up electromagnetic interference and resulting in noise in your recording. In particular, if your hardware manufacturer has not actually used all the possible inputs in the sound chip and left the unused input(s) without proper termination, those might pick up noise from any number of high-frequency digital signals inside the computer.
Comment: Thanks a lot, I never thought to tinker with alsamixer, after tinkering with some of the options in there, the sound went away completely.
Answer: Anyone going through the same issue. In my case the problem was with the mic boost. As soon as I muted the mic boost, the sound went away. To turn of the mic boost, get the index of your sound card, and type in alsamixer -c index. Then change the volume of the mic boost to zero.
Comment: The correct amount of mic boost depends on the properties of the microphone. Boosting the signal of a very sensitive microphone will cause noise and clipping in the recorded signal, but a less sensitive microphone might need some amount of boosting to get a useful signal that is not too quiet.


How to exclude axis when scaling just with the mouse

Question: I know I can do this by holding shift and then typing the letter of the axis I want to be excluded. However, I really like how I can scale on one axis by hitting "s" and then just use the mouse wheel to click and move in the direction I want to scale.  However, I haven't found a way to exclude an axis using this method.  Does anyone know how to do this?
Answer: You can't do it with the mouse only, but after pressing  S, while the scaling operator is active you can press Middle Mouse Button to constraint to an axis, depending on the direction the mouse is pointing.
Similarly you can also press ⇧ Shift + Middle Mouse Button to exclude the same axis.


What does "Name seemed to be in doubt" mean in this context?

Question:
Hunger, chaos, thawed mud everywhere, uncollected debris, water
pipes bursting, unofficial warnings of tainted water supplies, gas
explosions. Unrest among Free Britons. Today being pay day, pay
parades lined up punctually at FB centres at 09.00 hours. Moratorium
on pay declared. No cash available. Violence. Arab leader spoke Oxford
English at conference in Al-Dorchester ballroom (Sheikh Isa Ta'ala?
Name seemed to be in doubt) about awareness of unpopularity of Arabs
and Muslims generally in angry strikebound Britain, but Islam had
known hostility throughout its long existence and there was no
intention of withdrawal of Arab presence. Much Arab money tied up in
British property.
- 1985 by ANthony burgess

What does the author meany by saying: Name seemed to be in doubt? (emphasis in text is mine).
Answer: The people present seemed to be unclear as to the speaker's correct name.
Comment: The people who were present at the conference where the Sheikh spoke.
Comment: What do you mean by "people present"? Readers? Writer?


Will this small crease in passport be a problem

Question:
Will this crease be a problem when travelling
Comment: I know people (frequent travelers) carrying their passport in the back pocket of their jeans, throughout the complete travel, and after some years they look like they were run over by a tank. Never an issue.
Answer: I'm not an immigration/customs officer, but I highly doubt this would be a problem. It's on the outside so it doesn't look like some potential tampering. My passport probably looks worse and I've had no problems.
Answer: It's highly unlikely that this will cause an issue.
Passports are typically issued for 10 years. To expect them to be in pristine condition at the end of that period is unreasonable.
Answer: It will absolutely not be a problem.
To make you feel better, here's my story. My old passport was in a very terrible state after having spilled some Pepsi from KFC on it. The problem was that I only realised a couple of weeks later when I took it from its drawer and the pages were all wet, sticky and smelly. The biodata page was not damaged, but every single other page had a huge brown stain on it and an unpleasant smell (which fortunately went away after I "cleaned" it and dried it). I still used that passport for a few more years until it expired and I was only asked about the damage once, and after laughing at my story the border agent told be to be more careful.


Compatibility with Lenovo

Question: I am wanting to run this OS on a Lenovo flex 3. Ubuntu 17.10.1 contains a fix to an issue in the Linux 4.13 kernel that corrupts the bios on these machines. Is this issue an issue in this distro?
Answer: The current elementary OS version Loki is build on Ubuntu 16.04 and the next version of elementary, Juno, will be build on Ubuntu 18.04. So I don't think that will be an issue.
Also see: https://www.reddit.com/r/elementaryos/comments/7l7mis/is_elementaryos_affected_the_same_way_as_ubuntu/
Answer: Well.... I went ahead and ran it from a pin drive without installing and I now no longer have the option to boot from a pin drive in the menu at boot!! The Linux kernel in this distro is 4.13 and this is the same issue reported on the ubuntu support site. Although the option to boot from usb is no longer available it still boots from a pin drive and the Elementary OS seems to run fine. I will just have to remove bootable usb before boot to boot into Windows. If anyone has info on the nature and extent of the effects this may have had on my bios please let me know.
Here is list of the affected machines from ubuntu: https://bugs.launchpad.net/bugs/1734147
Answer: Worked for me (v6.1) on a Lenovo m93p mini-pc.  It didn't boot up right after USB install BUT i rebooted a couple more times and it started up.

Compatibility with Lenovo


What is the future of sharepoint on-premise?

Question: I am a SharePoint administrator I want to know the future of SharePoint on-premises in market ?
Comment: I am not sure if this is the right question fro this forum.  SharePoint future is bright! Microsoft recently announced that they will continue to invest SharePoint on premises.  Considering, moving to the cloud is not an option for everyone, SharePoint on-premises is not going away soon for sure!
Comment: SharePoint 2016 is said to be the last on-premise version, but then again, we don't know for sure.
Comment: @mike "We're committed to our on-premises and have no plans to make SharePoint Server 2016 our final version of our on-premises server."
Comment: This is news to me. This came out a week ago, but until that point it's always been implied SharePoint 2016 was the last on-premise version.
Answer: Flexibility in developing Custom solutions is still with On Prem. SharePoint online recently removed support for sandbox solutions which further degrades the customization. We had to move our solutions to another on Prem server or Azure.
Advised to learn MS Azure which will have more market in coming future.
Answer: Future of SharePoint is bright, but as an admin, we have to shift the gears as future of SharePoint depends upon hybrid. Like all future updates are cloud born then on Onprem. Like SharePoint framework, 1st release in the cloud now will be released on Orem.
Here is an answer from Bill bear for next versions question.

Q: Will there be another version of SharePoint on-premises? A: We're
  committed to our on-premises and have no plans to make SharePoint
  Server 2016 our final version of our on-premises server.

Read the complete blog.https://blogs.technet.microsoft.com/wbaer/2017/05/16/sharepoint-server-2016-and-beyond/


What is the price of commodity at delivery day for a futures contract?

Question: If I hold a futures contract till the delivery day, what price should I pay for the commodity delivered to me, the price of the futures contract when I bought it, the price of the last transaction at the last trading day, the average price of the last trading day, or the average price of the futures contract over all trading days?
Answer: A futures contract is a contract to buy a commodity (or stock, or whatever) for a specified price at a specified time. So if you enter into a contract at a certain price, that's the price you'll pay. The market (spot) price is irrelevant (other than to measure opportunity cost or to determine how much it costs you to get out of the contract at the last minute).
Note that technically you don't "buy" a futures contract. There's no upfront cost for futures. The "price" quoted is the price you must pay at delivery.
Comment: No- it means that the boilerplate contract does not have the price defined - it's filled in when you enter in to the contract. It's like when you get a mortgage on a house - most of the contract is filed in with blanks left for the amount, interest rate, etc. to be filled in later.
Comment: I have edited my question, to say the price I bought a futures contract, I mean the price of the commodity indicated in that contract. But I heard that a futures contract does not include the price of the commodity which is variable through time("Given the standardization of the contract specifications, the only contract variable is price.", https://www.cmegroup.com/education/courses/introduction-to-futures/definition-of-a-futures-contract.html) . Does that mean the price I need to pay at the delivery date is the last price indicated in the futures contract during trading days?


How to understand reactivity rates

Question: I have tried to rationalize the questions with resonance in their intermediate forms, but have not been able to see a difference. Does it have to do with steric interactions based on ortho, meta, and para positions? How do I approach this question?
Comment: Do you know about Hammett plots and linear free energy relationships (LFER)s?
Answer: Think about which direction the electrons will flow based on each group.
In A, the ester puts a positive charge on the carbonyl carbon, thereby drawing electrons away from the benzene ring, and increasing its electron withdrawing effect on the reaction site. With electrons pulled away from the reaction site, bromine will have a stronger bond to the reactive-carbon.
In B, the ethers are donating electrons. Thereby decreasing the strength of the bromine bond.
In C, the benzene ring has electron withdrawing effects, similar to in A.
In D, the ether is donating electrons, like in B (but to a lesser extent).
I trust you can figure it out from here!
Answer: RBr + MeOH → ROMe + H2O ?? I. don't. think. so. There is one reaction which the proximity of the ortho MeO on the ring might cause steric hindrance. The two other effects you should be considering are: i) the electron withdrawing/donating nature of the substituents on the ring and ii) their location (ortho, meta, or para) because their location has an electronic (not steric) effect.
Since these considerations are (obviously) the reason you are being asked this question, I leave it to you to digest what those effects will be. You should understand that their effects are not only on the reactant but on the transition states as well.
Comment: I totally did not think about activating groups, thank you!

How to understand reactivity rates


How to check Einstein-like equations on their correspondence with the real world?

Question: Physicists studying the foundations of physics and some mathematicians sometimes look at theories which are similar to general-relativity, but do not coincide with it. Often these theories contradict with what we know about our world. What should one do in order to check one of such theories? Which papers/books should one read in order to be able to understand mathematical theories similar to general relativity, and understand when such theory is compatible with what we know about our world?
Comment: What theories are you talking about ? You should be more specific.
Comment: Einstein's Special Theory of Relativity could be tested in less than a minute. Turn on a GPS. If the reading is within a few thousand miles accuracy, the theory holds. Without relativity, GPS systems would not work.
Comment: @Vortico: no one is going to be convinced by a correct reading on a very complex device involving software, RF electronics, satellites and so on, except the engineers involved in its design.
Comment: Yes, it could just be me, but I'm not sure what you're asking. You could list a few theories as examples.
Comment: For example cosmologists study Einstein equation with a lambda-term. Using some notions of which objects are natural in Riemannian geometry (see for example page 10 of http://arxiv.org/abs/math/0609287) another "natural" terms can be written. I don't think, that experiment with turning on GPS checks the lambda term of Einstein equations. Actually I don't know even to which extent does it check it (because I think some adaptive algorithms are used by GPS system).
Answer: Considering all the possible low-order corrections to Newtonian motion that there might be to a particle moving in a gravitation field of any kind,  or rather, in comparing relative motions of neighboring particles, there are defined some paramaters according to the Parameterized Post Newtonian (PPN) formalism.  This is described nicely in the famous book by Misner Thorne & Wheeler.  (My other three books on GTR don't mention PPN.)
GTR can be analyzed in terms of PPN parameters - beta=1, eta=0, etc.  Alternative theories work out to having different PPN values.   Any experimental observations, after being calibrated and curves fitted to and so on, can be judged in terms of PPN parameters, at least some of them, or combinations of some of them.   So it's a matter of seeing what fits within error bars.
http://en.wikipedia.org/wiki/Parameterized_post-Newtonian_formalism tells more detail.
Answer: Physical theories are rarely constructed as a purely theoretical exercise - they usually are based on empirical data which is fitted a mathematical solution. The physical theory then tries to explain the data and corresponding math.
The basis of scientific theory is that it must be verified by repeatable tests and data. Sometimes theories that explain some data well are disproven when applied to other situations - and sometimes amendments are made in order to account for the difference. That is the nature of every scientific theory - it is accepted until real world data says it is wrong. There is no way to know whether any theory truly describes our world or not - it holds until it no longer matches observations.


Red and yellow insect found in kitchen in Conrad, Montana (USA)

Question: Beetle found in our kitchen in Conrad, Montana (USA) on 3/13/19:
Answer: This appears to be a stink bug in the superfamily Pentatomoidea of the true bugs (i.e., order Hemiptera).
Specifically, your specimen appears to be Perillus bioculatus or the two-spotted stink bug.

 Photo Credit: Margarethe brummermann (2008)
You can see additional photos including those demonstrating the species's various yellow vs red color morphs here.
According to the Integrated Plant Protection Center at Oregon State University [my emphasis and links]:

Mature nymphs of the two spotted stink bug are about 8 to 9 mm long. Adults range in length from 10 to 12 mm. Nymphs may [be] pale yellow or reddishorange with a distinct black "Y-shaped" marking on the pronotum and two black spots on the thorax.

According to Wikipedia, this species is usually a beneficial predator (especially of the Colorado potato beetle), but early nymph stages feed by sucking on potato stems. The trade-off, I would guess, is worth it.

In fact, the color variation in this species (namely the shift from white/yellow to red) that my earlier link shows photos of is a result of a higher diet of potato beetles. [Source, taken from p 99 in McPherson's 1992 book The Pentatomoidea (Hemiptera) of Northeastern North America].

 Source: bugguide.net
Their range, according to bugguide.net is southern Canada, the U.S. and into Mexico.
Comment: I was gobbling cherries one day and I ate a cherry with a stink bug which defended itself on my tongue. It was a bit hot and a bit indescribably chemical. wasn't a major worry though, i had forgotten about it after a while. don't eat them :D their defense works you spew them out haha.


Vanilla TeXlive and wxMaxima on Ubuntu

Question: In order to install vanilla texlive (thanks for the excellent tutorial), I removed everything tex from Ubuntu, including wxmaxima. Now, when I want to install wxmaxima again, it also wants to install tex-common. Would that break my beautiful new texlive installation?
Answer: Did you finalise the TeXLive installation according to these instructions?
If you don't provide a "fake" TeX Debian package, it is likely to break your TeXLive setup.
Credits to user "cfr"!
Comment: I did, but I don't think that the texlive-local file that went into making the fake package mentions tex-common. Perhaps this is why wxmaxima wants to install it. The question is, what happens if I agree?
Comment: The suggested "content" of the fake package are tailored to Debian. If Ubuntu requires "tex-common" then simply add this (and any others that Ubuntu requires) to the list and redo the package. Then you should be safe installing wxmaxima via the Ubuntu package manager. You will run into troubles if you let Ubuntu install its own LaTex-package.
Comment: Hm, just checked with Synaptic (I am on Kubuntu 14.04), it seems to require only "tex-common". so if you add this to the contents list, you should be able to install wxmaxima without any further problems.

Vanilla TeXlive and wxMaxima on Ubuntu


How can I Protect my Minecraft server from griefers without and griefers within?

Question: I have a new MC server professionally hosted. I'm using whitelist to limit users that can connect, but I'm wondering what I need to do to make sure that when my players return, their hard-won items and buildings are where they should be and not blown to smithereens or stolen.  Your advice appreciated!
Answer: Plug-ins that allow users to protect areas
Many, many mods and plug-ins allow users to "own" small or large parts of the server, where they're the only players (besides mods) able to place or break blocks.  These can even be set to prevent TNT and creeper explosions from doing their damage to blocks (health bars are still affected, typically).
Backups
Seriously.  Auto-backup script.  There is no excuse for not saving backups.
Actually vetting people before adding them to the whitelist
If you only whitelist people who are referred by existing players, and therefore you actually have a reason to trust them, your chance of getting a troll is significantly reduced.  The faster and easier it is to get on your whitelist, the less protection the whitelist provides.  Requiring an existing user to sign in (to the server or your website) and request each new user is a strong defense.
I'm sure there are more answers than this, but these are a good start.
Answer: If you don't want a plug-in, just use a command block under spawn, and put this into it: /effect @a[m=0,r=36] 4 2 5 true
Then type this in chat:/gamerule commandBlockOutput false
Then have a hopper clock powering the command block.
(A hopper clock is where you put 2 hoppers facing into each other, then a comparator facing away, leading into one redstone that leads to the command block.) The griefers will not be able to break any blocks. Also, use hopper clocks leading to command blocks with this code in them:
/clear @a flint_and_steel
/clear @a obsidian
/clear @a lava_bucket
/clear @a tnt
/gamemode 0 @a[your name here]
NOTE:Each line of code should be in a different command block.
As for them still being able to place normal blocks and mess up you server, you can make it so that there is a place where you put your items into an ender chest, then get you inventory totally cleared. Not pretty, but you could make fit it into a story, where you have to get searched or something like that.


Where can I get an list of ATC phraseology terms in Spanish?

Question: I'm considering flying in a Spanish-speaking country and would like to have a passing familiarity with how to communicate with ATC in Spanish. Is there an ATC English-to-Spanish dictionary?
Comment: This doesn't really answer your question, but are you sure you want to talk to ATC in Spanish? If you aren't a fluent Spanish speaker, you might be better off just speaking English to them (which they're generally required to be proficient in.) IIRC, speaking Spanish to them gives them implicit permission to send further transmissions to you in Spanish, rather than English. Of course, understanding Spanish phraseology could still be helpful for understanding what the locals are saying to ATC for situational awareness purposes.
Comment: @reirab is completely right, if you can't speak fluent spanish, and in the local dialect and accent you are probably better off using English. I've not flown into Spain, but I have to France and I couldn't understand a word, even though I'd studied the phrases.
Answer: ICAO has defined in their Annexes that English is only one of the available langauges to ICAO and that ATS should either use the language specified in the country's AIP or use English.

1.2.9    Language proficiency
22.214.171.124    Aeroplane, airship, helicopter and powered-lift pilots, air traffic controllers and aeronautical station operators
  shall demonstrate the ability to speak and understand the language used for radiotelephony communications to the level
  specified in the language proficiency requirements in Appendix 1.
Note 2.— The provisions of 1.2.9 refer to Annex 10, Volume II, Chapter 5, whereby the language used for radiotelephony
  communications may be the language normally used by the station on the ground or English. In practice, therefore, there will
  be situations whereby flight crew members will only need to speak the language normally used by the station on the ground.

Personally, additional to my proficiency level in English, I also hold a Level 6 language proficiency German in my pilot's license.
Below is a screenshot of the Aerodrome Description for LEBL/Barcelona, taken from Spain's AIP. You see that ES/EN is listed as available languages.

If you are looking for Spanish Phraseology, you can find it with Argentina's Administracion Nacional de Aviacion Civil.
Answer: ICAO's official language is English, and they have introduced a Language Proficiency Requirement aimed at raising proficiency for pilots and Air Traffic Controllers.
Licensing for both ATC and Pilot licence holders has a requirement for proficiency at ICAO Level 4 or above
ICAO in Spanish is, therefore, something of a contradiction in terms. You should be able to get by just fine in English, but if you actually need to speak Spanish then you're probably not going to hear much ICAO phraseology.
Comment: For what it's worth: "*Radio traffic for flights under Instrument Flight Rules (IFR) must be conducted in one of the ICAO officially approved languages. These are English, French, Spanish, Russian, Chinese and Arabic.*" ([source](http://www.vateud.net/manuals/phraseology)).
Comment: User 11892 is actually wrong. English is not the only ICAO language. There are 7: English French Spanish Russian Portuguese Chinese Arabic Therefore ICAO Spanish IS NOT a contradictory term, and Spanish RT is "ICAO phraseology." The requirement to be able to speak English is separate, and not enforced in every ICAO country, like France and Germany, where French/German only airfields exist.
Comment: Fair point - I've updated the question to be more general


12.04 boots to blackscreen on Acer Aspire One 751h

Question: Just installed Ubuntu 12.04, but when i'm trying to boot desktop in normal mode screen turns black, just black (like turned off), but when I'm trying to boot in secure mode top half of screen start twitch and flick, bottom is black. How can I solve this problem? Netbook Acer Aspire One 751h | Intel GMA500
Answer: I've installed a "fresh" Ubuntu 12.04 in my Acer Aspire One 751H, and I've the same problem.
Follow the steps to fix the issue:

Open your Terminal - Ctrl + Alt + F1
Restart X:
sudo service lightdm restart

Open /etc/default/grub:
gksu gedit /etc/default/grub

and change
GRUB_CMDLINE_LINUX_DEFAULT=""

to
GRUB_CMDLINE_LINUX_DEFAULT="quiet console=tty1 acpi_backlight=vendor acpi_osi=Linux acer_wmi.blacklist=yes mem=1920mb"

Now it should work.

Source: Ubuntu Wiki and Bodhizazen Blog
Answer: This is a known compatibility issue with 12.04 and some restricted graphics drivers. The most likely cause is a

/etc/X11/xorg.conf

file that remained after the upgrade. Try booting into the 11.10 Live CD and disabling any proprietary drivers, which should fix it. Hope this helps!
Answer: just press button Fn+Left arrow or Right arrow while booting starts and that's it ! if its for acer laptop
Answer: I had exactly the same issue on an Alienware M18x (2 x ATI cards in there).  Using the above answer (thanks to fjt) I booted to recovery mode, enabled networking (which re-mounts the filesystems for you in r/w mode) and dropped to a root prompt.
I edited (using vi) /boot/grub/grub.cfg and changed the
linux /vmlinux-220.127.116.11-generic to add on the end, "acpi_backlight=vendor acpi_osi=Linux" (ignore the quotes)
Saved and rebooted.  All kicked into life for me.  I do have a long standing issue where on shutdown it hangs so I have to force it down, but other than this all is ok.
Answer: Look at:
https://wiki.ubuntu.com/HardwareSupportComponentsVideoCardsPoulsbo/#PSB-GFX_drivers
this works for my Dell Mini!
Answer: Using Xubuntu 12.04 on an Acer Aspire One 751h (1 GB RAM) the solution
GRUB_CMDLINE_LINUX_DEFAULT="quiet console=tty1 acpi_backlight=vendor acpi_osi=Linux acer_wmi.blacklist=yes mem=896mb"

Worked fine for me.

Edit GRUB as root using your favourite editor
eg. in a terminal sudo joe /etc/default/grub
Change the GRUB_CMDLINE_LINUX_DEFAULT to the above string
Save, sudo update-grub and reboot.

Contains the solution from Bodhizazen.com
Comment: Your kind words are appreciated. My intention was not to get my entry up or down, but thru to the interested ubuntu user with the same type of computer and problem. I am surprised finding myself on the wrong side by just sharing information others sparing a reasonable time of fiddling with parameters.


Unhandled Win32 exception

Question: At runtime, when myApp.exe crashes i receive "Unhandled Win32 exception" but how would i know which exception was occurred? where did something went wrong?
Comment: What language are you using? Is this .NET? C++?
Answer: For a Native C++ app see my earlier answer here: Detect/Redirect core dumps (when a software crashes) on Windows for catching the unhandled exception (that also gives code for creating a crash dump that you can use to analyse the crash later.  If the crash is happening on a development system then in Visual Studio (I'm assuming you're using that, if not other IDEs will have something similar), in Debug/Exceptions tick the 'Thrown' box for 'Win32 Exceptions'.
Answer: Typically, Windows will give you several hexadecimal numbers as well. Chances are that the exception code will be 0xC0000005. This is the code of an Access Violation. When that happens, you also will have three additional bits of information: the violating address, the violated address, and the type of violation (read, write or execute).
Windows won't narrow it down any further than that, and often it couldn't anyway. For instance, if you walk past the end of an array in your program, Windows likely won't realize that you were even iterating over an array. It just sees "read:OK, read:OK, read:out of bounds => page fault => ACCESS VIOLATION". You will have to figure that out from the violating address (your array iteration code) and the violated address (the out-of-bounds address behind your array).
Answer: If it's a .Net app you could try to put in a handledr for the UnhandledException event. You can find more information about it and some sample code here.
In general it's a good sign that your exception handling is broken though, so might be worth going through your code and finding places that could throw but where you don't handle exceptions.
Answer: Use the debugger. You can run the program and see what exception is been thrown that kills your application. It might be able to pinpoint the location of the throw. I have not used the VS debugger for this, but in gdb you can use catch throw to force a breakpoint when an exception is thrown, there should be something similar.

Unhandled Win32 exception


Add items to the dark menu in WordPress

Question: I would like to add a category (is that what it's called?) such as 'Articles' to the WordPress menu.
Not the one that will be visible to the end user, but this menu:

Ty
Answer: You would need to create a custom post type by adding this code to your functions.php file (only do this if you are comfortable with editing theme files if not you should use a plugin such as "Custom Post Type UI"):
<code> function custom_post_type() {

    $labels = array(
        'name' => 'Articles',
        'singular_name' => 'Article',
        'add_new' => 'Add New',
        'add_new_item' => 'Add New Article',
        'edit_item' => 'Edit Article',
        'new_item' => 'New Article',
        'view_item' => 'View Article',
        'search_items' => 'Search Articles',
        'not_found' => 'No Articles found',
        'not_found_in_trash' => 'No Articles found in Trash',
        'parent_item_colon' => '',
        'menu_name' => 'Articles'
    );

    $args = array(
        'labels' => $labels,
        'public' => true,
        'has_archive' => true,
        'publicly_queryable' => true,
        'query_var' => true,
        'rewrite' => array('slug' => 'articles'),
        'capability_type' => 'post',
        'hierarchical' => false,
        'supports' => array(
            'title',
            'editor',
            'thumbnail',
            'excerpt',
            'custom-fields'
        ),
        'menu_position' => 5,
        'exclude_from_search' => false
    );

    register_post_type('articles', $args);
}

add_action('init', 'custom_post_type');
</code>
This is just an example and you should edit the options in the function to what you need from the custom post type. You can refer to Wordpress documentation : https://developer.wordpress.org/plugins/post-types/registering-custom-post-types/

Add items to the dark menu in WordPress


Sprayer on kitchen sink hard to pull up

Question: Recently our kitchen was renovated and we now have a kitchen sink with a separate pull-up sprayer. Most of the time when I pull up on the sprayer there is resistance when the hose is about halfway up. I checked under the sink and there nothing that the hose is getting caught on. The odd thing is that often after using the sprayer a couple of times while doing dishes it will suddenly lift up smoothly all the way without any resistance. What could explain this behavior?
Comment: the hose is stiff when cold. after spraying hot water it heats up and is more flexible, thus providing less friction resistance.
Comment: Perhaps clear photos from above and below the sink might help.
Comment: I added two photos. The sprayer hose is white in the photo.
Comment: That seems to be the best explanation to fit the observations. If I ever get up enough motivation to change the hose, what kind of connection is used (the white thing in the photo)?
Answer: Ah! it looks from those excellent photos that when the hose is being pulled, it catches on the handle of a shutoff valve at the end of the blue pipe.
If that is the cause of the issue, you could make a smooth ramp around the valve, top to bottom with easily-removed plastic food wrap or wide tape, so that the hose slips past easily.

Of course, as @dandavis states, it could be the cold pipe is stiff.
Comment: That's a plausible explanation but as I had stated that was not the case.
Answer: I second the cold v warmed-up hose liklihood. Additionally, I've found that rubbing some silicone spray on the full length of my hose makes it more cooperative when cold since it does have to pass thru it's own fixture / guide, but that only works temporarily. Maybe there's a better form of lubricant, or maybe lubricating the fixture / guide would work better.

Sprayer on kitchen sink hard to pull up


Are there any differences that need to be accounted for when changing a hamburger from grilled to griddled?

Question: I have a friend that is about to open a food truck and he has asked me to use my burger recipe.  I have spent a long time perfecting it, but I have always made it with thick patties meant for the grill and not for the griddle, which is all he will have inside the truck.  Since the best griddled burgers are the smashed patty type, I want to adapt my recipe to work well with this new cooking method.  Am I going to need to play with my seasoning/spicing ratio?
Comment: I don't know about spicing, but I'd think that the meat you'd want to use would change, as with a grill, the melting fat could drip away, while that won't happen when cooking on a griddle.  (I guess the dripping fat might carry away some of the spices?)  This seems like a good opportunity for some taste tests ... make a few batches with different levels of (normal/over/under), then split each batch & cook on the griddle & grill, and compare.  You might only need to grill the 'regular' spiced batch.  You could also try how thickness affects things (other than cooking time).
Comment: Oh we will be testing before hand, I was just hoping to get an idea in what direction to head in to save some time. You already have me questioning my mix of meats due to the lack of draining on a griddle.
Answer: Does your burger recipe rely on the center of the burger being medium rare?  If so, you may have a problem with the spice ratio because your cooking technique will produce different types of doneness on the grill vs. the griddle.
With the grill you get a higher quantity of crispy burny bits (the Maillard reaction) than you will on a griddle (temperature generally in the high 300s F, as opposed to much higher grill heat).  With the grill at home you can go for a rare to medium rare center. with a lunch truck, you had best go for medium well for safety's sake (and possible legalities).
The easiest way to know how your recipe will work under griddle conditions is to test it.  Make up your burger, pat it thin and cook it all the way through in a medium heat fry pan (not my favorite way to have a burger, but classic griddle approach).  If all is well, you're done.  If not, well, you've already perfected it once, you'll need to decide what changes need to be made.
But I'm betting that perfection will carry through to the griddle burger just fine.
Comment: griddled burgers absolutely have more crust on them than an equivent grilled burger, there surface area is like twice of maybe even three times that of a grilled burger, all of it crusty. Mind you i'm talking about a comercial griddle here, lit by six gas flames easily churning out the same or more BTUS as my grill at high heat.  At least this is my understanding, I haven't ever worked extensively with a griddle before.
Comment: As it's supposed to be a gourmet kinda deal, I was going to default the burger to medium.  I was also planning on smashing the burgers, in the shake shack/in-and-out tradition.  My major question is will they be saltier due to the more extensive crusting? and how much should I reduce the fat content to make up for the fact that it's cookin gin the fat intead of the fat driping away?
Comment: If you are doing thick burgers on the grill you aren't losing as much fat as you'd think, so thinner burgers on the griddle should work fine with your existing blend.  And griddled burgers will be less crusty, not more.  If you are cooking to medium, you will still have most of the juiciness, so your salt balance should be fine.
Comment: If that's how you'll be doing it, then fine.  Most griddle work that I have done required that I do multiple types of dishes on it, so the temperature was definitely not as hot as a grill or broiler.  I did hamburgers next to pancakes next to eggs next to bacon next to toasted cheese sandwiches...all in the 375 griddle temperature range.  But if you are going to use the grill at very high temperatures then you'll get a better crust.  Just not my experience when working on the line.  YMMV.
Comment: I don't believe that we'll be doing eggs and such.  I'm actually just relating research I've done and i'm sadly lacking in pratical expereince with this equipment.  What I was envisioning was a super crusty burger, created by placing a rounded puck of seasoned beef on the griddle, smashing it flat with a spactula and then scraping it off the griddle to preserve as much of the crust as possible.  Is there another method I should be exploring?


Building Nested TypeScript Projects

Question: I'm using Typescript, React, and Vite.
This is my project structure. I have a tsconfig.json file at the root level. And I have a public/tsconfig.worker.json dedicated to my public/serviceWorker.ts file.
.
├── tsconfig.json
├── src/
│   └── constants/config.ts
└── public/
    ├── serviceWorker.ts
    └── tsconfig.worker.json

In my public/serviceWorker.ts file, I'm importing a variable from src/constants/config.ts.
// public/serviceWorker.ts

import Variable from "../src/constants/config";

I'm seeing this error in the import statement.
File '<path>/src/constants/config.ts' is not listed within the file list of project '<path>/public/tsconfig.worker.json'. Projects must list all files or use an 'include' pattern.

Below are my tsconfigs.
// root tsconfig.json

{
  "compilerOptions": {
    "target": "ES2022",
    "useDefineForClassFields": true,
    "lib": ["ES2022", "DOM", "DOM.Iterable"],
    "module": "ESNext",
    "esModuleInterop": true,
    "skipLibCheck": true,

    "moduleResolution": "bundler",
    "allowImportingTsExtensions": true,
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "react-jsx",

    "strict": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noFallthroughCasesInSwitch": true,

    // ...
  },
  "include": ["src", "svg.d.ts", "public/serviceWorker.ts"],
  "references": [
    { "path": "./tsconfig.node.json" },
    { "path": "./public/tsconfig.worker.json" }
  ]
}

// public/tsconfig.worker.json

{
  "compilerOptions": {
    "rootDir": "../",
    "composite": true,
    "module": "es2022",
    "noEmit": false,
    "moduleResolution": "bundler",
    "lib": ["WebWorker", "ES2022"],
  }
}

Also, I'm able to build ("build": "tsc && vite build") but the build includes serviceWorker.ts and tsconfig.worker.json files in the output like below.
.
└── dist/
    ├── assets/
    ├── serviceWorker.ts
    └── tsconfig.worker.json

Answer: The structure of your project is somewhat confusing. It seems to me, like you try to build the whole project from the root, expecting that tsconfig.json will be applied for the src folder and it will be merged with public/tsconfig.worker.json for the public/serviceWorker.ts file. But, when you run build public/tsconfig.worker.json is applied to the public/serviceWorker.ts independently from the tsconfig.json, which means it doesn't know about { "include": "public/serviceWorker.ts" }. Try to add { "include": "serviceWorker.ts" } into public/tsconfig.worker.json and remove { "include": "public/serviceWorker.ts" } from the root tsconfig.json.
Now about dist folder. This is the default vite behavior. public folder is supposed to be used for static assets only that don't require compilation, so you should think about putting your serviceWorker.ts somewhere else. I would try to place into src, since as far as I can see, you compile it anyway, so it's not a static asset. vite knows how to handle worker files out of the box.
Overall, I'd merge both tsconfigs into one and put serviceWorker.ts into src folder, e.g. src/workers/serviceWorker.ts.
Comment: Thanks for the explanation and relevant links.

Building Nested TypeScript Projects


Current through capacitor, displacement current

Question: How can current flow through a capacitor(open circuit)? Why is there a need of displacement current and why does it exist for a short period of time? Does the displacement current exist in medium between the plates? Why is there a need for charge to flow from battery's terminal to capacitor's plate?
Comment: Does this answer your question? [How Exactly Current Flow Through a Capacitor?](https://electronics.stackexchange.com/questions/77042/how-exactly-current-flow-through-a-capacitor)
Comment: How can radio waves travel through space when they are basically composed of electric and magnetic fields? One of the wonders of the universe in action. How can a charged amber rod levitate small pieces of paper and how do magnets attract iron?
Comment: See if https://electronics.stackexchange.com/questions/431231/how-does-capacitor-allow-ac-current-when-there-is-an-insulator-layer-between-the/431262?r=SearchResults#431262 helps.
Comment: Long story short, opposite charges attracts, so if you manage to change the charge on one plate, the other plate will follow suit with an opposite charge change. In a circuit, charge will flow in the circuit around the capacitor, and not through the space between the plates. What propagates between the plates is the field that make this charge redistribution possible. You can express that in a form that is dimensionally compatible with a current and it will be the same value as the current flowing in the conductors. That is the displacement current.
Answer:
How can current flow through a capacitor(open circuit)?

Because displacement current "flows" between the plates.  Or, more simply, because electrons pile up on one plate and are depleted on the other.

Why is there a need of displacement current

There is no "need" for displacement current, it just is.  Or, more properly, in order to make his equations consistent, James Clerk Maxwell invented it so that Ampere's Circuital Law always works.
You don't need the concept of displacement current to describe how a capacitor works at a simple level -- you can just use electrostatics and the notion of charges piling up on the plates.  But to keep Maxwell's Laws consistent, you need it.

and why does it exist for a short period of time?

Define "short".  If it takes a day for a capacitor to charge up, then the displacement current will exist for a day.

Does the displacement current exist in medium between the plates?

Yes.  That's the point of displacement current - it makes Ampere's Circuital Law work (and by extension, lets us calculate the propagation of electromagnetic waves).

Why is there a need for charge to flow from battery's terminal to capacitor's plate?

How could there possibly be a way for charge to not flow from the battery's terminal to the capacitor's plate?  If there's a force pushing electrons onto one plate, and an equal force pulling electrons off of the other, wouldn't you expect them to move?
Answer: When a capacitor is under charging one of the plates (= the minus side)  gets more electrons and the opposite plate (+) loses exactly as many. The force which changes the balance comes from the external source and metal wires bring it to the plates.
No current is needed across the gap between the plates. The external source both pushes from its one side and and sinks into its other side the needed amount of electrons.
If there happens to be some insulation material between the plates instead of vacuum there can be current inside that material during the capacitor gets charged. That's because the electron configuration in the material molecules changes due the increasing electric field between the plates. But those electrons do not move to nor from the plates, they stay in the insulator material, they only averagely move towards the plus plate. That effect isn't the displacement current, it's called polarization. It effectively reduces the distance between the plates so easily polarizable (=high permittivity) material between the plates greatly helps to make high capacitance capacitors.
The displacement current is an unfortunate name for a trick that mathematician J.C Maxwell made. He was writing a systematic compilation of all known basic electricity and magnetism theory. His goal was to present known facts in a general form which do not depend on any practical applications. That means vector differential equations in 3D space.
One thing was harmful: As a capable mathematician Maxwell knew that his equations had a hidden contradiction which someone sooner or later would bring up to make Maxwell and his work laughable. One day he got an idea: The contradiction could be fixed by inserting a new reason for magnetic field: a change in electric field.
Before that day theoretical writings stated "there's magnetic field around current and there's no other reasons for magnetic fields except fixed magnets". They could also be seen caused by current in the structure of the magnetic material, but that was only guessing at that time.  Maxwell inserted a term which made magnetic field also existing around a growing or decreasing electric field. So, there should be a magnetic field between the plates of a capacitor during charging or discharging just like there were a current in the gap between the plates. The calculated equivalent current between the plates is equal with the charging or discharging current.
Maxwell called that equivalent current "displacement current". A part of magnetic field between the plates can be caused by the polarization current in the insulator material and that's real current, but if there's no polarizing material between the plates, the magnetic field between the plates is generated by the change in the electric field and the equivalent current for the same field is purely imaginary.
Not asked, but maybe interesting:
 Maxwell himself didn't make any practical experiments to test how true his new law was. He knew that it was impossible to measure it with current equipment. There was no big enough capacitor nor measuring instruments compact and accurate enough for smaller ones.
Maxwell published  his work. The readers took it seriously because Maxwell already had earned his spurs in the world of science. It took years before one physicist was able to show that Maxwell's equations really predicted some observable phenomenons better than Ampere's and Faraday's theories did before Maxwell's correction. That phenomena was radiowaves and the physicist was H.Hertz. Later others found that also the basement of the theory of relativity was included to the same equations.


Bash option to make command substitution preserve trailing newlines

Question: I'm hoping that bash comes with an option that stops command substitution from stripping trailing newline characters. Is there? If there isn't, then do any shells exist that are bash-like, and for which standard—POSIX, I guess—sh code would run in, that has such an option or perhaps some special syntax for command substitution that doesn't strip newlines (the latter would be preferable)?
Comment: Related: [shell: keep trailing newlines ('\n') in command substitution](https://unix.stackexchange.com/q/383217/315749)
Answer: There's no option to do this directly (that I know of), but you can fake it by adding a protective non-newline character in the command substitution, and then removing that afterward:
var="$(somecommand; echo .)"  # Add a "." (and one newline that command
                              # substitution will remove) *after* the
                              # newline(s) we want to protect

var="${var%.}"  # Remove the "." from the end

Note that the exit status of somecommand is lost in the process, since both echo . and var=${var%.} set the status (normally to 0). If you need to preserve it until the end, you need to add a little juggling (w/ credit to Kusalananda):
var="$(somecommand; err=$?; echo .; exit "$err")"  # Make the subshell
                                                   # exit with somecommand's
                                                   # status
commandstatus=$?    # Preserve the exit status of the subshell
var="${var%.}"
# You can now test $commandstatus to see if the command succeeded

Note that the err and commandstatus variables both store the command's exit status, but they aren't redundant, since err only exists in the subshell created by $( ), and commandstatus only exists in the parent shell. You could use the same name for both, but that might add confusion.
BTW, if you don't need to preserve the status until after the "." is trimmed, you can skip the commandstatus part:
if var="$(somecommand; err=$?; echo .; exit "$err")"; then
    # somecommand succeeded; proceed with processing
    var="${var%.}"
    dosomethingwith "$var"
else
    echo "somecommand failed with exit status $?" >&2
fi

Beware that depending on the locale, you can't just use any character in place of `.`. The encoding of `.` is guaranteed by POSIX not to be found in the encoding of other characters, but that's not the case of all. For instance, in practice, the encoding of `x` is found at the end of the encoding of many characters in the BIG5 or GB18030 encodings, so if a `x` was appended instead  of `.`, that `x` could end up being combined with another byte that happens to be present at the end of the output to form a new character and `${var%x}` would then fail to remove that `x`.
Comment: @Walf, results of unquoted expansions go only through word splitting and globbing, but _a regular assignment is one of the few contexts where neither of those happen_. Barring bugs, `var=$foo` is exactly the same as `var=$bar`. (There have been some odd bugs in Bash related to that.)
Comment: The exit status of `somecommand` could be preserved with `var=$(somecommand; err=$?; echo x; exit "$err")`
Comment: In the case that `somecommand` would output something that may contain a trailing newline *and* always a final newline, then you''ll need to remove that as well, e.g. with `?` to match any single character: `d="$(dirname troublesome/path/to$'\n'/file; err=$?; echo x; exit $err)"; echo "dirname is '${d%?x}'"`
Answer: The only shells that I know that have a command substitution that can be told not to remove trailing newline characters are rc (the shell of Unix V10 and plan9, and Byron Rakitzis's public domain clone and its derivatives such as es or akanga) and fish.
In rc-like shells,
var = `{somecommand}

Stores the $ifs delimited words in the output of somecommand into the $var variables (and variables are arrays/lists in rc).
With an empty $ifs, (ifs = ()), that stores the output as is. The separators can also be specified with the ``(separators){somecommand}, so:
var = ``(){somecommand}

But rc/es/akanga are not very Bourne-like.
Also, you generally want to remove one newline character.
For instance in:
dirname=$(dirname -- "$file")

You do want to remove the newline character added by dirname, but not the ones that may be at the end of $file's directory.
rc has no builtin operator for that. You'd need:
dirname = ``(){dirname -- $file | head -c -1}

(not in standard head). In es, you can use the ~~ pattern extraction operator:
nl = '
'
dirname = <={ ~~ ``(){dirname -- $file} *$nl }

Which is hardly more legible (though could be made into a function).
The fish shell command substitution splits the output into its constituent lines.
set var (somecommand)

Stores the lines of somecommand's output into the $var array (and empty lines are preserved even those at the end of the output).
If you set $IFS to the empty list or one empty string, that splitting is disabled and up to one newline character is removed from the end of the output (at least in current versions of fish, IIRC there have been several changes on that front over the years). So there,
begin; set -l IFS; set dir (dirname -- $file); end

is reliable.
I'm not aware of any Bourne-like shell that can be told not to strip all trailing newline characters. That behaviour is required by POSIX and all Bourne-like shells do it even when not in posix mode (for those that have one like bash or zsh).
In bash 4.4+, in place of command substitution, you can also use readarray combined with process substitution (or a pipe with the lastpipe option and in non-interactive instances):
readarray -td '' var < <(somecommand)

Here -d '' is to splits on NULs. bash doesn't support storing NUL in its variables anyway, so for a replacement of command substitution that would be enough.
readarray -t lines < <(somecommand)

Stores that lines of the output of somecommand into the $lines array. You could then join them with newline to reconstruct that output without one trailine newline:
IFS=$'\n'
output="${lines[*]}"

But in all those approaches, you lose the exit status of somecommand.
To work around that misfeature of command substitution removing all newline characters, a common idiom is to add a non-newline character and stripping it (along with one newline character) afterwards as Gordon said.
But to do it without losing the exist status, you'd so something like:
cmdsubst() { # args: var cmd args
  eval "$1"'=$(shift; "$@"; ret=$?; printf .; exit "$ret")'
  eval "$1=\${$1%.}; $1=\${$1%'
'}; return $?"
}

Which is like command substitution except that only up to one newline character is removed.
To be used as:
cmdsubst dir dirname -- "$file"

in place of:
dir=$(dirname -- "$file")

Or for more complex commands:
cmdsubst var eval 'cmd1; for i in a b; do cmd "$i"; done'

Answer: A simple way that works in many use cases is to surround the command substitution with double quotes, and insert a newline immediately prior to the closing quote.  By placing the newline inside the quotes but outside the parentheses, you remove it from the scope of the command substitution, and the shell won't automatically remove it.
The first example has no newline before the closing quote, so the next $ prompt appears immediately after the output.  The second example works.
$ printf '%s' "$(date)"
Mon Jan 22 13:39:23 PST 2024$ printf '%s' "$(date)
"
Mon Jan 22 13:39:26 PST 2024
$

Because the shell strips all trailing newlines within the parenthesized command substitution, and the script subsequently adds just one newline back, this method has the limitation that it preserves only one trailing newline.  If there are multiple newlines, they are condensed down to one.


Can I add the 2nd monitor with Apple Cinema display

Question: I have a MBP 2017 13" connected to a cinema display. Right now I'm looking for a 4K 60hz display with USBC for charging my MBP. In that case, can both monitors work? I connect to the Cinema Display with an adapter.
Comment: You may find that your Intel graphics has to work very hard all the time, which may ramp the fans up all the time, to deal with the heat produced.
Answer: Yes this usually does work. Connecting another monitor with PD (Power-delivery) should not change the behaviour on your other ports. Your MacBook's specs specifically mention the ability to support two 4K monitors @60Hz, so one with a lower resolution will be no problem. I myself have been using a 4K PD (USB-C) LG monitor and a 2K monitor connected through a hub on a 2017 15" MBP.
However, your graphics card needs to push many more pixels, i.e. other graphics related tasks may slow down depening on your usecase.

Just to clarify:

Connecting another monitor [..] should not change the behaviour on your other ports

Of course your MacBook is limited at some point, i.e. connecting daisychained TB (Thunderbolt) devices and using an integrated USB hub in a monitor (many monitors using USB-C have this) will at some point lead to lower performance on these devices. However, you should only see decreasing speeds e.g. for external drives connected like that but the video output should generally be prioritized, i.e. not limited due to more connected other devices.
Comment: Thanks for ur reply. It's rly helpful. btw, which 4k monitor are u using? the LG ultrafine?
Comment: https://www.amazon.de/gp/product/B07MKT1W65/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1 its this one


Comprehensive guide on testing rails app

Question: Is there any comprehensive guides on testing rails apps. Im searching for guide that will tell me what should I test and how should I test it especially with Rspec. Lots of examples will be appreciated.
Answer: The RSpec Book
Testing the rails app is part of development so I'd sugest to read Ruby on Rails Tutorial, Learn Rails by Example by Michael Hartl, it has good explained testing process.
Answer: The Rails Guide A Guide to Testing Rails Applications is a good place to start.
It covers the default test/unit style of testing.
As suggested by @megas, the RSpec book is another place to look.
Agile Web Development with Rails is a great first book for any rails developer, covering the full process of building an application, testing it as you go.
Answer: Also take a look at Railscast as well.
Some episodes that talks about testing:
Episode 275: How I Test
Episode 257: Request Specs and Capybara
Episode 158: Factories not Fixtures revised or Older Episode
Episode 261: Testing JavaScript with Jasmine
Answer: Check out Everyday Rails Testing with RSpec. Sumner does a great job of walking you through writing tests for an entire app. The Hartl book is also a great resource.
Comment: Cool! I'll definitely buy this book


Different user access to different sharepoint views

Question: I have a sharepoint list with 10 columns. I want to give access to two different users.
User 1- Can edit all 10 columns.
User 2- Can only edit 6 columns.
Comment: You want to show different list views/columns to users OR different fields on list forms for editing/adding new items?
Answer: There is no directly way could do this in SharePoint online modern experience.
As a workaround, we suggest you add the different list view web part in classic page,then set Target Audiences for different web parts.


How to convert a Video to avi xvid with custom Frame Size?

Question: i want to convert my movies to avi xvid with the frame size 700x292 so that i can watch it on my tv.But i don't know which software in ubuntu will help me.I tried arista transcoder but it does not have the option to resize the frame.
Answer: I have found Handbrake to be a real pleasure.
https://trac.handbrake.fr/wiki/PictureSettings
He also has a ppa for Ubuntu.
https://launchpad.net/~stebbins/+archive/handbrake-releases
Answer: If your comfortable using the command line, then I highly suggest you take a look at ffmpeg which is the best video conversion utility available on linux imo. It does not come installed automatically on Ubuntu but is available in the standard repos.
sudo apt-get install ffmpeg

Once that's installed you can use command avconv to perform your video conversions. There is a whole bunch of options available for you to use which you can take a look at in the man pages (man avconv).
Answer: You have to install ffmpeg and its GUI application called WinFF
For compehensive use, you need to install it with following command:
sudo apt-get install ffmpeg ffmpeg-doc libav-tools winff winff-doc winff-gtk2 checkinstall yasm texi2html libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libsdl1.2-dev libtheora-dev libvorbis-dev libx11-dev libxfixes-dev libxvidcore-dev zlib1g-dev frei0r-plugins-dev libdc1394-22 libdc1394-22-dev libgsm1 libgsm1-dev libopenjpeg-dev libschroedinger-1.0-0 libschroedinger-dev libschroedinger-doc libspeex-dev libvdpau-dev vflib3-dev librtmp-dev libva-dev libjack-jackd2-dev libass4 libass-dev libmodplug1 libmodplug-dev libvo-aacenc0 libvo-aacenc-dev libvo-amrwbenc0 libvo-amrwbenc-dev libopenal1 libopenal-dev libavcodec-extra-53 libavdevice-extra-53 libavfilter-extra-2 libavformat-extra-53 libavutil-extra-51 libpostproc-extra-52 libswscale-extra-2

You can transcode the video with WinFF.
If with terminal you can done this with command:
ffmpeg -i [VIDEO NAME].[FORMAT] -vcodec -s mpeg4 -vpre [VIDEO PRESET EX. MEDIUM/HIGH ] -b [BANDWIDTH] -s [WIDTH]*[HEIGHT] -acodec copy [OUTPUT VIDEO NAME].avi

Replace the particular phrases in [ ]
If it is a mp4 video named Myvideo and needed output video is Output.avi with preset medium, 3000k bitrate and size 700x292,
Then the command is :
ffmpeg -i Myvideo.mp4 -vcodec -s mpeg4 -vpre medium -b 3000k -s 700x292 -acodec copy Output.avi

Comment: when i try to convert using winff it shows unknown encoder libxvid


Checking for unsnapped lines in ArcMap?

Question: I am trying to find a way to locate any unsnapped pipes/manholes. I noticed that my snapping environment was not set up in ArcMap the first few times I made edits and I want to go back and reverse those mistakes. There are thousands of pipes and manholes so I am sure I am not the only one to have this happen.
Answer: You could try the Feature Vertices to Points tool on your pipes, using the Both Ends (or maybe Dangle) option in Point Type.
Then do a select by location using the end points on your manhole layer. This will give you all the snapped manholes. Invert your selection and you'll be able to see  the unsnapped locations
Answer: One way would be to build a topology between your pipes and manholes.  Use rule Endpoint Must Be Covered By with your manholes and pipes, with pipe endpoints needing to be covered by manholes.
Additional Topo Rules

Checking for unsnapped lines in ArcMap?


Filling a buret tip before an experiment

Question: I have a question that asks if the buret tip is not filled before the experiment what would happen (effect on molarity for acid/base titration). The way I'm thinking about it, it's not like you're putting a pre measured solution into it. You fill it as high as you fill it and you can't put anything in without getting the tip filled up too, so I don't see where that will change anything. Am I thinking about that right?
Answer:
You fill it as high as you fill it and you can't put anything in without getting the tip filled up too,

No I don't think it will work like that. Usually you have the stock or valve closed at the bottom. Consequently, the tip will be empty until you bleed the buret. Further, you will often bleed (allow the titrant to flow) a buret while thumping the tip to remove any air bubbles that may form directly under the stop-cock when your titrant flows initially through the tip. Once you have titrant in the tip and the tip is devoid of air bubbles you will then close the valve and fill the buret to the desired level.
At this point you can better determine just how much you have used.
The measure marks on the buret itself take into account what is in the tip below the stop cock. But if you do not bleed the tip initially, filling it with your titrant then your first addition will be a bit off because the tip does not fill entirely with liquid before you allow some to drip through.
Here is a good write-up on titrations with burets.

A bubble in the nozzle of a buret will produce an inaccurate volume reading if the bubble escapes during a titration. Bubbles may be large and visible as shown above left or so small as not to be seen, above center. During a titration such small bubbles begin to move in the direction of the nozzle but may remain in place even though there is a moderate flow of titrant (above right). Even when the buret valve is wide open some bubbles remain in place until you take your eyes off them. Then they sneak through the nozzle and ruin your titration. Also if you let a an air bubble stay because you think it will remain and then later it leave to the tip you will have to start over because you have no idea what
Answer: I'm assuming that the question is talking about leaving air in the tip of the buret once you've filled it. In that case you would actually be adding less solution than you would have measured because the first half mL or so would go into filling the tip.
Answer: Yea, but in the lab we didn't measure any amount ahead of time, just filled it to the markings on the buret that we wanted.
(sory for the  annonymous post as an answer, away from my comp and coudn't remember my password to log in on this one.)


Change UIDatePicker font color?

Question: All I want to do is change the font color of the UIDatePicker. I've researched other questions but they're all involving changing other properties and customizing the entire look. All I want to do is just change the font color from black to white. I find it hard to believe that I can't do such a seemingly simple task. And why wouldn't the tint color affect it? Does it even do anything?
Comment: possible duplicate of [can I change the font color of the datePicker in iOS7?](http://stackoverflow.com/questions/18807940/can-i-change-the-font-color-of-the-datepicker-in-ios7)
Comment: In question above I found my solution.
Answer: All I need (on iOS 8.x and 9.0) is this one line to change the font color:
        [my_date_picker setValue:[UIColor whiteColor] forKey:@"textColor"];

No subclassing or invoking of private APIs...

Note: today's current date will still be highlighted (in newer iOS versions). You can get around this by using the following code:
if ([my_date_picker respondsToSelector:sel_registerName("setHighlightsToday:")]) {

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wundeclared-selector"

        [my_date_picker performSelector:@selector(setHighlightsToday:) withObject:[NSNumber numberWithBool:NO]];

#pragma clang diagnostic pop

}

Comment: I tried, but the parts of today's date are in the wrong color, the 10 and the October are black, I don't mind the year being in the wrong color but the other 2 feels weird
Comment: For current date `[my_date_picker performSelector:@selector(setHighlightsToday:) withObject:NO];`
Comment: This changes all text to white EXCEPT the current date (August 2 2015, for example would all be black).
Comment: @vshade, do you have a code snippet posted somewhere? happy to take a look...things still are working for me...
Comment: Figured out the default style changed, to get the wheel style back picker.preferredDatePickerStyle = .wheels is needed, then this solution continues to work
Comment: setHighlightsToday is no longer available on iOS 14
Comment: no longer works for iOS14 - The `picker.preferredDatePickerStyle = .wheels` does work - but what about color change ???
Comment: same thing here with "Today", at least.
Comment: Is it possible to set the font as well?
Comment: @NikKov That can throw a warning in the newest version and can possibly break in future versions so I'm editing code into the answer to reflect how to handle both of the cases I just mentioned when using your method. Thanks!
Comment: Code Works perfect. Thanks for help
Comment: I had to use this:  [_datePickerOutlet setValue:UIColor.blackColor forKey:@"textColor"];  #ObjectiveC
Answer: One other alternative to @Jeremiah answer is to define those values in  Interface Builder.
I prefer this one because there is no code to add in your ViewController.
Click into your DatePicker view and customise it from the Attribute inspector as in the screenshot.

Works for Swift 2, 3, 4 and probably for Swift < 2. (not tested)
Comment: Unfortunately this only colors the word "Today"... and nothing else. And if you set the highlightsToday off, the textColor has no effect. This is in Xcode 11.
Comment: In Xcode 14.2 highlightsToday has no effect, textColor works. Thanks!
Answer: As of Swift 2.1:
picker.setValue(UIColor.whiteColor(), forKey: "textColor")
picker.sendAction("setHighlightsToday:", to: nil, forEvent: nil)
let date = NSDate()
picker.setDate(date, animated: false)

Instead of "today" you will see the current day,
Comment: `setHighlightsToday` causes a warning, `No method declared with Objective-C selector 'setHighlightsToday:'`
Comment: Swift 3: picker.setValue(UIColor.white, forKey: "textColor")
            picker.sendAction(Selector(("setHighlightsToday:")), to: nil, for: nil)
Comment: In Xcode12/Swift 5.3 `…Selector(("setHighlightsToday:"))…` needs to drop `:` to be `…Selector(("setHighlightsToday"))…` to not have a runtime crash.
Answer: Next solution comes from "arturgrigor" and it works great in my apps, just copy it, paste it in viewDidLoad method, and enjoy it :
[my_datePicker setValue:[UIColor whiteColor] forKeyPath:@"textColor"];
SEL selector = NSSelectorFromString( @"setHighlightsToday:" );
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature :
                           [UIDatePicker
                            instanceMethodSignatureForSelector:selector]];
BOOL no = NO;
[invocation setSelector:selector];
[invocation setArgument:&no atIndex:2];
[invocation invokeWithTarget:my_datePicker];

Comment: You should be careful with this. this invokes an private api of apple and apple might reject your app for it!
Comment: what about changing the font ?
Comment: @SarenInden, my apps Acces-o and Acces-o School use it, don't worry!
Answer: According to Apple's UIKit User Interface Catalog, developers are not allowed to customize date pickers.
I've seen other StackOverflow answers for similar questions that suggest making a fake UIDatePicker using UIPickerView and customizing that.
I also found an open source date picker on GitHub (at https://github.com/mwermuth/MWDatePicker ) that might help a bit. It allows for different background and selector styles, but not a different font or font attributes.... yet.
Comment: Thanks Michael. I checked out the MWDatePicker, but it looks like it hasn't been updated for iOS 7 yet. It's just a blank picker when I run the sample project. I've settled for making a simulating a UIDatePicker by customizing a UIPicker. Thanks for the help. It's still very surprising Apple does not allow the customization of a date picker. I wonder why that is?
Comment: I see there's a [pull request](https://github.com/mwermuth/MWDatePicker/pulls) open to modernize MWDatePicker to iOS 7. It would be good if the owner merged it, but at least you can grab it and make use of it.
Answer: To change UIDatePicker text color use:
    // MARK: - Helping content

    private enum DatePickerProperties: String {
        case TextColor = "textColor"
        case HighlightsToday = "highlightsToday"
    }

    // MARK: - Outlets

    @IBOutlet private weak var datePicker: UIDatePicker!

    // MARK: - Lifecicle

    public override func awakeFromNib() {
        super.awakeFromNib()

        self.datePicker.setValue(UIColor.whiteColor(), forKey: DatePickerProperties.TextColor.rawValue)
        self.datePicker.setValue(false, forKey: DatePickerProperties.HighlightsToday.rawValue)
    }

It works like a charm with xCode 7.3 and Swift 2.3.
Answer: I stumbled upon a surprisingly clean solution using UIAppearance, without using any KVC, swizzling, or otherwise private API. I found that attempting to set the textColor via UIAppearance for any UILabel within a UIDatePicker had no affect, but a custom appearance property that simply called the regular textColor setter worked just fine.
// Implement a custom appearance property via a UILabel category
@interface UILabel (PickerLabelTextColor)

@property (nonatomic, strong) UIColor * textColorWorkaround UI_APPEARANCE_SELECTOR;

@end

@implementation UILabel (PickerLabelTextColor)

- (UIColor *)textColorWorkaround {
    return self.textColor;
}

- (void)setTextColorWorkaround:(UIColor *)textColor {
    self.textColor = textColor;
}

@end

And then use as follows:
UILabel *pickerLabelProxy = [UILabel appearanceWhenContainedInInstancesOfClasses:@[UIDatePicker.class]];
pickerLabelProxy.textColorWorkaround = UIColor.lightGrayColor;

Swift Version
UILabel extension:
extension UILabel {
    @objc dynamic var textColorWorkaround: UIColor? {
        get {
            return textColor
        }
        set {
            textColor = newValue
        }
    }
}

Appearance proxy use:
let pickerLabelProxy = UILabel.appearance(whenContainedInInstancesOf: [UIDatePicker.self])
pickerLabelProxy.textColorWorkaround = UIColor.lightGray

Comment: Can you provide a swift version of this solution please
Comment: @keegan3d Added! It compiles and should be functionally equivalent, but I haven't used this strategy recently. Let us know if it still works!
Comment: I'm trying it now in iOS 16.5.1 and it works really well when the component first appears, but changing the highlighted digits, and then moving to another, the previously highlighted one reverts to white, same thing with panning screens at a time or rolling the wheels.
Comment: It still works in August, 2023
Answer: If anyone wants the swift solution, I placed the following in viewDidLoad:
    birthdayDatePicker.setValue(DesignHelper.getOffWhiteColor(), forKey: "textColor")
    birthdayDatePicker.performSelector("setHighlightsToday:", withObject:DesignHelper.getOffWhiteColor())

Comment: anyway to remove the warning in xcode 7.3 - No method declared with Objective-C selector "setHighlightsToday:" ?
Comment: great!, any solution for Swift < 2? performSelector isn't available in 1.2
Comment: I haven't found one. I've confirmed it works and is still needed. If anyone has a way to do this without getting a warning that would be awesome!
Comment: To suppress warnings check out this solution http://stackoverflow.com/questions/194666/is-there-a-way-to-suppress-warnings-in-xcode
Answer: For Xamarin developers:
DatePicker.SetValueForKey(UIColor.White, new NSString("textColor"));
DatePicker.SetValueForKey(FromObject(false), new NSString("highlightsToday"));

It´s working like a charm.
Tested in iOS 9 and 10
Answer: You can also add this as an IBDesignable if you want to configure this within InterFace Builder.
    import UIKit

@IBDesignable
extension UIDatePicker {
    @IBInspectable var textLabelColor: UIColor? {
        get {
            return self.valueForKey("textColor") as? UIColor
        }
        set {
            self.setValue(newValue, forKey: "textColor")
            self.performSelector("setHighlightsToday:", withObject:newValue) //For some reason this line makes the highlighted text appear the same color but can not be changed from textColor.
        }
    }
}

Answer: This subclass of UIDatePicker works for iOS 7. Its not pretty but gets the job done.
#define kNotification_UIView_didAddSubview @"kNotification_UIView_didAddSubview"
@implementation UIView (addSubview)

-(void) didAddSubview:(UIView *)subview{
    [[NSNotificationCenter defaultCenter] postNotificationName:kNotification_UIView_didAddSubview object:self];
}
@end

@interface DatePicker ()
@property (nonatomic, strong) UIColor* textColor;
@end

@implementation DatePicker

-(id) initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self){
        [self setup];
    }
    return self;
}
-(id) initWithCoder:(NSCoder *)aDecoder{
    self = [super initWithCoder:aDecoder];
    if (self){
        [self setup];
    }
    return self;
}

-(void) setup{
    self.textColor = [UIColor darkTextColor];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(subviewsUpdated:) name:kNotification_UIView_didAddSubview object:nil];
}

-(void) dealloc{
    [[NSNotificationCenter defaultCenter] removeObserver:self];
}

-(void) updateLabels:(UIView*) view{
    for (UILabel* label in view.subviews){
        if ([label isKindOfClass:[UILabel class]]){
            label.textColor = self.textColor;
        }else{
            [self updateLabels:label];
        }
    }
}

-(BOOL) isSubview:(UIView*) view{
    if (view == nil){
        return NO;
    }
    if (view.superview == self){
        return YES;
    }
    return [self isSubview:view.superview];
}

-(void) subviewsUpdated:(NSNotification*) notification{
    if ([notification.object isKindOfClass:NSClassFromString(@"UIPickerTableView")] && [self isSubview:notification.object]){
        [self updateLabels:notification.object];
    }
}

@end

Answer: [date_picker setValue:textColor forKey:@"textColor"];
[date_picker performSelector:@selector(setHighlightsToday:) withObject:NO];

Answer: Add Runtime Attribute named "textColor" from Storyboard as shown in following image.
Answer: As alternative to @Jeremiah answer, you can use this:
datePicker.setValue(UIColor.redColor(), forKey: "textColor")
datePicker.sendAction("setHighlightsToday:", to: nil, forEvent: nil)
datePicker.setDate(NSDate(timeIntervalSinceReferenceDate: 0), animated: false)

it will remove Today (you will see current date), but it will be with right color.
Possible troubles:
if you change color dynamically, I didn't find a way to reload date picker. So, the user will see previous color and only after scroll, color will changed to a new one. -> Solved, by last string. Looks like Voodoo, but it works...
This answer suitable for Swift 2.1
Answer: It didn't work until textColor was set inside layoutSubviews()
override func layoutSubviews() {
    super.layoutSubviews()
    datePicker.backgroundColor = .black
    datePicker.setValue(.white, forKeyPath: "textColor")
}

Answer: Just use datePicker.tintColor = .red or any other color you want.
Answer: [my_date_picker setValue:[UIColor whiteColor] forKey:@"textColor"];

it seems don't work on ios 13 or later, you can set overrideUserInterfaceStyle property for UIDatePicker to determin it shows white color or black.

Change UIDatePicker font color?


Why do screws usually work well without clearance holes?

Question: Why do screws so often work even without a clearance hole? It seems like in theory, the screw should always push the joint apart (bridging). But in my experience, screws more often seem to tighten the joint. How does this work? Is it because the screw strips the threads in the first piece of wood a little bit, so it works the same as though it had a clearance hole?
Answer: I would challenge the 'usually' in your thread title, because the experience of many would suggest otherwise. But the screws you're using most and how you're using them will be factors. It may highlight the difference between power driving and hand-driven screws. And material matters, MDF and particleboard/chipboard aren't the same as wood.
So to your theory of the screw stripping the thread in the first piece of wood, my bet is that it won't be the main factor. But withdraw some screws and look. That's the best way to find out if that is what occurs.
This might not be obvious but if the two pieces are tightly together already and held that way (e.g. firmly clamped or already glued) then that spacing will be maintained as the screw is driven home. If they're not tightly together however then bridging is a virtual certainty with most screws IME — as anyone who has had this happen will have seen, as the screw is driven in it will move the first piece off the second and then the gap will not close to nothing.
Note that if using a conventional wood screw with an unthreaded portion at the top under the head and the first piece is roughly the same thickness there is no thread there to cause bridging, so that would prevent the problem since the action of the screw can overcome friction and pull the first piece down snug.


Vignetting on my Nikon D780 with AF-S 24-120mm f/4 G ED VR Lens

Question: I've recently got a new camera, the Nikon D780 with kit lens (AF-S 24-120mm f/4 G ED VR), the lens works great except for the vignetting I often get with. I have tried using it with and without the lens hood but it does not seem to change the result. I would be really grateful for some help!
Comment: Welcome to Stack Exchange - could you please post some images showing the problem along with the exposure settings (shutter speed, aperture and ISO) for each? Thanks!
Answer: This lens seems to suffer from vignetting. The linked review gives you combinations of focal length/aperture that mitigate this.
On the other hand vignetting is quite easy to compensate in any photo editor/demosaïcing application worth its salt, and that lens is probably very widely supported.
Comment: Thanks very much for the help, I wasn't sure if it was something I was doing wrong! The review you've attached is very useful.
Comment: Good. Then please consider marking the answer as accepted (click on the checkmark under the votes). This helps others.


What is the difference between AWS App Config and Code Deploy, and when to use each one

Question: Both these services seem to do the similar things, when would you use each one.
Answer: AWS AppConfig helps you applying configuration changes to running applications.
Use AWS AppConfig, a capability of AWS Systems Manager, to create, manage, and quickly deploy application configurations. AppConfig supports controlled deployments to applications of any size and includes built-in validation checks and monitoring. You can use AppConfig with applications hosted on EC2 instances, AWS Lambda, containers, mobile applications, or IoT devices.
AWS CodeDeploy helps you rolling out new versions of applications.
AWS CodeDeploy is a fully managed deployment service that automates software deployments to a variety of compute services such as Amazon EC2, AWS Fargate, AWS Lambda, and your on-premises servers. AWS CodeDeploy makes it easier for you to rapidly release new features, helps you avoid downtime during application deployment, and handles the complexity of updating your applications.
Answer: CodeDeploy is actually the tool you use for deploying your code, it supports deployments to EC2 hosts (including on-premise), Lambda and ECS. It takes a archive and deploys this to a resource based on specific conditions (for example a EC2 based deployment you can specify a tag name or autoscaling group to deploy to).
CodeDeploy also integrates with CodePipeline which enables you to build full deployment pipelines for your applications, including building, testing and deploying the application.
App Config is used to deploy configuration settings for your application.

AWS AppConfig enables customers to quickly rollout application configuration changes, independent of code, across any size application hosted on Amazon Elastic Compute Cloud (EC2) instances, containers, and serverless applications and functions.

Using either a parameter store value or an SSM document you would use AppConfig to perform rolling out of the feature within your app (supporting A/B style testing, proportional rollouts). This enables you to test new features in your application safely without using an all or nothing approach.
In Summary, CodeDeploy will be used for deploying your code base, whereas AppConfig will be for rolling out of the configuration values that your application uses.
Comment: Hi. A small note. AppConfig also integrates very well with CodePipeline.
Answer: Just to complement @DenisTraub and @ChrisWilliams answers.
One big difference between the two is that CodeDeploy does not require you to modify your application. It can deploy anything without changing a single line of code of your application.
However, to use AppConfig, you must modify your application. This is because your application must be pooling for any configuration changes that are stored/managed by the AppConfig, and respond to these changes.


Existing pre-trained NLP models to detect if a text input is a question

Question: I would like to quickly filter text data into question and non-questions. Using the presence of question mark in the text is too crude. Are there any existing models I can use to aid me with my task?
Answer: There are multiple threads on Stack Overflow talking about this. Couple of examples can be found below:

Determine if a sentence is an inquiry
NLTK. Detecting whether a sentence is Interogative or Not?

You can also take a look at Natty. It's a bot on Stack Overflow, which reviews answers to old questions. You can see how effective it is in terms of detecting questions (every bot needs training, and Natty has been trained for quite a while). However it is written in Java, it may give you some ideas. Like detecting keywords alongside checking for presence of question mark.