问:
Set the origin of element to center instead of top left (jquery)
I have this marker (which is a simple div) inside the triangle:

The center of the marker should lie exactly in the centroid of the triangle.

As seen in the picture, it's not exactly in the centroid (it's a bit to the right, and possible to the bottom).

I'm using jquery ui .draggable method. Here is my css for the marker:

```<code>#marker {
  position: absolute;
  background: #808080;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  cursor: grab;
}
</code>```

And here's my jquery script:

```<code>$(document).ready(function () {
  var triangle = $("#triangle");
  var marker = $("#marker");
  var coord = getTriangleCoordinates(triangle);
  var center = centroid(coord);

  $("#marker").hover(
    function () {
      // over
      $(this).css("filter", "brightness(0.8)");
    },
    function () {
      // out
      $(this).css("filter", "brightness(1)");
    }
  );

  $("#marker").mouseup(function () {
    $(this).css("background", "salmon");
  });

  $("#marker").draggable({
    drag: function (event, ui) {
      var offset = ui.offset;
      if (!bounded(offset, coord)) return false;
    }
  });

  marker.css("left", Math.round(center.left) - 5 + "px");
  marker.css("top", Math.round(center.top) - 5 + "px");

  console.log(coord);
});
</code>```

How do I make the default position of the marker's center exactly in the centroid, while still being able to drag the marker?

I tried the transform: translate(-50%, 0)css property. Although it fixed the position, it messed up the dragging feature altogether.

Any help is appreciated. Thanks!!

答:
Your marker element has width 50px and height 50px.

Assuming your centroid function returns the correct result, you are then positioning the top left corner of the marker (remember, it is basically a square) at a mere 5px offset from the actual centroid.

It needs to be offset by half its width and height so that its central point is at the centroid.

So change this:

```<code>  marker.css("left", Math.round(center.left) - 5 + "px");
  marker.css("top", Math.round(center.top) - 5 + "px");
</code>```

To this:

```<code>  marker.css("left", Math.round(center.left) - 25 + "px");
  marker.css("top", Math.round(center.top) - 25 + "px");
</code>```

For a more general solution, if for example the dimensions of the marker might change with viewport size or something, you can set the top left to the centroid and then transform: translate(-50%, 50%). This will move the marker left and up by half its own width and height, whatever they are.

Body:
I have this marker (which is a simple div) inside the triangle:

The center of the marker should lie exactly in the centroid of the triangle.

As seen in the picture, it's not exactly in the centroid (it's a bit to the right, and possible to the bottom).

I'm using jquery ui .draggable method. Here is my css for the marker:

#marker {
  position: absolute;
  background: #808080;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  cursor: grab;
}

And here's my jquery script:

$(document).ready(function () {
  var triangle = $("#triangle");
  var marker = $("#marker");
  var coord = getTriangleCoordinates(triangle);
  var center = centroid(coord);

  $("#marker").hover(
    function () {
      // over
      $(this).css("filter", "brightness(0.8)");
    },
    function () {
      // out
      $(this).css("filter", "brightness(1)");
    }
  );

  $("#marker").mouseup(function () {
    $(this).css("background", "salmon");
  });

  $("#marker").draggable({
    drag: function (event, ui) {
      var offset = ui.offset;
      if (!bounded(offset, coord)) return false;
    }
  });

  marker.css("left", Math.round(center.left) - 5 + "px");
  marker.css("top", Math.round(center.top) - 5 + "px");

  console.log(coord);
});

How do I make the default position of the marker's center exactly in the centroid, while still being able to drag the marker?

I tried the transform: translate(-50%, 0)css property. Although it fixed the position, it messed up the dragging feature altogether.

Any help is appreciated. Thanks!!

Body:
Your marker element has width 50px and height 50px.

Assuming your centroid function returns the correct result, you are then positioning the top left corner of the marker (remember, it is basically a square) at a mere 5px offset from the actual centroid.

It needs to be offset by half its width and height so that its central point is at the centroid.

So change this:

  marker.css("left", Math.round(center.left) - 5 + "px");
  marker.css("top", Math.round(center.top) - 5 + "px");

To this:

  marker.css("left", Math.round(center.left) - 25 + "px");
  marker.css("top", Math.round(center.top) - 25 + "px");

For a more general solution, if for example the dimensions of the marker might change with viewport size or something, you can set the top left to the centroid and then transform: translate(-50%, 50%). This will move the marker left and up by half its own width and height, whatever they are.


来源: stackexchange

问:
Evaluating a postfix expression
This is a program to evaluate a post-fix expression using stack. Why in the 8th line we have pushed question[i]-'0' rather than just question[i]. I did not understand the role of 0.

