小编bin*_*680的帖子

为什么apache服务器redicect/doc到usr/share/doc

我在我的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)

apache ubuntu mod-rewrite

4
推荐指数
1
解决办法
2828
查看次数

underscorejs unique不起作用

我试图使用下划线独特的功能,但无法让它工作,这是我的测试代码:

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/,两个都打印出三个对象.我无法弄清楚问题,任何人都可以帮忙吗?非常感谢.

javascript underscore.js

3
推荐指数
1
解决办法
2484
查看次数

保护用户的文件被访问,只有所有者才能访问?

我在php中编写一个Web应用程序,用户可以上传自己的文件或图像,但是如何保护这些文件不被所有者以外的其他人访问.想想dropbox,保护这些文件的机制是什么,我试图搜索但是没有得到任何关于此的信息.任何指针或指向教程的任何链接都非常有用.提前致谢.

php security file

2
推荐指数
1
解决办法
404
查看次数

javascript数组在函数外空

我有这样的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)

两个日志结果不同,我做错了什么?谢谢指点.

javascript arrays

2
推荐指数
1
解决办法
1360
查看次数

NFC意向调度问题

我正在尝试使用新的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)只会启动名为“已收集新标签”的内置活动,而从不显示选择或开始我的活动。知道为什么会这样,谢谢您的帮助。

android nfc

1
推荐指数
1
解决办法
4444
查看次数

mysql查询不起作用(同时运行两个INSERT)

我的代码中有一些查询

...
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代码时它不起作用,是否有人知道这里看起来有什么问题?感谢帮助.

php mysql

1
推荐指数
1
解决办法
353
查看次数

Javascript模块模式

有什么区别如下:

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)

谢谢你的解释.

javascript

1
推荐指数
1
解决办法
213
查看次数

如何在javascript中存储大量数据

我必须使用ajax处理从服务器检索到的大量数据并将其存储在JavaScript中.我目前正在使用数组来存储所有数据.这是我如何获取数据并将其存储在javascript中:

var buffer=new Array();
//when each ajax returns 
buffer=buffer.concat(JSON.parse(ajaxReq.responseText));
Run Code Online (Sandbox Code Playgroud)

我脑子里有两个问题:

  1. 使用数组来存储所有数据的效率,是否存在100万行数据的溢出问题?
  2. concat性能如何?怎么能在这里优化?

感谢任何输入.

javascript arrays performance

1
推荐指数
1
解决办法
3008
查看次数

Android包括布局

我有这样的布局:

<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)

layout android

1
推荐指数
1
解决办法
1万
查看次数

android启动活动的条件

我的活动需要根据条件开始.它与登录方案非常相似.喜欢:

  1. 如果用户未登录,请转到登录活动.正确验证后,转到配置文件活动.
  2. 如果用户已登录,请直接转到配置文件活动.

更新:我考虑过在登录活动时重定向,但是如果用户点回按钮它会返回登录活动,我不希望这种情况发生.

怎么能实现呢?感谢帮助.

android android-activity

1
推荐指数
1
解决办法
1686
查看次数