野の

文章 评论 浏览 30

野の 2025-02-11 04:56:38

使用每组:

from sklearn.metrics import mean_squared_error
s = (df.groupby('product_id')
      .apply(lambda x: mean_squared_error(x['real'], x['pred'], squared=False)))
    
print (s)
product_id
20    0.460435
22    0.672309
dtype: float64

或手动计数:

s = df['pred'].sub(df['real']).pow(2).groupby(df['product_id']).mean().pow(0.5)
    
print (s)
product_id
20    0.460435
22    0.672309
dtype: float64

Use sklearn.metrics.mean_squared_error per groups:

from sklearn.metrics import mean_squared_error
s = (df.groupby('product_id')
      .apply(lambda x: mean_squared_error(x['real'], x['pred'], squared=False)))
    
print (s)
product_id
20    0.460435
22    0.672309
dtype: float64

Or count it manually:

s = df['pred'].sub(df['real']).pow(2).groupby(df['product_id']).mean().pow(0.5)
    
print (s)
product_id
20    0.460435
22    0.672309
dtype: float64

MSE功能在Pandas DataFrame中返回NAN

野の 2025-02-10 19:35:58

我通过将读取器连接到Oracle VM VirtualBox上的系统来解决此问题。我将尝试连接到其他计算机,我认为它将起作用。

I solved this problem by connecting the reader to the system on a Oracle VM virtualbox. I will try connect to other computers, I think it will work.

HID OMNIKEY 5427 CK不在KBW模式下工作

野の 2025-02-09 21:07:33

我怀疑这与rttf2pt1的问题有关(超额font依赖)如所述在这里在这里。对我有用的建议解决方案是降级RTTF2PT1如下:

remove.packages("Rttf2pt1")   
remotes::install_version("Rttf2pt1", version = "1.3.8") 

I suspect this is related to issues with Rttf2pt1 (upon which extrafont depends) as described here and here. Suggested solution which worked for me is to downgrade Rttf2pt1 as below:

remove.packages("Rttf2pt1")   
remotes::install_version("Rttf2pt1", version = "1.3.8") 

如何在Extrafont中解决错误状态5?

野の 2025-02-09 05:12:03

您可以在文档中找到答案:

此类在API级别29中被弃用。呼叫者应该使用
ConnectivitionManager.networkCallback API学习
连接性更改或切换到使用
ConnectivityManager#getNetworkCapabilities或
ConnectivitionManager#GetLinkProperties获取信息
同步。请记住,虽然保证回调
要求每个事件都要求同步呼叫没有这样的电话
约束,因此使用同步是不可预见的
回调中的方法通常不会提供
网络是一致的(也就是说:他们可以返回过去或
关于事件正在处理的未来状态
打回来)。相反,建议呼叫者仅使用
回调,可能会记住特定信息位
他们需要从一个回调到另一个回调。

https://developer.android.com/reference com/reference/reference/reference/android/android/android/android/net/net/networkinfo

因此,您可以使用网络限制来获取网络连接状态,只是,以下一个方式更改最后一个字符串:

return networkInfo != null && connectivityManager.getNetworkCapabilities(n).hasCapability(NetworkCapabilities.NET_CAPABILITY_VALIDATED);

详细信息 net_capibility_validated

表明该网络上的连接成功
经过验证。例如,对于具有NET_CAPIABIES_INTERTET的网络,它
意味着成功检测到了互联网连接。

You can find the answer in the documentation:

This class was deprecated in API level 29. Callers should instead use
the ConnectivityManager.NetworkCallback API to learn about
connectivity changes, or switch to use
ConnectivityManager#getNetworkCapabilities or
ConnectivityManager#getLinkProperties to get information
synchronously. Keep in mind that while callbacks are guaranteed to be
called for every event in order, synchronous calls have no such
constraints, and as such it is unadvisable to use the synchronous
methods inside the callbacks as they will often not offer a view of
networking that is consistent (that is: they may return a past or a
future state with respect to the event being processed by the
callback). Instead, callers are advised to only use the arguments of
the callbacks, possibly memorizing the specific bits of information
they need to keep from one callback to another.

https://developer.android.com/reference/android/net/NetworkInfo

So,you can use the NetworkCapabilities to get network connectivity state, just, change the last string in the next way:

return networkInfo != null && connectivityManager.getNetworkCapabilities(n).hasCapability(NetworkCapabilities.NET_CAPABILITY_VALIDATED);

Details regarding NET_CAPABILITY_VALIDATED :

Indicates that connectivity on this network was successfully
validated. For example, for a network with NET_CAPABILITY_INTERNET, it
means that Internet connectivity was successfully detected.

https://developer.android.com/reference/android/net/NetworkCapabilities#NET_CAPABILITY_VALIDATED

