Monday, 30 May 2016

Getting started with IONIC framework

Open command prompt
onic framework have some advantages over Cordova as it uses additional plugins like angularJs , ionic.css and provides more community support.

Steps to create sample app.


  • Install IONIC
    npm install -g cordova ionic
  • Create a sidemenu App
    ionic start myApp sidemenu
  • navigate to myApp
    cd myApp
  • Add an Android platform
    ionic platform add android
  • build apk
    ionic build android


Customising is similar to the steps in cordova which i have told here



Sunday, 22 May 2016

Google i/o 2016


Here is Google i/o Key Note. All the products that are going to be released in 2016 are listed in this video

Alfresco—Accessing repository using Restful API using PHP

Steps:

•Get a ticket using Alfresco login webscript (Restful API)
•Remove the xml tags present in the ticket
•Append the ticket to the url of required repository
•Append the server and port to the href array returned inorder to access the folders inside the repository


Code:

<!DOCTYPE html>
<html>

<body>

<h1>Company</h1>
<h1>Alfresco Repository</h1>

<?php
//get a ticket
$content=file_get_contents('http://<your server>:<your port>/alfresco/service/api/login?u=admin&pw=admin');
//echo $content."<br>";
$url="http://<your server>:<your port>/alfresco/service/sample/folder/Company%20Home";
//echo "Hello World!<br>";
$a="?alf_ticket=";
//echo $a."<br>";
$b=$content;

//echo $b."<br>";
//remove the xml tags
$b= strip_tags($b);
//echo $b."<br>";
//echo $content."<br>";
//append the ticket to the url of required repository
$url1=$url.$a.$b;
//remove the spaces if present
$url1=(string)strip_tags($url1);
//echo $url1."<br>";

//$url2="http://<your server>:<your port>/alfresco/service/api/node/content/workspace/SpacesStore/0f4fe3cf-5eaa-4014-9357-b6f16a1b4b61/strt.png?alf_ticket=TICKET_2fa45f2c268d98a7b215fff83b96f2c9baf4fa88";
convert the url into a srting
$url1=(string)$url1;
//$url2=(string)$url2;
//echo var_dump($url1);
//echo var_dump($url2);
$aa="aa";
$bb="aa";
//remove all types of spaces in the url
$url1 = str_replace(' ', '', $url1);
$url1 = preg_replace('/\s+/', '', $url1);
//if($url1==$url2)
//echo "equal<br>";
//echo $url2."<br>";
//echo $url1."<br>";
//echo gettype($url1);

//get the contents of url
echo file_get_contents($url1);
//echo "<img src=".$url2.">";


/* $opts = array('http' =>
    array(
        'method'  => 'GET',
        //'user_agent '  => "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2) Gecko/20100301 Ubuntu/9.10 (karmic) Firefox/3.6",
        'header' => array(
            'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*\/*;q=0.8
'
        ),
    )
);
$context  = stream_context_create($opts);

$f = file_get_contents($url1, false, $context);
echo $f; */


?>
<script>


//the contents of the url have the href from the current repository. so we need to append the server and port to the href inorder to access the folders inside the repository
//get the size of the array of the elements having href
var a = document.getElementsByTagName("table")[0].getElementsByTagName("a")
 length = a.length;
// alert(a+length);


 for(var i=0; i< length; i++){
 var g=document.getElementsByTagName("table")[0].getElementsByTagName("a")[i].getAttribute("href");
//get all the href elements and append the server address
  document.getElementsByTagName("table")[0].getElementsByTagName("a")[i].setAttribute("href","http://<your server>:<your port>"+g);

}


document.getElementsByTagName("table")[0].getElementsByTagName("a")[0].setAttribute("href","http://<your server>:<your port>"+g);
//alert(document.getElementsByTagName("table")[0].getElementsByTagName("a")[0].getAttribute("href"));
</script>
</body>

Sunday, 15 May 2016

How to register your site on Google Search engines

Once you have your site complete and it is up and running.... you will want to promote your site.  A wide variety of ways to do this.
  • Also consider signing up for Google analytics (also free). https://analytics.google.com/analytics/  Analytics will help you "see" who is visiting your site and how they are finding it, via searches, direct keying in of the URL or via links, etc.  Also where they are from, how many per day, etc.  Lots of good information.

Monday, 2 May 2016

Useful UNIX /Linux commands.

ls -lart <files starting with>*
ex: ls -lart a*---lists all files with a

grep -i <words to search> *.js
ex: grep -i grarr *.js----lists all files with .jsextension having the words grarr along with the content where the line is present.

 netstat -an|grep <portnumber to check>
ex: netstat -an|grep 111111 ------if the port is not free it ll display the status of the port.If the port is free then it will not display any thing.

grep -il "*<string to search>*" *js
ex:grep -il "grl" *scr -----searches for the string "grl" all files with extension js


find . -name "*<part of file name>*"
ex:find . -name "*report*" ----finds all the subdirectories with the file name having the word "report"

kill -9 <pid name>
ex: kill -9 12344 ------kills the pid with 12344


find . -name "*<part of file name>*" |xargs grep -i "<string to search>*"
ex: find . -name "*report*" |xargs grep -i "grl*"  -----searches all files having the name report having the contents as "grl"


tail -f <file name>
ex: tail -f catalina.out  -----displays last 10 lines in the file. when the file is updated the 10 lines are also updated.



ex:  grep -r "*test*" /data/imp  --search all the the files recursively in all sub folders in "imp" folder for the string test

ex:
du -sh
size of the current directory