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

29 July, 2024

Deploy the laravel application in under 120 seconds using deployer

 Programing Coderfunda     July 29, 2024     No comments   

Deployment is one of the messiest things if not done correctly. This can cause downtime which in turn can cause significant damage to businesses. There are so many checks to make sure all goes well. And even after that sometimes shit happens. Not anymore...


https://www.youtube.com/watch?v=8YKLsAAdz5Y submitted by /u/samgan-khan
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Has anyone used Turbolinks + Laravel to create a native hybrid app?

 Programing Coderfunda     July 29, 2024     No comments   

I really want a simple iOS app for my Laravel project, but I’m not seeing very many recent posts / tutorials/ etc about Turbolinks and Laravel.

Has Turbolinks pretty much become exclusive to Ruby on Rails? Anyone know of alternatives or have RECENT tutorials on using it with Laravel?

Thanks ๐Ÿ™ submitted by /u/LikeAnElephant
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Supercharge your Laravel app with custom data types in PostgreSQL

 Programing Coderfunda     July 29, 2024     No comments   

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

My "Model Required Fields" package

 Programing Coderfunda     July 29, 2024     No comments   

With Model Required Fields package, you can get the required model fields, excluding primary keys, nullable fields, and fields with defaults.

I first needed this information while working on a large project with no tests or factories and many migrations. It was distracting to manually look for each required field.

I created a simple trait to fetch required fields. It was easy in Laravel 11 and 10. Then I realized that most programmers who face this problem are usually using older versions, so I added support for Laravel 9, 8, 7, and 6, and extracted the logic into a package.

I tested the code for each supported Laravel version and each SQL database: SQLite, MySQL, MariaDB, PostgreSQL, and Microsoft SQL Server. I needed to add support for each SQL database because I used the DB facade with raw SQL queries, and there were slight differences each time.

The package is fully tested with PHPUnit and GitHub Actions for every Laravel version and for each database.

The usage and examples are in the readme file.

I hope you like this package, and I welcome any contributions or comments.

package link:


https://github.com/watheqAlshowaiter/model-required-fields. submitted by /u/watheq_show
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

09 July, 2024

Quick tip about model serialization in event constructor

 Programing Coderfunda     July 09, 2024     No comments   

I had an issue with relations being resolved during unserialization, but because there is a polymorphic relation sometimes it can try to resolve a nested relation that does not exist anymore. Use the #[WithoutRelations] attribute to fix it. submitted by /u/imwearingyourpants
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

08 July, 2024

How to find ceritain value in multiple section and return other value

 Programing Coderfunda     July 08, 2024     No comments   

How should I write this formula


Find the Square section where Value A at (Gary is in 8 in this case), and get the name " Ocho" from list underneath


then find where is Value B, Put Ocho at highlight place in value B section


Then list the rest clockwise


Sample Image:



I tried to put value clockwise by using
=INDEX(D22:D29,,XMATCH(D22:D29,MOD(SEQUENCE(8,,E29-1),8)+1))
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

OpenCV - How to compute 3D points with SfM methods with known fundamental matrix

 Programing Coderfunda     July 08, 2024     No comments   

For a university project, we are working on implementing a basic SfM pipeline, using Middlebury's "temple" dataset. This means that, for each image, the projection matrix for that given image is known. I have done some reading and seen some examples on SfM reconstruction, where, usually, the camera rotation and translation are unknown and PnP algorithms are used to obtain them.
My question is, given we know the projection matrix for any given image, what would the processing pipeline look like? I envision something along the lines of:



* Compute SIFT keypoints and descriptors for each image.

* Pair "adjacent" images (in this case, images with sequential ids from the dataset)

* Find point matches for each pair using KNN or similar matching algorithm.

* Use cv2.triangulatePoints to find the corresponding 3D point for each of the 2d point matches using the known projection matrices.






