Jump to content

justsomeguy

Moderator
  • Posts

    31,575
  • Joined

  • Last visited

  • Days Won

    77

Everything posted by justsomeguy

  1. Look: $('body, html').animate({scrollTop: $('#your_tutor').offset().top},800); You are targeting 2 elements. The body element, and the html element. You are telling it to animate scroll both of them at the same time. I have no idea what the browser is going to do when jQuery tries to animate the window scrolling of 2 elements. That's what I'm talking about.
  2. There's probably a way to use CSS only to do a transition, but no, I wasn't suggesting not using Javascript. No. Maybe it reacts differently to trying to animate scroll two elements at the same time. I know. I see the fact that it doesn't do it if you wait as a symptom or clue to what the problem is, and my guess, again, is trying to scroll two elements at the same time.
  3. It seems like the animation doesn't finish for a while, maybe because you're trying to simultaneously scroll 2 elements. If you wait before scrolling it's fine. Are you unable to link directly to specific parts of your site because you're loading everything with Javascript?
  4. You have CSS targeting only the checked button. That's how radio buttons work, you can only select one of them.
  5. Get rid of the invalid JSON text, that shouldn't be there.
  6. You can save whatever you want in a database if the person is logged in to your site. I'm not sure exactly what you're trying to do though.
  7. If I use wget with that it gives me a 403 response, you want people to help you get around Apple's authentication? If you want to distribute Apple's software, then contact Apple and tell them you want to distribute their software.
  8. justsomeguy

    PHP question

    No, that's not what it means. It means that the variable persists its value even across different function executions. It means that each time that function runs, the variable has the value from the last time it ran. If you don't want a value to ever change then use a constant.
  9. I'm using source code as it's normally used by programmers. You write Javascript source code, and then use NPM to build the final package, just like you would use a compiler to compile C code into an executable. Here's the source for one of my components that's using react: import React from 'react' import StudentLayout from 'components/StudentLayout' export default class MainAppLayout extends React.Component { constructor(props) { super() this.state = { LMSuser: props.LMSuser } } render() { return ( ( <div style={{margin: "10px"}}><StudentLayout LMSuser={this.state.LMSuser} /></div> ) ) } } It imports another package and another component, and exports a class for this component with constructor and render methods. NPM takes all of the source code for all of the components and packages you're using and produces a single deliverable that is the actual runnable Javascript for the project. Here's the source code for another component: import React from 'react' import $ from 'jquery' import { Link, IndexLink } from 'react-router' import Msg from 'components/Msg' import Messages from 'components/Messages' import PageNav from 'components/PageNav' import Footer from 'components/Footer' import MainAppLayout from 'components/MainAppLayout' import getMuiTheme from 'material-ui/styles/getMuiTheme' import {Card, CardActions, CardHeader, CardMedia, CardTitle, CardText} from 'material-ui/Card' import FlatButton from 'material-ui/FlatButton' import defaultTheme from 'themes/defaultTheme' import muiThemeable from 'material-ui/styles/muiThemeable' import CircularProgress from 'material-ui/CircularProgress' import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider' import Chip from 'material-ui/Chip' import Avatar from 'material-ui/Avatar' import SocialPerson from 'material-ui/svg-icons/social/person' import { white } from 'material-ui/styles/colors' import * as Actions from 'actions/Actions' import Store from 'stores/Store' import MsgStore from 'stores/MsgStore' export default class Layout extends React.Component { constructor() { super(); this.state = { apiAvailable : true, haveUser: false } } componentDidUpdate() { //componentHandler.upgradeDom() } componentWillMount = () => { this.getLMSUser(); } getLMSUser = () => { this.userXHR = $.ajax({ method: "POST", url: "lms.php", dataType: "json", data: {mode: "getUser"} }).done( (data) => { if (!data.username) { MsgStore.createMsg({message: 'You are not logged in.', type: "popup"}) return; } Actions.saveLMSUser(data) this.setState({LMSuser: data, haveUser: true}) }) .fail( (xhr, status, err) => { if(err != 'abort'){ //MsgStore.createMsg({message: err}) alert('Error contacting server') } }) } handleSubmit = () => { let api = typeof(Novus) !== 'undefined' ? Novus.api.base.split('/rest')[0] : null window.location.assign(api) } render() { let displayWidth = $(window).width() const theme = defaultTheme() const { apiAvailable, haveUser } = this.state const styles = { loader: { width: '100%', textAlign: 'center', marginTop: "400px", } } return ( (apiAvailable && haveUser) ? <MuiThemeProvider muiTheme={getMuiTheme(theme)}> <div> <PageNav muiTheme={getMuiTheme(theme)}/> <MainAppLayout muiTheme={getMuiTheme(theme)} LMSuser={this.state.LMSuser}/> <Footer muiTheme={getMuiTheme(theme)}/> <Msg displayWidth={500} /> </div> </MuiThemeProvider> : <MuiThemeProvider muiTheme={getMuiTheme(theme)}> <div style={styles.loader}> <div style={styles.loader}>Veeco FSA Tool</div> <Msg /> </div> </MuiThemeProvider> ) } } If you just tell a browser to load that it's not going to know what you're doing. That's the source code, not the built project.
  10. If it shows private members then I don't think there would be a way to hide those.
  11. It's just the same with localhost as a remote server, the only difference is the host when you tell mysql where to connect.
  12. Yes, you build the project from your source code and the build process produces a single file, usually, for your application that includes everything it needs plus its own code.
  13. justsomeguy

    Perl+SQL

    I don't have an example of running a SQLite pragma, but if you do some research I'm sure you'll find examples. It should return a result set of columns that you can use to determine if the column you want is already part of the table.
  14. justsomeguy

    Perl+SQL

    Just like I said. Get the list of columns and figure out if it's already there or not, and add it if it's not.
  15. justsomeguy

    Perl+SQL

    SQLIte does not have if statements. It also does not have an information_schema database. It seems like you found something that works in MySQL and you're assuming that it's also going to work in any other database, and that's not true. It looks like you need to use the table_info pragma to get information about a table, which will return one record per column in the table. Look through those results to see if the column exists and then alter the table if not. https://www.sqlite.org/pragma.html#pragma_table_info
  16. When you build a project you tell it which modules to use, and it builds everything together. That's one of the things that Node Package Manager does.
  17. I'm not familiar with that, I feel like I used something similar to that at one point but that project is only 2 years old so it wouldn't have been that.
  18. In Javascript, all strings are internally treated as UTF-16 strings: http://ecma-international.org/ecma-262/5.1/#sec-8.4 http://speakingjs.com/es5/ch24.html
  19. You can get the length of a string, although you haven't said which database you're using so we don't know what's available to you. Regardless, it looks like you have a field where you're storing multiple pieces of data, and you're figuring out the reason why it's not a good idea to do that. If the different parts of that string are each significant then they should be in their own fields.
  20. I'm not sure why you're trying to filter out all apostrophes at all, because your problem is not apostrophes, but an obvious pattern would be an apostrophe that does not follow a letter.
  21. I doubt that someone is typing "&quot" into a search field somewhere, so that data is getting messed up somewhere along the way. Ideally you would find where and fix it there so that the data can be normalized to start with. Terms shouldn't be repeated just because they have extra punctuation. Otherwise, before the data gets added to the database try to clean it up by looking for those specific terms and removing them.
  22. How come, what's the difficulty? Is the problem that the escape sequences seem to be missing the terminating semicolon? Can you figure out why that is? If you're only seeing specific sequences then you could just look for those specifically and remove them.
  23. I'm not sure what your specific problem is. I would not store any version of a password in a cookie though, even if it's hashed. Just store a user ID and a token. Generate a new token for every request, so that each token is only used once. When you check the cookies to validate the user, compare the cookie token with the token in the database for that user, and if it's correct generate a new cookie, save it in the database, and update the cookie. Use single-use tokens instead of saving personal details in the cookie.
  24. It might not be possible to support very old browsers, it depends what they allow. I know that some sites used to use a Flash movie to do copying. Old IE that supports ActiveX may be able to use an ActiveX control to support copying. At some point you need to just draw the line though. My company doesn't even fix bugs on unsupported IE browsers for free any more, if a customer finds a bug that is only in an unsupported version of IE we bill them for the bug fix if they want us to do it. It was a good day when we could make that decision. We'll fix any bugs that show up in a current browser version, but when Microsoft stopped supporting IE we did too.
  25. You could use a regex, you could also use str_replace to just replace specific characters. It depends if you want to save the original data or not. If you don't care about the data before it gets cleaned, then clean it before you save it.
×
×
  • Create New...