RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / user-272446

RomanOks's questions

Martin Hope
RomanOks
Asked: 2020-07-15 18:37:24 +0000 UTC

如何在应用程序而不是浏览器中打开链接

  • 1

该项目基于 Ruby on Rails 构建,有适用于 ios/android 的移动应用程序。

任务:将打开的链接重定向到这些应用程序。

例如:我在手机上单击网站上的个人资料链接,它会在移动应用程序中打开。

实现这一点需要什么?

android
  • 1 个回答
  • 10 Views
Martin Hope
RomanOks
Asked: 2020-06-20 14:50:33 +0000 UTC

通过邮箱中的链接登录网站

  • 0

有一个站点,您可以在其中向其他用户发送消息。当发送消息的用户离线时,他们会收到邮件通知。

如何使当单击指向聊天的邮箱中的链接时,用户会自动登录到该站点?

现在我在邮箱中的链接导致聊天,但是当我单击时,该站点的登录窗口被敲掉了。

为了授权用户,有 Devise gem。

ruby-on-rails
  • 2 个回答
  • 10 Views
Martin Hope
RomanOks
Asked: 2020-06-16 02:39:26 +0000 UTC

在 JS 函数中重写变量

  • 0

第一天学习JS。任务:以美元解析比特币汇率,以卢布解析美元汇率,将值相乘。

问题是调用Btc2Rub()函数时,出现“未知变量”错误,但这是合乎逻辑的,因为 我在函数中声明了一个变量。

我试图为 btccourse 和 usdcourse 声明“全局变量”,希望它们会在函数中被覆盖,然后相乘。如此声明:在代码的第一行var btccourse = 0; ,但变量未被覆盖,保持为空。

我怎么解决这个问题?

$(document).ready(function() {
  getBtc();
  getUsd();
  Btc2Rub();
});


function getBtc() {
  $.get(
    "https://api.coindesk.com/v1/bpi/currentprice.json",
    function(data) {
      data = JSON.parse(data);
      btccourse = data.bpi.USD.rate_float;
      console.log("BTC = " + btccourse + " Usd");
    }
  )
};


function getUsd() {
  $.get(
    "https://www.cbr-xml-daily.ru/daily_json.js",
    function(data) {
      data = JSON.parse(data);
      usdcourse = data.Valute.USD.Value;
      console.log("USD = " + usdcourse + " Rub");
    }
  )
};

function Btc2Rub() {
  rubcourse = btccourse * usdcourse;
  console.log(rubcourse)
}
javascript
  • 2 个回答
  • 10 Views
Martin Hope
RomanOks
Asked: 2020-06-11 22:43:43 +0000 UTC

Heroku 上的 Elasticsearch 1.7

  • 0

再会!

我在 Heroku 上部署了一个安装了Bonsai Elasticsearch插件的应用程序,默认版本为 6.5.4

但是现在我需要将Elasticsearch的版本改为旧的1.7,我该怎么做呢?

盆景 Elasticsearch

ruby-on-rails
  • 1 个回答
  • 10 Views
Martin Hope
RomanOks
Asked: 2020-06-10 22:11:11 +0000 UTC

为 AJAX Rails 渲染一个 JS 视图

  • 0

我有一个show.html.haml视图,显示帖子的点赞数

= @post.likes.count

在创建动作的控制器中,我写道:

respond_to do |format|
  format.js { render template: 'posts/show.js.haml' }
  format.html { redirect_to post_path(@post) }
end

渲染 html 时,它会重定向到同一个帖子,即 它只是刷新页面以显示新的喜欢。如何通过JS进行提交,这样我就不必刷新整个页面?

我创建了 show.js.haml 来渲染 js 格式,但是我应该在那里写什么呢?

为Like按钮添加了 remote: true以调用 ajax:

= link_to 'Like', post_likes_path(@post), method: :post, class: 'btn btn-outline-dark', remote: true
javascript
  • 1 个回答
  • 10 Views
Martin Hope
RomanOks
Asked: 2020-05-23 19:29:47 +0000 UTC

将项目添加到 .build Rails 购物车

  • 0

我有一个产品列表,每个产品都有一个添加到购物车按钮,该按钮重定向到 line_items 控制器路径。

