小编Rah*_*kla的帖子

node-gyp构建如何在构建节点扩展时指定目标节点版本

我正在从node-waf构建迁移到节点本机插件的node-gyp构建系统.node-gyp说它支持多个目标版本,但是在使用node-gyp时我找不到如何指定目标节点版本.

问题是,我的系统安装了节点v0.10.3,但我需要为节点版本0.8.20构建我的本机插件.当我构建附加组件时,它使用v0.10.3的标头,其中包含错误.

我无法在使用node-gyp配置/构建时如何指定节点版本.

请帮忙.

node.js node-gyp

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

从NodeJS Native扩展中的不同线程回调

我是nodeJS和节点扩展的新手.我正在为节点js编写一个本机扩展,它将在虚函数OnEvent(param1,param2,param3)上接收回调.代码如下:

bool MyExt::OnEvent(int eventType, string param1, string param2)
{
    printf("MyExt:: onevent___ \n");
    {
        //// Crashes here, but if I use Locker, it get stuck!!!!!!
        //Locker l;
        Local<Value> argv[3] = {
            Local<Value>::New(Integer::New(1)),
            Local<Value>::New(String::New("parameter 1")),
            Local<String>::New(String::New("parameter 2"))
        };

        TryCatch try_catch;
        //// I need to call this
        m_EventCallback->Call(Context::GetCurrent()->Global(), 3, argv);
        if (try_catch.HasCaught()){
                printf("Callback is Exception()  \n");
        }
        printf("Callback is IsCallable() \n");
    }
    return true;
}
Run Code Online (Sandbox Code Playgroud)

我需要使用m_EventCallback将此回调参数转发到服务器脚本.函数bool OnEvent是从另一个线程调用的.

我尝试使用uv_async_send但无法成功.

任何帮助或指导将不胜感激.

multithreading callback node.js

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

Android Drawable(进度条,开关)渲染问题

我正在尝试实现以下UI.我正在使用Eclipse和ADT插件.

Spotify UI

以下是圆圈[白色+深灰色](circle_shape.xml)的实现:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@android:id/background">
        <shape android:shape="ring" android:innerRadius="65dp" android:thickness="10dp"
            android:useLevel="false">
            <solid android:color="@android:color/white" />
        </shape>
    </item>
    <item android:id="@android:id/progress">
        <shape android:shape="ring" android:innerRadius="57dp" android:thickness="8dp" android:useLevel="false">
            <solid android:color="#FF393939" />
        </shape>
    </item>
</layer-list>
Run Code Online (Sandbox Code Playgroud)

和进度条[绿色](circle_progress_bar.xml)为:

<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android" android:fromDegrees="270" android:toDegrees="270">
    <shape android:innerRadius="65dp" android:shape="ring" android:thickness="10dp">
        <gradient android:angle="0" android:endColor="#FF00FF00" android:startColor="#FF00FF00" android:type="sweep" android:useLevel="false" />
    </shape>
</rotate>
Run Code Online (Sandbox Code Playgroud)

在布局xml文件中:

<ProgressBar
    android:id="@+id/progressBar"
    style="?android:attr/progressBarStyleHorizontal"
    android:layout_width="200dp"
    android:layout_height="200dp"
    android:layout_alignBottom="@+id/repeat"
    android:layout_centerHorizontal="true"
    android:layout_marginBottom="36dp"
    android:background="@drawable/circle_shape"
    android:indeterminate="false"
    android:max="100"
    android:progress="65"
    android:progressDrawable="@drawable/circular_progress_bar" />
Run Code Online (Sandbox Code Playgroud)

问题1: 上面的代码为我提供了我想要的精确形状,但仅限于API 19和API 20.只要我将Eclipse中的预览模式切换到API 21,progressDrawable就会填满整个圆圈而只留下单个圆圈充满了绿色.我无法想象如何在Android L上做同样的事情.

问题2: 这与切换按钮有关.在API 21中,我可以轻松设置

<android:textOn="" android:textOff="">
Run Code Online (Sandbox Code Playgroud)

按钮看起来很好.但是,如果我在API19中查看相同内容,则Thumb …

eclipse android xml-drawable android-drawable android-5.0-lollipop

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