首页 文章 精选 留言 我的

精选列表

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

centos开发环境安装的备忘

#Centos visudo运行普通用户$(whomai)执行sudo操作 http://www.cnblogs.com/xianyunhe/archive/2011/08/08/2124342.html 在/etc/gdm/custom.conf文件中添加以下内容 [daemon] AutomaticLogin=username AutomaticLoginEnable=True #virtualbox Guest Host目录共享 sudo usermod -a -G vboxsf $(whomai) #yum源镜像 1、备份 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup 2、下载新的CentOS-Base.repo 到/etc/yum.repos.d/ CentOS 5 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo CentOS 6 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo CentOS 7 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo 3、之后运行yum makecache生成缓存 mysql的安装 yum install mariadb-server.x86_64 mariadb.x86_64 systemctl enable mariadb.service systemctl start mariadb.service #docker的安装 http://git.oschina.net/wushifeng/hivedocker/blob/master/ready.sh #!/usr/bin/env bash #1 centos上安装docker if [ -f /usr/bin/docker ]; then echo 'docker installed' else sudo yum install docker.x86_64 docker -h sudo systemctl enable docker.service fi #2 docker的仓库镜像的国内站点 https://www.daocloud.io/mirror#accelerator-doc http://guide.daocloud.io/dcs/daocloud-9153151.html #https://yq.aliyun.com/articles/29941 #Docker 镜像加速器 #docker version <=1.10 :<<EOF sudo cp -n /lib/systemd/system/docker.service /etc/systemd/system/docker.service sudo sed -i "s|ExecStart=/usr/bin/docker daemon|ExecStart=/usr/bin/docker daemon --registry-mirror=<your accelerate address>|g" /etc/systemd/system/docker.service sudo systemctl daemon-reload sudo service docker restart EOF #docker version >1.10 sudo mkdir -p /etc/docker sudo tee /etc/docker/daemon.json <<-'EOF' { "registry-mirrors": ["https://2mt5bmc8.mirror.aliyuncs.com"] } EOF sudo systemctl daemon-reload sudo systemctl restart docker #3 普通用户使用dcoker #普通的用户直接使用docker命令运行 [设置完成后,注销用户重新登陆] sudo groupadd docker sudo gpasswd -a $(whomai) docker sudo systemctl restart docker docker debian source 默认deb http://deb.debian.org/debian wheezy maindeb http://deb.debian.org/debian wheezy-updates maindeb http://security.debian.org wheezy/updates main使用163的源echo "deb http://mirrors.163.com/debian wheezy main non-free contrib" >/etc/apt/sources.list echo "deb http://mirrors.163.com/debian wheezy-proposed-updates main contrib non-free" >>/etc/apt/sources.list echo "deb http://mirrors.163.com/debian wheezy-updates main contrib non-free" >>/etc/apt/sources.list echo "deb http://mirrors.163.com/debian-security wheezy/updates main contrib non-free " >>/etc/apt/sources.list echo "deb http://http.us.debian.org/debian wheezy main contrib non-free" >>/etc/apt/sources.list echo "deb http://security.debian.org wheezy/updates main contrib non-free" >>/etc/apt/sources.list #maven http://www.cnblogs.com/ae6623/p/4416256.html ~/.m2/settings.xml yum install maven.noarch 阿里云的镜像 #nodejs https://npm.taobao.org/ https://cnpmjs.org/

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

iOS开发-UISwipeGestureRecognizer滑动手势

