|
Kaltag posted:Is this what you mean? To be fair, those are from the mid to late 90s and haven't been updated ever since. There's stuff in it like "Avoid lines longer than 80 characters, since they're not handled well by many terminals and tools".
|
# ¿ Jul 6, 2010 15:07 |
|
|
# ¿ Apr 29, 2024 03:16 |
|
I am in posted:You're trying to do it all at once. Break down the problem to smaller pieces, do one piece at a time and print out each piece's internal values to make sure they are what you intended. code:
|
# ¿ Sep 26, 2010 15:45 |
|
HKBGUTT posted:Yeah it is a school asignment, and the asignment says: Dont use If or Switch for some reason. And it also specifies that the random numbers must be added to a array. use while(), be all
|
# ¿ Sep 26, 2010 17:40 |
|
StickFigs posted:I'm trying to use a StringTokenizer and I need it to count anything that isn't a character of the regular alphabet as a delimiter, for example: Sound like something regular expressions were made for.
|
# ¿ Sep 27, 2010 21:22 |
|
StickFigs posted:Where would I find a list of regular expressions useful to my situation? I'd combine this and this The regex in case should be [a-zA-Z] /E: JavaDoc posted:StringTokenizer is a legacy class that is retained for compatibility reasons although its use is discouraged in new code. It is recommended that anyone seeking this functionality use the split method of String or the java.util.regex package instead. Sereri fucked around with this message at 21:51 on Sep 27, 2010 |
# ¿ Sep 27, 2010 21:47 |
|
hayden. posted:I'm taking an intro to Java class right now, and I had a question my instructor and Google couldn't answer. We were reading a series of numbers from a text file and we had to use a try/catch. My question is, if we know that there won't be an error reading the file, why does Java require us to use exception handling? How would you know that. What if the HDD/USB-drive you're reading from suddenly fails? What if your RAM suddenly shits itself? Maybe the OS says gently caress you, get your hands of that. /E: For further clarity: The exceptions are not for the handling of the numbers but for the action of reading the file they're in. Lots of stuff can happen Sereri fucked around with this message at 16:38 on Sep 30, 2010 |
# ¿ Sep 30, 2010 16:35 |
|
Flobbster posted:My beef with Javadoc is that their HTML generation hasn't changed since probably Java 1.0, and it shows. The HTML that gets generated is a horrible mess and it's impossible to style well. Yeah that won't happen. On the other hand the JavaDoc compilation usually happens in the IDE so really Eclipse/Netbeans are to blame.
|
# ¿ Oct 11, 2010 18:26 |
|
Aleksei Vasiliev posted:http://validator.w3.org/check?uri=h...oup=0&verbose=1 To be fair, if you look at it closely the validator is full of poo poo. And I kinda slipped up on the JavaDoc generation. Of course
|
# ¿ Oct 11, 2010 18:38 |
|
Aleksei Vasiliev posted:The official validator by the group that created what it is validating is full of poo poo? How so? Almost all the errors are "tag closed but wasn't open in the first place". If you look at the html you can clearly see that it's wrong, the tags are even in the correct place.
|
# ¿ Oct 11, 2010 19:46 |
|
MEAT TREAT posted:Javascript isn't Java I was thinking that he meant that too at first but I think the javascript is in an embedded browser within a java program.
|
# ¿ Oct 15, 2010 16:50 |
|
fletcher posted:If I do something with an array, and then I'm done with it and I need to do something else with an array, is it better to reuse the same pointer? How does it effect the GC? How about readability? You shouldn't reuse the array for the following reasons: a) Memory is cheap. Unless you try to run your program on a machine with 64MB ram you shouldn't have any problems with memory. b) Variables should have a purpose, should be named accordingly and should only be used for this purpose. It greatly improves readability. c) The GC mostly does not give a poo poo .
|
# ¿ Oct 22, 2010 20:46 |
|
magicalblender posted:Is it possible to make a decorator class that doesn't call super() on its superclass? The way Java works with classes is to call super() all the way up to Object. Even stand-alone classes are basically '(public) class Yadda extends Object'. You can write the super() yourself or not but it will always be there. Sorry dude.
|
# ¿ Oct 25, 2010 16:13 |
|
Keyboard Kid posted:code:
|
# ¿ Oct 28, 2010 18:01 |
|
Use a string, parse it into an integer, increase it by one, convert it back into a String ( = ""+ number;) check length and fill the missing digits with zeros.
|
# ¿ Nov 4, 2010 16:04 |
|
Just quickly looking over this I'd say it's because java arrays begin at 0 and your 'count' starts at 1. Go from there.
|
# ¿ Apr 13, 2011 20:45 |
|
^^^^^ true, still not really what it's supposed to do I guess.slyo posted:I am confused about this method: Yes it does. The first semicolon is misplaced, an else -> return true; is also missing.
|
# ¿ Aug 20, 2011 13:05 |
|
Harold Ramis Drugs posted:This thread is amazing, thanks for all the help. If arrays are off the table I guess lists and sets are too so maybe a string with comma separated integers.Use stringbuilder to write all the numbers one after another then remove them from the string if you match them. That's pretty ugly though, not sure why you'd want people to code that without arrays.
|
# ¿ Oct 16, 2011 05:19 |
|
I am in posted:Since that sounds like a homework problem and the most important point was already made (that strings are not very good data structures for this problem), I'm going to nitpick a bit about case-insensitivity. To be fair, a capital ß has never existed and might as well never will. The only use is in words written entirely in capitals and even then you either write ß or SS.
|
# ¿ Jan 13, 2012 12:23 |
|
DholmbladRU posted:Here I am reading in a xml tag and adding it to a java object field. However the tag name 'location=' comes along with it. How can I remove this from the incoming string without taking up alot of resources? So you have <abc location='xyz'> and want to remove the location='xyz' ? Why not simply remove the attribute from the object?
|
# ¿ Jan 25, 2012 14:11 |
|
Off to a good start.
|
# ¿ Jul 7, 2012 15:05 |
|
The problem is that you return the calculated hex instead of printing it. Also your method type is wrong, it's not supposed to return something in the first place. Finally two things Java code:
And maybe if your professor is a dick he will cause an exception by entering 0 for the values per line var.
|
# ¿ Nov 6, 2012 01:42 |
|
Joda posted:In the arguments passed to the sort() method you've written, you're passing a double array, which you've written as sort(double array[]). Why this notation doesn't give you a compile-time error, I do not know, but you always put the brackets after the type declaration (e.g. int[], double[] etc.), as opposed to the variable name, when you're declaring an array. type array[] and type[] array are both valid ways to declare arrays in Java. The second one is just preferred by most people I guess.
|
# ¿ Apr 10, 2013 09:57 |
|
DholmbladRU posted:yeah my bad, hard to see it had anything to do with java.. Are you telling me you guys haven't memorized all the available java packages syntax?... Awful uses jSoup to parse the forum's html code but we handle all the network stuff (including getting the html) with the apache httpConnection library. On the other hand I have no ideas whether it's better for your case than just using jSoup.
|
# ¿ Jun 27, 2013 12:47 |
|
Doctor w-rw-rw- posted:Tip - you should take a look at Volley for making http requests. For one, it properly manages swapping between apache on the old and httpurlconnection on the new OSes. It's on the list, like so many things. I guess I'll create a ticket for it.
|
# ¿ Jun 28, 2013 12:32 |
|
I'm a bit stumped. I'm trying to turn an image I have as a Bitmap into a base64 String. The code I have works for small images but as soon as they get bigger than for example, this happens: The base64 I get (just as the image I posted) comes to exactly 4096 bytes and I doubt that's a coincidence. The code in question: Java code:
This is on Android but that shouldn't really make a difference.
|
# ¿ Jul 10, 2013 15:31 |
|
|
# ¿ Apr 29, 2024 03:16 |
|
Imazul posted:Haven't done this in a long time but it's your ByteArrayOutputStream that is only reading the first 4096 bytes. You need to read it in chunks. Doctor w-rw-rw- posted:To offer additional advice, if I were to fix it, I might wrap the BAOS (abbreviated b/c I'm on a tablet) with a Base64OutputStream and then supply that to the compress method. Your BAOS now has a compressed, base64-encoded image. Then do what you will to read it out. Yeah that worked, thanks guys. It now looks like that: Java code:
before: after: Sereri fucked around with this message at 22:46 on Jul 10, 2013 |
# ¿ Jul 10, 2013 20:52 |