Don't re-apply patches when requiring new module?

Question: I keep running into the issue that, when requiring a new module with composer, existing packages are removed and reinstalled if they have patches defined in composer.json. For instance:
$ lando composer require drupal/media_entity_browser
    1/2:        https://packages.drupal.org/8/drupal/provider-2019-2$bae9fca7243956d61e44a716bdfb5c872f0f3e1a0b48b1dccfcae53d7e59c86f.json
    2/2:        https://packages.drupal.org/8/drupal/provider-2019-1$25356ca628b704d49a0ea504e6374f921a2b54d845d142aae1708cb94088516f.json
    Finished: success: 2, skipped: 0, failure: 0, total: 2
    1/2:        http://repo.packagist.org/p/provider-latest$56447e2294826167894155c32ceb596c58b3b2af059facd78694060f8a4d8c1c.json
    2/2:        http://repo.packagist.org/p/provider-2019-04$a612146345a708aa360ee61a695dd52d8d0faa79e136de5e075c95860af7c956.json
    Finished: success: 2, skipped: 0, failure: 0, total: 2
Using version ^1.0@beta for drupal/media_entity_browser
./composer.json has been updated
Gathering patches for root package.
Removing package drupal/core so that it can be re-installed and re-patched.
  - Removing drupal/core (8.7.3)
Deleting web/core - deleted
> DrupalProject\composer\ScriptHandler::checkComposerVersion
Loading composer repositories with package information
Updating dependencies (including require-dev)
    1/4:        https://ftp.drupal.org/files/projects/media_entity-8.x-1.8.zip
    2/4:        https://ftp.drupal.org/files/projects/entity-8.x-1.0-rc3.zip
    3/4:        https://ftp.drupal.org/files/projects/entity_browser-8.x-2.1.zip
    4/4:        https://ftp.drupal.org/files/projects/media_entity_browser-8.x-1.0-beta3.zip
    Finished: success: 4, skipped: 0, failure: 0, total: 4
Package operations: 5 installs, 0 updates, 0 removals
Gathering patches for root package.
Gathering patches for dependencies. This might take a minute

For something like drupal/core this is really a problem on my local as it takes a while to download and reinstall the package. I can't seem to find a pattern. Sometimes it seems that the repatched package is a requirement of the one being required, other times they are unrelated or no packages are repatched at all.
Has anybody else come across this? Is there a way around it? Ideally we'd only re-apply patches to a package when it's updated.
Here's my composer.json since it was requested:
{
    "name": "drupal/drupal",
    "description": "Drupal is an open source content management platform powering millions of websites and applications.",
    "type": "project",
    "license": "GPL-2.0-or-later",
    "require": {
        "composer/installers": "^1.0.24",
        "cweagans/composer-patches": "^1.6",
        "drupal/address": "^1.4",
        "drupal/addtoany": "^1.10",
        "drupal/admin_toolbar": "^1.26",
        "drupal/antibot": "^1.2",
        "drupal/better_exposed_filters": "^3.0@alpha",
        "drupal/blazy": "^2.0@beta",
        "drupal/ckeditor_media_embed": "^1.3",
        "drupal/color_field": "^2.0",
        "drupal/config_inspector": "^1.0@beta",
        "drupal/config_update": "^1.6",
        "drupal/console": "~1.0",
        "drupal/context": "^4.0@beta",
        "drupal/core": "^8.7.0",
        "drupal/csv_serialization": "^1.4",
        "drupal/ctools": "^3.2",
        "drupal/delete_all": "^1.0",
        "drupal/devel": "^2.0",
        "drupal/draggableviews": "^1.2",
        "drupal/dropzonejs": "^2.0@alpha",
        "drupal/ds": "3.x-dev",
        "drupal/entity_clone": "^1.0@beta",
        "drupal/entity_print": "^2.1",
        "drupal/entity_update": "^1.2@RC",
        "drupal/entity_usage": "^2.0@alpha",
        "drupal/features": "^3.8",
        "drupal/file_mdm": "^1.1",
        "drupal/form_options_attributes": "^1.0",
        "drupal/geocoder": "^2.0",
        "drupal/geofield_map": "^2.23",
        "drupal/google_analytics": "^3.0",
        "drupal/google_tag": "^1.1",
        "drupal/honeypot": "^1.29",
        "drupal/htmlmail": "^3.0@alpha",
        "drupal/imagemagick": "^2.4",
        "drupal/imagick": "^1.2",
        "drupal/imce": "^1.7",
        "drupal/inline_entity_form": "^1.0@RC",
        "drupal/languageicons": "^1.0@beta",
        "drupal/layout_builder_at": "^2.8",
        "drupal/layout_builder_modal": "^1.0@alpha",
        "drupal/layout_builder_restrictions": "^2.2",
        "drupal/media_entity": "^2.0",
        "drupal/media_entity_browser": "2.x-dev",
        "drupal/media_entity_generic": "^1.0@alpha",
        "drupal/media_entity_image_exif": "1.x-dev",
        "drupal/media_entity_video": "^2.0@alpha",
        "drupal/menu_export": "^1.2",
        "drupal/menu_per_role": "^1.0",
        "drupal/metatag": "^1.8",
        "drupal/migrate_plus": "^4.1",
        "drupal/migrate_source_csv": "^2.2",
        "drupal/migrate_tools": "^4.1",
        "drupal/panelbutton": "^1.2",
        "drupal/paragraphs": "^1.5",
        "drupal/path_redirect_import": "^1.0@beta",
        "drupal/pathauto": "^1.3",
        "drupal/permissions_by_term": "^2.10",
        "drupal/recaptcha": "^2.4",
        "drupal/redirect": "^1.3",
        "drupal/redis": "^1.1",
        "drupal/rename_admin_paths": "^1.1",
        "drupal/restrict_ip": "^1.3",
        "drupal/search_api": "^1.12",
        "drupal/search_api_autocomplete": "^1.2",
        "drupal/search_api_page": "^1.0@alpha",
        "drupal/slick": "^2.0@beta",
        "drupal/slick_media": "^2.0@alpha",
        "drupal/slick_paragraphs": "^2.0",
        "drupal/smtp": "^1.0@beta",
        "drupal/stage_file_proxy": "^1.0@alpha",
        "drupal/superfish": "^1.3",
        "drupal/taxonomy_menu": "^3.4",
        "drupal/tmgmt": "^1.7",
        "drupal/twig_tweak": "^2.1",
        "drupal/views_accordion": "^1.2",
        "drupal/views_block_area": "^1.0@beta",
        "drupal/views_bulk_operations": "^2.5",
        "drupal/views_data_export": "^1.0@beta",
        "drupal/webform": "5.1",
        "drupal/weight": "^3.1",
        "drush/drush": "^9.2",
        "league/iso3166": "^2.1",
        "solarium/solarium": "3.8",
        "wikimedia/composer-merge-plugin": "^1.4"
    },
    "require-dev": {
        "webflo/drupal-core-require-dev": "^8.7.0"
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "config": {
        "preferred-install": "dist",
        "autoloader-suffix": "Drupal8",
        "sort-packages": true
    },
    "conflict": {
      "doctrine/common": ">2.8"
    },
    "extra": {
        "_readme": [
            "By default Drupal loads the autoloader from ./vendor/autoload.php.",
            "To change the autoloader you can edit ./autoload.php.",
            "This file specifies the packages.drupal.org repository.",
            "You can read more about this composer repository at:",
            "https://www.drupal.org/node/2718229"
        ],
        "installer-paths": {
            "core": ["type:drupal-core"],
            "modules/contrib/{$name}": ["type:drupal-module"],
            "profiles/contrib/{$name}": ["type:drupal-profile"],
            "themes/contrib/{$name}": ["type:drupal-theme"],
            "drush/contrib/{$name}": ["type:drupal-drush"],
            "modules/custom/{$name}": ["type:drupal-custom-module"],
            "themes/custom/{$name}": ["type:drupal-custom-theme"]
        },
        "patches": {
            "drupal/core": {
                "Compatibility with JSON:API": "https://www.drupal.org/files/issues/2018-09-20/2942975-24.patch",
                "Layout builder revisions": "https://www.drupal.org/files/issues/2019-06-06/3033516-8.drupal.Revision-UI-on-Layout-Builder-does-not-function-correctly.patch",
                "Error: Call to a member function getLabel() after enable layout_builder": "https://www.drupal.org/files/issues/2018-07-16/2985882-entityfield-2.patch",
                "media_bundle shim": "patches/295028764_media-bundle-shim.patch"
            },
            "drupal/dropzonejs": {
                "The 'media_bundle' entity type does not exist.": "https://www.drupal.org/files/issues/2019-04-25/2820183-19.patch"
            },
            "drupal/paragraphs": {
                "Paragraphs Translation": "https://www.drupal.org/files/issues/2018-12-14/experimental-widget-asymetric-translation-2904705-47.patch"
            },
            "drupal/entity_reference_revisions": {
                "Fixes broken revisioning on paragraph updates": "https://www.drupal.org/files/issues/2019-01-29/3025709-3.patch"
            },
            "drupal/permissions_by_term": {
                "Use custom 403 destination set by admin form": "https://www.drupal.org/files/issues/2018-11-27/3009470-403-url-settings-ignored-10.patch"
            }
        }
    },
    "autoload": {
        "psr-4": {
            "Drupal\\Core\\Composer\\": "core/lib/Drupal/Core/Composer"
        }
    },
    "scripts": {
        "pre-autoload-dump": "Drupal\\Core\\Composer\\Composer::preAutoloadDump",
        "post-autoload-dump": "Drupal\\Core\\Composer\\Composer::ensureHtaccess",
        "post-package-install": "Drupal\\Core\\Composer\\Composer::vendorTestCodeCleanup",
        "post-package-update": "Drupal\\Core\\Composer\\Composer::vendorTestCodeCleanup",
        "drupal-phpunit-upgrade-check": "Drupal\\Core\\Composer\\Composer::upgradePHPUnit",
        "drupal-phpunit-upgrade": "@composer update phpunit/phpunit --with-dependencies --no-progress",
        "phpcs": "phpcs --standard=core/phpcs.xml.dist --runtime-set installed_paths $($COMPOSER_BINARY config vendor-dir)/drupal/coder/coder_sniffer --",
        "phpcbf": "phpcbf --standard=core/phpcs.xml.dist --runtime-set installed_paths $($COMPOSER_BINARY config vendor-dir)/drupal/coder/coder_sniffer --"
    },
    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        }
    ]
}

Comment: Isn't this a Composer issue for SO? "Don't re-apply patches when requiring new **dependency**?" Drupal seems to be a coincidence, no?
Comment: @leymannx hmm, yeah that's a good point. I think I've only seen it when requiring Drupal packages but I don't know for certain whether or not it's strictly related to Drupal packages
Answer: The problem is probably caused because one of the core patches that you are trying to apply doesn't exist or couldn't be downloaded.
I have tested with your composer.json on a clean Drupal 8 install. When running composer update I get the following error:

Could not apply patch! Skipping. The error was: The "patches/295028764_media-bundle-shim.patch" file could not be downloaded: failed to open stream: No such file or directory.

I figured that the media-bundle-shim.patch patch is no longer available, so I removed it from composer.json. After that everything worked fine and it stopped re-applying the core patches every time.
So all you have to do is to remove the patch from composer.json, or replace it with a new one that exists:
"drupal/core": {
  "Compatibility with JSON:API": "https://www.drupal.org/files/issues/2018-09-20/2942975-24.patch",
  "Layout builder revisions": "https://www.drupal.org/files/issues/2019-06-06/3033516-8.drupal.Revision-UI-on-Layout-Builder-does-not-function-correctly.patch",
  /* Remove the last comma from this line. */ "Error: Call to a member function getLabel() after enable layout_builder": "https://www.drupal.org/files/issues/2018-07-16/2985882-entityfield-2.patch",
  /* Remove this line. */"media_bundle shim": "patches/295028764_media-bundle-shim.patch"
},

UPDATE: The media_bundle patch could not be applyed for me, because it is a local patch.
I thave two suggestions to why it keeps re-applying the patches:

lando causes the issue.
The issue is caused because the local patch is not applied properly.

Since you mention that the issue was there prior to adding the local patch, it's unlikely that it's because the local patch is not being applied properly. I think the problem is lando, since your composer.json file works fine on a clean Drupal install using only Drupal and composer.
I don't know if it is possible to run composer require without lando on your site, but if it's possible you can test if lando is the problem by running composer require without lando.
If that doesn't work, try to remove the local patch to se if the problem persists.
Local patch problems.
Hope this helps you debug further.
Comment: Sorry, that's a custom local patch. This issue was indeed present prior that adding this patch into the mix
Comment: Uh, try to take a look at my updated answer. Thanks.
Comment: the local patch applies fine, it's not the problem. I'm on windows so without going through the rigamarole of setting up php/composer to run outside of lando I'm afraid I cannot test  composer outside of it. Tbh I was hoping somebody would come across this who had experienced my same problem but it may be more isolated to my environment than I expected it to be.
Comment: @Mrweiner I think so, as I say I have tested using php and composer and it works fine. So the problem is probably not drupal. I'm sorry to say but I think this question is a bit off topic here, and should be posted in a lando forum. It's hard to debug further when we don't have access to your environment. Hope you got a bit more cleaver on your problem ;) Good luck!
Answer: I think you may miss 2 "extra" settings in your composer.json:
"enable-patching": true,
"patchLevel": {
    "drupal/core": "-p2"
},

Explanation:
From the composer-patches documentation:

If you want your project to accept patches from dependencies, you must
  have the following in your composer file: "enable-patching": true

Also the drupal/core": "-p2" avoids things ending up in core/core or core/b.
See drupal-project/composer.json and Patch Drupal core without things ending up in core/core or core/b.
Comment: Unfortunately that didn't help me to avoid `drupal/core` re-installig/re-patching during simple `composer install`. But the info about `pathLevel` was very helpful/useful to correctly patch the core.


Putty dims in fullscreen mode

Question: When I maximize my putty window, it looks fine, however, if I hit alt-enter to go fullscreen mode, the font dims. I've looked through putty and my display settings, and I can't find anything that seems to address it. How can I get the full-screen mode to look the same as the maximized window?
Answer: My LCD monitor was doing automatic brightness and contrast. I found this by playing with the monitor settings. When I hit the button for "Brightness/Contrast", it prompted me to turn off the auto mode so that it could be adjusted manually. I said yes to turn it off, but didn't actually adjust brightness/contrast. PuTTY now looks the same in fullscreen or otherwise.
Comment: Just popping in to say thank you for answering this question. I had low expectations when I searched for "putty dims in fullscreen mode". I would never have guessed it on my own, you saved me a great deal of frustration!
Comment: Thank you, I accidentally changed my settings on my monitor to dynamic contrast and for some reason it would only happen when I did a fullscreen on a command prompt.  I was going nuts trying to figure this out.

Putty dims in fullscreen mode


How can I fix a ceiling above the shower that was damaged by water?

Question: Our pipe coming out of the wall was leaking a very fine stream of water. We haven't had time to fix it. I don't know what that bumpy stuff on the ceiling is called but it's all peeling off. I know the pipe needs to be fixed first, but how should we fix the ceiling? Is it possible to apply it back on the ceiling? None of it has actually fallen off yet.
Comment: See also http://diy.stackexchange.com/questions/60868/water-damage-in-bathroom-ceiling-floor-how-to-treat-and-then-prevent
Answer: What's up there depends on the age of the home and how much the contractor cared when they spec'ed it. Most likely, the ceiling is some form of gypsum board that is then plastered, textured and painted. The result of water leakage on gypsum board is usually that the entire board starts to sag under its own weight; alternately, the outer layer of paper, along with any spackle, texture and paint, will peel away with the damp.
Unfortunately, drywall repair == drywall replacement. You have to cut away the damaged portion, fit and screw a new piece of drywall into that hole (using rust-resistant screws as this area already has a reputation for moisture), then tape, spackle, seal, texture, prime and paint.
On top of that, many types of ceiling texture such as "popcorn" ceilings are simply impossible to blend in with when you do a repair like this; tiny differences in the application of the texture along with the sudden stop/start to the old texture around the patch will make repairs obvious. To really do the job right, you have to re-texture the entire ceiling by scraping off the old stuff, smoothing the surface with sandpaper or plaster, then reapplying texture, priming and painting.
If you're going to do all this anyway, I would recommend replacing the entire piece of drywall that has been leaked on with a more water-tolerant product like backer board (DuRock, Hardee-Backer, etc). This product is normally used in areas where water and/or heat can be a problem, and are durable enough to get soaked without crumbling apart unlike gypsum board. These products are generally a different thickness than drywall so you'll need to level the ceiling with lath strips of the proper supplemental thickness on the joists. After that, installation should proceed much like with drywall (you may need to smooth the surface with more plaster; backer board is commonly used as underlayment for tile and so often has a mesh that grips thinset).
Answer: Most likely it is some sort of drywall texturing applied by hand or with a spray gun. If you're asking if it can be re-attached to the ceiling - I don't think so. If you're decent at DIY jobs, and you can identify the texture, you may be able to apply new texturing yourself. I've been able to get decent results, but not perfect using a product like this : http://www.homedepot.com/buy/building-materials-ceilings-attics/homax-10-oz-orange-peel-spray-texture-3-pack-119845.html
Keep in mind that it will probably require some surface prep and new paint.
Comment: It's almost certainly not just the plaster that's bubbling. When drywall gets wet it collapses under its own weight. If this is what's happening it's much more than a retexture job.
Comment: There is no way to tell without more detail / pictures. I've had an instance where water on the surface of the paint has made it blister in small bubbles. This was definitely not the drywall sagging under it's own weight. Specifically, if the care was taken to use a high enamel paint, I doubt it saturated the actual drywall itself.


create customer & login that customer Programmatically in custom controller

Question: i am creating one getaway & hosted solution that redirect user on select payment method so user can't press place order button so it's creating problem in register checkout.     customer not create or login on register checkout.now i want to create & login that customer         Programmatically using detail present in quote on return of customer from that payment site.May be Magento have already have some methods. can any body helps.
Thanks
Answer: You can find here a possible solution for autologin. The example in the answer shows how to login a customer on frontend by clicking a button on the backend, but the idea is the same.
But I wouldn't recommend what you are trying.
There is always the chance that someone mimics the response you get from the gateway and can just try random quote ids and log in as anyone else.
If you are attempting it, make sure you use some kind of secret key and not just the quote id or only data from the quote.
Comment: I am return on onepage before save quote so i think get wrong quote is out of question.


Open CMD terminal Automatic on boot up

Question: How do I get the CMD terminal to open up on its own when I start the raspberry pi up.
Answer: I Figured it out. What you do is sudo nano /etc/xdg/lxsession/LDXE-pi/autostart, then add @lxterminal and it will autostart the cmd terminal on bootup, which will then run my shell script and go to the website
Answer: To start the Raspberry Pi into the command line then just execute
rpi ~$ sudo raspi-config

and select 3 Boot Options -> B1 Desktop / CLI -> B1 Console or B2 Console Autologin, just what you want. On the next boot you will have a text console instead of the graphical user interface.
Comment: @ParkerStearns You should have mentioned this important information in your question.
Comment: I've tried this but the problem is, I need the cmd terminal to open up in the desktop GUI. I need this because I'm trying to run a shell script that opens up the internet, and goes straight to a website on boot up. If I open the terminal it runs everything and goes straight to the website, I just need the cmd terminal to open on boot up, but it has to be in the desktop GUI so it can open chromium

Open CMD terminal Automatic on boot up


Plotting an implicit function

Question: Suppose I am given an equation of the following form: $f(x,y)=0$. I would like to find $y$ as a function of $x$. i.e. find the function $y=y(x)$. In general, it is impossible to find a closed-form solution. I can use ContourPlot to visualize the solution. Now, suppose I would like to plot a function $z=g(y(x))$ in terms of $x$. How can I do this in Mathematica?
Comment: Is $y$ a function of $x$ in general?  Or can $f$ be something like $f(x,y)=x^2+y^2-1$? People here generally like users to post a minimal working example in *Mathematica* code. It makes it convenient for them to copy-paste it and test their ideas. It's more likely you will get someone to help you.
Answer: Here's generic approach, if you can pick a initial point:
Block[{f, g, a, b, x0, y0 ics},
 (* set up problem *)
 f[x_, y_] := x^2 + y^2 - 1;
 g[y_] := Sin[Pi y];
 a = -1;
 b = 1;
 {x0, y0} = {0, 1};

 (* generic solution *)
 ics = {y[x0] == y0, z[x0] == g[y0]};
 ListLinePlot@
  NDSolveValue[{D[z[x] == g[y[x]], x], D[f[x, y[x]] == 0, x], ics},
   z, {x, a, b}]
 ]

Answer: Thanks @Michael E2 provide an example.
f[x_, y_] := x^2 + y^2 - 1;
g[t_] := Sin[Pi*t];
ParametricPlot[{x, g[y]}, {x, -1, 1}, {y, -1, 1},
 MeshFunctions -> Function[{x, y, u, v}, f[u, v]], Mesh -> {{0}},
 MeshStyle -> Red, PlotStyle -> Opacity[.01], PlotPoints -> 80,
 BoundaryStyle -> None]

Another way is use ParametricRegion.
f[x_, y_] := x^2 + y^2 - 1;
g[t_] := Sin[Pi*t];
RegionPlot[
 DiscretizeRegion[ParametricRegion[{{x, g[y]}, f[x, y] == 0}, {x, y}],
   MaxCellMeasure -> {Length -> 0.01}]]

Plotting an implicit function


how to use phpfox session in cusom php script to access user information

