导航

2013年4月14日

摘要: gcc提供了大量的警告选项,对代码中可能存在的问题提出警 告,通常可以使用-Wall来开启以下警告: -Waddress -Warray-bounds (only with -O2) -Wc++0x-compat -Wchar-subscripts -Wimplicit-int -Wimplicit-function-declaration -Wcomment -Wformat -Wmain (only for C/ObjC and unless -ffreestanding) -Wmissing-braces -Wnonnull -Wparentheses -Wpointer-sign -W 阅读全文

posted @ 2013-04-14 20:54 ChanHuman 阅读(321) 评论(0) 推荐(0) 编辑

摘要: gcc通过后缀来区别输入文件的类别:.c 为后缀的文件:C语言源代码文件.a 为后缀的文件:是由目标文件构成的库文件.C,.cc或 .cxx为后缀的文件:是C++源代码文件.h 为后缀的文件:头文件.i 为后缀的文件:是已经预处理过的C源代码文件.ii 为后缀的文件:是已经预处理过的C++源代码文件.o 为后缀的文件:是编译后的目标文件.s 为后缀的文件:是汇编语言源代码文件.S 为后缀的文件:是经过预编译的汇编语言源代码文件 阅读全文

posted @ 2013-04-14 20:53 ChanHuman 阅读(455) 评论(0) 推荐(0) 编辑

摘要: 安装sambasudo apt-get install samba配置第一步创建共享目录: 比如要创建/home/用户名/share首先创建这个文件夹 (这个用户名就是你的用户名,为了方便易懂我才这样写的,到时记得自己改啊)代码:mkdir /home/用户名/share (新建share文件夹)chmod 777 /home/用户名/share (设置该文件夹的权限使其让所有用户可读可写可运行)备份并编辑smb.conf允许网络用户访问 (养成随时备份的好习惯,在关键的时候你会发现当初的备份是多么的明智!) 代码:sudo cp /etc/samba/smb.conf /etc/samba/ 阅读全文

posted @ 2013-04-14 20:52 ChanHuman 阅读(156) 评论(0) 推荐(0) 编辑

摘要: 安装 NFS 相关组件sudo apt-get install nfs-kernel-server增加 NFS 目录sudo gedit /etc/exports#在文件中添加如下内容/var/nfsboot *(rw,sync)/var/nfsboot 为 NFS 共享目录,可自由指定× 表示任意的 IP 地址都可以挂载此目录,若设置为 192.168.1.× 则表示只有在 192.168.1.??? 这个网段的 IP 才可以挂载rw 可读写的权限ro 只读的权限no_root_squash NFS 客户端分享目录使用者的权限,即如果客户端使用的是 root 用户,那么对 阅读全文

posted @ 2013-04-14 20:51 ChanHuman 阅读(262) 评论(0) 推荐(0) 编辑

摘要: 2012-12-02 21:15tftpd服务没有启动解决方法:启动服务sudo/etc/init.d/xinetdrestartsudo/etc/init.d/tftpd-hparestart在linux下用tftp给arm板传送文件首先要安装tftp1. 下载tftp服务器、客户端tftp和守护进程xinetd三个包yuminstallxinetdtftptftp-server //xinetd.i3862:2.3.14-21.fc10//tftp-0.49-1.fc10.i386.rpm //tftp-server-0.49-1.fc10.i386.rpm2.配置vi/etc/xinet 阅读全文

posted @ 2013-04-14 20:50 ChanHuman 阅读(3760) 评论(0) 推荐(0) 编辑

摘要: Linux上的文件以.开头的文件被系统视为隐藏文件,仅用ls命令是看不到他们的,而用ls -a除了显示 一般文件名外,连隐藏文件也会显示出来。 ls -l(这个参数是字母L的小写,不是数字1) 这个命令可以使用长格式显示文件内容,如果需要察看更详细的文件资料,就要用到ls -l这个指令。例如我在某个目录下键入ls -l可能会显示如下信息(一共7个栏位): 文件属性 文件数 拥有者 所属的group 文件大小 建档日期 文件名 drwx------ 2 Guest users 1024 Nov 21 21:05 Mail -rwx--x--x 1 r... 阅读全文

posted @ 2013-04-14 20:49 ChanHuman 阅读(212) 评论(0) 推荐(0) 编辑

