16.libgdx根据配置文件生成布局(未完)-程序员宅基地

技术标签: java  ui  

思路:

  screen分为普通和复杂两种,普通的功能大部分是页面跳转以及简单的crud数据,复杂的单独弄出来

  跳转普通的screen,直接根据配置文件调整设置

<layouts>
    <loyout screenId="0" bg="bg_start" name="start" defaultWinId="" bgm="" remark="">
    </loyout>
    <loyout screenId="1" bg="bg_main" name="main" defaultWinId="0" bgm="" remark="">
        <window id="0" scale="1.0" bg="" x="0" y="0" w="0" h="0" float="center" >
            <buttons >
                <button  x="50" y="30" w="0" h="0"   imgUpName="mbtn_empire"  imgDownName="mbtn_empire"  functionId="0" font="" remark="帝国"></button>
                <button  x="300" y="30" w="0" h="0"  imgUpName="mbtn_conquest"  imgDownName="mbtn_conquest"  functionId="1" font="" remark="征服"></button>
                <button  x="550" y="30" w="0" h="0"  imgUpName="mbtn_commder"  imgDownName="mbtn_commder"  functionId="2" font="" remark="指挥官"></button>
                <button  x="800" y="30" w="0" h="0"  imgUpName="mbtn_option"  imgDownName="mbtn_option"  functionId="3" font="" remark="设置"></button>
                <button  x="300" y="120" w="0" h="0"  imgUpName="mbtn_map"  imgDownName="mbtn_map"  functionId="4" font="" remark="地图"></button>
            </buttons>
        </window>
    </loyout>
</layouts>
package com.zhfy.game.screen;

import java.util.ArrayList;
import java.util.List;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.ScreenAdapter;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.XmlReader;
import com.badlogic.gdx.utils.XmlReader.Element;
import com.badlogic.gdx.utils.viewport.StretchViewport;
import com.zhfy.game.MainGame;
import com.zhfy.game.config.ResConfig;
import com.zhfy.game.framework.GameFramework;
import com.zhfy.game.framework.GameLayout;
import com.zhfy.game.framework.GameUtil;
import com.zhfy.game.model.framework.TextureRegionListDAO;
import com.zhfy.game.screen.actor.base.BaseActor;

/**
 * 主游戏场景(游戏主界面), 实现 Screen 接口 或者 继承 ScreenAdapter 类 <br/>
 * 这里就展示一张图片代表游戏主界面
 */
public class MainScreen extends ScreenAdapter {
    
    private MainGame game;
    private EmpireScreen empireScreen;
    

    private Texture manTexture;

    private List<Stage> stages;
    private Stage stage;

    private BaseActor manActor;
    private TextureRegionListDAO imgLists;
    
    private TextureRegionListDAO imgUpList;
    
    private TextureRegionListDAO imgDownList;
    
    private ImageButton button;
    //使用场景
    private int screenId=1;
    //uiRoot
    private Element uiR;
    //ui
    private List<Element> ui;
    private XmlReader reader ;
    private String bgTexture;
    private float tempX,tempY,tempW,tempH;
    Array<Element> buttonEs;
    //private GameFramework framework;
    
