• Hey, guest user. Hope you're enjoying NeoGAF! Have you considered registering for an account? Come join us and add your take to the daily discourse.

Web Design and Development |OT| Pixel perfect is dead, long live responsive design

Hm, just a small guess, as i'm not really useful today, thanks cold!

I think there's something iffy with your query. If the only thing you get in the return is the empty div row container, then it fails at while($data), otherwise, it should have at least the empty children of the div row container.

Also, shouldn't you parse the query-result via a for each loop?

If my guess is correct, it's the single ' in your query. I think you want to use ` instead.
 
Thanks for the responses guys!

One thing I've been wondering about is AJAX request.

So I started looking into them and and the general XMLHttpRequest

I looked at https://developer.mozilla.org/en-US/docs/AJAX/Getting_Started

And it gave me a pretty good run through of the basics of how requests have traditionally been handled. At first it seems kind of complex but after reading through it I think I "get" the basic gist of it. Seems a little verbose but not insane or anything.

But then I stumbled across a pretty good article here.

Now this article suggests forgoing the whole "onreadystatechange" syntax and just using "onload" which seems to make sense from what I was reading in the article.

But now that you guys have mentioned "fetch" I started looking into that and it seems going forward it's going to be the new API for native JS/AJAX in browsers.

I was looking at here

The author goes into good detail explaining the fetch API and how it would be used.

So I guess what I'm asking is....should I just forget about all the onreadystatechange and onload stuff and just learn the fetch API? Or is it still good to have a knowledge of that stuff?
 
So I guess what I'm asking is....should I just forget about all the onreadystatechange and onload stuff and just learn the fetch API? Or is it still good to have a knowledge of that stuff?

Learning to do vanilla AJAX calls is a good thing to learn, but as XMLHttpRequests kinda suck, especially if you have to deal with them often and across multiple browsers, in general you are most likely going to use some library to handle them anyway. Anyhoo, as long as you get the (simple) concept, you shouldn't have much trouble learning how to create them. After you have done that, you can just go "screw it" and use something else instead.
 

theecakee

Member
You guys know any good light weight text editors for xfce linux?

I have a chromebook to do small programming things, it doesn't really come with any text editors besides a version of notepad...and I'm not sure whats the best to use that won't take up all of the very little space I have.
 

Kalnos

Banned
You guys know any good light weight text editors for xfce linux?

I have a chromebook to do small programming things, it doesn't really come with any text editors besides a version of notepad...and I'm not sure whats the best to use that won't take up all of the very little space I have.

Is there any specific feature you're looking for? Might be time to learn Vim. :p
 
You guys know any good light weight text editors for xfce linux?

I have a chromebook to do small programming things, it doesn't really come with any text editors besides a version of notepad...and I'm not sure whats the best to use that won't take up all of the very little space I have.

How lightweight? There's always Vim. Try it online: http://www.openvim.com/

edit: Dammit, there's always that guy who suggests that you should learn Vim ;)
 
I'm trying to put together a very simple web app, but I'm not sure the best way to go about it.

This shows the total extent of data that I am planning on showing:

NQiS6QD.png


It's basically 3 objects with a name, 7 numbers and a timestamp displayed in a table.

I need to grab these numbers from specific cells in an .xls file that is emailed to me every month and looks like this:

ZPGBkqC.png


I'm thinking of using a MEAN stack, but now I'm trying to decide if it's worthing setting up a database for this. Also, any suggestions for how I would go about getting values out of specific .xls files that are emailed to me would be really helpful. At this point I'm considering setting up a node.js email server, with only my email whitelisted, setting gmail to forward these emails every month and then figuring out how to parse the 3 attachments.

TLDR:
I want to set something up that automatically grabs and displays 7 values from an email I get every month containing 3 .xls files.
 

SmugFox

Member
Hi guys!

For the past couple of weeks I've been designing a UI for a fake Overwatch app. The whole idea for the app was an all in one app for everything related to Overwatch.

So with that idea in mind, I went ahead and tried to design something that people who play Overwatch would use to stay up to date with news, streams, heroes, and rankings.

I would really appreciate if you folks would take a couple of minutes and take a look at my Invision prototype and just click around and tell me what you think.

I've got pretty thick skin, so please tell me what you like, dislike, and hate. Nothing is finished and can be worked on, so I know it's not super great, but I just wanted to get my idea out there.

Also, please know that I know that I used pictures of different Na'Vi teams in this app, because to my knowledge, they don't have an Overwatch team. Also all the text is just stuff I made up so that it wasn't just filled with Lorem ipsum text.

Thanks a lot!


https://invis.io/F65XX2GUQ
 
I'm thinking of using a MEAN stack, but now I'm trying to decide if it's worthing setting up a database for this. Also, any suggestions for how I would go about getting values out of specific .xls files that are emailed to me would be really helpful. At this point I'm considering setting up a node.js email server, with only my email whitelisted, setting gmail to forward these emails every month and then figuring out how to parse the 3 attachments.

TLDR:
I want to set something up that automatically grabs and displays 7 values from an email I get every month containing 3 .xls files.

For parsing the .xls files, see soemthing like js-xlsx: https://github.com/SheetJS/js-xlsx

You can get the attachments straight from your Gmail account via their NodeJS wrapper of their API: https://developers.google.com/gmail/api/v1/reference/users/messages/attachments/get
 

Somnid

Member
I'm trying to put together a very simple web app, but I'm not sure the best way to go about it.

This shows the total extent of data that I am planning on showing:

NQiS6QD.png


It's basically 3 objects with a name, 7 numbers and a timestamp displayed in a table.

I need to grab these numbers from specific cells in an .xls file that is emailed to me every month and looks like this:

ZPGBkqC.png


I'm thinking of using a MEAN stack, but now I'm trying to decide if it's worthing setting up a database for this. Also, any suggestions for how I would go about getting values out of specific .xls files that are emailed to me would be really helpful. At this point I'm considering setting up a node.js email server, with only my email whitelisted, setting gmail to forward these emails every month and then figuring out how to parse the 3 attachments.

TLDR:
I want to set something up that automatically grabs and displays 7 values from an email I get every month containing 3 .xls files.

I'm really wondering what you want to get out of this. It seems, not especially useful to me. Is it not just a simple automation task? What does a web page buy you?
 
I'm really wondering what you want to get out of this. It seems, not especially useful to me. Is it not just a simple automation task? What does a web page buy you?

It's to share with brewers in the area and makes it so I don't have to dig through my email for the most recent water numbers when I want to do basic water calculations. I'd also like to eventually be able to pass those values to another site that will do the calculations base on the most recent values.
 
R

Rösti

Unconfirmed Member
I'm currently doing some basic penetration vulnerability testing and I'm wondering if anyone can share some good software on this? I'm currently using Nmap and Nikto 2 (together with some other obscure methods), and I've used Maltego to some extent. The target is already quite secure after some recent updates, and my suspicion is that the resources aren't under threat, but I still want to be more sure. Should I get things like Metasploit and Burp Suite? I would prefer something lightweight.
 

Kinitari

Black Canada Mafia
It's to share with brewers in the area and makes it so I don't have to dig through my email for the most recent water numbers when I want to do basic water calculations. I'd also like to eventually be able to pass those values to another site that will do the calculations base on the most recent values.

You might want to try and automatically get your spreadsheets sent to google drive and converted to a google sheet - which can then be accessed with the right api and plopped onto a website - if you want to skip the database step. Although I'm not 100% sure how to do this, I'm prety sure you can.
 

flyover

Member
You might want to try and automatically get your spreadsheets sent to google drive and converted to a google sheet - which can then be accessed with the right api and plopped onto a website - if you want to skip the database step. Although I'm not 100% sure how to do this, I'm prety sure you can.

That's the first thing that came to mind for me, too. Not sure how you can automate getting your files from email imported to Drive (and then set for web sharing). But, if you can manage that, you're set. I access Sheets documents all the time, using d3.js to grab and visualize .csv data -- though there are plenty of other ways to access it.

In a pinch, you can pretty much use Google Sheets as a whole website database. Heck, if you're only supporting JS-enabled users for a site or web app, I think one could get away with not having any back-end code at all, and just using HTML/JS/CSS.
 

Somnid

Member
It's to share with brewers in the area and makes it so I don't have to dig through my email for the most recent water numbers when I want to do basic water calculations. I'd also like to eventually be able to pass those values to another site that will do the calculations base on the most recent values.

Could you use an IFTTT recipe maybe? https://ifttt.com
 

Kinitari

Black Canada Mafia
That's the first thing that came to mind for me, too. Not sure how you can automate getting your files from email imported to Drive (and then set for web sharing). But, if you can manage that, you're set. I access Sheets documents all the time, using d3.js to grab and visualize .csv data -- though there are plenty of other ways to access it.

In a pinch, you can pretty much use Google Sheets as a whole website database. Heck, if you're only supporting JS-enabled users for a site or web app, I think one could get away with not having any back-end code at all, and just using HTML/JS/CSS.

Could you use an IFTTT recipe maybe? https://ifttt.com

https://ifttt.com/recipes/99068-save-new-email-attachments-to-google-drive
 

Copons

Member
Recently I've been tinkering around with vanilla ES2015 on a personal project of mine, so to finally start using it in a real world scenario.
To start small, I'm rewriting my own WordPress blog theme (also using Twig/Timber, just to learn more things at once) with the commitment of only using vanilla ES2015 for its JS part (and avoid external libraries as much as I can).

The theme is still PHP based, so I'm not in need of a full fledged front end framework, but just to support CSS-based animations and whatnot. Say, the fixed header that disappear scrolling down, or the drawer sidebar handling, the modal boxes, etc.

Point is, I'm realizing how much my vanilla JS sucks, as I'm pretty much writing the customary jQuery-like spaghetti code, but with classes and querySelector.

To explain, this is how I'm approaching the various components of the page:

Code:
// modal.js
export default function (selector, container) {
  // delegate listener etc.
}



// Header.js
import modal from './modal';

export default class Header {

  constructor() {
    this.header = document.querySelector('.header');
    this.slideUp();
    modal('a', this.header);
  }

  slideUp() {
    // listen to window scroll, etc.
  }

}



// index.js
import Header from './components/Header';
new Header();
(doesn't really make sense adding the modal to the header, but it's just an example)


Now, imho this is way cleaner and clearer than my pre-Angular JS code, but still it seems kind of a stupid approach and I wonder if there's a proper way/best practice to handle both kind of components, if I may use the totally wrong words, "static" as the site header, and "dynamic" as the modal.
 

grmlin

Member
Recently I've been tinkering around with vanilla ES2015 on a personal project of mine, so to finally start using it in a real world scenario.
To start small, I'm rewriting my own WordPress blog theme (also using Twig/Timber, just to learn more things at once) with the commitment of only using vanilla ES2015 for its JS part (and avoid external libraries as much as I can).

The theme is still PHP based, so I'm not in need of a full fledged front end framework, but just to support CSS-based animations and whatnot. Say, the fixed header that disappear scrolling down, or the drawer sidebar handling, the modal boxes, etc.

Point is, I'm realizing how much my vanilla JS sucks, as I'm pretty much writing the customary jQuery-like spaghetti code, but with classes and querySelector.

To explain, this is how I'm approaching the various components of the page:

Code:
// modal.js
export default function (selector, container) {
  // delegate listener etc.
}



// Header.js
import modal from './modal';

export default class Header {

  constructor() {
    this.header = document.querySelector('.header');
    this.slideUp();
    modal('a', this.header);
  }

  slideUp() {
    // listen to window scroll, etc.
  }

}



// index.js
import Header from './components/Header';
new Header();
(doesn't really make sense adding the modal to the header, but it's just an example)


Now, imho this is way cleaner and clearer than my pre-Angular JS code, but still it seems kind of a stupid approach and I wonder if there's a proper way/best practice to handle both kind of components, if I may use the totally wrong words, "static" as the site header, and "dynamic" as the modal.

Hi,
I use Web Components for websites like this. Not the crazy ones like Polymer offers. They are much more simple and use custom elements. I build a little framework for that called gremlin.js.

Some thoughts on your code:

- splitting your code into modules is the way to go
- You have a header class, but the class can only be used with one selector, .header. There is absolutely no need for a class here, unless you pass the selector as an option into your class :)

Regarding your question: on CMS/Shop Websites without js app frameworks like React everything I build are components. I don't care if its a header, a modal or a button, they are all components for me. Things, that enhance my page with javascript. I throw the element into the page and I'm done.

In React on the other hand I usually use layouts/pages etc. to organize my code. I do this because there normally is much much more code I have to deal with. For "normal" websites I don't see why I would have to do that.
 

Copons

Member
Hi,
I use Web Components for websites like this. Not the crazy ones like Polymer offers. They are much more simple and use custom elements. I build a little framework for that called gremlin.js.

Some thoughts on your code:

- splitting your code into modules is the way to go
- You have a header class, but the class can only be used with one selector, .header. There is absolutely no need for a class here, unless you pass the selector as an option into your class :)

Regarding your question: on CMS/Shop Websites without js app frameworks like React everything I build are components. I don't care if its a header, a modal or a button, they are all components for me. Things, that enhance my page with javascript. I throw the element into the page and I'm done.

In React on the other hand I usually use layouts/pages etc. to organize my code. I do this because there normally is much much more code I have to deal with. For "normal" websites I don't see why I would have to do that.

Thanks for the answer!

Regarding the classes: yeah, that's exactly why my structure seems so wrong to me, yet I was so eager to finally get to use classes in JS that I didn't really care. :D
Conversely, creating functions (or, I dunno, simple non-function/non-class blocks? can I even export them? --> see fake edit) for site unique parts, like the header, seems equally wrong. And at that point, I'd rather be full on hipster and use classes.

Regarding the web components, I was under the impression they were best used in a full JS scenario (and anyway, not great for SEO, considering they'll render client-side).
But I can't check them (and your library) in depth right now, thanks to the office proxy, and I may be totally wrong on this.


FAKE EDIT:
Dang, I just realized I can import files that don't export anything.
This way I could ditch the class in, say, Header.js and write it like I would have done pre-ES6, but still making use of imports and whatnot.
 

grmlin

Member
Custom Elements can be written like all other elements server side. That was the most important requirement for me, I needed them to work with server side generated html.
JS is more or less used to enhance the HTML. Sure, there are occasions where I use a JS template engine to dynamically render some HTML, but it's not that often.

The complete web component spec is of course much more than that. Templates, shadow dom... much more than that what I do.


And classes, oh classes. Javascript never needed classes. I for example use classes very very rarely these days, I prefer objects, mixins, prototypal inheritance. But that's just me.
 
Hey guys, quick question more database related I suppose.

I'm building a staff database/index at the moment.

But I'm not sure if I should have separate "User" and "Staff Member" tables that have a One-to-One relationship for my models or if I should just put everything into one table/model.

What is the best way to approach this?
 
Hey guys, quick question more database related I suppose.

I'm building a staff database/index at the moment.

But I'm not sure if I should have separate "User" and "Staff Member" tables that have a One-to-One relationship for my models or if I should just put everything into one table/model.

What is the best way to approach this?
If staff members and users share the same data structure, you could pack them in one table and use a flag-field to diminish between them.

Of course, splitting them could be better, depending on how complex your app will get. If possible, can you share more details?
 
If staff members and users share the same data structure, you could pack them in one table and use a flag-field to diminish between them.

Of course, splitting them could be better, depending on how complex your app will get. If possible, can you share more details?

So the 'Users' table has

USERS said:
ID
Email
Password
Staff_ID

The 'Staff Members' table has the following fields

Staff Members said:
ID
user_id
First Name
Last Name
Phone No
Extension
Office Hours
Manager
Team
Location
Active Regions
Duties

Now I might eventually split out "Teams" and "Managers" into separate tables and then I was thinking I could possible have a separate "Admin" table that contains "Users" who have admin rights.
 

Somnid

Member
And classes, oh classes. Javascript never needed classes. I for example use classes very very rarely these days, I prefer objects, mixins, prototypal inheritance. But that's just me.

I agree, I don't think it was needed and it looks like it's going to become the standard way to do everything (they'll say it's not necessary but it's clear they are more than sugar and will likely start getting specific optimizations with strong mode and such) which is a bit sad though it's somewhat understandable from a compiler perspective. Though prototypical inheritance is exactly why they exist because using prototype directly was terrible. Personally I don't think Js needs them because it doesn't need prototypical inheritance mainly because you have a mixin-like system for building things.
 

Kalnos

Banned
So the 'Users' table has



The 'Staff Members' table has the following fields



Now I might eventually split out "Teams" and "Managers" into separate tables and then I was thinking I could possible have a separate "Admin" table that contains "Users" who have admin rights.

You can remove the Staff_ID field from Users and the ID field from "Staff Members". You just need to make the ID field in "Users" a primary key and the UserID field in "Staff Members" a foreign key to it (and also a primary key to ensure one-to-one).

Code:
[U]Users[/U]
ID (Primary Key)
Email
Password

Code:
[U]StaffMember[/U]
UserID (Primary key and foreign key to Users.ID)
other fields
 

Copons

Member
So much to read about fancy vanilla JS stuff.
Problem is that I know about most of all that, but I'm not able to find proper real world use cases.
It's actually quite similar to when, years ago, I struggled to go object oriented in php.

Anyway, I went and replaced all my useless classes with a simpler carefree-er approach.
I sure have spared a lot of lines and got much more readability.
Here is the github repo (js folder), if you want to take a look: https://github.com/Copons/GG11/tree/dev/dev/js

(Don't bash me for every mistake though, I'm writing it in the office to keep my sanity, but I have to fake working, so sometimes things are rushed and commits are mostly a way to sync the repo between work and home :D )
 

xxracerxx

Don't worry, I'll vouch for them.
How can I have a line break in my array here? This is what I want to have happen:

Code:
"Name" => array
	(
		'Item 1' => 0,
		'Line 1 of Item 2' 
		'Line 2 of Item 2' => 65.00,
	)
 

WanderingWind

Mecklemore Is My Favorite Wrapper
Not really web development, but somebody asked me to make a static map and while I cobbled some shit together with Illustrator, it got me thinking. Is there some sort of program that allows you to basically make custom vector maps or something of the sorts?
 

Hellix

Member
I am looking at JavaScript libraries for charting, and I am liking Google's Chart/Visualization API. It is pretty easy to use once you get the hang of it. Another popular one I have seen is Highcharts, which I haven't tried yet, but you have to pay for commercial use. This is the first time I am getting into data visualization tools. My question is if anyone here knows of other JS libraries that they can recommend, or if there is any reason I should stay away from Google's Charts and use something else?
 

Somnid

Member
I am looking at JavaScript libraries for charting, and I am liking Google's Chart/Visualization API. It is pretty easy to use once you get the hang of it. Another popular one I have seen is Highcharts, which I haven't tried yet, but you have to pay for commercial use. This is the first time I am getting into data visualization tools. My question is if anyone here knows of other JS libraries that they can recommend, or if there is any reason I should stay away from Google's Charts and use something else?

d3 is probably the most popular nowadays.
 

WanderingWind

Mecklemore Is My Favorite Wrapper
Fast and powerful apparently. I haven't worked much with it yet but I'll be doing a project that uses it heavily next month. My co-worker seems to like it.

It's kind of funny. Chart.js has a really nice set of examples and easy to understand feature sets, but nobody ever recommends it. D3 has come up a couple of times and its page looks straight from 2003, as do all the given examples.

I think there is some correlation between how bad a feature set/library/plugin page looks and how much it's actually used. I can't explain that.
 

Kalnos

Banned
It's kind of funny. Chart.js has a really nice set of examples and easy to understand feature sets, but nobody ever recommends it. D3 has come up a couple of times and its page looks straight from 2003, as do all the given examples.

I think there is some correlation between how bad a feature set/library/plugin page looks and how much it's actually used. I can't explain that.

Different audience I believe. D3 for heavy customization/power and stuff like HighCharts/Chart.js for the "plug and play" solution.
 

WanderingWind

Mecklemore Is My Favorite Wrapper
Different audience I believe. D3 for heavy customization/power and stuff like HighCharts/Chart.js for the "plug and play" solution.

Yeah, probably, but you know, would it hurt D3 to cultivates at least 10 decent looking projects? Look at the gallery. They all look ancient. Half of them don't work on touch devices, either. Scared me off from learning it when nothing worked on iOS.
 

Kalnos

Banned
Yeah, probably, but you know, would it hurt D3 to cultivates at least 10 decent looking projects? Look at the gallery. They all look ancient. Half of them don't work on touch devices, either. Scared me off from learning it when nothing worked on iOS.

Point taken. Damn they have a fuck load of examples lol.

Anyone else trying Elixir/Phoenix? This is the most fun I have had programming in a long time. Maybe I'm just sick of NodeJS and .NET.
 

WanderingWind

Mecklemore Is My Favorite Wrapper
HighCharts got me all excited until I realized it wasn't free. lol. I'm willing to pay for the right solutions, but it doesn't look that much better than chart.js.

Now a proper mapping tool, I'd pay cash money for that. Same with timelines.
 

Hellix

Member
D3 does look pretty robust, but it also looks confusing to implement at first glance. Google, in my opinion, has their documentation well done and easy to understand. I haven't delve too deep into its customization options, but maybe that is when I will be left unsatisfied and wanting a different solution. I don't know how complex my visuals will be yet, so I am really just poking around now.
 

grmlin

Member
I used google charts and highcharts in the past, they both work.

Look at the design and functionality you have to implement and decide. Get the chart library that does what you need (animations, style, visualization options...). What I can say is: it can be a real pain to use a chart library for something else than the examples/documentations show.
 

Maiar_m

Member
It's kind of funny. Chart.js has a really nice set of examples and easy to understand feature sets, but nobody ever recommends it. D3 has come up a couple of times and its page looks straight from 2003, as do all the given examples.

I think there is some correlation between how bad a feature set/library/plugin page looks and how much it's actually used. I can't explain that.

Yeah D3 looks scary and is much more complicated to implement than chart.js, however it's also immensely more powerful. Bad doc is a real problem though, it infuriates me every time.
 

WanderingWind

Mecklemore Is My Favorite Wrapper
Are there any good beginner JS resources that start with basic document manipulation rather than interactivity? I'm interested in all of it, but have more of an interest in being able to do things like automate certain rote tasks initially. Stuff like generating a Table of Contents based on h1-h6 tags, wrap images inside a figure, stuff like that. Any books geared that way?
 
Been tasked to design an API to work with our databases. I've worked on APIs before, but it was either:
- me using an external third-party API or
- me coding an API that is for internal use only

I feel like I'm grasping in the shadows here.

So far I've decided on either Slim or Lumen microframeworks (it needs to be PHP). I don't even completely understand security, so I don't know if I understood OAuth protocol correctly. I did a LOT of googling but I still feel uneasy. Is this correct?
- We supply an API Key to Client. Is this just a hash of something, say client ID + a random string of chars?
- Client (the app) asks Server for an authentication token by giving the API Key + user's consent.
- Server responds with auth token, which is temporary (like 10 mins maybe). What do I hash?
- Client now requests for an access token.
- Server supplies access token. What do I hash?
- Client can now send API calls with the access token.

And how are key/token validations handled? I was thinking of setting up Redis just for a key/token lookup so that access token validation would be super quick. But no I read somewhere about this defeating the point or something due to some scalability thing? But how else am I going to validate a hash if that's all I've been sent? Assuming no client name, origin URL or whatever. Scalability won't be an issue for a long long looong time for us. Not in the next 3 years.

I'd also need to tell them how long this'll take but crap, I'm terrible at estimating. I've fiddled around with both the frameworks mentioned, got the bare bones running. Feels like most of the issues I'll encounter are infrastructure and security. Writing the methods to query the database feels like the very easy part.
 

Somnid

Member
There's no magic to the token values, they just have to be random strings. I'm not sure you can hash them either as you need to be able to recreate the signature for verification.
 

Blunoise

Member
So what's the day to day basis of a web developer at a company, what's the hours like? And are you told what project is, and if so do they expect you to know every line of code or can u just google things while on the job?

Once I finish school I will start applying to jobs, just want to know what I'm getting at
 
Top Bottom