首页 文章 精选 留言 我的

精选列表

搜索[AGI开发],共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开发-模板方法模式

模板方法模式定义一个操作中的算法的骨架,而将步骤延迟到子类中。模板方法使得子类可以不改变一个算法的结构即可重定义算法的某些特定步骤。模板方法模式是由子类决定实现算法中的步骤,工厂方法由子类决定实现哪一个具体的类,策略模式是封装可以互换的行为,使用委托决定采用哪一个行为,有的时候这三种容易出现理解上的偏差。 基础知识 模板方法的UML类图: 关于模板方法我们思考一个生活中的例子,我们都会网购,天猫或者京东,经历一下四个步骤,①访问网站②浏览下单③支付④收货,两种网站第二步和最后一步都是一样的,访问和支付的访问不一样,两个网站网址不一样,支付方式不一样~稍微思考一下可以怎么实现~ 实战探讨 关于上面的需要设计三个类,网购类,天猫类,京东类: OnLineShop: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 @protocol OnLineShopProtocol @optional -( void )accessURL; @optional -( void )pay; @end @ interface OnLineShop : NSObject<OnLineShopProtocol> -( void )shop; -(Boolean)callMyMobileHook; @end 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 30 31 32 @ interface OnLineShop() -( void )createOrder; -( void )receiptGoods; @end @implementation OnLineShop -( void )shop{ [self accessURL]; [self createOrder]; [self pay]; if ([self callMyMobileHook]) { [self receiptGoods]; } } -( void )createOrder{ NSLog( @"创建订单成功" ); } -( void )receiptGoods{ NSLog( @"收到了物品" ); } //子类可以回调钩子 -(Boolean)callMyMobileHook{ return true ; } @end Tmall类继承自OnLineShop: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 @implementation Tmall -( void )accessURL{ NSLog( @"https://www.taobao.com/" ); } -( void )pay{ NSLog( @"支付宝" ); } -(Boolean)callMyMobileHook{ return true ; } @end JDong类: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 @implementation JDong -( void )accessURL{ NSLog( @"http://www.jd.com/" ); } -( void )pay{ NSLog( @"货到付款" ); } -(Boolean)callMyMobileHook{ NSLog( @"博客园-FlyElephant" ); return false ; } @end 代码测试: 1 2 3 4 OnLineShop *tmall=[[Tmall alloc]init]; [tmall shop]; OnLineShop *jd=[[JDong alloc]init]; [jd shop]; 测试结果: 模板方法优点: ①模板方法模式通过把不变的行为搬移到超类,去除了子类中的重复代码。 ②子类实现算法的某些细节,有助于算法的扩展。通过一个父类调用子类实现的操作, ③通过子类扩展增加新的行为,符合“开放-封闭原则”。 缺点 ①每个不同的实现都需要定义一个子类,这会导致类的个数的增加,设计更加抽象。 适用于在某些类的算法中,用了相同的方法,造成代码的重复。控制子类扩展,子类必须遵守算法规则。 模板方式中涉及到一个原则是好莱坞原则,别调用我们,我们会调用你~理解起来就是高层组件可以调用底层组件,底层组件不要调用高层组件~ 本文转自Fly_Elephant博客园博客,原文链接:http://www.cnblogs.com/xiaofeixiang/p/5126158.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,如需转载请自行联系原作者

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

iOS开发-音乐播放(AVAudioPlayer)

