Programming

Moving to Github Pages using Jekyll from WordPress.com

Sudeep Acharya
I started my blog “hellocoding.wordpress.com” in 2013. WordPress.com provides the basic functionality of posting the post for free. It does not give the way to embed JavaScript and does not offer much control over your blog. After a few years of blogging in WordPress.com, I realised that I want more control over my site so that I can improve my SEO, make a page redirection and make my site how I want in every possible way.

A Silly way to comment in your Code

Sudeep Acharya
During my beginners year of writing code, i used to comment unnecessarily. I realised this after i saw the code written by senior developers. The main purpose of the comment is to make your code understood by other developers who are working together in the same project or for other contributors. Let us take an example of the silly code: <?php // Assigning the value to firstNumber firstNumber = 9 // Assigning the value to secondNumber secondNumber = 12 // Creating variable to store the sum of firstNumber and secondNumber sumOfNumbers = 0; // Adding both firstNumber and secondNumber and storing it to sumOfNumbers sumOfNumbers = firstNumber + secondNumber // Displaying the result echo sumOfNumbers; ?

How to Install PHP Composer in your Mac

Sudeep Acharya
Composer is the easiest way to manage dependencies to your small to large PHP projects. Use the following commands to install composer in your Mac curl -sS https://getcomposer.org/installer | php Now the composer is installed in your current directory. Now, you can access it using the following command php composer.phar [command] It works but you don’t always want to use this directory path to access the composer, So in the next step we will make it accessible globally.

How to set up basic PHP Project structure with Composer

Sudeep Acharya
Most of the time beginners learning PHP are unaware of Composer, if you are among them, Composer is a dependency management tool for PHP. Let’s take a simple example, rather than using include command in each of the PHP file, composer makes it easy by specifying that file as a dependency. Another example would be if you use some library then it makes easier to use and update it with a single command.

Learn Kotlin (Part 5) - Class

Sudeep Acharya
Post Series: Part 1: Hello world and Basic Data Types Part 2: Array, Collection and Range Part 3: Control Flow Part 4: Function Part 5: Class Although Kotlin is statically typed language, it supports object-oriented programming like Java. Before explaining further let us dive into the basic syntax of the Kotlin class. class Vehicle { // class definition // class body } So, defining a basic class is as simple as this and similar to Java.

Learn Kotlin (Part 4) - Function

Sudeep Acharya
Post Series: Part 1: Hello world and Basic Data Types Part 2: Array, Collection and Range Part 3: Control Flow Part 4: Function Part 5: Class Merry Christmas Guys! The year 2018 is about to end. This have been a great year. Happy New Year 2019, May your new year be filled with Joy and Happiness. This will probably be the last post for this year 2018. Hope to see you all in the next year!

Learn Kotlin (Part 3) - Control Flow

Sudeep Acharya
Post Series: Part 1: Hello world and Basic Data Types Part 2: Array, Collection and Range Part 3: Control Flow Part 4: Function Part 5: Class In this post we are going to learn about the control flow in Kotlin. Let us learn about how to make a decision, how to perform a task multiple times by iterating and how to get out of the loop, how to continue to next iteration.

Learn Kotlin (Part 2) - Array, Collection and Range

Sudeep Acharya
Post Series: Part 1: Hello world and Basic Data Types Part 2: Array, Collection and Range Part 3: Control Flow Part 4: Function Part 5: Class In this post we will discuss about the Array, Collection and Range in Kotlin. Array In Kotlin, we can create array using two different ways. First one is by using arrayOf() function and next one is by using Array() constructor. Using arrayOf() function val accountInfo = arrayOf("Sudeep", 34000) The accountInfo array is of type Array<Any>.

Learn Kotlin (Part 1) - Hello world and Basic Data Types

Sudeep Acharya
Post Series: Part 1: Hello world and Basic Data Types Part 2: Array, Collection and Range Part 3: Control Flow Part 4: Function Part 5: Class Since Kotlin is already a official programming language for Android Apps development, I have been learning Kotlin lately. In this post, i will take you through basic hello world skeleton program to data types, variables in Kotlin. Hello World Program for Kotlin fun main(args: Array) { println("Hello World!

Recursive directory traverse and append .png file to list

Sudeep Acharya
Python Developer’s Meetup Nepal #13 Question Solution Q: Write a python script that recursively walks all sub-directories and searches all files with extension *.png or *.PNG and append them to the list. Solution: import os # list variable to store the .png and .PNG file png_file_list = [] # Recursive function to traverse all the sub-dirctory and check for png files def traverse_directory(dir_path): for child in os.listdir(dir_path): path = os.path.join(dir_path, child) if os.