Friday, 13 November 2015

LibreOffice Calc: 15 Steps for Best Line Fits (Regression Line)

Have you been troubled with messy graph sheets and age old equipment from the stone age i.e. a ruler and pencil? Why muck around with that when you're in the Computer Age buddy! Use LibreOffice Calc to simplify your plotting requirements, and far more precisely than the arbitrary line of a ruler.

Steps to Get it Straight (No We're Not Homophobic)


Search for LibreOffice Calc (please do install first on Windows or Mac!)
  1. Get your version of LibreOffice booted up!
  2. Once you're booted up, go ahead and enter your values you want to plot in the cells as shown below.

    Data Entry complete
  3. In most cases your X values will be straight-forward as shown, but if you want to use other values as required, feel free to change those respective positions.
  4. Now that you're done with the value entry, the hard donkey work part's over. Sit back, relax and begin watching the freedom computing brings. From the menu bar, go to Insert > Chart.. and click on it.
  5. You should now have gotten the window entry. Select the XY (Scatter) option from Chart Type with the Points and Lines option as shown below and hit Next >> .

    Select Points and Lines before proceeding
  6. Go ahead, hit Next >>, nothing to view on this next entry (unless you haven't followed steps and entered data as a row).
  7.  You are now on the Data Series tab as displayed on the window left. Click Add if your series table is blank, or edit the entry already present as shown in the next step.

    Just added a new value set!
  8. Now in the right box, you have 3 options, Name, X Values & Y Values. To enter the X axis values, select the X Values option and in the text field immediately below click on the button on the right side as shown in the bottom right of the image.

    See that little button in this corner ---->
  9. You now have a popup window asking you for values. Go right over to your table and select all the values you want to enter on the X axis. I've highlighted them in the image below.

    See the X values highlighted in blue?
  10. Do the same with the Y Values. Select the option Y Values from the box, click the text field button on the bottom right and select the column with your Y value entries. In this case if your values are hidden by the table, copy whatever X contains and paste it in the box changing the Column Letter accordingly, in my case from A to B as shown.

    I've copy pasted the text. Easy peasy.
  11. Now you're completed your graph. Careful about your index values, recheck to confirm you've used all the values and aren't missing any.
  12. Now, if you want a simple line connecting the dots, you're done. If you want a straight line with the best fit a.k.a. regression line, proceed.
  13. Double-click on the line your graph presently shows and change the line type from Continuous to (none).

  14. Now your line should disappear. Head over to the top on the menu bar and select Insert -> Trend Lines... option.

  15. Select the continuous line option, and under the tab Type play around with the options to suit your need. I prefer to have the Show Equation checked to display the line slope and intercept, as well as name my line.
That's all folks! You're done. 15 easy steps to solve your two dimensional first world problems. Move the function display around, exit table editing mode and shift that around to display your original values, whatever you choose. No more relying on graphing calculators that nearly never have print options, or pencil ruled images to upload to your report.

Friday, 6 November 2015

Improve Battery Life on your Linux Mint/Ubuntu Laptop

Linux in itself is pretty power efficient on laptops. Firstly, if you're facing significant battery drain, I would recommend updating your drivers from the "Driver Manager" present in the Linux Mint menu. Once all your drivers are all up to date, there are a few simple tips and tricks to follow which can help you improve your battery life. We will be covering some very common tips and some slightly more uncommon tips to help you in your endeavor to squeeze as much as you can out of your battery without having to dig deep into Linux's configurations.

1. Reduce Screen Brightness

Although most users are aware of this, one can never stress this point enough. Your screen requires a significant amount of power to run. Almost 50% of your total power consumption is attributed to your screen. Reducing brightness can drastically improve battery life. You can get around an hour more of juice by just reducing your brightness to as low as you can bear. Brightness can be reduced quite simply by clicking on the battery icon on the lower right of your screen.

2. Turn Off and/or Unplug Unused Devices

Laptops these days have built-in Bluetooth, Wi-fi, and sometimes even Infrared. All of these adapters require power to run. Bluetooth and Infrared in particular are known to consume a considerable amount of power. If you aren't using them, turn them off. Same rule applies for Wi-fi: if you're not using it, turn it off. It is quite easy to turn it back on whenever you need it. Leaving it on all the time wastes away your battery, as it keeps looking for networks to connect to.

All external USB devices connected to your laptop also use power. Hard drives in particular require a lot of power to run. If you are working on data present on an external hard drive, consider copying it to your internal hard drive while working, and then disconnect your external hard drive. You can connect it later on to copy your updated data back. A hard drive has a spinning disc and a movable head inside it. Both components require a lot of power to run. Similarly, using your optical drive (CD/DVD/BR Drive) also requires a lot of power. That being said, mice and flash drives require negligible power to run, so these can be left connected.  Also, avoid charging your smartphone using your laptop if you're running on battery power.

3. Avoid Rebooting Frequently

Booting a computer requires a tremendous amount of power. Even if your boot time is less than 10 seconds, the power draw could reduce about 15 to 20 minutes of your battery power. If you feel you will be using your laptop at intervals of 2 or 3 hours (or less), then consider using "Suspend". Suspend puts your laptop in an ultra low power state. Although it still draws power from your battery, the drain is incredibly low. Turning your laptop back on from suspend state also requires far less power than a full boot.

The "Hibernate" option can be used if you're leaving your laptop turned off for over 3 hours. Hibernate saves your laptop's working state (everything present in the RAM) to the hard drive and then shuts down your computer. This way, Linux does not need to fetch and load all system processes and components when it boots, hence saving a lot of CPU cycles. Hibernate probably won't give you a significant boost in battery life, but it is certainly more efficient than booting from a complete system shut down. I would still recommend a proper reboot or shut down after updating your system because it's essential for some system changes to be applied.

4. Install TLP

TLP is a simple power management tool for Linux which runs in the background and automatically optimises your system for efficient power consumption. It changes the way your devices behave depending on whether you are plugged in or on battery power. There are a lot of advanced customisation options available for advanced users, but the default settings work perfectly for most users. 

Installing TLP requires using the terminal. I will try to make the steps as simple as possible to follow.
  1. First, you need to open a terminal window by pressing "Ctrl + T".
  2. Then simply copy the following lines, paste them in the terminal window (to paste something in a terminal, you need to press "Ctrl + Shift + V") and press enter.

Note: If you are using a Lenovo Thinkpad then you will also have to copy and paste the following line in the terminal after the above process is complete.

This installs TLP on your system. Now simply reboot your computer to have it up and running.

If you want to make any changes to the configuration or perform diagnostics, you can visit the official website here (advanced users only). All installation and configuration options have been defined well.


There are various more tricks I can discuss here, but they are mostly for advanced users. If you're feeling up to it, you could try updating your kernel or manually turning off devices from the BIOS itself. If not, the above tips could tremendously improve your battery life if you haven't already been following them.