Category Archives: Technology

I work in technology everyday, and occasionally I like to share what I’ve found.

Convert Moodle Timestamp fields to Date

I get really frustrated with Moodle for using int fields to store dates. They store it in the Unix (Epoch) format. Here’s how to make it more readable. To convert it to a readable date, use FROM_UNIXTIME(int) You can also … Continue reading

Posted in Technology | Tagged , , | Leave a comment

Search through text of Stored Procedure

Code to search across the text of all stored procedures for a particular string. SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_DEFINITION LIKE ‘%foobar%’ AND ROUTINE_TYPE=’PROCEDURE’  

Posted in Technology | Tagged | Leave a comment

Call parent class constructor in PHP5

This may be obvious to some, but I had a hard time figuring it out at first.  I needed to call the constructor of a parent class in the child.  This is handy when you have things that happen in … Continue reading

Posted in Technology | Tagged , | Leave a comment

Long character fields from database weird in PHP

When you are returning longer text from a query in PHP, like from a varchar(MAX) or such you can get weird characters at the end.  The problem is that the ODBC connection, which I used to query the MS SQL … Continue reading

Posted in Technology | Tagged , , , | Leave a comment

Handling checkboxes in JQuery

Some quick notes on handling checkboxes (and probably radio buttons, but I haven’t tested that) in JQuery. To find a count of all checked items with the class Testbox. $(“.Testbox:checked”).size(); To get a count of all of the unchecked items use … Continue reading

Posted in Technology | Tagged , | Leave a comment

Search and Replace across all tables

Search and replace all occurances of a string in all tables in a database. From http://vyaskn.tripod.com/ –To replace all occurences of ‘America’ with ‘USA’: EXEC SearchAndReplace ‘America’, ‘USA’ GO REATE PROC SearchAndReplace ( @SearchStr nvarchar(100), @ReplaceStr nvarchar(100) ) AS BEGIN — … Continue reading

Posted in Technology | Tagged | Leave a comment

Search all tables in a database

Search all text fields across all tables in a database. Taken from http://vyaskn.tripod.com/ –To search all columns of all tables in Pubs database for the keyword “Computer” EXEC SearchAllTables ‘Computer’ GO CREATE PROC SearchAllTables ( @SearchStr nvarchar(100) ) AS BEGIN … Continue reading

Posted in Technology | Tagged | Leave a comment

How to change the listening port for Remote Desktop

Often you’ll want to run Remote Desktop services on a non-standard port.  Here’s the steps for changing the listening port on the “host” system.  Taken from the MS Knowledge Base. View products that this article applies to. This article was … Continue reading

Posted in Technology | Tagged , | Leave a comment

Order characters numerically

It may be simple, but this SQL will order items numerically (1,2,3,10,20) instead of alpha (1,10,2,20,3). SELECT ItemID, ItemName, ItemNum, CASE WHEN Len(ItemNum) = 0 THEN ‘Z’ ELSE SPACE(10- Len(ItemNum)) + ItemNum END OrderCol FROM table ORDER BY OrderCol

Posted in Technology | Tagged | Leave a comment

Using Alt and Title attributes on img tags

I was sent a tip about using alt and title attributes. I’ve noticed for a while now that Netscape 6+ doesn’t show the alt tags when you hover over them. Looking at the W3C specifications, the alt attribute is supposed … Continue reading

Posted in Technology | Leave a comment