Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by Synook

  1. Synook

    Getting The Time

    You can also get people to tell you their timezone when they sign up, then you can use PHP to retrieve their local time. This is how many web applications, including this forum, work.
  2. CSS doesn't describe content, and so a CSS file by itself has nothing to "display". What sort of content do you want to apply the stylesheet to?
  3. Synook

    Order By

    Why don't you just have the squad-number-checking logic in PHP? if ($data['squad_number'] != 0) echo $data['squad_number']; or something.
  4. You should try to create a common layout that persists across all your pages, so that the stylesheet applies in the same way to all of them. Generally, you can create a general page design first, and then after coding it fill in the specific stuff for each page. If the designs of the two pages are totally different, then you probably do need different stylesheets.
  5. Synook

    Installing Pear

    .bashrc is in your home folder (it is hidden, due to the . at the start). To append the pear path to the PATH variable you can add the line: export PATH=$PATH:/var/root/pear/bin You may have to restart terminal / re-login for it to take effect (the .bashrc file is basically a list of commands that is run by bash, the shell, when it runs).
  6. Synook

    Installing Pear

    Well it looks like is has installed the pear binary to /var/root/pear/bin (check though, I don't know), which is probably not on the PATH environment variable (which lists the location where the OS should search for binaries by default). You can either change your .bashrc or similar to include that path in the PATH environment variable, or press '4' during installation to change the path to something already used (/bin or /usr/bin would be appropriate). Or you can just type in /var/root/pear/bin/pear every time you want to run it.
  7. 1. You may be able to use the spellcheck attribute to control spell-checking, but this may not work in all browsers. 2. When you hit enter, the form is submitted, and you probably don't have an action set so the page was just reloaded (clearing the input values). You can override this behaviour by setting an event handler for the form's submit event, but this is against UI conventions where the enter key is meant to submit the form. Users are meant to press tab to switch between fields.
  8. Synook

    Installing Pear

    It's the sudo bit that comes before the second command in their documentation (in the yellow box) — it means to run the command with elevated privileges (i.e. as root, or "Administrator" as they call it in Windows).
  9. Most of those only translate term-by-term (they are dictionaries, after all), and anyway they are a form of electronic translator as well. By virtue of Google's massive collection of documents in all languages, Google Translate is probably the best general-purpose machine translator there is... but it's still not very good.
  10. I believe ASP and ASP.NET can be both interpreted and compiled, depending on what language you use (remember, those are just frameworks). Java (JSP), in which Java is converted into "bytecode" (a sort of contrived assembly language), which is then run on a virtual machine. Modern PHP does this too but I don't think the process is as advanced — for example, Java has a "JIT" compilation mechanism that can cache common routines in machine code and just execute them instead of having to use the bytecode. Coldfusion is almost certainly interpreted. I wouldn't say there is a absolutely "best" programming language or framework for web development, but different ones suit different purposes. For example, along with the existence of first-party support ASP.NET (classic ASP has been superseded and is definitely not a good framework to use) integrates well with Microsoft systems such as Windows Server, SQL Server and Active Directory and thus is good for organisations that use Windows. Popular application programming languages, such as C#, C++, and VB.NET can also be used with ASP.NET, which reduces the learning curve. This is similar with JSP. In the case of bank websites, it is important to have a high level or support, but other features of PHP, such as its open-source nature, also reduce its applicability for those sort of applications. Remember the crypt() bug in PHP?* The service-level-agreements (SLAs) you get when you purchase licenses for proprietary products can provide some assurance in that regard. As aforementioned, too, using something like ASP.NET means that your programmers don't have to learn a new language from scratch. The reason, as far as I can tell, many people don't like PHP is because it is a very weird language. Many languages, such as Java or even Haskell, are designed from the ground up with very clear rules and conventions in mind — the language will operate in this way, our syntax will look like this, etc., and thus are very... uniform, if you like. PHP, on the other hand, was hacked together from a very simple start to the very complex language it is today, and thus has many little quirks and other inconsistencies that make it less "beautiful" to program in. For example, PHP only recently introduced an object-oriented model, and many of the libraries still use the old structured style (e.g. where you see a = create(); do_something(a)). There are many syntactic irregularities, too, such as with HEREDOC syntax. As a result in can feel much more ... unstructured writing in PHP than in some of the other languages, and also leads many people to program in strange ways (e.g. combining object-oriented and structured programming). I don't know how PHP gets funding, but it probably involves some combination of sponsorship, donations, and merchandise. I don't think the PHP Group sells support (unlike how, e.g. MySQL AB used to). * it basically caused the crypt() function to return the same thing for every input string.
  11. Synook

    Installing Pear

    It says you should run it in superuser mode — try that. P.S.: the wget utility just downloads the file at the URL provided in the argument.
  12. Machine translators are useless for accurate translations — they can provide the gist of a body of text but in terms of grammatical accuracy, or translation of meaning, they are very bad. Why don't you try them out? By "manual translation", I meant human translation. That is the only way to do it properly.
  13. The GitHub for Mac documentation says you can use it for any Git repository: "... if you wish to use a non-GitHub remote, it will work just fine. Set the remote manually in the settings tab and everything else should work as expected."
  14. They do have a lot more going on, but it wouldn't involve doing strange things to their database structure. However, there are "non-relational" database systems that store data in different ways that are perhaps more suited to large-scale applications, like Google's BigTable. On the PHP side, a language being object-oriented does not necessarily mean it has higher performance; in fact, the extra effort required to compile/interpret object-oriented structures probably makes them slower to compile/run.* However, the main problem with PHP is that it is a fully interpreted language, which means that it must usually be converted into machine instructions on the fly, which incurs a significant overhead. I don't know what this overhead is, but if it is superlinear then you have a scalability problem (and it's just slower anyway). By using their HipHop "code transformer", they can convert PHP code into C++ code and then compile it, allowing their applications to run natively instead of being interpreted all the time. * on an interesting note, our algorithms subject at uni is taught in C and not C++ because it is not object-oriented, so algorithms can be implemented directly, with minimal extraneous code.
  15. It's just describing the lang attribute again. As people have said, there is no relation between translating text and the lang attribute. If you want an exact translation you will need to do it manually.
  16. What is the format you want it to display in?
  17. Synook

    Query Sorting

    The symbol `a` doesn't represent a column — it is an alias for the subquery, which can be used to refer to it later. For example, you could have written SELECT a.* FROM (SELECT * FROM table ORDER BY c DESC LIMIT 5) a ORDER BY a.b (though that is redundant). MySQL requires all subqueries to have aliases in that manner. P.S.: if it was a column name, then there would be a comma before it. Also, you can change the alias to something more appropriate if you want; it doesn't have to be called `a`.
  18. The things you have to check for nowadays are generally "features" that some browsers implement, but other (not necessarily older) ones don't. Some examples include events like copy and contextmenu, as well as new HTML5 stuff like localStorage. http://www.quirksmode.org/ is, as you may have gathered, a good place to find compatibility on the various JS features browsers may have implemented, and W3Schools also has a key on each page of its JS reference.
  19. You should never create new tables dynamically — it is just a very, very bad idea. As with all relational databases, the data should be stored in a relational fashion — so there may be one table that stores "basic data", that each person only has one of (e.g., FBID and birthday), and then another table that stores wall posts, related to the former table on a one-to-many basis, and then another table for friends, which associates users with other users with a many-to-many relation, and so on. The basic concepts of good database design remain (more or less) the same no matter how large your dataset gets — you shouldn't be intimidated into doing weird things like creating tables on-the-fly just because you have "too much data". Optimisation can be performed at the implementation level, for example Facebook makes extensive use of caching. They also have many non-relational databases that store some of the information on their system.
  20. Also, you can't create websites that include more than the most basic amount of JavaScript, or that incorporate server-side scripting (e.g. a browser-based RPG) using WYSIWYG (what-you-see-is-what-you-get) tools like Webs.
  21. Synook

    Query Sorting

    Do you get any errors? You can check by printing out the return value of mysql_error(). You may need to alias the subquery (e.g. SELECT * FROM (SELECT * FROM table ORDER BY c DESC LIMIT 5) a ORDER BY b
  22. Synook

    Query Sorting

    You can use an uncorrelated subquery for the first query. SELECT * FROM (SELECT * FROM table ORDER BY c DESC LIMIT 5) ORDER BY b
  23. Synook

    Starting Pear

    You are missing Pear.php. Downloads and installation instructions for the PEAR system can be found at http://pear.php.net/.
  24. Well, it does not contain any obvious vulnerabilities. You are probably more likely to have someone maliciously gain access to your server's filesystem than for that script to be exploited.
  25. No-one else (i.e., on a different server), can read your PHP file over HTTP, as long as the PHP interpreter is acting on it. The PHP interpreter will execute the PHP code inside the file and only send the output on to be delivered over HTTP. You would need to have a vunerability within your own code.
  • Create New...