Python tutorials #1 – basic calculator

This is the first of my Python tutorials! Python is a programming language but unlike C++ and Java, is easier to learn but can still be used to create amazing programs such as web browsers, calculators, word processors, and more. But unlike Scratch, a GUI used to make games and other projects aimed at beginners and young children, you still must master Python to create amazing applications using it.

So, here’s my first tutorial: a basic calculator that can be used to add, subtract, multiply, and divide two numbers. Unlike the calculator app preloaded on your PC or phone however, it is CLI based so you won’t have a friendly GUI calculator but rather one where you type two numbers, what you want to do with them, then get the result printed to the screen.

This guide assumes that you are using the newer Python 3.x. The code may work on Python 2.x, but has not been tested, so if you need to stick to Python 2.x for some reason, you may have to make adaptations to the code for it to work properly.

Fire up your Python IDE (such as IDLE3 or Geany) and enter in the following code:


first_number = input("Enter in first number: ")
second_number = input("Enter in second number: ")
print(int(first_number) + int(second_number))

This basic block of code will ask you to enter in the first number, then store that first number, then enter the second number, store that second number, and then show the answer. The int around the variables converts them into intergers so they can be added together as numbers, not as characters. Without this 5 + 10 would equal 510, not 15.

This, however, is a little restricted. You can only add the two numbers, not subtract, multiply, or divide. Asking the user for what they want to do with the two numbers and then doing that expands the calculator’s functionality. For example:


first_number = input("Enter in first number: ")
second_number = input("Enter in second number: ")
option_choice = input("Add, subtract, multiply, or divide? ")
if 'dd' in option_choice:
print(int(first_number) + int(second_number))
elif 'ubtract' in option_choice:
print(int(first_number) - int(second_number))
elif 'ultiply' in option_choice:
print(int(first_number) * int(second_number))
elif 'ivide' in option_choice:
print(int(first_number) / int(second_number))

We are not doing if statements to see if, for example, option_choice equals ‘add’ as Python is case sensitive in this area. Checking for ‘dd’ (end of ‘add’) ensures that the program will work regardless of whether A is capital or not.

So there you have it! A basic calculator made in Python. Currently lacks support for decimals however, so if you try entering decimals the program will error out. This guide is aimed at beginners, so this calculator will likely be expanded on in a future guide. Enjoy!

-Chas ๐Ÿ˜Ž

Sorry

I’ve been a little less active recently but promise I won’t fall into inactivity like I did last year. I’ll be blogging frequently again when I have some ideas on blog post topics!

-Chas ๐Ÿ˜Ž

Do you need a custom ROM on your device?

When I first bought my Nexus 7 (2012), it was on Android 5.1 and was really slow. I downgraded it to the official Android 4.4.4 firmware, but when apps started showing incompatibility, I asked myself: is now the time for a custom ROM?

After searching around, it turns out the slow performance on the Nexus 7 (2012) was only affected by Android 5.x, with people reporting much better performance on Android 6.0 and 7.x based ROMs. So I decided to give one a try.

My first pick was Unlegacy Android, based on Android 7.1. I was forced to use the pico package for OpenGAPPS, which only included the Play Store and other services needed for it to function as the system partition couldn’t squeeze in Android 7.1 and all the Google apps.

UA 7.1 would freeze up randomly sometimes for me. It would sometimes stutter when switching between apps, but it was still better than Android 5.1. I decided that I needed a more stable ROM so I tried LineageOS 15.1, recently released and based on Android Go for a more smooth experience.

LineageOS 15.1 required me to use OpenGAPPS pico as it was based on Android 8.1 Oreo. It was slow. A little faster than Android 5.1, but slower than Unlegacy Android 7.1 and stock 4.4.

I then decided to try Unlegacy Android again, only this time it was based on Android 6.0 instead of 7.1. Frustratingly, I still had to use OpenGAPPS pico, explaining why Google did not release Android 6.0 to the Nexus 7 (2012) as they would be unable to fit all their services and apps in as well as the Android 6.0 system.

UA 6.0 ran much better. It was smooth, no stuttering, and never froze up. However, there was something wrong. What made the Nexus 7 so special was that it was Google branded. It was running on stock Android, just like Unlegacy Android does. But I missed all the Google apps other than the core Google Play functionality. Sure, I could just install them all from the Play Store. But that’s time consuming. I like having them all there.

