小编use*_*667的帖子

如何使用MinGW和MSYS为Windows构建Lua?

我有一本名为Beginning Lua Programming的书,它假定要考虑原始基础知识,但这有点让我陷入困境.这是一个压缩3页的努力:

引用:

The following environment variables are recommended for Windows:
UTIL_DIR=c:\program files\utility
LUA_DIR=c:\program files\lua\5.1
LUA_CPATH=?.dll;%LUA_DIR%\?.dll
LUA_PATH=?.lua;%LUA_DIR%\?.lua
The UTIL_DIR variable identifies the utility directory you created in the preceding section. 
Run Code Online (Sandbox Code Playgroud)

在此之后,有一段关于为lua设置'windows搜索路径'.基本上,它告诉我查找'doskey /?'的输出 和'路径'并自己弄清楚.我不知道这些是做什么的,如何使用它们,以及它们之间的区别是什么.

我的智慧结束了.详细解释或链接到详细的博客/文章或youtube视频是非常感谢!

windows lua mingw compilation

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

媒体查询如何检索数据?

例如:

<!-- CSS media query on a link element -->
<link rel="stylesheet" media="(max-width: 800px)" href="example.css" />

<!-- CSS media query within a style sheet -->
<style>
@media (max-width: 600px) {
  .facet_sidebar {
    display: none;
  }
}
</style>
Run Code Online (Sandbox Code Playgroud)

CSS3在何处以及如何检索设备的最大宽度和高度以及设备类型和宽高比等数据?

[编辑]我作为开发者需要做的其他事情是我想要弄清楚的底线.但是内部的解释(概念上很好)将不胜感激!

css css3 media-queries

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

Date.getTime()vs Date.now()

我注意到now()只能由Date对象调用.getTime()只能由日期实例调用.

var dd1 = new Date();

//console.log(dd1.now()); //Throws error -> TypeError: Object Mon Aug 19 2013 16:28:03 GMT-0400 (Eastern Daylight Time) has no method 'now'
console.log(dd1.getTime());

console.log(Date.now());
//console.log(Date.getTime()); //Throws error ->TypeError: Object function Date() { [native code] } has no method 'getTime'
Run Code Online (Sandbox Code Playgroud)

这种差异有正式名称吗?这是"静态"和"非静态"之间的区别吗?当我创建一个新的Date实例时,不应该继承所有方法吗?

javascript

5
推荐指数
3
解决办法
6023
查看次数

将外部JAR导入Websphere Liberty?[NoClassDefFoundError的]

我想在我的运行在Websphere Liberty上的JAX-RS应用程序中使用这个JSON解析器.

我做了以下事情:

1)右键单击Project - > Properties - > Java Build Path - > Add External Jar - > C:\ javalib\quick-json.jar

2)将C:\ javalib添加到环境变量CLASSPATH中

3)将文件集xml添加到serverl.xml

<library id="ExternalLibs">
    <fileset dir="C:\javalib" includes="*.jar"/>
</library>
Run Code Online (Sandbox Code Playgroud)

4)在"Java编译器"中未选中"启用项目特定设置"

5)清理项目

[编辑]

我最初创建了一个新实例,然后将其转换为@ApplicationScoped bean并将其注入.现在我收到这个错误:

The JNDI lookup failed for JNDI name java:module/ConsoleREST with the following Exception CNTR4007E: An error occurred creating the websphere.jaxrs.service.ConsoleREST interface for the ConsoleREST enterprise bean in the WebApiConsole.war module in the WebApiConsole application. The enterprise bean look up failed using the java:module/ConsoleREST JNDI …
Run Code Online (Sandbox Code Playgroud)

eclipse websphere java-ee websphere-liberty

4
推荐指数
1
解决办法
3980
查看次数

如何检索XML中定义的片段实例?

简而言之,问题是我可以通过id找到我的元素,但它一直要求我将它转换为视图,我不能将它转换为我的对象名称类型.我不确定转换为查看是否是假设,但Android示例只是创建片段并添加它因此它没有在xml中定义.但关键是在示例中,对象不是类型视图.

