我有一个棘轮聊天服务器文件
use Ratchet\Server\IoServer;
use Ratchet\WebSocket\WsServer;
use MyAppChat\Chat;
require dirname(__DIR__) . '/vendor/autoload.php';
$server = IoServer::factory(
new WsServer(
new Chat()
)
, 26666
);
$server->run();
Run Code Online (Sandbox Code Playgroud)
我使用Websocket连接,ws它工作正常
if ("WebSocket" in window) {
var ws = new WebSocket("ws://ratchet.mydomain.org:8888");
ws.onopen = function() {
// Web Socket is connected. You can send data by send() method.
ws.send("message to send");
};
ws.onmessage = function (evt) {
var received_msg = evt.data;
};
ws.onclose = function() {
// websocket is closed.
};
} else {
// the …Run Code Online (Sandbox Code Playgroud) 我有一个集合,称为article_category哪个商店都article_id属于category_id具有数据格式的类别.
集合1:article_category
{
"article_id": 2015110920343902,
"all_category_id": [5,8,10]
}
Run Code Online (Sandbox Code Playgroud)
然后我有其他收集称为article哪个存储我的所有帖子
收集2:文章
{
"title": "This is example rows in article collection"
"article_id": 2015110920343902,
},
{
"title": "Something change"
"article_id": 2015110920343903,
},
{
"title": "This is another rows",
"article_id": 2015110920343904,
}
Run Code Online (Sandbox Code Playgroud)
现在,我想执行的MongoDB查询发现title与regex同时category_id必须等于8.这是我的查询,但不起作用.
db.article.aggregate(
{
$match:
{
title:
{
$regex: /example/
}
}
},
{
$lookup:
{
from: "article_category",
pipeline: [
{ $match: { category_id: 8 } } …Run Code Online (Sandbox Code Playgroud) 我想在我的血腥请求中添加一个自定义标题,这是我的代码,但它不起作用.
var datasource = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.whitespace,
queryTokenizer: Bloodhound.tokenizers.whitespace,
remote: {
url: url,
prepare: function (query, settings) {
var authHeaders;
settings.type = "POST";
settings.data = param + '=' + query;
settings.headers = {
'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')
};
return settings;
},
wildcard: '%QUERY'
}
});
Run Code Online (Sandbox Code Playgroud)
任何的想法?
我使用 Laravel 5.4,现在我想对控制器进行动态路由,这意味着我可以直接访问UserController和Profile函数抛出路由,例如。
GET http://localhost/user/profile?userid=123
Run Code Online (Sandbox Code Playgroud)
上面的示例网址意愿访问UserController和功能profile与后动态参数?。如果我想访问不同的控制器,我只需要将userparam更改为Controllername。
我创建了一条这样的路线并且它有效。
Route::get('v1/{controller_name}/{function_name}/{query?}', function ($controller_name, $function_name){
$app = app();
$controller = $app->make('\App\Http\Controllers\Api\\'.$controller_name.'Controller');
return $controller->callAction($function_name, $parameters = array());
});
Run Code Online (Sandbox Code Playgroud)
但我不知道如何传递参数。
还有其他更好的方法来做到这一点吗?
我将我的Mac更新到1.9.4并安装Xcode 6,我创建了一个新项目并UIBubbleTable从项目中复制了源代码,之前我使用过这个库,并且根据我上次的检查工作仍然可以正常工作.
旧项目适用于此库,但新项目会出错.

我添加了每个需求框架,但仍然是错误.
这是我的错误日志,请帮忙.
CompileC /Users/vietnguyen/Library/Developer/Xcode/DerivedData/Troll_Kitty-gggxclyccrfjrdfavpkgnqibgoth/Build/Intermediates/Troll\ Kitty.build/Debug-iphoneos/Troll\ Kitty.build/Objects-normal/armv7/NSBubbleData.o Troll\ Kitty/NSBubbleData.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
cd "/Users/vietnguyen/Desktop/Troll Kitty/Troll Kitty"
export LANG=en_US.US-ASCII
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -arch armv7 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu99 -fobjc-arc -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wunreachable-code -Wno-implicit-atomic-properties -Werror=deprecated-objc-isa-usage -Werror=objc-root-class -Wno-receiver-is-weak -Wno-arc-repeated-use-of-weak -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wno-deprecated-implementations -DDEBUG=1 -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.0.sdk -fstrict-aliasing -Wprotocol -Wdeprecated-declarations …Run Code Online (Sandbox Code Playgroud) 当 PhpStorm 尝试修复一个常见错误时,我真是太疯狂了Method 'Bla bla' not found in class.
我已经在谷歌搜索了几天,希望找到解决这个问题的方法,但没有运气。
几乎我读过的每个单一主题都将我指向这个 laravel-ide-helper,但是在安装数千次之后(使用新的 laravel 项目),PhpStorm 仍然无法识别那些该死的方法。
我也在 PhpStorm 中安装了 laravel 插件,但仍然无法工作,现在该怎么办?
这是我的代码。
<?php
namespace App\Http\Controllers;
use App\Article;
use App\Menu;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Http\Requestst;
use Illuminate\Support\Facades\Input;
class PagesController extends Controller
{
public function index()
{
$article = Article::latest('published_at')->get();
$data = array(
'articles' => $article
);
return view('pages.index' , compact($data));
}
public function contact()
{
return view('pages.contact');
}
public function about()
{
return view('pages.about');
}
}
Run Code Online (Sandbox Code Playgroud)
请帮忙。
我使用此代码将视频栏添加到视图控制器中.
self.searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 64, MAINSCREEN.size.width, self.searchBar.frame.size.height)];
self.searchBar.delegate = self;
self.searchDisplayController = [[UISearchDisplayController alloc] initWithSearchBar:self.searchBar contentsController:self];
self.searchDisplayController.delegate = self;
self.searchDisplayController.searchResultsDataSource = self;
[self.view addSubview:self.searchBar];
self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 64 + self.searchBar.frame.size.height, MAINSCREEN.size.width, MAINSCREEN.size.height)];
self.tableView.delegate = self;
[self.view addSubview:self.tableView];
Run Code Online (Sandbox Code Playgroud)
我必须以编程方式将搜索栏和表格视图添加到视图中,因为我希望搜索栏始终位于表格视图的顶部,因此我使用了这些代码.
不幸的是,有一个问题,当我修复位置时搜索栏没有动画,CGRectMake所以我必须创建自己的动画来处理这个代码的问题.
- (BOOL)searchBarShouldBeginEditing:(UISearchBar*)searchBar {
[UIView animateWithDuration:0.55f
delay:0
usingSpringWithDamping:500.0f
initialSpringVelocity:0
options:UIViewAnimationOptionOverrideInheritedDuration
animations:^{
self.searchBar.frame = CGRectMake(0, 20, MAINSCREEN.size.width, self.searchBar.frame.size.height);
}
completion:nil];
return YES;
}
- (BOOL)searchBarShouldEndEditing:(UISearchBar *)searchBar
{
[UIView animateWithDuration:0.6f
delay:0
usingSpringWithDamping:500.0f
initialSpringVelocity:0.0f
options:UIViewAnimationOptionCurveLinear
animations:^{
self.searchBar.frame = CGRectMake(0, …Run Code Online (Sandbox Code Playgroud) 我有一个数组,现在我将这个数组放入for loop显示此数组中的每个项目,但我想要设置项目限制(每列4个项目),这是我的代码.
<?php
$area = $custom_area_settings; //is an array with 5 element
for($i=0;$i<=count($area->custom_area_list) - 1; $i++):
if($area->custom_area_list[$i]->top_show):
echo '<div class="sub-column column'.$i.'">';
echo '<p class="line"> ' . $area->custom_area_list[$i]->header . '</p>';
echo '</div>';
endif;
endfor;
?>
Run Code Online (Sandbox Code Playgroud)
在这段代码中,div column$i已经创建了每次循环运行但是我只想在循环运行4次时创建这个div,4次后这个div将再次创建,8次后这个div将再次创建并继续...
这是我想要的结果.
Column 1 Column 2
--------------- ---------------
item 1 item 5
item 2 item 6
item 3 item 7
item 4 item 8
Run Code Online (Sandbox Code Playgroud)
这是我现在得到的结果
Column 1
---------------------
item 1
Column 2
---------------------
item 2
.....
Run Code Online (Sandbox Code Playgroud)
请帮忙.
我有一些代码打开cmd并运行命令然后获取输出,但它总是运行两次,有时输出丢失.
这是我的代码,我多次重新检查,但无法弄清楚是什么原因.
using System;
using System.Diagnostics;
using System.IO;
using System.Security.Cryptography;
using System.Security.Permissions;
using System.Text;
using System.Threading;
namespace CommandHandler
{
class Program
{
public static string change_file = AppDomain.CurrentDomain.BaseDirectory + @"change\change.txt";
public static void Main()
{
//Console.SetWindowSize(Console.LargestWindowWidth, Console.LargestWindowHeight);
Console.BackgroundColor = ConsoleColor.Black;
Console.ForegroundColor = ConsoleColor.Green;
//ProcessStartInfo startInfo = new ProcessStartInfo("cmd", "/c php d:/test.php")
ProcessStartInfo startInfo = new ProcessStartInfo("cmd", "/c D:\\php64\\php D:\\xampp\\htdocs\\xxx\\bin\\listen.php")
{
WindowStyle = ProcessWindowStyle.Hidden,
UseShellExecute = false,
RedirectStandardOutput = true,
CreateNoWindow = true
};
Process process = Process.Start(startInfo);
//process.OutputDataReceived += new …Run Code Online (Sandbox Code Playgroud) php ×4
ios ×2
laravel ×2
ajax ×1
animation ×1
arrays ×1
bloodhound ×1
c# ×1
css ×1
html ×1
jquery ×1
laravel-5 ×1
mongodb ×1
objective-c ×1
phpstorm ×1
ratchet ×1
ssl ×1
typeahead ×1
uisearchbar ×1
url-mapping ×1
url-routing ×1
websocket ×1
xcode ×1