Waking Up

I have been thinking about writing this for a few months. I just couldn’t decide the proper venue or content to share it properly.

What I’m going to share is personal, but necessary. It is also potentially problematic — but I feel like I need to share it not just for my benefit but for others who may share my current (and previous) lot in life. Holding back any more is not the path towards growth.

It was November when I decided things needed to change. I had to change. Change what? Everything.

I had just spent a large portion of my life throughout the year working harder than I ever have before. I worked a full-time day job and then was shooting weddings and engagements every other free moment. Spending 18 hours a day sitting at a computer. Sleep was no longer a normal thing. It was an afterthought. A distraction.

I loved the results and things I accomplished but the process became a blur. I was no longer able to appreciate what I was spending my time doing, either behind the lens or behind the computer.

Unmotivated, anxious, and depressed, the season was starting to wind down. There was more time to reflect. Initially, that time of reflection directed me more towards anxiety and dissatisfaction. I thought my state was due to circumstances. Things I could not change, but just had to deal with.

I had spent the year deluding myself with the notion that I had everything under control. I could do it all. Somehow I also thought I was really good at it, too.

Then I cracked.

Everything seemed like an enormously stressful charade. I thought that maybe if I could just change the day to day things then it would fade away. Maybe a different challenge or doing something new would make it all better.

No matter what it was I still felt like I was invisible. And every day it got worse.

bttf-hand[1]

I couldn’t just snap out of it. It was impacting every relationship in my life. It’s one thing to just deal with it internally, but to alienate yourself from everyone you care about is not fair to them. It was hurting more people than just myself.

Something had to change because as easy as it is for me to rationalize hurting myself, it is much much harder to rationalize hurting other people.

I spent a hard few days reflecting on the specific things that were making me miserable. A few of the things were within my control, others were not. Of the things I could not change, could I remove them from my life — or at least minimize their presence? For things I could control, was it worth it to keep those things in my life or should I shed them entirely? If they stay, what was I going to change about how the impact me, my thoughts, and how I live my life?

For someone always seemingly in control I had to ask myself one of the hardest questions. Do I need help to do these things?

The answer was yes.

Once I admitted I needed help I became free to release some of the weight I was carrying around. Others helped me to find the things I needed to start on the path towards crafting a lifestyle that allows me to cope with normal stressors without the need to retreat.

I’ve scaled back a large part of my professional endeavors and focused more on what is going to be beneficial for me without creating additional stress and anxiety. I’m sleeping almost normally and I’ve been able to ease back into having a small social circle.

Things are getting better, but the real learning experience for me was to realize that I can still have it all without having to sacrifice my self in the process.

Bay Photo ROES Emerge Problems

If you’re a photographer trying to order items from Bay Photo through their ROES Emerge software platform I’m sure you’ve been frustrated with it at least once. Newer cameras like what we’re all using now are generating even larger images of 30MP+ and it seems that ROES Emerge can’t handle the images properly. I design albums for my clients using the ROES Emerge software and have had a heap of trouble trying to get it to work properly, even after trying to reach out to Bay Photo for support.

As a photographer who also happens to be a little technical, I decided to start monitoring the log file associated with the application. In my case it was in: C:\Users\Username\.BayPhotoEmerge\roeslog.log

So I fired up the application and tried to open my saved album that continuously failed to transmit to Bay Photo for processing. The application would hang and crash every single time. I tracked through the log as it updated and found that I kept seeing:
Exception in thread “AWT-EventQueue-2″ java.lang.OutOfMemoryError: Java heap space

So I got curious and figured that the application was indeed overflowing the memory allocation that Java was allocating it. How do I fix that? Well I ran across this here which seemed to offer some insight.

