Tag Archives: code

Including the version in a Maven artifact

Recently I wanted to include the version of an artifact generated by a Maven build into a text file in that artifact. As Google and and good friends will help you with, I was pointed to this article that was exactly what I wanted.

Basically, create a /src/main/resources/version.txt file with the following content…

${project.version}

… then including the following snippet in your “build”…


<build>
  <resources>
    <resource>
      <directory>src/main/resources</directory>
      <filtering>true</filtering>
      <includes>
        <include>**/version.txt</include>
      </includes>
    </resource>
    <resource>
      <directory>src/main/resources</directory>
      <filtering>false</filtering>
      <excludes>
        <exclude>**/version.txt</exclude>
      </excludes>
    </resource>
  </resources>
</build>
Please remember to subscribe to the newsletter to stay up to date!

You or someone you know looking to buy or sell?
Disclaimer: Thoughts and opinions are my own, and do not reflect the views of any employer, family member, friend, or anyone else. Some links may be affiliate links, but I don't link to anything I don't use myself. You would think this should be self evident these days, but apparently not...

Execute MySql script from the command line

This tip is very similar to how to “Execute a SQL file via the MySQL command line in one line” only this time specifying the DB you want to execute the script against and being prompted for your password…

mysql -u user -p -h localhost MyDb < ~/SQL/script.sql
Please remember to subscribe to the newsletter to stay up to date!

You or someone you know looking to buy or sell?
Disclaimer: Thoughts and opinions are my own, and do not reflect the views of any employer, family member, friend, or anyone else. Some links may be affiliate links, but I don't link to anything I don't use myself. You would think this should be self evident these days, but apparently not...

Using sed to view and replace text on a specific file in Linux

Ever need to replace very specific text on a particular line in a very large file on Linux? Enter the sed command.

To view the line (let’s say line 864 in this case) in the specific file, issue this command…

$ sed -n '864'p myfile.txt

And let’s say you get back the string ” I hate cheese”. Since we all know that’s not true, you can use a different variation of the sed command to replace “hate” with “love” like so…

$ sed -i '864s/hate/love/' myfile.txt

And if you’re really curious on how this even came about, it was due to an error in the phpMyAdmin export.php script when you had to change “break 2” to “break” on line 846 as identified here: https://askubuntu.com/questions/928883/500-error-on-phpmyadmin-export-on-phpmyadmin-export-php/930975

Please remember to subscribe to the newsletter to stay up to date!

You or someone you know looking to buy or sell?
Disclaimer: Thoughts and opinions are my own, and do not reflect the views of any employer, family member, friend, or anyone else. Some links may be affiliate links, but I don't link to anything I don't use myself. You would think this should be self evident these days, but apparently not...

Email Bookmarklets

Ever want an easy way to email a webpage to yourself? Maybe it’s to send it to your task list, or just to share with a co-worker? Of course there are extensions for most browsers to do this, but if you would prefer a bookmarklet that doesn’t require any installation, here’s how to do it. This is the basic link structure…

javascript:document.location='mailto:?subject='+document.title+'&body='+escape(document.location);

Or, for simplicity sake, just drag and drop this link into your bookmarks bar… Email

Of course you can go wild and start customizing the URL to your hearts content. Set a value after the “mailto:”, or maybe even a CC. For example…

javascript:document.location='mailto:[email protected]?subject='+document.title+'[email protected]&body='+escape(document.location);
Please remember to subscribe to the newsletter to stay up to date!

You or someone you know looking to buy or sell?
Disclaimer: Thoughts and opinions are my own, and do not reflect the views of any employer, family member, friend, or anyone else. Some links may be affiliate links, but I don't link to anything I don't use myself. You would think this should be self evident these days, but apparently not...