更多信息:这可能是一个快速简便的解决方案.我有一个片段类,它包含我用代码创建的自定义视图(它是一种不断绘制的游戏).我在xml布局的左上角添加了片段.片段下面是按钮(在xml布局中定义).我有一个主要的活动,我想要一个包含我自定义视图的片段实例的句柄,这样当单击按钮时,片段中的一些变量会被更改,并且视图会被重绘.

XML:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >

    <fragment android:name="com.example.dcubebluetooth"
              android:id="@+id/lEDView1"
              android:layout_width="400px"
              android:layout_height="400px" />

<Button
        android:id="@+id/layer1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/lEDView1"
        android:layout_marginTop="50px"
        android:text="Layer1"
        android:textSize="12dp" />

    <Button
        android:id="@+id/layer2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@id/layer1"
        android:layout_toRightOf="@id/layer1"
        android:text="Layer2"
        android:textSize="12dp" />

    <Button
        android:id="@+id/layer3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@id/layer2"
        android:layout_toRightOf="@id/layer2"
        android:text="Layer3"
        android:textSize="12dp" />

    <Button
        android:id="@+id/layer4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@id/layer3"
        android:layout_toRightOf="@id/layer3"
        android:text="Layer4"
        android:textSize="12dp" />

</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

主要活动:

public class MainActivity extends Activity implements LEDGridFragment.TriggerBlueTooth{

    Button l1;
    Button l2;
    Button l3;
    Button l4;
    BluetoothService bt;
    LEDGridFragment gridUI;

    @Override
    protected void …
Run Code Online (Sandbox Code Playgroud)

android android-fragments android-view

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

为什么在Python格式的迷你语言的所有例子中都有':'?

我在看这个具体的例子:

x = 3.45678
print({':.2f'}.format(x))
Run Code Online (Sandbox Code Playgroud)

我不能为我的生活找到任何涉及冒号的文件. http://docs.python.org/2/library/string.html#grammar-token-precision

如果有人能够指出我自己能够学到的东西,我真的更喜欢.

python string-formatting

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

如何将Websphere Application Server Liberty Profile运行时依赖项添加到Maven POM?

我有一个宁静的应用程序,我转换为maven项目.现在,我在使用时遇到编译错误,maven compile因为找不到java-ee/openjpa包.下面是我的POM文件

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>portal</groupId>
  <artifactId>portal</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>developer-portal</name>
  <url>http://maven.apache.org</url>

  <properties>
    <serverName>dropServer</serverName>
    <serverHome>C:\wlp</serverHome>
    <maven.compiler.source>1.7</maven.compiler.source>
    <maven.compiler.target>1.7</maven.compiler.target>
  </properties>

  <pluginRepositories>
    <pluginRepository>
        <id>Liberty</id>
        <name>Liberty Repository</name>
        <url>http://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/maven/repository/</url>
        <layout>default</layout>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
        <releases>
            <enabled>true</enabled>
        </releases>
    </pluginRepository>
  </pluginRepositories>

