Tagged: my_thoughts

Copying Files From Android Kitkat (4.4.4) to Slackware

I didn't know until I tried myself but when I connected my Samsung Galaxy Note 4 to my slacky64 (Slackware Linux) via USB, I no longer had an option to connect it as USB Mass Storage (UMS) like it did with other flash drives. In stead, it gave me two options: MTP and PTP. Hmm... what the heck are these?

mtp_php

Apparently, the old way of accessing the storage device had several drawbacks. One being how it was making its storage partition available to foreign systems. Whenever another system accessed the phone's storage area, it needed exclusive access to there, which means the entire storage partition was dedicated to that system and as long as that system was accessing there, the phone itself couldn't access any files or apps stored in that area. Also, this could easily mess up (or corrupt) the storage partition.

Another reason was the type of its file system. Because its storage partition needed to be available to various systems, mostly for Windows devices, it was formatted as the FAT file system (Duh...). FAT is an older and slower file system without the concept of file ownership. Not to mention Microsoft holds patents for which they demand royalties from OEM's for long file name support on the FAT file system, etc...

So what are MTP and PTP?

MTP (Media Transfer Protocol) is a subset of PTP (Picture Transfer Protocol) communication protocols that allow transferring media files from and to portable devices. These protocols have been around for a while but they are new to Android. They are considered better solutions to the problems UMS had. When a foreign system accesses the phone via MTP, it sends queries to Android and Android returns with the list of files requested. Then it downloads files. This allows access to file levels rather than exclusively opens up the entire storage portion and also allows Android choose which files to present.

This also enables Android format its storage device with ext3/ext4 or any other file systems - no longer limited to FAT!

PTP works the similar way and is mostly used by digital cameras.

For more information, please refer to Android USB Connections explained MTP, PTP, and USB Mass Storage

Now, some terminologies are out of the way, I tried transferring some photos from my Note 4 to slacky64 using MTP. Hm? It's very slow loading photos and it's even slower transferring them. Also, after photos were copied over, not only were their timestamp changed to current date and time instead of date and time taken but my photo viewer program also couldn't display them. That's not good...

I was hoping PTP would work better but no luck. It was even worse; I couldn't even get photos listed in my file manager.

Now, I went on a hunt for better ways to transfer photos.

I tried sftp and scp (with an option to retain the original timestamp) but its process kept dying on me while in the middle of transferring files.

I was kind of frustrated with this. Then, I found dukto in Google Play. It had good reviews and high rating points. I was a bit concerned about this program needing be installed on all devices, but, what the heck, as long as it'll transfer photos, I would be happy at this point.

Installation on the Android device was breeze. There were some extra steps needed to install it on my Slackware system because dukto was available in binary packages for CentOS, Fedora, OpenSUSE, RHEL, and Ubuntu and no source. This means the rpm package needs to be converted to the tgz format with the rpm2tgz command.

Converting rpm with rpm2tgz

Slackware comes with a handy utility to convert rpm files to tgz files. All you need is to run rpm2tgz with rpm file: # cd /tmp # rpm2tgz dukto-6.0-13.1.x86_64.rpm ... Slackware package /tmp/dukto-6.0-13.1.x86_64.tgz created # installpkg /tmp/dukto-6.0-13.1.x86_64.tgz Verifying package dukto-6.0-13.1.x86_64.tgz. Installing package dukto-6.0-13.1.x86_64.tgz: PACKAGE DESCRIPTION: Package dukto-6.0-13.1.x86_64.tgz installed. #

VoilĂ ! The conversion and installation went successful. To run the program, execute dukto: $ dukto

dukto_slacky64

Transferring Files

To transfer file from the Android device to PC:

  1. Open dukto on both devices
  2. On the Android device, click on the icon you want to send your files
  3. Choose Send some files and folders if you are sending files
  4. Locate files you wish to send
  5. Check files
  6. Click on the Send icon

Once selected files have been transferred, the confirmation message is displayed.

dukto_send

Transferring files was snap. In my opinion, the best way to transfer files for Android devices. Although this was the best method by far, I should note that the timestamp of transferred files was still changed. At this point, it's no longer a big issue because file name contains the date taken and this info as well as the time were embedded to file itself.

There are some drawbacks of this program:

  • There is no "select all" button. If you want to copy 100 files, you need to select all those files manually (or you could select a folder)
  • dukto needs to be running on both devices simultaneously
  • dukto must be active while transferring files; otherwise, it halts the process. This means no screensaver as well

Disclaimer:
The information in this site is the result of my researches in the Internet and of my experiences. It is solely used for my purpose and may not be suitable for others. I will NOT take any responsibility of end result after following these steps (although I will try to help if you send me your questions/problems).

That's all!
-gibb

A Happy New Year!

This is the first blog entry in 2014.

I can't believe another year past already. 2013 was busy year for me personally and non-personally. Well, if it's busy and got many things done, it would have been good and productive busy, but unfortunately, I was *just* busy and left many things undone in my laundry list. Hopefully, I can get some of them done in 2014.

To my big (and good) surprise, there were readers to my blog and they have left me such encouraging comments! This was not expected. Originally my intention of this blog was for notes to myself. But I'm very happy to hear that some of my notes have helped some readers. I hope I can keep up with their expectations!!

Well, I wish everyone a happy, peaceful, prosperous and productive new year!

That's all!
-gibb

WordPress Plugin: WP-No-Format

Being a WordPress (and Blogging) newbie, I have been trying to find a way to customize the representation of my posts for a few days. With a bit of ‘Googling’, I found about Child Themes.

Great! This helps me further customize my pages and my change/update won’t be affected by theme update. However, when I tried to ‘preserve’ the white-spaces with white-space:pre in CSS, this created extra empty lines:
With 'white-space:pre':
3 Spaces in front of this line.
This line should be right below above statement.

See, there is an extra line between statements. This is because the WordPress Editor inserts <br/> for each new line, plus, I think, ‘pre’ option specified in the ‘white-space’ property also preserves new lines. This creates extra space (If I’m wrong here, please point out!)

Now, how do we easily overcome this…?

Install WP-No-Format WordPress plug-in!

This plugin lets you prevent WordPress from modifying the HTML written code.

It’s very easy to use. All you need to do is to wrap the text which you want to protect with <!– noformat on –> and <!– noformat off –>.

<!-- noformat on --> With 'white-space:pre': 3 spaces in front of this line. This line should be right below above statement. <!-- noformat off -->

This example above will produce this:

With 'white-space:pre': 3 Spaces in front of this line. This line should be right below above statement.

That’s more I like it.

That’s all!
-gibb