' activenetworkinfo' and' isConnectedorConnecting'被弃用

野の 2025-02-08 11:41:05

@html.displayfor()只能显示模型的值,如果要提交值,则需要使用< input> ,这是一个简单的演示,我在您的表单中添加 hidden 输入以提交值:

@model List<PartVM>
@{
    int i = 0;
}

    <form method="post">
        <div id="tblPullParts" class="container justify-content-center mt-3">
       
            <table class="table table-striped">
           
                <thead>
                    <tr>
                        <th></th>
                        <th >Order #</th>
                        <th >Item</th>
                        <th >Description</th>
                        <th >Quantity</th>
                    </tr>
                </thead>
                <tbody>
                    
                    @foreach (var p in Model)
                    {
                    
                    <tr>
                        <td><input type="radio" id="radio" name="radio"
                                value="@Html.DisplayFor(item => p.PartID)" /></td>
@*<td><input asp-for="Selected" type="radio" value="Selected" /></td>*@
                            <th scope="row">
                                @Html.DisplayFor(item => p.PartID)
                                <input type="hidden"  asp-for="@p.PartID" name="[@i].PartID">
                            </th>                                                
                            <td>
                                @Html.DisplayFor(item => p.Name)
                                
                            </td>
                           
                            <td>
                                @Html.DisplayFor(item => p.ItemLocation)
                                <input type="hidden"  asp-for="@p.ItemLocation" name="[@i].ItemLocation">
                            </td>
                            
                            <td>
                                @Html.DisplayFor(item => p.PartGroup)
                                <input type="hidden"  asp-for="@p.PartGroup" name="[@i].PartGroup">
                            </td>
                            
                            <td>
                                @Html.DisplayFor(item => p.Description)
                                <input type="hidden"  asp-for="@p.Description" name="[@i].Description">
                            </td>
                            <td>
                                <input type="text" asp-for="@p.Name"  name="[@i].Name" id="txtNameN" />
                            </td>                         
                    </tr>
                    i++;
                }
                    
                </tbody>

            </table>         
            @*<input type="text" id="@Model[0].Name" />*@
            <input type="text" id="txtName" name="txtName" value="" />
        </div>
        <div class="text-center">
            <button type="submit" class="btn btn-lg btn-success mt-3">Start Pick</button>

        </div>
 </form>

Controller

    [HttpPost]
    public async Task<IActionResult> Index( List<PartVM> model, string radio, string txtName)
    {

         //.....
    }

演示:

“在此处输入图像描述”

您的第二个问题可以参考此 github essue

编辑===========================

如果您想通过选择无线电的行,您需要JS才能实现这一目标。请参阅以下内容:

创建一个ViewModel

public class PartvmViewModel
{
    public int PartID { get; set; }
    public string Name { get; set; }
    public string ItemLocation { get; set; }
    public string PartGroup { get; set; }
    public string Description { get; set; }
    public string? txtName { get; set; }
}

控制器

public IActionResult Display()

{
    List<PartvmViewModel> viewmodel = new List<PartvmViewModel>();

//pass data from PartVM to PartvmViewModel
    foreach (var item in PartVms)
    {
        viewmodel.Add(new PartvmViewModel()
        {
            PartID = item.PartID,
            Description = item.Description,
            ItemLocation = item.ItemLocation,
            Name = item.Name,
            PartGroup = item.PartGroup
        });
    }
    return View(viewmodel);
}


[HttpPost]
public IActionResult Display([FromBody]PartvmViewModel model)
{
      //because the value of radio is equal to PartID,SO i don't write it as parameter here
      //.........
            
}

View

@model List<PartvmViewModel>
@{
    int i = 0;
}

<form method="post">
    <div id="tblPullParts" class="container justify-content-center mt-3">
       
        <table class="table table-striped">
           
            <thead>
            <tr>
                <th></th>
                <th >Order #</th>
                <th >Item</th>
                <th >Description</th>
                <th >Quantity</th>
            </tr>
            </thead>
            <tbody>
                    
            @foreach (var p in Model)
            {
                    
                <tr>
                    <td><input type="radio"  name="radio" onclick="Method(this)" 
                               value="@Html.DisplayFor(item => p.PartID)" /></td>
                    @*<td><input asp-for="Selected" type="radio" value="Selected" /></td>*@
                    <th scope="row">
                        @Html.DisplayFor(item => p.PartID)
                        <input type="hidden"  asp-for="@p.PartID" name="[@i].PartID" id="PartID">
                    </th>                                                
                    <td>
                        @Html.DisplayFor(item => p.Name)
                                
                    </td>
                           
                    <td>
                        @Html.DisplayFor(item => p.ItemLocation)
                        <input type="hidden"  asp-for="@p.ItemLocation" name="[@i].ItemLocation" id="ItemLocation">
                    </td>
                            
                    <td>
                        @Html.DisplayFor(item => p.PartGroup)
                        <input type="hidden"  asp-for="@p.PartGroup" name="[@i].PartGroup" id="PartGroup">
                    </td>
                            
                    <td>
                        @Html.DisplayFor(item => p.Description)
                        <input type="hidden"  asp-for="@p.Description" name="[@i].Description" id="Description">
                    </td>
                    <td>
                        <input type="text" asp-for="@p.Name"  name="[@i].Name" id="txtNameN" />
                    </td>                         
                </tr>
                i++;
            }
                    
            </tbody>

        </table>         
        @*<input type="text" id="@Model[0].Name" />*@
        <input type="text" id="txtName" name="txtName" value="" />
    </div>
    <div class="text-center">
        <button  class="btn btn-lg btn-success mt-3" onclick="Submit()">Start Pick</button>

    </div>
