Python: Static Twitter

This code is used to download all of the tweets (and stay in-sync by running it regularly) as markdown files for inclusion into e.g. static blogs, such as this one. While you can simply display your timeline using Twitter’s official JS, replicating the tweets to your blog keeps it more current, allows for native comments, and, most importantly, ensures that visitors that may have tracker protections in use, can still see your posts aka tweets.

Read more

PHP: Wunderground PWS from La Crosse Alerts

The code below can be reused to connect other types of weather stations, but it was originally designed to utilize undocumented features of the La Crosse Technology Wireless Weather Station with La Crosse Alerts (aka C84612).

Full tutorial is now available as a separate article “(HACKING) PROFESSIONAL WEATHER STATION FOR UNDER $100“.

Updated 2/10/2014:

  • Temp path moved to a variable instead (thank you, Mara and Ford)
  • Down alert default changed to 2 hours (La Cross internet update seems to be down just over 1 hour quite often)
  • Check for station itself being down (outside temperature reported exactly at 32 and dew point of 0)
  • Running script with ?output at the end would produce an output each time - helps troubleshoot otherwise successful runs
  • Info on delay in hours since last update always available on errors
Read more

SQL - Server Table Search

Previously I have shared an extremely powerful method of finding objects such as procedures, functions, and triggers…but what about tables (or views)? MS SQL is, once again, able to do this quite easily and logically without the need for any expensive and limited 3rd party software:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
USE MyDataBase;
SELECT
TABLES.*
FROM
information_schema.columns
JOIN
information_schema.tables
ON COLUMNS.TABLE_NAME = TABLES.TABLE_NAME
WHERE
(
column_name LIKE '%SEARCHNEEDLE%'
)
AND TABLE_TYPE <> 'VIEW'

SQL - Server Search

What do you do if you need to find a certain string used in a stored procedure? What if you need to be completely certain that you can remove the object and there are no dependencies within the server itself? There are a number of 3rd party tools that allow searching within the SQL Server database schemas, but some are slow due to precaching and some are simply not powerful enough due to lack of options. SQL itself comes to the rescue!

The query below can be as simple and as advanced as you want it to be, but no matter what- it is always fast and easy to use:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
SELECT
OBJECT_NAME([id]) AS 'ObjectName',
MAX(CASE WHEN OBJECTPROPERTY([id], 'IsProcedure') = 1 THEN 'Procedure'
WHEN OBJECTPROPERTY([id], 'IsScalarFunction') = 1 THEN 'Scalar Function'
WHEN OBJECTPROPERTY([id], 'IsTableFunction') = 1 THEN 'Table Function'
WHEN OBJECTPROPERTY([id], 'IsTrigger') = 1 THEN 'Trigger'
END) AS 'ObjectType'
FROM
[syscomments]
WHERE
[text] LIKE '%SEARCHNEEDLE%'
AND (
OBJECTPROPERTY([id], 'IsProcedure') = 1
OR OBJECTPROPERTY([id], 'IsScalarFunction') = 1
OR OBJECTPROPERTY([id], 'IsTableFunction') = 1
OR OBJECTPROPERTY([id], 'IsTrigger') = 1
)
GROUP BY
OBJECT_NAME([id])

4/2/2012: Updated with more advanced SQL example

Textpattern Dynamic Date

Textpattern does not seem to support dynamic dates intrinsically, so here is a workaround I use. In this case, it will show the full date if it’s not in the current year, otherwise skip the year part. This approach can certainly be used for more advanced styling as well.

1
2
3
4
5
6
7
if(posted(array('format'=>'%Y')) < date("Y"))
{
echo posted(array('format'=>'%b %d %Y, %R %p'));
}else
{
echo posted();
}

TWG Summary

NOTE: This modification is not supported anymore. TinyWebGallery is a great and powerful script that I enjoyed for many years, but I have since switched to SmugMug and do not follow latest TWG development efforts. Nevertheless, feel free to use this “hack”- it is still most certainly useful and easy to implement.
By just modifying five files (a total of around 25 lines added), you will be able to have your TWG Gallery produce “summary” pages, where the users will be able to see multiple medium-sized pictures, without having to go into each picture every-time. A must for high-bandwidth users/sites.
This article assumes you are running an unmodified version of Tiny Web Gallery script version 1.6.3. If you are running a different version, line numbers and code might be different.
File Comparison done based on “Araxis Merge File Comparison Reports” by Araxis Merge.

As always, remember to do a full back-up of the system or at least backup all the files you modify:

Click here to see full File Modifications step by step in an easy to read format.

ikonBoard

NOTE: There will be no real support provided for ikonboard. I’m not into boards anymore and especially have no time to support an archaic one. Nevertheless, feel free to look through these pages (since they are kept only for “historical” reasons, most of the links are disabled).

iBv3 IRC Chat Hack :: This “hack” will add an IRC Chat feature to the board, but it can also work as stand-alone (which means, that you can implement it both, on your homepage and your bulletin board). Go to its homepage for more information.

iBv3 Clickable Emoticons Popup :: This “hack” will make all of the images in the Emoticons popup clickable. Go to its homepage for more information.