Programming Advice

Post new topic   Reply to topic

View previous topic View next topic Go down

Programming Advice

Post by RikaComet on July 23rd 2009, 10:36 am

hello fellow forumotioners

I'm a pinch right now.. one of my personal projects needs your help

regarding a simple program it is

only one objective:

for certain text it should return another text, thats all
these pre-determined responses should be storable as well

should i use visual basic?

if there is some programmer lurking through this thread please help~ Wink

RikaComet
Forumotion Member

Male
Posts: 1465
Age: 18
Language: English , Hindi , Arabic , Urdu, Japenese , Punjabi , German
Location: thing called Earth
Country:
Join date: 2008-09-01

Back to top Go down

Re: Programming Advice

Post by Placehold on July 23rd 2009, 12:14 pm

Personally for something like that,

I would use php and Javascript, the javascript will be needed to make the search, wait time, and results smooth as well as the trigger in order to return a result and the php will be used to store data and calculate the algorithm

Regards







Craig

Placehold
Forumotion Member

Male
Posts: 2047
Age: 24
Language: English
Country:
Join date: 2008-04-16

http://www.craigreville.com/

Back to top Go down

Re: Programming Advice

Post by Splytte on July 23rd 2009, 6:26 pm

Post edit :

Here is an example.

$text = preg_replace('#\[b\](.+)\[/b\]#isU', '<strong>$1</strong>', $texte);

This is for example how the tags

Code:
[b]Text[/b]


is replaced by :

Code:
<strong>Test</strong>


Hope you understand... Wink

Edit : I didn't know this kind of message was accepted?

-=~Splytte~=-

Splytte
Forumotion Member

Female
Posts: 737
Age: 22
Language: French, English, Dutch, Spanish, German, Japanese, Chinese (Beginner).
Location: Belgium
Country:
Join date: 2006-04-04

Back to top Go down

Re: Programming Advice

Post by RikaComet on July 24th 2009, 1:23 am


I would use php and Javascript, the javascript will be needed to make the search, wait time, and results smooth as well as the trigger in order to return a result and the php will be used to store data and calculate the algorithm


can it be done in visual basic? and stroing the data using sql?



@splytte: well I'm not asking help for forum , just avoiding paying a pro for such simple job lol: atleast its way better that "random facts about forumotion " or "why did you chose forumotion" stuff

RikaComet
Forumotion Member

Male
Posts: 1465
Age: 18
Language: English , Hindi , Arabic , Urdu, Japenese , Punjabi , German
Location: thing called Earth
Country:
Join date: 2008-09-01

Back to top Go down

Re: Programming Advice

Post by Splytte on July 24th 2009, 7:47 am

I know, and what I give you is not only for forums, you can use it to replace anything you want...

-=~Splytte~=-

Splytte
Forumotion Member

Female
Posts: 737
Age: 22
Language: French, English, Dutch, Spanish, German, Japanese, Chinese (Beginner).
Location: Belgium
Country:
Join date: 2006-04-04

Back to top Go down

Re: Programming Advice

Post by RikaComet on July 24th 2009, 1:39 pm

what is it actually? mind telling me how it is used?

RikaComet
Forumotion Member

Male
Posts: 1465
Age: 18
Language: English , Hindi , Arabic , Urdu, Japenese , Punjabi , German
Location: thing called Earth
Country:
Join date: 2008-09-01

Back to top Go down

Re: Programming Advice

Post by Splytte on July 24th 2009, 4:43 pm

This is a PHP regex.

The function preg_replace() replaces a certain text by another one.

For example, you have a variable text1, and you want to change a word in it.

Code:
<?php
// The first variable
$text1 = 'Cailhem is a good boss';

// You want to replace the word "good" by "bad"
$text2 = preg_replace('#good#', 'bad', $text1);

// You print the second variable, changed
echo $text2;
?>


# : It is the delimiter for what you want to change.

Wink

-=~Splytte~=-

Splytte
Forumotion Member

Female
Posts: 737
Age: 22
Language: French, English, Dutch, Spanish, German, Japanese, Chinese (Beginner).
Location: Belgium
Country:
Join date: 2006-04-04

Back to top Go down

Re: Programming Advice

Post by RikaComet on July 24th 2009, 5:05 pm

hmm php not my stuff can you give me a example of this

just a reminder

i want the program to behave like this

i enter 'Hi"
it returns "hello" or anything definable

i need it to be capable to store thousands of such combinations Wink

RikaComet
Forumotion Member

Male
Posts: 1465
Age: 18
Language: English , Hindi , Arabic , Urdu, Japenese , Punjabi , German
Location: thing called Earth
Country:
Join date: 2008-09-01

Back to top Go down

Re: Programming Advice

Post by Placehold on July 24th 2009, 5:27 pm

Your also forgetting Splytte that that code you advised can only be used on a constructed code/website/forum which would also require Javascript in order to function in the first place.

I'll have a snoop around for a code you can actually use.

EDIT: Here is an example of a code that allows you to return predefined text if a certain word is entered, This script is however a SIMPLE version of an example.

Code:
<script type="text/javascript">
var text_only = function() {
  var retrn = document.getElementById("rtrn");
  if (retrn.value == "Hi") {
    alert("Hello ...");
    return true;
  } else {
    alert("Hi.");
    return false;
  }
}
</script>
<form method="GET" action="lookup_rtrnid"
    onsubmit="javascript:return text_only();">
 Say something: <input type="text" size="7" name="rtrn_id" id="rtrn"></input>
