小编Nil*_*ngh的帖子

对JavaScript中的一个元素进行排序

我有一个数组,我正在排序它,但我需要排序除了我的数组的一个元素以外的所有内容.

我的阵列是:

var Comparison = [
    {key: "None", value: "None"},
    {key:"Geographical Area", value:"Geographical_Area"},
    {key:"Forests", value:"Forests"},
    {key:"Barren Unculturable Land", value:"Barren_Unculturable_Land"},
    {key:"Land put to Non agricultural use", value:"Land_put_to_Non_agricultural_use"},
    {key:"Land Area", value:"Land_Area"},
    {key:"Water Area", value:"Water_Area"},
    {key:"Culturable Waste", value:"Culturable_Waste"},
    {key:"Permanent Pastures", value:"Permanent_Pastures"},
    {key:"Land under Tree Crops", value:"Land_under_Tree_Crops"},
    {key:"Fallow Land excl Current Fallow", value:"Fallow_Land_excl_Current_Fallow"},
    {key:"Current Fallow", value:"Current_Fallow"},
    {key:"Total Unculturable Land", value:"Total_Unculturable_Land"},
    {key:"Net Sown Area", value:"Net_Sown_Area"},
    {key:"Gross Sown Area", value:"Gross_Sown_Area"},
    {key:"Cropping Intensity", value:"Cropping_Intensity"} ];
Run Code Online (Sandbox Code Playgroud)

我正在使用此代码对此数组进行排序:

