Blake Simpson

Prevent "Outlook Office Reminders" reappearing on OS X

Wednesday 22nd of October 2014

If you use Microsoft Outlook on OS X with the Exchange calendar, you will be familiar with the "Office Reminders" dialog window that will pop up and remind you of calendar events.

office reminders dialog

The problem is that this service will continue to pop up for events, even if you have closed the reminder application. Although the application has been closed and cannot be seen in the Dock, Outlook is actually running some background processes that prevent the reminders dialog from closing.

These processes can be stopped if wished, unfortunately in a not so user friendly manner, as you have to manually kill the processes using the Activity Manager.

To open the Activity Manager, open spotlight (⌘ + Space) and start typing "Activity" until you see the application.

Once open, you can filter for running processes, type "Microsoft" in the search bar in the top right.

filter activity monitor for microsoft processes

Finally once you can see these two processes "Microsoft Database Daemon" and "Microsoft Office Reminders", click on each one and click the "Force Quit" button which looks like a cross in a stop sign. Once the processes have ended, the pop up will no longer be able disturb you.

kill reminder process

Read More Comments

Cordova "rebuild precompiled header" error

Sunday 19th of October 2014

In Cordova 3.6 you may experience an error while trying to build the iOS platform stating a precompiled header has been modified and needs to be rebuilt.

This is usually caused by deleting an existing Cordova project and rebuilding it in the same directory.

Error:

fatal error: file '/Users/blake.simpson/cordova/del-app/platforms/ios/DEL Action/DEL Action-Prefix.pch' has been modified since the precompiled header '/var/folders/bq/1p80g4q56tl2zmcv96c3r3g9fw6s01/C/com.apple.DeveloperTools/6.0.1-6A317/Xcode/SharedPrecompiledHeaders/DEL Action-Prefix-edciowciqplpzxaziffeqsjfaaka/DEL Action-Prefix.pch.pch' was built note: please rebuild precompiled header

'/var/folders/bq/1p80g4q56tl2zmcv96c3r3g9fw6s01/C/com.apple.DeveloperTools/6.0.1-6A317/Xcode/SharedPrecompiledHeaders/DEL Action-Prefix-edciowciqplpzxaziffeqsjfaaka/DEL Action-Prefix.pch.pch'

1 error generated.

The simple option is to delete the existing .pch file. In the previous example that would be done in the terminal by using rm.

Terminal:

$  rm /var/folders/bq/1p80g4q56tl2zmcv96c3r3g9fw6s01/C/com.apple.DeveloperTools/6.0.1-6A317/Xcode/SharedPrecompiledHeaders/DEL\ Action-Prefix-edciowciqplpzxaziffeqsjfaaka/DEL\ Action-Prefix.pch.pch

Once deleted rebuild the iOS project.

Terminal:

$ cordova build ios

Read More Comments

Quickly open a web page in all browsers for testing

Thursday 16th of October 2014

In order to test a certain web page in all of my development browsers, I wrote a simple shell script that will open a new instance of each of my browsers and automatically point it to a given URL.

This script is designed for OSX and will likely need some tweaks for a Linux distribution (or perhaps a complete rewrite) but the concept can be easily transferred.

browser-test.sh

# $1: URL

open -a "/Applications/Google Chrome.app" $1 -g -n
open -a "/Applications/Google Chrome Canary.app" $1 -g -n
open -a "/Applications/Safari.app" $1 -g -n
open -a "/Applications/Webkit.app" $1 -g -n
open -a "/Applications/Firefox.app" -g $1 -g -n
open -a "/Applications/FirefoxAurora.app" -g $1 -g -n
open -a "/Applications/Opera.app" $1 -g -n
open -a "/Applications/Opera Beta.app" $1 -g -n

I have configured the script to work for Chrome and Canary (Nightly), Safari and Webkit (Nightly), Firefox and Aurora (Nightly) and finally Opera and Opera Beta (Nightly).

On my setup I additionally load an extra app called "CoRD" which is used to connect to remote Windows machines for Internet Explorer testing.

browser-test.sh

open -a "/Applications/CoRD.app" -g -n

The -g option after each open command tells the given app to open in the background. Finally the -n switch will force a new instance of the browser, even if you already have one running, so that the browser is in a clean state to test with.

Finally I symlink this file to my /usr/local/bin directory so that the script is always available on my PATH.

Terminal

