Wish One, Two, and Three Granted by Geany

When I get programming the following trend can be observed.

Organization over time graph

Time of interest: at this moment I have become stumped over an issue I could have probably left until later. After XChat and multiple Firefox windows are open, taking up a desktop themselves, it just progressively gets worse as I dive into library source code and download-only docs and multiple file system searches with the GUI tool because I suck at the find command... A hundred various windows, memory spilling into the swap space, and a diet coke later I have either given up or found the answer.

Unfortunately, Geany does not fix any of that. I'll probably always make a rat's nest when I am working on code. Er, that is, my code is elegant and clean but the process isn't... in comparison anyhow. What Geany does do, though, that I absolutely love, is the following three things.

  • Loads fast. While drowning in windows I often make the attempt to temporarily give myself some breathing room by closing windows that I only think I am done with. When I tried Eclipse it was a disaster because I'd be shuffling through windows and accidentally close my last Eclipse window which meant I'd have to load it again. Eclipse is a heavy IDE. It takes forever to load. Geany is a very light IDE. It pops up within two seconds.
  • Simple. I do not hate feature-heavy IDE's or tricky ones to get used to like vim. They are just not for me. Maybe one day I will spend a few weeks getting comfortable with a particular application. Until that day, though, I need an IDE that I can just take a glance at and understand.
  • Has the essentials. Syntax highlighting, symbol recognition, code folding and more, it is mostly there. I am still waiting for a tree-view directory browser, though. Maybe when I finally figure out C I can do that for them.

So there you have it: my IDE of choice. It runs almost anywhere so if you want to take it for a spin you should be able to. If you did not catch the link yet it is: http://geany.org.

Version 0.16 is out now and I haven't upgraded. Getting on that now... I'll probably grab another diet coke while I do that. Yeah, that's right, diet. It tastes better. I swear.

Getting an A in C

Well, I am not learning C in school, but if I had to grade my progress I'd give it an A. Okay, yes, I was just in it for the pun. I really am learning C, though. Kernighan's and Ritchie's second edition book on the C programming language is an excellent way to get going if you have programming experience. The chapters are concise and truly useful exercises are given at the end of each to apply your new knowledge to real programming. Best book I have picked up yet for learning a programming language. I ordered my copy from Amazon.ca, because I am Canadian, but it is also available on the .com and .co.uk sites.

The investment is well worth it if you want to learn C. But, before you place the order, I want you to check out this great Reverse Polish Notation calculator I made.

#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <math.h>
#define MAX_OPERANDS 100
#define MAX_NUM_LENGTH 20
#define OPERATION_NOT_SUPPORTED 1
#define ADDITION '+'
#define SUBTRACTION '-'
#define MULTIPLICATION '*'
#define DIVISION '/'

int preformOperation(int o);
int readNumber(int f);
void addOperand(double f);
double getOperand();

float operands[MAX_OPERANDS];
int operandsIndex = 0;

int main() {
    int c;
    double answer;
    while ((c = getchar()) != EOF) {
        if (isspace(c)) {
            continue;
        }
        if (isdigit(c) || c == '.') {
            if (readNumber(c) == EOF) {
                break;
            }
        } else {
            if (preformOperation(c) == OPERATION_NOT_SUPPORTED) {
                printf("Operation \"");
                putchar(c);
                printf("\" is not supported\n");
                break;
            }
        }
    }
    answer = getOperand();
    if ((int)answer == answer) {
        printf("%d\n", (int)answer);
    } else {
        printf("%lf\n", answer);
    }
}

int preformOperation(int o) {
    float temp;
    switch (o) {
        case ADDITION:
            addOperand(getOperand() + getOperand());
            break;
        case SUBTRACTION:
            temp = getOperand();
            addOperand(getOperand() - temp);
            break;
        case MULTIPLICATION:
            addOperand(getOperand() * getOperand());
            break;
        case DIVISION:
            temp = getOperand();
            addOperand(getOperand() / temp);
            break;
        default:
            return OPERATION_NOT_SUPPORTED;
    }
    return 0;
}

int readNumber(int f) {
    int c, i = 0;
    char buffer[MAX_NUM_LENGTH], *end;
    buffer[i++] = f;
    while (c = getchar()) {
        if (c == EOF || isspace(c)) {
            break;
        } else {
            buffer[i++] = c;
        }
    }
    buffer[i] = '\0';
    addOperand(strtod(buffer, &end));
    return c;
}

void addOperand(double f) {
    operands[++operandsIndex] = f;
}

double getOperand() {
    return operands[operandsIndex--];
}

This is one of the programs you may find yourself writing while going through their book. It probably won't look like this, because this exercise was more self-inspired, but they do have their own version of an RPN calculator that they ask you to tweak in various ways. I simply made one from scratch. Unfortunately, until I get to the section about malloc() and realloc(), my stack sizes are fixed. Bummer. Perhaps I'll write this calculator again when I am finished the book and see what I do differently.

Abstract Flow

I enjoy creating web sites so I decided to give a go at starting up a freelancing business. To find out more, the following links will be useful.

Then, if you are impressed, or at least would like to help get me off the ground with this new venture, go ahead and fill out the quote request form and I can get back to you promptly with project estimates.

I Blog With Habari

Finding the right pre-built platform for blogging wasn't hard, but I found lots of junk along the way.

  • Wordpress: slow, bloated, ugly code base. Have you seen how to make templates? (shudders)
  • Most other blog software falls under any of these: confusing, lack of documentation, few features, questionable code.
  • Most CMS's: slow, bloated, ugly code bases. For their complexity, I'd rather just develop something with Agavi.
  • Habari: fast, simple, enough attention to have an excess of features. Code base is decent.

I am pretty happy with Habari. However, documentation is rather lacking for what I have found thus far. I should probably start working on my own theme sometime soon. Blue and white blocks do not represent my style.

What do you blog with? Leave a comment. I'd like to share my thoughts if I have used it before. If I haven't, I'd like to give it a try.

Introducing Need to Develop

This is a simple blog to share what I find in computer programming. Enjoy.


About

User