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

02 February, 2024

Question regarding arrays and sequences in Java

 Programing Coderfunda     February 02, 2024     No comments   

I'm not sure on how to write this out in java code: "If the function is not null and the current index is less than the size, then the function array must agree with the field at the current index." It's listed as number six under wellFormed(). I just don't understand on how to check that the function array doesn't agree with the field at the current index, so i can throw a report. Thank you for the help !


This is the code that's relevant:




*
import java.util.function.Consumer;

/**

A Robot implemented with a dynamic array data structure

and providing "Sequence" capabilities. This is a homework assignment

inspired by Main: "Data Structures and Other Objects in Java" Chapter 3

(Sequence ADT). */



*
public class DynamicArrayPartSeq implements Robot, Cloneable { private static final int INITIAL_CAPACITY = 1;

// Data structure: Do not add or subtract from this: private String[] functions; private Part[] parts; private int size; private String function; private int currentIndex;

private static Consumer reporter = (s) -> System.out.println ("Invariant error: "+ s);

private boolean report(String error) { reporter.accept(error); return false; }

private boolean wellFormed() { // XXX: The invariant should be adjusted: no holes allowed // and it needs to check currentIndex and function

// 1. The "functions" and "parts" arrays must not be null.
// TODO
if (functions == null) {
return report("functions cant be null");
}
if (parts == null) {
return report("parts cant be null");
}

// 2. The "functions" and "parts" arrays are always the same length.
// TODO
if (functions.length != parts.length) {
return report ("functions and parts arrays should always bt the same length");
}

// 3. The size cannot be negative or greater than the length of the arrays.
// TODO
if (size < 0) {
return report ("size cant be negative");
}
if (size > functions.length) {
return report ("size can't be greater than functions length");
}
if (size > parts.length) {
return report ("size can't be greater than parts length");
}

// 4. None of the first “size” elements of either array can be null. (ie. no holes)
// TODO
if (size == 0) {
return report("first 'size' elements of either array cant be null");
}

// 5. The current index cannot be negative or greater than the size.
// TODO
if (currentIndex < 0) {
return report ("index cant be negative");
}
if (currentIndex > size) {
return report ("index cant be greater than the size");
}

// 6. If the function is not null and the current index is less than the size, then the
// function array must agree with the field at the current index.
// TODO
if (function != null && currentIndex < size) {

}

// If no problems discovered, return true
return true; }







I wrote out the first if regarding to check that the function isn't null and the current index is less than size. The second comment "function array must agree with the field at the current index" is throwing me off. I tried writing it as a second if statement inside the first, but I'm unsure on what to insert as the conditions.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

A simple statistic tool for Laravel apps

 Programing Coderfunda     February 02, 2024     No comments   

Hi folks,

a problem that I often face, when using analytic tools like Google Analytics oder Fathom Analytics is that they mostly show you data like visits, views, and page impressions. Everything beyond that, you need to integrate manually. That's why I started working on SimpleStats; it gives you KPIs like Reg, DAU, ARPU, ROI and much more out of the box, with a very simple installation!

The tool is not yet ready to launch and I don't know if anybody is interested in such a thing, but all tools I found out there, seem far to complicated to setup for me.

🚀 All you will need to do to get SimpleStats up and running is: Install a composer package, adjust the config to your needs, create an account, and add the token to your env file. Congrats, you're ready to analyze your campaigns and users!

📈 Here are a few of the KPIs that the tool provides: Registrations, Daily Active Users, New Active Paying Users, Average Revenue per User, Paying User, Revenue and much more. Everything filterable by date and UTMs!

🌟 Since the statistics tool and the composer client package are tailored precisely to Laravel, they can collect very interesting and important data without any additional complexity for you as the integrator of the package.

💻 Even though the composer client package is dedicated to Laravel, the API basically works with every client! So if you'd like to use the tool, even if you're not using Laravel, just trigger the API requests manually.

📍 Since the tool by default collects UTMs and Referrers for you and connects it with your users and their payments, it's super easy to see which of your marketing activities leads to revenue. You can simply analyze the ROI of your campaigns from the dashboard!

🛡️ We are fully committed to privacy compliance! No cookies are required or stored, ensuring your data remains confidential. You can rely on SimpleStats to respect your privacy and guarantee that your data will never be shared.

🏢 Collaborate by creating a team, inviting your co-workers to your projects, and assigning permissions to them. Each team is separated by tenancy, ensuring highly secure and robust data integration!

🎁 There will always be a free plan! If your business grows, you can support us with by subscribing. We would love to help you analyzing your campaigns. No need to enter credit card information at the registration.

​

📊 Feel free to checkout the current demo and hit that notify button to not miss the app launch:


https://simplestats.io

​

Thanks for reading.
I would love to here your feedback! submitted by /u/Nodohx
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

01 February, 2024

Function is not running as expected [duplicate]