</form>

@section Scripts
{
    <script>
    
    var Data;
    
        function Method(obj){
            
            
             this.Data = {
                
                "PartID":$(obj).val(),
                
                "ItemLocation" : $(obj).parent().parent().find('td:eq(2)').find(':input').val(),
                
                "PartGroup" : $(obj).parent().parent().find('td:eq(3)').find(':input').val(),
                
                "Description" : $(obj).parent().parent().find('td:eq(4)').find(':input').val(),
                
                 "Name" : $(obj).parent().parent().find('td:eq(4)').find(':input').val(),
            }        
        }
        
        function Submit(){          
            Data.txtName = $("#txtName").val();           
           $.ajax({
                url : '/Home/Display',
                type : 'post',
                data : JSON.stringify(Data),
                contentType : 'application/json'
           });
        }
    </script>
}

我的意见================================= ====

实际上,在我看来,通过数据列表还可以。因为我注意到您将无线电的值传递到控制器中,所以您可以使用:

[HttpPost]
    public async Task<IActionResult> Index( List<PartVM> model, string radio, string txtName)
    {
     
        var item = model.Where(i => i.PartID == int.Parse(radio)).FirstOrDefault();
         //.....
    }

要获取所选行,它比使用JS更容易;

@Html.DisplayFor() can only display the value of model, If you want to submit the value, You need to use <input>,Here is a simple demo, I add hidden input in your form to submit the value:

@model List<PartVM>
@{
    int i = 0;
}

    <form method="post">
        <div id="tblPullParts" class="container justify-content-center mt-3">
       
            <table class="table table-striped">
           
                <thead>
                    <tr>
                        <th></th>
                        <th >Order #</th>
                        <th >Item</th>
                        <th >Description</th>
                        <th >Quantity</th>
                    </tr>
                </thead>
                <tbody>
                    
                    @foreach (var p in Model)
                    {
                    
                    <tr>
                        <td><input type="radio" id="radio" name="radio"
                                value="@Html.DisplayFor(item => p.PartID)" /></td>
@*<td><input asp-for="Selected" type="radio" value="Selected" /></td>*@
                            <th scope="row">
                                @Html.DisplayFor(item => p.PartID)
                                <input type="hidden"  asp-for="@p.PartID" name="[@i].PartID">
                            </th>                                                
                            <td>
                                @Html.DisplayFor(item => p.Name)
                                
                            </td>
                           
                            <td>
                                @Html.DisplayFor(item => p.ItemLocation)
                                <input type="hidden"  asp-for="@p.ItemLocation" name="[@i].ItemLocation">
                            </td>
                            
                            <td>
                                @Html.DisplayFor(item => p.PartGroup)
                                <input type="hidden"  asp-for="@p.PartGroup" name="[@i].PartGroup">
                            </td>
                            
                            <td>
                                @Html.DisplayFor(item => p.Description)
                                <input type="hidden"  asp-for="@p.Description" name="[@i].Description">
                            </td>
                            <td>
                                <input type="text" asp-for="@p.Name"  name="[@i].Name" id="txtNameN" />
                            </td>                         
                    </tr>
                    i++;
                }
                    
                </tbody>

            </table>         
            @*<input type="text" id="@Model[0].Name" />*@
            <input type="text" id="txtName" name="txtName" value="" />
        </div>
        <div class="text-center">
            <button type="submit" class="btn btn-lg btn-success mt-3">Start Pick</button>

        </div>
 </form>

Controller

    [HttpPost]
    public async Task<IActionResult> Index( List<PartVM> model, string radio, string txtName)
    {

         //.....
    }

Demo:

enter image description here

Your second question can refer to this github issue.

Edit============================

