ChatGPT is too powerful, will it replace all programming forums in the future?
GridView not displaying
I want to display name,description and image in GridView.
export default function NFTViewer({
}) {
const [galleryList, setGalleryList] = useState([]);
const metadata = [];
const cardActions = [];
const [data, setData] = useState()
useEffect(() => {
const getNFTDetails = () => {
fetch("http://localhost:4000/getDetails").then(response => {
return response.json()
})
.then(posts => {
setData(posts)
})
.then((err) => {
console.log(err);
})
}
getNFTDetails()
}, []);
useEffect(() => {
handleData();
}, [data])
const handleData = async () => {
const list = [];
for (const a in data) {
metadata[a] = await fetchIpfsJsonFromCid(data[a].cid);
metadata[a].image = makeGatewayURL(metadata[a].image);
console.log("image url " + metadata[a].image)
list.push(
<Card
style={{ width: 200 }}
key={data[a].name}
title={
<div>
{data[a].name}
<a target='_blank' rel='noreferrer'>
</a>
</div>
}
>
<img src={metadata[a].image} style={{ height:50,width: 130 }} />
<div style={{ opacity: 0.77 }}>{data[a].description}</div>
</Card>
);
}
setGalleryList(list);
};
return (
<div
style={{
maxWidth: 820,
margin: 'auto',
marginTop: 32,
paddingBottom: 256,
}}
>
<StackGrid columnWidth={200} gutterWidth={16} gutterHeight={16}>
{galleryList}
</StackGrid>
</div>
)
}
In console, I can see it print https://dweb.link/ipfs/bafybeicyb5zpppsdyu5fxxx/image.png
,which is valid image link, but display blank in web page.
But if I remove these two lines code,and put the valid image url, it able to display the data.
These 2 codes removed
metadata[a] = await fetchIpfsJsonFromCid(data[a].cid);
metadata[a].image = makeGatewayURL(metadata[a].image);
and replace valid image url from
<img src={metadata[a].image} style={{ height:50,width: 130 }} />
to
<img src={https://dweb.link/ipfs/bafybeicyb5zpppsdyu5fxxx/image.png} style={{ height:50,width: 130 }} />
It able to display
How to fix?!
Header color and font style not changing
Why header background not changing to red and font style not changing to coiny?
index.js
import Head from 'next/head'
import Image from 'next/image'
export default function Home() {
return (
<div className="min-h-screen h-full w-full flex flex-col bg-brand-light overflow-hidden">
<Head>
<title>Create Next App</title>
<meta name="description" content="Generated by create next app" />
<link rel="icon" href="/favicon.ico" />
</Head>
<main className='bg-red-700'>
<h1 className='font-coiny'>
Welcome to <a href="https://nextjs.org">Next.js!</a>
</h1>
</main>
</div>
)
}
tailwind.config.js
const defaultTheme = require('tailwindcss/defaultTheme')
module.exports = {
content: [
'./pages/**/*.{js,ts,jsx,tsx}',
'./components/**/*.{js,ts,jsx,tsx}'
],
theme: {
extend: {
fontFamily: {
coiny: ['Coiny', ...defaultTheme.fontFamily.sans]
},
}, colors: {
'brand-purple': 'var(--clr-purple)',
'brand-pink': 'var(--clr-pink)',
'brand-yellow': 'var(--clr-yellow)',
'brand-blue': 'var(--clr-blue)',
'brand-green': 'var(--clr-green)',
'brand-light': 'var(--clr-light)',
'brand-background': 'var(--clr-background)'
},
},
plugins: [],
}
global.css
@import url('https://fonts.googleapis.com/css2?family=Coiny&family=Open+Sans:wght@400;500;600&display=swap');
@tailwind base;
@tailwind components;
@tailwind utilities;
:root {
--font-family: 'Open Sans', sans-serif;
--clr-light: #f0e9e9;
--clr-purple: #9b5de5;
--clr-pink: #f15bb5;
--clr-yellow: #fee440;
--clr-blue: #00bbf9;
--clr-green: #00f5d4;
--clr-selection-bg: #cb3d92;
--clr-selection-text: #f4f0f0;
--clr-background: #06070a;
}
html {
scroll-behavior: smooth;
font-family: var(--font-family);
background: var(--clr-background);
}
::selection {
background: var(--clr-selection-bg);
color: var(--clr-selection-text);
}
_app.js
import '../styles/globals.css'
function MyApp({ Component, pageProps }) {
return <Component {...pageProps} />
}
export default MyApp
package.json
{
"name": "nft-minting-app",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"next": "13.0.5",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"tailwindcss": "^3.2.4"
}
}
Output
Display wrong author name
I notice a bug..
This post is not written by Dani, but it shows Dani is the writer ?
Software for creating image
I've been code for android/ios using flutter more than a year. Now I would like to learn new things by using software to create image instead of just getting icons from google material design (just like image below).
Any recommended ? Thanks.
Fun-filled game to boost your Christmas mood!
Jingle bells, jingle bells,
Jingle all the way ~
Christmas is around the corner. Wishing you all Merry Christmas !
Let's us play a game by guessing the correct answers for the emoji pictionary given :)
Do we really need to use abstract and interface in java project?
I've been writing one/two projects but I not using them. I'm not sure in which
scenario I should use them. Is this consider bad programming style?
What recommended answer actually mean ?
Example from this post
https://www.daniweb.com/programming/threads/533787/how-to-solve-this-i-got-same-answer
There are three replies (include one answer from OP), one of the replies mark as recommended answer.
Is the recommended answer marked by OP? It doesn't looked like an answer though.
StreamSubscription calling from another class
In my main activity, I have two tab, named tab1 and tab 2. Tab 2 page consists of a listView and I use StreamSubscription to listen upload progress result. On tab2 action bar, it has one icon. When icon is pressed, it will navigate to pageC,which consists of listView, and I use StreamSubscription too.
The problem is I notice when I upload image in PageC, it will display the upload progress in Tab2 page first, then only it will display upload progress in pageC. Why would this happened?
I defined subscription in both page as below
StreamSubscription<UploadTaskResponse> _subscription;
FlutterUploader uploader = FlutterUploader();
@override
void initState() {
super.initState();
_subscription = uploader.result.listen(
(result) {
print("Printing in pageC");
....
},
onError: (ex, stacktrace) {
},
);
});
}
I have defined the cancel() in both class too
void dispose() {
super.dispose();
_subscription.cancel();
}
Output
printing in Tab2
printing in PageC
Same variables in a class function
What are all num referring to ?
class Sample {
int num;
void method() {
num = 1;
int num = num = 2;
num = 3;
}
}
MPAndroidChart x-axis not dislpay all value
I drawing line chart using MPAndroidChart library.
I would like the x-axis display the date of September
1/09, 6/09, 11/09,16/09,21/09,26/09
Code
xAxis.valueFormatter = IndexAxisValueFormatter(weekdays)
xAxis.setLabelCount(5, true)
xAxis.axisMinimum = 0f
xAxis.axisMaximum = 30f
xAxis.granularity = 5f
xAxis.position = XAxis.XAxisPosition.BOTTOM
weekdays is
[1 / 09, 2 / 09, 3 / 09, 4 / 09, 5 / 09, 6 / 09, 7 / 09, 8 / 09, 9 / 09, 10 / 09, 11 / 09, 12 / 09, 13 / 09, 14 / 09, 15 / 09, 16 / 09, 17 / 09, 18 / 09, 19 / 09, 20 / 09, 21 / 09, 22 / 09, 23 / 09, 24 / 09, 25 / 09, 26 / 09, 27 / 09, 28 / 09, 29 / 09, 30 / 09, 1 / 09, 2 / 09, 3 / 09, 4 / 09, 5 / 09, 6 / 09, 7 / 09, 8 / 09, 9 / 09, 10 / 09, 11 / 09, 12 / 09, 13 / 09, 14 / 09, 15 / 09, 16 / 09, 17 / 09, 18 / 09, 19 / 09, 20 / 09, 21 / 09, 22 / 09, 23 / 09, 24 / 09, 25 / 09, 26 / 09, 27 / 09, 28 / 09, 29 / 09, 30 / 09]
It looked simple, but the x-axis just not showing all !
25 Best Active Forums for Programmers
Although this post -25 Best Active Forums for Programmers is one year old post, but DaniWeb is one of it !
Receive notification when someone is posting a post
Hi,if I have interested on one of the forum, example post which has Java tag, can I receive notification if someone is posting on that forum?
Which layer should we start with when building an application?
When we build an application, which layer should we start with?
From top (UI) to bottom(Data Layer) or bottom to top?
Should I not using third party for development?
I making an android app which need to display data analysis in Gantt Chart.
I implement this library from https://github.com/PhilJay/MPAndroidChart and it runs smoothly in my app.
But what I'm worrying is if this library has been removed from github repo, will my app get effected?
Please be aware of the Momo Challenge !
Parents please be aware and very cautious of what your child watches on YouTube and KIDS YOUTUBE. There is a thing called ‘Momo’ that’s instructing kids to kill themselves, turn stoves on while everyone is sleep and even threatening to kill the children if they tell their parents!!!
Different between !.equals and !=
Are there any differencies between these two code ?
if (!a.equals("")) {
editDate.setText(a)
}
and
if (a!="") {
editDate.setText(a)
}
Can’t post question with code
When posting code, I get error
begin a line with 4 spaces in a row (or one tab), preceded by a blank line. 4+ spaces or tabs may not be used anywhere else.