Codingphpmedo

 

Press Ctrl+Enter to quickly submit your post
Quick Reply  
 
 
  
 From:  ANT_THOMAS   
 To:  Peter (BOUGHTONP)     
41694.4 In reply to 41694.2 
Right, we're close!

If I include the var in the 2nd line I get a 500 server error.

With it removed it outputs the 52nd and final part of the array but not the full array, I've checked by changing the 52 to another number.
 
Code: 
   for ( $i = 1 ; $i <= 52 ; $i++ )
        $marking[i] = strtotime((-1*$i).' week sunday') * 1000;

   function convert_to_markings( $CurMarking )
    {
        return "{ xaxis: { from: ".($CurMarking).", to: ".($CurMarking-96400000)." }, color: \"#F3F3ED\" }";
    }

    $markings = array_map( "convert_to_markings" , $marking );

    $markings = implode( "," , $markings );
Output from that is
 
Code: 
{ xaxis: { from: 1425168000000, to: 1425071600000 }, color: "#F3F3ED" }

Please help Peter!
0/0
 Reply   Quote More 

 From:  Chris (CHRISSS)  
 To:  ANT_THOMAS      
41694.5 In reply to 41694.4 
There's a missing $ in the for loop code. $marking[i] should be $marking[$i]

Dunno if that will fix it though.

Me
0/0
 Reply   Quote More 

 From:  ANT_THOMAS   
 To:  Chris (CHRISSS)     
41694.6 In reply to 41694.5 
I have literally just spotted that, working now :D
0/0
 Reply   Quote More 

 From:  Chris (CHRISSS)  
 To:  ANT_THOMAS      
41694.7 In reply to 41694.6 
Good timing :D Glad it's working.

Me
0/0
 Reply   Quote More 

 From:  ANT_THOMAS   
 To:  Chris (CHRISSS)     
41694.8 In reply to 41694.7 
It nicely highlights the weekends on my electricity usage chart.
0/0
 Reply   Quote More 

 From:  Peter (BOUGHTONP)  
 To:  Chris (CHRISSS)     
41694.9 In reply to 41694.5 
Bah! Damn PHP and its stupid dollars.
0/0
 Reply   Quote More 

 From:  Chris (CHRISSS)  
 To:  ANT_THOMAS      
41694.10 In reply to 41694.8 
Is that from the camera you have pointing at your electric meter?

Me
0/0
 Reply   Quote More 

 From:  Chris (CHRISSS)  
 To:  Peter (BOUGHTONP)     
41694.11 In reply to 41694.9 
Who puts dollar symbols in front of variable names? :(

Me
0/0
 Reply   Quote More 

 From:  CHYRON (DSMITHHFX)  
 To:  Chris (CHRISSS)     
41694.12 In reply to 41694.11 
jquery. Well, in front of selectors.

----
"American football is when a bunch over over paid American sports people frightened of being hurt strap on a ton of armour to play a game of rugby"
0/0
 Reply   Quote More 

 From:  ANT_THOMAS   
 To:  Chris (CHRISSS)     
41694.13 In reply to 41694.10 
That's the one.

I was originally just putting it in a spreadsheet and trawling through a load of readings every week or so (never got OCR working).

But now I've got it all in a MySQL database where I've got a little form that checks the last row in the database, then checks the date and displays the image for the next reading I need to enter, once entered it calculates the usage that day and the cost that day and adds them to the database. Data stored is - date, total meter reading, daily usage, cost. When it's up to date it tells me there's nothing more to add.

 
 

Attachments:

0/0
 Reply   Quote More 

 From:  ANT_THOMAS   
 To:  ANT_THOMAS      
41694.14 In reply to 41694.13 
The last 12 Weeks

Attachments:

0/0
 Reply   Quote More 

 From:  Peter (BOUGHTONP)  
 To:  Chris (CHRISSS)     
41694.15 In reply to 41694.11 
Idiots who blindly copy bits of shell script into a toy language without really knowing what they're doing, and then come up with lame justifications of why they shouldn't fix the nonsense when everyone uses the damned thing. Probably.
0/0
 Reply   Quote More 

 From:  Peter (BOUGHTONP)  
 To:  CHYRON (DSMITHHFX)     
41694.16 In reply to 41694.12 
A perfect example!

...of an idiot who doesn't know what things are. :S

Hmm, bit harsh? Maybe just a dunce. (hug)

jQuery neither prefixes variable names not puts dollars in front of selectors. It aliases itself as $, and as a function it can have arguments, the first of which can be a selector, though it also can be other things, and also has various methods attached to the function's object itself.

Which is not to say it isn't a bit dumb, but it is at least more convenient than typing case sensitive jQuery, though even that isn't as $durbrained $as $bloody $_PHP.

0/0
 Reply   Quote More 

 From:  Peter (BOUGHTONP)  
 To:  ANT_THOMAS      
41694.17 In reply to 41694.14 
It seems cost is just half of usage - or does that change?
0/0
 Reply   Quote More 

 From:  ANT_THOMAS   
 To:  Peter (BOUGHTONP)     
41694.18 In reply to 41694.17 
Cost is calculated based on a standing daily rate + (units used * unit rate)
0/0
 Reply   Quote More 

 From:  koswix  
 To:  Peter (BOUGHTONP)     
41694.19 In reply to 41694.15 
I've been wondering about that lately. Linux is, in theory, a much more secure OS than windows. But how many Linux users consist of people like me that spend days at a time running commands and scripts they find down the back of the internet trying to make bits of software work without any real clue of wtf they are actually doing? 

 ▪                    
             ┌────┐    ┌────┐                      
          │    │    │    │ ▪                    
          │    └────┘    │                      
          │   ──┐  ┌──   │ ▪                    
   ┌──────┤    ▪    ▪    │                      
  ┌┘      │              │ ▪                    
┌─┤       └──┐  │  │  ┌──┘                      
│ │          │ ││  ││ │   ┌─┐                   
│ │          └─┼┤  └┴─┴───┘ │                   
│ │           ─┘│           │                   
│ │   ┌──────┐  └┬──────────┘                   
  │   │      │   │                              
  │   │      │   │                              
  └───┘      └───┘                              
If Feds call you and say something bad on me, it may prove what I said are truth, they are afraid of it.
0/0
 Reply   Quote More 

 From:  ANT_THOMAS   
 To:  koswix     
41694.20 In reply to 41694.19 
Depending on your level of knowledge, running a command is less of an issue because you can see what you're inputting (and hopefully have some idea what it does, but often not), running scripts though is a different issue since I doubt most people check every line.

Could have a format c: in there somewhere.
0/0
 Reply   Quote More 

 From:  CHYRON (DSMITHHFX)  
 To:  Peter (BOUGHTONP)     
41694.21 In reply to 41694.16 
It does stuff. With dollar signs. I get dollars from it. Your fragile ego gets a wee boost. Win, win, win.

----
"American football is when a bunch over over paid American sports people frightened of being hurt strap on a ton of armour to play a game of rugby"
0/0
 Reply   Quote More 

 From:  CHYRON (DSMITHHFX)  
 To:  koswix     
41694.22 In reply to 41694.19 
I generally avoid doing stuff like that on mission-critical (e.g. L4D) systems. Usually if there's much doubt or risk I'll test it out in a VM first.

----
"American football is when a bunch over over paid American sports people frightened of being hurt strap on a ton of armour to play a game of rugby"
0/0
 Reply   Quote More 

 From:  koswix  
 To:  ANT_THOMAS      
41694.23 In reply to 41694.20 
Installing node.js (I think) the other day on a Pi and I curl'd a script to do all the installing. Didn't even look at the script first. Figured it'd be OK, cos after all I haven't even changed the default user/pass on the pi yet  :-O~~~  :-O~~~  :-O~~~  T_T

 ▪                    
             ┌────┐    ┌────┐                      
          │    │    │    │ ▪                    
          │    └────┘    │                      
          │   ──┐  ┌──   │ ▪                    
   ┌──────┤    ▪    ▪    │                      
  ┌┘      │              │ ▪                    
┌─┤       └──┐  │  │  ┌──┘                      
│ │          │ ││  ││ │   ┌─┐                   
│ │          └─┼┤  └┴─┴───┘ │                   
│ │           ─┘│           │                   
│ │   ┌──────┐  └┬──────────┘                   
  │   │      │   │                              
  │   │      │   │                              
  └───┘      └───┘                              
If Feds call you and say something bad on me, it may prove what I said are truth, they are afraid of it.
0/0
 Reply   Quote More 

Reply to All    
 

1–20  21–23

Rate my interest:

Adjust text size : Smaller 10 Larger

Beehive Forum 1.5.2 |  FAQ |  Docs |  Support |  Donate! ©2002 - 2024 Project Beehive Forum

Forum Stats