|
Does Javascript allow you anyway to save a text file through a dialog, WITHOUT a server? Common sense says no as it'd be a security vulnerability, but I wanted to make sure. Basically I have an offline application that I'd like to be able to Save and Load the data stores into and from a JSON text file. I can serialize and read no problems, but will I have to set up a server to bounce the string back as text file, or is that not necessary? edit: On further investigation I doubt this would exist if it were the case, but it'll do. Maluco Marinero fucked around with this message at 11:48 on Dec 5, 2012 |
# ? Dec 5, 2012 11:14 |
|
|
# ? Jun 8, 2024 08:44 |
|
I've never made a login system before, and now finding myself making one with MySQL / PHP / JS. Is md5-ing a user's password with JS before sending it to the server without HTTPS a fairly secure transaction? Do I just need to sack up and get an HTTPS certificate?
|
# ? Dec 5, 2012 21:19 |
|
What does that accomplish? Even though you hashed the password, anybody who steals the hashed password can log in as the user. Just get SSL. StartSSL.com is free.
|
# ? Dec 5, 2012 21:29 |
|
Duh, they could just plug the md5 value into the submission. Sometimes I think before I ask questions. Thanks for the recommendation, I'll check it out!
|
# ? Dec 5, 2012 21:36 |
|
pksage posted:I've never made a login system before, and now finding myself making one with MySQL / PHP / JS. Is md5-ing a user's password with JS before sending it to the server without HTTPS a fairly secure transaction? Do I just need to sack up and get an HTTPS certificate? Since this is your first login system and you mentioned MD5, I feel compelled to mention that MD5 is strongly discouraged for use as a password hash. It's quick to brute-force, so should your user database ever be exposed, the attacker will easily be able to obtain most of your users' plain-text passwords. Use bcrypt instead.
|
# ? Dec 5, 2012 21:44 |
|
Movac posted:Since this is your first login system and you mentioned MD5, I feel compelled to mention that MD5 is strongly discouraged for use as a password hash. It's quick to brute-force, so should your user database ever be exposed, the attacker will easily be able to obtain most of your users' plain-text passwords. Use bcrypt instead. Also, USE A LIBRARY to handle as much of this password stuff as possible. Passwords are a common problem for which you should NOT reinvent the wheel unless you absolutely know what you're doing.
|
# ? Dec 5, 2012 21:48 |
|
Maluco Marinero posted:Does Javascript allow you anyway to save a text file through a dialog, WITHOUT a server? Common sense says no as it'd be a security vulnerability, but I wanted to make sure. The project you provided appears to use Flash, which allows you to save files. However, that sounds like overkill for what you're trying to do. Browsers don't give you direct access to the file system, but they do let you persist data in other ways. Try looking into HTML5 local storage.
|
# ? Dec 6, 2012 08:44 |
|
Maluco Marinero posted:Does Javascript allow you anyway to save a text file through a dialog, WITHOUT a server? Common sense says no as it'd be a security vulnerability, but I wanted to make sure. http://developers.whatwg.org/links.html#downloading-resources
|
# ? Dec 6, 2012 08:46 |
|
Gordon Cole posted:The project you provided appears to use Flash, which allows you to save files. However, that sounds like overkill for what you're trying to do. Browsers don't give you direct access to the file system, but they do let you persist data in other ways. Try looking into HTML5 local storage. I'm already persisting data using IndexedDB. I want to provide a way to export that data into a text file, which is why I had a look in at the Flash project. While the link that SD provides seems interesting I'd still have to have a server precompile the resource I'm after for it to come out right, yeah?
|
# ? Dec 6, 2012 13:37 |
|
Maluco Marinero posted:I'm already persisting data using IndexedDB. I want to provide a way to export that data into a text file, which is why I had a look in at the Flash project. While the link that SD provides seems interesting I'd still have to have a server precompile the resource I'm after for it to come out right, yeah? The download attribute is supported only by Chrome, at the moment. But, that got me thinking that maybe you could make a data url and get Chrome to download that. edit: it works: JavaScript code:
Wheany fucked around with this message at 17:39 on Dec 6, 2012 |
# ? Dec 6, 2012 17:32 |
|
Maluco Marinero posted:Does Javascript allow you anyway to save a text file through a dialog, WITHOUT a server? Common sense says no as it'd be a security vulnerability, but I wanted to make sure. I was going to suggest opening a new window, writing your content into it, and having the user Save As, or something. code:
http://hackworthy.blogspot.com/2012/05/savedownload-data-generated-in.html http://updates.html5rocks.com/2011/08/Saving-generated-files-on-the-client-side They cover some things like the anchor download attribute, FileSaver API, and BlobBuilder API edit: aand, beaten
|
# ? Dec 6, 2012 18:06 |
|
Maluco Marinero posted:I'm already persisting data using IndexedDB. I want to provide a way to export that data into a text file, which is why I had a look in at the Flash project. While the link that SD provides seems interesting I'd still have to have a server precompile the resource I'm after for it to come out right, yeah? Ah I see, I misinterpreted the question. I have less experience with what you're asking about, but Wheany's solution seems to work really well.
|
# ? Dec 7, 2012 01:07 |
|
I'm pretty sure this is the right place to ask this, but if it's not please let me know and I'll take it elsewhere. I'll also preface this by saying I have absolutely zero programming knowledge. Me and a bunch of goons play a particular online game. Said game is a browser based, mostly text based game. Lately, we've began to grow really tired of manually sorting through individual user stats and numbers, and we're looking for a way to automate as much of the process as we can. The problem is that none of us really have any coding knowledge to speak of, which is why I'm here, on behalf of the whole alliance. Basically, what we want is a Grease Monkey script that can pull the source code of a user's profile page, sift out all the important numbers, and then dump them into a Google Docs spreadsheet. I've looked through the beginner guides a bit, but ho-ho-holy poo poo that stuff looks like friggin' Greek to me. Would anyone be so kind as to be willing to help us get a script written, either by teaching one or more of us, providing us with some basic examples to work off of, or by writing it for us?
|
# ? Dec 7, 2012 05:21 |
|
Gordon Cole posted:Ah I see, I misinterpreted the question. I have less experience with what you're asking about, but Wheany's solution seems to work really well. Yeah, Wheany's solution looks to be the most straightforward way to do what I want, gonna try it out later tonight. Cheers for the answers folks. edit: Wicked, works a treat. Thanks a ton. It's cool having a completely offline web app that can now save and load like it was a Desktop App. Maluco Marinero fucked around with this message at 13:30 on Dec 7, 2012 |
# ? Dec 7, 2012 06:34 |
|
neogeo0823 posted:I'm pretty sure this is the right place to ask this, but if it's not please let me know and I'll take it elsewhere. I'll also preface this by saying I have absolutely zero programming knowledge. Could you give us an example of such a user profile and the stats that you'd like from the page?
|
# ? Dec 7, 2012 12:27 |
|
neogeo0823 posted:I'm pretty sure this is the right place to ask this, but if it's not please let me know and I'll take it elsewhere. I'll also preface this by saying I have absolutely zero programming knowledge. If you're thinking about dumping many user automatically, this is probably a job for something like scrapy rather than a GreaseMonkey script
|
# ? Dec 7, 2012 16:40 |
|
Munkeymon posted:If you're thinking about dumping many user automatically, this is probably a job for something like scrapy rather than a GreaseMonkey script After looking at the overview of that program, I'm not sure that it would work the way we need it to. The reason I was thinking of going with a GreaseMonkey script was because we've got a couple of those that we run for other things already, and there's a couple bits of important info that can only be viewed by the user logging in and viewing their own profile. This is something every user does every time they log in, so having our members install a script that adds all the info to a spreadsheet as they log in solves a lot of headaches about having to make sure the data is both accurate and up to date. Bodhi Tea posted:Could you give us an example of such a user profile and the stats that you'd like from the page? Here's a screenshot of my profile when I log in. I've highlighted the info we want to track: I just found out that you can't even view user profiles without logging in, so here's a guy who's roughly in the same spot as me: This guy is just about at the same spot as me, progress-wise, but since I'm not him, I see a bit less info on him than I need. I can't see how many spies he has, if he has a CIA(I know he does, but the game hides it from other players' view), nor how much money he has. Not only that, but I need to know how much he pays in daily bills, which is something that only he can see on a separate page. So, what do you guys think? I'm personally still for the GreaseMonkey script idea, because at the very least, we could most likely roll the scripts we're using now, plus this new one, into an all-in-one package that every goon would run, which would then hopefully keep everyone up to date on all their data without them actually needing to do anything beyond installing the script itself.
|
# ? Dec 7, 2012 19:26 |
|
neogeo0823 posted:After looking at the overview of that program, I'm not sure that it would work the way we need it to. The reason I was thinking of going with a GreaseMonkey script was because we've got a couple of those that we run for other things already, and there's a couple bits of important info that can only be viewed by the user logging in and viewing their own profile. This is something every user does every time they log in, so having our members install a script that adds all the info to a spreadsheet as they log in solves a lot of headaches about having to make sure the data is both accurate and up to date. Oh, I think see what you're getting at: you want everyone's browser to upload their information to some central location when they happen to log in because only they can see it, right? I was thinking you wanted to scrape a whole lot of other peoples' information in mass by visiting their profiles with a script enabled, which would be fairly silly.
|
# ? Dec 7, 2012 20:17 |
|
Well, you can definitely scrape that information from the page when a player visits the page with their browser. Then you could save the data into the browser's local storage automatically. If you did this, the player would have to visit each other player's profile page (or wherever that data in the screenshots are stored), then after visiting all the interesting pages, you might click on a "dump data" button which would show some text box with the collected data formatted in some way (probably comma- or tab-separated), which you might be able to paste into Google docs. I'd say that the above should at least be doable without relying on any sort of external APIs. e: Munkeymon posted:I was thinking you wanted to scrape a whole lot of other peoples' information in mass by visiting their profiles with a script enabled, which would be fairly silly.
|
# ? Dec 7, 2012 20:22 |
|
Munkeymon posted:Oh, I think see what you're getting at: you want everyone's browser to upload their information to some central location when they happen to log in because only they can see it, right? This is correct. We need the data for various things we do in game, and our current system involves us bugging every member to fill out a form every month, then pestering the ones that are too to bother until they fill out the form. The problem with this method is that it entirely depends on users doing this themselves, which means we get roughly 65% of our user base to actually participate. As luck would have it, my negotiations with a friendly alliance have(finally, after 3 weeks) just yielded a script that they use to do similar things. I, of course, can't make heads or tails of it. Would anyone be willing to work with me to decipher it and modify it so we could use it?
|
# ? Dec 7, 2012 21:19 |
|
I want to write what should be a fairly simple web app that generates forrest plots like this That data input side is pretty simple as it's just a form and could be done very easily in PHP which i've used before but reading up it seems javascript might be a better option as it would allow for a bit more tinkering and make some of the functionality i want to add later (like being able to see how removing certain studies effects the result) on look abit neater. Is my thinking right?
|
# ? Dec 8, 2012 11:53 |
|
Loving Africa Chaps posted:I want to write what should be a fairly simple web app that generates forrest plots like this With Javascript you could do that client-side, so the plots would change immediately, instead of having to do the calculations and graph updates on server. You probably should study if some graphing library already offers forest graphs and if not, then look at the canvas element.
|
# ? Dec 8, 2012 12:10 |
|
http://code.google.com/p/flot/ My last project I used Flot to make bullet graphs. If you spend a little time you can get the graphs to do almost anything you want, without reinventing the wheel.
|
# ? Dec 8, 2012 12:16 |
|
Wheany posted:With Javascript you could do that client-side, so the plots would change immediately, instead of having to do the calculations and graph updates on server. Awesome this is what i though, time to learn javascript. I've had a look at some graphing libraries and they don't do forest plots as far as i can see but it shouldn't be too hard to draw them. Maluco Marinero posted:http://code.google.com/p/flot/ This looks awesome, thanks.
|
# ? Dec 8, 2012 12:18 |
|
So uh... does anyone feel like helping me figure out my problem? As I said, I've received a copy of the script that another alliance uses, but after looking at it, I believe it might be in PHP. At the very least, I'd need help sorting out the bits of it that I would need to use, and then reformatting those bits to work with GM.
|
# ? Dec 8, 2012 19:00 |
|
The Request a tiny custom app again thread might be a better place to ask for that. What you are asking sounds like it would take several hours of actual work, and not just a couple of minutes of dicking around with javascript.
|
# ? Dec 8, 2012 20:03 |
|
Wheany posted:The Request a tiny custom app again thread might be a better place to ask for that. Ah, thanks. I didn't know about that thread.
|
# ? Dec 8, 2012 20:08 |
|
Wheany posted:Well, you can definitely scrape that information from the page when a player visits the page with their browser. Then you could save the data into the browser's local storage automatically. It's at least not a terrible idea. Sure, it's doable and it'd work, but it's more, repetitive work than writing a scraper (when that's possible - obviously not in this case).
|
# ? Dec 11, 2012 23:40 |
|
I was looking at GitHub's Javascript Styleguide and noticed this...quote:Do your best to never use a semicolon. This means avoiding them at line breaks and avoiding multi-statement lines. For more info, read Mislav's blog post. I guess my question is... what the gently caress? I've never heard anybody argue for relying on semicolon insertion before, much less standardizing on it. Is this actually a thing outside Github?
|
# ? Dec 12, 2012 23:35 |
|
It's a coding style. But of course it's wrong. You should be putting your braces on new lines, pleb.
|
# ? Dec 12, 2012 23:55 |
|
akadajet posted:I was looking at GitHub's Javascript Styleguide and noticed this... This is my favorite part of the linked article: quote:My advice on JSLint: don’t use it. Why would you use it? If you believed that it helps you have less bugs in your code, here’s a newsflash; only people can detect and solve software bugs, not tools. Cool, so I guess all static analysis tools are completely useless. And what's the deal with compiler warnings?! It's not like a computer is going to find any problems with our code, so why even bother! This guy is a joke, although I do think it's fine to leave out semicolons as long as you completely understand the consequences of doing so. The "only real problem" with leaving out semicolons that he mentions is actually a pretty big problem: quote:Here is the only thing you have to be aware if you choose to code semicolon-less: And I think his recommendation of prepending lines that start with parens with a semicolon is awful. I personally use semicolons because it means I don't have to worry about these kinds of things. In my experience it's the more common coding convention in the JavaScript community anyways.
|
# ? Dec 13, 2012 00:29 |
|
Gordon Cole posted:And I think his recommendation of prepending lines that start with parens with a semicolon is awful. This is what made my head explode. Why do I always see Ruby developers trying to force that language's idioms on everything?
|
# ? Dec 13, 2012 00:41 |
|
Gordon Cole posted:Cool, so I guess all static analysis tools are completely useless. And what's the deal with compiler warnings?! It's not like a computer is going to find any problems with our code, so why even bother! JSLint is a piece of opinionated garbage. I mean, it has a goatse as its logo. Nice! Suspicious Dish fucked around with this message at 01:20 on Dec 13, 2012 |
# ? Dec 13, 2012 01:17 |
|
Suspicious Dish posted:JSLint is a piece of opinionated garbage. I mean, it has a goatse as its logo. Even if it is, claiming that "only people can detect software bugs" is ridiculous.
|
# ? Dec 13, 2012 01:24 |
|
I'm in the middle of making a web-based "connect the colored, numbered dots to make a picture" game - think PathPix or Link-A-Pix. It's a simple thing at the moment, with all of the JS, CSS, and HTML contained within one HTML document. Things have been going well - I've got path validation figured out, as well as the method by which I can generate a playing field of variable size and then lay out a sequence of predetermined colored number points for the user to connect. Unfortunately I've hit a wall - I can't figure out how best to keep track of the path of each line. I need to be able to store every cell used in a line so that if a user retraces their steps to redraw a line, I can sanity-check their movements to make sure they're moving properly according to the game rules. Also, if a user completes a line but needs to redraw, I want to enable them to double-click on the beginning or end of a completed line to reset every cell used in that line as though they were never traced on. I'm thinking of using an array for each line unique - when a user draws a line segment, provided the movement passes validation, that cell's ID will be put into an array after its preceding cell's ID. If a user retraces their steps, each cell they retrace their steps from is removed sequentially from the array. Here's a pseudocode example of an array containing a list of cells in a completed line: code:
It sounds simple enough, but I'm having the most trouble deciding on how to organize a multi-level array to store all of this information - I need to be able to store the length and color of each line as well so I can reference it as part of the move validation function. Once arrays get two or three levels deep my head starts to spin What's the best way of going about this? Is an multi-level array overkill, or even too limiting?
|
# ? Dec 13, 2012 01:49 |
|
akadajet posted:I was looking at GitHub's Javascript Styleguide and noticed this... Putting semi-colons in yourself A) can help avoid bugs / issues (rare, and yes, easily avoided, but maybe the guy changing your code later isn't as smart as you!) B) makes explicit what could be vague to others reading your code C) has zero down side. (OMG THOSE EXTRA BYTES!!! notwithstanding) So why on earth would not *not* put them in?
|
# ? Dec 13, 2012 04:32 |
|
Lumpy posted:Putting semi-colons in yourself A) can help avoid bugs / issues (rare, and yes, easily avoided, but maybe the guy changing your code later isn't as smart as you!) B) makes explicit what could be vague to others reading your code C) has zero down side. (OMG THOSE EXTRA BYTES!!! notwithstanding) Because you're deliberately contrarian and care more about personally showing off than about building maintainable software.
|
# ? Dec 13, 2012 04:39 |
|
Lumpy posted:Putting semi-colons in yourself A) can help avoid bugs / issues (rare, and yes, easily avoided, but maybe the guy changing your code later isn't as smart as you!) B) makes explicit what could be vague to others reading your code C) has zero down side. (OMG THOSE EXTRA BYTES!!! notwithstanding) Yeah, for a language that is very specifically white space dependant like Python it's entirely understandable. For a language like Javascript that's full of gotchas, why add one more for maintenance programmers to get tripped up by.
|
# ? Dec 13, 2012 04:42 |
|
I'm in ExtJS 4.1, and I'm using a function that colors grid rows based on that row's record. The only built-in ExtJS functionality for this involves adding a CSS *class* rather than a style string, but I'd like to give the user a palette of colors to choose from (i.e. a user-specified hex string), and I don't want to create a class for every hex color code. (For anyone in here that actually uses ExtJS, this is the getRowClass function of a gridpanel's viewConfig.) What's the best way to approach this? Is there any way to manipulate CSS classes after the stylesheet has been loaded? I looked into CSS3 variables, but they're not globally supported yet(?). Worst case I can give ExtJS the finger and style the cells myself, but the ExtJS grid model is a tangled mess and I'd rather not.
|
# ? Dec 13, 2012 05:20 |
|
|
# ? Jun 8, 2024 08:44 |
|
Lumpy posted:So why on earth would not *not* put them in? pksage posted:What's the best way to approach this? Is there any way to manipulate CSS classes after the stylesheet has been loaded? I looked into CSS3 variables, but they're not globally supported yet(?). Worst case I can give ExtJS the finger and style the cells myself, but the ExtJS grid model is a tangled mess and I'd rather not. Gazpacho fucked around with this message at 06:28 on Dec 13, 2012 |
# ? Dec 13, 2012 05:22 |