Knowledge Nuggets

Anyone who has done development, design, or IT knows that over the course of working on a project, you collect various “nuggets” of knowledge that you ever learn or find. Here I’m going to share some of what I’ve discovered that may be able to help you in your own projects. I have cited the original source of the information if I have that available. If there is something that I’ve left out, feel free to add it in the comments.

“Fatal error: Out of memory…” occurring when PHP and Apache memory limits seem fine

This problem drove me crazy for a little while. I did everything that I thought I needed to do, I changed the php.ini file to increase the php memory available until I ran across this link which provided the answer. We are using WiredTree as our hosting provider, for their servers, the problem was fixed by simply adding: RLimitMem 128000000 to the .htaccess file in the www root directory. After doing this, it fixed everything.

I keep getting Notice: Undefined offset: 1 in views_block_view() in Drupal 7

After doing a bunch of operations during prototyping a Drupal 7 site we kept this error. There wasn’t anything that we seemed to be able to do to eliminate it from the Drupal administrative interface. After searching the web for quite some time I came across this page: http://objitsu.com/node/29 which gave me all of the information I need. From the article:

It’s caused by stale records in the block table that then fail to resolve. There’s plenty of reading material out there and suggested fixes etc. that I am sure work but once I knew what the problem was I applied *my process* for all Drupal problems like this.

  1. Find the code that issues the message..
  2. Trap the code and drupal_set_message() the offending item
  3. Use that information to fix-up the database / code as required.

Here’s how the fix works for this particular problem. In my case I edited views.module, line 569, here’s the code that was causing the notice to be show:


list($name, $display_id) = explode('-', $delta);

and here is what I added to the code to find out what the duff delta in question was…


if (count(explode('-',$delta)) == 1) {
drupal_set_message($delta);
}
list($name, $display_id) = explode('-', $delta);

All I did then was refresh the page, take a note of hash value that was displayed and then cutting-and-pasting it into a command line MySQL session I issued this query:


mysql> delete from block where delta = 'd98a0bfa5a33e7d8bab0fc0670bdc9fd';
Query OK, 4 rows affected (0.01 sec)

Which took out all four problem pages at once.

What are the command line commands for git?

We use git for source control of our iOS projects. I found a great cheat sheet of git commands here:

Git Cheat Sheet.


Categories

Archives