滑动手势也算是iOS中交互中很重要的一部分,上下左右滑动,UISwipeGestureRecognizer可以很轻松的解决这个问题,没什么难度直接看代码吧: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 UISwipeGestureRecognizer *upSwipeGestureRecognizer=[[UISwipeGestureRecognizer alloc]initWithTarget: self action: @selector (swipeGestureRecognizer:)]; upSwipeGestureRecognizer.direction=UISwipeGestureRecognizerDirectionUp; [ self .view addGestureRecognizer:upSwipeGestureRecognizer]; UISwipeGestureRecognizer *downSwipeGestureRecognizer=[[UISwipeGestureRecognizer alloc]initWithTarget: self action: @selector (swipeGestureRecognizer:)]; downSwipeGestureRecognizer.direction=UISwipeGestureRecognizerDirectionDown; [ self .view addGestureRecognizer:downSwipeGestureRecognizer]; UISwipeGestureRecognizer *leftSwipeGestureRecognizer=[[UISwipeGestureRecognizer alloc]initWithTarget: self action: @selector (swipeGestureRecognizer:)]; leftSwipeGestureRecognizer.direction=UISwipeGestureRecognizerDirectionLeft; [ self .view addGestureRecognizer:leftSwipeGestureRecognizer]; UISwipeGestureRecognizer *rightSwipeGestureRecognizer=[[UISwipeGestureRecognizer alloc]initWithTarget: self action: @selector (swipeGestureRecognizer:)]; rightSwipeGestureRecognizer.direction=UISwipeGestureRecognizerDirectionRight; [ self .view addGestureRecognizer:rightSwipeGestureRecognizer]; 手势处理: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 -( void )swipeGestureRecognizer:(UISwipeGestureRecognizer *)recongnizer{ if (recongnizer.direction==UISwipeGestureRecognizerDirectionUp) { NSLog (@ "向上滑动" ); NSLog (@ "博客园-FlyElephant" ); } if (recongnizer.direction==UISwipeGestureRecognizerDirectionDown) { NSLog (@ "向下滑动" ); NSLog (@ "原文地址:http://www.cnblogs.com/xiaofeixiang" ); } if (recongnizer.direction==UISwipeGestureRecognizerDirectionLeft) { NSLog (@ "向左滑动" ); NSLog (@ "iOS技术交流群:228407086" ); } if (recongnizer.direction==UISwipeGestureRecognizerDirectionRight) { NSLog (@ "向右滑动" ); } } 效果图: 本文转自Fly_Elephant博客园博客,原文链接:http://www.cnblogs.com/xiaofeixiang/p/4586316.html,如需转载请自行联系原作者

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

iOS开发-类簇(Class Cluster)

类簇(Class Cluster)是定义相同的接口并提供相同功能的一组类的集合,仅公开接口的抽象类也可以称之为类簇的公共类,每个具体类的接口有公共类的接口抽象化,并隐藏在簇的内部。这些类一般不能够直接使用,一般都是由公共类的子类来实现,可以称之为私有子类。看概念会觉得有点枯燥,其实最常用的NSString就是一个类簇,不过看起来不明显,比较明显的是NSNumber,numberWithInt,numberWithDouble,这些方法其实在调用NSNumber的时候父类实例化私有子类,返回对应的实例。 基础概念 概念一般都是比较枯燥一点,我们可以先写一个简单的测试小程序来看一下NSString类簇大概的样子: 1 2 3 4 5 NSString *result= @"博客园-FlyElephant" ; classClusterLog(result); classClusterLog([result stringByAppendingString: @"原文地址:http://www.cnblogs.com/xiaofeixiang/" ]); classClusterLog([NSString stringWithUTF8String: "---" ]); classClusterLog(NSHomeDirectory()); 输出方法: 1 2 3 4 5 6 7 static void classClusterLog(NSString *str){ NSLog( @"Content=%@,Class=%s,\tmember=%s,\tkind=%s\n" , str, [NSStringFromClass([str class ]) UTF8String], [str isMemberOfClass:[NSString class ]]? "Yes" : "NO" , [str isKindOfClass:[NSString class ]]? "YES" : "NO" ); } 测试结果: 通过Log我们输出了类的真实的类型,我们发现每个类的类型都不一样,而且我们MemberClass得到的是类簇的类型,KindClass才能得到子类的类型,很多情况下公共类作为抽象类被实现的时候,各个方法都是在子类中具体实现的,因此即使直接生成继承公共类的子类,也不能立即产生用户想要的功能。 类簇的子类 类簇是多种类别实现抽象化,在公共类的外部只有类簇是可见的,虽然类簇是作为Foundation框架的基本类实现,一般情况下没必要生成子类,不过有的时候类簇的基本方法方法不能满足基本需求的时候可以使用Category进行扩展,这个之前的文章中有过讲述,如果不是很清晰,可以查看一下。类簇包含了基本的方法,但是具体的实现都是在私有子类中。如果我们需要新生成子类,可以直接实现已经公开的基本方法。 NSString有两个基本的方法:length和characterAtIndex,我们定义个NSString子类看一下效果: 1 2 3 4 5 6 7 8 9 10 11 12 @ interface BitPattern : NSString { unsigned char value; } -(id)initWithChar:( char )val; -(NSUInteger)length; -(unichar)characterAtIndex:(NSUInteger)index; @end 实现文件: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 @implementation BitPattern -(id)initWithChar:( char )val{ self=[super init]; if (self) { value=val; } return self; } -(NSUInteger)length{ return 4; } -(unichar)characterAtIndex:(NSUInteger)index{ return 'K' ; } @end 简单调用: 1 2 3 NSString *bits; bits=[[BitPattern alloc]initWithChar: 'A' ]; NSLog( @"%@--结果为:%s" ,[bits class ],[bits UTF8String]); 最后的结果为KKKK,关于类簇的子类的实现方法有几个需要考虑的地方: 1.确定私有数据结构,作为超类不能使用所有的数据结构; 2.定义初始化方法,定义init..这样的初始化方法,不能继承和使用init之外的超类的初始化方法; 3.定义构造器,不能继承和使用超类的同样的方法; 4.定义基本方法 5.定义其他方法,通过定义基础方法,公共类声明的方法可以暂且执行,但是利益哦那个生成的数据结构的特征也许能够产生更加高效的方法; iOS中的类簇也可以理解为简单工厂设计模式的一种具体实现~ 本文转自Fly_Elephant博客园博客,原文链接:http://www.cnblogs.com/xiaofeixiang/p/4712282.html,如需转载请自行联系原作者

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

