首页 » 2022年1月

IDEA调试php报错:Connection was not established. Cannot start debugger session with 'Xdebug 3.1.2' Validate installation

很不幸,xdebug3必须使用idea 2020以上,我得2019不行,因为idea生成得命令已经过时了
D:\tool\php\php.exe -dxdebug.remote_enable=1 -dxdebug.remote_mode=req -dxdebug.remote_port=9000 -dxdebug.remote_host=127.0.0.1 D:\dev\myphp\main.php

JAVA 遍历MONGO BSON 字段类型,BSON提供如何读取BSOn文档字段类型得方法

引入Mongo 依赖
 <dependency>
            <groupId>org.mongodb</groupId>
            <artifactId>mongodb-driver-async</artifactId>
            <version>3.4.2</version>
        </dependency>
        <!-- Sadly, we need the mongo-java-driver solely to serialize
             Document objects in a sane manner -->
        <dependency>
            <groupId>org.mongodb</groupId>
            <artifactId>mongo-java-driver</artifactId>
            <version>3.4.2</version>
        </dependency>
如果不需要连接mongo,只引入如下
  <dependency>
            <groupId>org.mongodb</groupId>
            <artifactId>bson</artifactId>
            <version>3.4.2</version>
        </dependency>
遍历文档字段,要借助BsonDocument和BsonValue来获取类型
 BsonDocument document = BsonDocument.parse(mogonDoc);
 MongoColumns column = new MongoColumns();

for(Map.Entry<String,BsonValue> en : document.entrySet()){
  BsonValue value = (BsonValue)en.getValue();
  String type = value.getBsonType().name();
}
BSON示例文档字符串,传入上面方法mogonDoc变量

BSON类型文档请见:https://docs.mongodb.com/manual/reference/bson-types/


{
    "_id" : ObjectId("6168e03a3f2817bf1f25e4fe"),
    "_class" : "com.pingan.lcloud.osp.FamilyInfo",
    "insNo" : "203669",
    "client_id" : "51A2E75F9EF64B638B123D445EB1239",
    "create_date" : ISODate("2021-09-24T01:38:45.202Z"),
    "personal_info" : {
        "client_id" : "51A2E75F9EF64B638B123D445EB1239",
        "name" : "小朱",
        "age" : 30,
        "sex" : "F",
        "birth_date" : "1992-05-30",
        "tel" : "",
        "operate_time" : ISODate("2021-09-20T19:34:03.202Z")
    }
}

drupal 拖动字段报错:PluginNotFoundException: The "hidden" plugin does not exist.

报错信息:

Drupal\Component\Plugin\Exception\PluginNotFoundException: The "hidden" plugin does not exist. Valid plugin IDs for Drupal\Core\Field\WidgetPluginManager are: comment_default, datetime_datelist, datetime_default, file_generic, image_image, link_default, path, text_textfield, text_textarea, text_textarea_with_summary, language_select, entity_reference_autocomplete_tags, number, email_default, options_buttons, string_textfield, uri, options_select, string_textarea, entity_reference_autocomplete, boolean_checkbox, datetime_timestamp in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 53 of /volume1/web/wwwroot/dev/drupal9.3/core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).
这个是因为当前网速慢,拖动字段会触发ajax请求。而ajax请求没有加载完,你就点了保存,所以报错。

解决方案,等ajax加载完,字段右边的加载图标转完。

最近遇到个问题,sqoop从tidb导入hive数据条数增多,解决方式是加上--hive-drop-import-delims

最近遇到个问题,sqoop数据条数不对,sqoop从tidb导入的数据行数比实际条数多,调查发现因为数据内容包含换行等分割符号,
所以加入下面参数,去掉多余的换行符\n, \r, and \01
--hive-drop-import-delims \

整体如下:

sqoop import   \
-D mapred.job.queue.name=${queueName} \
-D mapred.job.name=${job_name} \
-D yarn.application.classpath=${YARN_APPLICATION_CLASSPATH} \
-D mapreduce.map.memory.mb='6144' \
-D mapreduce.map.java.opts='-Xmx4916m -XX:+UseG1GC -XX:+PrintFlagsFinal -XX:+PrintReferenceGC -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintAdaptiveSizePolicy -XX:+UnlockDiagnosticVMOptions -XX:+G1SummarizeConcMark -XX:InitiatingHeapOccupancyPercent=35' \
--connect ${db_connection} \
--username ${db_username} \
--password ${db_password} \
--query " select \`revision\`, \
 \`created_by\`, \
 \`created_time\`, \
 \`updated_by\`, \
 \`updated_time\`, \
 \`id\`, \
 \`um_num\`, \
 \`feedback\`  \
 from ${source_table}  \
 where 1=1  \
 and \$CONDITIONS " \
--hive-table ${target_db}.${idld_table} \
--target-dir "${target_dir}" \
--hive-drop-import-delims \
-m=1 \
--null-string='\\N' \
--null-non-string='\\N' \
--hive-overwrite \
--hive-import;

报错信息Unable to find method ''java.lang.String org.gradle.api.artifacts.result.ComponentSelectionReason.getDescription()''.

Unable to find method ''java.lang.String org.gradle.api.artifacts.result.ComponentSelectionReason.getDescription()''.
Possible causes for this unexpected error include:
Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)

The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)

Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.

In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
解决办法很简单:升级你的idea到新版本就好了。