Basically if you've just started using "incognito" mode with the Google Chrome web-browser, this article is just how to switch the quick launch shortcut (next to your start button).  All the articles I googled were windows vista so I thought I'd share one for windows 7 here.  I'm actually only saving you a click as you can just right-click on the google chrome icon and select "New Incognito Window".  This is just how to set it by default (useful if you do online banking, shopping, etc).


Ok is it just me who does everything slowly and badly until someone comes along and says why are you doing it like that?  My justification is that the job has to be done no matter what.

If you've ever sat there with phpMyAdmin or a MySQL Administration Tool (like Navicat or SQLYog), and still there at night editing each field so that it displays correctly... well that's usually me.

Found it a bit boring but here's a short bit of code to speed it up which I now use:

copyraw
update table_name set field_name=REPLACE(field_name,'string_to_find','string_to_replace');
  1.  update table_name set field_name=REPLACE(field_name,'string_to_find','string_to_replace')

Source: http://www.mediacollege.com/computer/database/mysql/find-replace.html

 

Category: MySQL :: Article: 248

This is if  you have an FLV file and you don't want any fancy management system, you just want your FLV to play on your webpage.

The following example is a demonstration of how to do this without installing anything on your webserver.

 I like to use flowplayer for this example but my own systems can't use a solution as crude as this.

  1. Copy the below code (beginning and ending with object tags)
  2. Paste it into your HTML page
  3. Replace both instances of the text "http://my.video.com/myVideo.flv" with the full url of your own FLV.
  4. Save the HTML page and publish

The Code:


 This is an issue relating to the Time Server Synchronization error.  Basically you start up windows live messenger and get the following error:

{rokbox title=|Messenger Error 80048820|}/images/screenshots/windows_live_error_80048820.png{/rokbox}

Basically you need to check that the time on your windows clock is accurate or close to real Internet time:

I could apply the PRINCE2 (Projects in a controlled environment) methodology to website projects  but most people find this overwhelming.  It's in business techno babble and I get asked what does this mean in stage 1?  And this in stage 2?  (There are over 100 stages)...  

Below is my template project initiation plan (project mandate?) for my freelance website development process.  It may look clean, clear, obvious... it's just an outline of what I picture as a perfect project; unfortunately the first 2 pages tend to be completed in just over a day and the rest of the time is spent faffing around with design and functionality. We use the ProjectFork extension to manage projects, it helps during times when we can't see face-to-face with colleagues or clients.


Suppose you have a column in your table that you use as a counter (storing the value of the counter - eg. times an article has been displayed).

Basically what I used to do is something similar to the following:

  1. SELECT counter_field_value FROM table1 WHERE column1='this_article'
  2. Add 1 to counter_field_value
  3. UPDATE table1 SET counter_field_value=<new_counter_field_value> WHERE column1='this_article'

Combined with a PHP script this could be a few lines for something really small.

 

The quick trick to this is to do it all in one query:

copyraw
UPDATE table1 SET counter_field_value=counter_field_value+1 WHERE column1='this_article'
  1.  UPDATE table1 SET counter_field_value=counter_field_value+1 WHERE column1='this_article' 
Category: MySQL :: Article: 243

I've decided to put something in here as it took me an age to find out how I could do it.

This is when using a MySQL query within a PHP script.  The process is used often to do a statistics table or top ten chart of your data (eg. movies, music, etc).

My aim is to do the following:

  1. retrieve data from a table,
  2. count the number of times each data exists,
  3. sort it in reverse order so that the most frequent is at the top of the list
  4. print out each row with the number of times that particular data appeared in a row

My old method was to:


A data type reference table. If you're designing a database then you don't need me to tell you what this is.

My personal opinion is to always try to use the minimal type and length of the value required. For example, a comment of 500 words should only be TEXT (~64Kb) rather than LONGTEXT (~4Gb).


 I'm beginning a list as I've just spent an age trying to get PHP output to create a text file.  Then my client showed me how she then opens the text file in Excel, so I said we could get the script to do that instead.

PHP to TXT

copyraw
header('Content-Type: text/plain; charset=utf-8');
header('Content-Disposition: attachment; filename=foo.txt');
echo 'contents of file';
  1.  header('Content-Type: text/plain; charset=utf-8')
  2.  header('Content-Disposition: attachment; filename=foo.txt')
  3.  echo 'contents of file'

 

PHP to XLS