    public MainScreen(MainGame mainGame)  {
        //获取传参
        this.game=mainGame;
        // 创建背景纹理, 图片 bg_main.png
        
        

        reader = ResConfig.reader;
        uiR=GameLayout.getXmlERootByScreenId(screenId);
        ui=GameUtil.getXmlEByRootE(uiR);
        manTexture = GameUtil.getBgTextureByStr(uiR.get("bg"),mainGame.getAssetManager());
        //stages=new ArrayList<Stage>();
        
        //获取对应图片
        imgLists=GameUtil.getTextureReigonByScreenId( screenId,mainGame.getAssetManager());
        // 创建游戏人物演员
        manActor = new BaseActor(new TextureRegion(manTexture));
        
        
        for  (Element window:ui) {
            tempX=window.getInt("x");tempY=window.getInt("y");tempW=window.getInt("w");tempH=window.getInt("h");
            stage = new Stage(new StretchViewport(tempW==0?mainGame.getWorldWidth():tempW,tempH==0?mainGame.getWorldHeight():tempH));
            
            
            // 添加演员到舞台
            stage.addActor(manActor);
            imgUpList=new TextureRegionListDAO();
            imgDownList=new TextureRegionListDAO();
            //遍历window的buttons按钮
            buttonEs = window.getChildByName("buttons").getChildrenByNameRecursively("button");  // 递归遍历,否则的话返回null
            for (Element buttonE : buttonEs) {
               //Gdx.app.log("ui测试", button.get("remark"));
                imgUpList.add(imgLists.getTextureByName(buttonE.get("imgUpName")));
                imgDownList.add(imgLists.getTextureByName(buttonE.get("imgDownName")));
               
                button = new ImageButton(new TextureRegionDrawable(imgLists.getTextureByName(buttonE.get("imgUpName")).getTextureRegion()),new TextureRegionDrawable(imgLists.getTextureByName(buttonE.get("imgDownName")).getTextureRegion()),new TextureRegionDrawable(imgLists.getTextureByName(buttonE.get("imgDownName")).getTextureRegion()));
                button.setSize(buttonE.getInt("w")==0?imgLists.getTextureByName(buttonE.get("imgUpName")).getTextureRegion().getRegionWidth():buttonE.getInt("w"), buttonE.getInt("h")==0?imgLists.getTextureByName(buttonE.get("imgUpName")).getTextureRegion().getRegionHeight():buttonE.getInt("h"));
                button.setPosition(buttonE.getInt("x"),buttonE.getInt("y"));
                function(buttonE.getInt("functionId"));
                stage.addActor(button);
                Gdx.input.setInputProcessor(stage);
                
            }
        }
        
        
        
        
        /*// 使用伸展视口创建舞台
        
        // 将输入处理设置到舞台(必须设置, 否则点击按钮没效果)
        Gdx.input.setInputProcessor(stage);
        
        
        {
            //设定按钮
            for(int i=0;i<imgUpList.size();i++) {
                button = new ImageButton(new TextureRegionDrawable(new TextureRegion(imgUpList.get(i).getTextureRegion())),new TextureRegionDrawable(new TextureRegion(imgDownList.get(i).getTextureRegion())),new TextureRegionDrawable(new TextureRegion(imgDownList.get(i).getTextureRegion())));
                button.setSize(imgUpList.get(i).getTextureRegion().getRegionWidth(), imgUpList.get(i).getTextureRegion().getRegionHeight());
                button.setPosition(imgUpList.get(i).getRefx(),imgUpList.get(i).getRefy());
               
                //把按钮监听放到function(i)里了;
                function(i);
                stage.addActor(button);
            }
        }
        //测试框架
        //framework.getStagesByScreenId(screenId);
        
        //文字示例
        Label label=new Label("124563987258,12456382236874,123654236",new LabelStyle(new BitmapFont(), null));
        label.setWidth(100);//设置每行的宽度
        label.setWrap(true);//开启换行
        stage.addActor(label);*/
    }

    @Override
    public void render(float delta) {
        // 红色清屏
        Gdx.gl.glClearColor(1, 0, 0, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        // 更新舞台逻辑
        stage.act();
        // 绘制舞台
        stage.draw();
    }

    public void dispose() {
        super.dispose();
        // 场景被销毁时释放资源
        /*if (manTexture != null) {
            manTexture.dispose();
        }*/
        if (stage != null) {
            stage.dispose();
        }
    }
    
    //实现的功能
    public void function(int i){
        switch(i) {
            case 0://跳转到帝国页面
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        //Gdx.app.log("点击了第1个按钮", "x:" + x+" y:" + y);
                        game.showGameScreen(screenId,3);
                    }
                });
                break;
            case 1://跳转到征服页面
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        game.showGameScreen(screenId,4);
                    }
                });
                break;
            case 2://跳转到指挥官页面
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        game.showGameScreen(screenId,5);
                    }
                });
                break;
            case 3://跳转到设置页面
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        game.showGameScreen(screenId,6);
                    }
                });
                break;
            case 4://跳转到设置页面
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        //game.showGameScreen(6);
                        game.showGameScreen(screenId,7);
                    }
                });
                break;
            default:
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        Gdx.app.log("点击了其他按钮", "x:" + x+" y:" + y);
                    }
                });
                break;
        }
        
        
        
    }
    

}
通用场景

 

