小编Eug*_*gen的帖子

清除终端屏幕?

我正在为我的机器人从9个不同的传感器读取数据,我需要在同一个窗口中稳定地显示它们,这样我就可以比较这些值,看看是否有任何读数都关闭了.

我在Serial.print和lcd.print上遇到的问题是值不断移动,在移动机器人时我无法真正看到它们.

我想在显示任何其他东西之前调用类似Serial.clear()的东西,这样可以保持稳定并在一个地方,只改变值.

从我到目前为止发现的,不再支持Serial.print(17,BYTE)(调用ESC键).

那么......对于那些有更多Arduino经验的人来说......这样做的正确方法是什么?

terminal refresh arduino erase clear

16
推荐指数
3
解决办法
12万
查看次数

如何衡量Arduino函数的执行速度?

我需要确定Arduino执行某个功能的速度.

什么是最好的时间呢?到目前为止,我发现了一个带有秒表类的东西,但我想知道是否有任何本地方法来做到这一点.

c++ time measurement arduino stopwatch

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

我可以在Android开发中使用javax.script,如果是的话怎么样?

我在包含javax.script.*时遇到了一些麻烦.在Android项目中.我需要它,所以我可以在JavaScript中使用"eval"函数,以便有效地解析算术函数,而无需自己构建解析器(我完全没有经验,而且没有很多时间在我手上).

有没有机会在我的Android应用程序中使用JavaScript或"eval"功能或类似功能?

感谢您提供给我的任何信息

javascript android eval function

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

通过PHP连接到SQL Server 2008

我需要通过PHP(WAMP,最新版本)连接到SQL Server 2008.我安装并设置了sqlsrv驱动程序,它们确实显示在phpinfo().

我使用以下行使用Windows身份验证连接到我的数据库:

$serverName = "(local)";
$connectionOptions = array("Database"=>"MyTestDatabase");
$conn = sqlsrv_connect( $serverName, $connectionOptions) or die("Error!");
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

Array 
( 
    [0] => Array 
    ( 
        [0] => IMSSP 
        [SQLSTATE] => IMSSP 
        [1] => -49
        [code] => -49 
        [2] => This extension requires the Microsoft SQL Server 2011 Native Client. Access the following URL to download the Microsoft SQL Server 2011 Native Client ODBC driver for x86: http://go.microsoft.com/fwlink/?LinkId=163712 
        [message] => This extension requires the Microsoft SQL Server 2011 Native Client. …
Run Code Online (Sandbox Code Playgroud)

php wamp sql-server-2008

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

无法连接到postgres SQL

我正在使用Spring + Maven + Hibernate并希望在PostgreSQL环境中运行测试.

添加适当的依赖项并更改我的xml文件后,我mvn clean install在cmd中运行时遇到以下错误:

Coult not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Cannot open connection
Run Code Online (Sandbox Code Playgroud)

测试的输出日志类似于:

 Tests run: 9, Failures: 0, Errors: 9, Skipped: 0, Time elapsed: 23.695 sec <<< FAILURE!
testFlush(com.mms.pone.portal.domain.AccountAllocationIntegrationTest)  Time elapsed: 15.432 sec  <<< ERROR!
org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Cannot open connection
    at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:427)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:371)
    at org.springframework.test.context.transaction.TransactionalTestExecutionListener$TransactionContext.startTransaction(TransactionalTestExecutionListener.java:513)
    at org.springframework.test.context.transaction.TransactionalTestExecutionListener.startNewTransaction(TransactionalTestExecutionListener.java:271)
    at org.springframework.test.context.transaction.TransactionalTestExecutionListener.beforeTestMethod(TransactionalTestExecutionListener.java:164)
    at org.springframework.test.context.TestContextManager.beforeTestMethod(TestContextManager.java:358) …
Run Code Online (Sandbox Code Playgroud)

java postgresql spring hibernate maven

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

如何正确关闭Android中的警报对话框?

我正在使用以下代码向用户显示基本的文本框输入.

一切都很好.但是,第二次调用对话框时,应用程序崩溃了.

我怀疑这是因为我没有破坏我添加到View中的EditText.那么......对于那些比我更有经验的人来说......处理这个问题的正确方法是什么?

下面是我的代码和LogCat

final EditText ipInput = new EditText(this);
    final AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setView(ipInput);
    builder.setTitle("Enter Server IP Address: ");
    builder.setPositiveButton("Save", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            //STORE IP ADDRESS
        }
    });

    builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            //CANCELLED
        }
    });
    builder.create();
Run Code Online (Sandbox Code Playgroud)

而"展示":

settings.setOnClickListener(new OnClickListener(){
        public void onClick(View view){
            builder.show();
        }
    });
