CoderFunda
  • Home
  • About us
    • Contact Us
    • Disclaimer
    • Privacy Policy
    • About us
  • Home
  • Php
  • HTML
  • CSS
  • JavaScript
    • JavaScript
    • Jquery
    • JqueryUI
    • Stock
  • SQL
  • Vue.Js
  • Python
  • Wordpress
  • C++
    • C++
    • C
  • Laravel
    • Laravel
      • Overview
      • Namespaces
      • Middleware
      • Routing
      • Configuration
      • Application Structure
      • Installation
    • Overview
  • DBMS
    • DBMS
      • PL/SQL
      • SQLite
      • MongoDB
      • Cassandra
      • MySQL
      • Oracle
      • CouchDB
      • Neo4j
      • DB2
      • Quiz
    • Overview
  • Entertainment
    • TV Series Update
    • Movie Review
    • Movie Review
  • More
    • Vue. Js
    • Php Question
    • Php Interview Question
    • Laravel Interview Question
    • SQL Interview Question
    • IAS Interview Question
    • PCS Interview Question
    • Technology
    • Other

07 October, 2023

Manage a User's Browser Sessions in Laravel

 Programing Coderfunda     October 07, 2023     No comments   

submitted by /u/TouristDramatic8295
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

06 October, 2023

Reshape data from wide to long (Creating Panel Data)

 Programing Coderfunda     October 06, 2023     No comments   

