小编ipo*_*rto的帖子

通过DistributedCache读取本地文件时出现OutofMemoryError

更新2012年11月21日:

通过将属性mapred.child.java.opts设置为-Xmx512m解决了问题.在此之前,我在core-site.xml中将HADOOP_HEAPSIZE设置为2000,但这没有用.我仍然不明白为什么程序在本地工作,但它不是分布式的.感谢所有的答案.

我正在使用Hadoop 1.0.3.该集群由三台机器组成,所有机器都运行Ubuntu Linux 12.04 LTS.其中两台机器有12 GB RAM,第三台机器有4 GB.我正在通过DistributedCache读取大约40 MB的本地文件.我的程序在本地环境(本地/独立模式)下完美运行.但是,当我在Hadoop集群中执行它(完全分布式模式)时,我得到一个"OutOfMemoryError:Java堆空间",具有相同的40 MB文件.我不明白为什么会这样,因为文件不是那么大.这是代码:

    public static class MapClass extends MapReduceBase implements Mapper<LongWritable, Text, Text, Text> {
    // ...
    private HashMap<String, String> urlTrad = new HashMap<String, String>();
    // ...
    @Override
    public void configure(JobConf job) {
        Path[] urlsFiles = new Path[0];
        BufferedReader fis;

        try {
            urlsFiles = DistributedCache.getLocalCacheFiles(job);
            fis = new BufferedReader(new FileReader(
                    urlsFiles[0].toString()));
            String pattern;
            while ((pattern = fis.readLine()) != null) {
                String[] parts = pattern.split("\t");
                urlTrad.put(parts[0], parts[1]);
            }
            fis.close();

        } catch (IOException …
Run Code Online (Sandbox Code Playgroud)

hadoop mapreduce out-of-memory

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

PHP Composer Autoload 出现类未找到错误

错误是:

\n\n
Fatal error: Uncaught Error: Class \'Championsweb\\Model\\VO\\CompeticionVO\'\nnot found in E:\\Drive\\Proyectos\\ChampionsEclipse\\public\\CrearCompeticion.php\non line 4\n
Run Code Online (Sandbox Code Playgroud)\n\n

项目结构:

\n\n
\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80config\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80public\n\xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80css\n\xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80js\n\xe2\x94\x82       \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80vendor\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80src\n\xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80Championsweb\n\xe2\x94\x82       \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80Controller\n\xe2\x94\x82       \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80Model\n\xe2\x94\x82           \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80VO\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80templates\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80tests\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80vendor\n\xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80composer\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80views\n
Run Code Online (Sandbox Code Playgroud)\n\n

CrearCompeticion.php(位于 public/ 中)如下所示:

\n\n
<?php\n\nif (isset($_POST) && sizeof($_POST) > 0) {\n    $competicionVO = new \\Championsweb\\Model\\VO\\CompeticionVO(\n        $_POST[\'nombre\'],\n        $_POST[\'anho\']\n    );\n    $adminactions = new \\Championsweb\\Controller\\AdminActions();\n    $adminactions->crearCompeticion($competicionVO);\n}\n\nrequire \'../views/CrearCompeticion.view.php\';\n
Run Code Online (Sandbox Code Playgroud)\n\n

CompeticionVO.php(位于 src/Championsweb/Model/VO 中)如下所示:

\n\n
<?php\nnamespace Championsweb\\Model\\VO;\n\nclass CompeticionVO {\n    public $id;\n    public $nombre;\n    public $anho;\n    public $idGanador;\n\n    public function __construct($nombre, $anho) {\n        $this->nombre = $nombre;\n        $this->anho = $anho;\n    }\n}\n
Run Code Online (Sandbox Code Playgroud)\n\n …

php autoload classnotfound composer-php

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

Windows 窗体中的布局困难

我正在使用 Windows 窗体使用 C# 编写应用程序。它是一个带有菜单、选项卡式窗格、网格和状态栏的表单。我希望即使在调整窗口大小时控件也能正确显示。如果我将控件添加到窗体而不使用任何布局面板,菜单栏将显示在选项卡的顶部(参见图 1)。另一方面,如果我使用 FlowLayoutPanel 从上到下添加组件,则控件不会填充可用空间(参见图 2)。

\n\n

编辑:我无法使用 TableLayoutPanel 解决它。垂直空间也没有被填充。参见图 3。

\n\n

可能是什么问题?在 Windows 窗体中使用布局的常用方法是什么?先感谢您。

\n\n

没有布局面板的屏幕截图

\n\n

FlowLayoutPanel 的屏幕截图

\n\n

TableLayoutPanel 的屏幕截图

\n\n

代码如下:

\n\n
using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Data;\nusing System.Drawing;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Windows.Forms;\nusing AGAPconsole;\n\nnamespace AGAP\n{\npublic partial class MainForm : Form\n{\n\n    private String user;\n    private ClassDatabase db;\n\n    private TableLayoutPanel mainPanel;\n    private TabControl mainTabControl;\n    private TabPage mainTabPage;\n\n    // Grid de actuaciones\n    private DataGridView actuacionesGrid;\n    private ContextMenuStrip actuacionesContextMenuStrip;\n    private ToolStripMenuItem verTramitesMenuItem;\n    private ToolStripMenuItem verEncargosMenuItem;\n    private ToolStripMenuItem verTrabajosMenuItem;\n    private ToolStripMenuItem verDatosObraMenuItem;\n\n    // Barra …
Run Code Online (Sandbox Code Playgroud)

c# user-interface winforms

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