 Programing Coderfunda     February 01, 2024     No comments   

I am a total novice with zero background in computer coding, teaching myself how to write code. I would be so grateful if someone who actually knows what they're doing would please be able to explain why my code below isn't working? Don't give me the solution, please. I want to know the reason why it's not doing what I expect it to do. Thank you so much in advance!
function getComputerChoice() {
return rock || paper || scissors, Math.floor(Math.random() * 3);
let rock = 0
let paper = 1
let scissors = 2
if (0) {
return "rock"
} else if (1) {
return "paper"
} else {
return "scissors"
}
}



I tried what I included above and I expected the log to bring up either rock, paper, or scissors but it's only bringing up the random number! I tried moving the variables to the beginning of the code but that made no difference in the results.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Why insertMany does not create ObjectIds in mongoose?

 Programing Coderfunda     February 01, 2024     No comments   

Currently I'm developing an APP using Node.JS and MongoDB. I'm trying to insert multiple documents with predefined _id s and some ObjectId arrays.
When I use insertMany all documents _id fields are strings instead of ObjectId. However when I use create and pass an array it works fine but instead of one query it performs separate query for each item of the array.


As it is obvious as the array grows it would be critical problem.


How can I use insertMany with the fields of type ObjectId instead of string?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

PHP 8.3 Performance Improvement with Laravel

 Programing Coderfunda     February 01, 2024     No comments   

Has anyone upgraded to PHP 8.3 and seen performance improvements? I'm curious to see how much improvement real-world apps get. According to these benchmarks they got a 38% improvement in requests/second.
https://kinsta.com/blog/php-benchmarks/ submitted by /u/ejunker
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Print from database using array but ignore certain columns on data

 Programing Coderfunda     February 01, 2024     No comments   

I have a code which copies a line of data and pastes it into another sheet as an array, if a cell has been marked which a particular value (x) & then prints.


At the minute it copies the entire line of data, however I need it to ignore certain cells along that line of data.
Sub AlterQuote()
Dim FormWks As Worksheet
Dim DataWks As Worksheet
Dim myRng As Range
Dim myCell As Range
Dim iCtr As Long
Dim myAddr As Variant
Dim lOrders As Long

Application.ScreenUpdating = False

Set FormWks = Sheets("Quote")
Set DataWks = Sheets("Quote Database")

myAddr = Array("G9", "G10", "G11", "G12", "C14", "C15", "C16", "C17", "C18", "C19", "C20", "C21", "B25", "C25", "D25", "E25", "F25", "G25", "H25", "I25", "H38", "I38", "B26", "C26", "D26", "E26", "F26", "G26", "H26", "I26", "H39", "I39", "B27", "C27", "D27", "E27", "F27", "G27", "H27", "I27", "H40", "I40", "B28", "C28", "D28", "E28", "F28", "G28", "H28", "I28", "H41", "I41", "B29", "C29", "D29", "E29", "F29", "G29", "H29", "I29", "H42", "I42", "I30", "H31", "H32", "H33", "H43", "I43", "H44", "H45", "H46", "D57", "D58", "D59", "D60")

With DataWks
Set myRng = .Range("B3", _
.Cells(.Rows.Count, "B").End(xlUp))
End With

For Each myCell In myRng.Cells
With myCell
If IsEmpty(.Offset(0, -1)) Then
Else

.Offset(0, -1).ClearContents

For iCtr = LBound(myAddr) _
To UBound(myAddr)
FormWks.Range(myAddr(iCtr)).Value _
= myCell.Offset(0, iCtr).Value
Next iCtr

End If
End With
Next myCell

MsgBox "quote can now be altered on Quote Sheet"

Application.ScreenUpdating = True

End Sub




I know it's within this line With DataWks Set myRng = .Range("B3", _ .Cells(.Rows.Count, "B").End(xlUp)) End With but I can't get it to work
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Numbers with either comma or dot as separator : handle in front or back ?

