Jump to content
Larry Ullman's Book Forums

StephenM

Members
  • Posts

    59
  • Joined

  • Last visited

Everything posted by StephenM

  1. StephenM

    Java Or C#

    hi Antonio, thanks for your answers. its been very useful and reassuring. in ireland, i think its the same. and its good to hear that learning oop programming is very useful. the course is focussing on oop for the first 3 months. its good that the companies give you space to progress but sometimes i wonder how ready i or anyone with little programming experience can be ready after 9 months in university for a 3 month internship. i know the course focusses on programming and tries to condense everything. im not complaining too much though since im 30 and i dont have time for a few years in a course again. any recommendations on books for java? i was thing about readinng : beginning java objects. dunno how im gonna get through all this material php, js, ecommerce and now java. thanks, stephen
  2. StephenM

    Java Or C#

    hi, firstly, please forgive spelling errors, on the move. like larrys anouncement, i recently also got some good news that will change my career path. i have been tryinggb to learn php/js in a part time capacity for 4 months or so. i do enjoy it but i took a look around at courses to see if i could get some credentials on the cv. and structure to my learning path. i found a 1 year higher diploma in software development designed for graduates of other disciplines with some/ little / or even no programminggb experience. at the end the student will do an internship for an enteprise and the course is 100% direced towards becoming employed in an enterpise in the ict sector. it has a short internet programming module but otherwise is heavily geared on java and c# i think. so i was wondering: does learning these languages benefit you a little bit / some / significantly / very significantly if later i decided to go back to php or js? can those internet languages be learnt more easily on a part time basis if in tandem one is learning java/c# or are different languages more of a discrete learning process? finally, anybody got views on the pros and cons of enteprise level employee vs freelance? and if you work for a company and are an intern or junior developer, are you still sort of learning on the job? do companies allow / flexible in this regard? or is there a ton of pressure on top of you? how quick can you progress? is it based on your performance or internal politics play a role? i know these are general questions but maybe ppl have some personal experiences. rgds stephen
  3. Thanks Hartley, that pretty much answers my question. I haven't got a use case yet. So if I'm not mistaken a glob is sort of like a specialized scandir() that will narrow the scope of the result set.
  4. Hi, Just on chapter 11. It was suggested I look up other functions and I've done that. Been looking at the glob() function and scandir() function a bit. Is there any major differences where one might use either function? Seems to me that a similar result could be achieved with either.
  5. src=”includes/function.js” --> this is from your header.php file. Maybe it is on the same level as header.php? are you sure this is the right path to the function.js folder?
  6. Is this the right directory? [but it should work anyways if you added the unavailable.png image to the photos folder. I would also wonder if you are getting errors?
  7. okay, so I think I have found a solution to this part of the pagination task. Following your suggestions, I reviewed the approach. Changes made: reduced to one form. Removed the onchange.submit() function and added a submit button (so all filters can be selected simultaneously). Remove the redundant links in the select menu <option> elements Put necessary GET name/value pairs into the name of a select menu and value section respectively for the $display and $sort variables. Also, add an if statement so the correct one is selected. Added 2 hidden inputs for the start and pages variables I had to change the validation for the $pages variable because it changes if the $display variable changes. Here is the new form and it works: <form action="banking_example.php" method="get" id="form1"> <div class="row"> <p> Sort Results by: <select name="sort"> <option value="fn" <?php if ( $sort == "fn") { echo ' selected="selected"'; } ?> > First Name</option> <option value="ln" <?php if ( $sort == "ln") { echo ' selected="selected"'; } ?> > Last Name</option> </select> </p> </div> <div class="row"> <p> Results per page: <select name="d"> <option value="5" <?php if ( $display == 5) { echo ' selected="selected"'; } ?> > 5 </option> <option value="10"<?php if ( $display == 10) { echo ' selected="selected"';}?> > 10 </option> <option value="25"<?php if ( $display == 25) { echo ' selected="selected"'; } ?>> 25 </option> <option value="50" <?php if ( $display == 50) { echo ' selected="selected"'; } ?> > 50 </option> </select> </p> </div> <input type="hidden" name="s" value="<?php echo $start; ?>" /> <input type="hidden" name="p" value="<?php echo $pages; ?>" /> <div class="row"> <p> <button type="submit" form="form1"> Go </button> </p> </div> </form> That was it. Next to add the page numbers at the bottom of the page.
  8. Thanks for the answer, I understand now. So effectively the link in the select menu is redundant. I didn't realize that. That's a pity because I do very much like the interface that a select menu offers and I was hoping that 2 separate menus could be used. I'll dwell on this for a while and post back (hopefully with a not too disparate solution).
  9. Hi, I'm on the final step to finishing chapter 10 but I have encountered some sort of problem/quirk. I am adding pagination. A total of 4 name/value pairs need to be passed by the GET method. 2 variables that php computes are the $start and $pages variable. $start = $_GET['s'] $pages = $_GET['p'] 2 features (number of rows and sorting) the user will be able to modify with a <select> form. NUMBER OF ROWS: using the variable $display = $_GET['d']. SORTING using the variable $sort = $_GET['sort'] The problem though is that despite having the form set-up to send these variables, only one is actually sent in the browser ( I can only see one variable being passed in the address bar) but when I view the source, all variables show up in the link! I would have expected that once the link is clicked that it will show up all of the name/value pairs in the address bar? This must be the cause of the problem but I don't know how to fix it. Here are the forms: <p> Sort Results by: <form method="get"> <select name="sort" onchange="this.form.submit()"> <option value="fn"'; if ($sort == "fn" ){ echo ' selected="selected"';} echo'> <a href="banking_example.php?sort=fn&d='.$display; echo'&p='.$pages; echo'&s='.$start; echo'">First Name</a> </option> <option value="ln"'; if ($sort == "ln" ){ echo ' selected="selected"';} echo'> <a href="banking_example.php?sort=ln&d='.$display; echo'&p='.$pages; echo'&s='.$start; echo'">Last Name</a> </option> </select> </form> </p> <p> Results per page: <form method="get"> <select name="d" onchange="this.form.submit()"> <option value="5"'; if ($display == 5 ){ echo ' selected="selected"';} echo'> <a href="banking_example.php?d=5&sort='.$sort; echo'&p='.$pages; echo'&s='.$start; echo'">5</a> </option> <option value="10"'; if ($display == 10 ){ echo ' selected="selected"';} echo'> <a href="banking_example.php?d=10&sort='.$sort; echo'&p='.$pages; echo'&s='.$start; echo '">10</a> </option> <option value="15"'; if ($display == 15 ){ echo ' selected="selected"';} echo'> <a href="banking_example.php?d=15&sort='.$sort; echo'&p='.$pages; echo'&p='.$pages; echo'&s='.$start; echo '">15</a> </option> <option value="25"'; if ($display == 25 ){ echo ' selected="selected"';} echo'> <a href="banking_example.php?d=25&sort='.$sort; echo'&p='.$pages; echo'&s='.$start; echo'">25</a> </option> <option value="50"'; if ($display == 50 ){ echo ' selected="selected"';} echo'> <a href="banking_example.php?d=50&sort='.$sort; echo'&p='.$pages; echo'&s='.$start; echo'">50</a> </option> </select> </form> </p> Here is an example of the output if I click on form 2 for example: <p> Sort Results by: <form method="get"> <select name="sort" onchange="this.form.submit()"> <option value="fn" selected="selected"> <a href="banking_example.php?sort=fn&d=10&p=3&s=0">First Name</a> </option> <option value="ln"> <a href="banking_example.php?sort=ln&d=10&p=3&s=0">Last Name</a> </option> </select> </form> </p> <p> Results per page: <form method="get"> <select name="d" onchange="this.form.submit()"> <option value="5"> <a href="banking_example.php?d=5&sort=fn&p=3&s=0">5</a> </option> <option value="10" selected="selected"> <a href="banking_example.php?d=10&sort=fn&p=3&s=0">10</a> </option> <option value="15"> <a href="banking_example.php?d=15&sort=fn&p=3&p=3&s=0">15</a> </option> <option value="25"> <a href="banking_example.php?d=25&sort=fn&p=3&s=0">25</a> </option> <option value="50"> <a href="banking_example.php?d=50&sort=fn&p=3&s=0">50</a> </option> </select> </form> </p> but all that shows up in the browser address bar is the following (for example): /banking_example.php?sort=fn or if I click on the display link banking_example.php?d=25 the 3 other variables don't show up in the address bar despite being present in the html source code so this is why they don't get passed on. But how do I fix it?
  10. echo "If you work hard, have a portfolio and keep trying though, I think it will happen"; Exactly how I think.
  11. Been busy for a bit there & away for the computer so getting to this thread rather late. Thoroughly enjoyed reading some of the posts on this thread. I'm way off the "entry stage" yet but it is something I regularly think about. Apart from pure programming power, it seems to me like patience, good-timing and perhaps a dash of luck are also useful.
  12. Hi Hartley, Thanks for the answer, that's fine. I prefer not to go into depth on something in a half-hazard manner. I prefer the systematic approach to learning. I thought the issue was something simple I was missing. In that case, I think I am going to wait until I get to "Modern Javascript" and cover it in a more methodical manner. Is this issue dealt with in the book do you know? I'm going to put this into my tasks and post back the solution in a few months when I get to it. Thanks again, Stephen
  13. Hi all, I've been kept away from the computer lately with other jobs & it seems to take some time to get back into the swing of things again. Also, I haven't studied javascript or jquery properly yet as I want to finish the PHP/MySQL book first (on chapter 11) so please forgive me for what is probably a simple question as follows: I would like to add a little jquery functionality and I'm having a syntax error probably something to do with the '' or "" symbols. So the script works fine as follows: <script> $(document).ready( function(){ $('#table1').hide(); $('#button1').click(function(){ $('#table1').toggle(); }); }); $(document).ready( function(){ $('#table2').hide(); $('#button2').click(function(){ $('#table2').toggle(); }); }); $(document).ready( function(){ $('#table3').hide(); $('#button3').click(function(){ $('#table3').toggle(); }); }); $(document).ready( function(){ $('#table4').hide(); $('#button4').click(function(){ $('#table4').toggle(); }); }); $(document).ready( function(){ $('#table5').hide(); $('#button5').click(function(){ $('#table5').toggle(); }); }); </script> but I can't seem to get it to work as follows: (I reckon it is to do with the +i being outside the ''? <script> $(document).ready( function(){ var i =1; for (i = 1; i <= 5; i++){ $('#table'+i).hide(); $('#button'+i).click(function(){ $('#table'+i).toggle(); }); console.log('#table'+i); console.log('#button'+i); } }); </script>
  14. @damilola Perhaps your phone doesn't support utf-8? And that is the problem? @anyone I just changed the code a little to add detect encoding. I was surprised to see that 'Anton' has come out as ASCI Why not UTF-8? <?php header ('Content-Type: text/html; charset=UTF-8'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/ TR...ransitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/ html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <?php $names = array('joάo','ҐѾργζ', 'Anton', 'KamilÐ', 'FranĞiška','愛子', '杰西卡'); foreach ($names as $name) { echo "<p>$name has ".strlen($name)." characters <br />\n".strtoupper($name)." in capital letters <br />\n".mb_detect_encoding($name)." </p> \n"; } ?> </body> </html>
  15. @Michael, Yes, it would be great alright. Personally, I think it's crucial to offer the favorite local payment methods... and France and Germany have their own too. So I hope stripe will cover those too. @anyone, I haven't read or gotten the e-commerce book yet but would the principles of integrating stripe be the same as paymill for example? It seems to me (on the surface at least) that one of the most problematic issues of not using a shopping cart platform like drupal commerce or magento for example is the issue of integrating a wide range of payment options. Would this be right? In Europe, people use more than just their credit cards. (In USA, mostly just credit cards, right?) [ Right now, I'm weighing the merit of a platform vs custom php build]
  16. Hi Michael, What additional payment options will be available with Stripe do you know? Will it encompass payment methods popular in Ireland or Europe and Ireland? Thanks Stephen
  17. You could make use of the <audio> element for native browser support [to avoid plug-ins] but unfortunately and as always, there are browser compatibility issues, you can find more about that here: http://en.wikipedia.org/wiki/HTML5_Audio If all browsers supported OGG, that would be great but for now, they don't. There are also licensing issues with mp3. As an alternative solution, I wonder would embedding a soundcloud be workable? Just a thought.
  18. Actually, no information from form 1 is required a second time. This is why the hidden inputs method is rather silly. Yes, this makes sense. Yesterday, I was trying a combination of: 1. the conditional statements as above + 2. the logic on your line 3: If form 1 is submitted all okay, you should load an empty form 2 (No stickiness from form 1 actually needed). So this morning, I just loathed my solution of throwing all the data back into hidden inputs. So I started again, fresh & this time it worked. The general logic for the solution went as follows: if (submission = true ){ if (users submits form 1) { 1. Validation exercises. 2. if (no errors) { 3. if (certain data from form 1 occurs), then create form 2 and present it to user for submission. else { just continue on. } } 2. else (if errors) { Tell the user about the errors and force them to go back to a sticky form 1 } } // end of form 1 submission if (user submits form 2) { now the validation errors from form 1 should not show up and we can validate form 2 happily. } // end of form 2 submission } // End of Main submission form 1: So, onto the next step. Thanks again.
  19. Yes, I see how that works. I actually ended up trying something similar that went kinda like this: <?php if ( isset($_POST['submit1']) == true) { // Code here for form #1 } else if ( isset($_POST['submit2']) == true) { // Code here for form #2 } ?> <form action="" method="post"> <!-- Input fields here --> <input type="submit" name="submit1" value="submit"> </form> <form action="" method="post"> <!-- Input fields here --> <input type="submit" name="submit2" value="submit"> </form> I think that the above code would achieve something similar to yours? [or am I wrong?] [ is there something wrong with the method i used] Anyways, the conditionals got a bit too complicated because trying to apply them to a big splash of procedural code after it's all written was really cumbersome & I was getting loads of logic errors. I should have thought it out more at the start. So in the end to get around it, I removed the above conditionals & just appended all the previously submitted data from form1 into the hidden inputs in form2.This meant all the errors went away at least. I don't know if there is anything wrong with this method. (ugly code) or more issues?? Anyways the solution I opted for went something like this: FORM 2: for ($i =0; $i<$count;$i++){ echo ' Account Number: ' . $data[$i]['account_id'] . ', &nbsp Account Type: '. $data[$i]['type'] .'&nbsp <input type="radio" name="which_acc" value="'.$data[$i]['account_id'].'--'.$data[$i]['type'].'"><br>'; } echo ' <input type="hidden" name="outgoing" value="'.$_POST['outgoing'].'"> <input type="hidden" name="from_first_name" value="'.$_POST['from_first_name'].'"> <input type="hidden" name="from_last_name" value="'.$_POST['from_last_name'].'"> <input type="hidden" name="to_first_name" value="'.$_POST['to_first_name'].'"> <input type="hidden" name="to_last_name" value="'.$_POST['to_last_name'].'"> '; echo '<input type="submit" name="submit2" value="select2">'; echo '</p></form>'; FORM 1: echo '<form action="" method="POST"> Transfer:<input type="number" name="outgoing" value="'; if( isset( $_POST['outgoing'] ) && is_numeric( $_POST['outgoing'] ) ) echo $_POST['outgoing']; echo '> € <br> From: First Name: <input type="text" name="from_first_name" value="'; if( isset( $from_first_name ) ) echo $from_first_name; echo '>Last Name: <input type="text" name="from_last_name" value="'; if( isset( $from_last_name ) ) echo $from_last_name; echo '> </p> <p> <span style="font-size:150%;"> To: </span> First Name: <input type="text" name="to_first_name" value="'; if( isset( $to_first_name ) ) echo $to_first_name; echo '>Last Name: <input type="text" name="to_last_name" value="'; if( isset( $to_last_name ) ) echo $to_last_name; echo '>' . "\n"; echo '<p><input type="submit" name="submit1" value="Transfer Funds"></p>'; echo '</form>'; by submitting all the data from form 1 again in form 2 all the validation errors went away. but next time I am going to try the conditional method --> it looks a lot cleaner and probably more secure?.
  20. I'll have to try and get my head around this one. It would be good if I could manage to upload this. But I still haven't configured a live set-up with PHP/MySQL. I'll see how I get on & post back.
  21. I am on the last part of chapter 9 and doing my own thing in the last part of Persue. Is it possible to have 2 forms post to the same page (post to self) without interfering with each other? What I am trying to describe is tricky but it is something like this: if ($_SERVER['REQUEST_METHOD'] == 'POST') { if (a certain condition happens) { Create a new SECOND FORM form & post it back to the same php page. <form action="" method="post"> <input NEW STUFF > <input type="submit" name="submit2" value="select"> </form> Problem now is that the first form validation is cleared and all the errors from the first form are generated. } } FIRST FORM: <form action="" method="post"> <input> <input type="submit" name="submit1" value="submit"> </form> The source code is is a bit long to post. Let me know if not clear enough & I'll try to get the sample up and running online.
  22. Your opinion mirrors a lot of what I already thought. I'm definitely sticking with the MySQL/PHP book to the end. I'm very happy with the book so far. I'll have to toss a coin then to see which to move onto next! I don't think it matters too much as I plan to read both, eventually. Interesting insights there on the future of Javascript. One thing that confuses a beginner is the lack of harmonization --> dozens of different frameworks each with their niche. It's a bit flabbergasting. What I would take from this is in terms of time invested perhaps a PHP:JS ratio of 2:1 sounds about right. What I try to do in general is every now and again step away from the PHP and do a bit of HTML/CSS because 1. It is like a breath of fresh air sometimes. 2. I can continue an underlying level of HTML/CSS One thing is for sure, choosing the right tools to invest time in is also important. Thanks a lot for the extended answer.
  23. Hey HartleySan, I'm no expert - just a novice as you know but i do read forums all over the place with conflicting views. Just wondered what your thoughts might be if the questions aren't too bothersome: Would you rank javascript even higher than PHP (for importance)? I am about half way through the PHP/MySQL Book and I am focusing on PHP now. I bought Modern Javascript already which I will eventually read and I know javascript is important. But I am thinking of getting the OOP PHP book first because lots of discussions seem to point to the importance of knowing about OOP and I'm kinda getting into the swing of things with PHP. Furthermore, have you any thoughts about where DART might go?
  24. Although, I'm not sure where to find them. I'll have a look around --> only worth it if a bit of interest on the forum.
  25. Yes, in fact no need for 2 variables looping but there are probably at least a dozen ways to do it. for ($i=0; $i >= -8; $i-= 2) { echo $i.'<br>'; if ((abs($i) > 0) && (abs($i) <8)) {echo '+'.(abs($i)*2).'<br>';} }
×
×
  • Create New...