问题列表 - 第41736页

有没有办法使用Netbeans和Github,同步它们

有没有办法使用Netbeans和Github,同步它们

Netbeans的Github插件或其他东西

netbeans github

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

如何在Sqlite 3.7.4中使ON DELETE CASCADE工作?

我多次检查了功能列表,似乎级联应该可以工作.当我执行这个python脚本时:

#!/usr/bin/env python3
import sqlite3

print(sqlite3.sqlite_version)

con = sqlite3.connect(':memory:')

a = "create table a (id integer primary key, name text)"
con.execute(a)

b = "create table b (id integer primary key, r integer, foreign key(r) references a(id) on delete cascade)"
con.execute(b)
con.commit()

a = "insert into a (name) values (\"abc\")"
con.execute(a)
con.commit()

print(con.execute("select * from a").fetchall())

a = "insert into b (r) values (1)"
con.execute(a)
con.commit()

print(con.execute("select * from b").fetchall())

a = "delete from a where id=1"
con.execute(a)
con.commit()

print(con.execute("select * …
Run Code Online (Sandbox Code Playgroud)

python sql sqlite

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

有效地将矩阵值复制到新矩阵

是否有一种有效的内置方法将值从一个矩阵(例如double[,])复制到另一个矩阵?

换句话说,我正在寻找以下功能的替代品:

    public static double[,]CloneMatrix(double[,] aMatrix)
    {
        var newMatrix = new double[aMatrix.GetLength(0),aMatrix.GetLength(1)];
        for (int i = 0; i < aMatrix.GetLength(0); i++)
        {
            for (int j = 0; j < aMatrix.GetLength(1); j++)
            {
                newMatrix[i, j] = aMatrix[i, j];
            }
        }
        return newMatrix;

    }
Run Code Online (Sandbox Code Playgroud)

c# matrix

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

在Java中创建数独

我正在创建一个程序来发明一个新的数独谜题.我最初计划这样做的方法是发明一个新的谜题,然后删除随机数.但是,我使用(见下文)创建新拼图的算法最多可能需要5分钟才能完成.有没有人有更快的解决方案?

创建算法


    for (int x = 0; x < boardWidth; x++) //boardWidth is the number of fillable squares wide and high the board is. (9 for a standard Sudoku board)
    {
      for (int y = 0; y < boardWidth; y++)
      {
        int errorCount = 0;
        do
        {
          boardVals[y][x] = (byte)(rand.nextInt(boardWidth) + 1);
          errorCount++;
          if (errorCount > Math.pow(boardWidth, 4)) //If the square has been tried to be filled up to boardWidth^4 times (6,561 for a standard Sudoku board), it clears the …
Run Code Online (Sandbox Code Playgroud)

java creation sudoku

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

for-loop optimization - 需要与否?

我是否必须像下面那样优化我的FOR循环,否则编译器会为我做这个?

//this is slow, right?
for (int i = 0; i < menuItem.DropDownItems.Count; i++)
{
    ...
}

//this should be much faster right?
for (int i = 0, count = menuItem.DropDownItems.Count; i < count; i++)
{
    ...
}
Run Code Online (Sandbox Code Playgroud)

PS.我打赌这已经发布但我没有找到任何东西,抱歉可能有重复.

PPS.对不起,我编写了很多JavaScript代码 - 我们必须考虑这些优化......在.net-world中可能看起来很荒谬.

c# optimization for-loop

17
推荐指数
1
解决办法
2051
查看次数

UIViewController的presentModalViewController:animated:保留模态控制器吗?

这对我与模态控制器的交互方式有影响.当我第一次开始iOS开发时,我认为UIViewController 没有保留模态呈现的视图.嗯,真的更像是我没有理由认为它确实保留了它们.当我知道他们将完成他们的解雇动画时,这让我发布了相当尴尬的尝试:

_myViewController = [[UIViewController alloc] init];
[self. present modalViewController:_myViewController animated:YES];
/* 
Some stuff, then in a different method all together,
probably as the result of a delegate callback or something...
*/
[self dismissModalViewControllerAnimiated:YES];
[_myViewController performSelector:@selector(release) withObject:nil afterDelay:0.5f];
Run Code Online (Sandbox Code Playgroud)

然后,我看到了它的modalViewController属性,UIViewController并且想:"伙计,我希望它在呈现模态视图控制器时保留该属性." 果然,我记录了其中几次尝试的保留计数,并注意到在调用之后立即增加presentModalViewController:animated:(我知道,保留计数不是一个完美的指标).所以,沿着这条线的某个地方,我已经开始使用一个更好的模式,我假设我以模态方式呈现的任何控制器对象都由呈现控制器保留.这让我可以编写标准的现有代码:

UIViewController* myViewController = [[UIViewController alloc] init];
[self presentModalViewController:myViewController animated:YES];
[myViewController release]; // <- Fire and forget!
Run Code Online (Sandbox Code Playgroud)

当然,现在没有尴尬:没有必要等待动画完成,或者如果我不需要它,甚至可以保持对所呈现的控制器的引用.我可以稍后盲目解雇,不要担心漏水.我喜欢.

我在模态呈现控制器记录许多dealloc中,他们始终能精确地叫时,我想,这使我觉得我的做法充满信心:UIViewControllerpresentModalViewController:animated:保留所提出的控制器的modalViewController性能.

但是,这是这个问题的核心,我意识到我无法证实这是记录在案的行为.如果没有记录,我不应该感觉像我一样安全,因为Apple没有对未记载行为的长寿做出承诺.该modalViewController属性是公开的readonly …

iphone objective-c uiviewcontroller ipad

11
推荐指数
1
解决办法
8714
查看次数

如何获得没有\n\t的字符串?

在对象-c中,我得到一个字符串,如"\n \n\t \n\t\t\t\t\t\t\tstst; stst http://www.stackoverflow.com ",但我想要的是字符串"http://www.stackoverflow.com ",怎么弄明白?

objective-c

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

有没有办法将ActiveRecord对象导出到seeds.rb?

是否可以从数据库导出数据,或运行Person.find(1).to_seed之类的东西,并将控制台的输出复制到seeds.rb文件中?

activerecord ruby-on-rails

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

QBasic语言规范

我被朋友挑战在QBasic中编写QBasic编译器.

我在哪里可以找到最新版本语言的语言规范?

specifications basic qbasic

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

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