Ryan Harrison My blog, portfolio and technology related ramblings

Firefox Quantum - It's Fast Again

Firefox has always been installed on my system and it used to be my browser of choice. For the last few years or so however, it has been lagging behind Chrome in speed and general responsiveness. I have always hated the terrible startup times of Firefox compared to the relative instantaneousness of Chrome. General browsing and usability has also been more snappy in Chrome - which for most people is the single most important factor when choosing a browser.

Firefox Quantum Beta

This story seems to have changed quite a bit in the latest pre-release of Firefox however. Version 57, which is dubbed Quantum, uses a completeley new CSS engine and various components have been recreated in Rust which allow much better use of multi-core processors. Mozilla says that these improvements give Quantum a 2x speed improvement over v52 along with using up to 30% RAM than Chrome.

This all sounds great, but does it actually have any notable difference? I have been using the beta release alongside Chrome for a couple weeks now (both with the same extensions installed), and I must say that the performance improvement is quite significant. I generally don’t care much about RAM usage and have no problem with Chrome eating loads of it as long as its well used to make things faster (if it’s there why not use it?) so I won’t comment on that, but you can definitely notice the difference. Firefox feels a lot more snappy now and page loads are just generally much faster. Can’t really argue with that. I wouldn’t say that it feels faster than Chrome now, but it’s probably just as good which is quite impressive. Always good to have some competition back in the marketplace. Startup times are also much better now!

Other notable differences in Firefox Quantum include the new Photon UI, which I must say I think looks pretty good. Things seem a lot simpler now and they’ve thankfully done away with the old huge hamburger menu which was terrible. Transitions seem smooth and everything is where it should be. One thing to note is that the newer version forces the use of the new web extension framework, so if/when you do update, it’s certainly possible that not all of your extensions will work. One big example is the LastPass extension which has yet to be updated. It’s still a beta though so this is still acceptable. Most of the popular extensions have already been updated to work in Quantum and hopefully more will follow after general release.

Firefox Quantum (v57) is due for release on November 14th. In the meantime, you can still try it out by installing the Beta (or Nightly releases).

Read More

Microsoft Rewards - Earn points by using Bing & Edge

Microsoft Rewards has been around for ages now in the USA, but it’s now made its way over to the UK. The general idea is that you get awarded points by using Microsoft services (predominantly Edge and Bing) which you can then redeem for a range of rewards. You can also get points by purchasing products such as Xbox Live etc.

Currently, I fire up Edge every so often and look at the front page news on Bing to rack up points for the day. You can get a maximum of 90 points per day for using Bing to search (although there have been offers to get more if you also use Edge to perform your searches). Unfortunately, you can’t get points by visiting the same page over and over again, but it still doesn’t take too long to fill the daily quota.

There are also daily challenges and quizes on the main Microsoft Rewards portal which give you one off boosts to your points. Again, they don’t take too long and you can pretty much get through them by button mashing.

Microsoft Rewards Portal page

Above shows the main rewards portal page where you can see your total and redeem your points for prizes. I’ve managed to accumulate over 15,000 points in a few months with pretty little effort. In some ways it’s similar to Google Opinion Rewards - but instead of giving Google all your personal information you just have to use Bing for a bit.

Some of the prizes you can get include:

  • Skype credit (£2 = 900 points)
  • Skype Unlimited (3 months for 8000 points)
  • Xbox Live Gold (3 months for 15000 points or 12 months for 29000 points)
  • Xbox gift card (£10 for 12000 points)

As you can see my 15000 points equates to around £13 already which is pretty good. Annoyingly the UK version doesn’t include Amazon gift cards like the US one seems to - which is frustrating as that is pretty much the only thing I would redeem for. They have also removed the Groove music passes which seems strange to me. Maybe they will bring that back at some point. Edit - Microsoft is now apparently killing off Groove Music which explains why it suddenly disappeared from the rewards.

Visit the Microsoft Rewards page to sign up (you will need an account obviously).

Read More

Brave Browser for Android

Excessive ads and tracker scripts are a pain when on desktop, let alone mobile browsers with limited network connectivity. Nothing worse than loading a couple megabytes of Javascript on a ‘modern’ website, along with a bunch of tracking scripts, ads and an autoplaying video just for good measure. Not only does it now take ages to load a simple site - even on a reasonable 3g/4g connection - but it starts to eat through your data plan pretty quickly.

