Tuesday, February 11, 2014

How to configure MURA CMS

Scenario:

Downloaded and installed Mura CMS from http://getmura.com/. When installing, choose to run Mura with Railo and Tomcat.

But was not able to proceed further in getting the Mura CMS initial setup screen.

Solution:

1. Added a host entry in the server.xml file;

<Host name="mura.local" appBase="webapps">
        <Context path="" docBase="C:\...\tomcat\webapps\ROOT" />
</Host>

File Location:
    ..\RAILO_INSTALLED_PATH\tomcat\conf

2. Added an entry in the hosts file.

127.0.0.1       mura.local
File Location:
    C:\Windows\System32\drivers\etc

3. Restart the "Apache Tomcat Railo" service.

Successfully browsed the MURA configuration screen with the following url;

    http://mura.local:8888/

Monday, February 10, 2014

SQL Performance Optimization Checklist (Part -1)

A few points that I came across and implemented for a better SQL query execution and results;


1. Always in a JOIN condition the precedence comes from right. So RIGHT JOIN the table which has less number of rows or is of less size.

2.WHERE clause will always be executed from bottom to top. So tune the filter accordingly.

WHERE c1=1
AND c2 = 2
AND c3= 3 //First Executed

3. Implement any function in the WHERE clause as the last condition.

4. Use indexed column in the WHERE clause. Indexing implies faster search results.
Note: Indexing will create indexed trees for faster search / retrieval.

5. Do not use unwanted indexes in the table.
Note: We can always remove unwanted index in a table.


Database Used: Oracle

Sunday, February 9, 2014

Trivia about JavaScript Variables

  • Variables are typeless.
  • Act like containers
  • Prefixed with var keyword for declaration (Not mandatory)
  • variable name must begin with a letter (exception characters being $ or _ but not recommended)
  • variables are case sensitive  
  • Many variables can be declared and assigned (separated with a coma) with a single var prefix.
  • An unassigned variable will return 'undefined' when referred

Thursday, February 6, 2014

JavaScript: defer vs async

defer in JavaScript

To run a script block after the page is parsed in other words after the page is loaded, we use the defer keyword in the <script> block.
 

The keyword instructs the browser to wait until ready before executing the JavaScript block.
 

The key rule is the defer attribute will work only for external scripts i.e the keyword can be used only if the JavaScript file is loaded with a src attribute.

syntax:

<script src="test.js" defer>

async in JavaScript

Instructs the browser to run a script block as soon as the the block is available.

There is no wait time here for the browser to be ready. The script block is run in an asynchronous manner as and then the page is being parsed.

syntax:

<script src="test.js" async>

async vs defer

1. aync will take precedence over defer. The script will be asynchronously executed when the page is being parsed.
 
2. If no async but defer, the defer attribute property is executed.
 
3. If not defer or sync, the  script is fetched and executed immediately before parsing.

Wednesday, February 5, 2014

JavaScript: typeof

The typeof is an operator in JavaScript. 
It gets the data type of the variable. 
It returns a string value mentioning the datatype of the string. 
The operand can be a value, function or an object.

The following are the six possible typeof returns;

object
boolean
function
number
string
undefined

Syntax:

var sName = 'JavaScript';

//Usage format #1
alert(typeof sName);    //Will display string

//Usage format #2
alert(typeof(sName));    //Will display string


Tip: Always use the strict compare "===" when sing the typeof in a conditional operation.

Example:

var sName = 'JavaScript';

if(typeof(sName) === 'string')
{
    alert('The variable is a String');
}

Trivia: typeof(null) returns object