Booming Blade or Green Flame Blade: Utility against creatures with immunity to non-magical damage?

Both Booming Blade and Green Flame Blade have the following text:

You make a single melee weapon attack against a creature you can see within the spell’s range. If the attack hits…

Reading this question makes me believe that a weapon which has been magically enchanted or enhanced, even temporarily, would overcome this immunity, and that both base weapon damage and cantrip damage would apply on a hit (and double on a critical hit).

Question: What damage, if any, would be generated by attacking a creature (with immunity to damage from non-magical weapons) with a non-magical weapon as part of a Booming Blade or Green Flame Blade attack?

How to apply the utility Packages for Numerical Differential Equation Solving

I have solved two coupled equations with {Solf, Solg} = NDSolveValue[eqns, {f, g}, {x, 0, L}, {t, 0, tmax}] and want to extract the computational grid {x,t} with InterpolatingFunctionDomain and InterpolatingFunctionGrid to observe the spatial mesh and to plot the time steps. In addition, sometimes it cannot compute a solution over the full time-interval that I specified, so I want to plot the solution that was computed in order to understand what might have gone wrong.

By reading the document, I know how to do this when using NDSolve to solve a single equation for h[x,t]. For example,

hSol = First[h/.NDSolve[eqn, f, {x, 0, L}, {t, 0, tmax}]]  hGrid = InterpolatingFunctionGrid[hSol]  Dimensions[hGrid] (*determine mesh points in each dimension*)  {Tini, Tfinal} = InterpolatingFunctionDomain[hSol][[2]] (*extract the time interval*)  tList = hGrid[[mesh-position, All, 2]]; (*here the 'mesh-position' can be chosen according to the output of Dimensions[hGrid]*) 

Then we can plot the time steps at the mesh-position using

ListLogPlot[tList, PlotRange -> All, Frame -> True, FrameLabel -> {"step", "t"}] 

But I cannot extend these to the case in which I used NDSolveValue to solve two coupled equations for f[x,t] and g[x,t], as mentioned above. For example, using hGrid = InterpolatingFunctionGrid[Solf] and Dimensions[hGrid] I obtained {1}, which was clearly wrong and should be in the form of {number-of-space-mesh, number-of-time-step, 2}.

I think the problem results form the structure of the output of {Solf, Solg} = NDSolveValue[...]. In this case the output is in this form: {InterpolatingFunction[{{0.,L},{0.,tmax}},<>],InterpolatingFunction[{{0.,L},{0.,tmax}},<>]}. Please help.

Here is an example from the document of NDSolveValue:

pde={\!\( \*SubscriptBox[\(\[PartialD]\), \(t\)]\(u[t, x]\)\)==\!\( \*SubscriptBox[\(\[PartialD]\), \(x\)]\((\((v[t, x] - 1)\)\  \*SubscriptBox[\(\[PartialD]\), \(x\)]u[t, x])\)\)+(16 x t-2 t-16 (v[t,x]-1)) (u[t,x]-1)+10 x E^(-4 x),\!\( \*SubscriptBox[\(\[PartialD]\), \(t\)]\(v[t, x]\)\)==\!\( \*SubscriptBox[\(\[PartialD]\), \({x, 2}\)]\(v[t, x]\)\)+\!\( \*SubscriptBox[\(\[PartialD]\), \(x\)]\(u[t, x]\)\)+4 u[t,x]-4+x^2-2 t-10 t E^(-4 x)};  bc={u[0,x]==1,v[0,x]==1,u[t,0]==1,v[t,0]==1,3 u[t,1]+(u^(0,1))[t,1]==3,5 (v^(0,1))[t,1]==E^4 (u[t,1]-1)};  {usol, vsol} = NDSolveValue[{pde, bc}, {u, v}, {x, 0, 1}, {t, 0, 2}] 

Ubuntu keeps on rebooting after enabling TPM 2.0 from BIOS (APTIO utility)

I am having Ubuntu 18.04 LTS installed on to my system. I wanted to implement TPM functionalities. I enabled TPM 2.0 from Trusted Computing option in the BIOS. After this when I rebooted my system, the OS didn’t start. Rather it keeps on rebooting after the American Megatrends screen comes.

The system is stuck in this loop until I disable TPM from the BIOS again.

Really want help to solve this issue.

Stopwatch utility class in Java

Looking for input on my code for a Stopwatch utility written in Java.

