首页 文章 精选 留言 我的

精选列表

搜索[网站开发],共10000篇文章
优秀的个人博客,低调大师

Android 开发实用小技巧

转载请标明出处:http://blog.csdn.net/zhaoyanjun6/article/details/75647437 本文出自【赵彦军的博客】 Android Studio 实用插件传送门:http://blog.csdn.net/zhaoyanjun6/article/details/75646540 1、查看依赖包的方法数 网址: http://www.methodscount.com/ 2、在线把 layout 布局文件转为Java代码 网址:http://android.lineten.net/layout.php 3、在线生成 shapes 代码 网址: http://shapes.softartstudio.com/ 4、在线生成 Button 的样式 网址:http://angrytools.com/android/button/ 5、根据 packname 下载 GooglePlay 上的应用 网址: https://apps.evozi.com/apk-downloader/ 个人微信号:zhaoyanjun125 , 欢迎关注

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

iOS开发-UIActionSheet简单介绍

UIActionSheet和UIAlertView都是ios系统自带的模态视图,模态视图的一个重要的特性就是在显示模态视图的时候可以阻断其他视图的事件响应。一般情况下我们对UIAlertView使用的比较多,UIActionSheet相对来说情况少一点,偶尔作为一个上拉菜单来展示还是非常有用的。通常如果显示一个模态的视图,可以自定义一个UIViewController,不过里面的内容和动画实现起来工作量还是非常多的。 UIActionSheet介绍 介绍UIActionSheet之前需要简单的看下效果实现: 这是最基本的UIActionSheet,标题和按钮,不过有的时候为了美观可以不用标题,效果看起来是非常赞的,先上代码之后讲解: 1 2 3 4 5 6 7 8 UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@ "博客园" delegate: self cancelButtonTitle:@ "取消" destructiveButtonTitle:@ "确定" otherButtonTitles:@ "keso" , @ "FlyElephant" , nil ]; actionSheet.actionSheetStyle = UIActionSheetStyleBlackOpaque; [actionSheet showInView: self .view]; 大家可以明显感觉到确定是白底红字,其他的按钮是白底蓝字,因为确定在这里是destructiveButton,相当于销毁就是给用户一个明显的提示,这里的显示是直接在View中显示,当然也有其他的地方显示,调用方法如下: 1 2 3 4 5 - ( void )showFromToolbar:(UIToolbar *)view; - ( void )showFromTabBar:(UITabBar *)view; - ( void )showFromBarButtonItem:(UIBarButtonItem *)item animated:( BOOL )animated NS_AVAILABLE_IOS (3_2); - ( void )showFromRect:(CGRect)rect inView:(UIView *)view animated:( BOOL )animated NS_AVAILABLE_IOS (3_2); - ( void )showInView:(UIView *)view; 跟大多数控件一下,UIActionSheet也是有代理的,实现UIActionSheetDelegate可以在按钮之后执行自己需要执行的事件: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 -( void )actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:( NSInteger )buttonIndex{ NSString *result=@ "" ; switch (buttonIndex) { case 0: result=@ "确定" ; break ; case 1: result=@ "keso" ; break ; case 2: result=@ "FlyElephant" ; break ; case 3: result=@ "取消" ; break ; } UIAlertView *alertView=[[UIAlertView alloc]initWithTitle:@ "测试" message:result delegate: self cancelButtonTitle:@ "确定" otherButtonTitles: nil ]; [alertView show]; } -( void )actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:( NSInteger )buttonInde{ NSLog (@ "didDismissWithButtonIndex-FlyElphant" ); } -( void )actionSheet:(UIActionSheet *)actionSheet willDismissWithButtonIndex:( NSInteger )buttonIndex{ NSLog (@ "willDismissWithButtonIndex-FlyElphant" ); } -( void )actionSheetCancel:(UIActionSheet *)actionSheet{ NSLog (@ "Home键执行此方法" ); } 四个方法都是比较常见的使用,一般情况下只需要调用第一个方法即可,actionSheetCancel网上说的比较少,这个方法一般是点击Home键的时候执行,不是点击取消的按钮的执行,详情可参考文档解释: 1 2 // Called when we cancel a view (eg. the user clicks the Home button). This is not called when the user clicks the cancel button. // If not defined in the delegate, we simulate a click in the cancel button UIActionSheet的样式默认样式,黑色半透明和黑色不透明三种样式: 1 2 3 4 5 6 typedef NS_ENUM ( NSInteger , UIActionSheetStyle) { UIActionSheetStyleAutomatic = -1, // take appearance from toolbar style otherwise uses 'default' UIActionSheetStyleDefault = UIBarStyleDefault, UIActionSheetStyleBlackTranslucent = UIBarStyleBlackTranslucent, UIActionSheetStyleBlackOpaque = UIBarStyleBlackOpaque, }; 如果你觉得系统的不爽,可以自定义,完全取决于个人需求~ 本文转自Fly_Elephant博客园博客,原文链接:http://www.cnblogs.com/xiaofeixiang/p/4521610.html,如需转载请自行联系原作者

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

