Archive

Archive for April, 2009

PHP Link Directory (phpLD)

April 29th, 2009 admin No comments

Hey there guys. So my most recent project has been working with the PHP Link Directory, commonly known as phpLD. I’m working with versions v2.2.0 (free) and v3.3.0 (paid). I am creating various mods (unfortunately I cannot post them here, private project so the mods are to the buyer only) for the buyer and have looked through most of the script’s structure. So I’m giving a review.

It is natural for a programmer to look through source code of an open source program and decide for him or herself whether the program is efficient. For the most part, I must admit, phpLD is a great script. I will proceed by version in the next few paragraphs explaining the things I found.

In version v2.2.0 the script is very small. Simply the “barebone” basics of what you could call a program. Even though it gets the job done, there are very few modifications for this free version of phpLD and it makes it difficult to learn a lot about the version without looking through the source yourself. Now for people such as myself, we look through the source code anyway, but someone just taking a quick look to make a few changes, it could be quite difficult and cumbersome if they are unfamiliar with general programming. Normally this would not be the case because modding generally implies that you have a thorough understanding of how the code works in the first place, but sometimes I feel the file names could have been chosen better to describe their function—but then again, every developer has his or her preference. Other than that, there seem to be some minor security holes (haven’t spent too much time looking for large exploits as I’m just simply working on the mods) but this version is outdated, thus the reason it is free.

In version 3.4.0 I must say I’m highly impressed. At a glance, there are no apparent security holes or problems with this feature rich software. I think it actually makes shelling out the extra few bucks for this worth it. The already feature-rich link directory script also has many mods available for it. People who are “on the fence” so to speak about making their final purchase for this software, I recommend purchasing this version. If you’re looking to be a serious link directory and have the cash, this is the way to go. Now that is not to say you cannot have a successful link directory with v2.2.0, but this version is much easier to use and is much more admin friendly. It seems they crafted this version to be more geared toward the average use rather than the webmaster.

Some down falls in all of this is compatibility. I understand how versions work (x.x.x) major, minor, etc. on builds/releases, however, moving from v2.2.0 to v3.4.0 it looks like an entirely different program. Much of the source code from v2.2.0 has been completely outdated. If they are providing a free version, I personally think it should at least use a similar structure and not the primitive structure they use for it. Also, since the program is so widely used, it looks very generic if you do not theme it. Even then, with a custom theme the registration forms are identical on almost every site using it. So beware of losing a sense of “directory uniqueness” to this software.

So overall, the program, in either version, is a worthwhile program to at least take a look at. If you’re serious about creating a link directory and don’t want to, can’t, or don’t have time to create your own, phpLD is the way to go. Again, it may cause a problem that the directory script is so largely used that your site may lose any originality that it could have had otherwise. Also, the compatibility factor (if you start using the free v2.2.0) is horrendous. If you have a modded v2.2.0 and decide later you wish to upgrade to v3.4.0,  you may find great difficulty in transferring these mods over to the newer version. Other than those slumps, either version should suit most purposes well.

Regards,
Dennis M.

Categories: Software Reviews Tags: , , ,

SEO: The Importance of Unique Content

April 27th, 2009 admin 1 comment

Too many domains today are registered and then simply setup as parked pages, or even worse: duplicates of some other big site. This is an atrocious mess. It takes all originality out of the web itself! If one is simply going to reproduce content that another site already has, the reasons to go to multiple websites are lost.

Now, many of you may try to argue: “Your blog has content that can be found elsewhere,” or the great, “Your blog isn’t original either.” Well, the fact of the matter is it’s true; my blog is not original (there are many programming blogs out there), and yes the ideas of my posts can probably be found elsewhere. However, I write my blog to address your (user’s) questions directly focusing on specific questions you may have. Now there is no doubt some of my content is completely unique, but other things (such as my last post) have been posted over and over again. Now why would I do this? Simply to give another perspective, but I digress; duplicating content with hardly any change to it’s original format is what I am talking about and that’s not how this blog operates.

When I say unique content, I don’t mean you must only cover completely unique concepts. In fact, that is not what I am saying at all as you can see by the premisis of this blog. However, you do want to make sure you thoroughly understand your topic and can completely reproduce it yourself with little or no reference (Now be reasonable with yourself. You need to learn somehow anyway, so don’t shun outside sources!). If you can reproduce content all by yourself, it’s generally unique giving your perspective on your topic. As you very well know, people learn differently, so maybe your way of explaining the topic was better than the content giants of slashdot or a site similar in nature.

