我创建了一个扩展AndroidTestCase的示例测试用例.当我运行测试用例时,它会说错误
Running tests
Test running startedTest running failed:
Instrumentation run failed due to 'java.lang.RuntimeException'
Empty test suite.
Run Code Online (Sandbox Code Playgroud)
测试用例
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.SmallTest;
import static org.junit.Assert.assertEquals;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import java.lang.Exception;
import java.lang.Override;
public class DateFormatTest extends AndroidTestCase{
@Override
protected void setUp() throws Exception {
super.setUp();
}
@Override
protected void tearDown() throws Exception {
super.tearDown();
}
public DateFormatTest(){
super(DateFormatTest.class);
}
@SmallTest
public void testMultiply() {
assertEquals("10 x 5 must be 50", 50, 10*5);
}
}
Run Code Online (Sandbox Code Playgroud) npm http 200 https://registry.npmjs.org/weak/-/weak-0.2.2.tgz
npm http GET https://registry.npmjs.org/bindings
npm http 304 https://registry.npmjs.org/bindings
> weak@0.2.2 install node_modules/weak
> node-gyp rebuild
Traceback (most recent call last):
File "/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 18, in <module>
sys.exit(gyp.script_main())
AttributeError: 'module' object has no attribute 'script_main'
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:337:16)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Linux 3.11.0-15-generic
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" …Run Code Online (Sandbox Code Playgroud) 我在运行PAIR与ZMQ 的模式(非阻塞客户端服务器)连接时按Ctrl-C .后来当我尝试运行REQ-REP(阻塞客户端单服务器连接)模式时,我不断收到Address already in use错误.我试过运行netstat netstat -ltnp | grep :<my port>但没有列出任何进程.
那么究竟是谁正在使用这个地址?
另外,如何优雅地关闭这些套接字连接?
假设我在Procfile中声明了以下进程
web: newrelic-admin run-program python manage.py run_gunicorn -b 0.0.0.0:$PORT -w 9 -k gevent --max-requests 250 --preload --timeout 240
scheduler: python manage.py celery worker -B -E --maxtasksperchild=1000
worker: python manage.py celery worker -E --maxtasksperchild=1000
celerymon: python manage.py celerymon -B 0.0.0.0 -P $PORT
Run Code Online (Sandbox Code Playgroud)
我基本上必须运行一些主要网络流程的dynos.运行调度程序.跑几个工人.监控芹菜.单独使用托管的AMQP代理.
我尝试过在一个dyno上运行多个进程的替代方案,但它似乎不能可靠地工作,反正不是我想在生产中使用的东西.
我发现运行所有这些的成本有点过高,特别是当我认为我可以在一个dyno上将一些进程联合起来时.也许将调度程序与监视相结合,或者将调度程序和worker一起运行.
除此之外,Heroku只暴露了80和443个端口,并且无法在同一个dyno上的多个端口上运行服务.
优化流程和动态使用的优秀策略是什么?
另外,如果运行celerycam为你的成本增加另一个dyno,那么如何监控heroku上的芹菜任务呢?
我一直在我的哨兵例外中得到以下错误
AttributeError: 'RegexURLResolver' object has no attribute '_urlconf_module'
跟踪只指向带有django代码库的代码,而不指向我的应用程序中的任何位置.我的日志也很干净.这可能是什么原因?
raise Resolver404({'path' : path})
@property
def urlconf_module(self):
try:
return self._urlconf_module
except AttributeError:
self._urlconf_module = import_module(self.urlconf_name)
return self._urlconf_module
@property
'self'
<RegexURLResolver urls (None:None) ^/>
Run Code Online (Sandbox Code Playgroud) 我使用@receiver装饰器使用回调注册了我的信号
@receiver(post_save, sender=User, dispatch_uid='ARandomUniqueString')
def do_callback(sender, **kwargs):
Run Code Online (Sandbox Code Playgroud)
我已经把from app.signals import *代码放进去__init__.py,我可以看到它被导入了两次,我认为没有一种好方法可以解决它,可能是由于installed appsin 而发生的settings.py.我无法理解为什么尽管使用dispatch_uid和modelInstance.save仅被调用一次,它仍然运行do_callback两次.有什么建议?
如果我安装Anaconda Python Distribution并尝试ipython manage.py shell在我的django应用程序中运行,则会抛出以下错误.我知道当我安装anaconda时,它包含了python和ipython,其版本与我拥有的其他python/ipython版本不同.但无论ipython版本如何,为什么django shell会抛出错误?我尝试卸载系统ipython并抛出同样的错误,这意味着anaconda ipython发行版和django存在一些问题.卸载anaconda解决了这个问题.
堆栈跟踪
manage.py in <module>()
9
10 if __name__ == "__main__":
---> 11 execute_manager(settings)
lib/python2.7/site-packages/django/core/management/__init__.pyc in execute_manager(settings_mod, argv)
457 setup_environ(settings_mod)
458 utility = ManagementUtility(argv)
--> 459 utility.execute()
lib/python2.7/site-packages/django/core/management/__init__.pyc in execute(self)
380 sys.stdout.write(self.main_help_text() + '\n')
381 else:
--> 382 self.fetch_command(subcommand).run_from_argv(self.argv)
383
384 def setup_environ(settings_mod, original_settings_path=None):
lib/python2.7/site-packages/django/core/management/base.pyc in run_from_argv(self, argv)
194 options, args = parser.parse_args(argv[2:])
195 handle_default_options(options)
--> 196 self.execute(*args, **options.__dict__)
197
198 def execute(self, *args, **options):
lib/python2.7/site-packages/django/core/management/base.pyc in execute(self, *args, **options) …Run Code Online (Sandbox Code Playgroud) 我能够使用GET与SessionAuthentication和Tastypie一起工作而不设置任何标题,除了content-typeto application/json.然而,即使标头中的Cookie具有会话ID,HTTP POST也会失败.它失败了401 AuthorizationHeader,但它与授权无关.将SessionAuthentication更改为BasicAuthentication并传递用户名/密码也可以.
有没有人用SessionAuthentication与Tastypie一起使用POST?
由于 Celery 文档建议使用 Flower 进行监控,我试图让它与托管的 RabbitMQ 提供程序 (CloudAMQP) 一起使用
celery flower --broker=amqp://username:password@lemur.cloudamqp.com/vhost --broker_api=https://lemur.cloudamqp.com/api/ --basic_auth=username:password
Run Code Online (Sandbox Code Playgroud)
我可以在 CloudAMQP 管理控制台中看到如下所示的 500 内部服务器错误,这似乎表明密码错误,而我却没有。
The server encountered an error while processing this request:
{error,function_clause,
[{rabbit_auth_backend_internal,check_password,
[<<"password">>,
<<>>]},
{rabbit_auth_backend_internal,internal_check_user_login,2},
{rabbit_access_control,'-check_user_login/2-fun-0-',4},
{lists,foldl,3},
{rabbit_mgmt_util,is_authorized,4},
{webmachine_resource,resource_call,3},
{webmachine_resource,do,3},
{webmachine_decision_core,resource_call,1}]}
Run Code Online (Sandbox Code Playgroud)
那么如何使用 cloudamqp 监控 celery 呢?
有没有更好的解决方案(监控/任务队列)?
我正在尝试将UTC格式的字符串格式转换为日期对象,这会导致转换关闭几分钟.
SimpleDateFormat fullDateFormater = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSSSS", Locale.US);
fullDateFormater.setTimeZone(TimeZone.getTimeZone("UTC"));
Run Code Online (Sandbox Code Playgroud)
在解析日期字符串之前 - 2014-07-07T18:24:23.788810
解析日期之后是 Tue Jul 08 00:07:31 GMT+05:30 2014
正确的日期转换是 Tue Jul 07 23:54:23 GMT+05:30 2014
转换时间差异大约为12-13分钟.我观察到转换中10分钟的范围存在差异.
什么出了什么问题?
我为我的Android应用程序定义了一些flavor和buildTypes
productFlavors {
X {
applicationId = "com.x.xxxx"
}
Y {
applicationId = "com.y.yyyy"
}
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard_rules.txt'
}
debug {
applicationIdSuffix ".debug"
}
}
Run Code Online (Sandbox Code Playgroud)
这样做可以创建不同的flavor/buildType组合.
现在为了确保ContentProviders工作而我没有收到Failure [INSTALL_FAILED_CONFLICTING_PROVIDER]错误,我已将代码中的android:authorities="${applicationId}"和AUTHORITY引用更改为BuildConfig.APPLICATION_ID.
这使得ContentProvider工作正常,即当我在同一部手机上安装两种不同类型时,它不会引发错误.它让我安装它们.
下一步是错误发生的地方.我使用SyncAdapter并AccountManager控制一些事情.我已修改ACCOUNT_TYPE使用了APPLICATION_ID.因为不能够使用gradle这个问题的${applicationId}非清单XML资源文件,我已经创造了每味不同的目录结构和复制syncadapter.xml,并authenticator.xml有相应的authority和account type字符串.
我也尝试过这个博客中描述的技术 - http://blog.jensdriller.com/android-gradle-workaround-for-missing-placeholder-support-in-resource-files/
最受欢迎的答案是在Gradle中使用构建类型来运行在一台设备上使用ContentProvider的相同应用程序但事情似乎不起作用.
有人能够最近上班吗?
xml android gradle android-syncadapter android-productflavors
我的 AWS Elasticsearch 集群的 JVM 内存压力一直在增加。我在过去 3 天看到的模式是每 1 小时增加 1.1%。这是我提供的 3 个主节点之一。
所有其他指标似乎都在正常范围内。CPU 低于 10%,几乎没有任何索引或搜索操作正在执行。
我已经尝试清除本文档中fielddata提到的所有索引的缓存,但这没有帮助。
谁能帮我理解这可能是什么原因?
我想在我的应用程序中使用一些PLV8可用的功能9.3.生产数据库目前正在开启9.2.5.有没有好办法搬家9.3?
django ×6
python ×5
amqp ×3
android ×3
heroku ×3
celery ×2
gradle ×2
tastypie ×2
anaconda ×1
cloudamqp ×1
database ×1
date ×1
flower ×1
ipython ×1
java ×1
javascript ×1
junit ×1
jvm ×1
mysql ×1
node.js ×1
npm ×1
postgresql ×1
rest ×1
sentry ×1
signals ×1
sockets ×1
sql ×1
ubuntu ×1
unix ×1
xml ×1
zeromq ×1