I understand that, generally, the most difficult aspect of SfM is precisely the step we are skipping over of pose estimation. However, for now we are only aiming for a basic implementation, possibly implementing a "complete" algorithm that includes this step later.


Still, I am unsure as to whether there are any processing steps that would be necessary in order to obtain "good" results.



* Would something like undistortPoints be necessary for this estimation?

* What would be the most efficient way of building the point cloud (for example, building feature tracks and only include points that result from the triangulation of some number of images n)?

* Finally, where and how should we discard pair outliers? Most of the functions offered by OpenCV use RANSAC as part of the pose estimation process, and I don't know if there are functions that would allow us to use the algorithm in our case (if it would even be necessary).






So far, we have implemented a basic SIFT keypoint extractor.
Unsure where to continue from here.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to resolve a Cors error when trying to get an authentication token using authorisation code grant in Next.js

 Programing Coderfunda     July 08, 2024     No comments   

I have an app where im trying to send a generated pdf to get a signature. Pretty straightforward.
I got the authentication working in postman, but when I try it in code, I get this error:


Access to fetch at '
https://account-d.docusign.com/oauth/token' from origin '
http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.


I can retrieve the oauth code with this:
if (router.asPath !== router.route) {
setOAuthCode(new URLSearchParams(window.location.search).get("code"));
}



but in a seperate use effect, i try to submit this oAuth code, it falls appart:
useEffect(() => {
const getAuthToken = async () => {

const tokenUrl = "
https://account-d.docusign.com/oauth/token"; /> const encodedSecret = btoa(
`${process.env.NEXT_PUBLIC_DOCUSIGN_INTEGRATION_KEY}:${process.env.NEXT_PUBLIC_DOCUSIGN_CLIENT_SECRET}`
);

const headers = {
"Authorization": `Basic ${encodedSecret}`,
"Content-Type": "application/x-www-form-urlencoded",
};
const body = new URLSearchParams({
grant_type: "authorization_code",
code: oAuthCode,
});

const response = await fetch(tokenUrl, {
method: "POST",
headers: headers,
body: body,
});

if (!response.ok) {
throw new Error(
`Failed to get access token: ${response.status} ${response.statusText}`
);
}
const data = await response.json();
setAuthToken(data.access_token);
};
getAuthToken();
}, [oAuthCode]);



Any kung fu would be greatfully accepted
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

A laravel package to test/debug emails all at local machine

 Programing Coderfunda     July 08, 2024     No comments   

I am excited to announce that I have released new version of mailbase.
https://github.com/tkeer/mailbase

It lets you save your emails in database and go through each one by one.
If you use laravel mail feature I would love if you could check and let me know what do you think and how can I improve it. submitted by /u/tkeer
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

.Net 8 XUnit: Use an In-Memory DBConnection for testing as a replacement for the real MySqlConnection

 Programing Coderfunda     July 08, 2024     No comments   

I'm creating tests for my .Net 8 API, and as I want to test with fake self created data (instead of using the real MySql connection) I'm having problems figuring out how to implement that behavior, I mean, using -for example- an In-Memory database.


We use CQRS (Mediator pattern) for the database queries, and on each query handler we inject ICloudStackCoreConnectionFactory which includes (among others) a CreateConnection method that returns a DBConnection (in our case, a MySqlConnection):


ICloudStackCoreConnectionFactory:
public DbConnection CreateConnection(Region region)
{
return (DbConnection)new MySqlConnection(GetConnString(region));
}



I'd like to replace that MySqlConnection implementation by an in-memory connection so I can test with a reduced set of fake data, but I don't know how to do it.


We use a "Lab" to create all stuff needed for the tests, and the Lab includes a create method as follows:
public static Lab Create(ITestOutputHelper output)
{
var appFactory = Vdc.Libs.AspNet.Testing.Setup.Factory(
out var client,
out var authorize,
out var identity,
out var faker,
role: $"{VdcSecurity.Role.Management},{VdcSecurity.Role.ManagementAdmin}",
output: output,
setup: services =>
{
}
);
return new Lab(identity, appFactory, client, authorize, faker);
}



