Blogs

"file" function for C

ma * file(const char * filename);

Header file:

  1. #ifndef FILE_H_
  2. #define FILE_H_
  3.  
  4. #define MAXCHAR 65535
  5.  
  6. /* matrix array data type "ma" */
  7. typedef struct {
  8.         char text[MAXCHAR];
  9. } ma;
  10.  
  11. ma * file(const char * filename);
  12.  
  13. #endif

Library code:

  1. /********************************************************************
  2.  * Name: file.c
  3.  * Author: Rashaud Teague
  4.  * Date: 07/01/2009
  5.  * License: GNU LGPL
  6.  * Description: File handling functions for C
  7.  ********************************************************************/

Maris Source Maker...Decode Redux

As a follow up to the original post there are new command line changes to the Maris Source Maker, you no longer have strongly specify what source template(type) with this:

  1. smk test -t cpp

You can now just enter the file name with the extension.

  1. smk test.cpp

That would create C++ file named test.cpp with a comment block template ready to go.

Remember you can view the source code here http://marislabs.org/node/20

Have fun,
Rashaud Teague

Better parsing for the <pre> tag for Syntax Highlighter

I found out how to have a better parsing solution for using Syntax Highlighter on your system.

The Syntax Highlighter provides that you use:

  1. <pre name = "code" class = "cpp">
  2. ...some code goes here...
  3. </pre>

Maris Source Maker...Decoded

Many people have downloaded Maris Source maker and they don't have a clear understanding of how its truly used and "loved".

Maris Source Maker is for the Linux OS and is written in the Python Programming Language. View the source code for Maris Source Maker.

Ok...anyway...

Don't be afraid to drop the SOAP!

I've recently just tangled with PHP and Web Services. Something that I want to point out is the use of SOAP verses XML-RPC. What I can say is that XML-RPC came very easy to use.

Why? ...Keith Devens XML-RPC Library for PHP is by far the best to work with setting up Web Services using XML-RPC.

Some words from Mr. Keith...

Validating $_GET vars (PHP)

I've seen this before in a lot of people's code and I'm not going to lie, I've done this too...not validating $_GET vars.

When most developers develop scripts that take in $_GET like this:

www.example.com/thing.php?id=1

When you look at the scripting side developers may just enter the $_GET['id'] var plainly into the script like this:

  1. <?php
  2. $query = "SELECT * FROM example WHERE id = "'.$_GET['id'].'"";
  3. ?>

Well that is unsafe...

Easier phpBB Installation

When I was first trying to install phpBB on to my systems I hated doing it remotely through FTP. Through FTP programs it was slow uploading the phpBB folder to the server. So I came up with a way that you only have to upload the compressed file to the server and run a script to extract and go through the installation right away.

What you should do first is create a directory where you want the location of the phpBB forums to be. The most common name is forums/. Then upload the compressed phpBB file to that new directory. So now the structure should look as follows:

forums/

Uploading files with PHP

If you are new to PHP or web programming in general, ever wonder how to upload files to your server?

You do wonder?

...word?

Well here is an example of how to do so.

If you want to follow this code along with you actually programming first do this. Create a folder called "uploads" on your server so that when following this tutorial you will have a directory your files will upload to.

First as how I roll, I'll throw the entire code at your brain.

upload.php

  1. <?php
  2. //tutorial - file uploader

Displaying Data in Columns with PHP

Tutorial - Displaying Data in Columns with PHP

Here is a simple way of displaying data in columns in php. Right now we are going to do this with the most common data type or data structure in the programming world, the array. You can also apply this with grabbing data from a data table but for simplicity we will just stick to array data that is not from a data base.

Lets start with just throwing the whole code at your brain:

  1. <?php
  2. //tutorial - simple data columns
  3.  
  4. //data array...just US states

Welcoming Back Maris Labs

Hi,

Welcome back Maris Labs. I started this site last summer under the marislabs.com but now its marislabs.org. It had first been abandoned because of my lack of "time on the side". Now we are back up and running again to support a community of computer geeks.

I myself will be giving out programming tutorials and helping people in the forums with programming issues =)

-Neptune AKA Rashaud

Syndicate content