我可以使用Google Chrome网络检查器中的"网络"标签调试网络流量(AJAX请求等).我可以轻松检查传输的数据.但Websocket连接只显示为
Request URL:ws://localhost/...
Request Method:GET
Status Code:101 Switching Protocols
...
Run Code Online (Sandbox Code Playgroud)
我看不到传输的数据.Google Chrome中是否有任何内置功能来检查传输的数据?或者我需要使用Wireshark吗?
PS:我使用的是最新的稳定版(16.0.912.75).如果较新的版本(beta/dev)具有此功能,那就太好了.
我正在使用Windows 8和Visual Studio 2012的发行版本来创建带有Ribbon控件的WPF应用程序.我在.Net Framework 4.5中选择了WPF附带的功能区控件.
我创建功能区的代码:
<RibbonWindow
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WpfExperiments" x:Class="WpfExperiments.MainWindow"
Title="MainWindow" Height="350" Width="525" Icon="Test.ico">
<Ribbon>
<Ribbon.ApplicationMenu>
<RibbonApplicationMenu>
<RibbonApplicationMenuItem Header="Item 1"></RibbonApplicationMenuItem>
</RibbonApplicationMenu>
</Ribbon.ApplicationMenu>
<Ribbon.QuickAccessToolBar>
<RibbonQuickAccessToolBar>
<RibbonButton SmallImageSource="Test.ico" Label="Test"></RibbonButton>
</RibbonQuickAccessToolBar>
</Ribbon.QuickAccessToolBar>
</Ribbon>
Run Code Online (Sandbox Code Playgroud)
但问题是,它生成一个丑陋风格的窗口,与windows 8风格不匹配:

将它与资源管理器功能区进行比较.窗口标题居中(并具有不同的颜色),窗口的边框大小不同.功能区的风格是不一样的,但如果我有与MS Word相同的功能区风格(在Windows 8中正确显示),我会感到满意.

WPF的功能区控件是否不支持新的Windows 8样式?或者我错过了任何设置?
编辑:
我开始在Blend中编辑模板(4.0,我无法访问5.0).修复一些编译错误(似乎是混合中的错误)后,我可以运行该应用程序,但它看起来像这样:

