Pages

Thursday, 31 March 2016

10 Places are hide on Google Map

  1. The Royal Residence, The Netherlands
  2. Buffalo Niagara International Airport
  3. Tantauco National Park, Chile
  4. Keowee Dam, South Carolina
  5. Mysterious Russian Site
  6. Minami Torishima Airport, Japan
  7. The Michael Aaf Building, Utah
  8. Cornell University Combined Heat and Power Plant, New York
  9. Babylon, Iraq
  10. Vlissingen, The Netherlands

Wednesday, 30 March 2016

5 things you can do with Oculus instead of gaming

  1. Gaming
  2. Architecture
  3. Art
  4. Medicine
  5. Therapy
  6. Tourism

Thursday, 17 December 2015

Meteor Js continuous integration with Codeship and Jasmine Js.


Hello, Following are simple steps to implements continuous integration for Meteor Apps on Codeship with Jasmine testing.

Lest assume that you have Codeship account and you have adequate knowledge of Jamine testing. Here you need to add Jasmine test cases in your project directory.

Also you need to create folder .deploy/staging, this folder will contains mup.json file and settings,json file. You need to configure mup.json file for deployment of your meteor project.

Codeship steps:

   - Clone latest Meteor repo from BitBucket
   - Paste the following script to "Setup Command" section, because codeship needs to  install Meteor      and other packages

        nvm install 0.10.33

     nvm use 0.10.33

     curl -o meteor_install_script.sh https://install.meteor.com/

     chmod +x meteor_install_script.sh

     sed -i "s/type sudo >\/dev\/null 2>&1/\ false /g" meteor_install_script.sh

     ./meteor_install_script.sh

     export PATH=$PATH:~/.meteor/

     meteor --version

     npm install -g velocity-cli

     cd ~/src/bitbucket.org/https://username@bitbucket.org/username/reponame.git/ && meteor add sanjo:jasmine velocity:html-reporter


   - Paste following script to "Configure Test Pipelines" section

         meteor run --test


   - Setup deploy command in deployment section by choosing custom script
   
          npm install -g mup

     cd .deploy/staging

     mup deploy

Sunday, 13 December 2015

Testing in JavaScript using Velocity

Testing in JavaScript using Velocity


Unit testing required for to ensure the reliability and maintainability of software, and more there is also methods like Test-Driven Development and Behavior Driven Development are avilable.


Velocity supports many javascript framework for testing it includes;

  1. Jasmine

  2. Cucumber

  3. Mocha


Jasmine supports most of the modes of testing in meteor. Following image shows testing modes and supported frameworks.



Jasmine


Each of the framework has advantages and disadvantage but Jasmine has unique fratures that makes it eady to use and get started with.

To use Jasmine, it does not required to have Node.js installed.


Installation


To install Jasmine run following command in your project directory.

meteor  add sanjo:jasmine

We  also need to install Velocity Reporter package to see test result.
meteor  add velocity:html-reporter


Suites and Specs


Each suite in turn contains a set of Expectations that compare the results of the test - called the actual - with the expected value. A Suite is defined by calling the describe() function. It takes two parameters: the name of the Suite, and the function which contains the calls to the expectation methods called Specs. These are defined using the it() method. Like describe(), it() also accepts a name and function parameter. The it() function parameter may contain variables and one or more calls to the expect() method. Used in conjunction with a Matcher function, these carry out the task of comparing the actual and expected values. Here's a simple example to demonstrate:

describe  ("the todo page : page contents", function() {
     
   	it  ("should include a page title of 'Todo List'", 		function()  {
     		expect($('title').text()).toEqual('Todo  List');
   	});


   	it  ("should include a page heading of 'Todo List'",  	function() {
     		expect($('h1').text()).toEqual('Todo  List');
   	});
});


  Put  above code in  /test/jasmine/client/integration/todos/page-contents-spec.js,  Jasmine  supports folder structures.   


Pre-defined Matchers

In the above example, the toBeGreaterThan() method is a matcher. It represents a comparison such as ">" using plain English. There are many other matchers available, including:

  • toBe: represents the exact equality (===) operator.

  • toEqual: represents the regular equality (==) operator.

  • toMatch: calls the RegExp match() method behind the scenes to compare string data.

  • toBeDefined: opposite of the JS "undefined" constant.

  • toBeUndefined: tests the actual against "undefined".

  • toBeNull: tests the actual against a null value - useful for certain functions that may return null, like those of regular expressions (same as toBe(null))

  • toBeTruthy: simulates JavaScript boolean casting.

  • toBeFalsy: like toBeTruthy, but tests against anything that evaluates to false, such as empty strings, zero, undefined, etc…

  • toContain: performs a search on an array for the actual value.

  • toBeLessThan/toBeGreaterThan: for numerical comparisons.

  • toBeCloseTo: for floating point comparisons.

  • toThrow: for catching expected exceptions.