Now I have to find the config that is being used for my Bay Photo ROES Emerge to see if I can manually enter the amount of memory that can be allocated to the application.

  1. To do this I right clicked on the Bay Photo Emerge shortcut on my desktop and go to the properties item.
  2. Go to the ‘shortcut’ tab
  3. find the entry for ‘target’
  4. at the right side of that entry should be a file location in double quotes like “C:\Users\Username\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\47\2bfd02ef-7d42d6b5″ (note that the actual filename may vary on your system)
  5. Copy this file path to your clipboard and open notepad. Once notepad is open go to the file menu, select ‘open’ and paste the path from your clipboard into the filename field then click ‘open’
  6. Once opened you’ll see a bunch of stuff that probably doesn’t make sense. Look for this (or something really similar):
    <j2se version=”1.6+” max-heap-size=”1024M”/>

    This is the entry that tells Java how much RAM should be allocated for the application. If it is habitually hanging up and crashing then this limit is too low. If you know for sure you have plenty of RAM to spare (like I do) you can change this to something greater than it is currently.

  7. I changed mine from 1024M (1GB) to 4096M (4GB):
    <j2se version=”1.6+” max-heap-size=”4096M”/>
  8. After that change I saved the file, exited notepad, and restarted Bay Roes Emerge.
  9. I retried the operations that continuously failed earlier and it seemed to work as expected.

I’m not sure why this was such a hassle to get to this point but given the fact that I’m not afraid to dig around helped a lot. If I wasn’t apt to explore I would probably be frustrated for another week of back and forth with support. Hopefully someone else stumbles on this post and it is helpful to them.

Deploy a git repository on remote CentOS Linux web host

Recently came across the need to be able to push a git repository directly to a web server and have the repository’s changes automatically reflected in the server’s web root. The aim was to simply push the repo out to the web server and have it automatically apply the changes to the web site’s code.

There are several ways of doing this and this is not necessarily the most seamless but it doesn’t require as much pre-configuration to get up and running as other methods.

I found a few tutorials and put together my own here. For this purpose I’m using a CentOS 6 Linux remote host accessed via ssh via Putty on a Windows Desktop. The instructions follow the assumption that your remote server’s web root is empty or you have backed it up appropriately before proceeding. I’m also assuming you have a repo somewhere else that you can push to the web server remotely.

  1. Connect to your web server using your ssh client of choice. Once connected you should be prompted to log into your server with credentials.
  2. Verify that git is installed on your host machine. If it isn’t or you’re not sure you can install it using:
    yum install git
  3. Next you will need to create a bare local git repository. I’m making mine under the current user’s home directory. You can put it wherever you like but this seems as good a place as any to me:
    mkdir repo.git && cd repo.git
    git init –bare
  4. Now we have a bare git repo. Now we navigate into it and set up the hook that will link it up to our web root directory (or other web facing sub directory):
    cd hooks
    cat > post-receive
  5. This should give you a blank line where you can type in some stuff. Type this in:
    #!/bin/sh
    git –work-tree=/path/to/web/directorygoeshere –git-dir=/path/to/gitrepo/goeshere.git checkout -f
  6. Hit CTRL+D to save the stuff you just entered. Now git will checkout your repo to the web directory you specified when you push changes to it.
  7. Now give the hook you just created the ability to execute:
    chmod +x post-receive
  8. Now you have a working git repo on your host that you can push to. I have added this remote repo as a remote in my local windows msysgit  GUI. You can do the same thing using whichever method you’re using to interact with git.
  9. Now I can simply make changes locally, commit them on my local environment, then push to the remote web server which will check out the repo to the web directory specified in step 5 above.

References:

  • https://www.digitalocean.com/community/tutorials/how-to-set-up-automatic-deployment-with-git-with-a-vps
  • http://sebduggan.com/blog/deploy-your-website-changes-using-git/
  • http://www.aljtmedia.com/blog/deploying-a-git-repository-to-your-remote-server/
  • https://gist.github.com/Integralist/1875544

Add listing approval messages to Directory Press

I recently did a project that required Directory Press for a vendor directory. The DIrectory press system sends out emails for various site events but was lacking in one area. The site required that all listings that are submitted must be approved and published be an administrator. This also required an email to be sent to the post author which is something that Directory Press did not facilitate.

