21 October, 2023
20 October, 2023
Outlook Showing in Process even after closing - C#
Programing Coderfunda October 20, 2023 No comments
Process[] processlist = System.Diagnostics.Process.GetProcessesByName("OUTLOOK");
if (processlist.Count() > 0)
{
MessageBox.Show("Outlook Opened");
}
Works great for the first time when I open outlook, but the message box continue to show even after outlook is closed .
I also checked the background process there is no outlook process running.
Help appreciated :) .
19 October, 2023
Conditionally Assert Throwing An Exception in Pest
Programing Coderfunda October 19, 2023 No comments
Pest recently added the throwsUnless() method in Pest v2.24 to conditionally verify an exception if a given boolean expression evaluates to false.
This method is the counterpart to the throwIf() method, which conditionally verifies an exception if a given expression is true:
test('example 1', function () {
// Test that only throws an exception for the mysql driver...
})->throwsIf(DB::getDriverName() === 'mysql', Exception::class, 'MySQL is not supported.');
test('example 2', function () {
// Test that throws unless the db driver is mysql...
})->throwsUnless(DB::getDriverName() === 'mysql', SomeDBException::class);
For example, let's say that you have a PHP package that supports various PHP extensions for manipulating images. Your CI environment might support and test both gd and imagemagick; however, other environments might only support one or the other:
test('gd wrapper can create an image', function () {
$image = imagecreate(width: 200, height: 200);
imagecolorallocate($image, 255, 255, 255);
imagepng($image, '/tmp/new_image_gd.png');
expect(file_exists('/tmp/new_image_gd.png'))->toBeTrue();
})->throwsUnless(extension_loaded('gd'), \Error::class);
test('imagemagic wrapper can create an image', function () {
$image = new Imagick();
// ...
})->throwsUnless(extension_loaded('imagick'), \Error::class);
The throwsIf() and throwsUnless() methods also support callables if you prefer that style or have some custom logic that you want to use to determine if the test should throw an exception:
test('example test with callables', function () {
$image = new Imagick();
// ...
})->throwsUnless(fn () => class_exists(\Imagick::class), 'Class "Imagick" not found');
Learn More
You can learn about handling Exceptions in tests in the Pest Exceptions documentation. Also, if you're new to PestPHP and prefer videos, we recommend checking out Learn PestPHP From Scratch by Luke Downing.
The post Conditionally Assert Throwing An Exception in Pest appeared first on Laravel News.
Join the Laravel Newsletter to get Laravel articles like this directly in your inbox.
18 October, 2023
Write Single Page Applications using Laravel Splade
Programing Coderfunda October 18, 2023 No comments
Laravel Splade, created by by Pascal Baljet, is a super easy way to build single-page applications (SPA) using Laravel Blade templates. Splade makes it easy to create modern, dynamic web applications that are a joy to use.
Splade provides useful Blade components that are enhanced with renderless Vue 3 components out of the box, such as the Component component. It provides that SPA-like feeling, but you can use Blade, sprinkled with interactive Vue components when required.
As you can see, in the default installation, the components fetch the page data via XHR and provide that SPA snappy feel without full page reloads.
You can use both Blade and Vue markup. Here's an example from Splade's component. Note the v-show directive and @click listener from Vue, and the Blade-specific component and variable usage {{ }}:
{{ $blog->full_content }}
{{ $blog->excerpt }}
Expand
If you need Custom Vue components, Splade has your back, and you can even utilize Server Side Rendering (SSR) to improve performance in your application.
If you also want to use Laravel Breeze or Laravel Jetstream, Splade provides starter kits for both. Splade also provides useful components out of the box you can use to get started quickly, with or without using the starter kits:
* Forms
* Links
* Events
* Flash
* Modals
* Table
* Teleport
* Toggle
* Transition
* And more!
You can get started with Splade quickly by checking out the homepage and accompanying documentation on splade.dev. You can also dive deeper and learn How Splade works under the hood.
The post Write Single Page Applications using Laravel Splade appeared first on Laravel News.
Join the Laravel Newsletter to get Laravel articles like this directly in your inbox.
17 October, 2023
Inertia and React or Vue
Programing Coderfunda October 17, 2023 No comments
Here is the Reddit post I read that says they are finding it hard to get jobs with Vue.
https://www.reddit.com/r/vuejs/comments/12zevaz/vue_seniors_how_do_you_feel_about_not_picking/ submitted by /u/Blissling
[link] [comments]
16 October, 2023
Weekly /r/Laravel Help Thread
Programing Coderfunda October 16, 2023 No comments
* What steps have you taken so far?
* What have you tried from the documentation?
* Did you provide any error messages you are getting?
* Are you able to provide instructions to replicate the issue?
* Did you provide a code example?
* Please don't post a screenshot of your code. Use the code block in the Reddit text editor and ensure it's formatted correctly.
For more immediate support, you can ask in the official Laravel Discord.
Thanks and welcome to the /r/Laravel community! submitted by /u/AutoModerator
[link] [comments]
15 October, 2023
Laravel 9 Upgrade: Write Operations Now Overwrite Existing Files
Programing Coderfunda October 15, 2023 No comments
I'm not exactly sure what "overwriting existing files" means in this context. From what I've observed, Storage::put() operates the same way on both Laravel 8 and 9. That is, if the file exists, then put() replaces that file's contents with what's passed into the $contents argument -- it doesn't append the contents to the file, nor does it delete the original file and create a new one (it modifies the original file).
I'm trying to upgrade our Laravel 8 app to version 9, and this is the last item on the checklist that I have to get through. I was stumped because I'm not noticing any difference in the behavior of Storage::put() between v8 and v9.
Can anyone provide any context, insight, or example to demonstrate? submitted by /u/mattk1017
[link] [comments]
14 October, 2023
Copy and fill column from datagridview to another VBNET
Programing Coderfunda October 14, 2023 No comments
Any suggestions? thanks..
dgv1 to dgv 2
Dim column As New DataGridViewTextBoxColumn
Dim newCol As Integer = 0
For Each row As DataGridViewRow In DataGridView1.Rows()
If row.Cells(5).Value.ToString().Equals("I") Then
DataGridView2.Columns.Insert(newCol, column)
With column
.HeaderText = "R1"
.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells
.ReadOnly = True
End With
For rows As Integer = 0 To DataGridView1.Rows.Count - 1
DataGridView2.Rows.Add(DataGridView1.Rows(rows).Cells(5).Value)
Next
Exit For
End If
Next
13 October, 2023
How do you handle small actions?
Programing Coderfunda October 13, 2023 No comments
For exemple, a blog post might have a "Publish" button. But you might want to "Unpublish". And then you might want to just update the publication date.
I feel like it starts to get cumbersome if you have to create a route for each small action. In Livewire, this isn't an issue because of the way components work. But in Inertia, I have close to 100 controllers, most being small actions like publishing and unpublishing.
What is the best way to organize these small actions? submitted by /u/AsteroidSnowsuit
[link] [comments]
Since when did Laravel fill ONLY database fields into a Model?
Programing Coderfunda October 13, 2023 No comments
Yes, I'm aware of the $fillable and $guarded properties. In my model I don't have fillable set and have guarded set to ['id', 'created_at', 'updated_at']. So it should fill any properties except those three. In the past this worked fine, but now it only fills the fields that explicitly exist in the database. Laravel even runs a separate query to get those fields.
In my case, I had a "location" field with a dropdown and an "other" option to write in freetext. So the form would come with location=other and location_other=customtext. The DB would store "customtext" in the location field. But I can't fill the model and then copy "location_other" over, because the latter doesn't get filled.
When did this change? I never saw this listed anywhere in the documentation. submitted by /u/Disgruntled__Goat
[link] [comments]
12 October, 2023
Compiler Not Recognized (GCC for Visual Studio Code)
Programing Coderfunda October 12, 2023 No comments
For some reason, the path changes from C:/msys64/ucrt64/bin/ to C:/msys64/mingw64/bin/ after I reopen it.
File location on computer (path that was added to environment variable)
Compiler not recognized
Edit: Everything above has been resolved, the commands now all work when I put them into the MSYS2 terminal. However, I'm still having issues when I type g++ or any other commands into the VS terminal. I've attached another screenshot below.
VS terminal
11 October, 2023
Laravel Breeze with Volt Functional API
Programing Coderfunda October 11, 2023 No comments
The Laravel team released the Livewire + Volt functional stack for Breeze. This increases the Breeze offering to six stack variations, offering a tremendous amount of freedom to stacks that are emerging in the Laravel ecosystem:
* Laravel Blade
* Livewire with Volt Class API
* Livewire with Volt Functional API
* Inertia (React)
* Inertia (Vue)
* API-only
Getting Started with a New Project
If you want to install the Breeze + Volt functional API while creating a new Laravel project, all in one go, you can run the following:
laravel new --pest --breeze --git --dark \
--stack=livewire-functional \
breeze-functional-demo
Note: at the time of writing, the installer doesn't support livewire-functional unless you require dev-master. Likely, you can wait for the installer to get a release, or you can run
# Normal update once the release is created
composer global update laravel/installer -W
# For the impatient
composer global require laravel/installer:dev-master -W
If you prefer to install after-the-fact, you can run the following:
laravel new example-project
cd example-project
composer require laravel/breeze
php artisan breeze:install
Then you can follow the prompts to select the stack, include dark mode support, and pick the test suite (Pest or PHPUnit):
Learn More
If you'd like to get started with Laravel Volt, Jason Beggs wrote a tutorial on Laravel News to Learn Livewire 3, Volt, and Folio by building a podcast player. Also, check out the Volt Livewire documentation for more details.
The post Laravel Breeze with Volt Functional API appeared first on Laravel News.
Join the Laravel Newsletter to get Laravel articles like this directly in your inbox.
10 October, 2023
R - In a for loop iterating through columns df[[i]] if a data frame, how do I print the name of column df[[i]] for each loop?
Programing Coderfunda October 10, 2023 No comments
I have tried all I can think of, but haven't had any luck so far.
This was my best guess, but it just returns NULL for the column name (I'm guessing because once I've extracted the data of the column it's already a nameless vector?).
for (i in seq_along(df)) {
# Print column name
print(colnames(df[[i]]))
# Print sum of missing values for each column
print(sum(is.na(df[[i]])))
# Print NA value rows
}
Output is as follows:
NULL
[1] 70
NULL
[1] 0
NULL
[1] 0
NULL
[1] 0
NULL
What can I do to print the column name for each pass?
09 October, 2023
AWS Glue Python Shell Upgrade Boto3 Library without Internet Access
Programing Coderfunda October 09, 2023 No comments
The default version is very old and hence all the API's does not work
For eg pause_cluster() and resume_cluster() does not work in AWS Glue Python Shell due to this older version
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/redshift.html
/>
Similarly for many other product features.
Additionally, we don't have to Glue internet access by security and hence need a solution based on s3 storage libraries
Which is the best way to upgrade the Python Shell as it seems the lightest weight part of our architecture
Basically, we are using python glue shell as our core workflow engine to asynchronously deisgn our pipeline through boto3 apis
08 October, 2023
compact(): Undefined variable $pesanan_details
Programing Coderfunda October 08, 2023 No comments
compact(): Undefined variable $pesanan_details
Line 138 experienced an error and a red notification on that line
return view('checkout.check_out', compact('pesanan','pesanan_details'));
Controller controller/PesananController
@foreach ($pesanan_details as $pesanan_detail )
{{ $no++ }}
{{ $pesanan_detail->post->title }}
{{ $pesanan_detail->jumlah }} Style
Rp. {{ number_format($pesanan_detail->post->harga) }}
Rp. {{ $pesanan_detail->jumlah_harga }}
@csrf
{{ method_field('DELETE') }}
@endforeach
Total Harga :
Rp. {{ number_format($pesanan->jumlah_harga) }}
Check Out
@endif
{{-- Kembali --}}
Kembali
@endsection
How to create a customized Error using TypeScript and node.js?
Programing Coderfunda October 08, 2023 No comments
What I want to do is to create a customized Error that contains some extra properties over the built-in Error. For instance, to handle an inexsitent url/endpoint, I implemented the middleware as
const app = express();
//... skip some imports and basic middlewares
app.use("/api/v1/events", eventRouter);
app.use("/api/v1/users", userRouter);
interface IError extends Error {
status: string;
statusCode: number;
}
app.all("*", (req: Request, res: Response, next: NextFunction) => {
const err = new Error(`Can't find ${req.originalUrl}.`);
(err as any).status = "fail";
(err as any).statusCode = 404;
next(err);
});
app.use((err: IError, req: Request, res: Response, next: NextFunction) => {
err.statusCode = err.statusCode || 500;
err.name;
err.status = err.status || "error";
res.status(err.statusCode).json({
status: err.status,
message: err.message,
});
});
I had to cast err to type any because it would raise an error when I added the properties status and statusCode to err since type Error doesn't include these two properties. I am not sure if this is a good practice because I know it is not recommanded to declare or cast a variable to any, which actually is against the purpose of TypeScipt.
Are there any better solutions to it?
I had to cast err to type any because it would raise an error when I added the properties status and statusCode to err since type Error doesn't include these two properties. I am not sure if this is a good practice because I know it is not recommanded to declare or cast a variable to any, which actually is against the purpose of TypeScipt.
Are there any better solutions to it?
07 October, 2023
Manage a User's Browser Sessions in Laravel
Programing Coderfunda October 07, 2023 No comments
06 October, 2023
Reshape data from wide to long (Creating Panel Data)
Programing Coderfunda October 06, 2023 No comments
How can I do that in Stata?
enter image description here
I wrote this syntax
reshape long Date variable, i(date) j(UVBKP, PCHUVBKP1D, UVBKPA, UVBKPB, UVBKTNA, UVBKNAV, UVBKPH, UVBKPL)
but I don't know why it says
variable date not found
```
Configure and Display a Schedule of Opening Hours in PHP
Programing Coderfunda October 06, 2023 No comments
Opening Hours is a PHP package by Spatie to query and format a set of business operating hours. You can use it to present the times per day and include exceptions for things like holidays and other days off on a given year-specific date or recurring (happening each year). The project's readme file has this example to illustrate how you can configure hours:
$openingHours = OpeningHours::create([
'monday' => ['09:00-12:00', '13:00-18:00'],
'tuesday' => ['09:00-12:00', '13:00-18:00'],
'wednesday' => ['09:00-12:00'],
'thursday' => ['09:00-12:00', '13:00-18:00'],
'friday' => ['09:00-12:00', '13:00-20:00'],
'saturday' => ['09:00-12:00', '13:00-16:00'],
'sunday' => [],
'exceptions' => [
'2016-11-11' => ['09:00-12:00'],
'2016-12-25' => [],
'01-01' => [], // Recurring on each 1st of January
'12-25' => ['09:00-12:00'], // Recurring on each 25th of December
],
]);
// This will allow you to display things like:
$now = new DateTime('now');
$range = $openingHours->currentOpenRange($now);
if ($range) {
echo "It's open since ".$range->start()."\n";
echo "It will close at ".$range->end()."\n";
} else {
echo "It's closed since ".$openingHours->previousClose($now)->format('l H:i')."\n";
echo "It will re-open at ".$openingHours->nextOpen($now)->format('l H:i')."\n";
}
This package has tons of configuration options and can be used on any PHP project without any dependencies. While this package isn't a brand-new Spatie package, we've never covered it and think you should check it out! You can get setup instructions and see more API examples on GitHub at spatie/opening-hours.
If you'd like to learn more background information on why this package as created, Freek Van der Herten originally wrote about it on his blog: Managing opening hours with PHP.
The post Configure and Display a Schedule of Opening Hours in PHP appeared first on Laravel News.
Join the Laravel Newsletter to get Laravel articles like this directly in your inbox.
05 October, 2023
searching a list in a list model in flutter
Programing Coderfunda October 05, 2023 No comments
If my search finds the "what", "is", "my", "lecture", "score" in one of the sentence list in any order, the result will be true, otherwise false.
Here is my sentence list as a List:
class vaModel {
final int id;
final List stringData;
final String response;
vaModel({
required this.id,
required this.stringData,
required this.response,
});
}
and here is the data of this model:
import "package:flut2deneme/pages/vaModel.dart";
List vaData = [
vaModel(id: 1, stringData: ["what", "my", "score", "lecture"], response: "load1"),
vaModel(id: 2, stringData: ["total", "lectures", "hours", "week"], response: "load2"),
vaModel(id: 3, stringData: ["how", "much", "cost"], response: "load3"),
//other
];
for example, if the user enters "what my score is for this lecture", it will return "load1" in id:1 in the vaData list. Because however the order is different and it has more other words, the desired words (what, my, score, lecture) are found in the data list. As seen, there are other words in the received sentence and the words are not in given order, the result is true, since all required words exist in item 1 (id:1)
It may also be explained in searching a list in a list of List.
Thank you for any support.
Laravel 10.26 Released
Programing Coderfunda October 05, 2023 No comments
This week, the Laravel team released v10.26 with a search feature for the Artisan vendor:publish command, array cache expiry updates, more.
This week was a smaller release, but we get an excellent vendor:publish update that makes finding providers and tags a breeze! Laravel also saw some fixes and a few reverts leading us to Laravel 10.26.2. Thanks again for all the contributions from the Laravel team and the community!
Allow Searching on the vendor:publish prompt
Jess Archer contributed filtering the vendor:publish command to quickly search for providers and tags that you would like to publish. You can also select all providers and tags from the dropdown:
Ensure array cache considers milliseconds
In Laravel 10.25, Tim MacDonald contributed an update to ensure that array cache driver values expire at the expiry time; however, there were some testing issues around this update (which was reverted) and now in larval 10.26, those issues are all sorted. We would encourage you to update to the latest Laravel 10.26 version if you noticed any array cache driver flakiness, and thank you to Tim MacDonald for sorting it all out!
See Pull Request #48573 if you're interested in the updates made around that driver to ensure it honors expiry time.
Release notes
You can see the complete list of new features and updates below and the diff between 10.25.0 and 10.26.0 on GitHub. The following release notes are directly from the changelog:
v10.26.2
* Revert "Hint query builder closures (#48562)" by @taylorotwell in
https://github.com/laravel/framework/pull/48620
/>
v10.26.1
* [10.x] Fix selection of vendor files after searching by @jessarcher in
https://github.com/laravel/framework/pull/48619
/>
v10.26.0
* [10.x] Convert Expression to string for from in having subqueries by @ikari7789 in
https://github.com/laravel/framework/pull/48525
/>
* [10.x] Allow searching on vendor:publish prompt by @jessarcher in
https://github.com/laravel/framework/pull/48586
/>
* [10.x] Enhance Test Coverage for Macroable Trait by @salehhashemi1992 in
https://github.com/laravel/framework/pull/48583
/>
* [10.x] Add new SQL error messages by @magnusvin in
https://github.com/laravel/framework/pull/48601
/>
* [10.x] Ensure array cache considers milliseconds by @timacdonald in
https://github.com/laravel/framework/pull/48573
/>
* [10.x] Prevent session:table command from creating duplicates by @jessarcher in
https://github.com/laravel/framework/pull/48602
/>
* [10.x] Handle expiration in seconds by @timacdonald in
https://github.com/laravel/framework/pull/48600
/>
* [10.x] Avoid duplicate code for create table commands by extending new Illuminate\Console\MigrationGeneratorCommand by @crynobone in
https://github.com/laravel/framework/pull/48603
/>
* [10.x] Add Closure Type Hinting for Query Builders by @AJenbo in
https://github.com/laravel/framework/pull/48562
/>
The post Laravel 10.26 Released appeared first on Laravel News.
Join the Laravel Newsletter to get Laravel articles like this directly in your inbox.
Why I choose Inertia over Livewire
Programing Coderfunda October 05, 2023 No comments
Now that Livewire v3 came about, it looks much better and I had to try it again, to see if I could use it for my future projects. Wire:navigate is so amazing, but I just tested the very thing that made me leave the first time.
If it's a skill issue on my part, well, I'm a fool, will eat my critique and be happy that I was using Livewire wrong and can start using it properly now.
Let me demonstrate:
Model: class File extends Model { protected $appends = ['rand']; protected $fillable = ['name']; public function getRandAttribute() { return rand(1, 100); } }
Livewire Component: class Test extends Component { public $count = 1; // public $files = []; public function mount() { // $this->files = File::all(); } public function do() { $this->count++; } public function render() { return view('livewire.test')->with([ 'files' => File::all(), ]); } }
Livewire Blade: {{ $count }} @foreach ($files as $file) {{ $file->name }} {{ $file->rand }} @endforeach
I tested both commented and `with()` options, but both had same result. On every click, which only increases the count, the `rand` value changed.
Now you might see what's my problem. If the rand attribute was s3 file getter, I'm paying for every rerender.
https://i.redd.it/46gzkg08t5sb1.gif
So, is this doable in Livewire with different approach, or does it have to be like this? submitted by /u/narrei
[link] [comments]
04 October, 2023
I want to have the Fibonacci sequence returned with commas between the numbers
Programing Coderfunda October 04, 2023 No comments
'''
Function to return string with fibonacci sequence
>>> get_fibonacci_sequence(0)
''
>>> get_fibonacci_sequence(1)
'0'
>>> get_fibonacci_sequence(9)
'0,1,1,2,3,5,8,13,21'
'''
first_term = 0
second_term = 1
nth_term = 0
result = ''
for sequence in range(num):
result += str(first_term)
nth_term = first_term + second_term
first_term = second_term
second_term = nth_term
return(result)
I tried adding (+ ',') in the loop where I convert the numbers to a string and it works but not the way I want it to.
'0,1,1,2,3,5,8,13,21,'
I want to get rid of the comma after 21
03 October, 2023
Unfinalize tool
Programing Coderfunda October 03, 2023 No comments
02 October, 2023
Error when calling a function having a record with float fields as an arg using `function:call` method
Programing Coderfunda October 02, 2023 No comments
return "mockFunction scuccessful";
}
public function main() returns error? {
string input = "{\"operation\":\"ADDITION\",\"operand1\":23.0,\"operand2\":43.0}";
map & readonly inputJson = check input.fromJsonStringWithType();
any|error observation = function:call(mockFunction, inputJson);
io:println(observation);
}
I got the following error when I tried the above.
error: {ballerina/lang.function}IncompatibleArguments {"message":"arguments of incompatible types: argument list '(map & readonly)' cannot be passed to function expecting parameter list '(ai.agent:record {| string operation; float operand1; float operand2; |})'"}
01 October, 2023
MariaDB Encryption at rest - provide key from app
Programing Coderfunda October 01, 2023 No comments
I want to use the same / similar scenario with mariaDB.
Suppose i have mariadb with encryption at rest.
1- can i provide key from my application directly?
or build wcf service that mariadb call to get the key it needs when starting
2- can i prevent resetting admin password on encrypted db?
3- Is there any other dbs that support this scenario ?
thanks
30 September, 2023
HTTP Error 500.0 - ASP.NET Core IIS hosting failure
Programing Coderfunda September 30, 2023 No comments
29 September, 2023
Already has more than 'max_user_connections' active connections cpanel in Laravel - PHP
Programing Coderfunda September 29, 2023 No comments
Form Request Tester Package for Laravel
Programing Coderfunda September 29, 2023 No comments
The post Form Request Tester Package for Laravel appeared first on Laravel News.
Join the Laravel Newsletter to get Laravel articles like this directly in your inbox.
---
28 September, 2023
Livewire v3: Modelable, Events, and Data Sharing
Programing Coderfunda September 28, 2023 No comments