Politics › Re: Emmanuel Uduaghan To Return To PDP After Two Years In APC by crunchyDope(m): 12:46pm On Sep 22, 2020 |
Goke7: wow is this how horrible these ss governors are? uan dey try, I hail Lol boss na so o.. funny thing is we just de quiet about em like who dem nak jazz...to leave here(i mean ss) dey hungry me..nothing dey here na only keke work and yahoo..lolz  |
Politics › Re: Emmanuel Uduaghan To Return To PDP After Two Years In APC by crunchyDope(m): 11:47am On Sep 22, 2020 |
CashVessel: Uduaghan that did not add any value to Delta State and the PDP is talking about being used. Who really used who? Uduaghan used the PDP as he was never competent to be governor in Delta state. He left the PDP cos he was scared that he would be investigated by the APC central government for squandering the wealth and time of Deltans like no other governor, both past and present has. PDP should do themselves a favour and reject his U-turn as he has no value whatsoever to add. boss abeg no vex, am from delta state ..biko tell me werin okowa don do for delta state...even the uduaghan bus when dey give us cheap transportation ..the guy sell am...the traffic lights when uduaghan do the guy no maintain am...na jobs he provide? abeg just let me know, cos even d road he do don spoil unlike the one uduaghan do (example is ovwian) them still dey.. so abeg let me know...no be for mouth or paper abeg point am make i happy  |
Programming › Re: Node Js Gurus @nswer This Biko by crunchyDope(op): 10:51am On Sep 22, 2020 |
cixak95211: There is really no need to be checking the config every 15 mins, that is a cron job. Yes, crons have their use case but in this case, why dont you make whatever changes your config, send a webhook event. Saying "hello, config has been changed" Now the server will just sit idle and wait to receive that webhook event and when it does receive it, it knows the config has been changed and can then proceed according to your demands. Just in case you were wondering, during ci/cd, the server does not run a cron job every now and then to see if a new branch or pull request has been merged, Rather, it sits idle and wait for that message to come in; and when it does come in, it looks at the message details and handles the request accordingly. You save more server resources this way. I hope this comment has helped you. i am using the cron-job library to do the checking of the config , but looks like am going to make the core dependent on a file, and while am at it i would pick up the webhooks tuts. thanks! |
Programming › Re: Javascript Gurus Get In Here Biko by crunchyDope(op): 7:19pm On Sep 21, 2020 |
Karleb: Why would the configuration file change?
If I'm not mistaken, config file should be one of the easiest to set up.
Why not create a separate config file for the new changes?
What is stopping you from having a database.js, mail.js, session.js, cache.js, whatnot.js... Under a config directory? too much js, too much to manage. also m querying an api and i dont think its reliable |
Programming › Re: Javascript Gurus Get In Here Biko by crunchyDope(op): 6:59pm On Sep 21, 2020 |
Karleb: Why would you want to do that? because the json format might change and i want d code to adapt..  lets say d api is nested 3 levels and suddenly its 4 levels , how do i change d value seeing as d code is still doing .. json[levelA][levelB][levelC]= "value" now if the json is now under another object, the code would fail  |
Programming › Re: Node Js Gurus @nswer This Biko by crunchyDope(op): 6:34pm On Sep 21, 2020 |
cixak95211: i dont understand, why would u be changing values in production? Or you mean change values of a sample config file? Give me on clear use case. ok boss i was thinking about the whole running process of this node js,and d updating the code thingy. so am thinking abt having a core(app) running that checks the config file every 15 minutes. when it checks the config file? it could see a new file to run...lets say there is a "{ new: " new new new" }". it would take that new and load it, and call the init() on it.. now after another 15 minutes it would check that file and voila! that new still has the same file instead of {new:""}.. so how do i change the new in the config file, am using the config library |
Programming › Javascript Gurus Get In Here Biko by crunchyDope(op): 3:59pm On Sep 21, 2020 |
Question /Expectation Lets say this is a json config: { subconfig: { target :{
}
} }
normally i would do var value = json.config.subconfig.target;
buh how do i get it using a string like so eval("json" + "config" + "subconfig" + "target"  ?  <i might be in the wrong prof> |
Programming › Re: Node Js Gurus @nswer This Biko by crunchyDope(op): 2:59pm On Sep 21, 2020 |
[quote author=cixak95211 post=94076255][/quote]boss biko , how do yo change a value in a config file{dev or prod}? (programmatically)  |
Politics › Re: Edo 2020 Governorship Election Updates, Results And Live Monitoring by crunchyDope(m): 6:39am On Sep 20, 2020 |
Done! remain to end godfather for Lagos, Delta and porthHarcourt<mostly delta> biko |
Politics › Re: Edo 2020 Governorship Election Results (INEC Portal Updates) by crunchyDope(m): 9:01pm On Sep 19, 2020 |
sorom4: I am finding it difficult to activate use gmail |
Programming › Re: Node Js Gurus @nswer This Biko by crunchyDope(op): 2:25pm On Sep 17, 2020 |
CHIMDIYA4EVA: Working on a project and I know I'll have to use this refresh token concept. Already scared in advance as it's my first time doing anything reasonable with node  same boat....  |
Programming › Re: Node Js Gurus @nswer This Biko by crunchyDope(op): 9:25pm On Sep 15, 2020 |
codeigniter: that would work but it going to add more to d bill. the problem with node js jwt is that it doesn't create a table with the application/backend which makes it difficult to invalidate the token. anyways, I would prefer to use a table in my db. cixak95211: In memory dbs like Redis and Memcached are up to 300% faster in i/o operations that disk-based db like mongodb, mysql; because they reside in volatile RAM. Although you could persist the data once in a while, if persistence matters to you . . That's why it is preferred and it also prevents you from making the call to the DB [round-trip calling]. Secondly, sessions dont scale well, at least, vertically. Imagine you have deployed your app to 10 database replicas ....This can be disastrous, cos the first login request could go to Database A and if you're doing a round-robin, the next request, for that same user could go to Database E Now E doesnt hold the login session, it's held in A. To beat this problem, you have to sync your session data across all 10 Databases each time a user logs in, that's 10 round-trip calls. And you might ask why 10 DBS. . Facebook saves as of 2019, 1.5 petabytes of storage, that is not gonna fit into one database, not even into 10,000 databases, if they want efficiency codeigniter: that would work but it going to add more to d bill. the problem with node js jwt is that it doesn't create a table with the application/backend which makes it difficult to invalidate the token. anyways, I would prefer to use a table in my db. mehn u guys are too good, how do i get there? u guys make me feel stupid lolz, i feel like my personal project would be like crap if u guys were to look at it , like too many unnecessary codes! one question bosses like is it worth creating a table from a config file? m using the library "config" to get fields for a table or do i just write it in the code and update the code everytime i need to update a table . cos am writing a code to delete or alter a table field based on the config file and i feel the logic is flawed, bosses i need yo input |
Politics › Re: Protesters Cook In Front Of Shell In Rivers As They Protest Sacking Of Kinsmen by crunchyDope(m): 8:12am On Sep 15, 2020 |
Lipscomb: I will let you take water when you finally stop committing bluders. I will advise you to buy better grammar that will help you. bastard fool! <God forgive me> oga we don't care about English or Spanish or where dat language comes from as "lng @ss e x communicating" fvcking dummy, as if the whites can speak our language! u must still be a child . stupid! |
Politics › Re: Obaseki: I Will Promote Private Sector Investment For Job Creation by crunchyDope(m): 10:02am On Sep 14, 2020 |
enolife2: This is exactly what causes the fight between Obaseki and Oshomole. How can Oshomole left a lot of debt for Obaseki to pay and still want to be paying him hugh godfatherism fee. This same thing is what caused the fight between Tinubu and Ambode, But Ambode was not bold enough to stand his ground and reject the evil rather he step down. This same thing happened in Akwa Ibom state where Governor Udum Emmanuel fight and reject the Akpabio godfatherism evil and disgrace him in public. well done , conspiracy theorists, no proof, just words of payment |
Programming › Re: Node Js Gurus @nswer This Biko by crunchyDope(op): 6:15pm On Sep 12, 2020 |
cixak95211: You worry too much about the less important stuffs. There are more important stuffs to worry about e.g. how to scale up and down and keep costs low. Well to answer your questions. If you want your app to always stay online 24/7/365 even in the event of a terrorist attack or nuclear bomb blast, then you need to invest in "geo redundancy". Servers are divided into geographical location and zones. e.g. Eu-west-2 which stand for London in AWS [amazon] and Us-central-1 which stands for Iowa [Google] Those are now divided into zones, i.e. cities which are at least 100km apart from each other e.g. eu-west2-a, eu-west-2b, eu-west-3b . . repeat for us-central-1a u get the idea . . if you wanna make your app geo-redundant, you will need to deploy your app in multiple servers across different zones and countries. you might deploy it in 12 countries across the world . I hope you have money for that, cos the bill will be in hundreds of thousands of dollars each month. SO if Russia goes down, USA is stil online, ur app is still working. If CHina blows USA, the one is London is still workin . . London has fallen, then the one in South Africa is stil online . . if the whole 12 countries go down, then you know its the end of the world and nobody would be using the app anyways when we are all dead. Now the question is? Can yo afford it? So better stick to a single server, and when you make cash, like Jeff and Mark, you can even create your own server farms which is what they all did. Goodluck Iolz!!!! noted boss. |
Programming › Re: Node Js Gurus @nswer This Biko by crunchyDope(op): 12:52pm On Sep 12, 2020 |
DanTheGeek: [/quote][quote author=Xperienx post=93840398] you guys are still using the word rarely which means not "impossible".. so this is how i sleep knowing my crawlers might one day fail 
|
Programming › Re: Can Android Apps Be Created With Android Phones? by crunchyDope(m): 11:54am On Sep 11, 2020 |
moriton: I have two ideas for creating an app and I wonder if it's possible to create an android app with just and android phones.
App guru please help me out here. yeah it is possible! i would even say "too possible"  |
Programming › Re: The First Post In Nairaland Programming Section by crunchyDope(m): 11:52am On Sep 11, 2020 |
|
Programming › Re: Node Js Gurus @nswer This Biko by crunchyDope(op): 1:39pm On Sep 10, 2020 |
[quote author=cixak95211 post=93775436][/quote]i think am going to use vs and just do the reload thanks for the tutorial and the exposure. |
Programming › Re: Node Js Gurus @nswer This Biko by crunchyDope(op): 1:37pm On Sep 10, 2020 |
cixak95211: It not about being fast the users wont notice. It utilizes what we call 'graceful shutdown'. When you do a hot reload, imagine you have 10 users on yur platform, and 6 have sent a request to login at exactly when you did that reload. A cold reload will kill nginx, and they will recieve an error page. For A hot reload [because nginx uses master => slave workers]., the master will see that there are 6 pending request, and it will fulfil those requests first. The requests are handled by slaves, Then it will command the slaves to shutdown. Any new request (remember the other 4) will be routed to the new updated application. So in summary, it waits to fulfil any pending request before killing the processes. Read more on "worker thread and processes". its is very fundamental to building a performant application. For your local dev, u dont need any hot reload, waste of time. If you cant type npm run this, npm run that all the time just add shortcuts to ur terminal or console's profile e.g.
A few of mine, i have like hundreds of those literally, git push origin HEAD --force-with-lease = gpf npm run start:dev = dev yarn install = yi
you get the idea, right?
Then use autocomplete for your terminals, so yo dont have to remember even the shortcuts, cos u wil forget after some time. nice, thanks boss!!! you re too good!!! |
Programming › Re: Node Js Gurus @nswer This Biko by crunchyDope(op): 1:20pm On Sep 10, 2020 |
cixak95211: Nah, far from that . . thats for when you're writing codes on ur laptop. As part of your learning, you will venture into something called CI/CD. Pls google the full meaning. simply put, its a workflow that allows for continuous integration. I'll give u a case study of our own flow. We have 6 servers in AWS and they are always online. Once we make an update to github, it automatically pushes itself to AWS but code is not deployed yet, that's only a staging environment. It gives us a unque environment to test and test. When satisfied, we push to production. I like to do it manually, when am bored and here is what i do. 1. log into server via ssh 2. turn on bastion host, and update it to mirror staging environment, which as the latest update.. 3. We use nginx as a reverse proxy server . . . google what a reverse proxy is for claririfcation, it might not make sense tho for now 4. Open nginx config and reroute all traffic to bastion host. 5. Do a hot reload. A hot reload will make sure connections are not dropped, cos users are online, but it will switch all users automatically to the new version. You wont even notice. 6. Update main application. 7. Open nginx config again and reroute all traffic to main app 8. Do a hot reload once more. 9. Shut down bastion host and exit out of ssh server.
For our API, its running under PM2 process manager, and we have a flag called "watching" . . which means when there is a change, it will auto build and deploy itself and do a hot reload. It will do exactly the same thing I listed above but this time automatically. Its a very long story and might not make sense now. But trust me, your time will come. too rich for my blood..Lol.. u b truly guru! so its like so {code} => {dummy app} <= {users} {main app} code => {main app} users => {main app} <so fast the users wont notice> wow.. anyways for local host development , no hot reloading? |
Programming › Re: Node Js Gurus @nswer This Biko by crunchyDope(op): 1:07pm On Sep 10, 2020 |
[quote author=cixak95211 post=93772666][/quote]last question for now boss, if major company like uber and co uses node, how do they handle the service when they want to push an update? like they just ^C twice and npm start? just even in dev mode it is stressful, n easy solution? |
Programming › Re: Node Js Gurus @nswer This Biko by crunchyDope(op): 1:01pm On Sep 10, 2020 |
cixak95211: The url in this case, a url to where the application resides, usually localhost, if you are developing but in production, localhost will bind to the server ip address, which can in turn be bound to a custom domain so e.g . localhost:4000/api => 34.32.12.XX/api => nairaland.com/api so using nairaland as an example, if its a microservice, its gonna have at least 2 urls . . it could even be 50 . . but lets stick to the minimum 2 nairaland.com, which is what you will see and type, and that inturn will make a request to e..g. api.nairaland.com or nairaland.co/api [the owner chooses the style they like] . . the 2nd url is the server which responds with required data, and the data is shown to you on your screen or allows you to do something, eg. login. thanks so much!!!! |
Programming › Re: Node Js Gurus @nswer This Biko by crunchyDope(op): 10:22am On Sep 10, 2020 |
[quote author=cixak95211 post=93769127][/quote]which means the app instance is what handles all the url? |
Programming › Re: Node Js Gurus @nswer This Biko by crunchyDope(op): 10:20am On Sep 10, 2020 |
cixak95211: 1. Nodejs is meant for server-side applications . . although you can write a bit of frontend too, using stuffs like hbs and pug. But its primary focus is server-side code. Server side applications dont have that www.example.com/something where it displays a page. Nope! Yes, they might have a URL, but its more like api.example.com/v1 So you will need a frontend to marry the backend (node js) for a complete application . . Thats what is popularly referred to as a microservice architecture. as against Laravel for instance where both frontend and backend are sitting inside one application, Monolithic architecture. You can still use Laravel to write APis only, story for another day!
2. This question is now damn funny. Show truly you just started out, No shame in it, brov! As a professional software engineer, you will learn stuffs like "fault tolerance" which means what happens if I'm asleep and my server crashes? who will restart it? A fault tolerant app will restart itself. You will learn stuffs like process management. One good example is PM2. Google it, You will learn a little bit of server adminstration and what it means to deamonize an app [make it a service]. A service will always restart itself as long as it was enabled. Servers in production dont reboot. They can be online for 1000000 years without rebooting. Even your PC can be online for so long too, but eventually nepa will "take light" Servers are online 24/7. Google pictures of servers and see for yourself what they look like. And yes, you need to be very good with the terminal too.
One step at a time. Learn javascript first, then node then a little bit of cloud engineering, which will teach you most stuffs in server administration Then take a deep dive into building applications that scale, and mission-critical apps . .[app that shoudl nevr go down, even during updates for 1 second]. Good luck. thanks boss, fully understood. |
Programming › Node Js Gurus @nswer This Biko by crunchyDope(op): 7:38am On Sep 10, 2020 |
am just learning node and d whole thing looks like building a car(server) from scratch question 1 with php u just write your scripts and all link pointing at that direction just works! like so => www,example,com/test.php but would dat work in json node? cos it seems all the coding is done in this app.js file only! question 2 would i still go the terminal to start the app? in a live server? is that reliable? what if the system reboots? hw do i know? isn't dat too much work? sorry but not sorry for any grammatical errors, English is not my mother's tongue |
Politics › Re: Umar Danbatta: Nigerian Active GSM Subscribers Now 199.3 Million by crunchyDope(m): 6:34pm On Sep 01, 2020 |
nigeria has no data! lies my good sir! where did you get that data? did you remove ppl with up to 4 sims(like myself) . mtcheeew! |
Programming › Re: What Is Data Science And Its Application by crunchyDope(m): 1:56pm On Aug 25, 2020 |
truthfully u just sparked my interest in data science buh i don't know maths, well m riding |
Politics › Re: Buhari, Army Silent As US Exposes ISIS, Al-Qaeda Plans To Penetrate The South by crunchyDope(m): 9:04am On Aug 06, 2020 |
Simbrixton: u get gun? if I get i go say yes?
one thing we hate down here is Muslims! so make dem cum! |
Politics › Re: Buhari, Army Silent As US Exposes ISIS, Al-Qaeda Plans To Penetrate The South by crunchyDope(m): 9:01am On Aug 06, 2020 |
the South is not the north! |
TV/Movies › Re: Ka3na Stylishly Used Her Leg To Drag Her Shorts After Sex Romp With Praise by crunchyDope(m): 5:04pm On Aug 02, 2020 |
Jesse25: Ashawo go marry since watching people sleep and have sex is now a full time job Lol, it's my eyes, my TV, my job and my life! no one can dictate that! bye! |
TV/Movies › Re: Ka3na Stylishly Used Her Leg To Drag Her Shorts After Sex Romp With Praise by crunchyDope(m): 6:36pm On Aug 01, 2020 |
awon hypocrites oya, over to you  tell us how bbnaija is a waste of tym! fvcking dictators in the making!  |