当前位置:  编程技术>移动开发
本页文章导读:
    ▪zabbix学习入门小结        zabbix学习入门总结对于zibbix,我现在的轮廓,是多个agent,一个server,再加上一些可选的proxy。 从通信的角度来看,就是数据流从agents流向server.但是agent跟server数据传送的细节,我就无法把握.........
    ▪ SharedPreferences 数据储存        SharedPreferences 数据存储 MainActivity.java代码 package cn.itcast.settings; import java.util.Map; import cn.itcast.service.PreferencesService; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.wid.........
    ▪ jQuery弹出警告对话框美化插件(警告,确认跟提示)       jQuery弹出警告对话框美化插件(警告,确认和提示) http://demo.jb51.net/js/jquery-alert-dialogs/ ......

[1]zabbix学习入门小结
    来源: 互联网  发布时间: 2014-02-18
zabbix学习入门总结
对于zibbix,我现在的轮廓,是多个agent,一个server,再加上一些可选的proxy。
从通信的角度来看,就是数据流从agents流向server.但是agent跟server数据传送的细节,我就无法把握了,即“一个数据怎么从agent传到server的”[原理,标准,协议]是我需要深入学习并积累的东西。
如果叫我来描述agent与server的通信的具体过程,我能说清楚吗?我能说清到哪一步?[抽象层次]。


根据zabbix的说明文档,
Zabbix server is the central component to which agents report availability and integrity information and statistics.[server的职能描述]


Zabbix agents are deployed on monitoring targets to actively monitor local resources and applications and report the gathered data to Zabbix server. [agent的职能描述]


注意到其中的“report”,可以知道数据传输[通信]的发起者是agent.[在第一次读文档的时候我为什么没有发现,而当我带着上面的疑问的时候却发现了这个关键点的字眼?]


现在的问题,
Q1.什么时候传输送数据?[因为通信是agent发起的,所以这个问题只与agent有关,server只需listening就好]
Q2.传送那些数据?[最重要的东东,这牵扯到agent与server两端,需要两端协商(配置)]
Q3.怎么传数据?[我的“感觉”是“以IP协议为基础的TCP或UDP协议”,好像有自己的看法,那就先放下这个问题?最好这样。]
Q4.这些过程是怎么控制的[配置文件在哪里?]


根据之后的深入学习我知道,原来agent与server的通信过程有passive与active两种。前者是server主动要数据,后者是agent根据server提供的Item列表,主动的提交数据数。上面的report应该是从数据流由agent “report” 到server的角度来说的。




proxy的角色解读
对agent来说,proxy冒充server,对server来说,proxy冒充agent.[一个词——“两面派”呗!].这是从通信的逻辑或策略方面解读,如果从数据流的角度解读——缓冲池。


User parameters
zabbix server把在zabbix agent上执行的命令的结果返回回来。

    
[2] SharedPreferences 数据储存
    来源: 互联网  发布时间: 2014-02-18
SharedPreferences 数据存储
MainActivity.java代码

package cn.itcast.settings;

import java.util.Map;

import cn.itcast.service.PreferencesService;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

public class MainActivity extends Activity {
    private EditText nameText;
    private EditText ageText;
    private PreferencesService service;
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        nameText = (EditText) this.findViewById(R.id.name);
        ageText = (EditText) this.findViewById(R.id.age);
        service = new PreferencesService(this);
        Map<String, String> params = service.getPreferences();
        nameText.setText(params.get("name"));
        ageText.setText(params.get("age"));
    }
    
    public void save(View v){
    	String name = nameText.getText().toString();
    	String age = ageText.getText().toString();
    	service.save(name, Integer.valueOf(age));
    	Toast.makeText(getApplicationContext(), R.string.success, 1).show();
    }
    
    
}


layout/main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
<TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="@string/name"
    />
    
    <EditText
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:id="@+id/name"
    />
    
    <TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="@string/age"
    />
    
    <EditText
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:numeric="integer"
    android:id="@+id/age"
    />
    
    <Button
     android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="@string/button"
    android:onClick="save"
    />
</LinearLayout>



value/string.xml 配置文件

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="hello">Hello World, MainActivity!</string>
    <string name="app_name">软件参数设置</string>
    <string name="name">姓名</string>
    <string name="age">年龄</string>
    <string name="button">保存参数</string>
    <string name="success">保存完成</string>
</resources>


核心操作类 PerferencesServer.java

package cn.itcast.service;

import java.util.HashMap;
import java.util.Map;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

public class PreferencesService {
	private Context context;
	
	public PreferencesService(Context context) {
		this.context = context;
	}
	/**
	 * 保存参数
	 * @param name 姓名
	 * @param age 年龄
	 */
	public void save(String name, Integer age) {
		SharedPreferences preferences = context.getSharedPreferences("itcast", Context.MODE_PRIVATE);
		Editor editor = preferences.edit();
		editor.putString("name", name);
		editor.putInt("age", age);
		editor.commit();
	}
	/**
	 * 获取各项配置参数
	 * @return
	 */
	public Map<String, String> getPreferences(){
		Map<String, String> params = new HashMap<String, String>();
		SharedPreferences preferences = context.getSharedPreferences("itcast", Context.MODE_PRIVATE);
		params.put("name", preferences.getString("name", ""));
		params.put("age", String.valueOf(preferences.getInt("age", 0)));
		return params;
	}
}




    
[3] jQuery弹出警告对话框美化插件(警告,确认跟提示)
    来源: 互联网  发布时间: 2014-02-18
jQuery弹出警告对话框美化插件(警告,确认和提示)

http://demo.jb51.net/js/jquery-alert-dialogs/


    
最新技术文章:
▪Android开发之登录验证实例教程
▪Android开发之注册登录方法示例
▪Android获取手机SIM卡运营商信息的方法
▪Android实现将已发送的短信写入短信数据库的...
▪Android发送短信功能代码
▪Android根据电话号码获得联系人头像实例代码
▪Android中GPS定位的用法实例
▪Android实现退出时关闭所有Activity的方法
▪Android实现文件的分割和组装
▪Android录音应用实例教程
▪Android双击返回键退出程序的实现方法
▪Android实现侦听电池状态显示、电量及充电动...
▪Android获取当前已连接的wifi信号强度的方法
▪Android实现动态显示或隐藏密码输入框的内容
▪根据USER-AGENT判断手机类型并跳转到相应的app...
▪Android Touch事件分发过程详解
▪Android中实现为TextView添加多个可点击的文本
▪Android程序设计之AIDL实例详解
▪Android显式启动与隐式启动Activity的区别介绍
▪Android按钮单击事件的四种常用写法总结
▪Android消息处理机制Looper和Handler详解
▪Android实现Back功能代码片段总结
▪Android实用的代码片段 常用代码总结
▪Android实现弹出键盘的方法
▪Android中通过view方式获取当前Activity的屏幕截...
▪Android提高之自定义Menu(TabMenu)实现方法
▪Android提高之多方向抽屉实现方法
▪Android提高之MediaPlayer播放网络音频的实现方法...
▪Android提高之MediaPlayer播放网络视频的实现方法...
▪Android提高之手游转电视游戏的模拟操控
 


站内导航:


特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

©2012-2021,,E-mail:www_#163.com(请将#改为@)

浙ICP备11055608号-3