但这不是我改变的良好起点......
我有一个像这样的JSON对象:
var list = {'name1' : {'element1': 'value1'}, 'name2' : {'element1': 'value2'});
Run Code Online (Sandbox Code Playgroud)
如何提取所有nameX字符串值?
例如,假设我想将它们串联在一个字符串中,例如:"name1 name2"
在任何解决方案中使用jQuery都很好.请指教...
我们都知道boost和c ++ 11都支持shared_ptr.有些编译器支持c ++ 11,而有些编译器则不支持.我想编写我的代码,以便当编译器支持c ++ 11 shared_ptr时,它使用std :: shared_ptr; 如果没有,请使用boost :: shared_ptr.最常见/最佳做法是什么?
让我将讨论局限于GCC,而不是特定版本.
我正在编写一个 Flutter 应用程序,并希望在该应用程序的 Web 版本中处理 Ctrl+I 等键盘快捷键。
\n\n小免责声明:看起来围绕快捷方式的 Flutter API 最近发生了变化。我找到的在线文档已经过时了。我在用着Flutter 1.19.0-0.0.pre \xe2\x80\xa2 channel dev。
我发现Actions API 设计文档感觉像是当前可用的 API。根据文档中的示例,我实现了这个简短的片段:
\n\nclass MyIntent extends Intent {}\n\nclass MyApp extends StatelessWidget {\n // This widget is the root of your application.\n @override\n Widget build(BuildContext context) {\n return MaterialApp(\n title: \'Flutter Demo\',\n theme: ThemeData(\n primarySwatch: Colors.blue,\n visualDensity: VisualDensity.adaptivePlatformDensity,\n ),\n home: Shortcuts(\n shortcuts: {\n LogicalKeySet(LogicalKeyboardKey.control): MyIntent(),\n },\n child: Actions(\n actions: {\n MyIntent: CallbackAction(onInvoke: (i) {\n print(\'Hello World!!!\');\n return …Run Code Online (Sandbox Code Playgroud) 我有这个代码的问题:
struct document_type_content
{
long long m_ID;
QString m_type_name;
};
std::vector<QString> document_type::get_fields_by_name(e_doc_type) const
{
std::vector<QString> tmp;
std::vector<document_type_content*>::iterator it = m_table_data.begin(),
it_end = m_table_data.end();
for ( ; it != it_end; ++it) {
document_type_content* cnt = *it;
tmp.push_back(cnt->m_type_name);
}
}
Run Code Online (Sandbox Code Playgroud)
我正在为项目使用QtCreator,它给了我以下错误(对于行,初始化迭代器的行):
error: conversion from '__gnu_cxx::__normal_iterator<document_type_content* const*, std::vector<document_type_content*, std::allocator<document_type_content*> > >' to non-scalar type '__gnu_cxx::__normal_iterator<document_type_content**, std::vector<document_type_content*, std::allocator<document_type_content*> > >' requested
Run Code Online (Sandbox Code Playgroud)
这可能是一个简单的问题,无论如何,不是我:).
非常感谢提前.
我正在使用Dart对32位整数进行ZigZag编码.这是我正在使用的源代码:
int _encodeZigZag(int instance) => (instance << 1) ^ (instance >> 31);
int _decodeZigZag(int instance) => (instance >> 1) ^ (-(instance & 1));
Run Code Online (Sandbox Code Playgroud)
代码在DartVM中按预期工作.
但是在dart2js中,_decodeZigZag如果输入负数,则函数返回无效结果.例如-10.-10被编码19并应该被解码回来-10,但它被解码为4294967286.如果我(instance >> 1) ^ (-(instance & 1))在Chrome的JavaScript控制台中运行,我会得到预期的结果-10.对我来说,这意味着Javascript应该能够使用数字模型正确运行此操作.
但是Dart2Js生成以下JavaScript,它看起来与我在控制台中测试的代码不同:
return ($.JSNumber_methods.$shr(instance, 1) ^ -(instance & 1)) >>> 0;
Run Code Online (Sandbox Code Playgroud)
为什么Dart2Js将函数的右移0加到函数中?没有转变,结果将如预期的那样.
现在我想知道,这是Dart2Js编译器中的错误还是预期的结果?有没有办法强制Dart2Js输出正确的JavaScript代码?
或者我的Dart代码错了?
PS:还测试了将XOR分成其他操作,但是Dart2Js仍在添加正确的移位:
final a = -(instance & 1);
final b = (instance >> 1);
return (a & -b) …Run Code Online (Sandbox Code Playgroud) 我通过创建模型创建了一个实体框架4.0应用程序.使用此技巧创建SQL Server Compact 4.0版数据库.
现在我完成了将初始数据导入数据库的所有代码(添加元素工作正常).但是,如果我尝试通过访问元素
Context context = new Context();
foreach (var c in context.Customers) // Exception
{
System.Diagnostics.Debug.Print(c.ToString());
}
Run Code Online (Sandbox Code Playgroud)
它在foreach循环的开头抛出一个异常:
[A]System.Data.SqlServerCe.SqlCeConnection cannot be cast to
[B]System.Data.SqlServerCe.SqlCeConnection. Type A originates from
'System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=89845dcd8080cc91' in the context 'Default' at location
'C:\Windows\assembly\GAC_MSIL\System.Data.SqlServerCe\4.0.0.0__89845dcd8080cc91\
System.Data.SqlServerCe.dll'. Type B originates from 'System.Data.SqlServerCe,
Version=3.5.1.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' in the context
'Default' at location 'C:\Windows\assembly\GAC_MSIL\System.Data.SqlServerCe\
3.5.1.0__89845dcd8080cc91\System.Data.SqlServerCe.dll'.
Run Code Online (Sandbox Code Playgroud)
我将这些引用添加到我的应用程序:
System.Data.Entity - 4.0
System.Data.SqlServerCe - 4.0
System.Data.SqlServerCe.Entity - 4.0
Run Code Online (Sandbox Code Playgroud)
有没有人有想法,我的配置有什么问题?
PS:我想使用SQL CE 4.0,因为计算值.如果我需要使用3.5,我需要改变我的架构(或者是否可以在上下文类中实现类似计算值的东西?).
我有一个 vector < vector < Point> > X并且想要将其中的所有元素复制到一个vector < Point > Y(并且如果可能的话以相同的顺序)我尝试了类似的东西(在for循环中):
Y.push_back(i) = X.at(i).at(i);
Run Code Online (Sandbox Code Playgroud)
但显然它不起作用......
我也发现了这个(在stackoverflow上),但它对我来说也不起作用......
for (std::vector<std::vector<Point> >::iterator it = X.begin(), itEnd = X.end(); it != itEnd; ++it)
Y.push_back((*it));
Run Code Online (Sandbox Code Playgroud)
但是编译器告诉我"在重载中没有函数的实例"(老实说,我甚至不知道它是什么意思).
以下是我的代码:
using System;
using System.Collections.Generic;
using System.Text;
using System.CodeDom.Compiler;
using System.IO;
using Microsoft.CSharp;
using System.Reflection;
namespace DynaCode
{
class Program
{
static void Main(string[] args)
{
string content = File.ReadAllText(@"D:\hi.cs");
string[] code = new string[content.Length];
char[] seperators = { '\n','\r','\t' };
code = content.Split(seperators);
CompileAndRun(code);
Console.ReadKey();
}
static void CompileAndRun(string[] code)
{
CompilerParameters CompilerParams = new CompilerParameters();
string outputDirectory = Directory.GetCurrentDirectory();
CompilerParams.GenerateInMemory = true;
CompilerParams.TreatWarningsAsErrors = false;
CompilerParams.GenerateExecutable = false;
CompilerParams.CompilerOptions = "/optimize";
string[] references = { "System.dll"};
CompilerParams.ReferencedAssemblies.AddRange(references);
CSharpCodeProvider …Run Code Online (Sandbox Code Playgroud) 我正在使用 ZLibDeflater 压缩文件,方法是将其作为流读取并进行转换:
new File(filePath)
.openRead()
.transform(new ZLibDeflater())
.pipe(new File(gzipPath).openWrite())
.then(...);
Run Code Online (Sandbox Code Playgroud)