我正在使用kafka-node npm模块,0.2.27版本。
我发现producer.on('ready',fn(){})永远都不会打电话。
在检查了生产者对象时,观察到如下
{ ready: true,
client:
{ connectionString: '10.196.160.100.:2181,10.196.160.150:2181,10.196.160.151:2181',
clientId: 'dev',
zkOptions: { sessionTimeOut: 10000, spinDelay: 1000, retries: 10 },
brokers:
{ 'custom-kafka.mine.com:9092': [Object],
'custom-storm.mine.com:9092': [Object] },
longpollingBrokers: {},
topicMetadata: {},
topicPartitions: {},
correlationId: 0,
cbqueue: {},
brokerMetadata: { '0': [Object], '1': [Object] },
ready: true,
zk: { client: [Object], _events: [Object], inited: true },
_events: { ready: [Object], error: [Object], close: [Object] } },
requireAcks: 1,
ackTimeoutMs: 100,
_events: {} }
Run Code Online (Sandbox Code Playgroud)
无需等待事件(“就绪”),我只需检查一下if(producer.ready),就能稍稍超时将其发布到kafka。
理想情况下,应该触发事件。 …
我有一台4 GB内存的PC和一个内存使用量为10 GB的文件.现在我想检查一下,如果文件中的每一行都是唯一的,那么我编写了以下代码:
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.HashSet;
import java.util.Set;
public class Cleaner {
public static void main(String[] args) throws IOException {
if (args.length < 2) {
System.out.println("Too less parameters!");
return;
}
File file = new File(args[0]);
BufferedReader buff = new BufferedReader(new FileReader(file));
String line;
Set<String> set = new HashSet<String>();
while ((line = buff.readLine()) != null) {
set.add(line);
}
FileWriter fw = new FileWriter(args[1]);
for (String s : set) {
fw.write(s + "\n"); …Run Code Online (Sandbox Code Playgroud) 我有一个简单的应用程序,在三个屏幕的每一个上都有一个按钮.
前两个按钮应该将您从一个意图发送到下一个意图,直到最后一个应该拍照并在第三个屏幕上打印的按钮.
但是当我添加相机功能时,应用程序停止工作,现在当我按下第一个"开始spil"按钮时它甚至不会移动到第二个意图.
HomeActivity
package com.example.daniel.proto;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
public class Home extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
}
public void onClick(View view)
{
Intent i = new Intent(this, SelectLevel.class);
startActivity(i);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_home, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle …Run Code Online (Sandbox Code Playgroud) 我#include "graphics.h"在c ++中使用.
我使用visual studio 2008作为我的IDE.
问题是我无法构建我的代码.
我不知道如何解决这个错误以及该怎么做.
我卡住了!请帮忙!
这是我的代码......
#include<stdio.h>
#include<conio.h>
#include "graphics.h"
#include<stdlib.h>
#include<dos.h>
char game[3][3];
void screen(void);
void introducing(void);
void input(void);
void circle(int,int);
void cross(int,int);
void main(void)
{
int gd=DETECT, gm, errorcode; /* request auto detection */
char msg[80];
initgraph(&gd,&gm,"\\tc\\bgi"); /* initialize graphics */
errorcode = graphresult(); /* read result of initialization */
if(errorcode != grOk)
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1);
}
cleardevice();
introducing();
getche();
cleardevice();
screen();
getche(); …Run Code Online (Sandbox Code Playgroud) 单击"提交"按钮后.我在实体中变为空. 有人有解决方案吗?
视图
@using (Ajax.BeginForm("CreateRoom", "Room", new AjaxOptions { HttpMethod = "POST", OnComplete = "window.location.href='Index'" }, new { enctype = "multipart/form-data", id = "ajaxUploadForm" }))
{
<input type="file" name="Room" />
<input type="submit" value="OK" />
}
Run Code Online (Sandbox Code Playgroud)
调节器
[HttpPost]
public ActionResult CreateRoom(RoomFileView entity)
{
//code
}
Run Code Online (Sandbox Code Playgroud)
模型
public class RoomFileView
{
public RoomFileView();
public int BuildingId { get; set; }
public int CityId { get; set; }
public int CountryId { get; set; }
public int FloorId { get; set; }
public …Run Code Online (Sandbox Code Playgroud) 我有一个用 Unity3D 编写的游戏,以便最终将其发布到 iOS 和 Android。
假设游戏应用程序安装在移动设备上,并且我想通过外部蓝牙低功耗设备(例如心率传感器)控制它,那么
构建跨平台架构的更好方法是什么?
例如 - 使其成为在 iOS 和 Android 上实现它的最简单方法?
*External* *Mobile*
Run Code Online (Sandbox Code Playgroud)
低功耗蓝牙设备 --> Something.. --> Unity
Something = 您建议我使用什么跨平台框架来与低功耗蓝牙(将来还可以与数据库)和Unity3D接口以传递逻辑?
多谢
android cross-platform unity-game-engine ios bluetooth-lowenergy