philihp.com

Category: Programming

CSS even/odd row selectors! Finally!

IE9 has been released, and it finally includes the “nth-child” pseudo-selector in CSS! In the past, this has been done on a server side, or with javascript. Now we finally have simple CSS rules for rows in tables that highlight every even or odd row, and it works in every browser without any hacks. tr:nth-child(odd) [...]

EAGLE Library for 4-Digit 7-Segment LED Display

I made this EAGLE library for the LTC-4027JR 4-digit common cathode 7-segment super bright red LED clock display. As of right now, they’re $3.96 on Digikey.com. Since each digit has a common cathode, I have to multiplex the digits to display numbers larger than 9. The library can be used in EAGLE to make schematics [...]

Easy Way to Remove All Variable Labels in SAS

The hard way to remove a label in SAS is to list out all of the labels one-by-one, like this data mylib.mydataset; set mylib.mydataset; label varA=”; label varB=”; label varC=”; run; But if you don’t know all of the variables ahead of time, or just want something cleaner/faster, you can do this proc datasets library=mylib [...]

HDCP Cracked?

I doubt anyone has verified this (yet), but I remember the AACS censorship regarding HD DVD… sooooooo here’s your repost! http://twitter.com/IntelGlobalPR/status/24430356463 HDCP MASTER KEY (MIRROR THIS TEXT!) This is a forty times forty element matrix of fifty-six bit hexadecimal numbers. To generate a source key, take a forty-bit number that (in binary) consists of twenty [...]

Wicket Homepage Redirecting

With the Wicket Java Web framework where a lot of magic happens behind the scenes, and almost no XML needs to be configured. Most of it is done with Java. It has a lot of pretty cool features. I just came across this one. In the init setup of your class that extends WebApplication, you [...]

SQL Optimization: Union vs. Union All

Everyone should learn the difference between Union and Union All. Knowing it will make you a better programmer, and it’s fairly trivial to understand. SELECT * FROM apples UNION SELECT * FROM oranges When you know for a fact that there will never be any common rows between the apples table and the oranges table, [...]

Abusing Hash objects as a Stack in SAS Data Step

Everyone in the computer science field (should) eventually learn or realize that any recursive function can be rewritten as an iterative process with the aid of a stack. Since a SAS Data Step is iterative, it’s fairly easy to look up children of a tree node in metadata, but nearly impossible to recursively look up [...]

Looping through SAS metadata objects

The following is my attempt at SAS Golf, where in a Data Step, I try to list the associations of a metadata object to the log. This is basically just taking advantage of combining SAS for loops with SAS while loops. I thought it was cool. Usually I find myself doing this with metadata_getnasn, metadata_getnprp, [...]

Dramatically Increasing SAS DI Studio performance of SCD Type-2 Loader Transforms

In SAS DI Studio 3.4 (and I imagine in future versions), the prepackaged code for the SCD Type-2 Loader works like this: Does the dataset exist? If not, create an empty dataset with structure and indexes as defined from metadata. Then detect differences between it and the source dataset and the target dataset, expire any [...]

Easy Inserting/Appending Libraries into FMTSEARCH path lists in SAS 9.2

In SAS 9.1.3 and prior, Options list (such as FMTSEARCH for libraries with format catalogs, and SASAUTOS for paths that contain macros shared across jobs) were annoying to work with. If you have nested code that wants to add a library or a path the list, doing so like this could potentially clobber statements executed [...]