KNN Classifier Algorithm

The KNN Classifier Algorithm (K-Nearest Neighbor) is straight forward and not difficult to understand. Assume you have a dataset and have already identified two categories of data from the set. For the sake of simplicity, let’s say the dataset is represented by two columns of data, X1 and X2. The question is, how do you determine which category a new data point would belong to? Does it best fit the first category, or the second?

knn classifier algorithm

This is where the K-Nearest Neighbor algorithm comes in. It will help us classify the new data point.

 

 

 

KNN Classifier Algorithm Steps

knn steps

Typically, the number of neighbors chosen is 5. And the euclidean distance formula is mostly used. Other numbers of neighbors can be used, and a different distance formula can be used. It’s up the person to decide on how they want the model built.

euclidean distance formula
The Euclidan distance formula is most commonly used in the KNN Classifier Algorithm

As you can see in our example; the new data point is closer with two points in the green category, and with three points in the red category. We have exhausted our number of neighbors of five that we set for the algorithm, so we classify the new data point in the red category.

KNN Model
In this example, the K-Nearest Neighbor process dictates the new data point to belong in the red category

While the K-Nearest Neighbor Algorithm is based on a simple concept, it can can model some surprising accurate predictions.

PHP Developer Job Description from a PHP Web Developer

A PHP developer job description will vary depending on who you ask. This is what I believe after working for one year as a PHP developer. Part of being any kind of developer is to fit nicely into the job you are being hired for. In my case, I was hired as a developer to work on web applications for a factoring company. I knew from the start that the programming team was small. I would be given projects from the IT system engineer, and would be required to participate in conference calls with company executives on a weekly basis. There was another programmer who would be available to help me with some of my projects as needed. This was my first job contract as a web developer. This article should provide you with things that I do almost daily as my PHP developer job description.

The first thing I probably do for every session is update my repository. My company uses Tortoise SVN for its version control. I can have multiple sessions in one day, thus repository updates can happen multiple times as well. I quickly learned this would be an important habit to start.

You Should Also Know SQL

I’ve only been on this job year. My first projects were limited to web applications that provide financial reports for the management. The system engineer felt this was the best way to get me familiar with the database. It made sense, because I would be using the database, but only reading from it. In other words, I could do much wrong by not doing any inserts, updates, or deletes on the database. And this brings me to a very important point. Much of a PHP developer job description includes other programming skills besides PHP. I would also be using SQL, and on a Postgres database. SQL was familiar to me, but not to the extent that I needed it to be. I started using stack overflow early in my job as a valuable resource for getting answers to programming questions.

Be Ready to Learn New Stuff

PHP developers should know other programming skills like HTML, CSS, and JavaScript. I also use the Bootstrap framework because it allows me to develop faster, and it makes the web pages look modern. I had not used much JavaScript before this job, and  did not think I would need it much. This was a big mistake. And this brings me to my next important point. If you don’t know something that you need, then start learning it immediately.

Companies do not only hire programmers because of what they know, but also because of their ability to solve problems and learn quickly. In my case, I signed up for some JavaScript courses on Udemy. I also took a course on how to use AJAX calls in web applications, and this really paid off. The users  loved how the pages would load because of the AJAX. And I learned Google Charts to represent data visually.

As for coding, I work on PHP scripts virtually every day. Another skill I’ve picked up is writing code that can be reused in scripts. I breakdown every project into small parts, and this allows me to write code in small parts. Good naming conventions for variables, files, and folders helps produce code that is easy to copy and paste into new scripts. It becomes a huge time saver. Last but not least, commenting is huge! If nothing else, write good comments for your own benefit. Assume that next time you look at your code, you will have forgotten everything. You will appreciate being able to read what your code does in layman’s terms.

PHP Developer Job Description Summary

  • Use Great Communication Skills: Understand the difference between talking to people inside and outside of IT at your company. Learn to take feedback and input from people outside of IT. These are the users of the web applications you build.
  • Keep Your Repository Updated: Version control can intimidate people new to programming. But understanding how it works, and using it are vital to practically all developer jobs.
  • Know SQL: PHP is a server-side scripting language. It goes together with SQL like peas and carrots.
  • HTML, CSS, and JavaScript are Part of the Deal: If you think the company will appoint someone to write your JavaScript, then you may be dreaming – or unemployed.
  • Stay on Your Toes: More than being just a web developer, you are a problem solver! Web technology moves fast, so keep your thirst for knowledge. Learn new things that you can apply and incorporate into your work.
  • Reuse Code: Once you begin to reuse code, then you will write code with consideration for it being easy to reuse. Comment well. This will help you become a fast and efficient developer for your company.

 

ITIL V3 Foundation Study Material – Know 5 Phases

