NS2 on Fedora


Written by

My friend needed NS2 installed on Fedora 14 and he wasn’t confident in BASH (Borne Again SHell) so I helped him a little. I don’t have a Fedora install at the moment but this his how we finally got it installed. It isn’t an easy install procedure.

yum install gcc-c++ libX11-dlevel xorg-x11-proto-devel libXt-devel libXmu-devel wget
wget http://downloads.sourceforge.net/project/nsnam/allinone/ns-allinone-2.34/ns-allinone-2.34.tar.gz?r=http%3A%2F
tar -xzvf ns-allinone-2.34.tar.gz
cd ns-allinone-2.34.tar.gz
gedit ns-allinone-2.34/ns-2.34/mobile/nakagami.cc

This will open up the gedit editor, if you have KDE, change this for kate.

Change the following:

183
resultPower = ErlangRandomVariable::ErlangRandomVariable(Pr/m, int_m).value();

to

183
resultPower = ErlangRandomVariable(Pr/m, int_m).value();

and change:

185
resultPower = GammaRandomVariable::GammaRandomVariable(m, Pr/m).value();

to

185
resultPower = GammaRandomVariable(m, Pr/m).value();

save and exit

then type

gedit ns-2.34/tools/ranvar.cc

and edit:

219
return GammaRandomVariable::GammaRandomVariable(1.0 + alpha_, beta_).value() * pow (u, 1.0 / alpha_);

to

219
return GammaRandomVariable(1.0 + alpha_, beta_).value() * pow (u, 1.0 / alpha_);

save and exit.

Now:

./install
gedit ~/.bashrc

and add this to the file:

# LD_LIBRARY_PATH
OTCL_LIB=~/ns-allinone-2.34/otcl-1.13
NS2_LIB=~/ns-allinone-2.34/lib
X11_LIB=/usr/X11R6/lib
USR_LOCAL_LIB=/usr/local/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCL_LIB:$NS2_LI B:$X11_LIB:$USR_LOCAL_LIB

# TCL_LIBRARY
TCL_LIB=~/ns-allinone-2.34/tcl8.4.14/library
USR_LIB=/usr/lib
export TCL_LIBRARY=$TCL_LIB:$USR_LIB

# PATH
XGRAPH=~/ns-allinone-2.34/bin:~/ns-allinone-2.34/tcl8.4.14/unix:~/ns-allinone-2.34/tk8.4.14/unix
NS=~/ns-allinone-2.34/ns-2.34/
NAM=~/ns-allinone-2.34/nam-1.13/
PATH=$PATH:$XGRAPH:$NS:$NAM

save and exit

source ~/.bashrc

This should hopefully work. If someone has an updated/corrected guide then please contact me and I’ll fix it.
If you are having problems with xgraph, try gnuplot, its slightly different but still plots graphs.

yum install gnuplot

This guide may work on Red Hat Linux too as Fedora and Red Hat are developed from the same arm of Linux distros.

Orange UK Livebox 2 Mini


Written by

If you can use computers and know how to wifi etc.

Replace it; its a heap of shite.

Simple.

“I need a website”


Written by

Why?

A quote which I regularly hear from people is “I need a website” in which my response is “Why?“, I ask this as most people don’t even know why with an excuse such as “because everyone has one“.

What?

The next stage in the initial meetings are about requirements and the client either knows exactly what they want or has no idea. Both scenarios can pose a great problem as people who know exactly what they want usually wont budge on a design style or look and people who don’t have a clue just don’t have a clue so getting any kind of constructive start is next to impossible.

Final result

Then comes the final result.

It is never what they “imagined” even if they design an interface and colours etc or if you show them designs at every stage. That is to say it isn’t “Great“, “Fantastic” and “Amazing” because it is and the client will say so but the looks are never quite right. and this is why.

Stanards

People outside of a field of work does not know the standards of that field, I do not know the medial quality standards but I do know the W3C Standards for websites.

When I try to explain that websites have a standard to conform to, I get blank looks as though I am speaking french (Which I do not and if I tried, it would be utter shite). Why can people bot comprehend that there are standards to everything, cars, medical procedures and yes, websites. These standards are put into place for reasons and for websites, it is to create a structured code that will be understood by any browser and displayed correctly.

Accessability

