• WSannoyingmouse

    WSannoyingmouse

    @wsannoyingmouse

    Viewing 15 replies - 1 through 15 (of 16 total)
    Author
    Replies
    • in reply to: html css – center unordered list #1581967

      The answer from dg1261 is brilliant but when it comes to things like this I cheat and stand on the shoulders of giants and “borrow” from Bootstrap. I’m not 100% sure but it would help to see what your standard CSS files have and whether or not they already have a grid system to use (most do already if you’re using a framework). However, if you add the Bootstrap CSS then you can wrap your ULs in a row class (your container will already proide some level of centering) and add col-md-6 to each div containing the UL:

      [HTML]

      Our products and services

      • 1234
      • 12345
      • 111111111111
      • 2222222222222222
      • 3333333
      • 4444444
      • 55555555555555555
      • 666666666666
      • 77777777777777

      Our data is ustilised for:

      • aaaaaaaaa
      • bbbb
      • ccccccccccc
      • dddddddddddddd
      • eeeeeeeeee
      • ffffffffffffff
      • gggggggggggg

      [/HTML]

      This is a working JSFiddle with the CSS linked.

    • in reply to: SSH Client for Windows 10 #1581674

      I’ve used MobaXterm quite a lot in the past, though don’t need to so much anymore – those people who I know who do require SSH access from Windows boxes rate it highly though.

    • in reply to: Free Online Calender For Website – Not Https #1551973

      You could put FullCalendar on your page backed with a public Google Calendar. It’s a pretty cool approach and seems to work a treat. That way you can theme it to your hearts content.

    • in reply to: Saving entire website (portability) #1525666

      I’d suggest using XAMPP and then putting your whole site on a thumb drive on to serve from a machine (either yours or theirs). That way they’ll be able to see it in all it’s glory (assuming your present site is being served using Apache). If it’s something like a catalog site then you could perhaps leave it with them as a promotional item…?

    • in reply to: My webpage won’t display JavaScript in Chrome or Firefox #1525364

      Here you go, you’ll need to include jQuery and then this should work:

      Code:
              
              
                  var images = [
                  	“data:image/gif;base64,R0lGODlhAwADAKEBAICAgP///////////yH5BAEKAAAALAAAAAADAAMAAAIERBx3BQA7”,
                  	“data:image/gif;base64,R0lGODlhBQAFAMIDAAAAAICAgMDAwP///////////////////yH5BAEKAAIALAAAAAAFAAUAAAMJKDKqvCO+51QCADs=”,
                  	“data:image/gif;base64,R0lGODlhBwAHAKECAAAAAMDAwP///////yH5BAEKAAMALAAAAAAHAAcAAAIMnGU5qOLnIotqVWsKADs=”,
                  	“data:image/gif;base64,R0lGODlhCQAJAKECAAAAAMDAwP///////yH5BAEKAAMALAAAAAAJAAkAAAIQnCenuCa/nnSyJlQjbJerAgA7”,
                  	“data:image/gif;base64,R0lGODlhCwALAKECAAAAAMDAwP///////yH5BAEKAAMALAAAAAALAAsAAAIUnC2nl8vSHIxvQmRz0xT36jChqBQAOw==”];
                  var Amount = 10;
                  var Ypos = [];
                  var Xpos = [];
                  var Zpos = [];
                  var SpeedX = [];
                  var SpeedY = [];
                  var ScrXpos = [];
                  var ScrYpos = [];
                  var Speed = [];
                  var Size = [];
                  var Step = [];
                  var WinHeight = $(window).height() – 20;
                  var WinWidth = $(window).width() – 70;
      
                  $(function(){
                      for(var i = 0; i < images.length; i++){
                          var flake = $("
      “, { “style”:”position:absolute;top:0px;left:0px;” }).append($(“
      “, { “style”:”position:relative” }).append($(““, { “style”:”position:absolute;top:0px;left:0px;”, “id”: “si”+i, “src”: images[i] }))); $(“body”).append(flake); } for (var i = 0; i < Amount; i++){ Speed[i] = (i+1) * 6 / Amount + 4; //speed range from 4 to 10 Xpos[i] = (Math.random() * WinWidth – WinWidth / 2) * (Amount – i / 3) / Amount; Ypos[i] = (Math.random() * WinHeight – WinHeight / 2) * (Amount – i / 3) / Amount; Zpos[i] = Math.random() * 900 * (Amount – i / 3) / Amount + 100; } fly(); }); function fly(){ var WinHeight = $(window).height() – 40; var WinWidth = $(window).width() – 90; var hscrll = $(window).scrollTop(); for (var i = 0; i WinWidth || ScrXpos[i] WinHeight || ScrYpos[i] < 0 || Zpos[i] <= 0) { Speed[i] = (i + 1) * 6 / Amount + 4; Xpos[i] = (Math.random() * WinWidth – WinWidth / 2) * (Amount – i / 3) / Amount; Ypos[i] = (Math.random() * WinHeight – WinHeight / 2) * (Amount – i / 3) / Amount; Zpos[i] = Math.random() * 900 * (Amount – i / 3) / Amount + 100; } ScrXpos[i] = Xpos[i] / Zpos[i] * 100 + WinWidth / 2; ScrYpos[i] = Ypos[i] / Zpos[i] * 100 + WinHeight / 2; $("#si"+i).css("left", ScrXpos[i]); $("#si"+i).css("top", ScrYpos[i] + hscrll); } setTimeout(function(){ fly(); }, 20); }

      Working here.

      There’s an odd issue whereby the scroll bars suddenly appear and I’ve base64 encoded the image to reduce the requirements for added image files. Should be easy enough for you to work out what does what. The interesting thing about reusing old code is that it used to require lots of browser detection. jQuery means that that isn’t needed anymore… in fact it could be argued that modern browsers should all act pretty much the same. You’ll probably need to wrap it all in a $(function(){…}) within your script tag as well.

      Hope that helps.

      EDIT

      I’ve included everything you’ll need to implement it on the link. Just copy and paste the code to the head of your page and it should work… probably remove the old one first though.

    • This actually seems like a fun thing to tweak. Would you be okay with me working on it over the weekend and I’ll try to get the script to work in more modern browsers? I don’t think it’s anything more than the script having a reliance on browser detection TBH. If we abstract that out using jQuery then we could get it up and running quite quickly as it’s simply a question of creating and then moving elements in the DOM.

    • in reply to: Website being hacked? #1519874

      Some hosts have had similar issues with FTP being broken or just plain inherently insecure. Perhaps ask them to enable sFTP and disable FTP or ask them to disable FTP it unless you’ve selected to open it for a period. My hosts do that. I need to login to their control panel and unlock FTP whereupon it remains unlocked for 24 hours and then is automatically disabled afterwards.

    • in reply to: Recommend web-design programs? #1511712

      In terms of your business site then WordPress can be made to look shiny with a decent theme. I’ve been using the free version of Make. As @RetiredGeek notes own your own domain and find some hosting that will allow you to run PHP and hopefully has a one-click WordPress install option.

      I think that with the use of RootsPersona you’ll also have some measure of success with getting WordPress to sort out the showing of your family tree for your personal site. If your host allows subdomains (and most do), then you can have two sites running off of the same domains http://something.com for business and then http://family.something.com for your personal stuff. I’ve been using 34sp for years and they offer all that I’ve suggested.

    • in reply to: Help with PHP #1507889

      Think your issue might be down to the way you’re using an array value within the string… I always get confused so am perhaps a little guilty of defensive coding in such instances. When you add your $_PUT value I’d prefer to concatenate it rather than embed it like you do, but if you do embed it you can enclose the value within brackets. Here’s an example:

      [PHP] $arr = array(
      “one” => “one”,
      “two” => “two”,
      “three” => “three”);

      echo “Hello $arr[‘one’]
      “; // Won’t work
      echo “Hello “.$arr[‘two’].”
      “; // Will work – preferred by me in a defensive way
      echo “Hello {$arr[‘three’]}
      “; // Will also work
      [/PHP]
      So one possible solution would be to do this:

      [PHP] $url=’http://www.loventhal.com/Public/SL_&#8217;.$_PUT[‘month’].’.pdf’;[/PHP]

      or

      [PHP] $url=’http://www.loventhal.com/Public/SL_{$_PUT[‘month’]}.pdf’;[/PHP]

      It looks as though you were thinking along those lines anyway as you had an period in your code before the month…?

      Other than that I’d remember to tell the browser to expect a PDF as well 😉

      Also, bear in mind that PHP deals with single and double quotes in different ways!

      Hope that helps.

    • in reply to: Recommendations for website building? #1493658

      I’d echo Paul T in saying it’s not a simple site. From what I’ve heard SquareSpace might do what he requires with little or no knowledge of coding. With the low bar to access comes a higher price though. I’ve not used it myself though so I can’t recommend without reservations.

    • in reply to: Is this JavaScript problem? #1461653

      [PHP]setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
      $dbconn->exec(‘SET NAMES “utf8″‘);
      }catch (PDOException $e){
      $error = “Unable to connect to the database server.”;
      }
      if(!empty($_POST[“submit”])){
      try{
      $query = $dbconn->prepare(”
      SELECT
      *
      FROM
      `payments`
      WHERE
      `apt` = :apt
      “);
      $query->execute(array(
      “:apt” => $_POST[‘acctno’]
      ));
      $lines = array();
      if($query->rowCount() > 0){
      while($row = $query->fetch()){
      $lines = array(
      “acctno” => $row[“acctno”],
      “bname” => $row[“bname”],
      “purpose” => $row[“purpose”],
      “paidamt” => $row[“paidamt”],
      “amtdue” => $row[“amtdue”],
      “prevbal” => $row[“prevbal”],
      “datepaid” => $row[“datepaid”],
      “pd” => $row[“pd”]
      );
      }
      }else{
      $error = “No listing for apartment!”;
      }
      }catch(PDOException $e){
      $error = “Error retrieving payments: “.$e->getMessage();
      }
      }else{
      if(!empty($_POST[“update”])){
      try{
      $query = $dbconn->prepare(”
      UPDATE
      `payments`
      SET
      `name` = :name,
      `amtpaid` = :amtpaid,
      `rentdue` = :rentdue,
      `prevbal` = :prevbal,
      `hudpay` = :hudpay,
      `tentpay` = :tentpay,
      `datepaid` = :datepaid,
      `late` = :late,
      `comments` = :comments,
      `paidsum` = :paidsum
      WHERE
      `apt` = :apt
      “);
      $query->execute(array(
      “:name” => $_POST[“name”],
      “:amtpaid” => $_POST[“amtpaid”],
      “:rentdue” => $_POST[“rentdue”],
      “:prevbal” => $_POST[“prevbal”],
      “:hudpay” => $_POST[“hudpay”],
      “:tentpay” => $_POST[“tentpay”],
      “:datepaid” => $_POST[“datepaid”],
      “:late” => $_POST[“late”],
      “:comments” => $_POST[“comments”],
      “:paidsum” => $_POST[“paidsum”],
      “:apt” => $_POST[‘apt’]
      ));
      }catch(PDOException $e){
      $error = “Error updating payments: “.$e->getMessage();
      }
      }
      }
      include “dom.html.php”;[/PHP]

      [HTML]

      12 String

      <input type="text" class="form-control" name="acctno" disabled value="”>

      <input type="text" class="form-control" name="bname" disabled value="”>

      <input type="text" class="form-control" name="purpose" disabled value="”>

      <input type="number" data-original="” class=”form-control” name=”amtdue” value=”” disabled>

      <input type="number" data-original="” class=”form-control” name=”paidamt” value=”” disabled>

      <input type="text" class="form-control" name="pd" value="”>

      $(function(){
      $(“input[name=’pay’]”).on(“change”, function(){
      var $this = $(this);
      var $due = $(“input[name=’amtdue’]”);
      var $payed = $(“input[name=’paidamt’]”);
      var pay = parseInt($this.val(), 10);
      var due = parseInt($due.data(“original”), 10);
      var payed = parseInt($payed.data(“original”), 10);
      $due.val(due – pay);
      $payed.val(payed + pay);
      });
      });

      [/HTML]

      My bad – spun up a server and had a play with the following SQL:

      Code:
      CREATE TABLE IF NOT EXISTS `payments` (
        `acctno` int(11) NOT NULL,
        `bname` varchar(255) NOT NULL,
        `purpose` varchar(255) NOT NULL,
        `paidamt` float NOT NULL,
        `amtdue` float NOT NULL,
        `prevbal` float NOT NULL,
        `datepaid` datetime NOT NULL,
        `pd` int(11) NOT NULL,
        `apt` int(11) NOT NULL
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
      
      —
      — Dumping data for table `payments`
      —
      
      INSERT INTO `payments` (`acctno`, `bname`, `purpose`, `paidamt`, `amtdue`, `prevbal`, `datepaid`, `pd`, `apt`) VALUES
      (1, ‘Something here’, ‘Fix the sink’, 10, 100, 110, ‘2014-07-30 11:28:26’, 12, 1);

      Will work on dom.html.php in order to show the data returned from the query now.

    • in reply to: Is this JavaScript problem? #1461607

      Aye, that’s grand! The 1st one that is! You need to enter an account# number and then press enter… what is displayed when you do that? Anything? What should happen is that the underlying PHP should pick up the account# and query the MySQL DB with that account# – which will then be displayed at the top of the page (using the var_dump)… it might not show so if that’s the case have a look at the source of the page (looks like you’re using IE – think you right-click and select view source). If you get the record that you’re expecting then the next step is to display the record and we’ll do that with a simple PHP if within the dom.html.php. That way we can reuse the same page – once for searching for an account# and then again for displaying and editing the account#.

      Does that make sense?

      Cheers,

      Dom

      p.s. Looks like you’re using xampp locally? How cool! Haven’t used that in ages but it’s a fine tool!

    • in reply to: Is this JavaScript problem? #1461031

      Hey 12Strings – where is this being hosted? If it’s a local machine you could zip up the whole code base and db and I can have a crack at it – if it’s not you maybe want to grant me access and then revoke it when I’ve finished looking? I’m doing this nigh on 12 hours a day at the minute so I’m used to playing within this sphere – I prefer nodejs but this is nice because it’s comfortable and something I can do with my eyes closed (as long as I’ve access to my list of handy functions 😉 )

      From what you’ve said you’re not getting anything through after entering the account# – that’s cool and to be expected but when the page refreshes there should be the output from the SQL query…? Is there really nothing? I was going to alter the dom.html.php to display a table once we knew we were getting some results out of the query…

      Another fun thing to do is add these lines to the top of the dom.php script:

      [PHP] error_reporting(E_ALL);
      ini_set(‘display_errors’, ‘1’);[/PHP]

      That’ll hopefully tell us if I/we’ve done something really silly 😉

      If you get back to me and we know what we’re dealing with then we can work at altering the dom.html.php to display the results.

      Just a though but are you expecting just one or is there likely to be more than one result from the query? I’m only asking because of the use of a table to display the data – if the table was used to sort out the positioning on the page then that’s all gravy! If there’s likely to be more than one then we’re looking at something that might benefit from nice AJAX – I LOVE AJAX!

      I’m thinking that it’s likely to be just one result though – in which case a lot of the logic you’re passing to the JavaScript should perhaps be moved to the PHP as some (most – but not all) users disable JavaScript…

      Anyway, let me know how you get on – I’m about to dive into the joys of the AWS SKD for PHP (it’s actually lovely!). When you get some time have a look at composer – it’s lovely!

      Hope that that helps.

      Dom

      p.s. Just as a though – could you write a query that’ll populate a list of account#s – users a great at adding silly things to search for and while PDO is brilliant at avoiding SQL injection attacks – it might be nice to help them out with limiting what they can enter…?

    • in reply to: Is this JavaScript problem? #1460830

      This is dom.php 😉

      [PHP]setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
      $dbconn->exec(‘SET NAMES “utf8″‘);
      }catch (PDOException $e){
      $error = “Unable to connect to the database server.”;
      }
      if(!empty($_POST[“submit”])){ // Should perhaps check to see if $_POST[‘apt’] exists in the first place…?
      try{
      $query = $dbconn->prepare(”
      SELECT
      *
      FROM
      `payments`
      WHERE
      `apt` = :apt
      “);
      $query->execute(array(
      “:apt” => $_POST[‘apt’]
      ));
      if($query->rowCount() > 0){
      $lines = array();
      while($row = $query->fetch()){
      $lines[] = array(
      “acctno” => $row[“acctno”],
      “bname” => $row[“bname”],
      “purpose” => $row[“purpose”],
      “paidamt” => $row[“paidamt”],
      “amtdue” => $row[“amtdue”],
      “prevbal” => $row[“prevbal”],
      “datepaid” => $row[“datepaid”],
      “pd” => $row[“pd”]
      );
      }
      }else{
      $error = “No listing for apartment!”;
      }
      // JUST TO CHECK:
      var_dump($lines);
      }catch(PDOException $e){
      $error = “Error retrieving payments: “.$e->getMessage();
      }
      }else{
      if(!empty($_POST[“update”])){
      try{
      $query = $dbconn->prepare(”
      UPDATE
      `payments`
      SET
      `name` = :name,
      `amtpaid` = :amtpaid,
      `rentdue` = :rentdue,
      `prevbal` = :prevbal,
      `hudpay` = :hudpay,
      `tentpay` = :tentpay,
      `datepaid` = :datepaid,
      `late` = :late,
      `comments` = :comments,
      `paidsum` = :paidsum
      WHERE
      `apt` = :apt
      “);
      $query->execute(array(
      “:name” => $_POST[“name”],
      “:amtpaid” => $_POST[“amtpaid”],
      “:rentdue” => $_POST[“rentdue”],
      “:prevbal” => $_POST[“prevbal”],
      “:hudpay” => $_POST[“hudpay”],
      “:tentpay” => $_POST[“tentpay”],
      “:datepaid” => $_POST[“datepaid”],
      “:late” => $_POST[“late”],
      “:comments” => $_POST[“comments”],
      “:paidsum” => $_POST[“paidsum”],
      “:apt” => $_POST[‘apt’]
      ));
      }catch(PDOException $e){
      $error = “Error updating payments: “.$e->getMessage();
      }
      }
      }
      include “dom.html.php”;[/PHP]

      and this is dom.html.php:

      [HTML]

      Make an url!

      [/HTML]

      Give that a try… and then we’ll get onto the JavaScript 😉

      Don’t forget the var_dump, see if what you’re getting back is what you’re expecting!

      Take care,

      Dom

    • in reply to: Is this JavaScript problem? #1460828

      WOW 12Strings, no wonder I was getting confused… one document with PHP, HTML, JavaScript, SQL and the odd bit of CSS all mixed up? I code a lot with JavaScript and PHP and I still end up putting var in my PHP… also, there must be a special hell for people who make coders look at old code – I look at things that I coded 6 months ago and feel slightly poorly!

      Your 2nd version looks like it won’t work – I’ve copied and pasted it and it seems as though it’s incorrectly nested… probably down to the mixture of languages 😉 For instance – your table and form don’t get started for the rows!

      Over the course of the years I’ve been at this I’ve clocked the value of splitting things down. I think I mentioned this in my original reply but write your whatever code within a PHP file then get it to var_dump what you want at the bottom of the script as basic text… then write your html… then your JavaScript… does that make sense. Bear with and I’ll have a crack:

    Viewing 15 replies - 1 through 15 (of 16 total)