小编Hun*_*unt的帖子

在PHP站点中集成托管Web服务

我想在我的PHP站点中集成escrow.com的服务.

您将如何开始实现这一目标,以及提供哪些API是基本功能?你有任何PHP特定的建议或陷阱吗?你会推荐其他服务提供商吗?

php escrow

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

在PhoneGap中上传文件时获取文件名和扩展名

我在Android中使用PhoneGap从图库中取代了一个图像,但我想要的是获取文件名及其扩展名,我无法从imageuri获取它所以任何人都可以告诉我如何找到一个

imageURIcontent://media/external/images/media/876这样有一种方法来获取fileEntry使用它imageURI并读取文件名和扩展名?

function fileUpload(){

    navigator.camera.getPicture(
                uploadPhoto,
                function(message) { alert('get picture failed'); },
                {
                    quality         : 50,
                    destinationType : navigator.camera.DestinationType.FILE_URI,
                    sourceType      : navigator.camera.PictureSourceType.PHOTOLIBRARY
                }
            );


   }
    function uploadPhoto(imageURI) {
            var options = new FileUploadOptions();
            options.fileKey="uploaded_file";
            alert(imageURI);
            options.fileName=imageURI.substr(imageURI.lastIndexOf('/')+1);
            options.mimeType="image/jpeg";

            var params = new Object();
            params.value1 = "test";
            params.value2 = "param";

            options.params = params;

            var ft = new FileTransfer();
            ft.upload(imageURI, encodeURI("http://www.mydomain.com/mobile_upload.php"), win, fail, options);
        }

        function win(r) {

            alert("WIN" +r.response);
            console.log("Code = " …
Run Code Online (Sandbox Code Playgroud)

android cordova

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

设备中未调用 BOOT_COMPLETED

我想在设备启动时启动警报,为此我做了以下事情

1)用户权限

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
Run Code Online (Sandbox Code Playgroud)

2)在清单文件中添加带有意图操作的接收者

 <receiver
            android:name=".sms.BootReceiver"
            android:enabled="true" >
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" >
                </action>

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </receiver>
Run Code Online (Sandbox Code Playgroud)

3)来源

public class BootReceiver extends BroadcastReceiver {

    private AlarmManager dayAlarmMgr;
    private PendingIntent dayAlarmIntent;
    private NotificationManager mNotificationManager;
    private NotificationCompat.Builder builder;
    private Context context;
    public static final int NOTIFICATION_ID = 2;

    @Override
    public void onReceive(Context context, Intent intent) {

         if (intent.getAction().equals("android.intent.action.BOOT_COMPLETED")) {
                    Toast.makeText(context, "FIRED BOOT COMPLETE" , Toast.LENGTH_LONG).show();
           }
    }
}
Run Code Online (Sandbox Code Playgroud)

上面的代码可以在 genymotion 中运行,但不能在真实设备上运行

android android-broadcast android-reboot

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

ipaddress和mac地址的正则表达式

任何人都可以建议我的IP地址和mac地址的正则表达式?

我正在使用python和django

例如,http:// [ipaddress] /SaveData/127.0.0.1/00-0C-F1-56-98-AD/

对于mac地址,我试过以下但没有工作

([0-9A-F]{2}[:-]){5}([0-9A-F]{2})

^([0-9A-F]{2}[:-]){5}([0-9A-F]{2})$
Run Code Online (Sandbox Code Playgroud)

python regex mac-address ip-address

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

我无法启动ejabberd服务器

当我尝试使用以下commond启动我的ejabberd服务器时

/etc/init.d/ejabberd开始

它显示了以下内容,但是当我触发www.example.com:5280\http-bind时,什么也没有开始

启动ejabberd:[确定]

因为我在/var/log/ejabberd/ejabberd.log上的日志是空的,但要弄明白我尝试运行

ejabberdctl直播

并得到了以下日志,我真的不知道这特别是在这里说{error,duplicate_name}所以请任何帮助我如何摆脱这个并成功启动ejabberd.