Question: I have a custom php script for this i want to use the user information which is logged in into the phpfox site.
Just like in the wordpress we can access the information of the logged in user through the wp-header.php
So i was looking for such like thing to access the loggedin user information in phpfox.
Is there any function or function files through which we can access the loggedin user information and use the same session.
Answer: use Phpfox::getservice('user')->get(Phpfox::getUserId()) to get common fields of user


How to abstract out 2 different implementations of cache

Question: I plan to use a distributed cache in my load-balanced webapp.
So I'm going to try to abstract out the common functions between apache ehcache and memcached.
My goal is to be able to make a simple configuration switch to select the caching solution to use. Should I go the SPI route e.g. like how XML parsers are wired in ?
Answer: After fixing the interface, this is really a creational pattern problem. Dependency Injection is my favourite, if the cache-selection strategy is dynamic you can use spring bean factories to decide at runtime. Spring has support for "session" scopes on web-applications meaning you can let the factory decide per session if you want to.
Otherwise a simple service locator should also do the trick.
http://en.wikipedia.org/wiki/Service_locator_pattern
Answer: Spring also has a cache provider module which does exactly what you're looking to do. I'm just not sure if memcached is supported, though. Even if not, writing an adapter for it might be less work than hand-rolling your own interface. See https://springmodules.dev.java.net/docs/reference/0.8/html_single/#cache
Answer: From the top of my head...

Create interface with common cache related methods (add(), remove(), refresh() comes to mind as the most obvious ones).
Create implementations of that interface which use desired cache underneath ("MyEhCacheImplementation" and "MyMemCachedImplementation" or something like that).
Create a CacheFactory which returns some type of cache based on simple value like number, String or enum. Don't forget to make a fallback for default implementation!
create some way to inject that single value to the factory on initialization, for example if you have some class which reads various settings during startup or you're using Spring applicationContext.xml or something similar, you need to create an initialization method for your cache which takes in that one parameter, calls the factory and returns the correct type of cache and/or sets it to some place from where you're using it from.

I believe that's all you need structurally to get it to work reliably and so that you can extend it whenever you feel like doing so.


Routing setup to bridge eth0 and wlan0 without internet

Question: I'm trying to configure my raspberry pi to act as a DHCP server to so that any device that connects to eth0 or wlan0 will get an IP and be able to communicate with devices connected to the other interface. None of the devices will have internet access. I setup a bridge (br0) which seems to be working, but I'm not having any luck getting a DHCP server to listen on br0. My question is: Am I setting this all up correctly, or am I going down the wrong road completely?
Answer: I don't know what you have configured. But what you want is a stand alone access point with a bridge.
You can find an example at Setting up a Raspberry Pi as an access point - the easy way.
Just follow section Setting up an access point with a bridge. Instead of the router at the wired line in that example use your devices. Instead of the file /etc/systemd/network/12-br0_up.network use this one:
rpi ~$ sudo -Es   # if not already done
rpi ~# cat > /etc/systemd/network/12-br0_up.network <<EOF
[Match]
Name=br0

[Network]
MulticastDNS=yes
Address=192.168.50.1/24
DHCPServer=yes
EOF


Convexity and Jensen's Inequality for simple functions

Question: Suppose $\varphi$ is convex on $(a,b)$. I want to show that for any $n$ points $x_1,\dots,x_n \in (a,b)$ and nonnegative numbers $\theta_1,\dots,\theta_n$ such that $\sum_{k=1}^n \theta_k = 1$ we are able to boost $\varphi$'s convexity property up to look like Jensen's Inequality for simple functions:
$$\varphi\left( \sum_{k=1}^n \theta_k x_k \right)\leq\sum_{k=1}^n \theta_k\varphi\left(  x_k \right)$$
So far I observed that if $\sum_{k=1}^n \theta_k = 1$ then $(1-\theta_n) = \sum_{k=1}^n \theta_{n-1}$. So, we use this to manipulate the RHS in order to apply $\varphi$'s convexity:
$$\varphi\left(\theta_nx_n + (1-\theta_n)\sum_{k=1}^{n-1} \frac{\theta_k x_k}{1-\theta_n} \right)\leq \theta_n\varphi(x_n) + (1-\theta_n)\varphi\left(\sum_{k=1}^{n-1} \frac{\theta_k x_k}{1-\theta_n}\right)$$
I think induction is waiting for me, but I can't see the next step. Perhaps I am not thinking clearly enough about what the right hand side means in this last line. Any help would be nice.
Answer: You are basically done. You just need to apply the inductive hypothesis on your last term.
Comment: Ahh, because $\sum_{k=1}^{n-1} \frac{\theta_k}{1-\theta_n}=1$. Thanks.


I have a neutral wire, what do I hook that wire to?

Question: I have 4 wires on a new switch, 2 of them going to ground. One green and one silver (bare) coming from the bracket of the switch. In the electrical wiring of the house I have a neutral wire, what do I hook that wire to?
Comment: Hello, and welcome to Stack Exchange. Personally, your question makes me a bit nervous, as even with our best description and intentions, there would still be ways for you to start a nice, enthusiastic electrical fire. Others may disagree, though; a picture would certainly help.
Answer: I need a little more information on the wiring to give an answer. Typically the white neutral wire is bonded to ground, but only at the panel. If this is a switch box, the white wire could be bringing power to the box or returning power back to a light/outlet/switchable device.  Essentially, power has to feed "into" the switch with one wire and back "out" through another.  It's supposed to be marked/taped though to designate this.
Alternatively, it could simply be an unused neutral leg that was brought in with the hot leg and should just be capped if not used. Newer building codes require you to run a neutral leg to switch boxes so that things can be "run" from the box. For example, you would need the neutral to install an outlet/switch combo at the switch box. Or using a motion sensing switch might require a neutral leg as well.
Can you provide a picture or some history of what type of fixture was in the box?
Answer: Neutral (white) doesn't go anywhere on a plain old fashioned switch.   It is used by smart switches.
Based on the way the house is wired... If the switch is "on the way" to the light, then the neutral passes through the switch on its way to the light... that is to say, it is spliced to another white wire, probably with a wire nut.   If the switch is on an endpoint past the light, then the neutral is reserved for the future (when you or the next owner decides to use a smart switch) - just cap it off for now with a wire nut.


How does public address "know" private key?

Question: Imagine the following:
someone goes to the .org address of bitaddress, then switches off internet connection, then moves the mouse around until eventually the JavaScript Client-Side Bitcoin Wallet Generator produces a Bitcoin address with its corresponding Bitcoin private key, then saves everything on the screen to cold storage as a PDF, then scans the "Share" QR code onto a phone, then scans this QR code at a Bitcoin ATM to purchase Bitcoin and the Bitcoin in deposited in the wallet and this is confirmed on blockchain.
If later wanting to sell the Bitcoin, how does this public Bitcoin address "know" what the correct private key is?
That is, if the Bitcoin public address and private key have only existed on a non-internet connected PC and as a PDF in cold storage?
Comment: Does this answer your question? https://bitcoin.stackexchange.com/questions/102930/where-does-it-go-and-who-verifies-private-keys
Answer:
How does public address "know" private key?

It doesn't. There's no need.
When receiving money, nobody needs to know anything from you other than your receiving address (in reality a Bitcoin script, the most common types of which can be displayed as an address). At this point no-one cares about your private key.

If later wanting to sell the Bitcoin,

When spending money, you have to provide proof that you know the private key corresponding to that receiving address, without revealing the private key. This is what your wallet does when constructing the transaction details that are sent out for miners to pick up.
Other Bitcoin nodes (wallets, miners etc) can mathematically check that the proof matches the public key and will then know that you have the secret number known as a private-key.

See

https://en.bitcoin.it/wiki/Elliptic_Curve_Digital_Signature_Algorithm
Comment: <<<When spending money, you have to provide proof that you know the private key corresponding to that receiving address, without revealing the private key.<<<   Thanks, so only proof is provided that you know the private key when selling, but not the actual private key. Interesting.


Usage of "in our house" vs "at our house"

Question: Is the following sentence correct?

We gathered in our grandparent's house

can "in" be replaced with "at"?
What if "house" is replaced with "home", does that make any difference?
Answer: Abishek is correct about at being used to refer to a specific place such as a house rather than a town or a country.
But at and in, as prepositions to a specific place-name, mean slightly different things, certainly in BrEng.
We met in my grandparents' house means that when you met, you were [both] inside the house.
We met at my grandparents' house means that you met in the general vicinity of their house, for example in the garden or at the front gate, but not necessarily inside.
The use of Home vs House makes no difference here.
Comment: However, _at their house_  **is** quite often used to mean inside, it's just that it doesn't have to.
Comment: @KateBunting indeed
Answer: Preposition for place like home, school, office or any general places can be filled by at and for places like countries and cities can be filled by in at times.

In, as a preposition of place, is usually used to talk about the
  position of someone or something inside large places such as
  countries, continents, big cities etc.
For example:- She grew up in New Zealand.
At, as a preposition of place, is usually used to talk about the
  position of someone or something inside small and unimportant places
  such as villages, small towns etc.
For example:- I'lll meet you at the pub.