 Programing Coderfunda     February 01, 2024     No comments   

Hi

My app is used by users that are either using comma or dot as a decimal separator.

The laravel backend is expecting a DOT as a number separator, because of "number" rule in form requests, and because of mysql.

The frontend is a Vue SPA app.

I've tried to change the validator rule so numbers are both accepted as "dot" or "comma" serapated, but then the DB complains about comma numbers !

So, I was wondering what should be the best practice : should the frontend ensure that numbers containing comma are replaced with dots before sending the SAVE call, or should it be handled on backend ? submitted by /u/Napo7
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

31 January, 2024

.Net Maui-Can't set my appicon as the push notification small icon for Android

 Programing Coderfunda     January 31, 2024     No comments   

I am trying to implement firebase push notifications on my .Net Maui app. When I try to set my appicon as the smallicon of the notification it is not recognised.code snippet


This is working in xamarin.forms. Can anyone please help me with this?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to properly use prefetch instructions?

 Programing Coderfunda     January 31, 2024     No comments   

I am trying to vectorize a loop, computing dot product of a large float vectors. I am computing it in parallel, utilizing the fact that CPU has large amount of XMM registers, like this:

__m128* A, B;
__m128 dot0, dot1, dot2, dot3 = _mm_set_ps1(0);
for(size_t i=0; i
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

swiftui list - snap scrolling

 Programing Coderfunda     January 31, 2024     No comments   

i have a fullscreen list of element.

VStack{
List {
ForEach(books, id: \.id) { book in
Text(book.title)
.background(Color.yellow) // text background
.listRowBackground(Color.blue) // cell background
}
.frame(height: UIScreen.main.bounds.height)
}

}
.background(Color.red)
.edgesIgnoringSafeArea(.all)




Is possible to snap every cell on top when scrolling? I have no idea how to do this.



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

MIME type for msgpack?

 Programing Coderfunda     January 31, 2024     No comments   

msgpack seems to be an extremely fast, if extremely new format for data serialisation. Does it have a recognised MIME type yet? If not, what should be used in the interim?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Laravel Pulse monitor multiple domains

 Programing Coderfunda     January 31, 2024     No comments   

Hello all,

Is Laravel Pulse able to track multiple domains ? I am running Pulse on a Laravel application and this works nice. Seeing slow queries and exceptions (glad not to many :D ).

However I have multiple Laravel applications, can those application report to a single Pulse installation so that I can see all errors / slow queries etc in a single dashoard ? This gives me a single entry for overviewing issues. Or are there other tools that can archive this.

I know that Sentry etc excists, but as above projects are "hobby" projects, I prefer something free / selfhosted on the server. That's why I like Pulse :) submitted by /u/Noaber
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

30 January, 2024

Laravel + php logo

 Programing Coderfunda     January 30, 2024     No comments   

Hey everyone, not to complain or anything regarding laravel, i find it to be the best framework out there and i use it daily! Has anyone created some sort of a combination of the php elephant logo and the laravel logo? If so, please show your work! submitted by /u/chrisJarrell
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Unrecognized options while configuring newlib

 Programing Coderfunda     January 30, 2024     No comments   

I'm trying to build newlib with the ARM option "mno-unaligned-access. I downloaded and built the GNU ARM toolchain from the gcc-arm-none-eabi-10.3-2021.10-src.tar.bz2 package on ARM's website. Then I navigated to the newlib directory and attempted to rebuild newlib with "mno-unaligned-access" but I'm getting an unrecognized error when configuring:



$ ../newlib/configure --mno-unaligned-access --enable-newlib-io-
long-long --enable-newlib-io-c99-formats --enable-newlib-reent-check-verify --enable-newlib-register-fini --enable-newlib-retargetable-locking --disable-newlib-supplied-syscalls --disable-nls --target=arm-none-eabi --prefix=/usr/local/test/newlib
configure: error: unrecognized option: --mno-unaligned-access' Try ../newlib/configure --help' for more information.



Looking at the config.log file, I believe the issue is that the target is set to "x86_64-linux-gnu" in the configure script even though the target passed is "arm-none-eabi". "mno-unaligned-access" is not an option for "x86_64-linux-gnu".



configure:2297: checking build system type
configure:2311: result: x86_64-pc-linux-gnu
configure:2358: checking host system type
configure:2371: result: x86_64-pc-linux-gnu
configure:2391: checking target system type
configure:2404: result: arm-none-eabi
configure:2458: checking for a BSD-compatible install
configure:2526: result: /usr/bin/install -c
configure:2537: checking whether ln works
configure:2559: result: yes
configure:2563: checking whether ln -s works
configure:2567: result: yes
configure:2574: checking for a sed that does not truncate output
configure:2638: result: /bin/sed
configure:2647: checking for gawk
configure:2663: found /usr/bin/gawk
configure:2674: result: gawk
configure:4117: checking for gcc
configure:4133: found /usr/bin/gcc
configure:4144: result: gcc
configure:4373: checking for C compiler version
configure:4382: gcc --version >&5
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


configure:4393: $? = 0
configure:4382: gcc -v >&5
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.12' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu




Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.12)
configure:4393: $? = 0
configure:4382: gcc -V >&5
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:4393: $? = 1
configure:4382: gcc -qversion >&5
gcc: error: unrecognized command line option '-qversion'
gcc: fatal error: no input files
compilation terminated.
configure:4393: $? = 1
configure:4413: checking for C compiler default output file name
configure:4435: gcc -g -O2 -mno-unaligned-access conftest.c >&5
gcc: error: unrecognized command line option '-mno-unaligned-access'
configure:4439: $? = 1



Is there anything I could do to rebuild newlib with the ARM option specified? Do I new to rebuild the GCC toolchain with "arm-none-eabi" specified as the target?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Is this proper semantic html?

