Sunday, March 16, 2014

Using Android Mobile as Massive Downloader

 

Your can use your Android mobile to utilize your Unlimited Internet without keeping your Computer ON All the time.

Advantages of Using Android Mobile to Download big things instead of Computer:

1. Big Energy Savings

2. Reduced Wear of Computer/Laptop

& nice sleep at night ( no more sound of fan )

 

What is Needed?

1. Android Mobile ( having Wi-Fi )

2. Wi-Fi Router or Mobile Internet Plan

3. Aria2 Download Manager for android

4. Terminal App for Android

5. Aria2 Web Interface

 

Steps:

  1. Enable USB debugging on your Android Mobile & Connect it to Computer
  2. Download this Minimal ADB package & extract it somewhere & open command prompt (cmd) & cd to your adb directory.
  3. Now Execute this “adb devices” this will start adb daemon & list connected devices. If your mobile not get listed then you need to install your mobile’s drivers or install this Universal Adb drivers
  4. Now if your mobile is rooted then you can place aria2c binary in /system/bin, if not then temp. ( we will consider rooted scenario )
  5. Now extract aria2c zip file & cd to its folder. Execute this “adb push aria2c /system/bin”. This will copy aria2c binary to /system/bin on android mobile
  6. Aria2 is command line program,you can provide config file to it, so that every time you start Aria2 you dont need to provide all commandline arguments.
  7. Now start your Terminal App & Execute this “aria2c --enable-rpc --rpc-listen-all --rpc-user=ankush --rpc-passwd=password -–daemon”. Change username & password you whatever you want. Now aria2 has started on Mobile. Enable Wi-Fi tethering/wifi hotspot on Mobile & connect to Mobile from your Computer.
  8. Now aria2c supports control through XML-RPC interface means you can control Aria2 over Web Interface. Extract Aria2 Web Interface zip on your desktop
  9. Open Index.html file in browser, Under Settings->Connection Settings enter your Username & password & click on OKAria2_settingsAria2_webui
  10. Now you can add/remove downloads to your android mobile from your Computer.

Aria2 supports HTTP,HTTPS,FTP,Bit torrent,Metalink… downloads, So it is Complete Download Manager.

Building Avian Java Virtual Machine

 

What is Avian?

Avian is an open-source, lightweight Java virtual machine (JVM) and class library designed to provide a useful subset of Java's features, suitable for building self-contained applications.

The VM is implemented from scratch and designed to be small and fast, featuring:

  • Just-in-time compilation for fast program execution
  • Generational, copying garbage collection to ensure short pause times and good spatial locality
  • Thread-local heaps providing O(1) memory allocation with no synchronization overhead
  • Null pointer dereferencing and arithmetic errors handled via operating system signals to avoid unnecessary branches
  • Proper tail calls and continuations

& Best of it is

The virtual machine is designed to be embedded along with application classes into a single executable file, which can be run on systems where the Oracle Java platform isn't installed.

Supported OS: Windows, OSX, iOS, Linux, FreeBSD

Platform: ARM, IA-32, x86-64 & PowerPC

Let’s Build it for Windows.

What is needed?

1. MinGW or TDM GCC

2. MSYS

3. JDK 7 ( skip if already installed )

4. zlib

5. Go to Avian’s Github repository & download Avian’s source code in zip.

Avian_github

Introduction about Tools:

MinGW & TDM GCC provides gcc for windows (i.e. Windows port of GCC)

MSYS provides *nix environment on Windows like Bash shell, GNU Core Utilities...

Steps:

1. Start MSYS either by shortcut or go to MSYS install folder & execute MSYS.bat

2. Now you will see nice Bash shell console window.

3. Now set JAVA_HOME environmental variable to JDK directory & do not include bin directory. ( including bin generates build error )

E.g. export JAVA_HOME="C:\Program Files (x86)\Java\jdk1.7.0_21"

4. Now first we need to build zlib, Extract zlib, cd to Zlib directory

5. Execute “make -f win32/Makefile.gcc BINARY_PATH=C:\TDM-GCC-32\bin INCLUDE_PATH=C:\TDM-GCC-32\include LIBRARY_PATH=C:\TDM-GCC-32\lib install”

Here replace C:\TDM-GCC-32\ with your Mingw or TDM install directory

6. Now we have everything to build Avian. Extract Avian to folder & cd to Avian’s directory.

7. Execute “make bootimage=true” & press enter.

8. Now if everything works fine then Avian is built under “build” folder

9. cd to Avian’s “build” folder, cd to “windows-i386-bootimage” , create your java program here

10. Now compile it with “javac -bootclasspath classpath <name>.java”

11. Copy “classpath.jar” from host to its parent directory means “windows-i386-bootimage”.

12. Now execute “jar u0f classpath.jar Hello.class” ( This will add your .class file to classpath.jar )

13. Now copy “classpath.jar” to embed directory.

14. Rename classpath.jar to boot.jar ( You can optionally see with archive manager that your .class file is added or not )

15. Execute “embed.exe output.exe boot.jar [package.]<classname>” ( [] optional part )

E.g. embed.exe hello.exe boot.jar Hello

Avian_output

Avian creates much smaller executables than GJC but supports limited API