Monday, August 3, 2015

How to suggest communities that a user may want to follow - SQL

How to suggest communities that a user may want to follow in SQL

Hello everyone! This article is for those that have atleast the basics in SQL programming language. In this article of mine, I will first start by creating the database structure for our project, then will create a query to get the communities suggestions for Users. Note: It get the communities that the users are more involved. Like community A could have (pen, pencil) community B could have (pen, book), and community C could have (book, pencil). So You can see that, the system will propose you pen and pencil, since they are the most joined by the users.

Okay let's start!


Database Structure.


       CREATE TABLE users ( id INT, name VARCHAR(50) );
       CREATE TABLE users_communities ( user_id INT, community_id INT );
       CREATE TABLE communities (id INT, name VARCHAR(50) );
 
      INSERT INTO users VALUES
(1, 'User A'),
(2, 'User B'),
(3, 'User C'),
(4, 'User D');

INSERT INTO communities VALUES
(1, 'facebook'),
(2, 'google'),
(3, 'selfconsult'),
(4, 'twitter'),
(5, 'bootstrap'),
(6, 'blogger'),
(7, 'orange');

INSERT INTO users_communities VALUES
(1, 1), (1, 2), (1, 3),
(2, 1), (2, 4), (2, 5),
(3, 1), (3, 6), (3, 7),
(4, 1), (4, 6), (4, 4);

The Query.


         SELECT communities.*
    -- users who share at least one community
    FROM users
    JOIN users_communities ON (
        users_communities.user_id = users.id
        AND user_id <> 1
    )
    JOIN users_communities AS c_u_communities ON (
        c_u_communities.community_id = users_communities.community_id
        AND c_u_communities.user_id = 1
    )
    -- (end of) users who share at least one community
    -- these other users communities
    JOIN users_communities AS o_u_communities ON (
        o_u_communities.user_id = users.id
        AND o_u_communities.user_id <> 1
    )
    JOIN communities ON (
        communities.id = o_u_communities.community_id
    )
    LEFT JOIN users_communities AS c_u_not_communities ON (
        c_u_not_communities.community_id = o_u_communities.community_id
        AND c_u_not_communities.user_id = 1
    )
    WHERE c_u_not_communities.community_id IS NULL
    GROUP BY (communities.id)
    ORDER BY COUNT(communities.id) DESC
    LIMIT 2;

You could edit the "1" with the current user on the system. This tuto of mine is made in sql programming language but if you want assistance or help in that, you can contact me.
And for the PHP Prgramming language of this, you could comment if you need a tutorial on php part of that.
Hope you enjoyed. :)

Monday, March 30, 2015

Why YOU should write javascript or jquery codes?

Hello guys welcome to this new article on why you should write javascript or jquery codes.

To get started, I am going to give you guys a litle definition and or description of what javascript or jquery is, then I will give YOU some reasons why should write codes in javascript and jquery.

So javascript is the code that is actually run and executed on web pages in order to make your websites flexible and more reactive and responsive while jquery is a libary in javascript that actually does the same thing but with jquery, your codes are being reduced, made simplier and very responsive and smooth to load server scripting languages like PHP and ASP easily.

Now let give you some reasons why you should consider writing javascript and\or jquery codes as explain below:

The first reason is that, javascript programs the behavior of webpages. That is, javascript is responsible for web site interactivity and some dynamic loading and processes.

Javascript is that programming language that is use in validating web forms for insertion and output of data in the database.

Some times, you go on web sites and you see photos either animating, rotating or doing a slideshows. Well all that, is javascript that does it even though it could be done using html and css but javascript it is much less easier to implement.

Lastly, Javascript could also be use to ouptput notifications on your blog, website or network. For example, Like a new pop-up message just appear on the web site or in a fade in and out notification that may say something like "Welcome to this Site" or any!

Don't border if I didn't gave you some reasons on jquery. jQuery is simply that programming langauge that is oftenly written with less codes but that does more. It is a libary in javascript as explained above, that makes it easy to manipulate and change elements in a web site content.


Tchokote Herve is back-end web developer and desktop application programmer that spends his time programming for non-profit businesses( or projects) and who is passionate about computer programming and He can't stay a day without coding. Apart from that, He recently was involved in the conception and developement of SelfConsult, a health consultancy network that simplifies lives for doctors and patients to do their consultations. You could visit SelfConsult to know more and contact him.

Wednesday, March 18, 2015

Why YOU should write SQL Queries?

