If you find that your global $_SESSION variable is empty there can be several reasons, here are a few:
session.save_path is invalid (does not exist) or is not writable.
session.cookie_secure is set to true but you not using a secure site (SSL/https).
session.cookie_domain is set to a domain that does not match your site – very common if setting up a dev or test environment from a production site with a public domain.
I’ve had this issue on OSX Mavericks and Yosemite on soapUI 5.x versions. Here’s a fix that disables the browser in soapUI which seems to cause it to hang.
/Applications/SoapUI-5.2.0.app/Contents/ (adjust to suit your version).
vmoptions.txt and add line:
/Applications/SoapUI-5.2.0.app/Contents/java/app/bin (adjust to suit your version)
soapUI.sh and uncomment line:
You can find the session.save_path through php info or using the command line:
php -i | grep save_path
Once you have that, you clear PHP sessions by going into that path and clearing out the relevation session files.
Say you have a variable that comprises of another variable like so:
The above won’t work as bash will interpret the underscore after
$var_name as part of the variable name and look for a variable called
$var_name_and_extension and not find it.
Two ways to solve this:
Enclose in curly braces as follows:
Use double quotes to delineate between the variable name and the string:
The following grep command will search for any constants such as
define('CONSTANT', 1) within your PHP code base so you can see their values. Useful as many applications store the constant’s value in the database and not the constant’s friendly name.
This requires regular expressions, hence the use of egrep.
egrep --include *.php "(define)(.*)" -r *
Found this morning that my Mac Slack client (v1.13, build 2813) kept on crashing on start up (I’m running Mac OSX 10.9 Mavericks). It was working fine until the latest Mac update (Security Update 2015-006 version 1.0 18/08/2015).
The crash reporter tells me something along the lines of this:
Application Specific Information:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not make an sqlite3 statement for: CREATE TABLE IF NOT EXISTS downloads (team TEXT NOT NULL, token TEXT NOT NULL, href TEXT NOT NULL, state TEXT NOT NULL DEFAULT 'pending', http_status TEXT NOT NULL DEFAULT '', file_path TEXT NOT NULL DEFAULT '', file_exists TEXT NOT NULL DEFAULT 'false', mime_type TEXT NOT NULL DEFAULT '', start_ts TEXT NOT NULL DEFAULT '', end_ts TEXT NOT NULL DEFAULT '', base64_png TEXT NOT NULL DEFAULT ''); | (
terminating with uncaught exception of type NSException
Uninstalling/reinstalling didn’t fix the issue. I ended up deleting the following folder in my home directory:
This obviously holds some sort of data, so I’m not sure of the entire consequences of doing this. For a start, you need to sign into all your accounts again. It doesn’t appear to impact your slack history or anything like that.
Use the following formula to get the day of the week (e.g. Friday) for the given date field:
WEEKDAY function returns the day of the week as a number (1-7) and the
TEXT function formats that number into the corresponding text value for that day of the week e.g. 1=Sunday…7=Saturday.
str_to_date function and provide the format you need to it. for example, if you have a field called
created_dttm with a date which is in the format “24-07-2015 06:00:00” you can use this to convert into a MySQL date so that you use various MySQL date functions on it.
select str_to_date(created_dttm, '%d-%M-%Y %H:%i%s');
See this list for all the date formats.
Current date/time to Unixtime (to the nearest second, hence the trunc):
select trunc(extract(epoch from now()));
Note this will include your timezone.
Unix time stamp to PostgreSQL timestamp
select to_timestamp(<unix timestamp>)
I have an ASUS AC68U wireless router and lLgitech G930 wireless headset, and I kept finding that my headset with drop out. After some research, I came to the conclusion that I should try changing the wireless control channel on my router.
The control channels range from 1 to 11, so the best options to avoid interference are 1, 6 or 11 (i.e either end or the middle of the spectrum). I tried 11, then 6 and both weren’t much better, however control channel 1 seemed to do the trick. You can tell it works because a restart of the wireless on the router after changing the channel would cause a drop out, and this happened immediately on channels 6 and 11, but not on 1.