Run Code Online (Sandbox Code Playgroud)

堆栈跟踪:

02-24 02:08:55.759: E/AndroidRuntime(582): java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on …
Run Code Online (Sandbox Code Playgroud)

android dialog view destroy android-alertdialog

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

创建新的Maven项目时出现奇怪的故障

我正在使用Spring Tool Suite(最新版本),每当我做New project - > Maven Project并选择maven-archetype-webapp作为我的原型时,我的pom文件中出现以下奇怪的错误.

Failure to transfer org.codehaus.plexus:plexus-components:pom:1.1.18 from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.codehaus.plexus:plexus-components:pom:1.1.18 from/to central (http://repo.maven.apache.org/maven2): No response received after 60000
Run Code Online (Sandbox Code Playgroud)

此外,这是非常简短的生成的pom.xml文件

<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>Tset</groupId>
    <artifactId>Tset</artifactId>
    <packaging>war</packaging>
    <version>0.0.1-SNAPSHOT</version>
    <name>Tset Maven Webapp</name>
    <url>http://maven.apache.org</url>
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build> …
Run Code Online (Sandbox Code Playgroud)

model-view-controller spring spring-roo pom.xml maven

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

如何在Spring MVC表单中有多个按钮并相应地处理它们?

通过使用Spring MVC + Maven + Hibernate,我正在尝试构建一个Spring MVC表单,其中包含"添加到购物车"按钮,以及"添加到收藏夹"按钮.只要按下一个按钮,另一个按钮就会返回null,如下面的代码所示.

两个按钮都是type = submit,我在下面的代码中处理它们.我遇到的问题是"添加到收藏夹"的情况总是导致未捕获的异常(将我重定向到"内部错误"页面).

我想知道是否有一种优雅的方式来单独处理表单中的每个按钮按下,而不是每个按钮都有很多if语句.

HTML文件在表单结构中声明了以下项:

<c:if test="${empty readOnly}">
                        <input type="number" value="1" name="quantity" class="input-mini"/>
                        <button class="btn btn-primary" type="submit" name="addToCart"><i class="icon-shopping-cart icon-white"><jsp:text /></i> Add</button>
                        <button class="btn btn-secondary" type="submit" name="favourite"><jsp:text /> Favourite This!</button>
</c:if>
Run Code Online (Sandbox Code Playgroud)

我正在使用以下Controller方法:

   @RequestMapping(value = "/submit", method = RequestMethod.POST, produces = "text/html")
      public String submit(HttpServletRequest request, Model uiModel) {

        init(uiModel);
        String id = request.getParameter("product-id");
        String quantity = request.getParameter("quantity");

        if(!request.getParameter("addToCart").toString().equals(null))
        {
            if (StringUtils.isNotBlank(id) && StringUtils.isNotBlank(quantity)) {
              shoppingCartServiceLocal.addToShoppingCart(shoppingCart, id, quantity);         
            }
        }

    if(!request.getParameter("favourite").equals(null))
    { …
Run Code Online (Sandbox Code Playgroud)

java spring hibernate spring-mvc maven

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

如何正确地将 DCL 链接到 AutoLisp?

我正在尝试构建一个非常基本的 AutoLisp 界面。我在这方面完全是个初学者,所以在从头开始编码失败后,我开始正确地学习 DCL。我按照这个教程进行操作:

http://www.afralisp.net/dialog-control-language/tutorials/dialog-boxes-and-autolisp-part-1.php

我也遇到了同样的错误。AutoCAD 基本上退出执行该函数,就好像 dcl 文件根本不存在一样。

我尝试将地址完全输入其中,但我认为它应该能够像将 HTML 链接到同一文件夹中的图像一样工作。

下面是我的代码:

数据保护层:

samp1 : dialog {
    label = "Structural Holes";

    ok_cancel;
}
Run Code Online (Sandbox Code Playgroud)

口齿不清:

(defun C:samp1()
  (setq dcl_id (load_dialog "samp1.dcl"))
  (if (not (new_dialog "samp1" dcl_id))
    (exit)
    )

  (action_tile
       "cancel"
       "(done_dialog)(setq userclick nil)"
       )
  (action_tile
    "accept"
    "(done_dialog)(setq userclick T))"
    )

  (start_dialog)

  (unload_dialog dcl_id)

  (princ)

 )

(princ)
Run Code Online (Sandbox Code Playgroud)

感谢任何愿意花时间帮助我解决这个问题的人。我开始非常绝望,这是我的第一个也是唯一一个 autolisp 项目,所以我没有任何经验......

LE:请注意,dcl 文件和 lisp 文件都位于同一文件夹中,没有其他子文件夹或其他任何内容。

lisp dialog autocad autolisp

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