我的应用程序允许用户捕获视频:
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_VIDEO_CAPTURE);
startActivityForResult(cameraIntent, CAMERA_VIDEO_REQUEST);
Run Code Online (Sandbox Code Playgroud)
或图片:
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST);
Run Code Online (Sandbox Code Playgroud)
在图片的情况下,我可以判断它们是否以除横向以外的任何模式拍摄,然后在我将它们上传到网络之前旋转它们:
ExifInterface exif = new ExifInterface(fileName);
int exifOrientation = Integer.parseInt(exif.getAttribute(ExifInterface.TAG_ORIENTATION));
float rotate = 0;
switch (exifOrientation){
case ExifInterface.ORIENTATION_ROTATE_90:
rotate = 90;
break;
case ExifInterface.ORIENTATION_ROTATE_180:
rotate = 180;
break;
case ExifInterface.ORIENTATION_ROTATE_270:
rotate = 270;
break;
}
if(rotate > 0){
Bitmap bitmap = BitmapFactory.decodeFile(fileName);
Matrix matrix = new Matrix();
matrix.postRotate(rotate);
bitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
OutputStream outStream = context.getContentResolver().openOutputStream(Uri.fromFile(file));
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, outStream); …
Run Code Online (Sandbox Code Playgroud) In the Rest v3, I could easily query a commit and get the changed files and patch for each file: https://developer.github.com/v3/repos/commits/#get-a-single-commit
I don't seem to be able to retrieve this info using the new v4 graphQL, does anyone have a clue how?
我有一个大部分时间都可以正常工作的图表,除非其中包含许多条形,然后默认情况下决定仅显示任何第二个 y 轴标签(我可以将鼠标悬停在缺少标签的条形上以查看标签,但这不是所需的行为):
我该怎么做才能强制执行以显示所有标签?以及如何控制它们之间的间隙?高度应该是动态的...
我需要将 Associated Domains Entitlement 添加到我的 Flutter 应用程序,以便我可以实施App Links。我使用适用于 Android的uni_links插件。我已经ios/Runner/Runner.entitlements
按照描述添加了一个文件,但它不起作用。Apple 官方文档暗示我需要通过 xcode 向应用程序添加一些内容。问题是,我不使用 xcode,而是使用 Android Studio。我相信我需要手动添加一个条目,info.plist
或者project.pbxproj
这是我认为 xcode 所做的,但是我不确定是什么。
我希望两个不同的文本输入具有预输入功能,每个输入都有不同的源函数。为了举例,一个获取名字,另一个获取姓氏。
这是它的外观,它不起作用:
$('#first_name').typeahead({
source: function (query, process) {
$.get('/users/typeahead-first-name', { term: query }, function (data) {
return process(JSON.parse(data));
});
}
});
$('#last_name').typeahead({
source: function (query, process) {
$.get('/users/typeahead-last-name', { term: query }, function (data) {
return process(JSON.parse(data));
});
}
});
Run Code Online (Sandbox Code Playgroud)
第一次输入就可以了。但是,第二个,当我开始键入并且选项开始出现时,然后单击一个选项,下拉列表仅关闭并且没有值插入到输入字段中。
有人知道如何使它工作吗?
我有一个精彩的jquery旋钮的扩展,它将其转换为度数范围输入.在带有负z-index的div内的旋钮上有一个透明的指南针png图像,因此鼠标点击将与旋钮相互作用而不是与img相互作用.
现在,当我将旋钮放在没有背景颜色的div中时,罗盘png显示页面加载的时间.
但是,如果包含div具有背景颜色,则仅在用户开始标记范围后显示png (在紫色圆圈上拖动顺时针范围).
以下是该问题的演示:http://infoxicate.me/testknob.html
编辑:演示页面不再显示问题,因为它已解决...
我需要获取node/express应用程序中特定端点的原始发布数据.我做:
app.use('/paypal/ipn',function(req, res, next) {
var postData='';
req.on('data', function(chunk) {
postData += chunk;
});
req.on('end', function() {
req.rawBody = postData;
console.log('ended buffering. result: ' + req.rawBody);
next();
});
});
Run Code Online (Sandbox Code Playgroud)
会发生什么是我在控制台中获得console.log输出,然后没有任何反应.大约一分钟后,我看到服务器返回200 - 可能是超时.这就像next()命令永远不会执行,或执行和stales.
当我注释掉所有内容时,只需调用next():
app.use('/paypal/ipn',function(req, res, next) {
/*
var postData='';
req.on('data', function(chunk) {
postData += chunk;
});
req.on('end', function() {
req.rawBody = postData;
console.log('ended buffering. result: ' + req.rawBody);
next();
});
*/
next();
});
Run Code Online (Sandbox Code Playgroud)
一切正常,即调用端点(当然请求不包含rawBody).
所以我似乎在缓冲rawBody的方式做错了什么?导致next()不起作用的东西?
Shopify提供Ruby和PHP中的示例来实现此目的.在我的节点/快递应用程序中,我尝试:
var data = querystring.stringify(req.body);
var calculatedSha256 = crypto.createHmac("SHA256", APP_SECRET).update(new Buffer(data, 'utf8')).digest('base64');
Run Code Online (Sandbox Code Playgroud)
并且
var data = req.body;
var calculatedSha256 = crypto.createHmac("SHA256", APP_SECRET).update(new Buffer(data, 'utf8')).digest('base64');
Run Code Online (Sandbox Code Playgroud)
但是它们都没有提供与Shopify作为签名发送的字符串相同的字符串.
假设以下场景:第 1 页Navigator.push
到第 2 页。page2 上的用户单击后退按钮,因此 page2 弹出并且 page1 重新获得视图。如何在 page1 上捕获此事件?