Category Archives: Remember This

Grep picking up HTML (text) file as a binary file

For some reason, grep, thought that a “HTML document, Non-ISO extended-ASCII text, with very long lines” was a binary, so refused to print contents.

TIL about -a. In grep, -a tells grep to process a binary file as if it were text. This means, if grep incorrectly thinks a file is binary, it’ll still work with it.

That cost me at least 2 hours of scratching my head, wondering why my regex wasn’t working as it should…

Odd Magento / Fishpig / WordPress error

If you get an error like:
Fatal error: Call to a member function select() on a non-object in /home/username/public_html/app/code/community/Fishpig/Wordpress/Model/Resource/Page.php on line 119

Then, check you’ve not just changed a MySQL username, without updating the fishpig configuration, or otherwise Fishpig can’t access the MySQL database for some reason. It seems to store a MySQL login in Magento config. I’ve not yet found exactly where, I’ll update this post with more once I understand more about what it’s doing.

 

It presented as the main Magento site throwing the following error:

exception ‘Zend_Exception’ with message ‘dbModel read resource does not implement Zend_Db_Adapter_Abstract’

 

Which it seems that most everyone will tell you to clear your cache to fix. You *will* need to clear your cache, probably. Just, after fixing the MySQL connection issue.

 

The following line is to make it easier for people googling to find this post:
Fatal error: Call to a member function select() on a non-object in /public_html/app/code/community/Fishpig/Wordpress/Model/Resource/Page.php on line 119 magento fishpig

 

This post my making sure  https://xkcd.com/979/ doesn’t happen from me.

Low Carb Hot Chocolate

One of my bosses sent me this, his favourite easy recipe for a nice hot chocolate style drink. Saving it here so I remember to do it..

Half a tin of coconut milk in a saucepan.
Simmer.
Stir in as much cocoa as you want, and chunks of chocolate too, if you like it thick.
Add some xylitol to sweeten.
Pour into a mug.
Thick, astonishingly satisfying and good for you.

(Obviously, only pour into a mug once all the cocoa has mixed and chocolate melted – I use a whisk, and add a capful of vanilla essence too).

WordPress Cookie names

Here’s a list of cookies wordpress sets when you login. Because I can’t find this list anywhere on the net and I need it.

wordpress_[HASH] — admin panel auth cookie
wp-settings-3 — settings cookiewp-settings-time-3 — settings cookie
wordpress_test_cookie — cookie used to test that wp can set cookies. Honestly guys, really?
wordpress_logged_in — another auth cookie

 

Cook Me.

This is on my list of things to cook. Soon. Posting it here so I have *no* excuse. Instructions from a friend:

 
Visi: you should make the roast squash!
Visi: chop them in half, scrap out the seeds, score it with a grid, rub butter in, coat in salt and pepper and roast
Visi: put a lil bit of curry powder on near the end
Kirrus: temperature?
Visi: 180 I guess
Visi: whatever temperature you want!
Visi: takes a while but when you can shove a fork through it it’s done
Visi: *easily

Go (wéiqí, igo, baduk, cờ vây) opening

I’ve been playing Go a bit of late, and a friend was taught this about openings, during a review of a game on KGS. Posting it here mainly so I remember for the future! 🙂

Teofrostus [2k]: when you're playing go, there's a nice checklist that you should go through during the opening 
Teofrostus [2k]: it goes something like this
Teofrostus [2k]: 1) Do I have any weak groups?
Teofrostus [2k]: 2) Does my opponent?
Teofrostus [2k]: 3) Are there any unapproached corners? [opponent corners before allied corners]
Teofrostus [2k]: 4) Are there any "big points" left?
Teofrostus [2k]: and you should respond to these in this order

Also worth noting:
Teofrostus [2k]:it's something that you should follow until you're like 3d

MySQL Linux CLI command execution

As another aid to my memory, you can run mysql commands on the command line like this:

mysql -u user -p[password] database -e "SELECT * FROM orders;".

 

You can also send the mysql client commands on stdin:

echo "SELECT * FROM orders" | mysql -u user -p[password] database

 

Or read them in with a file redirection

mysql -u user -p[password] database < /home/kirrus/orders.sql

That last one is really handy for reading MySQL dumps back into MySQL.

MySQL GRANT syntax oddity, show views

So that I don’t forget: Despite what the documentation says, being unclear (links always have an underscore over there, so it’s hard to tell difference between a linked underscore linked item, and one merely space-separated), you should grant ‘SHOW VIEW’, not ‘SHOW_VIEW’. Additionally, ‘SHOW VIEW’ really needs SELECT permissions as well.