Saturday, August 22, 2020

How to install Moviepy on a AWS EC2

Recently, I wanted to move a python application from my local windows machine to the AWS EC2 instance. The application uses Moviepy for audio and video rendering. It took quite a bit of effort to port the application to AWS because the Moviepy intern uses FFMPEG and ImageMagick modules for rendering.

The below tutorial helps you install and configure the Moviepy module and its dependencies on an AWS EC2 instance. I assume you already have an EC2 instance up and running, refer to AWS documentation if you need help to launch an EC2 instance and SSH into the instance.

Table of content:

  1. Update the AWS EC2 instance and activate python 3
  2. Install FFMPEG
  3. Install and configure ImageMagick
  4. Install Moviepy

Tuesday, December 4, 2018

Java Crash Course : Garbage Collection

In Languages like C, C++ it is the responsibility of the developer to allocate/deallocate the memory needed for a program using malloc and calloc commands.

In Java, it is done by Java virtual machine automatically using the Garbage collector. In general, any object on the heap which cannot be referenced from the stack is eligible for garbage collection.

Garbage Collection uses two strategies to clear the heap.

  1. Match and sweep - Instead of identifying the objects with no references, GC maps all the objects for which there is a reference from the stack and sweeps others.
  2. Generation Collection - It was discussed as part of Java Memory management crash course where the heap is divided into four sections. Objects from the young generation are swept more than the objects in the old generation.

Java Crash Course : Memory Management in JVM

This document holds the summary of memory management concepts in JVM (Java Virtual Machine) that every software engineer should be aware of while designing/coding in Java.

Memory is divided into 2 parts
  1. Stack 
  2. Heap

Stack : Small when compared to heap memory and stores local variables and references to the objects in Heap.

  1. Each thread has its own Stack.
  2. Shorter life span
  3. Data from Stack is removed as soon as close braces ( } ) is encountered.
  4. Primitive types are saved in Stack.
  5. If a method pushed 10 elements to the Stack, all the 10 will be removed upon encountering closing braces.

Sunday, January 3, 2016

Jasper Localization From Property File:Encoding Issue

Recently In a Project I used Jasper to generate PDF forms.While doing this task I encountered a problem with Localization of Jasper Fields from Property Files.

Normally we include below attribute in JRXML header to point to localization files.

Localization files will be in same folder where JRXML is placed and localization files will be in below format.
  • etc
And each file will have key value pair like Date Date

and it will be used in JRXML in below format

and Localization is passed to JRXML in below format
 parameterMap.put(JRParameter.REPORT_LOCALE, new Locale("th"));
Encoding Issue:

When I generated the PDF for Thai language the output was a bunch of junk values.

The problem is resource bundle reads the property files in ASCII encoding even though property file is encoded in UTF-8

Sunday, September 27, 2015

Your own Broken Link Checker

Python Script : Crawl a website ,take screenshots and save it in word doc.

Steps to execute this script
  1. Create a folder 'link Checker' and place this script in it.
  2. Create a folder 'shots' and place it inside  'link Checker' folder.
  3. Change below variables 
    • url ="website url"
    • SaveDirectory=r ''screenshot directory"
  4. Execute the program.

Wednesday, February 18, 2015

What is the quickest traffic strategy to get traffic to your blog?

Quickest strategies will only work for a short period (A day or two).
Below strategy will help you to get huge traffic in very short duration and for a very short time.
Mantra: Target on NARROW LOCAL HOT topics.

Eg: Keep an eye on local exam results like GATE/IIT/JNTU/10th etc
I will explain taking JNTU as an example. You can apply same concept to other topics as well
 Do you know how many hits a JNTU website gets during semester results?

According to Alexa, JNTU website will get 40K hits during semester results. 
 Do you know how users reach JNTU results webpage?

Yup they Google it.
Now here is the tricky part .What if Google shows your blog as the first result when user search for "jntu results". YOU WILL GET 40K visits in a single day.

Friday, October 24, 2014

Control Remote Car with Keyboard

I got bored with software projects and thought of doing something different which I never tried. I've  always been fascinated by robots and have a dream of building one.This small baby step project helped me to understand the various concepts of Electronics.