Search This Blog

VIM: tidy up HTML

First enable filetype indent then set filetype to html, then enable smartident:
:filetype indent on
:set filetype=html
:set smartindent
Then re-format the file using the following commands:
1G      # go to the beginning of file
gg=G    # reformat the file from the beginning

CSS: image auto resize and centered inside a div

<div style="width:600px; height:400px;">
<div style="vertical-align:middle; text-align:center; width:100%; height:100%;">
    <img style="max-width:100%; max-height:100%; width:auto; height:100%;" src="http://your-domain.org/your-img.png"/>
</div>
</div>

see also

CSS: fit textarea to its parent div

textarea {
    height: 100%;
    width: 100%;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}
Example HTML code:
<div style="width:600px; height:400px;">
<textarea style="height:100%; width:100%; box-sizing: border-box;" readonly>
This is a textarea.
</textarea>
</div>
Run the Example:

Enable Mac OS X Integration library (com.apple.eawt.*) in Eclipse Java 8 Project

  1. Right click the project, select 'Build Path' then 'Configure Build Path...'
  2. Activate 'Libraries' tab, then open 'JRE System Library', then select Access Rules...
  3. Click 'Edit...' button, then click 'Add' button and type the rules:
    • Resolution: 'Accessible'
    • Rule Pattern: 'com/apple/eawt/**'

Install XNAT on Ubuntu 14.04

  1. Install and configure postgresql
    • Install postgresql:
      sudo apt-get install postgresql
    • Edit /etc/postgresql/9.3/postgresql.conf, and set:
      standard_conforming_strings=off
    • Restart postgresql:
      sudo /etc/init.d/postgresql restart
  2. Install Java 7
    • Run the following commands to install Java 7 SDK:
      sudo add-apt-repository ppa:webupd8team/java
      sudo apt-get update
      sudo apt-get install oracle-java7-installer
      sudo echo "export JAVA_HOME=/usr/lib/jvm/java-7-oracle" >> /etc/bash.bashrc
      
    • Run the following command to set Java 7 as default(java):
      sudo apt-get install oracle-java7-set-default
  3. Install Tomcat 7:
    export JAVA_HOME=/usr/lib/jvm/java-7-oracle; sudo apt-get install tomcat7
    
  4. Install Maven:
    cd /opt/; sudo wget http://apache.mirror.serversaustralia.com.au/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
    sudo tar zxvf apache-maven-3.3.9-bin.tar.gz
    sudo ln -s /opt/apache-maven-3.3.9/ /opt/maven
  5. Download and extract XNAT source:
    cd /opt
    sudo wget ftp://ftp.nrg.wustl.edu/pub/xnat/xnat-1.6.5.tar.gz
    sudo tar zxvf xnat-1.6.5.tar.gz
  6. Create XNAT unix user:
    sudo useradd -u 6667 -d /opt/xnat -s /bin/bash xnat
    sudo usermod -a -G tomcat7 xnat
    sudo chown -R xnat:xnat /opt/xnat
  7. Prepare XNAT directories:
    sudo mkdir /data/xnat/archive
    sudo mkdir /data/xnat/prearchive
    sudo mkdir /data/xnat/ftp
    sudo mkdir /data/xnat/cache
    sudo mkdir /data/xnat/build
    Note: /data/xnat should be the mount point for large storage for XNAT.
  8. Set up environment variables for xnat user, by editting .bashrc file:
    sudo su xnat
    vi ~/.bashrc
    add the following:
    # JAVA
    export JAVA_HOME=/usr/lib/jvm/java-8-oracle
    export PATH=$JAVA_HOME/bin:$PATH
    
    
    # Maven
    export MAVEN_HOME=/opt/maven
    export PATH=$PATH:$MAVEN_HOME/bin
    
    # Tomcat
    export TOMCAT_HOME=/opt/tomcat
    export PATH=$PATH:$TOMCAT_HOME/bin
    
    # XNAT
    export XNAT_HOME=/opt/xnat
    export PATH=$PATH:$XNAT_HOME/bin
  9. Create XNAT database user xnat01:
    sudo su postgres
    createuser -U postgres -S -D -R -P xnat01
    Note: set and remember the password for db user xnat01, you will need it in the XNAT build.properties file.
  10. Create XNAT database:
    sudo su postgres
    createdb -U postgres -O xnat01 xnat
  11. Edit build.properties:
    su xnat
    cd /opt/xnat
    cp build.properties.sample build.properties
    vi build.properties
    and the content should be like below:
    maven.appserver.home = /var/lib/tomcat7
    
    xnat.site.title=XNAT
    xdat.project.name=xnat
    xdat.project.db.name=xnat
    xdat.project.db.driver=org.postgresql.Driver
    xdat.project.db.connection.string=jdbc:postgresql://localhost/xnat
    xdat.project.db.user=xnat01
    xdat.project.db.password=XXXXXXX
    xdat.archive.location=/data/xnat/archive
    xdat.prearchive.location=/data/xnat/prearchive
    xdat.cache.location=/data/xnat/cache
    xdat.ftp.location=/data/xnat/ftp
    xdat.build.location=/data/xnat/build
    xdat.mail.server=mail.yourdomain.org
    xdat.mail.port=25
    xdat.mail.protocol=smtp
    xdat.mail.username=
    xdat.mail.password=
    xdat.mail.admin=admin@xnat.yourdomain.org
    xdat.url=http://192.168.100.12:8080/xnat
    xdat.require_login=true
    xdat.enable_new_registrations=false
    xdat.security.channel=any
    xdat.enable_csrf_token=true
    Note: xdat.url need to be set to the public ip or address instead of localhost if you want the XNAT server to be accessed from other computers.
  12. Edit project.properties file. and replace the 'maven.repo.remote' line with
    maven.repo.remote=https://nrgxnat.artifactoryonline.com/nrgxnat/xnat-maven1
  13. Run setup.sh script
    sudo su xnat
    cd /opt/xnat
    bin/setup.sh
  14. Create Database tables & views:
    cd /opt/xnat
    psql xnat01 -h localhost -d xnat -f deployments/xnat/sql/xnat.sql
    
    Note: you need supply the password for db user xnat01.
  15. Store initial security settings:
    sudo su xnat; cd /opt/xnat/deployments/xnat
    StoreXML -project xnat -l security/security.xml -allowDataDeletion true
  16. Store Example Custom Variable Sets:
    sudo su xnat; cd /opt/xnat/deployments/xnat
    StoreXML -dir ./work/field_groups -u admin -p admin -allowDataDeletion true
  17. Deploy the web app
    sudo su xnat; cd /opt/xnat
    bin/update.sh -Ddeploy=true
  18. Set the ownership of web app directory:
    sudo su chown -R tomcat7:tomcat7 /var/lib/tomcat7/webapps/xnat

