Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
neurotech
Apr 22, 2004

Deep in my dreams and I still hear her callin'
If you're alone, I'll come home.

v1nce posted:

What are you making? Does the underpants-burning speed provided by LevelDB justify the annoying to work with "database" you're about to build?

I work at high school in Sydney, Australia. Our teachers are required to 'buddy up' with another teacher and observe a few of their lessons each term and provide feedback.

I'm building an application for our teachers to allow them to record their feedback about the lessons that they observe. It needs to be only accessible to users within our Google Apps hosted domain - I'm making use of Passport to handle Google auth for that.

After they've logged in, they can either: record a new lesson observation, review previously recorded observations, review observations that other teachers have recorded about them. Ideally they would also be able to edit observations they've recorded in the past.

I also need to provide an admin 'dashboard' for a shortlist of managerial staff that allows them to view all recorded observations, as well as some nice graphs, etc.

At the moment I'm using the following naming structure for my keys:
code:
observer + '!' + observed + '~' + Date.now()
observer/observed are email addresses.

With all that said, the application is not going to generate a huge amount of intense traffic/db activity. Since getting stuck into learning LevelDB I've really come to like it - being able to have the DB installed just with a 'npm install' and configured by my application is a big plus.

Adbot
ADBOT LOVES YOU

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
What are you doing to get all the observations made by a particular person?

Your data set is inherently relational, you almost certainly want a relational database for it.

(As to why there's a sudden proliferation of key/value stores - the cynical answer is that it's easy for an amateur to write one that's "faster" than a real database for some trivial problem, and hence they become motivated to polish that turd until it shines. There are some legitimate uses for a key/value store, but I would always recommend starting with a real database and only consider switching to a key/value store once you've got a feature-complete implementation, and you know that a key/value store is going up be sufficient.)

Strong Sauce
Jul 2, 2003

You know I am not really your father.





leveldb is pretty amazing

1. Written by Jeff Dean.
2. Used as the backend of Chrome's IndexedDb implementation.
3. Ordered Keys

However it is obvious that the structure of the data is way better suited by a relational database.

But if you're going to use it you should at least know what the point of using leveldb is, which is that it has ordered keys.

So if you set your key as

observer!observed~date.now()

And you want to find all the people observer has observed you just specify a start and end key name and leveldb will return all the key items between start and end.

So in levelup it is
JavaScript code:
db.createReadStream({start: "<observer name>!A", end: "<observer name>!z" })
  .on('data', function(data) {
    console.log(data.key.split("!")[1].split("~")[0], ' observed by <observer name> has value ', data.value)
  })
  .on('close', function () {
    console.log('Done.')
  })
(Assuming observed names are start within the bounds of 'A' and 'z')

neurotech
Apr 22, 2004

Deep in my dreams and I still hear her callin'
If you're alone, I'll come home.

Jabor posted:

What are you doing to get all the observations made by a particular person?

Strong Sauce posted:

But if you're going to use it you should at least know what the point of using leveldb is, which is that it has ordered keys.

Of course. I'm currently using this approach to find all observations created by 'author':

JavaScript code:
  db.createReadStream({
    start: author + '!',
    end: author + '!' + '\xFF',
    encoding: 'json'
  })
and this for all observations about 'observed':

JavaScript code:
  db.createReadStream({
    start: '!' + observed + '~',
    end: '!' + observed + '~' + '\xFF',
    encoding: 'json'
  })
If I were to go for a relational database, what should I consider?

My primary source of experience with relational databases is limited to querying DB2 in RazorSQL all day and a bit of MySQL via phpMyAdmin back in the day.

neurotech fucked around with this message at 07:46 on Jul 14, 2014

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

neurotech posted:

After they've logged in, they can either: record a new lesson observation, review previously recorded observations, review observations that other teachers have recorded about them. Ideally they would also be able to edit observations they've recorded in the past.

Why not just have the teachers sit down and write a paragraph on paper, or as a word doc, and then file it? Why do you need to build a complicated web app for this?

