# Two options:

Easy and Simple run with compiled 64bit executable version :

To build it by yourself:

• Unpack the tar file and cd into it
• Copy and Paste the patch into the source folder and apply it.  (Download at: ab_append_requests)
• $cd httpd-2.2.4/support/$ patch -p0 &lt; ~/ab_append_requests.patch
• Run ./configure –with-included-apr –enable-static-ab –enable-ssl (the first option will ignore the more recent copy of apr that’ll be on your machine already, and the second will build a static binary—well, not completely static, but good enough to be independent)
• make (you can specify -jn where n is the number of processor cores you have; this will speed up the build a lot)

# Instructions

use -R command with the URL file path and other parameters you want:

./ab -n 2 -R randomList.txt -c 2 -g /test/testgnu "http://api.wiki-health.org:55555/healthbook/v1/"


randomList.txt contains your URLs or parameters to be appended to the URL. For example:

max=10&amp;start=1406224391
max=100&amp;start=1406224391


The connections and requests will be sent to the URL one by one from the list.

Thanks to Chris, reference: http://chrismiles.livejournal.com/21720.html

# Language display errors in Linux/Apache Environments

Add the following line in .htaccess file.

# Redirect domain without www to domain with www using .htaccess 301 direct

Here is the solution for many of you maybe searching for:

Add the following lines to .htaccess file (create a new one if it doesn’t exist).

Note: its for Linux apache environment. Change the domain url as yours.

 RewriteEngine on RewriteCond %{HTTP_HOST} ^leonli\.co.uk$[NC] RewriteRule ^.*$ http://www.leonli.co.uk/$0 [NC,L,R=301]  # Technical Paper Writing Tips 1. Avoid use of passive tense if at all possible. Example: “In each reservation request message, a refresh interval used by the sender is included.” reads better and shorter as “Each … message includes …” 2. Use strong verbs instead of lots of nouns and simple terms rather than fancy-sounding ones. Examples: verbose, weak verbs, bad short, strong, good make assumption assume is a function of depends on is an illustration illustrates, shows is a requirement requires, need to utilizes uses had difference differed 3. Check for missing articles, particularly if your native tongue doesn’t have them. Roughly, concepts and classes of things don’t, most everything else more specific does. (“Routers route packets. The router architecture we consider uses small rodents.”) Don’t use articles in front of proper nouns and names (“Internet Explorer is a popular web browser. The current version number is 5.0. Bill Gates did not write Internet Explorer.”) [NEED POINTER HERE] 4. Each sentence in a paragraph must have some logical connection to the previous one. For example, it may describe an exception (“but,” “however”), describe a causality (“thus,” “therefore,” “because of this”), indicate two facets of an argument (“on the one hand,” “on the other hand”), enumerate sub-cases (“first,” “secondly”) or indicate a temporal relationship (“then,” “afterwards”). If there are no such hints, check if your sentences are indeed part of the same thought. A new thought should get its own paragraph, but still clearly needs some logical connection to the paragraphs that preceded it. 5. Protocol abbreviations typically do not take an article, even if the expanded version does. For example, “The Transmission Control Protocol delivers a byte stream” but “TCP delivers a byte stream,” since it an abstract term. (“The TCP design has been successful.” is correct since the article refers to the design, not TCP.) Note that abbreviations for organizations do take a definite article, as in “The IETF standardized TCP.” Since the “P” in TCP, UDP and similar abbreviations already stands for “protocol,” saying the “the TCP protocol” is redundant, albeit common. (LCD, Liquid Crystal Display, is another common case where many are tempted to incorrectly write LCD display. Indeed, Google references 2,060,000 instances of that usage.) 1. Use consistent tense – present, usually, unless reporting results achieved in earlier papers. 2. None: None can take either singular or plural verbs, depending on the intended meaning (or taste). Both none of these mistakes are common and none of these mistakes is common arecorrect, although other sources only lists the singular and The Tongue untied makes finer distinctions based on whether it refers to a unit or a measure. 3. Use hyphens for concatenated words: “end-to-end architecture,” “real-time operating system” (but “the computer may analyze the results in real time”), “per-flow queueing,” “flow-enabled,” “back-to-back,” … In general, hyphens are used • adding prefixes that would result in double vowels (except for co-, de-, pre-, pro-), e.g., supra-auditory; • all-: all-around, all-embracing; • half-: half-asleep, half-dollar (but halfhearted, halfway); • quasi-: quasi-public • self-: self-conscious, self-seeking (but selfhood, selfless) • to distinguish from a solid homograph, e.g., re-act vs. react, re-pose vs. repose, re-sign vs. resign, re-solve vs. resolve, re-lease vs. release • A compound adjective made up of an adjective and a noun in combination should usually be hyphenated. (WiT, p. 230) Examples: cold-storage vault, hot-air heating, short-term loan, real-time operating system, application-specific integrated circuit, Internet-based. • words ending in -like when the preceding word ends in ‘l’, e.g., shell-like 1. Don’t overuse dashes for separation, as they interrupt the flow of words. Dashes may be appropriate where you want to contrast thoughts very strongly or the dash part is a surprise of some sort. Think of it as a very long pause when speaking. In many cases, a comma-separated phrase works better. If you do use a dash, make sure it’s not a hyphen (- in LaTeX), but an em-dash (— in LaTeX). 2. Avoid scare quotes, as they indicate that the writer is distancing himself from the term. 3. Numbers ten or less are spelled out: “It consists of three fields,” not “3 fields”. 4. Use until instead of the colloquial till. 5. Use. Eq. 7, not Equation (7), unless you need to fill empty pages. 6. Optimal can’t be improved – more optimally should be better or maybe more nearly optimal. 7. Avoid in-line enumeration like: “Packets can be (a) lost, (b) stolen, (c) get wet.” The enumeration only interrupts the flow of thought. 8. Avoid itemization (bullets), as they take up extra space and make the paper read like PowerPoint slides. Bullets can be used effectively for emphasis of key points. If you want to describe components or algorithms, often the description environment works better, as it highlights the term, providing a low-level section delineation. 9. Instead of “Reference [1] shows” or “[1] shows,” use “Smith [1] showed” or “Smith and Jones [1] showed” or “Smith et al. [1] showed” (if more than two authors). “et al.” is generally used for papers with more than two authors. (Note that “et al.” makes the subject plural, so it is “Smith et al. [1] show” not “shows”.) Or, alternatively, “the foobar protocol [1] is an example …”. This keeps the reader from having to flip back to the references, as they’ll recognize many citations by either author name or project name. No need to refer to RFC numbers in the text (except in RFCs and Internet Drafts). Exception for very low-level presentation: “RFC822-style addresses”. 10. Use normal capitalization in captions (“This is a caption,” not “This is a Caption”). 11. All headings must be capitalized consistently, either in heading style, capitalizing words, or sentence style, across all levels of headings. Generally, captions for figures and tables are best left in sentence style. 12. Parentheses or brackets are always surrounded by a space: “The experiment(Fig. 7)shows” is wrong; “The experiment (Fig. 7) shows” is right. 13. Avoid excessive parenthesized remarks as they make the text hard to read; fold into the main sentence. Check whether the publication allows footnotes – some magazines frown upon them. More than two footnotes per page or a handful per paper is a bad sign. You probably should have applied to law school instead. 14. The material should make just as much sense without the footnotes. If the reader constantly has to look at footnotes, they are likely to lose their original place in the text. As a matter of taste, I find URLs better placed in the references rather than as a footnote, as the reader will know that the footnote is just a reference, not material important for understanding the text. 15. There is no space between the text and the superscript for the footnote. I.e., in LaTeX, it’s text\footnote{} rather than text \footnote{}. 16. Check that abbreviations are always explained before use. Exceptions, when addressed to the appropriate networking audience: ATM, BGP, ftp, HTTP, IP, IPv6, RSVP, TCP, UDP, RTP, RIP, OSPF, BGP, SS7. Be particularly aware of the net-head, bell-head perspective. Even basic terms like PSTN and POTS aren’t taught to CS students… For other audiences, even terms like ATM are worth expanding, as your reader might wonder why ATM has anything to do with cells rather than little green pieces of paper. 17. Never start a sentence with “and”. (There are exceptions to this rule, but these are best left to English majors.) 18. Don’t use colons (:) in mid-sentence. For example, “This is possible because: somebody said so” is wrong – the part before the colon must be a complete sentence. 19. Don’t start sentences with “That’s because”. 20. In formal writing, contractions like don’tdoesn’twon’t or it’s are generally avoided. 21. Be careful not to confuse its with it's (it is). 22. Vary expressions of comparison: “Flying is faster than driving” is much better than “Flying has the advantage of being faster” or “The advantage of flying is that it is faster.”. 23. Don’t use slash-constructs such as “time/money”. This is acceptable for slides, but in formal prose, such expressions should be expanded into “time or money” or “time and money,” depending on the meaning intended. 24. Avoid cliches like “recent advances in …” and “paradigm”. You do not want readers of your work to play buzzword bingo. 25. Don’t use symbols like “+” (for “and”), “%” (for “fraction” or “percentage”) or “->” (for “follows” or “implies”) in prose, outside of equations. These are only acceptable in slides. 26. Avoid capitalization of terms. Your paper is not the U.S. Constitution or Declaration of Independence. Technical terms are in lower-case, although some people use upper case when explaining an acronym, as in “Asynchronous Transfer Mode (ATM)”. 27. Expand all acronyms on first use, except acronyms that every reader is expected to know. (In a research paper on TCP, expanding TCP is probably not needed – somebody who doesn’t know what TCP stands for isn’t likely to appreciate the rest of the paper, either.) 28. Each paragraph should have a lead sentence summarizing its content. If this doesn’t work naturally, the paragraph is probably too short. Try reading just the first lines of each paragraph – the paper should still make sense. For example, There are two service models, integrated and differentiated service. Integrated service follows the German approach that anything that isn’t explicitly allowed is verboten. It strictly regulates traffic, but also makes the trains run on time. Differentiated service follows the Animal Farm appraoch, where some traffic is more equal than others. It seems simpler, until one has to worry about proletariat traffic dressing up as the aristocracy. 29.$i$th, not$i-th. 30. Units are always in roman font, never italics or LaTeX math mode. Units are set off by one (thin) space from the number. In LaTeX, use ~ to avoid splitting number and units across two lines. \; or \, produces a thin space. 31. For readability, powers of a 1,000 are divided by commas. 32. Use “kb/s” or “Mb/s,” not “kbps” or “Mbps” – the latter are not scientific units. Be careful to distinguish “Mb” (Megabit) and “MB” (Megabytes), in particular “kb” (1,000 bits) and “KB” (1,024 bytes). 33. It’s always kHz (lower-case k), not KHz or KHZ. Units and MeasurementsTaligent style guide 34. Use “ms,” not “msec,” for milliseconds. 35. Use “0.5” instead of “.5,” i.e., do not omit the zero in front of the decimal point. (Words into Type recommends that “for quantities less than one, a zero should be set before the decimal point except for quantities that never exceed one.”) 36. Avoid “etc.”; use “for example,” “such as,” “among others” or, better yet, try to give a complete list (unless citing, for example, a list of products known to be incomplete), even if abstract. See also Strunk and White: Etc.: Not to be used of persons. Equivalent to and the rest, and so forth, and hence not to be used if one of these would be insufficient, that is, if the reader would be left in doubt as to any important particulars. Least open to objection when it represents the last terms of a list already given in full, or immaterial words at the end of a quotation. At the end of a list introduced by such asfor example, or any similar expression, etc. is incorrect. 37. If you say, “for example” or “like,” do not follow this with “etc.”. Thus, it’s “fruit like apples, bananas and oranges”. The “like” and “for example” already indicate that there are more such items. 38. Avoid bulleted lists of one-sentence paragraphs. They make your paper look like a slide presentation and interfere with smooth reading. 39. Avoid excessive use of “i.e.”. Vary your expression: “such as,” “this means that,” “because,” …. “I.e.” is not the universal conjunction! 40. Remember that “i.e.” and “e.g.” are always followed by a comma. 41. Do not use ampersands (&) or slash-abbreviations (such as s/w or h/w) in formal writing; they are acceptable for slides. 42. “respectively” is preceded by a comma, as in “The light bulbs lasted 10 and 100 days, respectively.” 43. Thereforehoweverhence and thus are usually followed by a comma, as in “Therefore, our idea should not be implemented.” 44. Never use “related works” unless you are talking about works of art. It’s “related work”. 45. Similarly, “codes” refer to encryption keys, not multiple programs. You would say “I modified multiple programs,” not “multiple codes”. 46. Use “in Figure 1” instead of “following figure” since figures may get moved during the publication or typesetting process. Don’t assume that the LaTeX figure stays where you put it. 47. Text columns in tables are left-aligned, numeric columns are aligned on the decimal or right-aligned. 48. Section, Figure and Table are capitalized, as in “As discussed in Section 3”. Figure can be abbreviated as Fig., but the others are not usually abbreviated, but that’s a matter of taste – just be consistent. 49. Section titles are not followed by a period. 50. In LaTeX, tie the figure number to the reference, so that it doesn’t get broken across two lines: Fig.~\ref{fig:arch} 51. Do not use GIF images for figures, as GIFs produce horrible print quality and are huge. Export into PostScript. At that stage, you’ll learn to “appreciate” Microsoft products. xfig andgnuplot generally produce PostScript that can be included without difficulties. 52. Only use line graphs when you are trying to show a functional or causal relationship between variables. When showing different experiments, for example, use bar graphs or scatter plots. 53. Figures show, depict, indicate, illustrate. Avoid “(refer to Fig. 17)”. Often, it is enough to simply put the figure reference in parenthesis: “Packet droppers (Fig. 17) have a pipe to the bit bucket, which is emptied every night.” 54. If you quote something literally, enclose it in quotation marks or show it indented and in smaller type (“block quote”). A mere citation is not sufficient as it does not tell the reader whether you simply derived your material from the cited source or copied it verbatim. 55. Technical report citations must have the name of the organization such as the university or company. Conferences must cite the location. 56. Do not refer to colors in graphs. Most people will print the paper on a monochrome (black and white) printer and will have no idea what you are talking about. Make sure that graph lines are easily distinguishable when printing on a monochrome printer. 57. Do not forget to acknowledge your funding support. If you do forget, you may not have any to acknowledge in the future. 58. Check your references to make sure they are up to date. For example, Internet Drafts might have been replaced by RFCs and technical reports or workshop papers by conference or journal papers. 59. Conference references should contain the location of the conference, the month and some indication such as “Proc. of” or “Conference”. Journal references always contain the volume, issue number and pages. It must be obvious from the citation whether an article was in a journal or in a conference. 60. Avoid numbers with artificial precision. Unless you have done enough experiments to be sure that the value measured is indeed meaningful to five digits after the decimal point, you’re overstating your results. # Add/Modify custom Accept-Languages to Chrome/Firefox/IE for pseudolocalization testing ## In Firefox Use about:config (There is a typo in qps-ploc in the screenshots, but you surely get the idea) ## In Chrome Edit the file C:\Users\USERNAME\AppData\Local\Google\Chrome\User Data\Default\Preferences, and add: <code>{ ... "intl": { "accept_languages": "qps-ploc,en-us,en" }, ... } </code> For example: # Mp4 Mod h264 streaming setup for Lighttpd ## Download Lighttpd 1.4.19 & 1.4.20 (and other 1.4.x) Follow the instructions for ‘Download Lighttpd 1.4.18’ first. Then continue with the following steps. Download a source distribution (e.g. ​version 1.4.28), build and install your version of Lighttpd (from the official site) as you would do normally. The following instructions are basically a copy of the Lighttpd’s page of ​How to add a Lighttpd plugin. #### Prerequisites Make sure you have automake 1.9 (required by autogen.sh), autoconf 2.59 and libtool 1.5.x. #### Files Copy the module’s files from the 1.4.18 source distribution to your source distribution (lighttpd-1.4.x). cp lighttpd-1.4.18/src/mod_h264_streaming.c lighttpd-1.4.x/src/ cp lighttpd-1.4.18/src/mod_streaming_export.h lighttpd-1.4.x/src/ ... see below for a list of all the files to copy ... cp lighttpd-1.4.18/src/output_mp4.* lighttpd-1.4.x/src/ #### Makefile First you add the following to the lighttpd-1.4.x/src/Makefile.am file: lib_LTLIBRARIES += mod_h264_streaming.la mod_h264_streaming_la_SOURCES = mod_h264_streaming.c \ mod_streaming_export.h \ moov.c moov.h \ mp4_io.c mp4_io.h \ mp4_reader.c mp4_reader.h \ mp4_writer.c mp4_writer.h \ mp4_process.c mp4_process.h \ output_bucket.c output_bucket.h \ output_mp4.c output_mp4.h mod_h264_streaming_la_CFLAGS =(AM_CFLAGS) -DBUILDING_H264_STREAMING
mod_h264_streaming_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined
mod_h264_streaming_la_LIBADD = $(common_libadd) (for example, just after ‘mod_flv_streaming’) Then, you type this: ./autogen.sh ./configure --enable-maintainer-mode --prefix=${HOME}/test/lighttpd-1.4.x

in the lighttpd-1.4.x directory. The ‘enable-maintainer-mode will trigger a rebuild of all makefiles by autoconf …

Note: You may not see the plugin listed in the ‘Plugins: enabled:’ list. No reason to worry.

After this you are all set and should type ‘make && make install’ – the exe+libs will be installed in ${HOME}/test/lighttpd-1.4.x. ## Download Lighttpd 1.5.0 cd ~ wget http://h264.code-shop.com/download/lighttpd-1.5.0_mod_h264_streaming-2.2.9.tar.gz tar -zxvf lighttpd-1.5.0_mod_h264_streaming-2.2.9.tar.gz ## Build Run configure in the Lighttpd directory. cd ~/lighttpd-1.4.18 ./configure Make and install Lighttpd. make sudo make install ## Configuration Edit the configuration file (in /etc/lighttpd/lighttpd.conf) so that file requests ending in “.mp4” are handled by the mod_h264_streaming module. server.modules = ( ..., "mod_h264_streaming", ... ) h264-streaming.extensions = ( ".mp4" ) Make sure that DAEMON in your startup script (/etc/init.d/lighttpd) is set to point to the locally build version. DAEMON=/usr/local/sbin/lighttpd Start Lighttpd sudo /etc/init.d/lighttpd start ## Advanced configuration Two other modules that you may consider using are mod_expire and mod_secdownload. The order of the modules in your configuration is important. If you are using mod_secdownload to prevent hotlinking of your mp4 files make sure that it is included before the mod_h264_streaming in the module list. server.modules = ( "mod_expire", "mod_secdownload", "mod_h264_streaming", etc... } Bandwidth shaping is enabled by setting the h264-streaming.buffer-seconds option. # Files ending in .mp4 and .f4v are served by the module h264-streaming.extensions = ( ".mp4", ".f4v" ) # The number of seconds after which the bandwidth is shaped (defaults to 0=disable) h264-streaming.buffer-seconds = 10 Also add an Expires/Cache?-Control header for your video files, so video files can be cached by webbrowsers or a CDN provider. # Add Expires/Cache-Control header$HTTP["url"] =~ "\.(mp4|f4v)\$" {
expire.url = ( "" =&gt; "access 8 hours" )
}

