journal extended

Just another WordPress.com weblog

Synchro Test Suite

leave a comment »

I use this mainly for unit testing my C programs. Since most of the programs were targetted for embedded device, it’s a bit tricky to test, but at least this small suite forced me to separate the modules and make sure they’re all decoupled.
Most of the main features were actually macros. Stored at test_fwx.h, the source is self-documented, just take a read to figure out how to use the assertions.
And then I was inspired by Python doctest, a tool to execute unit test written at docstring in the source code. It was actually came from Peter Norvig’s docex.py. So I decide to create similar tool, written in C, I used bison and flex to generate the parser, which I call chouchou.
Here be example on how to use chouchou:

First, make sure you already have bison and flex installed, then compile chouchou with gcc, just type make and you’ll set.

I’ll start with this C source file

//this file will be named lychrel.c
//It's not actually finding lychrel number
//but you've got the idea.
//http://en.wikipedia.org/wiki/Lychrel_number
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "lychrel.h"

int do_reverse(int number) {
    char m[11];
    int len, i, j;
    if (!sprintf(m, "%d", number))
        return 0;
    len = strlen(m);
    for(i = 0, j = len - 1; i < j; i++, j--) {
        char c = m[i];
        m[i] = m[j];
        m[j] = c;
    }
    return atoi(m);
}

int is_palindrom(int num) {
    int test = do_reverse(num);
    if (test == num)
        return 1;
    return 0;
}

long do_addition(int num) {
    return num + do_reverse(num);
}

Then I will use this header file

Read the rest of this entry »

Advertisements

Written by fudanchii

August 20, 2011 at 8:09 pm

Posted in script

Tagged with , , ,

now powered with fixed line

with 2 comments

Yes, It was installed last Monday.
After years, I finally subscribes to this fixed line telephone plus adsl service.
Well I hope I can update these blogs of mine more frequently.
or not.

Umm, for the sake of consistency, I should write something techie related. Or whatever, I guess.
I’m still using Presario CQ42, it’s been 8 months I think, since my office swapped the previous Axioo Neon with this.
It was geared with SuSE Linux Enterprise Desktop 11, which is old, and sucks. The kernel takes ~20% of cpu time while it’s actually idle.

Now I’m using Mint flavoured Debian. And still comfortable with it, despites on edge and unstable proclaim for its rolling based updates.

Well, that’s it for now.

Written by fudanchii

August 19, 2011 at 7:48 am

Posted in Uncategorized

gnome background changer

leave a comment »

see that notification
I got myself playing with a lot of scripting language lately…
so, this is a python script that change your gnome wallpaper based on given directory.
Its default setting is to change the wallpaper every 1 minute, the setting is stored in gconf
and you can change it from gconf-editor-> /desktop/gnome/background
the script will create two keys “picture_folder” and “timeout”
okay, this is it…

Read the rest of this entry »

Written by fudanchii

May 16, 2010 at 5:26 pm

Posted in script

Tagged with , ,

on snv_b132

leave a comment »

Apparently this site was long abandoned, since I’m only using this as progress report on my java payroll project over two years ago… The project is not going too smooth,with the lack of design ability, J2EE skill, and of course dedicated time, for one must not design and develop enterprise scale application from scratch in one month, alone!

But indeed that was good experience I guess…
Moving along, I decide to revive this log and fill it up with some techie administering, and programming stuff. until now I write all of these thing in random places like here or here.

I’m using Open Solaris for a while now and found it worthy enough to stay in my laptop. I can’t make the broadcom 4311 working of course, but I can hang on with it for some reasons. Open Solaris seems perfect for server but not so for desktop. I hate to recommends anyone for using UNIX variant OS, since it’s useless… I mean the recommendation. If one use linux, bsd, or solaris on they computer, then it means they’ll use it. for whatever reason… It’s an option.

As for know the build is come to 132, Open Solaris keep growing up, I’m taking a bet and try to upgrade my b131, with this command
$ pfexec pkg update-image --be-name snv_b312
--be-name is refer to new boot environment name where the update image will be installed.
I’m playing with YAWS and erlang while waiting the updates. The update going smoothly, and after restart there’s a brand new GDM screen, my opinion? not bad. And then I found that firefox 3.6 isn’t working anymore. Segmentation fault, for it’s look like the build is not compatible with the current kernel or user land. So I’m take a check on the services with svcs command. MPD, and YAWS run fine. another error is PHP. For unknown reason YAWS keep reports CGI failure when I’m trying to access php file. And for overall performance, I’m not really notice about that, but I think there’s a little improvement, since GDM screen -> wallpaper blend is going smoother.

I’m too lazy to compile php, so I think I’ll going with the old BE instead, at least until I finished downloading the usb image. Then I can install it again from scratch…

Written by fudanchii

February 7, 2010 at 6:40 am

Posted in Uncategorized

Jum’at 4 Juli

leave a comment »

####Activity####

masih mengutak-atik Formula.java

dari hari Selasa.

struktur class banyak yang diubah

masih mengusahakan parsing conditional if

####Achievement####

none

Formula.java

####Problem####

expression parsing…

T_T

####################

Sejak hari Selasa tidak sempat keluar rumah

untuk update report….

(Formula.java belum selesai…..)

mohon maaf

 

Written by fudanchii

July 4, 2008 at 1:25 pm

Posted in Uncategorized

Senin, 30 Juni 2008

leave a comment »

Hari pertama….

####Aktivitas####
(10.30) Sampai di Kantor
mulai mendesain sistem payroll, fokus pada class Formula
(12.45) Istirahat
(13.30) Menyusun properties untuk class Formula
preview class formula:

public class Formula {
//variable id akan otomatis di generate di constructor
private String id;
private String Name;
private String expression;
private boolean varError;
private ArrayList variables;
private ArrayList operators;

Formula(String Name, String expression) {

}

Formula(String expression) {

}

public double doCalculation (String expression, ArrayList param) {
double result = 0;

return result;
}

private double calcMonomial(String expression, char operator) {
double result = 0;

return result;
}

private String extractIFState(String expression) {
String expr = “”;

return expr;
}

private String cutBracket(String expr) {
String result = “”;

return result;
}

boolean isError() {
return this.varError;
}

String getName() {
return this.Name;
}

String getExpression() {
return this.expression;
}
}

#####Achievement#####
PayRoll web project
package :
#webPayRoll.helper
->Employee.java
->Formula.java
->Income.java
->Tax.java
->Variable.java
#webPayRoll.servlet
->TransactionProcessServlet.java

#####kendala#####
~none in particular~

next work Day Kamis, 3 Juli 2008

Written by fudanchii

June 30, 2008 at 12:06 pm

Posted in Uncategorized