 Programing Coderfunda     January 30, 2024     No comments   

I'm making a component for a website where I need to make a checklist with the different W3C guidelines. I currently use a form as a parent element with an article and different details/summary elements inside but I feel like this is not correct semantic HTML. Outside of the component I already use a and so I'm not worried about that. I just feel like I'm using the and elements wrong.

{#each principe.richtlijnen as richtlijn}


Richtlijn {richtlijn.index}


{richtlijn.titel}



{#each richtlijn.succescriteria as succescriterium}




Criteria {succescriterium.index} ({succescriterium.niveau})


{succescriterium.titel}



e.id === succescriterium.id)}
/>


{@html richtlijn.uitleg.html}

{/each}

{/each}




This is the current live link for the component:
https://dry-checklist-vervoerregio.vercel.app/ (It's the only component live because it's a school project).


Can anyone help me make my HTML more semantic?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Dive into the Streamlined Directory Structure in Laravel 11

 Programing Coderfunda     January 30, 2024     No comments   

---



We think you’ll love the fresh skeleton you start with in a Laravel 11 app that is coming out next week! Newcomers will appreciate the minimalism, and experienced developers upgrading will not experience breaking changes in how a typical Laravel application is structured.


If you want to follow along and experiment, you can create a Laravel 10 and Laravel 11 project side by side. We used the following commands to do so:
# Update the installer
composer global update laravel/installer -W

cd path/to/projects

# Create a Laravel 10 app
laravel new laravel-10-app -n --git --pest

# Crate a Laravel 11 app
laravel new laravel-11-app --dev -n --git --pest



On the surface, the project directory structure looks identical:





However, if you start diving into the subdirectories, the file count has dropped from a fresh Laravel 11 installation by ~ 69 files:
# Fresh Laravel v10 app
$ find . -type f -not -path "./vendor/*" | wc -l
=> 217

# Fresh Laravel v11 app (as of 01/29/2024)
$ find . -type f -not -path "./vendor/*" | wc -l
=> 148



Let's review the most significant updates and see how they compare to a Laravel 10 application so you can be ready for the changes coming to fresh Laravel 11 apps.


The app Directory




The app directory has been slimmed down tremendously, moving the nine middleware that ships with Laravel into the framework and out of the project. Typically, these middleware are not heavily customized, and Laravel 11 will provide other methods to customize built-in middleware and add your own middleware.



The app directory in a fresh Laravel 11 app


Middleware changes are done through the bootstrap/app.php file, which is, according to Taylor Otwell, a “lean routes-esque style file for configuring Laravel” that looks like the following:
return Application::configure(basePath: dirname(__DIR__))
->withProviders()
->withRouting(
web: __DIR__.'/../routes/web.php',
// api: __DIR__.'/../routes/api.php',
commands: __DIR__.'/../routes/console.php',
// channels: __DIR__.'/../routes/channels.php',
health: '/up',
)
->withMiddleware(function (Middleware $middleware) {
//
})
->withExceptions(function (Exceptions $exceptions) {
//
})->create();



You could add an application middleware by adding something like the following in the withMiddeware() closure:
$middleware->web(append: \App\Http\Middleware\ExampleMiddleware::class);



The Kernel.php files are no longer in the Laravel project, and these are handled through the framework bootstrap/app.php file.


You might have also noticed that the Controllers directory only includes one Controller class that doesn’t extend from anything. It’s up to you how you’d like to extend your controllers (or not), but it provides a default abstract Controller class.


The config Directory




The biggest shock for you might be the updated config directory, which has…nothing inside of it (other than the .gitkeep file). You will, however, notice that many more configuration options exist in the .env.example file.





If you want to publish any given configuration file from the framework to customize it, you can do so via the config:publish command:
# config/database.php
php artisan config:publish database

# config/logging.php
php artisan config:publish logging

# Or publish all of them
php artisan config:publish



You are free to only extend the configuration values you care about, and they will be merged with the framework’s defaults so you don’t have to keep all published configuration options in a given file.


Suppose you want to look up configuration values in the framework-shipped configuration. In that case, you can use the Artisan config:showcommand, publish the config, or look it up in the config/logging.php file within the Laravel vendor folder:
php artisan config:show logging

cat vendor/laravel/framework/config/logging.php



The database Directory




The database directory is roughly the same. However, you’ll notice that the migration filenames are prefixed in a way that does not represent a given date but keeps them in order as needed. The create_personal_access_tokens.php migration file is no longer in the project. Personal access tokens are only required if you build an API, which we will cover in the routes directory changes.



Also, the database.sqlite file will be installed by default unless you pick a different database option when creating a new Laravel project.


The routes Directory




The routes directory was also slimmed down only to include the web.php and the console.php routes files. If you want to create an API or use the broadcasting functionality, you can install them via artisan:
php artisan install:api
php artisan install:broadcasting



Those commands will bring in the required migrations, JavaScript, and configuration files. What’s nice about this is that applications that don’t need broadcasting or API routes don’t have to worry about these unnecessary files being in the project.



Laravel 11 routes directory


The test Directory




The test/ directory no longer includes the CreatesApplication trait in Laravel 11 projects. If you upgrade your Laravel 10 project, you can remove this trait, as it’s now provided as part of the base TestCase from the framework.





In a Laravel 10 project, the only thing included in the base TestCase class in Laravel 10 is the CreatesApplication trait, which bootstraps the application when creating a fresh application as part of the setup before each test. You can safely remove this trait (and its usage) once you upgrade existing apps to Laravel 11.


Learn More




If you want to learn more about Laravel 11, check out our Laravel 11 post with all the details on this exciting new release.



The post Dive into the Streamlined Directory Structure in Laravel 11 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

Handling Errors with Third-Party APIs