If you want just want to pass the row where radio is selected, you need to js to achieve this. refer to this:

Create a ViewModel

public class PartvmViewModel
{
    public int PartID { get; set; }
    public string Name { get; set; }
    public string ItemLocation { get; set; }
    public string PartGroup { get; set; }
    public string Description { get; set; }
    public string? txtName { get; set; }
}

controller

public IActionResult Display()

{
    List<PartvmViewModel> viewmodel = new List<PartvmViewModel>();

//pass data from PartVM to PartvmViewModel
    foreach (var item in PartVms)
    {
        viewmodel.Add(new PartvmViewModel()
        {
            PartID = item.PartID,
            Description = item.Description,
            ItemLocation = item.ItemLocation,
            Name = item.Name,
            PartGroup = item.PartGroup
        });
    }
    return View(viewmodel);
}


[HttpPost]
public IActionResult Display([FromBody]PartvmViewModel model)
{
      //because the value of radio is equal to PartID,SO i don't write it as parameter here
      //.........
            
}

View

@model List<PartvmViewModel>
@{
    int i = 0;
}

<form method="post">
    <div id="tblPullParts" class="container justify-content-center mt-3">
       
        <table class="table table-striped">
           
            <thead>
            <tr>
                <th></th>
                <th >Order #</th>
                <th >Item</th>
                <th >Description</th>
                <th >Quantity</th>
            </tr>
            </thead>
            <tbody>
                    
            @foreach (var p in Model)
            {
                    
                <tr>
                    <td><input type="radio"  name="radio" onclick="Method(this)" 
                               value="@Html.DisplayFor(item => p.PartID)" /></td>
                    @*<td><input asp-for="Selected" type="radio" value="Selected" /></td>*@
                    <th scope="row">
                        @Html.DisplayFor(item => p.PartID)
                        <input type="hidden"  asp-for="@p.PartID" name="[@i].PartID" id="PartID">
                    </th>                                                
                    <td>
                        @Html.DisplayFor(item => p.Name)
                                
                    </td>
                           
                    <td>
                        @Html.DisplayFor(item => p.ItemLocation)
                        <input type="hidden"  asp-for="@p.ItemLocation" name="[@i].ItemLocation" id="ItemLocation">
                    </td>
                            
                    <td>
                        @Html.DisplayFor(item => p.PartGroup)
                        <input type="hidden"  asp-for="@p.PartGroup" name="[@i].PartGroup" id="PartGroup">
                    </td>
                            
                    <td>
                        @Html.DisplayFor(item => p.Description)
                        <input type="hidden"  asp-for="@p.Description" name="[@i].Description" id="Description">
                    </td>
                    <td>
                        <input type="text" asp-for="@p.Name"  name="[@i].Name" id="txtNameN" />
                    </td>                         
                </tr>
                i++;
            }
                    
            </tbody>

        </table>         
        @*<input type="text" id="@Model[0].Name" />*@
        <input type="text" id="txtName" name="txtName" value="" />
    </div>
    <div class="text-center">
        <button  class="btn btn-lg btn-success mt-3" onclick="Submit()">Start Pick</button>

    </div>
</form>

@section Scripts
{
    <script>
    
    var Data;
    
        function Method(obj){
            
            
             this.Data = {
                
                "PartID":$(obj).val(),
                
                "ItemLocation" : $(obj).parent().parent().find('td:eq(2)').find(':input').val(),
                
                "PartGroup" : $(obj).parent().parent().find('td:eq(3)').find(':input').val(),
                
                "Description" : $(obj).parent().parent().find('td:eq(4)').find(':input').val(),
                
                 "Name" : $(obj).parent().parent().find('td:eq(4)').find(':input').val(),
            }        
        }
        
        function Submit(){          
            Data.txtName = $("#txtName").val();           
           $.ajax({
                url : '/Home/Display',
                type : 'post',
                data : JSON.stringify(Data),
                contentType : 'application/json'
           });
        }
    </script>
}

My opinion==========================

Actually, In my opinion, Pass the list of data is ok. Because i notice that you pass the value of radio into the controller, You can just use:

[HttpPost]
    public async Task<IActionResult> Index( List<PartVM> model, string radio, string txtName)
    {
     
        var item = model.Where(i => i.PartID == int.Parse(radio)).FirstOrDefault();
         //.....
    }

to get the selected row, It is more easier than using js;

.NET 6-将单选按钮选择的表行传递到控制器

野の 2025-02-08 04:56:31

您将更新值存储在不同的状态下,即 updatecity 状态,但是您应该做的是更新原始 coities 状态。尽管这两个状态无关,同时您的UI取决于 cities 状态数据,因此,如果您想更新UI,您需要做的是更新 code> codies “通过使用它的setter函数 setCities ”状态。

