小编The*_*imp的帖子

未捕获错误:[HMR]热模块更换已禁用

我用webpack我的构建这没有任何问题使用作品的webpack-dev-server(npm run watch),但是当我尝试创建一个生产版本(npm run build)我似乎获得错误的控制台,当我尝试加载网页和什么都没有显示出来在屏幕上.

未捕获错误:[HMR]热模块更换已禁用.

我有几个问题:

  1. 我对使用的理解Hot Module Replacement是它的设计是为了在开发过程中使生活更轻松,它不应该用于生产部署.那是对的吗?

  2. 鉴于以下情况,为什么Hot Module Replacement要使用?我不知道是什么驱使它.

  3. 什么是生产构建的最佳实践,我应该webpack为prod和dev 单独配置吗?理想情况下,我想纯粹使用单个配置来简化维护.

的package.json

{
  // ...
  "scripts": {
    "build": "webpack --progress --colors --production",
    "watch": "webpack-dev-server --inline --hot --progress --colors"
  },
  "dependencies": {
    "bootstrap": "^3.3.6",
    "bootstrap-sass": "^3.3.6",
    "bootstrap-webpack": "0.0.5",
    "extract-text-webpack-plugin": "^1.0.1",
    "html-webpack-plugin": "^2.15.0",
    "jquery": "^2.2.3",
    "node-sass": "^3.4.2",
    "react": "^15.0.1",
    "react-bootstrap": "^0.28.5",
    "react-dom": "^15.0.1",
    "react-redux": "^4.4.1",
    "react-router": "^2.0.1",
    "react-router-redux": "^4.0.1",
    "redux": "^3.3.1",
    "redux-thunk": "^2.0.1",
    "webpack": …
Run Code Online (Sandbox Code Playgroud)

javascript node.js webpack hot-module-replacement

9
推荐指数
2
解决办法
6751
查看次数

如何评估GPS信号强度?(苹果手机)

我需要一种分类GPS信号强度的方法.到目前为止,我遇到过(Class Reference)的horizontalAccuracy属性.CLLocation

更具体地说,我需要创建类似下面的内容; 我所遇到的问题是填写if声明.

if (someLocation.horizontalAccuracy ...)
{
    // No Signal
}
else if (someLocation.horizontalAccuracy ...)
{
    // Poor Signal
}
else if (someLocation.horizontalAccuracy ...)
{
    // Average Signal
}
else if (someLocation.horizontalAccuracy ...)
{
    // Good Signal
}
else
{
    // Excellent Signal
}
Run Code Online (Sandbox Code Playgroud)

有人可以帮助我吗?

iphone gps cllocation ios

8
推荐指数
1
解决办法
4448
查看次数

UITextView UITableViewCell sizeToFit无法按预期工作

我有一个UITextView我需要调整大小,以便它有一个宽度伸展,以填充屏幕,但可变高度,以便它足够大,以显示所有文本.当调整大小时,它应该使UITextView最小可能的高度,使其适合.

为了做到这一点,我一直在使用以下代码:

textView.text            = textMessage;
[textView sizeToFit];
CGRect rect              = textView.frame;
rect.size.height         = textView.contentSize.height;
textView.frame           = rect;
Run Code Online (Sandbox Code Playgroud)

当我这样做时,似乎并没有使UITextView成为可能的最小高度.看来下方还有一些空间.这是一个例子(我已经将背景颜色设置为红色以说明我的观点):

在此输入图像描述

请有人可以告知为什么会这样,以及我如何解决这个问题?请注意,UITextView位于自定义UITableView单元格中.此单元格使用"自动调整"蒙版水平拉伸以根据方向填充屏幕.

我花了很多时间试图让它工作,但我不明白为什么底部有多余的空间,当我旋转设备时,UITextViews的高度似乎都保持不变(即使我称之为[UITableView reloadData]方法我还定义了行高度方法).

iphone objective-c uitextview ipad ios

8
推荐指数
1
解决办法
7023
查看次数

使用java vert.x web服务器提供单页rect应用程序

我正在使用Vert.xWeb服务器将React应用程序作为静态内容提供.我希望从路径中提供这个/,然后在React应用程序中它有自己的路由,使用react-router它来决定显示哪个页面.

到目前为止,我有以下内容:

Vertx vertx = Vertx.vertx();
HttpServer server = vertx.createHttpServer();
Router router = Router.router(vertx);
router.route().handler(BodyHandler.create());
router.route(HttpMethod.POST, "/rest/foo").handler(new FooHandler());
router.route(HttpMethod.GET, "/*").handler(StaticHandler.create()).failureHandler(event -> { // This serves up the React app
    event.response().sendFile("webroot/index.html").end();
});
server.requestHandler(router::accept).listen(12001);
Run Code Online (Sandbox Code Playgroud)

如果我从请求开始localhost:12001,它按预期工作,并且它也正确地处理从该点开始的路径更改.但是,如果我尝试刷新其中一个具有由react router当时处理的路径的页面,那么我会在服务器日志中生成一堆错误(尽管页面确实正确加载).

有谁知道这里的问题是什么以及如何解决它?

SEVERE: Unexpected exception in route
java.lang.IllegalStateException: Response has already been written
    at io.vertx.core.http.impl.HttpServerResponseImpl.checkWritten(HttpServerResponseImpl.java:561)
    at io.vertx.core.http.impl.HttpServerResponseImpl.end0(HttpServerResponseImpl.java:389)
    at io.vertx.core.http.impl.HttpServerResponseImpl.end(HttpServerResponseImpl.java:328)
    at co.uk.foo.webserver.server.WebServer.lambda$initialiseRoutes$0(WebServer.java:67)
    at co.uk.foo.webserver.server.WebServer$$Lambda$4/1197365356.handle(Unknown Source)
    at io.vertx.ext.web.impl.RouteImpl.handleFailure(RouteImpl.java:227)
    at io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:76)
    at io.vertx.ext.web.impl.RoutingContextImpl.next(RoutingContextImpl.java:94)
    at io.vertx.ext.web.impl.RoutingContextImpl.doFail(RoutingContextImpl.java:355)
    at …
Run Code Online (Sandbox Code Playgroud)

java webserver vert.x reactjs react-router

8
推荐指数
1
解决办法
1936
查看次数

如何增加重复本地通知的应用程序徽章编号(iPhone)

我已经设置了每分钟重复的本地通知,但是我需要每次都增加应用程序徽章编号.当我运行它的时候它似乎没有增加,它只是保持1.请有人帮助我吗?

以下是我创建通知的方法:

// Create the UILocalNotification
UILocalNotification *myNotification = [[UILocalNotification alloc] init];
myNotification.alertBody = @"Blah blah blah...";
myNotification.alertAction = @"Blah";
myNotification.soundName = UILocalNotificationDefaultSoundName;
myNotification.applicationIconBadgeNumber++;
myNotification.timeZone = [NSTimeZone defaultTimeZone];
myNotification.repeatInterval = NSMinuteCalendarUnit;
myNotification.fireDate = [[NSDate date] dateByAddingTimeInterval:30];
[[UIApplication sharedApplication] scheduleLocalNotification:myNotification];
Run Code Online (Sandbox Code Playgroud)

iphone uilocalnotification

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

如何将参数传递给SwingWorker?

我正在尝试在GUI中实现Swing worker.目前我有一个包含按钮的JFrame.按下此按钮时,它应更新显示的选项卡,然后在后台线程中运行程序.这是我到目前为止所拥有的.

class ClassA
{
    private static void addRunButton() 
    {
        JButton runButton = new JButton("Run");
        runButton.setEnabled(false);
        runButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) 
            {
                new ClassB().execute();
            }
    });

    mainWindow.add(runButton);
    }
}

