Linux设置网卡信息

建议通过终端字符方式下来修改
一修改IP地址
vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=none
IPADDR=192.168.1.33
NETMASK=255.255.255.0
ONBOOT=yes
TYPE=Ethernet
~

二修改网关
vi /etc/sysconfig/network

NETWORKING=yes
HOSTNAME=Shawn
GATEWAY=192.168.1.1

三重新启动网络配置
/etc/init.d/network restart

纯代码实现首页调用分类图片

纯代码实现首页调用分类图片。给你的每一个wordpress分类目录指定一张图片,然后在首页文章中进行调用。原作者忘了是谁了,不好意思吖,如果你看到后联系我。功能如下:

1.CSS定义图片大小、位置;

2.图片格式可自由设置;

3.点击图片进入分类页面

我对此做了修改,去掉了链接功能,但保留title,有利于SEO,图片格式由gif变为jpg,更符合标准,修正了不规范的代码,可通过W3C检测。

在wp-content目录下新建文件夹cat-icons,将.jpg图片放进去。图片的名称必须与你的分类目录别名一致才行!比如你有一个分类是网络赚钱,它的别名是make-money,那么对应的图片应该命名为make-money.jpg。

将下面的代码拷贝到index.php文件中的

{
$catname =$cat->category_nicename;
$cattitle=$cat->cat_name;
echo “”<img src=’http://www.techmemo.net/wp-content/cat-icons/“;
\n”;
}
?>

再指定一个CSS样式:

.category {
float:left;
margin-right: 5px;
margin-bottom: 2px;
}
.category img {
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
}

Windows下安装AHCI驱动(适用于AMD SB系列南桥)

1、在主板驱动中拷贝AHCI驱动
2、将ahcix86.sys复制到C:\windows\system32\drivers
3、ahcix86.inf和ahcix86.cat复制到C:\windows\inf
4、编辑
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\pci#ven_1002&dev_4391]
“Service”=”ahcix86”
“ClassGUID”=”{4D36E 96A-E325-11CE-BFC1-08002BE10318}”
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\pci#ven_1002&dev_4393]
“Service”=”ahcix86”
“ClassGUID”=”{4D36E96A-E325-11CE-BFC1-08002BE10318}”
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ahcix86]
“Type”=dword:00000001
“Start”=dword:00000000
“Group”=”SCSI miniport”
“ErrorControl”=dword:00000001
“ImagePath”=”system32\\drivers\\ahcix86.sys”
“tag”=dword:00000019
“DisplayName”=”ATI AMD AHCI Controller”
为reg文件
5、将该文件导入注册表
6、重启系统并开启AHCI模式。

Warning: Invalid argument supplied for foreach()

问题Warning: Invalid argument supplied for foreach() in 完善解决方案
将报错的语句做如下修改(例):

QUOTE:
foreach($extcredits as $id => $credit)
{
if($credit[‘ratio’])
{
$exchcredits[$id] = $credit;
}
}

改为

QUOTE:
if(is_array($extcredits)) //add
{
foreach($extcredits as $id => $credit)
{
if($credit[‘ratio’])
{
$exchcredits[$id] = $credit;
}
}
} //add

QUOTE:
foreach((array)$extcredits as $id => $credit)
{
if($credit[‘ratio’])
{
$exchcredits[$id] = $credit;
}
}

Ubuntu SSH: How To Enable Secure Shell in Ubuntu

SSH (Secure SHell) is possibly the best way to remotely access a Unix system – it’s very secure thanks to automatic encryption of all the traffic, and it’s also quite universal because you can do all sorts of things: access remote command line shell, forward graphics session output, establish network tunnels and set up port redirections. Today I’m going to show you how to get started with SSH in Ubuntu.

Installing SSH server in Ubuntu
By default, your system will have no SSH service enabled, which means you won’t be able to connect to it remotely using SSH protocol (TCP port 22). This means that installing SSH server will be one of the first post-install steps on your system.

The most common SSH implementation is OpenSSH server, and that’s exactly what you want to install.

Log in with your standard username and password, and run the following command to install openssh-server. You should be using the same username that you specified when installing Ubuntu, as it will be the only account with sudo privileges to run commands as root:

ubuntu$ sudo apt-get install openssh-server
[sudo] password for greys:
Reading package lists… Done
Building dependency tree
Reading state information… Done
Suggested packages:
rssh molly-guard openssh-blacklist openssh-blacklist-extra
The following NEW packages will be installed:
openssh-server
0 upgraded, 1 newly installed, 0 to remove and 75 not upgraded.
Need to get 285kB of archives.
After this operation, 782kB of additional disk space will be used.
Get:1 http://ie.archive.ubuntu.com jaunty/main openssh-server 1:5.1p1-5ubuntu1 [
285kB]
Fetched 285kB in 0s (345kB/s)
Preconfiguring packages …
Selecting previously deselected package openssh-server.
(Reading database … 101998 files and directories currently installed.)
Unpacking openssh-server (from …/openssh-server_1%3a5.1p1-5ubuntu1_i386.deb) .
..
Processing triggers for ufw …
Processing triggers for man-db …
Setting up openssh-server (1:5.1p1-5ubuntu1) …
Creating SSH2 RSA key; this may take some time …
Creating SSH2 DSA key; this may take some time …
* Restarting OpenBSD Secure Shell server sshd [ OK ]Verifying your SSH server works
While you’re still on your local desktop session, you can use the ps command to confirm that SSH daemon (sshd) is running:

ubuntu$ ps -aef | grep sshd
root 24114 1 0 15:18 ? 00:00:00 /usr/sbin/sshdNow that you see it’s there, it’s time to try connecting:

ubuntu$ ssh localhostSince this is the first time you’re trying to connect using SSH, you’ll have to answer yes to the following question:

The authenticity of host ‘localhost (::1)’ can’t be established.
RSA key fingerprint is 18:4d:96:b3:0d:25:00:c8:a1:a3:84:5c:9f:1c:0d:a5.
Are you sure you want to continue connecting (yes/no)? yes… you’ll then be prompted for your own password (remember, the system treats such connection request as if you were connecting remotely, so it can’t trust you without confirming your password):

Warning: Permanently added ‘localhost’ (RSA) to the list of known hosts.
greys@localhost’s password:.. and finally you’ll see the usual Ubuntu (Jaunty in this example) banner and prompt:

Linux ubuntu 2.6.28-11-generic #42-Ubuntu SMP Fri Apr 17 01:57:59 UTC 2009 i686

The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.

To access official Ubuntu documentation, please visit:

http://help.ubuntu.com/

Last login: Fri May 15 15:18:34 2009 from ubuntu
ubuntu$That’s it, providing you have your networking configured and you know your IP address or hostname, you can start connecting to your Ubuntu box from remote systems, using the same command. Enjoy!

IIS下配置WordPress固定链接支持中文URL版

打开wp-includes/classes.php文件,找到如下代码:

if ( isset($_SERVER[‘PATH_INFO’]) )
$pathinfo = $_SERVER[‘PATH_INFO’];
else
$pathinfo = ”;
$pathinfo_array = explode(‘?’, $pathinfo);
$pathinfo = str_replace(“%”, “%25″, $pathinfo_array[0]);
$req_uri = $_SERVER[‘REQUEST_URI’];修改为:

if ( isset($_SERVER[‘PATH_INFO’]) )
$pathinfo = iconv(‘GBK’, ‘UTF-8’, $_SERVER[‘PATH_INFO’]);
else
$pathinfo = ”;
$pathinfo_array = explode(‘?’, $pathinfo);
$pathinfo = str_replace(“%”, “%25”, $pathinfo_array[0]);
$req_uri = iconv(‘GBK’, ‘UTF-8’, $_SERVER[‘REQUEST_URI’]);这样通过伪静态软件就可以支持文章的URL链接为中文了。

Ubuntu 10.10 and Hyper-V R2

Ubuntu 10.10 was today 2010-10-10 released which is great new for us working with Hyper-V R2. We now have access to all the new drivers that Microsoft donates to the Linux community. The earlier drivers available in Ubuntu 10.04 LTS lacked features such as integrated shutdown, heartbeat detection, problematic host and guest synchronization and unstable network drivers (network traffic died unexpectedly). With Ubuntu 10.10 we now have the sames features as the Linux Integration Components 2.1 from Microsoft which only enables us to use Red Hat, Cent OS or SuSE Enterprise where Cent OS is unsupported from Microsoft.

