自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 A constructor

A constructor is a special kind of class member function that is executed when an object of that class is instantiated. Constructors are typically used to initialize member variables of the class to a

2014-07-19 18:03:29 468

原创 Although you have

Although you have already seen the break statement in the context of switch statements, it deserves a fuller treatment since it can be used with other types of loops as well.The break statement ca

2014-07-19 18:02:19 449

原创 C安全编码--预处理

C安全编码--预处理  建议和规则  建议:  用内联函数或静态函数代替与函数相似的宏  在宏参数名两边加上括号  宏替换列表应该加上括号  应该使用typedef定义编码类型  不要复用标准头文件名  理解连接标记或执行字符串化时的宏替换  把头文件放在包含防护条件中  避免使用连续的问号  保证头文件名唯一  不要用不安全的函数替换安全函数 

2014-07-17 22:43:07 345

原创 由于VB.NET 没有位移运算

这几天一直在边学习边写一个上位机PC应用程序,用来接收串口收到的数据,并已要求的格式实时保存,再将数据以实时曲线的方式绘制出来。下位机是和ADI的ads21469通信,数据时1K Hz/s的采样率,即每秒采1024个点。以整数型式传过来,每个整数32bit表示。由于DSP那边只能是char型发送数据,所以我们把一个整数拆成了4个字节发送。这样就涉及到DSP那边的位移运算。先发高位:  int

2014-07-17 22:42:25 843

原创 即将到来的Java8给在Java虚拟

即将到来的Java8给在Java虚拟机上最广泛使用的语言带来了大量的新特性。或许最多提到的是Lambdas表达式,Scala和JRuby的爱好者们对此发出了终于来了的感叹。但是对于多线程应用更为重要的类是新增的LongAdder和DoubleAdder,在多线程下,原子实现比AtomicInteger和AtomicLong提供了更优越的性能。  一些简单的指标阐述了AtomicLong和Lon

2014-07-17 22:41:36 533

