Jump to content

kikz

Herø
  • Content Count

    6,552
  • Joined

  • Last visited

  • Days Won

    4

kikz last won the day on July 5 2017

kikz had the most liked content!

Community Reputation

86 Apprentice

About kikz

  • Rank
    Champion

Contact Methods

  • Website URL
    http://robertgray.net.au

Profile Information

  • Gender
    Male
  • Location
    Your Mums' place ;)
  1. kikz

    Australian Tax Calculator

    Cannot take web development tutorials from a site that looks like that lol :p
  2. As I predicted... Columbia gets first 'polyamarous family' as three men legally established as a unit http://www.telegraph.co.uk/news/2017/06/13/colombia-gets-first-polyamorous-family-three-men-legally-established/ I'm like a visionary or something. Maybe just the something.
  3. When you call json on one server from JSON on another you cab get that problem. Normally the easiest way is to set the Access-Control-Allow-Origin header to "*" in the response header. But that has to be done on the server. Unfortunately you can't do that (and I did). You have to call using JSONP https://www.sitepoint.com/jsonp-examples/ is a good introduction basically, the original code won't work as-is (it's using plain old JSON). All you should need to do is append a ? to the end of the url you are calling e.g. http://192.168.0.12/api/v1/production/inverters? *I think*. I've always modified the response header. You're auth problem is something else and may be sorted by the right Auth header in the request. see. http://stackoverflow.com/questions/18264601/how-to-send-a-correct-authorization-header-for-basic-authentication (which coincidentally also has an example where he sets Access-Control-Allow headers.
  4. not sure why you're getting the python problems. cross domain is usually when you try to access resources from another server. usually with posting. cross domain get shouldn't be a problem. here's the new JS code you'll need to total. Totalling is pretty trivial. <script> $(function() { $.getJSON("http://www.robertgray.net.au/gday", function(data) { var table = $("<table><tr><th>Serial Number</th><th>Last Report Date</th><th>Status</th><th>Last</th><th>Max</th></tr></table>").addClass("table table-striped"); var totalLastReportWatts = 0; var totalMaxReportWatts = 0; $.each(data, function(index, item) { totalLastReportWatts += item.lastReportWatts; totalMaxReportWatts += item.maxReportWatts; var percent = ((item.lastReportWatts / item.maxReportWatts) * 100); var row = $("<tr></tr>").html("<td>" + item.serialNumber + "</td><td>" + new Date(item.lastReportDate) + "</td><td class='box'><div style='width: " + percent + "%'> </div></td><td>" + item.lastReportWatts + "</td><td>" + item.maxReportWatts+ "</td>"); table.append(row); }); var totalsRow = $("<tr></tr>").html("<td colspan='3'></td><td>" + totalLastReportWatts + "</td><td>" + totalMaxReportWatts + "</td>"); table.append(totalsRow); $("#results").append(table); }) }); </script>
  5. kikz

    Cancer

    Condolences. My step-father passed away from bowel cancer about 7 years ago. Apparently it's not nice (duh). I barely knew the man so I can't say I have had any close contact with that. My wife had cervical cancer diagnosed in late 2012, but she's all good and C free now. No one in my genetic family I know of has had Cancer.
  6. kikz

    I got windows 10 and it's not ok

    nah you're not the only person. If I had such a thing existed I may move to a large 4K screen instead of multiple 1080p screens.
  7. kikz

    I got windows 10 and it's not ok

    Ctrl+Windows+Right Arrow make it all worthwhile. So easy to quickly get your porn offscreen.
  8. np. Updated to show current reporting max as horizontal bars.
  9. Hey - bit of shameless advertising I guess. Some years ago (2010) a bunch of atomicans start Atomic F1, racing on Codemasters F1 2010. We managed races here on the forums. At one point we realised most of us were only posting in these threads. We pulled some new nonatomic members and went and started our own site http://www.atomicsimracing.net/ And when I say "we" I mean Lambo :) Anyway, we're a bunch of guys (though we don't exclude girls :)) who love talking motorsport and tech - and enjoy meeting regularly online for sim races. We've got our own hosted servers etc and run a few sims. We've got the new seasons starting soon in Assetto Corsa in the Ferrari F138 Automobilista in the Caterham Superlight Sequential Codemasters F1 2016 We also are running a Dirt: Rally series ongoing have an iRacing team that currently runs a few series: ProtoGT in the LMP2, Star Maza, Mazda MX-5, Skip Barber If you're interested in dipping your toe into the world of sim racing come say hi to forum old timers like: Lambo Flouncy Mark84 Ghost kikz nobody813 Fredzfrog and a bunch more (people as well as long time atomicans). Come along to the forums, say hi, and have some fun on and off the track References :p http://forums.atomicmpc.com.au/index.php/topic/53754-atomic-f1-gp1-season-7/ http://forums.atomicmpc.com.au/index.php/topic/53758-atomicf1-gp2-season-3/ http://forums.atomicmpc.com.au/index.php/topic/51349-atomic-f1-gp1-season-6/ http://forums.atomicmpc.com.au/index.php/topic/51020-f1-2012/ http://forums.atomicmpc.com.au/index.php/topic/51352-atomic-f1-gp2-season-2/ http://forums.atomicmpc.com.au/index.php/topic/49025-atomic-f1-gp2-championship/ http://forums.atomicmpc.com.au/index.php/topic/48094-atomic-f1-season-5/ http://forums.atomicmpc.com.au/index.php/topic/45163-pc-f1-2011-atomic-championship/ http://forums.atomicmpc.com.au/index.php/topic/43342-f1-2011/ http://forums.atomicmpc.com.au/index.php/topic/41553-f1-2010-atomic-championship-season-3/ http://forums.atomicmpc.com.au/index.php/topic/36170-f1-2010-atomic-championship/ and a bunch more I cbf finding.
  10. kikz

    I got windows 10 and it's not ok

    Why on gods green earth would you want to run classic shell. Win 10 UX is buttkicking. #nottrolling :)
  11. 1) Authentication - I guess it's using basic authentication and sending in clear text? You can check it out by hitting F12 and going to the Network tab (assuming chrome here), finding the call to the endpoint and then looking at it's request headers. If it is in fact basic auth you can follow the answer here http://stackoverflow.com/questions/5507234/how-to-use-basic-auth-with-jquery-and-ajax really easy to do and it'll add the header to every request from that page. 2) yeah, It's blank because the code that creates the table only executes when the call to the endpoint returns successfully. at the moment you're not getting authorized, so it's not returning successfully :) Fix #1 and #2 should sort itself. Oh yeah, if you want it all graphicals and stuff you can just create a column instead of two and create a div with border set to 1px (border: 1px solid #000000 in css) and width to the max value (Set this in js). Then create another div with same starting point on the left hand side and create it with a solid background colour (e.g. background-color: #0000FF) and set the width to the last reported value. Or you could get fancy and use canvas, but meh. If you're trying to work out what's going on where in JS, include "console.debug('stuff')"; in the appropriate place. then pop open your buddy F12 and go to the console tab and see if it's output.
  12. <html> <head> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> <script src="https://code.jquery.com/jquery-3.1.1.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script> <style> table td.box { width: 250px; border-left: 1px solid #000000; border-right: 1px solid #000000; } table td.box div { background-color: #0000FF; } </style> </head> <body> <div id="results"></div> <script> $(function() { $.getJSON("http://www.robertgray.net.au/gday", function(data) { var table = $("<table><tr><th>Serial Number</th><th>Last Report Date</th><th>Status</th><th>Last</th><th>Max</th></tr></table>").addClass("table table-striped"); $.each(data, function(index, item) { var percent = ((item.lastReportWatts / item.maxReportWatts) * 100); var row = $("<tr></tr>").html("<td>" + item.serialNumber + "</td><td>" + new Date(item.lastReportDate) + "</td><td class='box'><div style='width: " + percent + "%'> </div></td><td>" + item.lastReportWatts + "</td><td>" + item.maxReportWatts+ "</td>"); table.append(row); }); $("#results").append(table); }) }); </script> </body> </html> okay. Whipped this up just now. All you need to do is copy it to a HTML file and click on it. oh and change the url from mine to yours :) that's the url in the getJSON. - which is just the data copied from your OP so i can test and verify. Here's a working example. http://www.robertgray.net.au/gday-example oh yeah... the dates... I guess it's not reporting year? and Jan 18 was when you were trying this? You can just do .getMonth and .getDay to get rid of the rest. Techologies: - jquery (hosted on cdn) - twitter bootstrap for styling the table (hosted on cdn). The most basic of basic web technologies :) From there you can do an easy sum on the inverters to get unique -rather than the raw data dump I have here.
  13. Sorry I'm late haha :) Not sure why people even consider Excel :) HTML page + javascript will read JSON piece of piss, then iterate in JS and create table. http://192.168.0.12/...ction/inverters = REST API. hit it using jquery with something like $.getJSON("http://192.168.0.12/api/v1/production/inverters", function(data) { // Build a table here using the returned data. // This will output to html page. // piss easy. all dynamic. }); see http://api.jquery.com/jquery.getjson/ I'm balls deep in deadline and shouldn't even be browsing here or taking the time to type this, otherwise I'd type up a complete working example. However, it realy is easy and not at all requiring "uber" technology :) Happy to help out if needed. JSON is built for this - JavaScript Object Notation. i.e. Use JavaScript. Ironically or coincidentally I'm balls deep in finishing a web-api REST end-point that emits JSON
  14. I expect v7.1 will not break v7.0 . I expect that v8.0 can break v7.0. Major version numbers are for exactly that reason, breaking changes. So typically, if you upgrade from one version to another you can accept that things may break. People should read the change log before upgrading. Same as v1.0 of an API can completely fuck apps coded against v0.9. This isn't really in direct response to your OP, just version numbering in general, and stuff like Windows is a bit different, where Microsoft would go bankrupt if an upgrade from windows 8.1 to window 10 meant you had to reinstall all your data and your software working on 8.1 doesn't work on 10. MS are a definite exception though, with their diligence in maintaing backwards compatibility.
  15. kikz

    What are you playing at the moment?

    Playing automobilista a fair bit lately.
×