Tip: Include email in notification message when sending confirmation mails

If you are a web developer and needs to handle user registration the you probably are sending out confirmation emails to users to ensure they’ve entered a valid email.

Lots of web sites (and apps) are showing a message saying “We’ve send you a confirmation mail. Please check your mailbox”.

Tip of the day is this – make sure to include the actual email in that notification message. In case a user actually entered a wrong email he will notice immediately and doesn’t need to refresh his email box to see if the mail is coming through. A simple “Hey, we’ve send off a confirmation mail to john@doe.com now. Please check your mailbox in a minute” is enough.

I’ll add this tip to an upcoming article about UI tips & tricks for apps and web sites.

Immediately flush IIS log for real time tail to avoid 60 second buffer delay

I wanted to tail my IIS log in realtime to avoid having to wait 60 seconds as is the default on IIS 7. I found out that I could run the command

> netsh http flush logbuffer

This is great but I wanted to do a tail so this short script does the trick for you (I assume you have cygwin installed if you’re on Windows)

Run command every second in the background and flush output (the “Ok.” message)

$ while true; do netsh http flush logbuffer > /dev/null; sleep 1; done &

Then you’re able to do your regular tail

$ tail -100f u_ex130814.log

and have it update in real time.

Tweak AppCode font aliasing on your mac

If you can’t use your beloved Monaco font in AppCode because it has gained weight and simply looks too bold, you might want to trim your anti-aliasing settings.

Try running this in your terminal

$ defaults write com.jetbrains.AppCode.plist AppleFontSmoothing -int 1

Left one is updated and right one is original

You might tweak it even more by using different values for -int 1 e.g. 0, 2 or 3. I’m not changing the system wide font smoothing setting, but only the one for AppCode.

Resolving DNS issues on my ThinkPad running Windows 8

I just installed Windows 8 but had a hard time figuring out why not all sites were available. I quickly found out the DNS lookup failed.

Since I had to uninstall my ThinkVantage WIFI manager before installing Windows 8 I assumed it could have something to do with an invalid configuration.

I had to reset my TCP/IP stack before I got it to work which is done using

C:> netsh int ip reset reset.log

followed by

C:> netsh winsock reset catalog

It should do the trick — you might have to restart your computer.

How to slice a PSD for use with iPhone & iPad

If you are designer doing iOS interfaces and want to help your developer, these guidelines are for you.

  1. Slice both a regular and retina version.
  2. Retina files are postfixed with “@2x.png” (for “two times”) e.g. “account.png” vs “account@2x.png”
  3. Retina files must be placed in same folder as its non-retina brother
  4. Retina dimensions must be dividable with 2 e.g. 25×13 is not a valid retina dimension but 26×14 is fine
  5. All files should be of type PNG (24bit if necessary)
  6. Background files might be in JPG too (saves on file size)
  7. Use transparency if needed – no background color
  8. All files must be lower-cased
  9. All files must not include any spaces
  10. Separate filenames with dashes if necessary e.g. “black-box.png”
  11. Group files in folders if needed e.g. “icons/account.png”, “backgrounds/washed.png”
  12. Keep folder structure after delivery to developer and update files in that structure if needed
  13. Animations must be postfixed with a number e.g. “anim_0.png”, “anim_1.png”, “anim2.png”, etc. (retina would be “anim_0@2x.png”, “anim_1@2x.png”, etc)
  14. Inform developer of any special masking necessary
  15. Slice each image with zero margin/padding i.e. keep to size of image

An additional tip for Mac users. Download Slicy from macrabbit. It’s an incredible cool tool which slices your PSDs automatically based on your layer naming.

Let me know in the comments if you have more suggestions I need to put on the list.

A bash version of keep_releases known from Capistrano ruby scripts

Today I needed a clean up feature in my bash script similar to what’s known from Capistrano when using the “keep_releases” argument.

I wasn’t able to find a simple version so I created it myself. Maybe others find it useful too so here goes

releases_path=/data/sites/yoursite.com/releases # change this
keep_releases=5

versions=`ls -xt $releases_path`
releases=(${versions// / })

# check available number of versions in releases directory
releases_count=${#releases[@]}

if [ $releases_count -le $keep_releases ]
then
  echo 'no old releases to clean up'
else
  echo keeping $keep_releases of $releases_count deployed releases
  releases=(${releases[@]:0:0} ${releases[@]:($keep_releases)})

  for release in "${releases[@]}"
  do
    path=$releases_path$release
    `rm -rf $path`
  done
fi

I’ve created a github gist too. Feel free to modify it if you have a better solution.

Finding Apache configuration file (httpd.conf) location

Just a quick tip for programmers working with Apache. Sometimes I’m asked where to find the Apache configuration file on a given server. Since it’s possible to configure this there is no “default location” so I usually do:

$ ps -ef | grep apache

which gives me a list like

deploy@cmd01:/$ ps -ef | grep apache
root      4053     1  0 06:26 ?        00:00:04 /usr/sbin/apache2 -k start
www       5189  4053  0 11:00 ?        00:00:00 /usr/sbin/apache2 -k start
www       5199  4053  0 11:00 ?        00:00:00 /usr/sbin/apache2 -k start
...

Then simply run

$ /usr/sbin/apache2 -V

and you will get the details you need, specifically this

Server compiled with....
 -D SERVER_CONFIG_FILE="/etc/apache2/apache2.conf"

That’s it. Are you using another/faster approach? Let me know in the comments.