|
|

08-26-2008, 05:06 PM
|
 |
Senior Member
Offline
|
|
Join Date: May 2004
Rating:
Posts: 12,757
|
|
Re: The Programmers, Web designers Thread
Quote:
Originally Posted by sally
wow, i thought i was a loyal islamican after remaining active for 6 years (going on 7)
but i think fahmed and sixpakistan should get gold medals for being such incredibly dedicated islamicans and taking precious time out of their busy days to write CODE for extra features
i dont think anyone can top such fidelity.
|
that was a shell script i wrote in like 5 minutes ~3.5 years ago
-rwx------ 1 root screen 811 May 26 2005 msnconv*
|

08-26-2008, 05:09 PM
|
 |
Moderator Khala
Offline
|
|
Join Date: Mar 2002
Rating:
Posts: 22,946
|
|
Re: The Programmers, Web designers Thread
i want a feature that allows you to set your font color preferences for the forum..so i dont hvae to keep changing mine to pink
*sigh*
__________________
.
.
You might be a big fish
I n a little pond
Doesn't mean you've won
|

08-26-2008, 05:13 PM
|
 |
Senior Member
Offline
|
|
Join Date: Aug 2007
Posts: 109
|
|
Re: The Programmers, Web designers Thread
Quote:
Originally Posted by sixpakistan
not working.. it's making both nicks the same color
|
try this..msn is little tricky as it puts the name and text in different lines...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="IBM WebSphere Studio">
<TITLE>test.html</TITLE>
<script type="text/javascript">
<!--
function convert() {
var lines;
var TA=document.form1.ta.value;
var out="";
var color="";
var im = "";
if(document.all) { // IE
lines=TA.split("\r\n");
}
else { //Mozilla
lines=TA.split("\n");
}
if(lines[0].indexOf("says:") != -1){
im="msn";
} else {
im="aim";
}
alert(im);
if(im=="msn"){
var user1=lines[0].substr(0, lines[0].indexOf("says:"));
var name="";
for(var i=0; i<lines.length; i++) {
var txt = "";
color="Red";
if(lines[i].indexOf("says:") != -1){
name = lines[i].substr(0, lines[i].indexOf("says:"));
if(name==user1){
color="Blue";
}else {
color="Red";
}
out = out+"[color="+color+"]"+name+"[\/color]"+":"
} else {
txt = lines[i].substr(0, lines[i].length);
out = out+"[b]"+txt+"[\/b]"+"\n";
}
}
}
if(im=="aim"){
for(var i=0; i<lines.length; i++) {
if(i%2==0){
color="Red";
}else{
color="Blue";
}
var name = lines[i].substr(0, lines[i].indexOf(":"));
var txt = lines[i].substr(lines[i].indexOf(":")+1, lines[i].length);
out = out+"[color="+color+"]"+name+"[\/color]"+":"+"[b]"+txt+"[\/b]"+"\n";
}
}
//alert(out);
document.form1.outputtxt.value=out;
}
//-->
</script>
</script>
</HEAD>
<BODY>
<form action="#" name="form1">
<P>Put convo here : <TEXTAREA rows="20" cols="50" name="ta"></TEXTAREA></P>
<button type="button" onclick="return convert();">convert</button>
<br>
<p><textarea rows="20" cols="50" name="outputtxt"></textarea></p>
</form>
</BODY>
</HTML>
__________________
www.imanhub.org
Networking Indian Muslim NGOs with donor/volunteer community worldwide.
|

08-26-2008, 05:42 PM
|
 |
Senior Member
Offline
|
|
Join Date: May 2004
Rating:
Posts: 12,757
|
|
Re: The Programmers, Web designers Thread
Awesome. You, sir, are a gentleman and a scholar. Now it just needs to be put up somewhere for public consumption, or be added as a feature on Islamica.
|

08-26-2008, 06:59 PM
|
 |
Senior Member
Offline
|
|
Join Date: Jul 2008
Rating:
Posts: 252
|
|
Re: The Programmers, Web designers Thread
I never understood what this line is for:
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
It seems to come up over and over again whenever I look at code. Can someone explain? 
|

08-26-2008, 08:54 PM
|
 |
Mr.Brightside
Offline
|
|
Join Date: Dec 2006
Rating:
Posts: 1,955
|
|
Re: The Programmers, Web designers Thread
it has to do with the character encoding of the html page.
ISO-8859-1 is the encoding for english language.
__________________
"Sometimes in order to help He makes us cry.
Happy the eye that sheds tears for His sake.
Fortunate the heart that burns for His sake."
- Mawlana Rumi (ra)
|

08-27-2008, 09:17 AM
|
 |
Senior Member
Offline
|
|
Join Date: Aug 2007
Posts: 109
|
|
Re: The Programmers, Web designers Thread
Quote:
Originally Posted by sally
i think fahmed and sixpakistan should get gold medals for being such incredibly dedicated islamicans and taking precious time out of their busy days to write CODE for extra features
|
ha ha..the gold medal should goto sixpak. He wrote the logic in 8 lines which took me more than 40 lines. 
__________________
www.imanhub.org
Networking Indian Muslim NGOs with donor/volunteer community worldwide.
|