https://www.learnenglish.de/mistakes/atvsin.html
Answer: In or at?
Yes, you can use "at", but the meaning changes slightly.  Gathering "at" a house allows for the possibility that you all met at the gate, but didn't go inside.  Gathering "in" a house leaves no doubt that you entered.
(In my experience, British English speakers make this distinction more than American English speakers do)
House or Home?
The word "home" carries an emotional attachment, whereas a "house" is simply a structure. "Home" can be a larger thing too: "we gathered in our grandparent's home" could mean that you met in the town where she grew up, or it could mean that you met in the small apartment that she used to live in before she moved away last year.
However, if you say "house", then you're definitely gathering inside the building where she lives (or, of course, a building that she possesses).
(It used to be that only real-estate agents said "home" when they really meant "house", but I've noticed it creeping into American usage in the last few years.)


Finding basis of inverse image

Question: Let $\psi $ be a linear transformation such that$$\psi ([x_1,x_2,x_3,x_4])=[x_1+x_3+x_4, -x_2-x_4,x_1+x_2+x_3+2x_4].$$
Find basis of inverse image $\psi^{-1}(W)$ of subspace $W=span([1,1,1],[3,2,1])\subset \mathbb{R}^3$ How to approach this?
Comment: Since I just spent a bunch of time earlier walking you through another problem rather like this, I'm going to suggest that the way to approach this is to get to know your definitions very well. Calling that span $S$, is it true that each of the spanning vectors for $S$ is in the image of $\psi$? What are their pre-images under $\psi$? How are these preimages related to the preimage of all of $S$ under $\psi$? What's the dimension of the preimage of $W$?
Comment: I am sorry, my mistake
Answer: I suggest that you find a basis for $\psi(\mathbb{R}^4) = T$. This could be done by simply calculating $\psi(e_1), \dots \psi (e_4)$ and then removing one by one those of them which breaks the linear independence. When you have the basis of T, it's time to calculate $T \cap W$. One way to do this is by solving several systems of equations. Namely you can find basis $t_1, \dots, t_k$ for $T^{\perp}$ and basis $w_1, \dots w_s$ for $W^{\perp}$ and then basis $b_1, \dots, b_m$ for $(\operatorname{span}(t_1, \dots, t_k, w_1, \dots, w_s))^{\perp}$, which will be just the basis of $T \cap W$. Now you can be sure that all of the $b_i \in \operatorname{Im}(\psi)$, so you can use the definition of $\psi$ to form a system of equations for every single one of them : $\psi(x_{1_{b_i}}, x_{2_{b_i}}, x_{3_{b_i}}, x_{4_{b_i}}) = b_i$ find the corresponding vectors and take their union for the final result. Ask me if you have questions. Not sure if I explained it very well... (However did my best :))

Finding basis of inverse image


Why is this assumption necessary on the proof of duality of $H^1$ and BMO? (Stein)

Question: I was going through the proof on Stein's Harmonic Analysis: Real-Variable Methods, Orthogonality and Oscillatory Integrals of the fact that BMO is the dual of $H^1$ (this is on Chapter IV, section 1.2., my question is more concretely about section 1.2.1). To prove this, he uses the atomic decomposition of $H^1$, and defines $H^1_\alpha$ as the space of finite linear combinations of atoms. As this space is dense, it would suffice to show $$\left|\int_{\mathbb R^N}f(x)g(x)dx\right|\leq c\lVert f\rVert \lVert g\rVert$$ for $f$ in BMO and $g\in H^1_\alpha$ in order to show every element in BMO yields a bounded linear functional on $H^1$ (as $H^1_\alpha\subset H^1$ is dense). The norms are, of course, the BMO norm for $f$ and some $H^1$ norm for $g$. In what follows, there are two things I don't understand. First, he wants to prove the inequality for $f\in L^\infty$ and then extend it to the general case, but I don't see why this is necessary. To be precisse, given $f\in L^\infty$, $g\in H^1_\alpha$ with an atomic decomposition $$g(x)=\sum_{k=1}^n \lambda_k a_k(x)$$ we may write $$\int fg=\sum_k \lambda_k\int fa_k=\sum_k \lambda_k\int_{B_k}(f-f_{B_k})a_k.$$ Here $B_k$ is the support of $a_k$ and $f_{B_k}$ is the integral average of $f$ in $B_k$. The last equality follows from the cancellation properties of $H^1$ atoms. So far I don't see where we might be using the fact that $f$ is bounded, as the first equality follows the linearity of the integral, and for the second the only assumption we need on $f$ is that it is locally integrable (so that the averages indeed exist). Then, he writes $$\left|\int fg\right|\leq\sum_k\frac{|\lambda_k|}{|B_k|}\int |f-f_{B_k}|\leq\sum_k |\lambda_k| \|f\|,$$ where the first inequality follows from the properties of $H^1$ atoms. This proves the desired inequality for the case in which $f\in L^\infty$. So: what do we need $f$ to be bounded for? And also, why is the sum of coefficients $\sum_k |\lambda_k|\leq c\|g\|$?
Answer: You are missing an important detail:
$g\in H^1_a$, so $g=\sum_{k=1}^n\tilde{\lambda}_k \tilde{a}_k$, but the proof is using another atomic decomposition of $g$, not that one.
In fact, remember that $H^1$ norm is defined as follow:
$$
        \left\lVert g\right\rVert_{H^{1}}:=\inf\left\{\sum_{j\in\mathbb{N}} \left\lvert{\lambda_j}\right\rvert: \exists\{a_j\}_{j\in\mathbb{N}}\text{ atoms s.t. }g=\sum_{j\in\mathbb{N}}\lambda_j a_j\text{ in } L^1\right\}
$$
So you can always choose a "good" atomic representation of $g$ s.t. $g=\sum_{j\in\mathbb{N}}\lambda_j a_j$ and $\sum_k \left\lvert \lambda_k \right\rvert<c\left\lVert g \right\rVert_{H^1}$ is satisfied. The atoms and the coefficients of this representation are no longer the same of the previous and the problem is that the sum in this representation can be an infinite series, even if $g\in H^1_a$.
In the rest of the proof you use this "good" representation of $g$ and no more the other. For this reason you need $f\in L^\infty$ to be sure that $fg\in L^1$. In particular when you write:
$$\int fg=\int f\sum_k \lambda_k a_k=\sum_k \lambda_k\int fa_k$$
The second equality follows from dominated convergence theorem and not from the linearity of integral, because you are using the "good" atomic representation.
This should answer both your questions
Edit: About $H^1$ norm. It is easy to check that $\left\lVert\cdot\right\rVert_{H^1}$(as defined above) is a norm on $H^1$. Let's write $\left\lvert g\right\rvert_{H^1}:=\left\lVert M_{\Phi}g\right\rVert_{L^1}$.
In Stein you can find the proof that exists a (possibly infinite atomic decomposition) of $g$ s.t.:
$$c_1\left\lvert g\right\rvert_{H^1}\leq \sum_{k\in\mathbb{N}}\left\lvert\lambda_k\right\rvert\leq c_2\left\lvert g\right\rvert_{H^1} $$
The first inequality is always true, for every atomic decomposition of $g$. The second inequality instead (if you carefully read the statement of Theorem 2 in Stein's Harmonic Hanalysis, Ch. III) is true only for a particular decomposition(the one constructed in the proof of that theorem), which could be infinite.
In Stein's book yu can also find a proof of the first inequality a few lines above that theorem. From this chain of inequalities it follows that $\left\lVert\cdot\right\rVert_{H^1}$ is equivalent to $\left\lvert\cdot\right\rvert_{H^1}$.
Comment: Okay, that makes a lot of sense. However, Stein defines the $H^p$ norm of $f$ as $||M_\Phi f||_{L^p}$, where $\Phi$ is a suitable Schwartz function and $M_\Phi f(x)=\sup_{t>0}|\Phi_t*f(x)|$. I suppose the norm you define is equivalent to any of these(?) I also realized it is on the proof of the atomic decomposition that $\sum |\lambda_k|\leq c||f||_{H^1}$, so why do we have to pick a particular, possibly infinite decomposition?
Comment: Yes, it is an equivalent norm, I've added a few lines about this fact


Will the messages sent from a deleted Facebook account be deleted from Messenger?

Question: I recently deleted (not deactivated) my Facebook Account.  I believe I have read that it takes 14 days for the account to be deleted providing it has not been accessed/re-opened.  If I am incorrect, someone please tell me.  My question is that my friends can still see my last message I sent in their messenger, however my profile is blank.  Will my messages ever be gone with the account being deleted?
Answer: No, your message will always be there in your friends inbox until he/she deletes it. But your name will not reflect. There will be no name, means no one can say who has sent those messages.
And yes, you are right with your information about account deletion.
Answer: somebody highjacked a friend of mine's Facebook account a few days ago. Her messages show up with her picture but instead of the actual past messages it say "Message Unavailable. This message is not available on this app."


UK Magistrate's court - appeal against revocation of child performance license

Question: I am the father of a 14 year old girl. She is trying to find work as a professional child actor. She has been offered a role, but is currently not able to accept as Hampshire County Council initially issued her with a performance license, but subsequently revoked it.
I understand that I am entitled to appeal against Hampshire County Council's revocation of my daughter's performance license, under sec 39(6) of the Children and Young Person's Act, 1963:

(6) Where a local authority refuse an application for a licence under
  section 37 of this Act or revoke or, otherwise than on the application
  of the holder, vary such a licence they shall state their grounds for
  doing so in writing to the applicant or, as the case may be, the
  holder of the licence ; and the applicant or holder may appeal to a
  magistrates' court or, in Scotland, the sheriff, against the refusal,
  revocation or variation, and against any condition subject to which
  the licence is granted or any approval is given, not being a condition
  which the local authority are required to impose.

My daughter's application was granted, then revoked, based on a council employee's view on the appropriateness of the project's subject matter, even though Hampshire County Council admit that the conditions required for the license to be issued are complied with. I believe this represents a form of censorship, and that the council are exceeding their authority. I would like to request the magistrate's court to consider overturning this revocation, as it is entitled to do.
Here is the email I received from the council:

Thank you for your email.    I have no cause for concern regarding the
  safeguarding procedures the production company have put in place.
  However, owing to the recent, very tragic events  Hampshire County
  Council does not feel that it is appropriate to support the content of
  the production. Therefore  a decision has been made by my line manager
  to revoke the licence and Tilly will no longer be able to take part in
  the filming.   I am going to inform the production company, the agency
  and the authority where the filming is taking place.   I apologise for
  any inconvenience this may cause you or Tilly but I hope you will
  appreciate this was not a decision that was taken lightly but we felt
  there was no alternative under the current circumstances   Regards

I don't see why the plot should be relevant to the license application, but for completeness here is a summary of the plot:
... plot removed as I realised it's copyright. The plot features some violence, but not glorified, trivialised or comedic, or even 'stylised'. It's about the dangers of social media and how we are unconsciously manipulated by what we see on youtube. It's even more important to do this stuff post-Manchester than pre.
The license is required for Thursday 1st June. Can you please tell me how I can bring this case in front of a magistrate on Tuesday 30th or Wednesday 31st? Can I just turn up at the court with my papers and wait for a slot?
Comment: I don't live in the UK, so I freely admit that I may not know how things are done, but it seems rather unethical to me to make performance licenses (for performers of any age) dependent on *whether the government approves of the production*.
Comment: I couldn't agree with you more.
Answer: I understand from elsewhere that it's necessary to

lodge a complaint with the council
the papers work their way from there to the Magistrate's court
the Magistrate's court hear the case in 4 weeks, plus

So the magistrate's court route won't work.
What would work potentially is a judicial review in the hight court, plus an injunction to temporarily quash the revocation pending the outcome of the judicial review. Hell's bells.


When does a function take an open interval into an open interval?

Question: Suppose we consider a function $f(x)$ defined from an open interval say $(a,b)$ to some set $T$. When would the set $T$ be an open interval?
Comment: I very much doubt that one can find a nontrivial necessary and sufficient condition for the problem as stated.
Comment: When would that open set be an open interval?
Comment: Certainly when $f$ is continuous it maps intervals to intervals (so continuous and open implies maps open intervals to open intervals).
Comment: Functions that verify the condiction "the image of an open set is itelf an open set" are called *open functions*. You may verify that homeomorphisms are open functions, but there are several functions which are open without being homeomorphisms.
Comment: If you're using $\mathbb{R}$ with the standard topology (I guess you are, since it's a real analisys question ;) ), then open sets are the unions of open intervals and open intervals are open sets.
Answer: To give some sense to how little can be said without any further restrictions on the function, consider this: There exists a map $f\colon(0,1)\to(0,1)$ which maps every nonempty open subinterval of $(0,1)$ onto $(0,1)$.
I don't know if such a function can be given explicitly, but here is an existence proof ultimately relying on the axiom of choice:
Write $x\sim y$ if $x-y$ is rational. Then $\sim$ is an equivalence relation on $(0,1)$. Write $E$ for the set of equivalence classes. Then the cardinality of $E$ equals that of $(0,1)$, because each equivalence class is countable. In particular there is an onto map $F\colon E\to(0,1)$. Define $$f(x)=F([x])$$ where $[x]$ is the equivalence class of $x$.
Now given any $y\in(0,1)$ and $0<a<b<1$ there is some $x\in(0,1)$ with $F([x])=y$. We can certainly find some $x'\in(a,b)$ with $x'\sim x$, so that $f(x')=F([x'])=F([x])=y$. Hence $f$ maps $(a,b)$ onto $(0,1)$ as claimed.
Comment: Thanks a lot for the explanation. Wasn't looking for an explicit example though.
Answer: The set $T$ would be an open interval if the function is also injective, that is, supposing that T is a subset of R and $f$ is continuous.