secdownload.secret          = "secret"
secdownload.timeout         = 3600
cp lighttpd-1.4.18/src/mod_h264_streaming.c lighttpd-1.4.x/src/ cp lighttpd-1.4.18/src/mod_streaming_export.h lighttpd-1.4.x/src/ cp lighttpd-1.4.18/src/moov.c lighttpd-1.4.x/src/ cp lighttpd-1.4.18/src/moov.h lighttpd-1.4.x/src/ cp lighttpd-1.4.18/src/mp4_io.c lighttpd-1.4.x/src/ cp lighttpd-1.4.18/src/mp4_io.h lighttpd-1.4.x/src/ cp lighttpd-1.4.18/src/mp4_reader.c lighttpd-1.4.x/src/ cp lighttpd-1.4.18/src/mp4_reader.h lighttpd-1.4.x/src/ cp lighttpd-1.4.18/src/mp4_writer.c lighttpd-1.4.x/src/ cp lighttpd-1.4.18/src/mp4_writer.h lighttpd-1.4.x/src/ cp lighttpd-1.4.18/src/mp4_process.c lighttpd-1.4.x/src/ cp lighttpd-1.4.18/src/mp4_process.h lighttpd-1.4.x/src/ cp lighttpd-1.4.18/src/output_bucket.c lighttpd-1.4.x/src/ cp lighttpd-1.4.18/src/output_bucket.h lighttpd-1.4.x/src/ cp lighttpd-1.4.18/src/output_mp4.c lighttpd-1.4.x/src/ cp lighttpd-1.4.18/src/output_mp4.h lighttpd-1.4.x/src/ install pkg-config before running autogen.sh apt-get install pkg-config apt-get install autogen apt-get install automake apt-get install libltdl-dev apt-get install make
apt-get install libbz2-dev
apt-get install libpcre3-dev

