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

04 November, 2023

How to integrate prerender.io into react app

 Programing Coderfunda     November 04, 2023     No comments   

"I'm currently developing a React app in which the implementation of meta descriptions and OG meta tags is crucial. I'm working on blog pages where the content is dynamically generated from the database based on the URL's slug parameter. I'm using react-helmet to handle dynamic meta tags, but I've encountered an issue where I can't share the URL with other websites to ensure that the OG tags appear correctly.


I've researched the documentation for prerender.io, but I couldn't find a guide for implementing it with React. If anyone has experience implementing prerender.io with React, I would greatly appreciate your assistance."


I attempted to implement dynamic meta tags for blog pages in my React app using react-helmet. I expected that by doing so, the meta descriptions and OG (Open Graph) meta tags would be correctly set for each blog post, making it shareable on other websites and social media platforms. However, I encountered a limitation where sharing the URL with other websites didn't display the OG tags correctly, leading to issues when sharing blog posts.


I also explored the documentation for prerender.io to see if it could potentially address this issue, but I couldn't find a specific guide or example for integrating it with a React application.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

'Cannot find type in scope' error when access public enum as class variable in swift

 Programing Coderfunda     November 04, 2023     No comments   

how can I use enum under extension into another class? I have no problem to use it under function directly. However I got 'Cannot find type '.home' in scope' error when set as a variable
extension Color {

public enum ColorUsage {
case home([String])
case school([String])
case park([String])

var description: String {
switch self {
case .home: return "my home"
case .school: return "kid school"
case .park: return "family park"
}
}

func getValue() -> [String] {
switch self {
case .home(let value),
.school(let value),
.park(let value):
return value
}
}
}

func findColor(places: [ColorUsage]) {
for eachPlace in places {
...
}
}
}

class MyClass {
func useColor() {
let places = [.home(["home1", "home2"]), .school(["AAA", "BBB"]), .park(["you park", "his park"])] /// issue with 'Cannot find type '.home' in scope'
let places = Color.findColor(places: places)

let places = Color.findColor(places: [.home(["home1", "home2"]), .school(["AAA", "BBB"]), .park(["you park", "his park"])]) /// no issue
}
}
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

AttributeError: 'NoneType' object has no attribute 'config' while True loop

 Programing Coderfunda     November 04, 2023     No comments   

Nothing I try works. I'm trying to change the config of a button within a function called by the button.
from tkinter import *

root= Tk()
# window config here
btn = Button(root, text="Start", command="toggle").pack()

def toggle():
if btn.config('text')[-1] == 'Start':
btn.config('text')[-1] == 'Stop'
elif btn.config('text')[-1] == 'Stop':
btn.config('text')[-1] == 'Start'

while btn.config('text')[-1] == 'Stop': # Error throws here
print('click')

root.mainloop()



It keeps throwing AttributeError: 'NoneType' object has no attribute 'config' regarding commented line
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Where should I store images with deployment on Vercel using nextjs

 Programing Coderfunda     November 04, 2023     No comments   

I have a portal which I have recently expanded to include a real estate offer. At the moment I still save all images in /public/assets/images. I don't think it's best practice to save all the images there. At least a user upload hasn't happened yet. Where and how would you store the assets?


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

03 November, 2023

Showing Direction Arrow on Line in Mapboxgl

 Programing Coderfunda     November 03, 2023     No comments   

Trying to show a arrow as indication of direction in mapboxgl. The arrow is only visible at high zoom and is not visible at low zooms.



Adding a image Layer with 'symbol-placement': 'line'



Line Layer

map.addLayer({
'id': 'route',
'type': 'line',
'source': 'mapSource',
'filter': ['==', '$type', 'LineString'],
'layout': {
'line-join': 'round',
'line-cap': 'round'
},
'paint': {
'line-color': '#3cb2d0',
'line-width': {
'base': 1.5,
'stops': [[1, 0.5], [8, 3], [15, 6], [22, 8]]
}
}
});




Arrow Layer

const url = 'img/arrow.png'
map.loadImage(url, (err, image) => {
if (err) { return; }
map.addImage('arrow', image);
map.addLayer({
'id': 'arrowId',
'type': 'symbol',
'source': 'mapSource',
'layout': {
'symbol-placement': 'line',
'symbol-spacing': 1,
'icon-allow-overlap': true,
// 'icon-ignore-placement': true,
'icon-image': 'arrow',
'icon-size': 0.045,
'visibility': 'visible'
}
});
});




No Arrow at low zoom







Arrow showing at high zoom







I have tried experimenting with symbol-spacing, but it didn't work.
Is there way to force mapbox to show arrow on low zoom?



jsfiddle.net/4jjmh2nb
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

GCP static website hosting via bucket does not serve configured error and index pages

 Programing Coderfunda     November 03, 2023     No comments   

I'm trying to serve a simple static React SPA through GCP bucket as described here:
https://cloud.google.com/storage/docs/hosting-static-website />

It is crucial for my structure that for /my_directory, the file /my_directory/index.html is served.


I think what I want is exactly described here in the "Three-object bucket" in the documentation


This is my config:





This is my file structure:





In the folder test_2023_11_03_c there is a file "index.html"


But it doesn't work.


For



*
https://storage.googleapis.com/my-bucket-name, I expect to get the main index.html served. However, instead I get a list of all files in the bucket.

*
https://storage.googleapis.com/my-bucket-name/something-that-doesnt_exist, I expect the content of my_error.html to be served. However, instead I get NoSuchKeyThe specified key does not exist.No such object: my-bucket-name/something-that-doesnt_exist

*
https://storage.googleapis.com/my-bucket-name/test_2023_11_03_c, I expect the content of the directory's index.html to be served. However, instead I get the same error: NoSuchKeyThe specified key does not exist.No such object: my-bucket-name/test_2023_11_03_c






What am I doing wrong?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

PHP Input Stream Truncated at 8192 bytes

 Programing Coderfunda     November 03, 2023     No comments   

I'm working on a project on Symfony 3 as an API and Angular as a front (This is not relevant i think but hey).



When some datas are sent through a PUT request to the server, the data are truncated at 8192 bytes.



I checked for every file configurations (apache files, even cli file, .htacces file... but can't seem to find the issue.)



Weirdest thing, is the issue is on the dev server, the same request on the production server works (all the 18 000~ bytes are sent correctly), so i even tried to take the production server's php configuration file, but even that failed. Just to add on the information, the server runs on php 7.



I'm at a loss, what could i have missed ?



I'm pretty sure the issue comes from a configuration file, or a knowledge i'm missing. So help would be greatly appreciated.



Thanks.



Edit: After a bit of forcing... Here is a .tar.gz containing the files requested:




https://files.fm/u/ddghdx36
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Error: Can't determine type for tag '?attr/shapeAppearanceCornerSmall

 Programing Coderfunda     November 03, 2023     No comments   

* What went wrong:
Execution failed for task ':app:mergeReleaseResources'.






C:\Users\Rahul.gradle\caches\transforms-3\4ccff20ef7c231e6ca175cf84e24aa03\transformed\material-1.9.0\res\values\values.xml: Error: Can't determine type for tag '?attr/shapeAppearanceCornerSmall'




* Try:







Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.




* Get more help at
https://help.gradle.org />





Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.


You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.


See
https://docs.gradle.org/7.6.2/userguide/command_line_interface.html#sec:command_line_warnings />

Execution optimizations have been disabled for 1 invalid unit(s) of work during this build to ensure correctness.


I am getting the above error when I am trying to build the apk


I have tried to upgrade gradle but its still showing the same problem and "implementation 'com.google.android.material:material:1.6.0'" also added this code in build.gradle its still not working.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Django query sum decimal based on column

 Programing Coderfunda     November 03, 2023     No comments   

I trie to find a solution to summary fields depended on a row. In the database the SQL would be:


Database:
ACCOUNT | LIMIT | MARKET | LENDING | BALANCE
----------------------------------------------
1000010 | 200.00 | 0.00 | -234.55 | 1000.00
1000010 | 300.00 | 11.00 | 0.00 | -239.00
1000010 | -200.00 | 235.00 | -134.00 | 450.00
1000011 | 30.00 | 1.00 | -10.00 | -98.00
1000011 | -200.00 | 235.00 | -134.00 | 49.00



SQL statements:
SUM(LIMIT) as bond_limit,
SUM(MARKET) as market_value,
SUM(LENDING) as lending_value,
SUM(case when BALANCE > 0 then BALANCE else 0 end) as FREE,
SUM(case when BALANCE < 0 then BALANCE else 0 end) as MISS



This should be the result:
ACCOUNT | LIMIT | MARKET | LENDING | BOND_LIMIT | MARKET_VALUE | LENDING_VALUE | FREE | MINUS
1000010 | 200.00 | 0.00 | -234.55 | Sum(LIMIT) | Sum(MARKET) | Sum(LENDING) | Sum(BALANCE) or 0
1000010 | 300.00 | 11.00 | 0.00 | Sum(LIMIT) | Sum(MARKET) | Sum(LENDING) | Sum(BALANCE) or 0
1000010 | -200.00 | 235.00 | -134.00 | Sum(LIMIT) | Sum(MARKET) | Sum(LENDING) | Sum(BALANCE) or 0
1000011 | 30.00 | 1.00 | -10.00 | Sum(LIMIT) | Sum(MARKET) | Sum(LENDING) | Sum(BALANCE) or 0
1000011 | -200.00 | 235.00 | -134.00 | Sum(LIMIT) | Sum(MARKET) | Sum(LENDING) | Sum(BALANCE) or 0

erg = database.objects.filter(
account=ACCOUNT
).aggregate(
bond_limit=Sum('LIMIT'),
market_value=Sum('MARKET'),
lending_value=Sum('LENDING')
)

.filter(bond_number=bond_number).aggregate(bond_limit=Sum('LIMIT')
^^^^^^^^^^^
NameError: name 'bond_number' is not defined

erg.filter(BALANCE__gt=0)...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

02 November, 2023

C++ STL Pririty Queue

 Programing Coderfunda     November 02, 2023     No comments   

Trying to do:


#include
#include \

using namespace std;

int main()

{

vector* V = new std::vector();

V[0].push_back(1);
V[0].push_back(2);
V[1].push_back(3);
V[1].push_back(4);
V[2].push_back(5);

priority_queue pq1;

return 0;

}



Getting following error:


/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/queue:425:22: error: type 'std::priority_queue::container_type' (aka 'std::vector *') cannot be used prior to '::' because it has no members
typedef typename container_type::value_type value_type;
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Cycle inside ; building could produce unreliable results: Xcode Error

 Programing Coderfunda     November 02, 2023     No comments   

I am trying to move to the new build system when compiling with Xcode 10. However, it gives the following error:
Cycle details:
→ Target 'project' : LinkStoryboards

Target 'project' has compile command with input '/Users/project/Commons/Components/ScreenshotSharing/ViewController/AppShare.storyboard'

Target 'project' : ValidateEmbeddedBinary /Users/project/Xcode/DerivedData/project-hgqvaddkhmzxfkaycbicisabeakv/Build/Products/Debug-iphoneos/project.app/PlugIns/stickers.appex

Target 'project' has process command with input '/Users/project/Resources/Info.plist'

Target 'project' has compile command with input '/Users/project/Commons/Components/ScreenshotSharing/ViewController/AppShare.storyboard'






Even after removing the problem file, I get the same for another xib/storyboard. How can I solve this error without reverting to the legacy build system?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How compare char (or wchar_t) as part of string in c++

 Programing Coderfunda     November 02, 2023     No comments   

I have two C-style null-terminated (wide)strings (not std::wstring) and I go through them by iterators and want to compare them char by char (for sorting). I don't need to use standard operators (==, >,
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to set MediaPlayerElement source in code in C++ in WinUI3?

 Programing Coderfunda     November 02, 2023     No comments   

I am working on a simple project using WinUI3 in C++, and I want to set MediaPlayerElement source in code. Microsoft provide the answers, but it is in c# as following code shows.
MediaPlayerElement mediaPlayerElement1 = new MediaPlayerElement();
mediaPlayerElement1.Source = MediaSource.CreateFromUri(new Uri("ms-appx:///Media/video1.mp4"));
mediaPlayerElement1.AutoPlay = true;



So how to set the media source in code in C++? (the source is like this: "rtsp://198.145.2.56")
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

iOS 17 Force Screen Rotation not working on iPAD only

 Programing Coderfunda     November 02, 2023     No comments   

I have followed all the links on Google and StackOverFlow, unfortunately, I could not find any reliable solution Specifically for iPad devices.


I am using the sample code from Kodeco UISplitViewController. You can download the source code from here and add a UIButton.


I added a Button and added a code for WindowScene RequestGeometryUpdate function.


So, please I need help to Rotate iPad Screen when Pressed on Button. I have attached Error Console Message when pressed on a Button.


Your help will be greatly appreciated.
@IBAction func btnSelector(_ sender: Any) {
self.rotateToLandsScapeDevice()
}

func rotateToLandsScapeDevice(){

let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene
if #available(iOS 16.0, *) {
windowScene?.requestGeometryUpdate(.iOS(interfaceOrientations: .landscapeLeft), errorHandler: { error in
print("Error", error)
})
self.setNeedsUpdateOfSupportedInterfaceOrientations()
} else {
// Fallback on earlier versions
UIDevice.current.setValue(UIInterfaceOrientation.landscapeLeft.rawValue, forKey: "orientation")
UIView.setAnimationsEnabled(true)
}

}



Error Console Message
Error Domain=UISceneErrorDomain Code=101 "The current windowing mode
does not allow for programmatic changes to interface orientation."
UserInfo={NSLocalizedDescription=The current windowing
mode does not allow for programmatic changes to interface orientation.}
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

01 November, 2023

7 Tips for Adding a Second Server to your App

 Programing Coderfunda     November 01, 2023     No comments   

---



Adding a second server to your app can be a great way to improve your app's performance and/or increase its reliability. However, there are a couple of things you need to keep in mind when adding a second server.


In this article, we'll discuss the key things you need to consider when adding an additional server to your app. We’ll use a Laravel hosted in Laravel Forge as the example here, but the concepts can be applied to any kind of application, not even limited to the PHP language.


Current infrastructure




First, to make sure we are speaking the same language, this is the outline of the current infrastructure. This app is currently running on a server created by Laravel Forge and running on AWS.



* Lets Encrypt for the SSL certificate;

* Redis (installed on the machine) for sessions, caching and as the queue driver for storing and processing background jobs;

* MySQL (installed on the machine) as the database;

* Local folder for saving user uploaded content;

* Laravel Scheduler using server’s CRON every minute;

* Deployments are manually triggered by clicking Laravel Forge’s “Deploy now” button;






1. Load balancer




The first thing you will need is a load balancer. This will be the entrypoint of your application, meaning you will point your domain DNS to the load balancer instead of the server directly. The job of a load balancer is, as you guessed, to balance the incoming requests between all the healthy and registered servers.





From now on, every time we mention “App Server”, this will be referring to a single server running our Laravel application.


One of the nice features of a load balancer is the health checks, which serve the purpose of making sure that all connected servers are healthy. If one of the servers fails for some reason, some unscheduled maintenance for example, the load balancer will stop routing requests to that server until the server is up, running, and healthy again.


We recommend using the application load balancer, which gives more robust functionality down the road, if you need it. Application load balancers can route traffic to specific servers based on the requested URL and even route requests to multiple applications. For now, we will have it evenly balance traffic using the round robin method.


Since your domain will now be pointing to the load balancer, your SSL certificate should also be in the load balancer now, instead of in your servers.


2. Database (MySQL), cache & queue (Redis)




Currently, there is one server running our app, local instances of MySQL, and Redis. What happens when the second gets attached to our load balancer?


Having multiple sources of truth for our database and caching layers could generate all kinds of issues. With multiple databases, the user would be registered in one server but not the other. With one Redis instance per server, you could be logged in into App Server 1, but when the load balancer redirects you to App Server 2 you would have to sign in again, since your session is stored in the local Redis instance.


We could make App Server 2, or any future App Servers connected to our load balancer, connect to App Server’s 1 services, but what happens when App Server 1 has to go down for maintenance or it unexpectedly fails? One of the reasons to add a second server is to have more reliability and scalability, which does not solve our problem.


The ideal scenario, when we have multiple app servers, is to have external services like MySQL and Redis running in a separate environment. To achieve this, we can use managed services, like AWS RDS, for databases and AWS Elasticache for Redis or unmanaged services, meaning we are going to set up a separate server to run those services ourselves. Managed services are usually a better option if cost is not an issue since you don’t have to worry about OS and softwares upgrades, and they usually have a better security layer.


Let’s imagine we decided to go with managed services for our application. Our Laravel configuration would become similar as this:
-DB_HOST=localhost
+DB_HOST=app-database.a2rmat6p8bcx7.us-east-1.rds.amazonaws.com
-REDIS_HOST=localhost
+REDIS_HOST=app-redis.qexyfo.ng.0001.use2.cache.amazonaws.com



After everything is set up, our infrastructure would look like this when connecting our App Servers to our services.





3. User uploaded content




Our application allows users to upload a custom profile picture, which shows up when you are logged in. On our current infrastructure, images get saved in an internal folder in our application and also get served from there. Now that we have multiple App Servers, this would be an issue, since the images uploaded in the App Server 1 will not be present on the second server.


There are a few ways to solve this. One of them is to have a shared folder between your servers (Amazon EFS, for example). If we choose this option, we would have to configure a custom filesystem in Laravel which would point to this shared folder location on our App Servers. While a valid option, this requires some knowledge to set up the disk on the servers, and for every new server you set up, you would have to configure the shared folder again.


We usually prefer using a Cloud Object Storage service instead, like Amazon S3 or Digital Ocean Spaces. Laravel makes it really easy to work with these services, if you are using the File Storage options. In this case, you would only have to configure your filesystem disk to use S3, and upload all your previous user uploaded content to a bucket.
-FILESYSTEM_DISK=local
+FILESYSTEM_DISK=s3 

AWS_ACCESS_KEY_ID=your-key
AWS_SECRET_ACCESS_KEY=your-secret-access-key
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=your-bucket-name



All your user uploaded content will be stored in the same, centralized bucket. S3 has built in versioning, multiple layers of redundancy and any additional app servers we add to our load balancer can use the same bucket to store content.





If your application grows in the future, you can set up AWS Cloudfront, which acts as a CDN layer sitting on top of your S3 bucket, serving your bucket content faster to your users and often cheaper than S3.


4. Queue workers




In step 2, we set up a centralized Redis server, which is the technology we were using to manage our application queues. This will also work for our load balanced applications, but there are a few good options to explore.


If you continue to process your queues on your app servers leveraging the centralized Redis instance, no changes need to be made. The jobs will get picked up by the server that has a worker available to process a job.


Another option is to use a service like AWS SQS, which can relieve some pressure on your Redis instance as your application grows by offloading that workload to another service.


5. Scheduled commands




When running multiple servers behind a load balancer, scheduled commands would run on each server attached to your load balancer by default, which is not optimal. Not only would running the same command multiple times be a waste of processing power, but could also cause data integrity issues depending on what that command does


Laravel has a built-in way to handle this scenario so that your scheduled commands only run on a single server by chaining a onOneServer() method.
$schedule->command('report:generate')
->daily()
->onOneServer();



Using this method does require the use of a centralized caching server, so Step 2 is critical to making this work.


6. Deployment




When it comes to deploying your application, you now have so many options and things to consider.


We can still deploy our applications using our previous approach, but now we have to make sure we remember to click the deploy button on both servers. If we forget, we would have our servers running different versions of the application, which could cause huge issues.


With multiple servers, it’s probably time to level up the deployment strategy. There are some very good deployment tools and services out there, like Laravel Envoyer or PHP Deployer. These types of tools and services allow you to automate the deployment process across multiple servers, so you can remove human error from the equation.


If we want to go one level deeper in our deployment process, since we now have 2 app servers, one of the great benefits is that we can temporarily remove one of the servers from the load balancer, and that server will stop receiving requests. This allows us to have zero downtime deployment, where we remove the first server from the load balancer, deploy the new code, put it back into the load balancer, remove the second one and do the same process again. Once server 2 is finished, both servers will have the new code and will be attached to the load balancer. To achieve this, we would use tools like AWS CodeDeploy, but the setup is more complex than our previous options.


Deployment is a very important process of our applications, so if we can automate the deployment using Github Actions or any CI/CD services out there, we are greatly improving the process. Making the deployment process simple and where anyone can trigger a deployment really shows the maturity of the development team and the application.





7. Network & security




One additional benefit we have with the use of a load balancer is that our servers are not the entrypoint of our websites anymore. This means we can only have our servers be internally accessible and/or restricted by specific IPs (our IPs, Load Balancer IPs, etc). This greatly improves the security of our servers since they are not directly accessible. The same can (and should) be done for our database and cache clusters.


To achieve this, we are going to only allow traffic to port 22 from our own IPs (so we can SSH into the server) and we are going to only allow traffic to port 80 from the load balancer, so it can send requests to the server. The same rules apply for our database and cache clusters.


Final thoughts




There are a lot of things to consider when adding additional servers to your infrastructure. It adds more complexity to your infrastructure and workflows, but it also increases the reliability and scalability of your application as well as improves your overall security.


When considered from the beginning of the process, these recommendations are simple to implement and can have a large impact on improving your app.



The post 7 Tips for Adding a Second Server to your App 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

31 October, 2023

CUDA Compute SM Throughput improvement for multiple loops

 Programing Coderfunda     October 31, 2023     No comments   

I'm interested in exploring different approaches to enhance the Compute (SM) Throughput of a CUDA code. It would be great to discuss with individuals having a good understanding of CUDA optimizations. To ensure a fruitful exchange and better comprehension, I kindly request that you also share code or algorithm snippets. If you are not familiar with CUDA optimizations, please feel free to disregard this request. Thank you!


First, let me describe the serial code. In the C code provided below, within both the first and second loops, we calculate 655 by 655 independent determinants. We then utilize weighted contributions to perform a summation over the second loop. The determinants are computed using LU decomposition. Ultimately, the objective is to compute the weighted contributions of these determinants.
I want to know which parallelization implementation would be better. That is, if there are multiple for loops, which loop should I consider for block and thread computation for time efficiency?


I have provided the details of these loops in the code below.
read_index(ind, ind_u, ind_d); // generates index for qc, det_store used later
int U=6;

for (it = 1; it < 64; it++) { // first loop, can be serial run
double sum1 = 0.0;
double sum2 = 0.0;

for (ii = 0; ii < 24*24*24; ii++) { // second loop, can be made parallel in blocks; values 24^3, 32^3, 48^3, 96^3}

read_qc(qc); // generates 4D qc array, different with each ii; size 3 * 3 * 4 * 4

int al[U], a[U], ap[U], alp[U]; // U=6
double _Complex A[U][U],AL[U][U],AU[U][U];
double _Complex det_store[655][655];

// every 655*655 has a A[6][6]
// det store [655][655]

int i,j,k,l;
for (i = 0; i < 655; i++) { //idx parallelize no dependency on above

for (k = 0; k < U; k++) { // al[k=U=6][i=655]
al[k] = ind[i][k]; //
a[k] = ind[i][k + U];
}

for (j = 0; j < 655; j++) { //jdx

for (k = 0; k < U; k++) {
alp[k] = ind[j][k];
ap[k] = ind[j][k + U];
}

for (k = 0; k < U; k++) {
for (l = 0; l < U; l++) {
A[k][l] = qc[a[k]][al[k]][ap[l]][alp[l]]; //Assigning the matrix element
}
}

Calculating the determinant using LU decomposition and storing them
LU_Decomposition(A, AL, AU);
det_store[i][j] = calculate_determinant(AU);
}
}

double _Complex temp;
//Uses above compute det
//
for (i = 0; i < 2716; i++) { //
for (j = 0; j < 2716; j++) { //
temp = weight[i]
* weight[j]
* det_store[ind_u[i]][ind_u[j]]
* det_store[ind_d[i]][ind_d[j]]; //combining the stored determinants using info from comb_he4.txt files
sum1 = sum1 + creal(temp);
sum2 = sum2 + cimag(temp);
}
}

}
printf("%d\t%.16E\t%.16E\n", it, sum1, sum2);
}



I am exploring various ideas and code snippets for an efficient implementation with minimal time stamp. If you can suggest improvements to LU_Decomposition functions with some CUDA libraries, that would also be helpful. Here is the LU_Decomposition function
void LU_Decomposition(double _Complex A[U][U], double _Complex L[U][U], double _Complex Up[U][U]) {
for (int i = 0; i < U; i++) {
// Upper Triangular Matrix
for (int k = i; k < U; k++) {
double _Complex sum = 0;
for (int j = 0; j < i; j++) {
sum += (L[i][j] * Up[j][k]);
}
Up[i][k] = A[i][k] - sum;
}

// Lower Triangular Matrix
for (int k = i; k < U; k++) {
if (i == k) {
L[i][i] = 1; // The diagonal elements of L are 1
} else {
double _Complex sum = 0;
for (int j = 0; j < i; j++) {
sum += (L[k][j] * Up[j][i]);
}
L[k][i] = (A[k][i] - sum) / Up[i][i];
}
}
}
}



I have parallelized the code mentioned above using CUDA by implementing a global kernel called gpu_sum. This kernel stores the reduced sum values for each iteration of the second loop, as described in the preceding C code. Below is the CUDA kernel
__global__ void gpu_sum(cuDoubleComplex *d_tqprop,
cuDoubleComplex *d_sum_nxyz,
int *d_deg_ind_up, int *d_deg_ind_down, float *d_deg_ind_weight,
int *d_ind, cuDoubleComplex *d_xdet){

int tid = threadIdx.x;
// int bid = blockIdx.x;
int gid = blockIdx.x;// * blockDim.x + threadIdx.x;

cuDoubleComplex sumA, temp_sumA, temp_sum;
cuDoubleComplex x1, x2, x3;

x3 = make_cuDoubleComplex(0.0,0.0);
temp_sum = make_cuDoubleComplex(0.0,0.0);
temp_sumA = make_cuDoubleComplex(0.0,0.0);

int start = 0;
int tx, k;
// int a[UP];
// int al[UP];

cuDoubleComplex d_A[UP*UP], d_UA[UP*UP], d_LA[UP*UP];
cuDoubleComplex detA;

curandState state;
curand_init(clock64(), tid, 0, &state);

__shared__ double sh_sum_re[SHMEM_SIZE];
__shared__ double sh_sum_im[SHMEM_SIZE];

int min_tx_det = (tid) * LOOP_DET_COUNT;
int max_tx_det = (tid + 1) * LOOP_DET_COUNT;

// int ap[UP];
// int alp[UP];
int alp[CHI_COUNT][DET_COUNT];
// int ap[UP][DET_COUNT];

for (int loopj = 0; loopj < DET_COUNT; loopj++) {
for (int i = 0; i < CHI_COUNT; i++) {
// ap[i][loopj] = d_ind[loopj * CHI_COUNT + i + UP];
alp[i][loopj] = d_ind[loopj * CHI_COUNT + i];
}
}

int index_det = 0;

for (tx = min_tx_det; tx < max_tx_det; tx++) {

if(tx < DET_COUNT){

// for (int i = 0; i < UP; i++) {
// a[i] = d_ind[tx * CHI_COUNT + i + UP];
// al[i] = d_ind[tx * CHI_COUNT + i ];
// }

for (int loopj = 0; loopj < DET_COUNT; loopj++) {

// for (int i = 0; i < UP; i++) {
// ap[i] = d_ind[loopj * CHI_COUNT + i + UP];
// alp[i] = d_ind[loopj * CHI_COUNT + i ];
// }

for (int i = 0; i < UP; i++) {
for (int j = 0; j < UP; j++) {

index_det = d_ind[tx * CHI_COUNT + i + UP] * DCD
+ d_ind[tx * CHI_COUNT + i] * CD
+ d_ind[loopj * CHI_COUNT + j + UP] * DDIM
+ d_ind[loopj * CHI_COUNT + j];

// index_det = alp[i+UP][tx]*DCD + alp[i][tx]*CD + alp[j+UP][loopj]*DDIM + alp[j][loopj];
// d_A[i*UP + j] = d_tqprop[gid * CDCD + a[i]*DCD + al[i]*CD + ap[j]*DDIM + alp[j]];
d_A[i*UP + j] = d_tqprop[gid * CDCD + index_det];
// d_A[i*UP + j] = d_tqprop[gid * CDCD + a[i]*DCD + al[i]*CD + ap[j][loopj]*DDIM + alp[j][loopj]];
// d_A[i*UP + j] = d_tqprop[gid * CDCD + alp[i+UP][tx]*DCD + alp[i][tx]*CD + alp[j+UP][loopj]*DDIM + alp[j][loopj]];
}
}

dev_LUD(d_A, d_LA, d_UA);
d_xdet[gid * DET_COUNT * DET_COUNT + tx * DET_COUNT + loopj] = dev_DET_LUD(d_UA);
}
}
}

__syncthreads();

int min_tx_sum = (tid) * LOOP_COUNT_DEG_INDEX;
int max_tx_sum = (tid + 1) * LOOP_COUNT_DEG_INDEX;

if (min_tx_sum < DEG_INDEX_COUNT) {

if (max_tx_sum > DEG_INDEX_COUNT) {
max_tx_sum = DEG_INDEX_COUNT;
}
for (tx = min_tx_sum; tx < max_tx_sum; tx++) {
if (tx >= DEG_INDEX_COUNT) {break;}

for (int loopj = 0; loopj < DEG_INDEX_COUNT; loopj++) {
x1 = d_xdet[gid * DET_COUNT * DET_COUNT + d_deg_ind_up[tx] * DET_COUNT + d_deg_ind_up[loopj]] *
d_xdet[gid * DET_COUNT * DET_COUNT + d_deg_ind_down[tx] * DET_COUNT + d_deg_ind_down[loopj]];
temp_sum = x1 * make_cuDoubleComplex(d_deg_ind_weight[tx] * d_deg_ind_weight[loopj], 0.0) + temp_sum;
}
}
}

// if (gid == 0) {
// printf("temp_sum:%d\t %d\t %f \t %f\n", gid, tid, cuCreal(temp_sum), cuCimag(temp_sum));
// }

sh_sum_re[tid] = cuCreal(temp_sum);
sh_sum_im[tid] = cuCimag(temp_sum);
__syncthreads();

// Perform block reduction in shared memory
for (int s = blockDim.x / 2; s > 0; s >>= 1) {
if (tid < s) {
sh_sum_re[tid] += sh_sum_re[tid + s];
sh_sum_im[tid] += sh_sum_im[tid + s];
}
__syncthreads();
}

if (tid == 0) {
d_sum_nxyz[gid] = make_cuDoubleComplex(sh_sum_re[tid], sh_sum_im[tid]);
}

}



Here are some nsight-compute profiling results:
----------------------- ------------- ------------
Metric Name Metric Unit Metric Value
----------------------- ------------- ------------
DRAM Frequency cycle/nsecond 9.27
SM Frequency cycle/nsecond 1.44
Elapsed Cycles cycle 122692065
Memory Throughput % 27.62
DRAM Throughput % 27.62
Duration msecond 85.00
L1/TEX Cache Throughput % 23.78
L2 Cache Throughput % 21.30
SM Active Cycles cycle 113862083.87
Compute (SM) Throughput % 7.37
----------------------- ------------- ------------

WRN This kernel grid is too small to fill the available resources on this device, resulting in only 0.1 full
waves across all SMs. Look at Launch Statistics for more details.



My grid consists of 64 blocks, with each block containing 64 threads. However, when I increase the grid size, both the compute streaming multiprocessor (SM) throughput decreases and the time taken increases.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

30 October, 2023

Is there a way to use awk to count the number of rows between 2 flags and input that number into a specific field?

 Programing Coderfunda     October 30, 2023     No comments   

I have a set of data that consists of seismic wave travel times and their corresponding information (i.e. source that produced the wave and the time for that wave arriving at each geophone along the spread). I am trying to format the data to fit my code in order to do some tomography using the data, but I'm still relatively new to awk. I am at a point where I need to now insert the number of receivers for each shot/source into the line of shot/source information, but its a variable amount each time. Is there a way to have awk count the number of rows and insert that into the proper field?


My data is formatted like the following.


Each line that documents a source/shot:


s 0.01 0 0 -1 0


Every other line that follows the source/shot information:
r 0.1 0 0 1.218 0.01
r 0.15 0 0 1.214 0.01
r 0.2 0 0 1.213 0.01




I can use the "s" as a flag for the shot lines, and I would like to count the number of "r" lines for each source/shot and insert that number into the corresponding "s" line.


The number of "r" lines for each "s" line varies greatly.


Given this sample input:
s 0.01 0 0 -1 0
r 0.1 0 0 1.218 0.01
r 0.15 0 0 1.214 0.01
r 0.2 0 0 1.213 0.01
s 1.01 0 0 -1 0
r 0.05 0 0 1.159 0.01
r 0.1 0 0 1.127 0.01
r 0.15 0 0 1.106 0.01
r 0.2 0 0 1.115 0.01
r 0.25 0 0 1.107 0.01



The expected output is:
s 0.01 0 3 -1 0
r 0.1 0 0 1.218 0.01
r 0.15 0 0 1.214 0.01
r 0.2 0 0 1.213 0.01
s 1.01 0 5 -1 0
r 0.05 0 0 1.159 0.01
r 0.1 0 0 1.127 0.01
r 0.15 0 0 1.106 0.01
r 0.2 0 0 1.115 0.01
r 0.25 0 0 1.107 0.01



Note the 3 as $4 in the first s line and the 5 as $4 in the second one.


The counted number of rows should be in the 4th column of each "s" line (asterisks here).


My experience with awk is limited to just rearranging/indexing columns, so I don't really know where to begin with this. I've tried googling help with awk, but it's very difficult to find answered awk questions that actually pertain to my specific situation (hence why I have decided to ask it myself).


I'm also new to using stackoverflow, so if I need to include more example data, please let me know. My data consists of approximately 4000 lines.


EDIT: The reason the desired result has slightly different data to the example of my data is because there are hundreds of lines for each "s" line and including that in the question seems excessive. I have cut out the majority of the data for ease of reading.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

29 October, 2023

I am new in springboot, i am getting error while working on sts

 Programing Coderfunda     October 29, 2023     No comments   

I am using Jpa repository in the code, and my code looks like this.


com.example.demo ->
package com.example.demo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;

@SpringBootApplication
@EntityScan("com.example.demo.model")
public class DemoApplication {

public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}

}



com.example.demo.controller ->
package com.example.demo.controller;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.example.demo.model.Employee;
import com.example.demo.service.EmployeeService;
//@Controller
@RestController //@controller+@ResponseBody
public class EmployeeController {
@Autowired
private EmployeeService eService;
// @RequestMapping(value = "/employees",method = RequestMethod.GET)
// @ResponseBody
@GetMapping("/employees")
public List getEmployees() {
return eService.getEmployees();
}
@GetMapping("/employee/{id}")
public String getEmployee(@PathVariable Long id) {
return "Details for: "+id;
}
@PostMapping("/employees")
public String saveEmployee(@RequestBody Employee employee) {
return "Saving employee details to the db "+ employee;
}
@PutMapping("/employee/{id}")
public Employee updateemployee(@PathVariable Long id, @RequestBody Employee employee) {
System.out.print("Update details for"+id);
return employee;
}
@DeleteMapping ("/employee")
public String deleteEmployee(@RequestParam Long id) {
return "Details for: "+id;
}
}



com.example.demo.model ->
package com.example.demo.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name="tbl_employee")
public class Employee {

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name="id")
private Long id;

@Column(name="name")
private String name;

@Column(name="age")
private Long age;

@Column(name="location")
private String location;

@Column(name="email")
private String email;

