Archive for June, 2009
PHP Session not being passed from a web site to WordPress
Posted by Rui Miguel Feio in PHP, WordPress on June 30th, 2009
Recently I had this case where a PHP session ($_SESSION) was not being passed from a web site to WordPress.
Basically, WordPress was installed and configured to be part of a web site and there was the need to use Sessions to control the login/logout process of the site.
Although the session_start() had been defined to WordPress, the latter did not recognize the session values and therefore simply ignored if a user was logged on.
After some research and some brainstorming with some great experts on the field, I realized that the problem was in the WordPress URL itself.
The problem was that although the domain was the same, WordPress was suppressing the “www” from the URL which caused the $_SESSION values not to be recognized.
Example:
Site URL: http://www.this-is-an-example.com
WP URL: http://this-is-an-example.com (missing the “www.”)
Solution:
By adding the “www.” to the WordPress domain name the problem was solved:
- Login to WordPress Admin area
- Go to Settings – General
- Add “www.” to the WordPress address (URL) and Blog address (URL).
Update Linklist dynamically
Posted by Rui Miguel Feio in MVS on June 29th, 2009
Some people dread the idea of having to update the Linklist dynamically but in fact it’s a very simple process:
- Update the PROGxx member that your system uses from PARMLIB:
- Add/remove libraries as required
- Change the LNKLSTnn reference to LNKLSTnn+1
- Issue the following MVS commands:
- SETPROG LNKLST,UNALLOCATE
- P LLA
- SET PROG=xx
- S LLA,SUB=MSTR
- SETPROG LNKLST,ALLOCATE
- SETPROG LNKLST,UPDATE,JOBNAME=*
- To make sure the libraries have been added /removed from the Linklist, issue the MVS command: D PROG,LNKLST
Example:
Let’s suppose your system is using SYS1.PARMLIB(PROG00) and the Linklist area in use is LNKLST00.
These would have to be the steps to follow:
- Edit SYS1.PARMLIB(PROG00) and add/remove the libraries you want from the Linklist area.
- Change all LNKLST00 references in SYS1.PARMLIB(PROG00) to LNKLST01.
- Issue the following MVS commands:
- SETPROG LNKLST,UNALLOCATE
- P LLA
- SET PROG=00
- S LLA,SUB=MSTR
- SETPROG LNKLST,ALLOCATE
- SETPROG LNKLST,UPDATE,JOBNAME=*
- D PROG,LNKLST
Note:
Click here to check why we need to stop LLA and unallocate the LNKLST.
Display PARMLIB concatenation
Posted by Rui Miguel Feio in MVS on June 29th, 2009
An LPAR can have more then one PARMLIB dataset defined to it’s concatenation.
The PARMLIB concatenation is defined on the LOADxx member and we can use the MVS command “D PARMLIB”to list it.
Example:
“D PARMLIB” command returns:
RESPONSE=LP1T
IEE251I 08.54.47 PARMLIB DISPLAY 825
PARMLIB DATA SETS SPECIFIED
AT IPL
ENTRY FLAGS VOLUME DATA SET
1 S LPCT01 SYS1.PARMLIB
2 S LPCT01 CPAC.PARMLIB
3 S LPRS01 SYS1.IBM.PARMLIB
Work with records older then x days
Posted by Rui Miguel Feio in MySQL on June 29th, 2009
For the sake of this example, let’s assume that:
- we want to work with records older then 60 days
- the table name is ‘table’ (how original!)
- the table field with dates is called date_field
DELETE FROM table WHERE date_field < DATE_SUB(CURDATE(),INTERVAL 60 DAY)
This MySQL command deletes all table rows whose date is older then 60 days from current date – CURDATE() -.
SELECT something FROM table WHERE date_field< DATE_SUB(CURDATE(),INTERVAL 60 DAY)
This MySQL command selects all table rows whose date is older then 60 days from current date – CURDATE() -.
Explanation:
DATE_SUB(date,INTERVAL expr unit) -> Subtracts two dates
CURDATE() -> Returns the current date
unit can be:
- MICROSECOND
- SECOND
- MINUTE
- HOUR
- DAY
- WEEK
- MONTH
- QUARTER
- YEAR
- SECOND_MICROSECOND
- MINUTE_MICROSECOND
- MINUTE_SECOND
- HOUR_MICROSECOND
- HOUR_SECOND
- HOUR_MINUTE
- DAY_MICROSECOND
- DAY_SECOND
- DAY_MINUTE
- DAY_HOUR
- YEAR_MONTH