Today's Question:  What does your personal desk look like?        GIVE A SHOUT

SEARCH KEYWORD -- Local dev



  One reason why mcrypt responds slowly

This morning one colleague came over and talked about one script which used mcrypt responded very slowly, the server configurations are fine. But the reason for the slowness is unknown. Here is one script which reproduces the issue: <?php $dmcryptText = "dummy"; $key = "foobar"; $size = mcrypt_get_iv_size(MCRYPT_BLOWFISH,MCRYPT_MODE_ECB); $iv = mcrypt_create_iv($size); //Take care $m = mcrypt_ecb(MCRYPT_BLOWFISH, $key, $dmcryptText, MCRYPT_DECRYPT, $iv); var_dump($m); When 20 requests of&...

   SOLUTION,SLOW,MCRYPT,RESPONSE,PHP     2012-09-27 12:03:16

  /dev/null and /dev/tty in Linux

In Linux, there are two special files /dev/null and /dev/tty. /dev/null will drop all the data written to it, i.e, when program writes data to this file, it means the program has completed the data write operation. But in  fact it does nothing, if you just want the status of a command but not the output of a command, this feature will be very useful. See below shell codes:     /> vi test_dev_null.sh        #!/bin/bash    if grep...

   Linux,/dev/null,/dev/tty     2013-03-04 02:23:23

  bash network interface

Some of us may have seen /dev/tcp/<host>/<port> before, is this a special file system implemented in some BSD kernel? Because there is no /dev/tcp in Linux. Actually, this one is implemented in bash. We no need to rely on wget,nc to do network connection. It's very easy to use this interface: bash-4.2$ cat </dev/tcp/time.nist.gov/13 56188 12-09-18 15:34:26 50 0 0 733.5 UTC(NIST) * bash-4.2$ exec 3<>/dev/tcp/www.w3.org/80 bash-4.2$ echo -e "GET / HTTP/1.0\n\n" >&3 b...

   Bash,Network interface,/dev/tcp     2013-07-20 00:57:52

  The Future of JavaScript � take a peek today!

The ECMA committee is working hard on designing the next version of JavaScript, also known as "Harmony". It is due by the end of next year and it is going to be the most comprehensive upgrade in the history of this language. Chrome and V8 are committed to pushing JavaScript forward and have already started implementing the new features. You can try some of them today in the latest dev channel release. Here’s a summary: Lexical scoping. Now "let" is the new "var" – traditional "var...

   JavaScript,Future,Feature     2012-02-12 04:56:37

  Difference between localhost and 127.0.0.1

Lots of people would think what the address 127.0.0.1 is when first seeing this address. In fact, 127.0.0.1 is a loopback address which refers to the local machine. It is generally used for local testing. When typing ping 127.0.0.1 on local command console, it will send network packets to local IP/TCP layer to test whether IP/TCP works properly or not.  To those who are used to use localhost, it is actually mapped to 127.0.0.1 by default. There are hosts files in the system which store this...

   LINUX,NETWORK,LOCALHOST,127.0.0.1,LOCALHOST VS 127.0.0.1     2018-09-29 22:11:12

  How to use Chome dev tool to find event handler bound to an element

As a front end developer, there is frequent need to debug JS code and sometimes need to find out what event handler has been bound to a HTML element. In this post, we will show how to find out the click event handler bound to a HTML element, this same applies to other events as well. Nowadays, a web application is usually very complicated and there are lots of JS codes which makes it difficult to find out what click event handler has been bound to a HTML element, especially when the JS source co...

   JAVASCRIPT,CHROME,CHROME DEV TOOL,EVENT LISTENER     2019-08-17 22:14:36

  Check whether a remote server port is open on Linux

As a system administrator or network engineer or application developer, there is a need to check whether a port on remote server is open so that you can tell whether the service under check is running or not. In this post, we would cover a few methods to check whether a remote server port is open or not on Linux. telnet telnet is the most frequently used command on both Windows and Linux to check port. The simple usage for this command is  telnet [host] [port] When the port is open, the o...

   LINUX,TELNET,PORT,NC,NMAP     2017-12-23 11:45:20

  strange thing in PHP session variable and local variable

A few minutes ago, I noticed one strange thing when I did my PHP web application development.The situation is described below:I want to display a user's profile using a query parameter user=user_id as the parameter. And also the session variable when user logs in  is $_SESSION["user"].So before displaying the user's profile, I need to either get the query string parameter user and create a local variable called $user and assign value to it as $user=$_REQUEST["user"].Here comes the strange t...

   PHP,session,variable name,change automat     2011-06-13 12:23:59

  About tmpfs

tmpfs is another confusing name in Linux kernel, its implementation is in mm/shmem.c, shmem has no relation to tmpfs at first glance although we know tmpfs is based on memory. We can understand why we use this name by seeing where this is used. In a desktop Linux system, tmpfs is loaded usually: % grep tmpfs /proc/mountsdevtmpfs /dev devtmpfs rw,seclabel,nosuid,relatime,size=1958956k,nr_inodes=489739,mode=755 0 0tmpfs /dev/shm tmpfs rw,seclabel,nosuid,nodev,relatime 0 0tmpfs /run tmpfs rw,seclab...

   tmpfs,Linux,file system     2013-06-14 12:10:56

  37 powerful Linux shell commands

To work on Linux platform, you cannot avoid using shell commands to complete some tasks. These tasks can be as simple as list files in some directories or find some text in some file, or can be as complex as monitoring processes. In this post, we will share 37 powerful Linux shell commands.   Task Commands 1 Delete file with 0 byte(empty file) find . -type f -size 0 -exec rm -rf {} \;find . type f -size 0 -delete 2 Check process memory consumption ps -e -o "%C : %p : %z : %a"|sort -k...

   Linux command,List     2013-09-16 07:47:16