Monday, November 24, 2008
ICSP pinouts
http://www.embedinc.com/picprg/icsp.htm
ICSP Overview
In-circuit Serial Programming (ICSP)
PICs are programmed using 5 signals. The data is transferred using a two wire synchronous serial scheme, with the clock always controlled by the programmer. The ICSP signals are:
GND
Negative power input to the PIC and the ground reference for the remaining signals. Voltages of the other signals are implicitly with respect to GND unless otherwise specified.
Vdd
This is the positive power input to the PIC. Some programmers require this to be provided by the circuit (circuit must be at least partially powered up), some programmers expect to drive this line themselves and require the circuit to be off, while others can be configured either way (like the Microchip ICD2). The Embed Inc programmers expect to drive the Vdd line themselves and require the target circuit to be off during programming.
Vpp
Programming mode voltage. This must be connected to the MCLR pin of the target PIC. To put the PIC into programming mode, this line must be in a specified range that varies between PICs, but is always above Vdd. The highest maximum allowed Vpp voltage that we know of is 13.5 volts. There is no one Vpp voltage that is within the valid Vpp range of all PICs.
PGC
Clock line of the serial data interface. This line swings from GND to Vdd and is always driven by the programmer. Data is transferred on the falling edge.
PGD
Serial data line. The serial interface is bi-directional, so this line can be driven by either the programmer or the PIC depending on the current operation. In either case this line swings from GND to Vdd. A bit is transferred on the falling edge of PGC.
Thursday, November 20, 2008
在C++Builer中多线程的实现
在C++Builer中多线程的实现
关键字:多线程,多任务,TThread对象
作者:Yinyin 更新:2002-11-15 浏览:8045
还在Dos时代,人们就在寻求一种多任务的实现。于是出现了TSR类型的后台驻留程序,比较有代表性的有Side Kick、Vsafe等优秀的TSR程序,这类程序的出现和应用确实给用户使用计算机带来了极大的方便,比如Side Kick,我们编程可以在不用进编辑程序的状态下,一边编辑源程序,一边编译运行,非常方便。但是,Dos单任务操作系统的致命缺陷注定了在Dos下不可能开发出真正的多任务程序。进入Windows3.1时代,这种情况依然没有根本的改变,一次应用只能做一件事。比如数据库查询,除非应用编得很好,在查询期间整个系统将不响应用户的输入。
进入了Windows NT和Windows 9x时代,情况就有了彻底的改观,操作系统从真正意义上实现了多任务(严格地说,Win9x还算不上)。一个应用程序,在需要的时候可以有许多个执行线程,每个线程就是一个小的执行程序,操作系统自动使各个线程共享CPU资源,确保任一线程都不能使系统死锁。这样,在编程的时候,可以把费时间的任务移到后台,在前台用另一个线程接受用户的输入。对那些对实时性要求比较高的编程任务,如网络客户服务、串行通信等应用时,多线程的实现无疑大大地增强了程序的可用性和稳固性。
在Windows NT和Windows 9x中,多线程的编程实现需要调用一系列的API函数,如CreateThread、ResumeThread等,比较麻烦而且容易出错。我们使用 Inprise公司的新一代RAD开发工具C++Builder,可以方便地实现多线程的编程。与老牌RAD工具Visual Basic和Delphi比,C++Builer不仅功能非常强大,而且它的编程语言是C++,对于系统开发语言是C的Windows系列操作系统,它具有其它编程语言无可比拟的优势。利用C++Builder提供的Tthread对象,多线程的编程变得非常简便易用。那么,如何实现呢?且待我慢慢道来,让你体会一下多线程的强大功能。
1. 创建多线程程序:
首先,先介绍一下实现多线程的具体步骤。在C++Builder中虽然用Tthread对象说明了线程的概念,但是Tthread对象本身并不完整,需要在Tthread下新建其子类,并重载Execute方法来使用线程对象。在C++Builder下可以很方便地实现这一点。
在C++Builder IDE环境下选择菜单File|New,在New栏中选中Thread Object,按OK,接下来弹出输入框,输入Tthread对象子类的名字MyThread,这样C++Builder自动为你创建了一个名为 TMyThread的Tthread子类。同时编辑器中多了一个名为Unit2.cpp的单元,这就是我们创建的TMyThread子类的原码,如下:
#include
#pragma hdrstop
#include “Unit2.h”
#pragma package(smart_init)
//---------------------
// Important: Methods and properties of objects in VCL can only be
// used in a method called using Synchronize, for example:
//
// Synchronize(UpdateCaption);
//
// where UpdateCaption could look like:
//
// void __fastcall MyThread::UpdateCaption()
// {
// Form1->Caption = “Updated in a thread”;
// }
//--------------------
__fastcall MyThread::MyThread(bool CreateSuspended)
: Tthread(CreateSuspended)
{
}
//--------------------
void __fastcall MyThread::Execute()
{
//---- Place thread code here ----
}
//---------------------
其中的Execute()函数就是我们要在线程中实现的任务的代码所在处。在原代码中包含Unit2.cpp,这个由我们创建的TMyThread对象就可以使用了。使用时,动态创建一个TMyThread 对象,在构造函数中使用Resume()方法,那么程序中就增加了一个新的我们自己定义的线程TMyThread,具体执行的代码就是Execute()方法重载的代码。要加载更多的线程,没关系,只要继续创建需要数量的TMyThread 对象就成。
以上我们初步地实现了在程序中创建一个自定义的线程,并使程序实现了多线程应用。但是,多线程应用的实现,并不是一件简单的工作,还需要考虑很多使多个线程能在系统中共存、互不影响的因素。比如,程序中公共变量的访问、资源的分配,如果处理不当,不仅线程会死锁陷入混乱,甚至可能会造成系统崩溃。总的来讲,在多线程编程中要注意共享对象和数据的处理,不能忽视。因此,下面我们要讲的就是多线程中常见问题:
2. 多线程中VCL对象的使用
我们都知道,C++Builder编程是建立在VCL类库的基础上的。在程序中经常需要访问VCL对象的属性和方法。不幸的是,VCL类库并不保证其中对象的属性和方法是线程访问安全的(Thread_safe),访问VCL对象的属性或调用其方法可能会访问到不被别的线程所保护的内存区域而产生错误。因此,Tthread对象提供了一个Synchronize方法,当需要在线程中访问VCL对象属性或调用方法时,通过Synchronize方法来访问属性或调用方法就能避免冲突,使各个线程之间协调而不会产生意外的错误。如下所示:
// 本文转自 C++Builder研究 - http://www.ccrun.com/article.asp?i=260&d=638igb
void __fastcall TMyThread::PushTheButton(void)
{
Button1->Click();
}
void __fastcall TMyThread::Execute()
{
…
Synchronize((TThreadMethod)PushTheButton);
…
}
对Button1-〉Click()方法的调用就是通过Synchronize()方法来实现的,它可以自动避免发生多线程访问冲突。在C++ Builder中,虽然有一些VCL对象也是线程访问安全的(如Tfont、Tpen、Tbrush等),可以不用Sychronize()方法对它们的属性方法进行访问调用以提高程序性能,但是,对于更多的无法确定的VCL对象,还是强烈建议使用Synchronize()方法确保程序的可靠性。
3. 多线程中公共数据的使用
程序设计中难免要在多个线程中共享数据或者对象。为了避免在多线程中因为同时访问了公共数据块而造成灾难性的后果,我们需要对公共数据块进行保护,直到一个线程对它的访问结束为止。这可以通过临界区域(Critical Section)的使用来实现,所幸的是在C++Builder中,给我们提供了一个TCriticalSection对象来进行临界区域的划定。该对象有两个方法,Acquire()和Release()。它设定的临界区域可以保证一次只有一个线程对该区域进行访问。如下例所示:
class MyThread : public Tthread
{
…
private:
TCriticalSection pLockX;
int x;
float y;
…
};
void __fastcall MyThread::Execute()
{
…
pLockX->Acquire();//Here pLockX is a Global CriticalSection variable.
x++;
y=sin(x);
pLockX->Release();
…
}
这样,对公共变量x,y的访问就通过全局TCriticalSection 对象保护起来,避免了多个线程同时访问的冲突。
4. 多线程间的同步
当程序中多个线程同时运行,难免要遇到使用同一系统资源,或者一个线程的运行要依赖另一个线程的完成等等,这样需要在线程间进行同步的问题。由于线程同时运行,无法从程序本身来决定运行的先后快慢,使得线程的同步看起来很难实现。所幸的是Windows系统是多任务操作系统,系统内核为我们提供了事件(Event)、Mutex、信号灯(semaphore)和计时器4种对象来控制线程间的同步。在C++Builder中,为我们提供了用于创建 Event的Tevent 对象供我们使用。
当程序中一个线程的运行要等待一项特定的操作的完成而不是等待一个特定的线程完成时,我们就可以很方便地用Tevent对象来实现这个目标。首先创建一个全局的Tevent对象作为所有线程可监测的标志。当一个线程完成某项特定的操作时,调用Tevent对象的SetEvent()方法,这样将设置这个标志,其他的线程可以通过监测这个标志获知操作的完成。相反,要取消这个标志,可以调用ResetEvent()方法。在需要等待操作完成的线程中使用 WaitFor()方法,将一直等待这个标志被设置为止。注意WaitFor()方法的参数是等待标志设置的时间,一般用INFINITE表示无限等待事件的发生,如果其它线程运行有误,很容易使这个线程死住(等待一个永不发生的事件)。
其实直接用Windows API函数也可以很方便地实现事件(Event)、信号灯(semaphore)控制技术。尤其是C++Builder,在调用Windows API方面有着其它语言无可比拟的优势。所用的函数主要有:CreateSemaphore()、CreateEvent()、 WaitForSingleObject()、ReleaseSemaphore()、SetEvent()等等,这里就不赘述了。
本文结合Inprise(Borland)公司开发的强大的RAD工具C++Builder的编程,对Windows下的多线程编程作了比较全面的介绍。其实多线程的实现并不神秘,看了本文,你也可以编出自己的多线程程序,真正体会多任务操作系统的威力。
附:本文是本人在使用C++Builder一年来的一些实践体会。在完成自己的项目的同时,发现对多线程的编程一般的书籍都介绍得比较少,而实际应用中,多线程编程又是如此的重要,因此,本文通过对多线程编程比较全面的介绍,愿能达到抛砖引玉之效。
C++Builder的多线程编程中一些体会
关键字:多线程编程,TThread
作者:佚名 更新:2002-12-26 浏览:11041
最近在写一个程序用到了多线程,所以对CB下的多线程有一定的学习。
现在把自己的一些心得讲一下。水平有限,写的很粗略,请大家见谅。
CB相对于VC来说,在CB下写多线程程序是很简单的。不仅是VCL中有TThread这个类。封装了那些关于多线程的WINDOW API。我觉得更方便的是他提供了
直接访问主VCL线程中对象的能力。可以很容易的和主线程中的窗体,控件
打交道。和单线程的方式没有太多区别。只是在有多个线程都要访问主线程
中的对象(比如访问同一个窗体上的StringGrid).只要用Thread的Synchronize方法来调用那段访问主VCL线程的代码(具体请看帮助),我们就不用担心访问冲突的问题了。而且对于多线程的同步和互斥,CB也对WINDOW 编程中那些机制进行了封装。比如对临界区CriticalSection封装为TCriticalSection.事件Event封装为TEvent.这些类相当简单好用。
下面就是我觉得比较重要的几点,供大家参考.
1。TThread的WaitFor方法。是等待一个线程返回。其返回值在这个线程里可以任意设定。以便在该线程返回的时候让调用他的线程知道他的运行情况。
在TThread的 OnTerminate事件中做线程的清除工作。他不是线程运行的一部分。
而是主VCL线程的一部分。所以在其中不能访问Thread的局部变量(如 int __thread i)
你可以把清楚代码写在这里,不用管现在在EXCUTE()方法执行到了哪个地方。
这么看起来有点类似于C++里的 finally 块的作用。
2。TEvent很重要。实现线程的同步。WaitFor(int Timeout)功能类似于
WINDOW API WaitforSingleObject().返回值包括:
其中参数Timeout可以设为INFINITE表示永久等待,但这样,程序很容易死在这里。
wrSignaled 该事件发生(成功返回).
本文转自 C++Builder研究 - http://www.ccrun.com/article.asp?i=393&d=82l8wk
wrTimeout 等待超时.
wrAbandoned 在该事件的超时期限到达前,该事件对象已经被毁灭了。.
wrError 在等待过程中有异常产生,要知道具体产生的错误要查看 TEvent的LastError
属性。
3 TCriticalSection
这个相当于WIN32编程中的临界区。
在多线程编程中,多个线程需要访问同一个公用变量的时候。
来保证访问的正确性。对公用变量访问的代码写在Enter();和Leave()之间。
比如有个公用变量 Count;
以下代码 :
TCriticalSection * pSection=new TCriticalSection();
pSection->Enter();
Count++;
pSection->Leave();
delete p;
Enter()方法进入临界区,对其中的公用变量加锁。
Leave()方法离开临界区,对其中的公用变量解锁。
4.TMultiReadExclusiveWriteSynchronizer
用来处理类似于多个生产者和多个消费者的问题。这里的消费者是指
对公用变量进行读操作的线程。
生产者是对公用变量进行写操作的线程。
四个方法。
BeginRead
EndRead
这两个方法用于消费者。
BeginWrite
EndWrite
这两个方法用于生产者。
使用的时候就是要把这个TMutiReadExclusiveWriteSynchronizer 定义一个全局变量。然后在其他线程中访问他。
Php First Example - hello world.
PHP only parses code within its delimiters. Anything outside its delimiters is sent directly to the output and is not parsed by PHP. The most common delimiters are and
?>
, which are open and close delimiters respectively. and
delimiters are also available. Short tags (
or
and
?>
) are also commonly used, but like ASP-style tags (<%
or <%=
and %>
), they are less portable as they can be disabled in the PHP configuration. For this reason, the use of short tags and ASP-style tags is discouraged.[50] The purpose of these delimiters is to separate PHP code from non-PHP code, including HTML. Everything outside the delimiters is ignored by the parser and is passed through as output.
Hello World' ?>
Word Tips--上标
首先选中需要做上标文字,然后按下组合键Ctrl+Shift+=就可将文字设为上标,再按一次又恢复到原始状态;按Ctrl+=可以将文字设为下标,再按一次也恢复到原始状态
insert check box in word 2003
2. View --> ToolBar --> forms
winxp-file-Share
点击“开始→运行”,在“运行”对话框中输入“GPEDIT.MSC”,打开组策略编辑器,依次选择“计算机配置→Windows设置→安全设置→本地策略→用户权利指派”,双击“拒绝从网络访问这台计算机”策略,删除里面的“GUEST”账号。这样其他用户就能够用Guest账号通过网络访问使用 Windows XP系统的计算机了。
打开组策略编辑器,依次选择“计算机配置→Windows设置→安全设置→本地策略→安全选项”,双击“网络访问:本地账号的共享和安全模式”策略,将默认设置“仅来宾—本地用户以来宾身份验证”,更改为“经典:本地用户以自己的身份验证”。
现在,当其他用户通过网络访问使用Windows XP的计算机时,就可以用自己的“身份”进行登录了(前提是Windows XP中已有这个账号并且口令是正确的)。
当该策略改变后,文件的共享方式也有所变化,在启用“经典:本地用户以自己的身份验证”方式后,我们可以对同时访问共享文件的用户数量进行限制,并能针对不同用户设置不同的访问权限。
不过我们可能还会遇到另外一个问题,当用户的口令为空时,访问还是会被拒绝。原来在“安全选项”中有一个“账户:使用空白密码的本地账户只允许进行控制台登录”策略默认是启用的,根据Windows XP安全策略中拒绝优先的原则,密码为空的用户通过网络访问使用Windows XP的计算机时便会被禁止。我们只要将这个策略停用即可解决问题。 五、如何共享访问 Windows XP 中的加密文件
1.在WinXP中安装NetBEUI协议
对的,你没有看错,就是要在WinXP中安装NetBEUI协议。微软在WinXP中只支持TCP/IP协议和NWLink IPX/SPX/NetBIOS兼容协议,正式宣布不再支持NetBEUI协议。但是在建立小型局域网的实际使用中,使用微软支持的两种协议并不尽如人意。比如,在解决网上邻居慢问题的过程中,笔者采用了诸多方法后网上邻居的速度虽然好一点,但还是慢如蜗牛;另外,在设置多块网卡的协议、客户和服务绑定时,这两种协议还存在BUG,多块网卡必须同时绑定所有的协议(除NWLink NetBIOS)、客户和服务,即使你取消某些绑定重启后系统又会自动加上,这显然不能很好地满足网络建设中的实际需要。而当笔者在WinXP中安装好 NetBEUI协议后,以上两个问题都得到圆满的解决。
在WinXP安装光盘的“\valueADD\MSFT\NET\NETBEUI”目录下有3个文件,其中“NETBEUI.TXT”是安装说明,另外两个是安装NetBEUI协议所需的文件。安装的具体步骤如下:
复制“NBF.SYS”到“%SYSTEMROOT%\SYSTEM32\DRIVERS\”目录;
复制“NETNBF.INF”到“%SYSTEMROOT%\INF\”目录;
在网络连接属性中单击“安装”按钮来安装NetBEUI协议。
注:%SYSTEMROOT%是WinXP的安装目录,比如笔者的WinXP安装在F:\Windows目录下,就应该用F:\Windows来替换%SYSTEMROOT%。
2.在WinXP中设置好其它网络协议
笔者建议,如果你的局域网不用上Internet便只需要安装NetBEUI协议就行了。在小型局域网(拥有200台左右电脑的网络)中NetBEUI是占用内存最少、速度最快的一种协议,NWLink IPX/SPX/NetBIOS兼容协议则应当删除掉。
如果你的局域网要上Internet则必须安装TCP/IP协议。但为了网络的快速访问,建议指定每台工作站的IP地址(除非网络中有DHCP服务器),否则工作站总是不断查找DHCP服务器使网速变慢。
当然,如果网络中只安装TCP/IP协议也能够实现局域网中的互访,但是在网上邻居中要直接看到其它机器就比较困难,必须先搜索到某台机器后才能访问它,这在许多实际网络运用中显得很不方便。
UART-Access-in-Windowns (General)
Once the port is opened (briefly outlined above) use the ReadFile and WriteFile functions to read and write from and to the port. To switch individual lines on the port (RTS, DTR..etc) use EscapeCommFunction (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devio/base/escapecommfunction.asp).
That is just a quick overview but the links provided should get you started.
TDM
Remote Desktop in Winxp -- Hints
View Linux Drive from Windows - SAMBA - Fedora 5
[q.yang@glomesprod01 ~]$ ls -alt /etc/samba/smb.conf
-rw-r--r-- 1 root root 10704 Feb 14 2006 /etc/samba/smb.conf
[q.yang@glomesprod01 ~]$ yum install system-config-samba
Loading "installonlyn" plugin
You need to be root to perform this command.
[q.yang@glomesprod01 ~]$ su
Password:
[root@glomesprod01 q.yang]# yum install system-config-samba
Loading "installonlyn" plugin
Setting up Install Process
Setting up repositories
core [1/3]
core 100% |=========================| 1.1 kB 00:00
updates [2/3]
updates 100% |=========================| 1.2 kB 00:00
extras [3/3]
extras 100% |=========================| 1.1 kB 00:00
Reading repository metadata in from local files
primary.xml.gz 100% |=========================| 767 kB 00:01
core : ################################################## 2207/2207
Added 2207 new packages, deleted 0 old in 43.32 seconds
primary.xml.gz 100% |=========================| 362 kB 00:09
updates : ################################################## 1013/1013
Added 1013 new packages, deleted 0 old in 20.89 seconds
primary.xml.gz 100% |=========================| 1.3 MB 00:09
extras : ################################################## 4277/4277
Added 4277 new packages, deleted 0 old in 73.21 seconds
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for system-config-samba to pack into transaction set.
system-config-samba-1.2.3 100% |=========================| 32 kB 00:00
---> Package system-config-samba.noarch 0:1.2.34-1 set to be updated
--> Running transaction check
--> Processing Dependency: samba for package: system-config-samba
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for samba to pack into transaction set.
samba-3.0.24-7.fc5.i386.r 100% |=========================| 109 kB 00:02
---> Package samba.i386 0:3.0.24-7.fc5 set to be updated
--> Running transaction check
--> Processing Dependency: cups-libs >= 1:1.2.8-1 for package: samba
--> Processing Dependency: samba-common = 0:3.0.24-7.fc5 for package: samba
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for cups-libs to pack into transaction set.
cups-libs-1.2.8-1.fc5.i38 100% |=========================| 35 kB 00:00
---> Package cups-libs.i386 1:1.2.8-1.fc5 set to be updated
---> Downloading header for samba-common to pack into transaction set.
samba-common-3.0.24-7.fc5 100% |=========================| 42 kB 00:01
---> Package samba-common.i386 0:3.0.24-7.fc5 set to be updated
--> Running transaction check
--> Processing Dependency: cups-libs = 1:1.1.23 for package: cups
--> Processing Dependency: samba-common = 0:3.0.21b-2 for package: samba-client
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for cups to pack into transaction set.
cups-1.2.8-1.fc5.i386.rpm 100% |=========================| 199 kB 00:05
---> Package cups.i386 1:1.2.8-1.fc5 set to be updated
---> Downloading header for samba-client to pack into transaction set.
samba-client-3.0.24-7.fc5 100% |=========================| 38 kB 00:01
---> Package samba-client.i386 0:3.0.24-7.fc5 set to be updated
--> Running transaction check
--> Processing Conflict: cups conflicts foomatic < 3.0.2-33.3
--> Processing Conflict: cups conflicts system-config-printer < 0.6.151.3
--> Processing Conflict: cups conflicts hplip < 0.9.9-5.1
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for foomatic to pack into transaction set.
foomatic-3.0.2-33.3.i386. 100% |=========================| 536 kB 00:10
---> Package foomatic.i386 0:3.0.2-33.3 set to be updated
---> Downloading header for hplip to pack into transaction set.
hplip-1.6.6a-1.1.i386.rpm 100% |=========================| 96 kB 00:01
---> Package hplip.i386 0:1.6.6a-1.1 set to be updated
---> Downloading header for system-config-printer to pack into transaction set.
system-config-printer-0.6 100% |=========================| 70 kB 00:01
---> Package system-config-printer.i386 0:0.6.151.8-1 set to be updated
--> Running transaction check
--> Processing Dependency: hpijs = 1:1.6.6a-1.1 for package: hplip
--> Processing Dependency: system-config-printer = 0.6.151-1 for package: system-config-printer-gui
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for hpijs to pack into transaction set.
hpijs-1.6.6a-1.1.i386.rpm 100% |=========================| 7.8 kB 00:00
---> Package hpijs.i386 1:1.6.6a-1.1 set to be updated
---> Downloading header for system-config-printer-gui to pack into transaction set.
system-config-printer-gui 100% |=========================| 51 kB 00:01
---> Package system-config-printer-gui.i386 0:0.6.151.8-1 set to be updated
--> Running transaction check
Dependencies Resolved
=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
system-config-samba noarch 1.2.34-1 core 246 k
Installing for dependencies:
samba i386 3.0.24-7.fc5 updates 16 M
Updating for dependencies:
cups i386 1:1.2.8-1.fc5 updates 2.9 M
cups-libs i386 1:1.2.8-1.fc5 updates 180 k
foomatic i386 3.0.2-33.3 updates 13 M
hpijs i386 1:1.6.6a-1.1 updates 221 k
hplip i386 1.6.6a-1.1 updates 7.8 M
samba-client i386 3.0.24-7.fc5 updates 4.2 M
samba-common i386 3.0.24-7.fc5 updates 8.5 M
system-config-printer i386 0.6.151.8-1 updates 1.1 M
system-config-printer-gui i386 0.6.151.8-1 updates 214 k
Transaction Summary
=============================================================================
Install 2 Package(s)
Update 9 Package(s)
Remove 0 Package(s)
Total download size: 54 M
Is this ok [y/N]:
ownloading Packages:
(1/11): cups-1.2.8-1.fc5. 100% |=========================| 2.9 MB 00:53
(2/11): foomatic-3.0.2-33 100% |=========================| 13 MB 03:46
(3/11): hpijs-1.6.6a-1.1. 100% |=========================| 221 kB 00:04
(4/11): samba-3.0.24-7.fc 100% |=========================| 16 MB 05:18
(5/11): samba-common-3.0. 100% |=========================| 8.5 MB 02:37
(6/11): cups-libs-1.2.8-1 100% |=========================| 180 kB 00:02
(7/11): samba-client-3.0. 100% |=========================| 4.2 MB 01:29
(8/11): system-config-pri 100% |=========================| 214 kB 00:05
(9/11): hplip-1.6.6a-1.1. 100% |=========================| 7.8 MB 02:26
(10/11): system-config-sa 100% |=========================| 246 kB 00:00
(11/11): system-config-pr 100% |=========================| 1.1 MB 00:35
[root@glomesprod01 q.yang]#
[q.yang@glomesprod01 ~]$ system-config-securitylevel
[q.yang@glomesprod01 ~]$ system-config-users
[q.yang@glomesprod01 ~]$ system-config-samba
Samba uses /etc/samba/smb.conf as its configuration file. If you change this configuration file, the changes will not take effect until you restart the Samba daemon with the command
#service smb restart.
A Samba user account will not be active until a Samba password is set for it.
#smbpasswd -a q.yang
New SMB password:
Retype new SMB password:
Relevant Link: http://www.reallylinux.com/docs/sambaserver.shtml
VNC set up in Fedora
[2] http://bobpeers.com/linux/vnc
[3] http://forums.fedoraforum.org/showthread.php?t=188625&page=2
[4] http://www.rpmfind.net/linux/rpm2html/search.php?query=selinux-policy&submit=Search+...
[5] http://linux.derkeiler.com/Mailing-Lists/Fedora/2008-07/msg01106.html
[6] http://rpm.pbone.net/index.php3/stat/26/dist/64/size/615728/name/vnc-4.1.3-1.fc9.src.rpm
BUG FIX VNC NOT RESPONDING CONTINUOUS KEY PRESS
-----------------------------------------------
See [5], need to upgrade Vnc package.
This has been resolved since installing vnc-server-4.1.2-31 from
Fedora-Updates. This coincided with an update to the xorg-x11-* packages,
so those updates could have been responsible for the fix, too. In any case,
I'm very grateful this has been corrected! :)
Download vnc-server-4.1.3-1.fc9.i386.rpm from [6]
HOW VNC SERVER PORT NUMBER IS DERIVED
-----------------------------------------
vnc port number is 5900+userDesktopIndexNumber
$vncviewer 10.1.1.10:2
Then in firewall, 5900+2 = 5902 must be enabled. [2]
BUG FIX WHY ONLY GET GREY SCREEN WHEN CONNECT VNC DESKTOP
------------------------------------------------------
Fixed bug in .vnc/localhost:localdomain:2.log
".......failed to execute message bus daemon /bin/dbus-daemon...."
Solution refer to web link [3]
upgrade selinux-policy, it solved the bug.
Details as below:
root@localhost q.yang]# rpm -q selinux-policy
selinux-policy-3.3.1-42.fc9.noarch
[root@localhost q.yang]# rpm -e selinux-policy
[root@localhost q.yang]# rpm -ivh /home/q.yang/Download/selinux-policy-3.3.1-132.fc9.noarch.rpm
Then
[root@localhost q.yang]# /sbin/service vncserver restart
[root@localhost q.yang]# vncviewer 10.1.1.5:2
Finally see the VNC desktop.
[root@localhost q.yang]# cat /home/q.yang/.vnc/xstartup
#!/bin/sh
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &
#startkde &
[root@localhost q.yang]#
[q.yang@localhost ~]$
------------------------------------------------
1. check whether VNC installed.
[tchung@tchung101 tchung]$ rpm -q vnc vnc-server vnc-4.0-0.beta4.3.2 vnc-server-4.0-0.beta4.3.2 If not installed, use yum install vnc [root@QuentinFedora12 Documents]# yum install vnc-server Loaded plugins: presto, refresh-packagekit Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package tigervnc-server.i686 0:1.0.1-1.fc12 set to be updated --> Processing Dependency: xorg-x11-fonts-misc for package: tigervnc-server-1.0.1-1.fc12.i686 --> Running transaction check ---> Package xorg-x11-fonts-misc.noarch 0:7.2-9.fc12 set to be updated --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: tigervnc-server i686 1.0.1-1.fc12 updates 1.1 M Installing for dependencies: xorg-x11-fonts-misc noarch 7.2-9.fc12 fedora 5.7 M Transaction Summary ================================================================================ Install 2 Package(s) Upgrade 0 Package(s) Total download size: 6.8 M Is this ok [y/N]: y Downloading Packages: Setting up and reading Presto delta metadata http://ga13.files.bigpond.com:4040/fedora/linux/releases/12/Everything/i386/os/repodata/521b16256b03f708faa16735faeb724df48eb2562ba044c595add16e23288979-prestodelta.xml.gz: [Errno 14] PYCURL ERROR 7 - "" Trying other mirror. fedora/prestodelta | 1.3 kB 00:00 updates/prestodelta | 9.0 kB 00:00 Processing delta metadata Package(s) data still to download: 6.8 M (1/2): tigervnc-server-1.0.1-1.fc12.i686.rpm | 1.1 MB 00:02 (2/2): xorg-x11-fonts-misc-7.2-9.fc12.noarch.rpm | 5.7 MB 00:12 ------------------------------------------------------------------------------------------------- Total 459 kB/s | 6.8 MB 00:15 warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 signature: NOKEY, key ID 57bbccba fedora/gpgkey | 3.2 kB 00:00 ... Importing GPG key 0x57BBCCBA "Fedora (12)8. want auto restart when linux reboot" from /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-i386 Is this ok [y/N]: y Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing : xorg-x11-fonts-misc-7.2-9.fc12.noarch 1/2 Installing : tigervnc-server-1.0.1-1.fc12.i686 2/2 Installed: tigervnc-server.i686 0:1.0.1-1.fc12 Dependency Installed: xorg-x11-fonts-misc.noarch 0:7.2-9.fc12 Complete! 2. change setting [tchung@tchung101 tchung]$ sudo vi /etc/sysconfig/vncservers VNCSERVERS="1:q.yang 2:m.xie" VNCSERVERARGS[1]="-geometry 1024x768" VNCSERVERARGS[2]="-geometry 1024x768" 3. pwd [tchung@tchung101 tchung]$ vncpasswd Password: 4. restart vnc service [tchung@tchung101 tchung]$ sudo /sbin/service vncserver start Starting VNC server: 1:tchung [ OK ] [tchung@tchung101 tchung]$ Verify: 5. edit ~/.vnc/xstartup [q.yang@QuentinFedora12 Documents]$ cat ~/.vnc/xstartup #!/bin/sh vncconfig -iconic & unset SESSION_MANAGER unset DBUS_SESSION_BUS_ADDRESS OS=`uname -s` if [ $OS = 'Linux' ]; then case "$WINDOWMANAGER" in *gnome*) if [ -e /etc/SuSE-release ]; then PATH=$PATH:/opt/gnome/bin export PATH fi ;; esac fi if [ -x /etc/X11/xinit/xinitrc ]; then exec /etc/X11/xinit/xinitrc fi if [ -f /etc/X11/xinit/xinitrc ]; then exec sh /etc/X11/xinit/xinitrc fi [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources xsetroot -solid grey xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" & twm & #startkde & 6. restart vnc service 7. change firewall to allow vnc NOTE: Please use GUI to do firewall settings for fedora 12 as 'iptables' has different format for fedora 9 and fedora 12. Below is iptables setting for fedora 9 ONLY. tchung@tchung101 tchung]$ sudo vi /etc/sysconfig/iptables # Firewall configuration written by redhat-config-securitylevel # Manual customization of this file is not recommended. *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] :RH-Firewall-1-INPUT - [0:0] -A INPUT -j RH-Firewall-1-INPUT -A FORWARD -j RH-Firewall-1-INPUT -A RH-Firewall-1-INPUT -i lo -j ACCEPT -A RH-Firewall-1-INPUT -p icmp --icmp-type any -j ACCEPT -A RH-Firewall-1-INPUT -p 50 -j ACCEPT -A RH-Firewall-1-INPUT -p 51 -j ACCEPT -A RH-Firewall-1-INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5901 -j ACCEPT -A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited COMMIT [tchung@tchung101 tchung]$ sudo /sbin/service iptables restart Flushing firewall rules: [ OK ] Setting chains to policy ACCEPT: filter [ OK ] Unloading iptables modules: [ OK ] Applying iptables firewall rules: [ OK ] [tchung@tchung101 tchung]$
To make VNC server to start on boot:
# chkconfig vncserver on
relevant link: http://www.g-loaded.eu/2005/11/10/configure-vnc-server-in-fedora/
Tuesday, November 18, 2008
Add new Macros in Soure Insight.
Macros like utils.em, comment.em,
just add utils.em into your project as one project source file, then after assigning a shortcut key to corresponding functions in utils.em, like, 'alt+(' for uncomment block of codes, 'alt+)' for comment block of codes. You can enjoy some new shortcut keys now powered by the Macros embedded into source insight.
Friday, November 14, 2008
Php+Mysql+Apache+BBS set up
------------------------------------------------------
[root@QuentinFedoraHome q.yang]# pwd
/home/q.yang
[root@QuentinFedoraHome q.yang]# uname -a
Linux QuentinFedoraHome 2.6.25-14.fc9.i686 #1 SMP Thu May 1 06:28:41 EDT 2008 i686 i686 i386 GNU/Linux
[root@QuentinFedoraHome q.yang]# /opt/apache/bin/apachectl start
now, you can see your page from browser
http://10.1.1.7/
INSTALLATION OF PHP + MYSQL + APACHE
---------------------------------------------------
[q.yang@QuentinFedoraHome ~]$ rpm -qa | grep mysql
mysql-connector-java-3.1.12-5.fc9.i386
mysql-libs-5.0.51a-1.fc9.i386
[q.yang@QuentinFedoraHome ~]$ rpm -qa | grep httpd
httpd-tools-2.2.8-3.i386
httpd-2.2.8-3.i386
[q.yang@QuentinFedoraHome ~]$ rpm -qa | grep php
[q.yang@QuentinFedoraHome ~]$
uninstall mysql-connector-java-3.1.12-5.fc9.i386
[root@linuxsir01 root]#rpm -e mysql-connector-java
From: http://doc.linuxpk.com/43251.html
and http://www.linuxsir.org/bbs/showthread.php?t=77079&highlight=apache
and http://doc.linuxpk.com/5557.html
==1== Obtain software.
Download mysql-5.0.67-linux-i686-glibc23.tar.gz from:
http://dev.mysql.com/downloads/mysql/5.0.html#downloads
Download php-5.2.6.tar.gz from:
http://www.php.net/
Download httpd-2.2.10.tar.gz from:
http://apache.wildit.net.au/httpd/ mirror of appache
or from http://www.apache.org/dyn/closer.cgi to get mirror list
==2== Installation from source
以Root登录,将以上文件均拷贝至/opt/software下。
[root@xxxx opt]#mv -f /home/user/
1.安装MySQL
[root@linuxsir01 root]# cd /opt/software
[root@linuxsir01 software]# ls mysql-4.0.16.tar.gz
[root@linuxsir01 software]#tar zxvf mysql-4.0.16.tar.gz
编译和安装:在这个地方值得注意的是,我们要把mysql-4.0.16安装到我们指定的目录中,
为了系统和安全和优化,建议把自己用源码包安装的服务器 类软件都放在/opt 目录里。
所以在这里,我们就要把mysql-4.0.16也安装到/opt/mysql这个目录中;
[root@linuxsir01 software]#cd
[root@linuxsir01 software]# cd mysql-4.0.16
[root@linuxsir01 mysql-4.0.16]#
./configure --prefix=/opt/mysql --with-mysqld-user=beinan --with-extra-charsets=all --with-unix-socket-path=/opt/mysql/var/mysql.sock
[注]关于configure的选项的一点说明:
--prefix=/opt/mysql 把mysql-4.0.16指定安装到/opt/mysql目录中;
--with-extra-charsets=all 对多语言的支持;
--with-unix-socket-path=/opt/mysql/var/mysql.sock 这个是指定mysql服务器启动后,联机套接字文件所处的位置和文件名,也就是说,如果mysql服务器成功启动后,就能在/opt/mysql/var 目录中看到mysql.sock文件。如果看不到,肯定是mysql启动不了。
--with-mysqld-user=beinan 这个是让mysql服务器也能让系统中普通用户beinan也能启动mysql服务器。当然要活学活用了:)你也可以把beinan换成你的系统中已经存 在的普通用户,比如您的系统中已经存在sir这个用户,那就把beinan替换成sir就行了。用普通用户来启动mysql的好处是:mysql的进程会 自己死掉自动退出。当然root用户也可以,不过有时mysql有些进程死了,但不会自动退出,root自己也杀不掉。所以用普通用户就有这样的好处,大 多不会出现mysql进程已死,但不会退出的情况;
[root@linuxsir01 mysql-4.0.16]#make
[root@linuxsir01 mysql-4.0.16]#make install
我们把/opt/mysql/share/mysql这个目录下的my-medium.cnf,复制为my.cnf到/etc目录下。
做了这些工作以后,还得创造MySQL授权表, 否则数据库也是启动不了。mysql_install_db,这个命令的用途就是做这个的。
[root@linuxsir01 mysql]#/opt/mysql/bin/mysql_install_db
[root@QuentinFedoraHome mysql]# ./bin/mysql_install_db
Installing MySQL system tables...
OK
Filling help tables...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/opt/mysql/bin/mysqladmin -u root password 'new-password'
/opt/mysql/bin/mysqladmin -u root -h QuentinFedoraHome password 'new-password'
Alternatively you can run:
/opt/mysql/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /opt/mysql ; /opt/mysql/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /opt/mysql/mysql-test ; perl mysql-test-run.pl
Please report any problems with the /opt/mysql/bin/mysqlbug script!
The latest information about MySQL is available at http://www.mysql.com/
Support MySQL by buying support/licenses from http://shop.mysql.com/
[root@QuentinFedoraHome var]# chown -R q.yang ./
[root@QuentinFedoraHome var]# ll
total 776
drwxrwx--x 2 q.yang root 4096 2009-05-21 22:54 mysql
-rwxrwx--x 1 q.yang root 125 2008-12-01 22:12 mysql-bin.000001
-rw-rw---- 1 q.yang root 106 2009-03-24 22:19 mysql-bin.000002
-rw-rw---- 1 q.yang root 106 2009-03-24 22:20 mysql-bin.000003
-rw-rw---- 1 q.yang root 125 2009-03-24 23:10 mysql-bin.000004
-rw-rw---- 1 q.yang root 106 2009-05-20 22:16 mysql-bin.000005
-rw-rw---- 1 q.yang root 125 2009-05-20 22:34 mysql-bin.000006
-rw-rw---- 1 q.yang root 106 2009-05-21 21:55 mysql-bin.000007
-rw-rw---- 1 q.yang root 125 2009-05-21 22:36 mysql-bin.000008
-rw-rw---- 1 q.yang root 18928 2009-05-21 22:23 mysql-bin.000009
-rw-rw---- 1 q.yang root 696216 2009-05-21 22:23 mysql-bin.000010
-rw-rw---- 1 q.yang root 106 2009-05-21 22:36 mysql-bin.000011
-rw-rw---- 1 q.yang root 106 2009-05-21 22:59 mysql-bin.000012
-rw-rw---- 1 q.yang root 125 2009-05-21 23:02 mysql-bin.000013
-rw-rw---- 1 q.yang root 125 2009-05-21 23:18 mysql-bin.000014
-rwxrwx--x 1 q.yang root 266 2009-05-21 23:18 mysql-bin.index
-rwxrwx--x 1 q.yang root 11477 2009-05-21 22:59 QuentinFedoraHome.err
drwxrwx--x 2 q.yang root 4096 2008-11-28 21:47 test
[root@QuentinFedoraHome var]# /opt/mysql/bin/mysql_install_db --user=q.yang --datadir=/opt/mysql/var/
Installing MySQL system tables...
OK
Filling help tables...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/opt/mysql/bin/mysqladmin -u root password 'new-password'
/opt/mysql/bin/mysqladmin -u root -h QuentinFedoraHome password 'new-password'
Alternatively you can run:
/opt/mysql/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /opt/mysql ; /opt/mysql/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /opt/mysql/mysql-test ; perl mysql-test-run.pl
Please report any problems with the /opt/mysql/bin/mysqlbug script!
The latest information about MySQL is available at http://www.mysql.com/
Support MySQL by buying support/licenses from http://shop.mysql.com/
=============================================
mysql服务器启动,应该是/opt/mysql/share/mysql目录中的 mysql.server
启动方法是:
[root@linuxsir01 mysql]# /opt/mysql/share/mysql/mysql.server start
add " datadir=/opt/mysql/var" into /etc/my.cnf,
#chown smith.y /opt/mysql/var/mysql-bin.index
#mysql_install_db --user=smith.y --datadir=/opt/mysql/var
[root@linuxsir01 mysql]# /opt/mysql/share/mysql/mysql.server start --skip-grant-table
--skip-grant-table is used to avoid 'unfound mysql.plugin' error.
commented out 'skip-federated' in /etc/my.cnf to avoid error 'unknown option '--skip-federated'
changed the /etc/sysconfig/iptables, to add 3306 socket ports.
/sbin/service iptables restart Not sure whether this helped the start of MySQL server.
Now, 'Starting MySQL [OK]'
[root@QuentinFedoraHome var]# /opt/mysql/bin/mysqladmin -u root password 123456/opt/mysql/bin/mysqladmin: You cannot use 'password' command as mysqld runs with grant tables disabled (was started with --skip-grant-tables).Use: "mysqladmin flush-privileges password '*'" instead
????? how to start MySal server without --skip-grant-table
[root@QuentinFedoraHome var]# /opt/mysql/bin/mysqladmin flush-privileges password '*'/opt/mysql/bin/mysqladmin: reload failed; error: 'Table 'mysql.host' doesn't exist'
2.安装Apache、PHP3、Mod―Auth―MySQL
由于PHP3、Mod―Auth―MySQL是作为Apache的两个模块进行编译,故Apache要与它们联合编译。
#tar xvzf httpd-2.2.10.tar.gz(产生httpd-2.2.10目录)
# tar xvzf php-5.2.6.tar.gz(产生php-5.2.6目录)
# tar xvzf mod_auth_mysql-3.0.0.tar.gz(产生mod_auth_mysql-3.0.0目录)
------------------------------------------------------------
#cd httpd-2.2.10
[root@QuentinFedoraHome httpd-2.2.10]#./configure --prefix=/opt/apache --enable-track-vars --enable-cgi --with-config-file-path=/opt/apache/conf
# ./configure --prefix=/opt/apache(把Apache的安装目录定为/opt/apache)
#./configure --prefix=/usr/local/apache --activate-module=src/modules/ php3/libphp3.a --activate-module=src/modules/mod―auth/libmod―auth.a
#make; make install
[root@linuxsir01 httpd-2.0.48]#./configure --prefix=/opt/apache --enable-track-vars --enable-cgi --with-config-file-path=/opt/apache/conf一点简单的说明:这个apache的安装,有很多的选项,如果您是比较精通,所以必要看此文,可以自己定义来安装。因为我大多是采用默认的配制,如果您想让apache有更多的功能,比如支持压缩输出以及jsp等支持,可以看其它的文章。这篇文件主还要给初学linux的弟兄写的一个简单的入门型文章,直接的说,就是给一点都不懂在linux如何安装apache,并支持php+mysql的。能让初学linux的弟兄自己架一个最简单的网站,这样弄明白原理以后,就便于深入学习和研究。我写此文的目的仅此而已;
--prefix=/opt/apache 指定把apahce安装到/opt/apache目录中;
--enable-cgi 支持CGI;
--with-config-file-path=/opt/apache/conf 指定把apache的配制文件放在/opt/apache/conf中;比如httpd.conf配制文件就在这个目录中;
--enable-track-vars 为启动cookie的get/post等追踪功能
如果需要更多的选项,可能通过下面的命令来查看;
[root@linuxsir01 httpd-2.0.48]#./configure --help
下一步就是make 和make install
[root@linuxsir01 httpd-2.0.48]#make
[root@linuxsir01 httpd-2.0.48]#make install
启动apache守护进程;
[root@linuxsir01 httpd-2.0.48]# /opt/apache/bin/apachectl start
打开浏览器,输入 http://localhost/ 就能看到一个apache的欢迎页面了,这表示我们已经成功解决了apache的安装。
back up apache config file
# cp /opt/apache/conf/httpd.conf /opt/apache/conf/httpd.confBAK
ServerAdmin beinan@linuxsir.com
ServerName 192.168.0.1:80
DocumentRoot "/var/home/freewill"
Add follows into "/etc/sysconfig/iptables"
-A INPUT -m state --state NEW -m udp -p udp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
Then restart firewall
/sbin/service iptables restart
Now, you should be able to view your webpage through Internet.
--------------------------------------------------------------
#cd ./php-5.2.6
# ./configure --prefix=/opt/php --with-mysql=/opt/mysql --with-apxs2=/opt/apache/bin/apxs --enable-force-cgi-redirect --with-config-file-path=/opt/php/etc
#./configure --with-mysql=/usr/local/mysql --with-apache=../apache―1.3.6 --enable-track-vars
配置PHP模块支持MySQL,并作为Apache功能模块、跟踪变量有效。
[from linuxsir ]
[root@linuxsir01 php-4.3.4]#./configure --prefix=/opt/php --with-mysql=/opt/mysql --with-apxs2=/opt/apache/bin/apxs --enable-force-cgi-redirect --with-config-file-path=/opt/php/etc
一点说明:
--prefix=/opt/php 指定把php-4.3.4安装到/opt/php目录中;
--with-mysql=/opt/mysql 指定mysql数据服务器安装的位置;
--with-apxs2=/opt/apache/bin/apxs 这是加入apache中为DSO模块的位置;
-enable-track-vars 为启动cookie的get/post等追踪功能
--with-config-file-path=/opt/php/etc 指定php的配制文件存放的目录是/opt/php/etc目录,我们安装完成后,也要把php.ini复制到这个目录中来。
#make; make install
[root@QuentinFedoraHome php-5.2.6]# libtool --finish /opt/software/php-5.2.6/libs
[root@QuentinFedoraHome php-5.2.6]# chmod 755 /opt/apache/modules/libphp5.so
PHP安装完毕。
-----------------------------------------------------------
#cd ./mod―auth―mysql-2.20
[root@QuentinFedoraHome software]# /opt/apache/bin/apxs -cia -L/opt/mysql/lib/mysql -I/opt/mysql/include/mysql -lmysqlclient mod_auth_mysql.c
Failed to build.
#./configure --with-mysql=/usr/local/mysql --with-apache=../apache―1.3.6 --enable-track-vars
配置支持MySQL、作为Apache功能模块、跟踪变量有效。
#make (注意:这里不再用make install命令)
Mod―Auth―MySQL安装完毕。
---------------------------------------------------------------
#cp -fp /opt/software/php-5.2.6/php.ini-dist /opt/php/etc/php.ini
#vi /opt/apache/conf/httpd.conf
DirectoryIndex index.html index.php "added index.php in this line -Quentin commented"
AddType application/x-httpd-php .php "added php application support."
AddType application/x-httpd-php-source .phps
/*
-------------------------------------------------------------------------
3.安装phpMyAdmin
#tar -zvxf phpMyAdmin―2.0.5.tar.gz
产生phpMyAdmin-2.11.9.5-all-languages 目录
#mv ./phpMyAdmin-2.11.9.5-all-languages /opt/apache/htdocs/phpMyAdmin
移到/usr/local/mysql
#cd /opt/apache/htdocs/phpMyAdmin
#chmod a+r * 置为可读
----------------------------------------------------------------------------
三、软件运行
1.启动MySQL
第一次运行之前,先进行数据库初始化:
#cd /usr/local/mysql
#scripts/mysql―install―db
#bin/safe―mysqld & (运行MySQL数据库)
#bin/mysql -u root (默认没有设口令)
#mysql〉use mysql; (打开MySQL数据库)
注意,命令后的“;”是必不可少的。
#mysql〉select * from user;
#mysql〉exit
这样就可以了,先不急着加口令。
2.启动Apache
#/usr/local/apache/bin/apachectl start
测试:
#telnet localhost 80
Trying 127.0.0.1... Connected to localhost.Escape character is ′^]′.
#cd /usr/local/apache/htdocs
#vi test.php3
在文件里敲入:
〈? Echo ″HELLO WORLD!″?〉
存盘退出,再用浏览器看一下这个文件,是不是一条问候信息?
3. 使用phpMyAdmin
用浏览器打开/phpMyAdmin/index.php3 (注意大小写),会出现一个简陋的界面,千万别小看它,它能完成很多让你意想不到的功能。
四、MySQL及phpMyAdmin的设置
1. phpMyAdmin设置
#cd /usr/local/apache/htdocs/phpMyAdmin
将require(″english.inc.php3″)改为require(″chinese―gb.inc.php3″)。这样就显示简体中文界面了。
2. MySQL的用户及口令设置
浏览/phpMyAdmin/index.php3,看到一个MySQL库,在其中的表User中,可查找当前数据库中所有用户,在Password字段中可更改Root口令。
设置口令后,phpMyAdmin也要作相应设置:
#vi config.inc.php3将
$cfgServers[1][′adv―auth′]=true;
$cfgServers[1][′stduser′]=′root′;
$cfgServers[1][′stdpass′]=′root password′。
五、MySQL、Apache由普通用户身份运行
1. 运行Apache
为Apache增加普通用户后,将Httpd.conf中的User、Group改为Apache的用户和组。
在/etc/rc.d/rc.local中增加下面一行:
/bin/sh -c ′/usr/local/apache/bin/apachectl start′
使其在系统启动时自动运行Apache。
2. 运行MySQL
为MySQL增加普通用户后,在/etc/rc.d/rc.local中增加下面一行:
/bin/sh -c ′/usr/local/mysql/bin/safe―mysqld --user=mysql &′
一切准备就绪,剩下的就是使用各种工具来建立一个属于自己的网站。
==========================================================================
webmin install
Install webmin using rpm, 'i'-install, 'v' -details 'h' - show progress bar.
#rpm -ivh webmin-1.470-1.noarch.rpm
Thursday, November 13, 2008
Monday, November 10, 2008
Tips in Excel SpreadSheet.
=IF(HEX2DEC(C3)<32768,HEX2DEC(C3),(HEX2DEC(C3)-65536))
Tuesday, November 4, 2008
Structure to Structure copy
http://forums.devx.com/archive/index.php/t-92711.html
why aren't you using plain assignment? C supports struct assignment:
struct A
{
int a;
float b;
char c;
long m;
};
struct A a;
struct A b;
b=a; /* works with ANSI C too*/
Danny
or pointers, you have to copy individually that members,
Mike
www.exontrol.com
Sunday, November 2, 2008
SVN repository access by password within LAN.
[user@FedoraHome ~]$ vi /var/svn/repos_ebook/conf/passwd
### This file is an example password file for svnserve.
### Its format is similar to that of svnserve.conf. As shown in the
### example below it contains one section labelled [users].
### The name and password for each user follow, one account per line.
[users]
# harry = harrypwd
# sally = sallypwd
--step 2 -- change config file
Has to disable anon-access so that password works on SVN checkout. (on SVN 1.8.8-1 default with Fedora 20)
[user@FedoraHome ~]$vi /var/svn/repos_ebook/conf/svnserve.conf
### The anon-access and auth-access options control access to the
### repository for unauthenticated (a.k.a. anonymous) users and
### authenticated users, respectively.
### Valid values are "write", "read", and "none".
### Setting the value to "none" prohibits both reading and writing;
### "read" allows read-only access, and "write" allows complete
### read/write access to the repository.
### The sample settings below are the defaults and specify that anonymous
### users have read-only access to the repository, while authenticated
### users have read and write access to the repository.
anon-access = none
# auth-access = write
### Uncomment the line below to use the default password file.
password-db = passwd
...........
### Uncomment the line below to use the default authorization file.
# authz-db = authz
### This option specifies the authentication realm of the repository.
### If two repositories have the same authentication realm, they should
### have the same password database, and vice versa. The default realm
### is repository's uuid.
realm = My ebook Repository
Other advanced access control methods, like via ssh tunnel, apach server. pls refer to SVN user guide Chapter 6 Server Configuration.
ACCESS SVN WITHIN LAN THROUGH TORTOISE SVN CLIENT
--------------------------------------------------