Asides
Google Chrome Incognito Mode To Browse Your Website
Did you know that there is a Google Chrome Incognito Mode To Browse Your Website? Google’s Chrome web browser has a great feature called “incognito”. The incognito mode is like a fresh browser without any cookies or stored identification data. This is great when you want to browse a website anonymously. No tracking data exists about you so it provides a fresh view/experience of any website that you would visit.
I find this helpful especially when I’m scanning my websites for viruses or hacking scripts that are smart enough to hide when the administrator is logged in!
To open a new browser instance in the Incognito mode, use the little hamburger icon in the top right corner and choose New Incognito Window. Enjoy!
Block Advertisements From Your Web Browser
You can block advertisements from your web browser in just a few minutes. By adding any of the latest available ad blocker extensions for your web browser, you can filter out the noise and speed up your browsing!
Chrome users just do a search for: ad blocker chrome extension
AdBlock does a great job blocking ads. Before you know it, you’ll enjoy browsing the web without the constant ad barrage on your eyes! Give it a shot!
Using a CFLOCATION with tokens breaks sessions when used on a different website on the same server
Using a CFLOCATION with tokens breaks sessions when used on a different website on the same server
We host a web application which has multiple installations (multiple domains names) on the same server, it is all hosted by the same Cold Fusion Application Server instance.
Over time we have added new features which allow clients that have multiple domains login to both of the domains using a ‘passthrough key’ which allows them to click one button and it automatically passes them to the next site, which then looks up a secret key in the database confirms that i thas been less than a second and automatically sets up the users session. (this portion is vague because it doesn’t really matter what procedure we went through).
The issue comes up when we use a <CFLOCATION tag which directs the user from Domain A to the Domain B If we do not specify the addtoken=false, then the CFID=xxxx&CFTOKEN=xxxx are appended to the URL. The problem here is that the session from domain A is used for that first transfer page request, then any subsequent page requests (which do not have the CFID and CFTOKEN) will use the CFID / CFTOKEN which is setup for the Domain B . When this happens the session you setup for the transfer page request is gone.
Long story short, specify ADDTOKEN=false at the end of the CFLOCATION when moving from one domain to another.
Complex Restore of Postgres data where multiples rows are deleted from a single row.
Complex Restore of Postgres data where multiples rows are deleted from a single row.
We ran into an issue with a client database where an application deleted upwards of 360 K records. In this process we found we needed to restore a database from several hours ago but we were unable to do a full system restore, so here is the recepie for how to resolve
- restore a database gziped file to a ‘sandbox’ database
#gunzip -c database_back.1014|psql -Uuser database_restore_20150909 - alter the public schema to rename it
#echo ‘alter schema public rename to ‘restore_09122015’|psql -Uuser database_restore_20150909 - dump the database and load to the live db in the new schema
#pg_dump -Uuser database _restore_20150909|psql -Uuser livedb - create insert statements which will insert all missing records from the new schema into the live (public) schema
#awk ‘/tbl/{gsub(“tbl”,””); print “insert into tbl”$1″ select r.* from restore_09122015.tbl”$1″ r left join tbl”$1” n using(“$1″id) where n is null; “}’ tbllist.save | psql –U user livedb.
Note that this relies on your database being in the same consistent naming format tblshortname.shortnameid.
Access the IP Security – Port Firewall on Windows 2000
Access the IP Security – Port Firewall on Windows 2000
In order to access the IP Address / Port restrictions / Firewall tools in Windows 2000.
Use this quick video to see where to click to access.
How To Migrate Database From Microsoft SQL Server 2000 To Microsoft SQL Server 2014
It is easy to Migrate Database From Microsoft SQL Server 2000 To Microsoft SQL Server 2014
Before you start make sure that you have administrative accounts on both servers.
This is 2 step process.
I would recommend reading this post for user export
Also read this document from Microsoft knowledge base.
1. we are going to export database using SQL Scripts from our old MsSQL 2000 server and then use that SQL Script file to create new version of Same database on our New MsSQL2014 server.
Ok on SQL 2000 server right click database you want to migrate then click on Generate SQL Script… as shown in figure 1
Then click on Show All button as shown in Figure 2
Now choose objects to create scripts for:
Next we decide on Formatting as shown in Figure 4
Finally we need to setup some Security and Table Scripting Options and as well one or multiple files, I prefer to use single file per database as shown in Figure 5.
Click Ok and wait for server to do its thing.
Now To the 2014 server…
Open Microsoft SQL Server Management Studio and connect to your 2014 server
click on open file or Ctrl + O (letter o not zero)
find your Exported SQL Script file from 2000 server.
Check your CREATE DATABASE directive and make sure that FILENAME is pointing to the place where you want new database to be stored.
2. Once all this is done we can do data Import using SQL Server Import and Export Wizard as explained in this post.
How To Use Triggers To Run Javascripts In PDF Forms
You can use triggers to run javascripts in PDF forms. You can also run javascripts in PDF forms that will run when the document is opened. The steps follow:
In order to edit the PDF document I used Adobe Acrobat DC. This is not a free app but I think Google has a free app and their are other apps out there for editing PDF documents, however I’m not sure of the capabilities.
Triggers
Be aware that buttons, form fields, radio buttons and similar features are called “fields” in the system. In the form I modified, I created a button field to send the form data over the Internet to our website where a WordPress plugin was waiting to process it.
- In Tools, Prepare Form: double click the “field” to open up the Properties UI
- Visibility controls are on the General tab, Common Properties section
- The field name, for programming purposes, is on the General, Name tab, and NOT the misleading Options, Label tab
- Several Actions and Triggers are available in the Actions tab
- An Action is matched with a Trigger
- “Mouse Up” is the trigger for the completion of a successful mouse click
- Action: Run a Javascript or Submit a form were the two useful features
Submit a form
- Submit a form, URL: is the target URL for the form when the user clicks the Send button. The target location must have some sort of processing feature or script that is designed to accept and process the form data. We have a free plugin available for WordPress named PDF Form Receiver with many options included
- The Submit a form action also has a few formats available. Our free WordPress plugin handles HTML and PDF. HTML setting sends the HTML formatted data. The PDF setting sends the form data as a PDF file attachment
Actions
The Actions system is trigger-based. Now there are instances where you may need to run a javascript within a PDF form automatically when the PDF form is opened, not when something fires a trigger. This is called a Document-level Javascript.
Document-Level Javascript
- Tools, Action Wizard, Create a New Action, More Tools, Document Javascripts. Fill out the name and description, then Save
- In the Document Javascripts, you can edit and create your javascript. Do not begin the javascript with a function or it may cause adverse effects
- Close and Save, then open the PDF in the free Adobe Reader app to test your javascripts
This webpage is not available ERR_CONTENT_DECODING_FAILED – PHP ob_start() ob_gzhandler – Trailing spaces after closing ?> in WordPress Plugin
This webpage is not available ERR_CONTENT_DECODING_FAILED – PHP ob_start() ob_gzhandler – Trailing spaces after closing ?> in WordPress Plugin
Recently we ran into an issue where a website would not load. We traced the problem to a line in the code which attempted to pass all content to ob_start(‘ob_gzhandler’).
This basically words to zip up all content and send it to the browser. However an error was being thrown ERR_CONTENT_DECODING_FAILED, which showed up in the browser window and in the browser console. After some detailed debugging in PHP using some die commands()
die("die: ".__FILE__.":".__LINE__);
I found that the issue came from an rogue blank character which displayed before the ob_start(“ob_gzhandler”) function could be called.
There were a couple of ways I could deal with this, first I could simply put an ob_start() at the top of the code, and then put an ob_get_clean(); just before the ob_start(‘ob_gzhandler’), however this felt a bit sloppy, so I went in search of the rogue character.
The application that this was in, was one that simply included the wordpress load file so that it could integrate with a WordPress installation, and I found that the characters was coming from the WordPress install. Using a hunch I decided d to look for a recently updated plugin and I quickly found a plugin that had an end php tag “?>” with an extra line after it.
I quickly fixed this and then decided I would figure out a way to quickly identify issues like this. While there are many ways to address this and figure out how to over come it, the issue seems to identify an need to figure out whether plugins conform to some best practices (such as omitting a closing ?> php sign)
If we identify this need, we will write a free plugin to put on the WordPress site, which will go through all plugins on sites to confirm that they use some best practices such as this.
Invalid command ‘SSLEngine’, perhaps misspelled or defined by a module not included in the server configuration – enable apache ssl module
Invalid command ‘SSLEngine’, perhaps misspelled or defined by a module not included in the server configuration – enable apache ssl module
If you are moving an existing Apache configuration file from one server to another, or if you are enabling SSL configuration on an existing website, you could run into this error as you restart apache
server#/etc/init.d/apache2 restart Invalid command 'SSLEngine', perhaps misspelled or defined by a module not included in the server configuration
This essentially means that Apache doesn’t understand what the SSLEngine command means. This is most likely because SSL has not been enabled on this server. For quite some time SSL has come with Apache2 by default, however you do still have to enable it.
To enable it you can simply run enable the ‘ssl’ apache module the command
#a2enmod ssl #/etc/init.d/apache2 reload #or #/etc/init.d/apache2 restart
The error should no longer show a the SSLEngine command is correctly recognized by the ssl mod.
Find out which PHP packages are installed on ubuntu / debian
Find out which PHP packages are installed on ubuntu / debian
As we have moved or upgraded sites from one server to another, sometimes we have needed to know which PHP5 dependencies were installed on one server servera, so that we could make sure those same dependencies were met on another server serverb
To do this we can run a simply command line tool on server a
servera# echo `dpkg -l|awk '$1 ~ /ii/ && $2 ~ /php5/{print $2}'`
libapache2-mod-php5 php5 php5-cli php5-common php5-curl php5-gd php5-mcrypt php5-mysql php5-pgsql
and then we copy the contents of the output and past it after the apt-get install command on serverb
serverb# apt-get install libapache2-mod-php5 php5 php5-cli php5-common php5-curl php5-gd php5-mcrypt php5-mysql php5-pgsql
Dont forget to reload apache as some packages do not reload it automatically
serverb# /etc/init.d/apache2 reload