Tag: Programming

PHP Lessons Part 2: Operators

by
Guest-GS

Welcome to Part 2 of the PHP lessons.

In the previous lesson, we talked about how to get started with PHP, setting up a local environment to develop in PHP. We also talked about Variables and how they can be very useful when developing.

Just to refresh yourself up, the way we write a variable is like so:


$myVariable = "This is some fancy text";
echo $myVariable;
?>

Continue Reading »

PHP Lessons Part 1: Introduction to PHP and Variables

by
Guest-GS

What is php?

PHP is a powerful programming language for programmers to add interactivity to web pages, making them dynamic. What does “dynamic” mean? Simply “not static”! It may seem strange, but this is exactly what it is. Traditionally, web pages were “static”, coded in HTML. Nowadays, these pages are filled contents that change over time. Think about a blog. Aren’t new articles added from time to time? Well in the past, someone had to go edit a webpage, add code and add the article there manually. Nowadays, the article is pulled from a database, and dynamically added to a page as it is posted. That’s what PHP does: generating pages on the fly with content, with the help of HTML and other languages of course.

PHP is free (as in no cash needed, and open source – you can download and view the PHP source code) and is among the most popular programming languages used for Website Developement, to do processing.

What does PHP stands for?

PHP means: Hypertext Pre-Processor (HP, right? It’s a recursive acronym! It originally meant, Personal Home Page). It is a server side language and are executed on a server (Not on a local machine like Javascript, HTML and CSS). PHP can interact with Many databases out there such as MySql, Oracle, etc. To fully make use of PHP, a minimum knowledge of HTML is required, as well as some basic CSS if you wish to make things look nicer, but CSS is not directly required.

Continue Reading »

PHP – The Basics of the Language

by
Guru

Today I will be talking  a bit on PHP’s syntax and constructs. Previously I had given a small introduction on PHP. Now is the time to get your feet wet. Before going even further you should have PHP and MYSQL minimally running on your machine a.k.a localhost (You can go for an elaborate discussion on localhost at wikipedia or stick to my simple description. Refers to your own machine also addressed by 127.0.0.1).  I know you are a Geek, you may want to do your own setup but yet, I would recommend you to take a look at integrated packages such as:

  1. Xampp (my preference)
  2. Wamp
  3. EasyPHP

As far as I know personally I have heard of these three packages. There are more out there in the wild. Xampp would be enough for all your development tasks. Please bear in mind these packages are meant only for development purposes. They are not to be used on a live website.

Continuing where I left. Lets talk syntax. uhh, let me remind you coding scripting in PHP is very different from conventional programming. As I say often, PHP has a philosophy, a way of getting things done. 🙂 Don’t be afraid.

Continue Reading »

Installing GLUT on Dev C++

by
Inf

We are currently using the GLUT library at University in our Interface Design and Computer Graphics module. We were told to use Linux (Kubuntu) to write and compile our OpenGL/GLUT programs. But for ease of use, I wanted to install the GLUT library on Windows. I am a user of Dev C++ 4.9.9.2. I know it is no longer under active development, but it still remains my IDE of choice for C++ and C on Windows. And yes, I do know about Code::Blocks, so don’t flame me if I use Dev C++.

So here’s a guide if ever you want to install GLUT on Dev C++. Don’t worry, it’s easy.

Note, this guide is just about installing GLUT, not how to use it. I’ll probably have a small guide on that later on, but for now, this (and the Red Book) should get you started.

  • First, get Dev C++ if you don’t already have it. It’s available on bloodshed.net. Get version 4.9.9.2 (Beta).
  • Of course, install it. It’s pretty straightforward till now.
  • After installing it, go to Tools – Check for Updates/Packages.
  • In “Select Devpak server” dropdown menu, choose “devpaks.org Community Devpaks
  • Click on “Check for Updates“. Wait a bit while the list downloads.
  • In the list, find “glut“, or a compatible GLUT package like freeglut or OpenGLUT (if you know how to use these, else stick to “glut”).
    • You might want to filter the results using “OpenGL” from the “Groups” dropdown menu. Else, you might click on the “Update” title bar in the list to sort entries alphabetically.
  • Then, check the small box on the left of “glut” or other compatible glut libraries. Finalize by clicking the “Download Selected” button. Wait for the package to download and install.
  • You will be prompted for an installer window. Just read instructions and click Next a couple of times.
  • Now, check if glut was correctly installed by going to Tools – Package Manager. See if you can see “glut” or other compatible libraries (whatever you downloaded) there.

After you install glut, you can do “File – New Project – Multimedia tab” and see that glut has created templates for you. Quite complex things if you ask me. I tend to stay away from those if I can.

Now, before you use any library, you need to link it, else you will get loads of “Linker errors” and “Undefined reference” errors. Here’s how to link the libraries: (read the Dev C++ FAQ!)

9. How can i use the OpenGL library and others ?

All the libraries that comes with Mingw reside in the Lib directory. They are all named in the following way: lib*.a
To link a library with your project, just add in Project Options – Parameters tab – Linker box:
-lopengl32 (including the – symbol)
This is for including the libopengl32.a library. To add any other library, just follow the same syntax:
Type -l (L in lowercase) plus the base name of the library (filename without “lib” and the “.a” extension). Or you can use the “Add Library or Object” button in the parameters tab for simplicity.

I have these libraries linked: “-lglut32 -lglu32 -lopengl32 -lwinmm -lgdi32” and it works fine for me. You can try removing some of the parameters and see if it still works for you. NOTE: The order in which these parameters are supplied is actually important! If you are using a library, and having “undefined reference” errors, try shifting that library’s link parameter to the front of them all.

That’s if you want to use projects. If you are using plain source files, you can put those link parameters in Tools – Compiler Options. Then put them in the “Add these commands to the linker command line“. Make sure the box is checked too. I’d advise you to create a compiler profile just for OpenGL and glut with those parameters. Don’t mess with the “default compiler” profile. You can create one using the small green “+” button there.

There is usually linking information in the header files (.h files) or the Readme files of libraries you download on the Internet.

Basically, to install a library, you will have to copy some files (ending with .lib or .a) to the “lib” folder and some .h files to the “include” folder in Dev C++’s install folder.

Now, to actually use glut, you have to include the header file with:

#include <GL/glut.h>

To know the exact path where glut.h is found, look inside the “include” folder, again in Dev C++’s install folder.

That’s it. You should now be able to compile and run glut code on Windows using Dev C++. The guide should be clear enough. If there is demand for it, I’ll include pictures too, but I don’t think they are really needed.

By the way, I’m not a glut or OpenGL expert or anything. I’m just studying it, and thought I’d share how I managed to get glut running on Dev C++. I might not be able to answer all your questions, and for that, Google’s here!

Creating ADODB Connection in VB

by
Guru

Developing applications in Visual Basic (VB) is rather easy. But, thinking of connecting to a database using purely codes may look difficult. But it is not! After understanding the basics and coding a little, it becomes as easy as pie. First we need to get everything ready with the references, then understand what you will need to do (I leave this part to you. Google is here!) and finally creating the connection… Note that this article pertains to VB6, but might work for other flavors. Continue Reading »