stack<int> s;
int main(){
  string question;
  cin>>question;

  for(int i = 0 ; i < question.length() ; i++){
    if(isdigit(question[i]))
      s.push(question[i] - '0');
    else{
      int a = s.top();
      s.pop();
      int b = s.top();
      s.pop();

      if(question[i]=='+') s.push(a+b);
      else if(question[i]=='-') s.push(a-b);
      else if(question[i]=='*') s.push(a*b);
      else if(question[i]=='/') s.push(a/b);
    }
  }
  cout<<"Converting to infix and solving we get : "<<s.top();
  return 0;
}
```

答:
'0' is a character literal.

So when you wrote:

```<code>s.push(question[i] - '0');
</code>```

The fundamental reason why/how question[i] - '0' works is through promotion.
In particular,

both question[i] and '0' will be promoted to int. And the final result that is pushed onto the stack named s will be the result of subtraction of those two promoted int values.

Also note that the C++ Standard (2.3 Character sets) guarantees that:

...In both the source and execution basic character sets, the value of
each character after 0 in the above list of decimal digits shall be
one greater than the value of the previous.

For example, say we have:

```<code>std::string question = "123";
int a = question[0] - '0'; //the result of question[0] - '0' is guaranteed to be the integer 1
int b = question[1] - '0'; //the result of question[1] - '0' is guaranteed to be the integer 2
int c = question[2] - '0'; //the result of question[2] - '0' is guaranteed to be the integer 3
</code>```

Lets consider the statement int a = question[0] - '0';:

Here both question[0] and 0 will be promoted to int. And the final result that is used to initialize variable a on the left hand side will be the result of subtraction of those two promoted int values on the right hand side. Moreover, the result is guaranteed to be the integer 1.

Similarly, for statement int b = question[1] - '0';:

Here both question[1] and 0 will be promoted to int. And the final result that is used to initialize variable b on the left hand side will be the result of subtraction of those two promoted int values on the right hand side. Moreover, the result is guaranteed to be the integer 2.

And similarly for variable c.

ContentLicense: CC BY-SA 4.0

Title: Evaluating a postfix expression

Body:
'0' is a character literal.

So when you wrote:

s.push(question[i] - '0');

The fundamental reason why/how question[i] - '0' works is through promotion.
In particular,

both question[i] and '0' will be promoted to int. And the final result that is pushed onto the stack named s will be the result of subtraction of those two promoted int values.

Also note that the C++ Standard (2.3 Character sets) guarantees that:

...In both the source and execution basic character sets, the value of
each character after 0 in the above list of decimal digits shall be
one greater than the value of the previous.

For example, say we have:

std::string question = "123";
int a = question[0] - '0'; //the result of question[0] - '0' is guaranteed to be the integer 1
int b = question[1] - '0'; //the result of question[1] - '0' is guaranteed to be the integer 2
int c = question[2] - '0'; //the result of question[2] - '0' is guaranteed to be the integer 3

Lets consider the statement int a = question[0] - '0';:

Here both question[0] and 0 will be promoted to int. And the final result that is used to initialize variable a on the left hand side will be the result of subtraction of those two promoted int values on the right hand side. Moreover, the result is guaranteed to be the integer 1.

Similarly, for statement int b = question[1] - '0';:

Here both question[1] and 0 will be promoted to int. And the final result that is used to initialize variable b on the left hand side will be the result of subtraction of those two promoted int values on the right hand side. Moreover, the result is guaranteed to be the integer 2.

And similarly for variable c.


问:
Tabpage that opens by menustrip button, but closes by the image on the tabpage header
I have the main form where there's tabcontrol and menustrip. In menustrip there are few buttons that should open the tabpages in tabcontrol with defined name and the perspective to fill in it with own content. But the function of closing the tabpage should be also present. My idea is not usage of distinct button, but a usage of special button on the tabpage header. Obviously, it would be some picture with cross imaged on it.

I used the property of tabcontrol DrawMode=OwnerDrawFixed. There's no picture in the header of tabpage in spite of the directory and name of file are correct. It is situated in the folder wherein exe file exists. Also there's no label in the header whilst the width of header witnesses that the text is present but invisible.

```<code>public partial class Core : Form
{
    private string closeButtonFullPath = "button-close.png";

    public Core()
    {
        InitializeComponent();
    }

     //  Do not forget this namespace or else DllImport won't work
    [DllImport("user32.dll")]
    private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wp, IntPtr lp);
    private const int TCM_SETMINTABWIDTH = 0x1300 + 49;
    private void tabControl1_HandleCreated(object sender, EventArgs e)
    {
        SendMessage(this.tabControl1.Handle, TCM_SETMINTABWIDTH, IntPtr.Zero, (IntPtr)16);
    }

    private void tabControl_DrawItem(object sender, DrawItemEventArgs e)
    {
        try
        {
            var tabPage = this.tabControl1.TabPages[e.Index];
            var tabRect = this.tabControl1.GetTabRect(e.Index);
            tabRect.Inflate(-2, -2);
            var closeImage = new Bitmap(closeButtonFullPath);
            e.Graphics.DrawImage(closeImage,
                (tabRect.Right - closeImage.Width),
                tabRect.Top + (tabRect.Height - closeImage.Height) / 2);
            TextRenderer.DrawText(e.Graphics, tabPage.Text, tabPage.Font,
                tabRect, tabPage.ForeColor, TextFormatFlags.Left);
        }
        catch (Exception ex) { throw new Exception(ex.Message); }
    }

    private void списокПерсонToolStripMenuItem_Click(object sender, EventArgs e)
    {
        string texttab = "Список персон";

        TabPage ListPersons = new TabPage(texttab);
        tabControl1.TabPages.Add(ListPersons);
    }

    private void списокОрганізаційToolStripMenuItem_Click(object sender, EventArgs e)
    {
        TabPage tp = new TabPage();
        tp.Name = "Tab_OrganizationList";
        tabControl1.TabPages.Add(tp);
    }

    private void tabControl1_MouseDown(object sender, MouseEventArgs e)
    {
        for (var i = 0; i < this.tabControl1.TabPages.Count - 1; i++)
        {
            var tabRect = this.tabControl1.GetTabRect(i);
            tabRect.Inflate(-2, -2);
            var closeImage = new Bitmap(closeButtonFullPath);
            var imageRect = new Rectangle(
                (tabRect.Right - closeImage.Width),
                tabRect.Top + (tabRect.Height - closeImage.Height) / 2,
                closeImage.Width,
                closeImage.Height);
            if (imageRect.Contains(e.Location))
            {
                this.tabControl1.TabPages.RemoveAt(i);
                break;
            }
        }
    }
}
</code>```

答:
What you are describing is not TabPage functionality, but Window Docking / MDI.

Where each Document (Page) is actually a separate form instance which can be closed, hidden, etc.

This is a guide for simple MDI window creation
https://www.c-sharpcorner.com/UploadFile/84c85b/building-mdi-winforms-application-using-C-Sharp/

If you want docking and more advance features then you need to use a 3PP library.  I suggest to check these out:

https://github.com/dockpanelsuite/dockpanelsuite

https://github.com/ComponentFactory/Krypton

Body:
I have the main form where there's tabcontrol and menustrip. In menustrip there are few buttons that should open the tabpages in tabcontrol with defined name and the perspective to fill in it with own content. But the function of closing the tabpage should be also present. My idea is not usage of distinct button, but a usage of special button on the tabpage header. Obviously, it would be some picture with cross imaged on it.

I used the property of tabcontrol DrawMode=OwnerDrawFixed. There's no picture in the header of tabpage in spite of the directory and name of file are correct. It is situated in the folder wherein exe file exists. Also there's no label in the header whilst the width of header witnesses that the text is present but invisible.

public partial class Core : Form
{
    private string closeButtonFullPath = "button-close.png";

    public Core()
    {
        InitializeComponent();
    }

     //  Do not forget this namespace or else DllImport won't work
    [DllImport("user32.dll")]
    private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wp, IntPtr lp);
    private const int TCM_SETMINTABWIDTH = 0x1300 + 49;
    private void tabControl1_HandleCreated(object sender, EventArgs e)
    {
        SendMessage(this.tabControl1.Handle, TCM_SETMINTABWIDTH, IntPtr.Zero, (IntPtr)16);
    }

    private void tabControl_DrawItem(object sender, DrawItemEventArgs e)
    {
        try
        {
            var tabPage = this.tabControl1.TabPages[e.Index];
            var tabRect = this.tabControl1.GetTabRect(e.Index);
            tabRect.Inflate(-2, -2);
            var closeImage = new Bitmap(closeButtonFullPath);
            e.Graphics.DrawImage(closeImage,
                (tabRect.Right - closeImage.Width),
                tabRect.Top + (tabRect.Height - closeImage.Height) / 2);
            TextRenderer.DrawText(e.Graphics, tabPage.Text, tabPage.Font,
                tabRect, tabPage.ForeColor, TextFormatFlags.Left);
        }
        catch (Exception ex) { throw new Exception(ex.Message); }
    }

    private void списокПерсонToolStripMenuItem_Click(object sender, EventArgs e)
    {
        string texttab = "Список персон";

        TabPage ListPersons = new TabPage(texttab);
        tabControl1.TabPages.Add(ListPersons);
    }

    private void списокОрганізаційToolStripMenuItem_Click(object sender, EventArgs e)
    {
        TabPage tp = new TabPage();
        tp.Name = "Tab_OrganizationList";
        tabControl1.TabPages.Add(tp);
    }

    private void tabControl1_MouseDown(object sender, MouseEventArgs e)
    {
        for (var i = 0; i < this.tabControl1.TabPages.Count - 1; i++)
        {
            var tabRect = this.tabControl1.GetTabRect(i);
            tabRect.Inflate(-2, -2);
            var closeImage = new Bitmap(closeButtonFullPath);
            var imageRect = new Rectangle(
                (tabRect.Right - closeImage.Width),
                tabRect.Top + (tabRect.Height - closeImage.Height) / 2,
                closeImage.Width,
                closeImage.Height);
            if (imageRect.Contains(e.Location))
            {
                this.tabControl1.TabPages.RemoveAt(i);
                break;
            }
        }
    }
}


问:
ModuleNotFoundError: No module named 'kivymd_extensions.sweetalert'
I am attempting to create an apk with Kivymd using googlecolab. I am following the official instructions from Kivymd. But my apk was crashed.This is my logcat Error ModuleNotFoundError: No module named 'kivymd_extensions.sweetalert' .

requirements = python3,kivy==2.0.0,https://github.com/kivymd/KivyMD/archive/master.zip,pygments,sdl2_ttf==2.0.15,pillow,openssl,sqlite3,kivymd_extensions.sweetalert

答:
There are some modules which are not easy to install in the buildozer file.
in my experience as i have use sweetalert in a project and it worked, i needed to change some variables of the kivymd_extensions widgets so included the entire kivymd_extensions folder in my project folder hence i didn't have to include in my buildozer file cuz my project ran with the version in the project folder. the kivymd_extensions folder you are adding to your project folder make sure it has the sweetalert folder in it

and the following code to import
from kivymd_extensions.sweetalert import SweetAlert


问:
EF Core Property B should be NOT ISNULL(A)
I am using EF Core 6 and have the following question.

In my EF model "MyModel", I have a property.

```<code>public byte[] Thumbnail { get; set; }
</code>```

These thumbnails can have some MB of data. So, I don't load them at the beginning.
I now want an additional EF property in "MyModel".

```<code>// Should be sql equivalent NOT ISNULL(Thumbnail)
public bool HasThumbnail { get; set; }
</code>```

That's needed because

```<code>// means not loaded yet OR no data at all
if(myModel.Thumbnail == null)
{
}
</code>```

I know, that I can achieve this by using

```<code>context.MyModel.Select(...)
</code>```

and map my HasThumbnail property in code.

But is there a way to tell the EF ModelBuilder this behaviour so that it works on the fly?

答:
One solution could be Computed Column

public class MyModel {
  public byte[] Thumbnail { get; set; }
  public bool HasThumbnail { get; set; }
}

...

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
    modelBuilder.Entity<MyModel>()
    .Property(e => e.HasThumbnail)
    .HasComputedColumnSql("NOT ISNULL(Thumbnail)");
}
```

Please note that maybe you should refactor MyModel to two tables, MyModel and MyModelThumbnailBinary with one-to-one FK.

Right now you have to use projection for EVERY query for MyModel - you really dont want to accidentally include your Thumbnail to selection (which can wreak havoc on RAM). And lets face it, accidentaldata.MyModelSet.Where(d => d.Date == DateTime.Now.Date).ToArray(); /* ups, i just loaded n*'some MB of data' :( */ is gonna happen sooner or later.

Body:
I am using EF Core 6 and have the following question.

In my EF model "MyModel", I have a property.

public byte[] Thumbnail { get; set; }

These thumbnails can have some MB of data. So, I don't load them at the beginning.
I now want an additional EF property in "MyModel".

// Should be sql equivalent NOT ISNULL(Thumbnail)
public bool HasThumbnail { get; set; }

That's needed because

// means not loaded yet OR no data at all
if(myModel.Thumbnail == null)
{
}

I know, that I can achieve this by using

context.MyModel.Select(...)

and map my HasThumbnail property in code.

But is there a way to tell the EF ModelBuilder this behaviour so that it works on the fly?

Body:
One solution could be Computed Column

public class MyModel {
  public byte[] Thumbnail { get; set; }
  public bool HasThumbnail { get; set; }
}

...

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
    modelBuilder.Entity<MyModel>()
    .Property(e => e.HasThumbnail)
    .HasComputedColumnSql("NOT ISNULL(Thumbnail)");
}

Please note that maybe you should refactor MyModel to two tables, MyModel and MyModelThumbnailBinary with one-to-one FK.

Right now you have to use projection for EVERY query for MyModel - you really dont want to accidentally include your Thumbnail to selection (which can wreak havoc on RAM). And lets face it, accidentaldata.MyModelSet.Where(d => d.Date == DateTime.Now.Date).ToArray(); /* ups, i just loaded n*'some MB of data' :( */ is gonna happen sooner or later.


问:
Subprocess checkoutput is not returning output for help command?
Here I am trying to read output for regular help cmd on windows but I am getting error subprocess.CalledProcessError: Command 'help' `returned non-zero exit status 1
is there anything I can do to fix this here

With the same command if I try with systeminfo keyword I am getting the output , why does it returns values for systeminfo but not for cmd keyword

```<code>import subprocess

calling_output = subprocess.check_output(
        "help", shell=True, stderr=subprocess.STDOUT)

print (calling_output)
</code>```

Expected Output

```<code>For more information on a specific command, type HELP command-name
ASSOC          Displays or modifies file extension associations.
ATTRIB         Displays or changes file attributes.
BREAK          Sets or clears extended CTRL+C checking.
BCDEDIT        Sets properties in boot database to control boot loading.
CACLS          Displays or modifies access control lists (ACLs) of files.
CALL           Calls one batch program from another.
CD             Displays the name of or changes the current directory.
CHCP           Displays or sets the active code page number.
CHDIR          Displays the name of or changes the current directory.
CHKDSK         Checks a disk and displays a status report.
CHKNTFS        Displays or modifies the checking of disk at boot time.
CLS            Clears the screen.
CMD            Starts a new instance of the Windows command interpreter.
COLOR          Sets the default console foreground and background colors.
COMP           Compares the contents of two files or sets of files.
COMPACT        Displays or alters the compression of files on NTFS partitions.
CONVERT        Converts FAT volumes to NTFS.  You cannot convert the
               current drive.