Accessibility for websites is a mine field and a dangerous one. There is basic accessibility included in the XHTML 1.0 standards but for true accessibility for people with all kinds of disabilities to be able to access the site, then a lot more work needs to be done and it needs to validate against the WAI WCAG standards.

For instance, basic accessibility requires alt attributes in images etc which conform to the W3C XHTML standard but then there is another set of standards purely for accessibility which require tags such as <label> and title attributes. These help screen readers for blind people to navigate and understand what is happening. Then there are plain stylesheets, alternate coloured stylesheets so people can remove the styling for easier reading and to remove colours if they clash especially in cases of colour-blindness. Then there are people with motor-neuron disorders which can use a site via eye control and voice control if it is setup correctly.

And once again, a client doesn’t understand that the internet is a wide open platform that can allow anyone access to any information and so this “unessential work” because these types of people are not interested in their site means the internet is restricted and that the site/client is effectively shutting them out because they are disabled.

Live Sites

So, why when we have these standards, do people not conform to them? I know that this blog currently doesn’t conform but that is because I didn’t code it and I’m working to iron out the bugs, but seasoned “Web Developers” that create commercial and personal sites do not follow these standards and yet get paid for it, isn’t this like paying a surgeon to give you an operation and then finding out he couldn’t be bothered to clean the instruments?

The standards are there for a reason, USE THEM!

End Rant

Useful Links

PHP Uptime Function


Written by

There is an updated version of this function.

I have been wanting to display the uptime of my Web Server so I wrote a little function.

It only supports Linux/Unix type systems but it checks for that and if its a Windows or Unknown system, it just outputs “Unknown”.

function uptime(){
 // See if it is a Unix Based OS
 if((PHP_OS == "Linux") || (PHP_OS == "FreeBSD") || (PHP_OS == "Unix") || (PHP_OS == "SunOS")){
  $uptime = file_get_contents( "/proc/uptime");
  $uptime = explode(" ",$uptime);
   $uptime_ = $uptime[0];
  $seconds = $uptime;
 
  $days = (($uptime % 31556926) / 86400);
  $days = explode(".",$days);
   $days = $days[0];
  $hours = ((($uptime % 31556926) % 86400) / 3600);
  $hours = explode(".",$hours);
   $hours = $hours[0];
  $minutes = (((($uptime % 31556926) % 86400) % 3600) / 60);
  $minutes = explode(".",$minutes);
   $minutes = $minutes[0];
  if($minutes > 0){
   $time = $minutes." mins.";
  }
  if($hours > 0){
   $time = $hours." hours, ".$time;
  }
  if($days > 0){
   $time = $days." days, ".$time;
  }
 
 }else{
  // Function Doesn't Support Windows
  $time = "Unknwown";
 }
return $time;
}

Hope someone else gets as much use of it as me.

Facebook & HTTPS


Written by

What is HTTPS?

HTTPS is the HTTP protocol that is secured, this means that all data sent via your web browser is encrypted and cant be read by some dodgy bugger somewhere trying to steal your passwords and sensitive information.

What on earth is Facebook?

Do you really have to ask?

So what are you going on about?

Well, if you visit https://www.facebook.com you can login securely but as soon as you click a link, it then takes you to the standard HTTP format.

So, if you think you’re being all secure and keeping your information all secure then you’ve thought wrong.

So why is this happening?

Well its all down to how you define a link in HTML. You have the a relative method:

<a href="webdesign/">

then you have the absolute method:

<a href="/webdesign">

now, both of these links take you to the same place but id different ways, if you moved the page that the first link is place in to another directory, it will break but the second will.

Now Facebook is using a third method usually used to link to external sites

<a href="http://www.aboutcher.co.uk">

this loads up an external address with the HTTP protocol, this method is used to tell your browser that the link is outside your domain.

So in short, Facebook is defining its links as though it is linking to an external site and not its own. This maybe because it runs several sub-domains for things such as groups and relative links would the not work but this is no excuse. Facebook runs on PHP and there is a function to check to see if the connection is secure or not.

All that is needed is the following code:

if($_SERVER['HTTPS']=="on"){
$PROTO = "HTTPS://";
}else{
$PROTO = "HTTP://";
}
echo $PROTO."www.aboutcher.co.uk";

This will create the link HTTP or HTTPS depending on what you are already using, and so keeping the connection secure on every click.