小编14w*_*wml的帖子

In [num]在jupyter笔记本中是什么意思?

我知道这In[*]意味着内核正在运行

在此处输入图片说明

但是什么In[93]意思呢?

在此处输入图片说明

这是指执行单元的总秒数还是行号?

python jupyter-notebook

4
推荐指数
1
解决办法
4465
查看次数

子图层添加后未显示

我正在尝试"resizeLayer"通过对UIView selectedShape进行子分层来将其添加到UIView中selectedShape

let sublayer = CALayer()
sublayer.bounds = selectedShape.bounds //even when inserted this line, sublayer still doesn't show up
sublayer.frame = selectedShape.frame
sublayer.contents = UIImage(named: "resizeLayer")
selectedShape?.layer.addSublayer(sublayer)
Run Code Online (Sandbox Code Playgroud)

但是当我运行代码时,我根本看不到该层

我什至尝试"resizeLayer"通过UIView来查看图像"selectedShape"

let resizeFrame = UIImageView(image: UIImage(named: "resizeLayer"))
resizeFrame.frame = selectedShape.frame
resizeFrame.contentMode = UIViewContentMode.ScaleAspectFill
selectedShape.addSubview(resizeFrame)
Run Code Online (Sandbox Code Playgroud)

但是,仍然"resizeLayer"没有出现!

仅当我"resizeLayer"在整体视图中添加时,它才会显示:

let resizeFrame = UIImageView(image: UIImage(named: "resizeLayer"))
resizeFrame.frame = selectedShape.frame
resizeFrame.contentMode = UIViewContentMode.ScaleAspectFill
selectedShape.addSubview(resizeFrame)     
self.view.insertSubview(resizeFrame, aboveSubview: selectedShape) //add this line
Run Code Online (Sandbox Code Playgroud)

任何帮助,将不胜感激!

如果相关,这就是我所做的 selectedShape

