Edge on Windows 10 opens and closes immediately

I had a problem with the Edge browser only a day after doing a clean install of Windows 10. When I tried to open it it would open, sit on the screen with the big blue background and the “e” logo, and then disappear about 4 second later. I was able to fix it by following the below steps:

First delete the Edge folder. The path:
C:\Users\%username%\AppData\Local\Packages\Microsoft.MicrosoftEdge_8wekyb3d8bbwe

Then Launch Powershell as and run the following command:
Get-AppXPackage -Name Microsoft.MicrosoftEdge | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml" -Verbose}

Hit enter and once the command is executed try opening Edge again.

For me it worked without having to restart, but the place where I found these instructions suggested restarting a couple of times. Here is original article I found.

Also, I ran the command without the -AllUsers parameter, not sure if that was why I didn’t have to restart.

Hope that helps someone!

Allowing Apache to listen on a different port with SELinux

I wanted to set up a virtual host in Apache today using a different port than the standard but kept getting a permissions error when I tried to start Apache. The problem turned out to be SELinux not allowing the port to be used. In order to fi it I just needed to add the port as one of the allowed ports for Apache.

For example, to allow Apache (httpd) to listen on port 12345 the command is

# semanage port -a -t http_port_t -p tcp 12345

Percona Toolkit on CentOS

I wanted to install Percona Toolkit on a CentOS machine today but the download comes as an RPM. Percona make it easy to install it with Yum however by adding their repo. To do it do:

64 bit:
# rpm -Uhv http://www.percona.com/redir/downloads/percona-release/percona-release-0.0-1.x86_64.rpm

32 bit:
# rpm -Uhv http://www.percona.com/redir/downloads/percona-release/percona-release-0.0-1.i386.rpm

and then you can simply do

# yum install percona-toolkit

Thanks Percona!

“Mailbox Rights” in Exchange 2003 showing only SELF

I had a problem today where the Mailbox Rights in Exchange for newly created users were showing only an entry for SELF and nothing else. After a bit of head scratching I eventually found via Google that this is normal until the user has logged in for the first time (either via Outlook Web Access or via normal Outlook) or the user has received an email. You can read more about it here:
http://www.petri.co.il/self_permission_on_exchange_mailboxes.htm

In my case I simply logged on each user I needed to create via OWA to get the permissions set correctly, before adding the additional permissions that I needed.

Display all Apache configuration files

Various times I’ve had a problem with Apache and I’ve wanted to be able to display all of the configuration files as they are seen when parsed by Apache. As I can never remember now to do it I thought I would document it here.

The mod_info module can be used to do this. Just add the following to one of the hosts in your Apache configuration and then go to the /server-info address on your server.

SetHandler server-info
Order deny,allow
Deny from all
Allow from 192.168.0.1

Don’t forget to secure access to this location by IP address or other method (see deny and allow directives above).

‘mod_alias’ and ‘mod_rewrite’

I spent a few hours recently trying to debug some Apache Rewrite rules on our development server.

We had a particular directory outside the root of the website that I was using an Alias command to make available. However, within this directory I also wanted to apply a couple of different Rewrite rules.

A simple cachebuster

One of the rules was basically to remove instances of the string nocache_XXXX_ where XXXX was a number which could change (this is usually a date-stamp, such as 20130131 if modified on 31st Jan, 2013). This allows us to easily change the number in the URL which will force the browser to reload the page, avoiding possible caching problems.

For example:
http://www.example.com/nocache_20130131_js/file.js
will be rewritten as
http://www.example.com/js/file.js
If the file.js changes we can modify the number in the url, which will force the browser to load the JavaScript again as it is a different URL, but the web server will return the current “file.js” inside the “js” directory, after the rewrite rule has been applied.

To cut a long story short, I found out that mod_alias and mod_rewrite cannot be used together. Therefore, the workaround in my case was to use just mod_rewrite and use a symbolic link instead of trying to use mod_alias. Note that to allow symlinks to be use, it is also necessary to specify Options FollowSymLinks within the Apache config for that site.

Maybe this will help someone else avoid wasting time trying to get mod_rewrite to work on top of mod_alias.

Connect to IMAP server with telnet

Every so often I need to be able to check IMAP account settings. This can be done by manually connecting to the IMAP server with telnet.

Once connected, all IMAP commands are preceded with a word of your own choosing, which the server will respond with. This is to enable the client to recognise the reply to each command which it has sent (this would be useful where a real mail client sends various commands to the server without waiting for a reply after each one, and can later identify the reply to each command).

Some useful commands are:

LOGIN [username] [password]
LIST [flags] [folder separator] [search term]
STATUS [mailbox] [flags]
SELECT [mailbox]
FETCH [first]:[last] flags
FETCH [mail number] body[header]
FETCH [mail number] body[text]
LOGOUT

Here is an example of an IMAP conversation between telnet and the server:

telnet: > open imapserver.example.com imap
telnet: Trying 192.0.2.2...
telnet: Connected to imapserver.example.com.
telnet: Escape character is '^]'.
server: * OK Dovecot ready.
client: a1 LOGIN MyUsername MyPassword
server: a1 OK Logged in.
client: a2 LIST "" "*"
server: * LIST (\HasNoChildren) "." "INBOX"
server: a2 OK List completed.
client: a3 EXAMINE INBOX
server: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
server: * OK [PERMANENTFLAGS ()] Read-only mailbox.
server: * 1 EXISTS
server: * 1 RECENT
server: * OK [UNSEEN 1] First unseen.
server: * OK [UIDVALIDITY 1257842737] UIDs valid
server: * OK [UIDNEXT 2] Predicted next UID
server: a3 OK [READ-ONLY] Select completed.
client: a4 FETCH 1 BODY[]
server: * 1 FETCH (BODY[] {405}
server: Return-Path: sender@example.com
server: Received: from client.example.com ([192.0.2.1])
server:         by mx1.example.com with ESMTP
server:         id <20040120203404.CCCC18555.mx1.example.com@client.example.com>
server:         for <recipient@example.com>; Tue, 20 Jan 2004 22:34:24 +0200
server: From: sender@example.com
server: Subject: Test message
server: To: recipient@example.com
server: Message-Id: <20040120203404.CCCC18555.mx1.example.com@client.example.com>
server: 
server: This is a test message.
server: )
server: a4 OK Fetch completed.
client: a5 LOGOUT
server: * BYE Logging out
server: a5 OK Logout completed.

This post gives you more details on syntax and examples of more of the IMAP commands:
http://wiki.mediatemple.net/w/Email_via_IMAP_using_Telnet

CloudFlare

I came across a service called CloudFlare the other day when I was investigating Content Delivery Networks (CDNs). They seem to, at the basic level, offer a high-performance, CDN for websites with no coding required, and also give you protection from Distributed Denial Of Service (DDOS) attacks. There is a paid model to use too, but the basic free service looks like something that many websites could benefit from.

I’m still trying out the service, but at first glance it seems to be pretty good. I’ve already got www.andrewc.com running with it and I’m hoping to move some over sites over in the next few days.