Programming › [Code Review Help] Explanation In Java Needed by paranorman(op): 1:21pm On Oct 11, 2019 |
A semi-colon delimited file exists, I just wanna output its content to the console after splitting it like this using PHP: try { if (($fp = fopen("output.txt", "r" ) ) ) { while (!feof($fp)) { $line = explode(";", fgets($fp, 1024)) ; list($firstname, $lastname, $othername) = $line ; print "First name: $firstname; Last name: $lastname; Other names: $othername <br /> " ; } fclose($fp); } else { throw new Exception("Error: File is not available" ) ; } } catch(Exception $e) { //implement control logic here ; }The above code works as expected Java's output of this code is funny: import java.io.*; import java.util.*;
public class Test2 { public static void main(String[] args) { try { File file = new File("output.txt" ) ; Scanner in = new Scanner(file) ; int count = 1; while (in.hasNextLine()) { if (in.nextLine().contains( " ; " ) ) { String names[] = in.nextLine().split( " ; " ) ; System.out.printf("(%d) Your name is %s %s %s\n", count, names[0], names[1], names[2] ) ; } else { throw new Exception("String " + in.nextLine() + " does not contain ; " ) ; } count++; } } catch (Exception e) { System.out.println(e.getMessage()) ; } } }output:(1) Your name is jacob zuma zoomzoom (2) Your name is abbey jackson teme
This java code works just fine, as expected: import java.io.* ; import java.util.* ; import java.util.regex.* ;
public class Test { public static void main(String[] args) { try { File file = new File("output.txt" ); Scanner in = new Scanner(file) ; int count = 1; while (in.hasNextLine()) { String names[] = in.nextLine().split(Pattern.quote( " ; " ) ) ; System.out.printf("(%d) First name: %s; last name: %s; other names: %s \n", count, names[0], names[1], names[2]) ; count += 1; } in.close() ; } catch (Exception e) { System.out.print("An error has occured" ) ; System.out.println(e.getMessage() ) ; } } } output: (1) First name: john; last name: doe; other names: wick (2) First name: jacob; last name: zuma; other names: zoomzoom (3) First name: optimus; last name: primus; other names: autobots (4) First name: abbey; last name: jackson; other names: teme The text file is (output.txt)john;doe;wick jacob;zuma;zoomzoom optimus;primus;autobots abbey;jackson;teme question: Why is the console output of the first java program omitting the odd rows of the text file?! NL smileys are getting in the way, so I had to space some characters oddly out. |
Politics › Re: Buhari's Alleged Wedding: Nigerians Joke About The Wedding (Pictures) by paranorman(m): 9:37am On Oct 11, 2019 |
I am not even getting the drift. What have I missed? I have been so busy.. |
Christianity Etc › Re: Can A Man Advice God?? by paranorman(m): 8:57pm On Oct 07, 2019 |
Man cannot advise God, no. ....And there is a difference between intercession and advice. Moses was intercedding on behalf of the Isrealites. Abraham did something like this when he interceded on behalf of Sodom and Gomorrah because of Lot's presence in those cities, God didn't heed to Abraham's plea for two cities but saved Lot (and members of his families that Lot could) which was what Abraham wanted anyway. Samuel interceded for Saul and God rejected it. Standing in the gap is something God does not overlook and we have read several examples in the bible.
God also initiated several discussions with his prophets and judges in the old testament just to hear what they have to say and then agree to it. Jesus did same and got the perfect responses, sometimes, from folks seeking miracles, and even from His disciples.
God even honoured the request of some folks when they asked for signs in the old testament and Jesus gave none to those that asked for it in the new testaments since they had the books of the prophets to read from back then. |
Sports › Re: “Any Youth With A Benz Is A Yahoo Boy"— Policeman Tells Footballer During Arrest by paranorman(m): 8:49am On Aug 27, 2019 |
The need for reorientation is one thing I wave aside and I always think 'shouldn't people know these things? ' The force needs a mental overhaul. Their salaries, benefits and walfare packages needs overhaul, else they will continue these misconduct. For those that have had experience similar to this harassment, you'd hate the police. A armed robber could even treat you better than a cop. |
Phones › Re: NCC Fines Airtel, 9mobile N136m For Violating Industry Regulations by paranorman(m): 6:55am On Aug 07, 2019 |
As is in the cooperate world, it's someone's fault. Some employees of both telcos will bare the brunt by the time the emails will start flying around..
56 customers huh? Someone have reported them to NCC, and they investigated. Free cash to fly around. |
Crime › Re: Student Dies After Being Kicked In Chest By Fellow Student (Graphic) by paranorman(m): 6:11pm On Jul 05, 2019 |
Who added the dumb sound effect to this disturbing vid? |
Webmasters › Re: Cloudflare Servers Develop Problem: Many Websites, Services Went Offline by paranorman(m): 7:21pm On Jul 03, 2019 |
josielewa: Even WhatsApp, telegram and Instagram ain't working well... You can't download media from this sites I even thought twas my network provider problem o, but later got confused when I noticed texts messages had no issues |
Politics › Re: Ngozi Okonjo-iweala Celebrates Her 65th Birthday Today by paranorman(m): 9:08am On Jun 13, 2019 |
She was very pretty.. She still is sha |
Politics › Re: FG May Lift Land Border Vehicle Importation Ban — Customs Boss by paranorman(m): 7:05am On Jun 13, 2019 |
I see rice there didn't I? But saying rice was banned for logistical reasons is lame. We all know it's political. I guess it good news for dealers doing imports FROM Benin. If they like, they should adjust rates and make the price unbearable, people still smuggle them vehicles. Taking off all officers from the road?! They had better have something that really works, not on paper! |
Christianity Etc › Re: Michael McIntyre: Millionaire Who Hated God Gets Saved, Now Helping Christians by paranorman(m): 8:18am On May 19, 2019 |
Salvation |
Christianity Etc › Re: How To Hear God's Voice And See Visions by paranorman(m): 8:17am On May 19, 2019 |
Hmmm.. I see |
Business › Re: First Bank Vs Dispatch Rider: N355 Million Fraud Scandal (Photo) by paranorman(m): 5:06pm On May 14, 2019*. Modified: 5:42pm On May 14, 2019 |
Had he agreed to "submitting the form in error", he could have been in for it. Thank goodness he followed his instincts. |
Phones › Re: Delete For Everyone Now Available On Facebook Messenger (remove For Everyone) by paranorman(m): 2:04pm On Apr 27, 2019 |
Yeah |
TV/Movies › Recommend A Movies' Website by paranorman(op): 1:45pm On Apr 12, 2019 |
Can someone point me to website(s) I can download movies for free without hassles in? Like Captain Marvel in good quality |
Programming › Re: Help In Create Virtual Environment For Python by paranorman(op): 7:05pm On Apr 11, 2019 |
Thanks y'all for your inputs, really helpful |
Programming › Re: Help In Create Virtual Environment For Python by paranorman(op): 7:24pm On Apr 10, 2019 |
EvilSec: You could use Docker though. Expantiate |
Programming › Help In Create Virtual Environment For Python by paranorman(op): 1:56pm On Apr 09, 2019 |
I want install python 2 and python 3 on my system and I read that it's possible when you install in separate envroments. How do I go about this? Any help.. |
Christianity Etc › Re: Order Of Egbesu Brotherhood (OEB) Member Performs Rites In A River In Bayelsa by paranorman(m): 12:09pm On Apr 01, 2019 |
All this traditional nonsense thst couldn't save the forefathers when the whites came enslaving them.. Mtchew |
Crime › Re: Man Nabbed For Transporting Fuel From Vandalised NNPC Pipeline by paranorman(m): 12:08pm On Apr 01, 2019 |
The kind mind wey people dey get do these things always gets me awe-struck.. People get mind o |
Phones › Re: Mention Top 3 Smartphones You've Used In The Past(throwback) by paranorman(m): 5:05pm On Mar 28, 2019 |
Nokia express music Nokia E5 Samsung s5  |
Jobs/Vacancies › Re: Thread For those Invited for 2019 INEC Adhoc Staff by paranorman(m): 7:08am On Mar 22, 2019 |
obinoral1179: am also done with INEC received mine too, but am happy it came and all the cash I received from INEC was.... 4500 training fee collected on the morning if presidential election.
13000 alert received from Abuja
10000 received on the 9th of March after the gubernatorial elections.... We had to protest the money in all ward in Ikeja local government..
13000 received today from Abuja
4500+13000+10000+13000=40500..... NB the 10k is not directly from INEC but from state or local government..  |
Programming › Re: Node.js Or PHP ? by paranorman(m): 8:52am On Mar 21, 2019 |
Both have their strengths and weaknesses. Some call node.js a Javascript hack..  Good ol' php.. My advice? Learn both.. Languages are like tool stacks: some have it almost all, some are strong in certain aspects, some weak. For example, spread is one of such factor. Relax and have fun learning. |
Education › Re: University Admission Offer Vs Nigeria Air Force Recruitment Offer by paranorman(m): 8:58pm On Mar 16, 2019 |
obinoral1179: This is a serious issues but let me point the con and pro for you
Goin to school advantage
1 you will be able to build your intellectual capacity 2 you will be able to become a professional in any field you find yourself 3 you will be able to control your destiny and decide what to do with your life 4 you can impact your knowledge to others 4 you can strive to make it in life by challenging yourself 5 Education is the bedrock of a successful nation
Disadvantages
Nigeria settings will make you look for jobs after graduation
You will depend on your parent for funding
Lecturer will frustrate you
You need to come out with a good grade to be able to get a good job
Nigeria situation will turn you to teacher or compulsory entrepreneur...
Air Force advantage
1 after six month you will allocated a house and a salary is guaranteed
2 you will be able to control people with your uniform
3 promotion is after 5 years but you will write exam kr go to course in some field
4 you will be respected by civilian
5 your kids school fees will be reduce if they attend force school which am sure they will
6 after 6 months you are big boy and after 2 years you will be the one giving your parent stipend.
Disadvantages
They will likely post you to anywhere they want including BH states
Your life belongs to the air force
You can't further your education because that loop holes has been blocked
If you don't have a plan your retirement after 35 years will be a waste of time because you knowledge and experience will only be needed at CDA or landlord association....
Your parent will be praying everyday for you for fear death
The choice is yours, pray to God and seek his face he alone can tell what your future holds....if not for unemployment nobody will near Airforce or military job... Experience |
Programming › Re: How Much It Cost To Build An App Like Uber Or Spotify by paranorman(m): 8:55pm On Mar 16, 2019 |
resosdigital: I am really sorry but my busy schedule wont permit me to afford you with you a response any more because frankly I don't see the point.
Still waiting for the problems php7 would pose though and oh php7 has moved beyond "lamp".
And you are also sfree to keep making baseless and wrong assumptions about me.
Thanks How advanced as PHP come? |
Art, Graphics & Video › Re: DESIGNERS AND CLIENTS! Mini Guide On Having A Hitch Free Design Project by paranorman(m): 9:48am On Feb 10, 2019 |
My kinda thread.. Amazing content op |
Crime › Re: Lady Pours Hot Coffee On A Nigerian Man In Canada, Arrested by paranorman(m): 10:47am On Jan 28, 2019 |
 Space bookers above sha... |
Politics › Re: N100b Sukuk Fund Released For 28 Road Projects by paranorman(m): 6:51am On Jan 11, 2019 |
|
Christianity Etc › Re: 2019 Prophecies By Bishop David Oyedepo by paranorman(m): 1:37pm On Jan 01, 2019 |
My year of dominion in all ramifications.. |
Politics › Re: Tyranny : Police Cut Power Supply To Dino Melaye's House Sahara Reporters by paranorman(m): 5:05pm On Dec 30, 2018 |
Pathetic. I just wish PDP can win this coming election so that the defections and counter-defections can occur again, witch hunt of APC members, so the cycle of uselessness can continue.
Sebi you Nigerians don't want to have sense àbí? Continue rooting for APC or PDP you hear, by banking on sentiments and tribal foolishness; as if these guys have something to offer. They have both been tested and have failed woefully.
PDP and APC: different side of the same coin! |
Phones › Re: How Google Plans On Replacing Android With Fuschia OS by paranorman(m): 5:44pm On Dec 29, 2018 |
martineverest: dead on arrival..they tried doing same thing with chrome OS,it been a total failure.what about wear OS,android one?.....Google can't go beyond android OS..... privacy invasion has been Google's Frankenstein monster
with the advent of PWAs,I see many operating systems springing up....Samsung and Huawei will likely dump android when PWAs becomes popular.in short , android OEMs are looking for a way to ditch google PWA, what does it mean? |
Programming › Re: Help With This Angular Error by paranorman(op): 10:16pm On Dec 26, 2018 |
makavele2: Assignment for you:
Try to run the project again verbatim as your first post . . but use CDN instead . . Tell if it works or not . . I used CDN on 1.7.5 with your codes verbatim and it didn't work . . . So I am wondering why you mentioned a failed or incomplete download. I will, and revert back |
Programming › Re: Help With This Angular Error by paranorman(op): 9:39pm On Dec 26, 2018 |
Figured it out: the angularjs file I downloaded is incomplete i think, version 1.6.6 worked out just fine. Been a dataObj is json format, didn't initialize it properly as an object. Thanks. |