COPY           Copies one or more files to another location.
DATE           Displays or sets the date.
DEL            Deletes one or more files.
DIR            Displays a list of files and subdirectories in a directory.
DISKPART       Displays or configures Disk Partition properties.
DOSKEY         Edits command lines, recalls Windows commands, and
               creates macros.
DRIVERQUERY    Displays current device driver status and properties.
ECHO           Displays messages, or turns command echoing on or off.
ENDLOCAL       Ends localization of environment changes in a batch file.
ERASE          Deletes one or more files.
EXIT           Quits the CMD.EXE program (command interpreter).
FC             Compares two files or sets of files, and displays the
               differences between them.
FIND           Searches for a text string in a file or files.
FINDSTR        Searches for strings in files.
FOR            Runs a specified command for each file in a set of files.
FORMAT         Formats a disk for use with Windows.
FSUTIL         Displays or configures the file system properties.
FTYPE          Displays or modifies file types used in file extension
               associations.
GOTO           Directs the Windows command interpreter to a labeled line in
               a batch program.
GPRESULT       Displays Group Policy information for machine or user.
GRAFTABL       Enables Windows to display an extended character set in
               graphics mode.
HELP           Provides Help information for Windows commands.
ICACLS         Display, modify, backup, or restore ACLs for files and
               directories.
IF             Performs conditional processing in batch programs.
LABEL          Creates, changes, or deletes the volume label of a disk.
MD             Creates a directory.
MKDIR          Creates a directory.
MKLINK         Creates Symbolic Links and Hard Links
MODE           Configures a system device.
MORE           Displays output one screen at a time.
MOVE           Moves one or more files from one directory to another
               directory.
OPENFILES      Displays files opened by remote users for a file share.
PATH           Displays or sets a search path for executable files.
PAUSE          Suspends processing of a batch file and displays a message.
POPD           Restores the previous value of the current directory saved by
               PUSHD.
PRINT          Prints a text file.
PROMPT         Changes the Windows command prompt.
PUSHD          Saves the current directory then changes it.
RD             Removes a directory.
RECOVER        Recovers readable information from a bad or defective disk.
REM            Records comments (remarks) in batch files or CONFIG.SYS.
REN            Renames a file or files.
RENAME         Renames a file or files.
REPLACE        Replaces files.
RMDIR          Removes a directory.
ROBOCOPY       Advanced utility to copy files and directory trees
SET            Displays, sets, or removes Windows environment variables.
SETLOCAL       Begins localization of environment changes in a batch file.
SC             Displays or configures services (background processes).
SCHTASKS       Schedules commands and programs to run on a computer.
SHIFT          Shifts the position of replaceable parameters in batch files.
SHUTDOWN       Allows proper local or remote shutdown of machine.
SORT           Sorts input.
START          Starts a separate window to run a specified program or command.
SUBST          Associates a path with a drive letter.
SYSTEMINFO     Displays machine specific properties and configuration.
TASKLIST       Displays all currently running tasks including services.
TASKKILL       Kill or stop a running process or application.
TIME           Displays or sets the system time.
TITLE          Sets the window title for a CMD.EXE session.
TREE           Graphically displays the directory structure of a drive or
               path.
TYPE           Displays the contents of a text file.
VER            Displays the Windows version.
VERIFY         Tells Windows whether to verify that your files are written
               correctly to a disk.
VOL            Displays a disk volume label and serial number.
XCOPY          Copies files and directory trees.
WMIC           Displays WMI information inside interactive command shell.
</code>```

答:
I don't understand from your question what command you are actually trying to run, nor do I have or use Windows, however I get the sense that your command is exiting with an error that is upsetting you.

If commandX fails on macOS or Linux, the normal thing to do is run a second command after it that will succeed and so the caller will not get upset. So maybe you can try that technique:

```<code>commandX             # this fails
commandX || true     # this succeeds
</code>```

I see that you are using shell=True and that Windows can do that here so you might want:

```<code>commandX || echo    # should succeed even if commandX fails
</code>```

Body:
Here I am trying to read output for regular help cmd on windows but I am getting error subprocess.CalledProcessError: Command 'help' `returned non-zero exit status 1
is there anything I can do to fix this here

With the same command if I try with systeminfo keyword I am getting the output , why does it returns values for systeminfo but not for cmd keyword

import subprocess

calling_output = subprocess.check_output(
        "help", shell=True, stderr=subprocess.STDOUT)

print (calling_output)

Expected Output

For more information on a specific command, type HELP command-name
ASSOC          Displays or modifies file extension associations.
ATTRIB         Displays or changes file attributes.
BREAK          Sets or clears extended CTRL+C checking.
BCDEDIT        Sets properties in boot database to control boot loading.
CACLS          Displays or modifies access control lists (ACLs) of files.
CALL           Calls one batch program from another.
CD             Displays the name of or changes the current directory.
CHCP           Displays or sets the active code page number.
CHDIR          Displays the name of or changes the current directory.
CHKDSK         Checks a disk and displays a status report.
CHKNTFS        Displays or modifies the checking of disk at boot time.
CLS            Clears the screen.
CMD            Starts a new instance of the Windows command interpreter.
COLOR          Sets the default console foreground and background colors.
COMP           Compares the contents of two files or sets of files.
COMPACT        Displays or alters the compression of files on NTFS partitions.
CONVERT        Converts FAT volumes to NTFS.  You cannot convert the
               current drive.
COPY           Copies one or more files to another location.
DATE           Displays or sets the date.
DEL            Deletes one or more files.
DIR            Displays a list of files and subdirectories in a directory.
DISKPART       Displays or configures Disk Partition properties.
DOSKEY         Edits command lines, recalls Windows commands, and
               creates macros.
DRIVERQUERY    Displays current device driver status and properties.
ECHO           Displays messages, or turns command echoing on or off.
ENDLOCAL       Ends localization of environment changes in a batch file.
ERASE          Deletes one or more files.
EXIT           Quits the CMD.EXE program (command interpreter).
FC             Compares two files or sets of files, and displays the
               differences between them.
FIND           Searches for a text string in a file or files.
FINDSTR        Searches for strings in files.
FOR            Runs a specified command for each file in a set of files.
FORMAT         Formats a disk for use with Windows.
FSUTIL         Displays or configures the file system properties.
FTYPE          Displays or modifies file types used in file extension
               associations.
GOTO           Directs the Windows command interpreter to a labeled line in
               a batch program.
GPRESULT       Displays Group Policy information for machine or user.
GRAFTABL       Enables Windows to display an extended character set in
               graphics mode.
HELP           Provides Help information for Windows commands.
ICACLS         Display, modify, backup, or restore ACLs for files and
               directories.
IF             Performs conditional processing in batch programs.
LABEL          Creates, changes, or deletes the volume label of a disk.
MD             Creates a directory.
MKDIR          Creates a directory.
MKLINK         Creates Symbolic Links and Hard Links
MODE           Configures a system device.
MORE           Displays output one screen at a time.
MOVE           Moves one or more files from one directory to another
               directory.
OPENFILES      Displays files opened by remote users for a file share.
PATH           Displays or sets a search path for executable files.
PAUSE          Suspends processing of a batch file and displays a message.
POPD           Restores the previous value of the current directory saved by
               PUSHD.
PRINT          Prints a text file.
PROMPT         Changes the Windows command prompt.
PUSHD          Saves the current directory then changes it.
RD             Removes a directory.
RECOVER        Recovers readable information from a bad or defective disk.
REM            Records comments (remarks) in batch files or CONFIG.SYS.
REN            Renames a file or files.
RENAME         Renames a file or files.
REPLACE        Replaces files.
RMDIR          Removes a directory.
ROBOCOPY       Advanced utility to copy files and directory trees
SET            Displays, sets, or removes Windows environment variables.
SETLOCAL       Begins localization of environment changes in a batch file.
SC             Displays or configures services (background processes).
SCHTASKS       Schedules commands and programs to run on a computer.
SHIFT          Shifts the position of replaceable parameters in batch files.
SHUTDOWN       Allows proper local or remote shutdown of machine.
SORT           Sorts input.
START          Starts a separate window to run a specified program or command.
SUBST          Associates a path with a drive letter.
SYSTEMINFO     Displays machine specific properties and configuration.
TASKLIST       Displays all currently running tasks including services.
TASKKILL       Kill or stop a running process or application.
TIME           Displays or sets the system time.
TITLE          Sets the window title for a CMD.EXE session.
TREE           Graphically displays the directory structure of a drive or
               path.
TYPE           Displays the contents of a text file.
VER            Displays the Windows version.
VERIFY         Tells Windows whether to verify that your files are written
               correctly to a disk.
VOL            Displays a disk volume label and serial number.
XCOPY          Copies files and directory trees.
WMIC           Displays WMI information inside interactive command shell.

Body:
I don't understand from your question what command you are actually trying to run, nor do I have or use Windows, however I get the sense that your command is exiting with an error that is upsetting you.

If commandX fails on macOS or Linux, the normal thing to do is run a second command after it that will succeed and so the caller will not get upset. So maybe you can try that technique:

commandX             # this fails
commandX || true     # this succeeds

I see that you are using shell=True and that Windows can do that here so you might want:

commandX || echo    # should succeed even if commandX fails


问:
span background-color & padding problems
I have a design I want to implement that involves title text appearing with its own background color, padded by 10px, over an image, par example:

http://i.stack.imgur.com/E7EpS.png