From an SEO standpoint, however, unique content is very important. It’s what gets your site noticed in the web. More unique content means (generally) more backlinks which lead to more traffic. To the average person, SEO means nothing coherently, but in terms of them ever finding out about your site it means almost everything. Good SEO means it’s easier for the average person to understand navigation of your website (e.g.: using static page links and deep links) and a higher popularity rating on (sometimes) search engines and other sites.

So as you can see, unique content plays a huge role in getting your site recognized. Without a userbase, a website ends up being wasted space on the web with stuff everyone already knows or doesn’t care about. So before you write that next article, make sure you’re not just copy and pasting (for reasons other than plagarism ;) ).

Regards,
Dennis M.

C++ Programming: Visual Windows

April 24th, 2009 admin No comments

I am primarily a programmer for *nix platforms and some cross compatibility for the DOS command prompt as many of you know. However, I also program Windows in the visual sense (how most end-users envision their product). So I’m going to write up a quick tutorial for you guys today!

I am compiling the example with Microsoft’s Visual C++. I am not normally an advocate for most things made by Microsoft, but in this case there is no doubt that this is the best compiler for compiling Windows programs. The best part about it is (unexpected, I know; it is Microsoft after all) that the compiler is FREE and comes with a very nice and clean GUI.

Now be mindful, the example has small functionality, but it is more or less the basis to ALL Windows programs! As we go through, we’ll explain the importance of each part. So let’s begin with the main file so you can see what’s going on.

main.cpp

/**
* Windows Programming Tutorial by Dennis M.
*
* main.cpp
*
*/

// Basic includes :D
#include <windows.h> // Win32 Lib
#include “menu.h” // Our menu – we’ll explain this later ;)
// more commonly named “resource.h,” but for
// explanation purposes this is easier :)

// Main WindowProcedure Definition
LRESULT CALLBACK WindowProcedure(HWND,UINT,WPARAM,LPARAM);
const char szClassName[] = “MicrosonicTestProgram”; // Our program’s name

int WINAPI
// Our main class to make the Window
WinMain(HINSTANCE hThisInstance,HINSTANCE hPrevInstance,LPSTR lpszArg,int WindowStyle)
{
// Pointer definitons
HWND hwnd;
MSG msgs;
WNDCLASSEX wcl;

// Standard window properties
wcl.hInstance = hThisInstance;
wcl.lpszClassName = szClassName;
wcl.lpfnWndProc = WindowProcedure;
wcl.style = CS_DBLCLKS;
wcl.cbSize = sizeof(WNDCLASSEX);
wcl.hIcon = LoadIcon(NULL,IDI_APPLICATION);
wcl.hIconSm = LoadIcon(NULL,IDI_APPLICATION);
wcl.hCursor = LoadCursor(NULL,IDC_ARROW);
wcl.lpszMenuName = “MAIN_MENU”;
wcl.cbClsExtra = 0;
wcl.cbWndExtra = 0;
wcl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;

if(!RegisterClassEx(&wcl)){
return 0;
}

hwnd = CreateWindowEx(
0,
szClassName,
“Microsonic.org Test Program”,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
640,
480,
HWND_DESKTOP,
LoadMenu(hThisInstance,”MAIN_MENU”),
hThisInstance,
NULL
);

// This is where we see the window.. ShowWindow()… duh!
ShowWindow(hwnd,WindowStyle);
while(GetMessage(&msgs,NULL,0,0)){
TranslateMessage(&msgs);
DispatchMessage(&msgs);
}
return msgs.wParam;
}