I downloaded data from data stream Refinitiv. The data is in wide format which resulted in too many variables (761). I only want to form 8 variables.


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
```
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

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.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

05 October, 2023

searching a list in a list model in flutter

 Programing Coderfunda     October 05, 2023     No comments   

I have been working on a LLM-like very simple project in Flutter. I need to find a string list, for example "what is my lecture score" in a list data. But the order doesn't matter.
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.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

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.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Why I choose Inertia over Livewire

 Programing Coderfunda     October 05, 2023     No comments   

Hi, back when Livewire was first announced I gave it a try. I was excited, but I felt like the way it's hydrated doesn't fulfill my needs. Then I found Inertia and got excited again. Even tho it doesn't allow me to use Laravel's helpers I feel like I have full control and that's what I need.

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]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

04 October, 2023

I want to have the Fibonacci sequence returned with commas between the numbers

 Programing Coderfunda     October 04, 2023     No comments   

def get_fibonacci_sequence(num: int) -> str:
'''
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
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

03 October, 2023

Unfinalize tool

 Programing Coderfunda     October 03, 2023     No comments   


https://laravel-news.com/unfinalize

​

I think this tool is useful either for poorly designed libraries or for users who aren't fully aware of the library's capabilities.

What are your thoughts? submitted by /u/leoshina
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

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   

isolated function mockFunction(record {|string operation; float operand1; float operand2;|} input) returns string{
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; |})'"}
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

01 October, 2023

MariaDB Encryption at rest - provide key from app

 Programing Coderfunda     October 01, 2023     No comments   

In the past, I use Sybase anywhere db as my db server. I can encrypt the whole db with password, and from my application, i provide password inside connection string to gain access to server.


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
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

30 September, 2023

HTTP Error 500.0 - ASP.NET Core IIS hosting failure

 Programing Coderfunda     September 30, 2023     No comments   

I got this error while testing my new website Locally on IIS Express on .NET5


I have checked that i have the required dotnet version , adding the dotnet paths to the system environment variables and Restarted the visual studio
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

29 September, 2023

Already has more than 'max_user_connections' active connections cpanel in Laravel - PHP

 Programing Coderfunda     September 29, 2023     No comments   

 This is Root Cpanel

1 


 After Hit Button Enter then Show This page



 

Change  the max connection value according you like 50 or 100 or 5000 


 

 


2

Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Form Request Tester Package for Laravel

 Programing Coderfunda     September 29, 2023     No comments   

The Laravel Form Request Tester package is a collection of helpers that help test form requests.


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.

---
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

28 September, 2023

Livewire v3: Modelable, Events, and Data Sharing

 Programing Coderfunda     September 28, 2023     No comments   

submitted by /u/ktan25
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

27 September, 2023

Solved max_user_connections in laravel

 Programing Coderfunda     September 27, 2023     Laravel     No comments   

 

max_user_connections and other problems!!

Go the Config folder then open database then change only options after your problem will be solved

/abc/config/database.php

abc = is a folder name where you install the laravel 
'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
            ]) : [],
        ],

Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How do I create a lexical dispersion plot in pyspark with seaborn?

 Programing Coderfunda     September 27, 2023     No comments   

I'm trying to make a lexical dispersion plot that maps out when words in a certain 'top ten' list are used over time through a column of strings in a Pysparks data frame (another column has their relevant dates).


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 :)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

26 September, 2023

Laravel Bootcamp now has a Livewire track

 Programing Coderfunda     September 26, 2023     No comments   

Laravel Bootcamp, the choose your adventure, style learning site, added support for Laravel Livewire.


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.

---
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

25 September, 2023

oracle developer_ importing different forms of date in one column

 Programing Coderfunda     September 25, 2023     No comments   

I am trying to import the date columns with different types of date format. table name: fD column name: TRANS_DATE_TRANS_TIME this column has two forms of the date like below. date type1: 'MM/DD/YYYY HH24:MI' date type2: 'YYYY-MM-DD HH24:MI:SS' not surprisingly, SQL developer(oracle) cannot import this column as a DATE type. I aim to unify these forms as 'MM/DD/YYYY HH24:MI.' What I did was I import it as a VARCHAR2 type and try to write very complicate and difficult(?) query... and then I read someone wrote here that do not import date type data as a VARCHAR2 because of this. Then, is there any idea that I can import this column successfully? or I need to import it as a VARCHAR2 type and write down complicate query? (and I do not know this query either.. haha) this is what I did when I imported it as a VARCHAR2. ''' with DT as( select TRANS_DATE_TRANS_TIME from fD ) select TRANS_DATE_TRANS_TIME, replace(to_char(to_date(TRANS_DATE_TRANS_TIME, case when regexp_like(TRANS_DATE_TRANS_TIME,'[0-9]{1}/[0-9]{1}/[0-9]{4} [0-9]{1}:[0-9]{2}') then 'MM/DD/YYYY HH24:MI' when regexp_like(TRANS_DATE_TRANS_TIME,'[0-9]{2}/[0-9]{1}/[0-9]{4} [0-9]{1}:[0-9]{2}') then 'MM/DD/YYYY HH24:MI' when regexp_like(TRANS_DATE_TRANS_TIME,'[0-9]{1}/[0-9]{2}/[0-9]{4} [0-9]{1}:[0-9]{2}') then 'MM/DD/YYYY HH24:MI' when regexp_like(TRANS_DATE_TRANS_TIME,'[0-9]{1}/[0-9]{1}/[0-9]{4} [0-9]{2}:[0-9]{2}') then 'MM/DD/YYYY HH24:MI' when regexp_like(TRANS_DATE_TRANS_TIME,'[0-9]{2}/[0-9]{2}/[0-9]{4} [0-9]{1}:[0-9]{2}') then 'MM/DD/YYYY HH24:MI' when regexp_like(TRANS_DATE_TRANS_TIME,'[0-9]{1}/[0-9]{2}/[0-9]{4} [0-9]{2}:[0-9]{2}') then 'MM/DD/YYYY HH24:MI' when regexp_like(TRANS_DATE_TRANS_TIME,'[0-9]{2}/[0-9]{1}/[0-9]{4} [0-9]{2}:[0-9]{2}') then 'MM/DD/YYYY HH24:MI' when regexp_like(TRANS_DATE_TRANS_TIME,'[0-9]{2}/[0-9]{2}/[0-9]{4} [0-9]{2}:[0-9]{2}') then 'MM/DD/YYYY HH24:MI' when regexp_like(TRANS_DATE_TRANS_TIME,'[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}') then 'MM/DD/yyyy HH24:MI' end), 'MM/DD/yyyy HH24:MI'),'') as newT from DT; '''
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

24 September, 2023

Inner funtion gives error in Django Rest Framework

 Programing Coderfunda     September 24, 2023     No comments   

I have inner functions inside the main function with an IF statement but when the if condition is applied it gives this error (AssertionError: The request argument must be an instance of django.http.HttpRequest, not rest_framework.request.Request.) How can I solve this issue? Any help, please? views.py from .api_option23 import api_option23 from .api_option23 import api_option45 @api_view(["GET", "POST"]) def apiscanning(request, qrcode, action, curr_user): if request.method == "GET" or request.method == "POST": if action ==1: #do something elif action ==2: api_option23(request, parameters) elif action ==3: api_option45(request, parameters)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

23 September, 2023

Livewire (+Filament) & debugging

 Programing Coderfunda     September 23, 2023     No comments   

I've worked with different frameworks quite a bit, recently mostly Laravel. There are many things I love about Laravel and quite a few pet peeves. Recently adopted Filament and I love the power, hate the lack of documentation (especially lacking source code documentation almost entirely). Filament is speeding up many things while radically slowing other things, especially when learning it. I've used Livewire in the past and love it. With Filament, everything is built on top of Livewire which has its benefits and at least one downside: debugging has become increasingly difficult. Your stack trace has 100 lines and it's very hard to understand what's going wrong. How are you approaching this aspect of debugging / development with Livewire? submitted by /u/lionmeetsviking [link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

22 September, 2023

Pail is an experimental package to tail logs

 Programing Coderfunda     September 22, 2023     No comments   

Pail is an experimental Artisan package to provide an effortless way to tail logs in your Laravel applications. The post Pail is an experimental package to tail logs appeared first on Laravel News. Join the Laravel Newsletter to get Laravel articles like this directly in your inbox. ---
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

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   

I am developing a web application in flash. The application has a database. When the user visits the page, he should see a graph with default data for the first device. Then there are filters in which the user selects the desired device, data type and time period. After clicking on the "Apply" button, the graph should be rebuilt according to the user's choice. Filters are made in wtform. The graph builds a canvas script in html. Problem: The graph is not rebuilt, it remains the original default all the time Flask code: @app.route('/chart', methods=['GET', 'POST']) def chart_view(): """Chart Page""" form = LogChartForm() if form.validate_on_submit(): source_id = form.source_id.data type_id = form.type_id.data time_start = form.time_start.data time_end = form.time_end.data source_get = EvSource.query.filter_by(description=source_id).first() source = source_get.id_ev_source if type_id != 'All': typ_get = EvType.query.filter_by(description=type_id).first() typ = typ_get.id_ev_type items = Log.query.filter_by(id_ev_source=source, id_ev_type=typ).order_by(Log.timestamp).all() else: items = Log.query.filter_by(id_ev_source=source).order_by(Log.timestamp).all() # start = calendar.timegm(datetime.datetime(time_start.year, time_start.month, time_start.day, 0, 0, 0).timetuple()) # end = calendar.timegm(datetime.datetime(time_end.year, time_end.month, time_end.day, 0, 0, 0).timetuple()) labels = [strftime('%Y-%m-%d %H:%M:%S', localtime(item.timestamp)) for item in items] datas = [item.value for item in items] text = form.source_id.data dict_data = {'labels': labels, 'datas': datas, 'texts': text} return render_template('chart.html', form=form, **dict_data) else: source_id = form.source_id.data type_id = form.type_id.data source_get = EvSource.query.filter_by(description=source_id).first() source = source_get.id_ev_source items = Log.query.filter_by(id_ev_source=source).order_by(Log.timestamp).all() labels = [strftime('%Y-%m-%d %H:%M:%S', localtime(item.timestamp)) for item in items] datas = [item.value for item in items] text = form.source_id.data dict_data = {'labels': labels, 'datas': datas, 'texts': text} return render_template('chart.html', form=form, **dict_data) class LogChartForm(FlaskForm): """Graph Form: Filter""" source_list = [source.description for source in EvSource.query.all()] type_list = [typ.description for typ in EvType.query.all()] type_list.append('All') source_id = SelectField( default=source_list[0], choices=source_list ) type_id = SelectField( default=type_list[-1], choices=type_list ) time_start = DateField(default=None, format='%Y-%m-%d', validators=[Optional()]) time_end = DateField(default=None, format='%Y-%m-%d', validators=[Optional()]) submit = SubmitField('Apply') Html code: {% extends "base.html" %} {% block content %} Current system status: Graph const labels = {{ labels | tojson }}; const texts = {{ texts | tojson }}; const data = { labels: labels, datasets: [{ label: texts, backgroundColor: '#E22545', borderColor: '#E22545', data: {{ datas | tojson }}, }] }; const config = { type: 'line', data: data, options: { maintainAspectRatio: false } }; const myChart = new Chart( document.getElementById('myChart'), config ); {{ form.csrf_token }} Filters {{ form.submit(style="height: 30px; width: 140px; font-size: 16px; color: #fbfbfb; background-color: #272d3d; border: none; font-weight: 700;") }} Signal source {{ form.source_id(style="height: 25px; width: 100%; text-align: right; font-size: 16px; font-weight: bolder;") }} Signal type {{ form.type_id(style="height: 25px; width: 100%; text-align: right; font-size: 16px; font-weight: bolder;") }} Period {{ form.time_start(class= "datepicker", style="text-align: right; font-size: 16px; font-weight: bolder;") }} {{ form.time_end(class= "datepicker", style="text-align: right; font-size: 16px; font-weight: bolder;") }} {% endblock %}
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Laracon EU 2024 tickets are now available

 Programing Coderfunda     September 21, 2023     No comments   

submitted by /u/ahinkle [link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

20 September, 2023

Why is c++ std::forward always return right value without template

 Programing Coderfunda     September 20, 2023     No comments   

I am trying to understand c++ perfect forwarding, and I do experiments with the following code: #include #include using namespace std; void inner(int&) {cout
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

19 September, 2023

How can I only install dependencies for a particular package managed by `nx`

 Programing Coderfunda     September 19, 2023     No comments   

I have a monorepo managed by nx. And I use yarn install to install dependencies. I found when I run yarn install under one package folder, it installs dependencies from other packages. packages/is-event/package.json packages/is-odd/package.json package.json node_modules Above is my project folder structure, I have one dependency in is-odd package, when I run yarn install in is-even package, the dependency from is-odd was downloaded and saved in the root level node_modules folder. How can I avoid downloading other packages' dependencies? I have removed the node_modules folder before running yarn install in is-odd folder.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

18 September, 2023

Weekly /r/Laravel Help Thread

 Programing Coderfunda     September 18, 2023     No comments   

Ask your Laravel help questions here. To improve your chances of getting an answer from the community, here are some tips: * 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]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

17 September, 2023

Fatal error: $CFG->dataroot is not writable, admin has to fix directory permissions! Exiting

 Programing Coderfunda     September 17, 2023     No comments   

unset($CFG); global $CFG; $CFG = new stdClass(); $CFG->dbtype = 'sqlsrv'; $CFG->dblibrary = 'native'; $CFG->dbhost = 'my remote db ip address'; $CFG->dbname = 'remote database name'; $CFG->dbuser = '****'; $CFG->dbpass = '**********'; $CFG->prefix = 'mdl_'; $CFG->dboptions = array ( 'dbpersist' => 0, 'dbport' => 1433, 'dbsocket' => '', ); $CFG->wwwroot = '
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.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Optional Dependency in VBA Module

 Programing Coderfunda     September 17, 2023     No comments   

Background I am developing a VBA module (call it "Greg") for VBA developers of Excel UDFs. The purpose of Greg is to enhance the experience for the end user, who uses those UDFs in Excel. The developer must simply copy a snippet into their own module (call it "Dev"). If Greg is loaded, the snippet enhances Dev's behavior. Otherwise, it has no impact on behavior, but it does prompt the Excel user to import Greg.bas. Approach Here is a simplified sketch of Greg.bas... Attribute VB_Name = "Greg" ' Keep these functions invisible to Excel users. Option Private Module ' Enhancement function. Public Function Enhancer(Optional x) ' ... End Function ' Assert the 'Greg' module is loaded. Public Function IsLoaded() As Boolean IsLoaded = True End Function ...and of Dev.bas: Attribute VB_Name = "Dev" ' Some UDF by the dev. Public Function DevRegular() ' ... End Function ' ############# ' ## Snippet ## ' ############# ' Use the enhancer, if available via the 'Greg' module. Public Function DevEnhanced(Optional x) If Enhance_IsSupported() Then DevEnhanced = Greg.Enhancer(x) Else DevEnhanced = DevRegular() ' Prompt the user to import the enhancer. MsgBox "Import the 'Greg' module to enhance your experience." End If End Function ' Check if enhancement is supported via the 'Greg' module. Private Function Enhance_IsSupported() As Boolean On Error GoTo Fail Enhance_IsSupported = Greg.IsLoaded() Exit Function Fail: Enhance_IsSupported = False End Function Problem While this has worked sporadically on Windows, it has often failed there and always on Mac. The crux seems to be Enhance_IsSupported() within Dev: Private Function Enhance_IsSupported() As Boolean On Error GoTo Fail Enhance_IsSupported = Greg.IsLoaded() Exit Function Fail: Enhance_IsSupported = False End Function I assumed that the line Greg.IsLoaded() would compile, even if there were no Greg module present...and it does! It only fails when a Greg module exists without a member called IsLoaded(). Unfortunately, it seems that VBA does not reliably refresh its "awareness" of a Greg module with an IsLoaded() function. When I import Greg.bas and Dev.bas together, everything works as intended: Enhance_IsSupported() returns True, and it updates to False if Greg is removed. But when I first import Dev.bas and run DevEnhanced(), and only afterwards import Greg.bas, then Enhance_IsSupported() apparently returns False despite the presence of Greg. Note This latter workflow is absolutely essential: an Excel user must first run DevEnhanced() and see the prompt, in order to know about Greg.bas in the first place! Failed Solutions Unfortunately, no experimentation has availed. In Greg itself, I have tried using a constant... Public Const IS_LOADED As Boolean = True ...and also a procedure: Public Function IsLoaded() As Boolean IsLoaded = True End Function In the snippet for Dev, I have implicitly tried Application.Evaluate()... Private Function Enhance_IsSupported() As Boolean On Error GoTo Fail Enhance_IsSupported = [Greg.IsLoaded()] ' ^^^^^^^^^^^^^^^^^ ' Application.Evaluate("Greg.IsLoaded()") Exit Function Fail: Enhance_IsSupported = False End Function ...but while this works for Enhance_IsSupported() itself, the same error simply crops up elsewhere — like whack-a-mole at other instances of Greg.* — and only a manual edit will "refresh" those procedures. I would also prefer to avoid unstable calls to any .Evaluate() method, even in the Worksheet scope. Questions * What is the simplest way to "refresh" the Dev module, such that its procedures now recognize the calls to Greg.*? * Is this possible without resetting cached or Static variables in Dev? * Can this be done with an IS_LOADED constant rather than an IsLoaded() procedure? Bonus * Can this refreshment be done by some Sub like Dev.Refresh(), called automatically at the start of Enhance_IsSupported()? * Can this refreshment be done by some Sub like Greg.Refresh(), as run manually by the user in the VBA editor? --- This project represents a great investment of my time and energy, and it is otherwise operational, so your help is greatly appreciated in conquering this final obstacle!
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

16 September, 2023

Git Delta is a Syntax Highlighting Pager for git, diff, and grep output

 Programing Coderfunda     September 16, 2023     No comments   

Delta is a syntax highlighting tool for git, diff, and grep, with a rich feature set. The post Git Delta is a Syntax Highlighting Pager for git, diff, and grep output appeared first on Laravel News. Join the Laravel Newsletter to get Laravel articles like this directly in your inbox. ---
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

15 September, 2023

Tablar: A Laravel Dashboard Preset

 Programing Coderfunda     September 15, 2023     No comments   

The Laravel Tablar Admin Dashboard Package is a beautiful, feature-rich admin dashboard Template using Laravel, Tabler, and Vite. The post Tablar: A Laravel Dashboard Preset appeared first on Laravel News. Join the Laravel Newsletter to get Laravel articles like this directly in your inbox. ---
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Newer Posts Older Posts Home

Meta

Popular Posts

  • Laravel auth check login
          <?php     Laravel auth check login     use Illuminate\Support\Facades\ Auth ;     if ( Auth :: check()) {         // The use...
  • window.location.replace() is not working
    just wanna ask why does window.location.replace is not working in my page. I've been working on it for weeks. It works fine on my other ...
  • JqueryUI Tutorial
    JqueryUI Tutorial    JqueryUI is the most popular front end frameworks currently. It is sleek, intuitive, and powerful mobile first fr...
  • What is WordPress
      What is WordPress WordPress is a free and open-source  C ontent  M anagement  S ystem (CMS). It is an online site based on PHP and MySQL. ...
  • Outlook Showing in Process even after closing - C#
    I am writing a code to such that I will get a trigger when ever outlook opens Process[] processlist = System.Diagnostics.Process.GetProcess...

Categories

  • Ajax (26)
  • Bootstrap (30)
  • DBMS (42)
  • HTML (12)
  • HTML5 (45)
  • JavaScript (10)
  • Jquery (34)
  • Jquery UI (2)
  • JqueryUI (32)
  • Laravel (1017)
  • Laravel Tutorials (23)
  • Laravel-Question (6)
  • Magento (9)
  • Magento 2 (95)
  • MariaDB (1)
  • MySql Tutorial (2)
  • PHP-Interview-Questions (3)
  • Php Question (13)
  • Python (36)
  • RDBMS (13)
  • SQL Tutorial (79)
  • Vue.js Tutorial (69)
  • Wordpress (150)
  • Wordpress Theme (3)
  • codeigniter (108)
  • oops (4)
  • php (853)

Social Media Links

  • Follow on Twitter
  • Like on Facebook
  • Subscribe on Youtube
  • Follow on Instagram

Pages

  • Home
  • Contact Us
  • Privacy Policy
  • About us

Blog Archive

  • July (4)
  • September (100)
  • August (50)
  • July (56)
  • June (46)
  • May (59)
  • April (50)
  • March (60)
  • February (42)
  • January (53)
  • December (58)
  • November (61)
  • October (39)
  • September (36)
  • August (36)
  • July (34)
  • June (34)
  • May (36)
  • April (29)
  • March (82)
  • February (1)
  • January (8)
  • December (14)
  • November (41)
  • October (13)
  • September (5)
  • August (48)
  • July (9)
  • June (6)
  • May (119)
  • April (259)
  • March (122)
  • February (368)
  • January (33)
  • October (2)
  • July (11)
  • June (29)
  • May (25)
  • April (168)
  • March (93)
  • February (60)
  • January (28)
  • December (195)
  • November (24)
  • October (40)
  • September (55)
  • August (6)
  • July (48)
  • May (2)
  • January (2)
  • July (6)
  • June (6)
  • February (17)
  • January (69)
  • December (122)
  • November (56)
  • October (92)
  • September (76)
  • August (6)

Loading...

Laravel News

Loading...

Copyright © CoderFunda | Powered by Blogger
Design by Coderfunda | Blogger Theme by Coderfunda | Distributed By Coderfunda