PHP: str_word_counter does not count numerals
Realized that str_word_counter() does not count numerals (just numbers alone without alphabets) as a word.
The manual’s expression is:
mixed str_word_count ( string $string [, int $format = 0 [, string $charlist ]] )
If we supply “ab cd ef”, then the function returns 3, and if we supply “11 22 ab”, then it would be 1 since the function just ignores the numerals only value. The workaround (although it is not a bug or anything. It is a feature.) is to use the “$charlist”.
str_word_count ( string $string [, int $format = 0 , “0123456789” )
Then the numerals will be treated as letters.
Cygwin: nslookup/dig command error : “;; communications error: connection reset”
If you receive following error when execute nslookup or dig command:
;; communications error: connection reset
You have one option if it is for “dig” command. There are two options if it is for “nslookup” command.
For “dig” and “nslookup” command, setup /etc/resolv.conf
For “nslookup”, the another solution is to use “/cygdrive/c/WINDOWS/system32/nslookup.exe” instead of “/bin/nslookup.exe” without creating a resolv.conf entries
Cygwin: how to look up which package includes the command
This is really becoming our memo….
#will open a new window
When you need to lookup which packages to install to use certain commands/find files within the cygwin package, use the following submit form:
Cygwin: How to setup tftpd
Make sure you have setup inetd already.
create a root directory for tftpd:
$ mkdir /tftpboot
Edit /etc/inetd.conf
(before)
#tftp dgram udp wait nobody /usr/sbin/in.tftpd in.tftpd
(after)
tftp dgram udp wait root /usr/sbin/in.tftpd in.tftpd -s -p /tftpboot
# If you changed the root directory for tftpd, then the above line needs to be modified accordingly.
Restart cygwin inetd service:
$ net stop inetd $ net start inetd
Check if the tftpd is working
$ netstat -a | grep tftp UPD MyServer:tftp *:*
Cygwin: How to setup inetd
(You have to have administrative privileges.)
Make sure you have set system PATH to cygwin binary directory: “My Computer” (right click) –> “properties” –> “Advanced” tab –> “Environment Variables” button on the bottom right above the “OK” button.
Register your cygwin inetd service to Windows’ service:
$ /usr/sbin/inetd --install-as-service
(The dollar sign above is a prompt)
Then start the inetd service:
$ net start inetdor
$ cygrunsrv -S inetd