blog code

Changing only the year in a mysql date or datetime field

For a datetime-field:

UPDATE table_name
SET date_column=DATE_FORMAT(date_column,'2016-%m-%d %T');

For a date-field:

UPDATE table_name
SET date_column=DATE_FORMAT(date_column,'2016-%m-%d');

It’s been a little silent here, lately

..maybe this will change…

Meanwhile, here is a picture of a cat, after losing a battle with a bee.
Cat's nose after losing a battle with a bee


How to work with me

[ad name=”Adsense – text only”]

  • I prefer to work fast, minimize bullshit, get to the point.
  • You will sometimes have bad news for me. I want it immediately. I can usually show you how to fix it. And I never blame the messenger.
  • Bring pen and paper to every meeting with me. Pay attention to what I say; I’ll try to speak with care. If I frequently must repeat instructions, or remind you of something I’ve already told you, you will not work with me again.
  • If I’ve scheduled a weekly meeting with you, don’t assume that this meeting is the only time to raise issues with me; Interrupt me for time critical issues.
  • If you have a meeting with me at an assigned time, and I am in another meeting with my door closed, interrupt me. I stack meetings, and each meeting leads into the next.
  • I like “micro-meetings”. Get in quick, bring only the necessary parties to the table, make a decision, get out. Five minutes or less. Make these effective by knowing what decision needs to be made before you start, and presenting the decision criteria ahead of time to all participants.
  • Stand during micro-meetings.
  • I don’t like email, particularly for discussing complex topics. If a decision needs to be made, do a micro-meeting. If a problem needs to be discussed, ask the person with the most depth to prepare something, an agenda, have a whiteboard, and work through it quickly.
  • One exception to the above: I like “micro-updates”: Quick emails confirming time critical commitments and mutual understanding. These are especially useful after we hold a meeting and I give you a set of directives: I always like to hear our agreed-upon commitments echoed back to me. I may not respond, but I will read it. Keep these emails short: Spare me the greetings, thank yous, regards.
  • Be consistent in your communication. Use words consistently. Use email headers consistently. Strive to make your work immediately comprehensible.
  • If you disagree with me, voice your differences. I welcome and invite dissent. If this makes you uncomfortable, feel free to prepare your thoughts after the meeting and then later return to make your case.
  • Ego-driven debates annoy me. Check your ego at the door: I’m only interested in reaching the best, most elegant solution —I don’t care if it’s your idea or mine.
  • Don’t be afraid to ask questions if you’re not clear. I have more patience for explaining and clarifying my position before you start than I do patience for fixing a wasteful, incorrect approach after the fact.
  • Don’t tell me something is in the process of being done without telling me when it will be done. I’m more interested in the time commitment than the fact that an effort exists.
  • Always give me options, informed by an economic analysis where possible (if there are dollars involved, an analysis is mandatory), and then make your recommendation. Don’t tell me there’s a problem without offering a solution. Don’t offer me multiple solutions without giving me your best and final recommendation.
  • If you must prepare reports for me, review spreadsheets I’ve created. Copy the style and format.
  • Don’t send me long documents. I like precision and concision. Say it on one page (or less).

That’s it.
If you need more tips, get One Minute Manager from Kenneth H. Blanchard.

blog code

The Ultimate Guide to Extend, Modify or remove the WordPress 3.1 Admin-Bar

Oh, already forgot this article in my drafts:

Since WordPress 3.1, a lot of new cool features were added. One of the most hated loved ones is the admin-bar. In this article I will cover some of the basic hooks to modify it to suit your needs.
Let’s go:

[ad name=”Adsense – text only”]

How to Disable the Admin-Bar

The developers of WordPress made it really easy for you to disable the admin-bar. Simply go to Users > Your Profile and find the section where it says “Show Admin Bar” and tick your choice.
But this is just saved for each users separately. If you are working on a site for a client and you want to get rid of it for each user, then simply open your theme’s function.php and paste the following code:


This will get rid of the admin-bar – if you want to remove the settings in the user profile too, just append this code:

function hideAdminBar(){
    echo "<style type='text/css'>";
    echo "  .show-admin-bar {display:none;}";
    echo "</style>";

Change the CSS (Move to bottom)

By default, the bar shows on top of each page when you are logged in. If you don’t like that, you can hook your own CSS to the admin-bar and move it to the bottom (and do some more crazy stuff with it).
Simply add this code to your functions:

function adminBarCSS() {
        echo "
        <style type='text/css'>
             html { padding-bottom: 28px !important; }
             body { margin-top: -28px; }
             #wpadminbar {  top: auto !important; bottom: 0; }
             #wpadminbar .quicklinks .menupop ul { bottom: 28px; }
add_action('admin_head', 'adminBarCSS');
add_action('wp_head', 'adminBarCSS');

Now it’s up to you to do some more interesting stuff (like moving the bar to the left/right, let it float, or whatever).

Remove Links from the Admin-Bar

If you want to (or need to) remove links in the admin-bar. this small function will help you:

function myAdminBarRender() {
    global $wp_admin_bar;
add_action( 'wp_before_admin_bar_render', 'myAdminBarRender' );

The way this works is just to provide the IDs for each link to the remove_menu() function.
You can find all default links in /wp-includes/admin-bar.php.

Some of the defaults are:

  • my-account / my-account-with-avatar – the first link, to your account
  • my-blogs – the ‘My Sites’ menu (for networked blogs)
  • get-shortlink -provides a Shortlink to that page
  • edit – the edit link
  • new-content – the ‘Add New’ drop down
  • comments – the ‘Comments’ drop down
  • appearance – the ‘Appearance’ drop down
  • updates – the ‘Updates’ drop down

Add Links to the Admin-Bar

Here you have a simple way of putting custom links into the admin-bar.

function myAdminBarRender() {
    global $wp_admin_bar;
        $wp_admin_bar->add_menu( array(
        'parent' => 'new-content',
        'id' => 'new_media',
        'title' => __('Media'),
        'href' => admin_url( 'media-new.php')
    ) );
add_action( 'wp_before_admin_bar_render', 'myAdminBarRender' );

You even can create a custom drop down menu in the admin-bar – just take a look at Michael Martins tutorial to get you started.

That’s it for now – now go and pimp your admin-bar! :)