 Programing Coderfunda     January 30, 2024     No comments   

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

29 January, 2024

Linker Error: how to work with clang library?

 Programing Coderfunda     January 29, 2024     No comments   

I am currently working on a C++ project involving the Clang library for code tokenization. After installing the Clang library using apt-get install, I proceeded to set up my project's CMakeLists.txt for building. However, I've run into linking issues that I am seeking assistance to resolve. I am in deep despair :'(
/usr/bin/ld: cannot find -lLLVMX86AsmPrinter
/usr/bin/ld: cannot find -lLLVMX86Utils
/usr/bin/ld: cannot find -lLLVMipa
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [CMakeFiles/goodcommit.dir/build.make:97: goodcommit] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/goodcommit.dir/all] Error 2
make: *** [Makefile:91: all] Error 2



here is my CMakeLists.txt file:
cmake_minimum_required(VERSION 3.22)

project(goodcommit)

set(CMAKE_CXX_STANDARD 17)

set(CMAKE_C_COMPILER "clang")
set(CMAKE_CXX_COMPILER "clang++")

set(LLVM_PATH /usr/lib/llvm-14)
link_directories(${LLVM_PATH}/lib)
include_directories(${LLVM_PATH}/include)

add_definitions(
-D__STDC_LIMIT_MACROS
-D__STDC_CONSTANT_MACROS
)

