07 October, 2023
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
27 September, 2023
Solved max_user_connections in laravel
Programing Coderfunda September 27, 2023 Laravel No comments
max_user_connections and other problems!!
'mysql' => [ 'driver' => 'mysql', 'url' => env('DATABASE_URL'), 'host' => env('DB_HOST', '127.0.0.1'), 'port' => env('DB_PORT', '3306'), 'database' => env('DB_DATABASE', 'forge'), 'username' => env('DB_USERNAME', 'forge'), 'password' => env('DB_PASSWORD', ''), 'unix_socket' => env('DB_SOCKET', ''), 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci', 'prefix' => '', 'prefix_indexes' => true, //'strict' => true, 'strict' => false, 'engine' => null, 'options' => extension_loaded('pdo_mysql') ? array_filter([ // PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), PDO::ATTR_PERSISTENT => false ]) : [], ],
How do I create a lexical dispersion plot in pyspark with seaborn?
Programing Coderfunda September 27, 2023 No comments
I've got my dataframe at the moment with the texts, their dates, and the words used in each.
my dataframe
As it is, my plot has a row for each individual text with a list of the words in it, when what I'm after is a row for each key word, mapping the instances in which it appears in texts over time...
This is the kind of thing I'm after, vs what I'm getting...
the type of thing I'm after
how my plot is coming out
Here's a function which I use to return words from my list which are present in a given description:
import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd
from pyspark.sql.functions import split, udf
top_ten = [row['word'] for row in top_ten_words]
punctuation = ',?!./\#@"[]'
@udf
def top_ten_list(description):
'''
function to return the key words which are present in a certain description string
'''
list_of_words = description.split(" ")
out_data = []
for word in list_of_words:
word = word.lower()
if word.strip(punctuation) in top_ten:
out_data.append(word)
else:
pass
return str(out_data)
I then run that function on my column with the following:
descriptions_with_top10 = descriptions_by_date.withColumn('top_tenners', top_ten_list(descriptions_by_date.description))
Here's my code so far to make my plot. I know I need something different in the y-axis but I'm just not sure how to word it so as to get what I'm after...
# make df into pandas df to plot with seaborn
top_ten_words_in_descriptions_df = descriptions_with_top10.toPandas()
# plot dispersion plot
top_ten_plot = sns.stripplot(data = top_ten_words_in_descriptions_df, x = "published_date", y = "top_tenners", orient='h', marker='X', color='navy', size=3)
# rotate x tick labels
plt.xticks(rotation=15)
# remove borders of plot
plt.tight_layout()
plt.show()
I want it to have each word just once in the y-axis, as in this image: enter image description here, with each keyword just once, with all its occurrences marked, rather than the list of keywords for each description string.
I hope that makes some sense to someone; any help would be very welcome :)
26 September, 2023
Laravel Bootcamp now has a Livewire track
Programing Coderfunda September 26, 2023 No comments
The post Laravel Bootcamp now has a Livewire track appeared first on Laravel News.
Join the Laravel Newsletter to get Laravel articles like this directly in your inbox.
---
25 September, 2023
oracle developer_ importing different forms of date in one column
Programing Coderfunda September 25, 2023 No comments
24 September, 2023
Inner funtion gives error in Django Rest Framework
Programing Coderfunda September 24, 2023 No comments
23 September, 2023
Livewire (+Filament) & debugging
Programing Coderfunda September 23, 2023 No comments
22 September, 2023
Pail is an experimental package to tail logs
Programing Coderfunda September 22, 2023 No comments
21 September, 2023
How to rebuild a graph on an html page based on the result of selecting data in the wtform form in a flash application?
Programing Coderfunda September 21, 2023 No comments
Laracon EU 2024 tickets are now available
Programing Coderfunda September 21, 2023 No comments
20 September, 2023
Why is c++ std::forward always return right value without template
Programing Coderfunda September 20, 2023 No comments
19 September, 2023
How can I only install dependencies for a particular package managed by `nx`
Programing Coderfunda September 19, 2023 No comments
18 September, 2023
Weekly /r/Laravel Help Thread
Programing Coderfunda September 18, 2023 No comments
17 September, 2023
Fatal error: $CFG->dataroot is not writable, admin has to fix directory permissions! Exiting
Programing Coderfunda September 17, 2023 No comments
http://localhost/LMS'; $CFG->dataroot = 'C:\\inetpub\\LMSdata'; $CFG->admin = 'admin'; $CFG->directorypermissions = 0777; This is my configuration in config.php. I'm using moodle 3.2 in IIS with php 7. Remote SQL server version 2012.
Optional Dependency in VBA Module
Programing Coderfunda September 17, 2023 No comments
16 September, 2023
Git Delta is a Syntax Highlighting Pager for git, diff, and grep output
Programing Coderfunda September 16, 2023 No comments
15 September, 2023
Tablar: A Laravel Dashboard Preset
Programing Coderfunda September 15, 2023 No comments