我在网上搜索了我的问题的答案而没有任何运气,所以她说:
我正在重做我的mod_rewrite用于搜索引擎优化目的,我希望所有网址都是小写的,例如:
http://BLAbla.com/
Run Code Online (Sandbox Code Playgroud)
变
http://bla.com/
Run Code Online (Sandbox Code Playgroud)
目前我的.htaccess看起来像这样:
RewriteEngine on
RewriteMap lc int:tolower
RewriteCond %{REQUEST_URI} [A-Z]
RewriteRule (.*) ${lc:$1} [R=301,L]
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule (.*)$ http://www.example.com/$1 [R=301,L]
RewriteRule ([\w]*)/$ http://%{HTTP_HOST}/$1 [R=301,L]
RewriteRule ^([^/]+)/([^/]?)$ index.php?worker=$1¶ms=$2 [L]
Run Code Online (Sandbox Code Playgroud)
但是当我运行http:// localhost/site /我得到错误500.我只知道基本的reg ex,并且mod_rewrite非常有限,所以我不能在这里查看错误.如果我删除重写地图行,页面不会给出任何错误.我的服务器还是不支持重写映射?
关于.htaccess文件的任何其他评论都非常受欢迎:)
谢谢你的时间.
现在我正在使用
set autoindent
我在Vim中编辑Yaml文件时,只需在开始换行时复制上一行的缩进即可.不过我不禁觉得它可能会更聪明一些.什么是伟大的是如果在之后开始一个新行
foo: "bar"
可以保持相同的缩进级别,但在之后开始一行
foo:
将添加额外级别的缩进.
在哪里可以找到.NET添加到Vista/7的列表,如跳转列表和自定义窗口样式?
在我的appengine python应用程序中,我有分片计数器,用于计算照片的favs数量和视图数量.
我有照片和计数器型号.要按受欢迎程度(最喜欢的数量)订购照片,我应该在我的照片实体(Photo.all().order('num_favs'))中存储最喜欢的#.由于我正在跟踪分片计数器中的fav的数量,我想知道用Counter模型中最新的#fores来更新我的Photo实体的最有效方法是什么?
这是我的模型的样子摘要:
class Photo(db.Model):
photo = db.BlobProperty()
favs = db.IntegerProperty() #num of favs
class Counter(db.Model):
#key_name = key to a model that's to be counted - Photo in this case
name = db.StringProperty() #counted entity key
count = db.IntegerProperty() #count
type = db.StringProperty() #type of model to count, "Photo" in this example
#Very unefficient way of updating my Photo entities with the latest count from Counter:
fav_counters = Counter.all().filter('type =', 'Photo')
for fav in fav_counters:
photo_fav = db.get(fav.name) …Run Code Online (Sandbox Code Playgroud) 我不明白当你做一个像这样的.show()链时会发生什么.我也没有写这段代码或者想知道如何弄清楚这里发生了什么.因此这个问题.
// Remove favorite category
$(".FavoriteRemove").click(function() {
var cat = $(this).parents(".Category"); //the parent of the clicked item is the category/bundle
var catid = $(this).attr("catid"); //the id tag on the clicked item is the BundleID
$.post($(this).attr("href"), function() { //the href tag is the post URL for adding a favorite
cat.remove(); //here we remove the category/bundle
//*** WHAT IS THIS DOING? v
$(".Category[catid=" + catid + "]").show().parent().show();
//*** NO THAT UP THERE ^
if ($(".FavoriteCategories div").length == 0)
$(".FavoriteCategories").hide();
//bindCategories();
});
return …Run Code Online (Sandbox Code Playgroud) 我总是将参数传递给像这样的函数:
setValue('foo','#bar')
function setValue(val,ele){
$(ele).val(val);
};
Run Code Online (Sandbox Code Playgroud)
原谅这个愚蠢的例子.但是最近我一直致力于一个有一些功能需要大量参数的项目.所以我开始将参数作为一个对象传递(不确定这是否是正确的方法),如下所示:
setValue({
val:'foo',
ele:'#bar'
});
Run Code Online (Sandbox Code Playgroud)
然后在功能中:
function setValue(options){
var value = options.val;
var element = options.ele;
$(element).val(value);
};
Run Code Online (Sandbox Code Playgroud)
我的问题是,有更好的方法吗?调用这些"选项"是常见的做法(或没关系)吗?您是否通常需要"解包"(缺少更好的术语)选项并在函数内设置本地变量?我一直这样做,以防其中一个没有定义.
我真的希望不要创造坏习惯并编写一堆丑陋的代码.任何帮助都是由我赞赏和+.谢谢.
我需要使用win32线程并行化应用程序.代码的一部分涉及使用线程修改静态数组.
我将数组作为参数传递如下:
struct threadParameter {
float **array;
int row;
}
Run Code Online (Sandbox Code Playgroud)
示例代码如下:
// Main
float data[100][100]
for (int i = 0; i < 100; i ++) {
tp = (*threadParameter) new threadParameter;
tp->array = (float **) data;
tp->row = i;
AfxBeginThread... // Begin thread code
}
// Thread Code
UINT myThread(LPVOID param) {
threadParameter *pp = (threadParameter *) param;
for (int j = 0; j < 100; j ++) {
pp->array[pp->row][j] = NEWVALUE;
}
}
Run Code Online (Sandbox Code Playgroud)
但是,在执行项目时,当我尝试通过**数组指针加入数组时,出现"访问冲突错误".如果阵列数据是动态的,则不会发生此问题.有没有办法解决这个问题(我不允许将数组数据从静态更改为动态)?
我有这样的功能:
function run(arg) {
if (!window.alreadyRun) init();
window.alreadyRun = true;
/* more code */
}
Run Code Online (Sandbox Code Playgroud)
你明白了,我试图弄清楚它是否是第一次调用函数.
有一个更好的方法吗?不使用全局变量?像这样的东西:
function run(arg) {
var ranAlready;
if (!ranAlready) init();
ranAlready = true;
/* more code */
}
Run Code Online (Sandbox Code Playgroud) 我需要隐藏或显示DataGridViewImageColumn中单个单元格的图像.我把代码放在单元格格式化事件中.但我不知道如何从细胞中隐藏图像.我知道如何删除图像的唯一方法是首先将图像列的Image属性设置为null,然后将每个单元格的图像设置为一些图像以供显示.但这有点不方便,因为图像显示/隐藏代码现在在我的单元格格式化事件中.
有人知道隐藏/删除单个细胞图像的简单方法吗?谢谢.
可能重复:
如何选择要加入的开源项目?
我是一名ac程序员,在开发大多数Web应用程序方面有两年多的经验.我喜欢在php上工作,设计和开发前端.我想将自己的技能和知识分享给开源项目,即使我还不是编程大师.
你是如何开始贡献开源的?当你没有自己的最佳方式时,最好的方法是什么?
编辑:我在相关问题中看到编写文档是其中一种方式.不幸的是,因为英语不是我的第一语言.我也很欣赏与.net 4相关的答案.
.net ×3
javascript ×2
c# ×1
c++ ×1
datagridview ×1
function ×1
image ×1
jquery ×1
lowercase ×1
mod-rewrite ×1
open-source ×1
pointers ×1
python ×1
seo ×1
vim ×1
winapi ×1
winforms ×1
yaml ×1