ImageMesh precision

Question: Browsing though the documentation of ImageMesh I found it lacking with regard to its methods and options concerning mesh generation. In my application I have an image with very fine details (compared to the size of the image as a whole) as a Graphics object. How does one increase the precision used to generate the mesh?
Answer: ImageMesh is designed to work with binary Images only, hence it automatically rasterizes Graphics objects by applying Image and Binarize to them:
Trace[ImageMesh@Graphics[{Black, Disk[], White, RegularPolygon[1, 5]}],
 Image[_Graphics] | _Binarize]

Due to the above reason, you should compare the obtained mesh not with Graphics, but with the result of rasterization:
Grid[Partition[Table[Framed@Grid[{{s, SpanFromLeft},
        {Image[Binarize@#, ImageSize -> 100],
         ImageMesh[#, Method -> "MarchingSquares", ImageSize -> 100]}}] &@
    Graphics[{Black, Disk[], White, RegularPolygon[1, 5]},
     ImageSize -> s], {s, 20, 80, 5}], 3]]

By the way, the Documentation statement

ImageMesh works with arbitrary 2D and 3D images, taking the nonzero pixels of the image as foreground.

isn't quite correct as you can see from the above Trace output: actually for 2D images the binarization is performed using Otsu's algorithm.
Answer: Even though Graphics are not exactly pixel images but rather more like vector images, setting ImageSize does have an effect on the mesh quality.
Take for instance
Manipulate[
Region[#, PlotLabel -> s] &@
ImageMesh[#, Method -> "MarchingSquares"] &@
Graphics[{Black, Disk[], White, RegularPolygon[1, 5]},
ImageSize -> s], {s, 20, 300, 1}]

I'd personally prefer there to be an explicit method option for ImageMesh, e.g. "MeshPrecision" for use with Graphics; this does work for my application just fine though.
Comment: See also [this Q&A](https://mathematica.stackexchange.com/questions/140014/how-to-resize-imagemesh)

ImageMesh precision


How to view download progress while Finder downloads new iOS version?

Question: In macOS Catalina, the iOS devices are synced and updated using the Finder instead of iTunes.
Is there a way to see the progress of the iOS-download in Finder?
Answer: Unfortunately there's no immediate way.
But see this article: https://discussions.apple.com/thread/250790312

While there is no progress bar available, one potential way to estimate the progress is through Terminal, with the following command:
ls -lhrt ~/Library/iTunes/iPhone\ Software\ Updates

It will show the size of the current (.ipsw.download) and all previous (.ipsw) update files, which can be used to estimate progress. For example, for a 2.9G update file (can be estimated using previous update files), if we see that the current update file size is 2.3G, then the progress would be approximately 2.3G / 2.9G = 79%. By running the above command periodically, we can somewhat know how long it may still take (or at least the downloading is still in progress and not stopped because of network or other issue).
Comment: For ipad use this command: `ls -lhrt ~/Library/iTunes/iPad\ Software\ Updates`
Comment: Maybe even use `watch ls -lhrt ~/Library/iTunes` to catch the iPad update file too and refresh the size ? Btw `watch` can be installed with `brew install watch`
Answer: In addition to Joe Farina's answer, you can also get a rough idea of how quickly things are progressing from Activity Monitor's Network tab.
Look for AMPDevicesAgent, which should show you how much that process has downloaded so far. This is probably ** (but not guaranteed) how much of the latest update you're downloading has downloaded.

If you're not downloading lots of other things, you can also see the speed of your download at the bottom of the activity monitor (in blue in the image below).

** Note that this is actually the total downloaded by that process, so if you're downloading multiple updates or have recently downloaded an update, that will be included in this number.
Answer: Another method is to use the terminal. The following code shows you the file download progress and also automatically clears the terminal screen and shows you the recent file size downloaded.
while true
do
clear
ls -lhrt ~/Library/iTunes/iPhone\ Software\ Updates
sleep 20
done

The "clear" command simple clears your terminal screen so you only see the latest row / value.
The numeric value after they keyword "sleep" is the number of seconds the code sleep before repeating itself again. So a value of 20 (20 secs) means, the same ls -lhrt command gets repeated after 20 seconds and shows you the most recent downloaded side of the file. So you do not have to repeatedly type the command again and again.


How to add more details in MKAnnotation in iOS

Question: I want to add more details in MKAnnotation like location title, description, date, location name. So it will be four lines that are needed. But I found that only 2 parameters can be passed to MKAnnotation which are title and subtitle. How can I add more details on the map? Plz help me..Thanks in advance.
Comment: i tried by adding the details appending to subtitle.. But it showed in one line.. How i can show details in multiple lines
Answer: Take a look at creating a custom MKAnnotationView object... it is basically a UIView that is tailored for map annotations.  In that object you could have your 4 custom labels.
In your MKMapViewDelegate class, you implement the viewForAnnotation method:
- (CustomMapAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
{
    CustomMapAnnotationView *annotationView = nil;

    // determine the type of annotation, and produce the correct type of annotation view for it.
    CustomMapAnnotation* myAnnotation = (CustomMapAnnotation *)annotation;

    NSString* identifier = @"CustomMapAnnotation";
    CustomMapAnnotationView *newAnnotationView = (CustomMapAnnotationView *)[self.mapView dequeueReusableAnnotationViewWithIdentifier:identifier];

    if(nil == newAnnotationView) {
        newAnnotationView = [[[CustomMapAnnotationView alloc] initWithAnnotation:myAnnotation reuseIdentifier:identifier] autorelease];
    }

    annotationView = newAnnotationView;
    [annotationView setEnabled:YES];
    [annotationView setCanShowCallout:YES];

    return annotationView;
}

And that will display your custom view where ever you have an annotation...  if you want a step by step tutorial, check out this video.
hope this helps
EDIT
I actually just found a new Maps example on the apple dev site... has all the source code you need to go through.  They are also using a custom MKAnnotationView called WeatherAnnotationView
Comment: the tutorial only changes the annotation image.. that's pretty much a one-liner
Comment: thank u for ur answer. Can i add the details into the default bubble  in wanted format , like with newline ? I tried by addding UIlabel to rightCalloutAccessoryView of   MKPinAnnotationView. But its not lloking nice.thanks in advance
Comment: I wouldn't try to do it the way you are trying to do it... Apple has setup annotations so they can be extended with the MKAnnotationView class.  Trying to override the rightCalloutAccessoryView in the way you are doing it is not a good way to do it... you are fighting the framework and it is giving you weird results.  If you want a custom annotation, the best way to do it is the way I described.
Comment: Is there an answer for this in swift?
Comment: @S.P. see this link http://stackoverflow.com/questions/5831382/how-to-display-2-lines-of-text-for-subtitle-of-mkannotation-and-change-the-image


Define key in prefix keymap for a particular mode

Question: I have all my keybindings in a separate minor mode - firstly, to be sure that keybindings that I consider mandatory wouldn't be overridden by some major mode; and secondly, to be able to disable all of them in one command in case I need too.
Up until now I have been extending prefix keys like so:
(define-key my-minor-mode-map (kbd "M-g f") 'my-goto-file-func)

But then I realized that there is such thing as prefix keymap, and for M-g key it is goto-map. So I'd rather extend this keymap instead of hardcoding the prefix key, so it would be like:
(define-key goto-map (kbd "f") 'my-goto-file-func)

But in this case my minor mode has nothing to do with it, so I lose all my advantages of using it.
One way would be to determine which key is bound to that particular prefix keymap and then use that key in the bindings. But it has a drawback - prefix key wouldn't be remapped for my minor mode if I remap it after loading my minor mode.
So are there any better ways to do that?
Answer: Extending keys the way you did is perfectly fine because it keeps complexity to a minimum. So while it is certainly possible to modify a keymap in your minor mode, it is not necessarily better.
In order to use a modified keymap in your minor mode without overriding the original one, simply set the original as your parent, e.g.
(defvar my-goto-map
  (let ((map (make-sparse-keymap)))
    (set-keymap-parent map goto-map)
    map))

You can then use a modified version in your minor mode:
(define-key my-goto-map "f" 'find-file)
(define-key my-mode-map (kbd "M-g") my-goto-map)

But the original goto-map is still alive and kicking, and modifying it will reflect in your my-goto-map:
(define-key goto-map "i" 'info)

See "Inheritance and Keymaps" in the elisp manual.
Comment: Just one thing - `set-keymap-parent` returns *parent*, not *child*. So you assigning the wrong thing to the `my-goto-map`
Comment: @MnZrK: Good catch. Maybe I thought it *should* return the child.
Answer: Note that olab b's answer is totally fine, and I gonna accept his answer and use it by myself, but there is one issue with it:
The original goto-map is untouched. Imagine hypothetical situation where some library provides a command which uses goto-map in some way - for example, to provide some fancy interface for commands in it or binds to it inside its own keymap - that is something that helm could do if they were crazy enough. Since all my keys would go to the my-goto-map, they wouldn't be reflected in those extensions.
So here is a weird solution for a made-up problem, just for funzies:
First, note that keymap in elisp can be one of two things:

variable containing list whos first element is symbol 'keymap (and it is usually how keymaps are used in emacs)
symbol whos function cell is set to the keymap variable (and I never saw that anybody used it like that)

So first we are going to define a variable for our keymap:
(defvar my-goto-map (make-sparse-keymap))

Next, write its value to the function cell as well:
(fset 'my-goto-map my-goto-map)

Note that we can't replace goto-map since everything that was already bound to it wouldn't catch the replacement. And manipulating with keybindinds one by one isn't fun. So here is a proper insert:
(setcdr goto-map (cons (make-composed-keymap 'my-goto-map (cons (car goto-map) (cdr goto-map))) nil))

(Of course we could just append my-goto-map to goto-map, but in that case the relation between my-goto-map and original goto-map would be "neighbors" and not "parent-child"; and "neighboring" does not allow for undefining keybindings)
Note that goto-map now depends on the symbol my-goto-map so we can do whatever we want with that symbol without loosing our keymap. So we can easily disable all custom keybindings like so:
(fset 'my-goto-map nil)

And the variable cell of my-goto-map is untouched, so we can easily restore keybindings:
(fset 'my-goto-map my-goto-map)

The main drawback comes from the fact that emacs does not allow "buffer-local functions", only "buffer-local variables". And here we need a local function :( So we can't just make that activation of prefix map in the hook of the minor mode - cause that modification would be reflected globally.
But at least all the original prefix keys for that keymap (which is one and only M-g IIRC) would automatically use all the custom keybindings, so no need to hardcode M-g as a prefix key in the my-goto-map.


Lagrangian mechanics, one-dimensional simple harmonic oscillator

Question: Question

Consider a one-dimensional simple harmonic oscillator, i.e. a particle moving in a potential, $$u(x)=\frac{k}{2}x^2$$
(a) Explain why energy is conserved and solve the problem by reducing to a one-dimensional integral.
(b) Obtain a direct solution of problem 1(a) by obtaining Lagrangian and from it the equations of motion, then solving the equations of motion directly. Express any symbols you introduce in terms of physical quantities.

An Attempt at the solution

As provided by user below:
$$\mathcal{L} = T - U = \frac{1}{2}m\dot{x}^2 - \frac{1}{2}kx^2$$
Euler-Lagrange tell us
$$\frac{\partial \mathcal{L}}{\partial x} = \frac{d}{dt} \frac{\partial \mathcal{L}}{\partial \dot{x}} $$
here,
$$\frac{\partial \mathcal{L}}{\partial x} = -kx$$
$$\frac{d}{dt} \frac{\partial \mathcal{L}}{\partial \dot{x}} = \frac{d}{dt} (m\dot{x}) = m\ddot{x} $$
and so
$$m\ddot{x} = -kx$$

I have found the solution of this differential equation to be $$x(t) = c_1 \cos\left(\sqrt{\frac{k}{m}} t \right) + c_2 \sin\left(\sqrt{\frac{k}{m}} t\right).$$
My Problem
I was just wondering if you could explain to me the significance of the constants. I am thinking that I am unable to determine them without some initial condition (which in this question I am not given) so hence am unable to 'simplify' further?
However, I have seen that looking at time, $t=0$, gives $x_0=c_1$, which would be simply saying that $c_1$ is the initial postion. I can similarly guess that $t=\sqrt{\frac{m}{k}}\left(\frac{n\pi}{2}\right)$, would give $c_2=x(\sqrt{\frac{m}{k}}\left(\frac{n\pi}{2}\right))$. However, this second part is clearly not constant so I clearly can not do this. My question is, can I find this condition (if I am even correct in doing this in the first place?)
Comment: Have you taken any courses on ODEs?
Answer: HINT For this problem the kinetic energy is
$$
T = \frac{1}{2}m \dot{x}^2
$$
and recall that
$$
L = T - U
$$


How to restore single table in Sql Server 2016

Question: I'm wondering how I can restore a single table in SQL Server 2016.
For example,
I backup the table using SSMS task script option.
Delete a row from that table.
Now I want to restore the table to bring the deleted row back, How can I do this in SSMS?
Thanks!
Comment: You backed up the table, or you scripted the table schema, and if the latter, with or without insert statements? You need to add a little more description around "using SSMS task script option"... Generally, you back up a database, and in order to restore a single table from a previous point in time, you restore that database as a different name, apply any logs to get you to the right point in time, and then copy the table. There are 3rd party tools, though, that have features that allow you to extract individual objects from backups without restoring them.
Comment: Have you actually taken a backup of the table? Can you elaborate on the "script option", did you script out the data as well as the structure?
Comment: I have a nasty feeling the OP just did "script table as.."
Comment: Does the table have any "IDENTITY" columns? (auto-increment IDs etc?)
Answer: If you used the "Generate Scripts" option and included both the schema and the data, you'll have a script containing something like "CREATE TABLE xyz INSERT INTO xyz VALUES ..." with a series of data values to insert. Possibly with a "DROP TABLE" statement at the top, if you included that option when you scripted it.
In that case, execute the generated script (the .sql file) to re-create the table and insert the values to it. Hopefully if there were any indexes etc. you selected the option to include those too. If it's not as simple as dropping and re-creating that table (like if there are foreign key constraints, identity columns etc) you may need to 'restore' the scripted table to a copy of itself, like my_table_new (if the original is my_table) and then re-insert the row from the 'copy' to the original - using ALTER TABLE my_table SET identity_insert on if necessary.
In the future please consider having a proper backup and restore schedule in place, to take care of this kind of thing. Please tell us you aren't running this update in production...!
Comment: Hi, Yes, this is exactly what I did. Well i'm banging away on a test server BUT, we got a script to update a user setting en masse in a user table and it was going to eventually run on production. I guess this isn't the recommended approach :-) .  I'm sorta green if you haven't noticed, if you had to do something like this, you would use a full backup type of approach? Thanks!
Comment: So your script includes both the table structure, and the data to insert to it? In that case you just need to DROP the existing table (if the script doesn't already include that) - assuming it's a straightforward overwrite - and execute the .sql script file you saved from the "generate scripts" process. Or if you have dependencies with foreign keys and such like, you could edit the script to create the table as "my_table_new" (if the original was "my_table") and insert the "missing" row from the new table.
Comment: Yes, when I created the script I used the schema and data options and I see in the generated script that it has the table create and all the inserts for the data. That approach where you import as a new table and just insert the missing rows is interesting..Thanks
Answer: Without 3rd-party tools, you'll have to do a full restore of the entire database (using a different name, so you don't overwrite the original), then extract the missing data from the copy.
Some 3rd-part backup tools (like Quest Litespeed, for example) have the ability to do an "object-level restore", which can restore just single tables from backup files.
Answer:
we got a script to update a user setting en masse in a user table and it was going to eventually run on production. I guess this isn't the recommended approach :-) .

For something like this it would be much safer to script an update of just the column(s) that need updating in your user table. Cloning any part of your test environment user data into production could be disastrous.
Is it not possible to use the script with which you (presumably) updated your test environment in production as well?
Answer: IMHO the better way is to full restore the entire DB under a different name and then run the query:
SET IDENTITY_INSERT maindb.mytable ON  -- if there is an auto increment key in the table

INSERT maindb.mytable select * from mybackupdb.mytable where primarykeyfield=value of the row to be restored.

SET IDENTITY_INSERT maindb.mytable OFF

Above SQL is just for example to set you on the right path.


What are the ways to read years B. C.?

Question: Do years before Christ (or zero) follow the same reading pattern as here? How do we say and write B. C. in German? Do they have other forms of expressing that (e. g. non-religious ones)? What about other calendars (Jewish, Eastern Orthodox)?
Comment: There is no such thing as a year zero ;)
Comment: My understanding is that BC and AD are increasingly being replaced by BCE and CE, standing for "before common era" and "common era". That way non-Christians can talk about dates without bringing religion into it. I assume *v.u.Z.* and *(n.)u.Z.* (see Henning Kockerbeck's answer) perform a similar function for German speakers.
Answer: Generally, the years B. C. are read in the same way as are the years A. D. For example

Romulus und Remus waren nach der römischen Mythologie die Gründer der Stadt Rom im Jahre 753 v. Chr.

what would be read as "(...) im Jahre Siebenhundertdreiundfünfzig vor Christus".
The equivalent for "A. D." would unsurprisingly be "nach Christus" or "n. Chr.", though this is very often ommitted. We rarely speak of "das Jahr 2023 n. Chr.", unless there's a specific reason for that ;)
Additionally, there's a way that tries to avoid religious connotations, and that's referring to "our way of calculating times", "unsere Zeitrechnung". You can compare this to "before or after the Common Era". With this, the legendary foundation of Rome would have been at

753 vor unserer Zeitrechnung (v. u. Z.)

For "A. D." we might say

das Jahr 2023 unserer Zeitrechnung (u. Z.)

or

das Jahr 2023 nach unserer Zeitrechnung (n. u. Z.)

You may want to note that "nach" in this case doesn't refer to "after" congruent to "before" in "v. u. Z.", but more to "according to". "Nach unserer Zeitrechnung" would be something like "according to our way of calculating times".
As an aside, in our calendar there was no year 0. After the year -1, so to speak, the next year was the year 1. That's seen from today's perspective, of course, the people of the time used different calender(s). You occasionally find people using a year 0 in their calculations, which means they determine the date for the coming apocalypse one year wrong ;)
Comment: FWIW, "after" can be used in English to mean "following, according to" in a similar way to how "nach" can be used in German. Overlaps like this bring me joy for some reason.
Comment: It is perhaps worth mentioning that "v. u. Z." is not politically neutral, because it was popularized (if not invented) by the communist dictatorship in East Germany, although I suppose many people, especially East Germans, will use it without intending to convey a political stance. By the way, "v. Chr." is also sometimes spoken as "vor Christi Geburt".
Comment: @SebastianKoppehel Are you saying that referring to Christ instead is politically neutral? Unless the context makes the distinction between v. u. Z. and v. Chr. meaningful I don't think anyone would care or even notice.
Comment: Of course it makes sense to speak about the years "nach Christus" if there is possibility of confusion, i.e. "Im Jahre 10 v. Chr. .... wohingegegen im Jahr 10 n. Chr..."
Comment: @infinitezero Sure, but in my experience this peters out relatively quickly. I don't remember, for example, reading about "das Jahr 800 n. Chr." that often ;) We _did_ have about two millenia since the beginning of "unserer Zeitrechnung", and the part of those that "n. Chr." is used with commonly is quite small IMHO.
Comment: @quarague I am not saying that. I agree that many people will not know or care about the expression's unwholesome origin.
Answer: There is no year zero. (This is independent from the language)

Das Jahr vor dem Jahr 2 nach Christus ist das Jahr 1 nach Christus.
Das Jahr vor dem Jahr 1 nach Christus ist das Jahr 1 vor Christus.

With the usual abbreviations:

Das Jahr vor dem Jahr 2 n. Chr. ist das Jahr 1 n. Chr.
Das Jahr vor dem Jahr 1 n. Chr. ist das Jahr 1 v. Chr.

In English:

The year before the year 2 AD is the year 1 AD.
The year before the year 1 AD is the year 1 BC.

But note that in astronomical calendars there is a year zero, but there are also negative years:

The year 2 AD is the astronomical year 2.
The year 1 AD is the astronomical year 1.
The year 1 BC is the astronomical year 0.
The year 2 BC is the astronomical year -1.
The year 3 BC is the astronomical year -2.

The German terms vor Christus and nach Christus and their abbreviations have of course a religious connotation, but since it is the most usual form, this connotation is weaker than it might sound to learners of German. I am an atheist but I still use these expressions because they are so common and I don't have a problem with it, like almost every second German native speaker who is non-religious or member of a non-christian religion.1
There are also other terms and abbreviations, but they are so rare, that most people don't know what the abbreviations stand for:

vuZ = v.u.Z. = vor unserer Zeit = vor unserer Zeitrechnung
nuZ = n.u.Z. = nach unserer Zeit = nach unserer Zeitrechnung

For the numbers themselves:
Everything that was explained in the answer you linked to in your question, is true also for dates before Christ. You just have to add »v.Chr.« The rest is the same.

For dates in other calendars:
I think you do it in German the same way as in English (how ever this might be - I don't know).

1 About 52% of people living in Germany are Christs source, in Austria it's about 68% source and in Switzerland about 61% source.
Comment: So 1350 B. C. is not red "dreizehnhundertfuenfzig v. Chr.", but "tausenddreihundertfuenfzig v. Chr."?
Comment: @Juandev: Wrong! I wrote: *"Everything that was explained in the [answer you linked to](https://german.stackexchange.com/a/23327/1487) in your question, is true also for dates before Christ. You just have to add »v.Chr.« The rest is the same."* In this other answer you can read for example: *"1315 dreizehnhundertfünfzehn".* As a conclusion 1350 BC is in German *"dreizehnhundertfünfzig vor Christus",* and this is what you should learn. The other possibility (*"tausenddreihundertfuenfzig v. Chr."*) is not completely wrong but very unusual, so you should avoid it.

What are the ways to read years B. C.?


Objective-c iphone programming with cisco routers?

Question: I've seen some apps that connect to routers via ssh.
Can anyone recommend any documentation on interacting with Cisco IOS configs and notifications? I'd love to write some custom in-house code!
Answer: Most of the configuring/querying can be done via SNMP, so you don't have to have a SSH client/command parser built in you application. What's supported depends on router/ios version. You can check here: SNMP OID Browser. SNMP can sometimes be overwhelming, but in time it can be of great use to you. My first suggestion is to find a SNMP browser (eg. from solarwinds) so you can inspect what info you can get from the router. Then you can use NET-SNMP library to do the actual querying/configuring of the router, or if you are willing to pay you can try IP*Works.


Solspace Calender Filtering events by category

Question: I am using the demo templates from Solspace and having a bit of trouble getting filtering working. I have one calendar and I want to be able to filter the events based on a category. I can't get it to work. Do I need to create a calendar for every type of category and then just link to each calendar?
Answer: No, you definitely do not need to create a calendar for every type of category. You can put all the events into one calendar and filter by category. Just use the category parameter on the <code>{exp:calendar:events}</code> tag.
<code>{exp:calendar:events category="1"}
</code>
Instead of hardcoding the category ID you'll probably want to pass it in via a segment variable. Depending on how you are building your URI's you might find Low Seg2Cat pretty useful.
If that's what you are already trying then please post some template code and I or someone else might be able to give you a more specific answer.
Answer: I've used Dynamic Parameters for filtering channels. I'm thinking you can do the same with Category.
https://ellislab.com/expressionengine/user-guide/add-ons/channel/dynamic_parameters.html


How can I set the power of a Canon 580EX II with a Godox X1 trigger?

Question: I have an X1 trigger and receiver set for Canon and a 580EX II. I don't know how to control the power of the flash through the trigger. I also have a Godox v860II and setting its power through the trigger is a breeze. How do I set the 580EX II?
Comment: What have you tried so far that did not work in order to control the power of the 580EX II?
Answer: The flash needs to be set to use its hot foot for communication with the camera.
If you set the flash to 'Slave', it will ignore anything attached to the hot foot and will monitor its optical sensor for optical pulses from an optical master flash (or ST-E2 flash controller). You should set the flash to 'Manual' power mode in the same way you would if the flash were attached to your camera's hot shoe. As far as the flash is concerned, the X1 receiver you have attached to its hot foot is the camera.
When you change a setting via the X1 controls (or the camera's menu), you need to do a half press of the camera's shutter button to tell the X1 to transmit the change to the remote flash if it has been more than a few seconds since the TX has communicated to the flash. As far as I can tell, this is a power saving feature as the 'wake' and 'set' signals are combined in one very short transmission.
Don't forget that the 580EX II must be set via the flash's control panel to 'default' settings for power and zoom or the X1 can not change the setting on the flash. The flash should be set to 1/1 manual power (or ±0 EC in TTL mode) and "Auto" zoom (There will be an "A" to the left of the displayed zoom head position) using the control panel on the flash in order to allow the X1 to change those settings. If the flash is set to another power level (or EC setting in TTL) or a specific zoom setting (There will be an 'M' to the left of the displayed zoom head position) via the flash's control panel the X1 or camera's menu will not override those settings. Also note that pulling out the diffuser panel on the flash is manually setting the zoom to 'wide' and the zoom head will not move regardless of the setting made via the X1. You're also locked out of changing the zoom setting on the 580EX II's control panel when the diffuser panel is pulled out.
Answer: I'm working with same setup in 2023, Godox X1T-C and X1R-C, using both 580EX and 580EX II flashes, with camera Canon R6. I second what Michael C says, and add this additional info comparing the 580EX to the 580EX II:

E-TTL mode flash exposure compensation setting works remotely in BOTH the 580EX and 580EX II.

Set both Godox and Flash to E-TTL mode. Set compensation using the Godox menu, or use the Camera menu (ext speedlite control / flash function settings / flash exp comp). Note that the compensation is not displayed on the remote flash's display, but it is nonetheless working to adjust the flash.

Manual-mode flash setting works remotely with 580EX II, but not 580EX.

The 580EX II's display updates to show the manual setting selected remotely using the Godox. The Godox will also toggle the 580EX II between ETTL and Manual mode remotely. But not on the 580EX.

Both flashes correctly respond to f-stop remotely.

Neither flash will respond to lens zoom remotely. They stay fixed to one zoom which you can set manually. I have not found this to be a detriment.

In summary these old flashes still have useful life with Godox remote control, especially the 580EX II, and also 580EX if using E-TTL mode.
Comment: Unless there's been a change in recent firmware releases, I'm pretty sure if you leave the  zoom setting on the flash at 'Auto', it can then be controlled by the transmitter. If it's set to any other value via the flash's control panel the value set on the flash will remain in force. (Similar to how FEC must be initially set to '0' with TTL and Manual power set to 1/1 on the flash's control panel for the trigger to be able to control and change those settings.)


Fish quality for ceviche

Question: In the US, can I buy fish from any reputable fishmonger for ceviche, or should I be using sushi-grade fish?
Comment: Note that in the US at least there is no legal standard of "sushi grade".  Stores can, and do use the label but it is at their choice and their digression.  In a reputable store it is one which should be their highest standard and something they claim to be safe to eat raw, but it is entirely on their say so.  Frankly, if they have other fish that you consider suspect quality, they I would not trust their sushi grade label either.
Comment: I would trust Wegmans, no question. They have very fresh, top quality seafood.
Comment: @dlb. I'm lucky enough to live in Wegmans territory, and the sushi is raved about.
Answer: This is an opinion answer, but and noted in the US "sushi grade" is a marketing label only, not a legal, inspected standard so unless you trust the vendor means very little.  Other places it has actual meaning.  In all cases you should likely go by what your local standards are, the reputation of the source and your own feeling.  Something may be safe, but if it does not feel safe to you, then don't trust it.
In general, my opinion on Ceviche but not backed by research is that it is an "acid cooked" item so is not raw but also has not had heat applied as we know.  This says to me that some potential pathogens have been eliminated, but not necessarily all.  As long as fresh, quality product is used, the main concern in sushi and ceviche of common proteins is usually parasites.  The curing with kill some, but quite possibly not all, so ceviche has less of a worry than sushi, but is not free from fear.
So, my opinion would be to avoid any fish even of high quality which might be prone to parasites, so I would use no fresh water fish.  Fish like salmon spend part of their life in fresh, part in salt which makes them more susceptible, so I would tend to use them only if they meet sushi standards.  In the US that means hard frozen to kill parasites while in  some other places that means well inspected.  I would always avoid any farm raised item myself as the crowding and often poor water exchange in the rearing increases risk.  Of salt water creatures, I would tend to go for ones which are deeper water, not ones which habit shallow or possible brackish waters which would in my mind increase exposure.  If it was an item that seemed more at risk, salmon as an example, then I would want sushi quality only.  Mahi Mahi though, a fast growing salt water fish I would just look for good quality from a reputable source.  My choices would vary by variety.
Answer: Yes you can.
If the fish is fresh and comes from a reputable store, you can use it.

Fish quality for ceviche


When building web apps in clojure, where should preperations for a page belong?

Question: In web frameworks like ruby on rails, any database queries needed to handle a specific request happen before a page is passed to the client in a controller class, but there's nothing like that for clojure. Where should database queries and stuff like that be handled in a clojure web app? My gut tells me to call a function within a hiccup page and generate the HTML within that function, but I'm not really sure. Thank you for your time and consideration.
Answer: There aren't that many "full stack" web frameworks in Clojure and as far as I know most Clojure web applications aren't built with one. There is a collection of frameworks and tools that handle a variety of things, but you'll likely develop your application using these components as building blocks. You have a choice of routing functions, authentication, view rendering, templating, RESTful web services and persistence.
Where particular things should go in your application depends on your architecture - a typical, 3-tier MVC web application looks different from a full blown scalable app that's using CQRS, CEP and other fancy patterns that help you build the next Facebook or Twitter.
If you design your web app conceptually with a 3-tier MVC architecture in mind, you'll have a clear separation between your view layer, business logic, and persistence layer. Like Alex said in his answer - it's probably the Controller that ties these things together. If you don't have complex business logic, your controller will likely call functions from your persistence layer directly before passing it on to the logic that builds your views.
For some situations, it might be useful to pull in data from your persistence layer in a "middleware" — that is a function that gets called by Ring every time a request comes in. This could be the stored information about a logged in user for example.

A number of options for your building blocks: Mature Clojure web frameworks?
Most (all?) of Clojure's routing/request handling frameworks are built on top of Ring. An overview of what that looks like is here: http://brehaut.net/blog/2011/ring_introduction
Comment: I wanted to throw my hat in the ring here, I've made a full stack framework for clojure: [coast on clojure](https://github.com/swlkr/coast) and it uses hiccup but separates code very similarly to the way rails does, without the active record ceremony. Give it a try!
Answer: IMO, whichever code generates your views should call the function, and use the result of the function to dictate how to render the view. Looked at from the Clojure perspective, Controllers could be seen as functions that are called by the router.
Comment: Just out of curiosity, have you played at all with clojure's web stack?


Do ethnic groups differ in non-coding DNA?

Question: There are services (23andme, AncestryDNA) that will associate an ethnic group to you from your spit. Could non-coding DNA in theory be useful for this goal i.e. are there statistically meaningful differences in non-coding DNA between different ethnic groups?
Comment: We only deal with one question per post. The first would be about the standards applied in a test by a commercial service - this would likely be off-topic here as it could be seen as promotion of that service. The second might be on-topic , but you would need to show what researches you'd done on the topic and where you'd gotten stuck. (Personally I'm interested in the answer should it be different from expected heritable differences by a significant amount). You should take our [tour] and refer to the [help] for guidance to our ways - then [edit] the question to show your workings.
Comment: Well then, perhaps it would be on-topic - but beware, that's from 2013 and the site-rules have significantly tightened since then - I'll let those with greater familiarity with this site on the stack tell you the current policy. (A cursory search of our [meta](https://biology.meta.stackexchange.com/questions) didn't enlighten me on the subject). You would still need to show your researches into the remaining topic.
Comment: Personally I see nothing wrong with discussing particular direct to consumer genetic testing companies.
Comment: This answer links to the site of 23andme https://biology.stackexchange.com/a/7295/68099
Answer: Not only 'in theory', but it is used for ancestry testing.
Coding DNA (exonic regions) tend to be more highly conserved between individuals, as changes to the sequence are more likely to have a deleterious effect on an important phenotype (think a mutation which makes someone only have a single arm). Non-coding DNA is less constrained by selection and varies more between individuals / ethnic groups. This makes it more useful for identifying variants specific to different ethnicities, which makes the basis of ancestry testing. Typically in ancestry testing SNPs which show evidence of being under some kind of functional selection (i.e. are out of Hardy-Weinberg equilibrium) are excluded from the analysis. Neutrally evolving SNPs (which are more likely to be found in non-coding regions) are more likely to reflect the true population phylogeny.
I'll try and update this post with some references.
Comment: @fielanb The differences that you note between people of different ancestry groups are largely red herrings. They give a superficial impression of difference (which in some cases does not have a clear genetic basis), relative to overwhelming similarity in functional regions of DNA (https://nyti.ms/3CxBxcj, https://www.nature.com/articles/ng1456). Noncoding regions on the other hand tend to yield a reasonable historical record of population differentiation, because they are not functionally constrained, and mutations in regions without functions are therefore more likely to be passed on.
Comment: But when people try to determine someone's ethnicity by looking at them they are relying on information (eyes, cheekbones, skin color, fat level, lip size, height etc.) primarily shaped by coding DNA right?
Answer: user438383's answer is correct. Non-coding DNA is much more useful for ancestral research, especially of ancient ancestry, because it preserves mistakes or changes that would damage a person if they occurred in coding DNA. For this reason people have SNP's in their DNA that date back thousands of years. By comparing and contrasting SNPs it can be determined absolutely how different people are related to each other. We are all related to each other, the only question is how far back you have to go to find the relation.
Concerning physical characteristics like eye and hair color, those are indeed determined by coding DNA, but are what are called "expressed traits" which means that how they get expressed is complex and depends on random factors. For example, I have seen a clone of a cat where the original was completely black, but the clone had a white patch on its chest. However, a littermate of the original did have the same patch. So, you see the gene codes for black, but when the organism grows in the environment, random differences can occur. Part of this is due to a process called "methylation". When a zygote is developed, the egg's genetic material is methylated and this inactivates or activates genes randomly (see "Methylation dynamics during the maternal-to-zygotic genome transition in dioecious species" Willian T. A. F. Silva for more information), thereby causing differences in physical makeup of the organism. Note that a person has many different copies of the same gene which can differ from each other, so which particular gene gets activated will affect the final form of the organism.
Physical characteristics can be a clue to a genetic heritage, but it is important to realize that for every gene that gets expressed many more are latent and go unused, perhaps to surface in a later generation.
Comment: The classic reference for reaction norms (gene x environment interaction) would be Lewontin 1974 (here is a republished version that is easy to access: https://pubmed.ncbi.nlm.nih.gov/16645033/).


How to have different build environments for android?

Question: I have dozens of api keys to facebook and twitter and many other services, what is the standard way to have different values for the keys depending on if I am making a development build vs. a staging build vs. a production build?
Answer: You can use a static flag to use it in a switch block to define your keys. That works for a simple project with two or three alternative keys.
If you really have that many, to use in several projects, I suggest you to add them to a helper class, so you minimise the code changing in your classes. Something like:
public class BuildHelper {
    public static final int DEBUG=0;
    public static final int STAGING=1;
    public static final int PRODUCTION=2;

    public static int BUILD;

    public static String getFbKey() {
      switch(BUILD) {
        case DEBUG: return "xxx";
        case STAGING: return "yyy";
        case PRODUCTION: return "zzz";
      }
      return null;
    }
    public static String getTwitterKey() {
      switch(BUILD) {
        case DEBUG: return "xxx";
        case STAGING: return "yyy";
        case PRODUCTION: return "zzz";
      }
      return null;
    }
}

and use it as:
public class YourClass extends Activity {

    public static String FB_KEY;
    public static String TWITTER_KEY;
    //etc.

  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    BuildHelper.BUILD=BuildHelper.DEBUG; // or STAGING or PRODUCTION
    FB_KEY = BuildHelper.getFbKey();
    TWITTER_KEY = BuildHelper.getTwitterKey();
    //etc.
  }
}

Comment: I ended up doing a runtime check for a strings var similar to this
Answer: I would keep them in separate properties files and reference the applicable property file in your build script/eclipse class path depending on what you're doing.


What happens in rugby game if the ball gets kicked into the posts at starting kick off?

Question: I know that in the middle or the end of a rugby game, if the ball is kicked into the posts correctly, they earn 3 points. What if it happens at kickoff?
Answer: Law 12 clarifies the result of any kick-off or restart kick.
Part 9 applies to this situation.

If the ball is kicked into the opponents' in-goal without touching any player and an opponent ground's the ball without delay or it goes dead through in-goal, the non-kicking team has the option of having the kick retaken or a scrum.

That is, unless the defending team keeps the ball in play and continues playing, they will choose either to make the kicking team kick again, or feed a scrum at the centre of the halfway line.


How to draw a map with a large database in android?

Question: I'm trying to draw a map ( but not using google map) and make an animation with it (like zoom, scroll rotate, transition....) . It works very smooth with the small database, but when i test with the large database (about 15000 points and lines), it take more than minutes to start a small activity (like zoom)...
In the code, i draw all the map into the canvas type, then use matrixs and thread to make animation.
I want to ask if there is a other way to make it faster.
Thank you.
Answer: While user starts zooming, convert your map to bitmap and zoom one image instead of thousands of objects. Also it's better to don't draw invisible (for user) objects


mistakenly sent ETC to ETH address on Cryptopia

Question: I have mistakenly sent ETC from Cryptopia To an ETH address.How can i recover my ETC back.
Answer: If the transaction was successful, then to recover your ETC I think you have only two options:

Ask the owner of the private key of that address to send you the funds.
Get the private key of that address and send yourself the funds.


Can you ever reduce your reaction time?

Question: Can you ever reduce your reaction time? As a martial arts practitioner, you can learn to spot certain tiny movements of your opponent ahead of their attack and start your countermove earlier, but your reaction time stays the same, doesn't it?
Comment: I don't feel I have enough information to provide a correct answer, because everything I've found so far is anecdotal, but, for example, https://martialarts.stackexchange.com/questions/8935/ suggests the meditation can work, and links to some scientific papers that attempt to prove it.
Answer: First off, as @mattm rightfully points out, you need to sleep well and enough, drink enough water and eat well, live an active life etc. All these factors are necessary conditions for good reaction times.
Reacting to visual stimuli: time frames
Here, what cannot be overcome is the need to process the visual data through pattern recognising routines and then send the signal through the motoric central in the brain and the Central Nervous System to the muscles.
Therefore, there is a lower limit of about 180ms even for the simplest possible visual and motor patterns. Since attacks in martial arts are much more complex visual patterns, as well as the motoric patterns that are proper reactions are, this can go well beyond 500 ms: there are studies 1 2 which suggest that even when reacting to a very simple visual stimulus you are waiting for with a very simple and predetermined move, we are already well beyond 300ms for professional boxers (320+ms for a fast jab, 500+ms for a powerful jab as a goal).
Now, how to train the reaction time?
Basically in three ways:

You train to see the tension and kinetic chain built up in your opponent's body by learning about all these little clues (visual pattern recognition training). That way, you can react before the technique is even coming at you.

You train the motor pattern (move) of the suitable reactions to become as fast as possible. That way, you both become faster in the execution and in the time it needs to build up the corresponding action potentials in your motor cortex (brain). This is often called "building muscle memory" these days.

You train the link between them by being exposed to the visual stimulus and doing the corresponding reaction pattern over and over. This way the link between them becomes stronger to the point where you don't have to think about it anymore (neurologically speaking, thinking is a reroute via the frontal cortex). Also, neural links are established.

We are speaking about time frames of months to years here though. There is no fast track.
Conclusion and TL;DR
While there are lower bounds to reaction times due to the way our brains work, we can certainly train reaction times. Skill training does establish neural structures that enable us to make use of trained reaction patterns much faster and without having to think about it.
Answer: You can train to reduce reaction time, but there are fundamental limits originating from the human visual system, for example. Untrained individuals generally have slow reaction times because they are trying to identify what is happening to them and make decisions. You can train to eliminate this delay, but you can't reduce human visual system reaction time.
There are also well-known ways to impair your reaction time such as drinking alcohol or sleep deprivation. If you want to reduce your reaction time, get enough sleep and avoid alcohol.
Answer: *Can I offer a simplified answer - the instinctive centre of the human body is where our survival perceptions and processes are sited. So any self-defence actions may be traced here; in contrast 'thinking' what to do, and emotions will nearly always make a person slower in perceptions and actions. So to centre the mind in the instinctive centre is optimal. How to learn to do this? Practice of the forms and skills of martial arts until they become second nature; and following the precepts of tai chi regarding 'quieting the mind' enable greater sensitivity to the bodies rhythmns and instincts.  In a serious and threatening situation (you are hopefully not responsible for), the instinctive centre is way ahead of your conscious mind. It will perceive not only someone's actions, but even intentions towards you, perceptions which are felt in the stomach. As soon as this is felt you can act decisively however that may be. This ability to instinctively 'sense' should be worked towards in life daily, as 'where the mind is, energy is'... Always trust your instinct. If you feel someone is going to attack you it is probably in their mind.
Sooo, if someone is acting aggressively towards you and you feel physical attack is intended, you may act in self-defence to stop it. If they start to take something out of their pocket, end it before it begins, nothing good can come of allowing someone to take a weapon out. Legally it is justifiable if warning signs have been displayed;
*creating an argument about nothing;
*excessive eye-contact;
*negative emotions of any sort/ heightened emo. state;
*invading personal space. (put your arm out full-length, and say 'this is my personal space - do not enter it again';
*verbal threats of violence/ increase of obscene language;
*NVC indicators; voice tone,'muscular' posture, chest out,chin forward, etc;
*positioning, ie trapping you in a corner/blocking your exits;
*pointless discussion on their terms;
And so on. Stay relaxed and ready to act; don't get caught out by appearances, or anything else. Readiness and confident relaxation will ensure you have a head-start. Best of luck and enjoy the martial arts, they're amazing systems of betterment.

Can you ever reduce your reaction time?


Software to auto adjust brightness of screen(s) from webcam

Question: Does any windows software exist to auto-adjust the brightness of a monitor (laptop screen and external monitor) based on the amount of light that a connected webcam senses?
Comment: Not sure if such software exists but if its possible its a really good idea, seeing as most modern laptops have built-in webcams.
Comment: And the downvote / close is for what?  When this question was asked I don't believe the software recommendations stackexached was opened yet.  If you feel it is placed here in error please move it there instead of downvoting and voting to close it.
Answer: i was looking for the same thing, for now i only found this, doesn't work with camera, but with time, at least
http://www.stereopsis.com/flux/
Answer: I've just done this tonight : http://calvin-studio.fr/projets.php?p=14 (in French)
Archive here , with code + Visual project + executable.
Uses parts of redshift sourcecode, and escapi. So : Windows only, ugly console, never tested on dual display, probably messes with any software calibration tool, f.lux incompatible, Skype/MSN/any_videoconference_software-incompatible.
Works for me, though :)
Answer: I ended up with running brightness adjustment every hour (using http://sven.killig.de/BLUntrl/) via the following autohotkey script:
<code>#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

Loop
{
   Run, D:\autohotkey\BLUntrl.exe
     Sleep, 10000
     Send, {Esc}
     Sleep, 3600000
}
Return
</code>
This solution seems to work fine with f.lux.
Calvin's application from previous post is great, but it alters color balance on my monitors.
Answer: "Many modern laptops include a built-in dedicated light sensor. If yours does, and if you're running Windows 7 Professional or higher, you can enable a Windows feature called "Adaptive Brightness" which will do what you want. Otherwise, click here and download "SoftonEyes"."


is a strong linux login password needed with full disk encryption with a strong password?

Question: I'm using full disk encryption, that is easily done using recent ubuntu installation images. I have a very strong password that I type in on boot to unlock the encrypted disk partitions. Is a strong linux login password needed if I have no network services running (I have a firewall turned on to reject all incoming connections)? It's really annoying to have to type in a 40+ character password everytime I lock my screen, like when I just want to take a 5 minute break from working and step away from my computer or leave it in the trunk of my car. I can't think of any way someone could do a very high speed brute force attack with just keyboard and mouse access. Is this true? If the machine is stolen, then someone can copy the disk and insert it into another machine, but if a very strong password is used on the full disk encryption, it seems like I am safe. Am I missing any possible hacking attempts? I am aware of a cold boot attack, but it seems to me like in this situation the length of the password doesn't really matter.
Answer: I feel the question is a bit vague but yet it has some points . The lock screen and disk encryption protects you mostly from physical (if you can call them so) attacks , meaning someone being in front of your computer literally . As you say computers can be stolen , and we all know that some data can be valuable . But I think cold boot attack is the method that hackers take data from RAM when the power is off and the encrypted disk don't offer more security . So in that sense the length of the pass doesn't really matters. As for brute force attacks 10 characters (that isn't really a word ) maybe with special characters and numbers , that covers it in the most part . Also I hear that linux kernel can be modified to keep some of the encrypted data in the CPU rather than the RAM with patches like TRESOR . If you conclude something more please share .
Answer: To answer your question: No.  Physical attacks are going to be in a number of categories:

Attacking the offline harddrive: This is the only point of using super long passwords.
Attacking the offline RAM: This is the approach billybadass is discussing, and if it works, length of your password won't matter.
Attacking the computer while on using the normal interface: This is the point of locking your computer and your computer wouldn't allow billions of password attempts per second, so no point in super long passwords.
Attacking the computer while on through roundabout means: If someone is able to get around the normal login interface, like directly reading memory or CPU, your password length won't matter because your harddrive is already decrypted so they'd have full access.

This is why there is a very different standard for encryption passwords specifically versus your normal passwords.  If you're the only user you might consider a full disk encryption which is prompted for once during the bootup and then have an easier user password.
Also, keep in mind that having no network services running and blocking incoming connections doesn't make you immune from that vector.  You could download a virus accidentally which could send all your data to the attacker.
Comment: Any example on how someone could directly read the CPU or memory? It seems as though all your comments have pointed towards the same conclusions that I made, which was I should have a strong password on decrypting the disk at boot, and then a simpler unix login password. All other attack methods success seem to be unrelated to the length of the passwords anyway. As a bonus, can anyone confirm these conclusions are valid or provide any technical references?
Comment: Getting a virus is a concern, but I think the risks are lower these days, particularly if all software that is installed is through a repository and/or signed by a reputable source.


php symfony to get blob image data from mysql

Question: How can I get image data string from mysql db that has blob images? Thanks.
Answer: Assuming that you're using the default ORM (Propel) that comes with Symfony, $your_object->getImage()* should return whatever blob value you stored in the database.
You might already know this and it's not an option, but have you considered storing the images in a directory and using the database to store the path to the images ?
*Assuming 'image' is the field name in the database/schema.yml
Answer: There is always flamewar about storing images in a database vs. filesystem.
Storing them in a database is more secure (if you need to secure access to them) but usually you need wrapper to read and display them in  tag (if you do it).
There's a lot of pros and cons... Depends on your needs what is better.
and yes sjobe's $x->getImage() would be enough to get a blob content.


How to get plugin configuration through plugin manager?

Question: I have defined plugin manager and I have installed two plugins, I am getting plugins name and id by <code>$plugins = $this->pluginManager->getDefinitions();</code> but I need to access its configurations and display whether this property is enabled or not with an edit button. How to do it?
Answer: The plugin manager is not responsible for storing the configuration, that happens somewhere else.
Typically plugin configuration is then stored in a config entity, either in a 1:1 relation (e.g. blocks) or 1:n (e.g. views, view/form displays, filter formats).
I'd suggest that you look at those modules to see how they work, block is probably one of the simpler cases in core. You can also ask more specific questions if you're stuck on implementing that


Multiple multilingual menus in Django-CMS with items rooted at /

Question: I'm using Django-CMS 2.3.5 on Django 1.4.5 and Python 2.7.2.
I have about 2 dozen pages which need to be presented in two or more menus in my base template.
Currently I'm using a primary menu and a footer menu.  For the primary menu, I simple created a "home" page with id 'home' and a number of children, then use <code>{% show_menu_below_id "home" 0 100 100 100 %}</code>.  Works perfectly.
For the footer-menu, I've created a fake node in the page tree called "Footer Menu" with id:footer-menu with my footer menu items as children.  Then, I use `{% show_menu_below_id "footer-menu" 0 100 100 100 %}.
Each of the pages within the menus are translated into 6 languages, including their slugs of course.
The problem lies in that my URLs for the items in the footer-menu are like "/en/footer-menu/news/".  I'm required to make this simply "/en/news/".  I tried using Advanced > Overwrite URL on footer-menu to '/', but its not allowed.
So, I use Advanced > Overwrite URL field on each sub-page to set the url to "/news".  While testing in English, I do indeed get a URL of "/en/news/", but when I switch to another language (E.g., Spanish), the url is "/es/footer-menu/noticia/".
So, what strategy should I use to permit:

Client-arrange-able menus - Client should be able to create/move/delete pages from menus
Multiple menus
i18N slugs and
root the items at "/< language >/"?

Surely I'm not the first person to want to do this, right?
All ideas welcome.  Thanks in advance!
Answer: The solution is to upgrade to 2.4.x where the Overwrite URL is now distinct for each language.


How can the discriminator determine the sample is fake or real?

Question: Based on the articles I've read, the discriminator can identify whether a sample is fake or real. However, the articles don't clarify the conditions used to determine if a sample is fake or real. I came across information suggesting that labeling all the samples generated by the generator as fake before the training process, but I'm not sure if this is correct. Could someone please provide clarification? Thanks
Answer: In a GAN, the discriminator starts untrained, and the generator and discriminator are trained alongside each other. The process relies on neither being too strong for the other at any one stage, so that training can continue.
So the reason the discriminator can determine the difference between a real or fake sample is because it has learned from the GAN training process.
You should start with some training data, in the form of real images that you want the generator to produce similar output to.
When you train the discriminator:

For every real image you show it, the target label is "real" (for a simple binary discrimintor the single target output is $p(real) = 1$)

For every generated image you show it, the target label is "fake" (e.g. $p(real) = 0$ for a binary class prediction)

In every minibatch you should train the discriminator on a mix of real and fake images, labelled accordingly.

When you train the generator:

You still show the generator outputs to the discriminator, but now your target is to make the generator better, so you lie to the discriminator and label the generator's image as "real" ($p(real) = 1$). The trick here is that you only do this to get the gradients at the generator output layer. The discriminator is not updated for these training examples, only the generator is.

There are a few variations of this process, but the core idea is always similar, and to answer your main question, the discriminator determines real or fake because this is part of the training process. It is very bad at its job at the start, and you need that to be the case.
Comment: @David Because the discriminator is *not* updated. The reading you have done is also correct - backpropagation is done through the discriminator layers. It has to be so in order to get the gradients to update the generator. What you should not do is use the gradients from the generator training for the discriminator to update it - those are thrown away, only keep and use the generator gradients when training the generator
Comment: In the training process of the generator, I read that backpropagation also goes through the discriminator. So, why did you state, _The discriminator is not updated for these training examples, only the generator is._?
Comment: When training the generator, _you lie to the discriminator and label the generator's image as "real" (p(real)=1)_, then what will be labeled as fake during the generator's training process ?
Comment: @David: Nothing is labelled as fake when training the generator. The generator's goal is to make all images as real as possible (as far as the discriminator can tell).
Comment: When will the error propagate back to the generator? Like when the generator fails to fool the discriminator (the discriminator classifies the generated images as fake instead of real) ?
Comment: @David When you train the generator. There's no need to select only failures, although of course these will give larger error signals, but even success  can be improved by increasing confidence. If you have further questions please start a new question on the site


Polkadot Patricia Trie compatible with Ethereum implementation

Question: I'm currently looking to verify ethereum transaction merkle-proofs in runtime. As Ethereum also uses a patricia-trie, I was wondering if the two implementations are generally compatible. Is it possible to use sp-trie to recreate the transaction root of an ethereum header?
Answer: Openethereum did use the same dependency but with a different node codec (https://github.com/openethereum/openethereum/tree/d8305c52ea805e62d7532c3ac76386873984d326/crates/db/patricia-trie-ethereum).
So not compatible.
Also openethereum uses a version of the trie crate and rlp codec that are not no_std compatible, so using the code in a runtime will not be straightforward.
Answer: I solved this by removing the std dependencies of the eth-trie.rs crate. That was pretty straightforward and works well.


Does every window running use System.Windows.Forms.Form?

Question: Does every window running use System.Windows.Forms.Form?
The title says it. From Java to C++ to Visual Basic to Console Apps. Does every compiled window use the class System.Drawing.Forms.Form?
Comment: No.  System.Drawing is a .NET namespace.  Many applications (including most of the operating system) don't use .NET.
Answer: No.
In .NET, System.Windows.Forms is (essentially) just a tool to draw windows, but it is not the only tool.  Other languages have their own tools; Java has the Swing libraries, Python and Perl have several other GUI toolkits, each which do things differently.  Console Apps use an entirely different way of presenting information.  How things are drawn not only depends on the language, but also the GUI API used.  For example, a window might be entirely drawn using C++ and DirectX and custom drawing routines; these would not use .NET at all, nor any underlying tools that .NET uses.  That same window might be drawn with C++ and Open GL; the same data might be displayed, but the routines invoked to draw it would be different.  In fact, you could do all the drawing with assembly if you were really masochistic!
Answer: Short answer No.
System.Windows.Forms.Form is an abstraction used by the WinForms .Net library to interact with the actual Windows provided by the OS.
Other languages have other abstractions: Java could use Swing or AWT or any other UI library which offer different ways to draw forms.
Likewise C++ could employ an abstraction over the OS provided objects (i.e. the MFC library) or use the Windows API directly.
All the UI libraries need in the end to use the Windows API to draw their windows, but not all of them do it to the same extent, so .Net's UI libraries will use some of the same API calls as Java's or C++'s UI libraries.
I'll update this answer if I find a good explanation of how the UI and UI libraries work on windows.
I remember reading a good one not long ago with some of the history and the changes in Windows 8 but don't remember where.


Draft 2: Are my tectonic plate formations plausible?

Question:
Ignore the biomes and stuff, I'm going to change that later. The world is spherical, and this is a map of the whole world. A quick note: Fennalore, the continent in the middle of the bottom row, is where my story is mostly set. The awkward gap in the middle of it is caused by a growing rift between dimensions in the ocean there. Don't worry about it.
Comment: I see a lot of red lines along coasts.. you show your whole planet so the scale would be ok, but I wonder if "tectonic plates"really  run along coast lines all the time. On Earth that is not the case, the boundaries run mid sea, parallel to the coasts. I don't see that in above drawing, but I'm not going to put an answer (for lack of expertise) for Earth see https://www.google.com/search?q=tectonic+plates+map&tbm=isch
Comment: Finally, you have a lot of plates (28 by my count). Earth has 15. Is there a reason the crust on your world is so much more broken?
Comment: You have a strange U-shaped plate between El'korrin, Fennalore, and Chinhuochou. I think the arms might better belong on other plates.
Comment: Assuming your world rotates East-to-West, your very massive plate Orriel is going to be pulled towards the equator by centripetal force. Over time, it should have already pushed a lot of the lighter plates around it out of the way, but - whatever the reason for where it is now - it should definitely be moving southward.
Comment: @JamesMcLellan - this is mercator projection, I'm not sure the plate is as large as it appears on the map. it is also polar.
Answer: Mountain ranges associated with tectonic subduction zones are typically above the subducted part of the plate that subducts beneath the other plate.  The friction of the subduction causes the rock to be heated into magma, which then rises to the surface.  You wouldn't get a mountain range across the surface boundary between the two plates, you're actually more likely to get a trench unless both plates carry land masses toward the plate boundary.
You're only likely to get a mountain range over a plate boundary when - like the Himalayas - two land masses collide.  The lower plate's bedrock would subduct, while the lighter landmass rock would remain on the surface for the most part, and bunch up into mountains.
In particular, where two plates are colliding south of El'Korin, you'd likely get a chain of volcanic islands on one side of the boundary, and an ocean trench on the other side. The chart doesn't show which plate is subducting.
The areas where plates are pulling apart tend to be in the middle of oceans, roughly equidistant from both shores.  Where this sort of plate boundary occurs on land, you'd end up with cliffs to either side of a depression: a rift valley.  Eventually, when a rift valley connects to the sea, it would likely fill with water. You wouldn't get such separating plate boundaries on one side of a sea between two land masses, you'd get one midway between the two.
This map also doesn't seem to account for fault-lines that aren't on a plate boundary.  Plates don't always move in straight lines, some twist as they move, so there could be stresses that would cause faults.


What works with RC2 quick release?

Question: A number of brands have quick-release systems that look like the RC2/200PL, but are they the same (intercompatible clones) or do they just look alike from a distance, down to the level with secondary locking pin?
Answer: Only genuine Manfrotto RC2/200PL Quick Release plates and clamps will be fully compatible. The 3rd party tolerances are not close enough and there will be issues. Some will be close, but it has been my experience that the fit will be sloppy or possibly not fit at all.

What works with RC2 quick release?


Is it possible to have Twitter alert me when someone tweets?

Question: I have twitter installed on my iPhone and wanted to know if it was possible to have my phone alert me when a particular user tweets?
Answer:
Yup, it's possible. Click on the account you want to get tweets
  notifications from. And click on the bell Icon
Comment: NOTE: method above works ONLY on the Android and iOS apps
Answer: One way to get it done, without being dependent on Twitter's mobile app, is by using a free action-trigger web service like IFTTT (If This Then That). It allows you to set new tweets from any account of your choosing as trigger and set the action to be an e-mail, SMS or even a mobile alert.
Here is a link to a ready-made IFTTT recipe which will send you an e-mail each time a certain account of your choosing tweets a new tweet.
The caveat with this is that it is not really real-time but works on a 15 min. refresh cycle. That means IFTTT is checking for new tweets every 15 min. or so...


Closed Form of $\int x^n e^x~\mathrm{d}x$

Question: My calculus teacher showed us how to solve $$\displaystyle\int x^n e^x~\mathrm{d}x$$ by iteratively doing integration by parts. I figured out that $$\displaystyle\int x^n e^x~\mathrm{d}x$$ is equal to $$x^n e^x - n\int x^{n-1} e^x~\mathrm{d}x.$$  You can then iteratively find out what the solution is for any $n$.  My question is whether or not there exists a closed form for this integral.  Any help would be much appreciated.
Comment: [This](https://en.wikipedia.org/wiki/Gamma_function) might be interesting.
Comment: That depends on your definition of "closed form" (no doubt, you don't have one). Please, note that the notation $\displaystyle\sum^n_{k=1}\ldots$ is just a shorthand for a recurrence, too. Is that "closed form"?
Comment: @ProfessorVector The exponential generating function of the polynomials involved does have a nice closed form, though.
Comment: I have changed the formatting of the title so as to
[make it take up less vertical space](https://math.meta.stackexchange.com/a/9686/290189) --
this is a policy to ensure that the scarce space on the main
page is distributed evenly over the questions.
See [here](https://math.meta.stackexchange.com/a/9730)
for more information. Please take this into consideration for future
questions. Thanks in advance.
Answer: Using General Leibniz Rule  for the $n$'th derivative of a product, we have
$$\begin{align}
\int x^ne^x\,dx&=\left.\left(\frac{d^n}{db^n}\int e^{bx}\,dx\right)\right|_{b=1}\\\\
&=\left. \frac{d^n}{db^n}\left(\frac{e^{bx}}{b}\right)\right|_{b=1}+C\\\\
&=\left. \left(\sum_{k=0}^n \binom{n}{k}\left(\frac{d^{n-k}e^{bx}}{db^{n-k}}\right)\left(\frac{d^k b^{-1}}{db^k}\right)\right)\right|_{b=1}+C\\\\
&=\sum_{k=0}^n\binom{n}{k}(-1)^k k! x^{n-k}e^x+C
\end{align}$$

Alternatively, using the recursive relationship, $I_n=x^ne^x-nI_{n-1}$, we have
$$\begin{align}
I_n&=x^ne^x-n(x^{n-1}e^x-(n-1)I_{n-2})\\\\
&=x^ne^x-nx^{n-1}e^x+n(n-1)I_{n-2}\\\\
&\vdots\\\\
&=(x^n-nx^{n-1}+n(n-1)x^{n-2}-n(n-1)(n-2)x^{n-3}\cdots+(-1)^nn!)e^x\\\\
&=\sum_{k=0}^n\binom{n}{k}(-1)^kk!x^{n-k}e^x
\end{align}$$
which is as expected modulo the integration constant.
Answer: It is clear that the antiderivative is a polynomial of degree $n$, let $P(x)$.
Then by derivation,
$$(P(x)'+P(x))e^x=x^ne^x$$ or
$$P'(x)+P(x)=x^n.$$
This yields the recurrence relation
$$p_{k-1}=-kp_k$$ with
$$p_n=1.$$
The solution is
$$p_k=(-1)^{n-k}\frac{n!}{k!}.$$
Answer: One may make a simple not of the two solutions provided. One states that
$$I_{n} = \int e^{x} \, x^{n} \,~\mathrm{d}x = (-1)^{n} \, n! \, e^{x} \, \sum_{k=0}^{n} \frac{(-x)^{k}}{k!}$$
is a solution and the other is
$$I_{n} = \int e^{x} \, x^{n} \,~\mathrm{d}x = e^{x} \, \sum_{k=0}^{n} \binom{n}{k} (-1)^{k} \, k! \, x^{n-k}.$$
By using the finite exponential (truncated exponential) function,
$$e_{n}(x) = \sum_{k=0}^{n} \frac{x^k}{k!},$$
then the first becomes
$$I_{n} = (-1)^{n} \, n! \, e^{x} \, e_{n}(-x).$$
The second can be placed in hypergeometric form as
$$I_{n} = x^{n} \, e^{x} \, {}_{2}F_{0}\left(-n, 1; --; \frac{1}{x}\right).$$
From this the formula
$$e_{n}(-x) = \frac{(-x)^{n}}{n!} \, {}_{2}F_{0}\left(-n, 1; --; \frac{1}{x}\right)$$
is obtained.
Answer: Let $$\int x^ne^x~\mathrm{d}x = p_n(x)e^x + C$$ for some polynomial $p_n(x)$, then from the integration by parts it follows that $p_n(x)=x^n-np_{n-1}(x)$, $n\ge 1$, and $p_0(x)=1$. Multiply both sides by $\dfrac{t^n}{n!}$ and sum over $n\ge 1$ to get
$$
\sum_{n\ge 1}{p_n(x)\frac{t^n}{n!}}=\sum_{n\ge 1}{x^n\frac{t^n}{n!}}-t\sum_{n\ge 1}{p_{n-1}(x)\frac{t^{n-1}}{(n-1)!}}.
$$
Let $P(x,t)=\displaystyle\sum_{n\ge 0}{p_n(x)\dfrac{t^n}{n!}}$, then $P(x,t)-1=(e^{xt}-1)-tP(x,t)$, i.e.
$$
P(x,t)=\frac{e^{xt}}{1+t}.
$$
It's easy to see that $\left[\dfrac{t^n}{n!}\right]e^{xt}=x^n$ and $\left[\dfrac{t^n}{n!}\right]\dfrac{1}{1+t}=(-1)^n n!$, so $p_n(x)$ is the exponential convolution of those sequences, i.e.
$$
p_n(x)=\sum_{k=0}^{n}\binom{n}{k}(-1)^{n-k}(n-k)!x^k=(-1)^n n!\sum_{k=0}^{n}(-1)^{k}\frac{x^k}{k!}.
$$


Rotate part of object

Question: Anyone know how I can rotate or flip the wings down?
Answer: To rotate an object, press the key 'r', and then press either 'x', 'y', or 'z' to get the rotation in a specific axis (This is not required. You can press 'r' and rotate freely.). The rotation will be based on the origin of the object, or the tiny yellow dot that shows up when you select it. In your case, if the origin is not at the base of the wing, follow these steps:

'Tab' to enter Edit Mode
Select the bottom face of the wing
Press 'Shift + S' and choose 'Cursor to selected'
Exit Edit Mode
Right click >> Set Origin >> Origin to 3D Cursor

Now, when you rotate in object mode, it should rotate and flip down.
Comment: Ok, but how would I remove the "clip" that keeps the wing up (in pic it's like a curved line) and how would I make it look like it hasn't been rotated and make it look seamless?
Answer: I would make the foldable part of the wing a separate object and move its origin to a vertice on the edge of the wing (select the vertice and "Shift+S"> "Move 3d cursor to selected") .
Then you can put the 3d cursor on the  corresponding vertice on the first half of the wing. Now in object mode, moving the foldable part to the 3D cursor with "Shift+S" > "Move selection to 3d cursor" will exactly alling those two vertices and if you choose them well the whole wing will be alligned as well. Now you can join the objects again. You can now "Merge by distance" to get rid of the seam completely.
Comment: Now I have realized that you can just select the foldable part and turn on vertice snapping. Its the magnet symbol on the top of the viewport window and you have to open the dropdown menu and select vertice snapping. now you can move the wing with "g" and try to allign them. I think that the vertice closest to your cursor upon pressing g is the one it tries to snap to. This method usually takes a few tries because it can be a bit unpredictable tho.

Rotate part of object


Ubuntu Server 22.04 Autoinstall and Cloud-Init Not Executing Commands

Question: I am trying to set up an Ubuntu Server 22.04 installation using autoinstall and cloud-init. I have two USB keys (I followed this tutorial https://www.jimangel.io/posts/automate-ubuntu-22-04-lts-bare-metal/):

One with an ISO image of Ubuntu Server 22.04 with autoinstall enabled.
The second one contains two YAML files: meta-data (empty file) and user-data.

When I try to install the new setup on a machine, ubuntu gets installed, the user is created but when the computer reboots, none of the packages (see user-data) seem to be installed. Even simple tests like creating a directory using runcmd do not persist.
Debugging Attempts
Checked cloud-init logs at /var/log/cloud-init.log and /var/log/cloud-init-output.log but did not find any relevant errors or warnings.
Tried simplifying the user-data file to just create a directory, but it did not work.
I'd appreciate any pointers to debug and resolve this issue.
Here is my user-data file:
#cloud-config
package_update: true
package_upgrade: true

autoinstall:
  version: 1
  locale: en_US
  keyboard:
    layout: fr
  identity:
    hostname: user
    username: user
    password: "$6$xyz$waX2p...."
  ssh:
    install-server: true
  packages:
    - openssh-server
  package_upgrade: true
  late-commands:
    - shutdown -h now
runcmd:
  - apt install -y curl autossh unzip
  - apt install -y docker.io
  - systemctl start docker
  - systemctl enable docker
  - mkdir /home/bob

Answer: The answer was to include the runcmd within the autoinstall, like that:
package_update: true
package_upgrade: true

autoinstall:
  version: 1
  locale: en_US
  keyboard:
    layout: fr
  identity:
    hostname: user
    username: user
    password: "$6$xyz$waX2p...."
  ssh:
    install-server: true
  packages:
    - openssh-server
  package_upgrade: true
  late-commands:
    - shutdown -h now
  runcmd:
    - apt install -y curl


Is there a way to invoke a function when error occurs in lightning-record-edit-form in LWC

Question: I would like to know if I can set a handler function so that it will be invoked when errors occur while submitting a record-edit-form in LWC. By errors I mean, required field errors. 'onerror' event is not working.
Answer: From the documentation there is a custom  event named error that is emited upon failure.
https://developer.salesforce.com/docs/component-library/bundle/lightning:recordEditForm/example
For including the error message just add lightning-messages immediately before or after the lightning-edit-form
You can also override and manually capture it .
In your submit button add an attribute onerror and call a method handleError
<lightning-button variant="brand" type="submit" name="save" label="Create Account" onerror={handleError}> </lightning-button>

have not tested it , try using the below
handleError(event) {
     console.log(JSON.stringify(event.detail))
 }

Comment: Hi Mohith, I am not getting any call back to handleError() function.


Leonin of the Lost Pride and undying creature

Question: How would Leonin of the Lost Pride interact with an opponents creature who has undying? The player with the undying creature sacrificed it and he also had out Dictate of Erebos, which when the undying creature died player 1 sacrificed the Leonin. Does the Leonin trigger prior to the undying creature coming back?
Comment: Hi! Welcome to B&CG. Whose turn it is when this happens?
Answer: Your opponent can control what happens, i.e. whether or not you can exile his undying creature before he can return it.
When the undying creature dies, both Dictate of Erebos and Undying trigger at the same time. Since your opponent controls both abilities, he can choose the order in which they go on the stack. Your Leonin is still alive at this point, since it only dies when Dictate actually resolves.

603.3b If multiple abilities have triggered since the last time a player received priority, each player, in APNAP order, puts triggered abilities they control on the stack in any order they choose. [..]

If your opponent puts the Undying trigger on the stack first, and the Dictate trigger second, i.e. on top, the Dictate trigger resolves first. You sacrifice the Leonin, which triggers its own death trigger, which becomes the topmost object on the stack. You can choose to target the undying creature in the graveyard and exile it. Finally the Undying trigger resolves, but the undying creature card is no longer in the graveyard and nothing happens.
If your opponent puts the Dictate trigger first, and the Undying trigger on top, the undying trigger resolves first and that creature will return. Then the Dictate resolves, you have to sacrifice a creature. If you sacrifice the Leonin, its ability will trigger, but you can no longer exile the Undying creature because it already returned to the battlefield.


Pansharpening Landsat 8 16 bit raster images

Question: Situation:
I have merged six Landsat 8 image tiles to one big tile for the bands 4,3 and 2. These are Landsat level 2 products, so already corrected to surface reflectance and need no further processing.
I have separately downloaded six band 8 image tiles for the same region. They are of a different date.merged those to one tile too.
All the raster images are 16 bit.
What options do I have to perform pansharpening on the 432 band combination?
Grass Gis apparently only takes 8 bit.
Semiautomatic classifications plugin in QGIS requires a metadata file. Of course no one single metadata file applies once the tiles are merged to one. Also, the band 8 is of a different date than the other bands.
please advise.
Comment: It is not valid to pansharpen floating point (reflectance) using 16-bit data. It is also extremely difficult to correct the pan band to reflectance. The correct workflow would be to use a pansharpening statistic that, more or less, retains the spectral fidelity, operating on the 16-bid data, and then apply the reflectance (TOA) correction. Convolution methods are best for retaining spectral fidelity whereas, PCA methods introduce considerable bias.
Comment: Many thanks. Two additional questions in this context:   1.) Is it possible to pansharpen a big raster that has been stiched together from 6 individual landsat tiles?    2.) Must I pansharpen the three input bands individually before I make virtual raster catalogue or can I apply the pansharpen to the output of the virtual raster catalogue (RGB image)?
Answer: Since you have QGIS you'll have access to Python and the various GDAL tools and scripts. As of GDAL 2.1 there is a pansharpening Python script available called gdal_pansharpen.py. If you don't have it already it is avaliable here. You can view the arguments and their descriptions at the official documentation page along with several examples. Additionally, the script is used in this article from Planet.
Another option is Orfeo Toolbox which is an open-source remote sensing toolbox. It contains various tools that can be used from the command line and through QGIS. OTB has its own pansharpening tool which is documented in the OTB CookBook. OTB setup for QGIS is covered here.
Answer: Here is nice blog post on pan-sharpening Landsat 8 OLI satellite data in GRASS GIS a productive opensource GIS software.
Alternatively, you may use SAGA GIS wherein multiple options are included to pansharpen data with ease.

These tools can be accessed within QGIS facilitating Pansharpening Landsat data. It is highly recommended to use bands from same acquisition dates to get optimal results regardless of whatever techniques is applied. Otherwise, it is usually necessary to apply a sun elevation correction and an earth–sun distance correction i.e. radiometric correction to input data to compensate changes in scene illumination, atmospheric conditions, viewing geometry, and instrument response characteristics etc.


How do I remove the head of this turn tap?

Question: I believe this is called a turn tap. I need to replace the washer due to it dripping, however I've not had much luck removing the head. My thought was that the blue plastic piece would pop off to reveal a screw, but I've not been able to prise it off, and there's not even enough clearance to get a screwdriver under it. How do I remove this type of tap head to replace the washer?
Comment: Hello, and welcome to Home Improvement. If there isn't a hex hole at the back of the lever, then that blue cap must be covering the fastener.
Comment: use a small mirror to examine all sides of the handle
Comment: Is there any non-destructive method to remove it? I guess I'm just going to have to break the plastic if it won't pop out and then try to source another cap from somewhere.
Answer:
My first guess is that there is a set screw under that blue cover. If not look carefully under the handle as indicated or on the back of the handle.
Answer: I got mine out with a strong kitchen knife screw was under the blue plastic
Comment: Welcome to [diy.se]. Please take a moment to take the [tour], you'll get a good feel for how this place is a bit different than most general discussion forums. (You'll also get a _free badge!_ redeemable for absolutely nothing, but it'll make you smile and feel better!) You'll also see that one-liner answers are _generally_ discouraged. There's nothing inherently _wrong_ with your answer, but we do generally look for a bit more "meat" in an answer.


Google cloud. NVIDIA T4 was available for days but not available for last 72+ hours

Question: I used to use NVIDIA GPU T4 in Google Cloud zone europe-central2-b before, but now it is not available since about 4 days ago. Is that normal for such a long time, or does it happen that google removes GPU's? I have already transferred my disk from other region where NVIDIA became unavailable long term and moving data to other region costs money. I would like to avoid that. So if GPU is not available for 4 day, should I keep trying or should I give up?
Comment: See https://cloud.google.com/compute/docs/troubleshooting/troubleshooting-resource-availability  but the generic recommendation is *"try in a different zone"*. I can only assume but it is a safe bet that with the ongoing AI hype supply simply can't keep up with demand and even GCP can be temporarily sold-out.
Comment: Despite the fact Google sponsors and/or [links](https://cloud.google.com/support/docs/stackexchange) to ServerFault, it is **not Google** support. The ServerFault community can only help with [on-topic questions](https://serverfault.com/help/on-topic) but can't resolve capacity issues, billing issues, [outages](https://status.cloud.google.com/) and similar problems. When you do have [a paid support plan](https://cloud.google.com/support) maybe ask your questions there: https://cloud.google.com/support/docs/manage-cases and they can give you an insider perspective.
Comment: When you are using the GPU, what is the error message that you are having?
Comment: Thanks for responses. I was not asking for the solution, rather about the experience, how long I should wait before giving up. The error I am getting is standard  capacity issue: "The zone 'projects/.../zones/europe-central2-b' does not
  have enough resources available to fulfill the request.  Try a different zone, or
  try again later." But I am not going to migrate to other zone every few days, its expensive. Does anyone know is AWS has similar capacity issues? I have read that never,
Comment: In GCP I have seen this a number of times, in different zones/regions, and with regards to different instance types. I have never seen anything like that with AWS, with which I worked many years. I don't know if there is any max. duration this may last. Probably the most "GCP way" to go about it is to be prepared and switch to another region when this happens. Not an ideal situation, and probably a bit of a surprise, in particular if one comes from AWS or Azure background.
Answer: If you have a designated person that processes your account, you may contact them for faster reservation. The other way is you can create reservations on the console to reserve resources that are needed for your workloads. In this way, you can mitigate transferring to another zone/region.
To verify your issue, you can check your logging with error message ZONE\_RESOURCE\_POOL\_EXHAUSTED that indicates the resources you request is currently not available on the zone or region.
Additionally, you may read this thread regarding resources that are not available on a certain region/zone.


Percentage of flight cancellations with Air Canada

Question: Is there a source to look up the percentage of flight cancellations with Air Canada? I am interested to compare this data with my own experience: On a long-distance trip with four Air Canada flights two were cancelled.
Comment: What were the flights, on what dates, and what were the reasons given for the cancellations, if any? When did you learn of the cancellations?
Answer: OAG has reports of on-time departure rates and cancellation rates by airline and month. For instance, see May 2023, which lists Air Canada as cancelling 1.4% of its flights.
Incidentally, cancellation rates will vary by route and by day of week, possibly more than by airline.
Answer: Cancellation rates are not constant over longer periods: cancellations tend to happen in groups.

Any large scale disruption (due to storms, snow, ice, heavy rain, high winds, volcanoes, strikes…) will affect many flights in a short period, while over a period of the same duration a month before or after the rate could be a lot smaller
Even small local disruptions (an issue with a plane, crew being ill or unavailable for any other reason, a local problem at an airport…) can affect several flights in a row and have knock-on effects for a few days (as you end up with planes and crew not in the right places at the right times).
Busy periods can result in small problems having larger consequences, because there is less "buffer" (less spare aircraft and reserve crew available compared to the requirements).

So you could book 100 flights one month and the same 100 flights a month later and have completely different results.
In any case, 4 flights is definitely not a representative sample, especially if flights are somehow linked (the same aircraft or crew would have served two or more flights) or there is a large scale disruption around (severe weather events).
If you want to take this further, you could book a single flight, and then you would have either 0% or 100% cancellation rate. As you can see, neither is representative.
Answer: While these statistics are relatively easy to come by for US airlines (and some other countries), I couldn't find anything specific to Air Canada.
Typically, cancellation rates are somewhere between 2% and 5%. There is a very good chance that Air Canada's cancellation rate sits in this range as well. Your 50% rate is an outlier and just bad luck. Cancellations are expensive for the airlines so there is a good incentive for them to minimize cancelled flights.
It's also not clear what the goal of your question is? What would you do differently if AC average rate was 0.5% or 10% ?
Comment: Thank you. Well, knowing the average would tell me whether to choose another airline next time, e g Icelandair.


Crimes commited in foreign country with capital punishment

Question: So the death penalty does not exist in the UK, and correct me if I'm wrong, but I beleive our laws also state that a person may not be extradited for prosecution if the conviction of the crime will result in the death penalty under the foreign country's laws. So considering the above, what would happen to a person who commited a serious crime that would result in death penalty in the foreign country, and is also a serious crime here in the uk (murder, sexual assult), could they be prosecuted and imprisoned in the uk, following uk laws?
Answer: Genocide, crimes against humanity and war crimes can be prosecuted in the UK no matter who did it or where. Murder and rape are not included in the Universal Jurisdiction offenses. There are some other crimes that can be extraterritorially prosecuted (see here) covering bribery, money laundering, tax evasion, circumvention of trade restrictions, but this does not include murder or rape.
Therefore if, for example, Jones is accused of murder in Texas, the Texas prosecutor must give assurances that the death penalty will not be sought. If he won't give such assurances, Jones cannot be extradited from the UK, and he also cannot be prosecuted in the UK for that crime.
Comment: Mainly because Parliament has not passed such a law. The usual rule of law is that you prosecute for crimes committed within the jurisdiction, and it is a special exception to prosecute for crimes committed in another jurisdiction. One class of exceptions is citizens of X being prosecuted for specific crimes in a foreign country (such as sex with a child, which laws are intended to discourage child sex tourism). Perhaps if a person is *not* extradited for murder and subsequently commits the same crime in the UK, that will change. Apostacy is considered a serious crime in some countries.
Comment: OK that's helpful, this does raise another question for me though. Why if, for whatever reason, this person cannot be extradited, won't they prosecuted? If certain crimes, depending on seriousness, can be prosecuted extraterritorially, why does that not include murder or rape, which I, and most people, would consider far more serious than bribery, money laundering and tax evasion.
Comment: Also, just to clarify, these exceptions only apply to the use of extraterritorial prosecution? The UK will still under no circumstances extradite someone if the death penalty is a possibility, no matter how serious a crime is alledged?
Comment: Yes, extradition with the possibility of the death penalty is forbidden, regardless of the crime.


Upgrade gear ratio

Question: I have a triple chainset 50*39*30*,and 9speed cassette.Could I upgrade these to a 52*chainset and a 10speed cassette,without changing the chain or derailleur.TIA
Comment: If you go from 9 speed to 10 speed you have to change the rear shifter.
Answer: 52 tooth chainring, no problem but the difference is kind of small and not necessarily worth the trouble.
10 speed cassette, for road bikes the same derailleur works but you need narrower chain and shifter with 10 speed indexing.

Upgrade gear ratio


Is it possible to install Active Directory on a machine that already has sharepoint installed?

Question: All the links I've read say the correct way is to have Active Directory installed before Sharepoint. But currently I have a machine running sharepoint and need to install active directory on it, is it possible? Has anyone done it? Any tips or links?
Answer: I am going to have a guess here and say yes it can work if you install Active Directory without enabling Domain Controller, so if you don't change SharePoint's server domain, it won't affect SharePoint. If it's a virtual machine you can just have a snapshot and try it and see what happens.
(That's just a guess, never tried it out. If am wrong please, someone correct me).
Comment: I'll try it with and without and report back
Comment: if you try it "with", it's going to join SharePoint's server on a new domain, it will break things, it's like migrating SharePoint's environment to new domain. But without I guess won't affect anything. Let me know what happens!
Comment: Using the standard installation wizard and following this guide http://www.howtogeek.com/99323/installing-active-directory-on-server-2008-r2/ then since the sharepoint is on the same machine as the DNS and AD I went and configured an Alternate Access Mapping (which seemed to remove all the ones that were configured before the AD was  installed, I don't mind that for now) to point port 90 of sharepoint to this own machine, now on the other machines in the network all I had to do was change the Domain of the computers and changed the DNS to point to the new DNS inside the AD+Sharepoint machine.


Which SQL Server component is in charge with checking cached execution plans for a given query?

Question: I understand that whenever SQL server receives a query it looks in the cache plan for any matching execution plans for that query. However, most of the resources that I encountered  don't specify which component is in charge of this lookup. This article suggests that it's the Buffer Manager, but I failed to find any evidence for this in Microsoft's Query processing architecture guide. On the other hand, the speaker in this presentation (around 42:43) seems to suggest that it's the Cmd Parser. So, which one is it?
Answer: Ref: Optimize SELECT statements

The input to the Query Optimizer consists of the query, the database
schema (table and index definitions), and the database statistics. The
output of the Query Optimizer is a query execution plan, sometimes
referred to as a query plan or execution plan.

From the above-quoted text, Query Optimzer's job is to create the execution plan. Hence you can infer that Query Optimizer will check the plan cache for the existence of a plan for the same query hash.