Wednesday, October 19, 2016

What is "export default" in JavaScript?

ES6 is the first time that JavaScript has built-in modules. ES6 modules are stored in files.

The "export" statement is used to export functions, objects or primitives from a given module(or file).

There are two types of export available:

  • Named export - useful to export several values from a given file.
  • Default export - there can only be a single default export from a given file. 
If a module defines a default export, then you can import the default export by omitting the curly braces.

Read more:

Friday, October 7, 2016

ReactJS

What is ReactJS?


Following is the answer that I found when searched the above question on Google:

"React is a JavaScript library for creating user interfaces by Facebook and Instagram. Many people choose to think of React as the V in MVC. We built React to solve one problem: building large applications with data that changes over time."

Links to read more about ReactJS:




https://egghead.io/courses/getting-started-with-redux

https://css-tricks.com/learning-react-router/

How to access ReactJS libraries?

  • Accessing ReactJS library from cdn in the html file is one way. (Refer: https://www.kirupa.com/react/creating_single_page_app_react_using_react_router.htm)
  • <!DOCTYPE html>
    <html> 
    <head>
    <title>Creating React Component with React.createClass</title>
    <script src="https://unpkg.com/react@15.3.2/dist/react.js"></script>
    <script src="https://unpkg.com/react-dom@15.3.2/dist/react-dom.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.min.js"></script>
    </head>
    
    <body>
     <div id="app"></div>
     <script type="text/babel">
     var destination = document.getElementById("app");
    
     var App = React.createClass({
       render: function() {
         return (
           <div>
             <h1>Welcome World!!</h1>
           </div>
         )
       }
     });
    
     ReactDOM.render(
       <div>
         <App/>
       </div>, 
       destination
     ); 
     </script>
    </body>
    
    </html>
  • Accessing ReactJS related modules from npm and bundle them and provide them to the html file is another way. (Refer: https://www.tutorialspoint.com/reactjs/reactjs_environment_setup.htm)
How to create ReactJS components?

There are two ways to create the ReactJS components.
  • Using the traditional way: React.createClass
  • Using the ES6 way: extends React.Component

Setting up Sublime-Text for React JSX development:

http://www.nitinh.com/2015/02/setting-sublime-text-react-jsx-development/

Sunday, September 18, 2016

Node basics

How to parse command line arguments in nodejs?

>node test.js hi hello cool

test,js
var cmdArgs = process.argv.slice(2);
console.log(cmdArgs); //prints ["hi","hello","cool"]

How to write a reusable module and how to import it in test.js?

myreusablemodule.js
module.exports = {
      sayHello : function(){
           console.log("Hello, how u doing?");
     }
};

test.js
var rModule = require("./myreusablemodule"); //returns whatever is assigned to module.exports
console.log(rModule.sayHello());

>node test.js

Explain about event driven programming in nodejs?

In an event driven programming, there is a main loop that listens for events, and then triggers a callback function when one of these events is detected.
Read more here: https://www.tutorialspoint.com/nodejs/nodejs_event_loop.htm

Give an example of event driven programming in nodejs?

All you need to remember is on and emit.

test.js
var events = require("events");
var eventsEmitter = new events.EventEmitter();
var mycustomeventassocfunction = function(){
      console.log("i am the response from mycustomeventassocfunction");
};
eventsEmitter.on("mycustomevent",mycustomeventassocfunction);

eventsEmitter.emit("mycustomevent");

>node test.js

How does the async functions work in nodejs?

Events and callbacks help nodejs to support concurrency.
database.query('something', function(err, result) {
  if (err) handle(err);
  doSomething(result);
});
The async function query takes callback function as the last parameter and the callback function takes err as the first parameter.
Read more here: https://www.tutorialspoint.com/nodejs/nodejs_event_loop.htm

What are the global objects in nodejs?

You don't have to require/include the global objects in nodejs programs. For example, console, process, __filename, __dirname, etc.

Read more here: https://www.tutorialspoint.com/nodejs/nodejs_global_objects.htm

test.js
console.log(__filename);

>node test.js

Friday, September 9, 2016

Cross-Origin Resource Sharing (CORS)


  • Say, web site a.com has some data that b.com site wants to access.
  • Web browser's same origin policy won't allow that happen.
  • If a.com supports CORS requests (that are made by sites like b.com) by adding a few special response headers, b.com can access the data.
  • CORS (Cross-Origin Resource Sharing) is a W3C spec that allows cross-browser communication from the browser. By building on top of the XMLHttpRequest object, CORS allows developers to work with the same idioms as same-domain requests. Read more in this html5rocks tutorial by Monsur Hossain!

Tuesday, August 30, 2016

Learn SQL queries on Oracle database

  • Go to http://sqltest.net/
  • Select Oracle 11g from the drop down on the right side of the black navigation bar.
  • Use these practice queries from this site.

Friday, August 19, 2016

Statistical Analysis System (SAS)


  • What does SAS stands for?
    • Statistical Analysis System
  • Who was the founder of SAS?
    • Jim Goodnight
  • How long SAS been around?
    • Around 30 years
  • What do you do with SAS software?
    • Gather, massage and manage the data, analyze the data, generate reports based on data.
  • What is the SAS software comprised of?
    • SAS Server to collect and save data, SAS Applications such as Enterprise Guide, SAS add-on for Microsoft Office, SAS Web Report Guide.
  • What are the SAS data access products?
    • SAS/ACCESS products that run on SAS Server.
  • Where can you download SAS software at free of cost?
  • What is a task in Enterprise Guide?
    • Tasks are the built-in wizards of Enterprise Guide.
  • Name couple of Enterprise Guide tasks?
    • Query Builder, Graphs, Reports, etc.
  • Why do you use charts in SAS?
    • To summarize the data.
  • Explain the basic mathematical terms mean, median, mode, range and give an example?
    • Mean is the average of all given numbers
    • Median is the middle number in the given numbers when arranged from smallest to largest
    • Mode is the number that appears the most in the given numbers
    • Range is the difference between the largest and smallest numbers in the given numbers
    • Let's find mean, median, mode, range of the given numbers 10, 18, 11, 11, 15
    • Mean: (10+18+11+11+15) / 5 = 13
    • Median: put the numbers in order: 10,11,11,15,18...and pick the middle number, 11
    • Mode: most appeared number is 11
    • Range: 18 (largest number) - 10 (smallest number) = 8
  • List some of the top pharmaceutical companies in USA?
  • Name some of the top clinical research organizations (CRO)?
    • Qunitiles, Covance, Parexel, Icon, INC, PPD, inVentiv, PRA, CRLI, WuXi
  • Name some of the top health foundations?
    • Bill & Melinda Gates Foundation, Robert Wood Johnson Foundation, Kresge Foundation, Nemours, W.K.Kellogg Foundation, Kaiser Parmanente.
  • Where can I learn more about Clinical Studies?
  • What are the clinical trial phases?
  • What is an IND Application?
    • IND stands for Investigational New Drug.
    • The drug sponsors file IND application to get the exemption from FDA to ship the experimental drug across the state lines (the intention is to use the drug in animal studies and human clinical trials). 
    • IND Application should have information in 3 broad areas: Animal Pharmacology and toxicity studies, Manufacturing information, Clinical Protocols and investigator information.
    • There are 3 IND types: Investigator IND, Emergency use IND, Treatment IND
    • Once the IND is submitted, the sponsor must wait 30 calendar days before initiating any clinical trials.
    • Read more at fda.gov
  • What is NDA Application?
    • NDA stands for New Drug Application.
    • The drug sponsors file NDA application with FDA to get the approval to sell the drug.
    • The data collected from IND becomes part of NDA.
    • Read more at fda.gov
  • What is the format of a proc step? (See for more details: http://www2.sas.com/proceedings/sugi29/256-29.pdf)