CNOT gate effect on 2 qubits

Question: If the CNOT gate applies a NOT on the target qubit if the control qubit is a 1 and the control qubit was in superposition (for example in the $|+\rangle$ state), wouldn't this break the superposition since the CNOT gate is checking if the control qubit is a 1 or not and hence measuring it?
Answer: This is a classical description of what controlled-not does which helps you think through the logic. However, controlled-not does not measure the control qubit, so it does not learn what state the control is in, and therefore does not destroy the superposition. Instead, it just applies the unitary operation
$$
U=|0\rangle\langle 0|\otimes I+|1\rangle\langle 1|\otimes X.
$$
Hopefully you can see, reading that, how it corresponds to the classical description. But the important thing is that it's a linear combination of the two statements, so if something is in superposition, it preserves the superposition.
Answer: Interestingly, the CNOT will not only keep the superposition, but in your example it will actually entangle the qubits! That is because, as DaftWullie says, you apply the operator linearly.
Let us take the truth table - i.e. all the possibilities on a basis - of the CNOT gate, where here I have taken the first qubit to be the control and the second to be the target:
$CNOT|00\rangle = |00\rangle$
$CNOT|01\rangle = |01\rangle$
$CNOT|10\rangle = |11\rangle$
$CNOT|11\rangle = |10\rangle$
So what happens if I act a CNOT on a state that has the the $|+\rangle$ state as its control? Let's take as an example the $|+\rangle|0\rangle$ state. Given our truth table above, it is not possible to know what happens if you try and directly apply the CNOT to this state as-is. But you can change basis - i.e. write it in all $0$s and $1$s - and then it becomes apparent. Here is how it looks like step by step:
$CNOT|+\rangle|0\rangle$
$=CNOT\frac{1}{\sqrt{2}}\left(|0\rangle+|1\rangle\right)|0\rangle$  (here I have changed to the $0/1$ basis by using $|+\rangle=\frac{1}{\sqrt{2}}\left(|0\rangle+|1\rangle\right)$)
$=CNOT\frac{1}{\sqrt{2}}\left(|0\rangle|0\rangle+|1\rangle\right|0\rangle)$ (here I have just multiplied out the $|0\rangle$ into the brackets)
$=\frac{1}{\sqrt{2}}\left(CNOT|0\rangle|0\rangle+CNOT|1\rangle\right|0\rangle)$ (here I have used the fact that the operator is linear, so I can basically multiply it out as well)
$=\frac{1}{\sqrt{2}}\left(|0\rangle|0\rangle+|1\rangle\right|1\rangle)$
$=\frac{1}{\sqrt{2}}\left(|00\rangle+|11\rangle\right)$
And just FYI, this is the famous Bell State :) hope this helps!

CNOT gate effect on 2 qubits


cann't add web part to PublishingWebControls:RichHtmlField

Question: I have created a Page Layout based on a custom Content type which inherits from Page Content Type. It contains four Custom Fields and a PublishingWebControls:RichHtmlField for each field. When I try to add web parts to it it only renders html as text. why You can add web part to a PublishingWebControls:RichHtmlField in BlankWebPartPage.aspx (OOB pageLayout) but it is impossible to add same web part to a custom pageLayout? thank you for your help.
Comment: Could you clarify your question? You're saying you "can't add webpart to" a webcontrol, but in your question you said you added the WebPart and the only problem is that it doesn't render HTML. Which one is it now? You can't add a Webpart or it renders incorrectly?
Comment: When I got Edit --> Insert --> Web Part and choose the web part and click "Add". the web part does not show up on the page. It shows some html instead.
Answer: Are you adding your RichHtmlField controls to asp:ContentPlaceHolder ID="Main" or you've created some additional placeholders?
If the second is true for you that build your master page in such a way to place the Main placeholder as the last one of used placeholders.


A build only device cannot be used to run this target

Question: I get this error when I trying to test an app.
A build only device cannot be used to run this target.
No supported iOS devices are available. Connect a device to run your application or choose a simulated device as the destination.
Comment: If you use a device and you have your apple developer account, please delete the app from your device, and then run it.
Answer: add -destination 'platform=iOS Simulator,name=iPhone 6,OS=9.3' to your xcodebuild
Comment: Explanation: Xcode tries to build with the Generic iOS Device but the test have to be build at the simulator.
Comment: A complete and working command: `xcodebuild test -project YourProject.xcodeproj -scheme YourProject -destination 'platform=iOS Simulator,name=iPhone 6,OS=9.3'`
Comment: /usr/bin/xcodebuild is a binary file. You should probably not modify it.
Comment: Why do you want to modify it?
Comment: You don't need to add this into `xcodebuild`.
All you need is to run this command with parameters
Answer: Maybe the Scheme has switched to a Generic device. Try to choose again the connected device from the Scheme menu:
Answer: Below is my way
Select project -> General -> Deployment Info -> Deployment Target -> choose a lower version
Comment: This case is useful when you import a project with deployment target higher than your local deployment target, lowering it can resolve the issue
Answer: You need to get a list of valid destinations. To do this, specify an erroneous key-value pair and xcodebuild will spit out the combinations that work:
List Destinations Command
xcodebuild test -destination 'platform=iOS Simulator' -workspace Register.xcworkspace -scheme ThatTestTarget

Output Example
Available destinations for the "ThatTestTarget" scheme:
    { platform:iOS Simulator, id:145A9B7E-B336-4819-8059-2FFEC408E05E, OS:11.1, name:iPad (5th generation) }
    { platform:iOS Simulator, id:69ABAF6F-ADA3-4E38-AC97-D71001447663, OS:9.3, name:iPad 2 }
    { platform:iOS Simulator, id:550E2F18-406D-4586-84BB-E48F1D704F27, OS:10.3.1, name:iPad Air }
    { platform:iOS Simulator, id:94734F1C-775F-40FA-9015-8196C08805EF, OS:11.1, name:iPad Air }
    { platform:iOS Simulator, id:1DB953DD-CD97-4EC7-8006-BCF01DF3E63F, OS:11.1, name:iPad Air 2 }
    { platform:iOS Simulator, id:DE3072DA-2E31-423D-9D77-220626F8B90A, OS:11.1, name:iPad Pro (9.7-inch) }
    { platform:iOS Simulator, id:3B5D18DB-13B5-4F28-B654-7D2ECDD1F6F0, OS:11.1, name:iPad Pro (10.5-inch) }
    { platform:iOS Simulator, id:A4225E3A-512C-4F42-ADD9-1E7E448C4D27, OS:11.1, name:iPad Pro (12.9-inch) }
    { platform:iOS Simulator, id:684FF1BA-8784-4B7C-B4E5-5231772F0FAC, OS:11.1, name:iPad Pro (12.9-inch) (2nd generation) }

Change Colons for Equals Signs, Remove Spaces, Ignore the ID
So if you want to use this destination:
platform:iOS Simulator, id:684FF1BA-8784-4B7C-B4E5-5231772F0FAC, OS:11.1, name:iPad Pro (12.9-inch) (2nd generation)

Change the colons for commas, remove the spaces, remove the ID, so you get this string:
platform=iOS Simulator,OS=11.1,name=iPad Pro (12.9-inch) (2nd generation)

Then the entire command would be:
xcodebuild test -destination 'platform=iOS Simulator,OS=11.1,name=iPad Pro (12.9-inch) (2nd generation)' -workspace Register.xcworkspace -scheme ThatTestTarget

Answer: i meet a problem that only "Generic iOS Device" can be choosed.
and when i  run ,it says
"A build only device cannot be used to run this target.No supported iOS devices are available. Connect a device to run your application or choose a simulated device as the destination "
and my solution for the problem is selecting Build Settings ---> Deployment ----->IOS Deployment Target---->choose a lower version like 8.0,
and i found  the simulator come out and can be chosen.
Comment: Do you have simulators with newer OS version installed? Goto Xcode -> Preferences -> Downloads to see the list of compatible legacy simulator runtimes.
Answer: You are building for Xcode's "Build Only Device", which is compiling the app. for the ARM processor (whereas compiling for the simulator targets the Intel CPU on your Mac.)
Plug in a device and select it from the active scheme popup, or, select one of the simulators and you should be good to go.
Comment: I don't call myself a rook because I'm good at this stuff... Thank you 2 hours wasted ha....
Answer: With XCode 8.3.2 I had this error message after I tried to run the app on a locked device. I unlocked and reattached as requested but the "A build only device cannot be used to run this target." message appeared.
I simply changed the target to a simulator and changed it back - it resolved my issue.
Answer: I encountered the same error message. Here's what I have experienced and did so far;

Step 1: Check your target.
My current target is IOS 13.2. From here, you will not see what
versions you currently have on your machine.

Step 2: Check available versions on your local

Click the Generic IOS Device

This will display a dropdown menu that contains a Download Simulators... selection
In case the Download Simulators... selection is not visible, you need to lower down your target. In my case, from 13.2 I made it 13.0 (This depends on your current XCode) then repeat the Step 2 again
From here, I can now see the Download Simulators... selection
Select it

You will now see what are the available versions you have
From here, you may choose to download or just use the version you have (The one that is selected)

Step 3: Change your IOS target accordingly

Now that you already know what are the available versions of the simulator you have locally, you can now change the IOS target.
In my case I choose to use IOS 11 (Just for this sample)
Then I change the target

Again click the Generic IOS Device

From here, you can now select any simulator under that IOS

I am not an expert, I just wanted to share my experience and I hope this can help someone.
Answer: For what it's worth, if you get the error A build only device cannot be used to run this target, and see in the Issue navigator this text:

ProjectName
  Target Integrity:
  iOS Deployment Target 'XX.X' is
  newer than SDK 'iOS YY.Y' in
  target ProjectName

then the issue is that the project requires an iOS SDK that is newer than what your version of Xcode has available. You'll find this issue in, say, projects taking advantage of new/beta iOS SDK functionalities such as ARKit.
The solution is to download the newest beta version of Xcode, which should have support for the non-public released iOS SDK that the application requires. If you have the latest Xcode, try finding the target iOS in Preferences -> Components -> Simulators.
Answer: If you are using cordova/Ionic Go to Products -> Destination-> Choose the target and re run
Answer: Modification to @Quver's answer. With latest Xcode version(8.3), the parameters to destination command should be given in double quotes. Single quotes didn't work for me
add -destination "platform=iOS Simulator,name=iPhone 7" to your xcodebuild
I haven't mentioned OS version in above command because when a newer version of iOS is released, this command will through error telling that this device is not found. So it is better not to give OS version
Answer: In my case this happened, when I selected a Generic iOS device and tried to "build" in order to publish it to the AppStore.
But I should have selected Product -> Archive instead
Answer: I fixed this issue for emulator,
Firstly check your emulator list

Window > Devices and Simulators

after choose any device and click check OS Version
If you have only Apple Watch OS, You should download new IOS Simulator
and click download more simulator runtimes..
choose your correct IOS Simulator and download it.
Answer: I had this issue after updating to latest MacOS version Ventura and Xcode  version.
You have to Enable developper mode again manually.

As indicated by the alert, to enable Developer Mode go to Settings >
Privacy & Security on the iOS device. Scroll down to the Developer
Mode list item and navigate into it. To toggle Developer mode, use the
"Developer Mode" switch.

Hope this help.
Answer:
I applied for a new AppleID and added it to the "Xcode->Preferences->Account" to solve this problem. (Xcode 7.3)
At the same time I deleted original AppleID in the "Xcode->Preferences->Account",because it was no longer a paid account and couldn't add new devices.
Answer: xcodebuild things were not working in my case.
Here's what I've solved.
I've removed my apple account and re-set(login) on the xcode preference,
and this was solved.
ps. on iphone 10.1, I needed to push Trust button on General > Device Management > account info > Trust App
Answer: I fixed this issue by going to the project settings, and under my 'Targets' section I had to set the Tests target to the correct team.
Answer: Well if you want to get the list of available destinations then call xcodebuild and pass in the command line option -showdestinations, and it will print valid options for you to pick from:
xcodebuild -showdestinations -workspace Register.xcworkspace -scheme ThatTestTarget

Answer: I tried almost anything above, including restarting XCode, none of them worked for me. I solved this problem by simply restarting my Mac. Yes, the classic solution.
A side note: This problem occurred to my XCode after it requested my Mac password from me, probably after an automatic upgrade.
Answer: For xcode v11:
I ran into this issue when trying to create an Archive of my project. I was trying to click "Build" when the device was set to "Generic iOS Device", but the proper steps were:

Set device to "Generic iOS Device"
Go to Product -> Archive (skip pressing Build!)
Answer: I am learning Tauri Mobile development and just ran into this issue. My problem is that I didn't have an available iOS Simulator.
Open the "Simulator" app from Launchpad, "File" -> "New Simulator..." , then create a new simulator. And select the simulator you just created in Xcode and it will run!
Answer: After 8 years still a valid question. I opened an old project to compile it for Apple Silicon, but I got this message and I could not even select a destination except Rosetta. Finally I found hidden under the PROJECT settings (not TARGETS) a user defined entry of Valid_Architecture. No matter what I entered still no success, but selecting the line (see image) and Edit/Delete was solving the issue. Ancient obsolete user defined setting
Answer: Problem: If you see "A build only device cannot be used to run this target" when you select only "Any IOS Device"
Solution :
YOU DO NOT NEED TO RUN THE APPLICATION DIRECTLY TO ARCHIVE IT!!
My problem is that I used "Start active schema" when I had to click on "Product > Archive", then the code runs and builds the project to put it directly in "App Store Connect"!
Answer: This worked for me.
You are trying to run on a device when you already built it for a different scheme.
Go to

Product > Clean.

Then build with your device chosen from the active schemes.
Comment: I upgraded my Xcode to 15.0 and ran into this error. I did `Product -> Clean Build Folder`, and that fixed the issue.
Answer: I had an entirely different problem. For some reason my app "Devices" was set to Universal build as opposed to iPhone. When I switched it to iPhone everything worked. Didn't need any extra settings.


How do we know so much about the sun since we can't go near it?

Question: I am wanting to learn everything there is to learn about the Sun from our solar system to the ends of the universe.
Comment: @VojtaKlimes You could make that into a good answer.
Comment: Spectroscopy, measuring solar wind, just normal observation, measuring radiation, checking sun-spots, observing all kinds of solar flares, physics behind nuclear fusion helped a lot and so on and on..
Comment: Yeah, I thought about that but I was not sure if the answer would be good enough but I have just read something about measuring its mass so I will change it to answer, thanks though!
Answer: Ok... some of Vojta's info is pointing in the right direction.
Via spectroscopy we can get a very good estimate on the chemical composition of the sun.
The mass of the sun can be deduced from Newton's laws (F = G Mm / r^2) and the period of the earth's orbit. Technically, you also need the mass of the earth, but it is so insignificant as compared to the sun that it's negligible.
We can measure the amount of energy received by the earth (which is the flux received by the earth). Since we know the earth diameter and the distance to the sun, we can compute how much energy the sun is sending out (and hence generating -- assuming its in equilibrium) each second (3.8 x 10^33 ergs/second or 3.8 × 10^26 watts).
Those are some of the basics, but I'm sure if you google "Sun" you'll uncover a wealth of information.
Answer: Well we can use for example spectroscopy, this means that we can know what is the surface made up of.
There is radiation coming from Sun, solar wind it is called. We can measure its speed and learn more about how it was created.
Of course we can just observe it with normal telescope. After astronomers found out the value of astronomical unit (AU) which happened I think around 18th century they were also able to find out the mass of Sun.
We are able to measure incoming radiation. This was very important during Apollo missions, even now lot of people think that there is no way to get through Van Allen radiation belts because of particles coming to us from Sun.
We learned that there are sun-spots in periods of 11 years.
Also during the measurement of radiation we were able to find out how strong events can solar flares be. Actually if one of the very strong ones hit us, we would have extreme black out (there is page which is predicting space weather but I do not remember its name).
We also found out using physics and particle accelerators that elements can fuse together. We learned that there is evolution in stars life and by observation in space we found out that there is going to be white dwarf instead of Sun in several billions of years.
We found that there is solar corona around Sun which is very hot but nobody is sure where it gets its energy.
Also we can see in our Milkyway how stars are created so we know that there must have been disc of matter which happened to create Sun.
There is much more to this but this is what I was able to think of right now.


SharePoint 2010 Workflow question using Designer

Question: I need to create a workflow for a custom list (having two columns Title and Hyperlink). When an item is created in that list the workflow should ceate a corresponding item in a discussion list with the same Title and the Hyperlink field in the first list should be updated with the URL of the discussion item.
Answer: The Create List Item workflow action, under List Actions, returns the ID of the created item. You can store this in a workflow variable.

Then set the Hyperlink field to a concat string with the fix part like
http://myserver/sites/a/lists/mylist/DispForm.aspx?ID= plus the variable.
Answer: You can be little more clear about your question. As far as I understood... You need to create an item in discussion board, when item is created in the custom list. For implementing it you can use the action 'Create List Item' in SharePoint Designer workflow which creates list item in another list.
Comment: yes, i did this, after creating item in another list i need to get the url of that particular list item to be updated in the currentllist item feild hyperlink.
Comment: my custom list name lets consider as Issue which contains columns (Title and Hyperlink),i have given Title name and saved it,now i need  a discussion board item to be created using this title in TeamDiscussions,up to this i have completed,Now my requirement is i need this Discussion board item url,to be updated in my Issue list Hyperlink Feild.
Comment: You can do this using action 'Update List Item'. In that select 'Current Item' then click Add button where you will be asked for field and value. Select the field in current item and for value you can lookup to discussion board list(Press function button near value textbox).
Now in Datasource select 'Team Discussion', In field from source select URL path. Below you can find field and value which is used to link your list and discussion list. You should mention a column which is common to both the lists. Try it...


Is double milled flour the same as 00 type flour?

