首页 文章 精选 留言 我的

精选列表

搜索[文档处理],共10000篇文章
优秀的个人博客,低调大师

iOS图像处理之画圆角矩形

CGContextRef ctx = UIGraphicsGetCurrentContext(); CGContextSaveGState(ctx); //画圆矩形 //设置线宽 CGContextSetLineWidth(ctx, BORDE_WIDTH); //设置填充颜色和画笔颜色 CGContextSetFillColorWithColor(ctx, self.color.CGColor); CGContextSetStrokeColorWithColor(ctx, [UIColor yellowColor].CGColor); CGPathRef clippath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake([self offsets].width,[self offsets].height, [self size].width, [self size].height) cornerRadius:CR_RADIUS].CGPath; CGContextAddPath(ctx, clippath); // //找到各个角点 // CGPoint p_0_0 = CGPointMake([self offsets].width, [self offsets].height); // CGPoint p_0_1 = CGPointMake([self offsets].width + [self size].width, [self offsets].height); // CGPoint p_1_0 = CGPointMake([self offsets].width, [self offsets].height + [self size].height); // CGPoint p_1_1 = CGPointMake([self offsets].width + [self size].width, [self offsets].height + [self size].height); // CGContextMoveToPoint(ctx, p_1_0.x , p_1_0.y - CR_RADIUS * 2); // CGContextAddArcToPoint(ctx, p_0_0.x, p_0_0.y, p_0_0.x + CR_RADIUS*2, p_0_0.y, CR_RADIUS); // CGContextAddArcToPoint(ctx, p_0_1.x, p_0_1.y, p_0_1.x, p_0_1.y + CR_RADIUS*2, CR_RADIUS); // CGContextAddArcToPoint(ctx, p_1_1.x, p_1_1.y, p_1_1.x - CR_RADIUS*2, p_1_1.y, CR_RADIUS); // CGContextAddArcToPoint(ctx, p_1_0.x, p_1_0.y, p_1_0.x, p_1_0.y - CR_RADIUS*2, CR_RADIUS); CGContextClosePath(ctx); CGContextDrawPath(ctx, kCGPathFillStroke); 本文转自 卓行天下 51CTO博客,原文链接:http://blog.51cto.com/9951038/1772555,如需转载请自行联系原作者

优秀的个人博客,低调大师

Docker下CentOS中文乱码问题处理

使用Docker pull centos,完了之后镜像无法显示中文问题 1 2 3 4 5 6 7 FROMcentos MAINTAINERfengwan.blog.51cto.com RUN rm -rf /etc/localtime && ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime #修改时区 RUNyum-y install kde-l10n-Chinese&&yum-yreinstallglibc-common #安装中文支持 RUNlocaledef-c-fUTF-8-izh_CNzh_CN.utf8 #配置显示中文 ENVLC_ALLzh_CN.utf8 #设置环境变量 RUNyum-y install python-setuptools&&easy_installpip&&pip install supervisor #安装supervisor多进程管理工具,用于启动多进程 可将以上文件作为dockerfile的初始部分 如果是实体机的话执行以下命令即可 1 2 3 yum-y install kde-l10n-Chinese&&yum-yreinstallglibc-common localedef-c-fUTF-8-izh_CNzh_CN.utf8 export LC_ALL=zh_CN.utf8 以上就可以解决Zabbix You are not able to choose some of the languages, because locales for them are not installed on the web server. 本文转自 rong341233 51CTO博客,原文链接:http://blog.51cto.com/fengwan/1891063

优秀的个人博客,低调大师

Android -- 处理ViewPager的notifyDataSetChanged无刷新

