lets say
var name = “test”;
Have tried
$(‘#form-text’).text(name); and $(‘#form-text’).val(name);
No matter what happens, the name is not being inputted and the form field is still empty.
Blancer.com Tutorials and projects
Freelance Projects, Design and Programming Tutorials
Category Added in a WPeMatico Campaign
lets say
var name = “test”;
Have tried
$(‘#form-text’).text(name); and $(‘#form-text’).val(name);
No matter what happens, the name is not being inputted and the form field is still empty.
The navbar/header section of this project seems to be overlapping the Call To Action section after uploading it to host and then viewing it on my phone. This is confusing because on devtools when I switch to my iphone specific dimensions it is fine and all other listed device dimensions are responsive in devtools when working on the project on my computer. What could be causing this issue to happen after I push it to the host?
here is how the project looks on my phone

As you can see the top navbar is overlapping the CTA.
Here is the code for the app
const App = () => (
<div className='w-full overflow-hidden'>
<div className='bg-cta-gradient z-[0] h-[450px] mobile-height-change'>
<div className={`fix-bg-img flex-col h-[450px] mobile-height-change
relative overflow-hidden ${styles.paddingX} ${styles.flexCenter}`}>
{/* background image */}
<div className='background-img z-[0] absolute overflow-hidden'></div>
{/* header section */}
<div className={`mt-5 margin-bottom absolute z-[2] ${styles.boxWidth}`}>
<Navbar />
</div>
<div className={`z-[0] mt-5 cta-mobile-change ${styles.boxWidth}`}>
<CTA />
</div>
</div>
</div>
{/* body sections */}
<div className={`${styles.flexStart} mobile-margin-change`}>
<div className={`${styles.boxWidth}`}>
<BodyTop />
</div>
</div>
<div className='w-full h-[650px] md:h-[350px]'>
<BodyMiddle />
</div>
<div className={`${styles.flexStart}`}>
<div className={`${styles.boxWidth}`}>
<BodyBottom />
</div>
</div>
{/* footer section */}
<div className='bg-footerBgColor sm:h-[720px] md:h-[350px] mt-10 rounded-tr-[80px]'>
<Footer />
</div>
</div>
);
export default App;
I use package mysql for NodeJs to Post Data to MySqlDB
this is my code example:
app.post('/countries', (req, res) => {
const country = req.body.country;
const city = req.body.city;
const town = req.body.town;
con.query('insert into countries value(?, ?, ?)', [Canada, Toronto, Mississauga]
})
I have an Error because I did’t insert ID VALUE, what value should I put in POST if inside MySql id = auto-increment? thank you =)
I did’n find the idea to resolve this proplem
Getting the following error when running playwright tests on azure pipeline
Please advise how to resolve the error
Node 16.16.0
C:\Windows\system32\cmd.exe /D /S /C "C:\hostedtoolcache\windows\node\15.0.0\x64\npm.cmd --version"
7.0.2
C:\Windows\system32\cmd.exe /D /S /C "C:\hostedtoolcache\windows\node\15.0.0\x64\npm.cmd config list"
; "global" config from C:\npm\prefix\etc\npmrc
cache = "C:\npm\cache"
; "env" config from environment
prefix = "C:\npm\prefix"
userconfig = "C:\a\1\npm\104610.npmrc"
; "cli" config from command line options
omit = []
user-agent = "npm/7.0.2 node/v15.0.0 win32 x64 ci/azure-pipelines"
; node bin location = C:\hostedtoolcache\windows\node\15.0.0\x64\node.exe
; cwd = C:\a\1\s
; HOME = C:\Users\AzDevOps
; Run `npm config ls -l` to show all defaults.
C:\Windows\system32\cmd.exe /D /S /C "C:\hostedtoolcache\windows\node\15.0.0\x64\npm.cmd run test"
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path C:\a\1\s/package.json
npm ERR! errno -4058
I'm trying to run playwright test cases on the azure pipeline but getting
error enoent ENOENT: no such file or directory, open 'C:a1spackage.json
I am using datatables for my project and I am using hidden column to display tooltips.
Is there a way I can style them? Maybe add some animation to it.
Right now, the tool tip looks default. I want to make it interesting for the user. Here is my code . Thanks.
$(document).ready(function() {
var table = $('#example').DataTable({
responsive: false,
paging: false,
scrollX: true,
scrollCollapse: true,
lengthChange: false,
searching: true,
ordering: false,
columnDefs: [{
targets: 2, visible: false
}],
rowCallback: function(row, data, displayNum, displayIndex, dataIndex) {
$(row).attr('title', data[2]);
}
} );
} );
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<link href="https://nightly.datatables.net/css/jquery.dataTables.css" rel="stylesheet" type="text/css" />
<script src="https://nightly.datatables.net/js/jquery.dataTables.js"></script>
<meta charset=utf-8 />
<title>DataTables - JS Bin</title>
</head>
<table id="example" class="cell-border row-border stripe dataTable no-footer dtr-inline" role="grid" style=" width: 100%; padding-top: 10px;"><thead>
<tr>
<th> </th>
<th> </th>
<th> </th>
<th colspan="3" style=" text-align: center;">Information</th>
<th> </th>
</tr>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
<th>Hidden Column</th>
</tr>
</thead>
<tbody>
<tr>
<td>ID.AI</td>
<td><p>System: Architectghhghjjkjukjkj<p></td>
<td>Edinburgh</td>
<td>61</td>
<td>2011/04/25</td>
<td>$3,120</td>
<td>Sys Architect</td>
</tr>
<tr>
<td>Garrett -2</td>
<td><p>Director: fgghghjhjhjhkjkj<p></td>
<td>Edinburgh</td>
<td></td>
<td>2011/07/25</td>
<td>$5,300</td>
<td>Director:</td>
</tr>
<tr>
<td>Ashton.1 -2</td>
<td><p>Technical Authorjkjkjk fdfd h gjjjhjhk<p></td>
<td>San Francisco</td>
<td>66</td>
<td>2009/01/12</td>
<td>$4,800</td>
<td></td>
</tr>
</tr></tbody></table>
</div>
hello I would like to block email addresses that contain “@mailbox”
when a user registers on wordpress with the wp-members plugin I tried this code but it returns a critical error
add_filter( 'wpmem_register_form', 'custom_register_form' );
function custom_register_form( $form ) {
$form .= '<script>
jQuery(document).ready(function($){
$('#wpmem_reg').submit(function() {
if ( $('#user_email').val().indexOf('@mailbox') > -1 ) {
alert('L'adresse e-mail fournie n'est pas valide pour l'inscription.');
return false;
}
});
});
</script>';
return $form;
}
I am trying to use the Facebook JavaScript SDK to get access to post to pages.
According to the documentation, I need to request 3 scopes to do this using the super simple example (Which means I can then get to request and extended token and then a page access token)
FB.login(function (response) {
if (response.authResponse) {
FB.api('/me', function (response) {
console.log('Hello ' + response.name);
});
} else {
//login cancelled or not every permission accepted
}
}, { scope: "pages_show_list,pages_read_engagement,pages_manage_posts" }
However this fails. I get this error in the Facebook pop up.
If I remove the scope: "pages_show_list,pages_read_engagement,pages_manage_posts" then it works and I log in… but I obviously don’t have the permissions I need.
How to get this to work?
I have a multipart/related request that contains a SOAP part with security headers and message data, and a binary part.
The SOAP message contains the key used during the encryption of the binary part, which I can retrieve.
The binary part is a gzipped string encrypted with aes-128-gcm . The returned tag is appended to the encrypted part, and the iv used during the encryption is prepended to the encrypted part. So we have a value => [iv][encryptedPayload][tag].
When I control everything myself and make sure that all the values I work with are binary, I can encrypt and decrypt without issues, but this does not seem to be the way the binary part is generated according to the Peppol AS4 specification.
Can anyone help with guiding how to encode the binary part and properly split it?
Here is a full example of how I encrypt a string, add it to a mocked body and encode it in base64, and then go all the way back decoding and decrypting to get to the original string.
import crypto from 'crypto';
const plaintext = 'hello aes-128-gcm'; // string to be encrypted
const algorithm = 'aes-128-gcm';
const encryptionKey = crypto.randomBytes(16);
const nonce = crypto.randomBytes(12); // generate an iv to prepend to the payload
const cipher = crypto.createCipheriv(algorithm, encryptionKey, nonce); // init cipher to encrypt the string
let payloadEncrypted = cipher.update(Buffer.from(plaintext).toString('base64'), 'base64', 'binary');
payloadEncrypted += cipher.final('binary'); // encrypted string
const tag = cipher.getAuthTag(); // get the mac tag to be appended to the payload
const payload = nonce.toString('binary') + payloadEncrypted + tag.toString('binary');
console.log(payload); // final payload to be submitted
// mocking request payload. Building an example multipart request and base64 encoding it
const body = `
--uuid:4535f302-c49e-4a8e-b32f-49c3da3577fc
Content-Type: application/soap+xml; charset=UTF-8
Content-Transfer-Encoding: binary
Content-ID: <[email protected]>
<env:Envelope</env:Envelope>
--uuid:4535f302-c49e-4a8e-b32f-49c3da3577fc
Content-Type: application/octet-stream
Content-Transfer-Encoding: binary
Content-ID: <0a7f6252-3854-4376-920d-5a01ae89a6e9@ip-10-10-131-116.eu-west-1.compute.internal>
CompressionType: application/gzip
MimeType: application/xml
${payload}
--uuid:4535f302-c49e-4a8e-b32f-49c3da3577fc--
`;
const b64Payload = Buffer.from(body).toString('base64');
// decoding the base64 request and decrypting the payload in the binary part
const request = Buffer.from(b64Payload, 'base64').toString();
const bData = Buffer.from(request.split('n')[14], 'binary').toString('binary'); // the payload
const splitNonce = bData.substring(0, 12); // the prepended nonce
const splitEncryptedPayload = bData.substring(12, bData.length - 16); // the encrypted payload
const splitTag = bData.substring(bData.length - 16); // the appended tag
const decrypt = (content, tag, iv, password) => {
const decipher = crypto.createDecipheriv(algorithm, Buffer.from(password, 'binary'), Buffer.from(iv, 'binary'));
decipher.setAuthTag(Buffer.from(tag, 'binary'));
let dec = decipher.update(content, 'binary', 'utf8');
dec += decipher.final('utf8');
return dec;
}
// I'm reusing the encryptionKey from above, in reality this would have been encrypted and provided in the SOAP message
const decrypted = decrypt(splitEncryptedPayload, splitTag, splitNonce, encryptionKey);
console.log(decrypted); // the decrypted message
When I try the above with an actual request (starting from the “decoding the base64 request and decrypting the payload in the binary part”) I get an [Error: Unsupported state or unable to authenticate data] in the decrypt function.
I am trying to create a little stock website dashboard and when I go to include the script to Chart.js I get this error now
DevTools failed to load source map: Could not load content for https://cdn.jsdelivr.net/npm/chart.umd.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
Note that I have the correct link in my file and it previously worked but broke for some reason, the link I have in my SRC is
<script src="https://cdn.jsdelivr.net/npm/chart.js"> </script>
Why is it adding .map when I go to run the page and what do I do to fix it?
I am getting data from supabase and passing it as a prop then using the usual map to iterate over the data and display the values I need. But for some reason I can’t get it to display. I thought getServerSideProps returned the data before the page gets rendered. I get the correct results on my console.log(programme.title) but nothing gets rendered.
import React from 'react'
import { createClient } from '@supabase/supabase-js'
export async function getServerSideProps() {
const supabase = createClient(process.env.NEXT_PUBLIC_SUPABASE_URL!, process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!)
const { data: programmes, error }: any = await supabase
.from('Programmes')
.select('*')
return {
props: {
programmes,
},
}
}
function programmes({programmes}: any) {
return (
<>
<div className='mx-auto px-12'>
<div className='my-24 flex flex-col'>
<h1 className='font-extrabold text-5xl'>Les programmes Natyf</h1>
<p>Actualités, films dramatiques, comédies, documentaires, talk-shows, spectacles de variétés et d’humour hauts en couleurs et en saveurs!</p>
</div>
{programmes.map((programme: any) => {
<div>
{console.log(programme.title)}
<div className="max-w-sm bg-white border border-gray-200 rounded-lg shadow dark:bg-gray-800 dark:border-gray-700">
<a href="#">
<img className="rounded-t-lg" src="/docs/images/blog/image-1.jpg" alt="" />
</a>
<div className="p-5">
<h5 className="text-xl tracking-tight text-transparent bg-clip-text bg-gradient-to-r from-cyan-500 to-blue-500">{programme.show_time}</h5>
<h2 className='text-2xl font-bold text-white'>{programme.title}</h2>
<p className="my-4 font-normal text-gray-700 dark:text-gray-400">{programme.description}</p>
</div>
</div>
</div>
})}
</div>
</>
)
}
export default programmes
At first I had tried making a function that returns my data from supabase and calling that function via useEffect() but I quickly realized my object was empty at render so I switched to using getServerSideProps
The rehype-remark plugin uses Github Flavored Markdown to parse HTML into Markdown.
In other words, it uses * for italic and ** for bold.
However, I want to use _ for italic, and keep ** for bold. Because using only * is causing errors in my parser, while _ works well.
Is there a plugin or config that changes the markdown default?
Been having this problem for a while. Trying to access the details of the Fungus upon clicking the API. Posting the precise details since this project is merely a learning experience. Upon click of an image, I get GET http://localhost:5500/api/fungus?id=310771 500 (Internal Server Error) in the console via /gallery but in the new window, where I am supposed to see the details, I get http://localhost:5500/fungus?id=undefined and can see all object properties show as undefined on the page. However, I can see the correct id in “showFungusDetails” and “showFungiGallery” in the console, which is what confuses me. I can’t seem to find a solution that displays the details correctly when opening the new window – as well as accesses the ID correctly. What am I doing wrong? I’ll include only part of the code below that I think is relevant. (The /gallery endpoint works as expected – it adds imageUrls of all Fungi to an array).
CLIENT-SIDE:
async function showFungusDetails(imageUrl) {
try {
const id = imageUrl.split('/')[4].replace(/D/g, '');
const response = await fetch(`${apiUrl}/api/fungus?id=${id}`);
const json = await response.json();
const fungusDetails = {
id: json.id,
default_photo: json.default_photo,
name: json.name
};
return fungusDetails;
} catch (error) {
console.error(error);
return {
error: 'Something went wrong'
};
}
}
async function showFungiGallery() {
try {
const response = await fetch(`${apiUrl}/api/gallery`);
const data = await response.json();
const galleryElement = document.getElementById('gallery');
const detailsContainer = document.getElementById('details');
galleryElement.innerHTML = '';
for (const imageUrl of data.images) {
const img = document.createElement('img');
img.classList.add('allFungi');
img.src = imageUrl;
galleryElement.appendChild(img);
img.addEventListener('click', async function() {
const id = imageUrl.split('/')[4].replace(/D/g, '');
console.log(`id: ${id}`);
const fungusDetails = await showFungusDetails(imageUrl);
console.log(fungusDetails);
if (fungusDetails) {
const id = fungusDetails.id;
const detailsWindow = window.open(`${apiUrl}/fungus?id=${fungusDetails.id}`, '_blank');
detailsWindow.onload = function() {
const detailsContainer = detailsWindow.document.getElementById('details');
detailsContainer.innerHTML = `
<h2>${fungusDetails.name}</h2>
<img src= ${fungusDetails.default_photo}>
`;
}
}
});
}
} catch (error) {
console.error(error);
}
}
return {
...
showFungusDetails: showFungusDetails,
showFungiGallery
}
SERVER-SIDE:
app.get('/gallery', (req, res) => {
res.sendFile(path.join(__dirname, '..', '..', 'public', 'gallery.html'));
});
app.get('/fungus', (req, res) => {
res.sendFile(path.join(__dirname, '..', '..', 'public', 'fungus.html'));
});
// Show fungi gallery
app.get('/api/gallery', async (req, res) => {
try {
let response = await axios.get(`https://api.inaturalist.org/v1/taxa?taxon_id=47170&rank=species&page=${page}&per_page=${perPage}`);
....
}
//Show fungus details
app.get('/api/fungus', async (req, res) => {
const id = req.query.id;
try {
const response = await axios.get(`https://api.inaturalist.org/v1/taxa/${id}`)
const fungusDetails = {
id: id,
default_photo: response.data.default_photo.medium_url,
name: response.data.name,
};
res.send(fungusDetails);
} catch (error) {
console.error(error);
res.status(500).send(error);
}
});
I need to make it possible to access in a secure way to sentive keys on my next js amplify app.
I have tried a lot of approaches, but the goal here is not to hardcode the variables or the accounts keys in the code to make it work, I even try to invoke the keys in the amplify.yml file so I can used it by typing process.env.
version: 1
env:
variables:
secrets:
# SECRET_KEY_NAME defined in secrets manager
MY_SECRET_KEY: SECRET_KEY_NAME
frontend:
phases:
preBuild:
commands:
- export MY_SECRET_VALUE=$(aws secretsmanager get-secret-value --secret-id ${env.MY_SECRET_KEY} --query SecretString --output text)
- echo "MY_SECRET_KEY=${MY_SECRET_VALUE}" >> .env
- yarn install
build:
commands:
- yarn run build
artifacts:
baseDirectory: .next
files:
- '**/*'
cache:
paths:
- node_modules/**/*
But after deploying I get an xml error (This XML file does not appear to have any style information associated with it. The document tree is shown below.)In the deployed app url.
Nothing makes sense have anyone ever done this, if so; how?
I
Complete noob here.
I’m creating a 3d art gallery using three.js. I’m using PointerLockControls to look around.
I want the art on the walls of my gallery to be able to be clicked so a pop up can show up after clicking it and display information, but PointerLockControls seems to disable clicking and/or using the mouse in general for anything that is not looking around.
How can I enable the click and the mouse cursor to be displayed while still using PointerLockControls?
As I said. Complete noob here. Tried adding this eventlistener for the click but it just doesn’t work. I even added a console.log and it sends no message to my console.
Tried adding the console.log to the renderer’s domElement and to the document and it does work. The problem seems to be the artowrk.
Everything displays just fine, but I can’t get that pop up to show. Here’s the code for that segment
let art2Texture = new THREE.TextureLoader().load('img/art/2.png');
const art2Geometry = new THREE.PlaneBufferGeometry(8, 8);
const art2Material = new THREE.MeshBasicMaterial({
map: art2Texture
});
const art2 = new THREE.Mesh(art2Geometry, art2Material);
art2.position.z = -49.9;
art2.position.y = 3.5;
art2.userData = {
name: 'Artwork 2',
description: 'This is the description of Artwork 2',
link: 'https://here-goes-the-link',
};
art2.addEventListener('click', () => {
console.log('Artwork 2 clicked!');
const popup = document.createElement('div');
popup.className = 'popup';
const title = document.createElement('h2');
title.textContent = art2.userData.name;
const description = document.createElement('p');
description.textContent = art2.userData.description;
const link = document.createElement('a');
link.href = art2.userData.link;
link.target = '_blank';
link.textContent = 'View on OpenSea';
popup.appendChild(title);
popup.appendChild(description);
popup.appendChild(link);
document.body.appendChild(popup);
});
// CSS for the pop-up
const popupCSS = `
.popup {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: white;
border: 2px solid black;
padding: 16px;
width: 300px;
text-align: center;
z-index: 1;
}
.popup h2 {
margin-top: 0;
}
.popup a {
display: block;
margin-top: 16px;
}
`;
const popupStyle = document.createElement('style');
popupStyle.textContent = popupCSS;
document.head.appendChild(popupStyle);
scene.add(art2);
Thanks in advance
I am working in Excel to create a Value in one column on the first time data is edited in another column in this case is is columns 3 to collect time data when column 6 is edited. I found this Code block that will trigger is a column is empty but I am new to coding and don’t know how to edit this myself. Is there a way to add trigger to only do this if the column 6 has a value?
function onEdit(e) {
var sh = e.source.getActiveSheet();
var row = e.range.getRow();
var col = e.range.getColumn();
var stampCol = sh.getRange(row, 3);
//check if "stampCol" is empty
if (!stampCol.getValue()) {
const sh = e.source.getActiveSheet();
sh.getRange ('C' + e.range.rowStart)
.setValue (new Date())
.setNumberFormat ('MM/dd/yyyy HH:MMam/pm');
}
}
I tried searching for ways to modify those code on google and forums but find anything that helped.