Coolpad F1 8297W: How to install custom recovery?

  1. You need to root your 8297W mobile phone first.
  2. After rooting, install Mobile Uncle(YDSS) MTK tools from Google play store.
  3. You can install CWM or TWRP.
  4. Extract the downloaded CWM or TWRP package, copy recovery.img file to your 8297W SD card's root directory.
  5. Open MobileUncle Tools (in your mobile) to install recovery update







see also

Coolpad F1 8297W: How to enter fastboot mode?

How to enter Fastboot Mode

  1. Turn off the mobile.
  2. Hold Volume Up, Volume Down and Power buttons until system starts.







see also

Coolpad F1 8297W: How to enter recovery mode?

How to enter Recovery Mode

  1. Turn off the mobile.
  2. Hold Volume Up and Power buttons until phone starts.
  3. It should display a little Android Icon with message "No command."
  4. Press Power button again to enter Recovery Mode.
  5. Use Volume Down button to move the cursor and use Volume Up button to enter the selected item.







see also

Coolpad F1 8297W: How to root?

Method 1: Use Baidu Root tool. You can try either PC version or Android version:


Method 2: Manual root

  1. Download Official_root.zip and copy it to the phone's SD card.
  2. Turn off the phone.
  3. Hold Volume Up and Power buttons to start the phone and enter Recovery Mode, until see the Android icon with message "No command". Press Power button again to see the menu.
  4. Use Volume Down button to move cursor to "Apply software update from SD card", press Volume Up to select it.
  5. Select Official_root.zip then press Volume Up to install it
  6. After installation, restart the phone. You should see a app named SU.








see also