wordxpression liked a comment+100 XP
1mo ago
@milicevic79 For a more exact match: str(class_basename($this))->headline()->apa();
The apa() method will lowercase the unimportant words, but headline() is still needed to convert from PascalCase.
wordxpression liked a comment+100 XP
1mo ago
wordxpression liked a comment+100 XP
1mo ago
wordxpression wrote a comment+100 XP
1mo ago
With regards to ordering the navigation items: I'm developing software for almost 40 years, and I learned one important thing when you want to order anything:
Never order with increments of 1... like 1, 2, 3 etc.
Take steps of at least 10, so 10, 20, 30 etc.
Because there always is a customer who thinks a new item should be added between 1 and 2... So you'll have to change the index of each item.
When you order in higher increments, you can work with 'values' in between.
So the 'item in between' would become 15... if the base index would have increments of 10, 150 when increments of 100 etc.
wordxpression started a new conversation+100 XP
1mo ago
Just wanting to share an experience with my 'multiple screen working'. For already a few years, even do not remember how long, I work 'multiple screen' for both my video editing work (started with using MultiScreen for that) and my programming. And I would not go back to a single screen. I even have a foldable screen to use in combination with my laptop. Recently however one of my desktop screens died a honerable death, so I needed a new monitor. Since I take sustainability seriously, my first search was for a refurbished monitor.
Brand etc does not matter -this is not an advertorial- but I found a 'good brand' monitor for a very acceptable price.
When it arrived, it showed it was a screen that also could be turned to portrait orientation. So I tested using one of the monitors in landscape, the other in portrait position.
Using the upper half of the screen for PHPStorm, the lower half for the docs in a browser, and the landscape screen for the actual output made my workflow significantly faster.
Since my video editing program (Davinci Resolve) works very good on two landscape monitors, but surely not very well on two monitors with a different orientation, I need to 'switch back' to traditional 'two landscape' screens when editing video... but that's about a minute work... (turn the screen and change the settings).
For those having a 'turnable' screen and never have tried a 'mixed mode' (landscape / portrait) for software development, for sure an advice to at least try it!
wordxpression liked a comment+100 XP
2mos ago
wordxpression wrote a reply+100 XP
2mos ago
Thanks! Actually, I meant something more like Xdebug or browser console debugging tools.
Actually, Xdebug is rather low-level and time-consuming when used for Laravel debugging. Both the dump/dd debug function in Herd and the Ray debugger are far more efficient and effective debugging Laravel apps.
Also the right choice of editor (I used to use Visual Code, now evaluating PHPStorm) can prevent a lot of potential errors.
wordxpression liked a comment+100 XP
2mos ago
@JeffreyWay Indeed, I wouldn’t trust this on my own machine.
Yesterday, there was an item on a (Dutch) TV show with other examples. A case where tickets were ordered (and actually paid for with a credit card) and a restaurant reservation was made. This was a fake website without a reservation system, but the bot saw a phone number and then, on its own initiative, tried to make a reservation by phone.
It’s in Dutch, but with subtitles it should be easy to follow. https://www.youtube.com/watch?v=Z4v5cHTzLN8
wordxpression wrote a comment+100 XP
2mos ago
@mvd Wow, watched the episode of Eva you linked to. This is wild. And scary. Especially the idea that the bot is going to generate his own code needed to perform tasks...
@jeffreyway Beware, soon Bob wil order you cleaning agents and nightly pizzas...
wordxpression wrote a reply+100 XP
2mos ago
wordxpression liked a comment+100 XP
2mos ago
@madprabh The classes just read the API keys from configuration, so you would need to override those configuration values before invoking the agent (and provider) classes.
If this is some sort of multi-tenant application where tenants can bring their own API keys, then you could have some sort of middleware that sets the configuration values:
class ConfigureTenant
{
public function handle(Request $request, Closure $next)
{
// Resolve your tenant model instance however you need to...
$tenant = Tenant::resolve();
// Set tenant configuration values...
config([
'ai.providers.anthropic.key' => $tenant->anthropic_api_key,
'ai.providers.openai.key' => $tenant->openai_api_key,
]);
return $next($request);
}
}
wordxpression liked a comment+100 XP
2mos ago
wordxpression wrote a comment+100 XP
2mos ago
wordxpression liked a comment+100 XP
2mos ago
Haha yeah, this one gets basically everyone at least once. The naming just doesn’t line up with how your brain expects it to work: Eloquent has orderBy() and orderByDesc(), SQL has ORDER BY RANDOM, so naturally you go looking for orderByRandom() and… nope, enjoy your trip to page 500 of the docs. The idea behind inRandomOrder() is that it’s DB-agnostic (MySQL uses RAND(), Postgres/SQLite use RANDOM()), and it follows that slightly weird “state” naming style in the query builder, like “put this query in a random ordering.” That explanation makes sense after you know it, but the first time you hit it, it absolutely feels like someone tried to be clever for no real payoff. An alias would’ve saved a lot of collective annoyance. Not the worst thing in Laravel, but definitely one of those classic “once burned, never forgotten” quirks. 😄
wordxpression liked a comment+100 XP
2mos ago
Can 28 index keys make the 500 rows data to slowdown?
@shivamyadav Indexes are “look-ups”. If you create lots of indexes, then that’s lots of look-ups that need to be checked, which take time, which then defeats the point of using indexes.
You should only be creating indexes for columns that are frequently used for retrievals. If just indexing every column could make all look-ups faster, then everyone would just index every column and render separate indexes useless.
wordxpression wrote a reply+100 XP
2mos ago
There are many other things are happening like creating parent division, children division auto assign the user event and courses etc stuffs.
Try to isolate the problem in a test environment. I can't imagine applications where a table needs 28 keys, usually that many keys is the result of poor database design. But first disable in your test environment all other db interactions, then try the import with 28 keys, slowly add the other features, and the culprit will show itself.
But personally, my first step would be which indexes are really needed. And remember, an index will only speed the search when there is a lot of different values. An index on a boolean col for example is totally useless.
wordxpression wrote a reply+100 XP
2mos ago
When I follow an online course on whatever topic, from home brewing to new languages, I usually ask questions in the Q&A at that specific lesson. It often leads to a discussion on the topic where other people ask questions too. Especially when it's a new course, the instructor monitors the discussions and more than once my inquiries lead to additional lessons.
wordxpression wrote a reply+100 XP
2mos ago
wordxpression wrote a comment+100 XP
2mos ago