Applies to:
  • Joomla! CMS 2.5.x

Joomla Filter: Validation OnSave
  • INT Forces the value to be an Integer

  • UINT Forces the value to be an absolute number (-4.2 becomes 4.2)

  • FLOAT Forces the value to be a floating point value

  • BOOL Forces the value to be true or false

  • WORD Strips anything that is not letters (including numbers)

  • ALNUM Forces the value to be alphanumeric (Letters and numbers only. No special characters)

  • CMD Forces the value to be alphanumeric plus the following three special characters _ (underscore) . (dot) - (dash)

  • BASE64 Forces the value to be a base64 encoded the string. Note it does not encode the string, it simply strips characters that may not exist in a base 64 encoded string.

  • STRING Removes HTML

  • HTML Allows basic HTML

  • ARRAY Forces value to be an array

  • PATH Forces value to be a file path

  • USERNAME Forces value to only contain characters allowed in the selection of a Joomla username

  • UNSET Completely remove any input

  • RAW Allow any content

  • URL Forces content to be a URL

  • TEL Forces content to be a properly formatted US phone number

What?
A quick reminder on how to disable user registration in Joomla! CMS version 1.5.x without using the Joomla! CMS back-end panel.

Why?
Because we're having some corruption issues and simply using the Joomla! administrator panel to navigate to global configuration, does not work!

How?
It isn't in the configuration.php file prior to Joomla! v1.6.x but in the database.
  1. Open the database to the Joomla 1.5.x website
  2. Browse the table "jos_components" (or "#__components" where "#_" is the site table prefix. default is "jos").
  3. Open the row where name="User Manager"
  4. Set the value under params for AllowUserRegistration
    • allowUserRegistration=0 to disable it.
    • allowUserRegistration=1 to enable it.

Not Working?
Are you sure you are using the Joomla user component or a 3rd-party such as Community Builder or K2? If so, you're in trouble as you HAVE to use the joomla admin panel to edit the settings of the 3rd party components.

Applies to:
  • Microsoft Business Intelligence Development Studio (BIDS) Visual Studio 2008
  • Microsoft Windows 7
  • Microsoft .NET Framework 3.5
  • Microsoft Visual C# 2008

What?
So like lots of people on the net, I've been given a datasource with names and addresses all in UPPERCASE. Initially, no one seemed bothered but now the request came through asking if this could be restored to a normal case, a mixture of mostly lowercase and some UPPERCASE.

Why?
I'm writing this article because other solutions on the net were either incomplete, did not work for me or simply did not match the requirements (do they ever?).
  1. The script must be able to be copied into other SSIS packages.
  2. Need the option to merely tick input column names rather than hardcode these.
  3. "It " should be an acronym for IT, so "IT Department" and "Director of IT".
  4. "O'REILLY" should become "O'Reilly" and not "O'reilly".
  5. "MCDONALDS" should become "McDonalds" but do not apply for "MacDonalds" because of names like "MACK" and "MACHURA".
  6. " and ", "la", "le", " van ", " de ", " of " and similar should remain lowercase.

How?

What?
A quick note for myself as I'd forgotten how to do this (we're talking technology belonging to the 90s - MS-DOS v6.22). The example wants to loop through a directory and then loop through the line it finds.

Why?
I use another technology for automation but sometimes the simpler solution is the one I make for other people to use. Explaining MS-DOS batch programs is a lot easier and colleagues trust these more than my all-in-one GUI applications.

How?
Note: we're using the code in a DOS Batch program so our variables have to be prefixed with a double-percent rather than just the one:

Applies to:
  • MS SQL Server Management Studio 2008
  • Two Transact-SQL databases
What?
A quick article on how to compare two Microsoft databases using the tools provided with SQL Server and without having to download any third-party products.

Why?
I googled and binged and all I could find were people selling third party products... they don't get it. If you are reading this, it's likely you've paid for a commercial version of a Microsoft product which cannot possibly be cheap. MS SQL Server Management Studio (SSMS) comes included so use it...

