I have a very complex mysql query with group by's, having etc...and select is working fine and fetching all the rows.... Now I want to count number of rows of the result but count(*) is not working
I just want one row with one column that tells me total number of rows that would have resulted from the actual query...
but instead it's doing some kind of grouping etc and returning several rows with their individual counts?
@TheodoreBrown select count(distinct t.id) as counter from table1 t join table2 t2 on t2.tid = t.id left join table2 t3 on t3.tid = t.id where t.prom = 'Y' group by t.id, t2.id, t3, id having 1 order by t.id asc
In my project, I want to have different urls for Desktop site and mobile site.
For example:
www.example.com // For Desktop
www.example.com/m // For Mobile site
How to do this?
PS: Both have access to same Database.
@bwoebi no idea, but I expressed previously that I think that 2 dedicated RMs are better than one and a half, the actual experience with our release process is nice, but that is easy to learn and you have the other RMs to help with that.
@LeviMorrison @salathe can't we just pick up my php.net tutorial and rush it to make it somewhat decent so we can put it up for php7? I really don't think it needs that much more? We can always add / change to it later when we want
@Danack Difficult to call, tbh. Not least because there may be situations in which the list of servers retrieved by one of those mechanisms is different from that which is actually used internally by PHP (I'm not sure about this but I can imagine it could happen).
Windows certainly makes it more complex by maintaining a separate list for each NIC, I don't think *nix does this at all, and I'm not sure how things are prioritised in that case w.r.t search domain suffixes etc (which the OS resolver internally handles transparently)
@BasicBridge You probably ought to read this book as well amazon.com/SYSTEMANTICS-SYSTEMS-BIBLE-John-Gall-ebook/dp/… "A complex system that works is invariably found to have evolved from a simple system that works. A complex system designed from scratch never works and cannot be patched up to make it work. You have to start over, beginning with a working simple system."
@DaveRandom I think we'll need to do something as currently Artax would be really difficult to use for any environment where there are private names in use, i.e. the guest/host situation I saw, but also for places where people want to use it over a VPN which has internal IP addresses for people inside the VPN.
That something might just be a blocking DNS lookup for Artax to use in place of the non-blocking one.
@DaveRandom (apologies if I use the wrong terms here, remembering stuff from 3 years ago) The situation is that you're the software is deployed on a machine, that is using OpenVPN to create a virtual network connection to allow connection to a remote network. The software can't know ahead of time the IP address of the DNS server - it can only find it out when the network connection is established.
@DaveRandom It wouldn't be transient, it's just that the DNS server exposed by the VPN isn't known until the VPN connects. So you can't list the DNS server to use in the config file for the software, it has to be determined programatically, right?
@Danack If it's not always connected, I would call it transient. As much as it is a solvable problem, being that this entire family of applications/libs (and indeed, PHP itself) is designed to execute server-side tasks it doesn't really seem worth the effort. If you have a server running a local VPN that is not permanently connected then you have architecture problems
tbh VPN connectivity probably shouldn't be being handled by the server at all, you put that somewhere in the routing layer in front of the server
Although I suppose VPS makes that more complex, even then you start to run into some pretty hard problems to solve programatically, namely: how do you determine which DNS server to use after the VPN is connected? The original DNS servers are still configured, the OS may or may not be using them for some or all lookups. It's not something it's really even possible to write some code that will always get "the right answer" because there isn't a universal right answer
Also: if you have a VPN, why would the DNS server addresses change between connects?
Seems like you have some pretty strange architecture issues if these are variables that can't be handled by simply using a rarely changed configuration file to bootstrap the application
long story short @Danack, I doubt it's worth the effort to add the functionality to PHP core. I'm happy to add a userland layer to do it, but it's just such a niche requirement that I don't think it's worth the effort to do it natively. YMMV, of course, but there are already not enough hours in the day...
Also @Danack it's possible that setting up a local bind proxy might be a good way to go here, I suspect it already has a bunch of funky shiz in it to handle this easily and then you could just point your app to 127.0.0.1 and forget about it
@DaveRandom Yep - I'm not going to pursue it. I think there are valid reasons why the DNS server to use may change but yeah, just not supporting that for now would be more sensible than trying to hack something in.
@Danack Indeed, the server address may change, but that should be pretty infrequent. The point of DNS is that you are talking to a known party with implied authority, if the party with that authority changes a lot then you definitely have problems. Using DNS as part of your security architecture is a sure sign that you need to go employ someone who understands security a bit better...
(not having a pop at you. btw, just a general comment that it sounds like someone should get fired over your current issue)
@Danack also funny story: some of the internal architecture here uses DNS as part of certain "security" measures. But I reached the conclusion that I had to do that in order to implement some approximately useful web filtering without a hugely expensive and high maintenance proxy solution or something
@MarkBaker I trying to modify an Excel file with macros. Apparently, this is possible with v1.8 of PHPExcel but for some reason, the macros do not show up when I open the file after modifications. Can you help?
@FlorianMargaine The wikipedia article seems pretty comprehensive and reasonably understandable, needs half an hour to read and probably a couple of reads though
i.e. no need to $this->instance_var, but simply $instance_var...
@DaveRandom ok, ty
> DNSSEC works by digitally signing records for DNS lookup using public-key cryptography. The correct DNSKEY record is authenticated via a chain of trust, starting with a set of verified public keys for the DNS root zone which is the trusted third party.
tbh in my mind dnssec is almost pointless anyway, it's attempting to solve the same problem that SSL certificate verification techniques solve much better. I can see the argument that solving it at a lower layer reduces the computing power required in the case where you connect to an untrusted party, but in the real world I don't think there's much of a gain there, certainly not enough of a gain to justify the added complexity for sysadmins to keep it all running sanely
@FlorianMargaine No, you can't. You can only be sure that the record you got for that name is the right one, you can't be sure that the host you connected to is the right one. MITM attacks often happen via mechanisms that are entirely independent from/don't rely on poisoned DNS lookups
@FlorianMargaine think of it in terms of a telephone number. dnssec effectively gives me a way to be sure that the number the directory enquiries service gave me is the correct one, it doesn't mean that when I dial that number I won't get a crossed line because someone is screwing with the exchange
@SyedQarib just a tip (which you are obviously under no obligation to follow), you may find it useful to write up questions offline, make them easy to read and then copy+paste them into online chat in one go. Not only does that make it easy to read for other people, but it means that if one place is unable to answer your question, you can post it somewhere else easily.
@DaveRandom That's probably true - but it could be worked around by having a "I am about to migrate a website" button, which reduces the TTL to 5 minutes for the next 4 hours, and can only be clicked through their web interface.
@Danack It would have to be 5 mins for the next $currentTTL + $timeWindowForMigration but yeh, could be a neat feature. Seems like something that would require a reasonable amount of back-end work for very little/no ROI though so... probably going to have to dream on.
Although also, I have noticed that some recursive resolvers (plusnet particularly bad for this) ignore TTL with their local caches. Which means that Google's approach of the permanent <3min TTL no longer works as intended
For some reason, everyone seems to have forgotten that a single <512b packet every couple of minutes from each tail is not actually a big stress on the network, by modern standards :-(