Software Developer survey

xox

Joined Sep 8, 2017
517
"...although such a low percentage points to problems with inclusion in the tech industry in general and Stack Overflow in particular. In regions including the United States, India, and the UK, women are represented at higher levels among students than among professional developers."
This irks me to no end. There seems to be a real disconnect with reality these days. The simple fact is that by nature women just happen to have less of a tendency to be interested in computer science. Which isn't to say that they should be discouraged from the field. If they truly have a passion for it, great, (and I have indeed met some extremely talented female programmers) but pushing for equal numbers for the sake of "diversity" is just plain nonsense.
 

bogosort

Joined Sep 24, 2011
571
This irks me to no end. There seems to be a real disconnect with reality these days. The simple fact is that by nature women just happen to have less of a tendency to be interested in computer science. Which isn't to say that they should be discouraged from the field. If they truly have a passion for it, great, (and I have indeed met some extremely talented female programmers) but pushing for equal numbers for the sake of "diversity" is just plain nonsense.
How did you learn of this "simple fact" that women are less interested in computer science by nature? Do men have a CS gene?
 

xox

Joined Sep 8, 2017
517
How did you learn of this "simple fact" that women are less interested in computer science by nature? Do men have a CS gene?
Consider this. If someone took a fertilized chicken egg and incubated it, allowed it to hatch, and then attempted to raise the chick up to be a computer scientist, what would you say the probability of that working out to be? Honestly now.

That's an extreme example, obviously, but the point is that genetics does play a role in things. And of course genetics is ultimately born from the pressures of the external environment so after many generations of tutoring chickens you could one day end up with a bird competent enough to become CIO of Chick'N'Bits Software.

But the fact remains that we do all have some sort of genetic predisposition toward one thing or another. And taken as a group one can clearly see certain statistical patterns. Men tend to be more mechanically inclined. On average. Women tend to be more interested in social work. On average. Again these are not absolutes and some day in the however distant future those numbers could flip. But here and now they are what they are. What's the problem with that? As long as we don't use that information prejudicially then there is none.
 

Thread Starter

wayneh

Joined Sep 9, 2010
16,568
But the fact remains that we do all have some sort of genetic predisposition toward one thing or another.
I do agree, and decades of social engineering based on the notion that nature plays no role (and that all you need is nurture) has done damage to society.

You can hypothesize many reasons why women avoid CS, but the bottom line is that it's a job they can physically do, it's lucrative if you're
good, and everyone says the career outlook remains bright. And yet women are not attracted to the field. Heck, a lot of men are not attracted to it either.
 

bogosort

Joined Sep 24, 2011
571
Consider this. If someone took a fertilized chicken egg and incubated it, allowed it to hatch, and then attempted to raise the chick up to be a computer scientist, what would you say the probability of that working out to be? Honestly now.

That's an extreme example, obviously, but the point is that genetics does play a role in things. And of course genetics is ultimately born from the pressures of the external environment so after many generations of tutoring chickens you could one day end up with a bird competent enough to become CIO of Chick'N'Bits Software.

But the fact remains that we do all have some sort of genetic predisposition toward one thing or another. And taken as a group one can clearly see certain statistical patterns. Men tend to be more mechanically inclined. On average. Women tend to be more interested in social work. On average. Again these are not absolutes and some day in the however distant future those numbers could flip. But here and now they are what they are. What's the problem with that? As long as we don't use that information prejudicially then there is none.
My problem with your conjecture is that you take it as fact, as if it is self-evident. But the reality is that we have absolutely no idea how molecular structure is mapped to emergent, macro-scale behavior. We can't even say if such a mapping is possible.

The alternative hypothesis is that behavior in general -- and a predilection toward CS in specific -- is dominated by environmental experience. I don't think any rational person could argue against the idea that environment and culture have a profound effect on social behavior. Do you believe that Jihadist fundamentalists in the Middle East are genetically predisposed to terrorism? Or could it be a result of constant indoctrination, compounded by growing up in a war-torn country without education or alternative views of thought?