The first example in this picture works well, and is simple:

```<code>.greenbox {width:520px; height:261px; position:relative;}
.greenbox span { padding:0 10px; background:#000; position:absolute; left:0; bottom:40px; }
</code>```

Trouble arises when the text overflows onto another line, then the span elements padding does not effect the text on the line breaks, it renders like so:

http://i.stack.imgur.com/pY18f.png

Anyone know of an alternative, or how they would set this design out so that the background color & padding was consistent?

Thanks in advance

Edit: I had simplified the code to make it concise, but had missed a vital part. Actually it's like this:

```<code>.greenbox {width:520px; height:261px; position:relative;}
.greenbox a {position:absolute; left:0; bottom:40px; }
.greenbox span { padding:0 10px; background:#000; }
</code>```

With the html as:

```<code><div class="greenbox">

    <a href="link"><span>The Title Goes Here</span></a>

</div>
</code>```

Thus the span remains inline, wrapped in a absolute position anchor.

答: The somewhat easy way is to add border to the left of a link and then add two wrappers, then position first to the left and the second back to the right, so it would like somehow like that: http://jsfiddle.net/kizu/fNGgN/4/

ContentLicense: CC BY-SA 3.0

Body:
I have a design I want to implement that involves title text appearing with its own background color, padded by 10px, over an image, par example:

http://i.stack.imgur.com/E7EpS.png

The first example in this picture works well, and is simple:

.greenbox {width:520px; height:261px; position:relative;}
.greenbox span { padding:0 10px; background:#000; position:absolute; left:0; bottom:40px; }

Trouble arises when the text overflows onto another line, then the span elements padding does not effect the text on the line breaks, it renders like so:

http://i.stack.imgur.com/pY18f.png

Anyone know of an alternative, or how they would set this design out so that the background color & padding was consistent?

Thanks in advance

Edit: I had simplified the code to make it concise, but had missed a vital part. Actually it's like this:

.greenbox {width:520px; height:261px; position:relative;}
.greenbox a {position:absolute; left:0; bottom:40px; }
.greenbox span { padding:0 10px; background:#000; }

With the html as:

    The Title Goes Here

Thus the span remains inline, wrapped in a absolute position anchor.


问:
Intellij When to do a maven reload?
I'm working on a java project with multiple people.
Sometimes people make a change which I pull into my own branch.
When do I need to run maven reload?
Sometimes when I get an error in my code I need to run maven reload to get my code working again, even when I do not see a change in any pom file. The project has a big list with maven projects that are nested.
I thought maven reload was only needed when a pom file is changed. I also found that in intellij right clicking on a project -> maven -> reload project doesnt fix as much as when I do a Reload all projects, even when I only see changes in one project. So what is the correct way of working with maven projects, when should I do a reload of a project?</p>

答:
Everytime your maven pom.xml changes you need to reload. The reload generates the configuration for your project based of your pom.xml.

If you have dependencies declared in your pom.xml they will be fetched when you reload your Maven project.

Title: Intellij When to do a maven reload?


问:
Flutter Release APK for playstore
I am trying to generate a build apk, but getting following error.
this is compatible with flutter version 2.8.1

Getting following error while run flutter build apk

```<code>/home/dell/snap/flutter/common/flutter/bin/flutter --no-color build apk

Building without sound null safety
For more information see https://dart.dev/null-safety/unsound-null-safety

Running Gradle task 'assembleRelease'...
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01

Note: /home/dell/.pub-cache/hosted/pub.dartlang.org/geocoding-2.0.2/android/src/main/java/com/baseflow/geocoding/GeocodingPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /home/dell/.pub-cache/hosted/pub.dartlang.org/google_maps_flutter-2.1.1/android/src/main/java/io/flutter/plugins/googlemaps/Convert.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /home/dell/.pub-cache/hosted/pub.dartlang.org/path_provider_android-2.0.11/android/src/main/java/io/flutter/plugins/pathprovider/PathProviderPlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
e: /var/projects/app/freshooo/android/app/src/main/kotlin/com/u6amtech/flutter_grocery/Application.kt: (11, 51): Unresolved reference: setPluginRegistrant
e: /var/projects/app/freshooo/android/app/src/main/kotlin/com/u6amtech/flutter_grocery/FirebaseCloudMessagingPluginRegistrant.kt: (15, 44): Unresolved reference: registerWith
</code>```

FAILURE: Build failed with an exception.

```<code>* What went wrong:
Execution failed for task ':app:compileReleaseKotlin'.
> Compilation error. See log for more details

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2m 6s
Running Gradle task 'assembleRelease'...                          126.8s
Gradle task assembleRelease failed with exit code 1
</code>```

pubspec.yaml

```<code>name: flutter_grocery
description: A new Flutter application.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

version: 1.1.0+2

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter

  cupertino_icons: ^1.0.2
  get_it: ^6.0.0
  provider: ^5.0.0
  http: ^0.13.1
  freezed: ^0.14.1
  shared_preferences: ^2.0.5
  photo_view: ^0.12.0
  dio: ^4.0.0-prev2
  image_picker: ^0.7.3
  pin_code_fields: ^7.0.0
  google_maps_flutter_web: ^0.3.0
  google_maps_flutter: ^2.0.3
  flutter_google_places: ^0.3.0
  geocoding: ^2.0.0
  geolocator: ^7.0.1
  shimmer_animation: ^2.0.0
  url_launcher: ^6.0.2
  webview_flutter: ^2.0.2
  firebase_core: ^1.7.0
  firebase_messaging: ^10.0.8
  flutter_local_notifications: ^8.2.0
  path_provider: ^2.0.1
  flutter_html: ^2.0.0-nullsafety.0
  connectivity: ^3.0.2
  carousel_slider: ^4.0.0-nullsafety.0
  fluro: ^2.0.3
  url_strategy: ^0.2.0
  universal_html: ^2.0.8
  universal_ui: ^0.0.8
  flutter_widget_from_html_core: ^0.6.1
  phone_number: ^0.11.0+2
  country_code_picker: ^2.0.2
  flutter_typeahead: ^3.1.3

dev_dependencies:
  flutter_test:
    sdk: flutter

flutter:
  uses-material-design: true

  assets:
    - assets/image/
    - assets/language/

  fonts:
    - family: Poppins
      fonts:
        - asset: assets/font/Poppins-Light.ttf
          weight: 300
        - asset: assets/font/Poppins-Regular.ttf
          weight: 400
        - asset: assets/font/Poppins-Medium.ttf
          weight: 500
        - asset: assets/font/Poppins-SemiBold.ttf
          weight: 600
        - asset: assets/font/Poppins-Bold.ttf
          weight: 700
</code>```

app/build.gradle

```<code>def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new FileNotFoundException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.google.gms.google-services'

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {
    compileSdkVersion 30

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.fresh.grocery"
        minSdkVersion 21
        targetSdkVersion 30
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        multiDexEnabled true
    }

    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
            storePassword keystoreProperties['storePassword']
        }
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation "com.google.firebase:firebase-messaging:21.0.1"
    implementation 'com.android.support:multidex:1.0.3'
}
</code>```

android/build.gradle

```<code>buildscript {
    ext.kotlin_version = '1.5.20'
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.4'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.5'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }

    tasks.withType(JavaCompile) {
        options.compilerArgs << '-Xlint:-options'
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
</code>```

gradle-wrapper.properties

```<code>#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https://services.gradle.org/distributions/gradle-6.3-all.zip
</code>```

key.properties

```<code>storePassword=123456
keyPassword=123456
keyAlias=upload
storeFile=~/home/dell/upload-keystore.jks
</code>```

Project Setting

答:
Did you register your Application class in the Manifest file?

like this :

```<code><application
        android:name=".Application"
        android:label="app_name"
        android:icon="@mipmap/ic_launcher"/>
</code>```

Title: Flutter Release APK for playstore

Body:
I am trying to generate a build apk, but getting following error.
this is compatible with flutter version 2.8.1

Getting following error while run flutter build apk

/home/dell/snap/flutter/common/flutter/bin/flutter --no-color build apk

Building without sound null safety
For more information see https://dart.dev/null-safety/unsound-null-safety

Running Gradle task 'assembleRelease'...
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01

Note: /home/dell/.pub-cache/hosted/pub.dartlang.org/geocoding-2.0.2/android/src/main/java/com/baseflow/geocoding/GeocodingPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /home/dell/.pub-cache/hosted/pub.dartlang.org/google_maps_flutter-2.1.1/android/src/main/java/io/flutter/plugins/googlemaps/Convert.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /home/dell/.pub-cache/hosted/pub.dartlang.org/path_provider_android-2.0.11/android/src/main/java/io/flutter/plugins/pathprovider/PathProviderPlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
e: /var/projects/app/freshooo/android/app/src/main/kotlin/com/u6amtech/flutter_grocery/Application.kt: (11, 51): Unresolved reference: setPluginRegistrant
e: /var/projects/app/freshooo/android/app/src/main/kotlin/com/u6amtech/flutter_grocery/FirebaseCloudMessagingPluginRegistrant.kt: (15, 44): Unresolved reference: registerWith

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileReleaseKotlin'.
> Compilation error. See log for more details

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2m 6s
Running Gradle task 'assembleRelease'...                          126.8s
Gradle task assembleRelease failed with exit code 1

pubspec.yaml

name: flutter_grocery
description: A new Flutter application.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

version: 1.1.0+2

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter

  cupertino_icons: ^1.0.2
  get_it: ^6.0.0
  provider: ^5.0.0
  http: ^0.13.1
  freezed: ^0.14.1
  shared_preferences: ^2.0.5
  photo_view: ^0.12.0
  dio: ^4.0.0-prev2
  image_picker: ^0.7.3
  pin_code_fields: ^7.0.0
  google_maps_flutter_web: ^0.3.0
  google_maps_flutter: ^2.0.3
  flutter_google_places: ^0.3.0
  geocoding: ^2.0.0
  geolocator: ^7.0.1
  shimmer_animation: ^2.0.0
  url_launcher: ^6.0.2
  webview_flutter: ^2.0.2
  firebase_core: ^1.7.0
  firebase_messaging: ^10.0.8
  flutter_local_notifications: ^8.2.0
  path_provider: ^2.0.1
  flutter_html: ^2.0.0-nullsafety.0
  connectivity: ^3.0.2
  carousel_slider: ^4.0.0-nullsafety.0
  fluro: ^2.0.3
  url_strategy: ^0.2.0
  universal_html: ^2.0.8
  universal_ui: ^0.0.8
  flutter_widget_from_html_core: ^0.6.1
  phone_number: ^0.11.0+2
  country_code_picker: ^2.0.2
  flutter_typeahead: ^3.1.3

dev_dependencies:
  flutter_test:
    sdk: flutter

flutter:
  uses-material-design: true

  assets:
    - assets/image/
    - assets/language/

  fonts:
    - family: Poppins
      fonts:
        - asset: assets/font/Poppins-Light.ttf
          weight: 300
        - asset: assets/font/Poppins-Regular.ttf
          weight: 400
        - asset: assets/font/Poppins-Medium.ttf
          weight: 500
        - asset: assets/font/Poppins-SemiBold.ttf
          weight: 600
        - asset: assets/font/Poppins-Bold.ttf
          weight: 700

app/build.gradle

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new FileNotFoundException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.google.gms.google-services'

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {
    compileSdkVersion 30

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.fresh.grocery"
        minSdkVersion 21
        targetSdkVersion 30
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        multiDexEnabled true
    }

    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
            storePassword keystoreProperties['storePassword']
        }
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation "com.google.firebase:firebase-messaging:21.0.1"
    implementation 'com.android.support:multidex:1.0.3'
}