# Use llvm-config to get compilation flags
execute_process(
COMMAND llvm-config --cxxflags
OUTPUT_VARIABLE LLVM_CXX_FLAGS
OUTPUT_STRIP_TRAILING_WHITESPACE
)

# Use llvm-config to get linking flags
execute_process(
COMMAND llvm-config --ldflags
OUTPUT_VARIABLE LLVM_LD_FLAGS
OUTPUT_STRIP_TRAILING_WHITESPACE
)

# Set the compilation flags
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LLVM_CXX_FLAGS}")

# Set the linking flags
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LLVM_LD_FLAGS}")

set(SOURCE_FILE main.cpp)
add_executable(goodcommit ${SOURCE_FILE})

target_link_libraries(goodcommit
clangFrontend
clangSerialization
clangDriver
clangParse
clangSema
clangAnalysis
clangAST
clangBasic
clangEdit
clangLex
clangTooling
LLVMX86AsmParser
LLVMX86Desc
LLVMX86AsmPrinter
LLVMX86Info
LLVMX86Utils
LLVMipo
LLVMScalarOpts
LLVMInstCombine
LLVMTransformUtils
LLVMipa
LLVMAnalysis
LLVMTarget
LLVMOption
LLVMMCParser
LLVMMC
LLVMObject
LLVMBitReader
LLVMCore
LLVMSupport
-lgit2
)



I have tried following the steps of building llvm project but it doesn't seem to lead anywhere! Plus my header




doesn't seem to be recognized.
Does anyone know how to solve this ?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Return cells that contain numbers with recurring digits

 Programing Coderfunda     January 29, 2024     No comments   

I have a large dump of data containing in which column A has TOTAL AMOUNTS. In column B, I'd like Excel to simply say "yes" or "no" if the cell contains a number that has any digit recurring 4 times or more consecutively.
For example: if a cell contains the number 38,353.03 this would bring "no"
For example: if a cell contains the number 3,404,444 this would bring "yes"