I’m currently running, yes you heard right, stock Android 4.3 on my Nexus 7. I decided I want the fast performance and Google app presence associated with the stock firmware, so I switched back. The apps I want such as Minecraft and Crossy Road still install and almost all incompatible apps such as YouTube have an older version available. It’s fast for my Nexus and its perfect.

Do you need a custom ROM for your device? Maybe. As a power user for my Lenovo Tab 4 8 Plus, I do run a custom ROM based on Android 9.0 and quite enjoy it. But if your device’s firmware is still adequate for your usage and custom ROMs just don’t mix well with it then maybe staying on stock is better.

Nexus 7 (2012) – why are there no Android 10 or 9 ROMs available and why has the only Android 8.1 ROM available only been released recently?

The Nexus 7 (2013) has a ROM for every Android version since the version it first launched with. Even when support for it was discontinued when Android 7.0 Nougat was released, the development community were quick to make ports of it. A port of Android 10 has recently been released.

The year older Nexus 7 (2012) only had ROMs going up to Android 7.1.2 until recently where a LineageOS 15.1 ROM was released. How come the Nexus 7 (2012) has a lot less ROM treatment than the one year newer model?

First of all, let’s start with hardware. The Nexus 7 (2012) has 1GB RAM and a Nvidia Tegra3 CPU, whilst the 2013 variant has 2GB RAM and a Snapdragon S4 Pro. That’s a noticeable difference in speed and performance just there. The Nexus 7 (2012) was good back in its day, and even now, if you choose the correct ROM, can make a good tablet, but Android 9 and 10 just won’t run very well on it. On LineageOS 15.1 and Unlegacy Android 7.1.2, I experienced lag but on stock 4.3, 4.4, and Unlegacy Android 6.0, it was perfectly acceptable for every day use.

Android Go was announced by Google a while back providing an optimised Android version for low end devices such as the Galaxy J2 Core. LineageOS 15.1 appears to use Go’s optimisation for the Nexus 7 (2012) but a 2019 low end smartphone may just be that little bit faster than a mid-range tablet from 2012.

Let’s not forget the system partition. When I tried Unlegacy Android 6.0, 7.1.2, and LineageOS 15.1, I had to use the minimal GAPPS package (pico) only including the Play Store and basic Google functionality. The Nexus 7 (2013) has a resize method available but it appears to be hard to use and you risk messing up the partition table resulting in an unrecoverable device. There is no such method for the Nexus 7 (2012). Recent Android versions take up more space and on the Nexus 7 (2013), the only currently available Android 10 ROM requires a resize before it can be installed.

Can we expect Android 9 or 10 ROMs for the Nexus 7 (2012)? Probably not. Unless a resize method is found for the system partition, there’s little chance of it and even if it was made, it probably wouldn’t run very well. Luckily, Android 6.0 or 7.1 is still adequate and a great majority of apps still work fine on it so if you’re looking for a good ROM to revive your tablet, look there instead of hoping for a ROM which could put the tablet past its limits.

What ROM do you have on your Nexus 7 and how does it run? Tell me down below in the comments section!

-Chas ๐Ÿ˜Ž

Galaxy J3 (2016) LineageOS development cancelled

In an earlier blog post, I mentioned that I was going to start development of a LineageOS 15.1 (Android 8.1 Oreo) ROM for the Galaxy J3 (2016). A couple of weeks later after testing and error fixing attempts throughout the build (which have failed or led to more errors which are harder to fix), I regret to inform you that development of this ROM port is coming to an end.

It appears that currently the J3 device tree for LineageOS 15.1 is still unstable and still being worked on, explaining the errors and also the fact that a developer who promised a LineageOS 15.0 ROM a couple of years back never posted it, probably because it errored out or they got it to build but it was way too unstable for general use.

I can say that I will attempt to make other ROMs for other devices, such as the Nexus 7 and Lenovo Tab4 8 Plus. But sadly, all the J3 ROM slots have been taken and porting newer Android ROMs to this device is incredibly hard.

I hope that I can announce the development of a new Android ROM for another device but at the moment I’ll just be playing around to see what I can get to work before testing anything.

Sorry for this, but Oreo for the J3 (2016) doesn’t seem possible just yet.

