小编Far*_* M.的帖子

SLF4J:类路径包含多个SLF4J绑定.消息在控制台上打印

我想在控制台上打印日志,并将它们写在文件中.在我使用akka loggers的scala项目中,这是我的build.sbt

libraryDependencies ++= Seq("org.mongodb" %% "casbah" % "2.8.0",
                            "org.slf4j" % "slf4j-simple" % "1.7.12",
                            "org.elasticsearch" % "elasticsearch" % "1.5.0",
                            "org.scalatest" %% "scalatest" % "2.2.1" % "test"
                        withSources() withJavadoc(),
                        "org.easymock" % "easymock" % "3.1" withSources() withJavadoc(),
                        "org.mockito" % "mockito-all" % "1.9.5",
                        "com.typesafe.akka" %% "akka-actor" % "2.3.6",
                        "ch.qos.logback" % "logback-classic" % "1.0.9",
                        "com.typesafe.akka" %% "akka-slf4j" % "2.3.9")
Run Code Online (Sandbox Code Playgroud)

这是我的代码的一部分

import akka.event.Logging

val log = Logging(context.system, this)
case RegularAdminWriteInMongo =>
    log.debug("writing to mongo")
    log.info("message received RegularAdminWriteInMongo")
Run Code Online (Sandbox Code Playgroud)

当我在sbt中运行我的程序后打印消息

SLF4J:类路径包含多个SLF4J绑定.SLF4J:在[jar:file:/ home/sara/.ivy2/cache/org.slf4j/slf4j - simple/jars/slf4j - simple …

logging logback slf4j sbt akka

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

角度材料md-autocomplete动态加载问题

我在我的项目中使用Angular Material组件"md-autocomplete".

我们正在尝试使用"md-list"组件的项目单击事件调用来呈现动态响应.

问题:但是,在调用事件调用之前,将调用md-autocomplete方法.

我的要求:有没有办法在调用md-autocomplete方法之前调用事件调用.

在这里,我们附上了样本图像,显示了我们作为输出所需的基本响应.

对象1相关的响应

对象2相关的响应

我试过下面的代码,但它没有用.我需要解决问题的方法.

HTML源代码:

md-list代码

<md-list>
    <div ng-repeat="object in ['object 1', 'object 2', 'object 3', 'object 4', 'object 5', 'object 6'] track by $index">
        <md-list-item class="md-2-line contact-item" ng-click="listItemClick($event, object)">
            <div class="md-list-item-text compact">
                <h3>Object data displayed here like object 1, object 2 and etc ...</h3>
            </div>
        </md-list-item>
    </div>
</md-list>
Run Code Online (Sandbox Code Playgroud)

md-autocomplete代码:

<md-autocomplete
        ng-disabled="isDisabled"
        md-no-cache="noCache"
        md-selected-item="selectedItem"
        md-search-text-change="searchTextChangeEvent(searchText)"
        md-search-text="searchText"
        md-selected-item-change="selectedItemChangeEvent(item)"
        md-items="item in search(searchText)"
        md-item-text="item.id"
        md-min-length="0"
        placeholder="Search by id ..."
        md-menu-class="autocomplete-custom-template">
        <md-item-template>
            <span class="item-title">
                {{id}}
            </span>
        </md-item-template>
</md-autocomplete>
Run Code Online (Sandbox Code Playgroud)

AngularJS脚本代码: …

angularjs md-autocomplete

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

空对象引用上的 SupportMapFragment#getMapAsync()

我一直试图将我的代码嵌套SupportMapFragment到另一个 Fragment 中,但是在尝试调用我的 SupportMapFragment 对象时,我不断收到nullPointerExceptiongetMapAsync()。我不知道如何解决这个问题,我已经尝试了一段时间了:/

这是我的onCreateView方法,来自应该包含 Map 的封闭 Fragment。

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View rootView = inflater.inflate(R.layout.activity_main, container, false);

    CustomMap mapFrag = new CustomMap();
    FragmentTransaction transaction = this.getChildFragmentManager().beginTransaction();
    transaction.add(R.id.map_container, mapFrag).commit();

    SupportMapFragment smf = (SupportMapFragment) this.getChildFragmentManager().findFragmentById(R.id.map);
    smf.getMapAsync(this);

    return rootView;

}
Run Code Online (Sandbox Code Playgroud)

下面是activity_main.xml文件:

<android.support.percent.PercentRelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context=".Activities.MainActivity"
    android:focusableInTouchMode="true">

    <FrameLayout
        android:layout_alignParentTop="true"
        android:layout_marginTop="0dp"
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        app:layout_widthPercent="100%"
        android:layout_marginBottom="250dp"
        android:layout_centerInParent="true"
        android:id="@+id/map_container" />

    <EditText
        app:layout_widthPercent="90%"
        android:layout_height="wrap_content"
        android:inputType="textPersonName"
        android:ems="10"
        android:layout_alignParentBottom="true"
        android:layout_alignLeft="@+id/map_container" …
Run Code Online (Sandbox Code Playgroud)

java android nullpointerexception android-fragments

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

array_key_exists() 期望参数 2 为数组,给定字符串

我有这段代码:

if( array_key_exists('customtextcolor',$atts) ){
    // If in array, then check if none, if not none, add to CSS classes
    if ( 'none' !== $atts['customtextcolor'] ) {
        $custstyles[] = $atts['customtextcolor'];
    }       
}
Run Code Online (Sandbox Code Playgroud)

这是第 90 行,我的php.log在第 90 行显示错误。

Apr 2 08:46:16 #####.net ool www: PHP 警告: array_key_exists() 期望参数 2 为数组,在 /var/www/####/wp-content/plugins/Fusion 中给出的字符串-Builder-Custom-Text-For-HP/fusion-builder-custom-text-for-hp.php 第 90 行

我觉得这很奇怪,因为我确信它是一个数组,因为代码按预期工作。我也使用过echo gettype($atts);,它返回一个数组。当我var_dump($atts);它呈现完整的数组。

知道 php.log 显示此错误消息吗?

如果$atts是字符串,为什么将gettype()其识别为数组?为什么要把var_dump()它渲染为数组?

我查看了array_key_exists()StackOverflow 上的其他问题,但据我所知,它们不是同一个问题。

php arrays

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