评论时我有这种不便.但我想知道你们会怎么做.假设您有以下代码:
/*Fancy function*/
function fancyFunction(){
echo "Oh yeah"
//200 more lines go here
}
Run Code Online (Sandbox Code Playgroud)
现在我想评论整个功能,你会这样做:
/*
/*Fancy function*/ <--Comment breaks here
function fancyFunction(){
echo "Oh yeah"
//200 more lines go here
}
*/
Run Code Online (Sandbox Code Playgroud)
你是怎么做这个xD的
我正在搞乱傅立叶变换.现在我已经创建了一个实现DFT实现的类(没有像FFT atm这样做).这是我用过的实现:
public static Complex[] Dft(double[] data)
{
int length = data.Length;
Complex[] result = new Complex[length];
for (int k = 1; k <= length; k++)
{
Complex c = Complex.Zero;
for (int n = 1; n <= length; n++)
{
c += Complex.FromPolarCoordinates(data[n-1], (-2 * Math.PI * n * k) / length);
}
result[k-1] = 1 / Math.Sqrt(length) * c;
}
return result;
}
Run Code Online (Sandbox Code Playgroud)
这些是我得到的结果 Dft({2,3,4})

好吧,看起来还不错,因为那些是我期望的值.我发现只有一件事令人困惑.这一切都与双打的四舍五入有关.
首先,为什么前两个数字不完全相同(0,8660..443 8)vs(0,8660..443).为什么它不能计算零,你期望它.我知道2.8E-15非常接近于零,但事实并非如此.
任何人都知道这些,边缘的错误是如何发生的,如果我能够并且想要对它做些什么.
似乎没有真正的问题,因为它只是小错误.但是,如果您要比较2个值,那么如何处理这些舍入误差.
5,2 + 0i != 5,1961524 …Run Code Online (Sandbox Code Playgroud) 我想知道我应该为此目的使用什么集合:
要求
<value1,value2><value1,value2> 等于 <value2,value1>这里最好用什么?
我想要一个检查以下内容的正则表达式:
有谁知道如何做到这一点?
我有一个ArrayList包含Attributes
class Attribute{
private int id;
public string getID(){
return this.id;
}
private string value;
public string getValue(){
return this.value;
}
//... more properties here...
}
Run Code Online (Sandbox Code Playgroud)
好吧,我用数百个属性填充了ArrayList.我想找到具有已定义ID的属性.我想做这样的事情:
ArrayList<Attribute> arr = new ArrayList<Attribute>();
fillList(arr); //Method that puts a lot of these Attributes in the list
arr.find(234); //Find the attribute with the ID 234;
Run Code Online (Sandbox Code Playgroud)
循环遍历ArrayList是唯一的解决方案.
我有这个界面
public interface TestInterface
{
[returntype] MethodHere();
}
public class test1 : TestInterface
{
string MethodHere(){
return "Bla";
}
}
public class test2 : TestInterface
{
int MethodHere(){
return 2;
}
}
Run Code Online (Sandbox Code Playgroud)
有没有办法让[returntype]动态?
我使用以下简单代码制作下拉菜单:
jQuery("#navigation li").hover(
function(){jQuery(this).children("ul").slideToggle("fast");},
function(){jQuery(this).children("ul").slideToggle("fast");
});
Run Code Online (Sandbox Code Playgroud)
但是当我#naviagtion li多次快速悬停时,它会保持slideToggling相同的次数.你怎么阻止这样做.
我在代码中弄乱了某种标志(isSliding)以查看它是否正在切换但是当我使用它时它看起来真的很麻烦.(我在开始滑动之前设置了标志,并且在回调中我再次将标志设置为false.在我调用函数之前,我只是有一个if(isSliding)声明.
c# ×2
java ×2
arraylist ×1
collections ×1
commenting ×1
double ×1
fft ×1
interface ×1
jquery ×1
member ×1
phone-number ×1
php ×1
regex ×1
search ×1
types ×1