我是 Git 新手,这是我第一个使用 Git 而不是 SVN 作为源代码管理的项目。我正在使用 XCode 开发 iPhone 项目。我希望 Git 忽略构建目录,该目录位于 XCode 项目的根文件夹中。我在这里发现了其他几个问题,还在 google 上找到了文章,其中提供了有关如何在根目录中创建 .gitignore 文件,然后将其添加到 Git 存储库以获取要忽略的目录的示例。
以下是我在设置存储库时采取的步骤:
git init初始化存储库git add .gitignore添加gitignore文件git commit -m提交 gitignore 文件git status查看存储库状态此时,除了构建目录之外,我的 gitignore 文件中列出的所有其他目录和文件都被正确忽略。这是我的 gitignore 文件的样子:
build/
.DS_Store
**/*.pbxuser
*.mode2v3
*.mode1v3
**/*.perspectivev*
Run Code Online (Sandbox Code Playgroud)
我尝试使用以下不同的条目忽略构建目录,但没有成功:
有人知道我在这里做错了什么吗?
这个问题看起来很熟悉:https://stackoverflow.com/questions/2187/essential-programming-tools,但我想专注于.NET编程.除了Windows和Visual Studio之外,您每天都需要哪些工具来完成工作?免费的开源代码工具是首选:)
我一直在使用这些工具:
我应该知道和使用哪些其他工具?
如何在WP7上创建类似于XBox Live Tile的动画图块?一般动画拼贴有哪些选项?
我有代码从MySQL数据库中检索有关玩家的信息.如果排名发生变化,我想在HTML输出中应用特殊情况.我希望它看起来像这样:http://i27.tinypic.com/f406tz.png
但我不能让它像我想要的那样,而是在每一行打印排名:
$old_rank = '';
while ($g = mysql_fetch_object($q)) {
if ($g->rankname != $old_rank) {
echo "<tr><td>$g->rankname</td>\n";
$old_rank = "<tr><td> </td>\n";
}
echo " <td>$g->name</td></tr>\n";
}
Run Code Online (Sandbox Code Playgroud)
我想要的是:
<tr>
<td>One</td>
<td>Kraven the Hunter</td>
</tr>
<tr>
<td> </td>
<td>Kull the Conqueror</td>
</tr>
<tr>
<td> </td>
<td>Zazi The Beast</td>
</tr>
<tr>
<td>Vice-leader</td>
<td>Igos du Ikana</td>
</tr>
<tr>
<td> </td>
<td>Saint Sinner</td>
</tr>
<tr>
<td> </td>
<td>Midvalley the Hornfreak</td>
</tr>.......................
Run Code Online (Sandbox Code Playgroud)
我得到了什么:
<tr><td>One</td>
<td>Tester</td></tr>
<tr><td>One</td>
<td>Kraven the Hunter</td></tr>
<tr><td>One</td>
<td>Kull the Conqueror</td></tr>
<tr><td>One</td>
<td>Zazi The Beast</td></tr>
<tr><td>Vice-Leader</td> …Run Code Online (Sandbox Code Playgroud) 我在for循环中调用了数百万次的代码,检查传递的参数是否是double.NaN.我描述了我的应用程序,其中一个瓶颈就是这个简单的功能:
public void DoSomething(double[] args)
{
for(int i = 0; i < args.Length;i++)
{
if(double.IsNan(args[i]))
{
//Do something
}
}
}
Run Code Online (Sandbox Code Playgroud)
即使我无法更改内部的代码,我可以优化它if吗?
我把hibernate注释放在哪里?
它是我的实例变量之上的行吗?或者在吸气器之前?或者在二传手之前?或者它真的不重要吗?
非常感谢
我已经看到很多关于如何将图像添加到模拟器的问题,并且看到了两个答案:
两者都适用于iOS SDK 4.0之前的所有功能.那些相同的方法对我来说不再适用,也不适用于我见过的其他人.我试图使用我在某处找到的以下代码块手动将图像写入照片库:
- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo{
UIAlertView *alert;
if (error) // Unable to save the image
alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:@"Unable to save image to Photo Album."
delegate:self cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
else // All is well
alert = [[UIAlertView alloc] initWithTitle:@"Success"
message:@"Image saved to Photo Album."
delegate:self cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alert show];
[alert release];
}
Run Code Online (Sandbox Code Playgroud)
但每次都会出错.那么模拟器的写访问是一个问题吗?还是只是一些bug?我已经更新到iOS 4.1 SDK,希望它被修复,但事实并非如此.
我正在尝试采用我编写的Perl程序并对其进行处理.问题是我读到一些模块不是"线程安全的".我如何知道模块是否是线程安全的?我环顾四周找不到一个清单.
为了测试我经常使用的一个模块(Text :: CSV_XS),我尝试了以下代码:
use strict;
use warnings;
use threads;
use threads::shared;
require Text::CSV_XS;
my $CSV = Text::CSV_XS->new ({ binary => 1, eol => "\n" }) or die("Cannot use CSV: ".Text::CSV->error_diag());
open my $OUTPUT , ">:encoding(utf8)", "test.csv" or die("test.csv: $!");
share($CSV);
my $thr1 = threads->create(\&sayHello('1'));
my $thr2 = threads->create(\&sayHello('2'));
my $thr3 = threads->create(\&sayHello('3'));
sub sayHello
{
my($num) = @_;
print("Hello thread number: $num\n");
my @row = ($num);
lock($CSV);{
$CSV->print($OUTPUT, \@row);
$OUTPUT->autoflush(1);
}#lock
}#sayHello
Run Code Online (Sandbox Code Playgroud)
我收到的输出如下:
Hello thread number: 1 Segmentation fault …
我正在使用web.py中的一个小型web应用程序,并且正在设置一个url来返回一个JSON对象.使用python将SQL表转换为JSON的最佳方法是什么?
版本控制菜鸟警报
我已经在Visual Studio 2010中安装了Mercurial,TortoiseHg和VisualHG.我已经在Visual Studio中设置了我的源代码控制到Mercurial.
当我右键单击我的解决方案时,我已经在那里出现的上下文菜单中看到了HG的按钮.
我现在的问题是,如何使这个版本控制工作?看来我之前必须进行某种配置,因为当我点击"HG Status"时它告诉我"解决方案不在Mercurial版本控制之下".
谢谢