我正在尝试使用像这样的php sdk获取Facebook用户ID
$fb = new Facebook\Facebook([
'app_id' => '11111111111',
'app_secret' => '1111222211111112222',
'default_graph_version' => 'v2.4',
]);
$helper = $fb->getRedirectLoginHelper();
$permissions = ['public_profile','email']; // Optional permissions
$loginUrl = $helper->getLoginUrl('http://MyWebSite', $permissions);
echo '<a href="' . $loginUrl . '">Log in with Facebook!</a>';
try {
$accessToken = $helper->getAccessToken();
var_dump($accessToken);
} catch (Facebook\Exceptions\FacebookResponseException $e) {
// When Graph returns an error
echo 'Graph returned an error: ' . $e->getMessage();
exit;
} catch (Facebook\Exceptions\FacebookSDKException $e) {
// When validation fails or other local issues
echo 'Facebook …
Run Code Online (Sandbox Code Playgroud) 我有三个表多对多关系我已加入三个表并选择我想要的值但现在我需要从查询结果中选择一行通过指定id这是我的三个表
这是使用LINQ
lambda表达式的查询:
DataBaseContext db = new DataBaseContext();
public ActionResult Index()
{
var UserInRole = db.UserProfiles.
Join(db.UsersInRoles, u => u.UserId, uir => uir.UserId,
(u, uir) => new { u, uir }).
Join(db.Roles, r => r.uir.RoleId, ro => ro.RoleId, (r, ro) => new { r, ro })
.Select(m => new AddUserToRole
{
UserName = m.r.u.UserName,
RoleName = m.ro.RoleName
});
return View(UserInRole.ToList());
}
Run Code Online (Sandbox Code Playgroud)
结果就像使用sql
查询一样
sql
询问
select *
from UserProfile u join webpages_UsersInRoles uir on u.UserId = uir.UserId
join …
Run Code Online (Sandbox Code Playgroud) 我在mvc中使用了dropzone.js,按照本教程上传图像,但在上传图像后,缩略图仍然显示,我需要在每次上传图像后将其删除.
我已经尝试使用jQuery上传图像后替换生成的HTML但是它没有正确显示,因为我第一次需要刷新页面才能正确显示但我不想这样做.
$("#ImageUpload").replaceWith('<form action="/Products/SaveUploadedFile" method="post" enctype="multipart/form-data" class="dropzone dz-clickable" id="dropzoneForm">'
+'<div class="fallback">'
+'<input name="file" type="file" multiple />'
+'<input type="submit" value="Upload" />'
+'</div>');
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用c#构建一个简单的VoIP应用程序,所以我发现这Ozeki SDK
是一种简单的方法,但是当我尝试使用SIPAccount
来自Ozeki SDK
和我的本地的类注册SIP帐户时,IP
它总是失败,这就是代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ozeki.VoIP;
using Ozeki.VoIP.SDK;
namespace SIP_R
{
class Program
{
private static ISoftPhone softphone; // softphone object
private static IPhoneLine phoneLine; // phoneline object
private static void Main(string[] args)
{
// Create a softphone object with RTP port range 5000-10000
softphone = SoftPhoneFactory.CreateSoftPhone(5000, 10000);
// SIP account registration data, (supplied by your VoIP service provider)
var registrationRequired = true;
var userName …
Run Code Online (Sandbox Code Playgroud) 我知道我的问题在互联网上有很多答案,但似乎我找不到一个好的答案,所以我将尝试解释我所拥有的并希望最好,
所以我想要做的是读取一个大的 json 文件,该文件可能具有比这更复杂的结构“具有大数组的嵌套对象”,但举个简单的例子:
{
"data": {
"time": [
1,
2,
3,
4,
5,
...
],
"values": [
1,
2,
3,
4,
6,
...
]
}
}
Run Code Online (Sandbox Code Playgroud)
这个文件可能是 200M 或更多,我正在使用file_get_contents()
和json_decode()
从文件中读取数据,
然后我将结果放入变量并循环时间并使用当前索引获取时间值以通过索引从值数组中获取相应的值,然后将时间和值保存在数据库中,但这需要太多的 CPU 和记忆,是他们做到这一点的更好方法
使用更好的函数,使用更好的 json 结构,或者可能是比 json 更好的数据格式来执行此操作
我的代码:
$data = json_decode(file_get_contents(storage_path("test/ts/ts_big_data.json")), true);
foreach(data["time"] as $timeIndex => timeValue) {
saveInDataBase(timeValue, data["values"][timeIndex])
}
Run Code Online (Sandbox Code Playgroud)
提前感谢您的帮助
2020 年 6 月 29 日更新:
我有另一个更复杂的 json 结构示例
{
"data": {
"set_1": {
"sub_set_1": {
"info_1": {
"details_1": {
"data_1": [1,2,3,4,5,...],
"data_2": …
Run Code Online (Sandbox Code Playgroud) 你好,我是初学者,也可以matlab
作为家庭作业的一部分.我需要检测图像中被感染的白细胞,并将它们计入受感染的白细胞的核大而颜色为蓝色的位置.
原始图像
说明图片:
所以我试图隔离白色细胞,然后检测感染的白细胞,但我卡住了,不要做什么我会写我的代码,并提到我卡住的地方,并请如果三个是另一种方式来做这个请求帮助
将图像转换RGB
为YcBcR
空间颜色以检测白色销售
OrgenalImg = imread('D:\Users\FADI\Desktop\cells\cells1.jpg');
CopyOfOrgenalImg = OrgenalImg;
YcbcrImage = rgb2ycbcr(CopyOfOrgenalImg);
cb = YcbcrImage(:,:,2);
cr = YcbcrImage(:,:,3);
[r,c,v] = find(cb>=77 & cb<=127 & cr>=133 & cr<=173);
index1 = size(r,1);
%Mark the white cell pixel
for i=1:index1
CopyOfOrgenalImg(r(i),c(i),:) = 255;
end
figure, imshow(CopyOfOrgenalImg);title('White Cells');
Run Code Online (Sandbox Code Playgroud)
白细胞图像:
2.我陷入困境我尝试将白色细胞图像转换为灰色grayscale
以删除并删除不需要的形状但我无法找到方法这样请求帮助以及如何继续我的作业来检测和计算有细胞,如果还有其他方法可以做这个请求,请提前感谢任何帮助.
我试图使用node-mysql模型和node.js在变量中保存MySql查询的结果,所以我有这样的代码:
connection.query("select * from ROOMS", function(err, rows){
if(err) {
throw err;
} else {
console.log(rows);
}
});
Run Code Online (Sandbox Code Playgroud)
结果是:
[ { idRooms: 1, Room_Name: 'dd' },
{ idRooms: 2, Room_Name: 'sad' } ]
Run Code Online (Sandbox Code Playgroud)
所以我需要将此结果存储在变量中,所以我尝试这样:
var someVar = connection.query("select * from ROOMS", function(err, rows){
if(err) {
throw err;
} else {
return rows;
}
});
console.log(someVar);
Run Code Online (Sandbox Code Playgroud)
但是没有工作,谢谢你提前帮助.
我使用https://github.com/zo0r/react-native-push-notification
得到推送通知和onNotification工作时,应用程序是aspected Active
或在Background
我收到的通知,但是当我杀死的应用程序,我只得到了通知和onNotification没有解雇任何一个可以请帮助我搜索一个解决方案但没有任何效果,当onNotification被解雇时,我增加了Android徽章计数是否有另一种方法来增加Android徽章时应用程序被杀?
"react-native": "0.55.3",
"react-native-push-notification": "3.0.2"
Run Code Online (Sandbox Code Playgroud)
我的代码
const options = {
// (optional) Called when Token is generated (iOS and Android)
onRegister: (token) => {
this._TOKEN = token.token;
this._addToPushChannels(channel);
},
onNotification: (notification) => {
console.log(notification);
if (notification['foreground']) {
}
//Notification from the background or when the app is killed
if (!notification['foreground']) {
if (Platform.OS !== 'ios' && Platform.Version < 26) {
this._messageCount++;
// console.log('this._messageCount ', this._messageCount);
let BadgeAndroid = require('react-native-android-badge');
BadgeAndroid.setBadge(this._messageCount);
}
}
// required …
Run Code Online (Sandbox Code Playgroud) 我正在尝试为WordPress中的用户更新多个meta_key
update_user_meta( $user_id, array( 'nickname' => $userFirstName, 'first_name' => $userFirstName, 'last_name' => $userLastName , 'city' => $userCityID , 'gender' => $userGenderID) );
Run Code Online (Sandbox Code Playgroud)
但它不起作用.我们如何为用户更新多个meta_key?
我是 React Native 和 Animated API 的新手,所以我正在尝试做一个简单的视差标题和 Animated SectionList 这样的
我的代码是
export default class Edit extends Component {
constructor(props) {
super(props)
this.state = {
fullName: '',
scrollEnabled: true,
scrollY: new Animated.Value(0),
}
}
_renderSectionHeader(section){
return <View style={[styles.SectionHeaderViewStyle]}><Text style={styles.SectionHeaderStyle}> {section.title} </Text></View>;
}
_renderItem(item){
return <View><TextFieldValidate /></View>;
}
_onScroll(event) {
// console.log(event.nativeEvent.contentOffset.y);
}
render() {
const backgroundScrollY = this.state.scrollY.interpolate({
inputRange: [0, 224],
outputRange: [0, -170],
extrapolate: 'clamp',
});
const listScrollY = this.state.scrollY.interpolate({
inputRange: [0, 224],
outputRange: [0, -170],
extrapolate: 'clamp',
});
const …
Run Code Online (Sandbox Code Playgroud) 我正在尝试在我公司的本地网络服务器上注册一个 git runner,gitlab 使用自签名证书可以正常工作,但是在尝试注册这样的 git runner 时
sudo gitlab-runner register --tls-ca-file=/home/gitlab-runner/certs/git.crt
Run Code Online (Sandbox Code Playgroud)
然后粘贴git URL
Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/)
https://git.mycompany/
Run Code Online (Sandbox Code Playgroud)
然后是令牌:
Please enter the gitlab-ci token for this runner:
TOKEN
Run Code Online (Sandbox Code Playgroud)
然后是描述和标签,然后我收到此错误:
ERROR: Registering runner... failed
runner=TOKEN status=couldn't execute POST against https://git.mycompany/api/v4/runners:
Post https://git.mycompany/api/v4/runners:
dial tcp: lookup git.mycompany on 127.0.0.53:53:
no such host
PANIC: Failed to register this runner. Perhaps you are having network problems
Run Code Online (Sandbox Code Playgroud)
我没有使用 docker,只是正常设置,请提前提供任何帮助和非常感谢
更新:
我将 DNS 服务器的名称服务器添加到 /etc/resolv.conf 并且最后一个错误消失了,但我有新错误:
x509: certificate has expired or is …
Run Code Online (Sandbox Code Playgroud) 我是mvc的新手,并试图了解我做错了什么,我创建了一个Dbcontaxt
类
public class DataBaseContext : DbContext
{
public DataBaseContext()
: base("DefaultConnection")
{
}
public DbSet<Membership> Membership { get; set; }
public DbSet<OAuthMembership> OAuthMembership { get; set; }
public DbSet<Role> Roles { get; set; }
public DbSet<UserProfile> UserProfiles { get; set; }
public DbSet<Category> Categorys { get; set; }
public DbSet<SubCategory> SubCategorys { get; set; }
public DbSet<Product> Products { get; set; }
public DbSet<Color> Colors { get; set; }
public DbSet<Size> Sizes { get; set; }
public DbSet<Company> …
Run Code Online (Sandbox Code Playgroud) 尝试使用Storage:: disk('local')->append()
方法在同一行的文件中添加字符串,但在输出文件中,我将每个字符串放在一个新行上
我所做的是:
$string = "first-";
Storage::disk('local')->append('filename', $string);
$string = "second";
Storage::disk('local')->append('filename', $string);
Run Code Online (Sandbox Code Playgroud)
输出文件是
first-
second
Run Code Online (Sandbox Code Playgroud)
但我正在尝试获取没有换行符的文件
first-second
Run Code Online (Sandbox Code Playgroud) php ×4
asp.net-mvc ×3
c# ×3
javascript ×3
laravel ×2
linq ×2
react-native ×2
wordpress ×2
ajax ×1
arrays ×1
dropzone.js ×1
facebook ×1
git ×1
gitlab ×1
image ×1
join ×1
jquery ×1
json ×1
laravel-5 ×1
linux ×1
matlab ×1
meta-key ×1
mysql ×1
nat ×1
node.js ×1
ozeki ×1
reactjs ×1
server ×1
sip ×1
ubuntu ×1
voip ×1