Posts

Using FFMPEG to trim your videos

 There are multiple methods to trim or clip videos with the help of FFMPEG, but sometimes looking at the documentation can confuse lots of us, and we cannot derive the output we want. And the examples on the documentation are simpler than what we want to do. So I will show few methods to combine, trim or clip video files using FFMPEG. I won't be going through installation process and will assume that you already have it installed. 1. Using timestamps to clip the video 🕐   ffmpeg -i video.mp4 -ss 00:00:00 -to 00:10:00 -c copy output.mp4   This command will copy the clip from 0 sec to 10 min without re-encoding, since we specify not to re-encode. Break down of command:      -i  : input video file     -ss : starting timestamp you can define in hh:mm:ss or just secs     -to : ending timestamp, this is the timestamp of the video     -c copy : codec is copy, which doesn't require re-encoding   If you w...

Audio de-noising using Python (Wavelets)

What is audio de-noising? Audio de-nosing is a process of removing noise(unwanted sound/signals from audio). You might have heard of noise cancellation headphones, these remove all the noise from the audio.  This process has various applications in media creation and learning. Also, de-noising is not only done on audio but also done on images. There are various methods to do this. We will see 2 methods and implement one. Method 1: FFT (Fourier Transform)    There are multiple different implementations of FT: FFT (fast FT), STFT (Short time FT). Also, there are inverse for each of them IFT respectively. So what is it? In short, FFT converts signals from one form to another, in audio, the time-series signal is converted to the frequency domain. More shortly, the dominant audio (your voice) will have more power than the non-dominant(noise). The following video will explain (a really good video):  Denoising with FFT (in Python)  Method 2: Wavelets (faster than FT) ...

JWT Token Auth | JSON Web Tokens in Node.JS

Image
When you create a REST service or any backend server for a website or an app, there is one talk about this new trending method for authenticating the user who is requesting your servers for data.   Previously there were only a few ways to know where is the request coming from. That could be storing  cookies, sessions in browsers, and using them to identify the user. So this method evolved, the trick is to create a string that has info of the user and data about the user.   So JWT has payload, header, and signature which has info of the user and other important data. Why JSON you ask? because JSON is less verbose than XML and when encoded the size is small to easily use in HTTP transmissions. The authorization token is passed as:   Authorization: Bearer <token> How it works? User signs in with username and password.  The server creates a JWT using one of the algorithms (HMAC, RSA, or ECDSA). Then this token is sen...

Should I read a BOOK or take a COURSE?

There are lots of confusion these days as we have more options to pick from. As we grow we tend to look at answers to the problem all by ourselves. Considering Computer Science, we have a huge list of domains available like Machine Learning, Artificial Intelligence, Mobile apps, Web apps, Computer Network and Security, Data mining, Data Science, etc. and whatnot.  The first problem comes which domain to choose from, that is done, how do I learn it? So should I read a book or take a course (online or offline). Even if you choose one from book or course, still loads of options from a book list and course sites and types.🤔 One solution to this problem is: 🤗   Learn by doing. Simple, what am I saying is pick a domain, pick a project under the domain (a simple one, old one or just something of your own), and start developing it from scratch. Now you'll say I don't know anything about the subject, how am I going to code? So use the internet, check source codes of open source proje...

Adding Firebase functionality in your app | Part 2 Creating Firebase Authentication

Introduction: In this post, we will create a Login and Registration Page with Firebase authentication, we will accept the name, email, password of the user and register the user with the Firebase auth library. Implementation: First, we need to enable authentication for our project, go to the Firebase console, select Authentication from the left panel and then sign-in method, enable email method. In AS, go-to the assistant, in the right panel, select Authentication, click connect to Firebase, it will be in green when connected, second select Add Authentication to the project, Accept changes and finish. Now you can start coding. Create an Empty Activity, named as SignUp Go to SignUp.xml and add the following XML. The XML file defines three EditText for user input and Button. Add the following java code to read the input and create an account with the Firebase If everything is done correctly, you would be able to create an account with your email, when created check...

Adding Firebase functionality in your app | Part 1 Connection

Image
Introduction :   Firebase is an online free cloud database, storage and authentication provider by Google. It can be used in mobile apps, websites, and other standalone. It provides database storage facility which is real-time, means the changes made to the database are reflected in user apps in realtime. It is suitable for personal as well as business applications. Anyone with a Google account can start working with the Firebase. I am going to post a series of articles on Firebase, so stay tuned. Connecting your Android project with Firebase : There are few ways to connect to Firebase, but I'll show a quick and easiest way which is not really documented on Google Docs. Create an Android Project with Android Studio. Sign In with Google in AS with the same account that you want the Firebase project to be with. You can log in in AS with the option in the top-right corner, then go to tools option in the options menu. Choose firebase and then the assistant will pop up fro...

Create an APK of Android Projects from Android Studio

Image
Introduction : Creating an Android app is quite simple when you get a hold of it, but sometimes deploying it can get tricky, especially while the project is going to target some particular android users. So here's a walkthrough. Steps : Code cleanup, remove unused resources, removing these would make your apk as small as possible. String resources, extract strings that are hardcoded, these string won't be translated if the system is using some other language. Add appropriate android api in app.gradle file. Make sure everything is working fine and that there no extra debugging details available on the UI.  Once you're ready : Click on the Build option in the Options on the Top. Select Generate Signed APK Create Key for app, make sure you keep the key file safe, because when updating the file you might need this file again. Set a password and key store path Finish the process You will get a message showing the completion ...

Display a table in JFrame UI from MySQL Table

Introduction :    Many times while creating UI you come across difficulties like, how to display data to the user which is readable and looks good. Mostly labels are used to display text but for dynamic data, there's no good way to show them. So, here is the way to display data in a table directly from the MySQL table on the UI using JTable and some tricks to read data from ResulSet object, the output from the MySQL database. Implementation : The following code should be added in the frame initialization methods. Explanation : Firstly creating the data structures to store the data values and the column names. Looping through the ResultSet object and reading the data. Looping through the ResultSetMetaData object, which returns the names of the table which we will use as column names. Adding the JTable to JScrollPane, to make the Table scrollable. Source : I have a project on GitHub that implements such codes. It is a project of the Library Manag...

What are Google Play Instant Apps

Native Android apps, without the installation With Google Play Instant, people can tap to try an app or game without installing it first. Increase engagement with your Android app and gain more installs by surfacing your instant app across the Play Store, Google Search, social networks, and anywhere you share a link. Android’s new app publishing format, the Android App Bundle, makes it easier than ever to offer a Google Play Instant experience. Starting from the Android Studio 3.3 beta release, you can build and publish one app bundle artifact to Google Play containing both instant and dynamic feature modules. Build instant games easily with Cocos and Unity plug-ins. Google Play Instant is open to all app and game developers. These apps will give the experience to use it and test it on the device without the need to download the whole app. This method is suitable with games because the user first wants to know whet...

Vibrate Android device programmatically

Android has inbuilt functions to make a device vibrate. You can specify a time for which the device vibrate and also check if the device can vibrate itself and other inbuilt services.

Notify the user, when the user goes in wrong direction (Google Directions API)

If you are using Google's Direction API, it easy fairly easy to determine whether a user is following the route or not. If the user fails to follow the path, the user can be notified and given the right instructions to remain on the path. Most of the time, the user gets a new route, i.e. the route changes. It can be implemented as below.

Toggle Bluetooth from Command Line on Mac OS

There will be situations where you can't access the touchpad or just want to show off your command line skills 😋, then this commands will change your Bluetooth handling skill It'll be clearly handy to use it. Finding new ways led me to this blueutil  command line tool that helps to turn Bluetooth off/on using single cmd. Start by installing it by HomeBrew: run the following command The -p flag act as a switch to toggle the Bluetooth Tell me when you found this command helpful.

Monetise your Android app | Admob integration | with code...

Making an Android app is one thing but earning from it is other. There are many ways to earn from apps like premium packs, subscription, buying stuff, ads.  The advertisement would be the most efficient one and will give you good revenue. There are many advertising networks but Google provides AdMob which is more preferable in terms of standard and revenue too. Also, read:  Converting HTML5 Game for Android | 2 Methods So let us start to code. I'll explain two types of ads only if you want me to explain the other two, comment for the same. Steps to integrate AdMob into your Android app: 1. Creating an Admob account Go to AdMob site sign in with your Google account. Create an app and note down the App Id, which we'll use in our app to authenticate. 2. Import Mobile Ads' SDK Open your gradle files and in your project-level gradle, put the below code, inside  allprojects {}  section. 3. Add Dependencies Add the following in your...

Converting HTML5 Game for Android | 2 Methods

HTML5 games are easy to develop and use. It has great graphics and processing capabilities. Many may wonder to convert their web apps compatible with Android. So here are two methods, which will walk you through Android development for making your web app compatible with your favorite platform. Method 1: Hosting the Game  There are various sites where you can host your HTML game for free and also earn from it. After hosting it take the link of the Game use it to make your Android game. 1. Create a new Android Project (obviously) 2. Add the following to the '.XML' file of the layout. In the above snippet, a WebView is created which takes up the whole screen. And a ProgressBar which is by default round and will appear when the page is loading. Till now there won't be any errors 😅 3. In your MainActivity.java, start by typecasting the WebView and ProgressBar. 4. Add web settings and enable JavaScript. The above code creates some basic Web Se...

Best Alternative For Android's AVD | How to use it?

Image
Many of you will agree that Android's AVD is slow and it does affect the complete development process. But if your work device has good specs, like more than 4GB of RAM, then you are lucky ones. But I had the problem with the virtual device, hence I used the best alternative. So let's discuss why is the Virtual Device slow. 1. It eats up a large amount of memory Android Studio itself takes up about 2GB of RAM approx. The remaining is reserved for the OS to function and if you accidentally click on run and a virtual device is starting you're in trouble. What I do during this situation is I shut down my PC.  Also, VD is not meant to run that fast since it's working on some other structure. So you can't expect it to run as needed. 2. Let's come to the main point Which is the best alternative? I tried around 5 alternatives over the internet, then, at last, I came to the one. It's Genymotion, great speed and easy. Now I'll tell you how to us...

Top 5 Programming Languages of 2018

Image
Maybe it's too late to talk about this topic, but it's never getting old. There is always innovation in technology daily. So let's start. If you are new to coding read:  How to learn Programming Languages Top 5 simple ways to teach yourself to code 1. C++ Since it is a high-level language, it is still referred to as low level due to its complexity. This language has a wide range of uses, if you dig in deep, you'll come to know, that C++ is used in making games, drivers, low-level applications, etc.  It's a worth learning language but you'll need to focus on it's functioning as sometimes it can get complicated. You'll be amazed to know that C++ is faster than Java. Hence used in games. 2. Java Java is well-known and developing language used everywhere, anyone who's in the Computer or IT field will tell that the best language is Java. Android most beloved, made using Android, Network apps, Business applications, all are Java...

How to learn a programming language?

Image
If you are new to programming I'll suggest taking a look at  Top 5 ways to teach yourself to code Due to great advancement in the field of technology, it is really necessary to cope up with it. There is some domain that is really in demand, which require you to have excellent coding abilities and much more. So today I'll tell you some ways to learn to code in a way that'll enhance your future. These ways I used myself to learn. 1. Choose a programming language There are lots of languages to choose from. But choose according to the requirements.  Like you have to do some backend database work then, use MySql, Oracle, MongoDB, etc. You want to use some server scripts then Nodejs, PHP, JSP, etc. You want a frontend webpage then HTML, CSS, etc. You can use Python, Java, C++ for Object-Oriented Work. So try to know important things how these languages function and then decide to choose one from them. Check out: Top 5 Programming Languages of 2018.  ...

Top 5 simple ways to teach yourself to code

Image
  Every CS student wants to write great code and bring them to life. But not all are able to do so. Actually no, all are able to write and read the code. There are some tips or say some ways to learn them.   Coding is a practice of doing things to automate stuff that is done manually. This stuff is tedious to do but code it and then automate it to do it smartly. There are many things that are needed to know before learning to code.   Some are:  knowing how it works? what does it do? and many other? But let's not go into detail. So here are my some simple ways to learn to code. 1. Understand the Problem         First thing, understanding the problem you want to solve. Thinking before moving forward is the correct way. Finding out the solutions and then choosing the best solution from all the solutions that can be used to solve it. Taking guidance with the solution to the problem. It's better to do it alone but so...