Sunday, October 30, 2011

Gui for apache webserver

Time to submit of the mini projects for the project exhibition by aces.Initially i planned of making a gui based apache configuration tool and even started coding for the same.I completed almost all of the projects major works like parsing the httpd.conf file using a lex program and then loading the parsed information into a c# program.i used Lex for windows.obviously dev c++ comes with gcc which can be used with windows.

But i was tooooooooo lazy to go through the entire configuration file and writing the regular expression for all server configuration information.so i dropped the project.however the program i have written can be used as a skeleton for further improving the project.

here is the lex code.those who want c# code do mail me. :D

%{

#include<stdio.h>
#include<stdlib.h>

int count=0,flag=0,nummodule=0;
%}
%%

ServerRoot[ ]*[\"][a-zA-Z][:]*[/][/a-z0-9\.A-Z ]*[\"] { printf("%s\n",yytext); }
["#"]*Listen[ ]*[0-9]*[\.][0-9]*[\.][0-9]*[\.][0-9]* { flag=1; if(flag==0){ printf("%s\n",yytext); } else { printf("Listen undefined\n");}flag=0;}
Listen[ ]*[0-9]+ {printf("%s\n",yytext);}
["#"]*LoadModule[ ][a-zA-Z_0-9]*[ ][a-z/A-Z0-9\.]* { printf("%s\n",yytext);nummodule++; }
ServerAdmin[ ]*[@a-zA-Z\.0-9]* {printf("%s\n",yytext);}
ServerName[ ]*[[@a-zA-Z\.0-9]* {printf("%s\n",yytext);}
ErrorLog[ ]*[\"a-zA-Z0-9\/]* {printf("%s\n",yytext);}
DocumentRoot[ ]*[\"][a-zA-Z][:]*[/][/a-z0-9\.A-Z ]*[\"] { printf("%s\n",yytext);}
DirectoryIndex[ ]*[a-zA-Z_0-9]*[\.][a-zA-Z_0-9]* {printf("%s\n",yytext);}
ErrorLog[ ]*[\"][a-zA-Z_0-9]*[\/][a-zA-Z_0-9]*[\"] {printf("%s\n",yytext);}
\n ;
. ;
%%
int main(int argc,char *argv[])
{
yyin=fopen("httpd.conf","r");
yyout=fopen("sample.txt","w");
yylex();
return 0;
}
int yywrap()
{
return 1;
}


Dont get scared by looking into code if you are beginner.just get along.its one of the easiest :D

Thursday, July 14, 2011

BCM 4312 : One Click .deb Package

Today i had to install suitable drivers for my broadcom wireless network interface card.I was using debian squeeze 6.0 . It took some time for me to understand and hook up all the dependencies. I had to install b43-fwcutter first and then install bcm4312 stuff.Totally it was a bit time consuming.So this task would be not that easy for absolute beginner.So i made a single package that could install it in a single command .no extra downloads required :D

in terminal :
sudo dpkg -i bcm4312.deb

The package is tested well under debian squeeze.The package can be downloaded from

http://sourceforge.net/projects/ecdebian/files/bcm4312.deb/download

Hope you guyzz will like the project.If it doesnt work please let me know