How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask TheDoctor Your Own Question

TheDoctor
TheDoctor, Professional w/Adv. Degree
Category: Homework
Satisfied Customers: 1528
Experience:  M.S. in Internet Information Systems
59032869
Type Your Homework Question Here...
TheDoctor is online now
A new question is answered every 9 seconds

"The Doctor" I need your help with javascript functions

Resolved Question:

"The Doctor" I need your help with javascript functions I need to validate two forms the same that we did the last time. Also I need help with mysql using cmd. I have created the tables but I allways get warnings and the out put is coming out scramble.
Submitted: 1 year ago.
Category: Homework
Expert:  TheDoctor replied 1 year ago.
Hello again! Thank you for requesting me.

Please send all details. You can upload files to http://ge.tt.

Once uploaded, you will be given a link on the right. Click on the 'Copy Link' option and then paste it here.

Thank you
Customer: replied 1 year ago.

http://ge.tt/6lkLdgc?c


 


Task #1 in the Javascript is done

Expert:  TheDoctor replied 1 year ago.
Thank you,

By when do you need this?
Customer: replied 1 year ago.

I have unit tomorrow 10PM If you need to see the screenshots of the tables let me know.

Expert:  TheDoctor replied 1 year ago.
Hello again,

I am not certain I understand what you want me to do with the Database part. Why would I want screenshots of tables?

What is it you are wanting me to do?
Customer: replied 1 year ago.

I need my work to be reviewed by you in order to find where is my error or if it is software problem or I need you to create the tables and so on.

Expert:  TheDoctor replied 1 year ago.
Send me screenshots of whatever you have and why you think there is an error.
Customer: replied 1 year ago.

http://ge.tt/5EPOkgc/v/0?c


 


For mysql lab

Expert:  TheDoctor replied 1 year ago.
The issue is that you are using not null with no default. See that it says that null is not allowed but the default is null. So when you specify an insert into 4 out of 17 columns, that leaves 13 columns with a default value of null even though null is not allowed.

Using not null is good practice, but you should set a valid default. For instance:

pool_available VARCHAR(20) NOT NULL DEFAULT '',

You see there that the default is an empty string. That is not the same thing as null. If you had the default as an empty string, you would receive no warnings. It is slightly disturbing that your instructor couldn't spot that issue. It's rather rudimentary.

You can drop your table and recreate it, or you can alter the columns. For instance:

ALTER TABLE offer1 CHANGE name name VARCHAR(20) NOT NULL DEFAULT '';

And if you would like your selects to output better at the command line, instead of ending them with a semicolon, end them with \G

Alright, beyond that, I just need to work on the JavaScript part?
Customer: replied 1 year ago.

I will try to fix it using default. I will let you know. I know this lab will separte so I will pay you separate. But let me see if I can fix it.

Expert:  TheDoctor replied 1 year ago.
Well, that is the issue and correct defaults would fix it. I will contact you about the JavaScript part.
Customer: replied 1 year ago.

I trying to use default using ALTER TABLE .... but it does not want to accept it. Do I need to insert some values between '', like default 'unknown' or 'o'.

Expert:  TheDoctor replied 1 year ago.
One moment please
Expert:  TheDoctor replied 1 year ago.
It is possible that it doesn't like it because you already have data in the database.

So do these queries first, for each row:

UPDATE TABLE offer1 SET name = '' WHERE name IS NULL;

Then

ALTER TABLE offer1 CHANGE name name VARCHAR(20) NOT NULL DEFAULT '';

If you run into errors, take a screenshot and show me. Thank you
Customer: replied 1 year ago.

I tried and got error see below link. But I think is better to drop the table and start a new one. But it is dinner time I would check your response later.


 


http://ge.tt/7aefKhc/v/0?c

Expert:  TheDoctor replied 1 year ago.

Well, you didn't enter the SQL correctly. You should be using ALTER TABLE for the alter table statement that I sent you.

And in the second one, it appears you are entering bad data as well. You should type in the queries as I sent them to you.

 

Are you running this on a local server on your computer?

 

Also, are you required to use CMD? You can't use MySQL Workbench?

Customer: replied 1 year ago.

Yes I am required to use CMD. I am running this on a local server, Apache.installed in a external usb drive.

Expert:  TheDoctor replied 1 year ago.
I can work on your database for you.

Go to your mysql bin directory and type:

mysqldump -p -u root database_name > dbdump.sql

Replace database name with the actual database name.

Then send me the dbdump.sql file.
Customer: replied 1 year ago.

http://ge.tt/3rrNnhc/v/0?c


 


dbdump.sql


 


I hope I did it correct.

Customer: replied 1 year ago.

It is very important that the database works because it will be used in connection with other files that we are doing. I so frustrated with it because if I miss something I have to start all over again. I wish I could use something more friendly and easy to edit, copy , paste etc.

Expert:  TheDoctor replied 1 year ago.
You dumped a database called mlopez which has no tables in it according to the dump file. Is that the right database?
Customer: replied 1 year ago.

Yeah, I dropped the previous tables due to many errors and warnings. You may do table offer1 and request1 again based on the instructions.


 

Expert:  TheDoctor replied 1 year ago.
Alright. I will contact you once everything is complete.
Customer: replied 1 year ago.

http://ge.tt/41NjEic/v/0?c


 


This document has the suggestions from the Prof. based on what we did the last week. I disagree with part of his comments because the lab instructions did not specify what items I needed to include in the forms. Now, it starts to make sense because this week we need to work on the forms items which are the same for the database lab. Remember that for this week I do not have to do all the project instructions attached. I am sending this to you just for adding the missing items to the forms and some javascript to validate the information input.

Expert:  TheDoctor replied 1 year ago.
Well, I'm glad your instructor seems more pleased.
Expert:  TheDoctor replied 1 year ago.
Hello again!

You can download the completed assignments here:


The database.docx file contains all of the required SQL and screenshots for your database assignment.

The mlopez.sql file is an sql dump so that you can import it into your database. Make sure that you have an mlopez database and that it has no tables in it. Then you import it by place this file into the same directory as your mysql and running:

mysql -u root mlopez < mlopez.sql

This will create the tables and insert the data for you.

For the other assignment, the check. js contains the JavaScript for the form validation. The project.zip contains all of the files for the project. And the JavaScript.docx contains the code and screenshots for that assignment.

Everything should be ready for you to turn in. Let me know if you have any questions. I'm here to help.

Please remember to rate my answer. Thank you so much!
Expert:  TheDoctor replied 1 year ago.
THIS ANSWER IS LOCKED!
You can view this answer by clicking here to Register or Login and paying $3.
If you've already paid for this answer, simply Login.
TheDoctor, Professional w/Adv. Degree
Category: Homework
Satisfied Customers: 1528
Experience: M.S. in Internet Information Systems
TheDoctor and 8 other Homework Specialists are ready to help you
Customer: replied 1 year ago.

Thanks for your prompt reply. I will follow your instructions and let you if I have any problems. Please check rating and make your that you get pay.

Expert:  TheDoctor replied 1 year ago.
Hello again!

Yes, I received your rating. I am very grateful. You are an excellent customer.

Please let me know if you have any follow-up question.

Thank you
Customer: replied 1 year ago.

Yes I do in case the Professor ask me questions. What I put in Bold is the part that I do not understand.


 


<script src="DANGEROUS URL REMOVED" type="text/javascript"></script> Is this statement connect the check.js with the other php pages?


 


<input type="checkbox" name="am[]" id="gym" value="gym" />


Is this name something special or you just like it?


The webpages work very nice, thanks


 


I still have not checked the databe, let you know.


 


Expert:  TheDoctor replied 1 year ago.
The script part is an external JavaScript file, just like an external CSS file. Because the same JavaScript code is used in both Offer and Request, it would be extremely bad form to place the code in the HTML files. The HTML files should share the code in one external file.

That name is XXXXX XXXXX it MUST have the open/close brackets. This is required for PHP. This will allow us to loop through the am array once the form is submitted to the PHP form. That way, we can very quickly and easily tell which amenities have been selected.
Customer: replied 1 year ago.

http://ge.tt/53EQRmc/v/0?c


 


I moved the .sql file to my xampp\mysql\bin, but it does not show tables see screenshots.


Thanks

Expert:  TheDoctor replied 1 year ago.
From looking at the screenshots, the import did not work. Try running it without the p option. Run it exactly as I gave it to you. Also,make certain the file is in the same directory as mysql.exe.

When I run the command it works. If you get that long list of mysql options, then it didn't work. You only get that when it cannot figure out what you are trying to do.

If you cannot get the file imported, then take note that all of the required SQL is in the word document for that assignment. You could simply run the queries yourself. Just make sure you type them in correctly.

All of the queries are accurate, shop if you get a syntax error, check you typing. Odds are that you have a typo

Thank you again.
Customer: replied 1 year ago.

Just to give you an update. I tried without -p but it did not take because I have a password. So, I created the tables following your statements. It worked fine. I was afraid to use double so I entered varchar and tinyint for everything. Maybe you know the answer to these issues that I still have. When I do for instance, SELECT * FROM offer; I get a scrambled table and the Prof told me that they will look perfect as soon as we implement PHP to the tables. I noticed that your tables display vertically with no grids or boxes. How do you make that happen? Because you used \G insead of ;? Going back to javascript, can you give me a brief explanation of this part: if(!1) { 1=3 } and .trim(e.val()). Thank You and I am sorry for asking too many questions . I will contact you soon for the next part that is due next Monday. Thanks God I do not have take another class in web development.

Expert:  TheDoctor replied 1 year ago.
Hello again,

How the output from MySQL looks in CMD has absolutely nothing whatsoever to do with PHP. Not even remotely. Command-line MySQL will always look "scrambled" if the length of the columns to be displayed from a select is wider than the command window. It automatically wraps everything, which results in a "scrambled" display. PHP has nothing to do with MySQL command line. PHP is used to create web site. It will look fine once you use PHP because the data will be pulled from the database and displayed on a web page using HTML elements and formatted any way that you want.

When using command-line MySQL, you have the option of ending your select statements with \G instead of a semicolon. This tells it to display the result vertically rather than horizontally. This option exists so that you can get results that have too many columns to display vertically and still be readable.

That JavaScript function takes a passed in argument of l (lower case L), which is the length that we are testing for. The default is three, as per the instructions. If no length is passed into the function, then it is set to 3. When checking the bedrooms fields, we pass in 1 because that fields should allow a single character. Otherwise, the site would not allow apartments with fewer than 100 bedrooms.

e is a reference to one of the elements (which ever is currently being passed into the function). .val() gets the value of the element (i.e., whatever you type into the form fields). $.trim (the dollar sign is important), trims off any extra white space from the beginning and the end of the string. That way, if a user attempts to enter a bunch of spaces, that will not pass the check. If we did not trim, then the spaces would be counted as valid characters.
Expert:  TheDoctor replied 1 year ago.
By the way, changing the doubles to VARCHAR is an extremely bad thing to do. Very, very, very bad. It will mess up your site later and, if I were your instructor, you would lose major points. We are talking about money, which is a real number. A number is XXXXX completely different than a character field.

Let's say that you have an apartment that is $800 and an apartment that is $1000 and we want to sort the list in the web site by the rent price.

If you sort that field and it is a var char, here is the order:

1000
800

If you sort it and it is a double, here is the order:

800
1000

Also, if it is a real number, then you can do a search with between. So, if a user enters a range while searching for an apartment, we can easily sear for:

WHERE rent BETWEEN 900 and 1500

Since you made it a character field instead, we cannot do that. It is no longer a number so doing anything number-based on the field will stop working. You won't be able to sort by rent correctly, or search within a range.

You cannot use VARCHAR for everything. Different data types are handled differently. If you use VARCHAR for the date fields, for instance, you will no longer be able to query the database for items within a certain date range. You will pretty much make your site completely non-functional when you get to the point of actually adding the database to the site.
Customer: replied 1 year ago.

I agree with you. Can I do the changes without creating more conflicts in the tables?. I think this coming week that we have to do PHP we need to make these connections. Thanks again, I am learning a lot from you.

Expert:  TheDoctor replied 1 year ago.
I'm not sure what you are referring to by "changes". The database should be implemented exactly as I sent it to you. That way, the site will have the various database-level numeric functionalities when it is integrated with the web site.

Doubles are very easy to understand. They contain numbers and only numbers, with decimal places. You cannot put dollar signs or anything like that.

The two length values are:

Total number of digits
Number of digits to the right of the decimal place

So, when you see DOUBLE(8,2), that means that it can be an eight digit number, two of which are to the right of the decimal point. So it is a field that can hold a number with a max of six significant digits and two decimal values. The max value would be:

999999.99
Customer: replied 1 year ago.

