Using Virtual_host and mod_proxy together in Apache

first configure DNS :

dns2

a2enmod proxy_http
nano /etc/apache2/apache2.conf
<VirtualHost *:80>
  ServerName public.server.name

  ProxyRequests Off
  ProxyPreserveHost On

  <Proxy *>
    Order deny,allow
    Allow from all
  </Proxy>

  ProxyPass / http://localhost:8080/
  ProxyPassReverse / http://localhost:8080/
</VirtualHost>

Keywords
apache , virtual host , VirtualHost , reverse , proxy

References
http://stackoverflow.com/questions/956361/apache-tomcat-using-mod-proxy-instead-of-ajp
https://httpd.apache.org/docs/2.4/vhosts/examples.html
http://askubuntu.com/questions/58179/install-mod-proxy-to-get-proxypass-to-work
http://www.thegeekstuff.com/2011/07/Apache-Virtual-Host/

How to configure proxy authentication to work with Ubuntu Software Center

Go to /etc/apt. Create the file apt.conf if you don’t have it there. Write the following lines there.

Acquire::http::proxy "http://username:password@proxyserver:port/";
Acquire::https::proxy "https://username:password@proxyserver:port/";
Acquire::socks::proxy "socks://username:password@proxyserver:port/";
Acquire::ftp::proxy "ftp://username:password@proxyserver:port/";

Save it. You are done.

Keywords
apt , ubuntu , proxy

References
http://askubuntu.com/questions/77449/how-to-configure-proxy-authentication-to-work-with-ubuntu-software-center

How to flash an Android Device manually

fastboot erase boot
fastboot erase cache
fastboot erase recovery
fastboot erase system
fastboot flash bootloader "name of bootloader"
fastboot reboot-bootloader
fastboot flash radio "name of radio"
fastboot reboot-bootloader
fastboot -w update "name of zip file"

or 

fastboot flash system system.img
fastboot flash boot boot.img
fastboot flash recovery recovery.img
fastboot flash cache cache.img
fastboot erase userdata
fastboot flash userdata userdata.img
fastboot reboot

References
http://androidforums.com/threads/guide-how-to-flash-a-nexus-factory-image-manually.706533/

List of fastboot commands

fastboot
usage: fastboot [ <option> ] <command>
 
commands:
  update <filename>                        reflash device from update.zip
  flashall                                 flash boot + recovery + system
  flash <partition> [ <filename> ]         write a file to a flash partition
  erase <partition>                        erase a flash partition
  format <partition>                       format a flash partition
  getvar <variable>                        display a bootloader variable
  boot <kernel> [ <ramdisk> ]              download and boot kernel
  flash:raw boot <kernel> [ <ramdisk> ]    create bootimage and flash it
  devices                                  list all connected devices
  continue                                 continue with autoboot
  reboot                                   reboot device normally
  reboot-bootloader                        reboot device into bootloader
  help                                     show this help message
 
options:
  -w                                       erase userdata and cache (and format
                                           if supported by partition type)
  -u                                       do not first erase partition before
                                           formatting
  -s <specific device>                     specify device serial number
                                           or path to device port
  -l                                       with "devices", lists device paths
  -p <product>                             specify product name
  -c <cmdline>                             override kernel commandline
  -i <vendor id>                           specify a custom USB vendor id
  -b <base_addr>                           specify a custom kernel base address
  -n <page size>                           specify the nand page size. default:
2048
  -S <size>[K|M|G]                         automatically sparse files greater th
an
                                           size.  0 to disable
 

References
http://androidforums.com/threads/list-of-fastboot-command.714676/

Usefull ADB Commands

adb devices

adb reboot recovery

adb reboot-bootloader

adb push [source] [destination]

adb pull

adb install [source.apk]

adb install -r [source.apk] // installing while keeping the app's data, as you would on the market or with an APK (It means update )

fastboot oem unlock

fastboot devices

fastboot reboot

fastboot flash recovery

adb sideload update.zip

References
http://lifehacker.com/the-most-useful-things-you-can-do-with-adb-and-fastboot-1590337225
https://tektab.com/2015/10/31/android-bootloaderfastboot-mode-and-recovery-mode-explained/
https://stackoverflow.com/questions/8962226/testing-an-adb-update-versus-install

Java Enums

Enum Example

public enum Level {
    HIGH,
    MEDIUM,
    LOW
}

Enums in if Statements

Level level = ...  //assign some Level constant to it

if( level == Level.HIGH) {

} else if( level == Level.MEDIUM) {

} else if( level == Level.LOW) {

}

Enum Iteration

for (Level level : Level.values()) {
    System.out.println(level);
}

Enum Fields

public enum Level {
    HIGH  (3),  //calls constructor with value 3
    MEDIUM(2),  //calls constructor with value 2
    LOW   (1)   //calls constructor with value 1
    ; // semicolon needed when fields / methods follow


    private final int levelCode;

    private Level(int levelCode) {
        this.levelCode = levelCode;
    }
}

Enum Methods

public enum Level {
    HIGH  (3),  //calls constructor with value 3
    MEDIUM(2),  //calls constructor with value 2
    LOW   (1)   //calls constructor with value 1
    ; // semicolon needed when fields / methods follow


    private final int levelCode;

    Level(int levelCode) {
        this.levelCode = levelCode;
    }
    
    public int getLevelCode() {
        return this.levelCode;
    }
    
}

References
http://tutorials.jenkov.com/java/enums.html
https://www.mkyong.com/java/java-enum-example/