自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(27)
  • 收藏
  • 关注

原创 有关Fragment

碎片(Fragment)是一种可以嵌入在活动当中的UI片段,它能让程序更加合理和充分地利用大屏幕的空间,与活动非常相似 。动态添加碎片主要分为5步:创建待添加的碎片实例。获取到FragmentManager,在活动中可以直接调用getFragmentManager()方法得到。开启一个事务,通过调用beginTransaction()方法开启。向容器内加入碎片,一般使用replace()...

2019-07-18 11:32:15 124

原创 Android中Parcelable的原理和方法

Parcel的意思是“打包”,而打包则是为了序列化。序列化—讲对象转化为可以传输的二进制流(二进制序列) 的过程,这样我们就可以通过序列化,转化为可以在网络传输或者保存到本地的流(序列),从而进行传输数据 ,那反序列化就是从二进制流(序列)转化为对象的过程.关于序列化的意义,这篇博文说的比较好:https://blog.csdn.net/windren06/article/details/78...

2019-07-18 11:14:21 350

原创 关于Handler的理解

Handler是Android SDK来处理异步消息的核心类。子线程与主线程通过Handler来进行通信。子线程可以通过Handler来通知主线程进行UI更新。如图MessageQueue用来保存子线程从Handler所发送未处理的消息,Looper依次取出MessageQueue中的消息传递给主线程响应处理。为什么使用handler,MessageQueue,Looper?主线程无法进...

2019-07-18 08:45:25 181

原创 android的UI操作单线程模型理解

学习安卓断断续续已经接近两个月了,之前为了省时间把学习过程中遇到的问题在网上查过之前没有记录只是收藏了一下网页,现在手上事情不多,来整理记录一下,以便记忆。Android单线程模型是这样描述的:Android UI操作并不是线程安全的,并且这些操作必须在UI线程执行如果在其他线程访问UI线程,Android提供了以下的方式:Activity.runOnUiThread(Runnable)...

2019-07-14 11:20:02 318

原创 30天自制OS学习笔记 (九)内存管理

本章内容包含两个方面:内存容量检查和内存管理。1.内存容量检查要进行内存管理,首先要知道内存的容量大小。最初启动时,BIOS会检查内存容量,所以BIOS知道内存容量大小,但由于BIOS版本不同,要写一段通用的代码会很费事,所以不如直接自己去检查内存。在进行内存容量检查之前先说一下高速缓存cache。486以后的CPU具有高速缓存,它的读写速度可以接近CPU速度。每次访问内存,都要将所访问的地...

2018-12-29 17:19:47 161

原创 30天自制OS学习笔记 (八)鼠标控制与32位模式切换

1.鼠标解读 & 2.稍事整理HariMain中整理后的代码:struct MOUSE_DEC { unsigned char buf[3], phase;};void enable_mouse(struct MOUSE_DEC *mdec);int mouse_decode(struct MOUSE_DEC *mdec, unsigned char dat);void H...

2018-12-19 23:51:58 168

原创 30天自制OS学习笔记 (七)FIFO与鼠标控制

1.获取按键编码接着上次改善一下程序,让程序在按下一个键时,让程序把所按键的编码在画面上显示出来。#define PORT_KEYDAT 0x0060void inthandler21(int *esp){ struct BOOTINFO *binfo = (struct BOOTINFO *) ADR_BOOTINFO; unsigned char data, s[4]; io...

2018-12-16 23:57:04 193

原创 30天自制OS学习笔记 (六)分割编译与中断处理

1.分割源文件 & 2.整理Makefile & 3.整理头文件源文件分割图如下这样整理一下,清爽多了。对应源文件的分割,我们还要修改Makefile,流程如下随着bootpack.c分割成多个文件,Makefile的内容变多了许多。为了简化Makefile的内容,可将处理相同类型文件的语句规则替换为一般规则。可将bootpack.gas : bootpack.c Ma...

2018-12-15 00:26:30 663 1

原创 30天自制OS学习笔记 (五)结构体、文字显示与GDT/IDT 初始化

1.接收启动信息 & 2.试用结构体 & 3.试用箭头符号在第五天之前,我们都是把vram、xsize、ysize这些值直接写在了bootpack.c文件中。而这些值应从asmhead.nas中获取,因为在asmhead.nas里面我们调用显卡函数并选择了模式,配置好了SCRNX,SCRNY,VRAM参数,如果不从asmhead.nas中获取,当画面模式改变时,系统就不能正常运行...

2018-12-11 23:24:22 281

原创 30天自制OS学习笔记 (四)C语言与画面显示的练习

