Jump to content

hisoka

Members
  • Posts

    569
  • Joined

  • Last visited

Everything posted by hisoka

  1. but a normal program is hard coded too Take a look at this : <?php $x = 10 ; $y = 20; echo $x + $y ; ?> This is a tiny simple program in which all the variables are embedded directly in the code and any modification in one variable creates a modification in the whole program or in the result of the program . Thus , a normal program can be a hard coded program . So what is the difference between a normal and a hard coded program ?
  2. this is what I mean : https://en.wikipedia.org/wiki/JScript.Encode my question is how to decode JScript.Encode source code ??
  3. I read this article : http://samar.techgaun.com/2010/09/full-path-disclosure-tutorial.html and I fall in love with it . It is very clear and simple . But what attracts me more is this line "Now, lets exploit the $_GET['page'] variable which will look as below:" http://localhost/index.php?page[]=main Justsomeguy my question to you is why the array is injected after the variable . Why not injected , for example, after the string like this http://localhost/index.php?page=main[]
  4. I do not know the meaning of the word "hard coded" . I read many definitions about it in the internet but my brain is still unable to grasp its meaning . Could someone tell me what is the meaning of "hard coded" in a simple way that my brain can understand ?
  5. so the + sign in document.write (counter + "<br>"); is for concatenation ?
  6. I tried document.write again and it worked this is the result: love reversed is evol!
  7. when I run this script : var counter = 10; while (counter > 0) { document.write (counter + "<br>"); counter--; } I get : 10 9 8 7 6 5 4 3 2 1 however when I delete "<br>" from the script above like this : var counter = 10; while (counter > 0) { document.write (counter + ); counter--; } an error is engendered : SyntaxError: expected expression, got ')' why when I deleted "<br>" an error is engendered ?
  8. I found this script in a book var newString = ""; var theString = prompt("Enter a string for reversal",""); var counter = theString.length; for (counter ;counter > 0 ;counter -- ) { newString += theString.substring(counter-1, counter); } document.write(theString + " reversed is " + newString + "!"); this script prompt a box in which the user enter a string . Once the string is entered and the user click ok , the script gives the reverse of the string . Using console.log , in firebug , I can see the reversed string but document.write does not show or echo the reverse string in the browser web page . I know that it is preferable to use console.log but I would like to know the cause why document.write did not echo the reversed string ? and how to make it echo the reverse string in the browser web page ?
  9. First I want to say thank you for the list of books you provide me I opened the first book in the list which is " clean code : A handbook for agile software craftsmanship for Robert . C. Martin and begun to read it until I reached a paragraph in which the author try to improve a code readability : He begun by asking a question : "What is the purpose of this code? public List<int[]> getThem() { List<int[]> list1 = new ArrayList<int[]>(); for (int[] x : theList) if (x[0] == 4) list1.add(x); return list1; } Why is it hard to tell what this code is doing? ..................................until public List<int[]> getFlaggedCells() { List<int[]> flaggedCells = new ArrayList<int[]>(); for (int[] cell : gameBoard) if (cell[sTATUS_VALUE] == FLAGGED) flaggedCells.add(cell); return flaggedCells; } Notice that the simplicity of the code has not changed. It still has exactly the same number of operators and constants, with exactly the same number of nesting levels. But the code has become much more explicit. We can go further and write a simple" . Neither I understood what the first code does nor did I understand what the second does . I have a question : when I face such code , while I am reading these books , and I do not understand it what should I do ? should I skip it and continue reading or should I understand what such a code does ? as a newbie who is in the beginning of the road and know nothing of programming is it necessary and obligatory , when facing those complicated sets of code while reading these books , to understand what they are doing? or I can skip them ? and if I skip them , does it impede me from improving or it does not?
  10. The problem is that I did not find books that talk about programming in its high level of view . The books that I found until now seem to deal with programming in its high or general level of view but , in reality , when opened and studied in details , they deal only with one specific programming language like (Programming for the Absolute Beginner Jerry Lee Jr. Ford) . Moreover , some books deal with many languages in the same time with reference to one language more than the others but you need to have a background about all these languages in order to understand the code written in them (Beginning Programming For Dummies Wallace Wang) therefore you need to learn the basic of all these languages before reading the books!!! . Due to all that , could you please provide me with one or two books that deal with programming in its high level of view so that I can confine myself and have a concrete example of what should I read exactly as a newbie who is in the beginning of the road??
  11. "A beginning programming book would probably be more instructive than a beginning Javascript book" So I begun to read about programming in general and those are the books I begun with : Beginning Programming For Dummies Wallace Wang Programming for the Absolute Beginner Jerry Lee Jr. Ford Computer Programming for Kids and Other Beginners Warren Sande Beginning Programming For Dummies is about Basic as a programming language Programming for the Absolute Beginner Jerry Lee Jr. Ford is about Liberty Basic in its majority and some other programming languages Computer Programming for Kids and Other Beginners is about Python and the majority of the books follow the same methodology like the three books above . Therefore there is not such a book that talks about programming as a general but even these books they teach one language . Thus , I see absolutely no reason to learn Basic because if I do so , would not be more wiser to learn javascript ?!! plus Basic, as I see it in the two books , is in no way easier than javascript . So why should I lose time in learning it if I can begin with javascript and the same for python . So Justsomeguy such a book as you suggest it does not exist . my aim is to learn php and javascript . This is what I want . Is not better to begin with php and javascript books for kids and beginners !!! especially that I have some little background about both languages?????
  12. Justsomeguy , should I begin by reading books about programming as a concept in general or I should begin by reading books about javascript as programming language for beginners ?
  13. "I don't know where you found that script, but it's completely wrong in every way." Thank you Foxy Mod and you are totally right it is totally wrong and a nonsense "If you can't do that by reading the code then you need to read the books about programming theory so that you can understand what the code is doing" In the past I believed that I am able to understand what the code does by reading but I come to the conclusion that I was cheating myself . Except for easy code , I cannot understand the complicated code even when I run it many time let alone by reading it . So I am not ready . Therefore , You are my teacher Justsomeguy so I will do all what you tell me so , please , give me all the books you see that they are useful for me and I will read them and try to understand them but I hope you take in consideration my very weak level so you do not give me complicated books please list them here so that I will download them from the internet and read them ( please no sponsored books as I cannot pay to have them )
  14. "Step through the code yourself to try and figure out why." Justsomeguy , I told you that I am very weak in programming , a newbie . I cannot understand most of the script that I posted here ,which they are not mine , let alone to understand the source of error in them . I try to run them to see what they do and according to that , I get an understanding about them . For me they are very complicated and I cannot figure out what they do even if I go through them line by line . Therefore , I post them here for clarification .. I know all the basics of javascript and php . Now , I believe that if I take a code or a script , for example , and try to study it and then take another and study it with your clarification and by time , I will be able to become very good in programming . For me it is more important to be able to understand what the most complicated code does then being able to write a code myself like a professional programmer . May be I am wrong in the method I use to learn how to understand a code very well even if it is complicated . So I would like you Justsomeguy to tell me , as my teacher , from where should I begin , besides writing a good code , in order to be able to understand , very easily , what a complicated code does ? from where ? what is the beginning ? I am lost
  15. ok here it is : I wrote it myself var x = "cat"; var g = "abcdeft" var h = 1; for( var i=0 ; i<x.length ; i++) { var z = g.indexOf(x.substring(i ,i+1)); var h = h+(z*1*i)*(z*i*i); console.log(h); } I would like to get information about the i in the var z = g.indexOf(x.substring(i ,i+1)); which is in turn inside the loop . I no need to use typeof as I know i is a number . I am asking if there is a function in javascript that is similar to var_dump in php .
  16. oh this is beautiful . I used firebug console . I do agree with you it is far more better than the regular console and as a result it gives me : [[0, 1], [0, 2], [0, 3], [1, 1], [1, 2], [1, 3]] what is the difference between the console API and the regular console ?
  17. " I don't use the regular console for Firefox" Why you do not use it ? and what do you mean by : "Firebug disables and overrides some features in the regular console in Firefox"
  18. When running this script : var upper =10000000; var randomNumber = getRandomNumber(upper); var guess; var attempts = 0; function getRandomNumber(upper) { while (guess !== randomNumber) { guess = getRandomNumber(upper); attempts +=1; if (guess == randomNumber) { break; } } return Math.floor( Math.random() * upper ) + 1; } var m = getRandomNumber(upper) ; console.log(m); I got an error that says " too much recursion " !!!!!! what is the meaning of this error ?? and how to correct it ?
  19. Generally why we use Math.floor together with Math.random ? for example like this : Math.floor(Math.random()*15)+1; or any other context
  20. JSON.stringify convert a value to string it does not give information about the variable : JSON.stringify( Boolean(10>9)); // "true" Boolean to string JSON.stringify(9); // "9" integer to string typeof() gives the type of the variable but it does not give enough helpful resources about the variable , for example , in a for loop like var_dump in php does Any other suggestions ?
  21. "console.log() will show the contents of a variable. You have to have the browser's Javascript console open to see the result" var x = 12 ; console.log(x); // gives 12 as a result . So console log does not give information about the variable it prints only the variable in the web console of Mozilla Firefox . I need information about the variable
  22. I would like to see the result in Mozilla Firefox web console . How is it possible ?
  23. now when I try to run the script above like this : function cartesian() { var r = [], arg = arguments, max = arg.length-1; function helper(arr, i) { for (var j=0, l=arg.length; j<l; j++) { var a = arr.slice(0); // clone arr a.push(arg[j]); if (i==max) r.push(a); else helper(a, i+1); } } helper([], 0); return r; } var x =cartesian([0,1],[1,2,3]); // call the function cartesian console.log(x); //print the result it gives me this result : Array [ Array[2], Array[2], Array[2], Array[2], Array[2], Array[2] I do not know why . Why ? how to correct the situation : what is my error ?
  24. Justsomeguy you told me that in php there is a function called var_dump that gives information about a variable . Could you tell me what is its substitute in javascript ? Thanks
  25. I found this code in : http://stackoverflow.com/questions/15298912/javascript-generating-combinations-from-n-arrays-with-m-elements : function cartesian() { var r = [], arg = arguments, max = arg.length-1; function helper(arr, i) { for (var j=0, l=arg[i].length; j<l; j++) { var a = arr.slice(0); // clone arr a.push(arg[i][j]); if (i==max) r.push(a); else helper(a, i+1); } } helper([], 0); return r; } First , I am wondering why the l is not declared as a variable Secondly , in the for loop there is three statements : The For LoopThe for loop is often the tool you will use when you want to create a loop. The for loop has the following syntax: for (statement 1; statement 2; statement 3) { code block to be executed } Statement 1 is executed before the loop (the code block) starts. Statement 2 defines the condition for running the loop (the code block). Statement 3 is executed each time after the loop (the code block) has been executed. here there are 4 statements for (var j=0, l=arg[i].length; j<l; j++) why ? thirdly , why using different variables j and l in a for loop? and why using a comma and a semi colon in for loop ?
×
×
  • Create New...