I know I could use Mock library to mock the ICloudStackCoreConnectionFactory interface, but as I debug, when the test starts the real "Program.cs" is launched, so is clear we are using the real hosted services and so I don't know how to replace only that interface with the mocked one.


Then I also don't know how to return a DBConnection In-Memory database with data in the "CreateConnection" method.


Any help?


Edit 1: The actual implementation of ICloudStackCoreConnectionFactory
//
// Summary:
// Allow create a connection with the CloudStack database for diferent regions
public sealed class MySqlCloudStackCoreConnectionFactory : ICloudStackCoreConnectionFactory
{
private sealed record QTaskInfo(Region Region, Task CountTask, Task DataTask);

private readonly CloudStackDBOptions _configuration;

private readonly ILogger _logger;

private static readonly ConcurrentDictionary _connections = new ConcurrentDictionary();

public MySqlCloudStackCoreConnectionFactory(IOptions options, ILogger logger)
{
_configuration = options.Value;
_logger = logger;
}

public DbConnection CreateConnection(Region region)
{
return new MySqlConnection(GetConnString(region));
}

public async Task QuerySearchAsync(IRegionRepository regionRepository, string fetchDataQuery, string? countDataQuery = null, Dictionary? columnModelModel = null, Paging? paging = null, ColumnName[]? order = null, string[]? excludedOrder = null, Func? transform = null, object? param = null, Func? filter = null, bool skipDbPaging = false, CancellationToken ct = default(CancellationToken)) where TOut : class
{
string[] excludedOrder2 = excludedOrder;
int total = 0;
List response = new List();
List connections = new List();
StringBuilder stringBuilder = new StringBuilder(fetchDataQuery);
if (order != null && excludedOrder2 != null && excludedOrder2.Length != 0)
{
order = order.Where((ColumnName o) => !excludedOrder2.Contains(o.Name)).ToArray();
}

if (order != null && order.Length != 0)
{
stringBuilder.Append(" ORDER BY");
ColumnName[] array = order;
foreach (ColumnName columnName in array)
{
string value = ((columnModelModel != null) ? columnModelModel[columnName.Name] : columnName.Name);
stringBuilder.Append(' ').Append(value).Append(columnName.Asc ? " ASC," : " DESC,");
}

stringBuilder.Remove(stringBuilder.Length - 1, 1);
}

if (paging != null && !skipDbPaging)
{
stringBuilder.Append(" LIMIT ").Append((paging.Page + 1) * paging.PageSize).Append(';');
}

fetchDataQuery = stringBuilder.ToString();
QTaskInfo[] array2 = ParallelizeTask(fetchDataQuery, countDataQuery, param, connections, await GetOnlineRegion(regionRepository, filter, ct));
Task[] array3 = new Task[2 * array2.Length];
for (int j = 0; j < array3.Length; j += 2)
{
int num = j / 2;
array3[j] = array2[num].CountTask;
array3[j + 1] = array2[num].DataTask;
}

Task.WaitAll(array3, ct);
ValueTask[] array4 = CloseConnection(connections);
for (int k = 0; k < array2.Length; k++)
{
var (region2, task3, task4) = array2[k];
try
{
IEnumerable result2 = task4.Result;
int result3 = task3.Result;
total += result3;
foreach (TDbItem item in result2)
{
TOut val = ((transform != null) ? transform(region2, item) : null) ?? (item as TOut);
if (val != null)
{
response.Add(val);
}
}
}
catch (Exception exception)
{
regionRepository.SetStatus(region2, online: false);
_logger.LogError(exception, "Error request region: {Region}", region2);
}
}

IQueryable result = response.AsQueryable().ApplySearch(paging, order);
_logger.LogInformation("Dispose all connection created");
ValueTask[] array5 = array4;
for (int l = 0; l < array5.Length; l++)
{
ValueTask valueTask = array5[l];
await valueTask;
}

TOut[] array6 = result.ToArray();
return ((countDataQuery == null) ? array6.Length : total, array6);
}

public async Task ExecuteAsync(IRegionRepository regionRepository, string sql, object? @params = null, Func? filter = null, CancellationToken ct = default(CancellationToken))
{
string sql2 = sql;
object params2 = @params;
Region[] array = await GetOnlineRegion(regionRepository, filter, ct);
List connections = new List();
Region[] array2 = new Region[array.Length];
Task[] array3 = new Task[array.Length];
for (int i = 0; i < array3.Length; i++)
{
Region region = array[i];
_logger.LogInformation("Creating connection for: {Region}", region);
DbConnection connection = CreateConnection(region);
Task task = Task.Run(async delegate
{
try
{
_logger.LogDebug("Creating connection for: {Region}", region);
return await connection.ExecuteAsync(sql2, params2);
}
catch (Exception exception2)
{
_logger.LogWarning(exception2, "Error query {Region}", region);
return 0;
}
});
array3[i] = task;
array2[i] = region;
}

Task[] tasks = array3;
Task.WaitAll(tasks, ct);
ValueTask[] array4 = CloseConnection(connections);
int total = 0;
for (int j = 0; j < array3.Length; j++)
{
Task task2 = array3[j];
Region region2 = array2[j];
try
{
int result = task2.Result;
total += result;
}
catch (Exception exception)
{
regionRepository.SetStatus(region2, online: false);
_logger.LogError(exception, "Error request region: {Region}", region2);
}
}

_logger.LogInformation("Dispose all connection created");
ValueTask[] array5 = array4;
for (int k = 0; k < array5.Length; k++)
{
ValueTask valueTask = array5[k];
await valueTask;
}

return total;
}

private static ValueTask[] CloseConnection(List connections)
{
return connections.Select((DbConnection s) => s.DisposeAsync()).ToArray();
}

private string GetConnString(Region region)
{
return region switch
{
Region.Europe => _configuration.Europe,
Region.Asia => _configuration.Asia,
Region.NA => _configuration.NA,
Region.Lab => _configuration.Lab,
_ => throw new NotSupportedException("Region is not supported"),
};
}

private static async Task GetOnlineRegion(IRegionRepository regionRepository, Func? filter = null, CancellationToken ct = default(CancellationToken))
{
Func filter2 = filter;
return (from p in await regionRepository.GetOnlineAsync(ct)
where p != Region.Lab
where filter2?.Invoke(p) ?? true
select p).ToArray();
}

private QTaskInfo[] ParallelizeTask(string fetchDataQuery, string? countDataQuery, object? param, List connections, Region[] onlineRegions)
{
string fetchDataQuery2 = fetchDataQuery;
object param2 = param;
string countDataQuery2 = countDataQuery;
QTaskInfo[] array = new QTaskInfo[onlineRegions.Length];
for (int i = 0; i < array.Length; i++)
{
Region region = onlineRegions[i];
_logger.LogInformation("Creating connection for: {Region}", region);
DbConnection dataConnection = CreateConnection(region);
if (!_connections.GetOrAdd(region, value: false))
{
lock (_connections)
{
if (!_connections.GetValueOrDefault(region))
{
dataConnection.Open();
_connections[region] = true;
}
}
}

Task dataTask = Task.Run(async delegate
{
try
{
_logger.LogDebug("Run Query {Query} with {Args}", fetchDataQuery2, param2);
return await dataConnection.QueryAsync(fetchDataQuery2, param2);
}
catch (Exception exception2)
{
_logger.LogWarning(exception2, "Error query {Region}", region);
return Array.Empty();
}
});
Task countTask;
if (!string.IsNullOrEmpty(countDataQuery2))
{
DbConnection countConnection = CreateConnection(region);
countTask = Task.Run(async delegate
{
try
{
_logger.LogDebug("Run Query {Query} with {Args}", countDataQuery2, param2);
return await countConnection.ExecuteScalarAsync(countDataQuery2, param2);
}
catch (Exception exception)
{
_logger.LogWarning(exception, "Error query {Region}", region);
return 0;
}
});
connections.Add(countConnection);
}
else
{
countTask = Task.FromResult(0);
}

connections.Add(dataConnection);
array[i] = new QTaskInfo(region, countTask, dataTask);
}

return array;
}
}



