在这篇文章中, Jonh Dvorak称Itanium是" 过去50年来最伟大的惨败之一 ".虽然他描述了过度乐观的市场预期和这个想法的戏剧性财务结果,但他没有深入探讨这一史诗失败的技术细节.我有机会与Itanium合作一段时间,我个人非常喜欢它的架构,与现代x86处理器架构相比,它是如此清晰,简单和直接......
那么它失败的技术原因是什么?在性能?与x86代码不兼容?编译器的复杂性?为什么这个"Itanic"下沉了?

我正在尝试使用jQuery ajax()调用我的'countries'控制器的'关税'动作,并以下列格式传递一个国家/地区名称:
/countries/tariff/countryname
Run Code Online (Sandbox Code Playgroud)
但是,使用以下代码(设置为GET),它将使用get ?添加来调用它:
/countries/tariff/?countryname
Run Code Online (Sandbox Code Playgroud)
这是代码:
$(document).ready(function(){
$('#CountriesIndexForm select').change(function(){
$.ajax({
type: "GET",
url: "/countries/tariff/",
data: escape($(this).val()),
success: function(html){
$(this).parent().next('div').html(html);
}
});
});
});
Run Code Online (Sandbox Code Playgroud)
我理解它,因为类型设置为GET,但有没有解决这个问题?
我有一个函数,给定一个文件名和目录路径,检查目录是否已经包含一个具有相同名称的文件,如果是这样,则返回一个修改过的文件名(通过在文件名的第一部分后附加一个数字).(get_filenames()函数是一个CodeIgniter帮助函数,它创建一个包含指定目录中所有文件名的数组.)
当我尝试打印出函数调用的返回结果时,我什么都没得到; 但是如果我在函数本身的else {}语句中打印$ new_filename,那么只需调用该函数(而不是打印它的值),它就可以了!
我需要返回函数中的值,而不是打印它,因为我实际上需要将结果分配给变量以进行进一步处理.(在下面的例子中,我刚刚打印了函数调用的结果来演示这一点.)
功能:
function avoid_conflicting_filenames($old_filename, $new_filename, $dir, $count)
{
$num = '';
if ($count > 0):
$num = $count;
endif;
$filename_arr = explode('.', $old_filename, -1);
$new_filename = $filename_arr[0] . $num . '.' . $filename_arr[1];
if (in_array($new_filename, get_filenames($dir))):
$count++;
avoid_conflicting_filenames($old_filename, $new_filename, $dir, $count);
else:
return $new_filename;
endif;
}
Run Code Online (Sandbox Code Playgroud)
我在哪里调用函数:
print avoid_conflicting_filenames('file.jpg', '', 'path/to/file', 0);
Run Code Online (Sandbox Code Playgroud)
这让我在过去的一天疯狂,所以任何帮助都将不胜感激!谢谢.
我正在一个字符串中进行一系列搜索,并且沿着该行的某个地方将丢失其中一个字符串,并且我的搜索集将失败.
我曾预料到,一旦位置达到std :: string :: npos,它就会留在那里,但事实并非如此.将std :: string :: npos传递给std :: string.find似乎再次开始搜索
std::string str("frederick");
std::string::size_type pos = str.find("der",std::string::npos);
TS_ASSERT_EQUALS(pos, std::string::npos); // FAIL, 3 is returned
Run Code Online (Sandbox Code Playgroud)
为什么不指示字符串的结尾?
更新:意图是按顺序搜索一系列字符串,并在结尾检查结果
pos = str.find(string1, pos)
pos = str.find(string2, pos)
pos = str.find(string3, pos)
if (pos != std:string::npos)
{ // All strings found
Run Code Online (Sandbox Code Playgroud) 当使用malloc并进行类似的内存操作时,我可以依赖sizeof(char)始终为1吗?
例如,我需要为N个元素类型分配内存char.是否sizeof( char )需要乘以:
char* buffer = malloc( N * sizeof( char ) );
Run Code Online (Sandbox Code Playgroud)
或者我可以依赖sizeof(char)始终为1并且只是跳过乘法
char* buffer = malloc( N );
Run Code Online (Sandbox Code Playgroud)
我完全理解sizeof在编译期间进行评估,然后编译器甚至可以编译出乘法,因此性能损失将是最小的并且很可能为零.
我主要询问代码清晰度和可移植性.这种乘法对于类型是否必要char?
有人可以说明我如何在谷歌应用引擎数据存储中存储和轻松查询分层数据?
我有一个MySQL数据库,其中包括英语和阿拉伯语的书籍标题,我使用的PHP类可以自动将阿拉伯语文本音译为拉丁文.
我希望我的输出HTML看起来像这样:
<h3>A book</h3>
<h3>???? <em>(kitaab)</em></h3>
<h3>Another book</h3>
Run Code Online (Sandbox Code Playgroud)
有没有办法让PHP根据其中使用的Unicode字符和字形确定字符串的语言?我想要得到这样的东西:
$Ar = new Arabic('EnTransliteration');
while ($item = mysql_fetch_array($results)) {
...
if (some test to see if $item['item_title'] has Arabic glyphs in it) {
echo "<h3>$item[item_title] <em>(" . $Ar->ar2en($item['item_title']) . ")</em></h3>";
} else {
echo "<h3>$item[item_title]</h3>";
}
...
}
Run Code Online (Sandbox Code Playgroud)
幸运的是,当输入拉丁字符时,类不会窒息,所以理论上我可以通过转换发送每个结果,但这似乎是浪费处理.
谢谢!
编辑: 我还没有找到检查字形或字符的方法.我想我可以将所有阿拉伯字符放在一个数组中,并检查数组中的任何内容是否与字符串的一部分匹配...
但是,我确实找到了一个可能最终工作正常的临时解决方案.无论语言如何,它都会通过转换放置每个标题,但只有在字符串发生更改时才输出括号音译:
while ($item = mysql_fetch_array($mysql_results)) {
$transliterate = trim(strtolower($Ar->ar2en($item['item_title'])));
$item_title = (strtolower($item['item_title']) == $transliterate) ? $item['item_title'] : $item['item_title'] . " <em>($transliterate)</em>";
echo "<h3>$item_title</h3>";
}
Run Code Online (Sandbox Code Playgroud) 我们开始在项目中更多地使用GWT,GWT编译器的性能变得越来越烦人.
我们将开始改变我们的工作实践来缓解这个问题,包括更加强调托管模式浏览器,这推迟了以后运行GWT编译器的需要,但这带来了自己的风险,特别是直到比我们想要的要晚得多,才能解决真正的浏览器问题.
理想情况下,我们想让GWT编译器本身更快 - 编译一个相当小的应用程序需要一分钟时间.但是,我们正在使用编译,如果一个相当天真的方式,所以我希望我们可以做一些快速和简单的收益.
我们目前正在从ant Ant目标调用com.google.gwt.dev.Compiler作为java应用程序,最大堆容量为256m,堆栈空间很大.Ant使用fork = true和最新的Java 6 JRE来启动编译器,以尝试利用Java6的改进性能.我们将主控制器类与应用程序类路径一起传递给编译器,然后关闭它.
我们还能做些什么来获得额外的速度?我们能否提供更多信息,以便花更少的时间来发现该怎么做?
我知道我们可以告诉它只为一个浏览器编译,但我们需要进行多浏览器测试,所以这不太实用.
此时欢迎所有建议.
在下面的代码中,我告诉ComboBox通过分配其ItemTemplate属性来使用名为CustomerTemplate的DataTemplate .
但是,StackPanel没有ItemTemplate属性.
如何让StackPanel也使用CustomerTemplate?
<Window.Resources>
<DataTemplate x:Key="CustomerTemplate">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding FirstName}"/>
<TextBlock Text=" "/>
<TextBlock Text="{Binding LastName}"/>
</StackPanel>
</DataTemplate>
</Window.Resources>
<DockPanel LastChildFill="False" Margin="10">
<ComboBox
x:Name="CustomerList"
ItemTemplate="{StaticResource CustomerTemplate}"
HorizontalAlignment="Left"
DockPanel.Dock="Top"
Width="200"
SelectedItem="{Binding SelectedCustomer, Mode=TwoWay}"
ItemsSource="{Binding Customers}"/>
<StackPanel DataContext="{Binding SelectedCustomer}" Orientation="Horizontal">
<TextBlock Text="Chosen: "/>
<TextBlock Text="{Binding LastName}"/>
</StackPanel>
</DockPanel>
Run Code Online (Sandbox Code Playgroud)