构想中首先根据screenId获得其布局背景图,布局默认stage编号,背景音乐等信息,

然后一个window代表一个stage,buttons下加载其按钮配置 

随后还设想加入Lable(文本标签)和Image(图片标签),并且x,y,w,h等都会变为百分比计算距离,根据float来确定位置(靠左,靠右,居中),根据bgm切换音乐

实现多窗口(多stage),动态加载内容等功能

此篇将随着后续对ui的完善持续更新

6.22更新:

所有坐标按百分比读取,绘制点为图片中心点,如果超边界,会顶边而不超出去

package com.zhfy.game.screen;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.ScreenAdapter;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.XmlReader;
import com.badlogic.gdx.utils.XmlReader.Element;
import com.badlogic.gdx.utils.viewport.StretchViewport;
import com.zhfy.game.MainGame;
import com.zhfy.game.config.ResConfig;
import com.zhfy.game.framework.GameFramework;
import com.zhfy.game.framework.GameLayout;
import com.zhfy.game.framework.GameUtil;
import com.zhfy.game.model.framework.TextureRegionListDAO;
import com.zhfy.game.screen.abandon.EmpireScreen;
import com.zhfy.game.screen.actor.base.BaseActor;

/**
 * 主游戏场景(游戏主界面), 实现 Screen 接口 或者 继承 ScreenAdapter 类 <br/>
 * 这里就展示一张图片代表游戏主界面
 */
public class GeneralScreen extends ScreenAdapter {
    
    private MainGame game;
    

    private Texture manTexture;
    
    private Image bgImage;

    private List<Stage> stages;
    private Stage stage;

    private TextureRegionListDAO imgLists;
    
    private TextureRegionListDAO imgUpList;
    
    private TextureRegionListDAO imgDownList;
    
    private ImageButton button;
    //使用场景
    private int screenId=-1;
    //uiRoot
    private Element uiR;
    //ui
    private List<Element> ui;
    private XmlReader reader ;
    private String bgTexture;
    private float tempX,tempY,tempW,tempH;
    Array<Element> buttonEs;
    private Map tempMap;
    private int i;//function的计数标志,从1开始
    //private GameFramework framework;
    