line_items_controller.rb 中的操作代码

    def create
      item = Item.find(params[:item_id])
      @line_item = @cart.line_items.build(item: item)

      respond_to do |format|
        if @line_item.save
          format.html { redirect_to @line_item.cart, notice: 'Line item was successfully added.' }
          format.json { render :show, status: :created, location: @line_item }
        else
          format.html { render :new }
          format.json { render json: @line_item.errors, status: :unprocessable_entity }
        end
      end
    end

需要将什么哈希传递给.build()才能将产品添加到购物车?

理论上,你需要传递产品参数的hash,但是无论我如何尝试传递它,它都行不通。现在它给出了错误不能写未知属性item_id

ruby-on-rails
  • 1 个回答
  • 10 Views
Martin Hope
RomanOks
Asked: 2020-07-06 02:24:25 +0000 UTC

Linux 依赖项

  • 1

有一个应用程序需要安装依赖项。在应用程序旁边的一个文件夹中收集了所有必要的依赖项。如何让它从这个文件夹中提取缺失的内容,而不是从 /usr/lib/x86_64-linux-gnu 中提取?

linux
  • 1 个回答
  • 10 Views
Martin Hope
RomanOks
Asked: 2020-01-20 16:31:41 +0000 UTC

如何用 Python 控制音量?

  • 10

我正在编写一个用于远程控制 PC 的程序。您需要添加声音控制功能。有合适的图书馆吗?

python
  • 2 个回答
  • 10 Views
Martin Hope
RomanOks
Asked: 2020-12-15 21:13:35 +0000 UTC

Numpy向量索引的求和

  • 4

我们需要编写一个函数,返回元素索引列表中数组的值之和。例如:数组(2 5 7 3)、索引列表(1 3)、答案(2+7=9)。我不知道如何按索引求和。解决了这个问题:

import numpy as np

arr = np.array(input('Введите значения массива: ').split()).astype(int)

indices = np.array(input('Введите индексы элементов в массиве: ').split()).astype(int)

result = 0

for i in indices:
    result += arr[indices[i]]
print(result)
python
  • 2 个回答
  • 10 Views
Martin Hope
RomanOks
Asked: 2020-11-18 06:30:39 +0000 UTC

从键盘输入一维 Numpy 数组,求向量所有元素的乘积

  • 0

输入的数组值a = asarray(input())。现在如何处理任何元素?以及如何将数组的所有元素相乘?

python
  • 1 个回答
  • 10 Views
Martin Hope
RomanOks
Asked: 2020-11-02 17:19:12 +0000 UTC

vk api如何接收消息?

  • 2
# -*- coding: utf-8 -*-

import requests
import json
import time

token = 'd...'
values = {'access_token': token, 'out': 0, 'count': 100, 'time_offset': 60}

#Прием сообщения
while True:
    r = requests.get('https://api.vk.com/method/messages.get', params = values)
    q = r.json()
    print(q['response'][1]['body'])
    time.sleep(1)

如果您向机器人写一条消息,它就会无休止地显示它。如何让机器人只显示一次新消息?

python
  • 2 个回答
  • 10 Views

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    我看不懂措辞

    • 1 个回答
  • Marko Smith

    请求的模块“del”不提供名为“default”的导出

    • 3 个回答
  • Marko Smith

    "!+tab" 在 HTML 的 vs 代码中不起作用

    • 5 个回答
  • Marko Smith

    我正在尝试解决“猜词”的问题。Python

    • 2 个回答
  • Marko Smith

    可以使用哪些命令将当前指针移动到指定的提交而不更改工作目录中的文件?

    • 1 个回答
  • Marko Smith

    Python解析野莓

    • 1 个回答
  • Marko Smith

    问题:“警告:检查最新版本的 pip 时出错。”

    • 2 个回答
  • Marko Smith

    帮助编写一个用值填充变量的循环。解决这个问题

    • 2 个回答
  • Marko Smith

    尽管依赖数组为空,但在渲染上调用了 2 次 useEffect

    • 2 个回答
  • Marko Smith

    数据不通过 Telegram.WebApp.sendData 发送

    • 1 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5