Edit 2: This is our comple "Lab" class we use to initialize all elements needed for the tests (maybe it helps):


Lab.cs:
public sealed class Lab
{

private readonly Faker _faker;
private readonly IdentityInfo _identity;
private readonly WebApplicationFactory _appFactory;
private readonly IApiClient _apiClient;
private readonly AuthorizeOptions _authorize;

private readonly Account[] _data;

private Lab(IdentityInfo identity, WebApplicationFactory appFactory, IApiClient apiClient, AuthorizeOptions authorize, Faker faker)
{
_faker = faker;
_identity = identity;
_appFactory = appFactory;
_apiClient = apiClient;
_authorize = authorize;

_data = [
CreateAccount("Account1", AccountTypes.Managed),
CreateAccount("Account2", AccountTypes.Managed),
CreateAccount("Account3", AccountTypes.Unmanaged),
CreateAccount("Account4", AccountTypes.Internal),
CreateAccount("Account5", AccountTypes.Hybrid),
CreateAccount("Account6", AccountTypes.Hybrid),
CreateAccount("Account7", AccountTypes.Hybrid),
CreateAccount("Account8", AccountTypes.Hybrid)
];
}

public Faker Faker => _faker;
public Account[] Jobs => _data;
public IdentityInfo Identity => _identity;
public IApiClient ApiClient => _apiClient;
public AuthorizeOptions Authorize => _authorize;
public WebApplicationFactory AppFactory => _appFactory;

public async Task InitAsync(IServiceProvider provider, bool useEvents = false)
{
var unitOfWork = provider.GetRequiredService();

//PopulateStatus(provider);
PopulateAccounts(provider, _data);
await unitOfWork.SaveChangesAsync();

EventSend? events = null;
if (useEvents)
Events.Capture(provider, events = new EventSend());

return events;

// ==============================================================================================================
static void PopulateAccounts(IServiceProvider provider, Account[] dataSample)
{
var accountRepository = provider.GetRequiredService();

IEnumerable data = dataSample;
accountRepository.AddRange(data.ToArray());
}
}

///
/// Create a lab with the requirement of this project
///
///
///
///
///
public static Lab Create(ITestOutputHelper output)
{
var appFactory = Vdc.Libs.AspNet.Testing.Setup.Factory(
out var client,
out var authorize,
out var identity,
out var faker,
role: $"{VdcSecurity.Role.Management},{VdcSecurity.Role.ManagementAdmin}",
output: output,
setup: services =>
{
services.AddScoped();
}
);
return new Lab(identity, appFactory, client, authorize, faker);
}

#region Private Methods
private Account CreateAccount(string accountName, AccountTypes typeId)
{
Account account;
var serializer = AppFactory.Services.GetRequiredService();
account = new Account
{
Id = Guid.NewGuid(),
Name = accountName,
CloudStackAccounts = new List(),
TypeId = typeId,
Order = 0
//Deleted = _faker.Date.Past(),
//SLID = _faker.Random.String2(6),
};
return account;
}
#endregion
}
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

