小编Joh*_*all的帖子

什么是__DARWIN_C_LEVEL C-preprocessor符号?

我最近收到了一个使用的补丁__DARWIN_C_LEVEL.我认为提供它的人使用OS X 10.10.

我有OS 10.9,10.8和10.5用于测试,但它们似乎都没有定义它.

10.5:

$ uname -a
Darwin PowerMac.home.pvt 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:57:01 PDT 2009;
root:xnu-1228.15.4~1/RELEASE_PPC Power Macintosh
$ cpp -dM < /dev/null | grep -i darwin
$
Run Code Online (Sandbox Code Playgroud)

10.8:

$ uname -a
Darwin riemann.home.pvt 12.6.0 Darwin Kernel Version 12.6.0: Wed Mar 18 16:23:48 PDT 2015;
root:xnu-2050.48.19~1/RELEASE_X86_64 x86_64
$ cpp -dM </dev/null | grep -i darwin
$
Run Code Online (Sandbox Code Playgroud)

有很多点击它,但它要么是苹果的源代码或某人的补丁.Confer,"_ _ DARWIN_C_LEVEL"网站:opensource.apple.com.

Apple就像这样使用它,但我不清楚他们想要实现的目标:

#if __DARWIN_C_LEVEL > __DARWIN_C_ANSI
#define …
Run Code Online (Sandbox Code Playgroud)

c macos posix c-preprocessor

9
推荐指数
1
解决办法
1169
查看次数

如何使用javascript提交使用angular 2 http post功能的表单?

我已经开始学习,Angular2但我想使用http.post()我的Web API 提交表单,但我不能.

javascript angular2-http angular

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

VC6:致命错误C1083:无法打开包含文件:'stdint.h'

在VC6中编译时,我收到错误:

(致命错误C1083:无法打开包含文件:'stdint.h':没有这样的文件或目录)

任何人都可以解释为什么我收到此错误?

visual-c++-6 stdint

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

Android下的unity3d中的webcamTexture旋转不同

我在Android设备中旋转webcamtexture时遇到了困难.

这是我在编辑器中的场景: 在此输入图像描述

这是手机中的图像: 在此输入图像描述

您可以看到手机和编辑器之间的旋转和缩放差异.

这是代码:

using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public class Camera_pnl : MonoBehaviour {

    //// Use this for initialization
    WebCamTexture webCameraTexture;

    void Start() {
        GUITexture BackgroundTexture = gameObject.AddComponent<GUITexture>();
        BackgroundTexture.pixelInset = new Rect(0,0,Screen.width,Screen.height);
        WebCamDevice[] devices = WebCamTexture.devices;

        foreach (WebCamDevice cam in devices)
        {
            if (cam.isFrontFacing )
            {    
                webCameraTexture  = new WebCamTexture(cam.name);
                webCameraTexture.deviceName  = cam.name;
                webCameraTexture.Play();
                BackgroundTexture.texture = webCameraTexture;
            }
        }
    }

    void Update () {
        if (Input.GetKey (KeyCode.Escape)) {
            Invoke("LoadGame",0.1f);
        }
    }

    void LoadGame ()
    {
        webCameraTexture.Stop (); …
Run Code Online (Sandbox Code Playgroud)

webcam android unity-game-engine

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

HQL中IDictionary <Key,Val>的CreateFilter()

我尝试着:

db.CreateFilter(x.dict, "DictionaryValue = 1 order by CreateDate");
Run Code Online (Sandbox Code Playgroud)

但这不是有效的HQL.如何在HQL中编写此过滤器?

这是代码:

public class A
{
    public virtual IDictionary<B, int> dict { get; protected set; } //int is 1 or -1
}

public class B
{
    public virtual DateTime CreateDate { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

其中映射为:

<map name="dict" table="TABLE">
  <key column="ID_A" />
  <index-many-to-many column="ID_B" class="B" />
  <element column="FACTOR" type="Int32" />
</map>
Run Code Online (Sandbox Code Playgroud)

nhibernate hql

7
推荐指数
0
解决办法
436
查看次数

jQuery ajax请求,承诺不在IE9中工作

这是我制作的一个使用YQL进行Google翻译的课程.

var Translator = {
    source: 'ro', // default
    target: 'en', // default
    url: 'http://query.yahooapis.com/v1/public/yql?q=select * from google.translate where q="',
    urlRemaining: '";&format=json&diagnostics=true&env=store://datatables.org/alltableswithkeys&callback=',
    diacritics: Array(),
    newCharacters: Array(),

    replaceAll: function( string, replace, replaceWith ) {
        return string.replace( new RegExp( replace, 'g' ), replaceWith );
    },

    replaceDiacritics: function( text ) {
        string = text;

        // diacritics and newCharacters should be arrays of the same length
        // diacritics should only be specified in lowercase - uppercased version will be assumed
        // durring the process …
Run Code Online (Sandbox Code Playgroud)

javascript ajax jquery promise internet-explorer-9

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

使用poll()检查文件修改

有一个文件,我想检查poll()内容已更改.

在Raspi上有一个名为gpio value的文件,如果更改的值poll()是用POLLPRI触发的,我想对普通文件做同样的事情.

这是我用来检查GPIO文件的代码:

int gpio_fd = gpio_fd_open();
int timeout = POLL_TIMEOUT;
struct pollfd fdset;
int nfds = 1;
char *buf[MAX_BUF];
int len;
int rc;
fdset.fd = gpio_fd;
fdset.events =  POLLPRI | POLLERR | POLLHUP | POLLNVAL; // POLLIN | | POLLOUT 
unsigned int c1, c2, c3;
do{
    rc = poll(&fdset, 1, timeout);
Run Code Online (Sandbox Code Playgroud)

和gpio_fd_open函数:

int gpio_fd_open() {
    printf("opening File: " SYSFS_GPIO_DIR "\n");

    int fd, len;
    char buf[MAX_BUF];

    len = snprintf(buf, sizeof (buf), SYSFS_GPIO_DIR);
    fd = open(buf, …
Run Code Online (Sandbox Code Playgroud)

c linux

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

纯Win32 C++中的自定义菜单边框(没有WTL,MFC等)

仅使用Win32 C++(没有WTL或MFC或任何其他第三方库),如何获得自定义菜单边框?

我能够拥有物品,但边界在非客户区域,我无法找到改变它们的方法.

有办法吗?

c++ windows winapi menu ownerdrawn

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

如何在RStudio中安装新字体?

我想在RStudio中安装一个新字体.更具体地说,我在我的办公室(Windows)和家里(OS X)使用RStudio,但我看到字体不同,需要一段时间才能习惯.

有人可以建议如何在Mac中的RStudio中安装SAS monospace字体吗?
(我在这里和谷歌进行了搜索,但我没有找到答案回答我的问题.)

先感谢您!

macos fonts rstudio

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

格式字符串攻击?

最近的安全通知(http://osdir.com/ml/bugtraq.security/2015-04/msg00102.html)声明这行代码:

fprintf(stderr, (isprint(adata->contents[i])) ? "%c " : "%02x", adata->contents[i]);
Run Code Online (Sandbox Code Playgroud)

受到" 格式字符串攻击 "的影响我理解为使用类似的东西:

fprintf(stderr, varWithUserSuppliedData);
Run Code Online (Sandbox Code Playgroud)

代替:

fprintf(stderr, "%s", varWithUserSuppliedData);
Run Code Online (Sandbox Code Playgroud)

但是我没有在第一次fprintf电话中看到这一点 - 我错过了什么?

c security printf

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