Category Archives: Work

SQL Server: list all user defined functions in a database

Recently I inherited a database project where many of the functions were not listed nor documented. Thankfully, with the help of the always useful stackoverflow, I was able to find the following snippet for displaying all user functions: select name, definition, type_desc FROM sys.sql_modules m INNER JOIN sys.objects o ON m.object_id=o.object_id where type_desc like ‘%function%’ via sql server – SQL list of all the user defined functions in a database – Stack Overflow. Very cool! 🙂

Create PayPal subscription buttons [SOLVED]

Since PayPal came up with their new ‘streamlined’ interface, it seems to have made some core features very difficult to find 🙁 A prime instance is the subscription buttons and links. These tools are very useful for webmasters and anyone offering recurring services online. Here is how to find the subscription tools: #1 Login to PayPal: https://www.paypal.com/ #2 Go to the ‘Buttons for subscriptions and recurring billing‘ page #3 Click ‘Create your button now‘ (you must be logged in for

Format SQL code

I have been writing copious quantities of SQL lately. Some of the queries are getting really long. When I am working with Navicat it has a nice ‘SQL beautify’ feature that takes messy SQL and makes it nice and tidy. 🙂 While that features is great when using Navicat for SQL editing, sometimes I need to workdirectly with SQL Server 2008 there is no comparable feature built into Microsoft’s SQL pane. 🙁 Thankfully, with a quick copy/paste there is an online tool

Select top 2 rows from records, grouped/partitioned by Unique ID

The Problem: A client needed a query that selected the two most recent tour dates for each user ID. This is an easy task for a single user ID because specifying the user ID and an ORDER BY tour_date DESC with a LIMIT 2 clause would get the dates needed. However, when there are a lot of users it gets harder. For a single date, the MAX function works great but in our instance it will not work because we

GoDaddy changes manual renewal to auto-renewal. Lame.

GoDaddy: “Unless you have specifically selected the manual renewal option, your purchase includes enrollment in our automatic renewal service” This domain was set to manual renewal and I did not even notice an option during the checkout process to “keep” it that way, instead GoDaddy automatically set it to automatic renewal 🙁 I am not a fan of that. On renewal why not have leave it at the domain’s previous renewal designation?

Enable remote MySQL connections on Turnkey Linux LAMP

I am a big fan of Turnkey Linux. It is great for working on projects locally, though sometimes I need to allow others access to the MySQL server on our LAN. Here are simple instructions for enabling remote MySQL connections and for allowing user access: How to allow remote access to databases | TurnKey GNU/Linux docshttp://www.turnkeylinux.org/docs/database-remote-accesssed -i “s/^bind-address/#bind-address/” /etc/mysql/my.cnf Configure MySQL to accept remote root connections (from any host (‘%’)): (added line breaks for readability) 🙂

Negotiating an Oil and Gas Lease (Creek County OK)

Recommended PDF: Lease clauses and forms, negotiation (RECOMMENDED) http://www.montana.edu/softwaredownloads/energydownloads/MineralLeasingHandouts.pdf Landmen.net – Clauses and Formshttp://www.landmen.net/clausesforms/clausesforms.htm  LEASE PROVISIONSOption to Extend Lease Surface Damages No Surface Operations Oil & Gas Only Royalty Increase Escalating Royalty Clause Minimum Royalty Clause Shut-In Royalty Clause Pugh… Negotiating Your OIl & Gas Lease | Oil, Mineral & Gas Lawhttp://www.kwgd.com/negotiating-oil-and-gas-leaseOne of the more difficult things landowners are called upon to do is negotiate an oil and gas lease.  Oil and gas leases contain many unique terms in the