07 July, 2024

Pass multiple arguments to single command in custom position xargs

 Programing Coderfunda     July 07, 2024     No comments   

I want execute a command where I have the args as single string but they need to be in a custom position. E.g. in the following example I want the args to be positioned before any fixed args that I have written after the cp comamnd i.e. the path argument /somedir


I want:
echo -n 'file1 file2 file3' | xargs -d ' ' -I{} cp {} /somedir



to behave like:
cp file1 file2 file3 /somedir



but it doesn't...


It also looks like when including the -I{} option, the -d option makes xargs behave differently. It seems like it tries to pass each argument to a separate command call rather than all of them toa single one.


For example, this works:
echo -n 'file1 file2' | xargs -d' ' diff



But this fails
echo -n 'file1 file2' | xargs -d' ' -I{} diff {}



With error:
diff: missing operand after 'file1'
diff: Try 'diff --help' for more information.
diff: missing operand after 'file2'
diff: Try 'diff --help' for more information.



How can I get echo -n 'file1 file2 file3' | xargs -d ' ' -I{} cp {} /somedir to behave as intended
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Problemas com a biblioteca customtkinter

 Programing Coderfunda     July 07, 2024     No comments   

enter image description here
Estou desenvolvendo um projeto para meu TCC sรณ que a biblioteca TKinter vem apresentando alguns bugs, muitas vezes tenho que apertar o botรฃo de login vรกrias vezes para realmente realizar o login, existe alguma alternativa para corrigir esse possรญvel bug.
#btn login
self.btn_login = ctk.CTkButton(self.frame_login, width=300, text='Login'.upper(), font=('Roboto bold', 16, 'bold'), corner_radius=15, command=self.verifica_login)
self.btn_login.grid(row=4, column=0, padx=10, pady=10)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Image not loading in HTML page when trying to change using GetElementByID method

 Programing Coderfunda     July 07, 2024     No comments   

