从本指南中,我已经成功运行了样本练习.但是在运行我的mapreduce作业时,我
从日志文件中收到以下错误错误
ERROR streaming.StreamJob: Job not Successful!
10/12/16 17:13:38 INFO streaming.StreamJob: killJob...
Streaming Job Failed!
java.lang.RuntimeException: PipeMapRed.waitOutputThreads(): subprocess failed with code 2
at org.apache.hadoop.streaming.PipeMapRed.waitOutputThreads(PipeMapRed.java:311)
at org.apache.hadoop.streaming.PipeMapRed.mapRedFinished(PipeMapRed.java:545)
at org.apache.hadoop.streaming.PipeMapper.close(PipeMapper.java:132)
at org.apache.hadoop.mapred.MapRunner.run(MapRunner.java:57)
at org.apache.hadoop.streaming.PipeMapRunner.run(PipeMapRunner.java:36)
at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:358)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:307)
at org.apache.hadoop.mapred.Child.main(Child.java:170)
Run Code Online (Sandbox Code Playgroud)
Mapper.py
import sys
i=0
for line in sys.stdin:
i+=1
count={}
for word in line.strip().split():
count[word]=count.get(word,0)+1
for word,weight in count.items():
print '%s\t%s:%s' % (word,str(i),str(weight))
Run Code Online (Sandbox Code Playgroud)
Reducer.py
import sys
keymap={}
o_tweet="2323"
id_list=[]
for line in sys.stdin:
tweet,tw=line.strip().split()
#print tweet,o_tweet,tweet_id,id_list
tweet_id,w=tw.split(':')
w=int(w)
if tweet.__eq__(o_tweet): …Run Code Online (Sandbox Code Playgroud) 我有以下代码登录到POST http://www.160by2.com/logincheck.aspx?iamindian=这个网址,我的问题是我无法登录,当我使用Fiddler调试它时,我看不到ne cookie认为我正在使用CookieContainer类,这里我在c#中使用Windows应用程序
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://www.160by2.com/logincheck.aspx?iamindian=");
string PostData = string.Format("htxt_UserName={0}&txt_Passwd={1}&txt_pop=&s=&d=&cmdSubmit=&namenumber={2}&strclf=&strshareuser=&ucountry=&ucode=&ucity=&uregion=", txtMobile.Text, txtPassword.Text, "1");
CookieContainer cookie = new CookieContainer();
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.Referer = "http://www.160by2.com";
request.CookieContainer = cookie;
StreamWriter sWriter = new StreamWriter(request.GetRequestStream());
sWriter.Write(PostData);
sWriter.Close();
request.GetResponse().Close();
//some more code is here for further posting but above code can't login so below code is also not working
Run Code Online (Sandbox Code Playgroud)
我跟着这个,发帖但是它对我没有帮助..请帮帮我,这里我的错误..
我在.net 4中尝试使用winforms应用程序(基本上是草图,我使用它有点像kata,但没有那么严格或具体)的Ninject.
要创建主窗体,我正在执行以下操作:
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
[...]
IKernel kernel = BuildKernel();
Application.Run(kernel.Get<frmMain>());
}
static IKernel BuildKernel()
{
var modules = new INinjectModule[]
{
[..modules]
};
return new StandardKernel(modules);
}
}
Run Code Online (Sandbox Code Playgroud)
精细.这将创建一个主窗体并很好地显示它,将适当的接口实现传递给注入的构造函数.
怎么办?我的应用程序是一个MDI,将有几个子窗口用于操作应用程序模型.我不再有对内核的引用了,所以我应该如何处理Get()这些形式?显而易见的答案是"我将内核传递给表单",但这是一个非常混乱的策略,我确信这不符合DI的理念.
我将在此指出Ninject 2的文档很糟糕.我能找到的一切都重复了基本的例子,而没有真正解释使用Ninject的DI如何让事情变得更容易.给出的示例标准并不复杂,不足以使编码和创建模块和绑定的麻烦变得有价值.
编辑#1:
在研究了Sam Holder友情提供的链接后,我正在尝试"组合根"方法.我的架构现在强制它使用的所有表单从CompositedForm构造函数语义派生,因此:
[Inject]
public CompositingForm(ICompositionRoot CompositionRoot)
{
InitializeComponent();
this.CompositionRoot = CompositionRoot;
}
public readonly ICompositionRoot CompositionRoot;
public CompositingForm() : …Run Code Online (Sandbox Code Playgroud) 可以sealed在Scala中定义类,基本上final除非子类在同一文件中发生.
似乎JVM不允许final类字节码及其子类.
考虑到字节码中没有源文件的"概念",如何强制执行此限制?
因此,如何javac防止Scala sealed类在Java中被分类?
我正在使用一个当前使用基本身份验证对话框登录系统的站点,这是您进入此处时获得的对话类型:http://www.dur.ac.uk/vm.boatclub/password/index .php 我没有设置这个系统,也不能轻易/快速地解决它,但它确实有效.但问题是,对话框对于告诉您必须使用哪些登录信息(即用户名和密码组合)并不是很有帮助,所以我想用表单替换它.我一直在想这不可能,但我想问一下,以便找出答案.
是否可以设置一个HTML表单,将数据发送到服务器,使其以与使用此对话框相同的方式接受它?或者,是否可以设置一个PHP脚本,该脚本将采用普通表单数据并以某种方式将其传递给服务器,以便它登录?
编辑:在被告知这是基本身份验证后,我四处寻找并找到了一种有效的方法并让用户持续登录.但是,这在Internet Explorer中不起作用.解决方案只是将用户重定向到: http:// username:password@www.dur.ac.uk/vm.boatclub/password/index.php 但是由于大约3年前的网络钓鱼使用,Internet Explorer将其删除了.有没有办法使用JavaScript来让浏览器以这种方式访问该网站?或者我只需要改变我的用户界面?
好的,我目前在PHP/MySQL/UTF-8/Unicode地狱!
我的环境:MySQL:5.1.53服务器字符集:latin1 Db characterset:latin1客户端字符集:latin1连接字符集:latin1
PHP:5.3.3
我的PHP文件保存为UTF-8格式,而不是ASCII文件.
在我的PHP代码中,当我建立数据库连接时,我执行以下操作:
ini_set('default_charset', 'utf-8');
$my_db = mysql_connect(DEV_DB, DEV_USER, DEV_PASS);
mysql_select_db(MY_DB);
// I have tried both of the following utf8 connection functions
// mysql_query("SET NAMES 'utf8'", $my_db);
mysql_set_charset('utf8', $my_db);
// Detect if form value is not UTF-8
if (mb_detect_encoding($_POST['lang_desc']) == 'UTF-8') {
$lang_description = $_POST['lang_desc'];
} else {
$lang_description = utf8_encode($_POST['lang_desc']);
}
$language_sql = sprintf(
'INSERT INTO app_languages (language_id, app_id, description) VALUES (%d, %d, "%s")',
intval($lang_data['lang_id']),
intval($new_app_id),
mysql_real_escape_string($lang_description, $my_db)
);
Run Code Online (Sandbox Code Playgroud)
我的MySQL数据库的格式/创建是:
CREATE TABLE IF NOT EXISTS …
我已经查过这篇文章了.但它没有回答我的问题.我想获取特定用户所属的所有活动目录组.
我写了以下代码.但我无法继续进行,因为我不知道如何提供过滤器以及如何访问属性.
class Program
{
static void Main(string[] args)
{
DirectoryEntry de = new DirectoryEntry("LDAP://mydomain.com");
DirectorySearcher searcher = new DirectorySearcher(de);
searcher.Filter = "(&(ObjectClass=group))";
searcher.PropertiesToLoad.Add("distinguishedName");
searcher.PropertiesToLoad.Add("sAMAccountName");
searcher.PropertiesToLoad.Add("name");
searcher.PropertiesToLoad.Add("objectSid");
SearchResultCollection results = searcher.FindAll();
int i = 1;
foreach (SearchResult res in results)
{
Console.WriteLine("Result" + Convert.ToString(i++));
DisplayProperties("distinguishedName", res);
DisplayProperties("sAMAccouontName", res);
DisplayProperties("name", res);
DisplayProperties("objectSid", res);
Console.WriteLine();
}
Console.ReadKey();
}
private static void DisplayProperties(string property, SearchResult res)
{
Console.WriteLine("\t" + property);
ResultPropertyValueCollection col = res.Properties[property];
foreach (object o in col)
{
Console.WriteLine("\t\t" …Run Code Online (Sandbox Code Playgroud) 我有一个最终的应用程序设计,我用Photoshop测量所有内容都是用PX测量的.现在我意识到Android应用程序正在使用DP进行字体大小和其他事情.
有什么方法可以将PX转换为DP吗?
我想在我的应用程序中使用flurry及其功能.我如何用乱舞注册自己,如何在我的Android应用程序中使用它?
谢谢
我是iphone编程的新手,并试图学习iphone编程.我需要专家的帮助.请原谅我,如果它的重复问题.
我有英特尔处理器MacBook与2.5 GB内存.
安装的Mac OS X版本为:10.5.2
我从APPLE DEVELOPER站点下载了Xcode 3.2.5和iOS SDK 4.2.
我的查询是:操作系统是否支持Xcode版本,或者我是否需要升级操作系统.
我不想升级操作系统.
请建议.
问候,Sunny