Jump to content

willisoften

Members
  • Posts

    255
  • Joined

  • Last visited

Everything posted by willisoften

  1. I'm busy revising for a test on shell basics tomorrow morning so a prompt reply would be appreciated. I'm running through some excercises and while attempting to get a foreach loop running the shell seems to be telling me there is no such thing. csh keeps coming up foreach? while bash just doen't do anything at all. Comments please.
  2. The software is pretty much the same as under windows pretty easy to install too. I've yet to configure it to start at boot and I want to configure it to give me access to the monitor as an ordinary user. It seems OK but it'll take a month and a powercut to really find out how well it works. I don't have time today - Bash scripting test on Monday, I'm not good at the terminal so I'm revising. Fun though!
  3. The Belkin unit came with Linux software though I haven't installed it yet. I chose it on price & Linux - it's the budget 800va (still a substantial investment with UK prices) and it said that Linux software was available from Belkin's site (it's on the CD). How well it works with Linux I don't yet know. My problem is that it came with a fairly sketchy instruction pamplet and never having owned or operated a UPS before it wasn't enough. So thanks to those who replied.
  4. Amen! I've never had a problem but I would strongly discourage you from updating the bios. Having said that I believe that most GigaByte boards have a twin bios, so it it's just the learning experience you are after this might be a good one to try. Look into it, carefully. One of myolder mb's had a problem with filling the 3 DiMM slots cured by an easy and trouble free bios update. So I'm not saying never - just why bother. If it aint broke.... As far as setting master slave in the Bios - are you actually talking about choosing which drive you boot from? If so it's usually under Advanced Bios Features
  5. My local power supply is unreliable causing my machine to reboot at awkward moments. So I bought an uninteruptable power supply. A battery with some fancy circuitry as far as I can see. (Belkin) (Admittedly I probably didn't do enough research before paying for it.) Question: does it have to stay powered up all the time? I prefer to unplug everything at night and during overhead electrical storms (UPS or no). Will it stay ready to operate? The instructions are limited so some general operational hints would be welcome. Most searches for information seem to be resulting in companies who can sell me another one.
  6. Dietel's Java how to program is a good book too but rather incomplete when you need details about the various methods. Java in a nutshell O'Reilly is a reasonable reference if you can understand it's sometimes cryptic format. IDE Try Borlands Foundation X it's free though you have to register it and you can get it for Windows too if you like.... Bit of a memory hog - but good.
  7. Hello again it looks like the way to do this is actually store each shape in a vector / linked list and paint everything you've done so far to the screen before calling repaint. Strange but perhaps true. Looks like swing really needs a JCanvas. I can do it but I'm not sure it's worth the hassle for what amounts to a very small percentage of my course work marks. ----------------------------------------------------------------------------------- ----------------------------------------------------------------------------------- Well there were two acceptable solutions. Use a buffered image was one and the preferrred solution was to dynamically stroe all the necessary information to create a shape in a dynamic data structure. I chose (stumbled on) the second and used an array list as for some strange reason there was apparently no Vector package available tin my JDK installation (Got it sorted now). I had an abstact class of Shapes and then a concrete class for each type of shape I wanted to store each had it's own draw method. I stored each new shape as it was drawn in the list of Shapes and then iterated through my list to draw each shape using it's own draw method before calling repaint - phew! Polymorphism for beginners...
  8. Hi guys it's still driving me nuts! I've gone back to using Canvas as it's the only way I can get more than one shape on screen at a time - I don't have time to set up a linked list to store sets of co ordinates colours shapes and then do it all polymorpically. So I'll try to get everything in the assignment done bar the JPanel painting area. A pit as it let me do draggable shapes, rubber banding and stuff but only one shape at a time.
  9. Thanks guys thats probably it! I need to override - the ba*** sorry method. Phunni I need to demonstarte the use of a couple of layout managers so I've got a couple of panels in the one applet GridLayout BorderLayout and GridBagLayout. Obviously performance went out for a coffee. Incidentally using JBuilder (mostly on Windows -als alack) but theres a newish version for Linux as well.
  10. I'm trying to create a small JApplet whic uses an JPanel as a Canvas. I've implemented a mouse listener and I can pick up the coordinates anywhere on my JPanel. I can draw any shape I want to but each new shape wipes out the previous one. That is only one shape on the canvas - JPanel at a time. The mouse listener picks up the coordinates on click and release on release I also execute repaint(); I guess this is the problem but I'm not sure what to do about it. Without repaint noting gets painted to the JPanel at all. The JPanel / JApplet is specified for the assignment. I've read documentation till I'm blue in the face. So now I need a hint. Obviously I can't publish the code.
  11. Sorry guys, I've been busy. I didn't really get a chance to do anything about this as all sorts of things happened to me at once! I'll investigate some more but the ascii / unicode thing looks likely - except that all the missing characters where turning up as the single value 13 when cast as int. I'm revising for exams at the moment so dear knows when I'll get back to this, not as though it's life-threatening! Cheers!
  12. I didn't use for loop! It's just an old exam question. Thanks for your replies. I find it a big help to get answers as you can go back and look again. Cheers!
  13. I hate this stuff but have to revise it for an exam. Unfortunately I have examples and no answers! This is an example from a previous paper. Worth a staggering 1 mark. for(int i=0; i<n; i++) sum++; for(int j=0; j<n; j++) sum++; O(2N) Any chance this is right?
  14. public static char ReadChar() { char cha=' '; BufferedReader key = new BufferedReader(new InputStreamReader(System.in)); try { cha = (char) key.read(); } catch(IOException e) { } return (cha); } I'm using this to read a character from the keyboard. Everything seems ok except that for some reasons £ € signs aren't being read. (windows xp) Can someone write a test harness and see what happens to them? Incidentally if I cast the £ or € or ¬ character as an int I print out 13. Other characters may also be missing Anything using Alt Gr prints out 13 when cast as an int. Is this a Java peculiarity or my error. class Trial01 { public static void main(String [] args) { System.out.print("Character? "); char c = KeybInput.ReadChar(); System.out.print( c + "\n"); }//ends main }
  15. I have tinitus (how do you spell it) and otherwise dull hearing from operating woodworking machinery without ear protection. It was provided but I was 17 and obviously really macho (read stupid). Amazing how often one is mistaken for the other amongst young men. I usually get along ok in conversation (I think I've got good at guessing what people are saying) but background noise and distance from the speaker make a big difference. When someone enunciates words differently, compared to what I'm used to I'm completely lost. It's a strange state of affairs when I get more help and feedback from this forum than from the people who are taking my tuition fees.
  16. Thanks to all. I do now have a sorted linked list. Create an array of nodes Sort node array according to Student Id Number reset "next" for each node. public void sortRecords() { //Create array of references Node[] noddy = new Node[length]; for (int x=0;x<length;x++) { noddy[x]= nodeAt(x); } //sort references by Student ID //mergeSort is too long to reproduce in this post mergeSort(noddy); //reset "next" in each Node Node p = head; for (int i=0;i<noddy.length;i++ ) { p.setNext(noddy[i]); //move to next node in list p = p.getNext(); } }//Ends sortRecords greyfoxlsu: thanks for maiking your code available I will examine it when I have more time. Unfortunately 3 assignments due by 28th this month. This is the most difficult.
  17. OK Cheating or not I think I'm going for the array solution. Simply because this is the one I think I can do myself. Question: Node[] n_array = new Node[list.length]; for (int x=0;x<list.length;x++) { n_array[x]= nodeAt(index); //nodeAt() method for refering to node at list position } This isn't so much the code as the general idea. Is this an array filled with copies of the nodes or an array of reference variables (pointers)? I was rather hoping it was the latter! I've got a course text book which covers sorting and linked lists in two different sections the section on sorting lists actually jumps to trees (surely would make more sense?) but thats outside the assignment specification. I've found this particular module extremely difficult. Both lecturers are Chinese and although they really seem to know their stuff they both speak heavily accented English. I sit near the front and still can't make out much of whats said. Complaints have been made at student staff committees then ignored by those in authority. I don't want to give anyone making a living a hard time but it is very frustrating.
  18. Yes I need to take a more planned approach to this rather than my usual change it and see-what-happens approach. Thanks for the ideas. If I can't work it out I'll hand in what I can do and get it marked out of 85. So it's not the end of the world. It's just that I'm stubborn and can't leave it alone!
  19. Java assignment is due in a couple of weeks. All is well apart from the last part sort the linked list. The list is a singly linked list consisting of nodes which contain a student record and the ref to the next node. The student record holds the properties belonging to each student. The list itself has to be sorted by Student ID (an integer) held in Student Record. Sounds simple but it's driving me up the walls!! Is there something I need to know which makes sorting linked lists so much more difficult than sorting arrays? I was trying a merge sort, any comments? All help, sympathy or money gratefully accepted.....
  20. I think but I'm not sure that your looking for remainders or modulus 2%2 =0 8 %2= 0 and 8 is a power of 2 This falls down with numbers like 6 6 %2 = 0 but 6 is not a power of two. I think that if x / 2 = a and a % 2 = 0 its a power of 2 As far as I can tell:This is the same as if log (base 2) of x = integer log 2 of 8 is 3 log 2 of 64 is 64 is 6 log 2 of 256 is 8 but log 2 of 6 is 2.584... I'm pretty sure there are methods for logs and checking if a number is an integer within C but i don't know how to use them so I'd go with if x / 2 = a and a % 2 = 0 its a power of 2 (not sure how to code it) something like: Set up yor variables if ((a =(x /2)) && (a % 2==0)) printf ("power of 2"); else printf("not a power of 2); I've been celebrating so if this is plain wrong feel free to ask the mods to remove it. BUT Hope I've been of some help!
  21. I've just tried rolands method 0b in borland 3.1 C compiler on windows and it's not working for me. Mind you it's a while since I've done any C programming so....
  22. Out of interest - is that an observation of Java or OO? Java, though I have limited experience of other OO languages, having looked briefly at ruby and python it seems to me that the bread and butter operations are much more compact or to use the technical term "lot less typing". We were introduced to C (procedural) in the first semester and it seems to me I got a lot more done with a lot less effort. Thats not comparing like with like though, just a personal unsubstantiated allegation!
  23. I did a little bit of this last year AFAIK you represent binary numbers (bit patterns) with Hexadecimal numbers. My notes actually say "Most computers use hexadecimal numbers to represent bit patterns, though some use octal numbers for this purpose." Binary Hexadecimal 0000 0 0001 1 0010 2 0011 3 0100 4 0101 5 0110 6 0111 7 1000 8 1001 9 1010 A 1011 B 1100 C 1101 D 1110 E 1111 F I'm sure you can convert between bases and have seen a table like this before, but it was pretty looking and easy to copy and paste in :P I remember it as a leading 0 for octal and leadin 0x for hex. (could be wrong). I haven't come across rolands method before.
  24. OK Thanks, I'll try to take a look, I'm like a kid in a sweet shop though I never know what to choose next!
  25. Sorry does that mean you have taught python to others in the past or you've taught yourself python? In either case a rundown on the resources (books tutorials websitesetc ) you found useful would be appreciated. Just because I reccomended the Java course doesn't mean I'm not interested in Python. Though as I'm in the second year of my degree time is admittedly limited.
×
×
  • Create New...