有没有办法使用 about:config 配置 Firefox 以允许本地文件访问(用于演示目的)?
特别是使用 FF12,我需要能够对 json 数据进行本地文件访问。它在服务器上运行良好,但我想让这个演示更加便携。
$.ajax({
url: "../_assets/levelschema.json",
complete: function (data) {
Levels = data.levels;
//...
},
success: function (data) {
// wont get called b/c files don't have 200 HTTP status
},
async: false
});
Run Code Online (Sandbox Code Playgroud)
我尝试将其设置为 not async=false,但收到“访问受限 URI 被拒绝”错误。这是一项安全功能。我确实需要该演示能够离线工作,无需访问互联网,而且我希望使用它的人不必安装网络服务器。我还不想将所有数据嵌入 HTML 标记中,因为这些数据可能会发生变化。
因此,我们有一个小图形doohickey需要在没有真正视频卡的服务器环境中运行.它真正需要的是帧缓冲对象,也许还有一些矢量/字体抗锯齿.我知道,它会很慢.它只需要输出单帧.
我看到这篇关于如何强制软件渲染模式的文章,但它似乎适用于已经有OpenGL卡的机器(如NVidia).
所以,由于担心尝试在三个时区的机器上安装OpenGL,并且有一堆现场制作网站 - 有没有人尝试过这个和/或知道如何"模仿"一个OpenGL环境?不幸的是我们的开发服务器有一个视频卡,所以我无法真正展示"我尝试过的东西".
相关代码全部都在Cinder中,但我认为我们的实际OpenGL利用率很轻.
这将在Windows Server 2008 Standard上运行
我看到MS有一个OGL 1.1 的软件实现,但似乎找不到2.0
我不认为我的语法在这里真的很糟糕.或者是吗?这是我第一次尝试OpenFL.
Haxe没有正确编译?我错过了编译器指令吗?我在这个函数中实际上有语法错误吗?Flashdevelop中的语法检查器说不.
这是命令:
Running process: C:\Program Files (x86)\FlashDevelop\Tools\fdbuild\fdbuild.exe "C:\dev\Haxe\TestOpenFL\OpenFLTest.hxproj" -ipc 2e4ace78-45b9-4868-a2dd-cf2c35265f44 -version "3.0.0" -compiler "C:\HaxeToolkit\haxe" -library "C:\Program Files (x86)\FlashDevelop\Library" -target "flash"
Run Code Online (Sandbox Code Playgroud)
src/Main.hx:32:字符16-17:意外; 构建因错误而停止(haxelib.exe).
function init()
{
if (inited) return;
inited = true;
// \/ says this semicolon is unexpected. wtf
for (var i = 0; i < 200; i ++)
{
var bmd = new BitmapData( 100, 100, true, 0xff0000ff);
var bmp = new Bitmap( bmd);
addChild(bmp);
bitmaps.push( bmp );
}
addEventListener( Event.ENTER_FRAME, onEnterFrame );
}
Run Code Online (Sandbox Code Playgroud)
这是整个脚本.我不能为我的生活弄清楚为什么它会在那里出错.如果我只注释循环,它编译就好了. …
刚做了一个简单的控制器注入一些.
var SimpleProductListController = BaseController.extend({
_notifications:null,
_productsModel:null,
init:function($scope,ProductsModel,$route){
},
defineListeners:function(){
this._super();
},
destroy:function(){
}
})
/...
SimpleProductListController.$inject = ['$scope','ProductsModel','$route'];
Run Code Online (Sandbox Code Playgroud)
控制台错误指向:http: //errors.angularjs.org/1.2.16/ng/areq?p0 = SimpleProductListController&p1 = not%20aNaNunction%2C%20got%20undefined
Argument 'SimpleProductListController' is not aNaNunction, got undefined
Run Code Online (Sandbox Code Playgroud)
我该如何调试呢?我得到了batarang,但它在这里什么也没做.
使用香草js.从OSX获取"右键单击"(选项单击)的任何方法?
function clickey(e)
{
if(event.button==2 || /*how you'd do it in Java=)*/ e.getButton() == MouseButton.BUTTON3 )
...
}
Run Code Online (Sandbox Code Playgroud)
但是在js中,eeet怎么样?
所以我有一个模型存储库,它使用C#AWS SDK for Dynamo.现在它有点难看.我想要的是将结果项输出到我的模型中.进入Dynamo很棒.我只是对我的Poco类进行了一些类型的反射,然后将它们推入:
var doc = new Document();
foreach (PropertyInfo prop in model.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public))
{
var propName = (string)prop.Name;
// dont add if value is null
if (prop.GetValue(model, null) != null)
{
if (prop.PropertyType == typeof(string))
doc[propName] = (string)prop.GetValue(model, null);
if (prop.PropertyType == typeof(List<string>))
doc[propName] = (List<string>)prop.GetValue(model, null);
if (prop.PropertyType == typeof(float))
doc[propName] = (float)prop.GetValue(model, null);
}
}
Run Code Online (Sandbox Code Playgroud)
但是在回购中,我想在检索项目时不必写这个丑陋的手工演员.是否有AWS帮助程序可以减少手动操作?我想我可以编写上面循环的反转并获取属性属性名称,然后在每个N,S,SS类型等上测试null.
var request = new ScanRequest
{
TableName = TableName.User,
};
var response = client.Scan(request);
var collection = …Run Code Online (Sandbox Code Playgroud) 我正在遵循这个单例模式,为什么错误LNK2001:在这种情况下未解析的外部符号?我的问题看起来很相似,但我的问题不在于静态实例的定义.我的问题是从另一个类解析静态GetInstance()定义.
我的错误似乎不同,或以前的答案是不充分的.我已经尝试过这样的建议,"你需要在课堂外定义s_instance"这对我来说是没有意义的cpp noob.我在标题中声明静态,并在cpp中定义它们的实现.
我也不需要关于单例的线程安全的讲座,处理程序绑定使用信号2 ...
State.h
class State
{
public:
State(void);
~State(void);
static State* instance;
static State* GetInstance();
...
};
Run Code Online (Sandbox Code Playgroud)
State.cpp
State::AppState mCurrentState;
boost::signals2::signal<void ()> mSignal;
State* instance = NULL;
State* GetInstance()
{
if( instance == NULL)
{
instance = new State();
return instance;
}
else
{
return instance;
}
}
Run Code Online (Sandbox Code Playgroud)
所有这些都很好.然后当我尝试访问这样的单例时
State *state = State::GetInstance();,我得到"未解析的外部符号"错误.
错误LNK2019:未解析的外部符号"public:static class State*__cdecl State :: GetInstance(void)"(?GetInstance @State @@ SAPAV1 @ XZ)在函数"public:virtual void __thiscall MesherApp :: setup(void)"中引用(?设置@ MesherApp …
所以,我正在将一些c ++转换为javascript,我真的需要知道D3DX如何定义它们的四元数运算符.
//Here's the c++ version
D3DXQUATERNION Qvel = 0.5f * otherQuat* D3DXQUATERNION(angVel.x, angVel.y, angVel.z, 0);
//Here's the js quat multiplication
function quat_mul(q1, q2) {
return
[q1.x * q2.w + q1.y * q2.z - q1.z * q2.y + q1.w * q2.x,
-q1.x * q2.z + q1.y * q2.w + q1.z * q2.x + q1.w * q2.y,
q1.x * q2.y - q1.y * q2.x + q1.z * q2.w + q1.w * q2.z,
-q1.x * q2.x - q1.y * q2.y - q1.z …Run Code Online (Sandbox Code Playgroud) 我正在写一个.NET服务,提供了相匹配的数据texturepacker架构很容易让iOS的开发者使用我产生spritesheets。这是一个基本节点(我还没有找到文档):
<dict>
<key>frame</key>
<string>{{449,767},{139,117}}</string>
<key>offset</key>
<string>{0,0}</string>
<key>rotated</key>
<true/>
<key>sourceColorRect</key>
<string>{{0,0},{139,117}}</string>
<key>sourceSize</key>
<string>{139,117}</string>
</dict>
Run Code Online (Sandbox Code Playgroud)
除了模式中明显的冗余之外,还有“框架”是目标矩形吗?
什么是 sourceColorRect?如果那只是来源,为什么不这样称呼它并摆脱 sourceSize,因为那是多余的?
另外,什么是偏移量?像注册点一样吗?如果我们不需要原点坐标信息,我可以忽略吗?
理想情况下,这个列表看起来像
- frame (but is this really the destRect?)
- sourceRect
- destRect
- rotated
- offset
Run Code Online (Sandbox Code Playgroud)
也许只给我自己的带有简化数据的 pList 和 iOS 开发人员需要将 image_name 确定为键而忘记“框架”是什么的准系统会更容易。
javascript ×3
c++ ×2
angularjs ×1
arguments ×1
c# ×1
casting ×1
click ×1
compilation ×1
direct3d ×1
dynamic ×1
emulation ×1
events ×1
firefox ×1
haxe ×1
ios ×1
json ×1
mouse ×1
objective-c ×1
openfl ×1
opengl ×1
plist ×1
quaternions ×1
scalar ×1
security ×1
singleton ×1
sprite-sheet ×1
static ×1
syntax ×1
video-card ×1
windows ×1