Experience in the development of senior Linux programmers

Source: Internet
Author: User
Tags ftp site imap
since - century the First Use in the middle of the decade SunOS supported by VI in this concise environment, Emacs the editor has become Murray Standard Tools. " It's in a variety of genres UNIX , which is one of the main reasons why I chose it when I was working on cross-platform development, "he said.

Linux Development people: Get to know your Shell

Murray ask you to understand your Shell . "Bash,tcsh,csh-Shell is your most basic software development tool", He stressed that. "It can do a lot of great things. All the work depends on it ... and its powerful features. " As a powerful example of a generic shell script, there is a downloadable file in the Resources section with a set of scripts to get updates from Red Hat releases RPM packages and incorporate them into the original packages and custom packages. After downloading the file and extracting it, you can find the script in the /developerworks/rpm_update_scripts directory. The end result is a directory with the latest version of all packages and an upgraded Hdlist file for network installation .

The following code fragment implements the Red Hat RPM automatically update the package to create a new one using the latest RPM version that can be installed. This is a basic step for anyone who maintains a public Linux server. As far as we are concerned, we usually maintain A large number of network services on many public Linux servers. Here is a partial script that automates the process of updating the latest security and functionality.

The following script illustrates the common Shell programming technology can be widely used in various system configuration and programming applications. The script uses the Bourne shell, which is the most common shellon different UNIX systems. This ensures that these very lightweight code can be modified or unmodified to be used on different UNIX systems. It is easy to modify the specifications of the Red Hat package to apply to other Linux distributions.

freshen.sh using the specified RPM FTP Update on the site RPM package to update the original RPM list. Executes the filter to replace the update RPM package. Finally, the long release list is updated based on the new RPM package that was obtained from the update Mirror site .

Checklist 1. fresh.sh

#!/bin/sh

Rh_ver=$1

Rh_path=$2

Update_dir=${rh_path}/rh${rh_ver}-updates

Custom_dir=${rh_path}/rh${rh_ver}-custom

Install_dir=${rh_path}/rh${rh_ver}-install

# sanity check for the original directory.

# Create Update and install directories if they don ' t exist

[-D ${update_dir}] | | mkdir ${update_dir}

[-D ${install_dir}/redhat/rpms] | | Mkdir-p ${install_dir}/redhat/rpms

# Get latest updates from fresh RPMs FTP site

./get_update.sh ${rh_ver} ${update_dir}

# create/update Hardlinks from update, and custom directories

# to the install directory. We assume that original RPMS is already

# hardlinked to the "install directory, so all we need" to "filter"

# out of 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.

./filter-rpms.pl $install _dir/redhat/rpms

# Rebuild the hard disk lists

/usr/lib/anaconda-runtime/genhdlist ${install_dir}

freshen.sh called do-links.sh and the get_update.sh , respectively, to set RPM the source of the release, the Homestay ( the source rpm software package is omitted; hard links are used to set the destination rpm) and retrieve updates.

Checklist 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

Checklist 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 and the Linux

in the codemonks , quite a lot of development work is done in Linux on Use Java completed. The combination of these two tools provides a platform for creating business-quality Web applications,Murray said. "In the course of doing these projects, we found that we were going to have an overall understanding of the customer's existing application code," he recalls. locks.c ( under the /developerworks/locks directory in the downloaded compressed file ) is a code fragment that implements the Java Virtual Machine Profiler Interface (JVMPI) the Read / write locks and a lot of debugging code.

Linux representative of the developer

"Do not write system-specific code when circumstances permit," Murray say, but overcome the difficulties to "write good cross-platform code." The hired Murray insists that his greatest capital will always be "writing commercially-quality code, building and delivering Web services, customizing the OS or kernel, and completely based on a reliable open-source platform".

here is a code snippet from a cross-platform custom IMAP server, this server is made up of Linux and the MacOS X Developed by developers. The code implements a simple growth cache that is used to process strings. This avoids the problem of cache overflow ( Don't forget those security holes ), and it's not necessary to reallocate space every time you do something. It is implemented 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 that worked nervously for a week.

In addition to a simple implementation of a string buffer, this code implements a variable-sized array of strings. It does a simple interface, and when you finish writing a string, you can mark it and then continue to write the next one. In addition, this saves space allocations and organizes the messy code together.

Full- IMAP The server's code will be released at some time this year.

Checklist 4. Custom 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 */

It 's called the killer level. Linux Application

the Murray , there are two killer-level Linux Application: Emacs and the Netscape Navigator . "Emacs is probably the most impressive and widely used Linux -based application," he says. "The other is Netscape Navigator. Once, we wanted to support more than one UNIX, and I did all the work on Linux. "

He went on to say, "Interestingly, based on Linux applications may run in many different styles of UNIX on the system, even installed the Cygwin of the Windows System. "

Linux the future of how ?

Currently, Murray is in progress. Linux several projects, from distributed Office applications that support e-mail, messaging, and shared databases to Web applications that use standard tools ( standard tools include:apache/tomcat, PHP, PostgreSQL, MySQL, and Linux) . Murray has his own company that specializes in hosting services for Web services and Web applications.

the Murray , thanks to Linux The list of powerful applications continues to grow. "There are many," he said. "Oracle, WebSphere, Apache, PostgresQL, MySQL, Cyrus IMAP ... This list is long and growing. "

the Murray speaking, Linux That 's it. "All of our servers are running Linux; Our main development is on Linux regardless of the target platform ; we put Linux Recommend to users to run server applications, "he said. " the pace of rapid development of Linux, open source organization of its broad support, low development costs, if you combine these together, you know it is a difficult platform to beat."

Free pick up LAMP brother Lian Original PHP Tutorials CD / the About PHP "Essentials Edition, details of the consultation website customer service: http://www.lampbrother.net

Phpcms Two-time development http://yun.itxdl.cn/online/phpcms/index.php?u=5

Development http://yun.itxdl.cn/online/weixin/index.php?u=5

Mobile Internet server-side development http://yun.itxdl.cn/online/server/index.php?u=5

Javascript Courses http://yun.itxdl.cn/online/js/index.php?u=5

CTO Training Camp http://yun.itxdl.cn/online/cto/index.php?u=5

The above describes the experience of the development of senior Linux programmers, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.