-Chas ๐Ÿ˜Ž

Support for the original Pixel and Pixel XL coming to an end after three years

Three years ago on the 4th October, Google launched the original Pixel and Pixel XL. Three years later, Google are now bringing support to an end for these phones.

The original Pixel and Pixel XL may have unexpectedly received the Android 10 update but did not receive the November 2019 security patch this month while the Pixel 2 and later did. The official Google support page states that update support will end after October 2019. That time has come and so the original Pixel and Pixel XL will no longer receive software updates.

It was not expected for the original Pixel and Pixel XL to even receive Android 10 but Google decided to support the 2016 lineup in Android 10.

It should be possible to download the source for the latest available Android build for the original Pixel lineup and then manually backport the changes into it if willing to put in the effort, but this is not for the inexperienced and one wrong move during backporting could cause noticeable instability on your device.

Custom ROMs are available for the original Pixel lineup and at some point they will contain newer security patches then what the latest stock firmware provides. When Android 11 is released, custom ROMs will be the only way to get it on the original lineup and also will continue support for the device and introduce you to the world of tinkering with your Android device.

Currently, LineageOS are providing official nightly support for the original Pixel lineup for LineageOS 16.0, based on Android Pie. Although it isn’t Android 10, it’s still worth checking out if you want to learn about ROMs and LineageOS 17.0 is only around the corner if you want to get used to what may be your new ROM if you want continued support.

What Android device do you currently use and is it still receiving updates? Tell me down below in the comments!

-Chas ๐Ÿ˜Ž

If you don’t update your iPhone 5 by the 3rd of November major functionality will break

If you do not update your iPhone 5 or iPad 4 (cellular variant) to iOS 10.3.4 by 3rd November, major functionality will stop working.

Functionality that require the correct date and time such as web browsing and app store will allegedly break should users not update to iOS 10.3.4 by 3rd November. GPS functionality such as the weather and maps apps will also require an update. After 3rd November, it will also be impossible to update the software directly on the device, requiring the use of a PC or Mac to install the update instead.

If you’re holding out on an iOS version like iOS 9 or even the nostalgic iOS 6 and are unwilling to update, you could try saving your onboard SHSH blobs and restoring from 10.3.4 to your desired iOS version through futurerestore or 3utools, enabling the option to preserve the baseband when doing so. However, this hasn’t been tested and there is no guarantee that it works.

iPhone 4S and cellular iPad 2, 3, and Mini 1st generation devices will also have similar issues, although they won’t be as severe, as there has been no information published on what will happen if users of devices with the A5 chip do not update to iOS 9.3.6, but considering iOS 9.3.6 is so slow on these devices, if the effects of holding out on an older iOS version on these devices are the same as for the iPhone 5, this will be received poorly by iPhone 4S users (like me) running on older iOS versions such as iOS 8.4.1 and 6.1.3.

If you’re using an iPhone 5 or iPad 4, the best thing you can do right now is update to iOS 10.3.4 and wait until a workaround is found.

What iOS version are you using on your older iPhone, how well does it run, and how will this news affect you? Tell me down in the comments below!

-Chas ๐Ÿ˜Ž

LineageOS 15.1 for Galaxy J3 (2016) developmentย 

The Samsung Galaxy J3 (2016) launched at the end of 2015 running Android 5.1.1 Lollipop and has never received a major OS update and to this day is currently still on Android 5.1.1 should you choose to stay on stock firmware.

However, custom ROMs for this device have been made based on newer Android versions without the TouchWiz UI, such as LineageOS 13 (Android 6.0.1) and Resurrection Remix based on Android 7.1.1.

However, the community has never seen a development of an Android 8.x based ROM for this device. There was an attempt to port LineageOS 15.0 (Android 8.0 Oreo) to the J3 (2016) but the developers abandoned the project and never provided a download link.

Luckily, I’ve came across a kernel and device tree for the J3 (2016) supporting Android 8.1 Oreo ROMs, as well as a tutorial for making unofficial LineageOS ROMs for devices that don’t have official support (like the J3 2016). I’m going to attempt building it. Will it work or will I find out why LineageOS 15.0 was abandoned for the J3 (2016)?

I’ll keep you updated of progress of porting it here, and let’s hope it will be a success.

Wish me luck!

-Chas ๐Ÿ˜Ž