Posts

How to play YouTube video in Android app

Image
In this post, I am going to show you how you can create an android app, that will play YouTube Video. Our app will have a simple play button. Clicking the play button will play a youtube video. We will be using this video from Youtube for our case : https://www.youtube.com/watch?v=ZENmkJk9fBM .

Adding android vendor rules in Arch Linux

Image
I had been using Ubuntu for a long time and then I had switch to ArchLinux a couple months ago. Ubuntu had been my development machine for a long time. And then when I moved to Arch, things weren't the same as in Ubuntu. The process was similar but with different commands. A similar issue I had was during adding android vendors to devices rules. I edited the file named:

Run VLC as root

Image
Running VLC as root user is absolute NO. However, we are going to do this. Read this post to know how? When I first installed Arch the default user was root. I know how to create users in Linux but I just wanted to run VLC as root. If you want too, go ahead and follow the steps below: Step one: install hexedit. For Arch Linux use pacman -S hexedit Step Two: backup vlc. cp -p /usr/bin/vlc /usr/bin/vlc_backup Step Three: Open vlc in hexedit, hexedit /usr/bin/vlc Step Four: Replace geteuid with getppid, a. Press TAB, to go to hex ASCII values b. To Search use Ctrl+s c. type geteuid and press enter then type getppid d. Press Ctrl+x to save Step Five: Start vlc as root

ArchLinux crashed with error 'Unable to find root device...Youre are being dropped to a recovery shell'

Image
After been using Ubuntu/Fedora alternately one after the other for couple of years, I decided to use Arch Linux because of its concept of rolling-release unlike Ubuntu/Fedora. So on February 23rd I installed Arch on my system. It was working all good till June 11,2016 evening. When I suddenly bumped into an error when I booted up my system. I don't know what cause the error. As far as I remember , I forgot the update that was running in my guake terminal last time when I shutdown my computer. And then when I came back to turn it on. I had this error on my screen:

How to enable root SSH login in amazon EC2 instance

Image
In amazon EC2 instances, by default SSH login is done using keys. And the root login is disabled for security reasons. But times come when we have to enable remote SSH login as root. My situation came when I was doing xstream installation. I had to enter my root ssh details in their dashboard to initiate the installation.  So, here I am going to show, what I did to enable root login using password in amazon EC2. The steps below were done in Ubuntu 14.04 64-bit. First lets enable login using password, to do this, change the line in /etc/ssh/sshd_config PasswordAuthentication no to PasswordAuthentication yes

How to download a file in Android

Image
Today in this post, I am going to share the code that I use in my android applications to support downloading of file. There are many ways you can use to download a file. For example you can use Async task and read the file stream to save it in device storage, you could also use a Service to download the file. But in my example I will show you the code that uses DownloadManager class.

Image loading in Android

Image
To load an image in android requires you to read the stream into a bitmap and which then can be used to display the image. But this cannot be done in the main UI thread so you will have to use Async task. This requires you to write a lot of code. Besides you have to handle memory and disk caching mechanism. An easy and quick way is to use the Picasso Library. Picasso is a powerful image downloading and caching library for Android. Picasso can be included in your project by adding the following line to your project's gradle file: compile 'com.squareup.picasso:picasso:(latest version)' You can check the available versions at : https://github.com/square/picasso A simple example to load an image into an imageview is : Picasso.with(context) .load("http://i.imgur.com/DvpvklR.png") .into(imageView); It also allows image transformation to better fit into layouts and reduce memory size. An example to do this is : Picasso.with(context) .load("h...