// Here we process all the commands etc.
LRESULT CALLBACK WindowProcedure(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam){
switch(msg){
// Process commands sent to the program
// In this case, from the menu items
case WM_COMMAND:
switch(wParam){
case MM_FILE_NEW:
MessageBox(hwnd,”MDI is more complex! Another tutorial soon perhaps on it! This is just the basics to Windows programming!\r\nSorry!”,
“Feature Not Available”,MB_OK);
return 0;
break;
case MM_FILE_EXIT:
PostQuitMessage(0);
return 0;
break;
case MM_HELP_ABOUT:
MessageBox(hwnd,”\tMicrosonic.org test program!\r\n\r\n\tFor more tutorials visit:\r\n\r\n\thttp://microsonic.org! \r\n”,
“Microsonic.org Test Program”,MB_OK);
return 0;
break;
case MM_HELP_VISIT:
ShellExecute(hwnd,”open”,”http://microsonic.org”,NULL,NULL,0);
return 0;
break;
}
break;
// If they hit the “X” button
case WM_DESTROY:
PostQuitMessage(0);
return 0;
break;
// Default loop
default:
return DefWindowProc(hwnd,msg,wParam,lParam);
break;
}
return 0;
}

Some basic points I’d like to touch upon. Since this is just the basics to the Window, I have not included MDI (allowing text, etc. through the new button) but, this is important for the generalization of the program. If you understand how this works, Windows programming becomes very similar to all other sorts of programming with the assistance of the MSDN Library. Now, realize that the structure file for the menu is never directly included into any C++ file, but rather automatically linked. Make sure you keep it this way and don’t make the mistake of including a .rc file. Also, as I peer through the code, it is important to realize that many of the function names are static. For the basics, all Windows programs should look as some sort of variation to this code simply by definition of a Windows program.

Now, let’s continue to see the header file. This purely holds definitions for the resource file holding the menu structure. If they are not defined, they will not work properly.

menu.h

/**
* Windows Programming Tutorial by Dennis M.
*
* menu.h
*
* Contains all our menu definitions
*
*/

// Give values to menu items
#define MM_FILE_NEW 2001
#define MM_FILE_EXIT 2002
#define MM_HELP_ABOUT 3001
#define MM_HELP_VISIT 3002

As you can see, each menu item is defined. These numbers are more or less arbitrary, you just want to make sure their definitions don’t conflict with each other or any other aspect of your program. I personally like to keep menu items grouped together, so I defined the “File” items in the 2000‘s and the “Help” items in the 3000‘s.

Finally, the structure of our menu. A resource file that is never really included.

menu.rc

/**
* Windows Programming Tutorial by Dennis M.
*
* menu.rc
*
* Resource file which contains the menu structure!
* To edit the file with Free Visual C++
* Right click and “View Code”
* Again, more commonly named “resource.rc”
*
*/
// Menu definitions
#include “menu.h”

// Should be able to get the hang of the menu ;)
MAIN_MENU MENU
BEGIN
POPUP “&File”,
BEGIN
// Format: MENUITEM “Title”, COMMAND_TO_SEND
MENUITEM “N&ew”, MM_FILE_NEW
MENUITEM SEPARATOR
MENUITEM “E&xit”, MM_FILE_EXIT
END
POPUP “&Help”
BEGIN
MENUITEM “A&bout”, MM_HELP_ABOUT
MENUITEM SEPARATOR
MENUITEM “G&oto Microsonic.org”, MM_HELP_VISIT
END
END

The structure is fairly straight forward, so I can probably leave it without much explanation. The only thing I would like to say is that you should realize how usable menu items are presented.
MENUITEM “Display Text”, DEFINED_FUNCTION.
The defined function is what is sent to the main loop of the program and is processed in the “switch.” Just remember this when you’re creating your programs!

As usual, I will provide complete source WITH the VC++9 Project file!

If you choose to make your own project, please make sure you go to the “General” tab and create an empty project. Compiler options in other Visual C++ presets do not work properly for many reasons. A major error one could run into (if using another setting) is compiling UNICODE which would break “const char szClassName[]” by definiton. You would then have to declare it as _T string.

Simple Win32 API Tutorial

Regards,
Dennis M.

Creating a Java Web Applet

April 20th, 2009 admin No comments

Today’s topic of discussion is Java. Ah yes, the programming language that sounds so familiar (and brings up feelings of dread) among high school programming students. There is no doubt that the language is very delicate, and in many ways very similar (yet different) than C++. But the steps to creating a program and the steps to creating a web are sometimes different.

Now, writing a Java applet is more or less the same as any other Java program; I will include examples later. But how should one go about packaging the applet? Packaging: the key word – no? In an applet, each class must be part of the package. We will go into depth on this later, but it’s important to keep in mind. Also, sometimes users just use the .class file, but this is not always the best for all programs. If you have many classes, you may wish to create a .jar archive which can load all of your files. So in this tutorial, we’ll explain all that as well as signing your jar file.

So let’s begin with a simple example. In fact, the most simple and infamous example known to man in all languages: the “Hello World.”

HelloWorld.java

/**
 * HelloWorld.java by Dennis M.
 *
 * Simple tutorial! :)
 *
 */

// Import all necessary files
import java.applet.*;
import java.awt.*;

// Start with our class
public class HelloWorld extends Applet {
  public void init(){
    // Just begins the program
  }
  public void stop(){
    // Stop the program when page is left or browser
    // closed
  }
  // Allowed to do this because of AWT library
  public void paint(Graphics g){
    g.drawString("Hello World!",20,20);
    g.drawString("Your name is: "+getParameter("YourName"),20,40);
  }
}

That code using this applet code:

<applet code="HelloWorld.class">
<param name="YourName" value="John Doe" />
You must have java enabled to see this text!
</applet>

Now notice, I’ve left the code in just “class” form. Since we only have one class file, there is no real reason to compile file into a jar. This next example will be slightly more complex. We will have a few class files so we’ll archive it and sign the jar. Although signing the jar may not be absolutely necessary in this case (because we’re not requesting access to the user’s computer), it may be a necessary skill you’ll need later on. For instance, I just finished a project working on a simple Java Uploader script; I needed to archive it and sign it. If it was not signed, it could not access the user’s files to upload!

test/testmain.java

/**
 * Simple Test Java Applet by Dennis M.
 *
 */
// Package should go according to structure!
package test;

// Imports
import java.applet.*;
import java.awt.*;
import test.dir1.test1; // We can import this because of "package"
			// and our structure!

public class testmain extends Applet{
  // Declare vars
  test1 test = new test1();

  // Start and stop functions.
  public void init(){
    System.out.println("init();");
  }
  public void stop(){
    System.out.println("stop();");
  }

  // Draw some text again
  public void paint(Graphics g){
    // This function included in dir1.test1
    if(test.randomTest() != 1){
      g.drawString("Did not load correctly!",20,20);
      System.out.println("Doh! bad load :( ");
    } else {
      // Let's continue to give the params and values! :)
      g.drawString("Name:  "+getParameter("name"),20,20);
      g.drawString("Email: "+getParameter("email"),20,40);
      g.drawString("Sex:   "+getParameter("sex"),20,60);
      System.out.println("Success! :D ");
    }
  }
}

test/dir1/test1.java

/**
 * Simple Java Applet by Dennis M.
 *
 */
// Remember.. STRUCTURE STRUCTURE STRUCTURE!
package test.dir1;

public class test1{
  public int randomTest(){
    System.out.println("Successfully called to external file!");
    return 1;
  }
}

ArchivedApp.html

<applet code="test.testmain" archive="bin/archivedapp.jar">
You must have a java-enabled browser to view this!
</applet>

Notice: In this particular applet, since we are loading from an archive, the code base is the name of the first file. The code should always go: package.Mainfile_name. Now if you’re main file happens to be like “package test1.test2,” then you simply adjust the code line to “test1.test2.Mainfile_name”

To compile the code use the following command (in the src/test directory)

javac testmain.java dir1/test1.java -d ../../bin

Now that we have it compiled, go to the “bin” directory. In here run the following command to generate a key:

keytool -genkey -keystore keystore -dname "CN=Default,OU=Default, O=Default, L=Default, ST=Illinois, C=US"

Use password: default

Now, to sign the jar file use this:

jarsigner -keystore keystore archivedapp.jar mykey

Enter the password you used earlier for the mykey certificate in the keystore. Your jar file has been successfully signed!

As usual, everything is in the archive below for you to download! All compiled classes/jars and sources are included. Enjoy!
Creating a Java Web Applet Tutorial Files

Regards,
Dennis M.

Categories: Java Tags: , , , , , ,

Importance of RSS Feed and What it Is

April 18th, 2009 admin No comments

Well, first thing’s first. Let’s explain what RSS Feed is. RSS stands for Rich Site Summary. It basically allows a user to keep updated on their favorite sites while not actually having to go to them unless they want to read the whole article or object.

Of course, RSS feed is not available for all sites, but why is the number of sites who are using the feed increasing so rapidly? Well, from an end-user’s point of view, RSS feed is a great tool to keep them (users) interested in a website. Without compromising security (like giving your e-mail out to a mailing list then being hit with spam) or any other true commitment, one can easily get the information they need from a site at the time it is available on the site (they know when this is by checking their feed).

Also, for users who subscribe to the RSS feed, it provides more “traffic security” for the website itself. From the owner’s point of view, it makes it more difficult for a user to simply “forget” your site and never return. When a user looks at their RSS feed and sees an interesting article, they will most likely click it and read the full article; thus returning traffic to your site.

Now that we understand the concept of RSS and its importance, if you enjoy the contents of this site, please subscribe to the Microsonic RSS Feed! :) It is the large orange RSS icon in the top right of the page. Or, if you’re using FireFox, click the RSS icon by the URL and hit “Subscribe to ‘RSS 2.0-all posts’”; your efforts are much appreciated!

This has been the last article in the series listed (oh maybe 5 posts ago?) so I’ll be starting on some new topics very soon! As usual, internet related and jam-packed full of useful information! Be sure to come back and check those out if you’re interested. Or better yet, subscribe to the feed here and just keep checking that and read the articles you find useful! ;)

Regards,
Dennis M.

Categories: Other Tags: , , , , ,