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

05 June, 2024

Why does `placeholder-shown:no-underline` work but `placeholder:no-underline` doesn't?

 Programing Coderfunda     June 05, 2024     No comments   

I expected placeholder:no-underline to remove the underline of an input's placeholder. However, placeholder-shown:no-underline does work. But I don't understand the CSS that is being created. Why does one work and the other not?


Example:

https://play.tailwindcss.com/gZIVyRDi6y
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Laravel Packages - Variable Validation & Sanitization

 Programing Coderfunda     June 05, 2024     No comments   

Self-taught Noob question... I'm probably over thinking this and being too paranoid, but something along the way gave me the impression that incoming variables need to be validated and sanitized.

There is no magic bullet built-in functionality that does that, right? I'm using the "Validator" package in combination with strip_tags(Purifier::clean($var) and I already added both of them to my custom-built controllers. I'm left wondering if that was wasteful and I'm particularly concerned about any outside packages I'm using.

If I need to add some code to the outside packages, then that would mean re-adding it every time they update/we adopt a package too, correct?

Thoughts and suggestions for best practices? submitted by /u/altdevD
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

04 June, 2024

Why do I get an Invalid Argument Exception when displaying a network image?

 Programing Coderfunda     June 04, 2024     No comments   

Sometimes when I call this code:
Widget displayImage(BuildContext context, MyBook book) {
if (book.coverUrl != null) {
try {
return Image.network(book.coverUrl!,
errorBuilder: (context, error, stackTrace) {
return Text('No \nimage');
});
} on Exception {
return Text('No \nImage');
}
} else {
return Text('No \nImage');
}
}



I receive the message



════════ Exception caught by image resource service ══════════════════


Invalid argument(s): No host specified in
URI file:///home/alan/FlutterProjects/books/null
═══════════════════════════════════════════════════════