$ cd /usr/local/bin
$ ln -s browser-test ~/path/to/browser-test.sh
$ chmod a+x browser-test

Complete these steps in order and you will be able to call browser-test from any directory in the terminal.

Terminal

$ browser-test http://blog.blakesimpson.co.uk/

Read More Comments

Ember Server "Bus Error 10" Fix

Friday 11th of July 2014

If you are using the ember-cli package to access the ember command line tool and experience a "Bus Error 10" that crashes the ember server every time you save a file then it is probably due to an incompatible Node.js version.

To fix this issue simply head to the Node.js downloads page and get the latest version of Node for your operating system.

For a functional ember server you should be using Node.js version 0.10.21 or higher, personally I upgraded from 0.10.20 to 0.10.29 and now the server runs perfectly, including the live reload functionality.

Read More Comments

Apache Configure CORS Headers for Whitelist Domains

Tuesday 20th of May 2014

In the current implementation of Cross Origin Resource Sharing (CORS) the Access-Control-Allow-Origin header can only provide a single host domain or a wildcard as the accept value. This is not optimal when you have multiple clients connecting to the same virtual server and simply want to allow a list of known client host domains to the "allow" list.

Since only a single domain in a single access header can be delivered back to the client, Apache must read the incoming Origin header and match it to the list of "white" (accepted) domains. If an appropriate match is found, echo the domain host back to client as the value of Access-Control-Allow-Origin.

Use the following configuration snippet in the Apache virtual host ".conf" file or in the server ".htaccess" file. Ensure mod_headers and SetEnvIfNoCase are enabled.

<IfModule mod_headers.c>
   SetEnvIfNoCase Origin "https?://(www\.)?(domain\.com|staging\.domain\.com)(:\d+)?$" ACAO=$0
   Header set Access-Control-Allow-Origin %{ACAO}e env=ACAO
</IfModule>

The regular expression https?://(www\.)?(domain\.com|staging\.domain\.com)(:\d+)?$ matches the URL of Origin, a required HTTP header for all requests. The pattern matches both the http and https protocols. It will match an optional www. subdomain and finally matches the actual host name of your whitelist entries. Any characters after the domain name are ignored. This example will therefore enable:

* http://domain.com
* https://domain.com
* http://www.domain.com
* https://www.domain.com
* http://staging.domain.com
* https://staging.domain.com
* http://www.staging.domain.com
* https://www.staging.domain.com

If you send a request from http://staging.domain.com/app/, the response would include the header:

Access-Control-Allow-Origin: http://staging.domain.com

If you sent another request from https://www.domain.com/client/, the response would include the header:

Access-Control-Allow-Origin: https://www.domain.com

Read More Comments

Restore accidentally deleted /tmp directory

Friday 16th of May 2014

Create the "/tmp" and restore function correctly after deleting it by accident:

http://superuser.com/questions/241955/tmp-directory-deleted-i-cannot-login-to-the-system

# mkdir /tmp
# chmod o+t,ugo+rw /tmp

Read More Comments

JavaScript Beacon API Explained

Friday 16th of May 2014

Beacons are a new API that is being experimentally introduced by browser vendors that will allow an XHR call to be made to a server when a webpage unloads without blocking the thread in order to create a better user experience. Quoting the W3C Beacon Specification.

"analytics and diagnostics code will typically make a synchronous XMLHttpRequest in an unload or beforeunload handler to submit the data. The synchronous XMLHttpRequest forces the User Agent to delay unloading the document, and makes the next navigation appear to be slower. There is nothing the next page can do to avoid this perception of poor page load performance."

This specification will prevent developers from having to use tricks and hacks to bend the rules of the browser, creating a better experience for everyone.

Read More Comments

Fix "0.1 + 0.2 = 0.300000004" in JavaScript

Thursday 15th of May 2014

Because JavaScript uses the IEEE 754 standard for Math, it makes use of 64-bit floating numbers. This causes precision errors when doing floating point (decimal) calculations, in short, due to computers working in Base 2 while decimal is Base 10.

0.1 + 0.2; // 0.300000004

A simple solution to this problem is:

+(0.1 + 0.2).toFixed(1); // 0.3

Here the numbers are added together, returning the erroneous floating number, it is then set using toFixed as a string "0.3". Finally the + symbol casts the string back to a valid Number so that it can be worked with again.

var x = 0.1,
  y = 0.2;

var z = +(x + y).toFixed(1);
z += 0.1; // z is now 0.4

Read More Comments