Jump to content

hisoka

Members
  • Posts

    569
  • Joined

  • Last visited

Everything posted by hisoka

  1. hisoka

    html

    "if the encoding was not declared in the above script how did the browser display the characters correctly?" answer : "Even though those elements aren't present in your code, the browser implicitly adds them" The browser will find the proper encoding type by itself . I am interested in knowing how , technically, this process is done . Any link or links to read would be appreciated
  2. hisoka

    html

    using this link : http://validator.w3.org/ I tried to validate this script and there was an error <!DOCTYPE html><html><title>Page Title</title><body> <h1>This is my first web page</h1> </body></html> (output : This is my first web page)The character encoding was not declared. Proceeding using windows-1252. if the encoding was not declared in the above script how did the browser display the characters correctly?
  3. hisoka

    html

    This : "The <head>...</head> holds links to external scripts, css, along with meta tags including title (which is required), the last two are picked up by search engines as part of SEO to describe the page content" is equal to this : Web search engines work by storing information about many web pages, which they retrieve from the HTML markup of the pages. These pages are retrieved by a Web crawler (sometimes also known as a spider) — an automated Web crawler which follows every link on the site. The site owner can exclude specific pages by using robots.txt. The search engine then analyzes the contents of each page to determine how it should be indexed (for example, words can be extracted from the titles, page content, headings, or special fields called meta tags). Data about web pages are stored in an index database for use in later queries. A query from a user can be a single word. The index helps find information relating to the query as quickly as possible So without <head><title></title><head>the web search engines would not be able to store information about the webpage content and analyse it , collect it , parse it , optimized it for the sake of the facilitation ,specification , quickness and efficacy of the information retrieval through queries and therefore the user or client would not be able to find the desired content and /or data of the webpage in the desired way. "<body>...</body> should hold html that will make up the website page and is viewable to the user visiting your site." the <body> </body> plays the role of containing the html data that are responsible for the page viewed by the client . Can we say that <body> </body> is like a VARIABLE ?????? What are the other drawbacks or disadvantage of not using <head></head> ???
  4. hisoka

    javascript

    in this tutorial http://www.w3schools.com/js/js_validation.asp there is this script : function validateForm() { var x = document.forms["myForm"]["fname"].value; if (x == null || x == "") { alert("Name must be filled out"); return false; }} I do not understand this : var x = document.forms["myForm"]["fname"].value; this : document.forms["myForm"]["fname"] is an array so why it is not like this ?? var x = ["my form" , "fname"]; and why it is between two strings (document.forms and value) : document.forms["myForm"]["fname"].value it confuses me . I cannot understand this
  5. hisoka

    html

    this : <!DOCTYPE html><html><title>Page Title</title><body> <h1>This is my first web page</h1> </body></html>and this : <!DOCTYPE html><html><body> <h1>This is my first web page</h1></body></html>and this<!DOCTYPE html><html><head> <title>My first web page</title></head><body> This is my first web page</body></html>and this<!DOCTYPE html><html><body> This is my first web page</body></html>give the same result1)if , in these examples, we can get the title without using <title>Page Title</title> so <title>Page Title</title> is useless !!?2)if we can get the title only using <title>Page Title</title> without <head></head> so <head></head> is useless too !!?"the <head> Defines information about the document" . does it mean that without <head> the document will not have an identitity and a definition and therefore it will not be shown !!? I still do not get this <head> </head>what is the difference between this:<!DOCTYPE html><html><head><title>HTML Reference</title></head><body>The content of the document......</body></html>and this :<!DOCTYPE html><html><body><head><title>HTML Reference</title>The content of the document......</head></body></html>in this script:<!DOCTYPE html><html><head> <title>My first web page</title></head><body> This is my first web page</body></html>why should we precise the title of the page in the <body></body> in order to get the title?
  6. "Javascript statements which modify the DOM make no sense outside of a document." Could you please explain this to me ? :)
  7. "I doubt it's an error. Do you see a red message that indicates that certain code is a problem, or just the word "undefined"?I doubt it's an error. Do you see a red message that indicates that certain code is a problem, or just the word "undefined"? I saw in red error : undefined Now , I copied this code : var a = 12;document.write(a); and pasted it again , surprisingly , it worked and the browser show 12 as output . May be it has something to do with Mozilla version or a bug in mozilla firefox . I like mozilla firefox web console . It is a simple , sweet and instructive , flexible woman :)
  8. "Stop using document.write. Instead use something like..." Could you confine yourself to my questions or you could not ? these were my questions : 1) I would like to know what is the cause of the error shown in mozilla firefox web console ? 2) how to avoid it so that I do not get the same error again when I run my little script in mozilla web console ? this was your answer : "Stop using document.write. Instead use something like..." look to my questions and look to your answer . Do they have something in common ? no absolutely not So I would appreciate it if you answer me in relation to the questions I ask and both of your codes did not work in mozilla firefox web console
  9. "Have you tried instead console.log()?" Now I tried it . it shows undefined and the output like this undefined 12
  10. when I run this little piece of code in mozilla firefox web console var a = 12;document.write(a); it gives this error : undefined when I put the same code in notepad and save it as example.html then run it , it runs normally and gives me an 12 as an output . 1) I would like to know what is the cause of the error shown in mozilla firefox web console ? 2) how to avoid it so that I do not get the same error again when I run my little script in mozilla web console ? :)
  11. hisoka

    server database

    The select command is used to retrieve data from rows . In this table : +----+------+---+------| username |password | +----+------+----------| | |---------------------- there is one row (in which there are the names of the two columns) . Regardless of the table and the empty set ,why the values of this row (which are the names of the two columns namely username and password) cannot be retrieved like (john and pass)??
  12. hisoka

    server database

    Thank you I have a question that confuses me : You told me this : "Use a select query to retrieve rows from a table. It will format the result in the columns of the table" once I used the select query as you told me , I got this table : +----+------+---+------| username |password | +----+------+----------| john | pass |---------------------- why I got the complete table with columns and rows instead of getting only the values of the row that I want to retrieve (here john and pass)!!? if I send a select query to the server database , normally it should return only the values in the rows not the entire table . Am I wrong? how?
  13. hisoka

    server database

    "I am not aware of any command to just show an empty result set listing the columns" You mean it is impossible to get a table like this in mysql ? +----+------+---+------| username |password | +----+------+----------| | |---------------------- "or why you would even want to do that" I believed that we can get such a table in mysql so I tried to get it displayed but I failed :) +----+------+---+------| username |password | +----+------+----------| | |---------------------- Why we could not get such a table in mysql ??
  14. hisoka

    divisors

    I am working on it . Once the code is ready I will put it and I will appreciate it and be happy when you evaluate it as always :)
  15. hisoka

    server database

    I used the SELECT query statement to retrieve a row as you told me . Therefore , I got this table displayed+----+------+---+------| username |password | +----+------+----------| john | pass |---------------------- However , this is not what I want . After creating a table with twocolumns named username and password , I wanted to display only the table with its two coplumns named username and password like this: +----+------+---+------| username |password | +----+------+----------| | |---------------------- I could not display such a table even after using this command : SELECT username , password FROM c1 ; the result of this command is this : Empty set (0.0 sec) (may be by "empty set" it means that there is no values inside the two columns and this is why the command did not display the table ) I still do not understand why I could not display it
  16. hisoka

    server database

    "I don't know what you're asking" I will reformulate my question so that I make myself clear : I used this command : CREATE TABLE c1 (username char(20) , password char(20)); to create a table with two columns the first is named username and the second is called password and now we have a table with two columns named username and password The problem is that I could not display the table c1 along with its two columns after creating it . By display I mean the table as a rectangle or a square divided in two columns the first called username and the second is password . with these command I could not display the table I created along with its password and username columns http://dev.mysql.com/doc/refman/5.5/en/show-create-table.html http://dev.mysql.com/doc/refman/5.1/en/show-table-status.html http://dev.mysql.com/doc/refman/5.6/en/show-tables.html I am stuck
  17. hisoka

    divisors

    <script>var matrix= [ [1, 1, 0, 0], [1, 2, 0, 0], [0, 0, 3, 0], [0, 0, 0, 4],];var matrix1= [ [1, 1, 0, 0], [1, 2, 0, 0], [0, 0, 3, 0], [0, 0, 0, 4],];for(i=0 ; i<1; i++){for(j=0 ; j<1 ; j++){alert((matrix.join()==matrix1.join() ? "matrix is symetric along the diagonal" :"matrix is not symetric along the diagonal"));}}</script> could you please test it and tell me . I think that you will get matrix is symetric if it is and matrix not symetric if it is not change the order , make the size bigger , change the value and you will get only the true result
  18. hisoka

    divisors

    var matrix = [1,1,0,0], [1,2,0,0], [0,0,3,0], [0,0,0,4], ]; this creates an array named matrix (a parent array) and assigns it 4 arrays as elements ( 4 children) the for(i=0; i<matrix.length ; i++) loops through the array parents matrix the second for loop which is inside the for(i=0; i<matrix.length ; i++) loops through the parent array ( matrix ) vertically ( from top left in a descending order to the bottom right . Why ? because according to wikepedia , a symmetric matrix is a square matrix that is equal to its transpose . The transpose of a matrix A is another matrix AT (also written A′, Atr, tA or At) created by any one of the following equivalent actions: reflect A over its main diagonal (which runs from top-left to bottom-right) to obtain AT write the rows of A as the columns of AT write the columns of A as the rows of AT for example if we have [1 2 3] [1 4 7] [4 5 6] = its transpose is [2 5 8] [7 8 9] [3 6 9] from that comes the idea of looping from the top left to the right bottom which is done through the second for loop : in the for(j=0 ; j<1 ; j++) the j<1 is used so that the loop will loop only one time so that we do not get unecessary numbers and to avoid errors the matrix[i+j] is to loop the array parent matrix from top left to the bottom right this alert((matrix[i+j]==matrix ? "matrix is symetric along the diagonal" :"matrix is not symetric along the diagonal")); says : after the looping ends compare the result you got with the matrix parent . if they are equal ( the result and the matrix , then the array matrix is symetric along the diagonal and a box popup in which it is stated "matrix is symetric along the diagonal" otherwise a box popup in which is written "matrix is not symetric along the diagonal "Can you explain what your code does to somebody who understands math but not Javascript?" Why you asked me to explain it . Is my result wrong or am I missing something in my code or is it wrong ? and if yes why and what is the correction step by step? or by asking me to explain it do you doubt that I understand what I am writing ( am i crazy so that I write a code I cannot understand !!!! as if I write a sentence that I could not understand!!)?
  19. hisoka

    divisors

    var matrix = [1,1,0,0], [1,2,0,0], [0,0,3,0], [0,0,0,4], ];for(i=0; i<matrix.length ; i++){for(j=0 ; j<1 ; j++){alert((matrix[i+j]==matrix ? "matrix is symetric along the diagonal" :"matrix is not symetric along the diagonal"));}}
  20. hisoka

    divisors

    Thank you very much I wanted to train myself on loop inside another loop like for example this little code that gives the same result of the previous code <script>var tmp = 0;for(i=0 ; i<4 ; i++){for(j=0 ; j<4 ; j++){for(k=0 ; k<4 ; k++){document.write("<br />");document.write(tmp+=4);}}}</script> :)
  21. hisoka

    divisors

    I write this little piece of code to get the divisors of 4 until 40000 (can be trillion and zillion ) if you have a very powerful computer . You can get the divisors of any number you want all you have to do is change the value of 4 to the number you want I said may be it can help someone who is looking for divisors :blush: <script>var tmp = 0;for(i=0 ; i<100 ; i++){for(j=0 ; j<100 ; j++){document.write("<br />");document.write(tmp+=4);}}</script> this gives the divisors of 4 to 40000 4812162024283236404448525660646872768084889296100104108112116120124128132136140144148152156160164168172176180184188192196200204208212216220224228232236240244248252256260264268272276280284288292296300304308312316 .... 40000
  22. hisoka

    for loop

    if you have some links for a beginner like me about what bitwise operators do I would appreciate it if you give me many links
  23. hisoka

    for loop

    They are operators used by the computers CPU and Registers to calculate and deal with binaries 0 and 1 and for encoding and decoding , they are used in cryptography and many other fields please if I am wrong correct me
×
×
  • Create New...