apt-get install zlib1g-dev
./autogen.sh
./configure --enable-maintainer-mode --prefix=/usr/local/lighttpd-1.4.32
make
make install
apt-get install php4-cgi
<strong> install pkg-config before running autogen.sh

aptitude install sendmail
</strong>

# Install PHP Memcached on CentOS 5

yum reinstall php-pear

yum install memcached

pecl install memcache

Then add the memcache extension to your php.ini file, usually at /etc/php.ini.

extension=memcache.so

/etc/init.d/httpd restart

# “/etc/mtab is not writable”, “read-only file system”, Linux, Virtual Machine Problem Solution

if you are experiencing problems with Linux or Linux Virtual Machines as:

"read-only file system"

on file operations or

 "/etc/mtab is not writable"

on return of typing command “mount”.

Errors are like this:

mount: warning: /etc/mtab is not writable (e.g. read-only filesystem).

It's possible that information reported by mount(8) is not

up to date. For actual information about system mount points

check the /proc/mounts file.

Solution:
Run fsck to fix the device disk, then reboot afterwards

fsck  /dev/sda1

# Install and Configure FTP(Vsftpd) service in CentOS/Linux

Q. How do I configure and install an FTP server in CentOS / RHEL 5 / Fedora Linux server?
A. CentOS / RHEL server comes with vsftpd which is the Very Secure File Transfer Protocol (FTP) daemon. The server can be launched via a xinetd or as standalone mode, in which case vsftpd itself will listen on the network port 21.

[root@leonli.co.uk ~]# yum -y install vsftpd
[root@leonli.co.uk ~]# vi /etc/vsftpd/vsftpd.conf
# line 12: no anonymous
anonymous_enable=NO
# line 80,81: uncomment ( allow ascii mode )
# line 95, 96: uncomment ( enable chroot )
chroot_local_user=YES
chroot_list_enable=YES
# line 98: uncomment ( specify chroot list )
chroot_list_file=/etc/vsftpd/chroot_list
# line 104: uncomment
ls_recurse_enable=YES
# add at the last line
# specify root directory ( if don't specify, users' home directory become FTP home directory)
local_root=public_html
# use localtime
use_localtime=YES
[root@leonli.co.uk ~]# vi /etc/vsftpd/chroot_list
# add users you allow to move over their home directory
cent
[root@leonli.co.uk ~]# /etc/rc.d/init.d/vsftpd start
Starting vsftpd for vsftpd: [  OK  ]
[root@leonli.co.uk ~]# chkconfig vsftpd on


# Session factory for Hibernate 4 using buildSessionFactory and ServiceRegistry

In Hibernate 3:

private static SessionFactory factory;
Configuration config = HibernateUtil.getInitializedConfiguration();
factory = config.buildSessionFactory();
Session session = factory.getCurrentSession();

In Hibernate 4:
You need to pass a ServiceRegistry class to buildSessionFactory:

Configuration config = new Configuration().configure("hibernate.cfg.xml");
Session session = factory.getCurrentSession();
ServiceRegistry serviceRegistry = new ServiceRegistryBuilder().configure().buildServiceRegistry();