I tried a formula using LOOKUP(SUMPRODUCT(LARGE(FREQUENCY(--MID(
but that was a disaster


so I'm at a loss
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Imcremental data import in Power BI Desktop table

 Programing Coderfunda     January 29, 2024     No comments   

In my Power BI desktop model, I have a fact table with 10 million rows.
Every day, I need to add (import) 600,000 new rows to this fact table inside Power BI desktop from SQL server data warehouse.
My concern is how can I incrementally import these new data and add it to the already existing one in my Power BI Desktop model.
Simply refresh data will read every day all the 10 million rows which will be time consuming.


I tried to modify the M code of the fact table to get new rows after a specific date but this solution completely erase the already 10 million rows of the fact table in Power BI Desktop.


Below my M code
let
Source = Sql.Database("10.Xx.Xx.Xx", "MY_DB"),
dbo_fact_table = Source{[Schema="dbo",Item="fact_table"]}[Data],
filteredRows = Table.SelectRows(dbo_fact_table, each [date] >= StartDate)

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

How do I fix the health check issue when deploying rails application on Digital Ocean

 Programing Coderfunda     January 29, 2024     No comments   

This is my first try at deploying a Rails application on digital ocean but each time I try to deploy the application I get a health check error.


The build stage is successful:





But it fails when it gets to the deployment stage and there are no details on this error in the logs.





I tried checking the error logs but instead the server appears to be running.





What i have tried so far:




*

Switched between the scheduled HTTP or TCP under health check in digital ocean.



*

Confirmed if the droplet is live:









Used the rails build pack to create a new application in the droplet:


::: Current build pack::::
Custom Build Command v0.1.2
Procfilev 0.0.4
Ruby: v1.244.3
::::::::::::::::::::::::::::::::


Setup the correct environment variables for the app on the digital ocean console.
RAILS_MASTER_KEY=..correct key ommited deliberately..
RACK_ENV=development
RAILS_ENV=development
RAILS_LOG_TO_STDOUT=enabled
RAILS_SERVE_STATIC_FILES=enabled
SECRET_KEY_BASE=key correct ommited deliberately..



In addition,I am currently on the basic plan which should allow me to deploy a rails application and i also tried setting the app level environment variables but they are were overriden by the env i initially setup when creating a new app.





My setup:




*

Ruby and Rails versions:


ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-darwin20]
Rails 7.1.3


*

platform configs in gemfile:


gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]
group :development, :test do
gem 'debug', platforms: %i[mri mingw x64_mingw]
end (edited)






The App Platform Error Code Reference stipulates that this issue is caused by *



the container not responding to health checks. If a health check is
failing, that means that external traffic is not reaching my service
at the expected HTTP route



*.How do ensure external traffic is reaching my service to resolve this if this is the solution?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Error : Error getting access token for service account: Remote host terminated the handshake, iss

 Programing Coderfunda     January 29, 2024     No comments   

I'm using below Java snippet to get the Authentication token for Firebase Messaging. But its throwing error during refreshIfExpired method call.


Java code:
private static String getAccessToken() throws IOException {
String[] SCOPES = {"
https://www.googleapis.com/auth/firebase.messaging"}; />
GoogleCredentials googleCredentials = GoogleCredentials.fromStream(new FileInputStream("./src/service-account.json")).createScoped(Arrays.asList(SCOPES));
//googleCredentials.refresh();
try {
googleCredentials.getAuthenticationType();
googleCredentials.refreshIfExpired();
} catch (IOException e) {
e.printStackTrace();
}

return googleCredentials.getAccessToken().getTokenValue();
}




Cause: javax.net.ssl.SSLHandshakeException: Remote host terminated the handshake.

Detailed Error: Error getting access token for service account: Remote host terminated the handshake, iss: firebase-adminsdk-jnf15@



Are these errors related to jars or certificates? As per Firebase documentation, they did not mentioned anything related to Certificates.your text


Java Snippet code from documentation link :
https://firebase.google.com/docs/cloud-messaging/migrate-v1#use-credentials-to-mint-access-tokens />

The getAccessToken() method was shared in Google Firebase API documentation and same was used by uploaded certain jars which are required.


This service supposed to return the Access Token which will be used in subsequent service as Bearer token to send the Notifications to devices in REST API call. But this service is not working as expected and returning error.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

08 January, 2024

Synchronised Environment Variables

 Programing Coderfunda     January 08, 2024     No comments   

I currently have about 4 server instances og a Laravel app all running on separate digital ocean droplets.

I've been thinking of a way to cndtaliswd my environment variables and keep it synchronised across all the servers because I've been doing a lot of updates recently and it's very likely to miss one or two servers.

Is this a problem anyone has faced before and how did you go around it? submitted by /u/_1017e_
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Laravel Pulse cards to show response times, scheduled jobs, broken links

 Programing Coderfunda     January 08, 2024     No comments   

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

The current state of Laravel Herd

 Programing Coderfunda     January 08, 2024     No comments   

Is Laravel Herd going open source or are there plans to monetize it?

i've been looking for something like WAMP on MacOS and it seems Herd is the closest one.

However the fact that it's:

* Not open source ( Developer tools are mostly open source, devs like to know that the software running on their machines is validated by the community. Also it can easily be forked when the need arises )
* No clear monetization strategy ( I assume it not being open source means there are plans to monetize it in the future but this has not been communicated)
* Hasn't been updated in 3 months
* No clear roadmap




For the reasons above, I'm skeptical about the longevity of the project. submitted by /u/MobyFreak
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

07 January, 2024

How to comprehensively evaluate the performance of an arm CPU?

 Programing Coderfunda     January 07, 2024     No comments   

I would like to conduct a comprehensive performance evaluation of the newly launched Nvidia Grace Superchip, including the following three aspects:



* Capabilities at the microarchitecture level, such as integer computing capability, floating-point computing capability, etc.

* Higher level capabilities, such as memory access latency, memory bandwidth limits, frequency fluctuations, etc.

* Actual operation situation, typical benchmark operation of computationally intensive or memory intensive workload






I wonder if there are sound and authoritative test suites, workloads, or methodologies for these three aspects?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Force number to text in R

 Programing Coderfunda     January 07, 2024     No comments   

For a system I am using, it requires the input format to be text even though the value is integer. In SQL, this is forced by using the following method:
variable_x = '"' + 5 + '"'



How do I do this in R? I tried as.character. But when I write out the data, the quote is missing.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Weekly /r/Laravel Help Thread

 Programing Coderfunda     January 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

Flutter-When i am changing value in respiratoryRate case and there i applied a setState after that i want to rebuild 'issue' case

 Programing Coderfunda     January 07, 2024     No comments   

var _respiratoryRate=0;

switch (cardioVascularWidget.key) {
case 'respiratoryRate':
VitalComponent? respiratoryRate = widget
.cardiovascularFormModel?.cardiovascularAssessment?.respiratoryRate;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
CustomInputTextFormField(
titleText: respiratoryRate?.title ?? "",
hintText: respiratoryRate?.hintText ?? "",
trailingInputUnitText: respiratoryRate?.suffixValue ?? "",
isTitleRequired: true,
isTitleMandatory: true,
onEnteredValue: (value) {
setState(() {
_respiratoryRate = value;
});
},
),
],
);
case 'issue':
Issue? issue =
widget.cardiovascularFormModel?.cardiovascularAssessment?.issue;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TitleMandatoryWidget(isMandatory: false, title: '${issue?.title}'),
Text('$_respiratoryRate'),
],
);
}



