|
|
Home
|
Steps to Becoming a Freelance Web Developer |
|
Written by Administrator
|
|
Sunday, 05 February 2006 |
Steps to Becoming a Freelance Web Developer Sunday September 11, 2005 - Thanks to http://www.garrettdimon.com
Making the Decision While it may sound dreamy to just up and decide to quit your job and start your own business, it helps if you do a little legwork and make an informed decision. I did the former. Don’t get me wrong, it’s exciting and provides good experience, but it wasn’t the most stable way to start a business. |
|
Last Updated ( Saturday, 27 October 2007 )
|
|
Read more...
|
|
|
Javascript Progressbar class |
|
Written by Administrator
|
|
Saturday, 27 October 2007 |
This is a basic object oriented progressbar written in javascript. Part of the script is a randomized increment which allows you to see how it looks. To see a possible implementation of the script click here . Also you can check out the mechanics of the script here.
Javascript Code:
/******************************************************************************************************************************* ************************************************************************************************************************ Progress bar object functions
************************************************************************************************************************* *************************************************************************************************************************/ var globalBarCollection = new Array() var globalBarCount = 0
function progressbar(prefix){
this.globalID = globalBarCount this.ledImage = "led.gif" this.prefix = prefix this.pgID = 0 this.spg = 0 this.progresstimer = false this.interval = 0 this.lightbg = 'orange' this.darkbg = 'eeeeee' globalBarCollection[this.globalID] = this globalBarCount++ }
//setup table for displaying progress progressbar.prototype.place = function() { with(document){ writeln('<table class="pbar" id='+this.prefix+' bgcolor="ffffff" cellspacing=1 cellpadding=0><tr>') for(i=0;i<100;i++){ writeln('<td width=5 id='+this.prefix+i+'></td>') } writeln('</tr></table>') } }
//repeat coloring of cells until 100% progressbar.prototype.play = function(){ this.spg = this.pgID // step(this) // this.interval = GetRandom(200,1000) //generate random time for timeout //if(!this.myPrototypeCall){ // var myInst = globalBarCollection[this.globalID] // this.myPrototypeCall = function() { myInst.play()} // this.progresstimer = window.setInterval (this.myPrototypeCall, interval); // } //cause of issues with running timeout from within prototype this is an attempt to use utility function to substitute //step(this) doProtoTypeInterval(this.globalID) } progressbar.prototype.pause = function(){ clearTimeout(this.progresstimer) } progressbar.prototype.reset = function(){ this.pause() clearRange(this.pgID,this.prefix) this.pgID = 0 this.spg = 0 }
/******************************************************************************************************************************* ************************************************************************************************************************ Progress bar utility functions
************************************************************************************************************************* *************************************************************************************************************************/ //setTimeout workaround
function doProtoTypeInterval(objID){ // step(globalBarCollection[objID])
currentobj = globalBarCollection[objID]
distance = GetRandom(0,6) //generate random increment for range of cells if((currentobj.pgID + distance) >= 99){ currentobj.pgID = 100 } else { currentobj.pgID+=distance } bgfill(currentobj.spg,currentobj.pgID,currentobj.prefix) currentobj.interval = GetRandom(200,1000) //generate random time for timeout currentobj.progresstimer = window.setTimeout("doProtoTypeInterval("+objID+")",currentobj.interval) }
//execute coloring of range of cells //to review function because there was no success in calling setTimeout from prototyped function play() //key utility function to fill range of cells //obsolete! functionality placed in doProtoTypeInterval function step(myobject){ distance = GetRandom(0,6) //generate random increment for range of cells if((myobject.pgID + distance) >= 99){ myobject.pgID = 100 } else { myobject.pgID+=distance } bgfill(myobject.spg,myobject.pgID,myobject.prefix) }
//utility function used by object during incrumenting function GetRandom(start,end){ var range = end - start + 1; var result = start + Math.floor(Math.random()*range); return result; }
//utility function used to color range of cell //not sure why but pointers to cell objects not changing. //Use bgfill instead. function fill(firstPG,lastPG,prefix){ for(x=firstPG;x<lastPG;x++){ pgsetp = prefix + x pgsetp = document.getElementById(pgsetp) pglight = document.createElement('IMG'); pglight.src= "led.gif" pglight.setAttribute('width','5'); pglight.setAttribute('height','5'); //pgsetp.removeChild(pgsetp.childNodes[0]); pgsetp.appendChild(pglight); } } function bgfill(firstPG, lastPG, prefix){ for(x=firstPG;x<lastPG;x++){ pgsetp = prefix + x pgsetp = document.getElementById(pgsetp) pgsetp.style.background = 'gray' } } function clearRange(lastPG,prefix){ for(x=0;x<lastPG;x++){ pgsetp = prefix + x //alert(pgsetp) pgsetp = document.getElementById(pgsetp) pgsetp.style.background = 'white' } }
Comment on this article | Add to favourite articles (9) | Place this article on your website | Views: 104 |
|
Last Updated ( Saturday, 05 January 2008 )
|
|
|
Calculate entitled leave in excel |
|
Written by Administrator
|
|
Saturday, 27 October 2007 |
This is a function i came up with so we could calculate the number of leave days someone is entitled to.
| level | 1 to 3 years | 4 to 7 years | 8 to 10 years | over 10 years | | 4 | 28 | 30 | 34 | 40 | | 3 | 24 | 26 | 27 | 35 | | 2 | 22 | 24 | 26 | 28 | | 1 | 12 | 14 | 16 | 20 |
Code:
Function GetDays(level As Integer, startdate As Date) Dim NumYears As Integer, levels As Variant NumMonths = DateDiff("m", startdate, Date) NumYears = Fix(NumMonths / 12) Select Case (level) Case 4 levels = Array(28, 30, 34, 40) Case 3 levels = Array(24, 26, 27, 35) Case 2 levels = Array(22, 24, 26, 28) Case 1 levels = Array(12, 14, 16, 20) End Select Select Case (NumYears) Case 1 To 3 GetDays = levels(0) Case 4 To 7 GetDays = levels(1) Case 8 To 10 GetDays = levels(2) Case Is > 10 GetDays = levels(3) Case Else GetDays = 0 End Select End Function
Comment on this article | Add to favourite articles (9) | Place this article on your website | Views: 124 |
|
Last Updated ( Thursday, 22 November 2007 )
|
|
|
Using Function To parse Preg_replace |
|
Written by Administrator
|
|
Saturday, 27 October 2007 |
|
It is Possible to use a function to format the output of a preg_replace. This can be accomplished using backreferences.
the following example assumes that freelance-window.com sells books and pays commissions to affilates who send customers to them.
PHP Code:
//original link or links nested in other content $aff = "< a href=\"http://www.freelance-window.com/books.php?bookid=5&\">php book</a>";
//this function will add the id to every match found function parseid($id){ $template = "http://www.yoursite.com/books.php?bookid={id}&referid=yourname"; return str_replace("{id}",$id,$template); }
//match all the book urls on the site $urlpattern = "/http:\/\/[^=]+([^&]+)/";
//store value of id $backreferenceid = "$1";
//parse urls matching pattern using template $parse_aff = preg_replace($urlpattern,parseid($backreferenceid),$aff);
echo($parse_aff);
If i did everything right the above code should output:
Code:
http://www.yoursite.com/books.php?bookid=5&referid=yourname
it seems trivial at first but its very useful when taking information
off other websites, parsing that information and redisplaying it on
your own. You may also parse info for the purpose of storing it in the
database.
The whole point of this is
1) make the script neater
2) function parseid allows for much more complex operations using the
information found in a match. this function could also be part of a
class...example
PHP Code:
class scraper{ function parseid($id){}
} $freelance_window= new scraper;
$freelance_window->parseid($backreferenceid);
Comment on this article | Add to favourite articles (9) | Place this article on your website | Views: 111 |
|
Last Updated ( Thursday, 22 November 2007 )
|
|
| | << Start < Previous 1 2 Next > End >>
|
|
|