在本文中,我们将为您详细介绍DelphiforiOS开发指南(3):创建一个FireMonkeyiOS应用程序的相关知识,并且为您解答关于delphi开发苹果app的疑问,此外,我们还会提供一些关于C
在本文中,我们将为您详细介绍Delphi for iOS开发指南(3):创建一个FireMonkey iOS应用程序的相关知识,并且为您解答关于delphi开发苹果app的疑问,此外,我们还会提供一些关于Cross Platform Development with Delphi XE7 & FireMonkey for Windows & MAC OS X、Delphi / Firemonkey在运行时更改iOS屏幕旋转、Delphi Firemonkey iOS应用程序中是否提供多点触控手势编程?、Delphi FireMonkey在应用程序中存储数据的有用信息。
本文目录一览:- Delphi for iOS开发指南(3):创建一个FireMonkey iOS应用程序(delphi开发苹果app)
- Cross Platform Development with Delphi XE7 & FireMonkey for Windows & MAC OS X
- Delphi / Firemonkey在运行时更改iOS屏幕旋转
- Delphi Firemonkey iOS应用程序中是否提供多点触控手势编程?
- Delphi FireMonkey在应用程序中存储数据
Delphi for iOS开发指南(3):创建一个FireMonkey iOS应用程序(delphi开发苹果app)
总结
以上是小编为你收集整理的Delphi for iOS开发指南(3):创建一个FireMonkey iOS应用程序全部内容。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。
Cross Platform Development with Delphi XE7 & FireMonkey for Windows & MAC OS X
总结
以上是小编为你收集整理的Cross Platform Development with Delphi XE7 & FireMonkey for Windows & MAC OS X全部内容。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。
Delphi / Firemonkey在运行时更改iOS屏幕旋转
procedure TForm1.Button1Click(Sender: TObject); var ScreenService: IFMXScreenService; OrientSet: TScreenorientations; begin if TPlatformServices.Current.SupportsPlatformService(IFMXScreenService,IInterface(ScreenService)) then begin OrientSet := [TScreenorientation.soLandscape];//<- Break point set here and line is executed ScreenService.SetScreenorientation(OrientSet); end; end;
取自这里:How to prevent screen rotation with android development in delphi xe5 Firemonkey
ScreenService.SetScreenorientation已执行且不会引发异常但方向未更改,我还在Project> Options> Application> Orientation中设置了Enable custom orientation,但这也没有任何效果.
对我来说奇怪的是,如果不支持,那么不应该这样
if TPlatformServices.Current.SupportsPlatformService(IFMXScreenService,IInterface(ScreenService))
回报错误?甚至没有进入开始
我添加了一个测试按钮来检查屏幕方向后,我将其设置为横向
if TPlatformServices.Current.SupportsPlatformService(IFMXScreenService,IInterface(ScreenService)) then begin case ScreenService.GetScreenorientation of TScreenorientation.Portrait: ShowMessage('Portrait'); TScreenorientation.Landscape: ShowMessage('landscape'); TScreenorientation.InvertedPortrait: ShowMessage('Inverted-Portrait'); TScreenorientation.InvertedLandscape: ShowMessage('Inverted-Landscape'); else ShowMessage('not set'); end; end;
如果在将它设置为横向之后它在纵向中,它仍然会说肖像
更新1:我也试过改变
OrientSet := [TScreenorientation.soLandscape] // <- Deprecated
至
OrientSet := [TScreenorientation.Landscape]
但行为仍然是一样的
解决方法
因为您无法在iOS中的iOS中伪造旋转或强制设备某些设备方向,所以您需要考虑很多方向
>设备方向
>状态栏方向
> UIViewcontroller方向
无法强制或更改设备方向,这将始终显示设备现在的方向.
然而,状态栏方向总是有你可以调用的setStatusBarOrientation过程并且指定你想要的方向,但是这被标记为已弃用,因此无效,但是当我调用该函数时,我没有得到外部异常.它仍然存在,它只是没有工作.
然后我读到了这个:
The setStatusBarOrientation:animated: method is not deprecated outright. It Now works only if the supportedInterfaceOrientations method of the top-most full-screen view controller returns 0
然后我决定尝试这个
Application.FormFactor.Orientations := []; //the supportedInterfaceOrientations returns 0 App := TUIApplication.Wrap(TUIApplication.Occlass.sharedApplication); win := TUIWindow.Wrap(App.windows.objectAtIndex(0)); App.setStatusBarOrientation(UIInterfaceOrientationLandscapeLeft);
并且它适用于状态栏方向更改,但如上所述,此协议已弃用,因此在某个阶段它可能/将会消失,这将不再起作用.
但是这只改变了状态栏和所有警报视图等的旋转,但是在我想要更改为横向的情况下,rootviewcontroller中的实际内容仍然在肖像中.
然后,我想,如果我愿意在Delphi中去Application-> Orientation->启用自定义旋转并说景观然后应用程序将仅以横向显示,并且它完美地完成,因为在创建表单然后创建rootViewcontroller时,返回的supportedInterface方向仅为landscape,Viewcontroller将转到Landscape.
因为当您的设备更改设备方向时,将根据Viewcontroller支持的接口方向评估方向,如果不支持方向,则不会旋转方向.
但是当分配新的rootviewcontroller时,必须更新GUI以在Viewcontrollers支持的方向中显示,考虑到这一点,这是我的修复/黑客将应用程序的方向更改为您想要的方向.
TL; DR
Uses: iOSapi.UIKit; procedure ChangeiOSorientation(toOrientation: UIInterfaceOrientation; possibleOrientations: TScreenorientations); var win : UIWindow; App : UIApplication; viewController : UIViewController; oucon: UIViewController; begin Application.FormFactor.Orientations := []; //Change supported orientations App := TUIApplication.Wrap(TUIApplication.Occlass.sharedApplication); win := TUIWindow.Wrap(App.windows.objectAtIndex(0)); //The first Windows is always the main Window App.setStatusBarOrientation(toOrientation); {After you have changed your statusbar orientation set the Supported orientation/orientations to whatever you need} Application.FormFactor.Orientations := possibleOrientations; viewController := TUIViewController.Wrap(TUIViewController.alloc.init);//dummy ViewController oucon := TUIViewController.Wrap(TUIViewController.alloc.init); {Now we are creating a new Viewcontroller Now when it is created it will have to check what is the supported orientations} oucon := win.rootViewController;//we store all our current content to the new ViewController Win.setRootViewController(viewController); Win.makeKeyAndVisible;// We display the Dummy viewcontroller win.setRootViewController(oucon); win.makeKeyAndVisible; {And Now we display our original Content in a new Viewcontroller with our new Supported orientations} end;
你现在所要做的就是调用ChangeiOSorientation(toOrientation,possible Orientient)
如果您想要它去Portrait,但可以选择横向
ChangeiOSorientation(UIInterfaceOrientationPortrait,[TScreenorientation.Portrait,TScreenorientation.Landscape,TScreenorientation.InvertedLandscape]);
这是在努力
>德尔福10西雅图> iPhone 5运行iOS 9.0> PA Server 17.0> Xcode 7.1> iPhoneOS 9.1 SDK
Delphi Firemonkey iOS应用程序中是否提供多点触控手势编程?
解决方法
但是:你可以解决它,比如Anders Ohlsson showed.他在Embarcadero CodeCentral上制作了modifications to Firemonkey available.
Delphi FireMonkey在应用程序中存储数据
我需要一个跨平台的解决方案.
这是我发现的RC_DATA解决方案:http://delphidabbler.com/articles?article=2
代码示例中的注释读取://资源类型 – RT_RCDATA(来自Windows单元)
我从这篇评论中得出结论,Windows单元中的代码是特定于Windows的.如果不是这样,我道歉.
既然Chris说它实际上是跨平台的,我会尝试一下.谢谢克里斯.
关于要求组件或库,我已阅读并重新阅读我的问题,我只是没有看到它.我猜一个’解决方案’可能会包含一个组件或库,但这在我看来并不存在.如果我做错了,我再次道歉.
解决方法
procedure LoadStringsFromres(Strings: TStrings; const ResName: string); var Stream: TResourceStream; begin Stream := TResourceStream.Create(HInstance,ResName,RT_RCDATA); try Strings.LoadFromStream(Stream); finally Stream.Free; end; end;
此外,如果由于某种原因您想在尝试加载之前检查给定资源是否存在,则系统单元会为非Windows平台实现Windows API FindResource函数.
嵌入式资源的替代方法是使用Project | Deployment将文件添加到应用程序包(OS X和iOS)或APK(Android).虽然这可能被认为是一种更“平台原生”的做事方式,但适当的“远程路径”是特定于平台的……坦率地说,如果一个人如此痴迷于平台原生,他们就无法处理嵌入式资源,那么他们首先不会使用FMX ……
更新:关于现在已经链接的文章,它显示了如何手动写出一个RES文件,这不是一个人通常会做的 – 如果你没有使用IDE的小资源管理器,那么通常的方法是创建一个RC脚本并使用Borland或Microsoft资源编译器进行编译.
我们今天的关于Delphi for iOS开发指南(3):创建一个FireMonkey iOS应用程序和delphi开发苹果app的分享已经告一段落,感谢您的关注,如果您想了解更多关于Cross Platform Development with Delphi XE7 & FireMonkey for Windows & MAC OS X、Delphi / Firemonkey在运行时更改iOS屏幕旋转、Delphi Firemonkey iOS应用程序中是否提供多点触控手势编程?、Delphi FireMonkey在应用程序中存储数据的相关信息,请在本站查询。
在这篇文章中,我们将为您详细介绍Delphi第三方皮肤组件AlphaControls的下载和使用方法的内容,并且讨论关于delphi 皮肤的相关问题。此外,我们还会涉及一些关于Alpha Controls for Delphi、AlphaControls 对 NoteBook 非首页未开启皮肤问题解决、Delphi 2009中的“Delphi Fundamentals”、Delphi ADOQuery的 DisableControls 和 EnableControls方法的知识,以帮助您更全面地了解这个主题。
本文目录一览:- Delphi第三方皮肤组件AlphaControls的下载和使用方法(delphi 皮肤)
- Alpha Controls for Delphi
- AlphaControls 对 NoteBook 非首页未开启皮肤问题解决
- Delphi 2009中的“Delphi Fundamentals”
- Delphi ADOQuery的 DisableControls 和 EnableControls方法
Delphi第三方皮肤组件AlphaControls的下载和使用方法(delphi 皮肤)
总结
以上是小编为你收集整理的Delphi第三方皮肤组件AlphaControls的下载和使用方法全部内容。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。
Alpha Controls for Delphi
总结
以上是小编为你收集整理的Alpha Controls for Delphi全部内容。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。
AlphaControls 对 NoteBook 非首页未开启皮肤问题解决
AlphaControls 是 著名的 Delphi 第三方皮肤组件,使用非常方便,只需加一个 TsSkinManager 组件,再指定所用皮肤名,即可对 Delphi 开发的程序进行美化。但使用中发现有一个组件 NoteBook, TsSkinManager仅对其首页 进行了美化,当 NoteBook有多个页面时,转到其他页面,发现其中的控件都没有美化,目前最新版是 13.19, 所有版本这个问题一直存在。这里给出了解决的办法:
if btn1.Tag = 0 then // 如果尚未 美化,则美化处理
begin
sknmngr1.BeginUpdate;
nb1.pageindex := 0;
sknmngr1.EndUpdate(True);
btn1.Tag := 1;
end else // 已经处理过,直接转到相应页面即可
nb1.pageindex := 0;
Delphi 2009中的“Delphi Fundamentals”
我在我的项目中使用词典(cArrays.pas,cDictionaries.pas,cStrings.pas,cTypes.pas),现在我在升级代码时遇到了一些麻烦.
如果有人能够在Delphi 2009中转换上述单位,我将非常感激.我对Delphi很新,从2007年开始工作,2009年已经发布,我只是无法帮助自己……
谢谢
解决方法
经过30分钟的搜索和替换,像疯子一样,我让他们在Delphi 2009中编译,只有几个警告要修复.
> Char>>>> AnsiChar
>字符串>>>> AnsiString
> PChar>>>> PAnsiChar
> PString>>>> PAnsiString
它通过了所有的自我测试,到目前为止似乎工作正常.我在这里分享了它:http://www.xs4all.nl/~niff/Fundamentals_UtilsD2009.zip
更新我已经将一个移植的cDataStructs.pas添加到zipfile,其中包含字典类.这个仍然有许多编译器警告,你可能想要修复,但自检通过,所以你可以尝试看看它是否适合你..
Delphi ADOQuery的 DisableControls 和 EnableControls方法
disableControls方法是在程序修改或后台有刷新记录的时候切断数据组件,如TTABLE、ADOQUERY等等与组件数据源的联系。如果没有切断,数据源中只要一有数据的改动,尤其是批量改动的话,每一笔的改动都会更新窗口中数据浏览组件的显示,这样会急剧减慢处理过程而且浪费时间。
EnableControls的作用相反,用来恢复TTABLE等组件与DATASOURCE的联系,并促使数据浏览组件更新显示。
这两个函数主要作用:阻止组件感应显示,以加快语句执行速度。 比如,用大量的循环的时候,最好用他们。
注意事项:
1. 数据集的EnableControls, disableControls方法成对使用的时候, 如果中间的代码可能会导至出错的话必须用try..finaly disableControls; end; 否则会导致数据感知不控制不可使用;
2. 在遍历数据或Filter大数据的时候的要用 DataSet 的 EnableControls 与 disabbleControls, 否则窗体上的数据感知控件会闪烁.enablecontrols,disablecontrols是防止因数据源的改动而造成界面的闪动!在你需要刷新数据时可以调这两个函数,但建议你把它写在
try...finally语句块中! 如:
try
ADOQuery1.disablecontrols;
ADOQuery1.close;
ADOQuery1.open;
finally
ADOQuery1.enablecontrols;
end;
TQuery 的 EnableControls 和disableControls 方法都是继承自TDataSet 类的。由于TTable 和TQuery 都是TDataSet 的派生类,
所以它们也适用以上这两个方法。
关于Delphi第三方皮肤组件AlphaControls的下载和使用方法和delphi 皮肤的介绍已经告一段落,感谢您的耐心阅读,如果想了解更多关于Alpha Controls for Delphi、AlphaControls 对 NoteBook 非首页未开启皮肤问题解决、Delphi 2009中的“Delphi Fundamentals”、Delphi ADOQuery的 DisableControls 和 EnableControls方法的相关信息,请在本站寻找。
在这篇文章中,我们将为您详细介绍Delphi 皮肤控件AlphaControls的使用的内容,并且讨论关于c# 皮肤控件的相关问题。此外,我们还会涉及一些关于Alpha Controls for Delphi、AlphaControls 对 NoteBook 非首页未开启皮肤问题解决、Delphi 2009中的“Delphi Fundamentals”、Delphi 7皮肤控件VCLSkin 5 60的使用的知识,以帮助您更全面地了解这个主题。
本文目录一览:- Delphi 皮肤控件AlphaControls的使用(c# 皮肤控件)
- Alpha Controls for Delphi
- AlphaControls 对 NoteBook 非首页未开启皮肤问题解决
- Delphi 2009中的“Delphi Fundamentals”
- Delphi 7皮肤控件VCLSkin 5 60的使用
Delphi 皮肤控件AlphaControls的使用(c# 皮肤控件)
总结
以上是小编为你收集整理的Delphi 皮肤控件AlphaControls的使用全部内容。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。
Alpha Controls for Delphi
总结
以上是小编为你收集整理的Alpha Controls for Delphi全部内容。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。
AlphaControls 对 NoteBook 非首页未开启皮肤问题解决
AlphaControls 是 著名的 Delphi 第三方皮肤组件,使用非常方便,只需加一个 TsSkinManager 组件,再指定所用皮肤名,即可对 Delphi 开发的程序进行美化。但使用中发现有一个组件 NoteBook, TsSkinManager仅对其首页 进行了美化,当 NoteBook有多个页面时,转到其他页面,发现其中的控件都没有美化,目前最新版是 13.19, 所有版本这个问题一直存在。这里给出了解决的办法:
if btn1.Tag = 0 then // 如果尚未 美化,则美化处理
begin
sknmngr1.BeginUpdate;
nb1.pageindex := 0;
sknmngr1.EndUpdate(True);
btn1.Tag := 1;
end else // 已经处理过,直接转到相应页面即可
nb1.pageindex := 0;
Delphi 2009中的“Delphi Fundamentals”
我在我的项目中使用词典(cArrays.pas,cDictionaries.pas,cStrings.pas,cTypes.pas),现在我在升级代码时遇到了一些麻烦.
如果有人能够在Delphi 2009中转换上述单位,我将非常感激.我对Delphi很新,从2007年开始工作,2009年已经发布,我只是无法帮助自己……
谢谢
解决方法
经过30分钟的搜索和替换,像疯子一样,我让他们在Delphi 2009中编译,只有几个警告要修复.
> Char>>>> AnsiChar
>字符串>>>> AnsiString
> PChar>>>> PAnsiChar
> PString>>>> PAnsiString
它通过了所有的自我测试,到目前为止似乎工作正常.我在这里分享了它:http://www.xs4all.nl/~niff/Fundamentals_UtilsD2009.zip
更新我已经将一个移植的cDataStructs.pas添加到zipfile,其中包含字典类.这个仍然有许多编译器警告,你可能想要修复,但自检通过,所以你可以尝试看看它是否适合你..
Delphi 7皮肤控件VCLSkin 5 60的使用
VCLSkin是一个能够用于创建Delphi/C++ Builder应用程序美化界面的皮肤组件。它允许允许软件开发人员不用修改程序代码便把软件界面变得非常漂亮。它的美化支持窗体和控件和菜单。VCLSkin同时也提供了大量高质量的skin(皮肤)让你应用于你的程序。
官方网站:http://www.link-rank.com /
安装步骤:
1.从网上下载VCLSkin,我这里下载到的是5.6 Full Source版本,解压到硬盘;
2.打开Delphi 7→菜单栏→Tools→Environment Options→Library→右边的“...”,添加刚才解压的VCLSkin目录下package文件夹和source文件夹,如下图所示:
3.下面打开Delphi 7使用的VCLSkin版本,菜单栏→File→Open→.../VCLSKIN/package/WinSkinD7R.dpk ,弹出对话框提示找不到资源文件,如下:
Cannot find resource file: F:/***/VCLSKIN/package/WinSkinD7R.res. Recreated.
点击OK,就会重建了。然后,在Package对话框点击Options,在Description选项卡→Usage Options,选中Designtime and runtime ,按OK确定,再点击Compile 就可以了。如下图所示:
保存文件,关闭文件。
4.跟上面步骤一样打开.../VCLSKIN/package/WinSkinD7D.dpk ,也一样弹出找不到资源文件,按OK重建。点击Compile,然后再点Install,安装顺利的话就会弹出安装成功对话框,提示新组件 WinSkinData.TSkinData,WinSkinStore.TSkinStore注册完成,如下图所示:
保存文件,关闭文件。在面板上多了VCLSkin面板,下面2个组件,分别为TSkinData 和TSkinStore ,TSkinData 主要用于美化你的程序,只要把TSkinData控件放下去,它就能自动美化所有窗体;TSkinStore 能让你在设计模式时储存多个skin文件。
5.下面开始测试应用。新建一个应用程序,拖动SkinData控件到窗体上,设置其SkinStore 属性,这是可以把skin文件储存在应用程序当中,然后设置Active 属性为True,编译运行程序,效果如下图所示:
再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!http://www.captainbed.net
今天关于Delphi 皮肤控件AlphaControls的使用和c# 皮肤控件的介绍到此结束,谢谢您的阅读,有关Alpha Controls for Delphi、AlphaControls 对 NoteBook 非首页未开启皮肤问题解决、Delphi 2009中的“Delphi Fundamentals”、Delphi 7皮肤控件VCLSkin 5 60的使用等更多相关知识的信息可以在本站进行查询。
本文将介绍关于delphi SetLength函数一个错误,请大家帮忙看看的详细情况,特别是关于delphi setlength函数 引用哪个单元的相关信息。我们将通过案例分析、数据研究等多种方式,帮助您更全面地了解这个主题,同时也将涉及一些关于C# Socket的问题,请大家帮忙看一看、centos6 做软raid 遇到一些问题 请大家帮忙看看、Delphi Setlength 内存释放总结、delphi SetLength 函数的知识。
本文目录一览:- 关于delphi SetLength函数一个错误,请大家帮忙看看(delphi setlength函数 引用哪个单元)
- C# Socket的问题,请大家帮忙看一看
- centos6 做软raid 遇到一些问题 请大家帮忙看看
- Delphi Setlength 内存释放总结
- delphi SetLength 函数
关于delphi SetLength函数一个错误,请大家帮忙看看(delphi setlength函数 引用哪个单元)
总结
以上是小编为你收集整理的关于delphi SetLength函数一个错误,请大家帮忙看看全部内容。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。
C# Socket的问题,请大家帮忙看一看
先谢谢大家。软件环境是 .net 3.5
Socket 服务器采用的是SocketAsyncEventAgrs 类来写的。
首先描述下需求。此项目分为3个模块,A是接收数据服务器,专门负责客户端发来的数据,进行初步匹配,B是解析服务器,专门解析数据,C是数据库服务器,把解析后的数据放入数据库
接着说一下详细流程,A接收到数据后,把数据放入队列线程,在队列线程中进行初步匹配,然后把匹配后的数据发送到B解析,现在问题出来了,
1,如果我单开一个发送数据的线程,包含一个Socket,就是把初步匹配后的数据放入这个发送线程,然后再发往B服务器。这样做的问题是,假如客户端500个连接,每秒发一条数据上来,然后队列线程匹配后放入发送线程再发往B,可是一秒钟处理不了500条数据,下一秒又有500条上来,这样一来,内存就一直网上飚,飙到1G多,程序就崩溃了。
2,出现了1中的情况,我把程序改了一下,在队列线程放一个socket,然后队列线程匹配数据后直接发往B。这样以来不到1分钟,B就崩溃了。
实在找不到原因。请大家帮忙看一下,感激不尽
注:队列线程匹配数据是用线程池来处理的。
centos6 做软raid 遇到一些问题 请大家帮忙看看
centos6 做软raid 遇到一些问题
开始 mknod /dev/md0 b 9 0 没有信息提示(这个应该是成功了的)
然后 mdadm --detail /dev/md0 的时候,报以下错:
Delphi Setlength 内存释放总结
总结
以上是小编为你收集整理的Delphi Setlength 内存释放总结全部内容。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。
delphi SetLength 函数
总结
以上是小编为你收集整理的delphi SetLength 函数全部内容。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。
今天关于关于delphi SetLength函数一个错误,请大家帮忙看看和delphi setlength函数 引用哪个单元的介绍到此结束,谢谢您的阅读,有关C# Socket的问题,请大家帮忙看一看、centos6 做软raid 遇到一些问题 请大家帮忙看看、Delphi Setlength 内存释放总结、delphi SetLength 函数等更多相关知识的信息可以在本站进行查询。
如果您对Delphi学习之Initialization和finalizaton感兴趣,那么本文将是一篇不错的选择,我们将为您详在本文中,您将会了解到关于Delphi学习之Initialization和finalizaton的详细内容,我们还将为您解答delphi inifile的相关问题,并且为您提供关于(Review cs231n) Spatial Localization and Detection(classification and localization)、@Transactional方法中的LazyInitializationException、c# – NHibernate.LazyInitializationException、Code-Serialization:System.Web.Serialization.JavaScriptSerializer.cs的有价值信息。
本文目录一览:- Delphi学习之Initialization和finalizaton(delphi inifile)
- (Review cs231n) Spatial Localization and Detection(classification and localization)
- @Transactional方法中的LazyInitializationException
- c# – NHibernate.LazyInitializationException
- Code-Serialization:System.Web.Serialization.JavaScriptSerializer.cs
Delphi学习之Initialization和finalizaton(delphi inifile)
总结
以上是小编为你收集整理的Delphi学习之Initialization和finalizaton全部内容。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。
(Review cs231n) Spatial Localization and Detection(classification and localization)
重在图像的定位和检测的内容。
一张图片中只有一种给定类别标签的对象,定位则是图像中有对象框;再这些类中,每一个训练目标都有一个类和许多的图像内部对应类的位置选框。
猜想的仅是类标签,不如说它们是位置选框。正确的位置选框,代表你的结果很接近分割的准确率。
研究定位的简单有用基础的范式,就是回归。
这张图片经过一系列的处理过程,最终生成四个代表选框大小的实数,有很多不同的参数来描述选框,人们常用的是用 XY 坐标定位选框的左上角
、宽度和高度,还有一些 ground truth(真实准确的选框),计算欧式损失。
训练流程:
1. 用 ground truth 边框对许多批样本进行抽样,and forward
2.get the loss between the predicted results and ground truth. and carry out the backward
3.download the trained models like VGG、AlexNet. and get the FC layers of class scores
4. 现在在这个网络里再接上一些新的全连接层,称为回归网络 (regression head),输出的是一些实数。
5. 训练这一个回归网络像训练分类网络一样,唯一的区别就是 class scores 和 class 的损失替换成了 L2 loss 和
ground true 选框。
6. finally get the classification network and the regression network
Detail note:在进行回归时一共有两种主要方式,不定类回归 (class-logostic regress) :全连接层都使用相同的结构和权值来得到边界框 (bounding box)
and 特定类回归(class- specific regress) :输出的是 C * 4 个数字,相当于每种类别有一个边界框。
两种回归的 Discussion: 对一只猫和对火车确定边界总是有一些不同,你需要网络中有不同的处理来应对这个问题,
它稍微改变了计算损失的方式,它不仅仅是使用 ground truth class 来计算损失。
网络在哪一个位置进行回归?
我们可以用这个框架对不止一种物体来划定边界框,输入一张图片,你需要提前知道固定数量的物体进行划定边界框,回归层
输出对于每个物体的边界框,同样训练。
应用于人类姿势判别:需要去找到人类的特定的关节,能够在 XY 轴上找每个关节的位置,从而让我们对这个人的姿势进行预测。
Idea 2: sliding window
思路:和之前的方法相比不只是运行一次,而是在不同的位置多次进行,再将不同的位置进行聚合。
Overfeat 的结构:
过程:输入图片,在图片左上方进行分类和定位,进而得到类的分数和相应的边界框。重复这个操作,使用相同的分类和
定位网络,在这个图片的四个角落都运行一次,最终得到四个边界框,对于每个位置都有一个边界框和类的分数,并使用一些方法对边界框和分数进行合并,组合和据集不同位置的边界框可以帮助这个模型进行错误修正。
1. 在实际操作中要使用远对于四个的边界框;
2. 进行回归时,输出的是表示边界框的四个数字,这个数字理论上可能出现在任何地方,他不一定在图片内部,当你在用
sliding window 方法进行训练的时候,你对不同位置进行操作时坐标轴为进行一些改变,事实上,它们选取的位置对于四种.
Discussion: 高效的方法; 网络通常包含卷积网络和全连接网络,一个全连接网络由 4096 个数字构成,是一个 vector,如果不把他看成一个 vector, 而将他看成另一个卷积的特征映射,这个方法是将全连接层转换成了卷积层,我们得到一个卷积特征映射;考虑通过一个 5*5 的卷积层,而不是特征特征映射。之后将全连接层转换为 1*1 的卷积。
我们使用了卷积运算替换了原先的全连接层,优势:网络只由卷积层和池化层的元素构成了,我们就可以使用不同尺寸的图片来运行网络,就可以处理不同尺寸的图片了,在不同大小的图片上使用相同的计算过程。
Discussion:
1、ResNet 使用了另外一种定位算法叫 RPN(region proposal network)
2、在 L2 损失值有一个极端值时,是很不好的,所以人们一般不用 L2,也可以使用 L1 损失值,帮助解决极端值的问题,用一个平滑 L1 函数(Huber 损失),看起来和普通的 L1 差不多,但在接近 0 的时候更像二次函数,但是里面有噪声的话就不会那么有效。
3. 不要选取非反向传播的网络;
4. 因为在测试环节,你用的类和训练环节一样,在训练中也需要测试,我们不要求去做不同类之间的泛化,这太难了。
5. 实际上人们有时候使用同一个网络,同时训练;有时候人们会分开,用一个网络训练回归,用另一个网络训练分类,两种都可以。
@Transactional方法中的LazyInitializationException
在执行以下操作org.hibernate.LazyInitializationException
时,当我尝试访问延迟加载的异常时遇到错误:
@Transactional
public void displayAddresses()
{
Person person = getPersonByID(1234);
List<Address> addresses = person.getAddresses(); // Exception Thrown Here
for(Address address : addresses)
System.out.println(address.getFullAddress());
}
我的实体看起来像这样:
@Entity
@Table("PERSON_TBL")
public class Person
{
...
@OneToMany(cascade=CascadeType.ALL,targetEntity=Address.class,mappedBy="person")
private List<Address> addresses;
...
}
@Entity
@Table("ADDRESS_TBL")
public class Address
{
...
@ManyToOne(targetEntity=Person.class)
@JoinColumn(name="PERSON_ID",referencedColumnName="PERSON_ID")
Person person;
...
}
我的印象是,通过在我的displayAddresses()
方法中使用@Transactional批注,它将使会话保持活动状态,直到该方法完成为止,从而使我可以访问延迟加载的Address集合。
我想念什么吗?
编辑
按照Tomasz的建议:在我的displayAddresses()
方法中,状态TransactionSynchronizationManager.isActualTransactionActive(),
变为false
。
这确实可以缩小问题的范围,但是为什么此时我的“交易”不能处于活动状态?
c# – NHibernate.LazyInitializationException
NHibernate.LazyInitializationException: Failed to lazily initialize a collection,no session or session was closed
在对象中的另一个集合上发生此错误.如果我添加:
.Not.LazyLoad()
对于我的Fluent映射,错误在我的项目周围移动.我一直禁止对对象的延迟加载,直到它没有延迟加载的地方,然后它抛出了这个错误:
NHibernate.LazyInitializationException: Could not initialize proxy – no Session.
所以,然后我在懒惰的装载上取出了遗嘱,现在我又恢复了原点.当我递增此视图计数器时,它只会出错.这是我的基类保存代码的片段:
using (ISession session = GetSession()) using (ITransaction tx = session.BeginTransaction()) { session.SaveOrUpdate(entity); tx.Commit(); }
环顾四周,我在另一篇文章中读到这些交易可能会导致问题,但这是因为它们被放置在哪里.此代码扩展到与我的域对象(存储库类)分开的类.这是帖子:
hibernate: LazyInitializationException: could not initialize proxy
我不相信这是我的问题.这是第一个抛出错误的集合的流畅映射.还有其他几个类似的集合.
HasManyToMany(x => x.Votes) .WithTableName("PostVotes") .WithParentKeyColumn("PostId") .WithChildKeyColumn("VoteId");
解决方法
Code-Serialization:System.Web.Serialization.JavaScriptSerializer.cs
ylbtech-Code-Serialization:System.Web.Serialization.JavaScriptSerializer.cs |
using System;
using System.Collections.Generic;
using System.Web.Script.Serialization; //引用序列化类库
public partial class _Default : System.Web.UI.Page
{
/// <summary>
/// 应对 Json.NET 使用序列化和反序列化。 为启用 AJAX 的应用程序提供序列化和反序列化功能。
/// ByYlbtech
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
var RegisteredUsers = new List<Person>();
RegisteredUsers.Add(new Person() { PersonID = 1, Name = "Bryon Hetrick", Registered = true });
RegisteredUsers.Add(new Person() { PersonID = 2, Name = "Nicole Wilcox", Registered = true });
RegisteredUsers.Add(new Person() { PersonID = 3, Name = "Adrian Martinson", Registered = false });
RegisteredUsers.Add(new Person() { PersonID = 4, Name = "Nora Osborn", Registered = false });
// 1、创建JavaScriptSerializer
var serializer = new JavaScriptSerializer();
// 2、序列化
// 将对象转换为 JSON 字符串
var serializedResult = serializer.Serialize(RegisteredUsers);
// Produces string value of:
// [
// {"PersonID":1,"Name":"Bryon Hetrick","Registered":true},
// {"PersonID":2,"Name":"Nicole Wilcox","Registered":true},
// {"PersonID":3,"Name":"Adrian Martinson","Registered":false},
// {"PersonID":4,"Name":"Nora Osborn","Registered":false}
// ]
// 3、反序列化
// 将指定的 JSON 字符串转换为 T 类型的对象
var deserializedResult = serializer.Deserialize<List<Person>>(serializedResult);
// Produces List with 4 Person objects
}
/// <summary>
/// Person实体类
/// </summary>
public class Person {
/// <summary>
/// 编号【PK】
/// </summary>
public int PersonID { get; set; }
/// <summary>
/// 姓名
/// </summary>
public string Name { get; set; }
/// <summary>
/// 是否注册
/// </summary>
public bool Registered { get; set; }
}
}

出处:http://ylbtech.cnblogs.com/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
关于Delphi学习之Initialization和finalizaton和delphi inifile的问题我们已经讲解完毕,感谢您的阅读,如果还想了解更多关于(Review cs231n) Spatial Localization and Detection(classification and localization)、@Transactional方法中的LazyInitializationException、c# – NHibernate.LazyInitializationException、Code-Serialization:System.Web.Serialization.JavaScriptSerializer.cs等相关内容,可以在本站寻找。
如果您对Delphi系统托盘组件 TTrayIcon 简介感兴趣,那么这篇文章一定是您不可错过的。我们将详细讲解Delphi系统托盘组件 TTrayIcon 简介的各种细节,此外还有关于Delphi 2007下安装GraphicEx组件、Delphi 2010:TRTTIConstructor发生了什么?、Delphi 7下最小化到系统托盘、Delphi CoolTrayIcon组件的使用的实用技巧。
本文目录一览:- Delphi系统托盘组件 TTrayIcon 简介
- Delphi 2007下安装GraphicEx组件
- Delphi 2010:TRTTIConstructor发生了什么?
- Delphi 7下最小化到系统托盘
- Delphi CoolTrayIcon组件的使用
Delphi系统托盘组件 TTrayIcon 简介
总结
以上是小编为你收集整理的Delphi系统托盘组件 TTrayIcon 简介全部内容。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。
Delphi 2007下安装GraphicEx组件
总结
以上是小编为你收集整理的Delphi 2007下安装GraphicEx组件全部内容。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。
Delphi 2010:TRTTIConstructor发生了什么?
>我正在阅读巴里凯利(Barry Kelly)看起来像conference talk的薄片,并在第二页上找到. 13看起来很有趣的东西:TRTTIConstructor.Invoke.在相邻的项目符号点中,可以找到“动态构造实例而无需虚拟构造函数和元类”.这似乎是一个很棒的功能(正是我需要的,顺便说一下)!但是,当我查看D2010文档(ms-help://embarcadero.rs2010/vcl/Rtti.html)时,我找不到它.它被撤销了吗?
>如果类名存储在字符串中,创建类实例的最小方法是什么?
解决方法
至于问题2,尝试这样的事情:
function GetConstructor(val: TRttiInstanceType): TRttiMethod; var method: TRttiMethod; begin for method in val.getmethods('Create') do begin if (method.IsConstructor) and (length(method.GetParameters) = 0) then exit(method); end; raise EInsufficientRTTI.CreateFmt('No simple constructor available for class %s ',[val.Metaclasstype.ClassName]); end;
这将找到名为Create的最高构造函数,该构造函数不带参数.如果您知道要查找的内容,可以对其进行修改以查找具有其他签名的其他构造函数.然后只需在结果上调用Invoke.
Delphi 7下最小化到系统托盘
总结
以上是小编为你收集整理的Delphi 7下最小化到系统托盘全部内容。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。
Delphi CoolTrayIcon组件的使用
总结
以上是小编为你收集整理的Delphi CoolTrayIcon组件的使用全部内容。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。
今天关于Delphi系统托盘组件 TTrayIcon 简介的分享就到这里,希望大家有所收获,若想了解更多关于Delphi 2007下安装GraphicEx组件、Delphi 2010:TRTTIConstructor发生了什么?、Delphi 7下最小化到系统托盘、Delphi CoolTrayIcon组件的使用等相关知识,可以在本站进行查询。
这篇文章主要围绕Delphi学习之函数参数修饰中的var 、out和const和delphi函数参考大全展开,旨在为您提供一份详细的参考资料。我们将全面介绍Delphi学习之函数参数修饰中的var 、out和const的优缺点,解答delphi函数参考大全的相关问题,同时也会为您带来C++ 学习之函数重载、基于const的重载、C++中const修饰函数,函数参数,函数返回值的作用、C++学习之:cout和cin用法总结、delphi – List和Contains方法的实用方法。
本文目录一览:- Delphi学习之函数参数修饰中的var 、out和const(delphi函数参考大全)
- C++ 学习之函数重载、基于const的重载
- C++中const修饰函数,函数参数,函数返回值的作用
- C++学习之:cout和cin用法总结
- delphi – List和Contains方法
Delphi学习之函数参数修饰中的var 、out和const(delphi函数参考大全)
总结
以上是小编为你收集整理的Delphi学习之函数参数修饰中的var 、out和const全部内容。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。
C++ 学习之函数重载、基于const的重载
函数重载
函数重载的定义是:在相同的作用域中,如果函数具有相同名字而仅仅是形参表不同,此时成为函数重载。注意函数重载不能基于不同的返回值类型进行重载。
注意函数重载中的“形参表”不同,是指本质不同,不要被一些表象迷惑。main函数不能被重载。
下面三组定义本质是相同的,不是重载:
1)int sum (int &a); 和 int sum (int &);
2) int sum (int a) 和 int sum (const int a);
3)typedef int DD;
int sum(int a); 和 int sum (DD a);
其中第二个例子对于非引用传参,形参是否const是等价的。但是当使用引用传参时,有无const是不同的。使用指针传参时,指向const对象的指针和指向非const对象的指针做形参的函数是不同的。《C++ primer》一书中这样描述:“可基于函数的引用形参是指向 const 对象还是指向非 const 对象,实现函数重载。将引用形参定义为 const 来重载函数是合法的,因为编译器可以根据实参是否为 const 确定调用哪一个函数。”
对于函数值传递的情况,因为参数传递是通过复制实参创建一个临时变量传递进函数的,函数内只能改变临时变量,但无法改变实参。则这个时候无论加不加const对实参不会产生任何影响。但是在引用或指针传递函数调用中,因为传进去的是一个引用或指针,这样函数内部可以改变引用或指针所指向的变量,这时const 才是实实在在地保护了实参所指向的变量。因为在编译阶段编译器对调用函数的选择是根据实参进行的,所以,只有引用传递和指针传递可以用是否加const来重载。
#include<iostream>
class A{
public:
A();
int foo(int *test);//可看做:int foo(A *this,int *test);
int foo(const int *test);//可看做:int foo(const A *this,int *test);
};
A::A(){
}
int A::foo(int *test){
std::cout << *test << " A::foo(int *test)" <<std::endl;
return 1;
}
int A::foo(const int *test){
std::cout << *test << " A::foo(const int *test)" <<std::endl;
return 1;
}
int main()
{
const int b =5;
int c = 3;
A a;
a.foo(&b);
a.foo(&c);
return 1;
}
*下面谈论一个比较恶心的问题,基于const的重载。
在类中会有这样一种重载,它是合法的。
Class A {
int function ();
int function () const;
};
可以看到在A类中,function函数是发生重载了,而且是合法的。而且在调用时,只用A类的const对象才能调用const版本的function函数,而非const对象可以调用任意一种,通常非const对象调用不是const版本的function函数。
原因是:按照函数重载的定义,函数名相同而形参表有本质不同的函数称为重载。在类中,由于隐含的this形参的存在,const版本的function函数使得作为形参的this指针的类型变为指向const对象的指针,而非const版本的使得作为形参的this指针就是正常版本的指针。此处是发生重载的本质。重载函数在最佳匹配过程中,对于const对象调用的就选取const版本的成员函数,而普通的对象调用就选取非const版本的成员函数。
(注:this指针是一个const指针,地址不能改,但能改变其指向的对象或者变量)
#include <iostream>
using namespace std;
class A{
public:
int fun()
{
return 10;
}
int fun()const
{
return 5;
}
};
int main()
{
A a1;
cout << a1.fun() << endl;
const A a2;
cout << a2.fun() << endl;
}
http://blog.csdn.net/guiyinzhou/article/details/6307754
C++中const修饰函数,函数参数,函数返回值的作用
原博客:https://blog.csdn.net/my_mao/article/details/22872149
const修饰函数
在类中将成员函数修饰为const表明在该函数体内,不能修改对象的数据成员而且不能调用非const函数。为什么不能调用非const函数?因为非const函数可能修改数据成员,const成员函数是不能修改数据成员的,所以在const成员函数内只能调用const函数。
#include <iostream>
using namespace std;
class A{
private:
int i;
public:
void set(int n){ //set函数需要设置i的值,所以不能声明为const
i = n;
}
int get() const{ //get函数返回i的值,不需要对i进行修改,则可以用const修饰。防止在函数体内对i进行修改。
return i;
}
};
const修饰函数参数
防止传入的参数代表的内容在函数体内被改变,但仅对指针和引用有意义。因为如果是按值传递,传给参数的仅仅是实参的副本,即使在函数体内改变了形参,实参也不会得到影响。如:
void fun(const int i){
i = 10;
}
在函数体内是不能改变i的值的,但是没有任何实际意义。
const修饰的函数参数是指针时,代表在函数体内不能修改该指针所指的内容,起到保护作用,在字符串复制的函数中保证不修改源字符串的情况下,实现字符串的复制。
void fun(const char * src, char * des){ //保护源字符串不被修改,若修改src则编译出错。
strcpy(des,src);
}
void main(){
char a[10]="china";
char b[20];
fun(a,b);
cout<<b<<endl;
}
而且const指针可以接收非const和const指针,而非const指针只能接收非const指针。
const修饰引用时:如果函数参数为用户自定义的类对象如:
void h(A a){
…………
…………
}
传递进来的参数a是实参对象的副本,要调用构造函数来构造这个副本,而且函数结束后要调用析构函数来释放这个副本,在空间和时间上都造成了浪费,所以函数参数为类对象的情况,推荐用引用。但按引用传递,造成了安全隐患,通过函数参数的引用可以修改实参的内部数据成员,所以用const来保护实参。
void h(const A & a){
…………
…………
}
const修饰函数返回值
也是用const来修饰返回的指针或引用,保护指针指向的内容或引用的内容不被修改,也常用于运算符重载。归根究底就是使得函数调用表达式不能作为左值。
#include <iostream>
using namespace std;
class A {
private:
int i;
public:
A(){i=0;}
int & get(){
return i;
}
};
void main(){
A a;
cout<<a.get()<<endl; //数据成员值为0
a.get()=1; //尝试修改a对象的数据成员为1,而且是用函数调用表达式作为左值。
cout<<a.get()<<endl; //数据成员真的被改为1了,返回指针的情况也可以修改成员i的值,所以为了安全起见最好在返回值加上const,使得函数调用表达式不能作为左值
}
C++学习之:cout和cin用法总结
cout
cout
用于在屏幕上显示消息,应该是 console output 的简写。它是 C++
中 ostream
对象,该类被封装在 <iostream>
库中,该库定义的名称都放在命名空间 std
中,所以 cout
的全称是 std::cout
。cout
被分类为流对象,这意味着可以使用数据流的。要在屏幕上显示消息,可以发送一串字符到 cout
。例如:
cout << "hello world!" ;
如果要使用 cout
,需要包含库 <iostream>
。
cout 输出的格式控制
在使用 cout
时,可以将一些格式控制操作符放在语句中,来实现不同的输出效果。
以不同进制输出数字
cout
在输出数字时,默认是十进制的方式,还可以使用 hex
、oct
、dec
来控制输出的进制,这三个控制符都包含在 <iostream>
库中。例如:
using namespace std;
auto i = 65534;
cout.setf(ios::uppercase); //输出为大写字母
cout << hex << i << endl; //十六进制输出(默认为小写字母)
cout << oct << i << endl; //八进制输出
cout << dec << i << endl; //十进制输出
cout << setbase(16) << i << endl; //以16进制输出
其中的 setiosflags(ios::uppercase)
表示以大写字母输出(默认是 ios::lowercase
), setbase(n)
方法表示以 n 进制输出,其中的 n 取值为 8、10 或者 16,其余值无输出。这两个函数都包含在库 <iomanip>
中。
使用 setiosflags()
时,可以使用 |
来同时设置多个位,例如:
cout << setiosflags(ios::scientific | ios::showpos) << 12.01 << endl;
控制浮点数的输出
可以通过 setprecision(n)
、setiosflags(ios::fixed)
或 fixed
来对 cout
输出的精度进行控制。这几个控制符都包含在库 <iomanip>
库的 std
命名空间中。
#include <iostream>
#include <climits>
#include <iomanip>
int main(void)
{
using namespace std;
system("chcp 65001");
system("cls");
double p = 1233.141592653;
cout << p << endl;
cout << setprecision(3) << p << endl; //保留两位小数
cout << setprecision(15) << p << endl;
cout << setiosflags(ios::fixed);
cout << p << endl;
cout << fixed << p << endl;
return 0;
}
运行结果如下:
1233.14
1.23e+03
1233.141592653
1233.141592653000089
1233.141592653000089
显示小数点和正负号
此外,还可以使用 setiosflags(ios::showpoint)
来显示小数点,使用 setiosflags(ios::showpos)
来显示正负号。例如:
double i2 = 100;
double d2 = -3.14;
cout << setprecision(4);
cout << setiosflags(ios::showpoint); //显示小数点
cout << i2 << endl;
cout << setiosflags(ios::showpos); //显示正负号
cout << d2 << "\t" << i2 << endl;
输出结果如下:
100.0000
-3.1400 +100.0000
默认显示6个有效位数。
设置宽度和对齐方式
可以通过 setw(n)
函数来设置输出的宽度,当不足宽度的时候,以空格填充剩余的空间,如果超出宽度,则忽略设置的宽度;使用 setiosflags(ios::left|ios::right)
来设置对齐方式。这些都定义在 <iomanip>
库中的 std
命名空间中。例如:
cout.fill('' '');
cout << setw(10) << 100 << setw(10) << 100 << endl;
cout << setiosflags(ios::left) << setw(10) << 100 << setw(10) << 100 << endl;
cout << setiosflags(ios::right) << setw(10) << 100 << setw(10) << 100 << endl;
输出结果为:
100 100
100 100
100 100
输出的结果默认为右对齐。
设置填充字符
在宽度大于字符数量时,cout
默认使用空格填充剩余的空间,可以使用 setfill(''*'')
来设置为其他的填充字符。例如:
cout << setfill(''*'') << setiosflags(ios::right) << setw(10) << 100 << setw(10) << 100 << endl;
使用 cout 的成员函数
ostream
类还有一些成员函数,通过 cout
来调用它们也可以控制格式输出。和前面的控制符不同的是,使用成员函数会影响后面所有使用默认格式的输出。如下表:
成员函数 | 控制符 | 说明 |
---|---|---|
precision(n) | setprecision(n) | 设置输出浮点数的精度为n |
width(w) | setw(w) | 指定输出宽度为w个字符 |
fill(c) | setfill(c) | 在指定输出宽度的情况下,多余的空白使用字符c填充 |
setf(flag) | setiosflags(flag) | 将摸个输出格式标志设置为1 |
unset(flag) | resetiosflags(flag) | 将某个输出格式标志设置为0 |
cout.precision(5);
double x = 1123.23456;
cout << x << endl;
cout.width(20);
cout.fill(''*'');
cout << x << endl;
cin
cin
是 C++中的标准输入流对象,它是 istream
类的对象,包含在 <iostream>
库中, std
命名空间中。cin
主要用于从标准输入读取数据,这里的标准输入,指的是键盘。
当我们从键盘输入字符串的时候,需要按一下回车键才能够将这个字符串送入到缓冲区中。那么键入的回车键也会被转换为一个换行符,这个换行符也会被存储在 cin
的缓冲区并且被当做一个字符来计算。cin
读取数据也是从缓冲区中读取数据,当缓冲区为空时,cin
的成员函数会阻塞等待数据的到来,一旦有数据,就触发函数去读取数据。所以,当缓冲区有残留数据时,cin
的函数会直接取得这些数据而不会请求键盘输入。
cin 常用的读取方法
当使用 cin
从标准输入读取数据时,通常用到的方法有 cin >>
、cin.get()
、cin.getline()
。
cin >>
cin >>
可以连续的从键盘读取数据,以空格、Tab 键或者换行符作为分隔符或者结束符。
当从缓冲区读取数据时,如果第一个字符是空白字符,cin>>
会忽略并将其清除,继续读取下一个字符,如果缓冲区为空,则继续等待。如果读取成功,字符后面的分隔符都是残留在缓冲区内的,cin >>
不做处理。
int a, b, c;
cin >> a >> b >> c;
cout << a << b << c << endl;
上面的代码,将会要求我们输入三个数,并以空白分隔,输出才算完成。cin>>
等价于 cin.operator>>()
,即调用成员函数 operator>>()
进行读取数据。
如果不想略过开头的空白字符,那就使用 noskipws
流控制符。如下:
cin >> noskipws >> a;
cin.get()
这个函数有多个版本的重载。如下:
int cin.get();
istream& cin.get(char& var);
istream& get(char* s, streamsize n);
istream& get(char* s, streamsize n, char delim);
其中的 streamsize
被定义为 long long
类型。
int cin.get() 和 istream& cin.get(char& var)
这两种版本都是一次读取一个字符。
例如下面的代码:
char c1, c2;
c1 = cin.get();
cin.get(c2);
cout << c1 << ''\t'' << (int)c2 << endl;
运行,输入 a,然后回车,输出如下:
a
a
如上面的代码:
cin.get()
从缓冲区读取单个字符时不忽略空白,直接将其读取,所以变量c2
保存的是一个空行\r
。它的返回值是int
类型,成功则返回读取字符的 ASCII 码值,遇到文件结束符时,返回EOF
,即-1
。在 Windows 中,可以使用 Ctrl+Z 来输入文件结束符。cin.get(char var)
如果成功返回的是cin
对象,所以可以支持链式操作,比如cin.get(a).get(c)
。- 可以使用
cin.get()
来删除缓冲区上一次遗留下来的换行符。
使用 cin.get() 读取一行
cin.get()
的后面两种重载形式,
istream& get(char* s, streamsize n);
istream& get(char* s, streamsize n, char delim);
可以用来读取一行。这两个版本的区别是,前者默认以换行符结束,后者可以指定结束符。参数里的 n
表示目标空间的大小。
例如下面的代码:
#include <iostream>
int main(void)
{
using namespace std;
system("chcp 65001");
system("cls");
char arr1[100] = {NULL};
cin.get(arr1, 100);
char a;
cin.get(a);
cout << arr1 << " " << (int)a << endl;
system("pause");
return 0;
}
运行的结果:
hello world //输入
hello world 10
从上面的代码中,可以看出:
- 读取一行时,遇到换行符时停止读取,但是对换行符不做处理,换行符依然残留在输入缓冲区。
- 第二次使用
cin.get(a)
将换行符读入变量a
,输出的 ASCII 码值为 10 。就是上一次残留的换行符。 - 这种方法读取一行时,只能将字符串读入 C 风格的字符串中,即
char*
,使用 C++ 的getline()
函数可以将字符串读入string
类型。
cin.getline 读取一行
这个函数可以从键盘读取一个字符串,还可以以指定的结束符结束。它不会将换行符残留在缓冲区。函数有两个重载的版本,如下:
istream& getline(char* s, streamsize count); //默认的换行符结束
istream& getline(char* s, streamsize count, char delim); //delim 指定结束符
例如下面的代码:
#include <iostream>
int main(void)
{
using namespace std;
char arr1[100] {0};
cin.getline(arr1, 100);
cout << arr1 << endl;
system("pause");
return 0;
}
cin 的条件状态
使用 cin
读取键盘输入时,一旦出错,cin
将设置条件状态(condition state)。条件状态定义如下:
- goodbit :无错误
- eofbit :已经到达文件尾
- failbit :非致命的输入/输出错误,可挽回
- badbit :致命的输入/输出错误,无法挽回
这些条件状态都有对应的成员函数,可以用来设置、读取当前的条件状态。这些成员函数如下:
函数 | 说明 |
---|---|
cin.eof() | 如果流 cin 的 eofbit 为1,则返回 true |
cin.fail() | 如果流 cin 的 failbit 位为1,则返回 true |
cin.bad() | 如果流 cin 的 badbit 位为1,则返回 true |
cin.good() | 如果流 cin 的 goodbit 位为1,则返回 true |
cin.clear(flags) | 清空状态标志位,将给定的标志位 flags 设置为0,无返回值,如果不带参数,那么则是将清除所有的非good状态 |
cin.setstate(flags) | 将对应的 flags 设置为1,无返回值 |
cin.rdstate() | 返回当前状态。返回值类型为 iostate |
cin.ignore() | 它有两个参数,第一个是整型,第二个是 char 类型。它表示从输入流 cin 中提取第一个参数指定的字符数量,然后将这些字符忽略,如果提取的数量达到指定值或者字符等于第二个参数指定的字符时,该函数将终止。否则,继续等待,直到两个条件之一满足。第二个参数默认值为 EOF |
例如下面的代码:
#include <iostream>
int main(void)
{
using namespace std;
system("chcp 65001");
system("cls");
int a;
while(true)
{
cin >> a;
cout << "位状态:good=" << cin.good() << ", eof=" << cin.eof() << ", bad=" << cin.bad() << ", fail=" << cin.fail() << endl;
//文件尾,可以使用Ctrl+Z
if(cin.eof())
{
cout << "文件尾命令" << endl;
exit(1);
}
if(cin.fail())
{
cout << "输入的非数字。" << endl;
cin.clear();
cin.ignore(1000,''\n''); //忽略后面的所有内容
continue;
}
}
system("pause");
return 0;
}
运行结果:
1
位状态:good=1, eof=0, bad=0, fail=0
a
位状态:good=0, eof=0, bad=0, fail=1
输入的非数字。
^Z
位状态:good=0, eof=1, bad=0, fail=1
文件尾命令
我们可以看到,在输入正确的类型(int)后,good 位标志为1。输入非数字时,fail 位被设置。当使用 clear() 函数进行清除状态后,除 good 位外所有的位都被设置为0。
其他用于读取的函数
这些函数不是 cin
的成员函数,但也可以用于读取输入。
gets() 函数
gets()
函数可以一直读取,直到遇到换行符或者文件尾,它的读取不设上限,所以必须保证缓冲区足够大。它不会让换行符残留在缓冲区。它是 C 语言的库函数。使用如下:
#include <iostream>
int main(void)
{
using namespace std;
char arr1[100] {0};
gets(arr1);
cout << arr1 << endl;
system("pause");
return 0;
}
getchar() 函数
getchar()
读取一个字符并返回,可以读取空白,遇到换行符停止。也会处理结尾的换行符。
#include <iostream>
int main(void)
{
using namespace std;
char c;
c = getchar();
cout << c << endl;
system("pause");
return 0;
}
getline() 函数
getline()
函数读取一整行,它是在 std
命名空间中的全局函数,这个函数的参数使用了 string
类型,所以声明在了 <string>
头文件中。getline()
从标准输入设备中读取一行,当遇到下面三种情况之一会结束读取:
- 文件结束 EOF。
- 遇到行分隔符。
- 输入达到最大的限度。
这个函数有两个重载的版本:
istream& getline(istream& is, string& str); //默认以换行符 \n 分隔行
istream& getline(istream& is, string& str, char delim); //指定分隔符
例如下面的代码:
#include <iostream>
int main(void)
{
using namespace std;
while(true)
{
string str;
getline(cin, str);
cout << str << endl;
}
system("pause");
return 0;
}
getline()
函数遇到结束符时,会将结束符一并读入指定的 string 中,再将结束符替换为空字符。
delphi – List和Contains方法
我试过写这段代码:
program Project1; {$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils,System.Generics.Collections,System.Generics.Defaults; type TDBStats = record Comb: Integer; Freq: Integer; end; TDBStatsList = TList<TDBStats>; procedure Add(ODBStats: TDBStatsList; const Item: TDBStats); var rItem: TDBStats; begin rItem := Item; rItem.Freq := 1; oDBStats.Add(rItem); end; procedure Update(ODBStats: TDBStatsList; const Item: TDBStats; const Index: Integer); var rItem: TDBStats; begin rItem := Item; Inc(rItem.Freq); oDBStats[Index] := rItem; end; var oDBStats: TDBStatsList; rDBStats: TDBStats; myArr: array [0..4] of integer; iIndex1: Integer; begin try myArr[0] := 10; myArr[1] := 20; myArr[2] := 30; myArr[3] := 40; myArr[4] := 10; oDBStats := TList<TDBStats>.Create; try for iIndex1 := 0 to 4 do begin rDBStats.Comb := myArr[iIndex1]; if oDBStats.Contains(rDBStats) then Update(oDBStats,rDBStats,oDBStats.IndexOf(rDBStats)) else Add(oDBStats,rDBStats); end; // Check List for iIndex1 := 0 to Pred(oDBStats.Count) do Writeln(oDBStats[iIndex1].Comb:3,oDBStats[iIndex1].Freq:10); finally oDBStats.Free; end; except on E: Exception do Writeln(E.ClassName,': ',E.Message); end; Readln; end.
并应该返回此结果:
10 2 20 1 30 1 40 1 50 1
但是返回这个结果:
10 1 20 1 30 1 40 1 50 1 10 1
我已经理解了问题:当我使用oDBStats.Contains(rDBStats)时,它控制rDBStats元素是否包含在列表中;第一次没找到它并添加到列表中;但是当它被添加到列表中时我将freq字段更新为1;所以第二次当我再次检查rdbstats时,freq = 0没找到它.
我可以解决这个问题吗?我需要一个计数器,我从输入中得到一个“梳子”,我想检查这个“梳子”是否存在于列表中,独立于记录的另一个字段的值.如果我在列表中找到“梳子”,那么我更新,增加频率字段.
感谢帮助.
解决方法
要使您的示例正常工作,您必须指定一个自定义比较器,仅比较记录的梳形字段.这是一个例子:
oDBStats := TList<TDBStats>.Create(TDelegatedComparer<TDBStats>.Create( function(const Left,Right: TDBStats): Integer begin result := CompareValue(Left.comb,Right.comb); end));
此外,您的更新例程中有错误.您正在递增item参数的未定义值,而不是递增现有值.第一行的更改应该使它工作:
rItem := oDBStats[Index]; Inc(rItem.Freq); oDBStats[Index] := rItem;
关于Delphi学习之函数参数修饰中的var 、out和const和delphi函数参考大全的介绍现已完结,谢谢您的耐心阅读,如果想了解更多关于C++ 学习之函数重载、基于const的重载、C++中const修饰函数,函数参数,函数返回值的作用、C++学习之:cout和cin用法总结、delphi – List和Contains方法的相关知识,请在本站寻找。
最近很多小伙伴都在问Delphi中多线程同步过程Synchronize的一些说明和delphi 多线程同步这两个问题,那么本篇文章就来给大家详细解答一下,同时本文还将给你拓展@Java | Thread & synchronized - [ 线程同步锁 基本使用]、cocoa线程同步synchronized、Delphi Dll中多线程无法使用Synchronize同步的解决方法、Delphi 中多线程同步的一些处理方法等相关知识,下面开始了哦!
本文目录一览:- Delphi中多线程同步过程Synchronize的一些说明(delphi 多线程同步)
- @Java | Thread & synchronized - [ 线程同步锁 基本使用]
- cocoa线程同步synchronized
- Delphi Dll中多线程无法使用Synchronize同步的解决方法
- Delphi 中多线程同步的一些处理方法
Delphi中多线程同步过程Synchronize的一些说明(delphi 多线程同步)
总结
以上是小编为你收集整理的Delphi中多线程同步过程Synchronize的一些说明全部内容。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。
@Java | Thread & synchronized - [ 线程同步锁 基本使用]
对实现了Runnable
或者Callable
接口类,可以通过多线程执行同一实例的run
或call
方法,那么对于同一实例中的局部变量(非方法变量
)就会有多个线程进行更改或读取,这就会导致数据不一致,synchronized
(关键字
)可以解决多线程共享数据同步的问题
synchronized使用说明
作用范围
synchronized是Java中的关键字,是一种同步锁。它修饰的对象有以下几种:
-
修饰一个代码块
:被修饰的代码块称为同步语句块,其作用的范围是大括号{}括起来的代码,作用的对象是调用这个代码块的对象 -
修饰一个非静态方法
:被修饰的方法称为同步方法,其作用的范围是整个方法,作用的对象是调用这个方法的对象 -
修改一个静态的方法
:其作用的范围是整个静态方法,作用的对象是这个类的所有对象 -
修改一个类
:其作用的范围是synchronized后面括号括起来的部分,作用主的对象是这个类的所有对象
高能提示:
No1 >synchronized修饰的非静态方法:
如果一个对象
有多个synchronized方法
,只要一个线程
访问了其中的一个synchronized方法
,则这个线程所属对象
的其它线程
不能同时访问
这个对象
中任何一个synchronized方法
No2 >synchronized关键字是不能继承的:
基类的方法synchronized function(){}
在继承类中并不自动是synchronized function(){}
,而是变成了function(){}
。继承类需要你显式的指定
它的某个方法为synchronized方法
,可以通过子类调用父类的同步方法来实现同步
No3 > 针对synchronized修饰代码块和非静态方法,本质上锁的是代码块或非静态方法对应的对象
(代码块是synchronized标注的变量,非静态方法是所在类对应的实例
),如果是不同的对象
是可以同时访问的
No4 > 实现同步是要很大的系统开销
作为代价的,甚至可能造成死锁
,所以尽量避免无谓的同步控制
No5 > 每个对象只有一个锁(lock)与之相关联
No6 > 在定义接口方法
时不能使用synchronized
关键字
No7 > 构造方法不能使用synchronized关键字
,但可以使用synchronized代码块
来进行同步
1. 修饰一个代码块
public void syncCode(Object o) {
synchronized (o) {// 同步代码块}
}
上面的锁就是o
这个对象,当然多个线程同步需要保证o
这个对象是同一个
,这是有明确的对象作为锁的情况,如果只是想单纯的让某一段代码同步,并没有明确的对象作为锁,可以创建一个特殊的instance
变量来充当锁synchronized(o)
修饰的代码块,其中o
可以取值一个对象
或者一个变量
或者this
亦或者Clz.class
public class Sync implements Runnable {
private byte[] lock = new byte[0];
public void syncCode() {
synchronized (lock) {// 同步代码块}
}
public void run ....
}
注
:零长度的byte数组
对象创建起来将比任何对象都经济,查看编译后的字节码
,生成零长度的byte[]
对象只需3条操作码,而Object lock = new Object()
则需要7行操作码
2. 修饰一个非静态方法
public synchronized void method() {// .....}
此时锁的是调用这个同步方法的对象
3. 修饰一个静态方法
public synchronized static void method() {// .....}
synchronized修饰的静态方法锁定的是这个类的所有对象
4. 修饰类
public class Sync implements Runnable {
public void syncCode() {
synchronized (Sync.class) {// 同步代码块}
}
public void run ....
}
和作用于静态方法一样,synchronized作用于一个类时,是给这个类加锁,类的所有对象用的是同一把锁
总结
- 线程同步的目的是为了保护多个线程反问一个资源时对资源的破坏。
- 线程同步方法是通过锁来实现,每个对象都有切仅有一个锁,这个锁与一个特定的对象关联,线程一旦获取了对象锁,其他访问该对象的线程就无法再访问该对象的其他非同步方法
- 对于静态同步方法,锁是针对这个类的,锁对象是该类的Class对象。静态和非静态方法的锁互不干预。一个线程获得锁,当在一个同步方法中访问另外对象上的同步方法时,会获取这两个对象锁。
- 对于同步,要时刻清醒在哪个对象上同步,这是关键。
- 编写线程安全的类,需要时刻注意对多个线程竞争访问资源的逻辑和安全做出正确的判断,对"原子"操作做出分析,并保证原子操作期间别的线程无法访问竞争资源。
- 当多个线程等待一个对象锁时,没有获取到锁的线程将发生阻塞。
- 死锁是线程间相互等待锁锁造成的,在实际中发生的概率非常的小,一旦程序发生死锁,程序将死掉
cocoa线程同步synchronized
synchronized关键字
代表这个方法加锁,相当于不管哪一个线程A每次运行到这个方法时,都要检查有没有其它正在用这个方法的线程B(或者C D等),有的话要等正在使用这个方法的线程B(或者C D)运行完这个方法后再运行此线程A,没有的话,直接运行 它包括两种用法:synchronized 方法和 synchronized 块。
1. synchronized 方法:
通过在方法声明中加入 synchronized关键字来声明 synchronized 方法。如:
2. synchronized 块:
通过 synchronized关键字来声明synchronized 块。语法如下:
对synchronized(this)的一些理解
一、当两个并发线程访问同一个对象object中的这个synchronized(this)同步代码块时,一个时间内只能有一个线程得到执行。另一个线程必须等待当前线程执行完这个代码块以后才能执行该代码块。Delphi Dll中多线程无法使用Synchronize同步的解决方法
总结
以上是小编为你收集整理的Delphi Dll中多线程无法使用Synchronize同步的解决方法全部内容。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。
Delphi 中多线程同步的一些处理方法
总结
以上是小编为你收集整理的Delphi 中多线程同步的一些处理方法全部内容。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。
今天关于Delphi中多线程同步过程Synchronize的一些说明和delphi 多线程同步的分享就到这里,希望大家有所收获,若想了解更多关于@Java | Thread & synchronized - [ 线程同步锁 基本使用]、cocoa线程同步synchronized、Delphi Dll中多线程无法使用Synchronize同步的解决方法、Delphi 中多线程同步的一些处理方法等相关知识,可以在本站进行查询。
对于想了解DelPhi Treeview 操作实例 onclick节点 treeview1.Selected.Level的读者,本文将提供新的信息,我们将详细介绍delphi treeview用法,并且为您提供关于c# – 从TreeView中删除SelectedItem、com.intellij.ui.dualView.TreeTableView的实例源码、com.intellij.util.xml.tree.DomModelTreeView的实例源码、Delphi TreeView DestroyWnd / CreateWnd很慢的有价值信息。
本文目录一览:- DelPhi Treeview 操作实例 onclick节点 treeview1.Selected.Level(delphi treeview用法)
- c# – 从TreeView中删除SelectedItem
- com.intellij.ui.dualView.TreeTableView的实例源码
- com.intellij.util.xml.tree.DomModelTreeView的实例源码
- Delphi TreeView DestroyWnd / CreateWnd很慢
DelPhi Treeview 操作实例 onclick节点 treeview1.Selected.Level(delphi treeview用法)
总结
以上是小编为你收集整理的DelPhi Treeview 操作实例 onclick节点 treeview1.Selected.Level全部内容。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。
c# – 从TreeView中删除SelectedItem
最好的祝福,
加布里埃尔
解决方法
如果要删除该项,请使用以下命令:
treeView1.Items.Remove(treeView1.SelectedItem);
如果要从树视图中删除选择,请使用以下命令:
((TreeViewItem)treeView1.SelectedItem).IsSelected = false;
com.intellij.ui.dualView.TreeTableView的实例源码
private static JPanel createCommentsPanel(final TreeTableView treeTable) { JPanel panel = new JPanel(new BorderLayout()); final JTextArea textArea = createTextArea(); treeTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(@NotNull ListSelectionEvent e) { final int index = treeTable.getSelectionModel().getMinSelectionIndex(); if (index == -1) { textArea.setText(""); } else { final VcsFileRevision revision = getRevisionAt(treeTable,index); if (revision != null) { textArea.setText(revision.getCommitMessage()); } else { textArea.setText(""); } } } }); final JScrollPane textScrollPane = ScrollPaneFactory.createScrollPane(textArea); panel.add(textScrollPane,BorderLayout.CENTER); textScrollPane.setBorder(IdeBorderFactory.createTitledBorder(VcsBundle.message("border.selected.revision.commit.message"),false )); return panel; }
@Override @Nullable public Object getTagAt(@NotNull final MouseEvent e) { // Todo[yole]: don't update renderer on every event,like it's done in TreeLinkMouseListener Object tag; JTable table = (JTable)e.getSource(); int row = table.rowAtPoint(e.getPoint()); int column = table.columnAtPoint(e.getPoint()); if (row == -1 || column == -1) return null; TableCellRenderer cellRenderer = table.getCellRenderer(row,column); if (cellRenderer instanceof DualView.TableCellRendererWrapper) { cellRenderer = ((DualView.TableCellRendererWrapper) cellRenderer).getRenderer(); } if (cellRenderer instanceof TreeTableView.CellRendererWrapper) { cellRenderer = ((TreeTableView.CellRendererWrapper) cellRenderer).getBaseRenderer(); } if (cellRenderer instanceof ColoredTableCellRenderer) { final ColoredTableCellRenderer renderer = (ColoredTableCellRenderer)cellRenderer; tag = forColoredRenderer(e,table,row,column,renderer); } else { tag = tryGetTag(e,column); } return tag; }
private void createuicomponents() { UpdaterTreeNode.Renderer renderer = new SummaryTreeNode.Renderer(); myPlatformloadingIcon = new AsyncProcessIcon("Loading..."); myPlatformSummaryRootNode = new RootNode(); myPlatformDetailsRootNode = new RootNode(); ColumnInfo[] platformSummaryColumns = new ColumnInfo[]{new DownloadStatusColumnInfo(),new TreeColumnInfo("Name"),new ApiLevelColumnInfo(),new RevisionColumnInfo(),new StatusColumnInfo()}; myPlatformSummaryTable = new TreeTableView(new ListTreeTableModelOnColumns(myPlatformSummaryRootNode,platformSummaryColumns)); SdkUpdaterConfigPanel.setTreeTableProperties(myPlatformSummaryTable,renderer); MouseListener modificationListener = new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { refreshModified(); } }; myPlatformSummaryTable.addMouseListener(modificationListener); ColumnInfo[] platformDetailColumns = new ColumnInfo[]{new DownloadStatusColumnInfo(),new StatusColumnInfo()}; myPlatformDetailTable = new TreeTableView(new ListTreeTableModelOnColumns(myPlatformDetailsRootNode,platformDetailColumns)); SdkUpdaterConfigPanel.setTreeTableProperties(myPlatformDetailTable,renderer); myPlatformDetailTable.addMouseListener(modificationListener); }
/** * This instance is created by Swing. * Do not call this constructor manually. */ public LanguagesPanel() { super(new BorderLayout()); SpoofaxIdeaPlugin.injector().injectMembers(this); final LanguageTreeModel model = new LanguageTreeModel(this.iconManager); this.languagesTree = new TreeTableView(model); this.languagesTree.setTreeCellRenderer(new LanguageTreeModel.LanguageTreeCellRenderer()); this.languagesTree.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); final ToolbarDecorator toolbarDecorator = ToolbarDecorator.createDecorator(this.languagesTree) .setAddAction(this::addLanguage) .setAddActionUpdater(e -> this.controller != null) .setRemoveAction(button -> removeLanguage(getSelectednode())) .setRemoveActionUpdater(e -> this.controller != null && getSelectednode() != null) .disableupdownActions(); add(toolbarDecorator.createPanel(),BorderLayout.CENTER); setBorder(IdeBorderFactory.createTitledBorder("Loaded languages",false)); }
private static JPanel createCommentsPanel(final TreeTableView treeTable) { JPanel panel = new JPanel(new BorderLayout()); final JTextArea textArea = createTextArea(); treeTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { final int index = treeTable.getSelectionModel().getMinSelectionIndex(); if (index == -1) { textArea.setText(""); } else { final VcsFileRevision revision = getRevisionAt(treeTable,false )); return panel; }
@Nullable protected Object getTagAt(final MouseEvent e) { // Todo[yole]: don't update renderer on every event,like it's done in TreeLinkMouseListener Object tag = null; JTable table = (JTable)e.getSource(); int row = table.rowAtPoint(e.getPoint()); int column = table.columnAtPoint(e.getPoint()); if (row == -1 || column == -1) return null; TableCellRenderer cellRenderer = table.getCellRenderer(row,column); } return tag; }
private static JPanel createCommentsPanel(final TreeTableView treeTable) { JPanel panel = new JPanel(new BorderLayout()); final JTextArea textArea = createTextArea(); treeTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { final int index = treeTable.getSelectionModel().getMinSelectionIndex(); if (index == -1) { textArea.setText(""); } else { final VcsFileRevision revision = getRevisionAt(treeTable,false )); return panel; }
@Nullable public Object getTagAt(final MouseEvent e) { // Todo[yole]: don't update renderer on every event,column); } return tag; }
private static void showTreePopup(final List<TreeItem<VcsFileRevision>> roots,final VirtualFile file,final Project project,final DiffProvider diffProvider) { final TreeTableView treeTable = new TreeTableView(new ListTreeTableModelOnColumns(new TreeNodeAdapter(null,null,roots),new ColumnInfo[]{BRANCH_COLUMN,REVISION_COLUMN,DATE_COLUMN,AUTHOR_COLUMN})); Runnable runnable = new Runnable() { @Override public void run() { int index = treeTable.getSelectionModel().getMinSelectionIndex(); if (index == -1) { return; } VcsFileRevision revision = getRevisionAt(treeTable,index); if (revision != null) { DiffActionExecutor.showDiff(diffProvider,revision.getRevisionNumber(),file,project,VcsBackgroundableActions.COMPARE_WITH); } } }; treeTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); new PopupChooserBuilder(treeTable). setTitle(VcsBundle.message("lookup.title.vcs.file.revisions")). setItemChoosenCallback(runnable). setSouthComponent(createCommentsPanel(treeTable)). setResizable(true). setDimensionServiceKey("Vcs.CompareWithSelectedRevision.Popup"). createPopup(). showCenteredInCurrentwindow(project); final int lastRow = treeTable.getRowCount() - 1; if (lastRow < 0) return; treeTable.getSelectionModel().addSelectionInterval(lastRow,lastRow); treeTable.scrollRectToVisible(treeTable.getCellRect(lastRow,true)); }
@Nullable private static VcsFileRevision getRevisionAt(final TreeTableView treeTable,final int index) { final List items = treeTable.getItems(); if (items.size() <= index) { return null; } else { return ((TreeNodeAdapter)items.get(index)).getRevision(); } }
private void createuicomponents() { myToolsLoadingIcon = new AsyncProcessIcon("Loading..."); myToolsSummaryRootNode = new RootNode(); myToolsDetailsRootNode = new RootNode(); UpdaterTreeNode.Renderer renderer = new SummaryTreeNode.Renderer(); ColumnInfo[] toolsSummaryColumns = new ColumnInfo[]{new DownloadStatusColumnInfo(),new VersionColumnInfo(),new StatusColumnInfo()}; myToolsSummaryTable = new TreeTableView(new ListTreeTableModelOnColumns(myToolsSummaryRootNode,toolsSummaryColumns)); SdkUpdaterConfigPanel.setTreeTableProperties(myToolsSummaryTable,renderer); ColumnInfo[] toolsDetailColumns = new ColumnInfo[]{new DownloadStatusColumnInfo(),new StatusColumnInfo()}; myToolsDetailTable = new TreeTableView(new ListTreeTableModelOnColumns(myToolsDetailsRootNode,toolsDetailColumns)); SdkUpdaterConfigPanel.setTreeTableProperties(myToolsDetailTable,renderer); MouseListener modificationListener = new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { refreshModified(); } }; myToolsDetailTable.addMouseListener(modificationListener); myToolsSummaryTable.addMouseListener(modificationListener); }
private void createuicomponents() { myWorkItemsTableModel = new WorkItemsTableModel(new WorkItemsCheckinParameters()); myWorkItemsTable = new TreeTableView(myWorkItemsTableModel) { @Override protected void onTableChanged(@NotNull TableModelEvent e) { super.onTableChanged(e); getTree().setRowHeight(calculateRowHeight()); } }; }
private static void showTreePopup(final List<TreeItem<VcsFileRevision>> roots,AUTHOR_COLUMN})); Runnable runnable = new Runnable() { public void run() { int index = treeTable.getSelectionModel().getMinSelectionIndex(); if (index == -1) { return; } VcsFileRevision revision = getRevisionAt(treeTable,VcsBackgroundableActions.COMPARE_WITH); } } }; treeTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); new PopupChooserBuilder(treeTable). setTitle(VcsBundle.message("lookup.title.vcs.file.revisions")). setItemChoosenCallback(runnable). setSouthComponent(createCommentsPanel(treeTable)). setResizable(true). setDimensionServiceKey("Vcs.CompareWithSelectedRevision.Popup"). createPopup(). showCenteredInCurrentwindow(project); }
@Nullable private static VcsFileRevision getRevisionAt(final TreeTableView treeTable,final int index) { final List items = treeTable.getItems(); if (items.size() <= index) { return null; } else { return ((TreeNodeAdapter)items.get(index)).getRevision(); } }
private static void showTreePopup(final List<TreeItem<VcsFileRevision>> roots,VcsBackgroundableActions.COMPARE_WITH); } } }; treeTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); new PopupChooserBuilder(treeTable). setTitle(VcsBundle.message("lookup.title.vcs.file.revisions")). setItemChoosenCallback(runnable). setSouthComponent(createCommentsPanel(treeTable)). setResizable(true). setDimensionServiceKey("Vcs.CompareWithSelectedRevision.Popup"). createPopup(). showCenteredInCurrentwindow(project); }
@Nullable private static VcsFileRevision getRevisionAt(final TreeTableView treeTable,final int index) { final List items = treeTable.getItems(); if (items.size() <= index) { return null; } else { return ((TreeNodeAdapter)items.get(index)).getRevision(); } }
CheckBoxClickListener(TreeTableView mainComponent,final UpdaterTreeNode.Renderer renderer) { myTreeTable = mainComponent; myRenderer = renderer; }
private void createTree() { DefaultMutableTreeNode root = new DefaultMutableTreeNode(); for (AddedFileInfo myRoot : myRoots) { root.add(myRoot); } myModel = new ListTreeTableModelOnColumns(root,COLUMNS); myTreeTable = new TreeTableView(myModel); int comboHeight = new JComboBox().getPreferredSize().height; int checkBoxHeight = new JCheckBox().getPreferredSize().height; myTreeTable.setMinRowHeight(Math.max(comboHeight,checkBoxHeight) + 2); myTreeTable.setRootVisible(false); final jtableheader tableHeader = myTreeTable.getTableHeader(); tableHeader.setReorderingallowed(false); tableHeader.setResizingallowed(false); final TreeTableTree tree = myTreeTable.getTree(); myTreeTable.addKeyListener(new KeyAdapter() { @Override public void keypressed(KeyEvent e) { final int keyCode = e.getKeyCode(); if (keyCode == KeyEvent.VK_SPACE) { final int selectedColumn = myTreeTable.getSelectedColumn(); if (selectedColumn == 0) { return; } final int[] selectedRows = myTreeTable.getSelectedRows(); if (selectedRows.length == 0) { return; } final boolean included = !((AddedFileInfo)myTreeTable.getValueAt(selectedRows[0],1)).included(); for (int selectedRow : selectedRows) { final AddedFileInfo addedFileInfo = (AddedFileInfo)myTreeTable.getValueAt(selectedRow,1); addedFileInfo.setIncluded(included); myModel.nodeChanged(addedFileInfo); } } } }); tree.setCellRenderer(new AddedFileCellRenderer()); TreeUtil.installActions(tree); }
private void createTree() { DefaultMutableTreeNode root = new DefaultMutableTreeNode(); for (AddedFileInfo myRoot : myRoots) { root.add(myRoot); } myModel = new ListTreeTableModelOnColumns(root,1); addedFileInfo.setIncluded(included); myModel.nodeChanged(addedFileInfo); } } } }); tree.setCellRenderer(new AddedFileCellRenderer()); TreeUtil.installActions(tree); }
com.intellij.util.xml.tree.DomModelTreeView的实例源码
public DomElementsToggleAction(final DomModelTreeView treeView,final Class aClass) { myTreeView = treeView; myClass = aClass; Icon myIcon = ElementPresentationManager.getIcon(myClass); if (myIcon == null) { myIcon = AllIcons.Nodes.pointcut; } this.myIcon = myIcon; myText = TypePresentationService.getService().getTypePresentableName(myClass); if(getHiders() == null) DomUtil.getFile(myTreeView.getRootElement()).putUserData(AbstractDomElementNode.TREE_NODES_HIDERS_KEY,new HashMap<Class,Boolean>()); if(getHiders().get(myClass) == null) getHiders().put(myClass,true); }
@Override @NotNull protected DomCollectionChildDescription[] getDomCollectionChildDescriptions(final AnActionEvent e) { final DomModelTreeView view = getTreeView(e); SimpleNode node = view.getTree().getSelectednode(); if (node instanceof BaseDomElementNode) { List<DomCollectionChildDescription> consolidated = ((BaseDomElementNode)node).getConsolidatedChildrenDescriptions(); if (consolidated.size() > 0) { return consolidated.toArray(new DomCollectionChildDescription[consolidated.size()]); } } final DomElementsGroupNode groupNode = getDomElementsGroupNode(view); return groupNode == null ? DomCollectionChildDescription.EMPTY_ARRAY : new DomCollectionChildDescription[]{groupNode.getChildDescription()}; }
@Override public void actionPerformed(AnActionEvent e,DomModelTreeView treeView) { final SimpleNode selectednode = treeView.getTree().getSelectednode(); if (selectednode instanceof BaseDomElementNode) { if (selectednode instanceof DomFileElementNode) { e.getPresentation().setVisible(false); return; } final DomElement domElement = ((BaseDomElementNode)selectednode).getDomElement(); final int ret = Messages.showOkCancelDialog(getPresentationText(selectednode,"Remove") + "?","Remove",Messages.getQuestionIcon()); if (ret == Messages.OK) { new WriteCommandAction(domElement.getManager().getProject(),DomUtil.getFile(domElement)) { @Override protected void run(@NotNull final Result result) throws Throwable { domElement.undefine(); } }.execute(); } } }
public DomElementsToggleAction(final DomModelTreeView treeView,final Class aClass) { myTreeView = treeView; myClass = aClass; Icon myIcon = ElementPresentationManager.getIcon(myClass); if (myIcon == null) { myIcon = AllIcons.Nodes.pointcut; } this.myIcon = myIcon; myText = TypePresentationService.getService().getTypePresentableName(myClass); if(getHiders() == null) DomUtil.getFile(myTreeView.getRootElement()).putUserData(BaseDomElementNode.TREE_NODES_HIDERS_KEY,true); }
@NotNull protected DomCollectionChildDescription[] getDomCollectionChildDescriptions(final AnActionEvent e) { final DomModelTreeView view = getTreeView(e); SimpleNode node = view.getTree().getSelectednode(); if (node instanceof BaseDomElementNode) { List<DomCollectionChildDescription> consolidated = ((BaseDomElementNode)node).getConsolidatedChildrenDescriptions(); if (consolidated.size() > 0) { return consolidated.toArray(new DomCollectionChildDescription[consolidated.size()]); } } final DomElementsGroupNode groupNode = getDomElementsGroupNode(view); return groupNode == null ? DomCollectionChildDescription.EMPTY_ARRAY : new DomCollectionChildDescription[]{groupNode.getChildDescription()}; }
public void actionPerformed(AnActionEvent e,DomModelTreeView treeView) { final SimpleNode selectednode = treeView.getTree().getSelectednode(); if (selectednode instanceof BaseDomElementNode) { if (selectednode instanceof DomFileElementNode) { e.getPresentation().setVisible(false); return; } final DomElement domElement = ((BaseDomElementNode)selectednode).getDomElement(); final int ret = Messages.showOkCancelDialog(getPresentationText(selectednode) + "?",ApplicationBundle.message("action.remove"),Messages.getQuestionIcon()); if (ret == 0) { new WriteCommandAction(domElement.getManager().getProject(),DomUtil.getFile(domElement)) { protected void run(final Result result) throws Throwable { domElement.undefine(); } }.execute(); } } }
public DomElementsToggleAction(final DomModelTreeView treeView,final Class aClass) { myTreeView = treeView; myClass = aClass; Icon myIcon = ElementPresentationManager.getIcon(myClass); if (myIcon == null) { myIcon = AllIcons.Nodes.pointcut; } this.myIcon = myIcon; myText = TypePresentationService.getInstance().getTypePresentableName(myClass); if(getHiders() == null) DomUtil.getFile(myTreeView.getRootElement()).putUserData(BaseDomElementNode.TREE_NODES_HIDERS_KEY,true); }
@NotNull protected DomCollectionChildDescription[] getDomCollectionChildDescriptions(final AnActionEvent e) { final DomModelTreeView view = getTreeView(e); SimpleNode node = view.getTree().getSelectednode(); if (node instanceof BaseDomElementNode) { List<DomCollectionChildDescription> consolidated = ((BaseDomElementNode)node).getConsolidatedChildrenDescriptions(); if (consolidated.size() > 0) { return consolidated.toArray(new DomCollectionChildDescription[consolidated.size()]); } } final DomElementsGroupNode groupNode = getDomElementsGroupNode(view); return groupNode == null ? DomCollectionChildDescription.EMPTY_ARRAY : new DomCollectionChildDescription[]{groupNode.getChildDescription()}; }
public void actionPerformed(AnActionEvent e,DomUtil.getFile(domElement)) { protected void run(final Result result) throws Throwable { domElement.undefine(); } }.execute(); } } }
@Override protected boolean isEnabled(final AnActionEvent e) { final DomModelTreeView treeView = getTreeView(e); final boolean enabled = treeView != null; e.getPresentation().setEnabled(enabled); return enabled; }
@Override protected void showPopup(final ListPopup groupPopup,final AnActionEvent e) { if (myTreeView == null) { if (e.getPlace().equals(DomModelTreeView.DOM_MODEL_TREE_VIEW_POPUP)) { groupPopup.showInCenterOf(getTreeView(e).getTree()); } else { groupPopup.showInBestPositionFor(e.getDataContext()); } } else { super.showPopup(groupPopup,e); } }
@Override protected DomElement getParentDomElement(final AnActionEvent e) { final DomModelTreeView view = getTreeView(e); SimpleNode node = view.getTree().getSelectednode(); if (node instanceof BaseDomElementNode) { if (((BaseDomElementNode)node).getConsolidatedChildrenDescriptions().size() > 0) { return ((BaseDomElementNode)node).getDomElement(); } } final DomElementsGroupNode groupNode = getDomElementsGroupNode(view); return groupNode == null ? null : groupNode.getDomElement(); }
@Nullable private static DomElementsGroupNode getDomElementsGroupNode(final DomModelTreeView treeView) { SimpleNode simpleNode = treeView.getTree().getSelectednode(); while (simpleNode != null) { if (simpleNode instanceof DomElementsGroupNode) return (DomElementsGroupNode)simpleNode; simpleNode = simpleNode.getParent(); } return null; }
@Override public void actionPerformed(AnActionEvent e,DomModelTreeView treeView) { final SimpleNode simpleNode = treeView.getTree().getSelectednode(); if(simpleNode instanceof BaseDomElementNode) { final DomElement domElement = ((BaseDomElementNode)simpleNode).getDomElement(); final DomElementNavigationProvider provider = DomElementsNavigationManager.getManager(domElement.getManager().getProject()).getDomElementsNavigateProvider(DomElementsNavigationManager.DEFAULT_PROVIDER_NAME); provider.navigate(domElement,true); } }
@Override final public void update(AnActionEvent e) { final DomModelTreeView treeView = getTreeView(e); if (treeView != null) { update(e,treeView); } else { e.getPresentation().setEnabled(false); } }
@Override final public void actionPerformed(AnActionEvent e) { final DomModelTreeView treeView = getTreeView(e); if (treeView != null) { actionPerformed(e,treeView); } }
@Override public void update(AnActionEvent e,DomModelTreeView treeView) { final SimpleNode selectednode = treeView.getTree().getSelectednode(); if (selectednode instanceof DomFileElementNode) { e.getPresentation().setVisible(false); return; } boolean enabled = false; if (selectednode instanceof BaseDomElementNode) { final DomElement domElement = ((BaseDomElementNode)selectednode).getDomElement(); if (domElement.isValid() && DomUtil.hasXml(domElement) && !(domElement.getParent() instanceof DomFileElement)) { enabled = true; } } e.getPresentation().setEnabled(enabled); if (enabled) { e.getPresentation().setText(getPresentationText(selectednode,ApplicationBundle.message("action.remove"))); } else { e.getPresentation().setText(ApplicationBundle.message("action.remove")); } e.getPresentation().setIcon(AllIcons.General.Remove); }
protected boolean isEnabled(final AnActionEvent e) { final DomModelTreeView treeView = getTreeView(e); final boolean enabled = treeView != null; e.getPresentation().setEnabled(enabled); return enabled; }
protected void showPopup(final ListPopup groupPopup,e); } }
protected DomElement getParentDomElement(final AnActionEvent e) { final DomModelTreeView view = getTreeView(e); SimpleNode node = view.getTree().getSelectednode(); if (node instanceof BaseDomElementNode) { if (((BaseDomElementNode)node).getConsolidatedChildrenDescriptions().size() > 0) { return ((BaseDomElementNode)node).getDomElement(); } } final DomElementsGroupNode groupNode = getDomElementsGroupNode(view); return groupNode == null ? null : groupNode.getDomElement(); }
@Nullable private static DomElementsGroupNode getDomElementsGroupNode(final DomModelTreeView treeView) { SimpleNode simpleNode = treeView.getTree().getSelectednode(); while (simpleNode != null) { if (simpleNode instanceof DomElementsGroupNode) return (DomElementsGroupNode)simpleNode; simpleNode = simpleNode.getParent(); } return null; }
public void actionPerformed(AnActionEvent e,true); } }
final public void update(AnActionEvent e) { final DomModelTreeView treeView = getTreeView(e); if (treeView != null) { update(e,treeView); } else { e.getPresentation().setEnabled(false); } }
public void update(AnActionEvent e,DomModelTreeView treeView) { final SimpleNode selectednode = treeView.getTree().getSelectednode(); if (selectednode instanceof DomFileElementNode) { e.getPresentation().setVisible(false); return; } boolean enabled = false; if (selectednode instanceof BaseDomElementNode) { final DomElement domElement = ((BaseDomElementNode)selectednode).getDomElement(); if (domElement.isValid() && DomUtil.hasXml(domElement) && !(domElement.getParent() instanceof DomFileElement)) { enabled = true; } } e.getPresentation().setEnabled(enabled); if (enabled) { e.getPresentation().setText(getPresentationText(selectednode)); } else { e.getPresentation().setText(ApplicationBundle.message("action.remove")); } e.getPresentation().setIcon(AllIcons.General.Remove); }
protected boolean isEnabled(final AnActionEvent e) { final DomModelTreeView treeView = getTreeView(e); final boolean enabled = treeView != null; e.getPresentation().setEnabled(enabled); return enabled; }
protected void showPopup(final ListPopup groupPopup,e); } }
protected DomElement getParentDomElement(final AnActionEvent e) { final DomModelTreeView view = getTreeView(e); SimpleNode node = view.getTree().getSelectednode(); if (node instanceof BaseDomElementNode) { if (((BaseDomElementNode)node).getConsolidatedChildrenDescriptions().size() > 0) { return ((BaseDomElementNode)node).getDomElement(); } } final DomElementsGroupNode groupNode = getDomElementsGroupNode(view); return groupNode == null ? null : groupNode.getDomElement(); }
@Nullable private static DomElementsGroupNode getDomElementsGroupNode(final DomModelTreeView treeView) { SimpleNode simpleNode = treeView.getTree().getSelectednode(); while (simpleNode != null) { if (simpleNode instanceof DomElementsGroupNode) return (DomElementsGroupNode)simpleNode; simpleNode = simpleNode.getParent(); } return null; }
public void actionPerformed(AnActionEvent e,true); } }
final public void update(AnActionEvent e) { final DomModelTreeView treeView = getTreeView(e); if (treeView != null) { update(e,treeView); } else { e.getPresentation().setEnabled(false); } }
public void update(AnActionEvent e,DomModelTreeView treeView) { final SimpleNode selectednode = treeView.getTree().getSelectednode(); if (selectednode instanceof DomFileElementNode) { e.getPresentation().setVisible(false); return; } boolean enabled = false; if (selectednode instanceof BaseDomElementNode) { final DomElement domElement = ((BaseDomElementNode)selectednode).getDomElement(); if (domElement.isValid() && DomUtil.hasXml(domElement) && !(domElement.getParent() instanceof DomFileElement)) { enabled = true; } } e.getPresentation().setEnabled(enabled); if (enabled) { e.getPresentation().setText(getPresentationText(selectednode)); } else { e.getPresentation().setText(ApplicationBundle.message("action.remove")); } e.getPresentation().setIcon(AllIcons.General.Remove); }
public AddElementInCollectionAction(final DomModelTreeView treeView) { myTreeView = treeView; }
protected DomModelTreeView getTreeView(AnActionEvent e) { if (myTreeView != null) return myTreeView; return DomModelTreeView.DATA_KEY.getData(e.getDataContext()); }
@Override public void update(AnActionEvent e,DomModelTreeView treeView) { e.getPresentation().setVisible(treeView.getTree().getSelectednode() instanceof BaseDomElementNode); e.getPresentation().setText(ActionsBundle.message("action.EditSource.text")); }
protected BaseDomTreeAction(DomModelTreeView treeView) { myTreeView = treeView; }
protected DomModelTreeView getTreeView(AnActionEvent e) { if (myTreeView != null) return myTreeView; return DomModelTreeView.DATA_KEY.getData(e.getDataContext()); }
public DeleteDomElement(final DomModelTreeView treeView) { super(treeView); }
public AddElementInCollectionAction(final DomModelTreeView treeView) { myTreeView = treeView; }
protected DomModelTreeView getTreeView(AnActionEvent e) { if (myTreeView != null) return myTreeView; return DomModelTreeView.DATA_KEY.getData(e.getDataContext()); }
public void update(AnActionEvent e,DomModelTreeView treeView) { e.getPresentation().setVisible(treeView.getTree().getSelectednode() instanceof BaseDomElementNode); e.getPresentation().setText(ActionsBundle.message("action.EditSource.text")); }
Delphi TreeView DestroyWnd / CreateWnd很慢
对于TTreeView,DestroyWnd将节点保存到流中,CreateWnd重新加载它们.在我们的具有非常大的树视图的应用程序中,这导致节点在流出和返回时的长延迟.
我的问题:如何防止这种延迟?我听说很多人高度评价Virtual TreeView,我认为这不是TTreeView的后代,是否避免了这个问题?我们尝试过Developer Express TcxTreeView,但它来自TTreeview,所以它遇到了同样的问题.
解决方法
与标准的TTreeView不同,后者将数据存储在TreeView本身中.这就是为什么每次重新创建窗口时,TTreeView.DestroyWnd()和TTreeView.CreateWnd()都必须保存和恢复所有节点数据的副本.节点越多,管理该数据的开销就越大.
今天关于DelPhi Treeview 操作实例 onclick节点 treeview1.Selected.Level和delphi treeview用法的介绍到此结束,谢谢您的阅读,有关c# – 从TreeView中删除SelectedItem、com.intellij.ui.dualView.TreeTableView的实例源码、com.intellij.util.xml.tree.DomModelTreeView的实例源码、Delphi TreeView DestroyWnd / CreateWnd很慢等更多相关知识的信息可以在本站进行查询。
如果您想了解DelPhi6中出现 Can not find engine configuration file如何解决?和delphi could not create output file的知识,那么本篇文章将是您的不二之选。我们将深入剖析DelPhi6中出现 Can not find engine configuration file如何解决?的各个方面,并为您解答delphi could not create output file的疑在这篇文章中,我们将为您介绍DelPhi6中出现 Can not find engine configuration file如何解决?的相关知识,同时也会详细的解释delphi could not create output file的运用方法,并给出实际的案例分析,希望能帮助到您!
本文目录一览:- DelPhi6中出现 Can not find engine configuration file如何解决?(delphi could not create output file)
- : No JAAS configuration section named ''Client'' was found in specified JAAS configuration file:
- Capistrano和XSendFileconfiguration
- ClientCnxn: SASL configuration failed: javax.security.auth.login.LoginException: No JAAS configuration ??
- com.intellij.lang.ant.config.impl.configuration.BuildFilePropertiesPanel的实例源码
DelPhi6中出现 Can not find engine configuration file如何解决?(delphi could not create output file)
总结
以上是小编为你收集整理的DelPhi6中出现 Can not find engine configuration file如何解决?全部内容。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。
: No JAAS configuration section named ''Client'' was found in specified JAAS configuration file:
zookeeper.ClientCnxn(line:957) : SASL configuration failed: javax.security.auth.login.LoginException: No JAAS configuration section named ''Client'' was found in specified JAAS configuration file: ''C:\Users\ADMINI~1\AppData\Local\Temp\jaas9138331021728969462.conf''. Will continue connection to Zookeeper server without SASL authentication, if Zookeeper server allows it.
java.net.SocketTimeoutException: callTimeout=60000, callDuration=60110: Call to master/192.168.7.202:16020 failed on local exception: org.apache.hadoop.hbase.ipc.CallTimeoutException: Call id=2, waitTime=60009, rpcTimeout=60000 row
Capistrano和XSendFileconfiguration
我正在尝试使用Apache 2.2,Passenger 4.0.59和XSendFile 0.12configurationRails生产服务器。 应用程序通过Capistrano进行部署。
部署的应用程序生成(也许很大)PDF到#{Rails.root}/tmp并使用send_file提供此文件。
问题是Capistrano使用符号链接指向当前部署的应用程序版本。 另一方面,XSendFile解引用符号链接,如果文件的真实位置在文档根目录之外,即使XSendFilePath允许,也拒绝提供文件。 Apache的error.log指出:
(20023)The given path was above the root path: xsendfile: unable to find file: /resolved/path/to/file.pdf
当我将PassengerAppRoot和XSendFilePath设置为当前版本的应用程序的实际位置时,一切正常,没有path上的符号链接。 但是直到下一次部署才行,这需要重新configurationApache。 不是很有用。
Nginx用Passenger重写规则
由于发生产卵错误,无法检出会话。 phusion乘客Nginx
Nginx + Passenger在不同的子URI中提供rails应用程序
phusion乘客没有看到环境variables?
Rails 4个子域名不适用于生产
我应该如何configurationCapistrano部署和XSendFile参数使它们一起工作?
我试着用Capistrano&X-Sendfile和mod_xsendfile中的符号链接描述ln -nFs解决scheme,但都没有成功。
我应该在哪里设置HTTP标题,如过期?
cachingRails资产时出现Nginx权限问题
与Passenger一起运行Rails应用程序以及PHP应用程序
Facebook的应用程序与铁路/乘客独立/ Nginx …错误的urlcallback!
可用的CSS,但不推出时推送到生产
我终于设法使它工作。 对于那些使用XSendFile会有问题的人的一些提示
我将XSendFilePath设置为用户的$HOME ,到$HOME的路径上没有符号链接,所以它工作。 我可以从功能和安全的角度来接受这个问题,但显然它是一个解决方法。
请注意, XSendFilePath对包含多个斜线的路径非常敏感/like//this 。 我使用的是Apache宏,而从几个宏参数连接XSendFilePath参数,我把一些过时的斜线。 这导致XSendFile拒绝发送文件。
祝你好运!
总结
以上是小编为你收集整理的Capistrano和XSendFileconfiguration全部内容。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。
ClientCnxn: SASL configuration failed: javax.security.auth.login.LoginException: No JAAS configuration ??
zookeeper.ClientCnxn: SASL configuration failed: javax.security.auth.login.LoginException: No JAAS configuration section named ''Client'' was found in specified JAAS configuration file: ''/etc/kafka/kafka_client_jaas.conf''. Will continue connection to Zookeeper server without SASL authentication, if Zookeeper server allows it.
20/04/07 18:23:56 INFO zookeeper.ClientCnxn: Opening socket connection to server master/192.168.7.202:2181
20/04/07 18:23:56 INFO zookeeper.ClientCnxn: Socket connection established, initiating session, client: /192.168.7.202:44298, server: master/192.168.7.202:2181
20/04/07 18:23:56 INFO zookeeper.ClientCnxn: Session establishment complete on server master/192.168.7.202:2181, sessionid = 0x171294ab3f2fdb6, negotiated timeout = 60000
20/04/07 18:23:57 INFO session.SessionState: Created HDFS directory: /tmp/hive/hbase/6629ad1f-0cf2-4565-a8f7-e79c794805bb
20/04/07 18:23:57 INFO session.SessionState: Created local directory: /tmp/root/6629ad1f-0cf2-4565-a8f7-e79c794805bb
20/04/07 18:23:57 INFO session.SessionState: Created HDFS directory: /tmp/hive/hbase/6629ad1f-0cf2-4565-a8f7-e79c794805bb/_tmp_space.db
20/04/07 18:23:57 INFO lineage.NavigatorQueryListener: Failed to generate lineage for successful query execution.
org.apache.spark.sql.AnalysisException: java.lang.ExceptionInInitializerError: null;
at org.apache.spark.sql.hive.HiveExternalCatalog.withClient(HiveExternalCatalog.scala:108)
at org.apache.spark.sql.hive.HiveExternalCatalog.databaseExists(HiveExternalCatalog.scala:216)
at org.apache.spark.sql.internal.SharedState.externalCatalog$lzycompute(SharedState.scala:114)
at org.apache.spark.sql.internal.SharedState.externalCatalog(SharedState.scala:102)
at org.apache.spark.sql.hive.HiveSessionStateBuilder.org$apache$spark$sql$hive$HiveSessionStateBuilder$$externalCatalog(HiveSessionStateBuilder.scala:39)
at org.apache.spark.sql.hive.HiveSessionStateBuilder$$anonfun$1.apply(HiveSessionStateBuilder.scala:54)
at org.apache.spark.sql.hive.HiveSessionStateBuilder$$anonfun$1.apply(HiveSessionStateBuilder.scala:54)
at org.apache.spark.sql.catalyst.catalog.SessionCatalog.externalCatalog$lzycompute(SessionCatalog.scala:90)
at org.apache.spark.sql.catalyst.catalog.SessionCatalog.externalCatalog(SessionCatalog.scala:90)
at org.apache.spark.sql.query.analysis.QueryAnalysis$.hiveCatalog(QueryAnalysis.scala:63)
at org.apache.spark.sql.query.analysis.QueryAnalysis$.getLineageInfo(QueryAnalysis.scala:88)
com.intellij.lang.ant.config.impl.configuration.BuildFilePropertiesPanel的实例源码
public void setBuildFileProperties() { final AntBuildFileBase buildFile = getCurrentBuildFile(); if (buildFile != null && BuildFilePropertiesPanel.editBuildFile(buildFile,myProject)) { myConfig.updateBuildFile(buildFile); myBuilder.queueUpdate(); myTree.repaint(); } }
public void setBuildFileProperties() { final AntBuildFileBase buildFile = getCurrentBuildFile(); if (buildFile != null && BuildFilePropertiesPanel.editBuildFile(buildFile,myProject)) { myConfig.updateBuildFile(buildFile); myBuilder.queueUpdate(); myTree.repaint(); } }
public void setBuildFileProperties() { final AntBuildFileBase buildFile = getCurrentBuildFile(); if (buildFile != null && BuildFilePropertiesPanel.editBuildFile(buildFile,myProject)) { myConfig.updateBuildFile(buildFile); myBuilder.queueUpdate(); myTree.repaint(); } }
关于DelPhi6中出现 Can not find engine configuration file如何解决?和delphi could not create output file的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于: No JAAS configuration section named ''Client'' was found in specified JAAS configuration file:、Capistrano和XSendFileconfiguration、ClientCnxn: SASL configuration failed: javax.security.auth.login.LoginException: No JAAS configuration ??、com.intellij.lang.ant.config.impl.configuration.BuildFilePropertiesPanel的实例源码等相关知识的信息别忘了在本站进行查找喔。
关于Delphi IsPathDelimiter的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于.Delphi7升级到Delphi 2010、Delphi XE、Delphi XE2总结、delimiter-MySql中的DELIMITER $$ 问题?、Delphi 7 Enterprise或Delphi 2010 Professional、Delphi IDE Theme Editor, Delphi IDE 主题编辑器,支持D7~XE5及Lazarus等相关知识的信息别忘了在本站进行查找喔。
本文目录一览:- Delphi IsPathDelimiter
- .Delphi7升级到Delphi 2010、Delphi XE、Delphi XE2总结
- delimiter-MySql中的DELIMITER $$ 问题?
- Delphi 7 Enterprise或Delphi 2010 Professional
- Delphi IDE Theme Editor, Delphi IDE 主题编辑器,支持D7~XE5及Lazarus
Delphi IsPathDelimiter
总结
以上是小编为你收集整理的Delphi IsPathDelimiter全部内容。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。
.Delphi7升级到Delphi 2010、Delphi XE、Delphi XE2总结
总结
以上是小编为你收集整理的.Delphi7升级到Delphi 2010、Delphi XE、Delphi XE2总结全部内容。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。
delimiter-MySql中的DELIMITER $$ 问题?
delimitermysql数据库
错误
sql 执行错误 # 1064. 从数据库的响应:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''DELIMITER $$'' at line 1
确定
这个问题怎么解决?我的mysql版本是 mysql-5.6.27,这个语句不能用吗?
好像是美元符号不能用,请高手帮忙解答。
Delphi 7 Enterprise或Delphi 2010 Professional
是否值得购买Delphi 2010 Professional Upgrade或者我应该寻找Delphi 7 Enterprise?
我试图购买Delphi的目的包括编写用于学习目的的多层数据库应用程序.
任何建议将不胜感激.
TIA!
解决方法
如果我是你,我会直接联系Embarcadero,看看升级到Delphi 2010 Enterprise需要什么.我也会听从鲍勃的建议并获得SA.
http://embarcadero.com/products/rad-studio/rad-studio-feature-matrix.pdf
Delphi IDE Theme Editor, Delphi IDE 主题编辑器,支持D7~XE5及Lazarus
总结
以上是小编为你收集整理的Delphi IDE Theme Editor, Delphi IDE 主题编辑器,支持D7~XE5及Lazarus全部内容。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。
关于Delphi IsPathDelimiter的介绍现已完结,谢谢您的耐心阅读,如果想了解更多关于.Delphi7升级到Delphi 2010、Delphi XE、Delphi XE2总结、delimiter-MySql中的DELIMITER $$ 问题?、Delphi 7 Enterprise或Delphi 2010 Professional、Delphi IDE Theme Editor, Delphi IDE 主题编辑器,支持D7~XE5及Lazarus的相关知识,请在本站寻找。
在本文中,我们将给您介绍关于delphi数据库:TADOConnection, TADOTable,TDataSource,TDBGrid,以及列名无效的详细内容,并且为您解答delphi 数据库操作的相关问题,此外,我们还将为您提供关于@EnableAsync annotation metadata was not injected、antd的table进行列筛选时,更新dataSource,为什么table显示暂无数据?、Application Server JDBC资源的DataSource或ConnectionPoolDataSource、com.alibaba.druid.pool.DruidDataSource abandon connection, open stackTrace的知识。
本文目录一览:- delphi数据库:TADOConnection, TADOTable,TDataSource,TDBGrid,以及列名无效(delphi 数据库操作)
- @EnableAsync annotation metadata was not injected
- antd的table进行列筛选时,更新dataSource,为什么table显示暂无数据?
- Application Server JDBC资源的DataSource或ConnectionPoolDataSource
- com.alibaba.druid.pool.DruidDataSource abandon connection, open stackTrace
delphi数据库:TADOConnection, TADOTable,TDataSource,TDBGrid,以及列名无效(delphi 数据库操作)
总结
以上是小编为你收集整理的delphi数据库:TADOConnection, TADOTable,TDataSource,TDBGrid,以及列名无效全部内容。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。
@EnableAsync annotation metadata was not injected
在初始化 spring 事务部分碰到该错误,详细错误信息如下:
警告: Exception encountered during context initialization - cancelling refresh attempt
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ''org.springframework.context.annotation.internalAsyncAnnotationProcessor'' defined in org.springframework.scheduling.annotation.ProxyAsyncConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.scheduling.annotation.AsyncAnnotationBeanPostProcessor]: Factory method ''asyncAdvisor'' threw exception; nested exception is java.lang.IllegalArgumentException: @EnableAsync annotation metadata was not injected
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1119)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1014)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:220)
at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:615)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:465)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:434)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:782)
at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:424)
at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:774)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:249)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1242)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:717)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:494)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95)
at org.eclipse.jetty.server.Server.doStart(Server.java:282)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at net.sourceforge.eclipsejetty.starter.embedded.JettyEmbeddedAdapter.start(JettyEmbeddedAdapter.java:67)
at net.sourceforge.eclipsejetty.starter.common.AbstractJettyLauncherMain.launch(AbstractJettyLauncherMain.java:84)
at net.sourceforge.eclipsejetty.starter.embedded.JettyEmbeddedLauncherMain.main(JettyEmbeddedLauncherMain.java:42)
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.scheduling.annotation.AsyncAnnotationBeanPostProcessor]: Factory method ''asyncAdvisor'' threw exception; nested exception is java.lang.IllegalArgumentException: @EnableAsync annotation metadata was not injected
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
... 28 more
Caused by: java.lang.IllegalArgumentException: @EnableAsync annotation metadata was not injected
at org.springframework.util.Assert.notNull(Assert.java:112)
at org.springframework.scheduling.annotation.ProxyAsyncConfiguration.asyncAdvisor(ProxyAsyncConfiguration.java:45)
at org.springframework.scheduling.annotation.ProxyAsyncConfiguration$$EnhancerBySpringCGLIB$$82eb591.CGLIB$asyncAdvisor$0(<generated>)
at org.springframework.scheduling.annotation.ProxyAsyncConfiguration$$EnhancerBySpringCGLIB$$82eb591$$FastClassBySpringCGLIB$$ed8c37b9.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:309)
at org.springframework.scheduling.annotation.ProxyAsyncConfiguration$$EnhancerBySpringCGLIB$$82eb591.asyncAdvisor(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
... 29 more
十二月 16, 2015 11:42:21 下午 org.springframework.web.context.ContextLoader initWebApplicationContext
严重: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ''org.springframework.context.annotation.internalAsyncAnnotationProcessor'' defined in org.springframework.scheduling.annotation.ProxyAsyncConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.scheduling.annotation.AsyncAnnotationBeanPostProcessor]: Factory method ''asyncAdvisor'' threw exception; nested exception is java.lang.IllegalArgumentException: @EnableAsync annotation metadata was not injected
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1119)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1014)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:220)
at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:615)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:465)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:434)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:782)
at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:424)
at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:774)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:249)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1242)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:717)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:494)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95)
at org.eclipse.jetty.server.Server.doStart(Server.java:282)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at net.sourceforge.eclipsejetty.starter.embedded.JettyEmbeddedAdapter.start(JettyEmbeddedAdapter.java:67)
at net.sourceforge.eclipsejetty.starter.common.AbstractJettyLauncherMain.launch(AbstractJettyLauncherMain.java:84)
at net.sourceforge.eclipsejetty.starter.embedded.JettyEmbeddedLauncherMain.main(JettyEmbeddedLauncherMain.java:42)
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.scheduling.annotation.AsyncAnnotationBeanPostProcessor]: Factory method ''asyncAdvisor'' threw exception; nested exception is java.lang.IllegalArgumentException: @EnableAsync annotation metadata was not injected
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
... 28 more
Caused by: java.lang.IllegalArgumentException: @EnableAsync annotation metadata was not injected
at org.springframework.util.Assert.notNull(Assert.java:112)
at org.springframework.scheduling.annotation.ProxyAsyncConfiguration.asyncAdvisor(ProxyAsyncConfiguration.java:45)
at org.springframework.scheduling.annotation.ProxyAsyncConfiguration$$EnhancerBySpringCGLIB$$82eb591.CGLIB$asyncAdvisor$0(<generated>)
at org.springframework.scheduling.annotation.ProxyAsyncConfiguration$$EnhancerBySpringCGLIB$$82eb591$$FastClassBySpringCGLIB$$ed8c37b9.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:309)
at org.springframework.scheduling.annotation.ProxyAsyncConfiguration$$EnhancerBySpringCGLIB$$82eb591.asyncAdvisor(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
... 29 more
错误原因:
在 spring 的配置文件 applicationContext.xml 中,配置包扫描器时,使用了 *, 想扫描所有的包;而这种方式有可能扫描到 spring 自带的包,造成错误 (自我理解,不对的话求教育)
改动前:
<!-- 包扫描器 -->
<context:component-scan base-package="*"/>
改动后 (具体指定了要扫描的包):
<!-- 包扫描器 -->
<context:component-scan base-package="com.git.*"/>
antd的table进行列筛选时,更新dataSource,为什么table显示暂无数据?
我想当然地认为只要dataSource改变,那么<Table>
组件就会重新渲染,
但是有一种特殊情况例外:
在onFilter()
中不写筛选条件,在调用filterDropdown
进行列筛选的时候,通过handleSearch
改变/保存dataSource
的状态,此时<Table>
重新渲染,但是拿的不是dataSource={xxx}
,而是拿的filterDropdown
中的onFilter()
中的dataSource
,而onFilter
中是没有写代码的,所以返回暂无数据
。
PS:
解释下我不在onFilter()
中写代码的原因,因为我已将dataSource保存到state中,所以需要setState
去更改dataSource
数据,但是onFilter()
方法是在componentDidUpdate()
周期调用的,所以setState
会报错,所以我想到了在onClick中setState,但这样console.log出来,dataSource更改了,但是table显示暂无数据。
示例代码:
handleSearch=()=>{
this.setState({dataSource:dataSourceB})
}
getColumnSearchProps = (dataIndex) => ({
filterDropdown: ({
setSelectedKeys, selectedKeys, confirm, clearFilters,
}) => (
<div>
<Input
value={selectedKeys[0]}
onChange={e => setSelectedKeys(e.target.value ? [e.target.value] : [])}
onPressEnter={() => this.handleSearch(selectedKeys, confirm)}
/>
<Button
onClick={() => this.handleSearch(selectedKeys, confirm)}
>
Search
</Button>
</div>
),
//筛选条件,没有写代码,所以没有数据返回,所以是暂无数据
onFilter: (value, record) =>{ },
})
render{
return(
<Table
column={ [{...this.getColumnSearchProps(''name'')}}
dataSource={dataSourceA}
>
)
}
示例代码地址:
https://ant.design/components/table-cn/#components-table-demo-custom-filter-panel
列筛选逻辑的流程图如下:
onFilter()的源码:
getLocalData(state?: TableState<T> | null, filter: boolean = true): Array<T> {
const currentState: TableState<T> = state || this.state;
const { dataSource } = this.props;
let data = dataSource || [];
// 优化本地排序
//就是这行代码,通过slice,另开内存来保存dataSource
data = data.slice(0);
const sorterFn = this.getSorterFn(currentState);
if (sorterFn) {
data = this.recursiveSort(data, sorterFn);
}
// 筛选
if (filter && currentState.filters) {
Object.keys(currentState.filters).forEach(columnKey => {
const col = this.findColumn(columnKey) as any;
if (!col) {
return;
}
const values = currentState.filters[columnKey] || [];
if (values.length === 0) {
return;
}
const onFilter = col.onFilter;
data = onFilter
? data.filter(record => {
return values.some(v => onFilter(v, record));
})
: data;
});
}
return data;
}
onFilter()的源码地址:
https://github.com/ant-design/ant-design/blob/d922c377cba03bef39ddb7d271fce3f67c353be9/components/table/Table.tsx
(完)
Application Server JDBC资源的DataSource或ConnectionPoolDataSource
在应用程序服务器中创建JNDI
JDBC连接池时,我始终将类型指定为javax.sql.ConnectionPoolDataSource
。我从来没有考虑过太多,因为与非池化连接相比,更喜欢池化连接似乎很自然。
但是,在查看一些示例(专门针对Tomcat)时,我注意到它们指定了javax.sql.DataSource
。此外,似乎还有设置maxIdle
,maxWait
给人的印象是这些连接也被合并。无论选择的数据源类型如何,Glassfish都允许这些参数。
- 是否
javax.sql.DataSource
集中在应用程序服务器(或servlet容器)中? - 什么(如果有的话)的优势在那里为选择
javax.sql.ConnectionPoolDataSource
了javax.sql.DataSource
(反之亦然)?
答案1
小编典典是的,默认情况下,Tomcat确实对定义为JNDI上下文资源的数据源使用Apache DBCP池。
从位于http://tomcat.apache.org/tomcat-7.0-doc/jndi-resources-
howto.html#JDBC_Data_Sources的文档中
注意-
Tomcat中的默认数据源支持基于Commons项目中的DBCP连接池。但是,可以通过编写您自己的自定义资源工厂来使用实现javax.sql.DataSource的任何其他连接池,如下所述。
挖掘Tomcat 6的消息源显示,它们以这种方式获取连接工厂(以防万一,如果您不使用Context的“ factory”属性指定自己的连接工厂):
ObjectFactory factory = (ObjectFactory)Class.forName(System.getProperty("javax.sql.DataSource.Factory", "org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory")).newInstance();
- 实现javax.naming.spi.ObjectFactory的org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory负责创建DataSource实例:[http](http://www.jarvana.com/jarvana/view/org/apache/tomcat/tomcat-
- dbcp/7.0.2/tomcat-
- dbcp-7.0.2-sources.jar!/org/apache/tomcat/dbcp/dbcp/BasicDataSourceFactory.java?format=ok)
- //www.jarvana.com/jarvana/view/org/apache/tomcat/tomcat- dbcp / 7.0.2 /
tomcat-
dbcp-7.0.2-sources.jar!/org/apache/tomcat/dbcp/dbcp/BasicDataSourceFactory.java?format
= ok - 我看到他们创建了org.apache.tomcat.dbcp.dbcp.BasicDataSource的实例:[http](http://www.jarvana.com/jarvana/view/org/apache/tomcat/tomcat-
- dbcp/7.0.2/tomcat-
- dbcp-7.0.2-sources.jar!/org/apache/tomcat/dbcp/dbcp/BasicDataSource.java?format=ok)
- //www.jarvana.com/jarvana/view/org/apache/tomcat/tomcat-dbcp/7.0.2/tomcat-
dbcp-
7.0.2-sources.jar!/org/apache/tomcat/dbcp/dbcp/BasicDataSource.java?format =
ok
奇怪的是,此类本身并没有实现ConnectionPoolDataSource,org.apache.tomcat.dbcp.dbcp.PoolingDataSource也没有实现,它由BasicDataSource内部返回
http://www.jarvana.com/jarvana/view/org/apache/tomcat /tomcat-
dbcp/7.0.2/tomcat-
dbcp-7.0.2-sources.jar!/org/apache/tomcat/dbcp/dbcp/PoolingDataSource.java?format=ok
因此,我假定当您将DataSources配置为javax.sql.ConnectionPoolDataSource时,您还使用了一些自定义工厂(这只是一个猜测,但我想否则您将在Tomcat中具有类强制转换异常,因为它们的池并没有真正提供javax.sql.ConnectionPoolDataSource的实例,仅javax.sql.DataSource的实例)。
因此,要回答有关特定情况的优缺点的问题,应将Apache DBCP与数据源工厂中的池化机制进行比较,无论使用哪种方式。
com.alibaba.druid.pool.DruidDataSource abandon connection, open stackTrace
用tomcat部署了一个项目,项目是JEECG集成了一个轻量的工作流框架snaker,运行过工作流的页面后就会弹出如下错误
10627811 ERROR 2017-08-01 14:24:08302 com.alibaba.druid.pool.DruidDataSource abandon connection, open stackTrace
at java.lang.Thread.getStackTrace(Thread.java:1589)
at com.alibaba.druid.pool.DruidDataSource.getConnectionDirect(DruidDataSource.java:682)
at com.alibaba.druid.filter.FilterChainImpl.dataSource_connect(FilterChainImpl.java:4530)
at com.alibaba.druid.filter.stat.StatFilter.dataSource_getConnection(StatFilter.java:659)
at com.alibaba.druid.filter.FilterChainImpl.dataSource_connect(FilterChainImpl.java:4526)
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:626)
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:618)
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:79)
at org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource.getConnection(AbstractRoutingDataSource.java:164)
at org.hibernate.service.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:141)
at org.snaker.engine.access.hibernate4.Hibernate4Access.getConnection(Hibernate4Access.java:51)
at org.snaker.engine.access.AbstractDBAccess.getDialect(AbstractDBAccess.java:166)
at org.snaker.engine.access.AbstractDBAccess.queryList(AbstractDBAccess.java:1023)
at org.snaker.engine.access.AbstractDBAccess.getHistoryOrders(AbstractDBAccess.java:768)
at org.snaker.engine.core.QueryService.getHistoryOrders(QueryService.java:102)
at org.snaker.engine.core.QueryService$$FastClassBySpringCGLIB$$80ab7a62.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:708)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:644)
at org.snaker.engine.core.QueryService$$EnhancerBySpringCGLIB$$b7527938.getHistoryOrders(<generated>)
at com.eqiao.dts.workflow.controller.FlowController.order(FlowController.java:138)
at sun.reflect.GeneratedMethodAccessor1051.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:175)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:446)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:434)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:938)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:624)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.jeecgframework.core.aop.GZipFilter.doFilter(GZipFilter.java:93)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:140)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:150)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218)
at org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:110)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1115)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2549)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2538)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
请问下是什么原因?
今天关于delphi数据库:TADOConnection, TADOTable,TDataSource,TDBGrid,以及列名无效和delphi 数据库操作的介绍到此结束,谢谢您的阅读,有关@EnableAsync annotation metadata was not injected、antd的table进行列筛选时,更新dataSource,为什么table显示暂无数据?、Application Server JDBC资源的DataSource或ConnectionPoolDataSource、com.alibaba.druid.pool.DruidDataSource abandon connection, open stackTrace等更多相关知识的信息可以在本站进行查询。
本文标签: