|
So, I've been tasked with putting a video on our website. Easy enough just using HTML5. Here are the problems: 1. The video changes two to three times a day (kind of like a podcast but relating to our industry) and I don't want to be doing this manually. 2. I get the videos via FTP access which has access to all the videos in the root ftp folder, all named with no standard. 3. It does appear that I could use the date modified timestamp to show the latest video. What is the best way to go about this? kiwid fucked around with this message at 18:11 on Oct 21, 2014 |
# ¿ Oct 21, 2014 18:06 |
|
|
# ¿ May 8, 2024 01:00 |
|
revmoo posted:- Crontab shell script runs hourly and connects to FTP to check for new video based off timestamp. Store timestamp in a plain text file that the shell script can consult Yeah I can definitely figure out the specifics. I just wanted to know the general flow of how you'd do it and this post just confirms essentially the way I was thinking of doing it in the first place. Luckily the video is HTML5-friendly so this should be as straight forward as you detailed. McGlockenshire posted:Well, there's ext/ftp, which you probably have installed already. You can use that to poke around and pull files down, but it'll be clunky. Is PHP's built in FTP functionality the way to go or is there something like Guzzle but for FTP out there that is better? kiwid fucked around with this message at 19:45 on Oct 21, 2014 |
# ¿ Oct 21, 2014 19:41 |
|
gently caress, so I tried to implement this tonight...php:<? // connect to the ftp server $conn = ftp_connect($server); ftp_login($conn, $username, $password); ftp_pasv($conn, true); // get all mp4 files into an array with date modified timestamp $data = []; $files = ftp_nlist($conn, ''); foreach ($files as $file) { if (pathinfo($file, PATHINFO_EXTENSION) == 'mp4') { $data[$file] = ftp_mdtm($conn, $file); } } arsort($data, SORT_NUMERIC); // sort the array by date modified, newest first $video_time = Settings::get('video_time'); // get the date modified of the last file downloaded // foreach mp4 file, if file is newer or doesn't exist, download it foreach ($data as $file => $time) { if (($time > $video_time->value) || ( ! file_exists('video/video_comments.mp4'))) { ftp_get($conn, 'video/video_comments.mp4', $file, FTP_BINARY); Settings::update('video_time', $time); } break; // only check the newest file } ftp_close($conn); ?> edit: to be exact, there are 5997 files in this ftp directory + 10ish every day. kiwid fucked around with this message at 02:52 on Oct 22, 2014 |
# ¿ Oct 22, 2014 02:42 |
|
McGlockenshire posted:So, plan A: modification time won't be changing on these files, right? If so, it'll probably be safe to cache the result of the ftp_mdtm calls, which are probably what's sucking up all the run time. Definitely would like to go with Plan C. However, I'll give Plan A a try. Another option I was thinking was to use the ftp_rawlist command and parse the date/time from that. It's a bit messier but I can get a rawlist in 7 seconds, rather than timing out.
|
# ¿ Oct 22, 2014 14:14 |
|
Anyone know a good free/opensource Microsoft Access ODBC driver for Mac OS X and Linux? This one costs $1000 http://www.easysoft.com/products/data_access/odbc-access-driver/index.html#section=tab-1
|
# ¿ Jun 5, 2017 20:45 |
|
I've been tasked to create an app that consolidates about 15 Microsoft Access databases (each of our robots logging data to each database in a standard format) into one database so that we can easily report off the data. Simple enough. However, my problem is that I don't know where to start on actually connecting to a Microsoft Access database. There are a bunch of ODBC drivers out there it seems but the problem is that I develop on OS X and deploy to a Debian or Ubuntu server so I need to purchase an ODBC driver for both platforms. Alternatively I could probably do something with Windows which has a free ODBC driver for Access. Otherwise, I was thinking I could have the Access databases dump to a CSV or something on a scheduled task? Has anyone here ever had to do something like this and if so what is my best way going about it? If this is too retarded for PHP, should I look into creating a python script that does this instead? kiwid fucked around with this message at 17:20 on Jun 29, 2017 |
# ¿ Jun 29, 2017 17:16 |
|
Tad Naff posted:When I had to work with Access databases and PHP I ended up converting them to MySQL using "mdbtools" I think it was called. I also had to edit the source of mdbtools to make its output actually MySQL compatible. As far as I know there's not much out there at least free that lets you connect to Access from PHP on Linux, but this was about eight or nine years ago, maybe things have improved since then. I checked out mdbtools and it seems like a lot of work.
|
# ¿ Jun 30, 2017 13:21 |
|
ConanThe3rd posted:So, I have a client who wants to take their Excell spreadsheet of ID Numbers and copy-paste it into a textfield to apply a status to it. Can you get the format in CSV instead?
|
# ¿ Nov 6, 2017 22:05 |
|
I'm about to work with an external API that requires OAuth2. In the past I've always just opted for using API keys since most third party APIs offer alternatives and I didn't at the time want to dive down the rabbit hole of OAuth2. Anyway, the API I'll be working with is DocuSign and they require OAuth2. My question is, how do you typically store the access tokens? Also, the DocuSign API documentation says that you can't refresh their tokens so you need to regenerate them when they expire but it appears to allow you to set the expiry time. What would be a good duration to expire these access tokens? I'm working with the Laravel framework if it matters.
|
# ¿ Sep 12, 2018 13:53 |
|
I asked this on Laracasts but didn't get any replies. Hoping someone can help me here. My question is: How do I read source code that eventually leads back to an interface? Whenever I'm trying to figure out how something works and it leads back to an interface, I get lost. For example, I was trying to figure out how the `Str::plural()` method works. Step 1: Look up the `Illuminate\Support\Str` class. Done: https://github.com/laravel/framework/blob/5.8/src/Illuminate/Support/Str.php Step 2: Find the `plural()` method. Done: https://github.com/laravel/framework/blob/5.8/src/Illuminate/Support/Str.php#L278-L281 Step 3: See that it's using a `Pluralizer` class so find that. Done: https://github.com/laravel/framework/blob/5.8/src/Illuminate/Support/Pluralizer.php Step 4: Find the `plural()` method on the `Pluralizer` class. Done: https://github.com/laravel/framework/blob/5.8/src/Illuminate/Support/Pluralizer.php#L65-L74 Step 5: See that it's using Doctrine's Inflector class so find that. Done: https://github.com/doctrine/inflector/blob/master/lib/Doctrine/Inflector/Inflector.php Step 6: Find the `pluralize()` method on the `Inflector` class. Done: https://github.com/doctrine/inflector/blob/master/lib/Doctrine/Inflector/Inflector.php#L502-L505 Step 7: See that it's calling an `inflect()` method on a `pluralizer` object so try to find what the `pluralizer` object is. Done: It appears to be some type of instance of a `WordInflector` interface. Now how do I go from here? I have no idea what the object is being passed that implements the `WordInflector` interface.
|
# ¿ Apr 11, 2019 15:41 |
|
Master_Odin posted:The main problem here is the you're looking at the source code of the latest version of the Inflector which laravel does not use, which is why you can't find what the concrete WordInflector it's using. A quick look at it's composer.json reveals it has a ^1.1.0 dependency on the Inflector, so you could start there (or at 1.3, you'd have to look at the composer.lock file to get the exact version they're assuming). You're right I should have clued into the fact that Laravel was using a static method but knowing Laravel I figured it was using some obscure "magic" somewhere. My bad.
|
# ¿ Apr 15, 2019 22:08 |
|
This might be better off asked in the SQL/database threads but I'll try here first. Let's say I've built a todo/task tracking application. I now want to add the ability to have scheduled or recurring tasks and I'm not sure how to model this in the database or how to implement this in the backend. On the front end it would basically allow a user to do the following: - Schedule a task into the future one time - Repeat tasks every __ days - Repeat a task every week on a specific day - Repeat a task every month on a specific day or the first/second/etc day/week of the month These are non-technical users so asking for a cron statement isn't going to work. How would I model this in the database and consume it?
|
# ¿ Dec 2, 2020 19:57 |
|
Tei posted:I think you can do with something like this: Thanks, after looking into it further it looks like this is called RRULE and there are libs out there to make this easier: https://github.com/rlanvin/php-rrule
|
# ¿ Dec 2, 2020 22:07 |
|
I'm using Laravel and have to work with a database from another piece of software using a read-only connection to pull in various data. I want to model some of the tables(views) so I can use eloquent relationships but the problem is that this database makes heavy usage of composite keys which eloquent doesn't support. So I find myself doing poo poo like this where I concat all of the keys to one column. It's working... but I'm wondering if I'll run into any issues doing this that I'm not aware of. SQL code:
SQL code:
|
# ¿ Mar 29, 2023 20:35 |
|
SpaceAceJase posted:Is Laravel Livewire worth looking at? I tried a few demo apps hosted remotely and performance didn't seem great on a simple toggle switch I love it, I use it in all my apps. As for performance, it's just Ajax behind the scenes so I'm not sure why you'd be having issues. I've used it on toggles that respond instantly.
|
# ¿ Sep 19, 2023 13:54 |
|
2Fast2Nutricious posted:The regex you write to make sure you're not replacing multiple spaces in between characters would be a bit unwieldy, no? Nah, easy with a positive lookbehind. PHP code:
Or if you don't want the leading space either: PHP code:
kiwid fucked around with this message at 20:08 on Sep 27, 2023 |
# ¿ Sep 27, 2023 19:55 |
|
There is an open source package that I want to use to drastically reduce the manual work I'd need to do in my database queries. Unfortunately, the package only supports drivers for MySQL, Postgres, and SQLite and my application uses SQL Server. I see that there is a pull request on the repo that implements an SQL Server driver and commenters have confirmed it to be working but the PR has gotten no attention from the maintainer of the package for some reason. I suspect the maintainer is just busy and will one day merge the PR but I can't wait for that. What is the best way to install the package with the SQL Server driver merged? Do I fork the repo, merge the PR, then install my forked repo until the maintainer one day merges it into his own or is there another way that I'm not thinking of?
|
# ¿ Mar 19, 2024 02:10 |
|
musclecoder posted:then copy the code from the PR to your codebase until it's merged. I hate doing this because the code would need to be in the vendor folder which I might forget about and accidentally wipe out. duz posted:If you're using composer to manage your dependencies, you can override a package with a version from a repo you set in the composer file. This worked perfectly.
|
# ¿ Mar 19, 2024 15:14 |
|
Anyone know a good video to teach me reflection? It's all magic to me and it's about time I learn how it actually works.
|
# ¿ Mar 22, 2024 20:39 |
|
Glimm posted:Is there a preferred package for viewing Laravel logs as an admin on a site? Never used it but this is what Laravel Forge integrates with: https://www.papertrail.com/
|
# ¿ Mar 22, 2024 20:42 |
|
|
# ¿ May 8, 2024 01:00 |
|
spiritual bypass posted:No, but I'm curious where you need/want it Was going to try building a simple framework to further my skills. Not actually to use.
|
# ¿ Mar 23, 2024 01:55 |