What is MVC Architecture? Why Use it?

So you have been coding applications for a while and now you are facing an issue with debugging…

You are taking too much time to develop and deploy your application to production server..

You are ready to take things to the next level, which means, you want to develop and deploy applications faster, debug the applications quicker and without tampering the UI of the application.

Yes, i know it. I feel your pain.

Back in the day in the college, i was asked to develop an attendance management system for my college.

It took my 6-8 months to develop it because i used to plain old sequential programming approach with functions scattered everywhere.

No matter how much I tried i wasnt able to organize things. Although everything worked fine.

This is where i looked at frameworks which enabled to do rapid application development, in short, RAD.

…and all frameworks had something in common…

It looked somehow organized and as i glanced through the documentation i came across the term, MVC.

So What is MVC?

As per the official definition, Model-view-controller (MVC) is a software architectural pattern for implementing user interfaces.

It divides a given software application into three interconnected parts, namely Model, View, Controller.

Each of these components are built to handle specific development aspects of an application.

MVC is one of the most frequently used industry-standard web development framework to create scalable and extensible projects.

It makes your development so much easier even if you have the most complex of COMPLEX of requirements you will be able to handle the the look and feel as well as the logic of the application easily and efficiently.

Yes, no more days where you will pull out your hair and think, “WTF, did i write?”.

I have had these moments when i was developing my final year engineering project, Deeptrawl, an intranet based search engine.

so lets go deeper…

Components of MVC

Model: The Model component represents all the data related logic that the user works with, like the data that is being transferred between the View and Controller components. Basically, all the database related queries comes here, so you are not messing those queries along with the design of the application like the way you may have used to do before.

View: The View component is used for all the User Interface of the application. I would say these as the templates for the application, which means the HTML/CSS/jQuery and all front-end engineering codes come here. So if there is a slight change in the design you dont have mess around with the logic of the data.

Controller: Controllers as the name sounds “controls” what model to use and what view to display to the user, it collects all the incoming data initially before communicating with the database, meaning, this where we do form validations, user login verification (after getting some info from the database, ofcourse).

To put things into perspective and perhaps more clear…

mvc

Depending on the platfor you choose to develop on, the MVC architecture could differ from each other, but it will always serve the same purpose as i have mentioned in this blog post.

In upcoming blog posts, i would discuss about each of these implementation for a few platforms i like to develop on, so stick around for more good stuff.

Thank you for stopping by and reading this article. Let me know your thoughts in the comments, below.

Later. Cheers.

 

How to Upload files Using CodeIgniter Framework

Uploading files is one the most common functionalities you will see in most web applications.

Manual configuration and initialization of a file upload is quite tedious but with a framework alot of work is reduced to help develop application real quick.

Codeigniter framework provides a descent and efficient way to do this

The file upload library included in CodeIgniter is very simple to implement and highly configurable.

In this blog post I’m going to show you a basic implementation of it specifically for beginners.

Upload files Using CodeIgniter Framework

Just like for any framework, CodeIgniter follows the MVC Architecture.

Model: Handles the Database Queries

View: Handles the User Interface for the User

Controller: Handles the information to be showed to the User.

Step 1: Setup the View

Firstly, to upload a file we need to prepare a simple form view with an input field to upload a file.

<form action="" method="POST" enctype="multipart/form-data" >
    Select File To Upload:<br />
    <input type="file" name="userfile"  />
    <br /><br />
    <input type="submit" name="submit" value="Upload" class="btn btn-success" />
</form>

Please Note:

  • We have used ‘enctype’ attribute (means ‘ENCode Type’) with a value of “multipart/form-data” in ‘form’ tag, which tells CodeIgniter that, this form will contain a file upload control.
  • A file browser control is added by specifying type=’file’. This is the main control where user will be able to select a file from his local computer. By default user will be able to select single file. But if you wish to facilitate multiple files on your web application, you can additionally use “multiple=’multiple’” attribute in this tag. This will do the trick well.
  • When uploading files using CodeIgniter the “name” attribute should always be userfile.