    public GeneralScreen(MainGame mainGame,int screenId)  {
        //获取传参
        this.game=mainGame;
        // 创建背景纹理, 图片 bg_main.png
        
        this.screenId=screenId;
        reader = ResConfig.reader;
        uiR=GameLayout.getXmlERootByScreenId(screenId);
        ui=GameUtil.getXmlEByRootE(uiR);
        manTexture = GameUtil.getBgTextureByStr(uiR.get("bg"),mainGame.getAssetManager());
        //stages=new ArrayList<Stage>();
        
        //获取对应图片
        imgLists=GameUtil.getTextureReigonByScreenId( screenId,mainGame.getAssetManager());
        // 创建游戏人物演员
        bgImage= new Image(manTexture);
        bgImage.setSize(mainGame.getWorldWidth(), mainGame.getWorldHeight());
        
        i=1;
        for  (Element window:ui) {
            tempX=window.getInt("x");tempY=window.getInt("y");tempW=window.getInt("w");tempH=window.getInt("h");
            stage = new Stage(new StretchViewport(tempW==0?mainGame.getWorldWidth():tempW,tempH==0?mainGame.getWorldHeight():tempH));
            
            
            // 添加演员到舞台
            stage.addActor(bgImage);
            imgUpList=new TextureRegionListDAO();
            imgDownList=new TextureRegionListDAO();
            //遍历window的buttons按钮
            buttonEs = window.getChildByName("buttons").getChildrenByNameRecursively("button");  // 递归遍历,否则的话返回null
            for (Element buttonE : buttonEs) {
               //Gdx.app.log("ui测试", button.get("remark"));
                imgUpList.add(imgLists.getTextureByName(buttonE.get("imgUpName")));
                imgDownList.add(imgLists.getTextureByName(buttonE.get("imgDownName")));
               
                button = new ImageButton(new TextureRegionDrawable(imgLists.getTextureByName(buttonE.get("imgUpName")).getTextureRegion()),new TextureRegionDrawable(imgLists.getTextureByName(buttonE.get("imgDownName")).getTextureRegion()),new TextureRegionDrawable(imgLists.getTextureByName(buttonE.get("imgDownName")).getTextureRegion()));
                button.setSize(buttonE.getInt("w")==0?imgLists.getTextureByName(buttonE.get("imgUpName")).getTextureRegion().getRegionWidth():buttonE.getInt("w")*imgLists.getTextureByName(buttonE.get("imgUpName")).getTextureRegion().getRegionWidth()/100, buttonE.getInt("h")==0?imgLists.getTextureByName(buttonE.get("imgUpName")).getTextureRegion().getRegionHeight():buttonE.getInt("h")*imgLists.getTextureByName(buttonE.get("imgUpName")).getTextureRegion().getRegionHeight()/100);
                button.setPosition(
                        buttonE.getInt("x")*stage.getWidth()/100+button.getWidth()/2>stage.getWidth()?stage.getWidth()-button.getWidth():buttonE.getInt("x")*stage.getWidth()/100-button.getWidth()/2<0?0:buttonE.getInt("x")*stage.getWidth()/100-button.getWidth()/2,
                        buttonE.getInt("y")*stage.getHeight()/100+button.getHeight()/2>stage.getHeight()?stage.getHeight()-button.getHeight():buttonE.getInt("y")*stage.getHeight()/100-button.getHeight()/2<0?0:buttonE.getInt("y")*stage.getHeight()/100-button.getHeight()/2);
                tempMap=new HashMap();
                tempMap.put("FUNCTION_ID", buttonE.get("functionId"));
                tempMap.put("ID", i);
                /*switch(screenId) {
                    //一些特殊的数据 暂时废弃
                    case 7:
                    break;
                }*/
                i++;       
                function(tempMap);
                stage.addActor(button);
                Gdx.input.setInputProcessor(stage);
                
            }
        }
        
        
        
        
        /*// 使用伸展视口创建舞台
        
        // 将输入处理设置到舞台(必须设置, 否则点击按钮没效果)
        Gdx.input.setInputProcessor(stage);
        
        
        {
            //设定按钮
            for(int i=0;i<imgUpList.size();i++) {
                button = new ImageButton(new TextureRegionDrawable(new TextureRegion(imgUpList.get(i).getTextureRegion())),new TextureRegionDrawable(new TextureRegion(imgDownList.get(i).getTextureRegion())),new TextureRegionDrawable(new TextureRegion(imgDownList.get(i).getTextureRegion())));
                button.setSize(imgUpList.get(i).getTextureRegion().getRegionWidth(), imgUpList.get(i).getTextureRegion().getRegionHeight());
                button.setPosition(imgUpList.get(i).getRefx(),imgUpList.get(i).getRefy());
               
                //把按钮监听放到function(i)里了;
                function(i);
                stage.addActor(button);
            }
        }
        //测试框架
        //framework.getStagesByScreenId(screenId);
        
        //文字示例
        Label label=new Label("124563987258,12456382236874,123654236",new LabelStyle(new BitmapFont(), null));
        label.setWidth(100);//设置每行的宽度
        label.setWrap(true);//开启换行
        stage.addActor(label);*/
    }

