Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,153,944 members, 7,821,306 topics. Date: Wednesday, 08 May 2024 at 11:12 AM |
Nairaland Forum / Naijasensei's Profile / Naijasensei's Posts
(1) (2) (3) (4) (5) (6) (7) (8) (9) (10) (of 19 pages)
Programming / Re: My PHP Code Run Locally On XAMPP But Showing Syntax Error Online by naijasensei: 10:18am On Jan 31, 2021 |
Akprof: Please try uploading a screenshot of said syntax errors. These sort of issues can arise for so many different reasons. One such reason, as some have kindly pointed out, could be due to differences between your local XAMPP environment and the environment of your online server. 1 Like |
Programming / Re: Computer Science by naijasensei: 10:10am On Jan 31, 2021 |
wristandbands: This seems to be some sort of web development / computer programming training, and not Computer science. To be brutally honest with you, those course duration dates are highly unrealistic. The only people that will benefit from those courses are those who are not complete beginners. Look at the C++ training, it mentions four(4) weeks as the course duration - this is a huge joke. Fours weeks is not even enough for some people to learn easier languages like JavaScript and Python. Am I saying no one can do it? No, however the average student will struggle mightily. Even if you enlist for these courses, have it at the back of your mind that you will still have a lot of ground to cover after the training. If possible, request for the training school's scheme of work - so that you can compare it with other courses online. Finally, make sure you choose the courses that suit the path you want to follow. For example, web development, mobile development, database administration, etc. As always, the views expressed herein are solely mine, and they are not gospel. Thanks. 2 Likes |
Programming / Re: Thread For Nairaland Algorithm Questions by naijasensei: 8:36pm On Jan 23, 2021 |
cixak95211: From the way switch statements work, the expression within 'switch(expression)' is evaluated only once. That is this arrow function will always return either 0 (whenever amount is zero, or amount is undefined) or 50 for all other values because it ignores the comparison expressions in the two case statements following the first one. There are two possible solutions I can think of: 1. Use an if...else if...else construct. 2. Make the expression within 'switch(expr)' to always evaluate to true, then check your expressions within your case statements. const calculateFee = (amount) => { switch (true) { case amount === 0: case amount === undefined: return 0; case (amount > 0 && amount <= 5000): return 10; case (amount > 5000 && amount <= 50000): return 25; default: return 50; } }; const calculateFeeAlt = amount => { if (amount === 0 || amount === undefined) { return 0; } else if (amount > 0 && amount <= 5000) { return 10; } else if (amount > 5000 && amount <= 50000) { return 25; } else { return 50; } };
|
Programming / Re: Thread For Nairaland Algorithm Questions by naijasensei: 6:57pm On Jan 23, 2021 |
cixak95211: I agree with not using the additional variable 'temp' on line 42. As for line 23, the redundancy is intentional. As for the website for 20k guys, I reserve my comments - for now. |
Programming / Re: Thread For Nairaland Algorithm Questions by naijasensei: 2:32pm On Jan 23, 2021 |
cixak95211: Question 1 only: 1. Kotlin 2. Kotlin (continued) 3. Javascript
|
Programming / Re: Thread For Nairaland Algorithm Questions by naijasensei: 2:23pm On Jan 23, 2021 |
Karleb: 1. Kotlin 2. Python
|
Programming / Re: Thread For Nairaland Algorithm Questions by naijasensei: 6:10am On Jan 21, 2021 |
Donpre: Nice observation. There are several things at play here. Your Python interpreter stripped off the leading zero on your text input immediately you cast your input to type int, you can confirm this. If you try to supply an int with a leading zero, your program will not run because it is not a valid int. The main issue I see is, if zero(0) is the last digit on the integer you inputed - it will not appear in your reversed integer. This is because, you will end up having zero as your first integer digit - which is not valid. Therefore, when this solution is used - any integer input that has a zero as the last digit will not produce an integer output with a leading zero. |
Programming / Re: Thread For Nairaland Algorithm Questions by naijasensei: 9:49pm On Jan 20, 2021 |
Deicide: Modulo arithmetic, using the remainder of a division combined with the quotient. Because, given any integer, n: n / divisor = quotient * divisor + remainder. If 10 is our divisor (because it will preserve the number but shift the decimal point to the left, 123/10 = 12.3): Then, n / 10 = quot * 10 + rem. For example, 12345 / 10 = 1234 * 10 + 5. If we divide by 10 repeatedly until we get zero and store the remainder in a variable during each iteration, we can successfully reconstruct the number in reverse by adding the remainders while remembering to multiply each digit by their corresponding powers of 10. reversedNumber = (((rem1 * 10 + rem2) * 10 + rem3) * 10) + ... + remn Image1 - Python Image 2 - Kotlin
|
Programming / Re: Thread For Nairaland Algorithm Questions by naijasensei: 4:39pm On Jan 20, 2021 |
Deicide: How about Kotlin then, with two(2) different implementations.
|
Programming / Re: Thread For Nairaland Algorithm Questions by naijasensei: 12:59pm On Jan 20, 2021 |
Deicide: number = 12345 def rev_number(num): num_str = str(num) num_str = num_str[::-1] out_num = int(num_str) return out_num print(rev_number(number)) 1 Like
|
Programming / Re: Thread For Nairaland Algorithm Questions by naijasensei: 12:48pm On Jan 20, 2021 |
Brukx: my_input = input("Enter a number, either 4 or 7: " my_output = {'4': 7, '7': 4} def is_it_4_or_7(my_var): return my_output.get(my_var) print(is_it_4_or_7(my_input)) 1 Like
|
Programming / Re: My First HTML Page by naijasensei: 12:00pm On Jan 20, 2021 |
Telegram234: Nice job. I have a few pointers though. 1. You nested an 'hr' element within an 'h1' element. While you are free to do this, it is not semantically recommended. By the HTML standards, heading elements (h1, h2, h3, h4, h5, h6) are not supposed to have child elements. Also use heading elements for semantic purposes, not presentation purposes. 2. You didn't use the 'hr' element properly. The 'hr' element is an empty element, so it has no content or closing tag - just an opening tag. 3. Similar issue with your 'br' element, it is also an empty element. 4. The 'big' element is a deprecated element, it is no longer recommended for use. 5. The 'strike' element has also been deprecated, it is not valid HTML5. Use the 'del' or 's' elements instead. 6. Be careful how you use 'b', 'em', 'strong', and 'i' elements. Make sure you use them semantically and not for presentation purposes, especially the 'em' and 'strong' elements. 2 Likes
|
Programming / Re: Learning Programming. (my Nairaland Journal) by naijasensei: 11:44am On Jan 12, 2021 |
syluck: Karleb: I agree with what @Karleb said. Try and focus on one thing so that you can master it. You mentioned web development, which is a path or route. AI, Cyber Security, Machine learning, Mobile App development, and Data Science are some other paths. To continue using Python for web development, there are two major frameworks you need to get familiar with - Django, and Flask. Django is a full fledged, everything (batteries) included framework, that can be used to develop all manner of web apps. Flask on the other hand is a micro framework, which is best for developing APIs. In the web development domain, there are two(2) main areas - front end development, and back end development. Back end development takes care of interactions with your web server, interactions with your database server, and interactions with your server environment. Front end development basically has to do with things that happen in the browser, and the User Interface. Python is used for back end web development, other popular alternatives are PHP and NodeJS. I personally use PHP for web development for two(2) reasons: it was the first web development language I learnt, and web development is PHP's primary domain. I won't bore you with pointless arguments for and/or against Python, PHP, and NodeJS. I believe in using the best tools for the job, and I use whatever gets the job done. To round off your skills in web development, you will need to get a solid grasp of HTML, CSS, and Javascript for front end development. You can then decide which type of development you prefer, or you can combine the two to become a full stack developer. 4 Likes |
Programming / Re: Help Me Please. by naijasensei: 2:17pm On Jan 08, 2021 |
spartan117: Wow, that is impressive. As a wise person once said, if you cannot alleviate someone's pain, do not add to it. If you cannot put out a fire, don't add petrol to the fire. If you cannot help a person; don't denigrate, deride, or belittle the person in need - just move along. 1 Like |
Programming / Re: Learning Programming. (my Nairaland Journal) by naijasensei: 2:12pm On Jan 08, 2021 |
yusman14: Excellent explanation. @syluck, I hope you have read this. The screenshot you posted is simply referring to optional parameters (which always have a default value, and can be omitted), and compulsory parameters - which must always be provided. In the screenshot, the 'text' parameter is the only compulsory parameter, while the others are optional. P.S. What's with returning a dictionary though? I suspect you are probably mixing somethings up. |
Programming / Re: Help Me Please. by naijasensei: 12:11pm On Jan 07, 2021 |
martius101: I believe what you need is more of an IDE made for mobile. For example, there are Android based Python IDEs like Pydroid3 and QPython. However if you really want compilers and interpreters, you should consider installing a terminal emulator like termux. 1 Like |
Programming / Re: I Want To Learn Programming. Which Language Should I Start With? by naijasensei: 12:01pm On Jan 07, 2021 |
seunny4lif: Nice, clean, responsive design. |
Programming / Re: Learning Programming. (my Nairaland Journal) by naijasensei: 9:01am On Jan 05, 2021 |
syluck: Text files are simple files which lack the special formatting available in files produced by word processing software. As text files are popular and ubiquitous, it is only natural that every programming language has a way to access and modify text files. Other popular (universal) formats you should be interested in are JSON, XML, and CSV. In python when you open a file, you create a resource object (which points to the file), with that resource you can now decide on the mode you want to open the file in (read only, write only, append, read/write, etc). From here you can then get the contents of the file, or even insert content into the file. It is a broad topic, so I can't cover everything here. 2 Likes |
Programming / Re: Learning Programming. (my Nairaland Journal) by naijasensei: 8:28am On Jan 04, 2021 |
syluck: Yes, while loops are not as straightforward as for loops; but there are many instances where you have no choice but to use a while loop. The main thing to remember about while loops is that you have a condition that must be monitored, and the condition must be evaluated at the end of each iteration through the loop in other to prevent an infinite loop. while <condition>: <statements> <update condition> 1 Like |
Programming / Re: Learning Programming. (my Nairaland Journal) by naijasensei: 4:49pm On Jan 03, 2021 |
syluck: Hi, peruse the code in the attached screenshot.
|
Programming / Re: Learning Programming. (my Nairaland Journal) by naijasensei: 2:39pm On Dec 20, 2020 |
KingAbdulazeez:
|
Programming / Re: Learning Programming. (my Nairaland Journal) by naijasensei: 6:12pm On Dec 18, 2020 |
KingAbdulazeez: You can also search for "Think like a computer scientist 3", search for the Python version. 2 Likes |
Programming / Re: Learning Programming. (my Nairaland Journal) by naijasensei: 6:11pm On Dec 18, 2020 |
syluck: Great to see you are making progress. However, always remember proper indentation in your Python code, else you will get logic errors in your code (if you don't encounter syntax errors first). 1 Like |
Programming / Re: A Thread For Tutorial On Python Programming by naijasensei: 5:00pm On Dec 12, 2020 |
onecoder: Much cleaner, thanks. 1 Like |
Programming / Re: Joining Two Tables In Php by naijasensei: 12:34pm On Dec 07, 2020 |
walterjnr: First off, this isn't PHP - it is SQL, most likely MYSQL. Secondly, what are you doing? Thirdly, the second table is exactly the same as the first table, save for one column. Finally, aren't the columns in the proposed third table the same as those in the first table? If you want my candid opinion, that database schema needs to be redesigned ASAP. It would be more efficient to have only a "tbltransaction" table and drop the "tbltransactionbank" table. Better still, you can keep the "tbltransaction" table while changing the transaction_type to type_id (or transaction_type_id) which will link to a transaction_type table. As a developer, always remember you have finite resources; don't waste computing resources on inefficient tasks. 1 Like |
Programming / Re: NL API ? by naijasensei: 6:16pm On Dec 04, 2020 |
pcguru1: Wow, I couldn't agree more with your motivation. |
Programming / Re: NL API ? by naijasensei: 5:25pm On Dec 04, 2020 |
pcguru1: An API? An official API? I believe the posting stuff can either be done with bots, or some some of job scheduler working on queued jobs. |
Gaming / Re: I Want To Buy A PS VITA by naijasensei: 9:32am On Dec 03, 2020 |
pcguru1: Many people will never understand what you typed up there. Emulating hardware can be tedious, the PS2 is notorious because Sony included so many esoteric things like the "Emotion engine" and some other things which an emulator has to fully emulate before you can even dream of playing games. The PS3 and Xbox360 consoles moved much closer to the x86 architecture used in PCs; this is why both the PS3 and Xbox360 emulators were developed in a shorter time compared to the PS2 emulator. The terrible performance of PS2 emulators on Android compared to Dolphin - an excellent Gamecube/Wii emulator - is a testament to how difficult PS2 emulation is, despite the fact that the Gamecube is slightly more powerful than the PS2. Also, as you alluded to, CPU power is more important in emulation than GPU power. |
Gaming / Re: I Want To Buy A PS VITA by naijasensei: 9:03am On Dec 03, 2020 |
Ournolly: I agree with you that PES2021 Mobile is highly overrated. I installed it recently after uninstalling it some months ago, same frustrating game, same flaws, lazy developers, horrible online play, and no new modes. I promptly uninstalled the waste of space when it prompted me to install updates, good riddance to bad rubbish. 3 Likes 2 Shares |
Gaming / Re: I Want To Buy A PS VITA by naijasensei: 8:56am On Dec 03, 2020 |
UnBanEbenezer: As pcguru1 rightly said, your tablet is using an outdated SoC - the Mediatek MT8735B. This SoC has a severely under powered (and under clocked) CPU with quad-core cortex A53 cores matched with an equally disappointing Mali T720 GPU. This SoC was released more than 6 years ago. Back to your question; it might run the game (and this is a big if), but it is guaranteed to be a frustrating experience. |
Programming / Re: Good News For Those That Want To Learn Python by naijasensei: 5:01pm On Dec 02, 2020 |
Karleb: Very true. |
Programming / Re: Good News For Those That Want To Learn Python by naijasensei: 12:25pm On Dec 02, 2020 |
Juliusmomoh: Apologies if I sound harsh. Be careful with your emotions. Both Python and Java are general purpose programming languages, however, every programming language has its speciality. Python is best suited for Machine learning, AI, Data Science, and automation. These are not the only things Python can be used for, but these areas are where Python excels. Java is mainly used for Android app development, and enterprise apps development. Python has an easier learning curve than Java, true. Nonetheless, a programmer must always use the best tools available for the job. Python (with Kivy) can be used to develop mobile apps, but you will definitely run into problems down the road. The technology is not mature, is not widely adopted, and is certainly not widely supported. You will be entering a niche environment with a very limited community. If I want to drive a nail into a surface, I will use a hammer. If I want to loosen or tighten screws, I will use a screwdriver. Always try to use the tools that are best suited for a particular job. The moment you start viewing every problem as a nail, then the only solution will always be a hammer. Java/Kotlin are miles and away better for Android app development compared to Python. Similarly, Python is a better choice than Java for Machine learning. Recommended alternatives to Java/Kotlin for mobile app development are; React Native, Flutter, and Ionic. The opinions expressed are my personal opinions, thanks. 1 Like |
(1) (2) (3) (4) (5) (6) (7) (8) (9) (10) (of 19 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. 84 |