Return URL with JavaScript that Prevents Loading of Cached Pages

HTML and JS logos

If you want to force a page to reload from the server rather than getting a cached copy, one way to do it is to append a query string to the URL.

If you want your web application to generate URLs that have this functionality, the code below can be implemented using JavaScript. Inside a file called BrowserUtility.js, insert this code.

function BrowserUtility()
	this.addNoCacheTimestamp =
			var ts = 'noCacheTS=' + (new Date()).getTime();
			sUrl = sUrl.trim();
			var nQIndex = sUrl.indexOf('?');
			return sUrl+=ts;

var browserUtility = new BrowserUtility();

Once this is loaded, the function can be called like this, where the variable sUrl stores a URL:

sUrl = browserUtility.addNoCacheTimestamp(sUrl);

If the variable sUrl initially contained “”, the returned string would be something like “”.

Another option, if you did not want to use the current time as the query string value, would be to use a random number function instead.

(This is a snippet of code that I didn’t write – it was authored by my friend and colleague Jeff Konicky.)

Executing Stored Procedures in Loops Using PL/SQL Tables

Oracle Database PL/SQL

I needed to be able to run a stored procedure once for each item in a list. In Microsoft SQL Server, I would probably do this with a table variable and a cursor, and the code would look something like this:

DECLARE @wo_table TABLE (wo_id VARCHAR(10) NOT NULL);

INSERT INTO @wo_table (wo_id) VALUES

SELECT wo_id FROM @wo_table;

OPEN wo_cursor;
FETCH NEXT FROM wo_cursor INTO @wo_id;
	EXEC dbo.MyStoredProc @wo_id;
	FETCH NEXT FROM wo_cursor INTO @wo_id;

CLOSE wo_cursor;
DEALLOCATE wo_cursor;

However, PL/SQL does not have table variables. While an option like a global temporary table could work, I decided that a PL/SQL table was a better solution.

Declare the PL/SQL table type, instantiate the PL/SQL table with the list of values (strings, in this case), then loop over the PL/SQL table, running the stored proc with each value. Notice that the “EXECUTE” keyword is missing. It is not only unnecessary in this context; it will not work here.

Below is the completed code:

  TYPE wo_table_type IS TABLE OF VARCHAR2(10);
  wo_table wo_table_type := wo_table_type(
  FOR i IN 1..wo_table.COUNT LOOP         

Problems with iOS 12 Beta Screen Time

iOS 12 logo

As should be obvious, putting a beta version of iOS on your primary iPhone may not be a wise choice – especially if you’re not a developer hunting for bugs. Even so, the iPhone 6s I bought for my daughter from Gazelle came with iOS 12 beta 3 loaded onto it.

iOS 12 Software Update screen

When I saw this, I was surprised, but I figured it wouldn’t be too big of a deal. However, I quickly discovered when setting up parental controls that things had changed. What was once called Restrictions, was now called Screen Time, and many things inside there were not where I expected them to be. This was, admittedly, the first time I had looked at iOS 12.

I began trying to set up Screen Time like I had restrictions on iOS 11 on her iPad. I also was able to get Disney’s Circle Go installed for additional control.

Once I thought I had everything set correctly, I tried to set up her Mail app with her Gmail account. It wouldn’t connect to Google’s accounts page for Gmail because the website was apparently blocked. I then began turning off restrictions – first Circle Go, then Screen Time. Still a no go. At this point, Safari wouldn’t even open.

I started checking to see if Screen Time in the beta had known bugs. Sure enough, it did.

At this point, I decided it was time to load iOS 11.4, so I did, with these instructions.

All is well now!

Primavera P6 Session Hung on Oracle Database

Oracle Primavera P6 EPPM

Occasionally a user will close a P6 application and the user’s session does not just go away. The easiest thing I’ve found is to check to see if there are hung sessions in the usession table (in Oracle – other database types may use a different name). This is the type of error you might see:

Primavera P6 hung user session

Look for hung sessions by running the following query, plugging the actual username into ‘Username’:

SELECT * FROM usession WHERE user_id = (
SELECT user_id FROM users WHERE user_name = 'Username');

If any are present, run this query:

DELETE FROM usession WHERE user_id = (
SELECT user_id FROM users WHERE user_name = 'Username');

The user should again be able to log into P6 at this point.