API best practices

API Writing Best Practices by Binghan

always manually output your field

meaningful resource URI
-post(c) get(r) put(u) delete(d)

Continue reading


wordpress relocate

When moving wordpress, try this method. Take note, does not change image URLs.

define('RELOCATE',true);

bitnami custom app

update: PHP FPM is enabled by default. If your getting file not error for php files then try disabling PHP FPM.

  1. Create new directory in apps
  2. Allow bitnami user to edit files/directories:
    sudo chown -R bitnami /opt/bitnami/apps/{app_name}
    
  3. Create the following in apps/myphpapp/conf/

    httpd-app.conf

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    
    <Directory "/opt/bitnami/apps/{app_name}/htdocs">
        Options FollowSymLinks MultiViews
        AllowOverride All
        <IfVersion < 2.3 >
          Order allow,deny                          
          Allow from all
        </IfVersion>
        <IfVersion >= 2.3 >
          Require all granted
        </IfVersion>
    </Directory>
    Include "/opt/bitnami/apache2/conf/php-fpm-apache.conf"

    httpd-vhosts.conf

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    
    <VirtualHost *:80>
        ServerName your-app-domain.com
        ServerAlias *.your-app-domain.com
        VirtualDocumentRoot "/opt/bitnami/apps/{app_name}/htdocs/"
        Include "/opt/bitnami/apps/{app_name}/conf/httpd-app.conf"
    </VirtualHost>
    
    <VirtualHost *:443>
        ServerName your-app-domain.com
        ServerAlias *.your-app-domain.com
        VirtualDocumentRoot "/opt/bitnami/apps/{app_name}/htdocs/"
        SSLEngine on  
        SSLCertificateFile "/opt/bitnami/apps/{app_name}/conf/certs/server.crt"
        SSLCertificateKeyFile "/opt/bitnami/apps/{app_name}/conf/certs/server.key"
        Include "/opt/bitnami/apps/{app_name}/conf/httpd-app.conf"
    </VirtualHost>

    httpd-prefix.conf (this file is commented out when using vhosts)

    1
    2
    3
    4
    
    Alias /tackashop/ "/opt/bitnami/apps/{app_name}/htdocs/"
    Alias /tackashop "/opt/bitnami/apps/{app_name}/htdocs"
    
    Include "/opt/bitnami/apps/{app_name}/conf/httpd-app.conf"
  4. Go to /opt/bitnami/apache2/conf/bitnami/bitnami-apps-vhosts.conf and include your custom app’s vhosts conf.

    Include "/opt/bitnami/apps/{app_name}/conf/httpd-app.conf"
    
  5. Check that you have commented the appropriate prefix conf files out in bitnami-apps-prefix.conf.

The steps here do not exactly match Azure.


bitnami install module (app)

You can either download module from bitnami or try wget.

Remaining steps here.


bitnami framework

update: PHP FPM is installed within each framework. If your getting file not error for php files then try disabling PHP FPM.

  1. point your @ A record to server
  2. create subdomain A record and point to server (see tinyuni.com on GoDaddy)
  3. duplicate a framework folder (e.g. codeigniter)
  4. chown the new folder
  5. (optional) create certs folder here /opt/bitnami/frameworks/api/conf
  6. (optional) copy certs from here /opt/bitnami/apache2/conf/server.crt & server.csr & server.key
  7. navigate to /opt/bitnami/frameworks/api/conf and point all .conf files to new folder
  8. in httpd-prefix.conf remember to comment out the aliases
  9. restart apache

bitnami restart script

$ sudo /opt/bitnami/ctlscript.sh restart apache


azure blob

change blob version

- visual studio 2013
- donwload https://github.com/Plasma/AzureBlobUtility
- run sln
- build utility in visual studio
- open cmd and navigate to folder AzureBlobUtility/bin/debug/

BlobUtility.exe -k AccessKey -a AccountName -c ContainerName --setDefaultServiceVersion 2012-02-12

hide more text in the_content wordpress

the_content('',true);

mandrill

Sending via SMTP with mandrill:

1. create key in mandrill
2. upload swiftmailer library
3. make sure you got the smtp port open on your server.
4. use this test script from mandrill