What I meant with "changes" was to put the table exactly the way that you gave it to me. Although it is already created.

Expert:  TheDoctor replied 1 year ago.
You could just drop it and recreate it. Changing it would likely be more bothersome.
Customer: replied 1 year ago.

I am sorry to disturb you. But it appears that you did not get another message that I sent you yesterday. The Prof is asking me to submit the jquery codes that I used. Did we use any jquery on the web pages? Otherwise, I do not know that he is talking about. I want to make sure before I open my mouth. Maybe tomorrow I will send you the PHP Lab that is due Sunday night unless he changes the date.

Expert:  TheDoctor replied 1 year ago.
Your previous message was not posted.

The check. js file contains your jQuery code.
Customer: replied 1 year ago.

Thanks, XXXXX XXXXX get check.js file so I guess I need to talk to him because he took points from the HW.

Expert:  TheDoctor replied 1 year ago.

Tell him that if he bothers to look in check. js, he will see that it is written using jQuery. You put your jQuery into an external file because it is used for both the request and the offer forms. Placing code that is reused in multiple form inline would be extremely poor form.

Point out these items:

$(e).next().remove();

$.trim(e.val())

$(passed).insertAfter(e)

isEmpty($('#name'));


All of that is jQuery. And it is good jQuery.

Expert:  TheDoctor replied 1 year ago.

Can you tell me exactly what the instructor's comments about the jQuery were?

 

Perhaps he was referring to the jQuery library? I don't see why he would be. Your project links to the latest jQuery library. The jQuery library itself is not in your project folders. However, your check. js is written using jQuery. Many professional web sites link out to jQuery rather than having a static document in the web directory. But you can also include it locally as a static file. If that is what he wants, then download this copy of the project:

 

Attachment: 2013-04-04_040644_withlocaljquery.zip

 

I don't think that is what he is referring to, as it really makes no difference. The check. js is written using jQuery code.

Customer: replied 1 year ago.

I asked him in an eamil. He was talking about another folder that I submitted not related to your codes. But I think that he likes src=jquery-1.9.1,js which is version that we are using. Anyway, he just picky. I am going to deposit more money to start working in the task.

Expert:  TheDoctor replied 1 year ago.
Hello again,

Yes, your instructors does seem infuriatingly picky.

Whenever you are ready, go ahead and enter a new question. Please remember to start it with **For TheDoctor**. Thank you.
Customer: replied 1 year ago.

Just checking with you. Some of your replies went to my aol account instead to my yahoo account. In the last reply from you the "reply to Expert" window did not show up. So I am using this one which belongs to something that we already worked. I wanted to make sure that we are not having technical difficulties with your pending reply from last night HW request.

Expert:  TheDoctor replied 1 year ago.
Please reply on the question to which you are referring. I work with hundreds of individuals, so using two different accounts makes it extremely difficult for me to follow which question thread you are referring to. Go to the question you are referring to and reply there.

Thank you
Customer: replied 1 year ago.

It does not have the reply to expert window. See photo attached. I am the guy with the apartment project


Attachments are only available to registered users.

Register Here

Attachments are only available to registered users.

Register Here

Attachments are only available to registered users.

Register Here
View Full Image

Attachments are only available to registered users.

Register Here

Expert:  TheDoctor replied 1 year ago.
Your image did not come through.

I just replied to you in that question.
Expert:  TheDoctor replied 1 year ago.
Make sure that when you go to that question, you log into that account. You entered that question with a different, brand-new account than this one. So if you are going to that question while logged in to this account, you are not the customer on that question. You are using two different accounts.
Customer: replied 1 year ago.

http://ge.tt/7AY6pJd/v/0?c


the attachment is a copy of your last reply but I cannot reply because there is no reply text box. I think is because you are using my aol account. We have always used my yahoo account with no problem. Please use yahoo. Yes, I did change the name of the tables to offer1 and request1 because I had to create them again the same way that you sent them to me. I already deleted the old ones. I hope we can fix this technical problem it is very difficult for me and for you.

Expert:  TheDoctor replied 1 year ago.
The reason that you do not have a reply box is because you opened a new account and you are viewing the question in a different account than you asked the question in. The account that you are using right now is not the account that asked that question. You opened a brand new account with JustAnswer and asked that question.