{error_logger,{{2012,2,4},{14,28,18}},"Protocol: ~p: register error: ~p~n",["inet_tcp",{{badmatch,{error,duplicate_name}},[{inet_tcp_dist,listen,1},{net_kernel,start_protos,4},{net_kernel,start_protos,3},{net_kernel,init_node,2},{net_kernel,init,1},{gen_server,init_it,6},{proc_lib,init_p_do_apply,3}]}]}
{error_logger,{{2012,2,4},{14,28,18}},crash_report,[[{pid,<0.20.0>},{registered_name,net_kernel},{error_info,{exit,{error,badarg},[{gen_server,init_it,6},{proc_lib,init_p_do_apply,3}]}},{initial_call,{net_kernel,init,['Argument__1']}},{ancestors,[net_sup,kernel_sup,<0.8.0>]},{messages,[]},{links,[#Port<0.94>,<0.17.0>]},{dictionary,[{longnames,false}]},{trap_exit,true},{status,running},{heap_size,610},{stack_size,23},{reductions,484}],[]]}
{error_logger,{{2012,2,4},{14,28,18}},supervisor_report,[{supervisor,{local,net_sup}},{errorContext,start_error},{reason,{'EXIT',nodistribution}},{offender,[{pid,undefined},{name,net_kernel},{mfa,{net_kernel,start_link,[['ejabberd@example',shortnames]]}},{restart_type,permanent},{shutdown,2000},{child_type,worker}]}]}
{error_logger,{{2012,2,4},{14,28,18}},supervisor_report,[{supervisor,{local,kernel_sup}},{errorContext,start_error},{reason,shutdown},{offender,[{pid,undefined},{name,net_sup},{mfa,{erl_distribution,start_link,[]}},{restart_type,permanent},{shutdown,infinity},{child_type,supervisor}]}]}
{error_logger,{{2012,2,4},{14,28,18}},crash_report,[[{pid,<0.7.0>},{registered_name,[]},{error_info,{exit,{shutdown,{kernel,start,[normal,[]]}},[{application_master,init,4},{proc_lib,init_p_do_apply,3}]}},{initial_call,{application_master,init,['Argument__1','Argument__2','Argument__3','Argument__4']}},{ancestors,[<0.6.0>]},{messages,[{'EXIT',<0.8.0>,normal}]},{links,[<0.6.0>,<0.5.0>]},{dictionary,[]},{trap_exit,true},{status,running},{heap_size,233},{stack_size,23},{reductions,123}],[]]}
{error_logger,{{2012,2,4},{14,28,18}},std_info,[{application,kernel},{exited,{shutdown,{kernel,start,[normal,[]]}}},{type,permanent}]}
{"Kernel pid terminated",application_controller,"{application_start_failure,kernel,{shutdown,{kernel,start,[normal,[]]}}}"}

Crash dump was written to: /var/log/ejabberd/erl_crash_20120204-142801.dump
Kernel pid terminated (application_controller) ({application_start_failure,kernel,{shutdown,{kernel,start,[normal,[]]}}})
Run Code Online (Sandbox Code Playgroud)

xmpp ejabberd

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

在openfire上启用http-bind

我试图通过Openfire启用BOSH连接,以便我可以通过Web创建XMPP客户端.目前我用strophe.js测试它.

问题是当我尝试在浏览器中触发以下URL时我得到了

http://www.mydomain.com:7070/http-bind
Run Code Online (Sandbox Code Playgroud)

跟随错误

HTTP ERROR 400


    Problem accessing /http-bind/. Reason:

        Bad Request
    Powered by Jetty://
Run Code Online (Sandbox Code Playgroud)

这是我的服务器设置,我看到几个线程,但他们没有帮助

在此输入图像描述

更新

我使用strophe建立了连接但是我在浏览器恍惚中遇到以下错误

在此输入图像描述

xmpp openfire strophe

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

当用户在 android 中的编辑文本中按 Enter 时的新行

我正在尝试创建编辑文本,当用户按 Enter 时,它会转到新行并允许用户输入更多文本。

这是我的设计部分

<android.support.design.widget.TextInputLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content">

                        <EditText
                            android:id="@+id/discussion"
                            android:layout_width="match_parent"
                            android:layout_height="100dp"
                            android:inputType="textMultiLine"
                            android:maxLines="5"
                            android:hint="Discussion outcome"
                            android:digits="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 "/>

                    </android.support.design.widget.TextInputLayout>
Run Code Online (Sandbox Code Playgroud)

这是我的代码,但问题是光标位置不会转到下一行。我也试过discussion.append("\n")了,但没有用

discussion= (EditText) findViewById(R.id.discussion);
        discussion.setOnKeyListener(new View.OnKeyListener() {
            @Override
            public boolean onKey(View view, int i, KeyEvent keyEvent) {

                Log.e(TAG , "Key  Action "+keyEvent.getAction());

                if(keyEvent.getAction() == KeyEvent.ACTION_UP && keyEvent.getKeyCode() == KeyEvent.KEYCODE_ENTER){

                    String data =discussion.getText().toString();

                    discussion.setText(data+"\n");
                    Log.e(TAG , "Key "+keyEvent.getKeyCode());



                }
                return false;
            }
        });
Run Code Online (Sandbox Code Playgroud)

android

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

在动态壁纸中启动浏览器意图

我想在android里面加载BROWSER VIEW意图onTouchEvent.基本上我已经创建了一个动态壁纸,如果我点击它,那么我想用指定的uri打开BROWSER VIEW意图.

我试过里面的代码 onTouchEvent

Uri uri = Uri.parse("http://www.google.com");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
Run Code Online (Sandbox Code Playgroud)

但我收到以下错误:

android.util.AndroidRuntimeException: Calling startActivity() from outside of 
an Activitycontext requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
Run Code Online (Sandbox Code Playgroud)

另一种方法是我创建了一个活动,在其onCreate方法中我尝试了以下代码:

public void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    browser=new WebView(this);
    setContentView(browser);
    browser.loadUrl("http://commonsware.com");
}
Run Code Online (Sandbox Code Playgroud)

并尝试通过自定义意图消息加载此活动,如下所示,但我仍然得到相同的错误

Intent intent = new Intent(ACTION);
startActivity(intent);

// over here I have not used context, as while creating live wallpaper I
// don't know here to get the context
Run Code Online (Sandbox Code Playgroud)

android wallpaper live-wallpaper

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

在android中检测速度

是否有可能在Android手机中使用GPS或加速度计检测汽车的速度?

任何人都可以给我实施这个路线图吗?

gps android accelerometer

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

将registerReceiver用于非活动和非服务类

我试图registerReceiver像BluetoothDevice类的事件ACTION_ACL_CONNECTED,ACTION_ACL_DISCONNECTED.

但是我使用的类registerReceiver不扩展Activity类或Service类 - 所以我传递Context给那个类并按如下方式注册接收器

context.registerReceiver(ActionFoundReceiver, 
          new IntentFilter(BluetoothDevice.ACTION_ACL_CONNECTED));

context.registerReceiver(ActionFoundReceiver, 
              new IntentFilter(BluetoothDevice.ACTION_ACL_DISCONNECTED));

context.registerReceiver(ActionFoundReceiver, 
          new IntentFilter(BluetoothDevice.ACTION_ACL_DISCONNECT_REQUESTED));
Run Code Online (Sandbox Code Playgroud)

和处理事件如下

private final BroadcastReceiver ActionFoundReceiver = new BroadcastReceiver() {

    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();
        if (BluetoothDevice.ACTION_ACL_CONNECTED.equals(action)) {
            // do some stuff
        }
    }
};
Run Code Online (Sandbox Code Playgroud)

但是当设备连接或断开连接时我无法跟踪是否意味着ActionFoundReceiver无法调用

android android-service

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