    @Override
    public void render(float delta) {
        // 红色清屏
        Gdx.gl.glClearColor(1, 0, 0, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        // 更新舞台逻辑
        stage.act();
        // 绘制舞台
        stage.draw();
    }

    public void dispose() {
        super.dispose();
        // 场景被销毁时释放资源
        /*if (manTexture != null) {
            manTexture.dispose();
        }*/
        if (stage != null) {
            stage.dispose();
        }
    }
    
    //实现的功能
    /*
    0:帝国/战役
    1:征服
    2:指挥官
    3:设置
    4:地图
    5:返回主页
    6:地图跳入(i)
    7:跳入详细地图
    8:
    9:
    10:
    11:
    12:
     */
            
    public void function(Map map){
        int i=Integer.parseInt(map.get("FUNCTION_ID").toString());
        switch(i) {
            case 0://跳转到帝国页面
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        //Gdx.app.log("点击了第1个按钮", "x:" + x+" y:" + y);
                        game.showGameScreen(screenId,3);
                    }
                });
                break;
            case 1://跳转到征服页面
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        game.showGameScreen(screenId,4);
                    }
                });
                break;
            case 2://跳转到指挥官页面
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        game.showGameScreen(screenId,5);
                    }
                });
                break;
            case 3://跳转到设置页面
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        game.showGameScreen(screenId,6);
                    }
                });
                break;
            case 4://跳转到设置地图
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        //game.showGameScreen(6);
                        game.showGameScreen(screenId,7);
                    }
                });
                break;
            case 5://返回
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        //game.showGameScreen(6);
                        game.showGameScreen(screenId,1);
                    }
                });
                break;
            case 6://地图跳入
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        //game.showGameScreen(6);
                        game.showGameScreen(screenId,7);
                    }
                });
                break;
            case 7://地图编辑
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        game.setMapId(Integer.parseInt(map.get("ID").toString()));
                        game.showGameScreen(screenId,71);
                    }
                });
                break;
            case 8://跳入征服    
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        game.setStageId(Integer.parseInt(map.get("ID").toString()));
                        game.showGameScreen(screenId,81);
                    }
                });
                break;
                
                
            default:
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        Gdx.app.log("点击了其他按钮", "x:" + x+" y:" + y);
                    }
                });
                break;
        }
        
        
        
    }
    

}
所有坐标按百分比读取

 

转载于:https://www.cnblogs.com/tysk/p/10995508.html

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/weixin_30764137/article/details/99412019

智能推荐

linux devkmem 源码,linux dev/mem dev/kmem实现访问物理/虚拟内存-程序员宅基地

文章浏览阅读451次。dev/mem: 物理内存的全镜像。可以用来访问物理内存。/dev/kmem: kernel看到的虚拟内存的全镜像。可以用来访问kernel的内容。调试嵌入式Linux内核时,可能需要查看某个内核变量的值。/dev/kmem正好提供了访问内核虚拟内存的途径。现在的内核大都默认禁用了/dev/kmem,打开的方法是在 make menuconfig中选中 device drivers --> ..._dev/mem 源码实现

vxe-table 小众但功能齐全的vue表格组件-程序员宅基地

文章浏览阅读7.1k次,点赞2次,收藏19次。vxe-table,一个小众但功能齐全并支持excel操作的vue表格组件_vxe-table

(开发)bable - es6转码-程序员宅基地

文章浏览阅读62次。参考:http://www.ruanyifeng.com/blog/2016/01/babel.htmlBabelBabel是一个广泛使用的转码器,可以将ES6代码转为ES5代码,从而在现有环境执行// 转码前input.map(item => item + 1);// 转码后input.map(function (item) { return item..._让开发环境支持bable

FPGA 视频处理 FIFO 的典型应用_fpga 频分复用 视频-程序员宅基地

文章浏览阅读2.8k次,点赞6次,收藏29次。摘要:FPGA视频处理FIFO的典型应用,视频输入FIFO的作用,视频输出FIFO的作用,视频数据跨时钟域FIFO,视频缩放FIFO的作用_fpga 频分复用 视频

R语言:设置工作路径为当前文件存储路径_r语言设置工作目录到目标文件夹-程序员宅基地