ITIL V3 Foundation Study MaterialA good resource for ITIL V3 Foundation study material is crucial for a successful result on the exam. ITIL was acquired by AXELOS in 2013. It is a widely adopted framework for any business that needs to align its IT service with its business service.

Individuals who wish to take the ITIL Foundation exam should now that AXELOS has delegated the study courses and exam voucher to numerous accredited organizations. This is why a search for ITIL V3 Foundations study material will yield results from multiple organizations. They are all vying for your business to take their course or to sell you the exam voucher.

It is also worth knowing that some organizations provide package deals where the course and exam voucher can be purchased together. In some instances, these packages may be about the same price as purchasing a single exam voucher. Shop wisely, and look for reviews on courses that interest you.

Once you find a resource for ITIL V3 Foundation study material, you should internalize the ITIL paradigm for the IT service life-cycle. Quickly internalizing the ITIL paradigm will best prepare you for the exam.

The ITIL Service Life-Cycle

You should know that ITIL breaks down the service life-cycle into five phases.

These phases are:

  1. Service Strategy
  2. Service Design
  3. Service Transition
  4. Service Operation
  5. Continual Service Improvement

Within each phase, there are a set of processes. It is a bit of memorization work, but it is worthwhile to know the phase which any give process falls under. For example, demand management and financial management are two processes that fall within the service strategy phase. Incident management, problem management, and event management are processes that fall within the service operation phase.

Intimately knowing the five phases, and the sets of processes within each phase, is probably the best tip for anyone who has to learn the ITIL V3 Foundation study material. Another tip would be to understand that ITIL has its roots going back to a 1980 project with the UK Government’s Central Computer and Telecommunications Agency. From there, it organically grew to a globally recognized, vendor neutral, framework. Having this frame of reference should validate the time and effort it takes for someone to learn the study material.

MVC PHP Framework Code Igniter

mvc php codeigniterCode Igniter is an MVC PHP Framework. MVC stands for model view controller. This design pattern is widely used in the software industry. It is a widely proven architecture for good development of software.

MVC architecture has two main advantages. First, it allows for easy reuse of code. Second, it separates the components of development.

Three MVC Components

The first component of development concerns where to store the information. This component is handled by the Model. The Model interacts with the database.

The second is UI or UX (User Interface or User Experience). UX is what the user sees. This is handled by the View.

Finally, there is the processing of information. This prepares the information to either be displayed to the user, or stored in the database. Processing of information is handled by the Controller.

In other words, Model is the memory of MVC, View is the face of MVC, and Controller is the heart of MVC.

Code Igniter for MVC PHP

Code Igniter implements this design pattern in an easy to understand manner. Code Igniter is lightweight and agile. It does not take up many resources on your computer. It has many built-in features that allow you to code PHP fast and easy. Some background on object-oriented programming is helpful to fully understand Code Igniter.

SEO Questions and Methods for Every Site Audit

A good list of SEO questions should be discussed with clients before the start of a site audit. Consider the following list as an example.

SEO Questions to Start a Site Audit

  1. SEO QuestionsHas there been in any previous SEO work, and do you have reports?
  2. What are your current SEO goals?
  3. What are the most important pages, products, and services you have?
  4. Where should we focus the effort?
  5. What’s the current marketing strategy?
  6. What other advertising is there?
  7. Are the statistics available for current traffic, popular pages, etc.?
  8. Is there anything I missed?

SEO Methods to Start a Site Audit

The website itself is a good place to start an SEO audit. The website should be setup to convert. Afterall, if you increase organic traffic to your website, it will not do any good if your site is not converting.

Make sure there is a call to action prominently displayed on the page. You want to direct users what to do. Don’t make the users guess what you want from them. Ask yourself how the call to action could be stronger.

Many businesses make the mistake of talking about themselves on the landing page. Rather, you want to talk about the customer, and what the business can do for them. Put the business information on an about page.

Look at the landing page and think about what it is saying. Think of how this could more directed to what the business can do for the customer.

Quick SEO Analyzer Tactics

  • Check the business on common social media pages, and make sure the profiles are complete and accurate.
  • Do a Google search on the business name to see what information pulls up on the business.
  • Google site:domaingoeshere.com and see what pages are indexed, and how high they come up. Pages that do not show may not be indexed.
  • Check on mobile devices for responsiveness. Test various features of the website on 2 or 3 mobile devices for functionality.
  • Check the Google Analytics account to get a quick snapshot of traffic the website is getting.

SOA Web Services Approach

SOA web services means an approach to develop a web application that makes use of services. These services are often RESTful web APIs that return data back to the client. The service could also validate the client, or provide some type of analysis. SOA stands for service-oriented architecture.

A site that can book an airline ticket may also be able to book a hotel room. However, the credit card information is not being shared among different companies. Rather, the site is assembled with different meta-applications that provide various services.

