我在我的ubuntu10.4服务器下的/ var/www下的.htaccess文件中有重写ruls,如下所示,当网址显示为http://127.0.0.1/doc/view时,网页显示"请求的URL/doc/view在此服务器上找不到",然后我检查apach日志,它记录"文件不存在:/ usr/share/doc/view",所以apachently apache将/ doc/view重定向到/ usr/share /文档/视图.我不知道这里发生了什么,有人可以帮忙吗?感谢帮助.
Options +FollowSymLinks
IndexIgnore */*
<IfModule mod_rewrite.c>
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
</IfModule>
Run Code Online (Sandbox Code Playgroud) 我试图使用下划线独特的功能,但无法让它工作,这是我的测试代码:
var foo = [ { "a" : "1" }, { "b" : "2" }, { "a" : "1" } ];
_.unique(foo, function(item, k, v){
return item.a;
});
console.log(foo);
_.unique(foo, 'a');
console.log(foo);
Run Code Online (Sandbox Code Playgroud)
如上所述:使用Underscore for Javascript删除重复的对象,测试代码在这里:http://jsfiddle.net/bingjie2680/wDvpM/2/,两个都打印出三个对象.我无法弄清楚问题,任何人都可以帮忙吗?非常感谢.
我在php中编写一个Web应用程序,用户可以上传自己的文件或图像,但是如何保护这些文件不被所有者以外的其他人访问.想想dropbox,保护这些文件的机制是什么,我试图搜索但是没有得到任何关于此的信息.任何指针或指向教程的任何链接都非常有用.提前致谢.
我有这样的JavaScript代码:
var buffer=new Array();
function fetchData(min,max){
var ajaxReq = new XMLHttpRequest();
ajaxReq.onreadystatechange = function(){
if (ajaxReq.readyState === 4) {
if (ajaxReq.status === 200) {
buffer= ajaxReq.responseText;
console.log(buffer)//this logs an array to console
} else {
console.log("Error", ajaxReq.statusText);
}
}
};
ajaxReq.open('GET', "server/controller.php?min="+min+"&max="+max, true);
ajaxReq.send();
}
fetchData(1,100);
console.log(buffer);//this log an empty array
Run Code Online (Sandbox Code Playgroud)
两个日志结果不同,我做错了什么?谢谢指点.
我正在尝试使用新的android设备和nfc标签,在那里我编写了一个非常简单的应用程序来检测nfc标签。但是我尝试了一下,但是在扫描标签时无法让我的设备开始活动。这是我所拥有的:
最简单的活动:
public class NFCIntentDispatch extends Activity{
private TextView mText;
public void onCreate(Bundle savedState) {
super.onCreate(savedState);
setContentView(R.layout.intent_dispatch);
mText = (TextView) findViewById(R.id.text);
}
}
Run Code Online (Sandbox Code Playgroud)
和menifest.xml
<activity android:name="NFCIntentDispatch">
<intent-filter>
<action android:name="android.nfc.action.TECH_DISCOVERED"/>
<meta-data android:name="android.nfc.action.TECH_DISCOVERED"
android:resource="@xml/nfc_tech_filter" />
</intent-filter>
<intent-filter>
<action android:name="android.nfc.action.TAG_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
Run Code Online (Sandbox Code Playgroud)
res / xml下的nfc_tech_filter.xml:
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<tech-list>
<tech>android.nfc.tech.IsoDep</tech>
<tech>android.nfc.tech.NfcA</tech>
<tech>android.nfc.tech.NfcB</tech>
<tech>android.nfc.tech.NfcF</tech>
<tech>android.nfc.tech.NfcV</tech>
<tech>android.nfc.tech.Ndef</tech>
<tech>android.nfc.tech.NdefFormatable</tech>
<tech>android.nfc.tech.MifareClassic</tech>
<tech>android.nfc.tech.MifareUltralight</tech>
</tech-list>
Run Code Online (Sandbox Code Playgroud)
问题:
每当扫描标签时,我的设备(Nexus S 2.3.3)只会启动名为“已收集新标签”的内置活动,而从不显示选择或开始我的活动。知道为什么会这样,谢谢您的帮助。
我的代码中有一些查询
...
echo $query;
mysql_query($query)
or die(mysql_error());
Run Code Online (Sandbox Code Playgroud)
当我运行它时,输出以下内容:
INSERT INTO test ( c1, c2, c3, c4, c5)
VALUES ('xo', 'VxbcS','rzDMœSfsg', 'œsAcdiNwu','axaWMYOOj');
INSERT INTO test ( c1, c2, c3, c4, c5)
VALUES ('ihTnUcBU', 'plKtJdsRT','PyJUPBx', 'f','SspBuWJiK');
You have an error in your SQL syntax; check the manual that corresponds
to your MySQL server version for the right syntax to use near 'INSERT
INTO test ( c1, c2, c3, c4, c5) VALUES ('ihTnUcBU', 'plKtJdsRT',' at line 3
Run Code Online (Sandbox Code Playgroud)
如果我复制上面的插入查询并直接在phpmyadmin中运行它,它没有任何问题.但是当我运行php代码时它不起作用,是否有人知道这里看起来有什么问题?感谢帮助.
有什么区别如下:
function test(){
this.init=function(){//do something}
this.some=function(){//do something}
function other(){}
}
Run Code Online (Sandbox Code Playgroud)
和
function test(){
function init(){//do something}
function some(){//do something}
function other(){}
return {'init':init, 'some':some};
}
Run Code Online (Sandbox Code Playgroud)
谢谢你的解释.
我必须使用ajax处理从服务器检索到的大量数据并将其存储在JavaScript中.我目前正在使用数组来存储所有数据.这是我如何获取数据并将其存储在javascript中:
var buffer=new Array();
//when each ajax returns
buffer=buffer.concat(JSON.parse(ajaxReq.responseText));
Run Code Online (Sandbox Code Playgroud)
我脑子里有两个问题:
concat性能如何?怎么能在这里优化?感谢任何输入.
我有这样的布局:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<include layout="@layout/basicinfo" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="profile" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="item" />
</LinearLayout >
Run Code Online (Sandbox Code Playgroud)
问题是它只显示包含部分,没有显示按钮.如果我删除包含布局,将显示按钮.知道我在这里做错了什么吗?谢谢.
更新:basicinfo布局:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<ImageView
android:id="@+id/imageView"
android:layout_width="70dp"
android:layout_height="wrap_content"
android:src="@drawable/icon"/>
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/imageView1"
android:layout_toRightOf="@id/imageView"
android:orientation="vertical" >
<TextView
android:id="@+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:text="Name:" />
<TextView
android:id="@+id/TextView02"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:text="Catogery:" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:text="Description" />
<TextView
android:id="@+id/TextView03"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:text="Owner" />
</LinearLayout>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud) 我的活动需要根据条件开始.它与登录方案非常相似.喜欢:
更新:我考虑过在登录活动时重定向,但是如果用户点回按钮它会返回登录活动,我不希望这种情况发生.
怎么能实现呢?感谢帮助.
javascript ×4
android ×3
arrays ×2
php ×2
apache ×1
file ×1
layout ×1
mod-rewrite ×1
mysql ×1
nfc ×1
performance ×1
security ×1
ubuntu ×1