In the switch case, you can see there I have a case 'respiratoryRate' in which have CustomInputTextFormField it return value inside onValueChange then i apply a

setState(() { _respiratoryRate = value ; });
and other switch case is 'issue' is there, i want to rebuild issues case
Anyone please help me
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Filtering Pivot Field using VBScript

 Programing Coderfunda     January 07, 2024     No comments   

I'm trying filter the field "Ödeme_Tarihi" by yesterday's date. Standart Autofilter didn't work.


enter image description here


I tried below code but it gives that error;
enter image description here


Code;
Dim oExcel
Dim myPivotField
Dim PvtItm

Function CnvTr(str)
str = Replace(str, "İ", ChrW(304))
str = Replace(str, "ı", ChrW(305))
str = Replace(str, "Ç", ChrW(199))
str = Replace(str, "ç", ChrW(231))
str = Replace(str, "Ğ", ChrW(286))
str = Replace(str, "ğ", ChrW(287))
str = Replace(str, "Ö", ChrW(214))
str = Replace(str, "ö", ChrW(246))
str = Replace(str, "Ş", ChrW(350))
str = Replace(str, "ş", ChrW(351))
str = Replace(str, "Ü", ChrW(220))
str = Replace(str, "ü", ChrW(252))
CnvTr = str
End Function

Set oExcel = CreateObject("Excel.Application")

oExcel.Visible = True
oExcel.DisplayAlerts = False
oExcel.AskToUpdateLinks = False
oExcel.AlertBeforeOverwriting = False

Set oWorkbook = oExcel.Workbooks.Open("C:\\RobustaDocs\\OdemeListesi.xlsx")
Set myPivotField = oWorkbook.WorkSheets(2).PivotTables("PivotTable1").PivotFields(CnvTr("\[Workbook\].\[Ödeme_Tarihi\]"))

oWorkbook.RefreshAll
myPivotField.ClearAllFilters
myPivotField.VisibleItemsList = Array(CnvTr("\[Workbook\].\[Ödeme_Tarihi\].&\[5.01.2024\]"))

Set myPivotField = Nothing
Set PvtItm = Nothing
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Newer Posts Older Posts Home

Meta

Popular Posts

  • 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...
  • 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...
  • 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 ++ में आने से पह...
  • Send message via CANBus
    After some years developing for mobile devices, I've started developing for embedded devices, and I'm finding a new problem now. Th...

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

  • 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