首页 文章 精选 留言 我的

精选列表

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

在Linux系统新增加一块硬盘

今天公司测试Linux服务器硬盘不够用了,主要是mysql数据文件太大了,买了个500G的硬盘回来,这里记录下新加硬盘的方法 PS 测试服务器的主板太差劲了,没有多余的电源接口,只能把光驱的电源拿出来,才能让硬盘使用。 把硬盘装好后,我们用 fdisk -l 查看下: 图中可以看出 /dev/sdb 是500G,新加的硬盘。 接下来我用命令 fdisk sdb 进行分区,输入 p 查看新硬盘分区,如图: 可以用m命令来看fdisk命令的内部命令;n命令创建一个新分区;d命令删除一个存在的分区;p命令显示分区列表;t命令修改分区的类型ID号;l命令显示分区ID号的列表;a命令指定启动分区;w命令是将对分区表的修改存盘让它发生作用。 我们这里是创建新分区,所以输入 n 然后 e 是扩展分区,p 是主分区,我们输入 p 接下来的块数什么的,都输入 1 ,最后选择大小,Last cylinder or +size or +sizeM or +sizeK (1-60801, default 60801): +500GB //我们输入这个意思是分区大小为500G 最后输入 w 保存,如图: 然后在/dev/目录下就可以看到 sdb1 存在了。 分区完了之后,我们需要进行格式化,使用 mkfs -t ext3 /dev/sdb1 命令进行对sdb1格式化。如图: 上图格式化,我还在进行中,大约进行了一半。 格式化完了之后,我们就可以进行挂载分区了,我们先创建一个目录叫 data 然后把 /dev/sdb1 挂载到 /data 目录下,命令如下 mkdir /data mount /dev/sdb1 /data 最后使用 df -h 命令进行查看,修改 /etc/fstab 来进行自动加载。如图: 保存后,重启服务器,一切OK。

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

Android应用中使用及实现系统“分享”接口