就像传递状态一样,您也将其传递给它的设置器,并使用Setter函数更新状态的值:

// CitiesPage
{cities.map((city) => {
    return <CityCard key={city.id} city={city} setCities={setCities} />;
})}

// CityCard
export const CityCard = ({ city, setCities }: CityProps) => {
    // ...

    return (
        // ...
        <ModalPortal onClose={handleClose}>
          <EditCityForm city={city} closeModal={setShowModal} setCities={setCities} />
        </ModalPortal>
        // ...
    )
}


// EditCityForm
export const EditCityForm = ({ city, closeModal, setCities }: Props) => {
  // const [updateCity, setUpdateCity] = useState<UpdateCity>({  // no need for this
  //   countryId: "",
  //   isoCode: "",
  //   name: "",
  // });  

  const handleSubmit = (evt: FormEvent<HTMLFormElement>) => {
    evt.preventDefault();
    const { id: cityId } = city;
    setCities(); // your update logic
    closeModal(false);
  };
}

You are storing the updated value in a different state, namely the updateCity state, but what you should be doing is update the origional cities state. While these two states are not related, and at the same time your UI is depend on cities state's data, so if you wish to update UI, what you need to do is update cities' state by using it's setter function setCities.

Just like passing down state, you pass it's setters as well, and use the setter function to update state's value:

// CitiesPage
{cities.map((city) => {
    return <CityCard key={city.id} city={city} setCities={setCities} />;
})}

// CityCard
export const CityCard = ({ city, setCities }: CityProps) => {
    // ...

    return (
        // ...
        <ModalPortal onClose={handleClose}>
          <EditCityForm city={city} closeModal={setShowModal} setCities={setCities} />
        </ModalPortal>
        // ...
    )
}


// EditCityForm
export const EditCityForm = ({ city, closeModal, setCities }: Props) => {
  // const [updateCity, setUpdateCity] = useState<UpdateCity>({  // no need for this
  //   countryId: "",
  //   isoCode: "",
  //   name: "",
  // });  

  const handleSubmit = (evt: FormEvent<HTMLFormElement>) => {
    evt.preventDefault();
    const { id: cityId } = city;
    setCities(); // your update logic
    closeModal(false);
  };
}

以表格提交时,我可以更新状态

野の 2025-02-08 03:54:00

根据我的经验,最快的方法是将64位商店指令逐个列出。

typedef struct {
    uint32_t data_count;
    uint8_t data[512];
    uint32_t error_count;
    uint8_t errors[512];
} measurements_t;


void zoo(measurements_t *m)
{
    uint64_t *x = (uint64_t *)m;
    #pragma GCC unroll sizeof(*m) / sizeof(*x)
    for(int i = 0; i < sizeof(*m) / sizeof(*x); i++)
        x[i] = 0;
}

https://godbolt.org/z/6wv1dyxfpp

使其更快地进入ITCM内存,并在ITCM内存中更快地放置代码可能进入DTCM内存的结构。它将地址和数据总线分开。

From my experience the fastest way is to have long list of 64 bit store instructions one after another.

typedef struct {
    uint32_t data_count;
    uint8_t data[512];
    uint32_t error_count;
    uint8_t errors[512];
} measurements_t;


void zoo(measurements_t *m)
{
    uint64_t *x = (uint64_t *)m;
    #pragma GCC unroll sizeof(*m) / sizeof(*x)
    for(int i = 0; i < sizeof(*m) / sizeof(*x); i++)
        x[i] = 0;
}

https://godbolt.org/z/6Wv1dYxfP

to make it faster place code into ITCM memory and if possible structures into DTCM memory. It separates address and data busses.

用零开始初始化大型结构,需要多少个Cortex-M7 CPU周期?

野の 2025-02-08 02:15:55

我猜你是伊朗人,我也遇到了这个问题,原因是Shecan(شک筹)是启用的。我禁用了Shecan,它起作用了!
(或其他类似工具!)

I guess you are Iranian, I also had this problem and the reason was that the Shecan (شکن) was enable. I disabled the Shecan and it worked!
(or other similar tools!)

Google colab ipython笔记本文件通常无法保存

野の 2025-02-07 23:18:59

尝试以下方法。创建一个书籍的实例,并将值从输入类型分配给其。

@Mutation(() => Book)
async createBook(@Arg("data") data: CreateBookInput) {
  const book = Book.create(Book, data);
  await book.save();
  return book;
}

或者

@Mutation(() => Book)
async createBook(@Arg("data") data: CreateBookInput) {
  const book = new Book();
  Object.assign(book, data);
  await book.save();
  return book;
}

Try with the following approach. Create an instance of Book and assign the values from the input type to it.

