自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(36)
  • 资源 (6)
  • 收藏
  • 关注

原创 编程问题解决

将碰到过的坑做下记录,有时间便于自己回顾。Java long long > int 转换(1)int random = (int) System.currentTimeMillis() % 3;(2)int random = (int) (System.currentTimeMillis() % 3);(1)int强制转换修饰的是System.currentTimeMillis()的值,由于从lo

2016-04-13 10:02:58 305

原创 Xcode7版本以后app无法联网问题解决

问题使用xcode7版本以后创创建app时,如果有网络访问操作会提示错误,The resource could not be loaded because the App Transport Security,解决办法如下。解决办法打开对应app target下的Info.plist。右键点击Add row,填入NSAppTransportSecurity,填入后会自动变换为App Transp

2015-12-15 16:55:25 650

原创 git使用小记

git使用刚进公司来实习,之前只是简单的使用svn图形化简单的管理下自己的工程,非常业余。进入公司以后全部是各种git管理,之前只是了解,完全没用过,使用过程中真是遇到超多问题,其实不难,但总是操作出错。现在使用比较熟练了,常用命令做下记录,随时补充。工作流本地git维护三棵“树”。第一个是工作目录,拥有实际文件;第二个是暂存区,像是缓存区域,临时保存改动;最后是HEAD,指向最后一次提交的结果。创

2015-12-04 11:25:58 422

转载 Objective-C中的instancetype和id关键字

一、什么是instancetypeinstancetype是clang 3.5开始,clang提供的一个关键字,表示某个方法返回的未知类型的Objective-C对象。我们都知道未知类型的的对象可以用id关键字表示,那为什么还会再有一个instancetype呢?二、关联返回类型(related result types)根据Cocoa的命名规则,满足下述规则的方法:1、类方法

2015-11-24 21:11:20 277

原创 旋转数组的最小数字