Step 2 : Define File Configuration.

Once a file is uploaded, we let out our server-side codes to kick in and configure the uploaded file.

First , we will need to make a configuration array.

This will include the basic settings for file upload like upload path, maximum size, allowed file types etc.

You will need to initialize different configuration arrays for different upload forms.

If the file upload of your application works different from each other, you are better off creating the configuration array in the respective controller.

In other case, where if the file upload of your application works exactly same for all file uploads, then you can specify the configuration in ‘application/config’ directory and load when needed.

$this->config =  array(
                  'upload_path'     => dirname($_SERVER["SCRIPT_FILENAME"])."/files/",
                  'upload_url'      => base_url()."files/",
                  'allowed_types'   => "gif|jpg|png|jpeg|pdf|doc|xml",
                  'overwrite'       => TRUE,
                  'max_size'        => "1000KB",
                  'max_height'      => "768",
                  'max_width'       => "1024"  
                );

Step 3: Loading CodeIgniter File Upload Library

CodeIgniter has a lot of helpful libraries that we can use for rapid application development.

Like said, file upload can be messy with Core PHP, depending on the complexity.

The CodeIgniter File Upload Library, makes this a lot easy and the configuration array you made above will be used as the settings for the library to function.

So we’ll load the library and use the do_upload() function to upload the file, using the settings specified in the configuration array.

$this->load->library('upload', $this->config);
if($this->upload->do_upload())
{
    echo "file upload success";
}
else
{
   echo "file upload failed";
}

If the code above returns any error, you can show the error messages using “display_errors()” function of the library.

After successful file upload, CodeIgniter returns an object that has all the properties of the uploaded file for further usage, for example, inserting a record in database, making a thumbnail etc.

The final result would look like below.

codeigniter-file-upload-tutorial

Thank you for reading till the end of this post. I hope i was able to help you out with uploading a file using CodeIgniter.

Let me know your comments, thought, opinions or any problems if you are facing with CodeIgniter File Upload. I’ld be happy to help you out.

Cheers.

 

 

 

 

 

 

 

sdfdddddddd

Inmotion OR Bluehost? Which One is The Best

One of the first things that comes to mind when thinking of choosing a hosting platform for your blog, is which one to go for?

Which hosting platform would be secure and reliable on the long run?

Since you are just starting out, you really don’t want to blow all your money on a hosting platform, right?

Well this blog post, is going to compare the two leading players in the shared hosting industry.

Inmotion OR Bluehost? Which One is The Best

When it come to choosing the right one among Inmotion Hosting & Bluehost, I would go ahead and say without a shadow of a doubt, that it is Inmotion.

But dont take my word for it, lets have a look at it.

A simple Google Search for Bluehost features will give you this link: https://www.bluehost.com/hosting-features

This URL has all features Bluehost talks about. Quite frankly, those features really don’t matter when you compare the hosting features and package available at Inmotion.

For Starters, Inmotion hosting uses SSD Storage for their hosting platform, that all by itself proves that they are faster than Bluehost which fails to mention anything about their Web Hosting Infrastructure.

I have worked with Bluehost & Inmotion for as long as a decade.

Ever since i started dabbling with websites and web development.

The company i used to work for had a reseller account from Bluehost.

Often times our customer’s website would go down without any prior notification from them.

The most common problem we faced with Bluehost is with emails.

Email hosting with Bluehost is a freaking nightmare.

This really did cause a problem to our brand image at the time.

Their support would take hours on top of hours to resolve any issue reported to them.

Now i really don’t to go on talking about a hosting service that made my life a living hell, so if you are interested I would like to redirect you to this Bluehost Review which breaks down in detail about their service.

Let me share with you a glimpse of the hell i was dealing with.

blue

I got 16 of these emails on a Friday, a weekend in Oman and then i get the below mail which made me go WTF.

blue1

Inmotion Hosting

When i launched this blog and couple other websites, i was skeptical about Inmotion because i have never seen their ads as much as i have seen Bluehost.

