有谁知道任何库/代码将使我能够编码和解码.tar格式的数据 - 我可以在我的iPhone项目中使用(最好是可可)
提前致谢
克雷格
更新:我已经看了一下建议的库并得出结论,他们正在解决大部分问题 - 所以我自己开发编解码器 - 毕竟它只是一个512字节的ASCII标头 - 它有多难是:-)
我在C#中有许多方法可以返回我希望测试的各种集合.我想尽可能少地使用测试API - 性能并不重要.一个典型的例子是:
HashSet<string> actualSet = MyCreateSet();
string[] expectedArray = new string[]{"a", "c", "b"};
MyAssertAreEqual(expectedArray, actualSet);
Run Code Online (Sandbox Code Playgroud)
// ...
void MyAssertAreEqual(string[] expected, HashSet<string> actual)
{
HashSet<string> expectedSet = new HashSet<string>();
foreach {string e in expected)
{
expectedSet.Add(e);
}
Assert.IsTrue(expectedSet.Equals(actualSet));
}
Run Code Online (Sandbox Code Playgroud)
我必须根据集合是否是数组,列表,ICollections等来编写许多签名.是否存在简化此操作的转换(例如,将数组转换为Set?).
我还需要为自己的课程这样做.我已经为他们实现了HashCode和Equals.它们(主要)是(比如)MySuperClass的子类.是否可以实现该功能:
void MyAssertAreEqual(IEnumerable<MySuperClass> expected,
IEnumerable<MySuperClass> actual);
Run Code Online (Sandbox Code Playgroud)
这样我可以打电话:
IEnumerable<MyClassA> expected = ...;
IEnumerable<MyClassA> actual = ...;
MyAssertAreEqual(expected, actual);
Run Code Online (Sandbox Code Playgroud)
而不是为每个班级写这个
我有以下场景:
在我的主页中,我有:
$(".datepicker").datepicker({
changeYear: true,
changeMonth: true,
dateFormat: "dd/mm/yy",
duration: 'fast'
});
Run Code Online (Sandbox Code Playgroud)
有了这个,我将类"datepicker"分配给的每个输入字段在单击时显示jquery UI datepicker.
现在我在页面上有一个应该处理"onSelect"事件的日期选择器.这样做的最佳做法是什么?
我看到的选项:
我知道你可以使用inline关键字,或者只是将一个方法放在类声明ala short ctor或getter方法中,但编译器是否最终决定何时内联我的方法?
例如:
inline void Foo::vLongBar()
{
//several function calls and lines of code
}
Run Code Online (Sandbox Code Playgroud)
如果编译器认为它会使我的代码效率低下,它会忽略我的内联声明吗?
作为一个副作用,如果我在我的类之外声明了一个getter方法,如下所示:
void Foo::bar() { std::cout << "baz"; }
Run Code Online (Sandbox Code Playgroud)
编译器是否会在内幕中内联这个内容?
我有以下幻灯片对象列表.根据对象'type'var的值,我想在列表中向上转换Slide对象.可能吗?
foreach(Slide slide in slidePack.slides)
{
if(slide.type == SlideType.SECTION_MARKER)
{
//upcast Slide to Section
}
}
Run Code Online (Sandbox Code Playgroud)
Section扩展Slide并添加一个参数.
我试图让我的应用程序的根路由到路由到默认控制器.从我读到的内容来看,这应该可以在我的routes.rb文件的底部使用类似的东西:
map.root :controller => 'albums'
Run Code Online (Sandbox Code Playgroud)
或者甚至是:
map.home '', :controller => 'albums'
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试导航到http:// myhost:8000 /时,我只看到rails欢迎页面.在对routes.rb进行更改之后和测试之前,我使用以下命令重新启动应用程序:
sudo mongrel_cluster_ctl restart
Run Code Online (Sandbox Code Playgroud)
以下是一些可能相关的环境信息:
% rails -v
Rails 2.3.3
% ruby -v
ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]
Run Code Online (Sandbox Code Playgroud)
我确信我错过了一些简单的东西,但我看不出它是什么.有任何想法吗?
我的代码中的瓶颈部分存在性能问题.基本上它是一个简单的嵌套循环.
对问题进行概要分析表明,该程序花费了大量时间来增加循环计数器(++)和终止测试(i/j <8).
观察汇编输出我发现两个计数器都没有得到寄存器,访问它们需要花费很多周期.使用"register"关键字并不能说服编译器将它们实际放入寄存器中.是否可以采取一些措施来优化计数器的访问时间?
这是装配输出.C源只是一个带有i/j计数器的简单嵌套循环.
2738 0.2479 2459 0.1707 : 1e6c: jne 1dd1 <process_hooks+0x121>
1041 0.0942 1120 0.0778 : 1e72: addl $0x1,0xffffffd4(%ebp)
2130 0.1928 2102 0.1459 : 1e76: cmpl $0x8,0xffffffd4(%ebp)
2654 0.2403 2337 0.1622 : 1e7a: jne 1da0 <process_hooks+0xf0>
809 0.0732 814 0.0565 : 1e80: jmp 1ce2 <process_hooks+0x32>
Run Code Online (Sandbox Code Playgroud)
根据要求,这里也是C代码.编译器是gcc btw:
for (byte_index=0; byte_index < MASK_SIZE / NBBY; byte_index++)
{
if (check_byte(mask,byte_index))
{
for (bit_index=0; bit_index < NBBY; bit_index++)
{
condition_index = byte_index*NBBY + bit_index;
if (check_bit(condition_mask,condition_index))
{
.
.
. …Run Code Online (Sandbox Code Playgroud) 我们需要使用Javascript清除IE中的身份验证缓存.在IE6上我们使用:document.execCommand('ClearAuthenticationCache');它可以工作.在IE7上它不起作用.
我能做什么?谢谢...
我需要通过Windows应用程序(C#)检索我可以访问的所有SharePoint站点的列表.我打算使用SharePoint Web服务.
使用SharePoint Web服务的任何指针都可以为我提供所需的信息?
c# ×3
.net ×1
archive ×1
c ×1
c++ ×1
cocoa-touch ×1
collections ×1
datepicker ×1
events ×1
iphone ×1
java ×1
javascript ×1
jquery ×1
jquery-ui ×1
optimization ×1
ruby ×1
sharepoint ×1
tar ×1
uidatepicker ×1
unit-testing ×1