I am attempting to write an simple function in an HTML page which displays the image and there are few buttons which change the image I have used the "document.getElementById('myImage').src= " command to change it but there is no image shows after I click the image. The same image is loading properly using the tag. The same button works if I use a link direct taken from google. Below I have pasted the code. Any suggestions are appreciated.





This page shows changing emotions using various buttons





Envy
Angry
Sad
Embarassed
Happy
Anxiety







Tried links from Google it works but local images does not work in the on click function Thank you!
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Weekly /r/Laravel Help Thread

 Programing Coderfunda     July 07, 2024     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

Laravel Livewire Filemanager

 Programing Coderfunda     July 07, 2024     No comments   

Hello there! I have created my first open source package! It's a simple and easy to use filemanager for your laravel apps!

It's still in development but any feedbacks and ideas are welcome !


https://github.com/livewire-filemanager/filemanager submitted by /u/bee-interactive
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

06 July, 2024

How to expand path to UNC including all server domain information?

 Programing Coderfunda     July 06, 2024     No comments   

I need to compare path strings, and can't work with any difference in the given information of an UNC path.


How to convert a path into the full UNC version, including server domain information, in Delphi?
thispath : String;

thispath := 'x:\testfolder_on_server';

thispath := ExpandUNCFIlename( thispath ) ; // '\\myserver\testfolder_on_server\'



But what I need is the UNC Path including all the domain information for my server path.
'\\myserver.local.commay\testfolder_on_server\'
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Temporary block when using Credential Manager to Sign in with Google

 Programing Coderfunda     July 06, 2024     No comments   

I'm testing the 'Sign in with Google' flow with Credential Manager by following the indications in the official docs. So far, the process works as intended: it shows a bottom sheet with the available accounts and it allows me to sign in to the selected account.


However, I observed that if I dismiss the bottom sheet 4 times in a row, the bottom sheet doesn't appear anymore and I get the following exception:
androidx.credentials.exceptions.NoCredentialException: During begin sign in, failure response from one tap: 16: [28436] Caller has been temporarily blocked due to too many canceled sign-in prompts.



That exception seems to come from the old 'One Tap' flow. As explained in the One Tap docs, "If a user cancels several prompts in a row, the One Tap client will not prompt the user for the next 24 hours".


Which leads to my question:


If a user who is trying to sign in into my app dismisses the credential prompt 4 times in a row (which I can easily see happening), what should I do? Telling them that they cannot use the app for 24 hours seems a bit excessive. Is there any alternative?


NOTE:


It's important to point out that the old GoogleSignInClient didn't have this limitation.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Laravel Breeze with PrimeVue v4

 Programing Coderfunda     July 06, 2024     No comments   

This is an follow up to my previous post about a "starter kit" I created with Laravel and PrimeVue components.

The project has been updated with the following new changes:

* Upgraded to Laravel 11
* Updated to use Laravel Breeze backend instead of Fortify (for the potential to abstract this project as a fork of laravel/breeze with custom stubs)
* Upgraded PrimeVue to v4 (overhauled theming and light/dark mode)
* Removed PrimeFlex and re-added Tailwind CSS for utility styling




Feedback is welcomed as a GitHub issue or PR, thanks!


https://github.com/connorabbas/primevue-auth-starter submitted by /u/DevDrJinx
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Is a back_insert_iterator valid for the lifetime of the container?

 Programing Coderfunda     July 06, 2024     No comments   

I think I know the answer to this, but I'd appreciate a sanity check.


Does iterator invalidation apply to std::back_insert_iterators?
#include
#include
#include

int main() {
auto v = std::vector{ 0, 1, 2 };
auto iter = std::back_inserter(v);
*iter++ = 3;
v.clear(); // invalidates iterators, but
*iter++ = 4; // back_insert_iterator is special?
assert(v.size() == 1 && v[0] == 4);
return 0;
}



This code works for me because the std::back_insert_iterator implementation from my vendor doesn't hold an iterator (or pointer or reference). It simply calls the container's push_back method.


But does the standard require that implementation? Could another vendor's back_insert_iterator hold and maintain a one-past-the-end iterator to use with a call to the container's insert method? It seems that would meet the requirements. This difference, of course, is that it would be vulnerable to invalidation.

---



I know cppreference.com is not authoritative, but it's more accessible than the standard.