I cannot assist you with any issue you are having replying to the question. I do not work for JustAnswer and cannot assist you with anything to do with the site. I can tell you that you have to completely separate accounts (different logins to JustAnswer) that you are using and you did not use this one to open that question.

If you have further questions, you must contact JustAnswer support.

support@justanswer.com

JustAnswer in the News:

 
 
 
Ask-a-doc Web sites: If you've got a quick question, you can try to get an answer from sites that say they have various specialists on hand to give quick answers... Justanswer.com.
JustAnswer.com...has seen a spike since October in legal questions from readers about layoffs, unemployment and severance.
Web sites like justanswer.com/legal
...leave nothing to chance.
Traffic on JustAnswer rose 14 percent...and had nearly 400,000 page views in 30 days...inquiries related to stress, high blood pressure, drinking and heart pain jumped 33 percent.
Tory Johnson, GMA Workplace Contributor, discusses work-from-home jobs, such as JustAnswer in which verified Experts answer people’s questions.
I will tell you that...the things you have to go through to be an Expert are quite rigorous.
 
 
 

What Customers are Saying:

 
 
 
  • Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help. Mary C. Freshfield, Liverpool, UK
< Last | Next >
  • Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help. Mary C. Freshfield, Liverpool, UK
  • This expert is wonderful. They truly know what they are talking about, and they actually care about you. They really helped put my nerves at ease. Thank you so much!!!! Alex Los Angeles, CA
  • Thank you for all your help. It is nice to know that this service is here for people like myself, who need answers fast and are not sure who to consult. GP Hesperia, CA
  • I couldn't be more satisfied! This is the site I will always come to when I need a second opinion. Justin Kernersville, NC
  • Just let me say that this encounter has been entirely professional and most helpful. I liked that I could ask additional questions and get answered in a very short turn around. Esther Woodstock, NY
  • Thank you so much for taking your time and knowledge to support my concerns. Not only did you answer my questions, you even took it a step further with replying with more pertinent information I needed to know. Robin Elkton, Maryland
  • He answered my question promptly and gave me accurate, detailed information. If all of your experts are half as good, you have a great thing going here. Diane Dallas, TX
 
 
 

Meet The Experts:

 
 
 
  • Manal Elkhoshkhany

    Tutor

    Satisfied Customers:

    4522
    More than 5000 online tutoring sessions.
< Last | Next >
  • http://ww2.justanswer.com/uploads/BU/BusinessTutor/2012-2-2_115741_Kouki2.64x64.jpg Manal Elkhoshkhany's Avatar

    Manal Elkhoshkhany

    Tutor

    Satisfied Customers:

    4522
    More than 5000 online tutoring sessions.
  • http://ww2.justanswer.com/uploads/ComputersGuru/2010-02-13_051118_Photo41.JPG LogicPro's Avatar

    LogicPro

    Engineer

    Satisfied Customers:

    3458
    Expert in Java C++ C C# VB Javascript Design SQL HTML
  • http://ww2.justanswer.com/uploads/LI/lindaus/2012-6-10_04811_IMG20120609164157.64x64.jpg Linda_us's Avatar

    Linda_us

    Finance, Accounts & Homework Tutor

    Satisfied Customers:

    3124
    Post Graduate Diploma in Management (MBA)
  • http://ww2.justanswer.com/uploads/chooser77/2009-08-18_162025_Chris.jpg Chris M.'s Avatar

    Chris M.

    M.S.W. Social Work

    Satisfied Customers:

    2385
    Master's Degree, strong math and writing skills, experience in one-on-one tutoring (college English)
  • http://ww2.justanswer.com/uploads/JawaadAhmed/2009-6-27_12137_SIs_SHadi.jpg F. Naz's Avatar

    F. Naz

    Chartered Accountant

    Satisfied Customers:

    1988
    Experience with chartered accountancy
  • http://ww2.justanswer.com/uploads/JK/jkcpa/2011-1-16_182614_jkcpa.64x64.jpg Bizhelp's Avatar

    Bizhelp

    CPA

    Satisfied Customers:

    1876
    Bachelors Degree and CPA with Accounting work experience
  • http://ww2.justanswer.com/uploads/avremote/photoa.jpg Seanna's Avatar

    Seanna

    Tutor

    Satisfied Customers:

    1781
    3,000+ satisfied customers, all topics, A+ work
 
 
 

Related Homework Questions