FIreHAzaR:-D CRiB

This is not a blog. This is my diary.

Current Posts

  1. Web development, build stage

    These are tools I'm interested in to automate the process of building a website. I grow a need for a build stage, where I compile the website resources before they are production ready.

    Read more »
  2. Server configs

    Tomcat (Apache SOLR)

    Tomcat to supports UTF-8

    Edit Tomcat's server.xml:

    • Add URIEncoding="UTF-8" to the correct Connector.
    • Be sure to remove useBodyEncodingForURI from that Connector.

    Source: Wim Mostrey.

  3. Useful bash scripts

    Tar

    • Create tar file:

      tar -cv -f FILENAME.tar DIR/FILES
      • -p, preserve file permissions.
      • -J, xz (best) compression, or -j for bz2

    Drop all database tables

    Save this code as "db-truncate.sh".

    #!/bin/bash
    mysqldump -u$1 -p$2 --add-drop-table --no-data $3 | grep -e '^DROP \| FOREIGN_KEY_CHECKS' | mysql -u$1 -p$2 $3

    For database dump: db-dump.sh

    #!/bin/bash
    mysqldump -hHOST -uUSER -pPASS DATABASE --no-data > DATABASE.schema.sql
    mysqldump -hHOST -uUSER -pPASS DATABASE --ignore-table=DATABASE.search_index --ignore-table=DATABASE.cache% --extended-insert=FALSE --no-create-info --add-drop-table --compress | split --line-bytes=20000000 - DATABASE.sql.
    gzip DATABASE.sql.*

    Show hidden files on console

    If you need to copy directory including the hidden files, you need this.

    1. Set shopt dotglobe option to enable.

      shopt -s dotglob
    2. Copy hidden files and folder.

      cp -pr SOURCEDIR TARGETDIR
    3. Set shopt dotglobe option to disable.

      shopt -u dotglob

    Source: labtestproject.com.

    Read more »
  4. Useful git commands

    Git command collection

    • Recommit HEAD.

      git commit --amend
    • Untrack files, when .gitignore and .git/info/exclude doesn't work.

      Stop tracking files with:

      git update-index --assume-unchanged MYFILE

      Resume tracking files with:

      git update-index --no-assume-unchanged MYFILE

      Source: Stackoverflow.com.

      Keep a note on which files being untracked. Git will not document this changes.

    • See the number of commits done to a repository.

      git log -a --pretty=oneline | wc -l

      Source: Chris Coyier.

  5. WYSIWYM (what you see is what you mean)

    What is it?

    WYSIWYM is not WYSIWYG. Well actually it is. But it is more geared toward using stylesheet than inline-css.

    Currently I am struggling to master wymeditor.

    I'll be using this for every site I made. Unless there's a higher authority that says otherwise.

    The question is, how to make it works like LibreOffice.

  6. drupal scripts for development

    Commands to switch to environment

    • Disable cache

      drush vset cache 0
      drush vset preprocess_css 0
      drush vset preprocess_js 0
      

      Source: stackoverflow.com.

    Database management commands

    • Backup database

      drush -v sql-dump --gzip --ordered-dump --result-file=/PATH/DUMPHERE.sql
    • Restore database from backup

      1. First nuke the database table.

        drush -v sql-drop
      2. Import our backup.

        gunzip -c /PATH/DUMPHERE.sql.gz | mysql -hHOST -uUSER -pPASSWORD DATABASE

    Labels: , ,

  7. Best Practices

    Check it out yo!

    This is the list of html structure and design best practices. I leech them from blogs and stuff. I hope I could get as many reference as I can and pour them here.

    Read more »