On desktop browsers this is most commonly solved by installing blocking extensions such as uBlock Origin, Adblock Plus, Ghostery etc. Unfortunately on mobile devices however, the app are much more limited and most don’t have support for installing custom extensions or addons. N.B - ok, yes the Firefox mobile app does allow this, and yes I have tried it. Even with just one extension installed however, the app seems too sluggish and laggy - especially when compared to the stock Chrome experience on Android devices (I am running a Nexus 6P so CPU performance shouldn’t be a factor).

I have however found what seems to be a good middle ground that gives you the speed and responsiveness of Chrome whilst also blocking most ads and trackers - the Brave browser.

Brave browser screenshot

The browser is based on Chromium so you get the familiar interface and speed, but it will also block a ton of the major trackers and ads by default. The site has some stats on how the load times are improved, which are probably under ideal circumstances, but I can definitely tell that there is a good improvement when surfing the web on my phone. I also get the same feeling of horror when I use any other browser on my phone as compared with using a stock browser on desktop. It’s amazing how fast the web could be without all the excess crap we push through the wire (or air).

To set your default browser on Android source:

  1. Open Settings.
  2. Go to Apps.
  3. On the All tabs, look for your default browser and tap on it.
  4. Under Launch by Default, press the “Clear defaults” button, to reset default 1. browser.
  5. Then open a link, you are asked to select a browser, select Opera , select Always.

You can get the Brave browser through the Google Play Store/Apple App store. There is also a desktop version available although I haven’t tried it yet.

Read More

Sending Email with Python 3

A common task in any popular programming language is the ability to send emails to your users, be it as a password reset or as a contact page submission on a blog just like this one.

The below snippet can be used to accomplish this, just change the variables depending on your use case. It assumes that you have a local SMTP server running on the machine you are running the script on (Postfix for example), however you can also login to another service if you want to send via Gmail or Outlook etc.

  
sender = "sender@domain.co.uk"
sender_name = "Sender Name"
receiver = "receiver@example.co.uk"
receiver_name = "Receiver Name"
subject = "This is the subject line"

message_str = "This is the body of the message"

mime = """From: {0} <{1}>
To: {2} <{3}>
MIME-Version: 1.0
Content-type: text/plain
Subject: {4}
{5}
""".format(sender_name, sender, receiver_name, receiver, subject, message_str)

try:
    smtpObj = smtplib.SMTP('localhost')
    smtpObj.sendmail(sender, receiver, mime)
    return "Successfully sent email"
except smtplib.SMTPException:
    return "Error: unable to send email"

You can also add additional properties to the MIME message for extra functionality:

  • Reply-To: Name <address> to specify who the receiver should send their replies to
  • Change the Content-type to text/html if you want to use HTML within your message body for styling

For more information take a look at the smptlib docs.

Read More

Apache - Redirect HTTP to HTTPS

With all the focus these days on cybersecurity and the push towards a more secure web, it’s more important than ever to ensure as many users as possible are using the HTTPS version of your site instead of the default HTTP version. Google search results will now rank secure versions better than their variations and some browsers are actively warning users if they are not browsing through HTTPS and there is a password input field on the page for example.

As such, having all of your standard HTTP traffic automatically redirect to their HTTPS equivalent can not only help reassure your visitors, but also potentially increase traffic as a whole. There really aren’t any excuses for not using HTTPS now when Let’s Encrypt is available.

Configuring redirects within your web server of choice is quite trivial. In this post I will focus on Apache, however I am sure the config is equally as straightforward if you are an Nginx user.

The first step is of course to make sure that you have a HTTPS version of your site available to the public. There are a thousand guides online about how to to this so I won’t cover it again here, but in short get a certificiate for your domain from Let’s Encrypt via certbot, create a new VirtualHost within Apache listening on port 443 and enable SSLEngine - pointing to your certificate. At this point your should have two versions of your site available - one through HTTP and one through HTTPS. At the end of this all of the HTTP traffic will be redirected the HTTPS virtual host.

Navigate to your main Apache config file which contains your HTTP virtual host definition. This is normally in /etc/apache2/sites-available and might be called something like 000-default.conf if you haven’t renamed it. If the first line of the file is <VirtualHost *:80> you are in the right place.

Open this file with your favourite text editor (you will need root privileges) and add the following, replacing “your-domain-name” with, of course, your domain name:

# Redirect to HTTPS
Redirect permanent / https://your-domain-name.com/

And that’s it. Run the command sudo service apache2 restart to pick up the changes and then test it out. Navigating to any of your pages through HTTP should be automatically redirected to HTTPS resulting in that nice green padlock in your browser.

Read More