// pages/index.js
import Link from 'next/link'
export default function HomePage() {
return (
<div>
<h1>Welcome to our news site!</h1>
<ul>
<?php | |
class User | |
{ | |
protected $name; | |
protected $surname; | |
protected $password; | |
public function setName($name) | |
{ |
<?php | |
function array_size($arr) { | |
$byte = 0; | |
foreach ($arr as $key => $val) { | |
$byte += is_array($val) ? array_size($val) : mb_strlen($val); | |
} | |
$kb = number_format($byte / 1024, 4); | |
$mb = number_format($byte / 1048576, 4); | |
$gb = number_format($byte / 1073741824, 4); | |
$result = array('Bytes: ' => $byte, 'Kilobytes: ' => $kb, 'Megabytes: ' => $mb, 'Gigabytes: ' => $gb); |
The easiest lay to get first and last element from an array in javascript with one line code. | |
<script> | |
const meals = ['apple', 'orange', 'bananna']; | |
const {length, 0: first, [length - 1]: last} = meals; | |
console.log(first, last) | |
</script> |
To enable anti-aliased fonts just for Netbeans, add -J-Dawt.useSystemAAFontSettings=on to the end of the netbeans_default_options line in /usr/share/netbeans/etc/netbeans.conf e.g.: | |
netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-Dawt.useSystemAAFontSettings=on" | |
Alternatively, you can set this globally so that all AWT apps are affected, by setting the _JAVA_OPTIONS environment variable in your .bash_profile: | |
export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true' | |
This also has Swing equivalent, using the swing.aatext preference. You'll have to log out and log back in for this to take effect. |
Do you know that if you call setIndexes([...indexes, index]);
too fast.. one after another time.. its possible only to update the array, but not to increment it?
The problem you're facing may be due to the asynchronous nature of the setState
function in React. When using the useState
hook, the setState
function doesn't update the state immediately, but during the next render of the component.
Your logic for adding values to the setIndexes
array can looks correct but.. However, when you use setIndexes([...indexes, index])
, you're actually accessing the previous value of uploadedFiles
, which may not be updated yet.
To solve this issue, you can use the functional form of setState
, where you take the previous value of the indexes
array and add the new value to it. Here's an example:
setIndexes((prevIndexes) => [...prevIndexes, index]);
https://support.ssl.com/Knowledgebase/Article/View/19/0/der-vs-crt-vs-cer-vs-pem-certificates-and-how-to-convert-them | |
Certificates and Encodings | |
At its core an X.509 certificate is a digital document that has been encoded and/or digitally signed according to RFC 5280. | |
In fact, the term X.509 certificate usually refers to the IETF’s PKIX Certificate and CRL Profile of the X.509 v3 certificate standard, as specified in RFC 5280, commonly referred to as PKIX for Public Key Infrastructure (X.509). | |
X509 File Extensions |
RUN - command triggers while we build the docker image.
CMD - command triggers while we launch the created docker image.
RUN EXPLAIN: RUN is an image build step, the state of the container after a RUN command will be committed to the container image. A Dockerfile can have many RUN steps that layer on top of one another to build the image. RUN: Commands May not Execute if Images are Cached.
<?php | |
define("CHATGPT_API_KEY", "your-key-goes-here"); | |
$data = array( | |
"model" => "text-davinci-003", | |
"prompt" => "What is PHP and how it works?", // Your question or request | |
"temperature" => 0.5, | |
"max_tokens" => 500 | |
); |