The procedure entry point_except_handler4_common could not be located in the dynamic link library msvcrt.dll

The procedure entry point_except_handler4_common could not be located in the dynamic link library msvcrt.dll

This error is caused by a 3rd party utility or applcation overwriting your msvcrt.dll with a different version.

For example if a windows vista version of this DLL was copied on to a windows XP computer you would probably get this error.

A solution to this problem can be found in Microsofts KB
http://support.microsoft.com/kb/324762

Your daily WTF

I found this today while doing code review.

it was ment to be a sleep timer…
I just about shit a brick when I saw this.

for(int i=0; i<PAUSE_LENGTH; i++)
{
i++;
}

Insert new post in to wordpress from php

This code snippet should let you add a new post to your wordpress database 2.5.1

require_once('wp-config.php');

// create post object
class wm_mypost {
    var $post_title;
    var $post_content;
    var $post_status;    /* publish, private */
    var $post_author;    /* author user id (optional) */
    var $post_name;      /* slug (optional) */
    var $post_type;      /* 'page' or 'post' (optional, defaults to 'post') */
    var $comment_status; /* open or closed for commenting (optional) */
    var $post_category ; 
}

// initialize post object
$wm_mypost = new wm_mypost();
$wm_mypost->post_title    = "Title2 ". date( 'r' );
$wm_mypost->post_content  = "content3";
$wm_mypost->post_status   = 'publish'; 
$wm_mypost->post_author   = 1;

// Catagorys
$post_category = split("," , "one");
foreach($post_category as $key=>$val) {
    $post_category[$key] = get_cat_ID($val);
}
$wm_mypost->post_category =  $post_category ; 

// Optional; uncomment as needed
// $wm_mypost->post_type = 'page';
// $wm_mypost->comment_status = 'closed';

// feed object to wp_insert_post
$post_ID = wp_insert_post($wm_mypost);
echo date( 'r' ) . "\n";
echo "post_ID:". $post_ID . "\n"; 

How to make a CMinMaxAvg class

I got asked how to create a simple averaging class.
If you where feeling smart you could enhance this class in to a template class for a object that has the =,+,>,< operator. But I’m feeling lazy today.

class CMinMaxAvg
{
private :
int	m_count;
int	m_total;
int	m_min;
int	m_max;
public:

CMinMaxAvg() {
m_count = 0 ;
m_total = 0 ;
m_min   = 0 ;
m_max   = 0 ;
}

void add( int iNum ) {
if( m_count == 0 ) {
SetMax( iNum, true ) ;
SetMin( iNum, true );
}        SetMax( iNum, false );
SetMin( iNum, false );
m_count ++;
m_total += iNum ;
}

void SetMax( int iNum, bool force=true ) {
if( m_max < iNum || force ) {
m_max = iNum ;
}
}

void SetMin( int iNum, bool force=true ) {
if( m_min > iNum || force) {
m_min = iNum ;
}
}

float GetAvg( ) {
return (float)m_total/(float)m_count ;
}

int GetMax() {
return m_max ;
}

int GetMin() {
return m_min ;
}
};

How to install PHPBB 3.0.1

This tutorial will walk you thou the steps to install PHPBB3 on your system.

Intro

PHPBB3 has become one of the more popular bulletin board system (AKA, BBS, or forums) available. It is used for all types of websites, from corporate websites, online stores, online hobby groups, ect.  One of the main selling points for many people that use PHPBB is the strong community of developers developing mods and themes. PHPBB is an open source project released under (General Public License) that started in 2000 by James Atkinson (now a former team member) has come a long way in the last 8 years. As PHPBB grew and became more popular and as its install base reached over 100,000 sites, it started getting targeted by hackers and script kiddies. Forums would be filled with spam comments, links to porn/adult sites, and people trying to sell perscription medication it turned a lot of people away from PHPBB on to other forum systems. The newer versions of PHPBB2 and PHPBB3 made spam and robot prevention a major concern and the exploits that allow robots and script kiddies to make new posts have been reduced significantly.

Requirements (^)

For this tutorial we will be use a apache.org on a UNIX based web server hosted on dreamhost.com using mysql.com for the database.

Directions

1) Download the latest stable version of PHPBB (We are using PHPBB3.0.1)
2) Extract the archive to your desktop, preserving the file tree. (C:\temp\PHPBB3)
3) Upload the contents of the archive to your web server. (/abluestar.com/temp/phpBB3/)
4) Browse to the installation page

5) Click the install tab at the top of the page. Then click the “Proceed to next step” button.

6) On this page your system will be checked for the basic requirements.

7) Enter your database settings

8 ) Set up the boards administrative user

9) Set Advanced settings. Most of these settings can be left as there defaults or changed later.

10) Create database tables. This page creates the nessary tables on your database for the forum system to store your settings.

11) Final stage, this is just a conformation page that everything has been installed correctly. You can now browse to the install directory.

12) Main page. At this stage you should delete the /install/ directory from the PHPBB3 folder.

13) At this point you can log in to your forums adminitation panle and configure your forums to suit your needs, but this beyond the scope of this tutorial.

This tutorial was written for COMP2920, Steven Smethurst, B.J. Wilson, Dennis Warren