I have never heard of anyone promoting or suggesting it as a hosting service, on the flip side, many entrepreneurs like Pat Flynn at smartpassiveincome.com (Huge fan) were promoting Bluehost like its the best thing ever.

Inmotion does cost alot more than Bluehost which is why it is so much better and really alot less painful to deal with.

I was impressed with Inmotion hosting’s support that i decided to take my “hosting relationship” to the next level by being their reseller for offering their service to my web hosting clients.

I gotta say this and am not exaggerating, i have never lost a single a client and neither have i heard anyone facing any issue with their hosting or emails.

Inmotion Hosting turned out to be the best investment i had ever made.

Now let me give some facts about Inmotion based on my experience. I don’t want to copy paste their features list over here and makes this page long. Thats not how i roll here.

  • WordPress hosting with Inmotion gave me an additional layer of security in the login section without using any extra plugins. It provides a security feature to block the IP address temporarily for an hour, if the login failed more than 5 times.
  • SSD Storage, meaning faster data retrieval and faster page load time. Good for SEO.
  • Never faced any issue with emails, including my clients.
  • Never had a downtime, including my clients.
  • Prompt notification before a server upgrade or maintenance.

inmotion

My Verdict: Inmotion Hosting

Based on my experience with both the platforms, i definitely recommend Inmotion Hosting as your web hosting provider.

My experience with Bluehost was not good at all and there are many people who feel the same way as I do.

When it comes to Inmotion, the price is quite higher than Bluehost but they really do deliver for it and at the end of the day it worth it, on the long run.

I have been a customer and an affiliate with Inmotion Hosting since, 2011 and prior to that with Bluehost.

I have done my best to give you my opinion based on my experience with each of them.

Inmotion Vs Bluehost

This banner has my affiliate link in it, so if you were to make a purchase and get started with Inmotion, it would be a huge support for me. 🙂

Thank you for reading this blog post. Let me know your experience with your hosting provider in the comments below.

 

10 SEO Tactics to Embrace in 2015

SEO is one of the top most priority for most internet marketers, network marketers, small business owners etc for gaining a potential lead and customer on the internet.

Many people invest their hard earned $$ for pricey courses that “teach” them SEO but what they don’t understand is that the landscape of SEO is changing periodically.

By the time they finish learning the SEO course with black hat tactics, after hours and days of procrastination, a Google update comes along and they crawl back to square #1.

Google had come with many updates, the panda, the penguin and then the hummingbird.

Yes, the sound of a hummingbird still drums in our ears.

This update has crippled many black-hat SEO practices like search engine spamming with keyword stuffing and illegitimate back links etc.

Does it mean, it has made SEO a never ending headache for new marketers? HELL NO!!!

In this article, I will show you 10 SEO tactics you need to embrace going forward in 2015.

Continue reading 10 SEO Tactics to Embrace in 2015

How to capture leads and sales using Instagram

It has been increasingly clear that photos grab a customer’s attention instantly.

So it makes perfect sense to use a platform like Instagram for marketing your
products by crafting really attractive posts.

Posting on Instagram is not just about clicking a photo, slapping a fliter and hitting publish.

If you wanna really make an impact with your photos, you need craft it to your purpose and intent

Right now, I’ll show you can achieve just that. I’ll show you exactly how you can use Instagram to your advantage to increase leads and conversions

1. Create Images to Grab Attention

This is a no-brainer because as humans we are instantly attracted to things that are pleasing to the eye.

You see a lambo on the road, you would stare at it, won’t ya? well unless you are super-rich freak… (you’re minority…just kidding)

So if you’re posting a photo on Instagram, make sure that you take a photo at an angle that bests shows off that image. Think of it like your product is a model, that you want to take photos off for marketing your product line.

Find that interesting angle.

You could either choose to show the entire image or maybe just a portion of image or else, you accompany your major product with other products which could represented as an accessory to the product, like a Laptop, with a bag, mouse and headset.