Consider that for nearly the entirety of human history, women have been treated as second-class citizens. They couldn't even vote in the U.S. until well into the 20th century. What does that say about our cultural heritage? It says that women's opinions were not deemed worthy enough to have a say in the land of the free. And while it's easy enough to claim that our ugly past is in the past, that we're much more enlightened now, cultural influences have enormous inertia -- they are literally ingrained in us and everything we do. When generation after generation raises their sons with a different set of expectations than their daughters, we become blind to the effects. But the numbers don't lie, and they tell us that sexism is subtle but real.

So, on the one side we have a hypothesis with precisely zero evidence and no plausible explanatory mechanism, and on the other we have a hypothesis with enormous amounts of evidence and reasonable explanatory power. How someone can conclude that genetics is the likelier factor is beyond me.
 

bogosort

Joined Sep 24, 2011
571
I do agree, and decades of social engineering based on the notion that nature plays no role (and that all you need is nurture) has done damage to society.

You can hypothesize many reasons why women avoid CS, but the bottom line is that it's a job they can physically do, it's lucrative if you're
good, and everyone says the career outlook remains bright. And yet women are not attracted to the field. Heck, a lot of men are not attracted to it either.
No rational person says that "nature" plays zero role in who we are; that's a straw man. Correct me if I'm wrong, but it seems like you're saying that those who call out sexism as a cultural phenomenon are engaging in "social engineering" and doing damage to society. That's some sad irony.
 

xox

Joined Sep 8, 2017
517
I do agree, and decades of social engineering based on the notion that nature plays no role (and that all you need is nurture) has done damage to society.

You can hypothesize many reasons why women avoid CS, but the bottom line is that it's a job they can physically do, it's lucrative if you're
good, and everyone says the career outlook remains bright. And yet women are not attracted to the field. Heck, a lot of men are not attracted to it either.
Well said. And we do need to make sure that diversity is always welcome of course. Blindly striving for equal numbers however is just pure foolishness.
 

xox

Joined Sep 8, 2017
517
My problem with your conjecture is that you take it as fact, as if it is self-evident. But the reality is that we have absolutely no idea how molecular structure is mapped to emergent, macro-scale behavior. We can't even say if such a mapping is possible.

The alternative hypothesis is that behavior in general -- and a predilection toward CS in specific -- is dominated by environmental experience. I don't think any rational person could argue against the idea that environment and culture have a profound effect on social behavior. Do you believe that Jihadist fundamentalists in the Middle East are genetically predisposed to terrorism? Or could it be a result of constant indoctrination, compounded by growing up in a war-torn country without education or alternative views of thought?

Consider that for nearly the entirety of human history, women have been treated as second-class citizens. They couldn't even vote in the U.S. until well into the 20th century. What does that say about our cultural heritage? It says that women's opinions were not deemed worthy enough to have a say in the land of the free. And while it's easy enough to claim that our ugly past is in the past, that we're much more enlightened now, cultural influences have enormous inertia -- they are literally ingrained in us and everything we do. When generation after generation raises their sons with a different set of expectations than their daughters, we become blind to the effects. But the numbers don't lie, and they tell us that sexism is subtle but real.

So, on the one side we have a hypothesis with precisely zero evidence and no plausible explanatory mechanism, and on the other we have a hypothesis with enormous amounts of evidence and reasonable explanatory power. How someone can conclude that genetics is the likelier factor is beyond me.
And so you would argue that the only thing holding a chicken back from writing code is the fact that it's being held down by social pressures? :D

Look, I do agree that sexism exists and has throughout time led to various unjustices. And to be fair, this whole push for diversity is really probably just a reactive force against that. But we need to strike a balance between the two, not destroy one or the other.
 

bogosort

Joined Sep 24, 2011
571
And so you would argue that the only thing holding a chicken back from writing code is the fact that it's being held down by social pressures? :D
Sure, if the genetic difference between chicken and human male were less than the genetic difference between human male and human female. But since human males and females are practically genetic twins with respect to other species' genomes, I'll stick with the argument that there's no scientific basis for assuming that women are genetically predisposed against becoming computer scientists.

Look, I do agree that sexism exists and has throughout time led to various unjustices. And to be fair, this whole push for diversity is really probably just a reactive force against that. But we need to strike a balance between the two, not destroy one or the other.
Likewise, I'm not saying that the question of What exactly are we supposed to do about sexism? has an easy answer. Nor am I saying that the various diversity initiatives all have it right; I am in no way convinced of this. Nor do I believe that "do something, anything" is the right course of action when the solution space is not clear.

What I am suggesting is simply this: If a rational person believes that genetics plays a significant part in why women are under-represented in STEM fields, then they need to learn more about genetics because the science does not agree with that conclusion in any freaking way. As a corollary to this, I would also humbly suggest re-examining one's unstated beliefs on the matter, particularly with an eye to the history of humanity and the role of culture in it.
 

Thread Starter

wayneh

Joined Sep 9, 2010
16,568
What I am suggesting is simply this: If a rational person believes that genetics plays a significant part in why women are under-represented in STEM fields, then they need to learn more about genetics because the science does not agree with that conclusion in any freaking way.
Prove it. Your soap-box grandstanding is not evidence. I think you'll find the majority of evidence shows that men and women's brains are indeed wired differently. The "nurture" argument has been steadily losing ground against the "nature" side for decades as more and more evidence accumulates that we are products of our genes. I can't help but chuckle that even Time magazine had to admit that men and women might be born different.
 
/--/ I think you'll find the majority of evidence shows that men and women's brains are indeed wired differently.
....and in other news, water is wet. No two brains are "wired" the same regardless of how you want to simplify the issue. You state the obvious as though it is evidence to support some point that is, apparently, divined by some kind of projective test.

https://content.time.com/time/covers/0,16641,19920120,00.html
I can't help but chuckle that even Time magazine had to admit that men and women might be born different.
You have a very low chuckle threshold.They *had* to? Which Time article are you citing where they said that they were born the same?

The "nurture" argument has been steadily losing ground against the "nature" side for decades as more and more evidence accumulates that we are products of our genes.
Prove it. Your soap-box grandstanding is not evidence.
 

bogosort

Joined Sep 24, 2011
571
Prove it. Your soap-box grandstanding is not evidence. I think you'll find the majority of evidence shows that men and women's brains are indeed wired differently. The "nurture" argument has been steadily losing ground against the "nature" side for decades as more and more evidence accumulates that we are products of our genes. I can't help but chuckle that even Time magazine had to admit that men and women might be born different.
You say that I'm grandstanding, so I considered the possibility. This thread has definitely increased my blood pressure -- hell, I really wanted to attack your post -- so maybe I am grandstanding. But grandstanders aren't interested in conversation; they just want a soap-box to stand on, and I'm genuinely interested in rational conversation. Unfortunately, I don't believe you and I can have a rational conversation about this subject.
 

nsaspook

Joined Aug 27, 2009
7,901
Prove it. Your soap-box grandstanding is not evidence. I think you'll find the majority of evidence shows that men and women's brains are indeed wired differently. The "nurture" argument has been steadily losing ground against the "nature" side for decades as more and more evidence accumulates that we are products of our genes. I can't help but chuckle that even Time magazine had to admit that men and women might be born different.
It would be out of the norm of evolution and species survival for our brains to be exactly alike. The evolution of several just as powerful but slightly different forms of human intelligence separated by sex (sometimes a blending of sexes) doesn't seem that odd to me.

