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

SEARCH KEYWORD -- timeout



  Set PHP session timeout

There are many different discussions about PHP sessions. We may often face some weird issues while handling PHP sessions. Sometimes session is expired earlier than expected. Or sometimes the session is not expired. This introduces many confusions. Today we discuss how to set PHP session timeout correctly today. In php.ini, there are three key parameters which will affect the session timeout. session.gc_maxlifetime, session.gc_probability and session.gc_divisor. session.gc_maxlifetime defined the...

   PHP,session,timeout     2013-08-31 08:11:03

  Resolve high CPU usage issue caused by file_get_contents in PHP

Sometimes a Linux server which runs Nginx + PHP-CGI(php-fpm) web service may experience sudden system load increase and the CPU usage is around 100% for many php-cgi processes when checking with top command. If this happens, file_get_contents may be the cause if it's used in the PHP script. In lots of web applications, normally there are lots of API requests based on HTTP. Many PHP developers like to use file_get_contents("http://example.com/") to get the API response because it's simple to...

   PHP,FILE_GET_CONTENTS,PHP-CGI     2018-11-09 21:35:00

  JavaScript tutorial - Creating time delays

There are two ways of creating time delays with JavaScript. The first is more simple and will simply wait for a specified amount of time before executing a function. The second does the same but will repeatedly execute the function. Note, many browsers have a minimum delay length of between 25 and 75 ms, with some of the fastest browsers having a minimum delay of about 3 ms. If a shorter delay is specified, the actual delay will be the minimum delay length. Even with higher numbers, the delay i...

   JavaScript,Time delay,setTimeout,setInterval     2012-04-13 07:17:46

  What you may not know about PHP session

When we access one website, the site usually should have a mechanism to keep track of the status of the user on the site. There are a few mechanisms supported by many server side languages to help track user status such as session and cookie. Today we will talk about session, when creating a session, we need to keep track of many data, besides user data, we also need to tell the server what is the timeout of the session so that we can garbage collect the session data which should not be stored a...

   PHP session,session timeout,example     2013-07-06 08:44:18

  Java Concurrency Basics: CountDownLatch and CyclicBarrier

CountDownLatch CountDownLatch can be used in synchronizing behavior among threads, it makes one or more threads wait for some actions in other threads to be completed. It has a property count which defines how many countDown() need to be called before other threads which called await() to be waked up.  When a thread calls CountDownLatch.await(), the thread will be blocked until the value of count becomes 0. The initial value of count can be specified when creating the CountDownLatch instanc...

   JAVA,JAVA CONCURRENCY,COUNTDOWNLATCH,CYCLICBARRIER     2018-03-25 07:02:40

  Handle NXDomain error when resolving IP address in Ruby DNS resolver

In another post, we covered how to resolve SystemStackError when resolving IP address in Ruby. In this post, we would cover another common issue where a NXDomain error is returned when resolving an IP address. The NXDomain error means that the queried domain name does not exist in the DNS. In Ruby, DNS resolver library will use /etc/resolv.conf by default get the name servers to resolve the domain name. There are multiple DNS name servers can be specified in /etc/resolv.conf with below format. ...

   RUBY,RUBY ON RAILS,NETWORK,DNS,NXDOMAIN     2017-07-16 01:39:23

  Some tricks on PHP session

1. Session timeout problem There is a nuance we found with session timing out although the user is still active in the session.  The problem has to do with never modifying the session variable. The GC will clear the session data files based on their last modification time.  Thus if you never modify the session, you simply read from it, then the GC will eventually clean up. To prevent this you need to ensure that your session is modified within the GC delete time.  You can accomp...

   PHP,Session,Timeout,Solution,Various domain     2015-03-13 07:05:37

  What can select do in GoLang

In Go language, select is a keyword used to listen to and perform IO operations related to channels. With the select statement, we can simultaneously listen to multiple channels and perform corresponding operations when any of the channels are ready. This article will summarize the common uses of the select statement and provide some considerations when using it. Basic syntax The basic syntax of the select statement is as follows: select { case <-channel1: // when channel1 has data to ...

   GOLANG,SELECT,USAGE,SYNTAX,TUTORIAL     2023-08-12 20:17:02

  XMLHttpRequest Level 2 user guide

XMLHttpRequest is a web browser interface, it makes it possible for JavaScript doing HTTP(s) communication. Microsoft's IE5 first introduced XMLHttpRequest, because it's so useful that many other browsers also adopted this. AJAX came to the front since. However, this interface is not standardized, implementation among different browsers is different, with the emerging of HTML5, W3C is considering to standardize this interface. In February 2008, they proposed a XMLHttpRequest Level 2 draft. This ...

   XMLHttpRequest, progress, upload, binary data     2012-09-19 11:51:50

  Server monitoring shell scripts

There are many open source server monitoring software such as cacti and nagios. Besides these, can we write our own shell scripts to monitor them? The shell scripts written by ourselves can fulfill our special requirements better and have a more detailed coverage. Below are some commonly used shell scripts used by Evangelist, an Oracle DBA. 1. Check network gateway traffic #!/bin/bash #network #Mike.Xu while : ; do time='date +%m"-"%d" "%k":"%M' day='date +%m"-"%d' rx_before='...

   Server monitor,CPU,memory,shell     2013-08-30 21:56:14