iOS开发-UIScrollView图片无限循环

关于UIScrollView图片浏览的例子有很多,之前也写过类似方面的文章,关于UIScrollView的图片循环在新闻类的App基本上是比较常见的一种情况就是图片浏览,然后根据不同的图片显示不同的内容显示不同的图片的介绍,因为属于比较常用的空间,先来看下需要实现的效果: 小圆点指示器是通过UIPageControl实现的,图片循环通过UIScrollView实现: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 -(UIPageControl *)pageControl{ if (!_pageControl) { _pageControl=[[UIPageControl alloc]initWithFrame:CGRectMake(0, 0, 150, 40)]; _pageControl.currentPage=0; _pageControl.pageIndicatorTintColor=[UIColor whiteColor]; _pageControl.currentPageIndicatorTintColor=[UIColor greenColor]; } return _pageControl; } -(UIScrollView *)scrollView{ if (!_scrollView) { CGRect screenRect=[[UIScreen mainScreen]bounds]; _scrollView=[[UIScrollView alloc]initWithFrame:CGRectMake(0, 64, CGRectGetWidth(screenRect), CGRectGetHeight(screenRect)-164)]; [_scrollView setBounces:NO]; [_scrollView setShowsHorizontalScrollIndicator:NO]; [_scrollView setPagingEnabled:YES]; _scrollView. delegate =self; } return _scrollView; } 关于分页的页面配置以及页数Label的设置: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 self.screenRect=[[UIScreen mainScreen]bounds]; CGFloat width=self.scrollView.bounds.size.width; CGFloat height=self.scrollView.bounds.size.height; self.imageArr=@[ @"girl0.jpg" , @"girl1.jpg" , @"girl2.jpg" ]; [self.scrollView setContentSize:CGSizeMake([self.imageArr count]*width, height)]; for (NSInteger i=0; i<[self.imageArr count]; i++) { UIImageView *imageView=[[UIImageView alloc]initWithFrame:CGRectMake(i*width, 0, width,height)]; imageView.image=[UIImage imageNamed:self.imageArr[i]]; imageView.contentMode=UIViewContentModeScaleToFill; [self.scrollView addSubview:imageView]; } [self.view addSubview:self.scrollView]; self.pageControl.numberOfPages=[self.imageArr count]; self.pageControl.center=CGPointMake(self.scrollView.center.x, CGRectGetMaxY(self.scrollView.bounds)+50); [self.view addSubview:self.pageControl]; self.pageLabel.text=[NSString stringWithFormat: @"%d/%lu" ,1,[self.imageArr count]]; [self.view addSubview:self.pageLabel]; 实现UIScrollViewDelegate中scrollViewDidEndDecelerating的方法: 1 2 3 4 5 6 7 8 9 10 11 //博客园-FlyElephant 原文地址:http://www.cnblogs.com/xiaofeixiang/ -( void )scrollViewDidEndDecelerating:(UIScrollView *)scrollView{ if (self.currentPage==[self.imageArr count]-1) { self.currentPage=0; self.scrollView.contentOffset=CGPointMake(0, 0); } else { self.currentPage=scrollView.contentOffset.x/CGRectGetWidth(self.screenRect); } self.pageControl.currentPage=self.currentPage; [self.pageLabel setText:[NSString stringWithFormat: @"%ld/%lu" ,self.currentPage+1,[self.imageArr count]]]; } 简单的UIScrollView实现基本上ok了,当然关于UIScrollView根据不同场景去实现不同的功能代码量比这肯定更复杂~ 本文转自Fly_Elephant博客园博客,原文链接:http://www.cnblogs.com/xiaofeixiang/p/4754451.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等操作系统。

WebStorm

WebStorm

WebStorm 是jetbrains公司旗下一款JavaScript 开发工具。目前已经被广大中国JS开发者誉为“Web前端开发神器”、“最强大的HTML5编辑器”、“最智能的JavaScript IDE”等。与IntelliJ IDEA同源,继承了IntelliJ IDEA强大的JS部分的功能。

用户登录
用户注册