我刚开始学习python和django,我有一个问题.我得到了将函数视图转换为基于类的视图的赋值.但我的链接现在不起作用.
这些来自urls.py:
url(r'^$', ContactIndex.as_view()),
url(r'^add$', ContactAdd.as_view()),
url(r'^([0-9]+)/update$', ContactUpdate.as_view()),
url(r'^([0-9]+)/view$', ContactView.as_view()),
Run Code Online (Sandbox Code Playgroud)
这是我的链接:
{% url rtr_contact.views.ContactView contact.id %}
Run Code Online (Sandbox Code Playgroud)
但这不起作用它说:
Caught NoReverseMatch while rendering: Reverse for 'rtr_contact.views.ContactView' with arguments '(20L,)' and keyword arguments '{}' not found.
Run Code Online (Sandbox Code Playgroud) 我写了一个自定义分区器.当我有大于1的reduce任务数时,作业失败.这是我得到的例外情况:
java.io.IOException: Illegal partition for weburl_compositeKey@804746b1 (-1)
at org.apache.hadoop.mapred.MapTask$MapOutputBuffer.collect(MapTask.java:930)
at org.apache.hadoop.mapred.MapTask$OldOutputCollector.collect(MapTask.java:499)
Run Code Online (Sandbox Code Playgroud)
我写的代码是
public int getPartition(weburl_compositeKey key, Text value, int numPartitions)
{
return (key.hashCode()) % numPartitions;
}
Run Code Online (Sandbox Code Playgroud)
这个值的key.hashCode()equals -719988079和mod正在返回-1.
感谢您对此的帮助.谢谢.
在大文件中,我需要编辑文本并删除特定范围内的注释.对于这个简化的例子,让我们假设范围从开始_start_并结束_end_.
我可以使用如下命令编辑文本没有问题:
sed -i -r "/_start_/,/_end_/ s/SearchText/ReplaceText/" FileName
Run Code Online (Sandbox Code Playgroud)
请注意以下事项(当然,如果我的任何陈述不准确或误导,请告诉我):
-i它,它将编辑"FileName",而不是写入不同的文件.-r这样使用它会识别扩展的正则表达式(在上面的简化示例中没有显示,但它似乎正常工作).上面的命令完全符合我的预期.所以我转到了我的过程的第二步:一个非常类似的命令来删除此范围内的注释行:
sed -i -r "/_start_/,/_end_/ /^#/ d" FileName
Run Code Online (Sandbox Code Playgroud)
但是,这没有任何效果:#不删除以开头的行.实际上,当我单独执行此命令时,我的文件中的任何内容都不会被更改或删除 - 既不在范围内也不在其他地方.
在我在这个网站和其他地方的搜索中,我发现了许多关于使用sed删除行的说明(我认为我正确遵循的说明) - 但没有关于我遇到的故障.
任何人都可以告诉我这里我做错了什么?
我是UNIX/Linux环境的新手,所以我绝对愿意接受有关如何处理这个问题的替代建议.但为了满足我的挫败感,我很想知道上面我的sed命令有什么问题.
真的很难解决这个问题,任何人都可以帮助我吗?
我显然做了一些根本错误的事情,我试图验证每个Mock对象,但它似乎不起作用.
org.mockito.exceptions.misusing.UnfinishedVerificationException:
Missing method call for verify(mock) here:
-> at com.muuves.reservosity.service.TestProductServiceImpl.search_OneHourSlot_TwoBookingAvailable(TestProductServiceImpl.java:86)
Example of correct verification:
verify(mock).doSomething()
Also, this error might show up because you verify either of: final/private/equals() /hashCode() methods.
Those methods *cannot* be stubbed/verified.
at com.muuves.reservosity.service.TestProductServiceImpl.setUp(TestProductServiceImpl.java:41)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) …Run Code Online (Sandbox Code Playgroud) 作业的减少阶段失败了:
每个任务失败的原因是:
任务尝试_201301251556_1637_r_000005_0无法报告状态600秒.杀!
问题详情:
Map阶段接收每个记录的格式:time,rid,data.
数据格式为:data元素及其计数.
例如:a,1b,4c,7对应于记录的数据.
映射器为每个数据元素输出每个记录的数据.例如:
key:(time,a,),val:(rid,data)key:(time,b,),val:(rid,data)key:(time,c,),val:(rid,data)
每个reduce从所有记录中接收与相同密钥对应的所有数据.例如:key:(time,a),val:(rid1,data)和key:(time,a),val:(rid2,data)到达同一个reduce实例.
它在这里进行一些处理并输出类似的rids.
对于小型数据集(如10MB),我的程序运行没有问题.但是,由于上述原因,当数据增加到1G时失败.我不知道为什么会这样.请帮忙!
减少代码:
下面有两个类:
VCLReduce0SplitCoreSplit一个. VCLReduce0SPlit
public class VCLReduce0Split extends MapReduceBase implements Reducer<Text, Text, Text, Text>{
// @SuppressWarnings("unchecked")
public void reduce (Text key, Iterator<Text> values, OutputCollector<Text, Text> output, Reporter reporter) throws IOException {
String key_str = key.toString();
StringTokenizer stk = new StringTokenizer(key_str);
String t = stk.nextToken();
HashMap<String, String> hmap = new HashMap<String, String>();
while(values.hasNext())
{
StringBuffer sbuf1 = new StringBuffer();
String val = values.next().toString();
StringTokenizer st = …Run Code Online (Sandbox Code Playgroud) My Dev OPs team would like to make use of an Intermediate CA certificate in our Java keystore. I believe adding an intermediate certificate into the keystore is the same process as as adding a "regular cert", correct? Are there any "gotchas" I need to be aware of? Also, how do I verify in testing that Java is using the intermediate cert as opposed to checking back with the CA?
我正在AVCaptureSession和我一起工作AVCaptureMetadataOutput.
它工作得很好,但我只是想知道如何指示只扫描和分析元数据对象的特定区域AVCaptureVideoPreviewLayer?
我正在从"hello to android"一书中练习"数独".我看到有些人和我有同样的问题,但我无法解决.我已经删除了三次这个项目,并从头开始重新创建,但我在下面仍然收到相同的错误消息,即使我正在从书中复制/粘贴.
W/ResourceType( 8592): Bad XML block: header size 29806 or total size 538970658 is larger than data size 0
C:\java\Sudoku\res\layout\activity_main.xml:6: error: Error: No resource found that matches the given name (at 'text' with value '@string/hello_world').
C:\java\Sudoku\res\menu\activity_main.xml:2: error: Error: No resource found that matches the given name (at 'title' with value '@string/menu_settings').
Run Code Online (Sandbox Code Playgroud)
书中有代码Sudokuv1/res/layout/main1.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/main_title" />
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/continue_label" />
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/new_game_label" /> …Run Code Online (Sandbox Code Playgroud) 如何run()通过Hadoop框架调用mapper或reducer类的方法?框架正在调用run()方法,但它需要一个上下文对象,那么Hadoop如何传递该对象?该对象中包含哪些信息?
您好,我需要使用 MapReduce 对大型密集方阵执行奇异值分解。
我已经检查过 Mahout 项目,但他们提供的是 TSQR 算法 http://arbenson.github.io/portfolio/Math221/AustinBenson-math221-report.pdf。
问题是我想要满级,而这种方法在这种情况下不起作用。他们之前使用的分布式 Lanczos SVD 实现也不适合我的情况。
我发现双面雅可比方案可以用于此目的,但我没有找到任何可用的实现。
有谁知道我是否可以以及在哪里可以找到参考代码?