Question: Is double milled flour the same as 00 type flour ? I want to buy some semolina 00 type flour but I can find only double milled semolina flour ? Are they the same ?
Comment: Welcome to the cooking stack. I think this might well have been answered on here before , so does this answer your question? [What is 00 flour and when should I use?](https://cooking.stackexchange.com/questions/27950/what-is-00-flour-and-when-should-i-use)
Comment: @bob1 How would that answer the question? It doesn't even mention "double-milled flour".
Comment: @Sneftel See the answer with score of 2 from Melara
Comment: @bob1 I did. It doesn't mention it.
Comment: @Sneftel it mentions that the different grades are different degrees of milling with the the finest being 000. Now, I'm aware that it doesn't specifically mention double milling, but the implication is that it doesn't have to be double milled to be 00.
Answer: No, double milled flour is not 00 flour. The 00 on flour is a measure of the milling fineness, this does not indicate that it has been double milled. In fact, I can find a number of sites that sell both 00 and double milled flour, such as this one (no endorsement or relationship with the company, merely one of many).
Double milled flour is flour that has been through a milling process twice. The size of the flour will be dependent on the mill size, ranging from 2-000, with 000 being the finest. Often double milling is done with a coarser size to start with and a finer size for the second mill. This produces a consistent mill and keeps the temperature in the milling process low, meaning that the proteins stay intact, so produce good gluten development.
Comment: From my research there are different names for soft wheat (Triticum aestivum)  and hard wheat(durum or triticum durum) . 2, 1,0, 00 are used for soft wheat, while semolina and semola are used for coarse and fine grain size of hard wheat. A little bit unusual , but no one seems to refer to durum wheat in numerical sizes.
Comment: @Kermilli looks like that's correct. Semolina is the coarse, single ground *Triticum durum* properly, but it seems you can also make semolina from soft wheat (*Triticum aestivum*), though this has to be named differently in some places and is distinguishable by colour. Italian has *semola di grano duro* for the coarse and the fine is *... grano rimacinata* (grama = grains, the ground bit, not the seeds in this case), so I think *semola* is the Italian for semolina in English.


ASP.Net AJAX Autocomplete Not Working

Question: I've looked at this link and I've tried all the suggestions there, but my Asp.Net AJAX Autocomplete still isn't working.
I have a test project with only a label, text box an the auto-completer:
<asp:ToolkitScriptManager ID="ScriptManager" runat="server">
</asp:ToolkitScriptManager>
<asp:Label ID="FieldLabel" Text="Label:" runat="server"></asp:Label>
<asp:TextBox ID="InputField" runat="server"></asp:TextBox>
<asp:AutoCompleteExtender
    ID="Autocompleter"
    TargetControlID="InputField"
    ServiceMethod="GetCompletionList"
    ServicePath="~/TestWebService.asmx"
    MinimumPrefixLength="1"
    CompletionInterval="1000"
    runat="server">
</asp:AutoCompleteExtender>

I don't have any code-behind on the aspx page.  In TestWebService.asmx.cs, I have:
[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public string[] GetCompetionList(string prefixText, int count)
{
    string[] results = { "test", "test", "test" };
    return results;
}

In theory, my textbox should have an autocomplete dropdown containing 3 instances of the word "test".  In practice, I can type anything I want into the textbox and nothing happens.  Does anyone have any idea what I'm doing wrong?
Comment: The same code i tried but not working for me. any other settings need  to be changed.
Answer: It looks as if you web service method is missing an argument. Also make sure that you have set the correct styles for your autocompletion "drop-down". In other words, compare your code to the reference.
Comment: The real problem is that I can't spell.  See my answer below.
Answer: I figured it out.  I misspelled the name of the WebMethod.  If you notice, its "GetCompetionList", not "GetCompletionList".
Now everything works.
Answer: you should to use
the word (static) after Public in your code
[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]

public static string[] GetCompetionList(string prefixText, int count)

{
  string[] results = { "test", "test", "test" };

   return results;

}

Answer: I was facing the similiar issue and that was resolved by deleting these lines in web.config file.
<rules>
        <rule name="san aspx">

          <match url="(.*)"/>
          <conditions logicalGrouping="MatchAll">
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" />
          </conditions>
          <action type="Rewrite" url="{R:1}.aspx"/>
        </rule>
      </rules>

ASP.Net AJAX Autocomplete Not Working


Electromagnetic waves - complex numbers

Question: The solution for the wave equation for the electric field is generally: $$\vec{E} = E_0 e^{i(\vec{k}\cdot\vec{r} - \omega t)} $$
My question is about the complex part, why do we use complex numbers? Why isn't it described by a cosine function without an imaginary part? Is it only out of comfort, making phase shifts more easy to deal with? From a mathematical perspective, we can describe functions using Fourier analysis, constructing waves using sum of exponents with different frequencies, but how does that apply to a real world wave? It is something I generally struggle with, understanding the place complex numbers have in physics in different topics, but I see the imaginary part mainly deals with the phases and I was wondering if it is here for the same reason.
Comment: More on [E&M and complex numbers](https://physics.stackexchange.com/questions/tagged/complex-numbers%2belectromagnetism).
Answer: The electric field is actually a real quantity. The complex notation is just a mathematical trick, we use to simplify the calculations. This trick is fine  as long as we are dealing with linear systems, where the fields are multiplied by scalar numbers or added to scalar numbers. Once we leave this regime and calculate e.g. intensities $I\propto |E|^2$, we should convert the electric field to a real number before doing the calculation. E.g. the plane wave
$$
E = E_0 e^{i(kx - wt)}
$$
would yields $|E|^2 = |E_0|^2$ irrespectively of position and time, while
$$
|\Re\{E\}|^2 = |E_0|^2 \cos^2(kx - wt)
$$
accounts for the oscillations.
Answer: The reason complex numbers are used to describe oscillatory quantities in Physics is a mixture of convenience, compactness, and generality. It's usually easier to do math with complex exponentials than it is with trigonometric functions, and it looks more concise. It's also more abstract than using sines and cosines and a lot more general.
Answer: The complex number notation naturally lends itself to describing the oscillatory behavior of the EM wave. It's also convenient to use in other contexts like acoustics that deal with wave behavior.

Electromagnetic waves - complex numbers


Designs for a Board Breaker / Board Holder?

Question: Does anyone have designs to build your own DIY board breaker/board holder for power breaking?
Answer: Around the beginning of 2012, I spent some time online trying to locate a freely available design for a martial arts board holder. At the time there was nothing available*. So after taking some inspiration from a few commercially available compact designs (see: http://www.google.com/search?tbm=isch&q=board+holder+martial+arts) I came up with my own.
In this HowTo, I show you how to make a collapsible martial arts board holder entirely out of broken Martial Arts boards. It can be easily attached to a heavy punching bag, held by a partner or supported against/hung on a wall. (see: http://www.fusionmartialarts.com.au/blog/?p=57 )
As a pure coolness bonus, this design is made entirely from previously broken martial arts boards (plus glue, screws, bungie and some fabric). In the posting is a demonstration of a power break using 4 UMAB boards (Yellow, Green, Brown and Black) of approx 5.5 boards.
*- For reference, I recently found another HowTo detailing the build process of a non-collapsible board holder that has some very nice design ideas: http://www.karate.gregoryzone.org/?p=219. It is worthwhile to have a look at this design to compare and contrast.
Comment: Nice :) From your article: *`Matching the two sides of a board from a pile of halves can be a challenge`* - the solution is to break more boards, thus producing more options :) Moar!!
Comment: @slugster: THAT is funny (and so very true)!
Comment: Can you quote and repost some of the information here to prevent link rot? I'm sure there are some people who would appreciate the knowledge but not necessarily want to click through a bunch of links whereas this question here would serve the purpose of presenting such information.
Comment: I've been meaning to post it in my reply for a while now, but the way StackExchange does the posts, it'll take me a while to get the images inline. Where as if I could just copy and paste from the Wordpress... I'll get it post here, eventually!
Answer: Here is a design I created in the 1990s using CAD software. I have used it for decades to break 1x12 common pine boards in stacks of 1 to 10.
Enjoy,
-Peter
http://world.std.com/~pce/holder1a.ps


Change in behavior

Question: We have an older pit/husky mix rescue dog he is about 7.5 years old and recently has gone from an indoor dog wanting to be with us to an outside dog who is afraid to come inside. He has been starting to not eat unless it's also outside. The only thing we can think of is we recently used a bug zapper inside (not on him) and he is afraid of it. Or he may of been abused in the past. Any suggestions would be helpful.
Comment: When does he show his fear? Is he visibly afraid of the zapper when shown? Are there any other things besides going inside he is visibly afraid of?
Comment: It is a hand held zapper and we removed it from the house.
Answer: Try turning off the bug zapper and see if that solves the issue.
Many bug zappers emit high frequency sound waves that are advertised as "cannot be heard by most humans and house pets" where MOST is a keyword.
It may be that the sound the zapper makes is so annoying to him that he would rather be outside.

Change in behavior


There is a way to use a controller action directly as an element in CakePHP?

Question: I want to use the view for one controller action inside another view with CakePHP, and passing some variables. Anybody has been work on this situation or something similar?
Answer: I think I understand what you're attempting, but I'm pretty sure it's not directly possible - as you've found.
What I tend to do in this situation is find the amount of code I want to replicate in both views, put it in an element and then call $this->renderElement('path-to/element') inside both views.
You could do something with $this->requestAction('controller/function') but it carries a large overhead.
I would suggest considering reformatting your code and using the element suggestion above.
Comment: renderElement() is deprecated (resp. no longer exists in the coming 1.3 release), use element() instead.
Comment: Thank you Dave, I'm working in this way. I just work to remove the requestAction because at the end with a few changes I need a form without any previous logic in a controller.


Crontab syntax: using '*' for minutes value

Question: What happens if I use '*' for the minutes value?
Is the command going to be run every minute?
For example:
* 4 * * 0 <command>
Answer: Yes, in your example, the command will run every minute of the 0400 hour on every Sunday.
By the way, if you do need something to run every minute, it's likely that you're monitoring something for changes; there is typically a better way of doing this. For instance, on Linux there is inotify for waking programs based on filesystem events, and ip monitor for watching network status changes.
Answer: Yes this will run every minute of the fifth hour (0400 to 0459) on Sunday.  Likely what is intended is to run once during that period.  Unless it needs to run on the hour, pick a random value from 1 to 59, and replace the minutes value.
If you have a bunch of programs that need to run in a particular period, you can limit load peaks by using a random minute in the hour you want the task to run.  Use a different value for each crontab entry.
Answer: Yes, this job will run every minute.
Here are some relevant sections from man 5 crontab:
   cron(8) examines cron entries once every minute.  The time and date fields are:

          field          allowed values
          -----          --------------
          minute         0-59
          hour           0-23
          day of month   1-31
          month          1-12 (or names, see below)
          day of week    0-7 (0 or 7 is Sun, or use names)

   A field may be an asterisk (*), which always stands for ``first-last''.

The manpage says that if you use the asterisk (*) in the minute field, this is is equivalent to using "0-59" (``first-last''), and the job will run every minute in the hour.


A mutual information equality

Question: $x$ and $y$ are two random variables and $I(u;v)$ is the mutual information between random variables $u$ and $v$. Does the following equality hold?
$$\text{argmax}_a I(y;ax)=\text{argmin}_a I(y;y-ax).$$
Answer: It can be seen that for any $a\neq 0$, $I(y;ax)=I(y;x)$ because $y\rightarrow ax\rightarrow x$ and $y\rightarrow x\rightarrow ax$ are both Markov chain hence by the data processing inequality both $I(y;x)\leq I(y;ax)$ and $I(y;x)\geq I(y;ax)$ respectively.
Since any $a\neq 0$ is a maximizer of $I(y;ax)$, your question is ill defined.
Comment: Could there be a misunderstanding, say, as shown in the expression $I(y;x)>0=\mathrm{argmin}_a I(y;y-ax)$? I am asking about argmin which the argument $a$ for which a minimization is achieved, not min.
Comment: Yes, Sorry about that, but then you have to define $\mathrm{argmax}$ more carefully since any $a\neq 0$ is a maximizer of $I(y;ax)$ hence yes, it could be true depending on how you do this definition
Comment: You are right. Indeed, from the definition $I(x;y)$ is invariant under any injective one variable transformation, i.e. $I(x;y)=I(f(x),g(y))$ where $f$ and $g$ measurable injective functions. More importantly, you may be interested in taking a look at the question of my main concern https://stats.stackexchange.com/q/386101/44368.
Comment: well, what you say is true if and only if $f$ and $g$ are almost surely one to one. About your main question, I don't understand what "z distributed normally conditioned on x" means, I would say you may want $x$ and $z$ independ and $z\sim \mathcal N(0,\sigma^2)$ or something of the sort. I would say without proof that if $x$ is also gaussian then your minimization is exactly the same as the usual regression so it may be of interest in other cases. I'm pretty sure this has been done before but I do not have any references.
Comment: I said "injective... transformation". That means one-to-one. "Almost surely", sure it makes it more complete, but is more like icing on the cake. So we are saying the same thing. Regarding my main question, there may be some misunderstanding there. The normality is to introduce the subject by giving the background. The new concept using mutual information comes after the phrase "now dropping the normality". Would you please reread the question more carefully? Thank you.

A mutual information equality


Convergence of Bisection, Secant and Newton's method when there is no root

Question: If there is no root to a function can the bisection, secant or Newton's method still converge to some number e.g. $f(x) = \frac{1}{x}$ on interval $[-1,1]$?
Comment: @whpowell96 : bisection fails with "division by zero" in the first step, there will be no sequence to diverge.
Comment: If we exclude 0 from the domain f: R\{0} then the function 1/x will be continuous. I think the bisection method will converge to zero but why?
Comment: @Maddie:  you are correct.  As long as you avoid evaluating at the root and getting a divide by zero you converge to the discontinuity.  Really what you are looking for is a sign change and the discontinuity provides that.  In the computer you can't tell a function with a discontinuity from a continuous one that crosses the axis between two neighboring floating point numbers.
Answer: Just try them.  Bisection and secant fail because they want to evaluate $f(0)$ on the first step.  This happens because of the symmetry of the problem.  For Newton, you work from just one point.  If you start by evaluating at the center of the interval, you have the same problem.
If you apply them to $g(x)=\frac 1{x+\frac 1\pi}$ bisection and secant will converge nicely to the discontinuity, assuming that for the secant method you maintain your bracket by replacing the old point where the function value has the same sign as the new point.  The methods cannot tell this $g(x)$ with its discontinuity at $-\frac 1\pi$ from a function that is continuous, following $g(x)$ to the computer real just below $-\frac 1\pi$, then dropping to hit $g(x)$ at the real just above $-\frac 1\pi$.  I didn't try Newton, but would expect it to go off to infinity, looking for the root that is "there".
Answer: Can the algorithms know as bisection, the secant method or Newton's method converge when there is no root? Under very mild assumptions the answer is always no.
Specifically, if an algorithm converges, then there is a root. Equivalently, if there is no root, none of the algorithms can converge.
Analysis: We will assume that $f : I \rightarrow \mathbb{R}$ for some close and bounded interval $I$, say, $I = [0,1]$.
Newton's method takes the form $$x_{n+1} = x_n - \frac{f(x_n)}{f'(x_n)}.$$
Suppose the sequence $\{x_n\}_{n=0}^\infty$ is defined and converges to some finite value $x \in I$. Now $f$ is continuous because we have implicitly assumed that $f$ is differentiable because we need the derivative in order to apply Newton's method. If $f'$ is also continuous with $f'(x) \not = 0$, then we can conclude that
$$ x = x - \frac{f(x)}{f'(x)}$$
or equivalently that $f(x) = 0$. We simply exploit the fact that
$$x_{n+1} \rightarrow x, \quad f(x_n) \rightarrow f(x), \quad f'(x_n) \rightarrow f'(x)$$
as $n$ tends to infinity.
The secant method takes the form
$$ x_{n+1} = x_n - f(x_n) \left( \frac{f(x_n) - f(x_{n-1})}{x_n - x_{n-1}} \right)^{-1}$$
Suppose the sequence $\{x_n\}_{n=0}^\infty$ is defined and converges to some finite value $x \in I$. If $f$ is differentiable and $f'$ is continuous with $f'(x) \not = 0$, then the previous reasoning still applies and we can still conclude that $f(x) = 0$. We use the mean value theorem to write
$$ \frac{f(x_n) - f(x_{n-1})}{x_n - x_{n-1}} = f'(\xi_n)$$
for at least one $\xi_n$ between $x_n$ and $x_{n-1}$, and since $\xi_n \rightarrow x$ by the squeeze lemma, we have $f'(\xi_n) \rightarrow f'(x)$, but this is the only difference.
Finally, suppose the bisection algorithm has produces an infinite sequence of intervals $\{[a_n,b_n]\}_{n=0}^\infty$. By design, we have $b_n - a_n = 2^{-n} (b_0-a_0)$. It follows that the sequence of left endpoints and the sequence of right endpoints are both convergent to the same limit, call it $c$. Moreover, we have $f(a_n) f(b_n) < 0$. If $f$ is continuous, then it follows that
$$ f(a_n) f(b_n) \rightarrow f(c)^2 \leq 0, \quad n \rightarrow \infty.$$
We conclude that $f(c) = 0$.
If the bisection algorithm terminates after a finite number of steps, then one of the endpoints of the final interval is a root and there is nothing to show.


Probability distribution and Stock Price Movement

Question: How can we use normal distribution for finding the probability of a stock price offer where current price offer depends upon the last price offer. The price offer on some day can go 10% above (at the maximum) or 10% below (at the minimum) from the last price offer. If NOT, which is the suitable distribution for the stated problem?
Comment: Hi Javeria Iqbal, I'm not sure what you mean. As you surely know the normal distribution has support on the whole real line. You can truncate the distribution but then it's not the normal distribution any more. Can you clarify.
Comment: Hi Bob Jansen, Yes i know that normal distribution has support on the complete real line. But, we can compute the expected value of a random variable in uniform distribution over the defined interval [a,b]. Could you please suggest me?
Comment: Sorry, I can't make much sense of it. Maybe you can try to restate your problem.
Answer: Stock prices have been modeled using the Lognormal distribution, not the Normal distribution. See this paper http://math.ucsd.edu/~msharpe/stockgrowth.pdf for more detailed information.
This does not mean that the current price offer depends on the last price offer.


Where can I find standard validation rules?

Question: In a developer org, although validation rule lists are empty, checks are performed against data. E.g. trying to create an Entitlement record may lead to an error "The number of Remaining Work Orders must be less than or equal to the number of Work Orders per Entitlement" or "The end date must be equal to or later than the start date". That makes sense of course, but where can I find a list of all these data checks?
Comment: I was simply pointing out that not all validation is performed using validation rules. Since you are talking about standard objects, some validations are implemented within the platform. Why do you ask your question? What is it you are trying to do?
Comment: Validation can be implemented in triggers (apex code) by adding errors to records or their fields.
Comment: Hi, I would like to know where I can find default data checks like the exemplars in my question, not where I can define validation rules. Triggers seen in the front end of the Salesforce developer org are also empty like validation rules.
Comment: Ah, understood. I want to check data records for correctness before uploading them.
Answer: Salesforce has a lot of standard validation that goes on. Accordingly, there's not one single page describes every possible validation. It'd be a very, very large list. Instead, there's the Standard Objects page. Validations and special access rules are mostly listed on the relevant object. Additional places to check are the in the Help & Training for a given object. Ultimately, you'll have to do some research when you start working with a new object.


Is there a benefit to enabling router RIP on my home router?

Question: I'm just curious if this will improve my small home network. What are the cons to using it at home? BTW, I use a WRT54GL with Tomato Firmware.
Answer: RIP is a dynamic routing protocol. Unless you have multiple routers you need to distribute routes to there really isn't any reason to run it. All it will do is put extra traffic on the wire and eat up a few cpu cycles on your router.
Comment: RIP has quite a few known vulnerabilities as well (esp. in older versions), so it's probably best to leave it off
Answer: The con to using it is that it will flood your network with updates periodically.  If you only have a single router it is unnecessary.


Disable DRM in Evince

Question: Is it possible to disable DRM (digital rights management) for PDF files in "Evince" so that encrypted PDF files can be saved?  How do you make this configuration?  The option does not seem to be apparent.
Comment: Check out http://unix.stackexchange.com/questions/41295/how-to-save-a-copy-of-a-protected-pdf-form-in-evince
Answer: From: http://en.wikipedia.org/wiki/Evince
"Evince used to obey the DRM restrictions of PDF files, which may prevent copying, printing, or converting some PDF files, however this has been made optional, and turned off by default in gconf."
A little googling led to this: http://archive.today/uKxXs
"2007-07-04 at 04:38 Donald Hellen wrote:

Does Evince allow you to at least read DRM protected ebooks, if not
    print them?
    What will Evince allow you to do with these DRM protected PDF files?

cough gconf-editor cough Enable /apps/evince/override_restrictions
Comment: The thing is that I'm using the Windows version of Evince, and I'm not sure what kinds of configuration utilities are supposed to be used for this or how to perform these equivalent configurations.  Evince does not allow me to save an edited copy of a PDF with protections on it.  Evince was installed to "AppData\Local\Apps\Evince-18.104.22.168\bin".  Should I add a configuration file?  Are these config editors something that can be installed in Windows?
Comment: @user553702: OK! I have no idea on how gconf is handled on windows. If you don't need to edit the file afterwards, you could print it and choose save as pdf. If that doesn't do it, do you have to use evince? For example, Okular has DRM setting.

Disable DRM in Evince


Forgot pass code and want to know if my recent videos will be safe if I restore from iTunes???? Help please!

Question: I forgot my pass code on my iphone 5. I know I can restore from iTunes but what about the videos on my phone?  We recently took a trip and I have uploaded all the photos but not the videos,:(. Do they back up when my phone backs up to the cloud? I also haven't backed them up to my computer yet. I really don't want to loose all these videos of my kids!!!! I have an iPad Air also but I know videos don't stream right?  Please help me if possible thanks!
Answer: When you connect your iPhone to iTunes you can do a backup, you should be able to do this even without the pin. Then just restore last backup and you're fine!
There is either a big "backup now" button or you can right click on the name of your iPhone and then select backup. Depends from the iTunes version.
Hope this helps.
Answer: You may be able to perform a backup, even if you have forgotten your passcode, however you will be limited to a computer you have synced with in past.
According to this Apple support article you should be able to get one last backup in before restoring.
Good Luck


What style would you say this cassette tape packaging is?

Question: I've provided some concept styles to a client and wasn't sure how to describe this style. What time period/style does this image evoke most?
Comment: Late 60s through early 80s. It's no particular style other than perhaps "bold and geometric" with heavy use of plain sans-serif type.
Answer: Well the invention of the cassette tape was in 1962 according to quick Google search.
So the time period would fit in the 60's & 70's. I would consider this style of packaging to be retro.
Some retro designs usually include:

Line gradient patterns (see below example)

Dull flat colors / low saturation
Bold patterns with high contrast


German word that means 'one who thinks with their hands'. It was a single word, I can not recall it. Any ideas?

Question: A presenter in Zurich said a word in German that meant 'one who thinks with their hands'. It was a single word I believe, I can not recall it. It may be particular to the Swiss. Any ideas?
Comment: Are you sure it was "think"? I know the phrase of "talking with the hands" for people with high active gestics while talking... But I have no imagination about people thinking with hands... What does it mean?
Answer: The term »mit den Händen denken« ("thinking with hands") is not very common. The most websites that deal with it are from Switzerland.
Sources:

Title of a creative workshop
This seems to be an exception, because the association that offers this workshop is from Bavaria.
Article about a Swiss film director
Exhibition of a Swiss designer

There are theories about how some people learn the easiest way, and these theories define different learning types:

People who belong to the auditive learning type learn best when they hear something
the visual learning type needs to see something
the communicative learning type must talk with others to learn
the haptic learning type must touch things

There are also some other types in discussion (the motor type must walk, etc.), and all these theories are heavily discussed because some researchers have found evidence, that this all might just be an illusion.
However, the point is: There is a haptic type, and in German this is:

ein haptischer Typ

This is a person that needs to touch things with their hands to better understand them. So this is what you might call a person who thinks with their hands. If you want to have just one word for it, then it is:

Haptiker

This is a correct word, but it is rare.

German word that means ‘one who thinks with their hands’. It was a single word, I can not recall it. Any ideas?