Jump to content

salathe

Staff Alumni
  • Posts

    1,832
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by salathe

  1. Before allowing anything like wildcards or "importing" entire namespaces, I'd like to see namespaces implemented more as black boxes (e.g. namespace-scoped variables and such like). Currently they are essentially used as class/function/constant name aliases.
  2. Look into using the available date classes, such as DateTime, DateInterval and DatePeriod. They are designed to make working with dates much less painful than the archaic lets-modify-a-timestamp-in-a-loop approach of yester-year.
  3. So, by "cycle" what is really meant is adjacent occurrences of a sequence of numbers. Now that that's clear, what have you tried so far, if anything?
  4. A cycle! Or is that sequence? I'm confused too!
  5. Go "full PHP", and Python, and Java, and… just take your time.
  6. Then you likely want to get all of the rows, loop over them and access each row's individual collection of cells. The basic idea is something like: $tableRows = $xpath->query('/html/body/table/tbody/tr'); foreach ($tableRows as $row) { $cells = $xpath->query('td', $row); foreach ($cells as $cell) { echo $cell->getNodePath(); echo ' has value '; var_export($cell->nodeValue); echo "<br>\n"; } }
  7. Does she? You suggested an array, not the OP.
  8. You are essentially looking to change the numbers from base 10 to base 62. PHP already has tools available to do this work for you, in the GMP extension. A basic example would look like: echo gmp_strval(gmp_init(12345, 10), 62); // Outputs: 3D7 Note that the above will use a slightly different map of characters than you mentioned in the first post (A-Z comes before a-z). If you want to keep your specified letter order then you could use something like strtr() to convert upper- to lower-case and vice versa. P.S. Your math in the first post is a little off at the boundaries, for example decimal 35 (not 36) should be z.
  9. You appear to be under the impression that URLs dictate the file type of the resource. This simply is not true. There is no reason why http://example.org/foo.exe could not be a completely normal web page (or a animated kitten gif), nor why http://example.org/foo/ could not be the location of an executable. If you still want to "validate" URLs based on whether they appear to contain what might possibly be a direct download link to a file, then sure go ahead but it seems like a silly idea to be. P.S. AyKay47's post isn't a very good example, even if you were to go down that route.
  10. You could add a new placeholder into $sImageTemplate, such as {IMGcount}. Then get the number of items in the $aUnits array using count. $iUnitsCount = count($aUnits); Then replace the placeholder by adding it into the array for strtr. $sImages .= strtr($sImageTemplate, array(..., '{IMGcount}' => $iUnitsCount));
  11. Here are a few resources, perhaps you have already read one or more of them. They should help you get on your way to deciding on a good, and widely supported, font stack. Code Style: CSS font survey and sampler Sitepoint: 8 Definitive Web Font Stacks Smashing Magazine; Guide to CSS Font Stacks: Techniques and Resources CSS Font Stack
  12. * Moved to CSS forum and unlocked *
  13. Except that that would be more forgiving than the OP has stated is allowed thus far.
  14. Apart from never reaching the "is ok" code... not a lot.
  15. There are .NET implementations of HAML too, if you're already familiar with HAML and .NET (it sounds like you might be) then run with it.
  16. salathe

    Date

    If you have access to a command line on the server, run locale -a. It could be that the locale is named slightly differently, or you can generate that locale. If you don't have access to check/generate it yourself, I don't see why the host wouldn't be happy to do it for you.
  17. salathe

    Date

    The date function does not change its output based on the locale, for that you want strftime. setlocale(LC_ALL, 'no_NO'); echo strftime('%A %e %B', strtotime('2012-10-29')); // mandag 29 oktober
  18. This is the important point, more so than any performance concerns of the @-operator. The ternary example allows you to define the value when the variable is not set, whereas the @'d variable will give you NULL (so you'll later go check for NULL and assign a value, right).
  19. Great. Please post your findings such that others can learn from your mistakes.
  20. I still do, daily. I'm a little stuck in the past.
  21. As the others said, one of the easier ways would be to create an array containing enough information to sort the files as you need. This array could contain all of the information that you are going to display, or it could just be a stepping stone to getting the list of files in the right order: that's up to you. I would go with Barand's suggestion of creating an array mapping file names to DrawnDates. While you're here, there are a few minor points about your code that I hope you wouldn't mind me mentioning. The FilesystemIterator is preferred over the older, slightly quirky, DirectoryIterator. In your case, only the class name needs to be changed to use it. By using isFile(), the second condition will never be met: when $oFile is a file, then it can not be a dot-directory. Your code might as well be if ($oFile->isFile()) { Your XML files only have one DrawResult (judging by your example on Dev Shed), so there is no need to loop over (all one of) them.
  22. I can't say I've noticed any particular issue today.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.