I'm hesitant that your web app is actually going to be used.

neurotech
Apr 22, 2004

Deep in my dreams and I still hear her callin'
If you're alone, I'll come home.

Suspicious Dish posted:

Why not just have the teachers sit down and write a paragraph on paper, or as a word doc, and then file it? Why do you need to build a complicated web app for this?

I'm hesitant that your web app is actually going to be used.

Good question. They're being made to do this already in an existing system that is less than satisfying. I'm trying to build something to make the experience a bit better for them.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Chenghiz posted:

Why is it that every new hot database seems to be key/value? Are relational databases like postgresql and mssql just that perfected/done?
It's a lot easier to build a good key/value store that does one or two interesting new things than it is to build even a bad relational database.

Vulture Culture
Jul 14, 2003

I was never enjoying it. I only eat it for the nutrients.

Chenghiz posted:

Why is it that every new hot database seems to be key/value? Are relational databases like postgresql and mssql just that perfected/done?
Most of the features of traditional relational databases (joins, multi-table transactions, etc.) become totally useless (as in they don't work anymore) when you need to start sharding your dataset across multiple server instances.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

neurotech posted:

Good question. They're being made to do this already in an existing system that is less than satisfying. I'm trying to build something to make the experience a bit better for them.

Have you talked to them about why they hate the experience and what they'd really like?

Replacing one overcomplicated, terrible web app with another isn't going to solve the problem.

lunar detritus
May 6, 2009


Suspicious Dish posted:

Have you talked to them about why they hate the experience and what they'd really like?

Replacing one overcomplicated, terrible web app with another isn't going to solve the problem.

In my experience your teachers are going to keep writing their notes in paper and then they'll transcribe them to the system one by one.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
I personally still keep all my notes in pen and paper, because all digital note-taking apps suck. I don't see what's wrong with saying that teachers take notes in the medium they prefer.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Misogynist posted:

Most of the features of traditional relational databases (joins, multi-table transactions, etc.) become totally useless (as in they don't work anymore) when you need to start sharding your dataset across multiple server instances.

Depends very much on how you shard things. Scalebase has one set of tools that is basically transparent, as an example, and we shard with internal tools (which might be coming to webscalesql soon? I forget) while preserving the relational properties we need.

If you need corpus-wide joins and transactionality, it's not like you'll get them with a key-value store either...

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

Subjunctive posted:

Depends very much on how you shard things. Scalebase has one set of tools that is basically transparent, as an example, and we shard with internal tools (which might be coming to webscalesql soon? I forget) while preserving the relational properties we need.

If you need corpus-wide joins and transactionality, it's not like you'll get them with a key-value store either...

...b-but web scale?

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Wheany posted:

...b-but web scale?

Turns out!

My Rhythmic Crotch
Jan 13, 2011

I'm stumped on a weird problem. I'm using jstree with the alternative JSON format. I'm manually building an object, because I do not want to modify my backend just for this one little thing.
code:
var data = new Array();
$.getJSON(API_ROOT + "first_url", function (result) {
    $.each(result, function(index, value) {
        data.push({"id": value.derp, "parent": "#", "text": value.text });
        $.getJSON(API_ROOT + "second_url", function(result2) {
            $.each(result2, function(index2, value2) {
                data.push({"id": value2.id, "parent": value2.derp, "text": value2.text });
            });
        });
    });
    DisplayTree(data);
});

function DisplayTree(data) {
    // blow away the old jstree.
    $("#jstree").empty().jstree("destroy");

    // create the jstree.
    console.log(data);
    $("#jstree").jstree({
        "core": {
            "data": data
        },
        "checkbox": {
            "keep_selected_style": false
        },
        "plugins": [ "checkbox" ]
    });
};
Problem: The children nodes do not render in jstree. I can see that the data object has been constructed as I would expect when it gets printed to the console. It seems that no matter what I push to data on the innermost loop, it does not render in jstree.

I'm not a big front-end developer. Is there a way to debug jstree and discover why it's not rendering the child nodes? It's equally possible there is some bit of syntax sugar I'm missing.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Subjunctive posted:

Please help me find my stupid Fabric.js error. I'm trying to center things in a group, which AFAICT is the default behaviour, and it's not happening.

Yet another silent 1.4.0-vs-later silent incompatibility. It is joy.

neurotech
Apr 22, 2004

Deep in my dreams and I still hear her callin'
If you're alone, I'll come home.

Suspicious Dish posted:

Have you talked to them about why they hate the experience and what they'd really like?

Replacing one overcomplicated, terrible web app with another isn't going to solve the problem.

Yes, I have. Hence the whole motivation to build this thing. I take offence to your assumption that the replacement I'm building will be 'overcomplicated' and 'terrible', though. Low blow!

neurotech fucked around with this message at 23:22 on Jul 14, 2014

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
Sorry, but I've seen many people eagerly rush to computer-ify a problem when a simpler solution would be much better, and I want to make sure you're not making the same mistakes. The fact that you're doing this for a single high school in some random county doesn't increase my confidence.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Suspicious Dish posted:

The fact that you're doing this for a single high school in some random county doesn't increase my confidence.

Why is that relevant to whether it will be a better experience than the current situation? LOB software is usually pretty narrowly targeted, and aiming at a known audience you can talk to is a good way to start with most anything.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
Just the fact that it seems like a lone IT guy going "I know how to make it better! Computers!!" and building some system nobody actually really likes.

Vulture Culture
Jul 14, 2003

I was never enjoying it. I only eat it for the nutrients.

Suspicious Dish posted:

Just the fact that it seems like a lone IT guy going "I know how to make it better! Computers!!" and building some system nobody actually really likes.
I've been this guy more times than I can count.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Suspicious Dish posted:

Just the fact that it seems like a lone IT guy going "I know how to make it better! Computers!!" and building some system nobody actually really likes.

Huh. I hadn't seen evidence of that, that I noticed. Don't know if people will really like it, I guess, but it sounds like he's connected to the people who have the problem, so the odds seem as good as any program's out of the gate. I mean, the fact that he's asking for advice on how to do a good job puts him on the right half of the bell curve IMO.

It's not like the scope is huge or anything. Not really getting the pessimism. Sorry you're having a bad day. :glomp:

neurotech
Apr 22, 2004

Deep in my dreams and I still hear her callin'
If you're alone, I'll come home.

That sure is a whole lot of assumptions, Dish!

I'm aware of the phenomena that you're describing. I've been working in schools for the last 11 years and have seen it, and worse, happen before. With that said, I'm trying my best to make sure that the tool I'm building for our staff is actually beneficial and not just an instance of "Solve this problem by making a computer thing for it!".

I'm not sure what you're implying with your "single high school in some random county" (country?) comment. In your reply to Subjunctive you dodged the question. You're coming off in a very condescending manner posting stuff like that.

v1nce
Sep 19, 2004

Plant your brassicas in may and cover them in mulch.
Suspicious Dish does have some valid concerns, we've all been on the receiving end of some godawful "our IT guy made this" systems, however I think neurotech's given sufficient justification for what he's doing, and rather than just poo-poo his approach, maybe we should be helping him to not gently caress it up? Besides, being paid to make one-off pieces of crap is how a lot of us got into this business ;)

Suspicious Dish posted:

Why not just have the teachers sit down and write a paragraph on paper, or as a word doc, and then file it? Why do you need to build a complicated web app for this?

Besides neurotech's own answer, the usual reason for this is "automated reporting", which is the be-all desire for most managers who have large chunks of data placed in front of them. Plus it can be backed up, can be improved, and it's standardised by being a system and not paper/word document.

neurotech posted:

If I were to go for a relational database, what should I consider?
My primary source of experience with relational databases is limited to querying DB2 in RazorSQL all day and a bit of MySQL via phpMyAdmin back in the day.

You want a relational database because this kind of system has a lot of room for additional features, which if you're going to be implementing even basic reporting, seems like something managers will want. For instance, they might want to be able to attach a star rating to every report, or a star rating for individual aspects of how they educate. They then might want the reports to take into account the reviewer bias, by looking up all reports by that reviewer and calculating the min/max scores they give. Under a key/value store that's a huge pain in the rear end, especially as to get those kind of aggregated data points you need to fetch everything into memory from the store and then process it, rather than have the database do the legwork.

Justification aside, I really can't help you pick something that's easy for NodeJS, but all things web development are "tool for a job" - don't use something that's not entirely suitable because someone, if not yourself, will hate you for it later on. If I were to go relational I'd probably go with MySQL, but that's because of where my experience lies, and should be perfectly adequate. Most of the dev threads should be able to help you with any SQL troubles you run into.

neurotech
Apr 22, 2004

Deep in my dreams and I still hear her callin'
If you're alone, I'll come home.

v1nce posted:

Database stuff

Thanks for the insight, v1nce. I am going to put a bit more time into researching relational DB options for node.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

neurotech posted:

That sure is a whole lot of assumptions, Dish!

Yep. I'm aware.

neurotech posted:

I'm aware of the phenomena that you're describing. I've been working in schools for the last 11 years and have seen it, and worse, happen before. With that said, I'm trying my best to make sure that the tool I'm building for our staff is actually beneficial and not just an instance of "Solve this problem by making a computer thing for it!".

Cool, that makes me happy to see. Having been on both sides of this for a long time, I just wanted to make sure that there wasn't an easier solution you were aware of. I'm trying to help you, not put you down.

neurotech posted:

I'm not sure what you're implying with your "single high school in some random county" (country?) comment. In your reply to Subjunctive you dodged the question. You're coming off in a very condescending manner posting stuff like that.

I actually meant county. Perhaps you don't have counties in Australia? I'm a dumb American, I have no idea about that sort of thing, excuse my ignorance.

There's a bunch of different dumb stereotypes that I've seen over the course of my life that contribute to this.

The first is that I've seen IT workers build complex, homegrown systems simply because it's fun and help them avoid actually dealing with the more boring parts of their job, and dealing with people. You're also not using an off-the-stock solution and customizing it. This is a custom-built web-app you're making here. You're using LevelDB and other "fun modern" tech, which means that it's skewed more towards the "pet project" side of things than "stable and in production", at least from my biased judgment.

I've also seen lots of solutions get implemented that even with the best of intentions, the staff aren't really happy with it. Who's going to train the staff? Is it you? For a high school in a large city like Sydney, can you be sure that all of your staff are comfortable with the system if it's forced on them? What about the twenty or so of them that have been writing their notes on pen and paper, since that's the way that they've done it for the past 30 years of their career?

Who's going to answer tech support and feature requests? Is it you? What if you get hit by a bus tomorrow? Who's going to maintain this custom node.js web app now?

If this was a project you were selling, or being consulted for, I'd feel a bit better, because either you sell it and live (and thus actually have to sell it), or you get your specs handed to you and it's not your job to come up with better solutions.

Really, I'm not trying to put you down, I'm just worried about these things. Because 50% of the time, the answer could have very well been "oh, I didn't think about that! I guess pen and paper make more sense considering the age and technical experience of our staff".

neurotech
Apr 22, 2004

Deep in my dreams and I still hear her callin'
If you're alone, I'll come home.

Suspicious Dish posted:

I actually meant county. Perhaps you don't have counties in Australia? I'm a dumb American, I have no idea about that sort of thing, excuse my ignorance.

I think we technically do have counties but nobody in Australia really uses that term.

Suspicious Dish posted:

There's a bunch of different dumb stereotypes that I've seen over the course of my life that contribute to this.

The first is that I've seen IT workers build complex, homegrown systems simply because it's fun and help them avoid actually dealing with the more boring parts of their job, and dealing with people. You're also not using an off-the-stock solution and customizing it. This is a custom-built web-app you're making here. You're using LevelDB and other "fun modern" tech, which means that it's skewed more towards the "pet project" side of things than "stable and in production", at least from my biased judgment.

I've also seen lots of solutions get implemented that even with the best of intentions, the staff aren't really happy with it. Who's going to train the staff? Is it you? For a high school in a large city like Sydney, can you be sure that all of your staff are comfortable with the system if it's forced on them? What about the twenty or so of them that have been writing their notes on pen and paper, since that's the way that they've done it for the past 30 years of their career?

I am training the staff, yes. I admit that I can't be sure that all staff will be comfortable with the system - there's always a portion that will take issue. I'm hoping to make that portion as small as possible with my project. I'll also admit that this is on the pet project side of things. I'm using this project for my own professional development as well as value-adding to the school.

Without going into too much detail, the 'Mentoring' program that's behind the 'lesson observation' app is a relatively new addition to the school's professional development plans. We don't really have any staff who are that deep in the 'pen and paper' mindset (all staff are given a laptop from day one).

Suspicious Dish posted:

Who's going to answer tech support and feature requests? Is it you? What if you get hit by a bus tomorrow? Who's going to maintain this custom node.js web app now?

Me again. The 'hit by a bus' is a problem, for sure. It's also a problem that is not unique to this project, or even me in my role in the school. This is getting beyond the scope of this discussion, I think.

Edit: In my defence, I got a lot out of this Workplace post: http://workplace.stackexchange.com/questions/9128/how-can-i-prepare-for-getting-hit-by-a-bus and am slowly trying to implement some of the ideas proposed.

Suspicious Dish posted:

If this was a project you were selling, or being consulted for, I'd feel a bit better, because either you sell it and live (and thus actually have to sell it), or you get your specs handed to you and it's not your job to come up with better solutions.

Really, I'm not trying to put you down, I'm just worried about these things. Because 50% of the time, the answer could have very well been "oh, I didn't think about that! I guess pen and paper make more sense considering the age and technical experience of our staff".

It's cool. I understand the frustration. My dinky little office is ensuite to the staffroom, so I get full access to the entire spectrum of complaints, criticisms, and annoyances that come from staff trying to use tech in their teaching.

neurotech fucked around with this message at 04:48 on Jul 15, 2014

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.
I'm way late on the conversation, was meaning to post a day ago, but anyway I'd just like to add that in my admittedly short career I've never seen a project that has been vindicated by their decision to use semantic primary keys. If you develop and build something for long enough, you'll hit that point where you need unique identification and you just can't provide it due to that design decision. As a result, something that would be trivial, now becomes days of work re-factoring and migrating, and it's even worse if you're in production at that point.

I'm not keen on dogma guiding software development, but sticking to surrogate keys with no semantic meaning is a no-brainer for my mind. Unless you throw away your project in three months, someone will ask for something eventually that will break semantic keys and require way more effort than that feature warranted.

Use a key value store that can support indexing fields, or use SQL.

LP0 ON FIRE
Jan 25, 2006

beep boop
What's a good way of getting the absolute position of an element besides getBoundingClientRect()? I've been trying to place buttons relative to an x number of elements on a page. It works okay in most browsers but Safari for iOS doesn't work correctly most of the time. I've tried setting the button positions using getBoundingClientRect and returning the top and left positions of the elements and placing the buttons relative to that on window.onload and even tried updating the positions with setInterval and some placements are totally off.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
What about the standard hack?

JavaScript code:
function getXY(elem) {
    var x = 0, y = 0;
    while (elem) {
        x += elem.offsetLeft;
        y += elem.offsetTop;
        elem = elem.offsetParent;
    }
    return { x: x, y: y };
}

LP0 ON FIRE
Jan 25, 2006

beep boop

Suspicious Dish posted:

What about the standard hack?

JavaScript code:
function getXY(elem) {
    var x = 0, y = 0;
    while (elem) {
        x += elem.offsetLeft;
        y += elem.offsetTop;
        elem = elem.offsetParent;
    }
    return { x: x, y: y };
}

I tried that with the same results. I narrowed it down by copying over the resulting html. It looks like it's being caused by the article tags above with text content inside and a specified width. Again, looks normal in OS X browsers, but not Safari for iPhone. Looks okay on iPad but I haven't always had it behave correctly.

HTML: http://pastebin.com/X6K3KhbJ

CSS: http://pastebin.com/6tTApQMr


edit: JSFiddle http://jsfiddle.net/CZSW9/

I know at this point this really isn't Javascript, but I don't think there is an HTML thread. The screen is of course thinner too on the iPhone so the actual button positions would be offset differently, but even if I use a function to find the position of the element, it positions incorrectly.

edit 2: I can't get this happen using Javascript to place the buttons! Argh... There must be something different than my script and using JSFiddle?

So what are the huge differences between these? The one with the Javascript works on iPhone and the html one doesn't.

HTML: http://jsfiddle.net/CZSW9/
With java script: http://jsfiddle.net/CZSW9/21/

LP0 ON FIRE fucked around with this message at 19:51 on Jul 15, 2014

DholmbladRU
May 4, 2006
I am using the InfoBox plugin to create custom interactive info-windows in google maps. From these infowindows users can scroll through a list and click on an image to invoke some script. Everything works, the issue is when enableEventPropagation is enabled I can click through the infobox to other markers which causes another infobox to pop up.

does anyone have experience solving this problem?

code:
    InfoWindow = new InfoBox({
                                content: document.getElementById("infobox-wrapper"),
                                disableAutoPan: true,
                                enableEventPropagation: true,
                                zIndex: null,
                                pixelOffset: new google.maps.Size(-300, -0),
                                closeBoxURL: '../assets/images/info-close.png',
                                boxStyle: {
                                    color: 'white',
                                    background: '#101010',
                                    width: "600px",
                                    height: "400px"
                                },
                                infoBoxClearance: new google.maps.Size(1, 1)
                            });
Removing infobox
code:
    function removeInfoWindow() {
        $('.infoBox').remove()
    }
Javascript invoked when image within infobox is clicked, only works when enableEventPropagation is set to true
code:
    $(document.body).on('touchstart', '.infoBox img', function () {
        if ($(this).attr('val') == 'off') {
            //turn on
            $(this).attr('val', 'on');
            $(this).attr('src', '../assets/images/check.png');
        } else {
            //turn off
            $(this).attr('val', 'off');
            $(this).attr('src', '../assets/images/uncheck.png');
        }
    });

excidium
Oct 24, 2004

Tambahawk Soars

excidium posted:

Need some ideas on how the best way to tackle this issue. I'm using an API call to get back all of the data on a page. The data is returned in an array of objects containing properties about the field including the name, value, caption, format, data type, read only, required and show condition. Now all of this would be easy to just spit out on the page in the order it appears in the API response but I would like to introduce a way to "design" a page layout. I'm using AngularJS so the idea is to create a template view for each page type that lays out the data and then uses the response to populate all of the values/attributes that make up the page.

code:
"controls": [
    {
      "name": "AccountInput.Name",
      "value": "",
      "reference": "aB046627977D44D39A44C680C395B6522",
      "caption": "First Name,
      "dataType": "string",
      "controlType": "text",
      "format": "",
      "maxLength": "50",
      "readOnly": "0",
      "hidden": "0",
      "required": "0"
    },
    {
      "name": "AccountInput.Address1",
      "value": "",
      "reference": "aB046627977D44D39A44C680C395B6522",
      "caption": "Address 1",
      "dataType": "string",
      "controlType": "text",
      "format": "",
      "maxLength": "30",
      "readOnly": "0",
      "hidden": "0",
      "required": "0"
    },
    ...
]
How can I do this since all of the individual objects are in an array (meaning I can't just easily path down to them through object notation)?

So I basically told the API designers that the way they were throwing the controls into an array was crippling any ability to create layouts besides those that just dump the data straight down the page through an array loop and output. I hope that the feedback can shift towards a better JSON structure to which I proposed the following format:
code:
"controls": {
  "AccountInput.Name": {
    "value": "",
    "reference": "aB046627977D44D39A44C680C395B6522",
    "caption": "First Name",
    "dataType": "string",
    "controlType": "text",
    "format": "",
    "maxLength": "50",
    "readOnly": "0",
    "hidden": "0",
    "required": "0"
  },
  ...
}
This should make it much easier to traverse the JSON and use individual values in a template without having to know their order in an array or having to put a ton of code to filter for each possible item.

N.Z.'s Champion
Jun 8, 2003

Yam Slacker

LP0 ON FIRE posted:

getBoundingClientRect [...] works okay in most browsers but Safari for iOS doesn't work correctly most of the time

That really should just work, so it sounds like some other bug. Did you add scroll position to the getBoundingClientRect().top?

code:
 document.body.scrollTop + document.documentElement.scrollTop + the_getBoundingClientRect_top_variable
I made a button effects thing that works on chrome/ff/android/iOS6/7 and it just does getBoundingClientRect with scroll position so maybe try taking that code.

N.Z.'s Champion fucked around with this message at 23:24 on Jul 15, 2014

stoops
Jun 11, 2001
I don't know much javascript or jquery. I mean, I can modify and get things to work, but i'm not comfortable writing it from scratch.

Does anyone have any great solid teaching resources? I don't mind paying for video tutorials, or online classes.

I can't seem to find any community college scripting programs, and i figured the net is the best way to go about it.

if any are highly recommended, I'd appreciate.

LP0 ON FIRE
Jan 25, 2006

beep boop

N.Z.'s Champion posted:

That really should just work, so it sounds like some other bug. Did you add scroll position to the getBoundingClientRect().top?

code:
 document.body.scrollTop + document.documentElement.scrollTop + the_getBoundingClientRect_top_variable
I made a button effects thing that works on chrome/ff/android/iOS6/7 and it just does getBoundingClientRect with scroll position so maybe try taking that code.

Thanks for showing me that code, but I tried adding the scroll positions like that and it doesn't make any difference! I'm so stumped. It works fine if there is one element, but not two. My code reports the same y position it should go to if the 2nd element is omitted, but yet the button y positions go up. It's like it's lying about the y positions it reports. wtf..

Jimlit
Jun 30, 2005



stoops posted:

I don't know much javascript or jquery. I mean, I can modify and get things to work, but i'm not comfortable writing it from scratch.

Does anyone have any great solid teaching resources? I don't mind paying for video tutorials, or online classes.

I can't seem to find any community college scripting programs, and i figured the net is the best way to go about it.

if any are highly recommended, I'd appreciate.

http://www.lynda.com/ is well worth the monthly fee for good video tutorials.

But before you do anything with jquery, go through the javascript lessons at http://www.codecademy.com/. Trying to jump into jquery before learning the core basics of javascript was one of the biggest mistakes I made starting out.

fuf
Sep 12, 2004

haha

stoops posted:

I don't know much javascript or jquery. I mean, I can modify and get things to work, but i'm not comfortable writing it from scratch.

Does anyone have any great solid teaching resources? I don't mind paying for video tutorials, or online classes.

I can't seem to find any community college scripting programs, and i figured the net is the best way to go about it.

if any are highly recommended, I'd appreciate.

I really like this one:
http://eloquentjavascript.net/

excidium
Oct 24, 2004

Tambahawk Soars

stoops posted:

I don't know much javascript or jquery. I mean, I can modify and get things to work, but i'm not comfortable writing it from scratch.

Does anyone have any great solid teaching resources? I don't mind paying for video tutorials, or online classes.

I can't seem to find any community college scripting programs, and i figured the net is the best way to go about it.

if any are highly recommended, I'd appreciate.

http://www.bento.io/javascript

Adbot
ADBOT LOVES YOU

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

stoops posted:

I don't know much javascript or jquery. I mean, I can modify and get things to work, but i'm not comfortable writing it from scratch..

Do you have any programming experience in other languages?

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply