Shimao's Posts
Nairaland Forum › Shimao's Profile › Shimao's Posts
1 2 (of 2 pages)
Heard too, but how true? |
Abegi! Make Mr. President go do medical checkup. He's always looked hypothyroid to me. The stress of the office is bringing it to the fore. |
You've been given all you need but just to add, you might need to add some recursive code and you might as well check up the Composite design pattern. |
Your first approach was better. You are using a hashmap to store values so you'll need a keyset to iterate through it. After getting the keyset, use a for, Loop to iterate through the keyset (cos the keyset is a collection of all the keys used to index values in your hashmap) while matching the current key with the supplied key. Once you get a match, break out of the loop. You can handle a no match situation by throwing an exception. Also for your addFile method, you do not need instance variables to hold arguments passed in to your method. You can work directly with the values. |
I can assure you No. 6 is a regular occurence in Nigeria. Funny though. |
Multithreading is simply running many tasks at the same time. Computers used to have only 1 processor and programs are instructions for the processor to execute and processors can only do things one at a time. So how do you get to play audio, type, download and do all sorts at the same time? Well, the system creates threads which are distinct lines of execution of codes for each task and shares the processor time between available threads. This is called context switching and occurs so fast that the user never notices. Now multithreading used to be a system level thing and with older programming languages, you'll have to load system specific libraries to accomplish it. However multithreading is built into java and allows your program remain uniform accross platforms. Multithreading introduces its own problem because its like you have a group of people that want to use the same thing, so you have to control access and guarantee the integrity of the shared resource. Multithreading can be used to increase performance of applications and also efficiently use resources. |
The US must love Nigeria and Nigerians so much that she wants a military base here to defend Nigeria and Nigerian citizens and I'm happy most NL realize that. |
Check out this sample implementation code. |
csharpjava has addressed some of it but it could still be better. Declare the initial position of your box and its dimension as variables, so also the distance to move with each key press. Use these as arguments to draw the box. I believe you intend to use a KeyListener, in your event handling code, use a switch to check which key was pressed and increment or decrement the initial x or y position as it would apply, then repaint. Your class need not implement an event handling interface as you may be giving it unintended responsibility. |
Though there are issues with the structure of your code, there actually isnt any code that moves your box. For you to simulate movement in code, you need to change either the x or y or both coordinate of your target object. Then ofcourse, have the GUI repainted. |
I agree it has lost its shine. There's very little of stimulating topics. |
Sadly, there isnt much to see. |
Whether you are or against the involvement of the US in Libya, pray the fragile peace in 9ja is sustained else I can bet you the US will be here in a jiffy at the slightest whiff of crisis, whether as NATO, UN, AU or whatever. It's all about the oil. |
Morgan Kaufmann series. Networking in java. |
By the way, the QuestionBank should be a singleton. |
I could be mistaken but it seems to me the problem the guy has is with the GUI, how data is displayed and input obtained from user, and not how data is stored or retrieved or the workings of his system. More so you guys seem to have expanded the SuD and would probably leave the guy confused. @Danyl Two objects you will certainly need are; Question - abstracts your question, its options, answers (correctAnswer, userAnswer), and probably has a mark() method. Degree of granularity is left to you. QuestionBank - abstracts retrieval of question from whatever storage mechanism you use and holds your Question objects, preferably in a Collection. It should keep a counter, to know the current point in the quiz and test for the end of the quiz, and have getter methods; nextQuestion() and previousQuestion(). You retrieve Question from the QuestionBank and have it displayed on your GUI. You can have a QuestionScreen (JPanel), which holds the current question and has a displayQuestion(Question q) method which is used to update your JLabels as appropriate - use a JLabel to display your question and not a Canvas. When a user clicks one of your JRadioButton, you set the corresponding option in the userAnswer in the current question. your next and previous navigation button would then be used to change questions. NB. you can even use the previous button to display the user's answer if the question has already been attempted. At the end of the quiz, all you need to do is to loop through all the Question in the QuestionBank, calling the mark() method and totaling the correct answers. You get the drift? |
Though could be done in different ways, try this; Abstract your questions into objects of a Question class, which holds at least the question and its options and answer. Use a List (preferably) or an Array to hold your question objects; Keep a counter to hold the current position in your question pool; Increment or decrement your counter with each click of next or previous; Use the value of your counter as a key to retrieve a question from the pool; Update your interface to display the current question and its options; Use a generic ActionListener to set the answer on a current question; Fill in the gaps as required. The rest should be intuitive. |
Post the code and let us help u debug. |
He said the 2000 medical doctors produced annually in Nigeria is highly inadequate, adding that some out of this number will still seek to practice in other countries.Why would they not seek to practice elsewhere? Do you know how appalling the situation of the health sector is? Does any Nigerian leader visit any of the hospitals here? |
Everybody be thief jare, OBJ wan say him no thief thief? Bankole wan say him no thief thief? abegi! |
What is there to celebrate? Constant power supply? Low unemployment rates? Declining poverty indexes? Winning the war against corruption? I could go on and on cos the list is endless. But any Nigerian with at least one properly functioning brain cell knows that we have failed in all aspects that defines a country. I believe the appropriate thing to do is to declare the 50 days leading to independence day as days of mourning (everyone dressed in black) culminating in crying for the country in all public squares across the country on independence day. |
Lord of the Rings trilogy. |
There's so much hope for you guy cos at the end of the day what matters is what you can do, and how well you do it. Take me for example. I trained and work as a Dcotor but I'm also a programmer, both of which I do concurrently. Although due to demand from the nature of my work, programming takes a back seat. Anyways, all you need is google |
I think this whole BBC think is just another trick. A country of 150 million people was thrown into turmoil and utter standstill over a 50 day abscence of her president, and the very first contact Mr. President would make with the "outside" world would be BBC! This defeats common sense. Are you sure BBC is not part of a conspiracy on another scale. If mr. President were trully alive, then could'nt he just address the nation to quell all doubts? |
You guys dont see the bigger picture. The only reason the senate is concerned about us being blacklisted is because they and their activities would now come under scrutiny; their countless foreign accounts would be under watch so also their numerous trips. Mark my words. This is a blessing in disguise. |
THAT GUY CANNOT BE NIGERIAN The whole thing is all illogical for a Nigerian to do. Nigerians are known scammers, agreed. But suicide workers? terrorist? Haba! An average Nigerian guy want to enjoy life and considering how hard it is to get American Visa, I greatly doubt the very first thing the guy would do will be to bomb a plane. Moreso, how didhe get the visa, if he was already blacklisted and had been to Yemen (Axis of terror). By the way, do you know how easy it is to obtain Nigerian passports? There is definitely more to this than is known. The US goverment should investigate thoroughly before they start shouting "Nigeria! Nigeria!" There is so much frustration here far an average Nigerian, If anybody was thinking of starting his own terrorist operations, then he should act locally like the guy that wanted to blow up Superscreen TV. |
How relevant is J2EE in the Nigerial market. was into EJB (3.0) and JWS not quite long ago, but was discouraged from furthering as i heard most businesses have now moved on to light-weight frameworks and dont depend on J2EE particulary EJB. is it worth doiing the SCBCD 5.0 and SCDJWS?. |
Is anyone of you guys a Doctor? try being one, then you'll be in a better position to make comments |
My first kiss didnt go as i expected. i waited patiently for it, it was long overdue, it was with my first love. the kiss was passionate and deep, my head was in the clouds!. then it was brought back to earth the next day.she said i should give her space. my fault?"i said she was great".we are still apart till date. |
Nice work you done here.but there were one or two i noticed which i thought i should bring to your attention. All of your textboxes had default text in them and i was kind of surprised these texts were not cleared when the textbox in question received focus.thus i had to delete the default text before entering my test values.This is not at all user friendly. Solution 1: There is an event listener class, "FocusListener" in package java.awt which you could have used.It declares 2 methods: "public void focusGained" and "public void focusLost". you'll just implement the focusGained method to set the text of the event source to an empty string like this: public void focusGained(FocusEvent event){ event.getSource().setText() == ""; } then register it to the textbox - your JTextField like this myBox.addFocusListener(FocusListener f).Better still you could use a focusAdapter class and just override the "foucsGained" method. And please be gentle with the colours. Once again. Nice work. |
hello, i'll briefly explain how you can do that. since you want to use acces,i expect that the database is ready for connection and has been copied into your project folder. the first thing to do is to create your data-bound controls on the form,these are the control:labels,textboxes that will bear the output from the database. the actual connection to the database can be done in two ways- using the ADO data control:an activeX control or using a Data enviroment. i'll explain that of the ADO as it is easier to grasp and you wont need to do much coding. go to an empty space on the toolbox, right click and select "components". then from the dialog box that shows a list of controls,check the one for Ms ADO control or so.then ok. this action brings the ADO control into your toolbox and ready for use. get the control unto your form you'll see a control with 2 left arrows, 2 right arrows and a central textbox(navigation buttons) ,resize,position and rename app'ately. right click on the control on your form and go to "properties". find your way to "connection build" command button and specify the database engine to be used,for access it's microsoft jet engine 4.1, the path to the database afterwards, click on test connection to test the integrity of the link.if you get a successful response then you're almost done. then find you way to the recordSource tab and specify what kind of let-say database.i suspect you'll be usint a table so pick on adcmdTable-if i got it right then exit the dialog box, back to your form,for each data-control you'll be using,go to the properties bar and click on "data source",in the drop down menu select your ADO(should be the only one). then go to the "data field" and specify the column-the field the control would bear from the dropdown list showing all the available feilds.do this for the remaning data-controls and run your form. automatically,the first entry of the database is displayed and you can navigate through the rest using the ADO control.thats all. NB.i suggest you use labels as the data contained in the database can be modified from the form,so for the first time avoid using textboxes or set their locked property to true. i leave you to discover some other things yourself. so you see you do not need any code to display the data,however if you'll want to use command buttons to navigate,you'll have to set the visibility of the ado control to alse and manually code the movements. the other using the data enviroment is more complex as you'll have to code for the all the actions however i think it;s better. i hope i've tried,the details might not be pinpoint as i or you have wanted it to be,but i belive,i've given you the idea and you should be able to find your way.forgive me for whatsoever errors their may be.happay coding |
1 2 (of 2 pages)