08-27-2008, 09:22 AM
|
 |
Senior Member
Offline
|
|
Join Date: Aug 2007
Posts: 109
|
|
Re: The Programmers, Web designers Thread
Made one small change..
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<TITLE>Convert</TITLE>
<script type="text/javascript">
<!--
function convert() {
var lines;
var TA=document.form1.ta.value;
var out=""; var color=""; var im = "";
if(document.all) { // IE
lines=TA.split("\r\n");
}
else { //Mozilla
lines=TA.split("\n");
}
if(lines[0].indexOf("says:") != -1){
im="msn";
} else {
im="aim";
}
if(im=="msn"){
var user1=lines[0].substr(0, lines[0].indexOf("says:"));
var name="";
for(var i=0; i<lines.length; i++) {
var txt = "";
color="Red";
if(lines[i].indexOf("says:") != -1){
name = lines[i].substr(0, lines[i].indexOf("says:"));
if(name==user1){
color="Blue";
}else {
color="Red";
}
out = out+"[color="+color+"]"+name+"[\/color]"+":"
} else {
txt = lines[i].substr(0, lines[i].length);
out = out+"[b]"+txt+"[\/b]"+"\n";
}
}
}
if(im=="aim"){
var name="";
var user1=lines[0].substr(0, lines[0].indexOf(":"));
for(var i=0; i<lines.length; i++) {
name = lines[i].substr(0, lines[i].indexOf(":"));
var txt = lines[i].substr(lines[i].indexOf(":")+1, lines[i].length);
if(user1==name){
color="Red";
}else{
color="Blue";
}
out = out+"[color="+color+"]"+name+"[\/color]"+":"+"[b]"+txt+"[\/b]"+"\n";
}
}
document.form1.outputtxt.value=out;
}
//-->
</script>
</HEAD>
<BODY>
<form action="#" name="form1">
<P>Put convo here : <TEXTAREA rows="20" cols="50" name="ta"></TEXTAREA></P>
<button type="button" onclick="return convert();">convert</button>
<br>
<p><textarea rows="20" cols="50" name="outputtxt"></textarea></p>
</form>
</BODY>
</HTML>
__________________
www.imanhub.org
Networking Indian Muslim NGOs with donor/volunteer community worldwide.
|

08-27-2008, 09:28 AM
|
 |
Senior Member
Offline
|
|
Join Date: May 2004
Rating:
Posts: 12,757
|
|
Re: The Programmers, Web designers Thread
what was the change? alert removed?
|

08-27-2008, 09:44 AM
|
 |
Senior Member
Offline
|
|
Join Date: Aug 2007
Posts: 109
|
|
Re: The Programmers, Web designers Thread
Quote:
Originally Posted by sixpakistan
what was the change? alert removed?
|
Apart from that, for AIM, I was just giving the colors alternatively. I changed that to give each user a different color.
__________________
www.imanhub.org
Networking Indian Muslim NGOs with donor/volunteer community worldwide.
|

08-27-2008, 10:09 AM
|
 |
Senior Member
Offline
|
|
Join Date: Jun 2005
Posts: 200
|
|
Re: The Programmers, Web designers Thread
mmm.. bash scripts make me feel all warm and fuzzy inside. although I use tcsh as regular shell preference.
i just can't explain or elaborate why. at my last job, i'd sit and write/edit bash atleast twice a week, for hours on end, into the wee hours of the night. php couldn't give me the same feeling ( although i did spend just as many hours on php a number of years back )
sed and awk are my babies.
in retrospect, that'd be fun, to name kids 'sed' and 'awk'. hah. 
|

08-27-2008, 10:25 AM
|
 |
Senior Member
Offline
|
|
Join Date: May 2004
Rating:
Posts: 12,757
|
|
Re: The Programmers, Web designers Thread
Quote:
Originally Posted by elysium
mmm.. bash scripts make me feel all warm and fuzzy inside. although I use tcsh as regular shell preference.
i just can't explain or elaborate why. at my last job, i'd sit and write/edit bash atleast twice a week, for hours on end, into the wee hours of the night. php couldn't give me the same feeling ( although i did spend just as many hours on php a number of years back )
sed and awk are my babies.
in retrospect, that'd be fun, to name kids 'sed' and 'awk'. hah. 
|
That's just regular Bourne.. it's an old habit of mine to not get attached to any custom or platform specific tools, and to make everything as portable as possible. So I always just used /bin/sh & occasionally ksh for scripting.
I'm a bit spoiled as of the past few years when it comes to using tcsh for commandline, though.. but I still consider csh acceptable.
Partially as a result of the "don't get attached to tools you might not always have access to" mentality, I never really had any use for perl, either. I've traditionally always done everything in c or /bin/sh.
I've done a lot of app dev in c++ & a little bit of C# & Java, but I never really got into the whole OO paradigm (though it's definitely a lot nicer for team development). :dinosaur:
This convo probably belongs in another thread..
|

08-27-2008, 12:12 PM
|
 |
Mr.Brightside
Offline
|
|
Join Date: Dec 2006
Rating:
Posts: 1,955
| | |