For today am going to give YOU guys some two or more reasons why you should write sql queries. But before that I am going to give you a brief definition of what sql query is and a short story about sql query.

SQL is a standard language for accessing databases.
SQL stands for Structured Query Language.
SQL lets you access and manipulate databases.

Now that you have a brief definition of what SQL query is, let me now tell you a short story about a friend of mine, a problem that he had concerning sql illiteracy.

Am not going to give you the name of my friend for the reason of privacy and security reasons too. so my friend was a guy that used to program websites but didn't actually know how to fetch dynamic data form a database. So one day, His boss or let me say his client came to him and wanted him to display data, those data were articles. His client wanted him to display his articles on the website and program his own like button and intergrae a facebook share button on it. In that way the client could see the number of people that liked and share his articles.

Now let me now proceed to give you those resons. These reasons are content reference from w3schools.com

SQL can execute queries against a database. SQL can retrieve data from a database. SQL can insert records in a database. SQL can update records in a database. SQL can delete records from a database. SQL can create new databases. SQL can create new tables in a database. SQL can create stored procedures in a database. SQL can create views in a database. SQL can set permissions on tables, procedures, and views.

Now that YOU have read through this article, I hope you are ready to write sql queries and YOU may even want to be involve more. You could still take the short story of my friend and implement that progrm that will help you increase your programming skills and work.

Thanks for your kind attention :)


Tchokote Herve is back-end web developer and desktop application programmer that spends his time programming for non-profit businesses( or projects) and who is passionate about computer programming and He can't stay a day without coding. Apart from that, He recently was involved in the conception and developement of SelfConsult, a health consultancy network that simplifies lives for doctors and patients to do their consultations. You could visit SelfConsult to know more and contact him.

Friday, March 13, 2015

Why YOU should program in PHP?

Guys today am going to give YOU as usual the 2 reasons why You should program in PHP. But before I start, Am going to tell you guys a story about PHP.

I had a friend that used to write html, javascript and css codes but wanted to know how actually can HE take the user inputs, can send and receive cookies and create, open, read, write, delete, and close files on the server and so on. But do you guys want to know what I told HIM?? I gave this reasons below which are still the same reasons why should write or program in PHP.

PHP stands for Hypertext Preprocessor and it is a scripting language executed on the server(web). Your PHP codes are been executed on the server, and the result is returned to the browser as plain HTML. So let me now give YOU those reasons;

Firstly, PHP can generate dynamic page content that is, create, open, read, write, delete, and close files on the server and can collect form data.

Lastly, PHP can send and receive cookies and can add, delete, modify data in your database. Also PHP can be used to control user-access and encrypt data.

If You are not still convinced, then comment and I shall respond to you.
Thank you guys! See us in my next tuts on why YOU should program in "...".


Tchokote Herve is back-end web developer and desktop application programmer that spends his time programming for non-profit businesses( or projects) and who is passionate about computer programming and He can't stay a day without coding. Apart from that, He recently was involved in the conception and developement of SelfConsult, a health consultancy network that simplifies lives for doctors and patients to do their consultations. You could visit SelfConsult to know more and contact him.

Thursday, March 12, 2015

Why you should program in CSS

A lot of people ask me why I am even learning CSS and how is it going to enhance my skills in web programming. Well studying CSS, is quite not hard but the experience you gain from it can make YOU go beyond your imaginations. Right now, Am going to give YOU some reasons as usual two reasons why YOU sh'ld program or write CSS codes.

CSS stands for Cascading Style Sheet, CSS defines how HTML elements are to be displayed with External Style Sheets stored in CSS files. The below gives YOU two reasons why You sh'ld write or get involve in CSS coding.

First, CSS has come to bridge a big gap that existed in the HTML document. Before, HTML documents discussed in my previous tuts, where intended to contain tags for formatting a document or html document. These tags where font tag, h1 tag and so on. As a result, to solve this problem, the World Wide Web Consortium (W3C) created CSS. Now YOU could write codes that decorates, changes, effects and make slideshows and give the beauty of your website or web page. You are still asking the second reason? Then look below!

Lastly, CSS Saves a Lot of Work. That is, CSS can be internal, external, as inline but with an external style sheet file ie, external, you can change the look of an entire Web site by changing just one file. The CSS file is saved with an extension of .css. That is, while you are creating the HTML, you can just style it in the .css file and you get the whole website change into your commands. Is that not awesome guys??

Are you now motivated to program or write codes in CSS? Am sure YES!
Thank you for your kind attention!


Tchokote Herve is back-end web developer and desktop application programmer that spends his time programming for non-profit businesses( or projects) and who is passionate about computer programming and He can't stay a day without coding. Apart from that, He recently was involved in the conception and developement of SelfConsult, a health consultancy network that simplifies lives for doctors and patients to do their consultations. You could visit SelfConsult to know more and contact him.

Tuesday, March 10, 2015

Why you should program in HTML

Today Am going to tell you why YOU should program in HTML. HTML is a that web programming language that you actually use to create webpages and or website. You cannot program a webpage or website without including this language let it be a complex or simple site, you need that. So am going to give you two reasons as usual why YOU should program in HTML and after that I am going to write you guys a basic snippet code on how to create a web page, for the tutorial on how to actually create simple and dynamic websites, it shall be discuss later in this blog but not now.

So YOU should program in HTML because this is the basic to start with web page designs. If you do not know html then it will be very difficult for you to actually write web page codes. This language is the basic and You need to learn it.

And lastly because this actually makes you to get the beauty of your web page making you a front-end designer. That is, in the HTML itself you can include external as internal styling that make you draw be able to program web pages.

Now Am going to drive you guys on how to be an html programmer that is, program in html. But before I let you there, We want to know what html is all about, right?

Okay lets get started! HTML stands for Hyper Text Markup Language

HTML is a markup language and what a markup language is, it is a set of markup tags that describe a document content and those documents contain HTML tags and plain text that are also called web pages.

HTML tags are keywords (tag names) surrounded by angle brackets like content


Tchokote Herve is back-end web developer and desktop application programmer that spends his time programming for non-profit businesses( or projects) and who is passionate about computer programming and He can't stay a day without coding. Apart from that, He recently was involved in the conception and developement of SelfConsult, a health consultancy network that simplifies lives for doctors and patients to do their consultations. You could visit SelfConsult to know more and contact him.

Monday, March 9, 2015

Why YOU should become a computer programmer

According to me, there are two reasons why YOU should become a computer programmer as discuss further.

Firstly, Taking a carrier as computer programmer is quite not difficult and not more into school kind of things, is just practice and logically knowing how to solve problems. These problems may be daily or arithmetic problems to solve.

Then Lastly, Because YOU want to be like any other rich entrepreneur or be like Steve Jobs(R.I.P), Bill Gates, Mark Zuckerberg etc. Is a joke! :) Here is again why. The most in demand position over the past 30 days is Computer Programmers. Employers and Recruiting Agencies have posted more than 220,000 new jobs for Computer Programmers, a 26% increase from the same time period in 2010. www.wantedanalytics.com

Today Am going to drive you to the basic steps in becoming a computer programmer.

So you want to become a computer programmer??? Then here's the right place. I will lead you from the basic, intermediate and advance way to acquire computer programming skills and knowledge.

But before I continue, Am first going to give you the definition and understanding of computer programming and the various programming languages involved in creating computer programs and or software.

Computer programming (often shortened to programming) is a process that leads from an original formulation of a computing problem to executable computer programs. Programming involves activities such as analysis, developing understanding, generating algorithms, verification of requirements of algorithms including their correctness and resources consumption, and implementation (commonly referred to as coding[1][2]) of algorithms in a target programming language. Source code is written in one or more programming languages (such as C, C++, C#, Objective-C, Java, Python, Ruby, Smalltalk, JavaScript, etc.). http://en.wikipedia.org/wiki/Computer_programming

Since you already know what computer programming mean, we will move on to our next step. Before being a computer programmer, YOU must first be familiar with computer programming languages, some which are: C, C++, JAVA, PYTHON, OBJECTIVE C, AJAX, ASP.NET & ASP, PHP, HTML, CSS, JAVASCRIPT, JQUERY and so on.

Thanks guys for your attention! I hope You are motivated now. Through out this articles of mine, I will be trying to give YOU all possible reasons why YOU should program and as such, make tutorials that makes you a good and competent programmer. All you need, is follow up my articles and or blog.


Tchokote Herve is back-end web developer and desktop application programmer that spends his time programming for non-profit businesses( or projects) and who is passionate about computer programming and He can't stay a day without coding. Apart from that, He recently was involved in the conception and developement of SelfConsult, a health consultancy network that simplifies lives for doctors and patients to do their consultations. You could visit SelfConsult to know more and contact him.