摘要: 很多人也许像我一样都想找一份学习的辟邪剑谱,转一个别人的帖子,希望对能够给用的。欲练此功,不必挥刀自宫的,呵呵。这句说的好:“最后,编程语言并非计算机科学技术的全部,尤其对于在校的学生来说,打好基础、开阔视野都是非常重要的。”一)语言入门:《C++ Primer》最新版本:第三版(第四版国外已上架,国内一些网上书店也在预订中)适合有丰富C经验,缺乏C++经验的。不过我个人一直认为此书带着过于强烈的C语言的痕迹,对于C++的学习未必是好事。《The C++ Programming Language》/《C++程序设计语言》最新版本:第三版特别版简称TC++PL,有其他语言的丰富经验的。(也有人. 阅读全文

posted @ 2013-04-14 20:48 ChanHuman 阅读(2807) 评论(1) 推荐(0) 编辑

摘要: 1. 用参数初始化表进行初始化Box::Box(int h,int w,int len):height(h),width(w),length(len){ }2. 使用默认参数的构造函数class里面声明Box(int h=10,int w=10,int len=10);class外定义Box::Box(int h,int w,int len){height=h;width=w;length=len;}3. 对象数组Box a[3]={Box(10,12,15),Box(12,12,15),Box(10,12,14)};4. 指向对象成员函数的指针有三个方面要匹配 3.所属的类要一样void ( 阅读全文

posted @ 2013-04-14 20:47 ChanHuman 阅读(176) 评论(0) 推荐(0) 编辑

摘要: http://www.360doc.com/content/11/0901/11/255982_144947210.shtmlhttp://blog.csdn.net/eric_jo/article/details/4138548http://www.cnblogs.com/lichkingct/archive/2009/04/21/1440848.html. const修饰普通变量和指针const修饰变量,一般有两种写法:const TYPE value;TYPE const value;这两种写法在本质上是一样的。它的含义是:const修饰的类型为TYPE的变量value是不可变的。对于一 阅读全文

posted @ 2013-04-14 20:46 ChanHuman 阅读(230) 评论(0) 推荐(0) 编辑

摘要: ①volume.h#include <iostream>using namespace std;class volume{public:double length;double width;double height;double countvolume();void setarg();void display();};②volume.cpp#include"stdafx.h"#include<iostream>#include"volume.h"using namespace std;double volume::countvo 阅读全文

posted @ 2013-04-14 20:45 ChanHuman 阅读(270) 评论(0) 推荐(0) 编辑

摘要: 求y=sqrt(x)的定积分#include "stdafx.h"#include <iostream>#include <math.h>using namespace std;double fun(double x){double y=sqrt(x);return y;}double ans(double a,double b,double(*pt)(double x)){int i,n;double step,sum=0;n=(b/a)*10000;step=(float)((b-a)/n);for(i=1;i<=n;i++){sum+=s 阅读全文

posted @ 2013-04-14 20:43 ChanHuman 阅读(282) 评论(0) 推荐(0) 编辑

摘要: 1.用const定义常变量e.g: const float PI 3.14159;定义了常变量PI,有属性,有数据类型,占用存储单元,有地址,可以用指针指向它。2.函数模板template<typename T>;T max(T a,T b,T c){if.......}3.引用①变量引用int a; int &b=a;②引用作为函数参数PS:不能定义指向引用类型的指针变量(不能。 int& *p=&a; )可以建立指针变量的引用(int i=5; int *p=&i; int* &pt=p; )可以用const对引用加以限定,不允许改变该引 阅读全文

posted @ 2013-04-14 20:42 ChanHuman 阅读(124) 评论(0) 推荐(0) 编辑

摘要: TCPServer: 1 import java.net.*; 2 import java.io.*; 3 4 public class TCPServer{ 5 public static void main(String[] args) throws Exception{ 6 ServerSocket ss = new ServerSocket(8888); 7 Socket sk = ss.accept(); 8 System.out.println("Client Connected!"); 9 InputSt... 阅读全文

posted @ 2013-04-14 20:41 ChanHuman 阅读(374) 评论(0) 推荐(0) 编辑

摘要: 1 public class ProducerConsumer{ 2 public static void main(String[] args){ 3 WtStack st = new WtStack(); 4 Producer a = new Producer(st); 5 Consumer b = new Consumer(st); 6 new Thread(a).start(); 7 new Thread(b).start(); 8 } 9 }10 11 class WoTou {12 ... 阅读全文

posted @ 2013-04-14 20:38 ChanHuman 阅读(194) 评论(0) 推荐(0) 编辑

摘要: 线程的同步是保证多线程安全访问竞争资源的一种手段。 线程的同步是Java多线程编程的难点,往往开发者搞不清楚什么是竞争资源、什么时候需要考虑同步,怎么同步等等问题,当然,这些问题没有很明确的答案,但有些原则问题需要考虑,是否有竞争资源被同时改动的问题? 在本文之前,请参阅《Java线程:线程的同步与锁》,本文是在此基础上所写的。 对于同步,在具体的Java代码中需要完成一下两个操作: 把竞争访问的资源标识为private; 同步哪些修改变量的代码,使用synchronized关键字同步方法或代码。当然这不是唯一控制并发安全的途径。 synchronized关键字使用说明 synchronize 阅读全文

posted @ 2013-04-14 20:35 ChanHuman 阅读(208) 评论(0) 推荐(0) 编辑

摘要: MainActivity: 1 package com.example.handlerthread; 2 3 import android.os.Bundle; 4 import android.os.Handler; 5 import android.os.HandlerThread; 6 import android.os.Looper; 7 import android.os.Message; 8 import android.annotation.SuppressLint; 9 import android.app.Activity;10 import android.content. 阅读全文

posted @ 2013-04-14 20:34 ChanHuman 阅读(158) 评论(0) 推荐(0) 编辑

摘要: MainActivity:package com.example.handlerprogessbar;import android.app.Activity;import android.os.Bundle;import android.os.Handler;import android.os.Message;import android.view.View;import android.view.View.OnClickListener;import android.widget.Button;import android.widget.ProgressBar;public class Ha 阅读全文

posted @ 2013-04-14 20:33 ChanHuman 阅读(154) 评论(0) 推荐(0) 编辑

摘要: MainActivity: 1 package com.example.easyhandler; 2 3 import android.os.Bundle; 4 import android.os.Handler; 5 import android.app.Activity; 6 import android.view.Menu; 7 import android.view.View; 8 import android.view.View.OnClickListener; 9 import android.widget.Button;10 11 public class MainActivi. 阅读全文

posted @ 2013-04-14 20:31 ChanHuman 阅读(236) 评论(0) 推荐(0) 编辑

摘要: px: 表示屏幕的实际像素。例如手机屏幕 320*480...dp: 是屏幕的物理尺寸。大小为一英寸的1/72...sp: (与刻度无关的像素)与dp类似,一般用于字体大小的描述...1、layout_margin指控件边缘相对于父控件的边距2、layout_padding控件内容相对于控件边缘的边距3、gravity指控件内的内容的对齐方式4、layout_gravity指控件本身的对齐方式5、layout_weight用于给定一个线性布局中诸多控件的重要度赋值 阅读全文

posted @ 2013-04-14 20:29 ChanHuman 阅读(181) 评论(0) 推荐(0) 编辑

摘要: MainActivity.java 1 package com.example.returnresult; 2 3 import android.os.Bundle; 4 import android.view.View; 5 import android.widget.Button; 6 import android.widget.EditText; 7 import android.app.Activity; 8 import android.content.Intent; 9 10 public class MainActivity extends Activity {11 12 ... 阅读全文

posted @ 2013-04-14 20:28 ChanHuman 阅读(559) 评论(0) 推荐(0) 编辑

摘要: mainActivity.java: 1 package com.example.intent3; 2 3 import java.io.ByteArrayOutputStream; 4 import java.io.ObjectOutputStream; 5 import android.app.Activity; 6 import android.content.Context; 7 import android.content.Intent; 8 import android.os.Bundle; 9 import android.text.ClipboardManager;10 im. 阅读全文

posted @ 2013-04-14 20:22 ChanHuman 阅读(235) 评论(1) 推荐(0) 编辑

摘要: PBar.javapackage com.example.progressbar;import android.os.Bundle;import android.app.Activity;import android.view.Menu;import android.view.View;import android.view.View.OnClickListener;import android.widget.Button;import android.widget.ProgressBar;public class PBar extends Activity { private ... 阅读全文

posted @ 2013-04-14 20:19 ChanHuman 阅读(161) 评论(0) 推荐(0) 编辑

摘要: LinearLayout: 1 <?xml version="1.0" encoding="utf-8"?> 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 android:orientation="vertical" 4 android:layout_width="fill_parent" 5 android:layout_height="fill_parent 阅读全文

posted @ 2013-04-14 20:16 ChanHuman 阅读(298) 评论(0) 推荐(0) 编辑

摘要: MainActivity: 1 package com.example.kj; 2 3 import android.os.Bundle; 4 import android.app.Activity; 5 import android.view.Menu; 6 import android.widget.CheckBox; 7 import android.widget.CompoundButton; 8 import android.widget.RadioButton; 9 import android.widget.RadioGroup;10 import android.widget. 阅读全文

posted @ 2013-04-14 20:13 ChanHuman 阅读(217) 评论(0) 推荐(0) 编辑

摘要: MainActivity: 1 package com.example.plus; 2 3 import android.app.Activity; 4 import android.content.Intent; 5 import android.os.Bundle; 6 import android.view.View; 7 import android.widget.Button; 8 import android.widget.EditText; 9 import android.widget.TextView;10 11 public class MainActivity exte. 阅读全文

posted @ 2013-04-14 20:08 ChanHuman 阅读(882) 评论(0) 推荐(0) 编辑

摘要: android全面开发(有链接到对应的知识)开发环境1. 【eoeAndroid社区索引】android开发环境搭建篇详尽的教程实例汇http://www.eoeandroid.com/thread-165561-1-1.html2. 【eoeAndroid社区索引】android开发环境SDK教程问题汇总http://www.eoeandroid.com/thread-165561-1-1.html3. 【eoeAndroid社区索引】android开发环境JDK教程实例汇总http://www.eoeandroid.com/thread-164313-1-1.html4. 【eoeAndr 阅读全文

posted @ 2013-04-14 19:58 ChanHuman 阅读(177) 评论(0) 推荐(0) 编辑