小编use*_*254的帖子

Pixi.js中的自定义字体

我尝试将自定义字体加载到Pixi.js(2D WebGL框架)中.

他们有一个使用.woff谷歌字体的例子:

https://github.com/GoodBoyDigital/pixi.js/tree/master/examples/example%2010%20-%20Text

我将.ttf转换为.woff并添加到css中:

@font-face
{
    font-family: "HU_Adrien";
    src: local('HU_Adrien'), url('HU_A0046.woff') format('woff');;
}

div.font{
    font-family: "HU_Adrien";
    color: white;
}
Run Code Online (Sandbox Code Playgroud)

它显示在我的div中但不在我的Pixi阶段.

...
    // create a text object with a nice stroke
    var spinningText = new PIXI.Text("I'm fun!", {font: "160px HU_Adrien", fill: "#cc00ff", align: "center", stroke: "#FFFFFF", strokeThickness: 6});
    // setting the anchor point to 0.5 will center align the text... great for spinning!
    spinningText.anchor.x = spinningText.anchor.y = 0.5;
    spinningText.position.x = 620 / 2;
    spinningText.position.y = 400 / 2;
...
Run Code Online (Sandbox Code Playgroud)

javascript webgl pixi.js

12
推荐指数
1
解决办法
7148
查看次数

Fullcalendar事件的结束时间丢失

我用这个选项运行Fullcalendar

defaultEventMinutes:30,
timeFormat: 'HH:mm { - HH:mm}',
Run Code Online (Sandbox Code Playgroud)

我有一些事件(每个30分钟),但只显示他们的开始时间.

10:00 -  
14:30 -
Run Code Online (Sandbox Code Playgroud)

拖动一个事件时,它的开始结束时间就像我应该的那样.

10:00 - 10:30  
14:30 - 15:00
Run Code Online (Sandbox Code Playgroud)

javascript fullcalendar

8
推荐指数
2
解决办法
1万
查看次数

Chrome打印空白页

如果用户点击缩略图,我有一个旧的JavaScript代码来打印图像.它过去工作得很好,但最近(仅限Chrome!)预览中有一个空白页面.

以下是JsBin中的演示:http://jsbin.com/yehefuwaso/7 单击打印机图标.现在在Firefox中试试吧; 它将按预期工作.

Chrome:41.0.2272.89米

Firefox:30.0,36.0.1

function newWindow(src){

  win = window.open("","","width=600,height=600");
    var doc = win.document;
    // init head
    var head = doc.getElementsByTagName("head")[0];
    // create title
    var title = doc.createElement("title");
    title.text = "Child Window";
    head.appendChild(title);
    // create script
    var code = "function printFunction() { window.focus(); window.print(); }";
    var script = doc.createElement("script");
    script.text = code;
    script.type = "text/javascript";
    head.appendChild(script);
    // init body
    var body = doc.body;
    //image
    doc.write('<img src="'+src+'" width="300">');

    //chrome
    if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1) {

      win.printFunction();               

    } else { …
Run Code Online (Sandbox Code Playgroud)

javascript printing google-chrome

7
推荐指数
1
解决办法
9219
查看次数

从Chrome扩展程序访问Websocket流量

有一个页面(游戏),该页面通过WebSocket与服务器通信。我可以在Chrome开发者工具中查看数据(框架)。是否可以通过chrom-extension访问/修改此通信?

websocket google-chrome-extension

6
推荐指数
3
解决办法
4497
查看次数

如何获得第n位值

我对整个位移和c ++都很陌生.

假设我有一个uint8_t 00100100(36),我想检查第3位是否已设置.以下是我现在只做一点的代码.

uint8_t x = 36;
    if(x&1<<3)
        printf("is set");
Run Code Online (Sandbox Code Playgroud)

如何检查第3 位第6位是否已设置?我想检查几个比特组合,如第5或第7或第8.

什么是最优雅的方式呢?

c++ bits bit-shift

6
推荐指数
1
解决办法
2万
查看次数

symfony 2中的REST表单验证 - 如何测试帖子

表单永远不会有效,但$form->getErrors()不会出错.由于它将使用DEV HTTP客户端进行REST API测试

测试数据是

标题: Content-Type:application/json

身体: {"username":"sad","password":"123","email":"asdsads@fgfdg.com"}

我没有任何validation.yml文件

有没有任何方法可以找出出错的方法(错误信息)?

public function postUserAction(Request $request)
{

    return $this->processForm(new User(),$request);
}

private function processForm(User $user, Request $request )
{


    $form = $this->createForm(new UserType(), $user);
    $form->handleRequest($request);

    if ($form->isValid()) {

         return array('form' => 'valid');
    }

    return \FOS\RestBundle\View\View::create($form->getErrors(),400);
}
Run Code Online (Sandbox Code Playgroud)

validation rest symfony

5
推荐指数
1
解决办法
4744
查看次数

警告C4146减去无符号类型的运算符

我从我想要使用的库中获取此代码.在编译时,我收到以下警告:

警告C4146:一元减号运算符应用于无符号类型,结果仍未签名

inline int lastbit (uint32_t v)
{
  int r;
  static const int MultiplyDeBruijnBitPosition[32] = 
    {
      0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, 
      31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9
    };
  r = MultiplyDeBruijnBitPosition[((uint32_t)((v & -v) * 0x077CB531U)) >> 27];
  return r;
}
Run Code Online (Sandbox Code Playgroud)

如何通过尽可能少地更改库来修复它?

c++ unsigned compiler-errors

3
推荐指数
1
解决办法
2691
查看次数

推力矢量距离计算

考虑以下数据集和质心。有 7 个个体和两个均值,每个均具有 8 个维度。它们存储在行主序中。

short dim = 8;
float centroids[] = {
    0.223, 0.002, 0.223, 0.412, 0.334, 0.532, 0.244, 0.612, 
    0.742, 0.812, 0.817, 0.353, 0.325, 0.452, 0.837, 0.441
};   
float data[] = {
    0.314, 0.504, 0.030, 0.215, 0.647, 0.045, 0.443, 0.325,
    0.731, 0.354, 0.696, 0.604, 0.954, 0.673, 0.625, 0.744, 
    0.615, 0.936, 0.045, 0.779, 0.169, 0.589, 0.303, 0.869, 
    0.275, 0.406, 0.003, 0.763, 0.471, 0.748, 0.230, 0.769, 
    0.903, 0.489, 0.135, 0.599, 0.094, 0.088, 0.272, 0.719, 
    0.112, 0.448, 0.809, 0.157, 0.227, 0.978, …
Run Code Online (Sandbox Code Playgroud)

c++ thrust

2
推荐指数
1
解决办法
970
查看次数