android/build.gradle

buildscript {
    ext.kotlin_version = '1.5.20'
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.4'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.5'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }

    tasks.withType(JavaCompile) {
        options.compilerArgs << '-Xlint:-options'
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

gradle-wrapper.properties

#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https://services.gradle.org/distributions/gradle-6.3-all.zip

key.properties

storePassword=123456
keyPassword=123456
keyAlias=upload
storeFile=~/home/dell/upload-keystore.jks

Project Setting

Body:
Did you register your Application class in the Manifest file?

like this :

<application
        android:name=".Application"
        android:label="app_name"
        android:icon="@mipmap/ic_launcher"/>


问:
Trying to root a phylogenetic tree using phangorn package in R
I am trying to root a phylogenetic tree (that I previously created using DECIPHER and phagorn with 16S data for a microbiome study) using the phangorn package in R. However, I am running into an issue that states that the number of nodes needs to be greater than the number of taxa. The tree has 2151 nodes. The associated sequences were grouped into 2153 taxa using a Dada2 pipeline. The sequences in the tree and in refseq within the phyloseq object (ps) are the exact same. I'm new to this. Please let me know if you need any additional information. Thank you in advance!

All relevant code up to the part in which an error occurred:

#Extract sequences from the dada2 output object:

```<code>sequences <- getSequences(seqtab.nochim)
names(sequences) <- sequences
</code>```

#Run sequence alignment (MSA) using DECIPHER:

```<code>alignment <- AlignSeqs(DNAStringSet(sequences), anchor=NA)
</code>```

#Change sequence alignment output into a phyDat structure

```<code>phang.align <- phyDat(as(alignment, "matrix"), type="DNA")
</code>```

#Create distance matrix

```<code>dm <- dist.ml(phang.align)
</code>```

#Perform Neighbor joining

```<code>treeNJ <- NJ(dm)
</code>```

#Note, tip order is not sequence order

#Internal maximum likelihood

```<code>fit <- pml(treeNJ, data=phang.align)
</code>```

#negative edges length changed to 0!

#Fit the tree
#Note: this step may take quite a while...

```<code>optim.pml()
fitGTR <- update(fit, k=4, inv=0.2)`
fitGTR <- optim.pml(fitGTR, model="GTR", optInv=TRUE, optGamma=TRUE,
                    rearrangement = "stochastic", control = pml.control(trace = 0))
</code>```

#Import into existing phyloseq object "ps":

```<code>ps@phy_tree <- fitGTR$tree
ps@phy_tree
</code>```

#Phylogenetic tree with 2153 tips and 2151 internal nodes - good!

#Need to root it for phylogeny-based diversity metrics (Unifrac)

```<code>phy_tree(ps) <- root(phy_tree(ps), taxa_names(ps), 1, resolve.root = TRUE)
</code>```
```<code>Error in root.phylo(phy_tree(ps), taxa_names(ps), 1, resolve.root = TRUE) : incorrect node#: should be greater than the number of taxa
</code>```

答:
ape::root expects the id of the new root node. The first nodes are the leaves. It does not make sense to root a tree on a leaf, thus the error. A leaf does not have children and a root must have children, otherwise it is an empty tree.

Use the function as_tibble from the tidytree package to get a table of node metadata to extract the desired node id:

library(ape)
library(tidytree)

# create example tree
tree <- read.tree(text='((A, B), ((C, D), (E, F)));')
tree <- makeNodeLabel(tree)

as_tibble(tree)
#> # A tibble: 11 x 3
#>    parent  node label
#>     <int> <int> <chr>
#>  1      8     1 A
#>  2      8     2 B
#>  3     10     3 C
#>  4     10     4 D
#>  5     11     5 E
#>  6     11     6 F
#>  7      7     7 Node1
#>  8      7     8 Node2
#>  9      7     9 Node3
#> 10      9    10 Node4
#> 11      9    11 Node5
plot(tree, show.node.label = TRUE)
```
<p><img src="https://i.imgur.com/7cBa1ry.png" alt="" /></p>
<pre class="lang-r prettyprint-override"><code># Root tree on leaf E (5th node)
# Does not make sense
tree2 <- root(phy = tree, node = 5)
#> Error in root.phylo(phy = tree, node = 5): incorrect node#: should be greater than the number of taxa

# Root tree on internal Node2 (8th node)
tree3 <- root(phy = tree, node = 8)
plot(tree3, show.node.label = TRUE)
</code>```

Created on 2022-02-10 by the reprex package (v2.0.0)

Body:
I am trying to root a phylogenetic tree (that I previously created using DECIPHER and phagorn with 16S data for a microbiome study) using the phangorn package in R. However, I am running into an issue that states that the number of nodes needs to be greater than the number of taxa. The tree has 2151 nodes. The associated sequences were grouped into 2153 taxa using a Dada2 pipeline. The sequences in the tree and in refseq within the phyloseq object (ps) are the exact same. I'm new to this. Please let me know if you need any additional information. Thank you in advance!

All relevant code up to the part in which an error occurred:

#Extract sequences from the dada2 output object:

sequences <- getSequences(seqtab.nochim)
names(sequences) <- sequences

#Run sequence alignment (MSA) using DECIPHER:

alignment <- AlignSeqs(DNAStringSet(sequences), anchor=NA)

#Change sequence alignment output into a phyDat structure

phang.align <- phyDat(as(alignment, "matrix"), type="DNA")

#Create distance matrix

dm <- dist.ml(phang.align)

#Perform Neighbor joining

treeNJ <- NJ(dm)

#Note, tip order is not sequence order

#Internal maximum likelihood

fit <- pml(treeNJ, data=phang.align)

#negative edges length changed to 0!

#Fit the tree
#Note: this step may take quite a while...

optim.pml()
fitGTR <- update(fit, k=4, inv=0.2)`
fitGTR <- optim.pml(fitGTR, model="GTR", optInv=TRUE, optGamma=TRUE,
                    rearrangement = "stochastic", control = pml.control(trace = 0))

#Import into existing phyloseq object "ps":

ps@phy_tree <- fitGTR$tree
ps@phy_tree

#Phylogenetic tree with 2153 tips and 2151 internal nodes - good!

#Need to root it for phylogeny-based diversity metrics (Unifrac)

phy_tree(ps) <- root(phy_tree(ps), taxa_names(ps), 1, resolve.root = TRUE)

Error in root.phylo(phy_tree(ps), taxa_names(ps), 1, resolve.root = TRUE) : incorrect node#: should be greater than the number of taxa

Body:
ape::root expects the id of the new root node. The first nodes are the leaves. It does not make sense to root a tree on a leaf, thus the error. A leaf does not have children and a root must have children, otherwise it is an empty tree.

Use the function as_tibble from the tidytree package to get a table of node metadata to extract the desired node id:

library(ape)
library(tidytree)

# create example tree
tree <- read.tree(text='((A, B), ((C, D), (E, F)));')
tree <- makeNodeLabel(tree)

as_tibble(tree)
#> # A tibble: 11 x 3
#>    parent  node label
#>     <int> <int> <chr>
#>  1      8     1 A
#>  2      8     2 B
#>  3     10     3 C
#>  4     10     4 D
#>  5     11     5 E
#>  6     11     6 F
#>  7      7     7 Node1
#>  8      7     8 Node2
#>  9      7     9 Node3
#> 10      9    10 Node4
#> 11      9    11 Node5
plot(tree, show.node.label = TRUE)

# Root tree on leaf E (5th node)
# Does not make sense
tree2 <- root(phy = tree, node = 5)
#> Error in root.phylo(phy = tree, node = 5): incorrect node#: should be greater than the number of taxa

# Root tree on internal Node2 (8th node)
tree3 <- root(phy = tree, node = 8)
plot(tree3, show.node.label = TRUE)

Created on 2022-02-10 by the reprex package (v2.0.0)


问:
API Calls from AWS Glue job
I am running an AWS Glue job written from scratch to read from database and save the result in s3.
I would like to set an HTTP API call to send the status of the Glue job after completing the read from database whether it was success or fail (which acts as a logging service). Is this possible from AWS Glue?</p>

答: Yes that is possible. You need to set up a VPC, with a public and a private subnet. In the private subnet, you can create an ENI that will allow only outbound connections for Glue to call the API. In the public subnet, you can install a NAT Gateway.</p>

Title: API Calls from AWS Glue job


问:
Codeigniter resizing of image not working
I am trying to resize the uploaded image to height of 163px maintaining aspect ratio and then upload it to a folder. I tried with the following code:

```<code>$id=1;     // user id
$this->load->library('image_lib');
$filename=$_FILES['file']['name'];
$config['image_library'] = 'gd2';
$config['upload_path'] = './userdata/'.$id;
$config['height'] = '163px';
$config['maintain_ratio'] = TRUE;
//$config['master_dim'] = 'height';
$config['source_image'] = $filename;
$this->load->library('upload', $config);
$this->image_lib->initialize($config);
$this->image_lib->resize();
if(!$this->upload->do_upload('file'))
{
     echo $this->data['error'] = $this->upload->display_errors();
}
</code>```

However this is uploading the image to the correct folder but the image is not resized. I uploaded an image of size *170*128* and it is uploaded to folder as it is without resizing. What is wrong with my code?

Can anyone help me to find the problem?

Thanks in advance.

答:
Simple...

You have to do one thing Go to Captcha_helper.php and search

instead of

```<code>    $x = mt_rand(0, $img_width / ($length / 3));
</code>```

Do Like this

```<code>    $x = mt_rand(0, $img_width / ($length / 1));
</code>```

Body:
I am trying to resize the uploaded image to height of 163px maintaining aspect ratio and then upload it to a folder. I tried with the following code:

$id=1;     // user id
$this->load->library('image_lib');
$filename=$_FILES['file']['name'];
$config['image_library'] = 'gd2';
$config['upload_path'] = './userdata/'.$id;
$config['height'] = '163px';
$config['maintain_ratio'] = TRUE;
//$config['master_dim'] = 'height';
$config['source_image'] = $filename;
$this->load->library('upload', $config);
$this->image_lib->initialize($config);
$this->image_lib->resize();
if(!$this->upload->do_upload('file'))
{
     echo $this->data['error'] = $this->upload->display_errors();
}

However this is uploading the image to the correct folder but the image is not resized. I uploaded an image of size *170*128* and it is uploaded to folder as it is without resizing. What is wrong with my code?

Can anyone help me to find the problem?

Thanks in advance.

Body:
Simple...

You have to do one thing Go to Captcha_helper.php and search

instead of

    $x = mt_rand(0, $img_width / ($length / 3));

Do Like this

    $x = mt_rand(0, $img_width / ($length / 1));


问:
How to replace specific indexes in string?
I'm trying to pass dynamically hours and minutes to the time_now variable.

I want to pass time dynamically to time_now. I'm trying but unable to pass it.

答:
Use strptime to convert your string as a datetime then replace to change hour and minute:

```<code>from datetime import datetime

# split your time to be usable with replace
new_time = '16:50'
hour, minute = new_time.split(':')

# it's not mandatory if date_time is already a datetime instance
date_time = '2022-02-10 14:18:58.209240+05:45'
date_time = datetime.strptime(date_time, '%Y-%m-%d %H:%M:%S.%f%z')

# replace each component with keyword args
new_time = date_time.replace(hour=int(hour), minute=int(minute))
</code>```

Output:

```<code>>>> str(new_time)
'2022-02-10 16:50:58.209240+05:45'
</code>```

Body:
Use strptime to convert your string as a datetime then replace to change hour and minute:

from datetime import datetime

# split your time to be usable with replace
new_time = '16:50'
hour, minute = new_time.split(':')

# it's not mandatory if date_time is already a datetime instance
date_time = '2022-02-10 14:18:58.209240+05:45'
date_time = datetime.strptime(date_time, '%Y-%m-%d %H:%M:%S.%f%z')

# replace each component with keyword args
new_time = date_time.replace(hour=int(hour), minute=int(minute))

Output:

>>> str(new_time)
'2022-02-10 16:50:58.209240+05:45'


问:
sql I want to make one row if ua_pilot has 2 ua_type to be on one row
```<code>SELECT
    UA_TYPE, UA_SCHEDULED_START_TIME, ua_pilot_id,
    ua_assignmentreason_abbrev, ua_scheduled_end_time,
    UA_CANCEL_TIME,ua_noq_reason
FROM
    unavailabilityassignment
WHERE
    UA_TYPE IN ('NOQ')
    AND UA_ASSIGNMENT_TIME > '2022-01-01'
    AND ua_scheduled_start_time  > '2022-01-21'
    AND ua_assignmentreason_abbrev IN 'APMA'

UNION

SELECT
    UA_TYPE, UA_SCHEDULED_START_TIME, ua_pilot_id,
    ua_assignmentreason_abbrev, ua_scheduled_end_time,
    UA_CANCEL_TIME,ua_noq_reason
FROM
    unavailabilityassignment
WHERE
    UA_TYPE IN ('SCK')
    AND UA_ASSIGNMENT_TIME > '2022-01-01'
    AND ua_scheduled_start_time > '2022-01-21'

UNION

SELECT
    UA_TYPE, UA_SCHEDULED_START_TIME, ua_pilot_id,
    ua_assignmentreason_abbrev, ua_scheduled_end_time,
    UA_CANCEL_TIME,ua_noq_reason
FROM
    unavailabilityassignment
WHERE
    UA_NOQ_REASON IN 'APMA'
    AND ua_scheduled_start_time > '2022-01-21'
ORDER BY
    3
</code>```

答:
Depends on what db you are using, but you can GROUP BY ua_pilot_id and use a function like the MySQL GROUP_CONCAT when selecting the other fields you need. For example

```<code>SELECT GROUP_CONCAT(UA_TYPE)
...the rest of your query...
GROUP BY ua_pilot_id
</code>```

Body:
Depends on what db you are using, but you can GROUP BY ua_pilot_id and use a function like the MySQL GROUP_CONCAT when selecting the other fields you need. For example

SELECT GROUP_CONCAT(UA_TYPE)
...the rest of your query...
GROUP BY ua_pilot_id


问:
Derived XmlSerializer can not be loaded within MSTest
I'm facing a strange behaviour. I have an derived implementation of an .NET XmlSerializer looking like this

```<code>public class ASerializer : XmlSerializer
{
    public ASerializer()
        : base( typeof ( A ) ) {}
}
</code>```

While instanciating an instance of this class within a MSTest an exception with the following message is thrown:

```<code>Initialization method 'ASerializerTest.Initialize' threw exception.
System.TypeLoadException: Could not load type 'ASerializer' from assembly 'AAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'..
</code>```

Running the Test from ReSharper Runner succeeds. Any ideas on this topic?

Thanks,
MacX

答:
CPU-Selection showed "Mixed Platforms". Switched it to "Any CPU".
Works like a charm now.

Many Thanks to Jonathan Dickinson for the hint.

Body:
I'm facing a strange behaviour. I have an derived implementation of an .NET XmlSerializer looking like this

public class ASerializer : XmlSerializer
{
    public ASerializer()
        : base( typeof ( A ) ) {}
}

While instanciating an instance of this class within a MSTest an exception with the following message is thrown:

Initialization method 'ASerializerTest.Initialize' threw exception.
System.TypeLoadException: Could not load type 'ASerializer' from assembly 'AAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'..

Running the Test from ReSharper Runner succeeds. Any ideas on this topic?

Thanks,
MacX


问:
How to play mp4 (actually GIFs converted to mp4)?
I have an Android App where I am using Glide to play animated GIF (.gif) files and it is working very well.

But when GIF files are heavy in size so I wanted to convert them to mp4 and use the same in my app. I have gif to mp4 conversion tools.

I couldn't find any library or solution yet.

答:
Androids MediaPlayer has some problems playing some media formats. you can instead use ExoPlayer for that purpose.

In the example below I am using Exoplayer to play an .mp4 from raw folder like a gif in my app.

XML:

```<code>    <com.google.android.exoplayer2.ui.PlayerView
        android:id="@+id/video_view"
        app:use_controller="false"
        app:hide_on_touch="false"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        />
</code>```

Java:

```<code>private void playVideo(int resourceId) {
    SimpleExoPlayer player = new SimpleExoPlayer.Builder(getContext()).build();
    binding.videoView.setPlayer(player);
    Uri uri = RawResourceDataSource.buildRawResourceUri(resourceId);
    MediaItem mediaItem = MediaItem.fromUri(uri);
    player.setMediaItem(mediaItem);
    player.prepare();
    player.play();
}
</code>```

Please note that this implementation does not repeat the video file after completion. but surely there are ways to do that with ExoPlayer as well.

Body:
Androids MediaPlayer has some problems playing some media formats. you can instead use ExoPlayer for that purpose.

In the example below I am using Exoplayer to play an .mp4 from raw folder like a gif in my app.

XML:

    <com.google.android.exoplayer2.ui.PlayerView
        android:id="@+id/video_view"
        app:use_controller="false"
        app:hide_on_touch="false"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        />

Java:

private void playVideo(int resourceId) {
    SimpleExoPlayer player = new SimpleExoPlayer.Builder(getContext()).build();
    binding.videoView.setPlayer(player);
    Uri uri = RawResourceDataSource.buildRawResourceUri(resourceId);
    MediaItem mediaItem = MediaItem.fromUri(uri);
    player.setMediaItem(mediaItem);
    player.prepare();
    player.play();
}

Please note that this implementation does not repeat the video file after completion. but surely there are ways to do that with ExoPlayer as well.


问:
retrofit request @Part and @Query in kotlin android
I want to send Image as form-data and userId as Params in retrofit android.enter image description hereI have tried many solution but did not got any success. here is my code and api.

@Multipart
@POST("upload/profile")
fun uploadProfilePhoto(@Part image: MultipartBody.Part, @Query("userId") userId: String): Call

```<code>    val photoContent = RequestBody.create(MediaType.parse("image/*"), file)
    val photo = MultipartBody.Part.createFormData("image", file.name, photoContent)
</code>```

答: I got the error in my case. actually when we post multipart parameter then we have to match our formData name with backend in the API. in my case it was "image/png" val photo = MultipartBody.Part.createFormData("image", file.name, photoContent)

Body:
I want to send Image as form-data and userId as Params in retrofit android.enter image description hereI have tried many solution but did not got any success. here is my code and api.

@Multipart
@POST("upload/profile")
fun uploadProfilePhoto(@Part image: MultipartBody.Part, @Query("userId") userId: String): Call

    val photoContent = RequestBody.create(MediaType.parse("image/*"), file)
    val photo = MultipartBody.Part.createFormData("image", file.name, photoContent)


问:
Getting error when launching app on simulator
when running 'npm run ios' i cant install my app on simulator

info Found Xcode workspace "exampleapp.xcworkspace"
info Launching iPhone 12 (iOS 15.2)
info Building (using "xcodebuild -workspace exampleapp.xcworkspace -configuration Debug -scheme exampleapp -destination id=A920E83F-83A2-4F8A-A40C-C5464A9FABDD")
success Successfully built the app

error Failed to launch the app on simulator, An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=405):
Unable to lookup in current state: Shutdown

答: i just run again 'npm run ios' and it worked! Don't know what happened</p>


问:
Why I cant use atoi() function on a "string" instead of the char pointer in C++?
I tried the following code and it is giving me error.

```<code>int main() {
    string String = "1235";
    int num = atoi(String);
    cout << num << endl;
    return 0;
}
/*
error: cannot convert 'std::__cxx11::string {aka std::__cxx11::basic_string<char>}' to 'const char*' for argument '1' to 'int atoi(const char*)'
     int num = atoi(String);
                          ^
mingw32-make.exe[1]: *** [Debug/main.cpp.o] Error 1
mingw32-make.exe: *** [All] Error 2
*/
</code>```

But if I use the following code it works perfectly fine.

```<code>int main() {
    char* String = "1235";
    int num = atoi(String);
    cout << num << endl;
    return 0;
}
//prints out 1235
</code>```

I know I can solve my problem using stoi() function.

```<code>int main() {
    string String = "1235";
    int num = stoi(String);
    cout << num << endl;
    return 0;
}
//prints out 1235
</code>```

I can solve my problem by using a char pointer instead of string. But I just want to know why this can't be done by placing string itself into atoi(). How does atoi() work internally?

I just wanna know how does atoi() function work in C++

答:
While std::stoi accepts std::string as input, ::atoi does not.

