23 Ocak 2015 Cuma

How To Make a Splash Screen In Android Like Facebook or Twitter Or Linkedin .

In This post i will show you how to create a Splash Screen in Android .lets start;
  1. Create a FullScreen Activity in Your Development Environment (mine is Eclipse Luna EE) and Pick This Activity As Launcher Activity.
  2. Comment out everything except for the parts in onCreate block till setContentView method.
  3. In Layout Editor delete all form items , have it just like this one below: layout xml:
    
    
        
    
    
    
        
    
        android:background="@drawable/your_splash_image"
            android:fitsSystemWindows="true" >
    
            
            
        
    
    
    
    Now Your Splash Screen is Done :) you only have to make some time count.
  4. After your "setContentView(R.layout.activity_welcome)" method Create a Timer Object which is from Java.Util.Timer and implment the logic as follows.
    setContentView(R.layout.activity_welcome);
    
    		Timer timeToLaunch = new Timer();
    		timeToLaunch.schedule(new TimerTask() {
    
    			@Override
    			public void run() {
    				// TODO Auto-generated method stub
    				
    				boolean isUserLoggedIn= here is your business logic whether is user Logged in , or is connection ok , do some logic or nothing just route to your mainActivity Screen After some time (in miliseconds)
    
    
    				if (isUserLoggedIn) {
    					Intent intentToMainActivity = new Intent(
    							WelcomeActivity.this, UserMainActivity.class);
    					startActivity(intentToMainActivity);
    				}
    				else
    				{
    					Intent intentToMainActivity = new Intent(
    							WelcomeActivity.this, MainActivity.class);
    					startActivity(intentToMainActivity);
    					
    				}
    			}
    		}, 3000);
    

12 Ocak 2015 Pazartesi

Angular Js Custom Filters Example .

Hello My Friends , Filters Are really powerfull in in Angular Js , you can manipulate your date spans ,customize according to local date format , capitilize your strings , convert currencies , anything that you need is possible by Filters.As you can see Custom Filters are important , so lets take a closer look and define a default filter provided by angular then create our own custom filter that does a specific job.

Javascript Alert Function in Angular JS

Hello my friends in this post i will tell you very short knowledge which is so nice.In Angular Js in order to use alert function you must inject $window Service to your Controller. Lets see the example ;

Angular Js Tutorial Lecture #1 .Hello Angular JS . Introduction to Angular JS. Simple Module and Controller Implementation.



















First Message from The Page is ---------- {{FirstMessage}}

Welcome {{inputName}}

First Message from The Page is ---------- {{FirstMessage}}

Welcome {{inputName}}

11 Ocak 2015 Pazar

How To Use Fluent Nhibernate and Mysql and C# Together. Fluent Nhibernate Configuration in Visual Studio C# and Mysql Example.

Hello my friends , i will show you how to use Fluent Nhibernate with Mysql and C# together as an Orm Tool in that post.First Create your C# project and add 2 folders Map and Model Folders to your project.Then either Add Fluent Nhibernate binaries manually or just open Nuget Packet Manager Console and Run " Install-Package FluentNHibernate " command. Then Add Classes to Model Folder as your Models representing your Tables in your DB. Such As ; Say that you have User Table with Primary Key UserID and varchar UserName and varchar Password Fields. Only important Point is that you must use virtual keyword in your properties othervise you will have errors. lets see User Table 's Model Class;

 public class UserModel
    {

        public virtual int UserID { get; set; }

        public virtual string  UserName { get; set; }

        public virtual string Password { get; set; }
    }

then in your Map Folders Create a Class as UserMap. Here we have some points to be careful . First You Will Extend ClassMap and Make Your Mappings in Code Side at the Constructor.Just Like as Follows;

public class UserMap:ClassMap< UserModel >
    {
        
        public UserMap() 
        {
            Table("User");
            Id(x => x.UserID);
            Map(x => x.UserName, "UserName/*Real Db Column  Name*/");
            Map(x => x.Password, "Password/*Real Db Column  Name*/");
        }
    }

Then we completed all mapping and model works.Lets Create Configuration and Make Some Insert Update Operations and Create the DbHelper Class. Create DbHelper Class in your project.Like;

 public class DbHelper
    {
        private static ISessionFactory sessionFactory;
       

        public static ISessionFactory getSessionFactory()
        {
            if (sessionFactory == null)
            {

                sessionFactory = Fluently
                                .Configure()
                                .Database(
                                        MySQLConfiguration
                                        .Standard
                                        .ConnectionString(ConfigurationManager.ConnectionStrings["MyDbName"].ConnectionString
                                        )).Mappings(x => x.FluentMappings.AddFromAssemblyOf< UserModel >()).BuildSessionFactory();
            /* 
             Here in AddFromAssemblyOf() point , we just point the folder where our models exist , do not hesitate when choosing a model  , just pick a model it will identify the place only to collect models.I               
             mean you dont have to add all model names here only pickking one is enough.
            */

            }
            return sessionFactory;
        }


      public static bool CreateUser(UserModel newUser)
        {

            using (var session = getSessionFactory().OpenSession())
            {
                try
                {
                    session.Save(newUser);
                    session.Flush();
                    return true;
                }
                catch (Exception ex)
                {
                    return false;
                }
            }

        }

     public static bool UpdateUser(int userID,string newUserName)
        {

            using (var session = getSessionFactory().OpenSession())
            {
                try
                {
                    UserModel userToUpdate = (UserModel)session.Get("UserModel", userID);
                    userToUpdate.UserName=newUserName;
                    session.Update(userToUpdate);
                    session.Flush();
                    return true;
                }
                catch (Exception ex)
                {
                    return false;
                }
            }

        }


  }

Now It is Done Successfully , lets Create an instance of DbHelper and make an Insert Operation .