That later approach appeals more to the user creating the illusion in the user’s mind that all of these are packaged as one, which sparks a conversation brewing via comments.

The approach you want to go forward with while marketing on Instagram is entirely your choice. I would suggest you to experiment with a few photos and with different styles and see which gets more traction and then stick with it.

Focus on Lighting

Proper lighting for your product is key for it to grab attention in a photo on Instagram. When it comes to marketing on Instagram you one shot to grab a user’s attention with photos. Proper lighting can accentuate the way a product is presented in the image and standout from all the clutter that runs through a user’s image feed.

There is nothing that can fix or tweak poor lighting other than photoshop. On Instagram there is only so much you can use with filters and image editing features but to seriously stay head and shoulders above the competition, proper lighting is key.

Make use of Instagram Filters

Instagram sets up the mood for the photos you snap and upload. The founders of Instagram found that they stood different compared to any other photo-sharing app out there when they launched. It makes perfect sense to use their Unique Selling Proposition to your advantage by using those filters and convey a different visual message to your audience.

2. Use Captions to Tell a Story

Captions are a great way to convey the story of a brand. People love to hear stories. When we were kids we like to hear stories from our parents and grand-parents. Not much has changed over the years when you grow up.

We love stand-up comedy and all what they do, is tell a story with humor element in it. Use Captions to tell a story that showcases your brand in a unique way.

3. Add Relevant Product Hashtags

Hashtags are something that made popular by Twitter and gained wide acceptance across various social media because of its ability to get an information outside of a specific social circle. Adding relevant hashtags to your Instagram posts can help you gain more traction to your photos. Use popular hashtags if they apply to your photo or your brand.

I have seen alot of people overkill their photo captions with hashtag after hashtags just exposes that you are so desperate for attention. The best process to follow for an Instagram post is to put three to five best relevant hashtags.

4. Tell People What You Want Them to Do (Call to Action)

Call to action is something that a marketers must use without having it specified for any kind of marketing anywhere. The reason you market is to get people to take a specific action. You don’t your audience to go, “Wow, that a really great offer. Now what do i do? Meh….I’ll just scroll down”.

Use CTAs folks. Tell them exactly what you want them to do and they’ll do if they find your product something that they can benefit from. Your CTA can be very concise and short like “Grab the offer” or “Download our app” or “Get Yours Today”, whatever is applicable to your Instagram Post.

Add CTAs in your caption and as well as on the post. Although, CTAs on posts gets more conversion.

5. Team Up With Influencers

Influencers are the ones who already have a loyal fan following and are trusted for their honest opinions about what products to purchase. Working with people who already have a large audience who they have a relationship with can instantly increase your reputation as the audience will trust the source of info and at the same time, it can increase your leads & conversions and your fan following on Instagram.

Some more Instagram marketing tips

Now that you have got the specifics on How to capture leads and sales using Instagram, here are some more instagram marketing tips you can use to really scale up your content creation efforts.

Creating impactful content is one thing, but really engaging with a user’s response works a long when it comes to building brand relationships with the audience. People love getting responses from a brand, it makes them feel important unconsciously. Generally it feels good.

Have a content strategy. Determine a routine for publishing your content. Find out what works for you. You want to publish content on instagram either daily, weekly or whatever works best for you. Have milestones setup in your marketing plan to reach X number of followers or to get X amount of likes and user engagement etc.

With all the traction you receive it makes perfect sense to determine which content gained more traction from the users. Which filter worked better for your brand etc. Those are some hints for your remove the guess work from your marketing and this keeps evolving as your grow your brand on Instagram.

Using these Instagram marketing tips, you can be sure to build your brand, generate leads and conversions and exponentially increase your brand reach and reputation. These are the simple tips that famous brands like Nike, Reebok, Adidas etc use to market their products on Instagram. They had been in this game for a longer time than you probably, but its never too late. There is always room for more.

Are you using Instagram for selling your products/services? Do you use any of these tactics with your account? Please share your thoughts about this post in the comments below.