These meta-applications act as services for the large application. The SOA web services approach is when you write an application that makes use of these services.

SOA Web Services
You must know the Application Program Interface (API) to use a web service.

An API exposes functionality to the outside world through a set of industry accepted standards and protocols.

multiple systems

 

JavaScript Combines Structure and Content

This post will focus on how JavaScript combines structure and content.

JavaScript integrates content and structure for web pages to create a dynamic user experience. You use arrays to store content, and you use templates to define structure. JavaScript combines the two.

If you have an image gallery, and you click on one of the photo albums, you need write code that remembers what the currently selected album is. This is important because if the user clicks on slide show, you want to show a slide show of the currently selected album.

Wk4SwitchDisplay1

In this case, you can create a gallery.js file. This will contain all the code that maps content data to the templates. This code needs to know what to display, and when to display it.

Wk4SwitchDisplay2

Look at the above picture. The first thing you see are a bunch of variables. These variables represent the templates. Here, you compile them at the beginning, so they can be used later. You also see variables for the current album and current photo.

The function show template is going to take a template, apply data to it, and display it to the HTML. This process is encapsulated into a single function so it can be easily reused.

A very important rule for large, dynamic sites, is you want all the page to load before you run any JavaScript. This is the purpose of the function $(document).ready, which calls an anonymous function. The anonymous function contains everything you need to make your website work.

You start by loading and compiling all your templates. You have your templates saved as variables, so you can easily call them later.

Next you will have click functions for your albums, photos, and slide show tabs. These are the three main tabs on your web page. Clicking each of those tabs will cause a distinct template to be loaded.

Wk4SwitchDisplay3

Later down in the code you want to grab all the elements with the class “album-thumbnail”, and give them a click function. You grab the data id and use that to select the correct album out of the array, and then show that album by the photos template. You also save it in the variable current_album. Again, it is important for your code to know what the current album is. The last thing is some code showing what to display when you click on a photo thumbnail.

Wk4SwitchDisplay4

Complex Webpages use JavaScript and jQuery

This post will explain exactly how to use JavaScript and jQuery to put content from objects into the structure of a template.

JavaScript objects and HTML templates allow you to separate content from structure. This technique will allow you to make powerful and complex webpages. You put these two things together using JavaScript and jQuery.

The first step is to use jQuery to get the text of the template out of the DOM.

var source = $(“#image-template”).html();

 

Next, you have to compile the template. You call the Handlebars.compile function and pass in the source text you got from the template, and the result is a variable called template. The variable template is a JavaScript function that turns objects into HTML.

var template = Handlebars.compile(source);

 

Now you will want to call the template function, pass in your data, and assign that to some HTML.

var html = template(data);

 

Finally, the last step is to use jQuery to copy the HTML back into your DOM element.

$(‘#Content’).html(html);

 

This above sequence of steps is what you need to do to turn your template text and content object into HTML code.

Take a look at a more complete example of how this works. First, look at all the and stylesheets you will need to bring in.

Importing Stylesheets

Inside the <body> tags you will see an empty <div>. You will soon push content inside this empty <div>. Below that is the actual template.

The HTML Template

Then at the end you will see the JavaScript. This goes through the sequence of steps that was shown at the beginning of this post.

Sequence of Steps

The last thing not pictured is the closing </script> tag. Do not forget that.

Pictured below is what the HTML page should look like. It is very simple, but the process learned in this post will allow you to make more complex webpages.

Rendered HTML

 

Separate Structure from Content

To be an efficient web developer, you need to know how to separate structure from content.

Take a look at the picture below that highlights the structure components of a webpage.

HTML Structure
The structure of the HTML is highlighted.

The next picture highlights the content.

HTML Content
The content of the HTML is highlighted.

These are the two things you should learn to separate. Knowing how to separate structure from content will create a more powerful web experience.

Why is it more powerful? Suppose you have a thousand webpages like the one pictured above. All the structure is the same, but your content is different for each page. Now, suppose you decide the <h2> is too big, and you want to change it to an <h3> tag. Well, you just created lots of work for yourself. You have lots of repetitive editing to do. However, if you separate structure from content, you will avoid this problem.

The idea is to create a template for the separate structure. This template can then be used to display as much content as you want. Therefore, if you need to change the structure, you only have to edit it once.

Bootstrap Themes – Free Download

The bootstrap grid system is so popular that people have created free bootstrap themes that you can use for your site. Notwithstanding, you should always check the license of your theme before you use it.

One bootstrap themes resource to start with is free bootstrap themes.

For this resource above, you can first preview the theme. If you like it, then click the download button for a link to a minified version of the code. Simply copy the code and paste it into a new bootstrap.css file, if you wish to use it on your site.

Another one you might consider is commercial bootstrap themes.