Software Developer survey

Discussion in 'Programmer's Corner' started by wayneh, Jun 14, 2018.

  1. wayneh

    Thread Starter Expert

    Sep 9, 2010
    16,102
    6,218
    I was looking for anything I could find about the demographics of app developers, which I didn't really find, but I stumbled across this today and found it fascinating.

    https://insights.stackoverflow.com/survey/2018

    I had to laugh that Visual Basic is the most dreaded language. No argument from me. :D
     
    xox likes this.
  2. xox

    Member

    Sep 8, 2017
    351
    74
    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.
     
  3. bogosort

    Senior Member

    Sep 24, 2011
    365
    212
    How did you learn of this "simple fact" that women are less interested in computer science by nature? Do men have a CS gene?
     
  4. xox

    Member

    Sep 8, 2017
    351
    74
    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.
     
  5. wayneh

    Thread Starter Expert

    Sep 9, 2010
    16,102
    6,218
    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.
     
    nsaspook likes this.
  6. bogosort

    Senior Member

    Sep 24, 2011
    365
    212
    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.
     
  7. wayneh

    Thread Starter Expert

    Sep 9, 2010
    16,102
    6,218
    That much is apparent. :p
     
  8. bogosort

    Senior Member

    Sep 24, 2011
    365
    212
    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.
     
  9. bogosort

    Senior Member

    Sep 24, 2011
    365
    212
    Great, then let's hear your expert opinion on the connection between protein folding and social behavior. What are the roles of amino acids in latent capability to do computer science?
     
  10. xox

    Member

    Sep 8, 2017
    351
    74
    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.
     
  11. xox

    Member

    Sep 8, 2017
    351
    74
    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.
     
  12. bogosort

    Senior Member

    Sep 24, 2011
    365
    212
    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.

    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.
     
  13. wayneh

    Thread Starter Expert

    Sep 9, 2010
    16,102
    6,218
    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.
     
  14. Raymond Genovese

    Well-Known Member

    Mar 5, 2016
    1,643
    990
    ....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.

    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?

    Prove it. Your soap-box grandstanding is not evidence.
     
    bogosort likes this.
  15. bogosort

    Senior Member

    Sep 24, 2011
    365
    212
    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.
     
  16. nsaspook

    Expert

    Aug 27, 2009
    6,090
    6,866
    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: Jun 15, 2018
    xox and wayneh like this.
  17. wayneh

    Thread Starter Expert

    Sep 9, 2010
    16,102
    6,218
    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.
     
  18. nsaspook

    Expert

    Aug 27, 2009
    6,090
    6,866
    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.
     
  19. wayneh

    Thread Starter Expert

    Sep 9, 2010
    16,102
    6,218
    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.
     
  20. nsaspook

    Expert

    Aug 27, 2009
    6,090
    6,866
    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.
    Code (C):
    1.  
    2. void HTTPPrint_mbmcdata(WORD num)
    3. {
    4.     time_t ltime;
    5.     static long solar_volts, load_volts, cube_power, load_power, solar_power;
    6.     static int mycolor, cube_panels = FALSE, water_alarm = FALSE;
    7.  
    8.     // Determine what mbmc status data to return
    9.     switch (num) {
    10.     case 0:
    11.         mbmc_put(mbmc_buffer.ccvoltage, 0);
    12.         break;
    13.     case 1:
    14.         mbmc_put(mbmc_buffer.inputvoltage, 0);
    15.         break;
    16.     case 2:
    17.         mbmc_put(mbmc_buffer.primarypower_B1, 0);
    18.         break;
    19.     case 3:
    20.         mbmc_put(mbmc_buffer.primarypower_B2, 0);
    21.         break;
    22.     case 4:
    23.         mbmc_put(mbmc_buffer.systemvoltage, 0);
    24.         break;
    25.     case 5:
    26.         mbmc_put(mbmc_buffer.currentin, 2);
    27.         break;
    28.     case 6:
    29.         // fixup battery charging current
    30.         mbmc_buffer.current = mbmc_buffer.currentin; // default on PV current to CC
    31.         if (mbmc_buffer.boc == 1) { // charging 1
    32.             mbmc_buffer.current = cell[1].current;
    33.         }
    34.         if (mbmc_buffer.boc == 2) { // charging 2
    35.             mbmc_buffer.current = cell[2].current;
    36.         }
    37.         mbmc_put(mbmc_buffer.current, 2);
    38.         break;
    39.     case 7:
    40.         mbmc_put(mbmc_buffer.currentload, 2);
    41.         break;
    42.     case 8:
    43.         mbmc_put(mbmc_buffer.thermo_batt, 2);
    44.         break;
    45.     case 9:
    46.         mbmc_put(mbmc_buffer.pick, 10);
    47.         break;
    48.     case 10:
    49.         mbmc_put(mbmc_buffer.boi, 10);
    50.         break;
    51.     case 11:
    52.         mbmc_put(mbmc_buffer.boc, 10);
    53.         break;
    54.     case 12:
    55.         mbmc_put(mbmc_buffer.alert, 10);
    56.         break;
    57.     case 13:
    58.         mbmc_put(mbmc_buffer.bn, 10);
    59.         break;
    60.     case 14: // bsoc #1
    61.         mbmc_put((DWORD) hist[1].bsoc, 10);
    62.         break;
    63.     case 15: // bsoc #2
    64.         mbmc_put((DWORD) hist[2].bsoc, 10);
    65.         break;
    66.     case 16:
    67.         mbmc_put(PVEFF, 10);
    68.         break;
    69.     case 17:
    70.         mbmc_put(TOTEFF, 10);
    71.         break;
    72.     case 18:
    73.         mbmc_put(CCEFF, 10);
    74.         break;
    75.     case 19:
    76.         mbmc_put((DWORD) hist[1].esr, 10);
    77.         break;
    78.     case 20:
    79.         mbmc_put((DWORD) hist[2].esr, 10);
    80.         break;
    81.     case 21:
    82.         mbmc_put(cell[1].current, 2);
    83.         break;
    84.     case 22:
    85.         mbmc_put(cell[2].current, 2);
    86.         break;
    87.     case 23:
    88.         mbmc_put(remote_daq.inputvoltage, 0);
    89.         break;
    90.     case 24:
    91.         mbmc_put(remote_daq.inputcurrent, 2);
    92.         break;
    93.     case 25:
    94.         mbmc_put(remote_daq.voltagedrop, 0);
    95.         break;
    96.     case 26:
    97.         mbmc_put(remote_daq.remotecurrent, 2);
    98.         break;
    99.     case 50: // this is a power function, the value passed is not used
    100.         mbmc_put(mbmc_buffer.bn, 50);
    101.         break;
    102.     case 51: // this is a power function, the value passed is not used
    103.         mbmc_put(mbmc_buffer.bn, 51);
    104.         break;
    105.     case 52: // this is a power function, the value passed is not used
    106.         mbmc_put(mbmc_buffer.bn, 52);
    107.         break;
    108.     case 100: // print MBMC software version
    109.         TCPPutROMString(sktHTTP, MBMC_VERSION);
    110.         break;
    111.     case 101: // print MBMC solar controller version and ID in HEX
    112.         mbmc_put(mbmc_buffer.MBMCID, 3);
    113.         break;
    114.     case 110:
    115.         mbmc_put(mbmc_status.sent / 1000, 12);
    116.         break;
    117.     case 111:
    118.         mbmc_put(mbmc_status.received / 1000, 12);
    119.         break;
    120.     case 112:
    121.         mbmc_put(mbmc_status.cmdsent, 10);
    122.         break;
    123.     case 113:
    124.         mbmc_put(mbmc_status.cmdreceived, 10);
    125.         break;
    126.     case 120:
    127.         mbmc_put(time_outs, 10);
    128.         break;
    129.     case 121:
    130.         mbmc_put((DWORD) MIi, 10); // Number of data points saved
    131.         break;
    132.     case 122:
    133.         ltime = SNTPGetUTCSeconds();
    134.         mbmctime = gmtime(&ltime);
    135.         TCPPutString(sktHTTP, (BYTE*) asctime(mbmctime));
    136.         break;
    137.     case 123:
    138.         mbmc_put(crc_errors, 10);
    139.         break;
    140.     case 130: // Power Cube functions INIT
    141.         mycolor = 0x7f7f7f;
    142.         solar_volts = mbmc_buffer.inputvoltage;
    143.         if (mbmc_buffer.boi == 1) {
    144.             load_volts = mbmc_buffer.primarypower_B1;
    145.         } else {
    146.             load_volts = mbmc_buffer.primarypower_B2;
    147.         }
    148.         load_power = (load_volts * mbmc_buffer.currentload) / 10000;
    149.         solar_power = (mbmc_buffer.inputvoltage * mbmc_buffer.currentin) / 10000;
    150.         if (cube_panels) {
    151.             cube_power = (long) 1999.9 - (CUBE_SCALE * log10(1.0 + abs(solar_power))); //use log10 and rescale
    152.         } else {
    153.             cube_power = (long) 1999.9 - (CUBE_SCALE * log10(1.0 + abs(load_power - solar_power))); //use log10 and rescale
    154.         }
    155.         if (cube_power < CUBE_SIZE) cube_power = CUBE_SIZE;
    156.  
    157.         if (solar_power > load_power) {
    158.             mycolor = 0x98fb98; // positive power into the system, shades of green
    159.             if (cube_power < 900) mycolor = 0x90ee90;
    160.             if (cube_power < 400) mycolor = 0x7cfc00;
    161.             if (cube_power < 300) mycolor = 0x32cd32;
    162.         } else {
    163.             mycolor = 0xfa8072; // shades of red
    164.             solar_volts = load_volts; // switch the cube voltage when net power is negative
    165.             if (cube_power < 900) mycolor = 0xb22222;
    166.             if (cube_power < 400) mycolor = 0xdc143c;
    167.             if (mbmc_buffer.boc == 0) { // Not charging
    168.                 mycolor = 0xffe4e1; // shades of red, misty rose
    169.             }
    170.         }
    171.         if (!(mbmc_buffer.diversion.flag & 0x2)) { // mask out charger bit
    172.             mycolor = 0x87cefa; //charger color shades of blue
    173.             if (cube_power < 900) mycolor = 0x87ceeb;
    174.             if (cube_power < 500) mycolor = 0x1e90ff;
    175.             if (cube_panels) mycolor = 0x9932cc; // dark orchid for panel only power display
    176.         } else {
    177.             if (cube_panels) mycolor = 0xffffff; // white for panel only power display
    178.             if (cube_panels && (mbmc_buffer.boc > HISTBATTNUM)) { // charging controller batteries
    179.                 mycolor = 0x99e4e1; // shades of green blue
    180.             }
    181.         }
    182.  
    183.         if (solar_volts < 11500) {
    184.             solar_volts = 0;
    185.         } else {
    186.             solar_volts -= 11500;
    187.         }
    188.  
    189.         mbmc_put(cube_power, 10);
    190.         break;
    191.     case 131:
    192.         mbmc_put(mycolor, 10);
    193.         break;
    194.     case 132:
    195.         mbmc_put(solar_volts / 2, 0);
    196.         break;
    197.     case 133:
    198.         // fixup battery charging current for Solar Cube
    199.         mbmc_buffer.current = mbmc_buffer.currentin; // default on PV current to CC
    200.         if (mbmc_buffer.boc == 0) { // Not charging
    201.             mbmc_buffer.current = mbmc_buffer.currentload;
    202.         }
    203.         if (mbmc_buffer.boc == 1) { // charging 1
    204.             mbmc_buffer.current = cell[1].current;
    205.         }
    206.         if (mbmc_buffer.boc == 2) { // charging 2
    207.             mbmc_buffer.current = cell[2].current;
    208.         }
    209.         if (cube_panels) mbmc_buffer.current = mbmc_buffer.currentin; // display pv current in panel mode
    210.         mbmc_put(mbmc_buffer.current / 10, 2);
    211.         break;
    212.     case 134:
    213.         cube_panels = FALSE;
    214.         TCPPutROMString(sktHTTP, (ROM BYTE*) "RESET");
    215.         break;
    216.     case 135:
    217.         cube_panels = !cube_panels;
    218.         if (cube_panels) {
    219.             TCPPutROMString(sktHTTP, (ROM BYTE*) "PANEL");
    220.         } else {
    221.             TCPPutROMString(sktHTTP, (ROM BYTE*) "NET");
    222.         }
    223.         break;
    224.     case 200: // Display AC charger status
    225.         if (mbmc_buffer.diversion.flag & 0x2) {
    226.             TCPPutROMString(sktHTTP, (ROM BYTE*) "OFF");
    227.         } else {
    228.             TCPPutROMString(sktHTTP, (ROM BYTE*) "ON");
    229.         }
    230.         break;
    231.     case 201: // Display power diversion status
    232.         if (mbmc_buffer.diversion.flag & 0x1) {
    233.             TCPPutROMString(sktHTTP, (ROM BYTE*) "OFF");
    234.         } else {
    235.             TCPPutROMString(sktHTTP, (ROM BYTE*) "ON");
    236.         }
    237.         break;
    238.     case 202: // Display Battery Ganged mode
    239.         if (mbmc_buffer.DIPSW & 0b00010000) {
    240.             TCPPutROMString(sktHTTP, (ROM BYTE*) "Batteries 1 & 2 are GANGED.");
    241.         } else {
    242.             TCPPutROMString(sktHTTP, (ROM BYTE*) " ");
    243.         }
    244.         break;
    245.     case 203: // Display alarm status
    246.         if (alarms.mbmc_alarm.absorp || alarms.mbmc_alarm.equal) {
    247.             if (alarms.mbmc_alarm.equal)
    248.                 TCPPutROMString(sktHTTP, (ROM BYTE*) "<li><b> Time to equal and check battery water</b></li>");
    249.             else
    250.                 TCPPutROMString(sktHTTP, (ROM BYTE*) "<li><b> Time to check battery water</b></li>");
    251.  
    252.             if (!water_alarm) {
    253.                 water_alarm_warn(TRUE);
    254.                 water_alarm = TRUE; // once per alarm flag
    255.             }
    256.         } else {
    257.             if (water_alarm)
    258.                 water_alarm_warn(FALSE);
    259.             water_alarm = FALSE;
    260.         }
    261.         break;
    262.     case 204: // Display alarm status
    263.         if (alarms.mbmc_alarm.utility) {
    264.             TCPPutROMString(sktHTTP, (ROM BYTE*) "<li><b> Utility power is off</b></li>");
    265.         }
    266.         break;
    267.     case 205: // Display alarm status
    268.         if (alarms.mbmc_alarm.inverter) {
    269.             TCPPutROMString(sktHTTP, (ROM BYTE*) "<li><b> Inverter power is off</b></li>");
    270.         }
    271.         break;
    272.     case 206: // Display alarm status
    273.         if (alarms.mbmc_alarm.cpu) {
    274.             TCPPutROMString(sktHTTP, (ROM BYTE*) "<li><b> A controller CPU flag is set</b></li>");
    275.         }
    276.         break;
    277.     case 207: // Display remote DAQ status
    278.         if (remote_daq.offline) {
    279.             TCPPutROMString(sktHTTP, (ROM BYTE*) "<li><b> The remote DAQ is OFFLINE</b></li>");
    280.         }
    281.         break;
    282.     case 208: // NEXT DISPLAY FUNCTION
    283.         if (0) {
    284.             TCPPutROMString(sktHTTP, (ROM BYTE*) "<li><b> The remote DAQ is OFFLINE</b></li>");
    285.         }
    286.         break;
    287.     default:
    288.         TCPPutROMString(sktHTTP, (ROM BYTE*) " N/A ");
    289.     }
    290.     return;
    291. }
    292.  
    293.  
    The embedded program generates html/xml data from sensor data while the browser javascript handles the web graphics interface using the web data.
    Code (Text):
    1.  
    2. <meta http-equiv="refresh" content="120" >
    3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    4. <head>
    5. <title>Solar Power Cube</title>
    6. <style>
    7. body { margin: 0; }
    8. canvas { width: 100%; height: 100% }
    9. </style>
    10.  
    11. <a href="javascript:document.location.reload();"
    12. ONMOUSEOVER="window.status = 'Refresh';
    13. return true"
    14. ONMOUSEOUT="window.status = 'Refresh Done.'">
    15. <img src="images/refresh.gif"
    16. width="115" height="31" border="0" /></a>
    17. <script src="/mchp.js" type="text/javascript"></script>
    18. </head>
    19. <body>
    20. <script type="text/javascript" src="includes/three.min.js"></script>
    21.  
    22. <script>
    23. // We need several parameters to visualize the system operation
    24. // 130 z cube size 0,2000: changes the camera z to the absolute power log10 of the system and moves
    25. // a sprite bar in relationship to the cube.
    26. // 131 mycolor cube base color 0x000000: green shades positive solar power in-flow, HTML HEX color codes,
    27. // red shades load power out-flow, blue shades positive charger power in-flow.
    28. // 132 x cube rotation speed 0,10: solar voltage indicator
    29. // 133 y cube rotation speed 0,10: solar or battery current indicator.
    30.  
    31. var scene, camera, renderer;
    32. var geometry, material, mesh;
    33. var mycolor=0x7f7f7f, cubez=1300,cubecolor=0x00,cubex=0,cubey=0,cube_update=false,cube_type;
    34. var map = THREE.ImageUtils.loadTexture( "images/sprite.png" );
    35. var material1 = new THREE.SpriteMaterial( { map: map, color: 0xffffff, fog: false } );
    36. var sprite = new THREE.Sprite( material1 );
    37.  
    38.  
    39. init();
    40. animate();
    41.  
    42. function init() {
    43.  
    44. scene = new THREE.Scene();
    45.  
    46. camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 1, 10000);
    47. camera.position.z = 1000;
    48.  
    49. geometry = new THREE.BoxGeometry(200, 200, 200);
    50.  
    51.  
    52.  
    53. sprite.position.set( 0, ~mbmcdata(130)~ - 150, 0 );// this sets up the data for other cube fuctions so it must be first
    54. sprite.scale.set( 500, 2, 1.0 ); // imageWidth, imageHeight
    55. scene.add( sprite );
    56.  
    57. material = new THREE.MeshBasicMaterial({color: 0x000000, wireframe: true});
    58.  
    59. mesh = new THREE.Mesh(geometry, material);
    60. scene.add(mesh);
    61.  
    62. renderer = new THREE.WebGLRenderer();
    63. renderer.setSize(window.innerWidth, window.innerHeight);
    64.  
    65. document.body.appendChild(renderer.domElement);
    66. window.addEventListener( 'resize', onWindowResize, false );
    67.  
    68. document.addEventListener( 'click', onDocumentMouseMove, false );
    69. setTimeout("newAJAXCommand('status.xml', updateCubeStatus, true)",100);
    70. }
    71.  
    72. function onWindowResize() {
    73.  
    74. camera.aspect = window.innerWidth / window.innerHeight;
    75. camera.updateProjectionMatrix();
    76.  
    77. renderer.setSize( window.innerWidth, window.innerHeight );
    78. }
    79.  
    80.  
    81. function onDocumentMouseMove( event ) {
    82.  
    83. cube_type= ~mbmcdata(135)~; // alternate cube display modes
    84.  
    85. }
    86.  
    87. function animate() {
    88.  
    89. if (cube_update) // dynamic updates from xml file
    90. {
    91. camera.position.z = cubez;
    92. sprite.position.set( 0, cubez - 150.0, 0 );
    93. mycolor = cubecolor;
    94. mesh.rotation.x += (0.03 * cubex);
    95. mesh.rotation.y += (0.03 * cubey);
    96. } else { // update on refresh
    97. camera.position.z = ~mbmcdata(130)~;
    98. mycolor = ~mbmcdata(131)~;
    99. mesh.rotation.x += (0.03 * ~mbmcdata(132)~);
    100. mesh.rotation.y += (0.03 * ~mbmcdata(133)~);
    101. }
    102.  
    103. mesh.material.color.setHex(mycolor);
    104. requestAnimationFrame(animate);
    105.  
    106. renderer.render(scene, camera);
    107. }
    108.  
    109. // Parses the xmlResponse from status.xml and updates the cube status
    110. function updateCubeStatus(xmlData) {
    111.  
    112. if(!xmlData)
    113. {
    114. return;
    115. }
    116.  
    117. // Update the CUBE value
    118. cubez = getXMLValue(xmlData, 'cube0');
    119. cubecolor = getXMLValue(xmlData, 'cube1');
    120. cubex = getXMLValue(xmlData, 'cube2');
    121. cubey = getXMLValue(xmlData, 'cube3');
    122. cube_update=true;
    123. }
    124.  
    125. </script>
    126. </body>
    127. </html>
    128.  
     
    xox likes this.
Loading...