Setting Up WakaTime on Emacs

Moringa2018_20

By Carol Wanjohi,

Moringa School staff.

As a programmer, tracking the amount of time spent coding is essential and vital. Thereby, increasing and validating the importance of a plugin such as WakaTime.

 

   def WakaTime:

       open-source plugins for text editors that measures coding time for programmers

Setting up WakaTime on most text editors such as Atom and Sublime Text is pretty straightforward. However, for Emacs, especially for a an Emacs beginner, it is a totally different story.

After successfully setting up WakaTime on other text editors, I thought that for Emacs it would be a walk through the park. Sadly, that was never the case. I spent nearly 6 hours setting it up. In the process, I learnt more about Emacs.

Pre-requisites

Before setting up WakaTime for Emacs there some requirements that are essential.

 

  1. Python
    • your machine should have Python installed. To confirm whether your machine has Python you can run the following command in your Terminal

   python —version

  1.   Emacs version 24 or higher
    • since this installation process will be using MELPA, an Emacs package installer that only works with Emacs version 24 or higher

This installation process will be for a MacOS.

Getting started

Most Mac’s come pre-installed with Python. So, we can go ahead and install Emacs for those without it.

To install Emacs you can use Homebrew. If you do not have Homebrew you can use this link to install Homebrew.

After installing Homebrew, you can use it to install Emacs with the following commands

brew update

 brew install emacs –with-cocoa

brew linkapps emacs

Homebrew will install the latest stable version of Emcas, that means it will be higher than version 24. Next, we need to connect to the Emacs installed by Homebrew. This means we are going to create an alias for it, so that when you invoke emacs it will run the newly installed version of Emacs

alias emacs=”/usr/local/Cellar/emacs/24.x/Emacs.app/Contents/MacOS/Emacs -nw”

After creating the alias, we can confirm the version of Emacs we are connected to by running the following command

emacs –version

Installing MELPA

After installing and connecting to Emacs, we can now install MELPA, a collection of packages compatible with Emacs.

To open Emacs you can type

   emacs

This gets you into the Emacs text editor. Next, we will find the init file for Emacs

Press Ctrl + X (C-x)

Press Ctrl + f (C-f)

Type the following path to the init file for Emacs

 ~/.emacs.d/init.el

This will open the init.el file and you can add the following code so that you can install MELPA

 (when (>= emacs-major-version 24)

          (require ‘package)

          (add-to-list

            ‘package-archives ‘(“melpa” . “http://melpa.org/packages/“)

 

    After that, you can save and close your Emacs text editor

 

   Press Ctrl + X (C-x)

    Press Ctrl + S (C-f)

Press Ctrl + X (C-x)

   Press Ctrl + c (C-c)

 

Now, you can go back to Emacs and confirm that packages from MELPA are connected to your Emacs

 

   emacs

 

   Press ESC + x (M-x) list-packages

 

A list of packages from GNU and MELPA will be displayed

 

Installing WakaTime

 

Now on to the good part, installing WakaTime plugin to Emacs.

 

   Press ESC + x (M-x)

   

   Type: list-packages

 

Scroll through the list of packages and search for a package called wakatime-mode. After locating it, type i and x. This will install wakatime-mode. Now you can exit emacs

 

   Press Ctrl + X (C-x)

   

 

   Press Ctrl + c (C-c)

 

So, we need the WakaTime cli for Emacs to connect with the WakaTime plugin properly. To set it up you can run the following commands in the home directory

 

   pip install wakatime

 

This will command will tell Python to install the WakaTime cli.

 

Next, we need to set-up Wakatime cli in your Emacs init.el file

 

   emacs

 

   C-x C-f ~/.emacs.d/init.el

 

   # Add the following code to the bottom of the init.el file

 

   (global-wakatime-mode)

Setting up WakaTime on Emacs

 

   Press Ctrl + X (C-x)

   

   Press Ctrl + S (C-f)

 

   Press Ctrl + X (C-x)

   

   Press Ctrl + c (C-c)

 

Now, you can set-up the WakaTime API key by doing the following:

 

   emacs

 

   Press ESC + x (M-x)

 

   Type: customize

 

Navigate to the form field

 

   Type: wakatime-api-key

 

   Press Tab key

 

   Press Enter

 

To navigate to where you should enter your WakaTime API Key, use the arrow keys on your keyboard. After keying your WakaTime API Key, navigator to the [Apply and Save] section and Click Enter.

 

Now, you just need to exit Emacs for the changes to apply.

 

Finally

 

To confirm if your WakaTime API Key is set you need to open the init.el file

 

   emacs

 

   C-x C-f ~/.emacs.d/init.el

 

Another way of confirming your WakaTime API key is

 

   emacs

 

   C-h v wakatime-api-key

 

Now you can log into WakaTime to confirm if your text editor has been linked to it. So, I hope everything has been connected properly and happy coding.

 

Advertisements

How To Chose a programming language

By Dennis Muturia,

Curriculum Developer,

Moringa School.

Moringa2018_7

Developer newbies have a really hard time in deciding what languages they would start learning. Trial and error methodology becomes a part of their new developer lives. Only to end up giving up on the early coding journey. The major contributor of this dilemma is the lack of guidance. I believe that this article will provide the needed guidance for your early developer coding journey.

What program are you building?

Know what you want to build. By this, I mean what kind of program would you want to build? Is it an e-commerce application or a graphical application? Before undertaking any language, keep in mind every programming language has its own speciality. Let’s take Python for example, Python is the most recommended language for machine learning because of its many supported libraries. Yet, it is an object oriented language recommended to coding newbies. Due to its simple nature it quite easy to understand.

 

What platform would you want to build for?

Know what platform you would want to build for. Do you want to build a mobile app or a web app? Each platform has its own specific language. Most languages can run on both Mobile and Web but it all depends on what you would want to build. Let’s take Java as an example, Java is the most recommended Android mobile platform language despite the threat from the newest kid on the block (Kotlin) by JetBrains. When it comes to web applications, still, Java dominates this area.


What operating system will your application be used in?

Know what operating system you are building your application for. Is it a Mac system, windows operating system? Some languages are operating system dependent. Take Swift as an example. It is the highly recommended language for both the Mac OS X and the IOS 11. Swift only runs on Mac systems. There is no way you can develop an Apple application without a Macbook. That’s being selfish but alright. Apple commitment to swift language is great. Since its production in 2014, Apple has released only 4 versions of Swift and the fifth is underway. There is also a ton of free resources to learn Swift online.

 

Credibility

Lastly, you must look at the credibility of the language. Credibility of the language essentially means, is that language of choice still widely used or is it dying or already dead. You would not want to code in a language that our grandfathers used like IPL or FORTRAN (I don’t them either, just did a quick Google search). Most of these old languages were low level, this essentially means that they were so hard to understand. But some of those languages are still in use today.

 

All in all understand the product you are interested in building. Language-hopping for code starters is not recommended. You will end up confused. The best programmers are those who only concentrate on one language at a time until they are confident to take on another.

 

Using jQuery and Bootstrap with Angular 5

By Latasha Ndirangu,

Moringa School Staff.

Displaying DSC_0108.NEF

 

Angular has always been a scary framework for me, maybe because I was expected to understand how to build a fully functional app in less than a week.

I recently decided to give it a second chance because HTML +CSS felt a bit too much, and besides, I needed the challenge.

I came across a challenge when I tried incorporating jQuery in my app. After opening what felt like 501 tabs, I found my answer!

First you need to install jQuery to your app.

npm install jquery --save

In your angular-cli.json add:

...
],
"scripts": ["../node_modules/jquery/dist/jquery.min.js"],
...

Now in you app.component.ts, you will need to import jQuery:

import * as $ from "jquery"

Now you can write your jQuery code in peace.

...
  ngOnInit() {
    $...add your code here...
  }

Happy coding 🙂

 

How To Generate A Signed APK.

By Christine Wasike,

Moringa School Staff.

So most of us junior Android developers still need some time trying to get used to and keep up with all the technologies in the vast Android field. I basically want to lay out a road map that I hope will help most of you when it comes to building your application and putting it up on play store. More specifically, how to generate a signed APK.

Here it goes:

What you will first need is to sign up for a Google Play Developer account using your Play Console.

Step One : Build Project

This basically entails putting your app together in a presentable manner after creating it to meet the MVP standards, having curbed bugs within your code and having resolved possible crashes.

In the menu bar, Select Build > Generate Signed APK.

Note:

At this point, a dialog box will pop up prompting you to fill up the necessary blank fields. That is key store path, key store password, key alias and finally the key password. You can opt to use an existing key and key store or create a new one. It is advisable to use an existing one for all your apps because it ensures that any future updates to your APK are authentic and come from the original author. We will however be creating a new key and keystore here.

Step Two :Click Create new

Generating a signed APK.PNG

Create a new key and keystore

Step Three: Provide the necessary information for your key and key store

Create a new keystore on android studio.PNG

Keystore

  • Key store path: This is where you would like keystore to be created.

Key

  • Alias: This is an identifying name for your key.
  • Validity(years): Your key should be valid for at least 25 years, so you can sign app updates with the same key through the lifespan of your app.

Once done, click OK.

Step Four: Continue to manually sign an APK if you’d like it generated and signed with your new key, or cancel if you do not want to sign an APK.

I hope this helps you out. 😊

You can checkout this story for more information regarding how you can correctly and efficiently deploy your Android App to play store using your Google Play Developer account

Moringa Core 5 Graduation

Published by Nancy Momanyi,

Moringa School Staff

Moringa2018_56.jpg

Figuring out what you want to do in life is not always easy. There are some people who know exactly what they want to do from a very young age but that was not the case for 26 year old John Mutavi who is the class rep of Moringa Core 5. Before joining Moringa School he was in law school and then he joined accountancy. Becoming a Web Developer is not something he had ever considered. I always thought to become a programmer you need to have done a degree in computer science or be a geeky introvert who spend time alone typing commands on a computer, he says. He is the exact opposite so at first he never thought that he would make it to the last day. He feels that he has made a lot of progress since he started out in August last year.

Most women normally shy away from tech related careers but this is not the case with Virginia Ndung’u who is one of the most active members of her class. She is one of the three girls who will be graduating from her class. She is grateful that Moringa School has exposed her to several Women in Tech networks from the monthly meet ups that are organized by the school. She believes that anyone can learn how code and wants to be an ambassador of more Women in Tech movements. Naturally women are creative thinkers which is a skill that is required in the tech industry, she says. She is glad that she came to Moringa School.

Virginia.jpg
Virginia Ndungu in the middle with her classmates Carol (on the left) and Mweru

Gitu Mbugua who joined the program immediately after high school has always wanted to be a Software Developer for as long as he can remember. He has been a tech enthusiast since he was in high school. When he finished he tried learning how to code using online resources but he hit a lot of blockers. He needed a community of developers. He searched for coding boot camps in Kenya and came across Moringa School. He admits that joining Moringa School is the best decision he has ever made.

Moringa2018_60.jpg
Gitu Mbugua and John Mutavi

Andrew Anampiu who is the technical mentor of the class says that he has seen a lot of growth in his students since the program started. He particularly loves that they have learnt how to pitch their ideas in front of a panel. Other than having technical competence it is also an important skill for programmers to know how to work in a team and present their ideas. Most tech companies are searching for developers with all rounded soft skills and he believes his class is ready to join the tech industry.

 

 

 

 

 

 

Moringa School partners with MEST to expand across Africa

 

By Nancy Momanyi,

Moringa School Staff.

Moringa2018_2

Since it was founded in April 2014 Moringa School has been the leading learning accelerator seeking to provide its students with both digital and professional skills training. Audrey Cheng who is the founder and CEO of Moringa School noticed that there was a skills gap among the Kenyan youth. She previously worked at Savannah fund which is a seed capital fund specializing in investments in early stage,high growth technology startups in Sub Saharan Africa. While at Savannah fund she realized that finding suitable candidates to hire would take at least 6 months. She wanted to solve the skills gap in Kenya and Africa as a whole.

Moringa School is partnering with MEST to expand to other parts of Africa. It is currently based in Nairobi, Kenya. The partnership with MEST was initiated in September when Moringa School had its first Ghana class. Moringa School plans to launch in Capetown on February 12th 2018. The second Ghana will also kick off on the same date. 

The Meltwater Entrepreneurial School of Technology (MEST) and MEST Incubator provide training, seed investment and mentor ship for the next generation of globally successful African software enterprises. The partnership with Moringa School to offer the 20 week programming and professional development course is aimed at graduating students with software development skills to bridge the skills gap in Africa.

Moringa School is divided into two main programs, Moringa Prep and Moringa Core. Moringa Prep is a five week introductory course which covers the fundamentals of programming like HTML, CSS and JavaScript. Moringa Core is a more immersive program which takes fifteen weeks. This is where the students learn how to build entire websites and mobile applications on their own. Once a student has successfully finished the Moringa Prep program they have the option of either joining Full stack web development or Android Development.

 

 

ARE WE READY FOR THE INTERNET-OF-THINGS?

By Kepha Okari.

Moringa School Student

 

IOT

Imagine reading your favorite book and a text comes in from your washing machine informing you that it’s done with your laundry and you need to dry them, or a message from the hydro sensors in your pot reminding you to water your plant. Better yet, a reminder from your fridge about the refreshments you need to buy whenever pass near a convenient store. How cool and convenient is that? The very concept of interconnecting appliances and accessories around our lives is what we call ‘Internet of things’. The key idea is to minimize human and computer direct interaction by enabling the devices to gather data from our environment on their own, interpret and act on it or advice us appropriately.

Like the two sides of a coin, IoT  comes with its own benefits that are so hard to resist and inevitable challenges. Much of the questions that arise about  our readiness for IoT have to do with the technical aspects. Any day any time, we will all be ready for the positive impacts of anything that there is to think about. I can’t quite say that regarding the probable  IoT challenges. This is so because all the stakeholders seem to direct their focus on the basic benefits of IoT but have taken  a backseat on solving the challenges it presents. We will never question our readiness for this piece of technology until we take our time to evaluate these existing challenges

Notably, the cost of implementing this piece of technology will not be any forgiving due to the infrastructure required to support it. However, this should be the least of our worries as there are always people willing to invest in innovations should they foresee an economic bubble attached to it. The technical challenges remain the real elephant in the room.

The first concern is security. We all want  to secure our personal  information from getting in the hands of bad people. But not all of the users have the technical know-hows to ensure this happens. Came to think of it, with  the large numbers of devices connected to the Internet, their will be a lot of information in the offing  and businesses will be yearning for it to optimize their marketing. There are those who will do about anything to avail this information to some of these corporates who are willing to play dirty. Also, there will always be those crazy hackers who will see this as an opportunity to take there mischievous a notch higher. With ten or so devices linked to one user, it becomes difficult to store passwords for each. As such, most users will likely use one password for all the devices or their email (or even worse, their social media account) to login. Unfortunately, this will widen the avenue of leaking their sensitive information. How secure a user can be depends on the security state of their least secured device. If the ‘right kind of hackers’ get this access, God knows what they can do.

Reliability is another concern. Owing to the dependence that will be attached to this kind of technology, any failure of servers will be felt to the core. We first need to ensure resilience in case that happens. Until then, I doubt our preparedness. Also, there will be so many devices to connect to the internet, it will be a real challenge allocating each an Internet Protocol address. An IP is the unique identification allocated to every device connected on the internet. It enables the device to send and receive information over the Internet. Much like a phone number is assigned to each phone in the cellular network for communication with other phones.I believe going forward, there is a high possibility of exhausting the available IP resources availed by IP version 6 (IPv6), which many believe is the ultimate IP addressing solution. Very few imagined IPv4 would be exhausted until the internet adoption proved them wrong. We will need a much more scalable IP addressing system. Otherwise, sticking to IPv6 as our silver bullet for this will be like fighting obesity by adjusting a belt.

We cannot also hide away from the environmental implications that IoT will present. IoT will peg its success on cloud computing which in turn will require millions of data centers to host the chunks of data generated by the users. We will need a lot of electricity to keep these facilities running. Currently, a research by Molecular Diversity Preservation International and Multidisciplinary Digital Publishing Institute (MDPI) estimates that they take 9% of the global electricity and generate 2% of carbon emission. If IoT adoption rockets before we find renewable energy sources that are more practical and scalable, this figures will get even more scary. Holding this challenges in mind, do you think we ready for the Internet of Things?