小编Pon*_*ing的帖子

得到警告:此linearlayout布局或其framelayout父级可能无用

<TabHost
    android:id="@+id/tabHost"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical" >

        <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1" >

 // ---------------------------  Here I got warning  -------------------------
            <LinearLayout
                android:id="@+id/chat_list"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:orientation="vertical"
                android:visibility="visible" >
 // --------------------------------------------------------------------------
                <ListView
                    android:id="@+id/listView"
                    android:layout_width="fill_parent"
                    android:layout_height="0dp"
                    android:layout_weight="1"
                    android:background="@color/white" >
                </ListView>

                <LinearLayout
                    android:id="@+id/text_entry"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:gravity="bottom"
                    android:orientation="horizontal" >

                    <EditText
                        android:id="@+id/txt_inputText"
                        android:layout_width="125dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="0.8"
                        android:hint="@string/enter_text"
                        android:inputType="text" />

                    <Button
                        android:id="@+id/btn_Send"
                        android:layout_width="100dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="0.2"
                        android:text="@string/send" />
                </LinearLayout>
            </LinearLayout>
        </FrameLayout>

        <TabWidget
            android:id="@android:id/tabs"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="0" >
        </TabWidget>
    </LinearLayout>
</TabHost>
Run Code Online (Sandbox Code Playgroud)

如何解决此警告?我找不到任何解决方案。任何帮助将不胜感激。

android warnings android-linearlayout android-framelayout

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

在后台运行PHP脚本(不使用Cron)

我想在某些情况下在后台运行以下代码:

文件A:

// ------------------- Some Code Before Following -----------------------

// send notification to given device token
$notification = new Notification();                    
$notification->sendNotification($token,$count);

// ------------------- Some Code After Above ------------------------
Run Code Online (Sandbox Code Playgroud)

这将称为以下类:

// Here I am sending notification to given device token (APNS Push Notification) 
<?php

class Notification
{
    public function sendNotification($token,$count)
    {
        if(strlen($token)%16 == 0)
        {
            // set Device token
            $deviceToken = $token;
            $passphrase = 'xxxxx';
            $badge = $count;

            // Displays alert message here:
            $message = 'Hello! There.';

            $ctx = stream_context_create();
            stream_context_set_option($ctx, …
Run Code Online (Sandbox Code Playgroud)

php notifications background-process apple-push-notifications

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

世界各地的 GMT 时区都一样吗?

我的服务器正在运行 PHP。我正在使用gmdate()函数将记录从服务器插入到我的数据库中。我只是想知道时区是否通过使用gmdate()功能集中?

例子:

一位用户从印度创建条目并将记录插入到数据库中

第二个用户从美国/加拿大/法国创建条目并将记录插入到数据库中。

那个时间和我gmdate()在服务器上插入记录时使用的功能一样吗?

php time timezone centralized gmt

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

为什么在使用 exec 命令时(写入日志文件时)权限被拒绝?

在我的本地机器上,我使用了 exec 命令,如下所示:

 if($serverHost == "api.frapi") 
 {
     $phpBianryPath='/Applications/MAMP/bin/php/php5.4.10/bin/php';
 }
 else
 {
     $phpBianryPath='/usr/bin/php';
 }

 $logDir= dirname(__FILE__). '/BackgroundTask';                
 exec("$phpBianryPath $logDir/notificationCall.php $token >> $logDir/log_file.log 2>&1 &");
Run Code Online (Sandbox Code Playgroud)

它在我的本地机器上运行完美。但是当我将它上传到生产服务器然后尝试使用它时,它会出现如下错误:

sh: /var/www/html/example/src/frapi/custom/Action/BackgroundTask/log_file.log:
Permission denied
Run Code Online (Sandbox Code Playgroud)

请指导我。我不明白为什么它在生产中不起作用?

php exec permission-denied logfile

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

尝试运行android应用程序时,模拟器屏幕挂起

我正在尝试过去两天,但找不到任何解决方案。尝试在错误日志中运行带有错误消息的android应用程序时,我的模拟器屏幕挂起,如下所示:

No command output when running: 'am start -n com.ss.hello/com.ss.hello.MainActivity -a       
android.intent.action.MAIN -c 
Run Code Online (Sandbox Code Playgroud)

异常堆栈跟踪:

com.android.ddmlib.ShellCommandUnresponsiveException
at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:408)
at com.android.ddmlib.Device.executeShellCommand(Device.java:435)
at com.android.ide.eclipse.adt.internal.launch.ActivityLaunchAction.doLaunchAction(ActivityLaunchAction.java:67)
at com.android.ide.eclipse.adt.internal.launch.ActivityLaunchAction.doLaunchAction(ActivityLaunchAction.java:109)
at com.android.ide.eclipse.adt.internal.launch.AndroidLaunchController.doLaunchAction(AndroidLaunchController.java:1277)
at com.android.ide.eclipse.adt.internal.launch.AndroidLaunchController.doLaunchAction(AndroidLaunchController.java:1289)
at com.android.ide.eclipse.adt.internal.launch.AndroidLaunchController.launchApp(AndroidLaunchController.java:1261)
at com.android.ide.eclipse.adt.internal.launch.AndroidLaunchController.simpleLaunch(AndroidLaunchController.java:906)
at com.android.ide.eclipse.adt.internal.launch.AndroidLaunchController.continueLaunch(AndroidLaunchController.java:748)
at com.android.ide.eclipse.adt.internal.launch.AndroidLaunchController.launch(AndroidLaunchController.java:409)
at com.android.ide.eclipse.adt.internal.launch.LaunchConfigDelegate.doLaunch(LaunchConfigDelegate.java:322)
at com.android.ide.eclipse.adt.internal.launch.LaunchConfigDelegate.launch(LaunchConfigDelegate.java:238)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:855)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:704)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1047)
at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1251)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Run Code Online (Sandbox Code Playgroud)

会话数据:

eclipse.buildId=v22.0.1-685705
java.version=1.7.0_21
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments:  -product com.android.ide.eclipse.adt.package.product
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -product    com.android.ide.eclipse.adt.package.product
Run Code Online (Sandbox Code Playgroud)

控制台输出为:

[2013-06-16 13:51:02 - Hello] ------------------------------ …
Run Code Online (Sandbox Code Playgroud)

android startup hang android-emulator

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

如何在PHP中没有关联的两个数组的差异

我的第一个数组A是: ["1604","1606","1610"]

我的第二个阵列B是: ["1604","1606","1607","1610"]

但是当我执行时:

   $results= array_diff($b,$a);
Run Code Online (Sandbox Code Playgroud)

然后我得到了这样的结果但我不想要关联(即2如下).我只想要钥匙.(即1607).

我的输出数组结果是:{"2":"1607"}

我希望输出像["1607"].

php arrays difference

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

如何在PHP中检查变量是否为null

在PHP中,

我正在使用名为$ token的One Variable.

我想检查它的值是否为null.我已经通过检查empty/isset/is_null条件尝试了.但它没有用.

当我使用error_log($token)它打印它的值时,它给出如下输出:" (null)".

因为在数据库中它的值是" (null)".

我怎样才能检查php是否(null)存在.

请指导我这个.

php variables null

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