class ClassB extends SwingWorker<Void, Integer>
{
    protected Void doInBackground()
    {
        ClassC.runProgram(cfgFile);
    }

    protected void done()
    {
        try 
        { 
        tabs.setSelectedIndex(1);
        } 
        catch (Exception ignore) 
        {
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

我不明白我怎么能传递我的cfgFile对象.有人可以就此提出建议吗?

java swing swingworker argument-passing

6
推荐指数
1
解决办法
8373
查看次数

图形没有在JLayeredPane中显示(java swing)

我正在尝试逐步建立基于用户输入的图像.我正在尝试做的是创建一堆图形并将它们添加为图层但是我遇到了一些问题,因为它们不会显示出来.这是我正在使用的代码:

public class ClassA 
{
    protected final static int dimesionsY = 1000;
    private static int dimesionsX;
    private static JFrame window;
    private static JLayeredPane layeredPane;

    public void init()
    {
        window = new JFrame("Foo");
        dimesionsX = // some user input
        window.setPreferredSize(new Dimension(dimesionsX, dimesionsY));
        window.setLayout(new BorderLayout());

            layeredPane = new JLayeredPane();
        layeredPane.setBounds(0, 0, dimesionsX, dimesionsY);
        window.add(layeredPane, BorderLayout.CENTER);

            ClassB myGraphic = new ClassB();    
        myGraphic.drawGraphic();

        layeredPane.add(myGrpahic, new Integer(0), 0);

        window.pack();
        window.setVisible(true);
    }
}



public class ClassB extends JPanel
{
    public void drawGraphic()
    {
        repaint();
    }

    public …
Run Code Online (Sandbox Code Playgroud)

java graphics swing jlayeredpane

6
推荐指数
1
解决办法
7036
查看次数

如何将bash脚本数组中的值增加1?

我正在尝试使用以下代码将数组中的值增加1,但是我遇到了一些问题.请有人帮帮我吗?

myArray[$position]=((${myArray[$position]}++))
Run Code Online (Sandbox Code Playgroud)

arrays bash increment

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

目标c划分两个整数

我试图通过int在我的程序中划分两个s 来生成一个浮点数.这是我期望的:

1/120 = 0.00833

这是我正在使用的代码:

float a = 1 / 120;
Run Code Online (Sandbox Code Playgroud)

但它没有给我我期望的结果.当我打印出来时,我得到以下内容:

inf
Run Code Online (Sandbox Code Playgroud)

objective-c

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

如何在XCode中设置SVN存储库?

我已经开始开发iPhone应用程序,我需要一种管理版本的方法.我已经研究了通过这种方式实现这一目标的方法,Xcode并且我发现我可以沿着使用GIT或者走的路走下去SVN.

在过去我曾经使用过SVN这个原因,我更倾向于沿着这条道路走下去(GIT如果人们觉得它比这更好的话,我愿意使用SVN).我的问题与设置存储库有关Xcode.

我做了大量的研究,我找到了几个有用的教程,但是很多看起来已经过时了.

我的问题是双重的:

  1. Xcode请问有人可以建议通过设置存储库的步骤吗?
  2. 我注意到Xcode要求我设置存储库的位置.我不知道该怎么做,因为我没有自己的服务器.有没有办法解决这个问题?我可以以某种方式设置本地存储库(如果是这样的话?如果不是我的其他选项?)?

在此输入图像描述

提前感谢您提供的任何帮助或建议.

svn git iphone version-control xcode

6
推荐指数
1
解决办法
6081
查看次数