How?
Well I started with the method #1 listed here and then just built on this.


What?
Quick note on how to do this.

I was tasked with cleaning up an english database by replacing all special alphabets (ë to e) and non-alphanumeric symbols with URL friendly characters.

How?
copyraw
-- return all records that contain non-alphanumeric characters
SELECT * FROM myTable WHERE myColumn NOT REGEXP '^[A-Za-z0-9]+$';

-- return all records that are non-alphanumeric but ignore underscores
SELECT * FROM myTable WHERE myColumn NOT REGEXP '^[A-Za-z0-9\\_]+$';
  1.  -- return all records that contain non-alphanumeric characters 
  2.  SELECT * FROM myTable WHERE myColumn NOT REGEXP '^[A-Za-z0-9]+$'
  3.   
  4.  -- return all records that are non-alphanumeric but ignore underscores 
  5.  SELECT * FROM myTable WHERE myColumn NOT REGEXP '^[A-Za-z0-9\\_]+$'
Category: MySQL :: Article: 521

What?
A quick note on a htaccess rewrite rule I'm liking.

What does it do?
What I type:
copyraw
http://www.mywebsite.com/blog/videos.html
  1.  http://www.mywebsite.com/blog/videos.html 
Sends this to server:
copyraw
http://www.mywebsite.com/index.php?myFolder=blog&myFiles=videos
  1.  http://www.mywebsite.com/index.php?myFolder=blog&myFiles=videos 
How?
Category: Personal Home Page :: Article: 520

Applies to
  • Transact-SQL (T-SQL)
What?
This is a quick article on how to split a single row into multipe rows based on the value of a column in the same table.

Why?
I have a table that has all the days of sickness of employees. This table contains, which employee, on what date, and for how many days they were off sick. When migrating to a new system, the destination wanted 1 row per day. This meant that if in the old system, there was 1 row with an employee who took 2 days off, we would want 2 rows for that date for the same employee in the new system.

What we have:
copyraw
SELECT
        EmployeeNo
        , DaysOffSick
        , DateOfSickness
FROM    Employees_Attendance_Table


-- yields

        EmployeeNo      DaysOffSick     DateOfSickness
        --------------  --------------  ----------------
        001             1.00            1997-11-17
        002             3.00            2000-02-18
        003             2.00            1999-02-25
  1.  SELECT 
  2.          EmployeeNo 
  3.          , DaysOffSick 
  4.          , DateOfSickness 
  5.  FROM    Employees_Attendance_Table 
  6.   
  7.   
  8.  -- yields 
  9.   
  10.          EmployeeNo      DaysOffSick     DateOfSickness 
  11.          --------------  --------------  ---------------- 
  12.          001             1.00            1997-11-17 
  13.          002             3.00            2000-02-18 
  14.          003             2.00            1999-02-25 
What we want:
copyraw
EmployeeNo      DaysOffSick     DateOfSickness
--------------  --------------  ----------------
001             1.00            1997-11-17
002             1.00            2000-02-18
002             1.00            2000-02-19
002             1.00            2000-02-20
003             1.00            1999-02-25
003             1.00            1999-02-26

-- note the dates increment and do not account for days off (eg. Saturday / Sunday)
  1.  EmployeeNo      DaysOffSick     DateOfSickness 
  2.  --------------  --------------  ---------------- 
  3.  001             1.00            1997-11-17 
  4.  002             1.00            2000-02-18 
  5.  002             1.00            2000-02-19 
  6.  002             1.00            2000-02-20 
  7.  003             1.00            1999-02-25 
  8.  003             1.00            1999-02-26 
  9.   
  10.  -- note the dates increment and do not account for days off (eg. Saturday / Sunday) 

How?
Category: Transact-SQL :: Article: 519

What?
So this is a quick note to myself as I was playing with the relevance heuristics of a query. This example adds a column of relevance and sorts the rows accordingly.

How?
This has to be a real quick one for a dropdown search field which has to find relevant terms to autofill/autocomplete a search form:
copyraw
-- where @ThisSearch is a posted (and sanitized) variable

