Archive for the ‘Technology’ Category
“Author” and “Committer” fields in git metadata…
Friday, November 18th, 2011Discovered a nice little git trick today. I haven’t seen this documented, so I’m not sure if it’s a feature per se, but if you set your user.name via git config like so:
[user]
name = accountname
email = email@company.com
and then commit with the --author="Full Name" flag set to another name, this will set git’s commit metadata such that “Author:” is “Full Name” and “Committer:” is “accountname”.
Useful when you want to see the Author in your git logs and the Committer in tools like Hudson or Jenkins.
MySQL Table Copying
Thursday, November 17th, 2011It’s too bad the MySQL documentation reads like a drunken rant channeled in English through Leo Tolstoy reincarnated as a database geek, otherwise I might be more familiar with nice features such as
CREATE TABLE IF NOT EXISTS database_b.my_table SELECT * FROM database_a.my_table
which quickly copies my_table form database_a to database_b however given that it’s virtually impossible to read the MySQL documentation and because I cringe in horror whenever a MySQL doc page comes up in a Google search, especially since any search for anything MySQL related always results in a deluge of of links pointing into the inscrutable mess that passes for the MySQL reference site, I suppose I will forever be pining for a switch to PostgreSQL or, at the very least, not be be surprised when Oracle starts to charge exorbitant sums for consultants who are able to translate the MySQL documentation from neo-Leo Tolstoy techno-babble into succinct technical English.
Less Snarky Update
The above seems to behave differently on Windows than it does on Linux. On Windows it will not copy data if the table already exists, the preferred behavior in my opininon. On Linux it will copy (and potentially duplicate) data.
zend_mm_heap corrupted
Friday, November 11th, 2011Has Apache suddenly started telling you that the “zend_mm_heap” is corrupted? Rather than mucking around with output_buffering or other php.ini values as recommend in a couple of places, first check that, if you have a custom session manager (typically memcached), it is started and you are able to connect.
For example, if your session handling is setup as follows:
[Session]
; Handler used to store/retrieve data.
; http://php.net/session.save-handler
;session.save_handler = files
session.save_handler = memcache
;session.save_path = "/tmp"
session.save_path = "tcp://localhost:11211?persistent=1&weight=1&timeout=1&retry_interval=15"
check to make sure that you can actually connect to localhost on port 11211:
$ telnet localhost 11211
Trying 127.0.0.1...
Connected to localhost.localdomain.
Escape character is '^]'.
stats
STAT pid 24041
STAT uptime 257289
STAT time 1321027200
STAT version 1.4.2
...
END
If you can’t connect, or the memcached server is not responding as above, then you’ve found the source of the “heap corruption”.
Doctrine Migrations and Jenkins
Wednesday, November 9th, 2011If you’re trying to automate Symfony2/Doctrine2 migrations with Jenkins, you may run afoul of the interactive confirmation that the doctrine-migrations package throws out:
$ app/console doctrine:migrations:migrateApplication Migrations
WARNING! You are about to execute a database migration that could result in schema changes and data lost. Are you sure you wish to continue? (y/n)
This will break the Jenkins build. While there is probably a way to get Jenkins to reply to this with a “y”, it’s easier just to use the under documented --no-interaction switch. In a build.xml for example:
<target name="schema" description="Update database">
<exec executable="app/console" failonerror="true">
<arg line="doctrine:migrations:migrate --no-interaction" />
</exec>
</target>
Now if the migrations work, so does the build.
Delete email with a specific email address from the Postfix queue…
Tuesday, November 1st, 2011HowtoForge still comes in handy. This is one of those times:
mailq | awk 'BEGIN { RS = "" } / falko@example\.com$/ { print $1 }' | tr -d '*!' | postsuper -d -
File under “what to do when postfix goes berserk”.
Ubuntu Apache Umask
Wednesday, October 19th, 2011Back to obscure technical topics for a moment.
Figuring out how to set umask for Apache on Ununtu was faaar more difficult than it needs to be. Even though it’s not an environmental variable, the “Ubuntu Way” seems to be to add this to the end of /etc/apache2/envvars like so:
...
## Some packages providing 'www-browser' need '--dump'
#export APACHE_LYNX='www-browser -dump'
umask 000
Restart Apache and voila, the above umask will give all files written by Apache a chmod of 777.
Use this particular example with caution.
tinyint(1) showing as bit?
Sunday, September 25th, 2011If Java is showing you tinyint(1) as a boolean bitfield, that’s probably because MySQL recently changed the behavior of tinyint:
As of MySQL 5.0.3, a BIT data type is available for storing bit-field values. (Before 5.0.3, MySQL interprets BIT as TINYINT(1).) In MySQL 5.0.3, BIT is supported only for MyISAM. MySQL 5.0.5 extends BIT support to MEMORY, InnoDB, BDB, and NDBCLUSTER.
To convince your JDBC driver to show you tinyint for the tiny little int that it actually is, rather than as a boolean, try setting the tinyInt1isBit=false parameter when connecting.
Outlook macros and self-signed certs on Windows 7
Thursday, September 8th, 2011If you are trying to get some custom macros to work with Outlook as outlined, for example, here and here, you may be befuddled to discover that that your macros fail silently; usually after restarting Outlook. This is because Outlook is quietly disabling all macros because it hates youI mean, because it doesn’t trust you. That is to say, it doesn’t trust your self-signed cert.
In Windows 7 it appears as though self-signed certs have to first be copied into a “trusted” group before they can be used. Here’s how to do it:
- Run certmgr.msc as an Administrator.
- Open the “Personal” tree node in the left pane.
- Open the “Certificates” node under the Personal node.
- Note that your self-signed certificate appears in the right pane. It may have a red “X” through it.
- Double-click the certificate in the right pane to see instructions about copying the certificate to the “Trusted Root Certification Authorities” store. Good thing these important details are so easy to discover.
- Hold down the control key and drag the cert into “Trusted Root Certification Authorities > Certificates” which should appear immediately below the Personal node.
- Follow any prompts to completion. The red “X” should disappear and your cert should know have a key icon attached to it.
- Inside Outlook, re-associate this cert with your macro.
- Restart Outlook for the new cert to be applied.
And voila, Outlook trusts you again.
Not, of course, that you should every fully trust it back.
Command-line Apache Status
Tuesday, August 30th, 2011Here’s another thing I have to do once per year and can never remember how to do.
If you have Apache extended status activated thusly:
<IfModule mod_status.c>
ExtendedStatus On
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from localhost ip6-localhost 127.0.0.1
</Location>
</IfModule>
…then you can check in on what Apache is up to via Lynx from the command line:
$ wget -q -O - localhost/server-status | lynx -stdin
Quite handy.