为了应用的推广、传播,很多的应用中都有“分享”功能,一个按钮,点击后会出现短信、微博等等一切实现了分享功能的应用列表。这一篇文章主要介绍怎么调用分享功能和怎么实现分享接口让自己应用出现分享列表中。Android应用中能很方便的完成这些功能,这也正是Android的伟大之处,他能很简单的完成应用之间的沟通以相互整合。 调用分享功能 1、分享文本 分享功能使用的隐式启动Activity的方法,这里的Action使用的是ACTION_SEND。 [java] view plain copy print ? Intent sendIntent =newIntent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_TEXT,"This is my text to send."); sendIntent.setType("text/plain"); startActivity(sendIntent); 效果如下图的图一。 2、改变分享列表标题 使用上面的分享方式分享列表标题为“使用一下内容完成操作”,Android中提供了Intent.createChooser(),这样能一直显示分享选择列表,并且修改了分享列表标题内容。 [java] view plain copy print ? Intent sendIntent =newIntent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_TEXT,"This is my text to send."); sendIntent.setType("text/plain"); startActivity(Intent.createChooser(sendIntent, getResources().getText(R.string.send_to))); 使用Intent.createChooser()的好处: If you callIntent.createChooser()for the intent, Android willalwaysdisplay the chooser. This has some advantages: Even if the user has previously selected a default action for this intent, the chooser will still be displayed. If no applications match, Android displays a system message. You can specify a title for the chooser dialog. 分享功能不只是Intent.EXTRA_TEXT,还可以EXTRA_EMAIL,EXTRA_CC,EXTRA_BCC,EXTRA_SUBJECT. 只需要接受方完成响应数据接受。 3、分享图片 分享功能还支持二进制内容(Binary Content),但是多数是处理的图片,因为shareIntent.setType("image/jpeg")这一项设置了内容类型。可也以是其他类型,需要接受方支持。 [java] view plain copy print ? Intent shareIntent =newIntent(); shareIntent.setAction(Intent.ACTION_SEND); shareIntent.putExtra(Intent.EXTRA_STREAM, uriToImage); shareIntent.setType("image/jpeg"); startActivity(Intent.createChooser(shareIntent, getResources().getText(R.string.send_to))); 4、分享图片列表 分享功能不仅支持单张图片,还支持图片列表,这里还是说的范围太窄了,应该声明不仅仅是图片。 [java] view plain copy print ? ArrayList<Uri> imageUris =newArrayList<Uri>(); imageUris.add(imageUri1);// Add your image URIs here imageUris.add(imageUri2); Intent shareIntent =newIntent(); shareIntent.setAction(Intent.ACTION_SEND_MULTIPLE); shareIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, imageUris); shareIntent.setType("image/*"); startActivity(Intent.createChooser(shareIntent,"Share images to..")); 实现分享功能 上面说的都是怎么调用分享功能,以下就开始写怎么实现分享功能,让我们的应用也出现在分享列表中。前面也说了分享功能是使用隐式调用Activtiy实现的,Activity需要声明<intent-filter>。 声明intent-filter [java] view plain copy print ? <activity android:name="com.example.sharedemo.ShareActivity" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.SEND"/> <category android:name="android.intent.category.DEFAULT"/> <data android:mimeType="image/*"/> </intent-filter> <intent-filter> <action android:name="android.intent.action.SEND"/> <category android:name="android.intent.category.DEFAULT"/> <data android:mimeType="text/plain"/> </intent-filter> <intent-filter> <action android:name="android.intent.action.SEND_MULTIPLE"/> <category android:name="android.intent.category.DEFAULT"/> <data android:mimeType="image/*"/> </intent-filter> </activity> 上面声明了三种intent-filter,当然可以更多,这里只是举个例子, 处理接收数据 声明了intent-filter,响应的Activity就要处理响应的数据,示例如下: [java] view plain copy print ? publicclassShareActivityextendsActivity{ @Override protectedvoidonCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); // Get intent, action and MIME type Intent intent = getIntent(); String action = intent.getAction(); String type = intent.getType(); if(Intent.ACTION_SEND.equals(action) && type !=null) { if("text/plain".equals(type)) { handleSendText(intent);// Handle text being sent }elseif(type.startsWith("image/")) { handleSendImage(intent);// Handle single image being sent } }elseif(Intent.ACTION_SEND_MULTIPLE.equals(action) && type !=null) { if(type.startsWith("image/")) { handleSendMultipleImages(intent);// Handle multiple images being sent } }else{ // Handle other intents, such as being started from the home screen } } voidhandleSendText(Intent intent) { String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT); String sharedTitle = intent.getStringExtra(Intent.EXTRA_TITLE); if(sharedText !=null) { // Update UI to reflect text being shared } } voidhandleSendImage(Intent intent) { Uri imageUri = (Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM); if(imageUri !=null) { // Update UI to reflect image being shared } } voidhandleSendMultipleImages(Intent intent) { ArrayList<Uri> imageUris = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM); if(imageUris !=null) { // Update UI to reflect multiple images being shared } } } 通过声明intent-filter,处理接受到的数据就能完成分享的接收功能。 更多 上面只做了分享功能简单的说明,伴随着Android api的升级,也出现了一些新的完成“分享”功能的方法,比如ShareActionProvider,更多请参考。 示例下载 /** * @author 张兴业 * http://blog.csdn.net/xyz_lmn * iOS入门群:83702688 * android开发进阶群:241395671 * 我的新浪微博:@张兴业TBOW */ 参考: http://developer.android.com/training/sharing/index.html 本文转自xyz_lmn51CTO博客,原文链接:http://blog.51cto.com/xyzlmn/1344472,如需转载请自行联系原作者

资源下载

更多资源
Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

腾讯云软件源

腾讯云软件源

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

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应用均可从中受益。

用户登录
用户注册