SET @ThisSearch:="Brains";

SELECT
        columnID,
        columnFullName,
        CASE
                WHEN columnFirstName LIKE @ThisSearch THEN 20
                WHEN columnFullName LIKE @ThisSearch THEN 10
                WHEN columnLastName LIKE @ThisSearch THEN 10
                WHEN columnFullName LIKE @ThisSearch THEN 1
        END as relevance
FROM
        myTable
WHERE
        s.columnPublished
  1.  -- where @ThisSearch is a posted (and sanitized) variable 
  2.   
  3.  SET @ThisSearch:="Brains"
  4.   
  5.  SELECT 
  6.          columnID, 
  7.          columnFullName, 
  8.          CASE 
  9.                  WHEN columnFirstName LIKE @ThisSearch THEN 20 
  10.                  WHEN columnFullName LIKE @ThisSearch THEN 10 
  11.                  WHEN columnLastName LIKE @ThisSearch THEN 10 
  12.                  WHEN columnFullName LIKE @ThisSearch THEN 1 
  13.          END as relevance 
  14.  FROM 
  15.          myTable 
  16.  WHERE 
  17.          s.columnPublished 
Category: MySQL :: Article: 516

What?
This is an article to remind me how to modify a column in a database table the old fashioned way (as in stop making me use GUI interfaces so poorly programmed when even I've made better DBMS tools).

All SQL
copyraw
-- Add a column to an existing table (giving it datatype char(2) and allowing NULL)
ALTER TABLE myTable ADD myColumn CHAR(2) NULL

-- Delete a column
ALTER TABLE myTable DROP COLUMN myColumn 

-- Reorder a column
ALTER TABLE myTable MODIFY COLUMN misplacedColumn AFTER otherColumn;
  1.  -- Add a column to an existing table (giving it datatype char(2) and allowing null) 
  2.  ALTER TABLE myTable ADD myColumn CHAR(2) NULL 
  3.   
  4.  -- Delete a column 
  5.  ALTER TABLE myTable DROP COLUMN myColumn 
  6.   
  7.  -- Reorder a column 
  8.  ALTER TABLE myTable MODIFY COLUMN misplacedColumn AFTER otherColumn; 
Category: Databases :: Article: 514

What?
Just a quick note to myself on how to reorder columns as I was having difficulty using a phpMyAdmin interface to do this.

How?
Taken from the best forum for programming Qs&As: http://stackoverflow.com/questions/4095481/easy-way-to-re-order-columns

Method: phpMyAdmin
So in the phpMyAdmin interface, apparently, you can drag the columns by clicking and holding on the headers when viewing a table structure... Though maybe this is derived from a template and depending on if you are using MS Internet Explorer...

Can't get it working? I use whatever is most useful and Google's Chrome is the fastest browser I have. Here are some ways to do this:


What?
So this is an article to list methods of retrieving the number of files in a folder/directory.

Why?
Why can't we just use a loop and file pattern native to the Autohotkey programming language:
copyraw
UserFolder:="C:"
-- UserFolder := RegExReplace( MyInputField, "\\$")  ; gets rid of trailing slash if required

-- Method #1
count := 0
Loop, %UserFolder%\*.*, 0, 1 
  count++

-- note for future use:
; if A_LoopFileAttrib contains H,R,S
;	continue
  1.  UserFolder:="C:" 
  2.  -- UserFolder := RegExReplace( MyInputField, "\\$")  ; gets rid of trailing slash if required 
  3.   
  4.  -- Method #1 
  5.  count :0 
  6.  Loop, %UserFolder%\*.*, 0, 1 
  7.    count++ 
  8.   
  9.  -- note for future use: 
  10.  ; if A_LoopFileAttrib contains H,R,
  11.  ;    continue 
This works fine at home on your local host on a local drive. Try using this over a networked drive and more time will be spent counting the files then the actual processing (or whatever your script is trying to do).

Category: AutoHotkey :: Article: 512

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

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