Background

Ubuntu is a strong Linux distribution in the community due to it’s huge repository which often is very up-to date with the newest versions of different applications and the package system apt is also very pleasant. I myself rather choose CentOS due to it’s mature and stable kernel but sometimes CentOS don’t offer up-dated repositories and you may have to wait until getting new features for the applications you are using. Of course you always have the option to compile the software your self. This is a short how-to how to active all the drivers and get Ubuntu 10.10 up and running in Hyper-V R2 in minutes.

Enabling and loading drivers

Make your installation of Ubuntu 10.10, in my case I used server amd64 (64-bit). In my case I compile the loading of the drivers in the ram drive (initramfs) so drivers get loaded early upon start up, similar to Hyper-V installation in CentOS but you can also load the drivers in the /etc/modules for late-stage loading. After finalizing your custom Ubuntu 10.10 installation simply do









01 root@ubuntu:~# nano /etc/initramfs-tools/modules






02   






03 // Add






04   






05 hv_vmbus






06 hv_storvsc






07 hv_blkvsc






08 hv_netvsc






09 hv_utils






10   






11 root@ubuntu:~# update-initramfs -u






12 root@ubuntu:~# shutdown -r now






13   






14 // After rebooting add the NIC, remember that nic names have changed back from sethX to ethX so






15   






16 root@ubuntu:~# nano /etc/network/interfaces






17   






18 // Add, in case of dhcp






19 auto eth0






20 iface eth0 inet dhcp






21   






22 root@ubuntu:~# /etc/init.d/networking restart
Ubuntu 10.10 running under Hyper-V R2 with drivers

Secure clock skew

To secure the clock even better I suggest installing the adjtimex package which Microsoft recommends in their Linux Integration Components. And it’s available in Ubuntu repositories, so to install simply:









1 root@ubuntu:~# apt-get install adjtimex






2   






3 // Wait until completed, takes around 70 seconds while comparing clocks

去掉SERVER 2008的增强安全性配置

服务器系统要求很高的安全性,所以微软给ie添加了安全增强。这就使得ie在Internet区域的安全级别一直是最高的,而且无法进行整体调整。

但是相信很多的初学者和小鱼我一样,开始是想尝尝鲜的,设置IE关闭增强配置顿时使浏览网页轻松多了。

在“服务器管理器”中 点击“配置IE ESC”,将对“管理员”和“用户”设置成“禁用”,再次打开Internet选项的安全,你会发现可以设置安全的高 中 低了

IIS7主机安装WORDPRESS报500错误的解决办法

在windows IIS7主机上安装Wordpress时报500错误,代码如下:
500 – Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.
经测试发现传很多网站程序时均报下500错误,后面上网查才明白,原来IIS的主机如果程序出错的话就直接报以下错误,即使你是刚上传的Wordpress程序,因为Wordpress默认是没有配置的,肯定会报错提示你输入配置信息,而这刚好与IIS的主机相冲突,所以就会报如下错误,解决方法很简单,如果你用的Windows IIS6或者IIS7主机,把以下代码复制下来,命名为web.config上传至网站根目录即可。
我按如下方法上传到网站根目录后打开网站就进入了Wordpress博客程序配置界面,配置完成后成功运行Wordpress。
Windows IIS6的用户使用下面的代码

<configuration>
    <system.web>
        <customErrors mode=”Off”/>
        <compilation debug=”true”/>
    </system.web>
</configuration>




Windows IIS7的用户使用下面的代码


<configuration>
    <system.webServer>
        <httpErrors errorMode=”Detailed” />
        <asp scriptErrorSentToBrowser=”true”/>
    </system.webServer>
    <system.web>
        <customErrors mode=”Off”/>
        <compilation debug=”true”/>
    </system.web>
</configuration>








以上代码保存为web.config上传至网站根目录即可。
另外要说的一点是网站程序一般都需要读写权限,在排除是网站权限的情况下,再上传上面的代码进行测试。