Before discussing classes, this lesson will be an introduction to data structures similar to classes. Structures are a way of storing many different values in variables of potentially different types under the same name. This makes it a more modular program, which is easier to modify because its design makes things more compact. Structs are …
You have a sales table listing product, salesperson and amount:
DROP TABLE IF EXISTS sales;
CREATE TABLE sales (
id int(11) default NULL,
product char(5) default NULL,
salesperson char(5) default NULL,
amount decimal(10,2) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO sales VALUES
SELECT * FROM sales;
| id | product | salesperson | amount |
| 1 | radio | bob | 100.00 |
| 2 …
If you’re a Linux user then you’ve probably used cURL. It’s a powerful tool used from posting mails to downloading the latest My Little Pony subtitles. In this article I’ll explain how to use the cURL extension in PHP. The extension offers us the functionality as the console utility in the comfortable world of PHP. …
How many times have you developed a web application that had some functionality which would benefit from running an external program or even forking a separate process? This is not something you generally like to do from your web app because you want to make it run as fast and efficient as possible, while keeping …
Design Pattern History
The term “design pattern” was originally coined in the field of architecture. Christopher Alexander, in his 1977 work, “A Pattern Language: Towns/Building/Construction,” describes common issues of architectural design and explains how new, effective designs can be created through the aggregation of existing, well-known patterns. Alexander’s concepts translate well into software development, where it’s …
LAMP stack is a group of open source software used to get web servers up and running. The acronym stands for Linux, Apache, MySQL, and PHP. Since the server is already running CentOS, the linux part is taken care of. Here is how to install the rest.
The steps in this tutorial require the user …
How to install MySQL
yum install mysql-server mysql php-mysql
How to configure MySQL
Set the MySQL service to start on boot
chkconfig --levels 235 mysqld on
Start the MySQL service
service mysqld start
Setting up the REMOTE DEBUG C/C++ with Netbeans :
1. Create new C/C++
2. Setting-up the C/C++ Hosts from Services Tab
3. Create the C/C++ source code and create Select Build Host
4. Clean and Build the Project
5. Select from the Project -> Proprieties -> Run -> Console Type : Standard OUTPUT
6. Debug the builded Project after …
A debugging tool to debug errors in C and C++ programs. A debugger is the best friend of a software programmer.This tutorial assumes you already know how to program in C and C++ and you can compile and execute programs.
GNU Debugger which is called gdb is the most popular debugger for UNIX systems to debug …
How do I install all developer tools such as GNU GCC C/C++ compilers, make and others, after installing CentOS or RHEL or Fedora Linux from a shell prompt?
You need to install 'Development Tools' group. These tools include core development tools such as automake, gcc, perl, python, and debuggers which is required to compile software and …
Have you ever designed an ER Diagram in MySQL Workbench and wondered, just what is the difference between “Identifying” and “Non-Identifying” relationships? Non-Identifying Relationships have dotted lines, whereas Identifying Relationships have solid lines in MySQL Workbench. The difference is subtle but worth knowing.
When you create an identifying relationship, the primary key of the child table …
A permutation, also called an “arrangement number” or “order,” is a rearrangement of the elements of an ordered list S into a one-to-one correspondence with S itself. A string of length n has n! permutation.
Below are the permutations of string ABC.
ABC, ACB, BAC, BCA, CAB, CBA
Here is a solution using backtracking.
These permute2 values themselves …
Someone posed an interesting probelm over at sitepoint the other day.
Given an array of words how can you work out each possible combination?
There are a few methods but here's the PHP code for the cleanest:
$words = array('red', 'blue', 'green');
$num = count($words);
//The total number of possible combinations
$total = pow(2, $num);
//Loop through …
Recursive functions can be very useful when developing in PHP.
A recursive function is simply a function that calls itself, but why would you want your function to be able to call itself?
They are best used when a problem needs to be solved by breaking it up into a smaller instance of itself. Examples of this …
When drawing a path on a map (for instance, the directions from point A to point B) it is important to consider the limitations of the device you're drawing the path on.
In this article, I will show you how to reduce the number of points in a path so the path can be displayed with …
Elliptic integrals of the first and second type is given in code, with some example of their implementation. I had recently a need for these types of integrals, both complete and incomplete, and such implementations was not easy to find (I couldn't find anything in C# or VB, as usual, and the C++ versions I …
References in PHP are a means to access the same variable content by different names.They are not like C pointers; for instance, you cannot perform pointer arithmetic using them, they are not actual memory addresses, and so on. Instead, they are symbol table aliases. Note that in PHP, variable name and variable content
are different, so …
Self installing .NET service using the Win32 API
Download demo project - 30.4 Kb
The Windows service code that ships with the .NET framework and Visual Studio works just fine usually. However, sometimes it's just annoying to have to create an installer project just for a simple service you're writing. Furthermore, Microsoft tends to hide away the …
The Model-View-Control (MVC) pattern, originally formulated in the late 1970s, is a software architecture pattern built on the basis of keeping the presentation of data separate from the methods that interact with the data. In theory, a well-developed MVC system should allow a front-end developer and a back-end developer to work on the same system …
Sam handed Peter a computer printout and asked, “If the yields are so high, why is my efficiency so low?”
Peter studied the report for a moment and then nodded. “Let me show you what’s going on,” he said as he picked up a marker and drew a diagram (see Figure 1).
“This process has 10 separate …
I have to admit the first time I peeked at the academic definition of the Open/Closed Principle, its predicate was surprisingly clear to me. Leaving all of the technical jargon out of the picture, of course, its dictate was pretty much the mantra that we’ve heard so many times before: “Don’t hack the core”.
Well, admittedly …