小编Roo*_*Pro的帖子

从github enterprise迁移到github.com

我们在Github Enterprise的试用版上有一些存储库和分支.我想评估如何从Github企业迁移到Github.com(比如付费组织)

我发现的唯一资源是如何在相反的方向上执行迁移 https://help.github.com/enterprise/2.0/admin/articles/moving-a-repository-from-github-com-to-github-enterprise /

我已经联系了github.com,询问下面的相同问题,我正在等待他们的回复.

  • 我们如何将存储库从github Enterprise迁移到github.com?(相当肯定git clone --bare和git push --mirror将完成这项工作)
  • 如果我也移动叉子,我们如何确保原始和叉子之间的关系得以保持?
  • 如何迁移我们为存储库配置的webhook和服务?
  • 如何转移Pull请求/问题?(我上面链接的文章说我们需要使用Github API,我对这个解决方案没问题)
  • 我们可以迁移团队和用户吗?(猜测,可能不是)

请注意,我们使用github提供的备份工具执行企业实例的备份(我认为它被称为ghe-backup)

谢谢

migration github

9
推荐指数
1
解决办法
2225
查看次数

加载UISearchController时自动显示键盘

我在表视图控制器中创建了一个UISearchController.我使用来自另一个视图控制器的push segue来查看此表视图控制器.我希望一旦按下表视图控制器,键盘就会在搜索栏中显示光标.

我在viewDidLoad方法中使用了搜索控制器

self.mySearchController.active = true
Run Code Online (Sandbox Code Playgroud)

它确实使搜索控制器处于活动状态,但这不会调出键盘,光标也不会放在搜索栏中.我也试过了

self.mySearchController.searchBar.becomeFirstResponder()
Run Code Online (Sandbox Code Playgroud)

这条线似乎没有任何效果.

如何自动/以编程方式调出键盘?下面是我的代码的更详细版本

class PickAddressViewController: UITableViewController, UISearchResultsUpdating {

var searchText = ""

var mySearchController = UISearchController()

override func viewDidLoad() {
    super.viewDidLoad()

    self.mySearchController = ({
        let controller = UISearchController(searchResultsController: nil)
        controller.searchResultsUpdater = self
        controller.dimsBackgroundDuringPresentation = false
        controller.searchBar.sizeToFit()
        controller.searchBar.text = self.searchText

        self.tableView.tableHeaderView = controller.searchBar

        return controller
    })()

    self.mySearchController.active = true
    self.mySearchController.searchBar.becomeFirstResponder()
}
Run Code Online (Sandbox Code Playgroud)

ios swift uisearchcontroller

8
推荐指数
2
解决办法
9131
查看次数

在Swift中没有nib文件的NSWindowController

我是初学Cocoa开发人员.我被聘用的团队在Swift中进行OS X开发而不使用nib文件(显然主菜单除外).所以,在我加入团队之前,我正在努力学习这一点.这是我到目前为止:

我创建了一个没有故事板的新OS X项目.我创建了一个名为MainWindowController.swift的新文件,使其成为NSWindowController的子类,并且没有创建xib/nib文件.我还让MainWindowController实现了NSWindowDelegate协议

在MainMenu.xib文件中,我默认删除了应用程序附带的窗口,但我保留了主菜单.

在app delegate中,我删除了窗口的默认插座.

然后我在app delegate中以编程方式创建了一个NSWindow.我希望MainWindowController成为这个窗口的委托.这就是我的AppDelegate的样子:

import Cocoa

@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {

    let newWindow = NSWindow(contentRect: NSMakeRect(100, 100, NSScreen.mainScreen()!.frame.width/2, NSScreen.mainScreen()!.frame.height/2), styleMask: NSTitledWindowMask|NSResizableWindowMask|NSMiniaturizableWindowMask|NSClosableWindowMask, backing: NSBackingStoreType.Buffered, `defer`: false)

    func applicationDidFinishLaunching(aNotification: NSNotification) {
        // Insert code here to initialize your application
        let wc = MainWindowController.init(window: newWindow)
        wc.showWindow(self)
    }

    func applicationWillTerminate(aNotification: NSNotification) {
        // Insert code here to tear down your application
    }

}
Run Code Online (Sandbox Code Playgroud)

如您所见,我正在创建一个窗口对象,然后在applicationDidFinishLaunching方法中,我使用该窗口初始化我的自定义NSWindowController,然后显示该窗口.我不确定这是否正确.

然后,在我的自定义NSWindowController中,我使用'self.window?.delegate = self'使'self'成为窗口的委托.这就是我的MainWindowController的外观

import Cocoa

class MainWindowController: NSWindowController, NSWindowDelegate {

    override func windowDidLoad() { …
Run Code Online (Sandbox Code Playgroud)

nswindowcontroller swift

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

使用 Swift 中的绑定以编程方式创建基于视图的 NSTableView

我正在阅读 Swift 中的 Cocoa 一书,但我被困在关于 Bindings 的一章中。这本书使用 nib 文件,但我想以编程方式完成所有工作(因为我加入了一个不使用 nib 的团队)。该项目是创建视图基于表2列和表中的内容被绑定到arrangedObjects阵列控制器的。数组控制器的内容绑定到一组 Employee 对象(Employee 有 2 个属性,即姓名和薪水)。

我能够像下面那样以编程方式创建表格(一个滚动视图,一个表格视图,2 个表格列):

let tableWidth = windowWidth! * 0.6
let tableHeight = windowHeight! * 0.8

scrollView = NSScrollView(frame: NSRect(x: windowWidth!*0.05, y: windowHeight!*0.08, width: tableWidth, height: tableHeight))

employeeTable = NSTableView(frame: NSRect(x: 0, y: 0, width: tableWidth, height: tableHeight))
employeeTable?.bind("content", toObject: (self.arrayController)!, withKeyPath: "arrangedObjects", options: nil)

nameColumn = NSTableColumn(identifier: "name column")
nameColumn?.width = tableWidth * 0.4
nameColumn?.headerCell.title = "Name"

raiseColumn = NSTableColumn(identifier: "raise column")
raiseColumn?.width …
Run Code Online (Sandbox Code Playgroud)

nstableview nstablecolumn cocoa-bindings swift

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

使用 NSImageView 显示 GIF 图像

我想在我的 cocoa 应用程序中显示动画 gif 图像。

我将 gif 拖到 XCode 中的 Assets.xcassets 中。我希望 NSImageView 可以显示开箱即用的 gif,所以我尝试了以下代码。

let imageView = NSImageView(frame: NSRect(x: 0, y: 0, width: 512, height: 512))
imageView.canDrawSubviewsIntoLayer = true
imageView.imageScaling = .ScaleNone
imageView.animates = true
imageView.image = NSImage(named: "loading-animation")

window.contentView?.addSubview(imageView)
Run Code Online (Sandbox Code Playgroud)

图像不显示。上面的代码适用于 png 图像。我该如何让它发挥作用?

cocoa swift

5
推荐指数
3
解决办法
4293
查看次数