iOS开发-UITableView滑动视差

视差滚动是指让多层背景以不同的速度移动,形成立体的运动效果,在Web上应用的比较多,App中倒是见的相对比较少,主要在UITableView中的应用的比较多,尤其是当整个UITableViewCell的背景是图片的时候,描述内容较少,滑动视差可以增强视觉效果,可以考虑使用,先来简单的看一下效果: 实现起来也比较简单,UITableView定义: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 #pragma mark - UITablViewDataSource -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ return 1; } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ return [self.dataSource count]; } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ MainTableViewCell *mainCell=[tableView dequeueReusableCellWithIdentifier:CELLIDENTIFIER forIndexPath:indexPath]; NSString *desc=[NSString stringWithFormat: @"FlyElephant-%ld" ,indexPath.row]; [mainCell setBackImage:self.dataSource[indexPath.row] description:desc]; return mainCell; } #pragma mark - UITableViewDelegate -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ return 150; } 滑动的时候修改单元格偏移量: 1 2 3 4 5 6 7 8 9 10 #pragma mark - UIScrollViewDelegate -( void )scrollViewDidScroll:(UIScrollView *)scrollView{ CGPoint offset=self.tableView.contentOffset; for (MainTableViewCell *cell in self.tableView.visibleCells) { //方式1 // [cell setImagOffset:offset tableView:self.tableView]; //方式2 [cell setAdjustOffset:(cell.frame.origin.y-offset.y)]; } } MainTableViewCell定义: 1 2 3 4 5 6 7 8 9 10 11 @ interface MainTableViewCell : UITableViewCell -( void )setBackImage:(NSString *)imageName description:(NSString *)desc; //视差滑动方式1 -( void )setImagOffset:(CGPoint)contentOffset tableView:(UITableView *)tablView; //视差滑动方式2 -( void )setAdjustOffset:(CGFloat)offset; @end 滑动视差调用方式: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 -( void )setImagOffset:(CGPoint)contentOffset tableView:(UITableView *)tablView{ //偏移量 CGFloat cellOffset = self.frame.origin.y - contentOffset.y; // 偏移量+单元格高度/tableview高度+单元格高度 CGFloat percent = (cellOffset+self.frame.size.height)/(tablView.frame.size.height+self.frame.size.height); //偏移比例(0-1) CGFloat extraHeight = self.frame.size.height*OFFSET_RATE; CGRect frame=self.backImageView.frame; frame.origin.y=extraHeight*percent; self.backImageView.frame=frame; } -( void )setAdjustOffset:(CGFloat)offset{ CGRect frame = self.backImageView.frame; frame.origin.y = (offset / 15.0); self.backImageView.frame = frame; } 实现起来比较简单,网上有各种各样的版本,这两种的方式算是最简单的实现~ 本文转自Fly_Elephant博客园博客,原文链接:http://www.cnblogs.com/xiaofeixiang/p/5152828.html,如需转载请自行联系原作者

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

iOS开发-UINavigationBar透明设置