copyraw
$export_file = "my_name.xls"; 
ob_end_clean(); 
ini_set('zlib.output_compression','Off'); 
header('Pragma: public'); 
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); 
header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT'); 
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: pre-check=0, post-check=0, max-age=0');
header ("Pragma: no-cache"); 
header("Expires: 0"); 
header('Content-Transfer-Encoding: none'); 
header('Content-Type: application/vnd.ms-excel;'); 
header("Content-type: application/x-msexcel");  
header('Content-Disposition: attachment; filename="'.basename($export_file).'"');
  1.  $export_file = "my_name.xls"; 
  2.  ob_end_clean()
  3.  ini_set('zlib.output_compression','Off')
  4.  header('Pragma: public')
  5.  header("Expires: Sat, 26 Jul 1997 05:00:00 GMT")
  6.  header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT')
  7.  header('Cache-Control: no-store, no-cache, must-revalidate')
  8.  header('Cache-Control: pre-check=0, post-check=0, max-age=0')
  9.  header ("Pragma: no-cache")
  10.  header("Expires: 0")
  11.  header('Content-Transfer-Encoding: none')
  12.  header('Content-Type: application/vnd.ms-excel;')
  13.  header("Content-type: application/x-msexcel")
  14.  header('Content-Disposition: attachment; filename="'.basename($export_file).'"')
Category: Personal Home Page :: Article: 240

Are you getting a lot of spam, or junk messages sent via your Joomla site?

I know certain components of Joomla let you put banned words but I know of even more that don't.  If you find all your forms need extra plugins and captchas (such as JezRecaptcha), then the website security isn't amazing.  I used to have Captcha on my K2 by Joomlaworks but if you did the sound version, it didn't work properly.  I found that sometimes the captcha wouldn't even match what you typed and what it displayed!!!

I have written this article to be another one of those programmer's tweaks.  This is quite a simple fix and I will hopefully be able to keep it simple for non-programmers.  The tweak below will stop any of your pages submitting content containing your banned words.

We're going to modify a file containing 2 lines of code by default.  The file is index2.php in your Joomla root folder.  Make a copy of it, back it up or do whatever you usually do when you modify a server-side file... ahem...

The code by to look for (joomla default) should be as follows:

copyraw
$_REQUEST['tmpl'] = 'component';
include('index.php');
  1.  $_REQUEST['tmpl'] = 'component'
  2.  include('index.php')

There is some more text but it's in /* lines */ which means these are comments.

 

The quick solution is:

copyraw
$_REQUEST['tmpl'] = 'component';
$offensive_words=array("viagra","cialis","[url=","porn","pfizer");
if (is_array($_GET)) $GotVars.=implode(",", $_GET).",";
if (is_array($_POST)) $GotVars.=implode(",", $_POST).",";
for($i=0;$i<count($offensive_words);$i++) { if (stripos($GotVars, $offensive_words[$i])) $offense=true; } 
if (!$offense) include('index.php');
  1.  $_REQUEST['tmpl'] = 'component'
  2.  $offensive_words=array("viagra","cialis","[url=","porn","pfizer")
  3.  if (is_array($_GET)) $GotVars.=implode(",", $_GET).","; 
  4.  if (is_array($_POST)) $GotVars.=implode(",", $_POST).","; 
  5.  for($i=0;$i<count($offensive_words);$i++) { if (stripos($GotVars, $offensive_words[$i])) $offense=true} 
  6.  if (!$offense) include('index.php')

The reporting solution (which tells your visitor what word caused an offense) is:

copyraw
# CREATE AN ARRAY OF BANNED WORDS
$offensive_words=array();
$offensive_words[]="viagra";
$offensive_words[]="cialis";
$offensive_words[]="[url=";
$errors="";
 
# CONVERT THE SUBMITTED DATA INTO STRING(S)
$GotVars="";
if (is_array($_GET)) $GotVars.=strtolower(implode(",", $_GET).",");
if (is_array($_POST)) $GotVars.=strtolower(implode(",", $_POST).",");
 
# NOW CHECK EACH BANNED WORD DOES NOT EXIST IN THE STRING
for ($i=0; $i<count($offensive_words); $i++) {
	$offensive_string.=(stripos($GotVars, $offensive_words[$i])!==false)?"- ".$offensive_words[$i].", ":"";
}
# IF THE OFFENSIVE STRING WAS POPULATED (=FOUND BANNED WORDS) THEN CREATE A MESSAGE
$errors.=(trim($offensive_string)!="")?"You have submitted word(s) that the website administrator has banned:".$offensive_string.".  Please try again without the banned words.":"";
 
# IF THE ERRORS STRING IS EMPTY PROCEED AS NORMAL, IF NOT THEN DISPLAY MESSAGE
if (trim($offensive_string)=="") {
	include('index.php');
} else {
	echo $errors;
}
  1.  # CREATE AN ARRAY OF BANNED WORDS 
  2.  $offensive_words=array()
  3.  $offensive_words[]="viagra"; 
  4.  $offensive_words[]="cialis"; 
  5.  $offensive_words[]="[url="; 
  6.  $errors=""; 
  7.   
  8.  # CONVERT THE SUBMITTED DATA INTO STRING(S) 
  9.  $GotVars=""; 
  10.  if (is_array($_GET)) $GotVars.=strtolower(implode(",", $_GET).",")
  11.  if (is_array($_POST)) $GotVars.=strtolower(implode(",", $_POST).",")
  12.   
  13.  # NOW CHECK EACH BANNED WORD DOES NOT EXIST IN THE STRING 
  14.  for ($i=0$i<count($offensive_words)$i++) { 
  15.      $offensive_string.=(stripos($GotVars, $offensive_words[$i])!==false)?"- ".$offensive_words[$i].", ":""; 
  16.  } 
  17.  # IF THE OFFENSIVE STRING WAS POPULATED (=FOUND BANNED WORDS) THEN CREATE A MESSAGE 
  18.  $errors.=(trim($offensive_string)!="")?"You have submitted word(s) that the website administrator has banned:".$offensive_string.".  Please try again without the banned words.":""; 
  19.   
  20.  # IF THE ERRORS STRING IS EMPTY PROCEED AS NORMAL, IF NOT THEN DISPLAY MESSAGE 
  21.  if (trim($offensive_string)=="") { 
  22.      include('index.php')
  23.  } else { 
  24.      echo $errors
  25.  } 