Even if we are born with much the same brain structure (I don't think we are) the hormonal changes after birth modify our sex typed organs including the brain. It's 'how' they work not how 'well' they work. IMO these differences are most noticeable at the ends of the spectrum where engineering/computer types seem to cluster because it's a 'thing' orientated culture for those with that bias in intelligence.

https://stanmed.stanford.edu/2017spring/how-mens-and-womens-brains-are-different.html
https://en.wikipedia.org/wiki/Neuroscience_of_sex_differences
https://www.psychologytoday.com/us/blog/hope-relationships/201402/brain-differences-between-genders
 
Last edited:

Thread Starter

wayneh

Joined Sep 9, 2010
16,568
A nature/nurture debate might be fun and interesting, maybe moreso than my original topic, but this is my thread and its topic has only the most tenuous connection to that debate.

Let's let it go and return the thread to its dull topic.
 

nsaspook

Joined Aug 27, 2009
7,901
Most of us are not IT guys or career software programmers as this is a electronics centered site where programming is usually just another wire to build the device. The survey tells us very little about these types of software developers other than the basic Demographics being much the same.
 

Thread Starter

wayneh

Joined Sep 9, 2010
16,568
Most of us are not IT guys or career software programmers as this is a electronics centered site where programming is usually just another wire to build the device. The survey tells us very little about these types of software developers other than the basic Demographics being much the same.
Yeah, I was hoping to find data on just how rare it was for an old guy from my locale to put an app in the AppStore. I didn't get close to finding that, but I nevertheless found that survey a little interesting. I had no idea that javascript was such a big deal, at least for the folks that answer polls at SO.
 

nsaspook

Joined Aug 27, 2009
7,901
Yeah, I was hoping to find data on just how rare it was for an old guy from my locale to put an app in the AppStore. I didn't get close to finding that, but I nevertheless found that survey a little interesting. I had no idea that javascript was such a big deal, at least for the folks that answer polls at SO.
If you design for web/browsers interfaces javascript with all its warts in a must for many database type application to provide an interactive gui.
C:
void HTTPPrint_mbmcdata(WORD num)
{
    time_t ltime;
    static long solar_volts, load_volts, cube_power, load_power, solar_power;
    static int mycolor, cube_panels = FALSE, water_alarm = FALSE;

    // Determine what mbmc status data to return
    switch (num) {
    case 0:
        mbmc_put(mbmc_buffer.ccvoltage, 0);
        break;
    case 1:
        mbmc_put(mbmc_buffer.inputvoltage, 0);
        break;
    case 2:
        mbmc_put(mbmc_buffer.primarypower_B1, 0);
        break;
    case 3:
        mbmc_put(mbmc_buffer.primarypower_B2, 0);
        break;
    case 4:
        mbmc_put(mbmc_buffer.systemvoltage, 0);
        break;
    case 5:
        mbmc_put(mbmc_buffer.currentin, 2);
        break;
    case 6:
        // fixup battery charging current
        mbmc_buffer.current = mbmc_buffer.currentin; // default on PV current to CC
        if (mbmc_buffer.boc == 1) { // charging 1
            mbmc_buffer.current = cell[1].current;
        }
        if (mbmc_buffer.boc == 2) { // charging 2
            mbmc_buffer.current = cell[2].current;
        }
        mbmc_put(mbmc_buffer.current, 2);
        break;
    case 7:
        mbmc_put(mbmc_buffer.currentload, 2);
        break;
    case 8:
        mbmc_put(mbmc_buffer.thermo_batt, 2);
        break;
    case 9:
        mbmc_put(mbmc_buffer.pick, 10);
        break;
    case 10:
        mbmc_put(mbmc_buffer.boi, 10);
        break;
    case 11:
        mbmc_put(mbmc_buffer.boc, 10);
        break;
    case 12:
        mbmc_put(mbmc_buffer.alert, 10);
        break;
    case 13:
        mbmc_put(mbmc_buffer.bn, 10);
        break;
    case 14: // bsoc #1
        mbmc_put((DWORD) hist[1].bsoc, 10);
        break;
    case 15: // bsoc #2
        mbmc_put((DWORD) hist[2].bsoc, 10);
        break;
    case 16:
        mbmc_put(PVEFF, 10);
        break;
    case 17:
        mbmc_put(TOTEFF, 10);
        break;
    case 18:
        mbmc_put(CCEFF, 10);
        break;
    case 19:
        mbmc_put((DWORD) hist[1].esr, 10);
        break;
    case 20:
        mbmc_put((DWORD) hist[2].esr, 10);
        break;
    case 21:
        mbmc_put(cell[1].current, 2);
        break;
    case 22:
        mbmc_put(cell[2].current, 2);
        break;
    case 23:
        mbmc_put(remote_daq.inputvoltage, 0);
        break;
    case 24:
        mbmc_put(remote_daq.inputcurrent, 2);
        break;
    case 25:
        mbmc_put(remote_daq.voltagedrop, 0);
        break;
    case 26:
        mbmc_put(remote_daq.remotecurrent, 2);
        break;
    case 50: // this is a power function, the value passed is not used
        mbmc_put(mbmc_buffer.bn, 50);
        break;
    case 51: // this is a power function, the value passed is not used
        mbmc_put(mbmc_buffer.bn, 51);
        break;
    case 52: // this is a power function, the value passed is not used
        mbmc_put(mbmc_buffer.bn, 52);
        break;
    case 100: // print MBMC software version
        TCPPutROMString(sktHTTP, MBMC_VERSION);
        break;
    case 101: // print MBMC solar controller version and ID in HEX
        mbmc_put(mbmc_buffer.MBMCID, 3);
        break;
    case 110:
        mbmc_put(mbmc_status.sent / 1000, 12);
        break;
    case 111:
        mbmc_put(mbmc_status.received / 1000, 12);
        break;
    case 112:
        mbmc_put(mbmc_status.cmdsent, 10);
        break;
    case 113:
        mbmc_put(mbmc_status.cmdreceived, 10);
        break;
    case 120:
        mbmc_put(time_outs, 10);
        break;
    case 121:
        mbmc_put((DWORD) MIi, 10); // Number of data points saved
        break;
    case 122:
        ltime = SNTPGetUTCSeconds();
        mbmctime = gmtime(&ltime);
        TCPPutString(sktHTTP, (BYTE*) asctime(mbmctime));
        break;
    case 123:
        mbmc_put(crc_errors, 10);
        break;
    case 130: // Power Cube functions INIT
        mycolor = 0x7f7f7f;
        solar_volts = mbmc_buffer.inputvoltage;
        if (mbmc_buffer.boi == 1) {
            load_volts = mbmc_buffer.primarypower_B1;
        } else {
            load_volts = mbmc_buffer.primarypower_B2;
        }
        load_power = (load_volts * mbmc_buffer.currentload) / 10000;
        solar_power = (mbmc_buffer.inputvoltage * mbmc_buffer.currentin) / 10000;
        if (cube_panels) {
            cube_power = (long) 1999.9 - (CUBE_SCALE * log10(1.0 + abs(solar_power))); //use log10 and rescale
        } else {
            cube_power = (long) 1999.9 - (CUBE_SCALE * log10(1.0 + abs(load_power - solar_power))); //use log10 and rescale
        }
        if (cube_power < CUBE_SIZE) cube_power = CUBE_SIZE;

        if (solar_power > load_power) {
            mycolor = 0x98fb98; // positive power into the system, shades of green
            if (cube_power < 900) mycolor = 0x90ee90;
            if (cube_power < 400) mycolor = 0x7cfc00;
            if (cube_power < 300) mycolor = 0x32cd32;
        } else {
            mycolor = 0xfa8072; // shades of red
            solar_volts = load_volts; // switch the cube voltage when net power is negative
            if (cube_power < 900) mycolor = 0xb22222;
            if (cube_power < 400) mycolor = 0xdc143c;
            if (mbmc_buffer.boc == 0) { // Not charging
                mycolor = 0xffe4e1; // shades of red, misty rose
            }
        }
        if (!(mbmc_buffer.diversion.flag & 0x2)) { // mask out charger bit
            mycolor = 0x87cefa; //charger color shades of blue
            if (cube_power < 900) mycolor = 0x87ceeb;
            if (cube_power < 500) mycolor = 0x1e90ff;
            if (cube_panels) mycolor = 0x9932cc; // dark orchid for panel only power display
        } else {
            if (cube_panels) mycolor = 0xffffff; // white for panel only power display
            if (cube_panels && (mbmc_buffer.boc > HISTBATTNUM)) { // charging controller batteries
                mycolor = 0x99e4e1; // shades of green blue
            }
        }

        if (solar_volts < 11500) {
            solar_volts = 0;
        } else {
            solar_volts -= 11500;
        }

        mbmc_put(cube_power, 10);
        break;
    case 131:
        mbmc_put(mycolor, 10);
        break;
    case 132:
        mbmc_put(solar_volts / 2, 0);
        break;
    case 133:
        // fixup battery charging current for Solar Cube
        mbmc_buffer.current = mbmc_buffer.currentin; // default on PV current to CC
        if (mbmc_buffer.boc == 0) { // Not charging
            mbmc_buffer.current = mbmc_buffer.currentload;
        }
        if (mbmc_buffer.boc == 1) { // charging 1
            mbmc_buffer.current = cell[1].current;
        }
        if (mbmc_buffer.boc == 2) { // charging 2
            mbmc_buffer.current = cell[2].current;
        }
        if (cube_panels) mbmc_buffer.current = mbmc_buffer.currentin; // display pv current in panel mode
        mbmc_put(mbmc_buffer.current / 10, 2);
        break;
    case 134:
        cube_panels = FALSE;
        TCPPutROMString(sktHTTP, (ROM BYTE*) "RESET");
        break;
    case 135:
        cube_panels = !cube_panels;
        if (cube_panels) {
            TCPPutROMString(sktHTTP, (ROM BYTE*) "PANEL");
        } else {
            TCPPutROMString(sktHTTP, (ROM BYTE*) "NET");
        }
        break;
    case 200: // Display AC charger status
        if (mbmc_buffer.diversion.flag & 0x2) {
            TCPPutROMString(sktHTTP, (ROM BYTE*) "OFF");
        } else {
            TCPPutROMString(sktHTTP, (ROM BYTE*) "ON");
        }
        break;
    case 201: // Display power diversion status
        if (mbmc_buffer.diversion.flag & 0x1) {
            TCPPutROMString(sktHTTP, (ROM BYTE*) "OFF");
        } else {
            TCPPutROMString(sktHTTP, (ROM BYTE*) "ON");
        }
        break;
    case 202: // Display Battery Ganged mode
        if (mbmc_buffer.DIPSW & 0b00010000) {
            TCPPutROMString(sktHTTP, (ROM BYTE*) "Batteries 1 & 2 are GANGED.");
        } else {
            TCPPutROMString(sktHTTP, (ROM BYTE*) " ");
        }
        break;
    case 203: // Display alarm status
        if (alarms.mbmc_alarm.absorp || alarms.mbmc_alarm.equal) {
            if (alarms.mbmc_alarm.equal)
                TCPPutROMString(sktHTTP, (ROM BYTE*) "<li><b> Time to equal and check battery water</b></li>");
            else
                TCPPutROMString(sktHTTP, (ROM BYTE*) "<li><b> Time to check battery water</b></li>");

            if (!water_alarm) {
                water_alarm_warn(TRUE);
                water_alarm = TRUE; // once per alarm flag
            }
        } else {
            if (water_alarm)
                water_alarm_warn(FALSE);
            water_alarm = FALSE;
        }
        break;
    case 204: // Display alarm status
        if (alarms.mbmc_alarm.utility) {
            TCPPutROMString(sktHTTP, (ROM BYTE*) "<li><b> Utility power is off</b></li>");
        }
        break;
    case 205: // Display alarm status
        if (alarms.mbmc_alarm.inverter) {
            TCPPutROMString(sktHTTP, (ROM BYTE*) "<li><b> Inverter power is off</b></li>");
        }
        break;
    case 206: // Display alarm status
        if (alarms.mbmc_alarm.cpu) {
            TCPPutROMString(sktHTTP, (ROM BYTE*) "<li><b> A controller CPU flag is set</b></li>");
        }
        break;
    case 207: // Display remote DAQ status
        if (remote_daq.offline) {
            TCPPutROMString(sktHTTP, (ROM BYTE*) "<li><b> The remote DAQ is OFFLINE</b></li>");
        }
        break;
    case 208: // NEXT DISPLAY FUNCTION
        if (0) {
            TCPPutROMString(sktHTTP, (ROM BYTE*) "<li><b> The remote DAQ is OFFLINE</b></li>");
        }
        break;
    default:
        TCPPutROMString(sktHTTP, (ROM BYTE*) " N/A ");
    }
    return;
}
The embedded program generates html/xml data from sensor data while the browser javascript handles the web graphics interface using the web data.
Code:
<meta http-equiv="refresh" content="120" >
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Solar Power Cube</title>
<style>
body { margin: 0; }
canvas { width: 100%; height: 100% }
</style>

<a href="javascript:document.location.reload();"
ONMOUSEOVER="window.status = 'Refresh';
return true"
ONMOUSEOUT="window.status = 'Refresh Done.'">
<img src="images/refresh.gif"
width="115" height="31" border="0" /></a>
<script src="/mchp.js" type="text/javascript"></script>
</head>
<body>
<script type="text/javascript" src="includes/three.min.js"></script>

<script>
// We need several parameters to visualize the system operation
// 130 z cube size 0,2000: changes the camera z to the absolute power log10 of the system and moves
// a sprite bar in relationship to the cube.
// 131 mycolor cube base color 0x000000: green shades positive solar power in-flow, HTML HEX color codes,
// red shades load power out-flow, blue shades positive charger power in-flow.
// 132 x cube rotation speed 0,10: solar voltage indicator
// 133 y cube rotation speed 0,10: solar or battery current indicator.

var scene, camera, renderer;
var geometry, material, mesh;
var mycolor=0x7f7f7f, cubez=1300,cubecolor=0x00,cubex=0,cubey=0,cube_update=false,cube_type;
var map = THREE.ImageUtils.loadTexture( "images/sprite.png" );
var material1 = new THREE.SpriteMaterial( { map: map, color: 0xffffff, fog: false } );
var sprite = new THREE.Sprite( material1 );


init();
animate();

function init() {

scene = new THREE.Scene();

camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 1, 10000);
camera.position.z = 1000;

geometry = new THREE.BoxGeometry(200, 200, 200);



sprite.position.set( 0, ~mbmcdata(130)~ - 150, 0 );// this sets up the data for other cube fuctions so it must be first
sprite.scale.set( 500, 2, 1.0 ); // imageWidth, imageHeight
scene.add( sprite );

material = new THREE.MeshBasicMaterial({color: 0x000000, wireframe: true});

mesh = new THREE.Mesh(geometry, material);
scene.add(mesh);

renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);