导航条最近需要设置成透明的形式,最开始想通过颜色clearColor设置,设置透明度,结果发现UINavigationItem无法显示显示,后来通过setBackgroundImage设置成功,不过会多出一条线白线,需要通过setShadowImage设置背景图片,代码如下: 1 2 3 4 5 -( void )viewWillAppear:( BOOL )animated{ [ super viewWillAppear:animated]; [ self .navigationController.navigationBar setBackgroundImage:[UIImage new ] forBarMetrics:UIBarMetricsDefault]; [ self .navigationController.navigationBar setShadowImage:[UIImage new ]]; } 如果不想影响其他页面的导航透明度,viewWillDisappear将其设置为nil即可: 1 2 3 4 5 6 -( void )viewWillDisappear:( BOOL )animated{ //原文地址:http://www.cnblogs.com/xiaofeixiang [ super viewWillDisappear:animated]; [ self .navigationController.navigationBar setBackgroundImage: nil forBarMetrics:UIBarMetricsDefault]; [ self .navigationController.navigationBar setShadowImage: nil ]; } 本文转自Fly_Elephant博客园博客,原文链接:http://www.cnblogs.com/xiaofeixiang/p/4624928.html,如需转载请自行联系原作者

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

IOS开发之property详解

之前很多网友对我翻译的教程中的Property的使用感到有些迷惑不解,搞不清楚什么时候要release,什么时候要self.xxx = nil;同时对于Objective-c的内存管理以及cocos2d的内存管理规则不够清楚。本文主要讲解objc里面@property,它是什么,它有什么用,atomic,nonatomic,readonly,readwrite,assign,retain,copy,getter,setter这些关键字有什么用,什么时候使用它们。至于Objc的内存管理和cocos2d的内存管理部分,接下来,我会翻译Ray的3篇教程,那里面再和大家详细讨论。今天我们的主要任务是搞定@property。 学过c/c++的朋友都知道,我们定义struct/class的时候,如果把访问限定符(public,protected,private)设置为public的话,那么我们是可以直接用.号来访问它内部的数据成员的。比如 //in Test.h class Test { public: int i; float f; }; 我在main函数里面是可以通过下面的方式来使用这个类的:(注意,如果在main函数里面使用此类,除了要包含头文件以外,最重要的是记得把main.m改成main.mm,否则会报一些奇怪的错误。所以,任何时候我们使用c++,如果报奇怪的错误,那就要提醒自己是不是把相应的源文件改成.mm后缀了。其它引用此类的文件有时候也要改成.mm文件) //in main.mm Test test; test.i =1; test.f =2.4f; NSLog(@"Test.i = %d, Test.f = %f",test.i, test.f); 但是,在objc里面,我们能不能这样做呢?请看下面的代码:(新建一个objc类,命名为BaseClass) //in BaseClass.h @interface BaseClass : NSObject{ @public NSString *_name; } 接下来,我们在main.mm里面: BaseClass *base= [[BaseClass alloc] init]; base.name =@"set base name"; NSLog(@"base class's name = %@", base.name); 不用等你编译,xcode4马上提示错误,请看截图: 请大家注意看出错提示“Property 'nam' not found on object of type BaseClass*",意思是,BaseClass这类没有一个名为name的属性。即使我们在头文件中声明了@public,我们仍然无法在使用BaseClass的时候用.号来直接访问其数据成员。而@public,@protected和@private只会影响继承它的类的访问权限,如果你使用@private声明数据成员,那么在子类中是无法直接使用父类的私有成员的,这和c++,java是一样的。 既然有错误,那么我们就来想法解决啦,编译器说没有@property,那好,我们就定义property,请看代码: //in BaseClass.h @interface BaseClass : NSObject{ @public NSString *_name; } @property(nonatomic,copy) NSString *name; //in BaseClass.m @synthesize name = _name; 现在,编译并运行,ok,很好。那你可能会问了@prperty是不是就是让”."号合法了呀?只要定义了@property就可以使用.号来访问类的数据成员了?先让我们来看下面的例子: @interface BaseClass : NSObject{ @public NSString *_name; } //@property(nonatomic,copy) NSString *name; -(NSString*) name; -(void) setName:(NSString*)newName; 我把@property的定义注释掉了,另外定义了两个函数,name和setName,下面请看实现文件: //@synthesize name = _name; -(NSString*) name{ return _name; } -(void) setName:(NSString *)name{ if (_name != name) { [_name release]; _name = [name copy]; } } 现在,你再编译运行,一样工作的很好。why?因为我刚刚做的工作和先前声明@property所做的工作完全一样。@prperty只不过是给编译器看的一种指令,它可以编译之后为你生成相应的getter和setter方法。而且,注意看到面property(nonatomic,copy)括号里面这copy参数了吗?它所做的事就是 _name = [name copy]; 如果你指定retain,或者assign,那么相应的代码分别是: //property(retain)NSString* name; _name = [name retain]; //property(assign)NSString* name; _name = name; 其它讲到这里,大家也可以看出来,@property并不只是可以生成getter和setter方法,它还可以做内存管理。不过这里我暂不讨论。现在,@property大概做了件什么事,想必大家已经知道了。但是,我们程序员都有一个坎,就是自己没有完全吃透的东西,心里用起来不踏实,特别是我自己。所以,接下来,我们要详细深挖@property的每一个细节。 首先,我们看atomic 与nonatomic的区别与用法,讲之前,我们先看下面这段代码: @property(nonatomic, retain) UITextField *userName; //1 @property(nonatomic, retain,readwrite) UITextField *userName; //2 @property(atomic, retain) UITextField *userName; //3 @property(retain) UITextField *userName; //4 @property(atomic,assign) int i; // 5 @property(atomic) int i; //6 @property int i; //7 请读者先停下来想一想,它们有什么区别呢? 上面的代码1和2是等价的,3和4是等价的,5,6,7是等价的。也就是说atomic是默认行为,assign是默认行为,readwrite是默认行为。但是,如果你写上@property(nontomic)NSString *name;那么将会报一个警告,如下图: 因为是非gc的对象,所以默认的assign修饰符是不行的。那么什么时候用assign、什么时候用retain和copy呢?推荐做法是NSString用copy,delegate用assign(且一定要用assign,不要问为什么,只管去用就是了,以后你会明白的),非objc数据类型,比如int,float等基本数据类型用assign(默认就是assign),而其它objc类型,比如NSArray,NSDate用retain。 在继续之前,我还想补充几个问题,就是如果我们自己定义某些变量的setter方法,但是想让编译器为我们生成getter方法,这样子可以吗?答案是当然可以。如果你自己在.m文件里面实现了setter/getter方法的话,那以翻译器就不会为你再生成相应的getter/setter了。请看下面代码: //代码一: @interface BaseClass : NSObject{ @public NSString *_name; } @property(nonatomic,copy,readonly) NSString *name; //这里使用的是readonly,所有会声明geter方法 -(void) setName:(NSString*)newName; //代码二: @interface BaseClass : NSObject{ @public NSString *_name; } @property(nonatomic,copy,readonly) NSString *name; //这里虽然声明了readonly,但是不会生成getter方法,因为你下面自己定义了getter方法。 -(NSString*) name; //getter方法是不是只能是name呢?不一定,你打开Foundation.framework,找到UIView.h,看看里面的property就明白了) -(void) setName:(NSString*)newName; //代码三: @interface BaseClass : NSObject{ @public NSString *_name; } @property(nonatomic,copy,readwrite) NSString *name; //这里编译器会我们生成了getter和setter //代码四: @interface BaseClass : NSObject{ @public NSString *_name; } @property(nonatomic,copy) NSString *name; //因为readwrite是默认行为,所以同代码三 上面四段代码是等价的,接下来,请看下面四段代码: //代码一: @synthesize name = _name; //这句话,编译器发现你没有定义任何getter和setter,所以会同时会你生成getter和setter //代码二: @synthesize name = _name; //因为你定义了name,也就是getter方法,所以编译器只会为生成setter方法,也就是setName方法。 -(NSString*) name{ NSLog(@"name"); return _name; } //代码三: @synthesize name = _name; //这里因为你定义了setter方法,所以编译器只会为你生成getter方法 -(void) setName:(NSString *)name{ NSLog(@"setName"); if (_name != name) { [_name release]; _name = [name copy]; } } //代码四: @synthesize name = _name; //这里你自己定义了getter和setter,这句话没用了,你可以注释掉。 -(NSString*) name{ NSLog(@"name"); return _name; } -(void) setName:(NSString *)name{ NSLog(@"setName"); if (_name != name) { [_name release]; _name = [name copy]; } } 上面这四段代码也是等价的。看到这里,大家对Property的作用相信会有更加进一步的理解了吧。但是,你必须小心,你如果使用了Property,而且你自己又重写了setter/getter的话,你需要清楚的明白,你究竟干了些什么事。别写出下面的代码,虽然是合法的,但是会误导别人: //BaseClass.h @interface BaseClass : NSObject{ @public NSArray *_names; } @property(nonatomic,assgin,readonly) NSArray *names; //注意这里是assign -(void) setNames:(NSArray*)names; //BaseClass.m @implementation BaseClass @synthesize names = _names; -(NSArray*) names{ NSLog(@"names"); return _names; } -(void) setNames:(NSArray*)names{ NSLog(@"setNames"); if (_name != name) { [_name release]; _name = [name retain]; //你retain,但是你不覆盖这个方法,那么编译器会生成setNames方法,里面肯定是用的assign } } 当别人使用@property来做内存管理的时候就会有问题了。总结一下,如果你自己实现了getter和setter的话,atomic/nonatomic/retain/assign/copy这些只是给编译的建议,编译会首先会到你的代码里面去找,如果你定义了相应的getter和setter的话,那么好,用你的。如果没有,编译器就会根据atomic/nonatomic/retain/assign/copy这其中你指定的某几个规则去生成相应的getter和setter。 好了,说了这么多,回到我们的正题吧。atomic和nonatomic的作用与区别: 如果你用@synthesize去让编译器生成代码,那么atomic和nonatomic生成的代码是不一样的。如果使用atomic,如其名,它会保证每次getter和setter的操作都会正确的执行完毕,而不用担心其它线程在你get的时候set,可以说保证了某种程度上的线程安全。但是,我上网查了资料,仅仅靠atomic来保证线程安全是很天真的。要写出线程安全的代码,还需要有同步和互斥机制。 而nonatomic就没有类似的“线程安全”(我这里加引号是指某种程度的线程安全)保证了。因此,很明显,nonatomic比atomic速度要快。这也是为什么,我们基本上所有用property的地方,都用的是nonatomic了。 还有一点,可能有读者经常看到,在我的教程的dealloc函数里面有这样的代码:self.xxx = nil;看到这里,现在你们明白这样写有什么用了吧?它等价于[xxx release]; xxx = [nil retain];(---如果你的property(nonatomic,retian)xxx,那么就会这样,如果不是,就对号入座吧)。 因为nil可以给它发送任何消息,而不会出错。为什么release掉了还要赋值为nil呢?大家用c的时候,都有这样的编码习惯吧。 int* arr = new int[10]; 然后不用的时候,delete arr; arr = NULL; 在objc里面可以用一句话self.arr = nil;搞定。 最新内容请见作者的GitHub页:http://qaseven.github.io/

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

开发下载地址汇集

http://www.centos.org/download/ http://search.cpan.org/ 安装mysql需要perl http://search.cpan.org/~bingos/perl-5.21.6/ jdk tomcat下载 http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html http://www.oracle.com/technetwork/java/javase/downloads/jre7-downloads-1880261.html http://tomcat.apache.org/ http://tomcat.apache.org/download-80.cgi wget --no-cookie --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.tar.gz http://www.mysql.com/downloads/ http://dev.mysql.com/downloads/mysql/ http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.23-linux-glibc2.5-x86_64.tar.gz http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.42-linux2.6-x86_64.tar.gz http://struts.apache.org/download.cgi#struts2320 http://repo.spring.io/libs-release-local/org/springframework/spring/3.2.0.RELEASE/spring-framework-3.2.0.RELEASE-dist.zip http://repo.spring.io/libs-release-local/org/springframework/spring/3.2.6.RELEASE/spring-framework-3.2.6.RELEASE-dist.zip http://repo.spring.io/libs-release-local/org/springframework/spring/ maven的eclipse插件地址 http://download.eclipse.org/technology/m2e/releases/ spring栏目 http://spring.io/tools http://search.maven.org/ http://docs.spring.io/spring-data/jpa/docs/1.9.0.M1/reference/html/ http://jpa.coding.io/ svn http://subversion.apache.org/packages.html#windows https://www.visualsvn.com/downloads/ http://www.mongodb.org/downloads http://lucene.apache.org/ http://www.apache.org/dyn/closer.cgi/lucene/solr/4.10.3 安装 http://www.memcached.org/downloads https://github.com/gwhalin/Memcached-Java-Client http://www.cnblogs.com/happyday56/p/4465876.html 大数据部分 Hadoop快速入门 http://hadoop.apache.org/docs/r1.0.4/cn/quickstart.html http://mirror.bit.edu.cn/apache/hadoop/common/ http://hbase.apache.org/ http://mirror.bit.edu.cn/apache/hbase/ http://hive.apache.org/ http://mirror.bit.edu.cn/apache/hive/ http://zookeeper.apache.org/releases.html#download http://mirror.bit.edu.cn/apache/zookeeper/ 前端框架 https://github.com/angular/angular.js 分类: 分布式 负载均衡 本文转自快乐就好博客园博客,原文链接:http://www.cnblogs.com/happyday56/p/4270231.html,如需转载请自行联系原作者

资源下载

更多资源
腾讯云软件源

腾讯云软件源

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

Nacos

Nacos

Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。

Spring

Spring

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

Sublime Text

Sublime Text

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

用户登录
用户注册