My comments in the code above are prefixed with #. As you can see I actually tell the user what word they've used that's been banned. You could easily not do this by replacing echo $errors="" with the word Return in the second to last line.

To sum up: my code does the following:

  1. Add words to the "offensive_words" array
  2. Joins any submitted data into 1 long string
  3. Tries to find each "offensive word" (case-insensitive) in the submitted data
  4. Creates a message if there was a banned word found
  5. If no message created, it proceeds as per usual; if not, it does not submit the form

To add more banned words, simply keep adding lines using the following syntax

copyraw
# CREATE AN ARRAY OF BANNED WORDS
$offensive_words=array();
$offensive_words[]="viagra";
$offensive_words[]="cialis";
$offensive_words[]="[url=";
$offensive_words[]="porn";
$offensive_words[]="a banned phrase";
#...
  1.  # CREATE AN ARRAY OF BANNED WORDS 
  2.  $offensive_words=array()
  3.  $offensive_words[]="viagra"; 
  4.  $offensive_words[]="cialis"; 
  5.  $offensive_words[]="[url="; 
  6.  $offensive_words[]="porn"; 
  7.  $offensive_words[]="a banned phrase"; 
  8.  #... 

or

copyraw
# CREATE AN ARRAY OF BANNED WORDS
$offensive_words=array("viagra","cialis","[url=","porn","a banned phrase");
#...
  1.  # CREATE AN ARRAY OF BANNED WORDS 
  2.  $offensive_words=array("viagra","cialis","[url=","porn","a banned phrase")
  3.  #... 

Additional Information: The Open Web Application Security Project (OWASP)

Category: Joomla :: Article: 237

The Issue

People have reported that although they have manually set the date/time on their computer, this gets changed by the windows time server (time.windows.com) when connected to the Internet and for some reason it doesn't display the right date/time.


The Quick Fix

First off, check there aren't any Update for Windows 7 releases at Microsoft's Windows Update


 In this case, I want to display the current month with today highlighted.  As I was trying to get my head round writing this in a program using the qHTM.dll (to include HTML in an autohotkey GUI), the calendar will be in a HTML-autohotkey mixed code.  Obviously just omit the HTML rubbish if you want to create a calendar using just autohotkey syntax.

Actually, the following code is an excerpt from my program which checks an online server (for IT Events during this month) and if it can't download the calendar, it had to display an offline version in the GUI.  To display the following code in this website though, I've had to omit a lot of the HTML part.


Credit where Credit is Due:


Feel free to copy, redistribute and share this information. All that we ask is that you attribute credit and possibly even a link back to this website as it really helps in our search engine rankings.

Disclaimer: Please note that the information provided on this website is intended for informational purposes only and does not represent a warranty. The opinions expressed are those of the author only. We recommend testing any solutions in a development environment before implementing them in production. The articles are based on our good faith efforts and were current at the time of writing, reflecting our practical experience in a commercial setting.

Thank you for visiting and, as always, we hope this website was of some use to you!

Kind Regards,

Joel Lipman
www.joellipman.com

RSS Feed

Related Articles

Joes Revolver Map

Joes Word Cloud

windows   work   display   list   page   google   need   name   file   case   code   using   function   version   added   note   used   first   would   server   script   source   time   order   client   report   zoho   deluge   license   table   find   error   website   uploaded   files   create   system   parameter   data   joomla   database   user   value   where   following   mysql   date   field   creator   form   JoelLipman.Com

Accreditation

Badge - Certified Zoho Creator Associate
Badge - Certified Zoho Creator Associate

Donate & Support

If you like my content, and would like to support this sharing site, feel free to donate using a method below:

Paypal:
Donate to Joel Lipman via PayPal

Bitcoin:
Donate to Joel Lipman with Bitcoin bc1qf6elrdxc968h0k673l2djc9wrpazhqtxw8qqp4

Ethereum:
Donate to Joel Lipman with Ethereum 0xb038962F3809b425D661EF5D22294Cf45E02FebF
© 2024 Joel Lipman .com. All Rights Reserved.