  <dependencies>
    <dependency>
        <groupId>com.ibm.tools.target</groupId>
        <artifactId>was-liberty</artifactId>
        <version>8.5.5</version>
        <type>pom</type>
        <scope>provided</scope>
    </dependency>
    <!-- Hard-Coded, made-up dependency -->
    <dependency>
        <groupId>com.ibm.nosql</groupId>
        <artifactId>nosqljson</artifactId>
        <version>1.0</version>
        <scope>system</scope>
        <systemPath>C:\javalib\db2_drivers\nosqljson.jar</systemPath>
    </dependency>
    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-server</artifactId>
        <version>1.18</version>
    </dependency>
    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-grizzly2</artifactId>
        <version>1.18</version>
    </dependency>
    <dependency>
        <groupId>org.codehaus.jackson</groupId>
        <artifactId>jackson-jaxrs</artifactId>
        <version>1.9.11</version>
    </dependency>
    <dependency>
        <groupId>com.sun.jersey.jersey-test-framework</groupId>
        <artifactId>jersey-test-framework-core</artifactId>
        <version>1.17.1</version>
    </dependency>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-email</artifactId> …
Run Code Online (Sandbox Code Playgroud)

maven websphere-8 websphere-liberty ibm-was

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

比较Double类型的对象时出错?

这个问题出现在这段代码之后(二进制搜索的实现).如果有人能告诉我为什么没有输出预期答案,我将不胜感激:

public static void main(String[] args){
    Double[] array = {0.0,1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0};
    BinarySearch s = new BinarySearch(array);
    System.out.println(s.searchNextHighest(2.0));
}

public BinarySearch(Double[] array){
    numbers = array;
}

public Integer searchNextHighest(Double y){
    return binarySearchNextHighest(0, numbers.length-1, y, numbers);
}

public Integer binarySearchNextHighest(int min, int max, Double target, Double[] array){
    int mid = (min+max)/2;

    if(target==array[mid]){ //Fails here
        return mid;
    }

    if(max<min){
        if(min>=array.length) return null;
        return mid;
    }

    if(target>array[mid]){
        return binarySearchNextHighest(mid+1, max, target, array);
    }else{
        return binarySearchNextHighest(min, mid-1, target, array);
    }
}
Run Code Online (Sandbox Code Playgroud)

输出:1

我跟着一个调试器并且绝对肯定.在某个时刻,target = 2.0,mid = …

java double

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

g_main_loop_unref(GMainLoop* 循环) 如何工作?

问题

文档摘录:

Decreases the reference count on a GMainLoop object by one. 
If the result is zero, free the loop and free all associated memory.
Run Code Online (Sandbox Code Playgroud)

我找不到有关此参考计数器的信息。它的初始设置是什么以及如何使用?

细节

特别是,我对这段示例代码(在 main 方法中)感到困惑(请注意 set_cancel 是一个静态方法:

void (*old_sigint_handler)(int);

old_sigint_handler = signal (SIGINT, set_cancel);

 /* Create a new glib main loop */
 data.main_loop = g_main_loop_new (NULL, FALSE);

 old_sigint_handler = signal (SIGINT, set_cancel);

 /* Run the main loop */
 g_main_loop_run (data.main_loop);

 signal (SIGINT, old_sigint_handler);

 g_main_loop_unref (data.main_loop);
Run Code Online (Sandbox Code Playgroud)

如果 g_main_loop 阻塞,它如何停止?我也找不到有关此信号方法的信息。但这可能是图书馆本机的(虽然我不知道)。

注意:我将上面的代码简化为我认为最重要的部分。它来自 docs/reference/aravis/html/ArvCamera.html 下名为 aravis 的相机接口库

glib

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

Element.className返回undefined?

[在我指出另一种调试方法之后,问题发生了变化,我找到了问题的真正原因 - 感谢Pointy和user2864740]

我试图模仿(在查看源代码之前)bootstrap的下拉菜单.

我将onclick监听器附加到每个a.dropdown-toggle.侦听器抓取节点的父节点,使用节点的父节点查找实际的下拉菜单,并添加或删除打开的类.

获取下拉菜单节点(ul元素)后,我使用element.className,但它返回undefined.这特别奇怪,因为jquery的.attr('class')返回预期的结果.

我正在使用jquery 1.10.2.

HTML:

<li class="dropdown">
    <a href="#" class="dropdown-toggle" data-toggle="dropdown">Account <b class="caret"></b></a>
    <ul class="dropdown-menu open">
        <li><a href="#">Profile</a></li>
        <li><a href="#">Settings</a></li>
        <li><a href="#">Privacy</a></li>
        <li class="divider"></li>
        <li><a href="#">Logout</a></li>
    </ul>
</li>
Run Code Online (Sandbox Code Playgroud)

CSS:

li.divider {
    border-top: solid 1px grey;
    padding: 0px 0px;
}

.dropdown-menu {
  position: absolute;
  display: none;
  border: 1px solid grey;
  list-style-type: none;
}

.dropdown a:link, .dropdown a:visited {
    text-decoration: none;
    color: black;
}

.dropdown-menu.open{
    display: block;
}
Run Code Online (Sandbox Code Playgroud)

使用Javascript:

$( document ).ready(function(){

    $('a.dropdown-toggle').click(function(e){

        e.preventDefault();

        dropDownMenu = $(this.parentNode).find('.dropdown-menu'); // …
Run Code Online (Sandbox Code Playgroud)

html javascript css jquery

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