Home > Article > Backend Development > Senior Linux programmers’ development experience
Emacs Emacs has been a clean environment since the The editor has become Murray ’s standard tool. "It works on all flavors of UNIX , which is one of the main reasons I choose it when working on cross-platform development," he said. LinuxDevelopmentPeople: Know your shell
Murrayasks you to know your shell. “Bash,
tcsh, csh—shell are your most basic software development tools,” he emphasized. "It can do a lot of amazing things. All work depends on it... and its power." As an example of how powerful common shell scripts can be, there is a downloadable file in the Resources section with a set of scripts for getting updated RPMs for Red Hat releases of software packages and merge them into original packages and customized packages. After downloading the file and unzipping it, you can find the script in the /developerworks/rpm_update_scripts directory. The end result is a directory containing the latest versions of all packages and an upgraded hdlist file for network installation. The following code snippet implements an automatic update of the Red Hat RPM package to create an installable version using the latest RPM . This is a basic step for anyone maintaining a public Linux
server. In our case, we typically maintain a large number of web services on many publicLinux servers. Below are some scripts that can automate the process of updating with the latest security and features. The script sample below proves that ordinary shell programming techniques can be widely used in various system configuration and programming applications. The script uses the bourne shell, which is the most common shell
in differentUNIX systems. This ensures that these very lightweight codes can be used on different UNIX systems with slight or no modifications. It's easy to modify Red Hat package specifications to apply to other Linux distributions. freshen.sh Updates the RPM package on the site with the specified RPM ftp to update the original
RPMlist. Execute filter to replace updated RPM packages. Finally, the long release list is updated with new RPM packages available from the update mirror site. List 1. fresh.sh#!/bin/sh rh_ver=$1
rh_path=$2
up date_dir=${rh_path}/RH${ rh_ver}-updatescustom_dir=${rh_path}/RH${rh_ver}-custom
install_dir=${rh_path}/RH${rh_ver}-install
#Sanity check for the original directory.
[ -d ${install_dir}/RedHat/RPMS ] || mkdir -p ${install_dir}/RedHat/RPMS
# Get latest updates from fresh rpms FTP site
We assume that original RPMS are already
# hardlinked to the install directory, so all we need to do is filter
# out any replaced by updated packages.
./do-links.sh ${ update_dir} ${install_dir}/RedHat/RPMS
[ -d ${custom_dir} ] && ./do-links.sh ${custom_dir}
${install_dir}/RedHat/RPMS
# Filter out all but the latest version of everything.
# Rebuild the hard disk lists
/usr/lib/anaconda-runtime/genhdlist ${install_dir}
freshen.sh Call do-links.sh and get _update. sh , respectively to set the source and sink of the RPM release version ( omitted the source RPM software package; hard links are used to set the purpose RPM) and retrieve updates.
List 2. do-links.sh
#!/bin/sh
src=$1
dest=$2
#for file in $src/*; do
for file in `find $src -name *.rpm -a ! -name *.src.rpm -print`; do
base=`basename $ file;`
if test ! -f $dest/$base; then
echo "Linking $file";
ln $file $dest
else
echo " EXISTS: $file";
fi
done
list 3. get_update.sh
#!/bin/sh rh_ver=$1
dest =$2
echo "Retrieving updates for version ${rh_ver} to $dest"
lftp << EOF
open ftp.freshrpms.net
mirror - n pub/redhat/linux/updates/${rh_ver}/en/os/i386 $dest/i386
mirror -n pub/redhat/linux/updates/${rh_ver}/en/os/i486 $dest /i486
mirror -n pub/redhat/linux/updates/${rh_ver}/en/os/i586 $dest/i568
mirror -n pub/redhat/linux/updates/${rh_ver} /en/os/i686 $dest/i686
mirror -n pub/redhat/linux/updates/${rh_ver}/en/os/SRPMS $dest/SRPMS
mirror -n pub/redhat/ linux/updates/${rh_ver}/en/os/noarch $dest/noarch
Java
andLinux in
Codemonks, quite a lot of development work is in Linux Completed using Java . The combination of these two tools provides a platform for creating commercial-grade quality Web applications, Murray said. “While working on these projects, we found that we needed to have a general understanding of the application code that the customer had,” he recalls. locks.c (In the /developerworks/locks directory) in the downloaded compressed file is a code snippet that implements the Java Virtual Machine Profiler Interface (JVMPI ) read/write locks and a lot of debugging code. Linux developer representative
"Don't write system-specific code when the situation warrants it," says Murray
, but overcome the difficulties and "write good cross-platform code." code". Employed Murray insists that his greatest asset will always be "writing commercial-quality code, building and delivering network services, customizing OS or kernel, and completely based on a reliable open source platform" . The following is a code snippet from a cross-platform custom IMAP
server jointly developed by developers of Linux and MacOS X . The code implements a simple growing cache for handling strings. This avoids buffer overflow problems(don’t forget those security holes), without having to reallocate space every time you do something. It does this by maintaining a simple variable-length cache that can be filled and emptied. This cache has been used for an experimental IMAP server, which was completed by a team of intense workers for a week. In addition to the implementation of a simple string buffer, this code also implements a variable-sized string array. What it implements is a simple interface. After you finish writing a string, you can mark it and continue writing the next one. In addition, this will save space allocation and organize messy code together.
The code for the complete IMAP
server will be released sometime this year. Checklist 4.
Customized IMAP Server part#ifndef HOED_BUF_H
#define HOED_BUF_H
typedef struct {
char *str;
int size;
int length;
int str_start;
int max_size;
int n_strings;
int size_strings;
int *str_posn;
char **str_set;
} hoed_buf_t;
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
#define PRINTF(f, a) __attribute__((format (printf, f, a)))
#else
#define PRINTF(f,a)
#endif
extern hoed_buf_t *hoed_buf_alloc(int init_size, int max_size);
extern void hoed_buf_free(hoed_buf_t *);
extern void hoed_buf_reset(hoed_buf_t *);
extern void hoed_buf_new_string(hoed_buf_t *);
extern char **hoed_buf_get_set(hoed_buf_t *, int *n_string);
extern char *hoed_buf_put_char(hoed_buf_t *, char toadd);
extern char *hoed_buf_sprintf(hoed_buf_t *, const char *format,...)
PRINTF(2,3);
extern char *hoed_buf_strcat(hoed_buf_t *, const char *append);
extern char *hoed_buf_cat_sprintf(hoed_buf_t *, const char *format, ...)
PRINTF(2,3);
#endif /* HOED_BUF_H */
称为杀手级的 Linux 应用程序
对Murray 来说,有两个杀手级的 Linux 应用程序:Emacs 和 Netscape Navigator。“Emacs 或许是给人印象最深而且广为应用的基于 Linux 的应用程序”,他说。“另一个是 Netscape Navigator。有一次,我们要支持20多种 UNIX,我在 Linux 上完成了所有的工作”。
他继续说,“有趣的是,基于 Linux 的应用程序可能运行于许多不同风格的 UNIX 系统上,甚至安装了 Cygwin 的 Windows 系统。”
Linux 的未来如何?
当前,Murray 正在进行的 Linux 项目有好几个,从支持电子邮件、消息和共享数据库的分布式办公应用程序到使用标准工具的网络应用程序(标准工具包括:Apache/Tomcat, PHP, PostgreSQL, MySQL, 和 Linux)。 Murray 有他自己的公司专门为网络服务和网络应用提供主机服务。
对Murray 来说,得益于 Linux 强大功能的应用程序的列表在不断地增长。“有很多”,他说。“Oracle, WebSphere, Apache, PostgresQL, MySQL, Cyrus IMAP... 这个列表很长而且在不断增长。”
对 Murray 来说,Linux 到此为止了。“我们所有的服务器都运行 Linux;不管目标平台如何,我们主要的开发都在 Linux 上进行;我们把 Linux 推荐给用户来运行服务器应用程序”,他说。“ Linux 快速发展的步伐,开放源代码组织对它的广泛支持,低廉的开发费用,如果把这些结合在一起,您就知道它是一个难以击败的平台”。
免费领取LAMP兄弟连原创PHP教程光盘/《细说PHP》精要版,详情咨询官网客服:http://www.lampbrother.net
PHPCMS二次开发http://yun.itxdl.cn/online/phpcms/index.php?u=5
微信开发http://yun.itxdl.cn/online/weixin/index.php?u=5
移动互联网服务器端开发http://yun.itxdl.cn/online/server/index.php?u=5
JavascriptCoursehttp://yun.itxdl.cn/online/js/index.php?u=5
CTOTraining Camphttp:/ /yun.itxdl.cn/online/cto/index.php?u=5
The above introduces the development experience of senior Linux programmers, including aspects of content. I hope it will be helpful to friends who are interested in PHP tutorials.