文章浏览阅读575次。【代码】R语言:设置工作路径为当前文件存储路径。_r语言设置工作目录到目标文件夹

background 线性渐变-程序员宅基地

文章浏览阅读452次。格式:background: linear-gradient(direction, color-stop1, color-stop2, ...);<linear-gradient> = linear-gradient([ [ <angle> | to <side-or-corner>] ,]? &l..._background线性渐变

随便推点

【蓝桥杯省赛真题39】python输出最大的数 中小学青少年组蓝桥杯比赛 算法思维python编程省赛真题解析-程序员宅基地

文章浏览阅读1k次,点赞26次,收藏8次。第十三届蓝桥杯青少年组python编程省赛真题一、题目要求(注:input()输入函数的括号中不允许添加任何信息)1、编程实现给定一个正整数N,输出正整数N中各数位最大的那个数字。例如:N=132,则输出3。2、输入输出输入描述:只有一行,输入一个正整数N输出描述:只有一行,输出正整数N中各数位最大的那个数字输入样例:

网络协议的三要素-程序员宅基地

文章浏览阅读2.2k次。一个网络协议主要由以下三个要素组成:1.语法数据与控制信息的结构或格式,包括数据的组织方式、编码方式、信号电平的表示方式等。2.语义即需要发出何种控制信息,完成何种动作,以及做出何种应答,以实现数据交换的协调和差错处理。3.时序即事件实现顺序的详细说明,以实现速率匹配和排序。不完整理解:语法表示长什么样,语义表示能干什么,时序表示排序。转载于:https://blog.51cto.com/98..._网络协议三要素csdn

The Log: What every software engineer should know about real-time data's unifying abstraction-程序员宅基地

文章浏览阅读153次。主要的思想,将所有的系统都可以看作两部分,真正的数据log系统和各种各样的query engine所有的一致性由log系统来保证,其他各种query engine不需要考虑一致性,安全性,只需要不停的从log系统来同步数据,如果数据丢失或crash可以从log系统replay来恢复可以看出kafka系统在linkedin中的重要地位,不光是d..._the log: what every software engineer should know about real-time data's uni

《伟大是熬出来的》冯仑与年轻人闲话人生之一-程序员宅基地

文章浏览阅读746次。伟大是熬出来的  目录  前言  引言 时间熬成伟大:领导者要像狼一样坚忍   第一章 内圣外王——领导者的心态修炼  1. 天纵英才的自信心  2. 上天揽月的企图心  3. 誓不回头的决心  4. 宠辱不惊的平常心  5. 换位思考的同理心  6. 激情四射的热心  第二章 日清日高——领导者的高效能修炼  7. 积极主动,想到做到  8. 合理掌控自己的时间和生命  9. 制定目标,马..._当狼拖着受伤的右腿逃生时,右腿会成为前进的阻碍,它会毫不犹豫撕咬断自己的腿, 以

有源光缆AOC知识百科汇总-程序员宅基地

文章浏览阅读285次。在当今的大数据时代,人们对高速度和高带宽的需求越来越大,迫切希望有一种新型产品来作为高性能计算和数据中心的主要传输媒质,所以有源光缆(AOC)在这种环境下诞生了。有源光缆究竟是什么呢?应用在哪些领域,有什么优势呢?易天将为您解答!有源光缆(Active Optical Cables,简称AOC)是两端装有光收发器件的光纤线缆,主要构成部件分为光路和电路两部分。作为一种高性能计..._aoc 光缆

浏览器代理服务器自动配置脚本设置方法-程序员宅基地

文章浏览阅读2.2k次。在“桌面”上按快捷键“Ctrl+R”,调出“运行”窗口。接着,在“打开”后的输入框中输入“Gpedit.msc”。并按“确定”按钮。如下图 找到“用户配置”下的“Windows设置”下的“Internet Explorer 维护”的“连接”,双击选择“自动浏览器配置”。如下图 选择“自动启动配置”,并在下面的“自动代理URL”中填写相应的PAC文件地址。如下..._設置proxy腳本