riahc3 50 Â Team Colleague

Here is a quickie:

//declare another integer called x
while i <= Length(sEmail) do

  begin

    while x <= Length(ALLOWED) do
     begin

       if sEmail[i] = ALLOWED[x] then
         begin
               bResult := true;
               break;
         end;
       else
       begin
             bResult := false;
     // break;
         end;
           Inc(x) ;
     end;  
     Inc(i)

  end; 

Code is as-is and untested. Also very dirty and there are 1000000s of better ways to do this.

BTW, pritaeas is right: With this you are just validating if it is a email, not a proper email.

riahc3 50 Â Team Colleague
if sEmail[i] in [ALLOWED[1] .. ALLOWED[Length(ALLOWED)]] then 

I cant find any documentation on a "if.......in......then" statement.

riahc3 50 Â Team Colleague

OK, from debugging I see your problem is in the while....

Debugging some more as I havent done Pascal in a LONG time.

riahc3 50 Â Team Colleague

Id take a hack at it (putting it on my PC and testing it) but is this Pascal or Delphi? Looks like Delphi...

Mya:) commented: Yes it is delphi. +0
riahc3 50 Â Team Colleague

Liked that so much, its in my sig now :P

riahc3 50 Â Team Colleague

you're repeating code.

In all sincerity, I have never really cared. I perfer repeating code 100 times and program takes up 100MB in memory rather than not repreat code and the program take up 1MB. To me, a program should be made so I can understand and it does what it is suppose to do.

Ive said several times I am not a great programmer, I just program (and dont like it) so....thats my point of view and Im sticking to it.

riahc3 50 Â Team Colleague

As for #1, it looks like it's supposed to be "factorial"; that's what n! usually means. #4 makes sense that way, too.

OK.

riahc3 50 Â Team Colleague

1- write a java programm which calculate the Faculity of a given numbe n (n!).
2-a) write a java programm which reads a typed number and prints it out : if n neative : "input number is negative"
if n positiv : "input number is positiv" , if n = 0 : "input number is Zero"
2-b) epand your program : if input number n is positiv then : is it odd or even ? ( use if else struct inside the posivie 2-a) )
2-c) expand your program : if the input nuber is between 1 - 7 then print out the corresponding day 1 = Monday .... 7 = sunday ( use Switch construct )
3-a) write a java program that : reads 10 numbers and gives out the max . min , and the Midvalue ( use "for loop")
3-b) implement the program from 3-a) with "while loop"
3-c) implement the program from 3-a) with "do-while-loop" in this case positiv numbers are to be typed as input and as soon as the input number is negative the program will give the results (min , max , midvalue ) and stop .
4- make a java-class which solve Question 1 (n!) with for-loop . the number n is to be typed with the keyboard.

Here we go:

1: No idea what is a Faculity
2a:

Scanner input=new Scanner(System.in);
        try
        {
            do
            {
                System.out.println("Insert a number");
                String …
ddanbe commented: first time I do this -3
riahc3 50 Â Team Colleague

First result on Google

public static boolean isInteger(String s) 
{
    try 
    { 
        Integer.parseInt(s); 
    } 
    catch(NumberFormatException e) 
    { 
        return false; 
    }
    return true;
}

Use this and it will return true or false depending...

riahc3 50 Â Team Colleague

Possibly the worst advice of 2013 so far in this forum. Even if you never write a single program for real, even your teacher will read and mark your code. Coding standards and conventions are there to help everybody, and the sooner you engrain all the right habits the better.

I disagree.

If noone is going to read your code, name things however you feel like that makes sense to you and you remember it. This of course if only YOU are going to read the code.

I shouldnt prepare my code for others.

One of the most important things when coding is commenting; Commenting is more for you than others as you maybe one day see your code again and say "Why did I do that?". It makes life so much easier.

But other than that? If you want to name two int variables HiIAmBerry and another one klshldgfkjhsgfdj and add them up to a ohrlylolo varaible, be my guest! As long as you comment them and later remember why/what they do

riahc3 50 Â Team Colleague

And about the jar/exe thing.........I THOUGHT a jar was made when you ran but you have to change some setting. Ill look it up.

riahc3 50 Â Team Colleague

I ment that if you want to call it Play, call it Play. If you want to call itkljsdgkjhdskjg, call it that. Whatever is clearest to you...

riahc3 50 Â Team Colleague

Thank you for the quick response bguild. That was carelessness on my part about the Play method naming.

Personally, dont listen to bguild; In most cases, noone sees your code except you. You dont need to write how a set of code conventions state. You write the code however it is clearest/makes sense to you. First, write the code how it is clearest to you, the developer. THEN do things to better the code, optimize, etc.

I think a precomplied jar/exe would have been nice to test your program out...Was your program free choosing (you choose to do this) or assigned?

riahc3 50 Â Team Colleague

Its a good excerise, Java or not.

I'd like to hear comments on the way I code, what are my strong points, what should I improve, am I using bad logic?

The way someone code is very personal, for me. Makings lots of classes with no comments is the same as making one big entire class with lots and lots of comments. People are object obsessed and I believe programming is what is easier for you to read, not better organized (Exceptions are using a if 1==1 vs a while(1==1) and at the end change 1 to another number, if its a simple condition; You obviously use the if).

A good thing that is done is to think and write down what to do before you code it. Makes things a lot easier and faster. I dont do it personally but I agree that it is better.

riahc3 50 Â Team Colleague
public void main ()
{

}

Its clean, its a effective. I have NEVER understood why the hell people put { on the same line as the function. Its not clear.

riahc3 50 Â Team Colleague

Programming generally sucks. Period.

Web programming, although it sucks even more, gets better paid. Do note that you have to know A LOT more languages: PHP, JS, HTML, Flash (yes, Flash), etc with others.

riahc3 50 Â Team Colleague

BTW, thats just "working" code. I have no idea what you want to acomplish.

riahc3 50 Â Team Colleague

Work from this:

package tests;

import java.util.Scanner;

public class Tests 
{

    /**
     * @param args
     */
    public static void main(String[] args) 
    {
        Scanner scan = new Scanner(System.in);
        String names[]=new String[0];
        int rooms[]=new int[0];

        do
        {
             int choice=0;
             System.out.println("\n\nMENU ");//menu
             System.out.println("1) Add Guest");
             System.out.println("2) View All Rooms");
             System.out.println("3) Display Empty Rooms");
             System.out.println("4) Find Room From Customer Name");
             System.out.println("5) Store Program data into file");
             System.out.println("6) Load Program from data file");
             System.out.println("7) View Rooms Alphabetically");
             System.out.print("Choice: ");
             choice=scan.nextInt();
             if((choice==10) || (choice ==0))//either or
             {
                 break;
             }
             char inputChar = (char)scan.nextLine().charAt(0); //No idea what you are trying to do here
             switch(inputChar)
             {
                case 'A':
                 addGuest(names);
                 break;
                 case 'V':
                 viewRooms();
                 break;
                 default:
                 break;
             }


        }while(true);


    }


     public static void addGuest(String[] names)
     {
         //Add Guest
         Scanner sc = new Scanner(System.in);
         //sc.nextLine();
         System.out.print("Please enter your guest: ");
         String guest=sc.nextLine();
         names=addName(guest,names);
         System.out.print("Room: ");
         int room=sc.nextInt();
         rooms=addRoom(room,rooms);
         //sort rooms by ascending... don't use arrays.sort!
         for(int x=0;x<rooms.length;x++)
         {
             for(int y=0;y<rooms.length;y++)
             {
                 if(rooms[x]<rooms[y])
                 {
                     int dummy=rooms[x];
                     String dummy2=names[x];
                     rooms[x]=rooms[y];
                     names[x]=names[y];
                     rooms[y]=dummy;
                     names[y]=dummy2;
                 }
             }
         }
      }



}
riahc3 50 Â Team Colleague

Im downloading the Java 7 JDK.....

Just like others have said, we are trying to help you but we have no ideas what your main goal is and/or what you currently know.

riahc3 50 Â Team Colleague

i never said i used the etc etc i know what that means and i aint stupid to write that in the program...
i never said write the damn program for me!!
NO THANKS FOR UR HELP!!

First you need to calm the fuck down. Thats first off.
Second, posting in the wrong section and being told that Java 7 has this feature and answering you are using Netbeans means that Java is pretty new for you (Id say even programming in general is new for you but oh well...)

I see you have 2 initialise functions with different types of parameters. You should really name them differenly to know exactly what is going on in your program.

We need some more explainations on what exactly you want to acomplish.

riahc3 50 Â Team Colleague

You can start by posting your question in the java forum instead of VB.Net. Consider it moved.

I doubt it but maybe he wanted to make it simple by porting it to VB .NET (doubt it but anything is possible)

riahc3 50 Â Team Colleague

I go to "edit profile", clicked on the "update member profile" button and log out. After that, the only way (for me) to login is to reset my password,

The only thing that can remotely have to do with it (I doubt it is thing) is that if you click edit profile, you can edit your password. If you dont do anything and click update member profile, technically (I imagine there are checks against this but...) your password is set to "". Daniweb's DB might not allow that and cause problems.

Its the only thing I can up with...

Nick Evan commented: Yup! +0
riahc3 50 Â Team Colleague
riahc3 50 Â Team Colleague

I'm using noconflict as below

Personally I do not use the noconflict function like that and I too use Prototype and jQuery.....

I declare, in a totally diferent .js file:

$j = jQuery.noConflict();

Meaning that when ever I want to use a jQuery thing in another library/function/etc, I call $j. Example:

var somevariable = $j("#somecomboboxid").val();
riahc3 50 Â Team Colleague

Another thing, I you sure it is a jQuery and not a plugin coding problem?

Looking at the source:

<div id="rotate" class="mc-cycle" style="visibility: visible; position: relative; width: 821px; height: 578px; overflow: hidden;">
<div class="mc-image mc-image-n0" style="height: 578px; width: 821px; position: absolute; top: 614px; left: 0px; display: none; z-index: 41; opacity: 1;">
<img src="http://www.aaronvanderzwan.com/maximage/2.0/lib/images/demo/coalesse.jpg" style="height: 616px; width: 821px; margin-left: 0px; margin-top: -109px;">
</div>
<div class="mc-image mc-image-n1" style="position: absolute; top: 614px; left: 0px; display: none; z-index: 41; width: 821px; height: 578px; opacity: 1;">
<div class="mc-image mc-image-n2" style="position: absolute; top: 614px; left: 0px; display: none; z-index: 41; width: 821px; height: 578px; opacity: 1;">
<img src="http://www.aaronvanderzwan.com/maximage/2.0/lib/images/demo/laughing.jpg" style="height: 616px; width: 821px; margin-left: 0px; margin-top: -109px;">
</div>
<div class="mc-image mc-image-n3" style="position: absolute; top: 614px; left: 0px; display: none; z-index: 41; width: 821px; height: 578px; opacity: 1;">
<div class="mc-image mc-image-neach" style="position: absolute; top: 578px; left: 0px; display: none; z-index: 41; width: 364px; height: 313px; opacity: 1;">undefined</div>
<div class="mc-image mc-image-neachSlice" style="position: absolute; top: 578px; left: 0px; display: none; z-index: 41; width: 364px; height: 313px; opacity: 1;">undefined</div>
<div class="mc-image mc-image-nall" style="position: absolute; top: 578px; left: 0px; display: none; z-index: 41; width: 364px; height: 313px; opacity: 1;">undefined</div>
<div class="mc-image mc-image-nany" style="position: absolute; top: 578px; left: 0px; display: none; z-index: 41; width: 364px; height: 313px; opacity: 1;">undefined</div>
<div class="mc-image mc-image-ncollect" style="position: absolute; top: 578px; left: 0px; display: none; z-index: 41; width: 364px; height: 313px; opacity: 1;">undefined</div>
<div class="mc-image mc-image-ndetect" style="position: absolute; top: 578px; left: 0px; display: none; z-index: 41; width: 364px; height: 313px; opacity: 1;">undefined</div>
<div …
riahc3 50 Â Team Colleague

OK, several things pop into mind

1: Does FireBug throw any errors?
2: Are you sure you are using jQuery's noconflict correctly?
3: http://forum.jquery.com/topic/noconflict-does-not-work

Lets see those three points and see if we can see something.

riahc3 50 Â Team Colleague

the Django(Python) code is for the server side

Yes, this is what I meant. Im almost sure that in Django the Python code is server side.

riahc3 50 Â Team Colleague

Django is written in Python which AFAIK only is server side, for web applications (It can be used client side but there is few support on browsers or it does not come out of the box) . Javascript is client side and supported on all browsers out of the box.

riahc3 50 Â Team Colleague

Certainly was one of my problems! Thankyou very much for your assistance - I have half of my script working now - the values are being passed.

Now I just need to make the <option></option> appear in my second menu now that the array is responding with ["1","2","3"].

I was advised not to put html in my ajax.php file for some reason. So now to figure out how to spit it out :)

Step by step.....Thats good that now it replies.

I imagine that now that you know how Firebug/AJAX works you will have more knowledge on how to debug this. You could also download FirePHP to debug even further.

riahc3 50 Â Team Colleague

I just noticed something when I was posting your code on here to reply to you:

$t2=$_GET["t2choice"];

Should be

$t2=$_POST["t2choice"];

Sorry about that.

The reason it works when you directly call http://yoursitee.com/ajax.php?hi=hello is because there you are passing it as a GET value and not as a POST value while in this AJAX call you are passing it as a POST value and your ajax.php expects a GET value. Try this out.

So you can do that or change in the ajax call to "type:GET" or put (not recomended)

$t2=$_REQUEST["t2choice"];

My personal recommendation is to change in the ajax.php to a $_POST

JayJ commented: Superb spot! Thankyou very much! +2
riahc3 50 Â Team Colleague

Here is a bit how you would see what I see.

You open up Firebug and refresh the page. You hit that tab (it should be network) and then change the dropdown to something else. As soon as it does that, you should see POST ajax.php appear. From there you can select Post, which will show the post variables passed. Reply which shows the reply the PHP page has sent back. And HTML which is like Reply but if the Reply has HTML code, it will be rendered as such.

http://img145.imageshack.us/img145/5854/44653098.png

I put a PNG just in case. Any questions just ask

riahc3 50 Â Team Colleague

OK, just looked at it....

Good news: Your parameters are being POSTed corrected, the page can be reached and it replies. Bad news: Its repling "".

Just in case do this test on your ajax.php page:

<?php 
$t2=$_GET["t2choice"];
echo $t2;
?>

This should just send back what you POSTed as a reply....

riahc3 50 Â Team Colleague

Ill have to leave in less than 8 minutes so if I dont reply its because of that...

riahc3 50 Â Team Colleague

By your post, then yes, you should do change on t2. Whenever you change on t2, you modify t3.

riahc3 50 Â Team Colleague

Trust me, AJAX is a bitch so its normal the first time around this doesnt work :P

You can see AJAX events (with POST and GET) using Firebug. In the network tab, whenever a change is made (in your case as thats the event being fired) it should show the call. It should show you the reply, HTML reply, POST/GET etc.....

As a matter of fact, if you want, PM the address as I can see the page you call yourself and I can see what you pass and the reply. I cant see the PHP code (dontworry) just the reply and what is passed.

riahc3 50 Â Team Colleague

Apologies - thats my lack of simplifying my code. brigade should read t3choice

I have adjusted both var to .val as you suggest that both should be the same. This is where I have been going wrong as I have been lifting snippets of code from various sources and piecing them together.

Firebug pointed out a missing "}" - and then a missing ")" - not sure where these are from, but having placed those no further errors are showing.

Upon changing the value of the first drop-down, the second menu is not displaying.

Thankyou very much for your assistance so far

No problem, we all copy/paste....

Anyways, thats one important step: No errors such as missing ")" or "}".

But, you said it should be "t3choice". Personally that makes no sense; When you change t2choice, it should populate t3choice, not the other way around.

I apoligize if I am not understanding something correctly.

riahc3 50 Â Team Colleague

Also, I personally dont know what "brigade" is. Does Firebug's console do anything when the event change is fired on brigade?

riahc3 50 Â Team Colleague

Why

var t2choice = $('#t2choice').attr('value');
var t3choice = $('#t3choice').val();

?

They SHOULD both be the same but...

riahc3 50 Â Team Colleague

Id start with FirePHP and tell us if thats good enough or if something is missing...

riahc3 50 Â Team Colleague

Yes, you already said that in your first post.
The code you have posted in not valid Java. It won't compile, and therefore cannot be executed. So how about posting the actual code that gave you the error?

I could have sworn I commented that....

I gave you what I THINK it could be......if you dont post the entire code, we have no idea.

riahc3 50 Â Team Colleague

Looks like you should use 149.....

Remember positions start at 0 and end at one less of your declared value.

Example:

int[] hi=new int[5];

Has these positions:

hi[0]
hi[1]
hi[2]
hi[3]
hi[4]

riahc3 50 Â Team Colleague

I found this:

http://codeigniter.com/wiki/jQuery

It doesnt work?

riahc3 50 Â Team Colleague

1st, spamming is not allowed here and one of the reasons you have been ignored by many is that reason.
2nd, DETAILS. "website as a project so how to create database ,and connect asp page to C# code" is not a explaination of what you are trying to do. Do you want to print information from the database on the page? Do you want to read information from the page and insert it into a database? What database is this? What version of .ASP? DETAILS
3rd, We are not your mother and you are not our child: Spoonfeeding is not something that occurs here.

I hope that my post helps you make your post a lot better. Maybe then someone will help you....

Zorrro commented: Spamming?? Are u nuts? +0
riahc3 50 Â Team Colleague

The only reason is called "free". Nothing more, nothing less.