(四)C语言与画面显示的练习用C语言实现内存导入这里说的用C语言实现内存写入不是用指针实现,而是用汇编语言写的内存写入函数,用C语言调用。_write_mem8: ; void write_mem8(int addr, int data); MOV ECX,[ESP+4] ; [ESP+4]中存放的是地址addr,读入ECX MOV AL,[ESP+8] ; [ESP+8...

2018-12-10 00:21:30 259

原创 30天自制OS学习笔记 (三)进入32位模式并导入C语言

(三)进入32位模式并导入C语言首先了解一下软盘结构需要注意的是扇区是从1开始计算的,并不是从0。启动扇区会自动装载,所以在读盘的时候ipl.nas中设置的CL值为2。缓冲区地址,是个内存地址,表明我们要把从软盘上读出的数据加载到内存的哪个位置。一个BX只能表示0~0xffff的值,最大即64K,为了解决这个问题,增加了一个EBX的寄存器。另一种方式则是设计了一个起辅助作用的段寄存器,...

2018-12-07 23:38:15 327

原创 30天自制OS学习笔记 (二)汇编语言学习与Makefile入门

(二)汇编语言学习与Makefile入门上一节中helloos.nas中的代码继续用汇编语言改写:; hello-os; TAB=4 ORG 0x7c00 ;指明程序的装载地址 ; 以下这段是标准FAT12格式软盘专用的代码 JMP entry DB 0x90 DB "HELLOIPL" ;启动区的名称可以是任意的字符串(8字节)

2018-12-05 15:44:16 230

原创 30天自制OS学习笔记 (一)从计算机结构到汇编程序入门

关于OS这门课程,课堂上只是学习了一些基本的理论上的知识,希望基于《30天自制操作系统》这本书,从今天开始学习并实现一个操作系统。(一)从计算机结构到汇编程序入门书中一开始进入编码阶段是用的二进制编辑器将一系列超长的十六进制数输入,生成helloos.img文件。接着为了方便书写和理解程序内容,写了一个汇编程序helloos.nas来生成helloos.img文件(通过汇编语言编译器nask,...

2018-12-04 17:04:30 473

原创 leetcode 16. 3Sum Closest

今日份LeetCode 16. 3Sum ClosestDescription:Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the three in...

2018-12-03 18:20:40 106

原创 leetcode 11. Container With Most Water

因为一些事情已经有两天没刷leetcode了,从今天开始加油!一切都会慢慢变好的。今日份leetcode 11. Container With Most WaterDescription:Given n non-negative integers a1, a2, …, an , where each represents a point at coordinate (i, ai). n...

2018-12-02 18:46:08 325

原创 Java中的参数传递

今天在做一道数组相关的leetcode题目时,遇到了一些麻烦,于是查阅资料后整理记录下来。网上很多博文都提到了Java的值传递、引用传递,虽然一部分情况下这样说也解释的通,但这确实是不正确的说法。Java 总是 采用按置调用,方法得到的是所有参数值得一个拷贝。Java对对象采用的不是引用调用,实际上,对象引用进行的是值传递。方法参数类型共有两种:1.基本数据类型(数字、布尔值)2.对...

2018-11-30 11:18:48 166

原创 leetcode 88. Merge Sorted Array 合并有序数组

今日份leetcode 88. Merge Sorted ArrayDescription:Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note:The number of elements initialized in nums1 and nums...

2018-11-29 23:34:06 151

原创 leetcode 26. Remove Duplicates from Sorted Array 移除数组中的重复元素

今日份leetcode 26. Remove Duplicates from Sorted ArrayDescription:Given a sorted array nums, remove the duplicates in-place such that each element appear only once and return the new length.Do not ...

2018-11-28 15:03:14 103

原创 leetcode 121. Best Time to Buy and Sell Stock

Description:Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (i.e., buy one and sell one share of...

2018-11-28 11:14:44 152

原创 leetcode 27. Remove Element

昨天偷了个懒没有刷leetcode题目。懊悔不已。。。今日份leetcode 27. Remove ElementDescription:Given an array nums and a value val, remove all instances of that value in-place and return the new length.Do not allocate e...

2018-11-27 11:12:34 115

原创 leetcode 283. Move Zeroes

283.Move ZeroesDescription:Given an array nums, write a function to move all 0’s to the end of it while maintaining the relative order of the non-zero elements.Example:Input: [0,1,0,3,12]Output: ...

2018-11-25 22:37:23 102

原创 leetcode 189. Rotate Array

今日份leetcode 189. Rotate ArrayDescription:Given an array, rotate the array to the right by k steps, where k is non-negative.Example 1:Input: [1,2,3,4,5,6,7] and k = 3Output: [5,6,7,1,2,3,4]Expl...

2018-11-25 13:11:39 110

原创 leetcode 167. Two Sum II - Input array is sorted

这是今天的第二道题目,本来计划好的做三道,终究还是效率低。。。Description:Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.The function twoS...

2018-11-24 23:56:34 87

原创 leetcode 119. Pascal's Triangle II 杨辉三角2

Description:Given a non-negative index k where k ≤ 33, return the kth index row of the Pascal’s triangle.Note that the row index starts from 0.In Pascal’s triangle, each number is the sum of the t...

2018-11-24 21:42:57 95

原创 leetcode 66. Plus One 加一运算

今天本来想做三道题目,无奈拖延症效率太低。。。Description:Given a non-empty array of digits representing a non-negative integer, plus one to the integer.The digits are stored such that the most significant digit is at th...

2018-11-23 21:32:08 624

原创 leetcode首题! 35. Search Insert Position 搜索插入位置

今天是第一次刷leetcode的题目,刚开始接触有些困难。从今天开始每天至少一题(有时间就写笔记)。希望坚持下去,加油!版本一class Solution { public int searchInsert(int[] nums, int target) { int flag=-1; if(nums.length==1){ if(...

2018-11-22 23:40:48 96

原创 The server time zone value'???ú±ê×??±??' 与Loading class com.mysql.jdbc.Driver'. This is deprecated.

MySQL遇到的两点问题——Cause: java.sql.SQLException: The server time zone value与Loading class com.mysql.jdbc.Driver’. This is deprecated. The new driver class is com.mysql.cj.jdbc.Driver第一个问题Cause: java.sql.S...

2018-10-15 17:08:51 496

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除