-
Posts
2,241 -
Joined
-
Last visited
-
Days Won
47
Everything posted by netcarver
-
That's a good example of fixed-point storage and is certainly one way to address this. Also, though I'm not 100% sure about this, I seem to remember having heard from accounting circles that you should be storing 2 decimal points beyond the smallest unit of currency, not one. Meaning $3.25 would be represented as 32500 and $3.256 as 32560. If that's right, that would apply no matter if you were using strings or integers behind the scenes.
-
Hi Roelof, welcome to the ProcessWire forum, you'll find quite a few Textpattern users in here! At least, I seem to remember a roelof from the TxP forum with a domain similar to that one but my memory is not what it used to be. Anyway, if that is you and your site is running on Textpattern then you should be OK with ProcessWire. I haven't yet come across anything that I did in Textpattern that I can't do with ProcessWire (and usually much more easily too.) Edited to add: But, it does take knowing some PHP as you'll need to use PHP in your template files.
-
Take a look at fNumber and fMoney from the Flourish library if you need something to ease working with these kinds of data. And here's a how-to for autoloading Flourish from your template files should you choose to go down that route.
-
Ah, ok. If you need any more help with that I should be around in #processwire later this evening.
-
What are folks wanting to store in these float fields? If you want to store what would be monetary values then I'd suggest avoiding floats or doubles like the plague. Go with fixed-point values which are usually strings which you manipulate with PHP's bc maths functions. MySQL also supports fixed point numbers using the DECIMAL() type. Contrary to popular belief, floating point numbers (including doubles) are *extremely* inaccurate number representations. Where floats and doubles shine is where you have to store values from a huge *range*; but they do it at the expense of accuracy. They are almost always inaccurate approximations of the value you want to store.
-
Hey Joss, Not a total solution, more of an idea to get you started; when you hear phrases like "ad-infinitum" in the context of computation you probably need to be thinking of using recursion rather than iteration. In most programming languages this is handled by having a function that calls itself as many times as needed to get the job done. Something like this perhaps... function renderChildrenOf($parent) { $output = ''; $children = $parent->children; foreach ($children as $child) { // Render this child. NB use of .= which is a PHP shortcut to // concatenate stuff at the end of existing $output. // Adjust this to suit your needs $output .= '<li>' . $child->title . '</li>'; // If this child is itself a parent, then render it's children in their own menu too... if (count($child->children)) { $output .= '<ul class="dropdown-menu">' . renderChildrenOf($child) . '</ul>'; } } return $output; } $homepage = $pages->get("/"); // Setup the start of the top-level menu... $menu = '<ul class="nav">'; // Append something for the homepage (as menus usually squish the root node in with its children anyway)... $menu .= '<li><a href="/">' . $homepage->title . '</a></li>'; // Set the ball rolling... $menu .= renderChildrenOf($homepage); // Close the top-level menu... $menu .= '</ul>'; // Show the result to the world... echo $menu; Ok, that's off the top of my head and is meant to give you a starting point to address your ad-infinitum issue. You'll need to experiment some and adjust the markup as needed for bootstrap. Hope that helps.
-
ProcessWire not working in WAMP environment (Windows 8)
netcarver replied to thisissnafu's topic in General Support
@thissnafu: welcome to the forum. Glad you worked out your problem! -
Hello again Marty, Check out the fourth image in the opening post for some clues regarding cache invalidation when pages are saved. I would imagine that you might need to do some manual cache invalidation if you edited template files but you'll have to wait for a reply from Ryan for that. I'd imagine it shouldn't be too hard to add a module that simply watched for changes to template files and invalidated the ProCache cache if it found any that had changed.
-
@WillyC Con.sider do secure pass.phrase gyration service u.can? you perhaps kickfarter?
- 1 reply
-
- 4
-
-
Hi Marty... You can use tools like ApacheBench to do this (installation instructions here. Steps 1 & 2 are all you need). Warning; if you point this at a live production server and fire off a lot of requests at it you are effectively operating a denial of service against that site for as long as the test is running, so you'd want to keep the number of requests pretty low to limit how long the site is affected ... say a hundred requests to start with... ab -n 100 -c 10 -r http://site.to.test/ If you are testing on localhost or a non-production server, feel free to wind the requests right up (that's the number after the '-n'.) There are other tools that can be used for profiling and some are listed in the answer to this server fault question.
-
I'm in! Thank you Ryan.
-
Hi Matthew, sorry for the delay in replying. I have little experience with off-the-shelf solutions but know some people who like things like the drobo but I've never used it. Actually, it sounds like you are doing about 200% better with your current backup strategy than most people, probably myself included (currently I do a regular backup to an external, removable HDD and most of my development work goes onto github, if public, or bitbucket if private.) In the past I have setup RAID-1 arrays using FreeNAS on cheap-and-cheerful old boxes. I'd have the OS (which is FreeBSD based) running off a memory stick on an internal USB port and 2 matching sata drives hooked up directly to the motherboard. These boxes actually serve as a file server with backups handled onto external drives. There are, however, plenty of other products in the same arena (like UnRaid and NAS4Free.) FreeNAS works great and is pretty easy to configure, supporting many network storage options and even allowing ZFS if the box is powerful enough. There's always the possibility of failures in RAID but it comes down to managing risk vs the costs of not doing so. If you want to look at things like distributed storage then there are products like Gluster which allows having different storage nodes (one of multiple How-Tos courtesy of HowToForge.) For off-site storage there are multiple services to choose from starting off with a roll-your-own solution (like rsync to your own off-site server somewhere) to more bespoke products like Carbonite, JungleDisk and, more up my street, Tarsnap. You could even use dropbox if you didn't care a hoot about security.
-
Hi Matthew, do you want an "off-the-shelf" solution or are you willing to put something together yourself?
-
I created a repository for a base HTML5 startup.
netcarver replied to thatigibbyguy's topic in Showcase
Great idea. Perhaps this could lead to various PW "distros". -
Once the International Organization for Standardization have a 639 classification for WillyC's lingo, we can give him his own sub-forum too.
-
Hello Jenn, Welcome to the forums and thanks for reporting that. You are right, this is incorrect in the master branch on github but it does look like it's fixed already in the dev branch.
-
In reply to panictree... Totally agree here. There is very seldom a 1:1 language:country mapping so trying to reflect language via country-specific top level domains doesn't reflect that reality anyway. Language specific subdomains would be more easily established under the processwire banner and certainly easier to administer. However, for *local* user-groups locality obviously becomes an issue and is, perhaps, better solved by such groups as they organize themselves anyway. In such cases, I would have thought that a "national" PW user group (should it ever get established) might seek to secure and use domains like processwire.de/.es etc. Perhaps we could do something similar to Textpattern's forum? They have an International section with subforums for each language. The vast majority of discussion is in the English forums but having the language specific forums there does allow for conversations in other languages when needed.
-
Very interesting presentation from a number of angles. Thanks for posting the link Dave.
-
Well, I just submitted a pull request for this module that might be of use to others here. It adds the ability to check to see if parent pages appear in a user's editable-pages list and to allow editing if that's the case. This allows marking whole branches of the page tree as being editable by a user with just the addition of the root page to the user's list.
-
Brian, try this post for some autoloader help.
-
As I post this, your likes are at 1001. Remember, yours are in binary
-
Yeah, actually you could do it with PHP if you wanted.
-
@Nico There are a few ways to do this. One would be to setup a simple LAMP stack with an unused PW install in a virtual machine using KVM/QEMU or VirtualBox. etc Take a snapshot of the virtual machine just after you do a fresh PW install. You can then just restore the snapshot everytime you want to start over. If you want to keep the state of your work you can just clone the installation to a new VM and then restore your initial one. Personally I just use a bash script for "one-click" installations of PW (or other software I'm testing). I have it do this... Ask for the the domain name to use Ask what software to install Add an entry to my /etc/hosts file Create the root directory for the new site Create a new virtual host pointing to the root dir Restart Apache Create an application specific MySQL user + DB + password combo Install the software I've asked it to (for some software I use a lot) automate the initial setup screens using wget to post the correct params into the app. If anyone's interested I could gist various PW specific parts of my script. (Go easy though, I'm just learning bash scripting.) Edited to add: Vagrant is definitely worth taking a look at for this kind of thing too.
-
Great. Welcome to the forum too!
-
Tracking changes on pages – getting original value
netcarver replied to Adam Kiss's topic in API & Templates
@Adam, did you see the field-change-notifier module? It does pre + post checking on changed fields.