Note: std::string is a c++ class type, const char* is a basic data type.   Although std::string does have a member function .c_str(), which can return its C-Style representation with const char* type.

Protype declarations of std::stoi in <string>:

```<code>int stoi( const std::string& str, std::size_t* pos = nullptr, int base = 10 );
int stoi( const std::wstring& str, std::size_t* pos = nullptr, int base = 10);
</code>```

Protype declaration of ::atoi in <stdlib.h>:

```<code>int atoi (const char *__nptr);
</code>```

Body:
I tried the following code and it is giving me error.

int main() {
    string String = "1235";
    int num = atoi(String);
    cout << num << endl;
    return 0;
}
/*
error: cannot convert 'std::__cxx11::string {aka std::__cxx11::basic_string<char>}' to 'const char*' for argument '1' to 'int atoi(const char*)'
     int num = atoi(String);
                          ^
mingw32-make.exe[1]: *** [Debug/main.cpp.o] Error 1
mingw32-make.exe: *** [All] Error 2
*/

But if I use the following code it works perfectly fine.

int main() {
    char* String = "1235";
    int num = atoi(String);
    cout << num << endl;
    return 0;
}
//prints out 1235

I know I can solve my problem using stoi() function.

int main() {
    string String = "1235";
    int num = stoi(String);
    cout << num << endl;
    return 0;
}
//prints out 1235

I can solve my problem by using a char pointer instead of string. But I just want to know why this can't be done by placing string itself into atoi(). How does atoi() work internally?

I just wanna know how does atoi() function work in C++

Body:
While std::stoi accepts std::string as input, ::atoi does not.

Note: std::string is a c++ class type, const char* is a basic data type.   Although std::string does have a member function .c_str(), which can return its C-Style representation with const char* type.

Protype declarations of std::stoi in <string>:

int stoi( const std::string& str, std::size_t* pos = nullptr, int base = 10 );
int stoi( const std::wstring& str, std::size_t* pos = nullptr, int base = 10);

Protype declaration of ::atoi in <stdlib.h>:

int atoi (const char *__nptr);


问:
Share menu android

Possible Duplicate:

  share feature of menu in android application

Hello I want to do this share menu in my app but I don´t know how. There is a manual or a code to help me. Thank you.

答:
You can create a simple menu with this tutorial :

http://developer.android.com/guide/topics/ui/menus.html

After that you can easily change the style (Transparent, ....) and also force displaying the menu without any action !

And for the Quickaction Dialog, read this tutorial :

http://www.londatiga.net/it/how-to-create-quickaction-dialog-in-android/

Hope it helps you

Title: Share menu android


问:
Moving LoginComponent to another slot
Because of design requirements, we want to show the LoginComponent as part of the SiteLinks slot (above the main navigation). I went deep into the source code and found this component has a static mapping to the SiteLogin slot

```<code>export const defaultCmsContentProviders: ValueProvider[] = [
...
  provideCmsStructure({
    componentId: 'LoginComponent',
    pageSlotPosition: 'SiteLogin',
  }),
];
</code>```

I have removed this provider from my set up, because redefining a provideCmsStructure with my slot name doesn't work.

I have defined a new ValueProvider[] for my project,

```<code>
export const myCmsContentProviders: ValueProvider[] = [
  provideCmsStructure({
    componentId: 'HamburgerMenuComponent',
    pageSlotPosition: 'PreHeader',
  }),
  provideCmsStructure({
    componentId: 'LoginComponent',
    pageSlotPosition: 'SiteLinks',
  }),
];
</code>```

This shows the hamburger on mobile, but doesn't add the LoginComponent to the SiteLinks slot..

Has anyone succeeded in moving this component?

We are running spartacus 4.0 (greenfield)

答:
I created a new page where I didn't want the Header to appear. I looked everywhere in my impexes to try to find out why this LoginComponent was being added even though I don't have a Header. In the end, it was hardcoded in the Spartacus library using provideCmsStructure and I still don't know how to remove it besides replacing it with a custom empty Component.

```<code>provideCmsStructure({
    componentId: 'EmptyComponent',
    pageSlotPosition: 'SiteLogin',
  }),
</code>```

Surely there's a better way...

Title: Moving LoginComponent to another slot

Body:
Because of design requirements, we want to show the LoginComponent as part of the SiteLinks slot (above the main navigation). I went deep into the source code and found this component has a static mapping to the SiteLogin slot

export const defaultCmsContentProviders: ValueProvider[] = [
...
  provideCmsStructure({
    componentId: 'LoginComponent',
    pageSlotPosition: 'SiteLogin',
  }),
];

I have removed this provider from my set up, because redefining a provideCmsStructure with my slot name doesn't work.

I have defined a new ValueProvider[] for my project,

export const myCmsContentProviders: ValueProvider[] = [
  provideCmsStructure({
    componentId: 'HamburgerMenuComponent',
    pageSlotPosition: 'PreHeader',
  }),
  provideCmsStructure({
    componentId: 'LoginComponent',
    pageSlotPosition: 'SiteLinks',
  }),
];

This shows the hamburger on mobile, but doesn't add the LoginComponent to the SiteLinks slot..

Has anyone succeeded in moving this component?

We are running spartacus 4.0 (greenfield)

Body:
I created a new page where I didn't want the Header to appear. I looked everywhere in my impexes to try to find out why this LoginComponent was being added even though I don't have a Header. In the end, it was hardcoded in the Spartacus library using provideCmsStructure and I still don't know how to remove it besides replacing it with a custom empty Component.

provideCmsStructure({
    componentId: 'EmptyComponent',
    pageSlotPosition: 'SiteLogin',
  }),

Surely there's a better way...


问:
import CSV in another language to SAS
I am attempting to import a CSV file which is in French to my US based analysis. I have noticed several issues in the import related to the use of accents. I put the csv file into a text reader and found that the data look like this

I am unsure how to get rid of the [sub] pieces and format this properly.

I am on SAS 9.3 and am unable to edit the CSV as it is a shared CSV with French researchers. I am also limited to what I can do in terms of additional languages within SAS because of admin rights.

I have tried the following fixes:

```<code>data want(encoding=asciiany);
set have;
comment= Compress(comment,'0D0A'x);
comment= TRANWRD(comment,'0D0A'x,'');
comment= TRANWRD(comment,'0D'x,'');
comment= TRANWRD(comment,"\u001a",'');
</code>```

How can I resolve these issues?

答:
This worked:</p>
```<code>data want;
  array f[8] $4 _temporary_ ('ä'  'ö'  'ü'  'ß'  'Ä'  'Ö'  'Ü'  'É');
  array t[8] $4 _temporary_ ('ae' 'oe' 'ue' 'ss' 'Ae' 'Oe' 'Ue' 'E');
  set have;
  newvar=oldvar;

newvar = Compress(newvar,'0D0A'x);
newvar = TRANWRD(newvar,'0D0A'x,'');
newvar = TRANWRD(newvar,'0D'x,'');
newvar = TRANWRD(newvar,"\u001a",'');
newvar = compress(newvar, , 'kw');
  do _n_=1 to dim(f);
    d=tranwrd(d, trim(f[_n_]), trim(t[_n_]));
  end;
run;
</code>```

Title: import CSV in another language to SAS