把一个数组最开始的若干个元素搬到数组的末尾,我们称之为数组的旋转。输入一个递增排序的数组的一个旋转,输出旋转数组的最小元素。例如数组{3,4,5,1,2}为{1,2,3,4,5}的一个旋转,该数组的最小值为1。public : int BinarySearch(vector arr, int start, int end) { int i = 0;

2015-08-14 16:34:13 366

原创 二叉树构造

题目:输入某二叉树的前序遍历和中序遍历的结果,请重建出该二叉树。假设输入的前序遍历和中序遍历的结果中都不含重复的数字。例如输入前序遍历序列{1,2,4,7,3,5,6,8}和中序遍历序列{4,7,2,1,5,3,8,6},则重建二叉树并返回。public: int FindValPtr(vector arr, int val) { int i = 0;

2015-08-14 13:51:53 331

原创 Leetcode Q100 : Same Tree

Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the same value./** * Def

2015-08-13 11:00:47 363

原创 Leetcode Q88:Merge Sorted Array

Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note:You may assume that nums1 has enough space (size that is greater or equal to m + n) to hold add

2015-08-12 23:51:29 472

原创 C/C++ const使用

刷题过程中,遇到const相关的题目,有些地方比较困惑,稍微验证了一下,记录一下。 const int i = 0; int *j = (int *) &i; *j = 1; printf("%d,%d", i, *j);这段程序的输出结果需要根据编译器的优化来看,i为const修饰的变量,通过指针的方式修改了i的内存内容(不能直接对i进行复制修改,否则会报

2015-08-10 09:43:56 299

原创 C++多态调用和继承内存分布

以下面代码为例:class A{public: int a; A() { a = 1; } virtual void fA() { printf("A\n"); } void fAA() { printf("AA\n"); }};class B{publ

2015-08-07 22:55:30 759

原创 按层次打印二叉树

从上到下按层打印二叉树,同一层结点从左至右输出。每一层输出一行。模拟一个队列queue,记录已经遍历到的二叉树节点,创建数组l_n记录每层的节点数。首先将根节点加入队列,记录第0层的节点数为1;然后从队列中取出元素,第一次取出根节点,输入到结果中,如果根节点有左子结点或右子节点,添加到队列中,记录下一层的节点数;再取第二层的节点,直到队列为空。public: vector> P

2015-08-07 01:32:20 2117

原创 链表反向打印

输入一个链表,从尾到头打印链表每个节点的值。常规方法,先正向输入到数组中,然后再反向读出。/*** struct ListNode {* int val;* struct ListNode *next;* ListNode(int x) :* val(x), next(NULL) {* }*

2015-08-07 00:23:26 548

原创 printf的(i++)和(++i)详解(编译器不同有差异)

printf的入栈顺序和打印显示,一直是比较绕的东西,稍微总结了一下,发现有些地方和之前理解的是有出入的,记录一下,供以后自己查看。第一种情况:int i = 1;printf("%d %d\n", i++, i++);按从右到左的顺序,先压栈,首先将i = 1,入栈,然后i=2,将i=2入栈,i=3,因此输出结果是2 1 ,这是按大家的理解的比较正常的方式。记下来看一下在vs201

2015-08-06 09:34:07 3679 1

原创 纸牌博弈问题

题目:题目:有一个整型数组A,代表数值不同的纸牌排成一条线。玩家a和玩家b依次拿走每张纸牌,规定玩家a先拿,玩家b后拿,但是每个玩家每次只能拿走最左或最右的纸牌,玩家a和玩家b都绝顶聪明,他们总会采用最优策略。请返回最后获胜者的分数。给定纸牌序列A及序列的大小n,请返回最后分数较高者得分数(相同则返回任意一个分数)。测试样例:[1,2,100,4],4返回:101解

2015-08-05 22:40:55 4150 3

原创 Leetcode Q15: 3Sum

题目15:代码写的非常复杂和凌乱,需要再进行整理。Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note:

2015-08-03 00:03:30 483

原创 Leetcode Q14 :Longest Common Prefix

题目14:Write a function to find the longest common prefix string amongst an array of strings.在一组字符串中,查找最长的公共前缀,并输出。从第一个字符,依次遍历所有字符串,如果第一个字符都相同,则添加到结果中;直到遍历到不同字符,或某一字符串遍历结束,则输出结果。char* max_pr

2015-08-02 10:48:50 357

原创 Leetcode Q13: Roman to Integer

题目13:Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.int StrLen(char* s){ int l = 0; while (*s++ != 0) { l++;

2015-07-31 14:00:19 306

原创 Leetcode Q12 : Integer to Roman

题目12:Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999./****************************************************************************

2015-07-31 10:01:30 390

原创 Leetcode Q11:Container With Most Water

题目11:Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i,

2015-07-30 21:33:11 399

原创 Leetcode Q10: Regular Expression Matching

题目10:(该题目拿到手没什么特别好的思路,从网上看的别人的解法,然后写了下自己的理解,需要常回顾)Implement regular expression matching with support for '.' and '*'.'.' Matches any single character.'*' Matches zero or more of the preceding

2015-07-29 23:10:41 393

原创 Leetcode Q136: Single Number

题目136:Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without

2015-07-28 22:22:47 275

原创 Leetcode Q9: Palindrome Number

题目9:Determine whether an integer is a palindrome. Do this without extra space.Some hints:Could negative integers be palindromes? (ie, -1)If you are thinking of converting the integer to st

2015-07-28 21:56:08 391

原创 Leetcode Q8 : String to Integer (atoi)

题目8:Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible inpu

2015-07-28 09:05:37 469

原创 Leetcode Q6:ZigZag Conversion

题目6:The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A H N

2015-07-28 01:12:07 334

原创 Leetcode Q191:Number of 1 Bits

题目191:Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight).For example, the 32-bit integer ’11' has binary representation

2015-07-27 21:23:58 339

原创 Leetcode Q5:Longest Palindromic Substring

题目5:Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring./***************

2015-07-27 21:19:11 308

原创 Leetcode Q7:Reverse Integer

题目7:Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321click to show spoilers.Have you thought about this?Here are some good questions to as

2015-07-27 10:37:25 521

原创 Leetcode Q4:Median of Two Sorted Arrays

题目4:There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n))./******************

2015-07-24 11:22:49 521

原创 Leetcode Q3:Longest Substring Without Repeating Characters

题目3:Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3

2015-07-24 11:19:20 342

原创 Leetcode Q2: Add Two Numbers

题目2:You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as

2015-07-24 11:17:40 364

原创 Leetcode Q1: Two Sum

题目1:Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers such that they add up to the target,

2015-07-24 11:14:41 443

原创 VS2012 C语言dll文件生成和C#调用

用C#做Web项目时,需要使用C实现的加密算法,将加密算法封装成dll文件以便在C#中调用,第一次使用dll,做个简单记录。1. 在需要调用的函数前面添加 __declspec(dllexport)。使2.用命令行生成dll,使用VS2012的命令行工具,“开始”中找到“Microsoft Visual Studio 2012”,然后“Visual StudioTool

2015-06-16 20:37:13 1816

原创 fork()和逻辑运算符的混合使用

fork()的使用和逻辑运算的混合使用。fork() || fork(); 生成多少进程?解析:1fork() ||2 fork();fork()用来创建进程,并返回值,子进程返回0,父进程返回子进程的进程号;对两个fork进行编号。对于逻辑运算符或“||”,先计算左边表达式,如果是非0,则后边的表达式无需计算;如果是逻辑运算符与“&&”,左边表达式是0,则后边表达式无需计算;如果

2014-09-02 09:51:15 501

原创 VS将已有的项目生成lib静态库并使用

首先,建一个空项目,在其中添加两个文件,test.h和test.c。test.hint add(int, int);test.c#include "test.h"int add(int a, int b){ return (a + b);}1、右键单击项目,选择属性,在配置属性里,将配置类型改为静态库(.lib),点击确定。2、右键点击项目,生成。3、右

2013-04-01 23:07:27 3260 1

原创 c语言内存对齐

记录平常所学,以便回顾。c语言中存在着内存对齐问题,在struct存储中尤为明显,这里先介绍一种情况,以后接着补充。typedef unsigned char u8;typedef unsigned short u16;typedef unsigned long u32;typedef unsigned long long int u64;struct s1{ u8

2013-03-28 21:54:57 621

原创 c语言限制访问链表元素的一种机制

自己记录下的一些心得,以便自己以后能够回顾。定义两个自己的链表节点,stIn和stOut。 list_head即为Linux中List的使用。链表stIn保存了1-16个节点(不包括头),其中a和b的值依次为1到16。遍历链表stIn的list_head,即可得到每个节点的a和b的值。    out_head = (struct stOut*)(&in_head);此句非常重要

2013-03-28 12:57:13 527

《x86汇编语言:从实模式到保护模式》配书文件包

《x86汇编语言:从实模式到保护模式》配书文件包。内容包括第5、6、7、8、9、11、12、13、14、15、16和17章的汇编语言程序源代码,以及工具软件。还包括VirtualBox和Bochs软件的安装手册。

2014-05-26

securable检测电脑是否支持64位和虚拟化技术

此工具可以检测出你的电脑是否能安装win7(64位)的系统,运行即有提示:显示为 64 yes yes则可以安装,显示为:64 off off(或64 no no )则不能安装。 测试你的cpu支不支持vt虚拟化技术 Locked ON的意思:主板有“开和关”两种选择,ON表示,目前处于开启状态。OFF,表明处于关闭状态(Locked OFF并不能表明CPU是否支持,到底支持不支持,请到主板BIOS中,看是否有VT的开启开关,开后,如显示为ON那就成功了,如还是OFF,那表明CPU不支持)YES的意思:本机第三项为“YES”,手动创建虚拟机后提示无法启动,原因是BIOS中有设置项“virtualization”,但没有开启。开启之后方可运行。Virtualization虚拟技术中第三项Locked ON表明你的硬件平台处于开启状态

2013-05-17

Chameleon Install 1806 for win

变色龙是Voodee团队开发的一个基于Boot-132的EFI引导软件,主要用来引导Mac OS X苹果系统,最初是简短的引导Linux的代码,经过不断改进,已经可以引导Mac,最新版RC5,750及更高版本的可以引导Mac 10.7 lion,而752、755及1800以后的版本可以引导最新的OS X Mountain Lion.变色龙RC5有不同的皮肤供选择,安装成功后进入变色龙,可以选择操作系统,输入各种参数,可以实现以不同的模式引导Mac.如-v是命令行模式启动Mac(俗称罗嗦模式),-x是安全模式,-f是重新加载缓存,-s是单用户模式,等等。 变色龙更新迅速,并且是开源的,因此有基于变色龙的各种修改版. 你可以去Voodoo官方网站下载源代码,在Mac上用XCode编译和测试.

2013-05-16

虚拟机mac和宿主机实现共享文件夹

虚拟机mac和宿主机实现共享文件夹,自己写的,可用。

2013-05-16

虚拟机安装mac教程

虚拟机安装mac教程。自己安装后写的。可以用来体验苹果系统。 但如果用虚拟机进行开发,劝还是不要。自己试过,非常之卡。

2013-05-16

Java编程思想第四版完整中文高清版

Thinking in java java编程思想 高清版

2011-11-20

空空如也

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

TA关注的人

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