Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Aug 17 09:32
    User @bjorno43 unbanned @linkin-park
  • Jun 20 21:19
    @bjorno43 banned @shenerd140
  • Apr 25 17:13
    @mstellaluna banned @cmal
  • Jan 08 22:05
    @mstellaluna banned @dertiuss323
  • Nov 07 2018 04:42
    User @texas2010 unbanned @ows-ali
  • Nov 02 2018 16:25
    @texas2010 banned @ows-ali
  • Oct 12 2018 05:50
    @bjorno43 banned @NACH74
  • Oct 05 2018 23:02
    @mstellaluna banned @JomoPipi
  • Sep 16 2018 12:21
    @bjorno43 banned @yash-kedia
  • Sep 16 2018 12:16
    @bjorno43 banned @vnikifirov
  • Sep 05 2018 08:12
    User @bjorno43 unbanned @androuino
  • Sep 05 2018 07:38
    @bjorno43 banned @androuino
  • Aug 23 2018 16:57
    User @bjorno43 unbanned @rahuldkjain
  • Aug 23 2018 16:23
    @bjorno43 banned @rahuldkjain
  • Jul 29 2018 14:13
    User @bjorno43 unbanned @jkyereh
  • Jul 29 2018 01:00
    @bjorno43 banned @jkyereh
  • Jul 10 2018 22:09
    @bjorno43 banned @manafn
  • Jul 06 2018 15:20
    @texas2010 banned @imlegend19
  • Jul 03 2018 12:28
    @bjorno43 banned @vbvmatta
  • Jun 29 2018 13:54
    @bjorno43 banned @OGTechnoBoy
Diane
@106Ch213
@coymeetsworld Good point I'll add it
CSims20
@CSims20
Hi everyone! Quick ? Our tribute page can be on anyone right?
Coy Sanders
@coymeetsworld
yes @CSims20
CSims20
@CSims20
@coymeetsworld okay awesome! Thanks!
CamperBot
@camperbot
csims20 sends brownie points to @coymeetsworld :sparkles: :thumbsup: :sparkles:
:star2: 1579 | @coymeetsworld |http://www.freecodecamp.com/coymeetsworld
Coy Sanders
@coymeetsworld
seen some people do fictional characters that should be fine too if you're thinking about it
Ken Haduch
@khaduch
@artoodeeto - absolute positioning is very difficult to use for good responsive behavior, at least that is what I think. If you are trying to do something like this, perhaps using the Bootstrap grid would be helpful?
aRtoo
@artoodeeto
@khaduch yea. thats what i thought. i changed it. thanks'
CamperBot
@camperbot
artoodeeto sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 2032 | @khaduch |http://www.freecodecamp.com/khaduch
Ken Haduch
@khaduch
@tommygebru - do you mean just getting the text?
@106Ch213 - hello Diane - looks good for me, although I'm seeing a background of what appears to be a hurricane, so I don't know if that is supposed to reflect the weather here? We are supposed to be getting some snow, but I don't think a hurricane is in the forecast... :) But the location and weather info appears to be correct.
aRtoo
@artoodeeto
hey guys i have a form that needs to be submitted to a private email and currently im using free version of formspree, do you have any other 3rd party party services that i could handle form? dont know how to use php yet and ruby on rails so. hit me up. thanks
Diane
@106Ch213
@khaduch hello thanks for the feedback! The picture isn't linked to the local weather but I see why this is confusing so I think I'll change it :)
CamperBot
@camperbot
106ch213 sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 2033 | @khaduch |http://www.freecodecamp.com/khaduch
RakeshNerkar
@Rakesh18754
How to write a function that will accept the below Json as input and will output the below formatted json
var jsonArray = [{
            "tagValueName": "PCI",     
            "tagValueId": 1,
            "priorityAlertsCount": 20,
            "investigationAlertsCount": 140,
            "incidentAlertsCount": 100,
            "otherAlertsCount": 40
        }, {
            "tagValueName": "ABC",
            "tagValueId": 2,
            "priorityAlertsCount": 100,
            "investigationAlertsCount": 60,
            "incidentAlertsCount": 20,
            "otherAlertsCount": 20
        }];

        How to write a function that will accept the above Json as input and will output the below formatted json

 var jsonData = [{
                "tagValueName" : "PCI",
                "type": "priorityAlertsCount",
                "count": "20",
            },
            {
                "tagValueName" : "PCI",
                "type": "investigationAlertsCount",
                "count": "140",
            },
            {
                "tagValueName" : "PCI",
                "type": "incidentAlertsCount",
                "count": "100",
            },
            {
                "tagValueName" : "PCI",
                "type": "otherAlertsCount",
                "count": "40",
            },{
                "tagValueName" : "ABC",
                "type": "priorityAlertsCount",
                "count": "100",
            },{
                "tagValueName" : "ABC",
                "type": "investigationAlertsCount",
                "count": "60",
            }];
