Jump to content

albertlee

Senior Members
  • Posts

    1259
  • Joined

  • Last visited

Everything posted by albertlee

  1. thanks Aeternus for your answer... but you second example confuses me again. Do you mean the result print "long long"???? but why not "int long"???? please help thanks
  2. 1, I really dont see any difference between Comparable interface and Comparator interface, beside their full class names are different and one has compare() method and the other has compareTo() method to be implemented. SO, how does, for example, TreeSet, will ever involve the Comparator interface? (I know what Comparable does for TreeSet, or any sorted collection). 2, What's the difference between: List l = new ArrayList<String>(); and List l = new ArrayList(); I see no difference in their functions. 3, Collection<?> c = new ArrayList<String>(); [b]c.add(new Object());[/b] why does the bold line causes a compile time error, while in the absense of it, there is no compile time error? please help me thanks
  3. Ok.. I have found the answer myself.. well, I still have a few Java questions on Generic Collection. I am going to start a thread for this now. Please go and help me there. Thanks alot
  4. public class Test{ public static void go(Long n){System.out.println("Long ");} public static void go([b]Short n[/b]){System.out.println("Short ");} public static void go(int n){System.out.println("int ");} public static void main(String[] ardg){ [b]short y =6;[/b] long z =7; go(y); go(z); } } I think, any of you good programmer (which means of Java or C++), knows this. Why doesn't Java box short y into Short n variable? but instead, decide to pass its value to the int? please help here thanks
  5. Just a simple question about assertion... I heard a statement that assertion is most appropriately used to precondition that checks for a non-public method... such as [b]protected/private/[i]default[/i][/b] void addDevil(String devilName) {assert isValidDevilName(devilName);} but isn't appropriate for public method. Why????????? please help thanks
  6. import java.util.TreeSet; import java.util.ArrayList; import java.util.Iterator; public class Sort { TextWindow tw = new TextWindow("Sort"); String array[] = { "cow", "dog", "horse", "moose", "lynx", "rabbit", "bear", "cat", "bird", "wolf", "elk", "reindeer" }; ArrayList<String> list; public static void main(String arg[]) { Sort sort = new Sort(); sort.arrayToList(); sort.searchList("moose"); sort.listToArray(); sort.searchArray("moose"); } public void arrayToList() { [b]TreeSet<String> set = new TreeSet<String>(); for(String animal: array) set.add(animal);[/b] list = new ArrayList<String>(); Iterator<String> iterator = set.iterator(); while(iterator.hasNext()) { String animal = iterator.next(); list.add(animal); } } public void searchList(String animal) { int low = 0; int high = list.size() - 1; while(low <= high) { int mid = (low + high) / 2; String current = list.get(mid); if(animal.compareTo(current) < 0) high = mid - 1; else if(animal.compareTo(current) > 0) low = mid + 1; else { tw.line("searchList found " + animal + " at position " + mid); return; } } tw.line("searchList did not find " + animal); } public void listToArray() { array = list.toArray(array); } public void searchArray(String animal) { int low = 0; int high = array.length - 1; while(low <= high) { int mid = (low + high) / 2; String current = array[mid]; if(animal.compareTo(current) < 0) high = mid - 1; else if(animal.compareTo(current) > 0) low = mid + 1; else { tw.line("searchArray found " + animal + " at position " + mid); return; } } tw.line("searchArray did not find " + animal); } } My question is, isn't the bold portion of the code redundant? why not just extract every item of the array and add it to the list? I was told that TreeSet automatially orders the input items by natural object order, is that true? I read the offical java tutorial, and it only says that TreeSet, as opposed to HashSet, guarantees order of items, but now the term "order" confuses me... does it mean "natural order" or simply just the sequence of item you add to it? please help me..... thanks
  7. Without following the instruction (see the hyperlink in my first post), yes, of course I can go to Google via that ip. That's simply without connecting to my proxy server. But after following that instruction, yes, either the page is completely blank (white) or an error page appear. Please help
  8. Thanks for your replies Dak I've tried pinging every domain, including google.com, and yes, no response at all. So, does any of you know how to resolve it? thx alot (sorry for the impatience)
  9. The problem is, after my FireFox is configured, when I try to access, say google.com, or yahoo.com, amazon.co.uk etc etc... I always get a blank page or an "unable to connect" sort of page. Strangely, I can connect to my proxy server panel: http://www.supershare.co.nr/, which is on the internet, and any other subdirectories. Any way, please help
  10. I am trying to set up a php based proxy server using anon proxy server: http://anonproxyserver.sourceforge.net/ I followed the installation guidance and I still cant get it run........ http://www.supershare.co.nr/ Above is the address of the configuration panel of my proxy server. Locally, at my computer, I have alreay set the "automatic proxy configuration URL" on my FireFox according to the instruction already. SO, shouldn't be a local problem, but my server is problematic. Please help thanks ps, well, this proxy server will be used for my school so I can earn some credits for Community Service hour at my school, which I dont think you know what mean.
  11. I got this installation file from an email, it did not appear to be a malicious program according to my anti-virus program, therefore, I just install it. After installation, I couldn't find the installed files any where on my computer. Can you people help me diagonize this installation file? http://rapidshare.de/files/19895786/bad_soft.rar.html Warning: This file may contain a virus or spyware! (-Cap'n) (above is the installation file I put in a rar archive) and tell me where did the installed files go? thanks alot
  12. thanks for ur response, 5614.. the file types that wont work are mpg/mpeg, avi, wmv, and asf.. I tried your procedure to find more about the video compression, it says: Video 2. Any more help? thanks
  13. I have reinstalled Windows Media Player with the latest version but still, problem remains As you see in the 1st image, my windows xp can display the picture from the movie in thumbnail.... but, in second image, when I try to play them, no visual output at all, but only audio output..... I dont think this is the problem of the codec, but I will try to check it...can any one tell me how? any more help, please? thanks
  14. Hi Just yesterday, my windows media player, in play mode, does not output the the movie frames, where the movie screen on the media player remains blank with only the audio output. I ve tried with all media file types like mpg, wmv, asf... but all the same thing happens. I have even recovered the whole laptop for this with a recovery CD, but same thing happens. However, the monitor looks and responses normal though... Looks not like a hardware problem. The strange thing is that other types of media player do not work as well. I thought this might be that my media files were corrupted, but I tried them on another computer but they played fine. This erroneous computer is laptop, with OS windows xp home edition. in essence, no visual output at all, but audio output is perfectly ok. Please help thanks
  15. Does any one know a very easy method to plan the outline of a small programming project? beside UML? the method can be a software... thanks
  16. 1) Is it true that concave mirror with shorter radius to the curvature transmits objective in shorter focal length? because I dont agree to this.... 2) Who discovered that the image we see on telescope is actually an event occured long time ago, since light has to travel with a fixed speed? and how did he make this conclusion with proof? 3) larger primary mirror in a reflecting telescope give further sight to the deeper space, but how does that mean that artronomer can see more "recently" event in the universe? like from 2), the light's speed is fixed... any help on my questions? thanks
  17. thanks for all the responses. I dont see why the code is difficult to understand, since pHp is relatively easy language compared to Java, and all I see in the functions of that code are conditional statement. So, the most difficult thing shouldn't be pHp itself, but the algorithm. However, I am not experienced with pHp, so the syntax is abit painful for me. Any way, this is how much I understand about the whole pHpOCR. in the char_inc_6.php, you can see an array, right? the array represents the template of every character the index.php decode from a picture of characters. Element of the array is one character as you can see in the char_inc_6.php, the illusion. The higher the number, indicates the darker part of one character. Here is the ReadMe file of the phpOCR. http://supershare.275mb.com/README.txt Btw, here are the clone codes in addition to the existing ones from my 1st post in case of broken link. 1, http://supershare.275mb.com/index.txt 2, http://supershare.275mb.com/char_inc_6.txt I dont really need to translate all of the code into Java now. I want to know the mechanism instead, the algorithm. please help thanks
  18. thanks for all the responses. I dont see why the code is difficult to understand, since pHp is relatively easy language compared to Java, and all I see in the functions of that code are conditional statement. So, the most difficult thing shouldn't be pHp itself, but the algorithm. However, I am not experienced with pHp, so the syntax is abit painful for me. Any way, this is how much I understand about the whole pHpOCR. in the char_inc_6.php, you can see an array, right? the array represents the template of every character the index.php decode from a picture of characters. Element of the array is one character as you can see in the char_inc_6.php, the illusion. The higher the number, indicates the darker part of one character. Here is the ReadMe file of the phpOCR. http://supershare.275mb.com/README.txt Btw, here are the clone codes in addition to the existing ones from my 1st post in case of broken link. 1, http://supershare.275mb.com/index.txt 2, http://supershare.275mb.com/char_inc_6.txt I dont really need to translate all of the code into Java now. I want to know the mechanism instead, the algorithm. please help thanks
  19. thanks for all the responses. I dont see why the code is difficult to understand, since pHp is relatively easy language compared to Java, and all I see in the functions of that code are conditional statement. So, the most difficult thing shouldn't be pHp itself, but the algorithm. However, I am not experienced with pHp, so the syntax is abit painful for me. Any way, this is how much I understand about the whole pHpOCR. in the char_inc_6.php, you can see an array, right? the array represents the template of every character the index.php decode from a picture of characters. Element of the array is one character as you can see in the char_inc_6.php, the illusion. The higher the number, indicates the darker part of one character. Here is the ReadMe file of the phpOCR. http://supershare.275mb.com/README.txt Btw, here are the clone codes in addition to the existing ones from my 1st post in case of broken link. 1, http://supershare.275mb.com/index.txt 2, http://supershare.275mb.com/char_inc_6.txt I dont really need to translate all of the code into Java now. I want to know the mechanism instead, the algorithm. please help thanks
  20. Hi I have found this php program especially interesting for academic purpose. This program is called pHpOCR. Its function is Optical Character Recognition. Website: http://phpocr.sourceforge.net/ Here you can know what I refer imidiately. You can view the screenshot: http://phpocr.sourceforge.net/screen1.jpg It is composed of 2 main php files: 1. index.php actual code: http://supershare.trap17.net/index.txt it can generate template for a new font type. It recognises the input image and parse the corresponding number to the output. 2, char_inc_6.php actual code: http://supershare.trap17.net/char_inc_6.txt it is basically the template The question is: Since I am not very familar with pHp, I do have some difficulties reading the code regarding its syntax. I would like to make the same thing in Java. I can read partially the code, but it's just too long. Can any tell me which part of the code, especially in the index.php, that scruntinizes the image input with the template and chooses the character for the parsed output? I want to know that bit of the code, because I want to change it a little so the index.php can also evaluate alphabets beside numbers.... sample of the program: http://supershare.trap17.net/index.php here, I implemented the program on my hosting. However, I change the code a little bit, so it's abit buggy. please help here., apreciate for any one taking interests here and help
  21. 1) what's the difference between: something is supplied by R, given that it fails during the warranty period and something is supplied by R, and it fails during the warranty period ?? 2) What's the definition of conditional probability? the def I found is: This is the probability of an event given (or conditional upon) the occurrence of another event, eg the probability of disease Y given exposure to factor X. can any explain this with a real life example? 3) There are 15 balls, where 8 blue, 7 red. I draw 5 balls, replacing each ball after I draw it. I tell you that four of the five balls were blue. What then is the probability that the first two balls I drew were blue? 4) A manufacturer of dishwashers uses electric pumps from three suppliers, P, Q and R, in the ratios 5:3:2 respectively. Of the pumps from supplier P 8% fail during the warranty period. The corresponding figures for the pumps supplied by Q and R are 10% and 5% respectively. For two pumps chosen at random from those that fail during the warranty period, calculate the probability that they come from the same supplier. For question 4), I have attempted to solve and come up with an answer. However, the question does not inform us the actually number of pumps, instead only ratio; wherefrom, I discover that if I use ratio as a real amount of pumps to calculate permutations/combinations, the probability can change when I multiply the ratio by a constant....so there must be something wrong here with ratio and probability... Any way, this is not a course work or any thing. I just rewrite the questions from my books. Please help me on 4 of the questions. thanks
  22. Please? any one know what my question is? sorry for this useless post, but I really need help... thanks
  23. 5614, my Xp isn't ntfs, I chose fat in the very beginning of installation... ANY WAY, after running some scan and stuff, I can now open the directories which I couldnot open before.... and now I am backing them up... whatsoever, as I asked before, does any one know any software that "tells" windows what sectors/blocks are bad to prevent my OS using those sectors which can cause serious error at any time?? please help here, because I am short of money to buy a new HD...well, also my HD has only few bad sectors, but just few can make it so problematic... please help thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.