现在的手机的基本上没有人不停音乐的,我们无法想象在一个没有声音的世界里我们会过的怎么样,国内现在的主流的主流网易云音乐,QQ音乐,酷狗,虾米,天天基本上霸占了所有的用户群体,不过并没有妨碍大家对音乐的追求,乐流算是突围成功了,据说卖给QQ啦,有兴趣的可以看下。我们做不了那么高大上的就先做个简单的,最核心的就是播放,暂停,切歌,其他的基本上围绕这个修修补补锦上添花的,比如说歌曲名称,专辑,谁听了这首歌。。。铺垫的多了,直接看效果吧,三个按钮一个进度条: 初始化按钮: 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 30 31 32 self .playButton=[[UIButton alloc]initWithFrame:CGRectMake(40, 100, 60, 30)]; [ self .playButton setTitle:@ "播放" forState:UIControlStateNormal]; [ self .playButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; [ self .playButton.titleLabel setFont:[UIFont systemFontOfSize:14]]; self .playButton.layer.borderColor=[UIColor blackColor].CGColor; self .playButton.layer.borderWidth=1.0; self .playButton.layer.cornerRadius=5.0; [ self .playButton addTarget: self action: @selector (playMusic:) forControlEvents:UIControlEventTouchUpInside]; [ self .view addSubview: self .playButton]; self .pauseButton=[[UIButton alloc]initWithFrame:CGRectMake(140, 100, 60, 30)]; [ self .pauseButton setTitle:@ "暂停" forState:UIControlStateNormal]; [ self .pauseButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; [ self .pauseButton.titleLabel setFont:[UIFont systemFontOfSize:14]]; self .pauseButton.layer.borderColor=[UIColor blackColor].CGColor; self .pauseButton.layer.borderWidth=1.0; self .pauseButton.layer.cornerRadius=5.0; [ self .pauseButton addTarget: self action: @selector (pauseMusic:) forControlEvents:UIControlEventTouchUpInside]; [ self .view addSubview: self .pauseButton]; self .switchButton=[[UIButton alloc]initWithFrame:CGRectMake(240, 100, 60, 30)]; [ self .switchButton setTitle:@ "切歌" forState:UIControlStateNormal]; [ self .switchButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; [ self .switchButton.titleLabel setFont:[UIFont systemFontOfSize:14]]; self .switchButton.layer.borderColor=[UIColor blackColor].CGColor; self .switchButton.layer.borderWidth=1.0; self .switchButton.layer.cornerRadius=5.0; [ self .switchButton addTarget: self action: @selector (switchMusic:) forControlEvents:UIControlEventTouchUpInside]; [ self .view addSubview: self .switchButton]; 初始化进度条: 1 2 self .progressView=[[UIProgressView alloc]initWithFrame:CGRectMake(40, 180, 200, 50)]; [ self .view addSubview: self .progressView]; AVAudioPlayer可以看成一个简易播放器,支持多种音频格式,能够进行进度、音量、播放速度等控制,已经满足了基本需求,接下来是播放音乐的代码: 1 2 3 4 5 6 if ( self .audioPlayer.isPlaying) { [ self .audioPlayer pause]; } else { [ self loadMusicByAsset:[[AVURLAsset alloc] initWithURL:[[ NSBundle mainBundle] URLForResource:@ "我最亲爱的" withExtension:@ "mp3" ] options: nil ]]; [ self .audioPlayer play]; } 实例化AVAudioPlayer: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 -( void )loadMusicByAsset:(AVURLAsset*)avUrlAsset { if ([[ NSFileManager defaultManager] fileExistsAtPath:avUrlAsset.URL.path]){ NSError *error= nil ; self .audioPlayer= [[AVAudioPlayer alloc] initWithContentsOfURL:avUrlAsset.URL error:&error]; self .audioPlayer.delegate= self ; //准备buffer,减少播放延时的时间 [ self .audioPlayer prepareToPlay]; [ self .audioPlayer setVolume:1]; //设置音量大小 self .audioPlayer.numberOfLoops =0; //设置播放次数,0为播放一次,负数为循环播放 if (error) { NSLog (@ "初始化错误:%@" ,error.localizedDescription); } } } 上面是通过AVURLAsset实例化的,还可以直接通过名称实例化: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 -( void )loadMusic:( NSString *)name { NSString *musicFilePath = [[ NSBundle mainBundle] pathForResource:name ofType:@ "mp3" ]; //创建音乐文件路径 if ([[ NSFileManager defaultManager] fileExistsAtPath:musicFilePath]){ NSURL *musicURL = [[ NSURL alloc] initFileURLWithPath:musicFilePath]; NSError *error= nil ; self .audioPlayer= [[AVAudioPlayer alloc] initWithContentsOfURL:musicURL error:&error]; self .audioPlayer.delegate= self ; //准备buffer,减少播放延时的时间 [ self .audioPlayer prepareToPlay]; [ self .audioPlayer setVolume:1]; //设置音量大小 self .audioPlayer.numberOfLoops =0; //设置播放次数,0为播放一次,负数为循环播放 if (error) { NSLog (@ "初始化错误:%@" ,error.localizedDescription); } } } 暂停音乐,这里为了方便单独写了一个按钮,大多数情况下,播放是暂停都是同一个按钮,仅供参考: 1 2 3 4 5 -( void )pauseMusic:(UIButton *)sender{ if ( self .audioPlayer.isPlaying) { [ self .audioPlayer pause]; } } 切歌就是通常大家点的上一曲下一曲,很好理解: 1 2 3 4 5 -( void )switchMusic:(UIButton *)sender{ [ self .audioPlayer stop]; [ self loadMusicByAsset:[[AVURLAsset alloc] initWithURL:[[ NSBundle mainBundle] URLForResource:@ "我需要一美元" withExtension:@ "mp3" ] options: nil ]]; [ self .audioPlayer play]; } 通过timer实时更新进度条: 1 2 3 self .timer = [ NSTimer scheduledTimerWithTimeInterval:0.1 target: self selector: @selector (changeProgress) userInfo: nil repeats: YES ]; 进度更新: 1 2 3 4 5 -( void )changeProgress{ if ( self .audioPlayer.isPlaying) { self .progressView.progress = self .audioPlayer.currentTime/ self .audioPlayer.duration; } } 效果如下: 音乐播放完成之后可以在AVAudioPlayerDelegate的代理方法里面根据业务场景执行自己安排: 1 2 3 4 5 6 7 -( void )audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:( BOOL )flag{ // [self.timer invalidate];直接销毁,之后不可用,慎重考虑 // [self.timer setFireDate:[NSDate date]]; //继续 // [self.timer setFireDate:[NSDate distantPast]];//开启 [ self .timer setFireDate:[ NSDate distantFuture]]; //暂停 } 本文转自Fly_Elephant博客园博客,原文链接:http://www.cnblogs.com/xiaofeixiang/p/4540286.html,如需转载请自行联系原作者

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

iOS开发-UIView扩展CGRect

关于UIView的位置都会遇到,一般需要改变UIView的位置,需要先获取原有的frame位置,然后在frame上面修改,有的时候如果只是改变了一下垂直方向的位置,宽度和高度的一种,这种写法很麻烦。下面两种写法第二种明显更简单,如果需要实现第二种方法就需要扩展UIView。 1 2 3 4 5 6 7 8 //1 CGRect frame=self.testView.frame; frame.size.width=120; self.testView.frame=frame; [self printFrame]; //2 self.testView.width=120; [self printFrame]; 扩展定义: 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 @ interface UIView (ReSize) @property (nonatomic, assign) CGSize size; @property (nonatomic,assign) CGFloat x; @property (nonatomic,assign) CGFloat y; @property (nonatomic, assign) CGFloat top; @property (nonatomic, assign) CGFloat bottom; @property (nonatomic, assign) CGFloat left; @property (nonatomic, assign) CGFloat right; @property (nonatomic, assign) CGFloat centerX; @property (nonatomic, assign) CGFloat centerY; @property (nonatomic, assign) CGFloat width; @property (nonatomic, assign) CGFloat height; @end 扩展实现: 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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 @implementation UIView (ReSize) - (CGSize)size; { return [self frame].size; } - ( void )setSize:(CGSize)size; { CGPoint origin = [self frame].origin; [self setFrame:CGRectMake(origin.x, origin.y, size.width, size.height)]; } -(CGFloat)x{ CGRect frame=[self frame]; return frame.origin.x; } -( void )setX:(CGFloat)x{ CGRect frame=[self frame]; frame.origin.x=x; [self setFrame:frame]; } -(CGFloat)y{ CGRect frame=[self frame]; return frame.origin.y; } -( void )setY:(CGFloat)y{ CGRect frame=[self frame]; frame.origin.y=y; return [self setFrame:frame]; } - (CGFloat)left; { return CGRectGetMinX([self frame]); } - ( void )setLeft:(CGFloat)x; { CGRect frame = [self frame]; frame.origin.x = x; [self setFrame:frame]; } - (CGFloat)top; { return CGRectGetMinY([self frame]); } - ( void )setTop:(CGFloat)y; { CGRect frame = [self frame]; frame.origin.y = y; [self setFrame:frame]; } - (CGFloat)right; { return CGRectGetMaxX([self frame]); } - ( void )setRight:(CGFloat)right; { CGRect frame = [self frame]; frame.origin.x = right - frame.size.width; [self setFrame:frame]; } - (CGFloat)bottom; { return CGRectGetMaxY([self frame]); } - ( void )setBottom:(CGFloat)bottom; { CGRect frame = [self frame]; frame.origin.y = bottom - frame.size.height; [self setFrame:frame]; } - (CGFloat)centerX; { return [self center].x; } - ( void )setCenterX:(CGFloat)centerX; { [self setCenter:CGPointMake(centerX, self.center.y)]; } - (CGFloat)centerY; { return [self center].y; } - ( void )setCenterY:(CGFloat)centerY; { [self setCenter:CGPointMake(self.center.x, centerY)]; } - (CGFloat)width; { return CGRectGetWidth([self frame]); } - ( void )setWidth:(CGFloat)width; { CGRect frame = [self frame]; frame.size.width = width; [self setFrame:CGRectStandardize(frame)]; } - (CGFloat)height; { return CGRectGetHeight([self frame]); } - ( void )setHeight:(CGFloat)height; { CGRect frame=[self frame]; frame.size.height = height; [self setFrame:CGRectStandardize(frame)]; } @end 项目源代码地址:https://github.com/SmallElephant/iOS-FEViewReSize 本文转自Fly_Elephant博客园博客,原文链接:http://www.cnblogs.com/xiaofeixiang/p/5119677.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等操作系统。

用户登录
用户注册