- 关于流媒体播放器EasyPlayer和EasyPlayerPro的介绍以及其区别
EasyDarwin
EasyDarwin音视频ffmpeg人工智能大数据ar
EasyPlayer是一款流媒体播放器系列项目,它支持多种流媒体协议的播放,包括但不限于RTSP、RTMP、HTTP、HLS、UDP、RTP、File等。除此之外,EasyPlayer还支持本地文件播放和多种功能特性,包括本地抓拍、本地录像、播放旋转、多屏播放、倍数播放等。EasyPlayer核心基于ffmpeg,稳定、高效、可靠、可控。随着多年的不断发展和迭代,EasyPlayer基于成功的实践
- python笔记14介绍几个魔法方法
抢公主的大魔王
pythonpython
python笔记14介绍几个魔法方法先声明一下各位大佬,这是我的笔记。如有错误,恳请指正。另外,感谢您的观看,谢谢啦!(1).__doc__输出对应的函数,类的说明文档print(print.__doc__)print(value,...,sep='',end='\n',file=sys.stdout,flush=False)Printsthevaluestoastream,ortosys.std
- Pandas:数据科学的超级瑞士军刀
科技林总
DeepSeek学AI人工智能
**——从零基础到高效分析的进化指南**###**一、Pandas诞生:数据革命的救世主****2010年前的数据分析噩梦**:```python#传统Python处理表格数据data=[]forrowincsv_file:ifrow[3]>100androw[2]=="China":data.append(float(row[5])#代码冗长易错!```**核心痛点**:-Excel处理百万行崩
- 【Jupyter】个人开发常见命令
TIM老师
#Pycharm&VSCodepythonJupyter
1.查看python版本importsysprint(sys.version)2.ipynb/py文件转换jupyternbconvert--topythonmy_file.ipynbipynb转换为mdjupyternbconvert--tomdmy_file.ipynbipynb转为htmljupyternbconvert--tohtmlmy_file.ipynbipython转换为pdfju
- 微服务日志追踪,Skywalking接入TraceId功能
Victor刘
微服务skywalkingjava
文章目录一、借助skywalking追加traceIdlogbacklog4j2效果二、让skywalking显示日志内容版本差异logback配置文件log4j2配置文件一、借助skywalking追加traceId背景:在微服务或多副本中难以观察一个链路的日志,需要通过唯一traceId标识来查找,下面介绍Skywalking-traceId在Java中的配置方法。介绍两种java日志的配置方
- 深入剖析 boost::unique_lock<boost::mutex>
程序员乐逍遥
C++Boost库C/C++多线程编程专题C++boost线程锁
在高并发的C++程序中,线程安全是永恒的主题。而boost::unique_lock作为Boost.Thread库中的核心组件,为开发者提供了强大、灵活且异常安全的互斥量管理机制。它不仅是RAII(ResourceAcquisitionIsInitialization)设计模式的典范,更是实现复杂线程同步逻辑的基石。一、从lock_guard的说起在介绍unique_lock之前,我们先回顾其“简
- Makefile if语句用法
java叶新东老师
c++makefile
文章目录语法1.BasicExpressions:2.LogicOperators:3.ExistenceChecks4.FileOperations5.Comparisons示例1、判断两个字符串是否相等2、判断文件路径是否目录完语法CMake中的if命令用于有条件地执行一组命令,其格式如下:if()elseif()#optionalblock,canberepeatedelse()#optio
- Spring Boot 2整合Druid的两种方式
玩代码
springboot后端javaDruid
一、自定义整合Druid(非Starter方式)适用于需要完全手动控制配置的场景添加依赖(pom.xml)com.alibabadruid1.2.8org.springframework.bootspring-boot-starter-jdbc创建配置类@ConfigurationpublicclassDruidConfig{@Bean@ConfigurationProperties(prefix
- CMS垃圾回收器和G1垃圾回收器区别_g1cms垃圾回收器区别
2401_89191885
jvm
该类所有的实例都已经被回收,也就是Java堆中不存在该类的任何实例;加载该类的ClassLoader已经被回收;该类对应的java.lang.Class对象没有在任何地方被引用,无法在任何地方通过反射访问该类的方法。3.常见的垃圾回收算法1、Mark-Sweep(标记-清除算法):(1)思想:标记清除算法分为两个阶段,标记阶段和清除阶段。标记阶段任务是标记出所有需要回收的对象,清除阶段就是清除被标
- Java 笔记 transient 用法
transient关键字用于标记不希望被序列化(Serialization)的字段。序列化是指将对象的状态保存到字节流中,以便将其传输或存储。当使用如ObjectOutputStream进行序列化时,transient修饰的字段将不会被序列化。✅1.使用场景避免序列化敏感信息privatetransientStringpassword;某些字段不需要持久化(如缓存、临时数据)privatetran
- window显示驱动开发—Direct3D 11 视频设备驱动程序接口 (DDI)
程序员王马
windows图形显示驱动开发音视频
这些设备驱动程序接口(DDI)是新的或针对Windows8更新的:CalcPrivateCryptoSessionSizeCalcPrivateAuthenticatedChannelSizeCalcPrivateVideoDecoderOutputViewSizeCalcPrivateVideoDecoderSizeCalcPrivateVideoProcessorEnumSizeCalcPri
- 群晖 File Station:集中浏览与管理 NAS 文件的工具
Trihawk宇麦科技
群晖NAS
FileStation是SynologyDSM(DiskStationManager)操作系统中的核心内建应用,以网页形式提供友好的图形界面,供用户在浏览器中管理NAS上的文件和共享资料核心功能特色1.文件浏览与管理Navigate文件夹、执行拖放上传、剪贴、重命名、移动、删除等常用操作,类似WindowsExplorer或macOSFinder的使用体验,直观且便捷支持批量操作、压缩与解压、多文
- Redis反弹Shell
波吉爱睡觉
web安全#未授权访问漏洞#SSRFredis网络安全web安全
这里我来总结几种Redis反弹Shell的方法一、利用Redis写WebShell前提条件开了web服务器,并且知道路径,还需要有文件读写增删改查的权限条件比较苛刻,但是满足条件上传就会简单一点,我们直接将文件写入www目录下,完了使用工具连接即可。语句:redis:6379>configsetdir/var/www/html/redis:6379>configsetdbfilenameshell
- pod 命令
你飞跃俊杰
创建默认的Podfile$podinit第一次使用安装框架$podinstall安装框架,不更新本地索引,速度快,但是不会升级本地代码库$podinstall--no-repo-update今后升级、添加、删除框架$podupdate更新框架,不更新本地索引,速度快可以安装新框架或者删除不用的框架,但是不会升级项目已经安装的框架$podupdate--no-repo-update查看哪些框架有更新
- 基本服务 FTP & SMB
会飞的灰大狼
Centos7linux
基本服务FTP&SMB前言:FTP简称为文件传输协议前面说的他可以做到备份的功能那么它可以做到文件传输的过程smb我们简单来说共享文件夹NFSNFS(NetworkFileSystem,网络文件系统)是一种分布式文件系统协议,允许不同计算机之间通过网络共享文件和目录,使远程文件系统像本地文件系统一样被访问。它最初由SunMicrosystems开发,现在已成为UNIX/Linux系统中常用的网络
- 使用OpenCV对视频进行处理:视频读取、视频显示和视频保存,视频追踪等
无规则ai
OpenCVopencv人工智能计算机视觉python
一.视频的读写1.从文件中读取视频并播放(1)创建读取视频的对象cap=cv2.VideoCapture(filepath)filepath:视频文件的路径(2)视频的属性信息a.获取视频的某些属性retval=cap.get(propId)propId:从0到18的数字,每个数字表示视频的属性常用的属性有属性名对应数值功能描述CAP_PROP_POS_MSEC0视频当前的播放位置,单位为毫秒。C
- 零基础学习性能测试第六章:性能难点-Jmeter实现海量用户压测
目录一、海量压测核心挑战与解决思路二、分布式压测集群搭建(百倍性能提升)1.架构设计2.实战步骤三、百万级用户参数化方案1.Redis预生成测试数据2.JMeter分段读取(避免内存溢出)3.CSV分片策略四、高并发优化配置模板1.`jmeter.properties`关键修改2.线程组配置技巧五、结果收集与监控方案1.轻量级结果存储2.实时监控看板六、海量压测实战案例:双11级流量模拟测试目标:
- Could not extract GUID in text file UserSettings\Layouts\CurrentMaximizeLayout.dwlt at line 924.
zhannghong2003
Unityunity游戏引擎
错误提示:无法在文本文件UserSettings\Layouts\CurrentMaximizeLayout.dwlt的第924行提取GUID。UnityEngine.GUIUtility:ProcessEvent(int,intptr,bool&)这个错误发生在Unity无法解析一个损坏或格式错误的布局文件(CurrentMaximizeLayout.dwlt)时。以下是解决方法:解决方案:关闭
- 如何从模型返回结构化数据
努力学习agent
langchain人工智能
with_structured_output()方法支持此方法的模型ProviderToolcallingStructuredoutputJSONmodeLocalMultimodalPackageChatAnthropic✅✅❌❌✅langchain-anthropicChatMistralAI✅✅❌❌❌langchain-mistralaiChatFireworks✅✅✅❌❌langchain
- webpack 浅谈系列之 Loader
KimYYX
webpack拥有六大核心部分:Entry、Output、Loaders、Plugins、Mode、BrowserCompatibility,这里就我的理解来稍微聊聊Loaders这个部分。1.认识Loader先放出我对loader的理解:Loader是用来逐个处理指定类型的文件。emmm...下面我们对上面那句话稍微解释下。首先我们要先明确,一个Loader是如何在webpack中配置的,见下面
- Moviepy怎样使用?
MoviePy是一个用于视频编辑和视频脚本编写的Python库。以下是使用MoviePy的步骤:安装MoviePy:在命令行中运行pipinstallmoviepy来安装MoviePy库。导入MoviePy:在Python脚本中导入MoviePy库,通常使用importmoviepy.editorasmp。创建视频对象:使用mp.VideoFileClip('视频文件路径')来创建一个视频对象。视
- moviepy用法大全
1.引用frommoviepy.editorimport*2.载入2.1载入视频video=VideoFileClip(filePath)2.2载入音频audio=AudioFileClip(filePath)2.3载入图片img=(ImageClip(videopath+videofengpi)#水印持续时间.set_duration(start_video_clip_begin.duratio
- Error: C++14 standard requested but CXX14 is not defined
闹钟又响了
在R中安装包如果遇到上述问题,基本上去修改一下Makevars文件即可。可以用vim编辑,也可以在R中编辑,如下dotR<-file.path(Sys.getenv("HOME"),".R")if(!file.exists(dotR))dir.create(dotR)M<-file.path(dotR,"Makevars")if(!file.exists(M))file.create(M)cat(
- Python操作excel,工作效率提高篇_python对xlsx文档进行操作怎么提速
2401_84266286
程序员pythonexcel网络
上面的代码是对工作簿最基本的操作,新建工作簿和保存工作簿,还有关闭当前工作簿。importosfile_path='table'file_list=os.listdir(file_path)foriinfile_list:print(i)列出文件夹下所有文件和子文件夹的名称,这是方便总结和查看文件的。importxlwingsasxwapp=xw.App(visible=False,add_boo
- 用 automake 来构建项目
守拙圆
author:守拙圆一般而言,对于小项目通常自己来编写Makefile即可。但对于大型项目,手动编写维护大型项目,编写makefile将是一项费力费时的工作。1工具介绍gnu提供了一套autotools工具来辅助用户来生成makefile,完成编译工作。此工具集包括:autoscan:此命令能够对于一个软件包或目录创建或者维护一个configure.ac文件。aclocal:此命令将configu
- 2x002 MacOS X里的Python环境变量设置
2x002MacOSX里的Python环境变量设置MacOSX里的Python环境变量设置略说:SHELL类型环境变量配置文件添加环境变量系统环境变量/etc/paths系统环境变量/etc/profile和/etc/bashrc设置NODE_ENV环境变量。退出SHELL时失效查看当前所有环境变量MacOSX里的Python环境变量设置略说:当我们安装一个软件后,然后得以使用一些与该软件相关的命
- 开源TTS
vanloswang
综合TTS
Ekhohttp://sourceforge.net/projects/e-guidedog/files/Ekho/http://www.eguidedog.net/ekho.phpflitehttp://www.speech.cs.cmu.edu/flite/
- OpenCV读取视频帧卡死的BUG修复
henysugar
opencv音视频bug
OpenCV读取指定视频文件如果异常的时候,会卡死一直不退出,问题是卡在CvCapture_MSMF::grabVideoFrame函数内,跟了一下,发现有个判断有点问题,其下面的源码:while(!stopFlag) { for(;;) { CV_TRACE_REGION("ReadSample"); if(!SUCCEEDED(hr=videoFileSour
- 【Linux】多线程:线程池的创建、日志类、RAII互斥锁、单例模式:饿汉方式与懒汉方式
小白也有开发梦
Linuxlinux单例模式日志多线程线程池c++c语言
目录一、线程池概念二、线程的封装及线程池类成员变量的介绍三、单例模式饿汉方式(EagerInitialization)懒汉方式(LazyInitialization)四、RAII类型的互斥锁五、日志类的实现六、简单的任务类创建七、线程池的创建一、线程池概念线程池(ThreadPool)是一种基于池化技术的线程使用模式,它创建了一个线程的集合,这些线程可以被多个任务重复使用。线程池的主要目的是减少在
- go: go.mod file not found in current directory or any parent directory.如何解决?
这个错误表明你正在执行goget命令,但是当前目录或任何父目录中都找不到go.mod文件。这可能是因为你的项目还没有使用GoModules进行管理。要解决这个问题,有几种方法:gomodinit其中是你的项目名称,这将创建一个新的go.mod文件。再次执行goget-ufyne.io/fyne/v2/cmd/
[email protected]正常。
- Spring中@Value注解,需要注意的地方
无量
springbean@Valuexml
Spring 3以后,支持@Value注解的方式获取properties文件中的配置值,简化了读取配置文件的复杂操作
1、在applicationContext.xml文件(或引用文件中)中配置properties文件
<bean id="appProperty"
class="org.springframework.beans.fac
- mongoDB 分片
开窍的石头
mongodb
mongoDB的分片。要mongos查询数据时候 先查询configsvr看数据在那台shard上,configsvr上边放的是metar信息,指的是那条数据在那个片上。由此可以看出mongo在做分片的时候咱们至少要有一个configsvr,和两个以上的shard(片)信息。
第一步启动两台以上的mongo服务
&nb
- OVER(PARTITION BY)函数用法
0624chenhong
oracle
这篇写得很好,引自
http://www.cnblogs.com/lanzi/archive/2010/10/26/1861338.html
OVER(PARTITION BY)函数用法
2010年10月26日
OVER(PARTITION BY)函数介绍
开窗函数 &nb
- Android开发中,ADB server didn't ACK 解决方法
一炮送你回车库
Android开发
首先通知:凡是安装360、豌豆荚、腾讯管家的全部卸载,然后再尝试。
一直没搞明白这个问题咋出现的,但今天看到一个方法,搞定了!原来是豌豆荚占用了 5037 端口导致。
参见原文章:一个豌豆荚引发的血案——关于ADB server didn't ACK的问题
简单来讲,首先将Windows任务进程中的豌豆荚干掉,如果还是不行,再继续按下列步骤排查。
&nb
- canvas中的像素绘制问题
换个号韩国红果果
JavaScriptcanvas
pixl的绘制,1.如果绘制点正处于相邻像素交叉线,绘制x像素的线宽,则从交叉线分别向前向后绘制x/2个像素,如果x/2是整数,则刚好填满x个像素,如果是小数,则先把整数格填满,再去绘制剩下的小数部分,绘制时,是将小数部分的颜色用来除以一个像素的宽度,颜色会变淡。所以要用整数坐标来画的话(即绘制点正处于相邻像素交叉线时),线宽必须是2的整数倍。否则会出现不饱满的像素。
2.如果绘制点为一个像素的
- 编码乱码问题
灵静志远
javajvmjsp编码
1、JVM中单个字符占用的字节长度跟编码方式有关,而默认编码方式又跟平台是一一对应的或说平台决定了默认字符编码方式;2、对于单个字符:ISO-8859-1单字节编码,GBK双字节编码,UTF-8三字节编码;因此中文平台(中文平台默认字符集编码GBK)下一个中文字符占2个字节,而英文平台(英文平台默认字符集编码Cp1252(类似于ISO-8859-1))。
3、getBytes()、getByte
- java 求几个月后的日期
darkranger
calendargetinstance
Date plandate = planDate.toDate();
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
Calendar cal = Calendar.getInstance();
cal.setTime(plandate);
// 取得三个月后时间
cal.add(Calendar.M
- 数据库设计的三大范式(通俗易懂)
aijuans
数据库复习
关系数据库中的关系必须满足一定的要求。满足不同程度要求的为不同范式。数据库的设计范式是数据库设计所需要满足的规范。只有理解数据库的设计范式,才能设计出高效率、优雅的数据库,否则可能会设计出错误的数据库.
目前,主要有六种范式:第一范式、第二范式、第三范式、BC范式、第四范式和第五范式。满足最低要求的叫第一范式,简称1NF。在第一范式基础上进一步满足一些要求的为第二范式,简称2NF。其余依此类推。
- 想学工作流怎么入手
atongyeye
jbpm
工作流在工作中变得越来越重要,很多朋友想学工作流却不知如何入手。 很多朋友习惯性的这看一点,那了解一点,既不系统,也容易半途而废。好比学武功,最好的办法是有一本武功秘籍。研究明白,则犹如打通任督二脉。
系统学习工作流,很重要的一本书《JBPM工作流开发指南》。
本人苦苦学习两个月,基本上可以解决大部分流程问题。整理一下学习思路,有兴趣的朋友可以参考下。
1 首先要
- Context和SQLiteOpenHelper创建数据库
百合不是茶
androidContext创建数据库
一直以为安卓数据库的创建就是使用SQLiteOpenHelper创建,但是最近在android的一本书上看到了Context也可以创建数据库,下面我们一起分析这两种方式创建数据库的方式和区别,重点在SQLiteOpenHelper
一:SQLiteOpenHelper创建数据库:
1,SQLi
- 浅谈group by和distinct
bijian1013
oracle数据库group bydistinct
group by和distinct只了去重意义一样,但是group by应用范围更广泛些,如分组汇总或者从聚合函数里筛选数据等。
譬如:统计每id数并且只显示数大于3
select id ,count(id) from ta
- vi opertion
征客丶
macoprationvi
进入 command mode (命令行模式)
按 esc 键
再按 shift + 冒号
注:以下命令中 带 $ 【在命令行模式下进行】,不带 $ 【在非命令行模式下进行】
一、文件操作
1.1、强制退出不保存
$ q!
1.2、保存
$ w
1.3、保存并退出
$ wq
1.4、刷新或重新加载已打开的文件
$ e
二、光标移动
2.1、跳到指定行
数字
- 【Spark十四】深入Spark RDD第三部分RDD基本API
bit1129
spark
对于K/V类型的RDD,如下操作是什么含义?
val rdd = sc.parallelize(List(("A",3),("C",6),("A",1),("B",5))
rdd.reduceByKey(_+_).collect
reduceByKey在这里的操作,是把
- java类加载机制
BlueSkator
java虚拟机
java类加载机制
1.java类加载器的树状结构
引导类加载器
^
|
扩展类加载器
^
|
系统类加载器
java使用代理模式来完成类加载,java的类加载器也有类似于继承的关系,引导类是最顶层的加载器,它是所有类的根加载器,它负责加载java核心库。当一个类加载器接到装载类到虚拟机的请求时,通常会代理给父类加载器,若已经是根加载器了,就自己完成加载。
虚拟机区分一个Cla
- 动态添加文本框
BreakingBad
文本框
<script> var num=1; function AddInput() { var str=""; str+="<input 
- 读《研磨设计模式》-代码笔记-单例模式
bylijinnan
java设计模式
声明: 本文只为方便我个人查阅和理解,详细的分析以及源代码请移步 原作者的博客http://chjavach.iteye.com/
public class Singleton {
}
/*
* 懒汉模式。注意,getInstance如果在多线程环境中调用,需要加上synchronized,否则存在线程不安全问题
*/
class LazySingleton
- iOS应用打包发布常见问题
chenhbc
iosiOS发布iOS上传iOS打包
这个月公司安排我一个人做iOS客户端开发,由于急着用,我先发布一个版本,由于第一次发布iOS应用,期间出了不少问题,记录于此。
1、使用Application Loader 发布时报错:Communication error.please use diagnostic mode to check connectivity.you need to have outbound acc
- 工作流复杂拓扑结构处理新思路
comsci
设计模式工作算法企业应用OO
我们走的设计路线和国外的产品不太一样,不一样在哪里呢? 国外的流程的设计思路是通过事先定义一整套规则(类似XPDL)来约束和控制流程图的复杂度(我对国外的产品了解不够多,仅仅是在有限的了解程度上面提出这样的看法),从而避免在流程引擎中处理这些复杂的图的问题,而我们却没有通过事先定义这样的复杂的规则来约束和降低用户自定义流程图的灵活性,这样一来,在引擎和流程流转控制这一个层面就会遇到很
- oracle 11g新特性Flashback data archive
daizj
oracle
1. 什么是flashback data archive
Flashback data archive是oracle 11g中引入的一个新特性。Flashback archive是一个新的数据库对象,用于存储一个或多表的历史数据。Flashback archive是一个逻辑对象,概念上类似于表空间。实际上flashback archive可以看作是存储一个或多个表的所有事务变化的逻辑空间。
- 多叉树:2-3-4树
dieslrae
树
平衡树多叉树,每个节点最多有4个子节点和3个数据项,2,3,4的含义是指一个节点可能含有的子节点的个数,效率比红黑树稍差.一般不允许出现重复关键字值.2-3-4树有以下特征:
1、有一个数据项的节点总是有2个子节点(称为2-节点)
2、有两个数据项的节点总是有3个子节点(称为3-节
- C语言学习七动态分配 malloc的使用
dcj3sjt126com
clanguagemalloc
/*
2013年3月15日15:16:24
malloc 就memory(内存) allocate(分配)的缩写
本程序没有实际含义,只是理解使用
*/
# include <stdio.h>
# include <malloc.h>
int main(void)
{
int i = 5; //分配了4个字节 静态分配
int * p
- Objective-C编码规范[译]
dcj3sjt126com
代码规范
原文链接 : The official raywenderlich.com Objective-C style guide
原文作者 : raywenderlich.com Team
译文出自 : raywenderlich.com Objective-C编码规范
译者 : Sam Lau
- 0.性能优化-目录
frank1234
性能优化
从今天开始笔者陆续发表一些性能测试相关的文章,主要是对自己前段时间学习的总结,由于水平有限,性能测试领域很深,本人理解的也比较浅,欢迎各位大咖批评指正。
主要内容包括:
一、性能测试指标
吞吐量、TPS、响应时间、负载、可扩展性、PV、思考时间
http://frank1234.iteye.com/blog/2180305
二、性能测试策略
生产环境相同 基准测试 预热等
htt
- Java父类取得子类传递的泛型参数Class类型
happyqing
java泛型父类子类Class
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import org.junit.Test;
abstract class BaseDao<T> {
public void getType() {
//Class<E> clazz =
- 跟我学SpringMVC目录汇总贴、PDF下载、源码下载
jinnianshilongnian
springMVC
----广告--------------------------------------------------------------
网站核心商详页开发
掌握Java技术,掌握并发/异步工具使用,熟悉spring、ibatis框架;
掌握数据库技术,表设计和索引优化,分库分表/读写分离;
了解缓存技术,熟练使用如Redis/Memcached等主流技术;
了解Ngin
- the HTTP rewrite module requires the PCRE library
流浪鱼
rewrite
./configure: error: the HTTP rewrite module requires the PCRE library.
模块依赖性Nginx需要依赖下面3个包
1. gzip 模块需要 zlib 库 ( 下载: http://www.zlib.net/ )
2. rewrite 模块需要 pcre 库 ( 下载: http://www.pcre.org/ )
3. s
- 第12章 Ajax(中)
onestopweb
Ajax
index.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/
- Optimize query with Query Stripping in Web Intelligence
blueoxygen
BO
http://wiki.sdn.sap.com/wiki/display/BOBJ/Optimize+query+with+Query+Stripping+in+Web+Intelligence
and a very straightfoward video
http://www.sdn.sap.com/irj/scn/events?rid=/library/uuid/40ec3a0c-936
- Java开发者写SQL时常犯的10个错误
tomcat_oracle
javasql
1、不用PreparedStatements 有意思的是,在JDBC出现了许多年后的今天,这个错误依然出现在博客、论坛和邮件列表中,即便要记住和理解它是一件很简单的事。开发者不使用PreparedStatements的原因可能有如下几个: 他们对PreparedStatements不了解 他们认为使用PreparedStatements太慢了 他们认为写Prepar
- 世纪互联与结盟有感
阿尔萨斯
10月10日,世纪互联与(Foxcon)签约成立合资公司,有感。
全球电子制造业巨头(全球500强企业)与世纪互联共同看好IDC、云计算等业务在中国的增长空间,双方迅速果断出手,在资本层面上达成合作,此举体现了全球电子制造业巨头对世纪互联IDC业务的欣赏与信任,另一方面反映出世纪互联目前良好的运营状况与广阔的发展前景。
众所周知,精于电子产品制造(世界第一),对于世纪互联而言,能够与结盟
It needs to be followed with a =true otherwise you get errors that it doesn't know how to debug...
No, you need not specify =true. Just providing -Dlog4j.debug while launching your java program works. Here's an example:
java -Dlog4j.debug org.myapp.SampleProg
You will see the log4j output something similar to:
log4j: Trying to find [log4j.xml] using context classloader sun.misc.Launcher$AppClassLoader@e80a59.
log4j: Using URL [file:/E:/Samples/log4j.xml] for automatic log4j configuration.
log4j: Preferred configurator class: org.apache.log4j.xml.DOMConfigurator
log4j: System property is :null
log4j: Standard DocumentBuilderFactory search succeded.
log4j: DocumentBuilderFactory is: org.apache.crimson.jaxp.DocumentBuilderFactoryImpl
log4j: debug attribute= "false".
I added -Dlog4j.debug, but the output is not as descriptive as what you posted. All I get is the following:
log4j: Trying to find [log4j.properties] using context classloader org.eclipse.core.runtime.internal.adaptor.ContextFinder@ede48.
log4j: Trying to find [log4j.properties] using org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader@57f993 class loader.
log4j: Trying to find [log4j.properties] using ClassLoader.getSystemResource().
log4j: Could not find resource: [log4j.properties].
I also tried adding the directory of interest to my classpath, and simply putting the file in a major directory, but log4j just can't see it.
Any ideas?
I am the same person as the above comment...
I added the PropertyConfigurator.configure($PATH_TO_FILE) command, and it worked. But I would prefer use the previous method where it gets the file from the classpath. If you have any tips on how to get that to work, I would appreciate it.
I am using eclipse, and I checked that the file is in the classpath there.
Thanks in advance.
I added -Dlog4j.debug, but the output is not as descriptive as what you posted. All I get is the following:
...
log4j: Could not find resource: [log4j.properties].
The last line shows that the log4.properties is not found in the classpath. You mention that you are using Eclipse. I guess you have not placed the log4j.properties (or log4j.xml) at the right place in the project. If you have project created in D:\MySampleApp folder, then place the log4j.properties (or log4j.xml) at the root of the project (i.e. directly in D:\MySampleApp folder).
If you have project created in D:\MySampleApp folder, then place the log4j.properties (or log4j.xml) at the root of the project (i.e. directly in D:\MySampleApp folder).
Thanks for the tip. I tried placing it in various locations within the project (at the root, in the root of the build.eclipse directory, etc.) but to no avail. I wish that the debug output would tell me where it is looking, as it did in your output. I have searched but found no way of making it more verbose.
Mark T. W. Ebbert said...
If you have project created in D:\MySampleApp folder, then place the log4j.properties (or log4j.xml) at the root of the project (i.e. directly in D:\MySampleApp folder).
Thanks for the tip. I tried placing it in various locations within the project (at the root, in the root of the build.eclipse directory, etc.) but to no avail. I wish that the debug output would tell me where it is looking, as it did in your output. I have searched but found no way of making it more verbose.
Mark, if you use Eclipse go to project properties, then Java Build Path. There you'll find currently defined classpath for your project.
For example my project defines 2 source folders on build path:
{project name}/src/main/java and {project name}/src/main/resources. I added the log4j.properties file under {project name}/src/main/resources/config/log4j.properties. Whan I ran the project I had to pass the parameter as -Dlog4j.configuration=config/log4j.propertiesand it configured log4j properly.
Hope this helps!
I had a problem with log4j too, my error was:
log4j:WARN No appenders could be found for logger ...
log4j:WARN Please initialize the log4j system properly.
To solve this problem I used :
BasicConfigurator.configure(); line on start main method.
import org.apache.log4j.BasicConfigurator;
It solved my problem. Maybe it help you too.
otmek
thanks mate, you saved me some time with this...
hi Anonymous, BasicConfigurator.configure() helped me too. thanks.
BasicConfigurator.configure() did it for me too... I put it in the initialization phase of my application listener (using JSF)
Thanks!
Thank sir, this simple command saved me a ton of time at work.
thanks.
Guys,
If you use BasicConfigurator it will work, however, you will have only console appender with log level hard set and an useless log4j.config file.
To solve it, just put log4j.config file inside src folder.
I know it may not seem to be a very clean solution, but then, you'll have time figure out how you can set your classpath to allow log4j.properties to be read from project root folder.
Best regards
You are right,
Its for console default logger.
but if we need to use log4j.properties file's custom logging then its no use.
As Roberto mentioned, put a log4j.properties file in src older but still having same waring,
log4j:WARN No appenders could be found for logger (src.com.test.Calculator).
log4j:WARN Please initialize the log4j system properly.
please help on this..
Deepa,
You mention that you placed the log4j.properties in the src folder. However, if you are still seeing that WARN message then i guess log4j did not find the log4j.properties.
As explained in the article, try using the -Dlog4j.debug option to see whether log4j is able to find the configuration file.
hi Jaikiran,
I understood the problem why log4j did not find the log4j.properties even though placing it in src folder..,
Not just for compilation it needs for running application as well (the thing which was missing :( ), so i put one copy of this properties file where the classes exit of my src.
src
--com
-- test
-- Hello.java
log4j.properties
classes
--com
-- test
-- Hello.class
log4j.properties
it works .. Thanks :)
Deepa.....
Dude that BasicConfiguration helped me a lot...Thanks very much!!!!!
Hey thanks for sharing about looking at the java build path to know where to put the log4j.properties.
Finally solve my problem when dealing with a package.
I guess, it will solve this problem if you fully qualify the class...
for example,
private static Logger log = Logger.getLogger("com.fmr.fims.deconv.XrefCnvThread.class");
instead of just private static Logger log = Logger.getLogger("XrefCnvThread.class");
hi Anonymous, BasicConfigurator.configure() helped me too. thanks.
Thank you soo much this command spared my precious hours :)
Thanks a ton for sharing this information. It helped a lot.
I just had a nightmare time debugging a problem similar to what you guys describe.
For me, the solution was to use the full "file:/" URL form. For example:
-Dlog4j.configuration=file:/jamesGosling/log4j.xml
This is briefly discussed (but totally inadequately emphasized) in the log4j manual:
http://logging.apache.org/log4j/1.2/manual.html
(See "Example 4" under the "Default Initialization under Tomcat" section)
Mark T. W. Ebbert, You save me! ;) thanks a lot!
"The last line shows that the log4.properties is not found in the classpath. You mention that you are using Eclipse. I guess you have not placed the log4j.properties (or log4j.xml) at the right place in the project. If you have project created in D:\MySampleApp folder, then place the log4j.properties (or log4j.xml) at the root of the project (i.e. directly in D:\MySampleApp"
It works...
I work in linux environment with eclipse.
I placed log4j.properties file in /src folder and it worked.
Thanks for the help.
WOW thank you Anonymous from Friday, April 01, 2011 1:06:00 PM
I had put the properties file in the classpath, and I had tried specifying the properties file via the command line parameter -Dlog4j.configuration, but neither seemed to be working. Finally, I tried specifying the file path as a URI rather than a local file path, and it finally worked.
Try this:
-Dlog4j.configuration=file:C:\MyPath\log4j.properties
instead of this:
-Dlog4j.configuration=C:\MyPath\log4j.properties
BasicConfigurator.configure();
solved my problem. Thanks for your help.
Thanks Anonymous/otmek,
BasicConfigurator solved my problem.
Vidhya
BasicConfigurator.configure() helped me!
Thanks! :)
Thanks a lot, using
BasicConfigurator.configure();
worked fine (for console output)!!!