Jack Lyons
@JackEdwardLyons
an input, you mean you want to add it to the bottom JSON data?
can you explain the task a bit more please @Rakesh18754
you will need to slice the array , and rename the key's to match the keys in the json below
RakeshNerkar
@Rakesh18754
@JackEdwardLyons I want to write a function that will accept the first var as input and then will format the json and output it in the format which i have mentioned
can u provide some code...actulaay i am new to JS....
Jack Lyons
@JackEdwardLyons
so, the input for the first variable is an array with two objects
RakeshNerkar
@Rakesh18754
yes right
it can conatin n number of object...
Jack Lyons
@JackEdwardLyons
so to access the first object you would write jsonArray[0]
for all objects
iwould use a forEach loop
one second
how many inputs do you have?
RakeshNerkar
@Rakesh18754
only one array which can have n number of objects
@JackEdwardLyons but all have the same sructure
Jack Lyons
@JackEdwardLyons
this jsonArray var jsonArray = [{ "tagValueName": "PCI", "tagValueId": 1, "priorityAlertsCount": 20, "investigationAlertsCount": 140, "incidentAlertsCount": 100, "otherAlertsCount": 40 }, { "tagValueName": "ABC", "tagValueId": 2, "priorityAlertsCount": 100, "investigationAlertsCount": 60, "incidentAlertsCount": 20, "otherAlertsCount": 20 }];
is different to the below arrays, does that matter?
RakeshNerkar
@Rakesh18754

@JackEdwardLyons

var jsonInputArray = [{
            "tagValueName": "PCI",     
            "tagValueId": 1,
            "priorityAlertsCount": 20,
            "investigationAlertsCount": 140,
            "incidentAlertsCount": 100,
            "otherAlertsCount": 40
        }, {
            "tagValueName": "ABC",
            "tagValueId": 2,
            "priorityAlertsCount": 100,
            "investigationAlertsCount": 60,
            "incidentAlertsCount": 20,
            "otherAlertsCount": 20
        }];

output should be

var jsonData = [{
                "tagValueName" : "PCI",
                "type": "priorityAlertsCount",
                "count": "20",
            },
            {
                "tagValueName" : "PCI",
                "type": "investigationAlertsCount",
                "count": "140",
            },
            {
                "tagValueName" : "PCI",
                "type": "incidentAlertsCount",
                "count": "100",
            },
            {
                "tagValueName" : "PCI",
                "type": "otherAlertsCount",
                "count": "40",
            },{
                "tagValueName" : "ABC",
                "type": "priorityAlertsCount",
                "count": "100",
            },{
                "tagValueName" : "ABC",
                "type": "investigationAlertsCount",
                "count": "60",
            }];
Jack Lyons
@JackEdwardLyons
weird..
what do you need this for?
RakeshNerkar
@Rakesh18754
@JackEdwardLyons actually i am trying to plot a chart
and my chart requires data in that specific format
Jack Lyons
@JackEdwardLyons
ok, well im probably the wrong person to ask, this is weird how the above array is so varied from the second array, in terms of key value pairs... they are totally different
JiaLe Guo
@gabygoole
In ikipedia
In Wikipedia Viewer´╝î what kind of thing should I learn?
Adi2Point0
@Adi2Point0
@Rakesh18754
var jsonData = [];

var keysToDrop = ['tagValueName', 'tagValueId'];

jsonArray.forEach(function(json){
  Object.keys(json).forEach(function(key){
    if(keysToDrop.indexOf(key) === -1){
      jsonData.push({
        tagValueName : json.tagValueName,
        type : key,
        count : json[key]
      })
    }
  });
});
tommy
@tommygebru
@khaduch yeah is it possible to get the text? or is that not available through the api?
Thomas Swatland
@swatbone85
Hi all, I'm trying to create a button that toggles through 2 alternating options. This is my code: $("h3 a").on("click", function() { counter += 1; console.log(counter % 2); /* switch(counter % 2) { case 0: $("h3").html(Math.round(data.main.temp * 1.8 + 32) + "<a href='#'>&#176F</a>"); case 1: $("h3").html(Math.round(data.main.temp) + "<a id='temp' href='#'>&#176C</a>"); } */ });
Thing is, the code inside the comments only runs once. Any pointers?
$("h3 a").on("click", function() {
          counter += 1;
          console.log(counter % 2);
          /*
          switch(counter % 2) {
            case 0:
            $("h3").html(Math.round(data.main.temp * 1.8 + 32) + "<a href='#'>&#176F</a>");
            case 1:
            $("h3").html(Math.round(data.main.temp) + "<a id='temp' href='#'>&#176C</a>");
          }
          */
        });
Thomas Swatland
@swatbone85
Anyone?
Abhishek Kumar
@Mr-Kumar-Abhishek
@swatbone85 I don't get what are you trying to do but..... why aren't there break; after switch cases ??
@swatbone85 uh.. nevermind seems those are commented out ... hard to fiqure via IRC
@swatbone85 oh, so you were asking about commented out code lol
@swatbone85 so my question remains ~