@Mutation(() => Book)
async createBook(@Arg("data") data: CreateBookInput) {
  const book = Book.create(Book, data);
  await book.save();
  return book;
}

or

@Mutation(() => Book)
async createBook(@Arg("data") data: CreateBookInput) {
  const book = new Book();
  Object.assign(book, data);
  await book.save();
  return book;
}

如何使用Type-graphQl来调用Typeorm的基础,什么时候创建?

野の 2025-02-07 21:36:09

最常见的原因是从 feature -branch - &gt中挤压提交。 开发,然后在开发 master 之间再次挤压。使用GIT命令行在本地修复非常容易。您需要在计算机上安装GIT,然后可以按照以下步骤操作:

  • 单击右上角的 clone 并复制给定的URL。
  • 克隆回购: git克隆[复制URL]
  • 确保您在主上: git Checkout Master
  • 创建一个新分支: git Checkout -b fix_merge_conflicts
  • 从开发中合并: git合并开发
  • git将为您提供有冲突的文件列表,打开这些文件并通过删除适当的行来解决冲突。
  • 添加固定的文件: git add myfile.txt文件夹/otherfile.py
  • 提交您的更改: git commit
  • 如果消息看起来还不错,请退出编辑器(通常 vi> vi vi ,因此请使用:WQ 退出)。
  • 再次结帐大师: git Checkout Master
  • 在分支的更改中合并: git Merge fix_merge_conflicts
  • 结帐开发: git chechbout devence
  • 在分支的更改中合并: git Merge fix_merge_conflicts
  • 将所有更改推回您的代码存储库: git push

The most common cause of this is squashing commits from feature-branch -> develop and then again squashing between develop and master. This is fairly easy to fix locally using the git command line. You'll need to have git installed on your machine and then you can follow the following steps:

  • Click Clone in the top right and copy the url given. enter image description here
  • Clone the repo: git clone [COPIED URL]
  • Make sure you're on master: git checkout master
  • Create a new branch: git checkout -b fix_merge_conflicts
  • Merge from develop: git merge develop
  • Git will give you a list of files with conflicts, open these and fix the conflicts by removing appropriate lines.
  • Add the fixed files: git add myfile.txt folder/otherfile.py
  • Commit your changes: git commit
  • If the message looks okay, exit the editor (normally vi, so use :wq to exit).
  • Checkout master again: git checkout master
  • Merge in changes from your branch: git merge fix_merge_conflicts
  • Checkout develop: git checkout develop
  • Merge in changes from your branch: git merge fix_merge_conflicts
  • Push all changes back to your Code Repository: git push

当开发过时分支机构时,如何合并拉力请求?

野の 2025-02-07 18:11:07

编辑:我最终在Github上制定了该概念。 Check out: https://github.com/sivabudh/system-in- A-box


首先,我的答案是针对2组人:使用Mac的人和使用Linux的人。

主机网络模式在Mac上不起作用。您必须使用IP别名,请参阅: https://stackoverflow.com/a/43541681/2713729

主机网络模式?请参阅: https://docs.docker.com/engine.com/engine/regine/reference/reference/run-run /#/网络插条

其次,对于使用Linux的人(我的直接经验是Ubuntu 14.04 LTS,我很快就会升级到16.04 LTS), ,您可以使在Docker容器中运行的服务连接到 localhost 在Docker主机上运行的服务(例如,笔记本电脑)。

如何?

关键是当您运行Docker容器时,必须使用主机模式运行它。命令看起来像这样:

docker run -network =“ host” -id&lt&docker image id&gt;

当您进行 ifconfig (您需要> code>) apt-get安装net-tools 您的容器在您的容器内进行 ifConfig ),您会看到网络接口与Docker主机上的网络接口相同(例如。笔记本电脑)。

重要的是要注意,我是Mac用户,但是我在相似之处下运行Ubuntu,因此使用Mac并不是一个不利条件。 ;-)

这就是您将NGINX容器连接到在 localhost 上运行的MySQL的方式。

Edit: I ended up prototyping out the concept on GitHub. Check out: https://github.com/sivabudh/system-in-a-box


First, my answer is geared towards 2 groups of people: those who use a Mac, and those who use Linux.

The host network mode doesn't work on a Mac. You have to use an IP alias, see: https://stackoverflow.com/a/43541681/2713729

What is a host network mode? See: https://docs.docker.com/engine/reference/run/#/network-settings

Secondly, for those of you who are using Linux (my direct experience was with Ubuntu 14.04 LTS and I'm upgrading to 16.04 LTS in production soon), yes, you can make the service running inside a Docker container connect to localhost services running on the Docker host (eg. your laptop).

How?

The key is when you run the Docker container, you have to run it with the host mode. The command looks like this:

docker run --network="host" -id <Docker image ID>

When you do an ifconfig (you will need to apt-get install net-tools your container for ifconfig to be callable) inside your container, you will see that the network interfaces are the same as the one on Docker host (eg. your laptop).

It's important to note that I'm a Mac user, but I run Ubuntu under Parallels, so using a Mac is not a disadvantage. ;-)

