A user created an account in my web application which had an apostrophe in their e-mail address. It was similar to First_D’Second@website.com. I didn’t think that an apostrophe was a valid character for an e-mail so I didn’t have any code to prevent it from crashing the app when it tried to run. The original code was:
string sql = "SELECT * FROM Users WHERE Email = '" + email + "'";
You can prevent an error by escaping the apostrophe in the email variable, i.e. replacing a single apostrophe with a double one. This can be done in C# with the .Replace function:
string sql = "SELECT * FROM Users WHERE Email = '" + email.Replace ("'", "''") + "'";
The sql string can then be executed without crashing the application.
I’ve compiled a list of important emergency alerts that should be on your cell phone and Twitter accounts. These can be found on the EmergencyInfoBC web site, but I summarized the important data to use with your devices for receiving these alerts. Two of these are geared towards BC and Canada residents, but the other two are suitable for the rest of the people on this planet.
The mobile alerts are setup by texting the message (i.e. follow NWC_NTWC) to the number 21212. Don’t include the double quotes (“) in the text message. You should get a confirmation that you subscribed to the service.
BTW, the !important word in the subject title is not a mistake. Anyone who knows CSS would know what this means.
National Tsunami Warning Center
Mobile: text “follow NWS_NTWC” to 21212
Natural Resources Canada
Mobile: text “follow CANADAquakes” to 21212
U.S. Geological Survey
Mobile: text “follow USGSted” to 21212
Mobile: text “follow EmergencyInfoBC” to 21212
When I started my adventure in computers in school in the 1980’s, we were using Apple II’s and Commodore Pets which had around 64K of memory. My first computer in 1984 had 128K memory and a 360K floppy disk drive, which seemed like quite a bit of storage for the tiny apps that were built back then. Over the years, memory and storage sizes have increased greatly. In the 1980’s at the University of Alberta, a friend of mine showed me a 500 MB hard drive which was the size of a large garbage can. Today, my iPhone has a 32 GB of storage space and it fits in my pocket.
Disk/memory storage and computer speeds are increasing rapidly over the years. 1 TB hard drives are common today and soon we’ll be using multi petabyte drives. I should note that the following numbers are not referring to bytes (as my post may suggest), but to decimal numbers, so kilo is 10^3 and not 2^10. That could be another post …
BTW … when I say 10^3, this means 10*10*10 = 1000, 10^6 is 10*10*10*10*10*10 = 1 000 000, etc. That’s enough math lessons for today.
If you don’t login regularly to your Joomla administrator site, you may one day forget what your password is. If this unfortunate event does happen, its very easy to recover it if you have access to the database that your web site uses.
Open your database and find the table prefix_users, where prefix is the database prefix that you selected when you installed Joomla.
Open your user account for editing.
In the password field, replace the contents with
You’ve just changed your password to the word secret. Now immediately login and change your password to something more secure.
This procedure works with Joomla 2.5 and 3.x.
When I upgraded to Windows 8 from Windows XP, everything worked well except Microsoft Outlook. It required me to activate its license and failed on every attempt I made at this. This may be due to it trying to write data to a folder that Windows 8’s enhanced security was blocking. Windows 7 users experience the same problem with Outlook’s license activation.
The solution is very simple. You need to run Outlook as an administrator, i.e. right click on the Outlook program icon and select “Run as administrator” from the list of options. Even though I was logged in as administrator, I still had to do this step to force Windows to run Outlook as an administrator. Outlook was then able to activate its license with Microsoft and then ran without a red title bar in the application that indicated a problem.