原创 class parent{

java中,在创建一个新的对象的时候,会调用其父亲的构造方法,测试程序如下:        class parent{        int a=5;        public parent(){        System.out.println("a="+a);        System.out.println("parent()");   

2014-07-17 22:26:06 1543

原创 Previously, you learned

Previously, you learned that the value of a variable is stored as a sequence of bits, and the data type of the variable tells the compiler how to translate those bits into meaningful values. Often it

2014-07-17 22:23:40 420

原创 By far, the most utilized

By far, the most utilized looping statement in C++ is the for statement. The for statement is ideal when we know exactly how many times we need to iterate, because it lets us easily declare, initializ

2014-07-17 22:22:14 589

原创 The iostream library

The iostream library is fairly complex — so we will not be able to cover it in it’s entirety in these tutorials. However, we will show you the most commonly used functionality. In this section, we wil

2014-07-15 18:06:06 347

原创 Function pointers

Function pointers are an advanced topic, and this section can be safely skipped or skimmed by those only looking for C++ basics.In the lesson on pointers, you learned that a pointer is a variable

2014-07-15 18:01:44 400

原创 Although

Although you have already seen the break statement in the context of switch statements, it deserves a fuller treatment since it can be used with other types of loops as well.The break statement ca

2014-07-15 17:58:57 439

原创 The most

The most basic kind of conditional branch in C++ is the if statement. An if statement takes the form:if (expression) statementorif (expression) statementelse statement2If th

2014-07-15 17:57:46 410

原创 Windows XP模式

据国外媒体报道,近日,TechRadar网站为我们列出了18件Vista所不具备的Windows 7功能,主要有以下几点:本地ISO刻录、Jumplists(跳跃菜单)、新的任务栏、Windows XP模式等。  自Windows 3.1至Windows Vista,Windows操作系统实现了巨大了飞跃。虽然Vista操作系统受到了众多用户的冷眼对待,然而Windows 7将会替微软抹去用户

2014-07-14 17:02:29 354

原创 Lucene的原理

很庆幸在交谈的这近一个小时内每句话都没白讲白听,对面的技术官让我很钦佩。总得来说,对方比较看重实战经验,几乎所有的问题都是从你自己的阐述中提取出来的。说实话,我在之前做过很多Java的功课,但实际上根本用不着,只要在自己的每个项目中多用心多思考,结束后勤加总结积累,技术自会装进大脑,答案也会手到擒来。罗列些问题,答案可以问谷歌。  1. 从简历的项目谈起,说一下Lucene的原理,对于这个项目

2014-07-14 17:01:43 352

原创 scheduled模式

大家看到了线程的好处了吧!单线程需要10S,10个线程只需要1S。充分利用了系统资源实现并行计算。也许这里会产生一个误解,是不是增加的线程个数越多效率越高。线程越多处理性能越高这个是错误的,范式都要合适,过了就不好了。需要普及一下计算机硬件的一些知识。我们的cpu是个运算器,线程执行就需要这个运算器来运行。不过这个资源只有一个,大家就会争抢。一般通过以下几种算法实现争抢cpu的调度:  队列方

2014-07-14 17:00:58 714

原创 package thread;

平时的开发中线程是个少不了的东西,比如tomcat里的servlet就是线程,没有线程我们如何提供多用户访问呢?不过很多刚开始接触线程的开发工程师却在这个上面吃了不少苦头。怎么做一套简便的线程开发模式框架让大家从单线程开发快速转入多线程开发,这确实是个比较难搞的工程。  那具体什么是线程呢?首先看看进程是什么,进程就是系统中执行的一个程序,这个程序可以使用内存、处理器、文件系统等相关资源。例如

2014-07-14 16:57:45 662

原创 The preprocessor

The preprocessor is perhaps best thought of as a separate program that runs before the compiler when you compile your program. It’s purpose is to process directives. Directives are specific instructio

2014-07-13 10:56:47 608

原创 As programs get larger

As programs get larger, it is not uncommon to split them into multiple files for organizational purposes. One advantage of working with an IDE is they make working with multiple files much easier. You

2014-07-13 10:53:17 469

原创 By default,

By default, arguments in C++ are passed by value. When arguments are passed by value, a copy of the argument is passed to the function.Consider the following snippet:123

2014-07-12 18:42:14 635

原创 A typedef does

Typedefs allow the programmer to create an alias for a data type, and use the aliased name instead of the actual type name. To declare a typedef, simply use the typedef keyword, followed by the type t

2014-07-12 18:41:16 414

原创 Up to this point

Up to this point in the tutorial, you’ve only seen exceptions used in non-member functions. However, exceptions are equally useful in member functions, and even moreso in overloaded operators. Conside

2014-07-12 16:46:42 538

原创 In C++03

In C++03, stepping through all the values of a sequence requires a lot of code, particularly when using the iterator syntax:1for(std::vectorint>::iterator itr = myvecto

2014-07-12 16:45:00 410

原创 When working with arrays

When working with arrays, we typically use the subscript operator ([]) to index specific elements of an array:1anArray[0] = 7; // put the value 7 in the first element of

2014-07-12 10:53:57 358

原创 For much of this

For much of this chapter, we’ve been preaching the virtues of keeping your data private. However, you may occasionally find situations where you will find you have classes and functions that need to w

2014-07-12 10:52:58 387

原创 References

References and pointers have an interesting relationship — a reference acts like a const pointer that is implicitly dereferenced. Thus given the following:123intn

2014-07-12 10:48:20 439

原创 The use of functions

The use of functions provides many benefits, including:The code inside the function can be reused.It is much easier to change or update the code in a function (which needs to be done once) than fo

2014-07-12 10:46:46 394

原创 Namespaces don’t really

Namespaces don’t really fit into the functions category, but they are an important concept that we need to cover before we get to classes and object oriented programming, and this is really as good a

2014-07-12 09:36:57 379

原创 Just like normal variables,

Just like normal variables, pointers can be declared constant. There are two different ways that pointers and const can be intermixed, and they are very easy to mix up.To declare a const pointer,

2014-07-12 09:33:09 556

原创 SuppressWarnings("unchecked")

@SuppressWarnings("unchecked")  public static T fromXML(String xml, Class valueType) {  try {  JAXBContext context = JAXBContext.newInstance(valueType);  Unmarshaller unmarshaller = context.c

2014-07-11 18:41:55 408

原创 JAXB主要用来实现对象和XML之间的序列化

JAXB主要用来实现对象和XML之间的序列化和反序列化,关于JAXB的介绍就不多说了,网上一搜一大把,这里主要总结下基本使用方法和一些注意事项  首先定义两个示例类ClassA,ClassB,用于后续的示例演示  复制代码  package cn.lzrabbit;  public class ClassA {  private int classAId;  private

2014-07-11 18:40:32 467

原创 view plainprint?

当现在不适合这个操作,或是没有必要进行这个操作时就直接放弃这个操作而回去。这个就是Balking模式例如王某在餐厅吃饭,当王某需要点餐时喊服务员需要点餐。当服务员A和B都注意到了王某点餐的示意,这时服务员B看到服务员A已经去响应了王某的点餐请求,所以服务员B就不会再过去响应王某的点餐请求。  程序示例:程序的需求是模拟一个自动保存的功能。自动保存是为了预防计算机忽然断电或则软件突然出错的危险,

2014-07-11 17:37:22 474

原创 XML现在已经成为一种通用

XML现在已经成为一种通用的数据交换格式,它的平台无关性,语言无关性,系统无关性,给数据集成与交互带来了极大的方便。对于XML本身的语法知识与技术细节,需要阅读相关的技术文献,这里面包括的内容有DOM(Document Object Model),DTD(Document Type Definition),SAX(Simple API for XML),XSD(Xml Schema Definit

2014-07-11 17:36:31 436

原创 using System;

1.using System;  2.using System.Collections.Generic;  3.using System.Linq;  4.using System.Text;  5.using System.Runtime.InteropServices;  6.  7.namespace TestCom  8.{  9.    [Guid("E9

2014-07-11 17:35:19 823

原创 hread的join()方法

本文介绍两种主线程等待子线程的实现方式,以5个子线程来说明:  1、使用Thread的join()方法,join()方法会阻塞主线程继续向下执行。  2、使用java.util.concurrent中的CountDownLatch,是一个倒数计数器。初始化时先设置一个倒数计数初始值,每调用一次countDown()方法,倒数值减一,他的await()方法会阻塞当前进程,直到倒数至0. 

2014-07-11 17:32:56 1380

原创 session.close()

System.out.println("--------------------------------------");  Iterator iter = session.createQuery("from User s where s.id  while (iter.hasNext()) {  User age = (User) iter.next();  System.out

2014-07-11 17:30:29 1525

原创 Thread的join()

本文介绍两种主线程等待子线程的实现方式,以5个子线程来说明:  1、使用Thread的join()方法,join()方法会阻塞主线程继续向下执行。  2、使用java.util.concurrent中的CountDownLatch,是一个倒数计数器。初始化时先设置一个倒数计数初始值,每调用一次countDown()方法,倒数值减一,他的await()方法会阻塞当前进程,直到倒数至0. 

2014-07-11 17:28:12 406

原创 对于对象查询

对于对象查询  1、使用List的时候会将对象全部取出,而使用Iterate则只先将对象主键取出,然后在使用的时候再一个个取出。  2、List第二使用的时候会继续重新数据库中取出,而Iterate则会先成缓存中查找,如果没找到再去数据库中取出。  对于属性查询(条件:查询缓存关闭):  两者没什么差别,根据查询对象的相应属性,在执行查询的时候将结果从数据库中取出(不同于上面据说的

2014-07-11 17:27:11 344

原创 public void setName(String name)

public void setName(String name) {  this.name = name;  }  public int getAge() {  return age;  }  public void setAge(int age) {  this.age = age;  }  public void cry(){  System.out.p

2014-07-11 17:27:03 6644

原创 学习java也快一年多了!

学习java也快一年多了,看过很多方面的书,也喜欢在网络上学习优秀的java资料。但是每当自己打开myeclipse时,总是那么的不自信……,java基础部分的内容自己以及掌握,并能很好运用,加油吧,多实践,多总结,一定会有所突破的。老银每天进步一点点。  今天就总结一下,自己看过的资料上好的列子。  1:java面向对象特征:抽象,封装,继承,多态。  抽象:  封装:  继

2014-07-11 17:26:23 511

原创 main thread starting…

运行结果如下:  main thread starting…  Thrad 2 staring…  Thrad 2 end…  Thrad 4 staring…  Thrad 4 end…  Thrad 1 staring…  Thrad 1 end…  Thrad 3 staring…  Thrad 3 end…  Thrad 5 staring…  

2014-07-11 17:26:13 695

空空如也

空空如也

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

TA关注的人

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