And this is how you connect NGINX container to the MySQL running on a localhost.

从Docker容器的内部,如何连接到机器的本地主机?

野の 2025-02-07 18:06:58

沿线的东西

"policyRule": {
  "if": {
    "field": "type",
    "equals": "Microsoft.Resources/subscriptions"
  },
  "then": {
    "effect": "deployIfNotExists",
    "details": {
      "type": "Microsoft.Resources/Subscriptions/resourcegroups",
      "roleDefinitionIds": [
        "/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c"
      ],
      "evaluationDelay": "AfterProvisioning",
      "existenceCondition": {
        "field": "name",
        "equals": "myResourceGroup"
      },
      "resourceGroupName": "myResourceGroup",
      "deploymentScope": "subscription",
      "deployment": {
        "location": "canadacentral",
        "properties": {
          "mode": "incremental",
          "template": {
            "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
            "contentVersion": "1.0.0.0",
            "parameters": {},
            "variables": {},
            "resources": [
              {
                "name": "myResourceGroup",
                "type": "Microsoft.Resources/resourceGroups",
                "apiVersion": "2019-10-01",
                "location": "canadacentral"
              }
            ],
            "outputs": {}
          }
        }
      }
    }
  }
}

Something along the lines

"policyRule": {
  "if": {
    "field": "type",
    "equals": "Microsoft.Resources/subscriptions"
  },
  "then": {
    "effect": "deployIfNotExists",
    "details": {
      "type": "Microsoft.Resources/Subscriptions/resourcegroups",
      "roleDefinitionIds": [
        "/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c"
      ],
      "evaluationDelay": "AfterProvisioning",
      "existenceCondition": {
        "field": "name",
        "equals": "myResourceGroup"
      },
      "resourceGroupName": "myResourceGroup",
      "deploymentScope": "subscription",
      "deployment": {
        "location": "canadacentral",
        "properties": {
          "mode": "incremental",
          "template": {
            "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
            "contentVersion": "1.0.0.0",
            "parameters": {},
            "variables": {},
            "resources": [
              {
                "name": "myResourceGroup",
                "type": "Microsoft.Resources/resourceGroups",
                "apiVersion": "2019-10-01",
                "location": "canadacentral"
              }
            ],
            "outputs": {}
          }
        }
      }
    }
  }
}

您如何将具有Azure策略的资源组部署?

野の 2025-02-07 17:25:07

有很多方法可以实现您所需的结果,但这是最直接的开始。

您可以使用JavaScript MAP 来定义关键字/响应对,而不是为每个可能的关键字创建语句语句。
MAP 的键将是您的关键字, MAP 的值将是您的响应:

const keywordResponseMap = new Map([
    ['testpark2', 'StartMyParking:\n\nTo start your parking, please click this link: https://blahblah2.com'],
    ['testpark3', 'StartMyParking:\n\nTo start your parking, please click this link: https://blahblah3.com'],
    ['testpark', 'StartMyParking:\n\nTo start your parking, please click this link: https://blahblah.com'],
]);

const keywords = Array.from(keywordResponseMap.keys());
let keyword;

if (incomingMessage.includes('bye')) {
    twiml.message('Goodbye!');
}
else if (keyword = keywords.find(k => incomingMessage.includes(k))) {
    const response = keywordResponseMap.get(keyword);
    twiml.message(response);
} else {
    twiml.message('Please check your zone/code and try again.');
}

另请注意,我正在放置 bye 前面的案例是因为它比在 IncomingMessage 中寻找关键字更具性能,因此,当用户说 bye 时,您避免了不必要地进行处理。

您可以使用查找来搜索 IncomingMessage 中的任何关键字,然后您可以使用 keyword 来检索响应来自地图。

如果您的响应始终是相同的,除了URL外,您可以通过仅将URL存储在地图中并使用类似的字符串插值来进一步优化它:

const keywordUrlMap = new Map([
    ['testpark2', 'https://blahblah2.com'],
    ['testpark3', 'https://blahblah3.com'],
    ['testpark', 'https://blahblah.com'],
]);

const keywords = Array.from(keywordUrlMap.keys());
let keyword;

if (incomingMessage.includes('bye')) {
    twiml.message('Goodbye!');
}
else if (keyword = keywords.find(k => incomingMessage.includes(k))) {
    const url = keywordUrlMap.get(keyword);
    twiml.message(`StartMyParking:\n\nTo start your parking, please click this link: ${url}`);
} else {
    twiml.message('Please check your zone/code and try again.');
}

