今天我想将我的node.js应用程序部署到heroku.本地我也在使用bower和grunt开发,我还想继续使用它们.
现在,按照我在网上找到的一些建议,我加入bower了我的dependencies并添加"postinstall": "node_modules/.bin/bower install到我的网站package.json postinstall.
现在我遇到了一些问题grunt.当我将我的呼噜声依赖于dependencies从devDependencies grunt不认我的tasks,例如,当我有
{
"name": "js-linkedin-connector",
"version": "0.1.0",
"dependencies": {
"passport": "~0.1.17",
"passport-local": "~0.1.6",
"passport-linkedin-oauth2": "~1.0.1",
"connect": "~2.11.0",
"underscore": "~1.5.2",
"bower": "1.2.x",
"grunt": "~0.4.1",
"grunt-cli": "0.1.11",
"load-grunt-tasks": "~0.1.0",
"grunt-contrib-copy": "~0.4.1",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-coffee": "~0.7.0",
"grunt-contrib-uglify": "~0.2.0",
"grunt-contrib-compass": "~0.5.0",
"grunt-contrib-jshint": "~0.6.0",
"grunt-contrib-cssmin": "~0.6.0",
"grunt-contrib-connect": "~0.5.0",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-htmlmin": "~0.1.3",
"grunt-contrib-watch": "~0.5.2",
"grunt-autoprefixer": "~0.2.0",
"grunt-usemin": "~2.0.0", …Run Code Online (Sandbox Code Playgroud) 最后一天,我是在更新的过程中Angular,从我的项目库1.0.7到1.2.6,要做到这一点,我更新了我的yeoman发电机,并再次生成的应用程序.
在此之后,我开始浏览生成的文件以获取更改,我注意到index.html文件中有新内容.
<!-- build:js scripts/vendor.js -->
<!-- bower:js -->
<script src="bower_components/jquery/jquery.js"></script>
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/bootstrap/dist/js/bootstrap.js"></script>
<script src="bower_components/angular-resource/angular-resource.js"></script>
<script src="bower_components/angular-cookies/angular-cookies.js"></script>
<script src="bower_components/angular-sanitize/angular-sanitize.js"></script>
<script src="bower_components/angular-route/angular-route.js"></script>
<!-- endbower -->
<!-- endbuild -->
Run Code Online (Sandbox Code Playgroud)
我知道任务使用<!-- build:js scripts/vendor.js -->和<!-- endbuild -->评论grunt-usemin,但是<!-- bower:js -->和的目的是<!-- endbower -->什么?我bower在主页上发布的文档中找不到任何提及.
今天我整合sbt-native-packager到我的scala项目中,主要是为了生成方便的执行脚本和/或包.
现在,我添加到我的build.sbt行:
packageArchetype.java_application
Run Code Online (Sandbox Code Playgroud)
和我的 plugins.sbt
resolvers += "sbt-plugins" at "http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases"
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "0.7.0-RC2")
Run Code Online (Sandbox Code Playgroud)
当我调用时,sbt stage我得到了target/universal/stage目录,但只有lib那里,没有bin脚本(根据http://www.scala-sbt.org/sbt-native-packager/GettingStartedApplications/MyFirstProject.html应该创建).
我是否需要添加其他内容以获取bin脚本目录?
我遇到了JSTL和空操作符的问题.我已经做了一些简单的页面,一切正常,但现在我有:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<body>
<form action="/Projekt/myaccount" method="post">
<table border="1">
<tr>
<td>Artist</td>
<td>Record Name</td>
<td>Delete</td>
</tr>
<c:forEach var="item" items="${records}">
<tr>
<td>${item.artist}</td>
<td>${item.recordName}</td>
<td>
<input type="checkbox" name='${item.recordName}|${item.recordName}'/>
</td>
</tr>
</c:forEach>
</table>
<hr/>
<input type="submit" name="back" value="back"/>
<c:if test='${not empty "${records}"}'>
<input type="submit" name="delete" value="delete selected"/>
</c:if>
</form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
现在无论我是否设置了记录属性,都会显示删除按钮:
<c:if test='${not empty "${records}"}'>
<input type="submit" name="delete" value="delete selected"/>
</c:if>
Run Code Online (Sandbox Code Playgroud)
在正常情况下记录属性我传递ArrayList然后使用foreach,但有时ArrayList是空的,所以在那些情况下我不希望删除按钮显示,我打了最简单的方法来实现这个就是使用这个空操作符.我哪里弄错了?
我甚至尝试手动将此属性设置为null:
if (ar.size() != 0)
request.setAttribute("records", ar);
else
request.setAttribute("records",null);
Run Code Online (Sandbox Code Playgroud)
编辑:@Qwe:是的你是对的,它之前对我有用,因为我测试了属性是否为空,它总是如此,因为我使用了错误的构造,但它起作用,因为我只是想显示一个字符串,如果没有任何字符串没有出现所以我认为一切正常.
如果我愿意写:
char *a=malloc(sizeof(char)*4);
a="abc";
char *b="abc";
Run Code Online (Sandbox Code Playgroud)
我是否需要释放此内存,还是由我的系统完成?
我正在玩Spring测试框架,但我有一个问题.通常,当我们在Tomcat上部署应用程序时
<Resource
name="jdbc/sqliteDS"
auth="Container"
type="javax.sql.DataSource"
maxActive="4"
maxIdle="2"
username="x"
maxWait="5000"
driverClassName="org.sqlite.JDBC"
password="x"
url="jdbc:sqlite:/home/xxx/db.sqlite"/>
</Context>
Run Code Online (Sandbox Code Playgroud)
在Tomcat context.xml中,
<resource-ref>
<description>sqlite DataSource</description>
<res-ref-name>jdbc/sqliteDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
Run Code Online (Sandbox Code Playgroud)
在web.xml和
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:/comp/env/jdbc/sqliteDS" />
</bean>
Run Code Online (Sandbox Code Playgroud)
在data-context.xml中获取数据源,但我怎样才能为Spring测试框架模拟JNDI资源,因为现在在初始化过程中我遇到的错误是找不到数据源,而且他是对的.
此外,如果可以在不编写另一个.xml文件的情况下执行此操作,那将会很棒.
我开始MongoDB在我的应用程序中使用数据库,为了数据访问,我选择了Spring Data for MongoDB.
我浏览了API参考和文档,我可以看到有map-reduce集成但是聚合框架呢?我可以看到它支持group by操作,这表明它支持$group运营商判断:http://docs.mongodb.org/manual/reference/sql-aggregation-comparison/,但是其他运营商呢,那是现在不支持?
我问的是这个问题,因为我想知道与MongoDBSping Data 有什么样的集成,所以我知道会发生什么,可以这么说.
我在我的一个大学项目中使用pycharm,我想将它与unittest模块集成,但我在构建项目时遇到问题
这个项目的一部分涉及生成抽象语法树,所以我创建了AST目录并放在__init__.py那里,然后我创建了expression模块.我想把我的测试放在test/子目录中,所以它看起来像这样:
AST/
__init__.py
expression.py
test/
some_test.py
utils.py
Run Code Online (Sandbox Code Playgroud)
现在我也在我的AST被调用symbol_table和模块中调用了模块utils,示例测试类看起来像
import unittest
from ...AST import expression
from ...AST import utils
class ConstantExpressionTest(unittest.TestCase):
def testConstantExpressionCheck(self):
constantExpression = expression.ConstantExpression(17, 5, utils.TYPES.INT)
self.assertTrue(constantExpression.check())
Run Code Online (Sandbox Code Playgroud)
当我右键单击此文件并选择Run Unittest in ...我收到错误时:
/usr/bin/python2.7 /home/xubuntu/Downloads/pycharm-2.7.2/helpers/pycharm/utrunner.py /home/xubuntu/Przedmioty/VI/kompilatory/tk-projekt/src/AST/test/test_constant_expression.py true
Testing started at 12:06 PM ...
Traceback (most recent call last):
File "/home/xubuntu/Downloads/pycharm-2.7.2/helpers/pycharm/utrunner.py", line 110, in <module>
modules = [loadSource(a[0])]
File "/home/xubuntu/Downloads/pycharm-2.7.2/helpers/pycharm/utrunner.py", line 34, in …Run Code Online (Sandbox Code Playgroud) 我在玩 POSIX 队列,但遇到了一个问题。创建新队列时,我可以指定例如消息的大小以及队列中可以有多少消息。我的正常限制是 10,见
/proc/sys/fs/mqueue/msg_max
Run Code Online (Sandbox Code Playgroud)
有没有一种简单的方法可以在程序执行期间更改它,除了
echo number > /proc/sys/fs/mqueue/msg_max
Run Code Online (Sandbox Code Playgroud)
也许存在一些设置这些东西的系统调用。