selectedShape = UIView(frame: …
Run Code Online (Sandbox Code Playgroud)

calayer uiview ios swift

3
推荐指数
2
解决办法
5364
查看次数

禁用时如何使 UIBarButton 不灰显?

我有一个UIBarButton saveBarButton屏幕图像保存到相机胶卷。当用户按下saveBarButton图像被保存并且UIBarButton saveBarButton改变UIImage doneIcon为 1.2 秒时,向用户表明图像已被保存。当saveBarButton显示doneIconI disable 时saveBarButton。但是,当我这样做时,它saveBarButton会变灰。

我的问题是:如何阻止UIBarButton禁用时变灰?

我的代码:

//create UIBarButton saveBarButton
override func viewDidLoad() {    
    let saveBarButton = UIBarButtonItem(image: UIImage(named: "saveIcon"), style: .Plain, target: self, action: "save:")
    saveBarButton.tintColor = colorGreyDark
}

//save function called when press saveBarButton
func save(sender: UIBarButtonItem) {
    //save image
    deselectShape()
    let window: UIWindow! = UIApplication.sharedApplication().keyWindow
    let windowImage = capture(window)
    UIImageWriteToSavedPhotosAlbum(windowImage
        , nil, nil, nil)

    //Change saveBarButton …
Run Code Online (Sandbox Code Playgroud)

customization uibarbuttonitem ios swift

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

单击按钮后jQuery函数无法正常工作?

我想要发生什么

  • 按下添加按钮时,将在添加按钮的行下方添加一行
  • 按下删除按钮时,该行将被删除.
  • 悬停或单击某个输入文本时,旁边会显示一个添加按钮.
    • 当鼠标没有悬停在输入文本上或未选择输入文本时,添加按钮应该消失.
  • 将鼠标悬停在某个项目符号上时,会出现一个删除按钮来代替项目符号.
    • 当鼠标离开移除按钮时,它将恢复为子弹.

我怀疑我的一些问题正在发生b/c我把所有的功能都放进去了$(document).ready().如果有人可以输入我应该使用的jQuery代码,我将非常感激!

怎么了

添加按钮 在此输入图像描述

只有第一个添加按钮有效.

删除按钮 在此输入图像描述 其他添加的行删除按钮仅在将鼠标悬停在第一个项目符号上时显示.

在此输入图像描述 删除按钮仅适用一次.删除一行后,删除按钮和添加按钮将失去其功能.删除和添加按钮也不会消失.

我的代码

HMTL

这是我要添加的行

<div class="row">
                <div class="col-lg-7">
                    <div class="form-group">
                        <div class="input-group input-group-lg">
                            <div class="input-group-btn"> 
                                <button type="button" class="btn btn-default button-remove" aria-label="Remove">
                                    <span class="glyphicon glyphicon-minus-sign" aria-hidden="true"></span>
                                </button>
                                <button type="button" class="btn btn-default button-bullet" aria-label="Bullet">
                                    <span class="glyphicon glyphicon-one-fine-dot" aria-hidden="true"></span>
                                </button>
                            </div> 
                            <input type="text" name="Worksheet-Problem" class="form-control" placeholder="Problem..." aria-label="Write worksheet problem here"> 
                            <div class="input-group-btn">  
                                <button type="button" class="btn btn-default button-add" aria-label="Add">
                                    <span class="glyphicon glyphicon-plus-sign" aria-hidden="true"></span>
                                </button> 
                            </div>
                        </div>
                    </div>
                </div>
            </div> …
Run Code Online (Sandbox Code Playgroud)

html javascript jquery twitter-bootstrap

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

如何摆脱div右侧的空白区域?

怎么了

在此输入图像描述

我想要的是

正如你所看到的,#Demo-Card即使我设置了它,右边还有这个讨厌的白色空间body{padding: 0; margin: 0;}.

我也尝试过:

#Demo-Card {
    padding: 0;
    margin: 0;
}
Run Code Online (Sandbox Code Playgroud)

但那没用.

如何摆脱这个讨厌的白色空间?

如果有人可以提供帮助,我们将不胜感激!

HTML

<body>
<div id="Demo-Card">
    <header>
        <h3><span class="problem-number">11</span> <span class="problem-equation">Problem</span></h3> 
    </header>
    <!--<button id="Run">Run Demo</button>-->
    <div class="iframe-container">
        <iframe id="Demo-iFrame" src="mathsynthesis/LearningByExample/GUI/web/mathsynth.html">
            <p>Your browswer does not support iFrames</p>
        </iframe>
    </div>
</div>
</body>
Run Code Online (Sandbox Code Playgroud)

CSS

body{
    padding: 0;
    margin: 0;
    font-family: 'Work Sans', sans-serif;
}

/*DEMO-CARD FORMATTING*/
#Demo-Card {
    width: calc(100vw - 40px);
    height: calc(100vh - 40px - 50px); /*40px for borders, 50px for …
Run Code Online (Sandbox Code Playgroud)

html css

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

为什么背景图片没有显示页脚?

如下图所示,我的footerImage页脚div的背景图像没有显示,即使div有一个明确定义的高度(50px)和宽度(100%),如绿色边框所示.为什么?我该如何解决?

注意:这不是图像路径问题,因为我可以在Brackets中提取图像的预览.

我的页脚:

HTML:

<ul>
    <li>
        <a href="" target="_blank"> <figure>
            <div class = "footerImage resume"> </div>
            <figcaption>Resume</figcaption>
        </figure></a>
    </li>
</ul>
Run Code Online (Sandbox Code Playgroud)

CSS:

.footerImage {
    background-repeat: no-repeat;
    background-size: contain;
    background-position: center center;
    width: 100%;
    height: 50px;
    border: 1px solid green;
}

.footerImage .resume {
    background-image: url('../images/resume.png');
}
Run Code Online (Sandbox Code Playgroud)

html css background-image

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

委托必须响应locationManager:didFailWithError:即使实现了didFailWithError方法

出于某种原因,Xcode认为我没有实现协议的didFailWithError方法CLLocationManagerDelegate

在此输入图像描述 在此输入图像描述

我没有看到我做错了什么,因为我从另一个SO帖子中复制了一下,说这个didFailWithError方法是为Swift 3更新的.所以我不明白为什么Xcode认为我没有实现didFailWithError

任何见解将不胜感激!

class OptionsViewController: UIViewController,
    CLLocationManagerDelegate {
var locationManager: CLLocationManager = CLLocationManager()

    override func viewDidLoad() {
//Ask user for location
        locationManager.delegate = self
        locationManager.desiredAccuracy = kCLLocationAccuracyBest

        //Use users current location if no starting point set
        if CLLocationManager.locationServicesEnabled() {
            if CLLocationManager.authorizationStatus() == CLAuthorizationStatus.authorizedWhenInUse
                || CLLocationManager.authorizationStatus() == CLAuthorizationStatus.authorizedAlways {
                locationManager.requestLocation()
            }
            else{
                locationManager.requestWhenInUseAuthorization()
            }
        }
        else{
            //Alert user to open location service, bra bra bra here...
        }
    }

func locationManager(_ manager: …
Run Code Online (Sandbox Code Playgroud)

xcode cllocationmanager didfailwitherror ios swift3

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

错误:您无权将文件保存在文件夹中

我已经成功下载了该文件,但我无法保存该文件.因为我不断收到错误:

[SSZipArchive] Error: You don’t have permission to save the file “fileName” in the folder “Folder_Name”.
[SSZipArchive] Error: You don’t have permission to save the file “fileName” in the folder “__MACOSX”.
Run Code Online (Sandbox Code Playgroud)

任何帮助,将不胜感激!

解压缩文件函数调用

 ZipManager.unzipFile(atPath: filePath, delegate: self)
Run Code Online (Sandbox Code Playgroud)

ZipManager.swift

private static let documentsURL: URL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0]

static func unzipFile(atPath path: String, delegate: SSZipArchiveDelegate)
    {
        let destFolder = "/Folder_Name"
        let destPath = documentsURL.appendingPathComponent(destFolder, isDirectory: true)
        let destString = destPath.absoluteString

        if ( !FileManager.default.fileExists(atPath: destString) )
        {
            try! FileManager.default.createDirectory(at: destPath, …
Run Code Online (Sandbox Code Playgroud)

ios swift ssziparchive

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

Installed BeautifulSoup but still get no module named bs4

I'm using a Jupyter notebook, Python 3.5, and a virtual environment.

Within my virtual env I did:

(venv) > pip install BeautifulSoup4
Run Code Online (Sandbox Code Playgroud)

Which seemed to run fine b/c the terminal output was:

Downloading beautifulsoup4-4.6.0-py2-none-any.whl (86kB)
  100% |????????????????????????????????| 92kB 297kB/s 
Installing collected packages: BeautifulSoup4
Successfully installed BeautifulSoup4-4.6.0
Run Code Online (Sandbox Code Playgroud)

But when I run my Jupyter notebook I get:

ImportError                               Traceback (most recent call last)
<ipython-input-1-5fe69888b1a1> in <module>()
      5 from itertools import groupby
      6 import pickle
----> 7 import bs4
      8 import matplotlib.pyplot as …
Run Code Online (Sandbox Code Playgroud)

beautifulsoup virtualenv python-3.5 jupyter-notebook

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

如何拆分Ocaml中的空格?

空格是空格,制表符或换行符(即回车符或换行符)

我假设\s包括, \t,\n,\r,和\f

但是当我尝试使用\s它时,无法正确拆分字符串:

# let line1 = "We the People of the United States, in Order to form a more perfect";;

# let wsp_regex = Str.regexp "\\s+";;
# let words = Str.split wsp_regex line1;;
val words : string list = 
["We the People of the United State"; ", in Order to form a more perfect"]

# let wsp_regex = Str.regexp "[ \\s]+";;
# let words = Str.split wsp_regex …
Run Code Online (Sandbox Code Playgroud)

regex string ocaml

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