我知道ArrayList可能不适合这种特殊情况,但幽默我并帮助我失去了这个头痛.
我有一个构造函数类,如下所示:
class Peoples
{
public string LastName;
public string FirstName;
public Peoples(string lastName, string firstName)
{
LastName = lastName;
FirstName = firstName;
}
}
Run Code Online (Sandbox Code Playgroud)
我正在尝试构建一个ArrayList来通过调用这个构造函数来构建一个集合.但是,当我使用这个构造函数时,我似乎无法找到正确构建ArrayList的方法.我已经用数组找出它,但不是ArrayList.
我一直在搞乱这个尝试构建我的ArrayList:
ArrayList people = new ArrayList();
people[0] = new Peoples("Bar", "Foo");
people[1] = new Peoples("Quirk", "Baz");
people[2] = new Peopls("Get", "Gad");
Run Code Online (Sandbox Code Playgroud)
根据我得到的例外,我的索引显然超出了范围.
我正在尝试相互显示两个网站的内容,有人建议我使用 RSS 阅读器,但我的问题是:
除了使用 rss 之外,我还有什么可以尝试显示内容!?
我以为我可以连接到另一个网站的数据库,但这不起作用/
提前致谢
快速问题,Kohana(版本3)是否自动转义传递到ORM :: factory .....的数据(以及与数据库有关的其他任何地方)?
例如:
$thread = ORM::factory('thread', $this->request->param('id'));
Run Code Online (Sandbox Code Playgroud)
在第二个参数中传递的数据是否会在进入SQL查询之前自动转义,还是我必须手动执行?可能是一个愚蠢的问题,最好是安全而不是抱歉,但是...我通常会手动逃避数据,但我想知道Kohana是否为我做了这个?
谢谢
我需要扩展实例的行为,但我无法访问该实例的原始源代码.例如:
/* I don't have the source code for this class, only the runtime instance */
Class AB
{
public void execute();
}
Run Code Online (Sandbox Code Playgroud)
在我的代码中,我会截取每个执行调用,计算一些sutff然后调用原始执行,类似于
/* This is how I would like to modify the method invokation */
SomeType m_OrgExecute;
{
AB a = new AB();
m_OrgExecute = GetByReflection( a.execute );
a.execute = MyExecute;
}
void MyExecute()
{
System.Console.Writeln( "In MyExecute" );
m_OrgExecute();
}
Run Code Online (Sandbox Code Playgroud)
那可能吗?
有没有人有这个问题的解决方案?
IEnumerable<fishbiscuits> a = GetFishBiscuits(0);
IEnumerable<fishbiscuits> b = GetFishBiscuits(1);
if ([any of the results in either list match])
{
// Do something ie
Console.WriteLine("I see both a and b love at least one of the same type of fish biscuit!");
}
Run Code Online (Sandbox Code Playgroud)
你能使用linq来查看两个IEnumerables数据是否包含任何公共条目?
我需要(数值地)计算函数的一阶和二阶导数,我试图使用这两个函数splrep并UnivariateSpline创建样条函数,以便插入函数来获取导数.
然而,对于大小为10 ^ -1或更低并且(快速)振荡的函数,似乎在样条表示本身存在固有问题.
例如,考虑以下代码在区间(0,6*pi)上创建正弦函数的样条曲线表示(因此函数仅振荡三次):
import scipy
from scipy import interpolate
import numpy
from numpy import linspace
import math
from math import sin
k = linspace(0, 6.*pi, num=10000) #interval (0,6*pi) in 10'000 steps
y=[]
A = 1.e0 # Amplitude of sine function
for i in range(len(k)):
y.append(A*sin(k[i]))
tck =interpolate.UnivariateSpline(x, y, w=None, bbox=[None, None], k=5, s=2)
M=tck(k)
Run Code Online (Sandbox Code Playgroud)
下面是M的结果,A = 1.e0,A = 1.e-2
http://i.imgur.com/uEIxq.png幅度= 1
http://i.imgur.com/zFfK0.png振幅= 1/100
很明显,样条函数创建的插值函数完全不正确!第二个图甚至没有振荡正确的频率.
有没有人对这个问题有任何见解?或者知道在numpy/scipy中创建样条曲线的另一种方法?
干杯,罗里
我对trim方法有一个非常奇怪的问题.我正在尝试修剪从数据库收到的字符串.这是我目前的方法:
string debug = row["PLC_ADDR1_RESULT"].ToString();
SPCFileLog.WriteToLog(String.Format("Debug: ${0}${1}",debug,Environment.NewLine));
debug = debug.Trim();
SPCFileLog.WriteToLog(String.Format("Debug2: ${0}${1}", debug, Environment.NewLine));
debug = debug.Replace(" ", "");
SPCFileLog.WriteToLog(String.Format("Debug3: ${0}${1}", debug, Environment.NewLine));
Run Code Online (Sandbox Code Playgroud)
它产生如下文件输出:
Debug: $ $
Debug2: $ $
Debug3: $ $
Run Code Online (Sandbox Code Playgroud)
检查文件中的十六进制代码揭示了一些有趣的东西 假设为空的空格不是十六进制20(空格),但它们被设置为00(null?)
我们的数据库如何包含这样的数据是另一个谜,但无论如何,我需要修剪那些无效的(?)空字符.我怎样才能做到这一点?
我在sass文件中有一些行:
.menu
ul
xx: xx
li
xx: xx
a
xx: xx
.others
xx: xx
Run Code Online (Sandbox Code Playgroud)
如果我想将整个.menu部分向右移动一个宽度的标签,我应该使用7>>.这太无聊了,我必须算一下有多少行.menu.
有没有简单的方法来做到这一点?我的意思是,同时移动节点及其子节点
我正在开发一个WPF应用程序,其中许多UI控件同时呈现并且它减慢了动画等等.有什么方法可以阻止它吗?
那就是问题,是不是有任何编程语言2+3*5不是17?我发现这个问题是对我的教师的一个旧考验,引起了我的注意.没什么大不了的,但我有点怀疑.一个加号将是为什么不?
syntax programming-languages compilation operators expression-trees
.net ×5
c# ×4
database ×2
php ×2
arraylist ×1
compilation ×1
constructor ×1
ienumerable ×1
kohana-3 ×1
linq ×1
math ×1
operators ×1
performance ×1
python ×1
runtime ×1
scipy ×1
security ×1
sql ×1
sql-server ×1
syndication ×1
syntax ×1
vim ×1
wpf ×1