也必须注意,我正在放置 testpark 在地图中的最后一次是因为 testPark 匹配 testPark2 testpark3 。如果您将其放在首位,即使用户提交 testPark2 或类似值,它也总是会解决 testpark
另外,我正在使用 map 类型,因为它保证了返回密钥的顺序,这对于上一点点很重要。

当您有更多的关键字和响应时,您可能必须开始查看一个解决方案以像数据库一样在外部存储它们,并通过关键字查询数据库以解决响应。

祝您好运,我们迫不及待想看看您的建造!

There are a lot of ways to achieve your desired outcome, but here's the most straightforward to begin with.

Instead of creating an else if statement for every possible keyword, you could define the keyword/response pairs up front using a JavaScript Map.
The keys of the Map will be your keywords, the values of the Map will be your responses:

const keywordResponseMap = new Map([
    ['testpark2', 'StartMyParking:\n\nTo start your parking, please click this link: https://blahblah2.com'],
    ['testpark3', 'StartMyParking:\n\nTo start your parking, please click this link: https://blahblah3.com'],
    ['testpark', 'StartMyParking:\n\nTo start your parking, please click this link: https://blahblah.com'],
]);

const keywords = Array.from(keywordResponseMap.keys());
let keyword;

if (incomingMessage.includes('bye')) {
    twiml.message('Goodbye!');
}
else if (keyword = keywords.find(k => incomingMessage.includes(k))) {
    const response = keywordResponseMap.get(keyword);
    twiml.message(response);
} else {
    twiml.message('Please check your zone/code and try again.');
}

Also note that I'm putting the bye case up front because it is more performant than looking for the keywords in the incomingMessage, thus you avoid unnecessarily doing that processing when a user says bye.

You can use find to search for any keyword that is in the incomingMessage, then you can use the keyword that you found to retrieve the response from the map.

If your response will always be the same except for the URL, you could further optimize this by only storing the URL in the map and using string interpolation like this:

const keywordUrlMap = new Map([
    ['testpark2', 'https://blahblah2.com'],
    ['testpark3', 'https://blahblah3.com'],
    ['testpark', 'https://blahblah.com'],
]);

const keywords = Array.from(keywordUrlMap.keys());
let keyword;

if (incomingMessage.includes('bye')) {
    twiml.message('Goodbye!');
}
else if (keyword = keywords.find(k => incomingMessage.includes(k))) {
    const url = keywordUrlMap.get(keyword);
    twiml.message(`StartMyParking:\n\nTo start your parking, please click this link: ${url}`);
} else {
    twiml.message('Please check your zone/code and try again.');
}

It is also important to note that I'm putting testpark last in the map because testpark matches to testpark2 and testpark3. If you'd put it first, it would always resolve to testpark even with a user submits testpark2 or similar values.
Also, I'm using the Map type because it guarantees the order in which the keys are returned, which is again important for the previous point.

When you have a lot more keywords and responses, you may have to start looking at a solution to store them externally like a database, and query the database by keyword to resolve the response.

Good luck, we can't wait to see what you build!

在Twilio功能中包括多个传入的SMS消息/响应

野の 2025-02-07 04:06:34

确保您有 selenium.通过导入

from selenium.webdriver.common.by import By

不要在代码中添加“ by =”和“ value =”部分。

WebDriverWait

使用 webdriverrer's> webdriverriverwait 方法。运行以下命令:

inputElement = WebDriverWait(driver, 20).until(EC.visibility_of_all_elements_located((By.CLASS_NAME, 'su-input-group')))

确保您也有这些导入:

from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

Make sure you have Selenium.By imported:

from selenium.webdriver.common.by import By

Do not add the "by=" and "value=" portion to the code.

WebDriverWait

It is also a better idea to locate your elements using the WebDriverWait method. Run the following command:

inputElement = WebDriverWait(driver, 20).until(EC.visibility_of_all_elements_located((By.CLASS_NAME, 'su-input-group')))

Make sure you also have these imports:

from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

如何在Python和Selenium中使用标签名称或ID获取元素

野の 2025-02-06 11:01:05

板单元不得超过50,000个字符:

当您将文档从Excel转换为Google表格时,任何具有超过50,000个字符的单元格都将在表中删除。

我建议您将数据分为几个单元格。

参考:

A Sheets cell cannot have more than 50,000 characters:

When you convert a document from Excel to Google Sheets, any cell with more than 50,000 characters will be removed in Sheets.

I'd suggest you to split your data into several cells.

Reference:

Google电子表格错误文本结果的文本结果长于50000个字符的极限

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

更多

友情链接

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文