document.body.appendChild(renderer.domElement);
window.addEventListener( 'resize', onWindowResize, false );

document.addEventListener( 'click', onDocumentMouseMove, false );
setTimeout("newAJAXCommand('status.xml', updateCubeStatus, true)",100);
}

function onWindowResize() {

camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();

renderer.setSize( window.innerWidth, window.innerHeight );
}


function onDocumentMouseMove( event ) {

cube_type= ~mbmcdata(135)~; // alternate cube display modes

}

function animate() {

if (cube_update) // dynamic updates from xml file
{
camera.position.z = cubez;
sprite.position.set( 0, cubez - 150.0, 0 );
mycolor = cubecolor;
mesh.rotation.x += (0.03 * cubex);
mesh.rotation.y += (0.03 * cubey);
} else { // update on refresh
camera.position.z = ~mbmcdata(130)~;
mycolor = ~mbmcdata(131)~;
mesh.rotation.x += (0.03 * ~mbmcdata(132)~);
mesh.rotation.y += (0.03 * ~mbmcdata(133)~);
}

mesh.material.color.setHex(mycolor);
requestAnimationFrame(animate);

renderer.render(scene, camera);
}

// Parses the xmlResponse from status.xml and updates the cube status
function updateCubeStatus(xmlData) {

if(!xmlData)
{
return;
}

// Update the CUBE value
cubez = getXMLValue(xmlData, 'cube0');
cubecolor = getXMLValue(xmlData, 'cube1');
cubex = getXMLValue(xmlData, 'cube2');
cubey = getXMLValue(xmlData, 'cube3');
cube_update=true;
}

</script>
</body>
</html>
 
Top