[A vector's clear method] [i]nvalidates any ... iterators referring to contained elements. Any past-the-end iterators are also invalidated. [cppreference.com, emphasis added]



A std::back_insert_iterator could be the poster child of a past-the-end iterator.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

My first laravel package

 Programing Coderfunda     July 06, 2024     No comments   

Hi! I just released the v1 of my first laravel package. This is a very simple one, and I'm happy to receive some feedbacks.


https://github.com/nadlambino/laravel-uploadable

Thanks! submitted by /u/Environmental-Put358
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

05 July, 2024

Laravel AI Translator v1.0.0: Now with GPT ๐Ÿง , Smarter Pluralization, and More.

 Programing Coderfunda     July 05, 2024     No comments   

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

Preview canvas crashing because environmentObject not set properly

 Programing Coderfunda     July 05, 2024     No comments   

I have my preview canvas crashing because the environmentObject is not properly set.
The app itself builds and run properly.


Error message.


app crashed due to missing environment of type: TaskModel. To resolve this add .environmentObject(TaskModel(...)) to the appropriate preview.


My View with the #Preview macro looks like this.
struct CopyTaskListScreen: View {
@EnvironmentObject private var taskModel: TaskModel

var body: some View {
NavigationStack {
List(taskModel.tasks.sorted(by:
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

I don't compile C# tutorial with Matlab engine

 Programing Coderfunda     July 05, 2024     No comments   

I write a tutorial C# API with Matlab using matlab.engine.
(I want to exchange data between C# and Matlab. However, I cannot use the library when compiling. How to hide error?
My code here:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

using MathWorks.MATLAB.Engine;
using MathWorks.MATLAB.Exceptions;
using MathWorks.MATLAB.Types;
using System;

namespace MathWorks.MATLAB.Engine.ConsoleExamples
{
public class Program
{
public static void Main(string[] args)
{
Console.Write("Starting MATLAB... ");
using (dynamic matlab = MATLABEngine.StartMATLAB())
{
Console.WriteLine("done.");
double[] A = matlab.linspace(-5.0, 5.0);
int[] sz = new int[] { 25, 4 };
double[,] B = matlab.reshape(A, sz);
}
// Call when you no longer need MATLAB Engine in your application.
MATLABEngine.TerminateEngineClient();
}
}
}
namespace UDP_virtual
{
internal static class Program
{
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}




But I don't compile. I assume I don't add lib for C# file.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

sorting algorithm in O(n) according a specific condition

 Programing Coderfunda     July 05, 2024     No comments   

Given an array A with n−1 numbers where n = 2k
for some integer k. One of the values appears exactly n/2
another appears exactly n/4, and so on. More formally, for all 1 ≤ k ≤ log n exists a value that appears exactly n/2^k times in the array. Describe an algorithm that sorts A with a run time complexity of ฮ˜(n), and analyze its running time.
example: input: 5,1,2,1,2,2,2
output: 1,1,2,2,2,2,5


some important pointers:
1.the time comlexity should be Worst case
2.using a dictionary is not allowed
3.the solution should use a stack or other basic data structures


i tried using counting sort but it didnt work because the array doesnt contain values starting from 0 and up.
i also thought about using a hash map but the wanred time complexity would be expected and not worst case.
thanks for the help in advance
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

TALL Stack Boilerplate

 Programing Coderfunda     July 05, 2024     No comments   

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

04 July, 2024

๐Ÿš€ Laravel AI Translator v0.2.2: Now with Smarter AI that Understands Context & Pluralization!

 Programing Coderfunda     July 04, 2024     No comments   

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

Wrap tag in a new tag and add alt attribute to the

 Programing Coderfunda     July 04, 2024     No comments   

How do I replace with text:






with:






What is right regex to handle ?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

What rector rules do you use?

 Programing Coderfunda     July 04, 2024     No comments   

I have been playing around with Rector to ensure a more consistent codebase and there are a lot of rules to choose from. Additionally there's even a Laravel Rector package with more rules to choose from on top of that.

I am using a few, such as the early return rules and moving the property to the constructor as I think they're niceties but I'm interested in what rules the wider community uses.

All the rules seem like such good ideas but I'm not sure if it is wise to use them all, even if the application is pretty well tested. submitted by /u/TertiaryOrbit
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Unite JavaScript Power with Laravel & Inertia

 Programing Coderfunda     July 04, 2024     No comments   

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

Scramble 0.11.0 – Laravel API documentation generator update: Laravel Data support, ability to enforce schema types, inference improvements

 Programing Coderfunda     July 04, 2024     No comments   

submitted by /u/RomaLytvynenko
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Newer Posts Older Posts Home

Meta

Popular Posts

  • Credit card validation in laravel
      Validation rules for credit card using laravel-validation-rules/credit-card package in laravel Install package laravel-validation-rules/cr...
  • Write API Integrations in Laravel and PHP Projects with Saloon
    Write API Integrations in Laravel and PHP Projects with Saloon Saloon  is a Laravel/PHP package that allows you to write your API integratio...
  • iOS 17 Force Screen Rotation not working on iPAD only
    I have followed all the links on Google and StackOverFlow, unfortunately, I could not find any reliable solution Specifically for iPad devic...
  • C++ in Hindi Introduction
    C ++ เค•ा เคชเคฐिเคšเคฏ C ++ เคเค• เค‘เคฌ्เคœेเค•्เคŸ เค“เคฐिเคंเคŸेเคก เคช्เคฐोเค—्เคฐाเคฎिंเค— เคฒैंเค—्เคตेเคœ เคนै। C ++ เค•ो Bjarne Stroustrup เคฆ्เคตाเคฐा เคตिเค•เคธिเคค เค•िเคฏा เค—เคฏा เคฅा। C ++ เคฎें เค†เคจे เคธे เคชเคน...
  • Python AttributeError: 'str' has no attribute glob
    I am trying to look for a folder in a directory but I am getting the error.AttributeError: 'str' has no attribute glob Here's ...

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 (68)
  • 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 (2)
  • 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