Category Archives: programming

How to fix the fatal error allowed memory size exhausted [SOLVED] (PHP)

How to fix the following memory size error on turnkeylinux (or similar)? ( ! ) Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 80 bytes) in /var/www/fit2019/index.php on line 2841 Call Stack # Time Memory Function Location 1 0.0015 510656 {main}( ) ../index.php:0 2 0.0153 523256 funcMakeTableTotal2019( ) ../index.php:487 3 2.0429 33543952 mssql_fetch_assoc ( ) ../index.php:2841 Answer:Edit the configuration file: /etc/php5/apache2/php.ini and set the memory limit to a value higher than 32M: memory_limit = 128M Then

How do I clean my coffee maker? [AI Answered]

NOTE: this is an AI generated answer, using OpenAI GPT-2. Here is the question prompt and the resulting answer: Q: How do I clean my coffee maker? A. There are numerous cleaning methods to choose from. 1.) Pour some water into the coffee maker and submerge the lid. Do not wash the glass. 2.) Dip the coffee maker upside down in water for 10 seconds and then rinse. 3.) Put the lid back on and let the coffee maker sit

Show SKU in cart and checkout [WooCommerce]

Recently I have been setting up a quote only WooCommerce site. Specifically, the site needs to have SKUs listed and quantity info but not pricing. Here is a method to get SKUs listed throughout the cart/checkout pages: Step 1. Setup child theme Step 2. Copy the templates from /plugins/woocommerce/templates/cart/cart.php and /plugins/woocommerce/templates/checkout/review-order.php to your child theme folder, with the result being similar to this: Step 3. To add SKU to Cart and Checkout (Order Review) Edit your cart.php template, where appropriate add: <?php echo

Online PHP code editors

Here are some rather interesting PHP code editors that run entirely online. They can be particularly helpful if you need to be able to develop from any machine anywhere (as long as you have an internet connection). 🙂 Online Code Editor – Codeanywherehttps://codeanywhere.net/Codeanywhere is compatible on all major browsers so you can work from the one you like, also if you on your mobile you can download the native mobile apps for iOS and Andriod. PhpFiddle – PHP/MySQL online IDE and execution

Order SQL query manually when numeric string representation is out of order

In some instances, doing a straight ORDER BY ASC (OR DESC) does not work as one might want: 0-50 101-200 201-300 301-400 401-500 501-600 51-100 601+ That is not how humans do it 😉 A way to get around this, is to add a new column and put in an ordering value, for instance: 1. 0-50 2. 51-100 3. 101-200 4. 201-300 5. 301-400 6. 401-500 7. 501-600 8. 601+ Now that is much better 🙂 Here is a real

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! 🙂

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