var Comparison_sort = this.Comparison.sort(function (a, b) {
  if (a.key < b.key) …
Run Code Online (Sandbox Code Playgroud)

javascript arrays sorting

22
推荐指数
5
解决办法
5251
查看次数

如何在Android上的其他应用程序中触发数据共享中的点击或发送事件?

我正在尝试将数据从我的应用程序共享到其他应用程序,如短信或任何其他应用程序.我有一个应用程序,我需要发送或共享一些数据到应用程序,如短信或fb信使.通过链接,我可以打开应用程序并使用以下代码将数据添加到文本框中:

  Intent sendIntent = new Intent();
  sendIntent.setPackage("com.sms or fb");
  sendIntent.setAction(Intent.ACTION_SEND);
  sendIntent.putExtra(Intent.EXTRA_TEXT, "This is my text to send.");
  sendIntent.setType("text/plain");
  startActivity(sendIntent);
Run Code Online (Sandbox Code Playgroud)

使用这个应用程序,我可以打开其他应用程序,并在文本区域中添加值我的问题是有什么办法,我可以触发点击或发送事件发送自动消息到其他应用程序,如短信Facebook.如果是这样,我如何看到谷歌应用程序,我用我的声音发送给我的whatsapp联系人,所以这种方法是谷歌应用程序可以使用我的声音发送消息和触发事件.我的问题是如何使用我的Android代码触发事件发送.如果root系统在那里我也可以使用它.

没有一个答案甚至接近我想要解决的问题,没有答案值得赏心悦目.

android eventtrigger

13
推荐指数
1
解决办法
1581
查看次数

如何将MySQL`LIMIT`子句转换为PostgreSQL`LIMIT`子句?

MySQL查询示例:

    SELECT message_id, message_text
    FROM messages
    LIMIT 0 , 30
Run Code Online (Sandbox Code Playgroud)

我得到这个提示是一个错误:

HINT: Use separate LIMIT and OFFSET clauses.
Run Code Online (Sandbox Code Playgroud)

mysql postgresql

7
推荐指数
1
解决办法
3367
查看次数

电子打开外部网址

我正在尝试使用电子创建桌面应用程序,但我无法加载任何外部 url,如 google.com 或任何东西。

当我在 index.html 中使用此代码时:

   <!DOCTYPE html>
  <html>
    <head>
      <meta charset="UTF-8">
      <title>Hello World!</title>
    </head>
    <body>
      <h1>Hello World!</h1>
      <!-- All of the Node.js APIs are available in this renderer process. -->
      <iframe src="http://www.w3schools.com"></iframe>


      <script>
        // You can also require other files to run in this process
        require('./renderer.js')
      </script>
    </body>
  </html>
Run Code Online (Sandbox Code Playgroud)

我收到此错误:

  index.html:1 Refused to display 'https://www.w3schools.com/' in a frame because it set 'X-Frame-Options' to 'sameorigin'.
  www.w3schools.com/ Failed to load resource: net::ERR_BLOCKED_BY_RESPONSE
Run Code Online (Sandbox Code Playgroud)

我的问题是我可以打开 atom 内的任何 url 如果是,那么当我将它作为桌面应用程序或 android 应用程序时它会起作用吗

electron

7
推荐指数
2
解决办法
2万
查看次数

Laravel 5.2 curl_init() 抛出错误“调用未定义的函数”

我正在尝试使用 curl 在 laravel 中使用 FCM,但出现错误。首先,我在我的一个控制器中编写了一个 php 代码,它是:

$first_name = $request->input('first_name');
      //FCM api URL
      $url = 'https://fcm.googleapis.com/fcm/send';
      //api_key available in Firebase Console -> Project Settings -> CLOUD MESSAGING -> Server key
      $server_key = 'AIzaSyA1RyuAGGPASh_flFCwiyd9ZHEMYlhQOho';
   $target = "r_token";
      $fields = array();
      $fields['data'] = $first_name;
      if(is_array($target)){
        $fields['registration_ids'] = $target;
      }else{
        $fields['to'] = $target;
      }
      //header with content_type api key
      $headers = array(
        'Content-Type:application/json',
        'Authorization:key='.$server_key
      );

      $ch = curl_init();
      curl_setopt($ch, CURLOPT_URL, $url);
      curl_setopt($ch, CURLOPT_POST, true);
      curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, …
Run Code Online (Sandbox Code Playgroud)

php curl laravel-5

6
推荐指数
2
解决办法
1万
查看次数

如何使用Paperclip在Rails 4中上传多个图像

我正在尝试为我的市场控制器创建一个图像库我可以使用回形针上传单个图像.我在谷歌上搜索但我找不到任何解决方案.如何使用回形针上传多个图像并以图库的形式显示.有什么办法吗?请给我答案.

ruby-on-rails image-gallery paperclip ruby-on-rails-4

3
推荐指数
1
解决办法
4614
查看次数

如何重新加载制表数据表中的数据?

我正在尝试使用制表符加载动态数据我可以使用以下代码生成表格和数据:

 $("#example-table").tabulator({
        layout:"fitColumns",

        columns:[ //Define Table Columns
        {title:"Name", field:"name", width:150},
        {title:"Age", field:"age", align:"left", formatter:"progress"},
        {title:"Favourite Color", field:"col"},
        {title:"Date Of Birth", field:"dob", sorter:"date", align:"center"},
    ],
      });
      var tabledata = [
      {id:1, name:"Oli Bob", age:"12", col:"red", dob:""},
      {id:2, name:"Mary May", age:"1", col:"blue", dob:"14/05/1982"},
      {id:3, name:"Christine Lobowski", age:"42", col:"green", dob:"22/05/1982"},
      {id:4, name:"Brendon Philips", age:"125", col:"orange", dob:"01/08/1980"},
      {id:5, name:"Margret Marmajuke", age:"16", col:"yellow", dob:"31/01/1999"},
      ];

    //  $("#example-table").tabulator("setData", []);

      $("#example-table").tabulator("setData", tabledata);
Run Code Online (Sandbox Code Playgroud)

但是,当我尝试重新加载相同的数据 onclick 函数时,出现错误:

 Options Error - Tabulator does not allow options to be …
Run Code Online (Sandbox Code Playgroud)

tabulator

3
推荐指数
1
解决办法
7095
查看次数

Odoo 资产未加载

我有一个 ODOO 应用程序,在一般情况下运行良好。我正在尝试将数据库托管到另一台服务器。

我正在创建和备份数据库并将其上传到我的云 SQL。我更改了数据库名称并从本地数据库上传了备份数据,然后。我正在使用此配置来启动服务器:

[options]
; This is the password that allows database operations:
admin_passwd = mb_staging
db_host = my-ip
db_port = 5432
db_user = odoo
db_password = ....
;addons_path = ....
addons_path = ....
logfile = /var/log/odoo/odoo12.log
;dbfilter=db_name
xmlrpc_port=8069
longpolling_port = 8072
proxy_mode = True
Run Code Online (Sandbox Code Playgroud)

我正在运行此配置,并且要选择数据库并选择数据库名称,但收到此错误:

Uncaught TypeError: odoo.define is not a function
Run Code Online (Sandbox Code Playgroud)

我无法加载任何资源。有什么方法可以生成新资产或更改路径。

该文件夹内有一个文件:

~/.local/share/Odoo/filestore/db_name
Run Code Online (Sandbox Code Playgroud)

我不知道如何生成资产文件以及需要将哪个文件复制到哪个文件夹。

当我使用默认配置运行 odoo 时,所有内容均为 false。效果很好。

在哪里可以找到默认的资源文件夹?里面这个:

~/.local/share/Odoo/filestore
Run Code Online (Sandbox Code Playgroud)

有一个文件夹是我移动的新数据库名称。

assets odoo

3
推荐指数
1
解决办法
3215
查看次数

命令“python setup.py Egg_info”失败,/tmp/pip-install-xtrlkujj/pyaudio/ 中的错误代码为 1

我正在尝试 balena 推送 Dockerfile。我的代码经过多次调整,仍然报错,无法推送。我的代码显示:

 FROM balenalib/fincm3-debian-python:latest

# RUN install_packages git

RUN apt-get update 
RUN apt-get install python -y\
        && apt-get install python3-pip -y
RUN apt-get install libportaudio0 libportaudio2 libportaudiocpp0 portaudio19-dev -y 
RUN pip3 install pyaudio numpy matplotlib \
             scipy librosa

# Set our working directory
WORKDIR /usr/src/app

COPY Recorder.py /usr/src/app

# Recorder.py will run when the container starts up on the device
CMD ["python","/usr/src/app/Recorder.py"]
Run Code Online (Sandbox Code Playgroud)

和错误:

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-xtrlkujj/pyaudio/
Run Code Online (Sandbox Code Playgroud)

python docker dockerfile balena

3
推荐指数
1
解决办法
3万
查看次数

Rails 禁用编辑更新删除路线

我正在尝试找到一种方法来禁用资源路由,例如编辑销毁和更新。可以使用这个答案来完成。禁用路由在这个答案中我可以输入如下代码:

resources :books, except: [:edit, :destroy]
Run Code Online (Sandbox Code Playgroud)

它会起作用,但我有一个独特的问题,我创建了许多资源路由,我的路由文件如下所示:

         resources :expenditure_management2s do 
                            collection { post :import }
                            collection { get :dropdown }
                            collection { get :test }
                            end 
        resources :expenditure_management1s do 
                            collection { post :import }
                            collection { get :dropdown }
                            collection { get :test }
                            end 
        resources :expenditure_managements do 
                            collection { post :import }
                            collection { get :dropdown }
                            collection { get :test }
                            end 
                 ......
Run Code Online (Sandbox Code Playgroud)

我有差不多100条这样的路线,如果我必须一一改变这些方法,那将是一项艰巨的任务。有什么方法可以将这些路由分组为某种方法并拒绝编辑更新并销毁所有资源路由。

routes ruby-on-rails

2
推荐指数
1
解决办法
437
查看次数