In order to sent the post author a message when their directory listing was published I had to add this block to the functions.php in the theme.

function post_published_notification( $new_status, $old_status, $post ) {
if ( $old_status == 'publish' && $new_status != 'publish' ) {
$author = $post->post_author; /* Post author ID. */

$name = get_the_author_meta( 'display_name', $author );
$email = get_the_author_meta( 'user_email', $author );
$title = $post->post_title;
$permalink = get_permalink( $post );
$edit = get_edit_post_link( $post, '' );
$to[] = sprintf( '%s <%s>', $name, $email );
$subject = sprintf( 'Your Post %s has been published', $title );
$message = sprintf ('Congratulations, %s! Your post “%s” has been published. Please return to verify that your listing appears as you\'d like and make adjustments if necessary.' . "\n\n", $name, $title );
$message .= sprintf( 'View and edit if necessary: %s', $permalink );
//add information here if you want to change the send from address
//$headers[] = 'From: Site Admin ';

wp_mail( $to, $subject, $message, $headers );
}
}
add_action( 'transition_post_status', 'post_published_notification', 10, 3 );

Import CSV with PHP to update MySQL data

I have written a very simple script to perform a useful function for me. I figured I’d share it so that others can make use of it.

If you have a CSV file with the first row containing headers and the subsequent rows containing data that you wish to update along with an ID column, then this will work for you without any issues. If your primary key is different or you wish to match other criteria you may need to adjust the script a bit. This does not facilitate upload but only uses a csv file residing on the same directory as the script.

Carbonite Online Backup – Don’t do it.

I’ve got a lot of data to back up. Lots. I have tried several services and were unhappy with the pace of the backups as well as the lack of reliability.

I landed on Carbonite as my next product to try out. With the volume of data I had to back up, I gave it a try. Initial backups were going at a steady pace. Faster than I expected, really. But after the initial 30 days or so it slowed to a crawl. It would have taken about 18 months to get my initial backup completed and by that time I would have double the data. It was never really going to be able to keep pace and that was a huge deal breaker.

In addition to the slow pace of the initial backup, the actual backup engine software failed to work more than a dozen times, resulting in weeks of absolutely no backups. I had to keep restarting my computer, re-installing the software, and hoping it would just start working. At one point it told me it was going to have to start the backup over again. That was the icing on the cake so I gave up on it. I couldn’t trust it with my data.

This service just wasn’t going to work. Carbonite isn’t a good solution. I emailed support and asked to cancel the account and have a refund of my remaining balance. A bit later I get a response that I need to call them during certain hours to talk to them before I can move forward. I let some time pass before I tried again.

I emailed support once more with the same request: cancel and refund. Same line. They wanted me to call them during certain hours. I responded to let them know that I would not be calling them and that this was a simple request. After a few more email exchanges and confirmations of confirmations, I was finally done with the service. Almost. At no point did they have any intention of giving me a refund on my year subscription that was used for 8 weeks. And they still haven’t given me a refund and only pointed me towards their policy on refunds – they don’t give them.

I cannot recommend Carbonite Online Backup for any real-world use (not to mention, bad business). It would have been one thing if the service just couldn’t perform, but it’s another thing entirely that they refuse to give refunds when someone is completely unsatisfied with the service.

Converting GoToMeeting Video to other formats (WMV to FLV)

I regularly process presentation recordings and encode them into streaming formats. I have repeatedly run into the problem of the near impossibility of converting the gotomeeting WMV format. GoToMeeting seems to be able to record presentations in two variations: the first being their own proprietary WMV format and the second is standard Windows WMV format.

The latter is what is needed to easily convert the video file into various other formats, FLV included.

