Monday 22 July 2013

How to remove strip_tags in Appcelerator ?

// Here sample code to remove strip_tags from strings.

 Helpful Link : http://phpjs.org/functions/strip_tags/

 Code :

 var input = "<div>Sani</div>" // Static string
       
      strip_tags(input); // function

      function strip_tags(input) {
         var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>/gi, commentsAndPhpTags = /<!--[\s\S]*?-->|<\?(?:php)?[\s\S]*?\?>/gi;
            return input.replace(commentsAndPhpTags, '').replace(tags, '');
        }


OutPut : Sani

Wednesday 10 July 2013

Appcelerator Titanium Business Application Development Cookbook Review .



Appcelerator Titanium Business Application Development Cookbook


What you will learn from this book :

I really thanks to  Benjamin Bahrenburg who is author of this book. This book helps me a lot and also very helpful to me. With the help of this book clear my douts and learn good things witch help me in code. 

With the help of this book i learn many thing like
 1) Location
 2) Passcode
 3) Notification
 4) LockScreen
 5) Analytics
 6) URL Schemes etc......

Approach :

Written in a cookbook style, this book offers solutions using a recipe-based approach. Each recipe contains step-by-step instructions followed by an analysis of what was done in each task and other useful information. The cookbook approach means you can dive into whatever recipes you want in no particular order.

Who this book is written for :

This book is for any developer who possesses some JavaScript or web development knowledge and wishes to take a leap into building native applications for both the iPhone and Android. No knowledge of Objective C and Java is required. Using this book he/she easily understand about Appcelerator and very helpful to create Application in Android, Tablet, iPhone, iPad, etc .

Book Is Available:

Appcelerator Titanium Business Application Development Cookbook 

Examples : 

With the help of this book you can easily develop some good example in appcelerator in both OS android as well as iOS. :)

1)   Use of Google Analytics in your application.
2)   Opening PDF documents in Android and iOS.
3)   AES encryption using JavaScript
4)   Using the LinkedIn Contacts API  
5)    Passcode

This all are the basic examples are available in this book. And its really helpful to me. 


I show you some snapshot of my application that i create with the help of this book.

First snap of PassCode. :)
And 
Second snap of PDF viewer. :)



 





Monday 8 July 2013

How to use iOS DocumentViewer .

// iOS DocumentViewer is very helpful to open .pdf file in appcelerator in iOS.

Prefer below link it gives whole description of iOS DocumentViewer.

// http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.iOS.DocumentViewer

For example, an email program might use this class to allow the user to preview attachments and open them in other apps. Use this class to present an appropriate user interface for previewing or printing a specified file. 

Sample Code  :)

app.js 

var win1 = Titanium.UI.createWindow({
    title : 'win 1',
    backgroundColor : '#fff'
});
var modalWin = Ti.UI.createWindow();

var navmodal = Ti.UI.iPhone.createNavigationGroup({
    window : modalWin
});
win1.add(navmodal);

var b2t = Titanium.UI.createButton({
    title : 'Open PDF'
});
modalWin.RightNavButton = b2t;

var b1t = Titanium.UI.createButton({
    title : 'Share PDF',
    height : 40,
    width : 200,
    top : 270
});
win1.add(b1t);

z = Ti.UI.iOS.createDocumentViewer({
    url : 'GettingStarted.pdf' // Name of PDF file and path is simply in iphone folder
});

b1t.addEventListener('click', function() {
    z.show({
        animated : false,
        view : b2t
    });
});

b2t.addEventListener('click', function() {
    z.show();
});
win1.open();

Snap :)







Wednesday 3 July 2013

Titanium Mobile Create a Sliding Menu for iOS

// Titanium Mobile Create a Sliding Menu for iOS

In  this link tutorial is available for Sliding Menu, that code is simple code not in Alloy.

http://mobile.tutsplus.com/tutorials/appcelerator/titanium-mobile-create-a-sliding-menu-for-ios/


// I just use same code that give in this tutorial but only difference is my code is in Alloy.

// If any one need that code in alloy that person take code from GIT. :)

// That Alloy Code is available on Git.

Here the Link. :)

https://github.com/dharmik/Sliding-Menu-for-iOS-in-Alloy 

Helpful Link :)

http://mobile.tutsplus.com/ 




(Alloy) Slider Like Facebook working in both android and iOS

// Slider like facebook working in both Android and iOS .

// Code is in alloy .

// Code is working fine in both os.

// Slider is smoothly working.

// Code is available on GIT :)

https://github.com/dharmik/Slider-Like-Facebook-working-in-both-android-and-iOS

Here snap of iPhone simulator. and this slider working fine in android device.

Snap :)




Monday 1 July 2013

Use Emoji In Appcelerator

// How to use Emoji in appcelerator ?

//It is very easy to create Emoji in appcelerator.

//What is Emoji ?

// ANS : Emoji started in Japan so many of the icons are closely tied to the Japanese culture. Some of them are quite foreign.

//Prefer below link it very helpful to you to understand what is Emoji and how to use it.


http://hasseg.org/blog/post/546/use-unicode-emoji-as-image-free-icons-in-ios-web-apps/ 

http://hasseg.org/blog/post/692/use-unicode-emoji-as-icons-in-native-ios-apps/

Sample code is available on Git.

Here git Link :)

https://github.com/dharmik/Use-Emoji

Snap :)