我有以下问题,我在数组中生成了站点地图的网址。所以数组有 60000 个条目。谷歌希望我创建 2 个站点地图,因为每个站点地图的限制为 50000 个条目。
我怎样才能用 php 做到这一点?我尝试过,但是循环停止并在其他文件中输入其他数据时遇到问题。到目前为止,这是我的代码。
// $data is array with the urls
$count_array = count($data);
$maxlinksinsitemap = 50000;
$numbersofsitemap = ceil($count_array / $maxlinksinsitemap);
for($i = 1; $i <= $numbersofsitemap; $i++) {
$cfile = "sitemap_" .$i . ".xml";
$createfile = fopen($cfile, 'w');
$creat = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
$creat .= "<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"\n";
$creat .= "xmlns:image=\"http://www.sitemaps.org/schemas/sitemap-image/1.1\"\n";
$creat .= "xmlns:video=\"http://www.sitemaps.org/schemas/sitemap-video/1.1\">\n";
$creat .= "<url>\n";
$creat .= "<loc>http://www.urltosite.com</loc>\n";
$creat .= "<priority>1.00</priority>\n";
$creat .= "</url>\n";
$creat .= "</urlset>";
fwrite($createfile, $creat);
fclose($createfile);
} …Run Code Online (Sandbox Code Playgroud) 考虑以下测试用例:
{ CompilerVersion = 21 }
procedure Global();
procedure Local();
begin
end;
type
TProcedure = procedure ();
var
Proc: TProcedure;
begin
Proc := Local; { E2094 Local procedure/function 'Local' assigned to procedure variable }
end;
Run Code Online (Sandbox Code Playgroud)
在第13行,编译器发出具有ERROR级别的消息,禁止所有这种本地过程使用的情况."官方"决议是将Local符号推广到外部范围(即:使其成为兄弟姐妹Global),这将对代码"结构性"产生负面影响.
我正在寻找以最优雅的方式规避它的方法,最好使编译器发出警告级别的消息.
我正在寻找一个与Amazon S3一起使用的优秀Django自定义存储后端.
我一直在谷歌搜索,发现很多博客文章的代码片段或半生不熟的gist.github.com一次性工作.但我似乎无法找到一个坚实的,经过良好测试的.
是否有一个被广泛接受的标准Amazon S3 Django定制存储后端那里?它并不特别重要,我什么Python的后端库,它使用-也就是说,无论是S3.py或boto有细.
我只使用jQuery的fadeIn和fadeOut,我不想加载整个jQuery.有没有办法删除其他功能?我知道jquery的缩小版本非常小,但在我的情况下1KB很重要.
我正在创建一个layout并在顶部对齐的标题,底部对齐的页脚,并希望视图占用中间的所有剩余可用空间.
如果没有明确地将高度属性传递给每个视图,我该怎么做?
我的实际XML是:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent"
orientation="vertical">
<ImageView
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/library_header"
android:scaleType="fitXY" />
<ViewFlipper
android:id="@+id/content"
android:layout_height="0dip"
android:layout_width="match_parent"
android:layout_weight="1.0" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="44px"
android:layout_alignParentBottom="true"
android:background="@drawable/library_footer">
<Button
android:id="@+id/l_coverflow"
android:layout_width="44px"
android:layout_height="34px"
android:background="@drawable/library_coverflow_deselected"
android:layout_gravity="center" android:layout_marginLeft="12px" />
<Button
android:id="@+id/l_grid"
android:layout_width="36px"
android:layout_height="32px"
android:background="@drawable/library_grid_deselected"
android:layout_marginLeft="12px"
android:layout_gravity="center"
android:paddingLeft="10px" />
<Button
android:id="@+id/l_list"
android:layout_width="40px"
android:layout_height="32px"
android:background="@drawable/library_list_deselected"
android:layout_marginLeft="12px"
android:layout_gravity="center" />
</LinearLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud) 我有各种2D向量,我想在运行时查询它们的不同类型.
看来这可能在"空"向量上,例如:
vector<vector<float> > myVec;
cout << (typeid(myVec[0][0]).name() << endl;
Run Code Online (Sandbox Code Playgroud)
上面返回"浮动",虽然我期待一个例外,因为我没有推回任何元素.
只是运气,在[0][0]没有任何边界检查或迭代器访问内存时它成功了吗?或者向量在声明时分配一些基线存储?
在使用dlopen加载时,我遇到了一些异常无法正常运行的问题(或者至少,正如我希望的那样;我知道这有问题).我在这里包含一些简化的示例代码.实际情况是myapp = Matlab,myext1 = mexglx matlab扩展,mylib是我的代码在两个扩展之间的共享库(myext1,myext2)
mylib.h
struct Foo { Foo(int a); m_a; }
void throwFoo();
Run Code Online (Sandbox Code Playgroud)
mylib.cpp
#include "mylib.h"
Foo::Foo(int a): m_a(a) {}
void throwFoo() { throw Foo(123); }
Run Code Online (Sandbox Code Playgroud)
myext1.cpp
#include "mylib.h"
#include <iostream>
extern "C" void entrypoint()
{
try { throwFoo(); }
catch (Foo &e) { std::cout << "Caught foo\n"; }
}
Run Code Online (Sandbox Code Playgroud)
myext2.cpp与myext1.cpp相同
MyApp.cpp中
#include <dlfcn.h>
int main()
{
void *fh1 = dlopen("./myext1.so",RTLD_LAZY);
void *fh2 = dlopen("./myext2.so",RTLD_LAZY);
void …Run Code Online (Sandbox Code Playgroud) 我想实现一个2部分首选项屏幕.如果单击复选框,则第一个类别应锁定,第二个类别解锁.如果不是,反过来.现在我看到它只有在我之前的活动然后转到新的(sharedPreferences)时才有效.我应该覆盖什么样的倾听者以及如何?
我在一所大学拥有两台电脑.它们都在某种防火墙等背后,不允许我通过网络直接连接它们.他们都可以SSH公共计算机,但我无法弄清楚如何从一个到另一个.我还经营一个小网站.我的问题是,我可以使用我的网站的公共地址以某种方式连接我的两台计算机,而没有所有信息流过我的网站并占用我所有的带宽吗?理想情况下,我想在两台计算机之间创建一个ssh隧道.
我已经尝试过Hamachi,它不再适用于macs了,我想更多地控制连接.
好的,所以我是Emacs的狂热用户,并且倾向于远离使用IDE,除非我绝对必须并且我看到建议使用带有插件的Eclipse来开发android.我只是想知道是否真的有必要使用Eclipse插件(或其他一些)?