(file:///home/alan/FlutterProjects/books/ is my app's path. book.coverUrl is a String.)
The online image displays properly, despite the Exception message.


What causes this? Do I need to fix it?


EDIT:
The end of the stack track also includes the message:



Image provider: NetworkImage("null", scale: 1.0)




Image key: NetworkImage("null", scale: 1.0)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Autohotkey - Is there a way to replace every string typed?

 Programing Coderfunda     June 04, 2024     No comments   

You can script autohotkey to replace specific strings, right? Hypothetically, is there a way to replace every string with specifically another?


I.e
Hey, I'm writing to you to... -> Quack, Quack quack quack quack quack


additionally, I want to add on a random number service that allows me to randomize each string into pre-selected options, though I think I can handle that on my own once I understand how to replace every string first


I.e
Hey, I'm writing to you to... -> Quack, Snack quack flack flack snack


Looking through the autohotkey documentation, I'm only able to find out ways to replace specific strings and inputs into other inputs. Is there a way to allow every string to be translated into one singular output?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

UInt16_t multiplication, SAM D21/DA1 microcontroller [closed]

 Programing Coderfunda     June 04, 2024     No comments   

I need to modify code on this microcontroller, because our old lights used servo PWM and the new lights use power PWM.
/**
* Convert a value from 0 to 255 to a 1.0 ms
* to 2.0 ms positive PWM cycle based on
* the clock configuration of the TC.
*/
void pwm_lamp_update(int index, uint8_t lamp_user)
{
uint16_t lamp = 0;
lamp = (240 * (uint16_t)lamp_user);
if (0 == index)
{
//lamp0_intensity = ((1175 * (uint16_t) lamp_user) / 100) + 3008;
//lamp0_intensity = lamp0_intensity * 2;
}
else if (1 == index)
{
//lamp1_intensity = ((1175 * (uint16_t) lamp_user) / 100) + 3008;
//lamp1_intensity = lamp1_intensity * 2;
//lamp1_intensity = 240;
//lamp1_intensity = 65500;
//lamp1_intensity = 31680;
//lamp1_intensity = (240 * (uint16_t)lamp_user);
lamp1_intensity = lamp;
lamp1_intensity = 41520;
}
lamp_user = lamp_user;
}



lampx_intensity is an uint16_t.


The first two lines of the if statements are code that creates a servo PWM type signal. I am trying to make a power PWM signal.


I find that if I hard code a number everything works fine. Anytime that I use a variable I don't get any output.


In the example above, even 'lamp1_intensity = lamp;' fails. I see a valid value for lamp1_intensity. The live microcontroller is not throwing any errors that I see. The light is not working and there isn't any PWM signal when it fails.


The microcontroller is an AT03259 SAM D21/DA1.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Encrypt with Prune, Dispatch without Delay & Prohibitable

 Programing Coderfunda     June 04, 2024     No comments   

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

Issue while getting data from Ringba API using Google Apps Script

 Programing Coderfunda     June 04, 2024     No comments   

I am trying to get call logs data from Ringba platform using Ringba API. I use the following script to get the data in specific date range.
function fetchRecordingData(spreadsheet, specificBuyerName) {

var ringbaSheet = spreadsheet.getActiveSheet();
var dateValue = ringbaSheet.getRange("K1").getValue();

var targetDate = new Date(dateValue);
var startOfDay = new Date(targetDate.getFullYear(), targetDate.getMonth(), targetDate.getDate(), 0, 0, 0);
var endOfDay = new Date(targetDate.getFullYear(), targetDate.getMonth(), targetDate.getDate(), 23, 59, 59);
var reportStart = new Date(startOfDay.getTime());
var reportEnd = new Date(endOfDay.getTime());

var url = "
https://api.ringba.com/v2/{{account id}}/calllogs";
const apiToken = '###';

var extractedData = [];
var offset = 0;
var size = 1000;

while (true) {
var payload = {
"reportStart": reportStart, //Fri May 31 2024 00:00:00 GMT-0600 (Mountain Daylight Time)
"reportEnd": reportEnd, //Fri May 31 2024 23:59:59 GMT-0600 (Mountain Daylight Time)
"orderByColumns": [],
"filters": [],
"formatDateTime": true,
"formatPercentages": true,
"formatTimeZone": "America/Denver",
"formatTimespans": true,
"offset": offset,
"size": size,
"valueColumns": [
{ "column": "callDt" },
{ "column": "campaignName" },
{ "column": "publisherName" },
{ "column": "inboundPhoneNumber" },
{ "column": "buyer" }
]
};

var options = {
"method": "POST",
"headers": {
"Authorization": "Token " + apiToken,
"Accept": "application/json, text/plain, */*",
"Content-Type": "application/json;charset=UTF-8"
},
"payload": JSON.stringify(payload),
"muteHttpExceptions": true
};

var response = UrlFetchApp.fetch(url, options);
var jsonResponse = JSON.parse(response.getContentText());

var records = jsonResponse.report.records;
if (!records || records.length === 0) {
break;
}

var filteredData = records.filter(function(record) {
return record.buyer && record.buyer.toLowerCase().trim() === specificBuyerName.toLowerCase().trim();
}).map(function(record) {
return [
record.callDt,
record.campaignName,
record.buyer,
record.publisherName,
record.inboundPhoneNumber
];
});

extractedData = extractedData.concat(filteredData);
console.log(extractedData.length);

if (records.length < size) {
break;
}

offset += size;
}

if (extractedData.length > 0) {
var range = ringbaSheet.getRange("A2:E").clearContent();
ringbaSheet.getRange(ringbaSheet.getLastRow() + 1, 1, extractedData.length, extractedData[0].length).setValues(extractedData);
}



There are total of 831 records for that given date, when I run randomly it gives the correct number of records. However, when I run it 2-3 times in quick succession, the number of records in output keeps changing (825,837).


Then I wait for 5-10 minutes, run it, and it gives the correct output (831) again. I am unclear why doesn't it always give the same output. Any guidance to point out my mistake would be much appreciated.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

03 June, 2024

Spring Security PreAuthorize using multi-value enum

 Programing Coderfunda     June 03, 2024     No comments   

I have a annotation that is declared as follows.
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@PreAuthorize("hasAuthority('SCOPE_{scope.getName()}') || hasAuthority('SCOPE_{ADMIN_SCOPE.getName()}')")
public @interface RequiredScope {
ServiceScope scope();
static final ServiceScope ADMIN_SCOPE = ServiceScope.SUPERADMIN;
}



I want to be able to pass in a required scope, but also have the superadmin scope be valid too. However, even when the proper authorities are present in the provided token, I get a 403 response stating that I have insufficient scopes.


The error says error="insufficient_scope",error_description="The request requires higher privileges than provided by the access token.",error_uri="
https://tools.ietf.org/html/rfc6750#section-3.1 when making a call to the endpoint via a Swagger page with a valid token provided.


The enum in question is structured as follows with various different scopes (not included)
@Getter
public enum ServiceScope {
String name;
String description;

private ServiceScope(String name, String description) {
this.name = name;
this.description = description;
}

}



The value in name is the actual scope in the token, I just need the annotation to pick it up. Fairly new to spring security, so please be kind!


I have referenced
https://docs.spring.io/spring-security/reference/whats-new.html to start, but haven't been able to find more helpful information
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Generating AES IV from Rfc2898DeriveBytes

 Programing Coderfunda     June 03, 2024     No comments   

I am using Rfc2898DeriveBytes to generate an AES key and iv. However, I heard that the iv should not be dependent on the password. Here's how I'm doing it right now:
byte[] salt = GenerateRandomBytes(32); // Generates 32 random bytes
using (Rfc2898DeriveBytes rfc = new Rfc2898DeriveBytes(plainStrPassword, salt)) {
byte[] aesKey = rfc.GetBytes(32);
byte[] iv = rfc.GetBytes(16); // Should I do this or generate it randomly?
}



My question: Is it OK (secure) to generate the iv from Rfc2898DeriveBytes? Or should I generate it randomly using RNGCryptoServiceProvider?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to monitor process status during process lifetime

 Programing Coderfunda     June 03, 2024     No comments   

I need to track the process status ps axf during executable lifetime.
Let's say I have executable main.exec and want to store into a file all subprocess which are called during main.exec execution.

$ main.exec &
$ echo $! # and redirect every ps change for PID $! in a file.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Docker json file log driver unescape

 Programing Coderfunda     June 03, 2024     No comments   

I am running docker on EC2 and my app is running as a container in this docker.


It produces a log like this:
{"key": "value"}



This is the output from docker logs . If I check the daemon log of the container from the /var/lib/docker/container/
{"log": {\"key\": \"value\"}}



Is there a way to unescape this in the daemon logs? There is a complex use case which can't be explained for me to use these logs.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Pytorch - sending dataset to cuda breaks the dataloader iterator - TypeError: can't convert cuda:0 device type tensor to numpy. Use Tensor.cpu()

 Programing Coderfunda     June 03, 2024     No comments   

I am trying to speed up my pytorch training by following the advice from here:



https://discuss.pytorch.org/t/cpu-faster-than-gpu/25343/12 />

So now, I am sending my trainingdata.data and .targets to cuda before starting training. What I am confused about it how to then use the Dataloader made off of the trainingdata in my train function, as when I try the way I had before (when I was sending individual batches to cuda), I get this error on the iterator of the dataloader:
TypeError: can't convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.



It is erroring on the following line (loader is the dataloader here):
for data, target in loader:



What am I doing wrong? How can I still use the dataloader while also sending the full dataset over to the gpu?


Python version is 3.12, pytorch is 2.3.0+cu121


Also, the error is the same if I dont include the pin_memory var to the dataloader


Full error trace:
Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm Community Edition 2024.1.2\plugins\python-ce\helpers\pydev\pydevd.py", line 1537, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\JetBrains\PyCharm Community Edition 2024.1.2\plugins\python-ce\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "C:\Users\me\PycharmProjects\NueralNetTests\TorchTests.py", line 181, in
main()
File "C:\Users\me\PycharmProjects\NueralNetTests\TorchTests.py", line 169, in main
train(epoch, model, loaders, device, optimizer, lossFN)
File "C:\Users\me\PycharmProjects\NueralNetTests\TorchTests.py", line 41, in train
for data, target in loaders['train']:
File "C:\Users\me\PycharmProjects\NueralNetTests\venv\Lib\site-packages\torch\utils\data\dataloader.py", line 631, in __next__
data = self._next_data()
^^^^^^^^^^^^^^^^^
File "C:\Users\me\PycharmProjects\NueralNetTests\venv\Lib\site-packages\torch\utils\data\dataloader.py", line 675, in _next_data
data = self._dataset_fetcher.fetch(index) # may raise StopIteration
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\me\PycharmProjects\NueralNetTests\venv\Lib\site-packages\torch\utils\data\_utils\fetch.py", line 51, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
~~~~~~~~~~~~^^^^^
File "C:\Users\me\PycharmProjects\NueralNetTests\venv\Lib\site-packages\torchvision\datasets\mnist.py", line 143, in __getitem__
img = Image.fromarray(img.numpy(), mode="L")
^^^^^^^^^^^
TypeError: can't convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.



and The code:
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')

_transform = Compose([
lambda img: rotate(img, -90),
lambda img: hflip(img),
ToTensor()
])

trainData = datasets.EMNIST(
root='data',
train=True,
transform=_transform,
download=True,
split='letters'
)
testData = datasets.EMNIST(
root='data',
train=False,
transform=_transform,
download=True,
split='letters'
)

trainLoader = DataLoader(trainData,
batch_size=100,
shuffle=True,
pin_memory=True
)

testLoader = DataLoader(testData,
batch_size=100,
shuffle=True,
pin_memory=True
)

trainData.data = trainData.data.to(device)
trainData.targets = trainData.targets.to(device)
testData.data = testData.data.to(device)
testData.targets = testData.targets.to(device)

model = CNN().to(device)
optimizer = optim.Adam(model.parameters(), lr=0.001)
lossFN = nn.CrossEntropyLoss()

for epoch in range(1, 2):
train(model, trainLoader, device, optimizer, lossFN)
test(model, testLoader, device, lossFN)

def train(model, loader, device, optimizer, lossFN):
model.train()
for data, target in loader:
optimizer.zero_grad()
output = model(data)
loss = lossFN(output, target)
loss.backward()
optimizer.step()

class CNN(nn.Module):

def __init__(self):
super(CNN, self).__init__()

self.conv1 = nn.Conv2d(1, 10, kernel_size=5)
self.conv2 = nn.Conv2d(10, 20, kernel_size=5)
self.conv2Drop = nn.Dropout2d()
self.fc1 = nn.Linear(320, 50)
self.fc2 = nn.Linear(50, 27)

def forward(self, x):
x = F.leaky_relu(F.max_pool2d(self.conv1(x), 2))
x = F.leaky_relu(F.max_pool2d(self.conv2Drop(self.conv2(x)), 2))
x = x.view(-1, 320)
x = F.leaky_relu(self.fc1(x))
x = F.dropout(x, training=self.training)
x = self.fc2(x)

return F.softmax(x)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

02 June, 2024

local issuer certificate error uniquely in docker with python

 Programing Coderfunda     June 02, 2024     No comments   

Following error occurs only with docker app in python when making request to an https url.





Outside of docker, the app works. I can fetch the same URL inside the docker image of other language app such as dotnet.


I have tried:



* RUN update-ca-certificates

* Install certfi library and manually supply the certificates during making the call

* Manually insert the certificates that comes with certify library in different locations of docker images such as /usr/local/share/ca-certificates/, /etc/ssl/certs/ and RUN update-ca-certificates

* Tried different versions (3.6.9, 3.8.4) and providers (alpine, buster, slim-buster ) of python.

* Setting different env variables such as REQUESTS_CA_BUNDLE, SSL_CERT_FILE etc.

* Use different libraries such as requests, urllib, urllib3






.... and really large number of different things.


It of course works when I turn the verify off, but I want to keep verification.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

MongoDB run loop to add incremental index value in array

 Programing Coderfunda     June 02, 2024     No comments   

I have a MongoDB collection where I have an array of objects and I want to add an incremental index value to each element of the array of objects.


Like index starts from 0 to array length - 1.
db.collection.aggregate([
{
"$unwind": "$array"
},
{
"$addFields": {
"array.index": {
"$add": [
{
"$ifNull": ["$index", 0]
},
1
]
}
}
},
{
"$group": {
"_id": "$_id",
"array": {
"$push": "$$ROOT.array"
}
}
}
])
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Jest - SyntaxError: Cannot use import statement outside a module

 Programing Coderfunda     June 02, 2024     No comments   

I am using jest:24.9.0 without any configuration, installed globally from a create-react-app. Inside these files I am using es6 modules. There is no error when using "test": "react-scripts test"



However when I move to use jest with "test": "jest --config jest.config.js", I see the below error.

FAIL src/configuration/notifications.test.js
● Test suite failed to run

/var/www/management/node/src/configuration/notifications.test.js:1
({"Object.":function(module,exports,require,__dirname,__filename,global,jest){import notifications from './notifications';
^^^^^^

SyntaxError: Cannot use import statement outside a module
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Weekly /r/Laravel Help Thread

 Programing Coderfunda     June 02, 2024     No comments   

Ask your Laravel help questions here. To improve your chances of getting an answer from the community, here are some tips:

* What steps have you taken so far?
* What have you tried from the documentation?
* Did you provide any error messages you are getting?
* Are you able to provide instructions to replicate the issue?

* Did you provide a code example?

* Please don't post a screenshot of your code. Use the code block in the Reddit text editor and ensure it's formatted correctly.






For more immediate support, you can ask in the official Laravel Discord.

Thanks and welcome to the /r/Laravel community! submitted by /u/AutoModerator
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

There is no resource to build Laravel video call app using only blade and not use 3rd party paid api.

 Programing Coderfunda     June 02, 2024     No comments   

Yes this is all. I want to build my video app but I could not find any good example to look what they did. There are many examples but all of them react or vue. Other examples are using Agora or other 3rd party paid tools so Is there any good point to start? submitted by /u/nothingen
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

01 June, 2024

python manage.py dumpdata Unable to serialize database

 Programing Coderfunda     June 01, 2024     No comments   

I am trying to run the command
python manage.py dumpdata > data.json


However, I receive such a traceback:
CommandError: Unable to serialize database: 'charmap' codec can't encode characters in position 1-4: character maps to
Exception ignored in:
Traceback (most recent call last):
File "C:\Users\Illia\Desktop\MyDjangoStuff\greatkart\venv\lib\site-packages\django\db\models\sql\compiler.py", line 1625, in cursor_iter
cursor.close()
sqlite3.ProgrammingError: Cannot operate on a closed database.




How to solve this issue?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

A few easy questions from a Laravel beginner.

 Programing Coderfunda     June 01, 2024     No comments   

I have a simple project in mind and I want to start working more with Laravel so I chose to start with that.

I want to create a simple admin panel with a rudimentary hierarchy Account > Store > Product Categories > Products and users that I want to assign to them.

I want to also create a public facing front-end for viewing those products.

I want to work with the Tall Stack for the admin panel and InertiaJS + Vue3 for the front-page.

My questions are:

* How do I add the --auth scaffolding in the TALL stack AFTERWARDS? I want to get started on the project and I don't care about the auth for now since most of it is ready anyway, but I don't see anywhere in the documentation how to add it later.
* Is there anything I need to setup for InertiaJS to be able to work in the project when the TALL stack is already configured? Are there any conflicts that I might experience down the line?
* Is there a good/large open source livewire project to get a better look at how people would usually work with Livewire?
* How do I inject a class in a Livewire component? For example, I will have a product page and I would like to have the logic separately in a productService or action or w/e. How would I inject the class? Do I do it in the constructor as usual?




I chose TALL stack for the admin and Inertia for the front-page because I want to learn both of those technologies as I intend to work with laravel mainly in the future. submitted by /u/AlkaKr
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to Run a Python File on a Specific Virtual Desktop Only?

 Programing Coderfunda     June 01, 2024     No comments   

I want to run a Python script on a specific virtual desktop without affecting other desktops.


Currently, when I execute my Python file using VS Code, the `webbrowser.open()` command opens the browser window on the desktop where I’m currently working, rather than the one where I initially started the program.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to create a responsive circle with two lines of text in HTML and CSS?

 Programing Coderfunda     June 01, 2024     No comments   

body {
display: flex;
justify-content: center;
align-items: center;
gap: 15px;
}

.circle {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background-color: #333;
color: #fff;
font-size: 32px;
font-weight: 600;
border-radius: 50%;
padding: 20px;
aspect-ratio: 1 / 1;
}


2
AP


200,000
AP







Why is the aspect-ratio CSS property not working here? When the text inside is long enough (like if I use 200,000 instead of 2, it is a square aspect ratio perfect circle). But I need it to work when the text is short too.


I want to avoid Javascript and hardcoding any widths or heights, because the circle should be fully responsive to the text inside of it, and be the minimum size required to display it (while also being a square aspect ratio).
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Can't connect to a specific wifi with error : unsupported get ioctl on awdl0

 Programing Coderfunda     June 01, 2024     No comments   

I'm trying to connect to a mixed 2.4Ghz and 5Ghz wifi. When trying to connect with the right password, my Mac is asking me to type the password again. By checking the logs, I was able to find what was the error:


_Apple80211AWDLCompatibilityInternal: unsupported get ioctl on awdl0 for APPLE80211_IOC_CURRENT_NETWORK[103]


The first time it happened was random, I was on the internet and connected to the same wifi and then suddenly I didn't have access to the internet and my Mac was asking me to type my password.


By running Ifconfig, I was able to see that, both, awdl0 and llw0 were inactive (which lead to Airdrop and Airplay being unusable). I was able to activate awdl0 back but not llw0


Here are the things that I have tried so far:



* Forget wifi

* Removing the following files:






sudo rm /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist
sudo rm /Library/Preferences/SystemConfiguration/com.apple.wifi.message-tracer.plist
sudo rm /Library/Preferences/SystemConfiguration/NetworkInterfaces.plist
sudo rm /Library/Preferences/SystemConfiguration/preferences.plist



* Reset NVRAM/PRAM

* sudo ifconfig llw0 up (not working, llw0 still inactive)

* Restart in safe mode

* Manually adding the wifi






None of them worked.


I have a 13 inch MacBook Pro M1 Sonoma 14.5 (up to date)


Any ideas ? I want to avoid a factory reset.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

31 May, 2024

Python interpreter if statement issue

 Programing Coderfunda     May 31, 2024     No comments   

So, I am making a really simple Python interpreter. But, there is a part in the interpreter that checks for if statements. But, whenever I use this interpreted if statement, it checks every other indented line (which is what code should be executed if the statement is true). My code is shown below.
def tof(c):
if eval(c) == True:
return True
elif eval(c) == False:
return False

def interpret(code):
lines = code.splitlines()
for line in lines:
if line.startswith("//") or line.strip() == "" or line.startswith(" "):
continue
if line.startswith("write(") and line.endswith(")"):
if line[6] == '"' and line[-2] == '"':
print(line[7:-2])
elif line[6:-1].isdigit():
print(line[6:-1])
else: # not done yet (variables)
v = line[6:-1]
exec(f"print({v})")
if line.startswith("if ") and line.endswith(" then"):
one = line.split("if ")[1]
c = one.split(" then")[0]
if tof(c) == True:
for x in lines:
if x.startswith(" "):
interpret(x.split(" ")[1])
elif tof(c) == False:
continue
if line[2] == "=" or line[1] == "=": # not done yet (variables)
if line[2] == "=":
a = line.split(" = ")[0]
b = line.split(" = ")[1]
exec(f"{a} = {b}")

code = '''
if 1 + 1 == 2 then
write("This should execute once!")
if 1 + 3 == 4 then
// asterisk are there to tell which message is which.
write("This should execute once! **")
'''

interpret(code)



I tried breaking the loop as soon as it sees an unindented piece of code, but if I put something like this:
if True then
write("Hello, World!")
write("Stops here :(")
write("Never gets here..")
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

The Modern Index.php File (A brief look at Livewire Volt)

 Programing Coderfunda     May 31, 2024     No comments   

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

Google workspace add-on install trigger with toolbar failed

 Programing Coderfunda     May 31, 2024     No comments   

It is very weird! The same code(attached below), user take diff installation ways, diff effects.


Success situation:
User A -> click menu item in Add-on menu to install trigger(Google sheet onEdit trigger).
User A can call that trigger when edit something in sheet.
All other users can call that trigger when edit something in sheet.


Failure situation:
User -> click the button in the sidebar by the toolbar icon to install the same trigger.
User A can call that trigger when edit something in sheet.
All other users cannot call that trigger when edit something in sheet.


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

Eloquent JoinWith Package for Laravel

 Programing Coderfunda     May 31, 2024     No comments   

---



The Eloquent JoinWith package by Mohammed Safadi lets you join existing HasOne and BelongsTo model relationships with a new joinWith() method. According to the package's readme, JoinWith will execute a single query instead of two separate queries, which can translate to faster and more efficient queries.


To use this package, you can either use the package's JoinWith trait or extend the package's provided JoinWithModel class:
namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Safadi\EloquentJoinWith\Database\Concerns\JoinWith;

class User extends Model
{
use JoinWith;

// ...
}



You can then call the joinWith() method, which resembles the with() method:
$user = User::joinWith('profile')
->select('users.id', 'users.name')
->first();

// Nested relationships
$user = User::joinWith('profile.country')->first();

// More complex example
$orders = Orders::joinWith(['user' => function ($query) {
$query->where('users.status', '=', 'verified');
}])->get();



This package works specifically with HasOne and BelongsTo model relationships—at the time of writing, other relationships are not supported. You can learn more about this package, get full installation instructions, and view the source code on GitHub at msafadi/laravel-eloquent-join-with.



The post Eloquent JoinWith Package for Laravel appeared first on Laravel News.


Join the Laravel Newsletter to get Laravel articles like this directly in your inbox.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Introducing laravel-command-bus!

 Programing Coderfunda     May 31, 2024     No comments   

Hello Laravel developers! I'm excited to announce the release of laravel-command-bus, a package designed to simplify and enhance command handling in your Laravel applications.

With this package, you can:

* Organize Your Code: Cleanly separate command logic from your controllers.
* Boost Maintainability: Keep your application code more readable and maintainable.
* Leverage Middleware: Easily add middleware to your commands for additional functionality.
* Implement CQRS Effortlessly: Separate your command and query responsibilities with ease.




Whether you're building a small app or a large enterprise solution, laravel-command-bus will help you manage commands more efficiently. Check it out on GitHub and give it a try today! submitted by /u/Crafty-Savings6727
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

30 May, 2024

Recoding an entire data frame using label-value pairs stored in a different dataframe

 Programing Coderfunda     May 30, 2024     No comments   

Suppose I have a dataframe:
df
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Snowflake: How to flatten the ACCESS_HISTORY View

 Programing Coderfunda     May 30, 2024     No comments   

in snowlake.account_usage.access_history DIRECT_OBJECTS_ACCESSED and BASE_OBJECTS_ACCESSED contains the objects that were involved in the query


Although it’s great to have these information, the format however prohibits us from joining this data with another object data to gain more insight about how the objects was used by the query (e.g. which warehouse this query was executed? How long did it take to execute? Was there an error encountered? Who executed it? etc.)


is there a way to flatten it ?


flatten the access_history view
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

AVD users facing issue with Error code: 0x3000047 Extended error code: 0x0

 Programing Coderfunda     May 30, 2024     No comments   

Users get disconnected from AVD machines with error code 0x3000047 Extended error code: 0x0


Here are the logs that we see


[{"Code":-2147467259,"CodeSymbolic":"ConnectionFailedAdTrustedRelationshipFailure","Time":"2024-05-30T12:01:46.7398504Z","Message":"Exception of type 'Microsoft.RDInfra.RDAgent.Service.AddUserToLocalGroupAdTrustedRelationshipFailureException' was thrown.","ServiceError":false,"Source":"RDAgent"}]


Is there a way to resolve/aviod this issue ?
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Newer Posts Older Posts Home

Meta

Popular Posts

  • Credit card validation in laravel
      Validation rules for credit card using laravel-validation-rules/credit-card package in laravel Install package laravel-validation-rules/cr...
  • Write API Integrations in Laravel and PHP Projects with Saloon
    Write API Integrations in Laravel and PHP Projects with Saloon Saloon  is a Laravel/PHP package that allows you to write your API integratio...
  • iOS 17 Force Screen Rotation not working on iPAD only
    I have followed all the links on Google and StackOverFlow, unfortunately, I could not find any reliable solution Specifically for iPad devic...
  • C++ in Hindi Introduction
    C ++ का परिचय C ++ एक ऑब्जेक्ट ओरिएंटेड प्रोग्रामिंग लैंग्वेज है। C ++ को Bjarne Stroustrup द्वारा विकसित किया गया था। C ++ में आने से पह...
  • Python AttributeError: 'str' has no attribute glob
    I am trying to look for a folder in a directory but I am getting the error.AttributeError: 'str' has no attribute glob Here's ...

Categories

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

Social Media Links

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

Pages

  • Home
  • Contact Us
  • Privacy Policy
  • About us

Blog Archive

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

Loading...

Laravel News

Loading...

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