</form>


Again i made it simple so as not to confuse things, If the user types in 'Hi' the code then returns 'Hello', If they enter anything else apart from 'Hi' it returns 'Hi'


regards







Craig

Placehold
Forumotion Member

Male
Posts: 2047
Age: 24
Language: English
Country:
Join date: 2008-04-16

http://www.craigreville.com/

Back to top Go down

Re: Programming Advice

Post by Splytte on July 24th 2009, 5:58 pm

Well if you don't want it in PHP, I can't really help you sorry Wink

-=~Splytte~=-

Splytte
Forumotion Member

Female
Posts: 737
Age: 22
Language: French, English, Dutch, Spanish, German, Japanese, Chinese (Beginner).
Location: Belgium
Country:
Join date: 2006-04-04

Back to top Go down

Re: Programming Advice

Post by Cornelia on July 24th 2009, 8:27 pm

RikaComet wrote:hmm php not my stuff can you give me a example of this

just a reminder

i want the program to behave like this

i enter 'Hi"
it returns "hello" or anything definable

i need it to be capable to store thousands of such combinations Wink


"Not your stuff", because it was shown in a way that it looks complicated.
If you want to learn PHP, I suggest you this tutorial, even if the English might not be 100% perfect. The way it's explained makes PHP look easier to learn : http://www.newbiesparadise.com/tutorial-3-104-a-dynamic-site-using-php.html
Than, you complete with other sites' tutorials.

Cornelia
Forumotion Member

Female
Posts: 4731
Age: 25
Language: I'M NOT A TECHIE OR A MOD, SO QUIT SENDING ME PMS FOR TECHIE STUFF OR LOST PASSWORDS !!!
Location: /home/Canada/Quebec/Baie-Comeau
Country:
Join date: 2005-10-21

http://ishimaru-design.servhome.org

Back to top Go down

Re: Programming Advice

Post by RikaComet on July 25th 2009, 4:39 am

Placehold wrote:Your also forgetting Splytte that that code you advised can only be used on a constructed code/website/forum which would also require Javascript in order to function in the first place.

I'll have a snoop around for a code you can actually use.

EDIT: Here is an example of a code that allows you to return predefined text if a certain word is entered, This script is however a SIMPLE version of an example.

Code:
<script type="text/javascript">
var text_only = function() {
  var retrn = document.getElementById("rtrn");
  if (retrn.value == "Hi") {
    alert("Hello ...");
    return true;
  } else {
    alert("Hi.");
    return false;
  }
}
</script>
<form method="GET" action="lookup_rtrnid"
    onsubmit="javascript:return text_only();">
 Say something: <input type="text" size="7" name="rtrn_id" id="rtrn"></input>
</form>


Again i made it simple so as not to confuse things, If the user types in 'Hi' the code then returns 'Hello', If they enter anything else apart from 'Hi' it returns 'Hi'


regards




so how do use it.. some file can you put it in one?

@cornelia: thanks i knew that site from before when i started learning html
its so cool and easy that mateo guy is awesome

question" i remember that his site was more broad and was a it different looking ..did he renovated it perhaps? Wink

RikaComet
Forumotion Member

Male
Posts: 1465
Age: 18
Language: English , Hindi , Arabic , Urdu, Japenese , Punjabi , German
Location: thing called Earth
Country:
Join date: 2008-09-01

Back to top Go down

Re: Programming Advice

Post by Xiso on July 25th 2009, 7:50 am

Cornelia wrote:
RikaComet wrote:hmm php not my stuff can you give me a example of this

just a reminder

i want the program to behave like this

i enter 'Hi"
it returns "hello" or anything definable

i need it to be capable to store thousands of such combinations Wink


"Not your stuff", because it was shown in a way that it looks complicated.
If you want to learn PHP, I suggest you this tutorial, even if the English might not be 100% perfect. The way it's explained makes PHP look easier to learn : http://www.newbiesparadise.com/tutorial-3-104-a-dynamic-site-using-php.html
Than, you complete with other sites' tutorials.


Making her surprise appearance is Cornelia. Very Happy

Xiso
Forumotion Member

Male
Posts: 465
Language: English
Country:
Join date: 2009-05-06

Back to top Go down

Re: Programming Advice

Post by Splytte on July 25th 2009, 3:03 pm

Yep newbies paradize has become v3.0 a few times ago, before it was v2. For French, its siteduzero.com, much more complete.

-=~Splytte~=-

Splytte
Forumotion Member

Female
Posts: 737
Age: 22
Language: French, English, Dutch, Spanish, German, Japanese, Chinese (Beginner).
Location: Belgium
Country:
Join date: 2006-04-04

Back to top Go down

Re: Programming Advice

Post by RikaComet on July 26th 2009, 5:03 am

ok thanks
for now can some G.Mod temporarily lock this thread
i will have it open when i'm done with php

RikaComet
Forumotion Member

Male
Posts: 1465
Age: 18
Language: English , Hindi , Arabic , Urdu, Japenese , Punjabi , German
Location: thing called Earth
Country:
Join date: 2008-09-01

Back to top Go down

View previous topic View next topic Back to top


Permissions of this forum:
You cannot reply to topics in this forum