In the beginning of this post, I asked myself: why Vim and why I would like to cut my fingers? (Joke). An answer to this question is simple: I met with a number of situations in my life where I actually edit the file on the server or on a specific device connected to the network. But how to do it when there are no possibilities of installing any external text editor?
Everyone has their own toolbox, which is a set of tools that uses in everyday work and even after work. Sometimes it is so that incoming to the company/job anyone could ask a simple question. What tools do you use? So then what you say? In my opinion, either in the work of the tester, programmer or system administrator and any other work related to IT, it is important to know well and use a text editor. And the text editor in both Linux and Unix is Vim. Some will say that the Vi, but for simplicity, I will say that Vi and Vim mean to me almost the same thing.
For the moment someone says, but he is the best Emacs text editor, again, another person can say that Atom is really great. OK, I agree with all the views, but … There are some cons. Especially on any Linux and UNIX machine. If I log onto the production machine likely I’m will not even have the right to install any additional software but use this one that is already available. Of course, we can look around and see what happens but it will be hard with installing there any additional software. However, we will not use such editors as, for example, nano the text editor is often used on Ubuntu, but Red Hat or CentOS no longer can be a pre-installed editor, which is relatively easy to use.
Vim is free. If we have one machine – our beloved laptop we don’t need to pay for the license. We have 10,000 servers – is still free on each of these machines, there are no hidden costs involved.
The third reason – Vim is super customizable. The ability to install plugins, write your own and the engine itself can not be compared with any paid tool.
Another important thing is that Vim does not require a graphical user interface. Most servers do not have a graphical user interface installed, the X server so inevitably we can not run anything that will allow you to display icons, Eclipse, or are other java-based editors. We can never assume what we have installed on the server.
The last reason: Vim is a fast tool for editing code or editing files. If you’ve ever seen a user who has for several years used the Vim and how he can make changes in the code you were a probably very impressed. There is a competition which aims to see how quickly the participants can do the right things in Vim.
There is one disadvantage, the learning curve but in the end, it is worth it.
Reading logs during testing Android applications often force developer or tester to use appropriate tools. One of them is: Android Device Bridge. ADB comes as a part of the standard Android SDK, it provides a terminal-based interface for interacting with your devices with Android file system. Below I added some useful commands that every tester, programmer use during deal with applications every day.
– access to Android device logs, direct output to the console
adb logcat -d > [filename]
– this command allows to save logs in a file name you have specified, for example: abd logcat -d Users/user/storage
adb logcat -c - all
– logs on devices are erased, after that you are able to grab logs without unnecessary data
adb logcat -v time
– display logs with specified time
– reboot device
– ensure that there is a server running
– kill the server if it is running
adb push app /system/sd/app
– push apps from comupter onto device
– prints: offline | bootloader | device
– prints: serial-number
– continuously print device status for a specified device
– remounts the /system partition on the device read-write
adb reboot [bootloader|recovery]
– reboots the device, optionally into the bootloader or recovery program
– restarts the adbd daemon listening on TCP on the specified port
– list PIDs of processes hosting a JDWP transport
adb ppp [parameters]
– Run PPP over USB.
Note: you should not automatically start a PPP connection. refers to the tty for PPP stream. Eg. dev:/dev/omap_csmi_tty1 [parameters] – Eg. defaultroute debug dump local notty usepeerdns
adb -s [yourdeviceserialnumberhere] shell
– above command will start an interactive shell from your machine, but running on your device
Starting a new project in Android Studio is a very simple task if we have an idea of course what we want to do. In this post, I will show step by step how to create a simple project using blank activity with fragment.
First, we should run AndroidStudio and then select from the main window: Start a new Android Studio project. After that, we will see a: Configure your new project window:
This window allows naming your project, select location of workspace and also set your company domain, for me company domain is: andrzejdubaj.com.
Next screen allows selecting form factors on which app will be running.
I select: Phone and Tablets, also: Minimum SDK – API 21: Android 5.0(Lollipop). Why has Android 5.0 Lollipop ? Because I have a smartphone on which I can test my app – physical device, not an emulator and second: I want to build from source Android 5.0 and run in on raspberry pi 2 or 3 version. We will see in the future.
On: Add an activity to Mobile allows selecting one from several activities with automatically add necessary file to project, for example, *.xml files. I select a blank activity. If I decided to create some localization app I will choose google maps application.
Next step takes us to: Customize the Activity. Way, I choose fragments ? Because fragments allow building an application with behaves somewhat like a nested activity that can define its own layout and manage its own lifecycle. You can read more here.
After pressing on: Finish button we will get build the layout of an application. Basic project structure with catalogs and base classes.
On this point, we can start developing the application. Writing code and add necessary files.
During launching my tests written in JUnit I notice problem with performing one of them. I received:
java.io.IOException: Cannot run program "aapt": error=20, Not a directory at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
In Stack Overflow I found a lot of solutions but non of them didn’t solve my problem. There’s a bug in IntelliJ IDE that points to platform-tools for executable that are in build-tools. I found my own solutions of this problem: