当它们是你(或同事)的错误时,错误可能很难解决.但是,我们都知道,我们用于实施程序的技术是由像我们这样的绝对正确的人编写的.因此,有些人在实施他们使用的工具时遇到了一些错误.
那么,您是否在程序中发现了一个由广泛的底层技术(如编程语言或框架)引起的错误?如果是这样,它是否因某些迹象而失败,或是否以静默方式覆盖某些数据?调试有多难?它是否会导致潜在的安全漏洞?您是否可以联系提供商并确认已修复(或自行修复)?
以下是一些最糟糕的(在我看来)有一个bug的技术(尤其是一个无声地失败的技术):
我听到很多关于couchdb的内容,但在阅读了一些关于它的文档之后,我仍然不明白为什么要使用它以及如何使用它.
你能为我澄清一下这个谜吗?
我有一个未分类的链表.为了对它进行排序,我想我会将值放入一个带有比较器的TreeSet中,然后将这些值作为新的链表返回.然而,它失败了.
比较:
public class SortSpeciesByCommonName implements Comparator<Species> {
/**
* a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
*/
@Override
public int compare(Species arg0, Species arg1) {
return arg0.getName().compareTo(arg1.getName()); //arg.getName() is String
}
}
Run Code Online (Sandbox Code Playgroud)
排序功能:
public static LinkedList<Species> sortedAnimals(LinkedList<Species> animals) {
TreeSet<Species> sortedBreeds = new TreeSet<Species>(new SortSpeciesByCommonName());
sortedBreeds.addAll(animals);
return new LinkedList<Species>(sortedBreeds);
}
Run Code Online (Sandbox Code Playgroud)
测试值时,一切似乎仍处于插入顺序.
注意:这与其他问题类似,但不完全相同
我已经实现了一个IBusinessCollection界面.它既来自两者ICollection<T>,又来自旧的非泛型ICollection.我更喜欢抛弃旧的破坏ICollection,但我正在使用带有CollectionView的WPF数据绑定,它希望我实现旧的非泛型IList:-(
无论如何,接口看起来像这样:
public interface IBusinessCollection<T> : ICollection<T>, ICollection
{ }
public interface ICollection<T>
{ int Count { get; } }
public interface ICollection
{ int Count { get; } }
Run Code Online (Sandbox Code Playgroud)
由于使用依赖注入,我IBusinessCollection<T>使用它们的接口传递类型的对象,而不是具体的类型,所以我有这样的东西:
internal class AnonymousCollection : IBusinessCollection<string>
{
public int Count { get { return 5; } }
}
public class Factory
{
public static IBusinessCollection<string> Get()
{ return new AnonymousCollection(); }
}
Run Code Online (Sandbox Code Playgroud)
当我尝试调用此代码时,出现错误,如下所示: …
是否有任何内置或第三方库允许您在运行时简单地将所有变量转储到内存中?我想要的是能够查看变量和当前值,类似于通过点击断点并将鼠标悬停在变量上来查看变量和当前值,但实际上不必停止程序执行(即只是获取快照).如果它可以将它们转储到一个文件然后可以在程序中打开以获得一个很好的GUI界面来查看它们会很好,但是简单的文本文件转储就足够了.
在我的代码中,我有一个Student对象的向量.
vector<Student> m_students;
Run Code Online (Sandbox Code Playgroud)
我想要:
请考虑以下代码:
// Check to see if the Student already exists.
Student* targetStudent = NULL;
for each (Student student in m_students)
{
if (student.Name() == strName)
{
targetStudent = &student;
break;
}
}
// If the Student didn't exist, add it.
if (targetStudent == NULL)
{
targetStudent = new Student(strName);
m_students.push_back(*targetStudent);
}
// Add the course info to the Student.
targetStudent->Add(strQuarter, strCourse, strCredits, strGrade);
Run Code Online (Sandbox Code Playgroud)
当我调用m_students.push_back(*targetStudent);它时,似乎向量"m_students"最终得到了"targetStudent"当时指向的Student对象的副本.
后续尝试添加到targetStudent不会更改向量中包含的对象.
我怎样才能从指向对象的指针开始,将该对象添加到向量中,然后访问向量中的对象?
我是 PEAR::Mail 的新手,我正在寻找可以教我如何发送批量邮件(10K+ 电子邮件)的教程。“在 php 中使用 mail() 效率不高,因为它打开和关闭 smtp 套接字”,这是我从互联网资源中读到的内容(现在找不到链接,grrr)。
因此,我正在考虑手动执行此操作并使用可用于 PHP 的邮件库,并且我发现了这个 PEAR:Mail。在PEAR网站本身上,有“发送多个收件人”简单教程,所有收件人将被插入到一个数组中,然后发送。这是发送 10k++ 邮件的方式吗?我记得有一个叫做“邮件队列”的东西,但真的不知道如何在 PEAR:Mail 中使用它,有人可以帮助我吗?
我不认为 Facebook 会使用 for 循环来发送批量电子邮件(通知),对吗?(嗯,这就是我的想法)
请看一下这个截图
替代文字http://www.maclife.com/files/u18/Yep3-big.jpg
我认为这些是'标签面板'的主要特征:
1)面板上的每个标签都是独立控件,可以单击
2)当没有足够的空间显示当前行中的下一个标记时自动换行.
3)每个标签的圆角矩形边框是一个很好的功能.
我想在Delphi中实现类似的功能,是否有现成的控件来执行此操作?如果没有,实施这种控制的最佳方法是什么?
谢谢.
我有一个textarea ...
<textarea>
Some writing here
*
Then some more on another line
</textarea>
Run Code Online (Sandbox Code Playgroud)
我想要做的是将用户聚焦在*所在的位置.这可能吗?
鉴于方法:
internal static DataSet SelectDataSet(String commandText, DataBaseEnum dataBase)
{
var dataset = new DataSet();
SqlConnection sqlc = dataBase == DataBaseEnum.ZipCodeDb
? new SqlConnection(ConfigurationManager.AppSettings["ZipcodeDB"])
: new SqlConnection(ConfigurationManager.AppSettings["WeatherDB"]);
SqlCommand sqlcmd = sqlc.CreateCommand();
sqlcmd.CommandText = commandText;
var adapter = new SqlDataAdapter(sqlcmd.CommandText, sqlc);
adapter.Fill(dataset);
return dataset;
}
Run Code Online (Sandbox Code Playgroud)
为什么sqlc(SqlConnection)在调用方法超出范围后没有处理/关闭,或者sqlc没有更多的引用?
编辑1: 即使将其包装在使用中,我仍然可以看到连接使用(我已关闭连接池):
SELECT DB_NAME(dbid) as 'Database Name',
COUNT(dbid) as 'Total Connections'
FROM sys.sysprocesses WITH (nolock)
WHERE dbid > 0
GROUP BY dbid
Run Code Online (Sandbox Code Playgroud)
编辑2: 在我从这里得到的帮助下进行一些调试 - 答案是有人硬编码连接字符串与池.感谢所有的帮助 - 如果可以的话,我会将所有回复标记为答案.
c# ×3
asp.net ×1
bulk ×1
c++ ×1
comparator ×1
couchdb ×1
database ×1
debugging ×1
delphi ×1
dump ×1
email ×1
focus ×1
frameworks ×1
generics ×1
icollection ×1
idisposable ×1
java ×1
javascript ×1
linked-list ×1
php ×1
pointers ×1
runtime ×1
schemaless ×1
send ×1
sorting ×1
static ×1
tagging ×1
treeset ×1
variables ×1
vector ×1