Example

Put follwing code in demoapplication.css

<head>
    <title>jasminetest</title>
</head>
<body>
<h1>Welcome  to Meteor!</h1>
	{{>  hello}}
</body>
<template  name="hello">
    <button  id="clickButton">Click Me</button>
    <p  id="buttonText">You've pressed the button  {{counter}} 		times.</p>
</template>

Put follwing code in demoapplication.js

if  (Meteor.isClient) {
    //  counter starts at 0
    Session.setDefault('counter',  0);
    Template.hello.helpers({
        counter:  function () {
            return  Session.get('counter');
        }
    });
    Template.hello.events({
        'click  button': function () {
            //  increment the counter when button is clicked
            Session.set('counter',  Session.get('counter') + 			1);
        }
    });
}


Write following tets to check counter display proper or not


inside tests/jasmine/cleint/integration/sample/buttonSpec.js


describe('clicking  the button', function () {
    //  reset the counter before each test
    beforeEach(function()  {
        Session.set('counter',  0);
    });
    it('should  show how many times the button was pressed', 	function () {
        //  Get the text we are testing
        var  text = $('p#buttonText').text();
         
       //  assert that we see 'You've pressed the button 			times.'
        expect(text).toEqual("You've  pressed the button 0 			times.");
    });
});


Output:



Friday, 22 May 2015

Link List formation

Algorithm


node *n;
n=(node*)malloc(sizeof(node));
n->data=x,y,z;
n->next=21,22,Null;
C program of link list

#include<stdio.h>
#include<conio.h>
#include<alloc.h>
struct newnode
{
int number;
struct newnode *nextnode;
};
struct newnode *firstnode;
void linklist()
{
char ch='a';
struct newnode *ptr,*n;
while(ch!='n')
{
printf("\nEnter elements");
n=(struct newnode*)malloc(sizeof(struct newnode));
scanf("%d",&n->nnumber);
n->nextnode=0;
if(firstnode==0)
{
firstnode=n;
}
else
{
for(ptr=firstnode ;ptr->nextnode!=0;ptr=ptr->nextnode);
{
ptr->nextnode=n;
}
}
printf("\npress y for continue and n for no");
ch=getch();
}
}
void display()
{
struct newnode *ptr;
printf("Elements are");
for(ptr=firstnode;ptr!=0;ptr=ptr->nextnode)
{
printf("\n%d",ptr->nnumber);
}
}
void main()
{
clrscr();
firstnode=0;
linklist();
display();
getch();
}

Wednesday, 20 May 2015

Android splash screen tutorial

It is best way to represent your logo or show start up image until all data are not loaded to the application or first page.
To understand the splash screen you must have a knowledge of Thread in java, because splash scree is appear for only some milliseconds (3000 i.e 3 secs) which means running thread for some time and after that we have to terminate it.

Now lets start the implementation of splash screen.

create new layout file and copy following code inside it.

activity_splash_screen.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/appsplash"
    android:orientation="vertical" >
</LinearLayout>

in above i have add image in background of LinearLayout. So replace it with your image.

Add new class file for splash sceeen.

SplashScreen.java

package com.ilearn.xtreme;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;

public class SplashScreen extends Activity {

    // Splash screen timer in milliseconds
    private static int SPLASH_TIME_OUT = 3000;
    

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash_scren);
       
        
        new Handler().postDelayed(new Runnable() {


            @Override
            public void run() {
                // This method will be executed once the timer is over and name of target activity
              
                Intent i = new Intent(SplashScreen.this, MainActivity.class);
                startActivity(i);

                // close this activity
                finish();
            }
        }, SPLASH_TIME_OUT);
    }

}


Dont forget to make this activity as launcher activity in manifest file by adding following code.

<activity
.........some code
<intent-filter>
 <action android:name="android.intent.action.MAIN" />
 <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
.........some code
</activity>


screenshot of output is as follows





share it and enjoy.
comment wherever you stuck thank you :)