/**  * File: Stopwatch.java  */ package org.me.mystuff;  import java.util.concurrent.TimeUnit;  public class Stopwatch {     /**      * The start timestamp, as determined by a call to {@code System.nanoTime}.      */     private long start;      /**      * The total elapsed time recorded so far in nanoseconds (raw value).      */     private long elapsed;      /**      * Whether or not the stopwatch is running.      */     private boolean running;      /**      * Constructs a new {@code Stopwatch} instance.      */     public Stopwatch() {         reset();     }      /**      * Stops time interval measurement, resets the elapsed time to zero, and      * starts measuring time again.      *       * <p>      * This is a convenience method equivalent to calling {@code reset} followed      * by {@code start}.      */     public void restart() {         reset();         start();     }      /**      * Stops time interval measurement and resets the elapsed time value to      * zero.      */     public void reset() {         running = false;         start = 0;         elapsed = 0;     }      /**      * Initializes a new {@code Stopwatch} instance, sets the elapsed time value      * to zero, and starts measuring elapsed time.      *       * @return a running {@code Stopwatch} instance      */     public static Stopwatch startNew() {         final var s = new Stopwatch();         s.start();         return s;     }      /**      * Starts, or resumes, measuring elapsed time for an interval.      */     public void start() {         // Calling start() on a running stopwatch is a no-op.         if (!isRunning()) {             running = true;             start = start <= 0 ? System.nanoTime() : System.nanoTime() - elapsed;         }     }      /**      * Stops measuring elapsed time for an interval.      */     public void stop() {         // Calling stop() on a stopped stopwatch is a no-op.         if (isRunning()) {             elapsed = System.nanoTime() - start;             running = false;         }     }      /**      * Returns the elapsed time measured so far by this stopwatch in the      * specified {@code TimeUnit}.      *       * @param timeUnit      *            the desired time unit      * @return the duration in the specified time unit      */     public double elapsed(TimeUnit timeUnit) {         // If the stopwatch is running, compute and return the current timestamp.         // Otherwise, just return the timestamp as of the last call to stop().         final long duration = isRunning() ? System.nanoTime() - start : elapsed;         return UnitConverter.convert(duration, timeUnit);     }      /**      * Returns {@code true} if the stopwatch is currently running.      *       * @return {@code true} if this stopwatch is running      */     public boolean isRunning() {         return running;     }      /**      * Returns a string representation of the elapsed time measured so far by      * this stopwatch, expressed in milliseconds using two decimal places.      *       * <p>      * Example: 1.2345 milliseconds would return a string equal to      * {@code "1.23 ms"}.      *       * <p>      * This is a convenience method that simplifies querying the stopwatch for      * reporting purposes.      */     @Override     public String toString() {     final double duration = elapsed(TimeUnit.MILLISECONDS);      final double rounded = Math.round(duration * 100d) / 100d;     return String.valueOf(rounded).concat(unit);     }      /**      * This class is an internal utility to supplement the stopwatch's unit      * conversion operations.      */     private static class UnitConverter {         /**          * The number of nanoseconds in a millisecond.          */         static final double NANOS_PER_MILLI = 1e6;          /**          * The number of nanoseconds in a second.          */         static final double NANOS_PER_SECOND = 1e9;          /**          * The number of nanoseconds in a minute.          */         static final double NANOS_PER_MINUTE = 6e10;          /**          * The number of nanoseconds in an hour.          */         static final double NANOS_PER_HOUR = 3.6e12;          /**          * Converts the specified nanosecond value to the specified time unit          * and returns the result.          *           * @param nanoTime          *            the value to convert (in nanoseconds)          * @param toUnit          *            the desired time unit          * @return the converted value          */         static double convert(long nanoTime, TimeUnit toUnit) {             switch (toUnit) {             case MILLISECONDS:                 return toMillis(nanoTime);             case SECONDS:                 return toSeconds(nanoTime);             case MINUTES:                 return toMinutes(nanoTime);             case HOURS:                 return toHours(nanoTime);             default:                 throw new IllegalArgumentException("no valid time unit specified");             }         }          static double toMillis(long nanos) {             return nanos / NANOS_PER_MILLI;         }          static double toSeconds(long nanos) {             return nanos / NANOS_PER_SECOND;         }          static double toMinutes(long nanos) {             return nanos / NANOS_PER_MINUTE;         }          static double toHours(long nanos) {             return nanos / NANOS_PER_HOUR;         }     } } 

The stopwatch uses System.nanoTime as its time source. In general it works similarly to the standard .NET version and is, as far as my unit tests go, correct. You can query it whether or not it is running, and it will give the most recent recorded value each time.

I am just curious to hear some thoughts on my code and suggestions for improvement, if any. It’s extremely lightweight so feel free to test it on your machine if you wish.

Create a new partition with disk utility

I’m running OS X 10.11.6 and I want to create a new partition on my disk (disk0).

Is there a way to first resize the disk to make some space and then add a new partition? When I boot from this disk I get an error message in disk utility. And when I use the Recovery Volume I cannot resize the “pie chart” in disk utility.

 $   diskutil list /dev/disk0 (internal, physical):    #:                       TYPE NAME                    SIZE       IDENTIFIER    0:      GUID_partition_scheme                        *256.1 GB   disk0    1:                        EFI EFI                     209.7 MB   disk0s1    2:          Apple_CoreStorage Mac SSD                 255.1 GB   disk0s2    3:                 Apple_Boot Recovery HD             784.2 MB   disk0s3 /dev/disk1 (internal, virtual):    #:                       TYPE NAME                    SIZE       IDENTIFIER    0:                  Apple_HFS Mac SSD                +254.7 GB   disk1                                  Logical Volume on disk0s2                                  CC5EA835-07C6-4481-8114-493AD10988B7                                  Unlocked Encrypted  
 $   gpt -r show disk0 gpt show: disk0: Suspicious MBR at sector 0       start       size  index  contents           0          1         MBR           1          1         Pri GPT header           2         32         Pri GPT table          34          6                   40     409600      1  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B      409640  498176832      2  GPT part - 53746F72-6167-11AA-AA11-00306543ECAC   498586472    1531680      3  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC   500118152          7            500118159         32         Sec GPT table   500118191          1         Sec GPT header 

APFS on external drive missing from Disk Utility

When I use Disk Utility app in macOS Mojave to format an external drive, I do not see the new Apple File System (APFS) offered as a choice of format.

Does it matter that my external drive is a Toshiba Canvio® Advance Portable External Hard Drive plugged into a MacBook Pro Retina (late 2013) via USB-3 cable? I know APFS is optimized for solid-state storage, so does Disk Utility not offer it for a spinning-metal disk drive?

➥ Why is APFS not offered by Disk Utility?