LAMP DB Backup from Command Line Tips

  mysqldump --databases database_one database_two > two_databases.sql
 
  scp your_username@remotehost.edu:foobar.txt /local/dir
  scp -i key_file.pem your_username@remotehost.edu:/remote/dir/foobar.txt /local/dir

  some git tips
  git push https://[username]@github.com/repo.git origin [branchhere]
  git clone -b [branchhere] --single-branch https://github.com/repo.git

Adding Custom Hook on Contact Form 7

How to add Custom Hook on Contact Form 7

/*
    Prevent the email sending step for specific form
*/

add_action("wpcf7_before_send_mail", "wpcf7_do_something_else");  
function wpcf7_do_something_else($cf7) {
    // get the contact form object
    $wpcf = WPCF7_ContactForm::get_current();

    // if you wanna check the ID of the Form $wpcf->id  
    $submission = WPCF7_Submission::get_instance();

    $yourname   = $submission->get_posted_data('your-name');    
    $youremail  = $submission->get_posted_data('your-email');


    return $wpcf;
}

Setting Virtual Host with XAMPP

<VirtualHost *:8080>
    DocumentRoot "C:\DIR"
    ServerName domain.localhost
    <Directory "C:\DIR">
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        Require all granted
    </Directory>
 php_flag display_errors on
    php_value error_reporting 6143
    php_flag log_errors on
    php_value error_log "C:\DIR"
</VirtualHost>

(e.g. for Xampp 1.7.7. )

<VirtualHost *:80>
 DocumentRoot C:/DIR
 ServerName domain.local

 <Directory "C:/DIR">
  Options Indexes FollowSymLinks Includes ExecCGI
  AllowOverride All
  Order allow,deny
  Allow from all
 </Directory>
</VirtualHost>

Loosely Coupled , Test Driven Design and API Centric Application

I now have my Asp.net MVC WebAPI 2 implemented with Test Driven Design.

Loosely Coupled with the help of Unity and TDDed with Moq.

Now I can begin porting my Real Estate Billing Management System coded in PHP and Zend Framework

public class PeopleRepository<T> : IPeopleRepository<T> where T : class
{
   protected AppDBContext db;

   public PeopleRepository(IUnitOfWork unitOfWork)
   {
     db = unitOfWork.DbContext;
   }
}
   public interface IPeopleRepository<T> where T : class
   {
      IEnumerable<T> FindAll();
      T GetByID(int id);
      void Delete(int id);
      void SaveOrUpdate(T customer);
   }
   public interface IPeopleRepository<T> where T : class
   {
      IEnumerable<T> FindAll();
      T GetByID(int id);
      void Delete(int id);
      void SaveOrUpdate(T customer);
   }

I will have this Application front ended with AngularJs2 because of TypeScript.

I heard that ReactJs is becoming more popular. But just *7^&off!

How to add custom post in WordPress

Hi Kids,

If you want to add custom post in wordpress, aside from the default POST and PAGE type posts.
all you have to do is add this piece of code in your functions.php

You have to change the “custompost “variable though.

register_post_type(
 'custompost',
 array(
  'labels' => array(
  'name' => __( 'Custom Post' ),
  'singular_name' => __( 'Custom Post' ),
  ),
  'description' => __('Custom Post'),
  'public' => true,
  'register_meta_box_cb' => 'custompost_meta_boxes',
  'show_ui' => true,
  'supports' => array(
   'title',
   'editor',
   'author',
   'excerpts',
   'custom-fields',
   'revisions',
   'thumbnail'
  )
 )
);

register_taxonomy_for_object_type('category', 'custompost');
register_taxonomy_for_object_type('post-tag', 'custompost');

function custompost_meta_boxes() {
 //add_meta_box( 'testpost_meta', __('TEST POST'), 'testpost_meta_box', 'testposts','normal', 'high' );
}

Alrigh kids,

Ciao!!!