Viewpager在调用notifyDataSetChanged()时,界面无刷新 Viewpager在调用notifyDataSetChanged()时,界面无刷新,它确实影响我们功能的实现了。可能选择为Viewpager重新设置一遍适配器adapter,达到刷新的目的。但是这种方法在大多数情况下,是有问题的。 查看方法 super.notifyDataSetChanged()调用的是PagerAdapter.notifyDataSetChanged() /** * This method should be called by the application if the data backing this adapter has changed * and associated views should update. */ public void notifyDataSetChanged() { mObservable.notifyChanged(); } 注释里说到,当附加在适配器上的数据发生变化时,应该调用该方法刷新数据。该方法调用了一个mObservable .notifyChanged(); 我们继续跟进这个方法,进入DataSetObservable类中,发现这样一段代码: /** * Invokes {@link DataSetObserver#onChanged} on each observer. * Called when the contents of the data set have changed. The recipient * will obtain the new contents the next time it queries the data set. */ public void notifyChanged() { synchronized(mObservers ) { // since onChanged() is implemented by the app, it could do anything, including // removing itself from {@link mObservers} - and that could cause problems if // an iterator is used on the ArrayList {@link mObservers}. // to avoid such problems, just march thru the list in the reverse order. for (int i = mObservers .size() - 1; i >= 0; i--) { mObservers.get(i).onChanged(); } } } 这都不是重点,重点我们来看这个mObservers的类型是一个抽象类DataSetObserver,里面只有两个未实现的方法,都有谁使用了这个抽象类呢,其中我们发现了Viewpager的身影。进入viewpager,我们终于找到了viewpager中控制数据变更的重点方法dataSetChanged ,这个方法如下: void dataSetChanged () { // This method only gets called if our observer is attached, so mAdapter is non-null. boolean needPopulate = mItems .size() < mOffscreenPageLimit * 2 + 1 && mItems.size() < mAdapter.getCount(); int newCurrItem = mCurItem ; boolean isUpdating = false; for (int i = 0; i < mItems.size(); i++) { final ItemInfo ii = mItems .get(i); final int newPos = mAdapter.getItemPosition(ii.object ); if (newPos == PagerAdapter.POSITION_UNCHANGED ) { continue; } if (newPos == PagerAdapter.POSITION_NONE) { mItems.remove(i); i--; if (!isUpdating) { mAdapter.startUpdate( this); isUpdating = true; } mAdapter.destroyItem( this, ii.position , ii.object); needPopulate = true; if (mCurItem == ii.position ) { // Keep the current item in the valid range newCurrItem = Math. max(0, Math.min(mCurItem, mAdapter.getCount() - 1)); needPopulate = true; } continue; } if (ii.position != newPos) { if (ii.position == mCurItem ) { // Our current item changed position. Follow it. newCurrItem = newPos; } ii. position = newPos; needPopulate = true; } } if (isUpdating) { mAdapter.finishUpdate( this); } Collections. sort(mItems, COMPARATOR); if (needPopulate) { // Reset our known page widths; populate will recompute them. final int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { final View child = getChildAt(i); final LayoutParams lp = (LayoutParams) child.getLayoutParams(); if (!lp.isDecor ) { lp. widthFactor = 0.f; } } setCurrentItemInternal(newCurrItem, false, true); requestLayout(); } } 重点看这样一行代码: final int newPos = mAdapter.getItemPosition(ii.object ); if (newPos == PagerAdapter.POSITION_UNCHANGED ) { continue ; } Called when the host view is attempting to determine if an item’s position has changed. ReturnsPOSITION_UNCHANGEDif the position of the given item has not changed orPOSITION_NONEif the item is no longer present in the adapter. The default implementation assumes that items will never change position and always returnsPOSITION_UNCHANGED. 意思是如果item的位置如果没有发生变化,则返回POSITION_UNCHANGED。如果返回了POSITION_NONE,表示该位置的item已经不存在了。默认的实现是假设item的位置永远不会发生变化,而返回POSITION_UNCHANGED 解决方案 所以我们可以尝试着修改适配器的写法,覆盖getItemPosition()方法,当调用notifyDataSetChanged时,让getItemPosition方法人为的返回POSITION_NONE,从而达到强迫viewpager重绘所有item的目的。 class SearchAdapter extends PagerAdapter { private int mChildCount = 0; @Override public void notifyDataSetChanged() { mChildCount = getCount(); super.notifyDataSetChanged(); } @Override public int getItemPosition(Object object) { if ( mChildCount > 0) { mChildCount --; return POSITION_NONE; } return super.getItemPosition(object); } } 我是天王盖地虎的分割线 本文转自我爱物联网博客园博客,原文链接:http://www.cnblogs.com/yydcdut/p/4232614.html,如需转载请自行联系原作者

资源下载

更多资源
腾讯云软件源

腾讯云软件源

为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。

Spring

Spring

Spring框架(Spring Framework)是由Rod Johnson于2002年提出的开源Java企业级应用框架,旨在通过使用JavaBean替代传统EJB实现方式降低企业级编程开发的复杂性。该框架基于简单性、可测试性和松耦合性设计理念,提供核心容器、应用上下文、数据访问集成等模块,支持整合Hibernate、Struts等第三方框架,其适用范围不仅限于服务器端开发,绝大多数Java应用均可从中受益。

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

Sublime Text

Sublime Text

Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。

用户登录
用户注册