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 September, 2024

Can we honoured Intent flag value over Manifest in launch mode when intent flag and manifest launch mode is different?

 Programing Coderfunda     September 04, 2024     No comments   

Android Documentation mentioned for Same Intent Flag and Manifest Launch Mode but what when they are different?


So, if Activity A starts Activity B, Activity B can define in its manifest how it associates with the current task, and Activity A can use an intent flag to request how Activity B can associate with current task.


If both activities define how Activity B associates with a task, then Activity A's request, as defined in the intent, is honored over Activity B's request, as defined in its manifest.


when Activity B can define in its manifest how it associates with the current task is different(single Top) , and Activity A can use an intent flag to request how Activity B can associate with current task is different example(new task).


what will be honored over whom?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Multipart file is not present in SB3

 Programing Coderfunda     September 04, 2024     No comments   

Since the update on Spring Boot 3, my multipart endpoint has stopped working. I tried every post on the stackOverflow but it was not helping.


Endpoint is defined as RestController:
@PatchMapping(value = "/users/test", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public List userTest(
@Parameter(content = @Content(mediaType = MediaType.MULTIPART_FORM_DATA_VALUE))
@RequestPart(value = "file") MultipartFile file) {
System.out.println(file.getContentType());
return operationResourceService.parseFile(file);
}



The endpoint is designed only to print out the content of the CSV file. Since this is Spring Boot 3 there is no need to define any MultipartResolver, because the default resolver now is the StandardServletMultipartResolver.


After request is sent to the backend, exception is thrown:
org.springframework.web.multipart.support.MissingServletRequestPartException: Required part 'file' is not present.



After detail debug found out that this part of the code is throwing this same exception:
if (arg == null && isRequired) {
if (!MultipartResolutionDelegate.isMultipartRequest(servletRequest)) {
throw new MultipartException("Current request is not a multipart request");
}
else {
throw new MissingServletRequestPartException(name); // EXCEPTION
}
}



But main cause is that method resolveMultipartArgument is returning null from some strange reason...
Object mpArg = MultipartResolutionDelegate.resolveMultipartArgument(name, parameter, servletRequest); // Returns null
if (mpArg != MultipartResolutionDelegate.UNRESOLVABLE) {
arg = mpArg; // This is the line where arg is assigned as null
}
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

03 September, 2024

how to fix width of child div tag

 Programing Coderfunda     September 03, 2024     No comments   

I have two div tags parent and child. The child tag has a position fixed with a width of 100%. The parent has a padding of 10px as shown in this jsfiddle code. The issue is that when I give a width of 100% to the child tag then its right side moves out of the parent div tag. I know that is because it has padding. One way to solve this is to give the child tag a width of 90%.


But is there a better way than this so that the child tag appears exactly inside the parent tag?


UPDATE


I want to keep position: fixed for child tag
.parent {
height: 300px;
padding: 10px;
border: 1px solid red;
}

.child {
position: fixed;
height: 100px;
width: 100%;
border: 1px solid black;
}
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Function not showing up in list

 Programing Coderfunda     September 03, 2024     No comments   

Following these instructions:
https://www.exceldemy.com/learn-excel/geocoding/ I created a new module and used Tools/References to check Microsoft XML, 6.0. Then I pasted this code into the new module:
Function Co_Ordinates(address As String) As String
Application.Caller.Font.ColorIndex = xlNone
Dim xDoc As New MSXML2.DOMDocument
xDoc.async = False
xDoc.Load ("
https://nominatim.openstreetmap.org/search?format=xml&q=" + WorksheetFunction.EncodeURL(address))
If xDoc.parseError.ErrorCode 0 Then
Application.Caller.Font.ColorIndex = vbErr
Co_Ordinates = xDoc.parseError.reason
Else
xDoc.SetProperty "SelectionLanguage", "XPath"
Dim loc As MSXML2.IXMLDOMElement
Set loc = xDoc.SelectSingleNode("/searchresults/place")
If loc Is Nothing Then
Application.Caller.Font.ColorIndex = vbErr
NominatimGeocode = xDoc.XML
Else
Application.Caller.Font.ColorIndex = vbOK
Co_Ordinates = loc.getAttribute("lat") & "," & loc.getAttribute("lon")
End If
End If
End Function



But when I select the top line in the function and click the run arrow, I get a pop-up list of macros that does not include Co_Ordinates. The image below shows what I see. Also, if I use that function in a cell (=Co_Ordinates(K12)), I get a Name? error. What am I doing wrong?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

MinimumOSVersion in 'MyProject.app/Frameworks/hermes.framework' is ''. in react native

 Programing Coderfunda     September 03, 2024     No comments   

While uploading on TestFlight, I have this error. I searched a lot but didn't helped any thing. I am using RN v.0.74.4.



Invalid minimumOSversion. Apps that only support 64-bit devices must
specify a deployment target of 8.0 later. MinimumOSVersion in
'CPOD_Recap_Revamp.app/Frameworks/hermes.framework' is ''.



I have tried several solutions, but nothing worked:



* Deleting and install node_modules folder

* Deleting and install package-lock.json

* Deleting and install Pods folder

* Deleting and install Podfile.lock

* Defining minimumOSVerion in info.plist
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How do I pass data directly from Google Cloud TTS SynthesizeSpeechResponse object to sounddevice without creating a file on disk

 Programing Coderfunda     September 03, 2024     No comments   

Question




How do I pass data from google.cloud.texttospeech_v1.types.cloud_tts.SynthesizeSpeechResponse object to sounddevice play function without creating an audio file on disk


Problem




Data supplied by SynthesizeSpeechResponse has RIFF WAV header information in byte stream, but I do not know how to manipulate it as such. Can easily save file to disk, then read that file to play audio, but want to keep data in memory without write to disk.


err=LibsndfileError(2, 'Error opening b\'RIFF\\xcbt\\x00\


response.doc reminds us that "Note: as with all bytes fields, protobuffers use a pure binary representation, whereas JSON representations use base64.", but I do not find a way to access this JSON readily.


Environment





* torch base platform (CUDA 11.8)

* google-3.0.0

* google-cloud-texttospeech-2.17.2

* transformers-4.44.1

* soundfile-0.11.1

* sounddevice-0.5.0

* numpy-1.26.4






Code


import soundfile as sf
import sounddevice as sd

from transformers import pipeline
from google.cloud import texttospeech

text_to_speak = "The quick brown fox"

google_client = texttospeech.TextToSpeechClient()
input_text = texttospeech.SynthesisInput(text=text_to_speak)
selected_voice_name = "en-US-Standard-B"
voice = texttospeech.VoiceSelectionParams(
language_code=selected_voice_name[:4],
name=selected_voice_name,
ssml_gender=texttospeech.SsmlVoiceGender.FEMALE,
)
audio_config = texttospeech.AudioConfig(
audio_encoding=texttospeech.AudioEncoding.LINEAR16 # MULAW # ALAW
)
response = google_client.synthesize_speech(
input=input_text, voice=voice, audio_config=audio_config
)

# The below works by creating file on disk, then reading and playing that file

output_file_name = "google_cloud_tts_output.wav"

with open(output_file_name, "wb") as out:
out.write(response.audio_content)
r_data, r_samplerate = sf.read(output_file_name)
sd.play(r_data, r_samplerate)

# The below does not work
# AttributeError: Unknown field for SynthesizeSpeechResponse: decode

sd.play(response.decode(response.audio_content), 16000)

# The below does not work because the data type is unsupported
# In this case the '674416' is subject to change, it could be a five or six digit number
# TypeError: Unsupported data type: 'bytes674416'

sd.play(response.audio_content, 16000)

# The below does not work because the data is malformatted
# File "c:\Projects\ventriloquist\.venv\lib\site-packages\soundfile.py", line 1216, in _open
# raise LibsndfileError(err, prefix="Error opening {0!r}: ".format(self.name))
# soundfile.LibsndfileError: Error opening b'RIFFFI\x01\x00WAVEfmt \x10\x00\x00\x00\x01\x00\x01\x00\xc0]\x00\x00\x80\xbb\x0
# ...
# xff\xf0\xff\xf2\xff\xee\xff': System error.

sd.play(sf.read(response.audio_content), 16000)

# The below does not work because the data is malformatted
# ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (2,) + inhomogeneous part.

import io

io_ir = io.BytesIO(response.audio_content)

sd.play(sf.read(io_ir), 16000)



When working with speech synthesis data returned by Hugging Face transformers, it is easy to convert this data object to what sounddevice is expecting:
speech = tts_model.generate_speech(inputs["input_ids"], speaker_embeddings, vocoder=vocoder)
sd.play(speech.numpy(), 16000)



When working with the Google Cloud TTS SynthesizeSpeechResponse object, the expectation is to write the contents to a wave or MP3 file; details on the format of the data provided by the SynthesizeSpeechResponse object are not provided, but empirically we know that it is formatted to be readily saved to disk.


The below does not work
AttributeError: Unknown field for SynthesizeSpeechResponse: decode
sd.play(response.decode(response.audio_content), 16000)



The below does not work because the data type is unsupported
In this case the '674416' is subject to change, it could be a five or six digit number
TypeError: Unsupported data type: 'bytes674416'
sd.play(response.audio_content, 16000)



The below does not work because the data is malformatted
File "c:\Projects\ventriloquist.venv\lib\site-packages\soundfile.py", line 1216, in _open
raise LibsndfileError(err, prefix="Error opening {0!r}: ".format(self.name))
soundfile.LibsndfileError: Error opening b'RIFFFI\x01\x00WAVEfmt \x10\x00\x00\x00\x01\x00\x01\x00\xc0]\x00\x00\x80\xbb\x0
...
xff\xf0\xff\xf2\xff\xee\xff': System error.
sd.play(sf.read(response.audio_content), 16000)



Some methods already tried




The below does not work because the data is malformatted
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (2,) + inhomogeneous part.
import io
io_ir = io.BytesIO(response.audio_content)
sd.play(sf.read(io_ir), 16000)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Pinkary is now fully open source

 Programing Coderfunda     September 03, 2024     No comments   

---




Pest creator and Laravel core team member Nuno Maduro announced recently that Pinkary is now fully open source, and you can also find us on it at @laravelnews.


Built with Laravel, Livewire, Tailwind, and more, Pinkary is an excellent example of a full Laravel application you can learn from and contribute to:





Pinkary is already a thriving project, with over 400+ submitted pull requests, and is encouraging open-source contributions and giving you the installation instructions you need to go from project setup to pull request. Pinkary is already using Pest 3, and as the creator of Pest, the code has plenty of examples you can learn from to level up your testing skills.


On the user side of this project, Pinkary is a landing page for all your links and a place where you can connect with like-minded people without the noise of other social media applications. It went from a new project to over a thousand users very quickly and is known for using a SQLite database for application data, sessions, queues, cache, etc.


Start learning from the Pinkary source code today! Visit pinkary-project/pinkary.com on GitHub and join this exciting open-source project.



The post Pinkary is now fully open source 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

02 September, 2024

Angular: how to call router.navigate() relative to target route in a RouteGuard?

 Programing Coderfunda     September 02, 2024     No comments   

I have an existing project developed with Angular 4. I need to control the access to a particular route based on user-rights. The simplified route configuration looks like this:

[
{ path: '', redirectTo: '/myApp/home(secondary:xyz)', pathMatch: 'full' },
{ path: 'myApp'
children: [
{ path: '', redirectTo: 'home', pathMatch: 'full' },
{ path: 'home', ... },
...
{ path: 'product'
children: [
{ path: '', redirectTo: 'categoryA', pathMatch: 'full' },
{ path: 'categoryA', component: CategoryAComponent, canActivate: [CategoryACanActivateGuard]},
{ path: 'categoryB', component: CategoryBComponent},
...
]
},
...
]
},
...
]




Now, I want to control the access to www.myWeb.com/myApp/product/categoryA. If the user doesn't have enough permission, he/she will be redirected to ... /product/CategoryB. I have written a CanActivate RouteGuard to do this, the guard class looks like this:

import { Injectable } from '@angular/core';
import { CanActivate, Router, ActivatedRouteSnapshot, RouterStateSnapshot, ActivatedRoute } from '@angular/router';
import { MyService } from '... my-service.service';

@Injectable()
export class CategoryACanActivateGuard implements CanActivate {
constructor(private myService: MyService, private router: Router) { }

canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise {
return this.myService.checkPermission()
.then(result => {
if (!result.hasAccess) {
//redirect here

this.router.navigate(['./myApp/product/categoryB']);
//works, but I want to remove hardcoding 'myApp'

//this.router.navigate(['../../categoryB']);
//doesn't work, redirects to home page

//this.router.navigate(['./categoryB'], { relativeTo: this.route});
//do not have this.route object. Injecting Activated route in the constructor did not solve the problem

}
return result.hasAccess;
});
}
}




Everything works fine, but I want redirect relative to the target route like the following:

this.router.navigate(['/product/categoryB'], { relativeTo: });
// or
this.router.navigate(['/categoryB'], { relativeTo: });




Unfortunately, relativeTo accepts only ActivatedRoute objects and all I have is ActivatedRouteSnapshot and RouterStateSnapshot. Is there a way to navigate relative to the target route (in this case categoryA)? Any help will be really appreciated.



Note:




* I can not change the route configuration other than adding some route-guards.

* I am not looking looking for this.router.navigateByUrl using state.url. I want to use router.navigate([...], { relativeTo: this-is-what-need}).
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Control user to login from only specific device that provided to the user

 Programing Coderfunda     September 02, 2024     No comments   

UPDATE as of Sept-2024:
as per @Joundill In reality, it won't be possible for you to securely restrict access to individual devices through the web. We have made some extra level of authentications in our software to authenticate the users (Added client side certificate on each devices and based on that the user can't access the site from other devices: i.e: how to use client certificates to access website) now it's resolved.


Original Question


I am trying to develop the software for college students, we will provide device to the students (tab/laptops) they must need to log in their credentials using the device that we provided to the student. E.g. If student 1 tried to log in from student 2's tab/laptop, then it needs to be rejected.


Is there any way available to get the MAC address of the client's PC using PHP, and JavaScript?


We developed web applications using PHP 5.3 with jQuery and JS, also another is Laravel with PHP 8.1.


Is there any best way available to restrict the user to login from only the device specified?


I have tried by controlling the user via MAC address using this answer but it's not working in our case.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Is there a way to calculate "suggestedMaxPriorityFeePerGas and suggestedMaxFeePerGas", same way the INFURA Gas API do for BNB Network

 Programing Coderfunda     September 02, 2024     No comments   

The Infura Gas API response for bnb net :
{
"low": {
"suggestedMaxPriorityFeePerGas": "4.7",
"suggestedMaxFeePerGas": "4.7",
"minWaitTimeEstimate": 15000,
"maxWaitTimeEstimate": 60000
},
"medium": {
"suggestedMaxPriorityFeePerGas": "4.85",
"suggestedMaxFeePerGas": "4.85",
"minWaitTimeEstimate": 15000,
"maxWaitTimeEstimate": 45000
},
"high": {
"suggestedMaxPriorityFeePerGas": "4.9",
"suggestedMaxFeePerGas": "4.9",
"minWaitTimeEstimate": 15000,
"maxWaitTimeEstimate": 30000
},
"estimatedBaseFee": "0.0",
"networkCongestion": 0,
"latestPriorityFeeRange": [
"4.85",
"4.85"
],
"historicalPriorityFeeRange": [
"4.85",
"5"
],
"historicalBaseFeeRange": [
"0",
"0"
],
"priorityFeeTrend": "down",
"baseFeeTrend": "down",
"version": "0.0.1"
}



suggestedMaxPriorityFeePerGas returned by API for low, medium and high are not static.

My question is how can I calculate the suggestedMaxFeePerGas when suggestedMaxPriorityFeePerGas is dynamic and the baseFee is zero too (not just in this case. it's always zero, for BNB).


I'm a beginner and what I know is that the

MaxFeePerGas = BaseFeePerGas + MaxPriorityFeePerGas


But in this case baseFeePerGas is 0 & MaxPriorityFeePerGas is dynamic (which I can't figure out, how to calculate)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to cast an HTMLElement to a React element?

 Programing Coderfunda     September 02, 2024     No comments   

I am working on a React application that uses an external library in Vanilla JS that creates DOM elements using document.createElement(...). Some of this data I want to insert into my React elements. If I have a simple application:
let sub = React.createElement('p', null, 'Made with React'),
main = React.createElement('div', null, [sub])

React.render(main, document.getElementById('app'));



It renders with the content

Made with React. If I try it with document.createElement instead, nothing is rendered.
let sub = document.createElement('p');
sub.innerText = 'Not React';
let main = React.createElement('div', null, [sub])

React.render(main, document.getElementById('app'));



I have currently found a workaround using dangerouslySetInnerHTML.
let sub = document.createElement('p');
sub.innerText = 'Not React';
let main = React.createElement('div', {dangerouslySetInnerHTML: {__html: sub.outerHTML}});

React.render(main, document.getElementById('app'));



This renders but doesn't seem safe. What is the proper way to append HTMLElement as React child elements?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Let's build a Twitter clone with Livewire 3 & Laravel Reverb | 5 - Styling Tweet

 Programing Coderfunda     September 02, 2024     No comments   

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

01 September, 2024

How to generate a parse error after exactly one expression

 Programing Coderfunda     September 01, 2024     No comments   

I have following ANTLR grammar:
start :
expression
;

expression
:
| dateOperatorExpression
| numberOperatorExpression
| stringOperatorExpression
| methodBooleanExpression
| doubleMethodOperatorExpression
| numberInExpression
| stringInExpression
| bracketExpression
| andExpression
| orExpression
| notExpression
;

numberInExpression:
| WS? METHOD WS? IN WS? '{' WS? NUMBER (WS? ',' WS? NUMBER)* '}' WS?
;

stringInExpression:
| WS? METHOD WS? IN WS? '{' WS? STRING (WS? ',' WS? STRING)* '}' WS?
;

dateOperatorExpression:
| WS? DATE WS? OPERATOR WS? DATE WS?
| WS? DATE WS? OPERATOR WS? METHOD WS?
| WS? METHOD WS? OPERATOR WS? DATE WS?
| WS? DATE WS? OPERATOR WS? NULLVALUE WS?
| WS? NULLVALUE WS? OPERATOR WS? DATE WS?
;
numberOperatorExpression:
| WS? NUMBER WS? OPERATOR WS? NUMBER WS?
| WS? NUMBER WS? OPERATOR WS? METHOD WS?
| WS? METHOD WS? OPERATOR WS? NUMBER WS?
| WS? NUMBER WS? OPERATOR WS? NULLVALUE WS?
| WS? NULLVALUE WS? OPERATOR WS? NUMBER WS?
;
stringOperatorExpression:
| WS? STRING WS? OPERATOR WS? STRING WS?
| WS? STRING WS? OPERATOR WS? METHOD WS?
| WS? METHOD WS? OPERATOR WS? STRING WS?
| WS? STRING WS? OPERATOR WS? NULLVALUE WS?
| WS? NULLVALUE WS? OPERATOR WS? STRING WS?
;
doubleMethodOperatorExpression:
| WS? METHOD WS? OPERATOR WS? METHOD WS?
| WS? METHOD WS? OPERATOR WS? NULLVALUE WS?
| WS? NULLVALUE WS? OPERATOR WS? METHOD WS?
;
methodBooleanExpression:
| WS? METHOD WS? OPERATOR WS? BOOLEAN WS?
| WS? BOOLEAN WS? OPERATOR WS? METHOD WS?
;

bracketExpression:
| '(' WS? expression WS? ')'
;
andExpression
:
| AND WS? '(' expression (',' expression)* WS? ')'
;
orExpression
:
| OR WS? '(' expression (',' expression)* WS? ')'
;
notExpression
:
| NOT WS? expression
;

WS: (' ' | '\t' | '\r' | '\n')+ -> skip;
AND: 'AND' | 'and';
OR: 'OR' | 'or';
NOT: 'NOT' | 'not' | '!';
IN: 'IN' | 'in';

OPERATOR: '==' | '!=' | '>' | '=' | '= 25), not(father.address.street != null)), firstName in {"John", "Pete"})



The parser only takes and((retired == true)) and ignores the rest. So, I thought about simply changing the grammar as follows, and then printing a warning of multiple expressions were parsed:
start :
(expression)+
;



But this gives the error: "rule start contains a closure with at least one alternative that can match an empty string". Why is that? How can (expression)+ match an empty string, if expression can't?


How can I achieve what I want?
Thanks,
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Patented Private Label Seller in Amazon [closed]

 Programing Coderfunda     September 01, 2024     No comments   

We are going to launch a private label product and there are many other sellers. But nowadays appeared one patented seller. Can they leave out of this market by complaining to Amazon?


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

Must-Know Tips for Efficient Laravel Apps (Not just selecting only needed columns, eager loading instead of lazy loading, caching queries, using queues, indexes, and more)

 Programing Coderfunda     September 01, 2024     No comments   

Hey everyone! 👋

I recently wrote an article on some essential tips for making your Laravel apps more efficient. But this isn’t just the typical like selecting only needed columns, eager loading, caching, or using indexes. I dive into some lesser-discussed but highly impactful strategies that can really make a difference in your app’s performance.

If you’re looking to optimize your Laravel projects beyond the usual tips, check it out!

👉 Must-Know Tips for Efficient Laravel Apps

Would love to hear your thoughts and any additional tips you might have! submitted by /u/summonshr
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to put a header file curses.h/ncurses.h for work in vscode? [duplicate]

 Programing Coderfunda     September 01, 2024     No comments   

I am learning programming in C, and on the Internet I came across an interesting header file ncurses, with which you can create many interesting things. But I ran into a problem, I did not find a normal explanation of how to install this file for the Windows operating system (not a single method worked). Please tell me, is it possible to install this file in Windows?


I tried to install it using some popular methods (linking), but nothing worked.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to set the shutter time but leave the ISO (sensitivity) on auto on android

 Programing Coderfunda     September 01, 2024     No comments   

I am building an Android app with the Camera2 API that uses short shutter times, 1/1000 and 1/2000.
I can set the SENSOR_EXPOSURE_TIME without any problem. But I want to keep the ISO (SENSOR_SENSITIVITY) on auto mode.


To set the shutter speed I use the following code:
mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AE_MODE, CaptureRequest.CONTROL_AE_MODE_OFF);
mPreviewRequestBuilder.set(CaptureRequest.SENSOR_EXPOSURE_TIME, EXPOSURE);
mCaptureSession.setRepeatingRequest(mPreviewRequestBuilder.build(), null, surfaceView.getmBackgroundHandler());



This code works OK, but because the CONTROL_AE_MODE is set to CONTROL_AE_MODE_OFF the ISO (SENSOR_SENSITIVITY) has to be set manually also. And this is what I don't want, I want to keep the ISO on auto.


Is there any way to accomplish this or is there a workaround?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

11 August, 2024

Minimum number that can fit in a box [closed]

 Programing Coderfunda     August 11, 2024     No comments   

There is a box variable containing up to 4 balls and variables called balls A and B. There must be at least one ball A and B in the box. I would like to get the Java code for this.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Securing Patient Health Data in Laravel: HIPAA-Compliant Encryption and Decryption

 Programing Coderfunda     August 11, 2024     No comments   

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

10 August, 2024

Instaloader stopped downloading at 12th posts

 Programing Coderfunda     August 10, 2024     No comments   

Instaloader newest version 4.12.1 on Python 3.11.5 stopped downloading at the 12th post without raising any exception even though the user has 48 downloadable posts.
L = instaloader.Instaloader(
download_videos=False,
download_video_thumbnails=False,
save_metadata=False,
user_agent='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36',
)
# L.login("USER", "PASS")
full_directory_path = os.path.join(root, username)
if not os.path.exists(full_directory_path):
os.makedirs(full_directory_path)
L.dirname_pattern = full_directory_path
L.download_profile(username,profile_pic=False)
print(Fore.GREEN + Style.BRIGHT + "\n* Download complete\n.")



This is my code, I have tried to download with an account logged in as well but it does not even download a single post (no exception was raised).



profile thuwu_ could also be downloaded anonymously. Retrieving posts
from profile thuwu_.



* Download complete .






Process finished with exit code 0



The problem here was it used to run flawlessly, I don't know what the problem here. And I tried to change my IP also but that does not work either.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Find the folderID from a shared fileID [duplicate]

 Programing Coderfunda     August 10, 2024     No comments   

how I can analyse the folderID from a file with is shared with me an i know the fileID?


Is there any way About Google-Scripting?


Greetings


I have done the following so far without success:




*

I search about the WEB-Interface - here I see only "Shared with me"


*

I checked it wit the API-Explorer:
https://developers.google.com/drive/api/reference/rest/v3?hl=de
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Build Your Own Assistant with Laravel Livewire — using your Data and Streamed Content

 Programing Coderfunda     August 10, 2024     No comments   

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

InputStream and Reader subclass hierarchy difference [closed]

 Programing Coderfunda     August 10, 2024     No comments   

The InputStream abstract class has FileInputStream and FilterInputStream as a direct subclass. FileInputStream has all necessary code to establish an input connection from a file, whereas FilterInputStream is created as a wrapper which acts as a decorator and facilitates other classes extending it to provide a specific and specialized operation on InputStream, hence BufferedInputStream is a subclass of it and provide buffering capabilities by introducing an in-memory byte-array which acts as a storage for reducing System input calls directly to the file-system. This complete hierarchy makes sense.


pictorial representation -
InputStream ---> FileInputStream
|
|
---> FilterInputStream ---> BufferedInputStream



But then the Reader abstract class has FilterReader as a direct subclass but FileReader is not a direct subclass, FileReader extends InputStreamReader, and BufferedReader is a direct subclass of Reader and not of FilterReader, again why this decision is taken.


pictorial representation of this as well
Reader ---> InputStreamReader ---> FileReader
|
---> FilterReader
|
---> BufferedReader



Let me summarize all my queries in bullet pointers for easy answering -



* Why BufferedReader is a direct subclass of Reader and not extend FilterReader, as in the InputStream hierarchy.

* Why does FileReader extend InputStreamReader and not directly a subclass of Reader ?

* What capabilities were given to InputStreamReader because of which FileReader was kept a subclass of it?

* Why are those capabilities of InputStreamReader not given to FilterReader? If it was done that way, maybe the Reader abstract class might have the same hierarchy as InputStream.

* FilterReader might have been designed such that InputStreamReader can extend it and then provide an extra specialised wrapper on Reader for input-stream-specific purposes, which then can be further utilized. Why keep it a direct subclass instead?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

09 August, 2024

C++ Templates - Guarantee A Type Definition Has a Particular Constructor Signature?

 Programing Coderfunda     August 09, 2024     No comments   

#include
#include
#include

struct AppleMakeInfo {};

template class Apple {
static_assert(std::is_base_of::value, "T must be derived from AppleMakeInfo");

public:
std::function deleteFunc;

~Apple() { deleteFunc(); }

Apple(T* aMI) {};
};

template class AppleManager
{
static_assert(std::is_base_of::value, "T must be derived from AppleMakeInfo");
static_assert(std::is_base_of::value, "U must be derived from Apple");

public:

static U* MakeApple(T* aMI, std::function dF)
{
U* ret = new U(aMI);
ret->deleteFunc = dF;
All.push_back(ret);
return ret;
}

private:
AppleManager() {};

static std::vector All;
};

struct GrannySmithMakeInfo :public AppleMakeInfo {};

class GrannySmith :public Apple {};

class GrannySmithManager :public AppleManager {};



The above code block mostly compiles, however I am having trouble with one line causing a compile error:


U* ret = new U(aMI)


This line, during compilation, will show the following error in my IDE (compile error C2665):


'GrannySmith::GrannySmith': no overloaded function could convert all the argument types


To me, this reads like the typename U of the AppleManager template class does not have a constructor with a signature that matches new U(aMI) because nothing in my source indicates a guarantee/contract between AppleManager and whatever Type is provided for typename U for a constructor with the new U(aMI) signature to exist in the definition of the typename U Type. I'd use the where keyword in C# to get this kind of contract, but the closest there is for this in C++ is static_assert() which isn't actually a contract (AFAIK) but just acts the way a contract would at compile.


Assuming I'm understanding correctly and the code won't compile because there's no compiler guarantee that the type provided for typename U will have a constructor with a signature matching new U(aMI), what am I to do to provide this kind of guarantee to the compiler?


Many thanks for any help I get! I'm not so experienced with C++ so apologies if the code block above is embarrassingly amateur.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

cgi-bin on google search

 Programing Coderfunda     August 09, 2024     No comments   

I'm facing an issue with my website bpraj.online. Instead of displaying the homepage, it shows a directory listing with the following information:


mathematica
Copy code
Name Last Modified Size
Directory cgi-bin 2024-08-05 04:23 -
And below it says: "Proudly Served by LiteSpeed Web Server at www.bpraj.online Port 443."


I've already checked that the index.php file is present in the root directory, and I've ensured the server is set to point to this file. Despite this, the directory listing keeps appearing.


I've also added rules to block directory listing in my .htaccess file and updated my robots.txt to prevent indexing. Additionally, I've tried removing the URL from Google Search Console, but the issue persists.


Has anyone faced a similar issue or knows how to resolve this? Any guidance or suggestions would be greatly appreciated.


Thank you in advance for your help!


I've tried the following steps to resolve the issue:


.htaccess and robots.txt: I added rules to block directory listing in my .htaccess file and updated my robots.txt to prevent indexing, expecting it to stop showing the directory contents and display the homepage instead.


Google Search Console: I edited settings in Google Search Console and attempted to remove the indexed URL, hoping it would refresh Google's view and remove the directory listing from search results.


Favicon/Icon Issue: Additionally, my site icon is not appearing in Google search results. I've added the appropriate meta tags and linked the favicon, but it still doesn't show.


Despite these efforts, the problems persist.


Has anyone faced a similar issue or knows how to resolve this? Any guidance or suggestions would be greatly appreciated.


Thank you in advance for your help!
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Spyder console: Avoid empty lines in REPL output

 Programing Coderfunda     August 09, 2024     No comments   

I am using Anaconda's Spyder. In the console, I want to see more of the historical output, including warnings/errors. Since the Spyder uses IPython, I found from here that avoid the vertical white space by putting the following into the IPython config files: c.InteractiveShell.separate_in = ''. From here, I found that the config file is c:/Users/User.Name/.ipython/profile_default/ipython_config.py. It didn't exist, so I created it with the one line above. The Spyder console output still contains too much vertical white space. What else can I try?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Mapping json to class/model

 Programing Coderfunda     August 09, 2024     No comments   

Hello, I've looked into this few times, but decided to ask here if someone has found better solution.

I'm looking for some kind of package/or built in function, that can map JSON to Class/Model, similar to how you can map JSON to Struct in Go.

I found few small libraries but they are either too old or does not do exactly this.

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

How to implement something like an SDK? [closed]

 Programing Coderfunda     August 09, 2024     No comments   

I'm developing a Rust application, with some feature to be implemeted in Python. I plan to expose some Python function API to users, so that users can write their own Python code with these functions imported. Then they put their code in a directory, and my application can run the script.


I'm not quite clear how to implement this.
1)In what format should I provide my method code to user, should it be in form of DLL or .whl, or just Python scource?
2)If the application run user script with pyo3, how to process my method code called in the script?


Update: To be more forcused.
My application would also run a client side, it would include user written script to accomplish some feature.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

08 August, 2024

How to use return value from method in Java?

 Programing Coderfunda     August 08, 2024     No comments   

I want to use the return value from a member function by storing it into a variable and then using it. For example:

public int give_value(int x,int y) {
int a=0,b=0,c;
c=a+b;
return c;
}

public int sum(int c){
System.out.println("sum="+c);
}

public static void main(String[] args){
obj1.give_value(5,6);
obj2.sum(..??..); //what to write here so that i can use value of return c
//in obj2.sum
}
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Opinions on this Laravel Actions package?

 Programing Coderfunda     August 08, 2024     No comments   


https://www.laravelactions.com/

Has anyone used it and stopped using it? What were your reasons?

Anyone loving it and use it for everything? submitted by /u/Fluffy-Bus4822
[link] [comments]
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