|
Any idea what the ODBC driver version is? yitam's comment on GitHub suggests that the visible error message may be a result of ARM64 not being included as a processor type in the driver code, but as part of a code path that's intending to warn about ODBC not being installed.
|
# ? Sep 4, 2021 18:14 |
|
|
# ? Jun 8, 2024 08:35 |
|
MSSQL support is apparently broken on arm https://github.com/microsoft/msphpsql/issues/1292
|
# ? Sep 4, 2021 18:35 |
|
Biowarfare posted:MSSQL support is apparently broken on arm https://github.com/microsoft/msphpsql/issues/1292 Well poo poo. I can confirm this by creating the same configuration on an x86 c5.l box and it works perfectly. I didn't think about driver support from third party vendors when testing graviton.
|
# ? Sep 4, 2021 22:00 |
|
to be fair, this is kind of ridiculously edge case - who is even using mssql on arm with the per processor licencing costs, not to mention that they have previously just outright said if you want ARM, use azure sql edge instead of mssql. windows people would just be running everything on amd64. i'm not sure how to describe it, but it feels weird/i've rarely if ever seen a lamp stack or php user using mssql in the first place, and i've rarely if ever seen php running on windows, and same for arm and mssql. Impotence fucked around with this message at 22:21 on Sep 4, 2021 |
# ? Sep 4, 2021 22:15 |
|
I’m not running SQL server on a graviton processor. The SQL Server box is on an X86 server but I’m connecting to it using PHP on a graviton Ubuntu box. But apparently I’m not, since the ODBC connector for SQL server isn’t supported. Edit: With regards to PHP on windows or SQL server versus MySQL, in this application SQL Server blows the doors off of MySQL performance-wise so that’s the direction I went. Agrikk fucked around with this message at 00:49 on Sep 5, 2021 |
# ? Sep 5, 2021 00:45 |
|
Different project now: I'm trying to time the download of a given file from various CloudFront pops and I'm having trouble getting the curl command right in PHP. I have it running like so in DOS and gnuwin32: code:
%pop% is the name of the endpoint that generates the IP address %distribution% is the name of the cloudfront distribution %payload% is the file to be downloaded. (This file is a broken chunk of a .wav file that's been snipped at exactly 1GB) and !_ip! is the resolved IP address of the pop serving up the specified CF distribution so I have this: code:
What am I missing? Agrikk fucked around with this message at 08:34 on Oct 29, 2021 |
# ? Oct 29, 2021 08:19 |
|
Agrikk posted:Different project now: Try ["{$distribution}.cloudfront.net:443:{$ip}:443"]
|
# ? Oct 29, 2021 09:27 |
|
Professional PHP touchers... Do you find yourselfs using private and public and constants with the language? I'm going through PHP Panda as a refresher for a interview I have next week and they devote alot of time towards that, but I don't think i've ever really used those properties. Thanks for the help.
|
# ? Dec 29, 2021 20:39 |
|
I tend to make all of my class properties private (unless it's just a data holder class) and use constants to represent any magic values. Are you encountering any scenarios that make you wonder about what's best?
|
# ? Dec 29, 2021 20:43 |
|
Nah not really, I'd perfer to use them since it makes the language more like Java or C#, but I didn't want to do it and then have people be like "What are you doing? I can't read this!".
|
# ? Dec 29, 2021 21:15 |
|
The world of PHP definitely has its share of people writing it in the traditional style with no sense of design, but you won't meet those people outside of the world's worst workplaces for programmers. Use type hints, visibility, and interfaces without hesitation
|
# ? Dec 29, 2021 21:19 |
|
Excellent alright, thank you very much. It's hard to find what to expect for a PHP interview so I'm just hoping there isn't a bunch of algorithm questions lol.
|
# ? Dec 29, 2021 21:21 |
|
Yeah if they have that reaction to it you probably don't want it?
|
# ? Jan 1, 2022 21:43 |
|
cum jabbar posted:The world of PHP definitely has its share of people writing it in the traditional style with no sense of design, but you won't meet those people outside of the world's worst workplaces for programmers. Use type hints, visibility, and interfaces without hesitation this. theres no reason to write bad code, even if some mechanism are not well supported yet... writing futureproff code will pay of later also if you are salary man, having good code that can be the foundation of great programs is interesting PHP does change behavior based on public, private, protected. I believe. but on top of it everything about giving PHP hints about types is desirable. Always paying attention the PHP version you have has target.
|
# ? Jan 1, 2022 22:14 |
|
Thank you all for the posts. I didn't actually know Interfaces were that highly used but thats good because I like using them. It seems like PHP has matured alot lately which is probably great for you hardcore PHP developers!
|
# ? Jan 2, 2022 01:03 |
|
I have a chunk of code that reads from a CSV and puts the data in it into an array:code:
|
# ? Jan 9, 2022 00:07 |
The file should be closed when the request finishes, regardless of you closing it explicitly, but it's still good practice to explicitly close your handles.
|
|
# ? Jan 9, 2022 00:25 |
|
A Real Happy Camper posted:do I need to put fclose before I return, or if I leave it here will it still do its job? When your code hits a return, any code after is completely ignored -- some IDEs will even warn you of this, marking it as "unreachable code". That means you should do the fclose before the return. "Oh, but my current structure wouldn't make this easy", you say. Should be easy enough to fix by having a returnable variable that is either empty or filled in case a match is found: code:
Saoshyant fucked around with this message at 16:10 on Jan 14, 2022 |
# ? Jan 14, 2022 16:01 |
|
FWIW, try-finally is often a better way to handle resource cleanup, e.g.:code:
|
# ? Jan 14, 2022 18:16 |
|
I'm trying to get php installed on macOS, using Intel processor. I've had it before, but I understand there has been some changes, and the brew install is your best bet. Seems to be installed, although php is showing the script instead of the rendered page in my browser. I'm using localhost in the address bar. I followed these instructions: https://github.com/shivammathur/homebrew-php
|
# ? Jan 15, 2022 22:56 |
|
Good Sphere posted:I'm trying to get php installed on macOS, using Intel processor. I've had it before, but I understand there has been some changes, and the brew install is your best bet. Seems to be installed, although php is showing the script instead of the rendered page in my browser. I'm using localhost in the address bar. Showing the script as text instead of executing means your web server isn't configured to send requests to PHP files to php-fpm. When I do local dev, I prefer to skip the web server config and use the PHP built in webserver to run my project because it's simpler
|
# ? Jan 15, 2022 23:19 |
|
Good Sphere posted:I'm trying to get php installed on macOS, using Intel processor. I've had it before, but I understand there has been some changes, and the brew install is your best bet. Seems to be installed, although php is showing the script instead of the rendered page in my browser. I'm using localhost in the address bar. Your best and easiest bet might be XAMPP: https://www.apachefriends.org/download.html
|
# ? Jan 15, 2022 23:24 |
|
ModeSix posted:Your best and easiest bet might be XAMPP: https://www.apachefriends.org/download.html Thanks! I was just looking into MAMPP, but now I have XAMPP installed and running, with my files. One thing that got me was the php short tags. I turned it on, but regardless it just won't work. I know it's not safe because of the bad interactions it can have with xml. No big deal, I can write "<?php". Good Sphere fucked around with this message at 01:34 on Jan 16, 2022 |
# ? Jan 16, 2022 01:01 |
|
Ok I could use some advice to see if I made a significant OOPS on something I am working on (probably because I am not very experienced in PHP). For some background I play Foxhole a lot. In Foxhole you have buildings you can privately store things in, but if you don't visit the building at least once every 50 hours the stuff in there gets donated to public. So I started writing an app in PHP to help me catalog the stuff in various storage buildings and to track timers. One thing I need is an animated countdown timer to show how long until the 50 hours runs out. I found plenty of JavaScript examples and managed to get one to integrate enough to run, but I am having a problem. What I am doing is pulling a list of buildings & info from a SQL source with a fairly simple connect to SQL then while($row = $result->fetch_assoc() to table cells type thing. I got the countdown timer to pick up on a date that is part of the SQL query but what happens is that if there is more than 1 row returned by the query the timer only appears on the 1st row and picks up its countdown time from the last row. So if there are 3 or 7 or 22 rows I only get 1 timer and its counting down the wrong time. Any ideas on how I might get this timer to function with more than 1 row ? https://pastebin.com/Z8iBubVC for what I have written
|
# ? Feb 13, 2022 20:32 |
Two things: You only have one instance of the countdown JS, and it only handles a single $countdown value. And it looks for the cell to fill in the countdown by HTML "id", which is by definition unique inside the document, it's not allowed to have two HTML elements with the same "id". What I'd personally do is make an empty cell in the output HTML from the PHP, give those cells a specific HTML "class", and then use a "data" attribute on them to store the countdown target. Then in the JS, you can search for all elements with the specific "class" value and create timers for each of them. PHP code:
JavaScript code:
|
|
# ? Feb 13, 2022 21:07 |
|
So the way you script works currently : - in your while loop you set some variables (countdown) and you build three tables using those variables - then once the loop is over you insert the countdown into a script that uses the last variable set in the loop. That's why you see the countdown for the last row A way to solve this would be to set the expiration date as an HTML attribute in the table : PHP code:
Then use a script like this one to update each countdown. JavaScript code:
Banditu fucked around with this message at 21:20 on Feb 13, 2022 |
# ? Feb 13, 2022 21:18 |
|
Thanks for the replies to both of you . The last time I did anything with PHP was in a college class in 2012 or so. So while staring at this I slowly remembered that the output of PHP loops sort of don't exist until they get sent to the browser so you can't really change the contents with some other code (this is how my brain wants to think of it) so yeah I understand somewhat why the counter showed up where it did and why it was wrong. Banditu I tried your solution and it works fine except for one thing - the countdown is no longer animated, it's static now. There was a line of "now = now + 1000;" in there which I'm guessing had something to do with it executing every second but that line is not present in what you wrote.
|
# ? Feb 13, 2022 22:23 |
|
You're right. If i'm not mistaken just move : JavaScript code:
JavaScript code:
JavaScript code:
Edit : modified to follow nielsm advice Replace JavaScript code:
JavaScript code:
Banditu fucked around with this message at 22:55 on Feb 13, 2022 |
# ? Feb 13, 2022 22:35 |
Nah you almost certainly want to check the actual client system time every time the interval timer runs in JS. You don't have any guarantee the timer runs exactly every 1000 ms, it can run a bit later and eventually you get noticeable timer drift. It can be okay to pass the server timestamp in from PHP, but you still want to at least calculate a time delta between page load and now with JS.
|
|
# ? Feb 13, 2022 22:39 |
|
Banditu posted:You're right. JavaScript code:
Edit: made changes that Banditu added, no change. I will say though if I try to select the displayed countdown time to copy it it deselects itself in about a second.... so it might be running but not updating the displayed time ? IDK MREBoy fucked around with this message at 23:41 on Feb 13, 2022 |
# ? Feb 13, 2022 22:57 |
|
Hey all, I'm having issues accessing a certain JSON variable through PHP and was hoping someone in here might have a idea as to what the hell I need to type to get the exact info I need. Background: I am using WooCommerce and accessing data. This is what the data looks like: code:
code:
code:
I tried: code:
Hoping someone here who is smart can help assist! Thanks
|
# ? Mar 7, 2022 17:36 |
"meta_data" is an array of objects, you need something like $item_data['meta_data'][0]['value']['deposit'] or probably rather a loop over it, in case there's multiple metadata.
|
|
# ? Mar 7, 2022 18:05 |
|
That print_r is saying $item_data['meta_data'] is an array so you'd need $item_data['meta_data'][0] to start. After that, current_data and data are the only properties and they are protected so you might need another method call to get the value.
|
# ? Mar 7, 2022 18:05 |
|
Thank you both that seemed to solve it besides the protected layer
|
# ? Mar 7, 2022 20:15 |
|
It's funny, I just solved this problem for myself just yesterday on something I was working on. You could also do something like this: code:
|
# ? Mar 8, 2022 03:04 |
|
Yeah I ended up just cheating and using WooCommerce's built in functions to not have to deal with it lol. I hope for any of you you never have to interact with HubSpot's API. It is a nightmare.
|
# ? Mar 10, 2022 18:58 |
|
Speaking of nightmares Hoping someone can help me figure this out. quote:Hello, i'm trying to figure out how to send a time stamp correctly to a datepicker property. I've done some research on here but can't really find a answer. This is what hubspot says needs to be sent for time: https://legacydocs.hubspot.com/docs/faq/how-should-timestamps-be-formatted-for-hubspots-apis Unfortunately all of their documentation is confusing
|
# ? Mar 10, 2022 21:54 |
|
According to the thread and their documentation you need to send a timestamp in microseconds with the hour part as 00:00:00 UTC. The timestamp you posted is in seconds you need to multiply it by 1000. Test with this timestamp for example : 1632096000000 You can use this website to test your timestamps : https://www.epochconverter.com
|
# ? Mar 10, 2022 23:18 |
|
Banditu posted:According to the thread and their documentation you need to send a timestamp in microseconds with the hour part as 00:00:00 UTC. Thanks for that. For some reason the HubSpot API still doesnt want to take it . I guess I need to figure out how to properly translate it to UTC in PHP. I tried sending it the following: code:
|
# ? Mar 11, 2022 15:44 |
|
|
# ? Jun 8, 2024 08:35 |
|
I figured it out, if anyone ever has to deal with this poo poo: Hubspot needs the time in Y-m-d format so: code:
|
# ? Mar 11, 2022 16:39 |