Body:
I am attempting to import a CSV file which is in French to my US based analysis. I have noticed several issues in the import related to the use of accents. I put the csv file into a text reader and found that the data look like this

I am unsure how to get rid of the [sub] pieces and format this properly.

I am on SAS 9.3 and am unable to edit the CSV as it is a shared CSV with French researchers. I am also limited to what I can do in terms of additional languages within SAS because of admin rights.

I have tried the following fixes:

data want(encoding=asciiany);
set have;
comment= Compress(comment,'0D0A'x);
comment= TRANWRD(comment,'0D0A'x,'');
comment= TRANWRD(comment,'0D'x,'');
comment= TRANWRD(comment,"\u001a",'');

How can I resolve these issues?

Body:
This worked:

data want;
  array f[8] $4 _temporary_ ('ä'  'ö'  'ü'  'ß'  'Ä'  'Ö'  'Ü'  'É');
  array t[8] $4 _temporary_ ('ae' 'oe' 'ue' 'ss' 'Ae' 'Oe' 'Ue' 'E');
  set have;
  newvar=oldvar;

newvar = Compress(newvar,'0D0A'x);
newvar = TRANWRD(newvar,'0D0A'x,'');
newvar = TRANWRD(newvar,'0D'x,'');
newvar = TRANWRD(newvar,"\u001a",'');
newvar = compress(newvar, , 'kw');
  do _n_=1 to dim(f);
    d=tranwrd(d, trim(f[_n_]), trim(t[_n_]));
  end;
run;


问:
How am I supposed to go to any fragment from an activity?
This is the activity code. I'm tryin to go to the fragment when I click on a button. But I don't know how to do it. And when I use intent like the intent report, it asked me to declare the shopping_cart (fragment) at manifest.

```<code>@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
    switch (item.getItemId()) {
        case (R.id.shopping_cart):

        case (R.id.report):
            Intent report;
            report = new Intent(getApplicationContext(), Report.class);
            startActivity(report);
            break;
    }

    return super.onOptionsItemSelected(item);
}
</code>```

答:
Just Do This For Going Activity To Fragment

```<code> public void replace(Fragment fragment) {
        FragmentManager fragmentManager = getSupportFragmentManager();
        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
        fragmentTransaction.replace(R.id.frame, fragment);
        fragmentTransaction.addToBackStack(fragment.toString());
        fragmentTransaction.commit();
    }
</code>```

And In Button Click Just Put Below Code

```<code>replace(new FragmentName());
</code>```

Body:
This is the activity code. I'm tryin to go to the fragment when I click on a button. But I don't know how to do it. And when I use intent like the intent report, it asked me to declare the shopping_cart (fragment) at manifest.

@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
    switch (item.getItemId()) {
        case (R.id.shopping_cart):

        case (R.id.report):
            Intent report;
            report = new Intent(getApplicationContext(), Report.class);
            startActivity(report);
            break;
    }

    return super.onOptionsItemSelected(item);
}

Body:
Just Do This For Going Activity To Fragment

 public void replace(Fragment fragment) {
        FragmentManager fragmentManager = getSupportFragmentManager();
        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
        fragmentTransaction.replace(R.id.frame, fragment);
        fragmentTransaction.addToBackStack(fragment.toString());
        fragmentTransaction.commit();
    }

And In Button Click Just Put Below Code

replace(new FragmentName());


问:
TfLite LSTM models
I have not found any pretrained lstm models to work with .
Did tfLite provided any pretrained lstm models ?
I tried to create tflite model but facing issues while conversion ? Could you provide exact script to create tfLite model ?
Does tfLite has any script for creating tfLite LSTM models with latest version ?
This is my script to create tfLite model. But its not working.</p>
```<code>import numpy as np
import tensorflow as tf

model = tf.keras.Sequential()
# Add an Embedding layer expecting input vocab of size 1000, and
# output embedding dimension of size 64.
model.add(tf.keras.layers.Embedding(input_dim=1000, output_dim=64))

# Add a LSTM layer with 128 internal units.
model.add(tf.keras.layers.LSTM(128))

# Add a Dense layer with 10 units.
model.add(tf.keras.layers.Dense(10))
model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['categorical_accuracy'])
model.summary()
#model.fit_generator(train_data_generator.generate(), len(train_data)//(batch_size*num_steps), num_epochs,
#                        validation_data=valid_data_generator.generate(),
#                        validation_steps=len(valid_data)//(batch_size*num_steps), callbacks=[checkpointer])
tf.saved_model.save(model, "saved_model_keras_dir")

model.save('my_lstm_model')
# x_train =
#(x_train, y_train), (x_test, y_test) = tf.keras.datasets.mnist.load_data()
#x_train, x_test = x_train / 255.0, x_test / 255.0

# Cast x_train & x_test to float32.
#x_train = x_train.astype(np.float32)
#x_test = x_test.astype(np.float32)

#model.fit(x_train, y_train, epochs=5)
#model.evaluate(x_test, y_test)

converter = tf.lite.TFLiteConverter.from_keras_model(model)

# Step 3: Convert the Keras model to TensorFlow Lite model.

tflite_model = converter.convert()
#sess = tf.compat.v1.keras.backend.get_session()
#input_tensor = sess.graph.get_tensor_by_name('embedding_1:0')
#output_tensor = sess.graph.get_tensor_by_name('dense_1:0')
#converter = tf.lite.TFLiteConverter.from_session(
    sess, [input_tensor], [output_tensor])

#tflite = converter.convert()
print('Model converted successfully!')

# Save the model.
with open('lstmmodel.tflite', 'wb') as f:
  f.write(tflite_model)
</code>```

答:
To expand Tian Lin's answer, here is the link to a Colab notebook showing LSTM conversion: https://colab.research.google.com/github/tensorflow/tensorflow/blob/master/tensorflow/lite/examples/experimental_new_converter/Keras_LSTM_fusion_Codelab.ipynb

As I know, there are no pre-trained LSTM models for TF Lite... But you can try to have a look at the TF Lite Model Hub: https://tfhub.dev/s?deployment-format=lite

Title: TfLite LSTM models

Body:
I have not found any pretrained lstm models to work with .
Did tfLite provided any pretrained lstm models ?
I tried to create tflite model but facing issues while conversion ? Could you provide exact script to create tfLite model ?
Does tfLite has any script for creating tfLite LSTM models with latest version ?
This is my script to create tfLite model. But its not working.

import numpy as np
import tensorflow as tf

model = tf.keras.Sequential()
# Add an Embedding layer expecting input vocab of size 1000, and
# output embedding dimension of size 64.
model.add(tf.keras.layers.Embedding(input_dim=1000, output_dim=64))

# Add a LSTM layer with 128 internal units.
model.add(tf.keras.layers.LSTM(128))

# Add a Dense layer with 10 units.
model.add(tf.keras.layers.Dense(10))
model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['categorical_accuracy'])
model.summary()
#model.fit_generator(train_data_generator.generate(), len(train_data)//(batch_size*num_steps), num_epochs,
#                        validation_data=valid_data_generator.generate(),
#                        validation_steps=len(valid_data)//(batch_size*num_steps), callbacks=[checkpointer])
tf.saved_model.save(model, "saved_model_keras_dir")

model.save('my_lstm_model')
# x_train =
#(x_train, y_train), (x_test, y_test) = tf.keras.datasets.mnist.load_data()
#x_train, x_test = x_train / 255.0, x_test / 255.0

# Cast x_train & x_test to float32.
#x_train = x_train.astype(np.float32)
#x_test = x_test.astype(np.float32)

#model.fit(x_train, y_train, epochs=5)
#model.evaluate(x_test, y_test)

converter = tf.lite.TFLiteConverter.from_keras_model(model)

# Step 3: Convert the Keras model to TensorFlow Lite model.

tflite_model = converter.convert()
#sess = tf.compat.v1.keras.backend.get_session()
#input_tensor = sess.graph.get_tensor_by_name('embedding_1:0')
#output_tensor = sess.graph.get_tensor_by_name('dense_1:0')
#converter = tf.lite.TFLiteConverter.from_session(
    sess, [input_tensor], [output_tensor])

#tflite = converter.convert()
print('Model converted successfully!')

# Save the model.
with open('lstmmodel.tflite', 'wb') as f:
  f.write(tflite_model)


问:
Best practice to include console app in NuGet
I'm developing an open-source library which mainly consists of one class-library project targeting .NET Standard 2.0. On top of that, I've also implemented a console app which is the CLI to this library. The console project (for historic reasons) only targets .NET Framework 4.6.2.

Now I wonder what would be the best practice in order to make this console app available to the community. On the broadest level, I see two possibilities:

Ship the console app as a separate NuGet.

Ship the console app in the same NuGet as the class library because it's just a minor add-on and does not justify an own package.

Historically, I've been using the second approach but considering that the class library can be used in a multi-targeting scenario, I'm not sure anymore. Maybe it's cleaner to separate the console app in a NuGet of its own so that it's dependency on the full .NET framework is clear.

Either way I wonder where the console exe belongs to in the file structure of the NuGet. Historically, I've been putting it under tools\net462 but a comment about the tools folder on this page made me insecure:

Powershell scripts and programs accessible from the Package Manager Console

I'm not necessarily imagining someone using the CLI from the Package Manager Consoler. Rather it would be used as stand-alone exe somewhere is some shell.

答:
When time pass by, other solutions come available...

https://learn.microsoft.com/nl-nl/dotnet/core/tools/global-tools-how-to-create

```<code><PackAsTool>true</PackAsTool>
<ToolCommandName>botsay</ToolCommandName>
<PackageOutputPath>./nupkg</PackageOutputPath>
</code>```

Body:
When time pass by, other solutions come available...

https://learn.microsoft.com/nl-nl/dotnet/core/tools/global-tools-how-to-create

<PackAsTool>true</PackAsTool>
<ToolCommandName>botsay</ToolCommandName>
<PackageOutputPath>./nupkg</PackageOutputPath>