我已经按照编写服务器端应用程序在我的应用程序中实现GCM,但是
final String regId = GCMRegistrar.getRegistrationId(this);
Run Code Online (Sandbox Code Playgroud)
回归empy.每时每刻.
我正确地放了所有权限.
有代码:
public void registerPush(){
GCMRegistrar.checkDevice(this);
GCMRegistrar.checkManifest(this);
final String regId = GCMRegistrar.getRegistrationId(this);
REG_ID = regId;
if (regId.equals("")) {
GCMRegistrar.register(this, this.getString(R.string.SENDER_ID));
} else {
if (GCMRegistrar.isRegisteredOnServer(this)) {
// Skips registration.
} else {
// Try to register again, but not in the UI thread.
// It's also necessary to cancel the thread onDestroy(),
// hence the use of AsyncTask instead of a raw thread.
final Context context …Run Code Online (Sandbox Code Playgroud) 我尝试在panamax-uidocker 上使用(一个 RoR 应用程序)。我在它上面工作了几天(本地和 docker),成功地修改了它等等。
然后我添加了一些新的功能和一些宝石。
我bundle install什么都有
然后我想重新构建我的 docker ( docker build)
但我犯了这个错误:
Gem::Ext::BuildError: 错误:无法构建 gem 本机扩展。
/usr/bin/ruby extconf.rb 创建 Makefile
制作“DESTDIR =”干净的sh:制作:未找到
制作“DESTDIR =”sh:制作:未找到
制作失败,退出代码 127
Gem 文件将保留安装在 /usr/lib/ruby/gems/2.1.0/gems/json-1.8.3 中以供检查。结果记录到 /usr/lib/ruby/gems/2.1.0/extensions/x86_64-linux/2.1.0/json-1.8.3/gem_make.out 安装 json (1.8.3) 时出错,Bundler 不能继续。
gem install json -v '1.8.3'在捆绑之前确保成功。命令“/bin/sh -c bundle install --without development test”返回非零代码:5
我试图删除 Gemfile.lock 并重新运行bundle install然后重建docker ,同样的错误......
这是我的Gemfile:
source 'https://rubygems.org'
gem 'rails', '4.1.7'
gem 'puma', '2.8.2'
gem 'sqlite3', '1.3.9'
gem 'faraday_middleware', '0.9.0'
gem …Run Code Online (Sandbox Code Playgroud) 我正在尝试设置 cassandra DB 并使用 golang 应用程序连接到它。
这是我的docker-compose
version: "3.6"
services:
cassandra:
image: cassandra:4.0
ports:
- 9042:9042
volumes:
- ~/apps/cassandra:/var/lib/cassandra
environment:
- CASSANDRA_CLUSTER_NAME=mycluster
myapp:
...
ports:
- 4242:4242
- 4243:4243
depends_on:
- cassandra
...
networks:
default:
driver: bridge
Run Code Online (Sandbox Code Playgroud)
我使用启动 Cassandra
docker-compose up cassandra
然后我等待它准备好。
然后我尝试在本地使用连接到 Cassandra
> cqlsh
Connected to mycluster at 127.0.0.1:9042
Run Code Online (Sandbox Code Playgroud)
然后我尝试在我的 go 应用程序(dockerized)中使用连接到它gocql
cluster := gocql.NewCluster("127.0.0.1")
session, err := cluster.CreateSession()
Run Code Online (Sandbox Code Playgroud)
(还尝试添加元素 asConsistency等ProtoVersion=4相同的结果)
它说:
Cannot connect to db: gocql: unable to create session: …Run Code Online (Sandbox Code Playgroud) 我正在做一个 SAML 身份验证,当我收到 xml 时,它的一部分被 ecrypted。这是我需要的部分(包含姓名、电子邮件等)
为此,我有一个私钥来解密它,但我不知道如何做到这一点。
我在这里:
response = OneLogin::RubySaml::Response.new(params[:SAMLResponse])
response.settings = set_settings
doc = Nokogiri::XML(response.response)
document = XMLSecurity::Document.new(doc)
### NOT USED HERE
formated_cert = OneLogin::RubySaml::Utils.format_cert(CONFIG_CERTIFICATE)
cert = OpenSSL::X509::Certificate.new(formated_cert)
formated_private_key = OneLogin::RubySaml::Utils.format_private_key(CONFIG_PRIVATE_KEY)
private_key = OpenSSL::PKey::RSA.new(formated_private_key)
### NOT USED HERE
ret = doument.decrypt!(settings) rescue nil # PROBLEME HERE, DONT WORK
def set_settings
settings = OneLogin::RubySaml::Settings.new
...
settings.security[:digest_method] = XMLSecurity::Document::SHA1
settings.security[:signature_method] = XMLSecurity::Document::SHA1
...
settings.certificate = CONFIG_CERTIFICATE
settings.private_key = CONFIG_PRIVATE_KEY
end
Run Code Online (Sandbox Code Playgroud)
因此,应该ret是我可以使用的解密 xml,但它始终保持在nil( rescue nil,以避免 500) …
为了提高我的Rails应用程序安全性,我想知道如何从参数哈希中获取所有密钥
哈希示例:
params =
{"id"=>23, "name"=>"test", "infos"=>{"data"=>"er323e3ee23reQir", "signed"=>true}}
Run Code Online (Sandbox Code Playgroud)
如果我做 params.keys
我获得了 : ["id", "name", "infos"]
但我想在一个简单的数组中获取所有键,例如: ["id", "name", "infos", "data", "signed"]
有一种简单的方法可以做到这一点吗?
我昨天第一次安装并使用了docker,
一切都运转正常,但昨天晚上我关机了.
今天我启动它,我想在我的docker应用程序上工作,但是当我尝试运行它时
docker run -d -p 8080:8080 container/app
我收到了错误:
docker:无法连接到Docker守护程序.docker守护程序是否在此主机上运行?
但是我找不到如何再次启动docker ......
想法?
编辑:
eval "$(docker-machine env default)"
Run Code Online (Sandbox Code Playgroud)
结果:
检查TLS连接时出错:主机未运行
我创建了一个简单的项目,有 3 个页面:主页、联系人和关于。
一切正常,然后我想用 mongo 添加用户注册。
所以我跟着这个教程
但是,当我添加一些新路线时,我无法访问更多页面。
这是我index.js可以访问我的 3 页的时候
var express = require('express');
var router = express.Router();
/* GET home page. */
router.get('/', function(req, res) {
res.render('index', { title: 'Express' });
});
/* GET contact page. */
router.get('/contact', function(req, res) {
res.render('contact');
});
/* POST contact page (submit). */
router.post('/contact', function(req, res) {
res.render('contact', { name: req.param('name') });
});
/* GET home page. */
router.get('/home', function(req, res) {
res.render('home');
});
/* POST home page (submit). …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用cmake构建cpp/qt5项目,但编译返回有关QT5的错误.
我用Homebrew安装了QT5,
当我做 :
brew --prefix qt5
Run Code Online (Sandbox Code Playgroud)
我明白了
/usr/local/Cellar/qt5/5.6.0
Run Code Online (Sandbox Code Playgroud)
所以我在build我项目的文件夹中,我这样做:
cmake .. -DCMAKE_PREFIX_PATH=$(brew --prefix qt5) -G Xcode -DBUILD_TESTS=ON -DBUILD_TESTS_COVERAGE=off
Run Code Online (Sandbox Code Playgroud)
给我这个错误:
CMake Error at CMakeLists.txt:124 (find_package):
By not providing "FindQt5.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Qt5", but
CMake did not find one.
Could not find a package configuration file provided by "Qt5" with any of
the following names:
Qt5Config.cmake
qt5-config.cmake
Add the installation prefix of "Qt5" to CMAKE_PREFIX_PATH or …Run Code Online (Sandbox Code Playgroud) 我尝试在 C++ 程序中超时:
...
void ActThreadRun(TimeOut *tRun)
{
tRun->startRun();
}
...
void otherFunction()
{
TimeOut *tRun = new TimeOut();
std::thread t1 (ActThreadRun, tRun);
t1.join();
while(tRun->isTimeoutRUN())
{
manageCycles();
}
}
...
Run Code Online (Sandbox Code Playgroud)
超时在 3 秒后完成,并tRun->isTimeoutRUN()更改其状态。
但是如果我“ join”线程,我会阻塞程序,所以它会在继续之前等待 3 秒,所以它永远不会进入我的 while 循环......
但是如果我不“ join”线程,线程永远不会超时,tRun->isTimeoutRUN()永远不会改变,所以它会无限运行。
我不擅长线程,所以我在寻求你的帮助,因为我不理解 C++ 中的教程。
我正在按照一些教程来安装和使用Firebase,
但我什至无法通过我必须要做的部分
this.firebase.getToken().then(token => {...},error => {...});
因为我有这个错误:
TypeError:Object(...)不是Firebase.getToken上的函数
该模块是这样导入的:
import { AngularFirestore } from 'angularfire2/firestore';
import { Firebase } from '@ionic-native/firebase/ngx';
Run Code Online (Sandbox Code Playgroud)
请注意,如果我不放在/ngx导入末尾,则会收到提供程序错误...
我试图安装这个:
npm i rxjs@6 rxjs-compat@6 promise-polyfill --save
但没有改变
ionic info :
Ionic:
ionic (Ionic CLI) : 4.9.0 (/.../.nvm/versions/node/v9.11.2/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.1.8
Cordova:
cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
Cordova Platforms : android 7.0.0, ios 4.5.5
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 1.2.1, (and 21 other plugins)
System:
Android SDK Tools …Run Code Online (Sandbox Code Playgroud) 正如标题所解释的那样,当router对象在subscribe成员内部被调用时,该对象变得不确定.
我来告诉你一些代码:
export class AuthComponent implements OnInit {
password = '';
email = '';
constructor(
private _router: Router,
private authService: AuthService
) { }
sendLogin(): void {
this.authService.login(this.email, this.password)
.subscribe(function(token){
console.log("Success Response" + token)
this.token = token
// TOKEN Here is good
// now I want to change my page, but
// _router -> undefined
this._router.navigate(['/dashboard']);
},
error => console.log(error));
}
Run Code Online (Sandbox Code Playgroud)
sendLogin()提交表单时调用该方法.表格中的每个变量都很好.
这个过程subscribe完美,但后来
this._router.navigate(['/dashboard']);
给了我:
EXCEPTION:无法读取undefined的属性'navigate'
有任何想法吗 ?
angular2-routing angular2-services angular2-observables angular