@Column(name="department")
private String department;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Long getAge() {
return age;
}
public void setAge(Long age) {
this.age = age;
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
@Override
public String toString() {
return "Employee [name=" + name + ", age=" + age + ", location=" + location + ", email=" + email
+ ", department=" + department + "]";
}
public String getDepartment() {
return department;
}
public void setDepartment(String department) {
this.department = department;
}
}



com.example.demo.repository ->package com.example.demo.repository;
import org.springframework.data.jpa.repository.JpaRepository;

import org.springframework.stereotype.Repository;

import com.example.demo.model.Employee;

*@Repository*

public interface EmployeeRepository extends JpaRepository\ {

}



com.example.demo.service ->enter image description here(interface) enter image description here(Implementation)


pom file ->


4.0.0

org.springframework.boot
spring-boot-starter-parent
3.1.5


com.example
demo
0.0.1-SNAPSHOT
demo
Demo project for Spring Boot

17



org.springframework.boot
spring-boot-starter-web



org.springframework.boot
spring-boot-starter-test
test


org.springframework.boot
spring-boot-starter


org.springframework.boot
spring-boot-devtools
runtime
true



org.springframework.boot
spring-boot-starter-data-jpa



com.mysql
mysql-connector-j
runtime


javax.persistence
javax.persistence-api
2.2






org.springframework.boot
spring-boot-maven-plugin








Here I am just trying to return an empty list via(@GetMapping("/employees")) but it is showing error like below
[2m2023-10-29T12:19:17.956+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mcom.example.demo.DemoApplication [0;39m [2m:[0;39m Starting DemoApplication using Java 17.0.8.1 with PID 5216 (C:\Users\parit\Documents\demo\target\classes started by parit in C:\Users\parit\Documents\demo)
[2m2023-10-29T12:19:17.959+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mcom.example.demo.DemoApplication [0;39m [2m:[0;39m No active profile set, falling back to 1 default profile: "default"
[2m2023-10-29T12:19:18.003+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36m.e.DevToolsPropertyDefaultsPostProcessor[0;39m [2m:[0;39m Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
[2m2023-10-29T12:19:18.003+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36m.e.DevToolsPropertyDefaultsPostProcessor[0;39m [2m:[0;39m For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
[2m2023-10-29T12:19:18.732+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36m.s.d.r.c.RepositoryConfigurationDelegate[0;39m [2m:[0;39m Bootstrapping Spring Data JPA repositories in DEFAULT mode.
[2m2023-10-29T12:19:18.785+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36m.s.d.r.c.RepositoryConfigurationDelegate[0;39m [2m:[0;39m Finished Spring Data repository scanning in 44 ms. Found 1 JPA repository interfaces.
[2m2023-10-29T12:19:20.254+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mo.s.b.w.embedded.tomcat.TomcatWebServer [0;39m [2m:[0;39m Tomcat initialized with port(s): 8080 (http)
[2m2023-10-29T12:19:20.264+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mo.apache.catalina.core.StandardService [0;39m [2m:[0;39m Starting service [Tomcat]
[2m2023-10-29T12:19:20.264+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mo.apache.catalina.core.StandardEngine [0;39m [2m:[0;39m Starting Servlet engine: [Apache Tomcat/10.1.15]
[2m2023-10-29T12:19:20.339+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mo.a.c.c.C.[Tomcat].[localhost].[/] [0;39m [2m:[0;39m Initializing Spring embedded WebApplicationContext
[2m2023-10-29T12:19:20.340+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mw.s.c.ServletWebServerApplicationContext[0;39m [2m:[0;39m Root WebApplicationContext: initialization completed in 2337 ms
[2m2023-10-29T12:19:20.452+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mcom.zaxxer.hikari.HikariDataSource [0;39m [2m:[0;39m HikariPool-1 - Starting...
[2m2023-10-29T12:19:20.756+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mcom.zaxxer.hikari.pool.HikariPool [0;39m [2m:[0;39m HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@36041206
[2m2023-10-29T12:19:20.758+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mcom.zaxxer.hikari.HikariDataSource [0;39m [2m:[0;39m HikariPool-1 - Start completed.
[2m2023-10-29T12:19:20.803+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mo.hibernate.jpa.internal.util.LogHelper [0;39m [2m:[0;39m HHH000204: Processing PersistenceUnitInfo [name: default]
[2m2023-10-29T12:19:20.895+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36morg.hibernate.Version [0;39m [2m:[0;39m HHH000412: Hibernate ORM core version 6.2.13.Final
[2m2023-10-29T12:19:20.898+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36morg.hibernate.cfg.Environment [0;39m [2m:[0;39m HHH000406: Using bytecode reflection optimizer
[2m2023-10-29T12:19:21.277+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mo.s.o.j.p.SpringPersistenceUnitInfo [0;39m [2m:[0;39m No LoadTimeWeaver setup: ignoring JPA class transformer
[2m2023-10-29T12:19:21.659+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mo.h.e.t.j.p.i.JtaPlatformInitiator [0;39m [2m:[0;39m HHH000489: No JTA platform available (set 'hibernate.transaction.jta.platform' to enable JTA platform integration)
[2m2023-10-29T12:19:21.665+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mj.LocalContainerEntityManagerFactoryBean[0;39m [2m:[0;39m Initialized JPA EntityManagerFactory for persistence unit 'default'
[2m2023-10-29T12:19:21.792+05:30[0;39m [33m WARN[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mConfigServletWebServerApplicationContext[0;39m [2m:[0;39m Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'employeeController': Unsatisfied dependency expressed through field 'eService': Error creating bean with name 'employeeServiceImpl': Unsatisfied dependency expressed through field 'eRepository': Error creating bean with name 'employeeRepository' defined in com.example.demo.repository.EmployeeRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Not a managed type: class com.example.demo.model.Employee
[2m2023-10-29T12:19:21.793+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mj.LocalContainerEntityManagerFactoryBean[0;39m [2m:[0;39m Closing JPA EntityManagerFactory for persistence unit 'default'
[2m2023-10-29T12:19:21.796+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mcom.zaxxer.hikari.HikariDataSource [0;39m [2m:[0;39m HikariPool-1 - Shutdown initiated...
[2m2023-10-29T12:19:21.804+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mcom.zaxxer.hikari.HikariDataSource [0;39m [2m:[0;39m HikariPool-1 - Shutdown completed.
[2m2023-10-29T12:19:21.805+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mo.apache.catalina.core.StandardService [0;39m [2m:[0;39m Stopping service [Tomcat]
[2m2023-10-29T12:19:21.816+05:30[0;39m [32m INFO[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36m.s.b.a.l.ConditionEvaluationReportLogger[0;39m [2m:[0;39m

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
[2m2023-10-29T12:19:21.834+05:30[0;39m [31mERROR[0;39m [35m5216[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mo.s.boot.SpringApplication [0;39m [2m:[0;39m Application run failed

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'employeeController': Unsatisfied dependency expressed through field 'eService': Error creating bean with name 'employeeServiceImpl': Unsatisfied dependency expressed through field 'eRepository': Error creating bean with name 'employeeRepository' defined in com.example.demo.repository.EmployeeRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Not a managed type: class com.example.demo.model.Employee
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:767) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:747) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:145) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:492) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1416) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:597) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:973) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:950) ~[spring-context-6.0.13.jar:6.0.13]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:616) ~[spring-context-6.0.13.jar:6.0.13]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.1.5.jar:3.1.5]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:738) ~[spring-boot-3.1.5.jar:3.1.5]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:440) ~[spring-boot-3.1.5.jar:3.1.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) ~[spring-boot-3.1.5.jar:3.1.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306) ~[spring-boot-3.1.5.jar:3.1.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295) ~[spring-boot-3.1.5.jar:3.1.5]
at com.example.demo.DemoApplication.main(DemoApplication.java:12) ~[classes/:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:50) ~[spring-boot-devtools-3.1.5.jar:3.1.5]
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'employeeServiceImpl': Unsatisfied dependency expressed through field 'eRepository': Error creating bean with name 'employeeRepository' defined in com.example.demo.repository.EmployeeRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Not a managed type: class com.example.demo.model.Employee
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:767) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:747) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:145) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:492) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1416) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:597) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1417) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1337) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:764) ~[spring-beans-6.0.13.jar:6.0.13]
... 25 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'employeeRepository' defined in com.example.demo.repository.EmployeeRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Not a managed type: class com.example.demo.model.Employee
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1770) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:598) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1417) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1337) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:764) ~[spring-beans-6.0.13.jar:6.0.13]
... 39 common frames omitted
Caused by: java.lang.IllegalArgumentException: Not a managed type: class com.example.demo.model.Employee
at org.hibernate.metamodel.model.domain.internal.JpaMetamodelImpl.managedType(JpaMetamodelImpl.java:192) ~[hibernate-core-6.2.13.Final.jar:6.2.13.Final]
at org.hibernate.metamodel.model.domain.internal.MappingMetamodelImpl.managedType(MappingMetamodelImpl.java:467) ~[hibernate-core-6.2.13.Final.jar:6.2.13.Final]
at org.hibernate.metamodel.model.domain.internal.MappingMetamodelImpl.managedType(MappingMetamodelImpl.java:97) ~[hibernate-core-6.2.13.Final.jar:6.2.13.Final]
at org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation.(JpaMetamodelEntityInformation.java:82) ~[spring-data-jpa-3.1.5.jar:3.1.5]
at org.springframework.data.jpa.repository.support.JpaEntityInformationSupport.getEntityInformation(JpaEntityInformationSupport.java:69) ~[spring-data-jpa-3.1.5.jar:3.1.5]
at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getEntityInformation(JpaRepositoryFactory.java:246) ~[spring-data-jpa-3.1.5.jar:3.1.5]
at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:211) ~[spring-data-jpa-3.1.5.jar:3.1.5]
at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:194) ~[spring-data-jpa-3.1.5.jar:3.1.5]
at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:81) ~[spring-data-jpa-3.1.5.jar:3.1.5]
at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:317) ~[spring-data-commons-3.1.5.jar:3.1.5]
at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.lambda$afterPropertiesSet$5(RepositoryFactoryBeanSupport.java:279) ~[spring-data-commons-3.1.5.jar:3.1.5]
at org.springframework.data.util.Lazy.getNullable(Lazy.java:245) ~[spring-data-commons-3.1.5.jar:3.1.5]
at org.springframework.data.util.Lazy.get(Lazy.java:114) ~[spring-data-commons-3.1.5.jar:3.1.5]
at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:285) ~[spring-data-commons-3.1.5.jar:3.1.5]
at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:132) ~[spring-data-jpa-3.1.5.jar:3.1.5]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1817) ~[spring-beans-6.0.13.jar:6.0.13]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1766) ~[spring-beans-6.0.13.jar:6.0.13]
... 49 common frames omitted



Why it is giving error?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Disable Jupyter Notebook cell only for whole notebook run

 Programing Coderfunda     October 29, 2023     No comments   

I don't know if it is possible, but I have a Jupyter notebook where I'd like to disable some cells in case of a whole run.
That is, 'Run All' would jump over these cells and not trigger them, but they could still be used if ran alone (e.g. with Ctrl+Enter) without changing the code.


I know %%script false --no-raise-error does the trick, but you need to manually change a constant to re-enable the cells when you need them. Ideally, I'd not have to change anything in the code.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

28 October, 2023

what do you do with model names, etc when the project is not in english?

 Programing Coderfunda     October 28, 2023     No comments   

I'm working on a project to manage specific legal orders in a country where english is not the language.

Although it's possible to translate some names in english, it becomes a little weird in some situations. For example a law requires to compile a form, it's weird if I translate the name of the form from the original language name into english, but it's also weird to have so much code in a language that is not english.

What do you do in these cases? submitted by /u/MobilePenor
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

27 October, 2023

cross-table query but filter doesn't works

 Programing Coderfunda     October 27, 2023     No comments   

I have two table,custom(click to show picture) gateway(click to show picture). custom.gateway_id's (pk) value is set as gateway.id
When i give a parameter(ex: 1 )The query is intended to retrieve data from CustomModelSerielPort where CustomModelSerielPort.gateway_id (ex:1)_matches Gateway.id (ex:1), and the data is only returned if Gateway.is_partner_ipc is equal to 1.
def list_serial_port(gateway_id: int, db: Session):
result = {"item_list": []}
serial_ports = (
db.query(CustomModelSerielPort.id, CustomModelSerielPort.path)
.join(Gateway, CustomModelSerielPort.gateway_id == Gateway.id)
.filter(Gateway.id == gateway_id)
.filter(Gateway.is_partner_ipc == 1)
.all()
)



If i give a parameter(ex: 3), i shouldn't get any data because Gateway.is_partner_ipc ==0,
However i still can get data, just like filter doesn't work, and if i change my condition to
.filter(Gateway.is_partner_ipc == 0)



I expect to get data when give a parameter(ex: 3) but no data when give a parameter(ex: 1 ), however both wont get any data, do anyone now what wrong with my code, thank a lot.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

26 October, 2023

Laravel + vue jwt auth

 Programing Coderfunda     October 26, 2023     No comments   

Used this (
https://blog.logrocket.com/implementing-jwt-authentication-laravel-9/) tutorial to setup my backend, getting the user as well as the token itself after login. But how can/should I store it? Is there any good tutorial that is handling that all in the frontend? Any articles to read that you can suggest? Really want to learn to work with jwt in a professional way, and store/use it as an httpOnly cookie if possible. Thanks for your help 😁👍 submitted by /u/IngloriousBastrd7908
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

25 October, 2023

AI foot tracking model

 Programing Coderfunda     October 25, 2023     No comments   

I am a student doing a graduation project. I urgently need to deal with this model (I am attaching a link). I've never worked with python and AI. Please help me understand how to run this model. I really need. Thank you



https://github.com/OllieBoyne/FIND#model-downloads />

This is my first time dealing with this. I sat there for a very long time trying to figure it out, but nothing came of it
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

24 October, 2023

How to completely overwrite previous print with a new one? [duplicate]

 Programing Coderfunda     October 24, 2023     No comments   

I have to print a progress status, so update a print with a new one. I read many post that says you have to use "\r", so I tried this: print(string, end="\r", flush=True).


The problem is that when the previous printed string is bigger than the second one, some stuff of old print will reamins in the new print.


Here's the full code:
import time

long_string = "AAAAA"
short_string = "BB"
c = 0
while True:
if c % 2 == 0:
print(long_string, end="\r", flush=True)
else:
print(short_string, end="\r", flush=True)
c += 1
time.sleep(1)




I would expect that in the if it would print "AAAAA" and in the else it would print just "BB", but instead, in the else, it prints "BBAAA" because the "A" remains from previous print. Here's what I mean. I would like it would be just "BB" instead of "BBAAA".


I saw this post answer Python: How to print on same line, clearing previous text? so I tried to use os.sys.stdout.write('\033[K' + long_string + '\r') instead of print, but I still have the same problem and it also print a strange character


How can I completely delete previous clean and make a new one without traces of the old one?


Edit:


@Thierry Lathuille
Here's the full code with the second solution:
import time, os

long_string = "AAAAA"
short_string = "BB"
c = 0
while True:
if c % 2 == 0:
os.sys.stdout.write('\033[K' + long_string + '\r')
else:
os.sys.stdout.write('\033[K' + short_string + '\r')
c += 1
time.sleep(1)



It produces this output





I'm testing it in Windows 10 cmd.


Edit 2:
I said that the solution of "\r" didn't work and you closed my question and said that it has been answered in that thread. Are you kidding me right? Please open it again, that solution doesn't work, I already said it, that thread's answeres doesn't work to me and I explained why.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

how would you approach baselining models and all of their relations?

 Programing Coderfunda     October 24, 2023     No comments   

I've been tasked with one of the more challenging things I've had to do in my 18 years+ career and as I try to wrap my head around the best approach to solve this, I thought I would ask here as well to see if I can gain anything from outside perspectives.

Hopefully this is allowed, I know it speaks of a specific problem, but it's also a general problem that others might have to deal with at some point so hoping that this thread could be of some use to others in the future.

In my project I have models who contain many nested relations, all of which themselves contain many nested relations. Including many pivot many-to-many relations. I've been tasked with making it possible to save a snapshot of the top level model, including all of its recursive nested relations. These snapshots, also called baselines or versions, can then be loaded at a later time. They can never be edited however, they are frozen in time.

My first approach was to create a new table for this and save the model and all of its recursive relations as json, with the idea that I could then later hydrate that json back into models and return them via my API. This is proving to be quite tricky as the process of re-hydrating my complex json into models and their relations is cumbersome and feels hacky. The idea with this approach is that I could have my snapshots contained and would not have to pollute my database with tons of "cloned" records.

My second approach would be to create duplicate copies of my models and all their relations whenever a snapshot is created. This feels like it would indeed work, but would result in potentially lots of extra rows, though that in itself shouldn't be much concern.

I was wondering if anyone can think of a better approach to my problem? Or if either of my two above approaches seem sound and valid?

Just thought I would pick some brains! Many thanks for any insight! submitted by /u/spar_x
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

23 October, 2023

🚀Introducing ims-laravel-admin-starter: Your Hassle-Free Laravel Admin Panel & API Starter Kit🚀

 Programing Coderfunda     October 23, 2023     No comments   

Hey there, fellow developers! I'm excited to share with you an open-source project that can supercharge your web development journey.

ims-laravel-admin-starter is a purpose-built Admin panel and API starter application, skillfully crafted with the robust Laravel 10 framework and Filament 3.

The primary goal? To make your local development setup a breeze and let you dive into your project right away. No more fussing with intricate configurations. You can hit the ground running with your Laravel-based API and admin panel development. Spend your time building your application's logic, not wrestling with setup complexities.

🔗 Find out more: GitHub Repository

📚 Explore the Wiki: Dedicated Wiki

This project is a brainchild of Innovix Matrix Systems and is proudly released as open-source software under the MIT license. Feel free to use, modify, and distribute this starter kit in harmony with MIT license terms. We're all about collaboration, so don't hesitate to contribute and make this project even more amazing.

Let's shape the future of Laravel development together! 🙌 submitted by /u/AHS12_96
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

22 October, 2023

VSCode IntelliSense autocomplete suddenly stopped working with node modules

 Programing Coderfunda     October 22, 2023     No comments   

I'm trying to make a steam bot with JS, and IntelliSense does not work.





I have my SteamUser object declared:
const SteamUser = require("steam-user");
const client = new SteamUser()



It recognizes the logOn function:





But IntelliSense doesn't work. I tried restarting VSCode, entering command pallete and using the Developer: Reload Window command, but to no avail.


In a discord.js project IntelliSense also doesn't work:





I have run npm install:





Here is my package.json:
{
"dependencies": {
"steam-user": "^5.0.1"
}
}



EDIT: Just found out that local requires also don't work.


Example:
const config = require("./config.json")






config.json:
{
"accountName": "something",
"password": "something2"
}
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Can't run jupyter using docker compose with nginx

 Programing Coderfunda     October 22, 2023     No comments   

i am trying to run python script on jupyter using docker compose but can't connect to python kernel and this is my docker compose file which running on ubuntu vm :

services:
jupyter:
container_name: jupyter
image: jupyter/scipy-notebook
ports:
- 8888:8888
volumes:
- ./jupyter:/home/jovyan/work
environment:
- JUPYTER_TOKEN=password
command: jupyter notebook --ServerApp.iopub_data_rate_limit=10000000 && ["jupyter", "lab", "--debug"]
networks:
testing_net:
ipv4_address: 172.18.0.3

networks:
testing_net:
ipam:
driver: default
config:
- subnet: 172.18.0.2/16`

and this is my nginx configuration
` location / {
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
proxy_pass
http://localhost:8888; /> proxy_redirect off;
}```
when i'm trying to run any python code on jupyter can't connect to kernel an it gives me this error in the docker logs
```[W 2023-10-22 06:55:09.321 ServerApp] Replacing stale connection: ab4cb6a6-12c1-4d60-9730-ec05070a5f5f:56fc3464-cb08-4d4c-8d8b-7962be661691
[W 2023-10-22 06:55:09.322 ServerApp] 400 GET /api/kernels/ab4cb6a6-12c1-4d60-9730-ec05070a5f5f/channels?session_id=56fc3464-cb08-4d4c-8d8b-7962be661691 (1fd5f82f97c944089c5f3113e6ec60a5@172.18.0.1) 1.78ms referer=None```
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

21 October, 2023

offset formula / dynamic range in Google sheets

 Programing Coderfunda     October 21, 2023     No comments   

I need to set a dynamic range/offset formula in order to track only the last 5 inputs in to separate fields (for each person). Each month I am adding 1 new row for each person (2 new rows in total), so the range of the last 5 inputs should be updated.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

20 October, 2023

Outlook Showing in Process even after closing - C#

 Programing Coderfunda     October 20, 2023     No comments   

I am writing a code to such that I will get a trigger when ever outlook opens
Process[] processlist = System.Diagnostics.Process.GetProcessesByName("OUTLOOK");

if (processlist.Count() > 0)
{
MessageBox.Show("Outlook Opened");
}



Works great for the first time when I open outlook, but the message box continue to show even after outlook is closed .


I also checked the background process there is no outlook process running.
Help appreciated :) .
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 ++ में आने से पह...
  • 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