Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,153,727 members, 7,820,515 topics. Date: Tuesday, 07 May 2024 at 04:21 PM

Webapi's Posts

Nairaland Forum / Webapi's Profile / Webapi's Posts

(1) (2) (3) (4) (5) (6) (7) (of 7 pages)

Programming / Re: Please I Need Explanation Of This Express.js Code by webapi: 6:35am On Jul 10, 2021
jikins:


Not at all. The code as is sends only one response what ever the case may be. Its only if an else statement is placed inside thats when you will get multiple responses.

Look at the code again. If it finds a user with that id. It changes found to true. Then sends the response with the user data. The if statement outside the foreach won't fire because found is true. So essentially only one response is sent.

If none of the id match, the response in the foreach never fires and found is not changed from being false. So automatically, the if statement outside fires because found is false. So you see only one response fires in either case.

The only way multiple responses will fire is if more than one user have the same id. Which is very unlikely as the unique id of each user is the basis for their identification. So doing that just won't work at all for foreach, even filter will give you an array of all the user that matches that id and that's not obviously what you want to send.
Yes you are correct but nevertheless, the OP was not supposed to pull all the users from the database before iterating. I dont know what kind of database he's using but it's a wrong approach to pull every user from database before iterating. If there are 1million users, it wouldn't be nice to fetch all
Programming / Re: Please I Need Explanation Of This Express.js Code by webapi: 11:03pm On Jul 09, 2021
jikins:


Yes filter is better. But the code as it is in the picture will still work out fine as long as there is only one user with that id, which is normally the case.
For this case, Foreach wont work at all because expressjs can only send one response. If he sends any response on this condition, he will get an error message saying it had already sent the request. Filter is the only best option here. But if he must use Foreach, then he would need to use the push function to push the data into an empty array then send the array at once as the response
Programming / Re: Please I Need Explanation Of This Express.js Code by webapi: 6:25pm On Jul 09, 2021
jikins:


You're right but my first statement still remains true. Using your initial code will still give you bugs.

Using your example the for each will give you true 4 times and false 6 times. So what if the last item in the array is false? The final result at the end will be false and not true. So the way it is written is much better than using else in there as it will always give you bugs except the final item is the true one
Yes sorry i wasn't advising him to use return statement. I was only guiding him about the if and else statement. He can do whatever he likes within the conditions. But the filter is still the best option to be on safe side.
Programming / Re: Please I Need Explanation Of This Express.js Code by webapi: 4:59pm On Jul 09, 2021
Here is a better solution for the OP since we are concerned about the items with user.id === id. Simple use the filter function to get the objects that matches the id then you send a success response.
Programming / Re: Please I Need Explanation Of This Express.js Code by webapi: 3:42pm On Jul 09, 2021
jikins:


If you understand how foreach works putting else inside the way you describe will give you bugs.

Foreach checks each item in the array. According to this your code if it checks the first item and the id don't match it returns error and that will be the end of its search. It won't go further than that because return stops the loop. So this just simply won't work at all.

Having this in mind you can begin to understand why the boolean of found was put inside to be changed to true only when the details matches. And the "!found" placed outside the foreach loop to catch the fact that if none of id matches found will never be changed to true.

Your point is completely wrong. Foreach is an iteration and it works per item/key. So if out of 10 objects of array, only 4 is true, then it will return true 4 times and false six times. It wont stop the iteration regardless of the condition you place. So back to my point, OP is completely wrong in his code.
Programming / Re: Please I Need Explanation Of This Express.js Code by webapi: 1:33pm On Jul 08, 2021
Karleb:


The boolean was really unnecessary there.
I tire ooo
Programming / Re: Please I Need Explanation Of This Express.js Code by webapi: 8:52pm On Jul 06, 2021
DDayve:
Please I need somebody to explain this code to me.
I was thinking that instead of using if (!found), I can as well use if (found===true). But the code didn't work when I used the later. Thanks in anticipation
Why do you need a special boolean for this? Simply add an else and return your error code..
If (user.id===id){
return success;
}else {
return error;
}

2 Likes

Programming / Re: We Need A Shopify App Developer by webapi: 6:39pm On Jun 03, 2021
Kate06:
Hello, I am back with another project for the app developers in the house.

I think Nigerians should get this money rather than giving them to the Pakistanis.

So, here is the sample in the pics below. If you are available to work, kindly signify by saying 'I am available' with your tel.gram username or whatsapp num as the case may be.

Payment is rewarding.
If it's still open, here is my telegram @icodesoftwares and yes i'm interested

1 Like

Programming / Re: Contact Me For Your Mobile App and Web Development by webapi: 11:48am On May 30, 2021
webapi:
For your android and ios project, contact me on 08170077580.

Webmasters / Contact Me For Your Mobile App and Web Development by webapi: 7:30am On May 30, 2021
For your web and mobile app projects, contact me on 08170077580

Webmasters / Re: I Need A Website For Akawo by webapi: 7:24am On May 30, 2021
EzeJustme:
I need a website that is suitable for daily contribution business (akawo)
How can I get a good and reliable one
Contact me on 08170077580. This is a huge project with a unique algorithm. Let's talk about your project.
Programming / Contact Me For Your Mobile App and Web Development by webapi: 7:22am On May 30, 2021
For your web and mobile app projects, contact me on 08170077580.
Programming / Re: Database by webapi: 9:27am On May 27, 2021
Whatshallido:

Thanks and God bless you. But what about phpmyadmin database? It can only store 500 data. Can i use it to store large volume of data?
You can increase all that from php init file to contain as much data. Also your hosting plays a big role here too. You need a dedicated server to be able contain much data
Programming / Re: Database by webapi: 11:17pm On May 26, 2021
Whatshallido:
Good afternoon my fellow progammers.
Please i have a question to ask, which database server is suitable with php to store plenty datas apart from mysql?I've used mysql, but it has a limited number of data it can handle. Please help me I'm learning.
Mysql can store billions of data so go ahead with it
Programming / Re: How Do You Integrate User Wallets by webapi: 10:06pm On May 26, 2021
Karleb:


I read a fintech named Wallet has one, also Stripe.

I would never write such from scratch unless I am releasing it as a package. Better to find a tested open source package for that.
I don't know of any open source but i write mine from scratch. Including withdrawals and escrow system on the wallet.
Programming / Re: How Do You Integrate User Wallets by webapi: 9:39pm On May 26, 2021
Karleb:
How can one integrate user wallet with paystack or flutterwave where user can deposit directly into their account.

Any resources that can help will be appreciated.
You don't integrate a wallet. You create a wallet and if you don't know much on writing such algorithm, i will advice you don't try it on production app. It can cause alot of damages on finance. Get a professional to do it then let him explain how he did it so you learn. Financial storage is nothing to be put on test.
Phones / Re: Nairalanders Please Help With This Issue by webapi: 8:31am On May 26, 2021
Quickly move your files to a PC before formatting. You can recover them after formatting.
Webmasters / Re: Seun by webapi: 9:07pm On May 25, 2021
Omoniyidarasimi:
How did SEUN OSEWA get use to programming without studying computer science
Was mark zuckerberg a student of computer science at harvard?.
Business / Re: How Can A Nigerian Collect Money From USA by webapi: 8:19pm On May 15, 2021
Arabiandude:

maybe you should mention my moniker elsewhere and give me the link of your previous courier work let me check. what do you think?
or you can give me the link here if its cool by you
Ok... https://siruexpress.com
Business / Re: How Can A Nigerian Collect Money From USA by webapi: 7:33pm On May 15, 2021
Arabiandude:

I saw your pm but I am not longer using the email attached to my nairaland. are you base in Benin City?
Not based in benin but can send my work on courier platform with the tracking system and other features. How can i connect with you?
Webmasters / Re: What Ecommerce Platform Is Been Used By Jumia? by webapi: 1:21pm On May 07, 2021
ibietela2:
Any Idea on which ecommerce platform is using? Or it is Custom script or theme?
Jumia uses php framework yii
Programming / Re: I Need React Native Developers by webapi: 9:13am On May 05, 2021
smile4kenn:
Are there any good react native developers in here. Im in need to hire a couple react native devs for a mobile project that I have. Please reply here and how I can be in touch and I will definitely contact you. Please you must be good in JavaScript and understand mobile dev.
08170077580 whatsapp

1 Like

Business / Re: How Can A Nigerian Collect Money From USA by webapi: 3:58pm On May 03, 2021
faceland:
Apart from wire transfer (Western Union and Money Gram), are there alternative to get money from a civilian in USA?

Where they can easily use their care to send the money and it is SAFE.
Worldremit

1 Like

Programming / Re: Can I Get A Documentation Of All Powershell CLI Commands? by webapi: 3:21pm On Apr 13, 2021
Rgade:
Is there such a thing?
Powershell is just like every other terminal. Cli depends on the softwares installed on your machine. You can use the terminal to run docker commands, nodejs commands, composer, python and other stuffs.
Programming / Re: If You Are Good With React Hooks And Context API by webapi: 6:48pm On Mar 28, 2021
techstack:
Please contact me
Check my phone number on my profile

Thanks
Redux saga is best
Properties / Serious Clients Only by webapi: 7:01pm On Mar 26, 2021
This house is for sale. It stands on 770sqm land. 5 bedrooms, 2 rooms b/q, 2 living rooms and a large kitchen.

Asking price N150million.

It’s a directs mandate from the owner itself

Location.....VGC gan gan

Call or chat 08179353237

Webmasters / Re: How To Integrate Flutterwave With Woocommerce by webapi: 3:13am On Mar 23, 2021
Manlike2good:
I have done that already. under settings I have a tab called API where I can get the secret and public keys. then I have another tab where I see webhook. I can't find the secret hash and it is required for WooCommerce aswell
I can fix it for u
Webmasters / Foxtichweb Company by webapi: 10:05pm On Mar 06, 2021
Our services

Software development
Web development
Mobile app development
Social media management
Chatbot development
Graphic design
UIUX design

Put a call to us now!!!!

Business / Re: Is It Just Me Or Has Nairaland Become Really Slow In Loading? by webapi: 11:25pm On Mar 04, 2021
RounDVisio:
I have noticed for some weeks now that nairaland website has been painfully slow when it comes to loading pages.

I am wondering if it is just me and my network or has anyone been experiencing this too?
Itz everyone bro... Nairaland is very slow
Programming / Re: Web Developers You Are Needed Asap by webapi: 8:45pm On Mar 03, 2021
Observer20:
If you know you can build a site with the description in the image below watsapp me on this number, someone needs your services.
09029128610
I sent a message

(1) (2) (3) (4) (5) (6) (7) (of 7 pages)

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 46
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.