Take these steps to convert a given file from the GoToMeeting codec to a standard WMV.

  1. Go download and install the GoToMeeting Codec pack: https://www1.gotomeeting.com/codec?Portal=gotomeeting.com
  2. After installation, go find your installation folder. It’s usually something like “C:\Program Files\Citrix\GoToMeeting\”
  3. Now you want to locate the g2mtranscoder.exe and g2m.dll files — these are what actually do the conversion for you.
  4. Once you’ve located them, copy them somewhere that you can access easily. Take note of the full path of the files (ex. C:\Program Files\Citrix\GoToMeeting\g2mtranscoder.exe)
  5. Locate the video file you want to convert and take note of that file’s path (ex C:\My Documents\Videos\videofile.wmv)
  6. If you have Windows XP go to your start menu and then open the ‘run’ menu and type in “CMD” (without the quotes). If you have Windows Vista or 7 then go to your start menu and type “CMD”  (without the quotes) into the search/run area at the bottom of the menu.
  7. Now you’ll have a command window where you will call up your g2mtranscoder using the path you took note of previously and the path of the video file:
    Your command to execute should look something like this:
    C:\Program Files\Citrix\GoToMeeting\g2mtranscoder.exe source=C:\My Documents\Videos\videofile.wmv
  8. This will run the g2mtranscoder.exe and use the video file as the source. Of course the names and locations of each of these may change depending on your system. It will overwrite the old G2M WMV with the new plain Windows WMV.
  9. You can now freely convert this WMV to other formats without the difficulty of G2m codec.
  10. You can check and see if it is complete my using Windows Task Manager to see if the process is still there. You can check task manager to see if the process is still running in the ‘processes’ tab. You’ll see the name of the exe in the list. If it shows up it is still running. It takes longer depending on the length of the video file.How to bring up task manager:
    Press CTRL+ALT+DELETE click ‘Task Manager.
    OR
    Right-click an empty part of the taskbar and click ‘Task Manager’.

 

Some tips from: http://www.any-video-converter.com/convert-g2m3-g2m4-codec-video-to-wmv-avi-mp4-flv.php

 

DirectoryPress Broken CSV export

If you use DirectoryPress 7.0.9 you may have noticed that the CSV export function isn’t working properly. This is going to be a quick “edit this here” fix.

Edit the admin-save.php file in your /wp-content/themes/directorypress/admin directory.

Find around line 1105 or so. It should have:

$dat = array_merge($dat, $FF);

Change that to:

$dat = $dat + $FF;

Save it and upload it to your server. It should now be able to export properly.

MySQL zerofill and lpad: whipping your digits into shape

I’m working with a large dataset. One of the columns is set as an INT(8) but not all of the values are 8 digits. I need to run a query that will sum values and group by the first two digits in that INT(8) column. This presents a potential problem since it may end up grouping incorrectly since I need everything to be grouped based off of 8-digit numbers. How do you make these smaller numbers into 8-digits?

Simple. There are two ways.

  1. Alter the table itself using the ZEROFILL in MySQL. This will add 0s to the left of your values up to the max number of digits defined for that column:
    • ALTER TABLE [table name] MODIFY COLUMN [column name] INT(x) ZEROFILL UNSIGNED;
    • Where table name = your table name, column name = the desired column to pad, and x is the number of digits allowed for that column
  2. Pad the values using lpad() in your query itself, without altering your table:
    • select lpad(column name,x,'0') from table name;
    • Where table name = your table name, column name = desired column to pd, and x = the number of digits to allow.
    • If your value in the DB is 332, your result will be 0332. If your value is 9, the result will be 0009.

Hopefully this will help someone facing the same problem I was. It’s also good to know that there are multiple ways of doing things.

Installing memcache on PHP with CentOS 6

I was following the instructions here to install memcache on a CentOS 6 server that I’m currently configuring. I was able to install the base memcache rpm, but had trouble when installing the PECL extension for PHP.

The first error I got had something to do with not being able to phpize the script.

So, I ran the following command to install the php development package:

yum install php-devel

Then I re-ran the PECL memcached install and came across this message:

checking for the location of zlib… configure: error: memcache support requires ZLIB. Use –with-zlib-dir=<DIR>

And finally found a solution for this by running this command to install the zlib-devel package:

yum install zlib-devel

Now you should be able to successfully install and add the memcache extension to your php.ini. Follow the instructions linked above for more information.