摘要: rails 开发环境api传递access_token参数 在controller用 request.headers["HTTP_ACCESS_TOKEN"] 可获取到值。 但是在生产环境却获取不到值了。 原因是生产环境headers的参数名不可以用下划线。改为access-token。 还是用 r 阅读全文
posted @ 2023-03-14 12:48 wangyuyu 阅读(30) 评论(0) 推荐(0) 编辑
摘要: 今天用php的项目网页请求另一个服务器的rails项目的api。首先解决php项目的跨域问题。服务器是ubuntu 用的apache2。 修改文件 /etc/apache2/apache2.conf, 添加一行 Header set Access-Control-Allow-Origin "*" < 阅读全文
posted @ 2023-02-15 20:28 wangyuyu 阅读(53) 评论(0) 推荐(0) 编辑
摘要: 1. 方法跳过 使用下列方法可跳过回调: decrement decrement_counter delete delete_all increment increment_counter toggle touch update_column update_columns update_all up 阅读全文
posted @ 2021-07-23 11:26 wangyuyu 阅读(191) 评论(0) 推荐(0) 编辑
摘要: 用树莓派接usb温湿度传感器测环境温度湿度。 树莓派是3B, USB温湿度传感器用的达林科技的DL11-MC-S1。 DL11-MC-S1文档中连接方式支持串口读取,我们用python的serial 连接传感器。 需要注意的是命令需要用16进制发送,而且相隔的字符直接是没有文档中的空格符的。 下面是 阅读全文
posted @ 2021-07-22 15:42 wangyuyu 阅读(631) 评论(0) 推荐(0) 编辑
摘要: 用一个frps连接多个frpc,原理上多个frpc和frps绑定同一个端口,但是多个frpc用不同的remote_port连接。 云服务器frps.ini [common] bind_port = 7000 vhost_http_port = 8000 dashboard_addr = 0.0.0. 阅读全文
posted @ 2021-01-22 11:40 wangyuyu 阅读(10594) 评论(2) 推荐(1) 编辑
摘要: frp下载地址https://github.com/fatedier/frp/releases 1.配置服务器环境 在阿里云下载安装frp cd /varwget https://github.com/fatedier/frp/releases/download/v0.35.0/frp_0.35.0 阅读全文
posted @ 2021-01-22 11:09 wangyuyu 阅读(504) 评论(0) 推荐(0) 编辑
摘要: rails5.1版本前用法: You can send plain text – with no markup at all – back to the browser by using the :text option to render: render :text => "OK" rails5. 阅读全文
posted @ 2021-01-05 15:07 wangyuyu 阅读(174) 评论(0) 推荐(0) 编辑
摘要: redis提供的发布订阅命令subscribe: subscribe channel [channel …] 订阅一个或多个频道unsubscribe: unsubscribe [channel [channel …]] 退订频道,如果没有指定频道,则退订所有的频道publish: publish 阅读全文
posted @ 2020-07-07 16:41 wangyuyu 阅读(333) 评论(0) 推荐(0) 编辑
摘要: 我们先看一下如何ruby如何推一个任务到sidekiq https://github.com/mperham/sidekiq/wiki/FAQ#how-do-i-push-a-job-to-sidekiq-without-ruby require 'securerandom' require 'js 阅读全文
posted @ 2020-07-07 16:29 wangyuyu 阅读(229) 评论(0) 推荐(0) 编辑
摘要: #datetime转字符串ex: now = datetime.datetime.now() time_string = now.strftime('%Y-%m-%d %H:%M:%S') #字符串转datetimeex: time_string = '2020-05-26 11:42:54' da 阅读全文
posted @ 2020-05-26 12:00 wangyuyu 阅读(979) 评论(0) 推荐(0) 编辑