我的.cabal文件的许多节中经常有类似的属性.例如
Library x
...
ghc-options:
-O2 -Wall -fno-warn-missing-signatures -fwarn-incomplete-patterns
-fno-warn-name-shadowing
Executable y
...
ghc-options:
-O2 -Wall -fno-warn-missing-signatures -fwarn-incomplete-patterns
-fno-warn-name-shadowing
Run Code Online (Sandbox Code Playgroud)
保持一致是繁琐且容易出错的.有没有更好的办法?
甚至更棘手的是当字段相似但不完全相同时,例如当我有几个具有共同构建依赖性但是变化很小的可执行文件时.
我想从C++库生成C包装器.有关如何手动完成的教程:
但这太过于体力劳动.
例如,为此:
struct RtAudio {
virtual DeviceInfo const& f() {...}
class DeviceInfo {
virtual void g() { ... }
};
...
};
Run Code Online (Sandbox Code Playgroud)
我需要写:
struct RtAudioC {
RtAudio x;
};
struct DeviceInfo {
RtAudio::DeviceInfo x;
};
extern "C" {
RtAudioC* newRtAudio() {
return new RtAudioC;
}
void deleteRtAudio(RtAudioC *p {
delete p;
}
/* do something with RtAudio::f() */
void g(DeviceInfo *p) {
try {
p->x.g();
} catch (SomeError & err) {
}
}
}
Run Code Online (Sandbox Code Playgroud)
是否有可以自动执行此过程的工具?
我目前正在使用Phonegap/Cordova和jQuerymobile为iOS构建应用程序.我们的想法是用相机拍照并存储拍摄的图像以备将来使用.我想将路径/文件名存储到我的本地数据库中,并将图片文件移动到iPhone中的持久位置.
有人可以给我一个例子吗?
我正在研究一个简单的java程序.它只是编译并执行另一个java程序.我正在使用Runtime.exec()函数进行编译和运行.编译没有问题.但是当它运行时,如果第二个程序需要输入来从键盘读取,我不能从主进程中提供它.我使用了getOutputStream()函数.但它无能为力.我会提供我的代码.
public class sam {
public static void main(String[] args) throws Exception {
try {
Process p = Runtime.getRuntime().exec("javac sam2.java");
Process p2 = Runtime.getRuntime().exec("java sam2");
BufferedReader in = new BufferedReader(
new InputStreamReader(p2.getInputStream()));
OutputStream out = p.getOutputStream();
String line = null;
line = in.readLine();
System.out.println(line);
input=input+"\n";
out.write(input.getBytes());
p.wait(10000);
out.flush();
}catch (IOException e) {
e.printStackTrace();
}
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的主程序(sam.java).
以下是sam2.java的代码
public class sam2 {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String str;
System.out.println("Enter the …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Cordova应用程序上的HTML5音频流式传输Shoutcast URL.
我遇到的问题是:当音频流失去与ShoutCast URL的连接时,似乎没有回调.在此阶段,音频元素显示它正在播放音频,但没有音频.
Radio = {
initialized: false,
isBuffering: false,
interrupted: false,
isPlaying: false,
media: null,
trackName: '',
url: 'shoutcast_url',
initialize: function () {
if (!this.media) {
this.media = new Audio(this.url);
this.media.preload = "none";
this.media.onerror = function (e) {
App.alert("Unable to connect to Radio");
Radio.interrupt();
};
this.media.onwaiting = function (e) {
Radio.set_buffering(true);
};
this.media.onplaying = function (e) {
Radio.set_buffering(false);
};
}
},
set_buffering: function (value) {
...
}
Run Code Online (Sandbox Code Playgroud)
播放缓冲内容后,音频停止播放.但没有发出表示连接丢失的回调.
media.networkState是 …我正在为Web应用程序设计REST API.我想清楚地对API进行版本化,以便将来可以更改界面而不会破坏现有服务.因此,在我的v1.0 API中,我希望将其清楚地标识为v1.0 API,让我可以自由地发布未来的v1.1版本并进行重大更改.
我的问题是,URI的路径组件中的一段时间是不好的做法?
例如.有没有什么好的理由不使用http://example.com/myapi/v1.0/services作为我服务的URI?
我正在使用带有php的sendgrid,我已经使用了客户端库和curl选项这两个选项.到目前为止,我已经能够直接使用addTo选项发送电子邮件,没有任何问题.但是当我尝试添加Cc或Bcc选项时,电子邮件仍然会被发送,但副本永远不会被发送.php版本有任何已知问题吗?在其他项目中,java库工作得很好.
这是一段简单的代码,我试图让它工作
<?php
require ('sendgrid/sendgrid-php.php');
$sendgrid = new SendGrid('user', 'pwd');
$mail = new SendGrid\Email();
$mail ->addTo("mymail@gmail.com");
$mail ->addCc("other@otherserver.com");
$mail ->setFrom("sender@server.com");
$mail ->setSubject("TEST");
$mail->setHtml("<h1>Example</h1>");
$sendgrid->send($mail);
?>
Run Code Online (Sandbox Code Playgroud) 这篇伟大的文章解释了有关ASP.NET 5中间件的问题,或者我的HttpModule已经去了哪里?
但目前还不清楚我们何时以及为何要使用ASP.NET 5中间件.
任何人都可以解释它并提供其使用的真实例子吗?
我正在尝试检索设备注册ID,以便从我的后端向它发送通知.
我已经尝试了几次:
GambifyApp.NotificationManager = window.GambifyApp.NotificationManager = Ember.Object.extend({
init: function(){
var pushNotification = window.plugins.pushNotification;
window.GambifyApp.NotificationHandler = GambifyApp.NotificationHandler;
if ( device.platform == 'android' || device.platform == 'Android' )
{
console.log('pushNotification Register');
pushNotification.register(
this.successHandler,
this.errorHandler, {
"senderID":GambifyApp.config.android_sender_id,
"ecb":"window.externalOnNotificationGCM"
});
},
});
window.externalOnNotificationGCM = function (e) {
console.log('reg id:' + e.regid);
};Run Code Online (Sandbox Code Playgroud)
方法是在另一个对象内部(除ECB外,一切都保持不变:
"ecb":"window.GambifyApp.NotificationHandler.onHandler"
Run Code Online (Sandbox Code Playgroud)这是我放置处理程序的地方:
GambifyApp.NotificationHandler = window.GambifyApp.NotificationHandler = {
onHandler: function(e){
console.log('onHandler:');
if(e.event == "registered") {
console.log('reg id:' + e.regid);
}
console.log(e);
}
}
Run Code Online (Sandbox Code Playgroud)
我的最后一个方法
"ecb":"GambifyApp.NotificationManager.onNotificationGCM"
Run Code Online (Sandbox Code Playgroud)这里增加了经理类:
GambifyApp.NotificationManager = window.GambifyApp.NotificationManager = Ember.Object.extend({ …Run Code Online (Sandbox Code Playgroud) 当用户安装我的应用程序时,我会注册他的注册ID(android)或设备令牌(iOS)并发送工作正常的推送通知.但是现在我想在卸载应用程序时从服务器中删除用户.
我如何在Phonegap中完成此操作:获取一个事件,之后我可以取消注册用户注册ID(android)或设备令牌(ios)?
注意:我使用的是PushPlugin
cordova ×3
ios ×2
.net ×1
android ×1
asp.net-core ×1
bcc ×1
c ×1
c++ ×1
cabal ×1
camera ×1
carbon-copy ×1
ember.js ×1
ffi ×1
haskell ×1
html5-audio ×1
java ×1
javascript ×1
middleware ×1
php ×1
rest ×1
runtime ×1
runtime.exec ×1
sendgrid ×1
shoutcast ×1
streaming ×1
uri ×1
wrapper ×1