| Time |
S |
Nick |
Message |
| 01:44 |
|
|
HEGX64 joined ##friendlyjava |
| 01:52 |
|
|
sfisque joined ##friendlyjava |
| 02:03 |
|
|
sfisque1 joined ##friendlyjava |
| 05:03 |
|
|
HEGX64 joined ##friendlyjava |
| 07:06 |
|
|
abba joined ##friendlyjava |
| 09:59 |
|
aditsu |
omg, default interface methods are sooo cool! :) |
| 11:09 |
|
pdurbin |
aditsu: yeah? how so? this is a java 8 thing, right? |
| 11:10 |
|
aditsu |
yeah, you can provide default implementations in interfaces, so you don't need to copy the code in implementations or use an abstract class that stops you from extending something else |
| 11:11 |
|
aditsu |
although… it doesn't always work quite as well as I hoped - http://stackoverflow.com/questions/35770017/must-implement-default-interface-method |
| 11:15 |
|
|
pdurbin_m joined ##friendlyjava |
| 11:15 |
|
pdurbin_m |
Daniel De Luca on Twitter: "Java does not permit multiple implementation inheritance: Possible solutions in Java 8 via @venkat_s https://t.co/QC8NVHqMvx": https://mobile.twitter.com/danieldeluca/status/705316956333707264 |
| 11:17 |
|
aditsu |
ooh, a long video |
| 11:18 |
|
pdurbin |
I think it's related. Haven't watched it yet. :) |
| 11:18 |
|
aditsu |
the first answer on my question also mentions traits (and says I shouldn't use default methods for that) |
| 11:19 |
|
aditsu |
(video title is "The Story of Traits") |
| 11:25 |
|
pdurbin |
he says the code is on his website |
| 12:43 |
|
|
abba joined ##friendlyjava |
| 12:59 |
|
|
abba joined ##friendlyjava |
| 15:30 |
|
|
sfisque joined ##friendlyjava |
| 16:13 |
|
aditsu |
hmm, java 8 still doesn't have a method to get the file extension |
| 16:27 |
|
pdurbin |
bummer |
| 16:27 |
|
pulsar |
aditsu: i used mimetype detection for that a long time ago. iirc it came from the java mail api. jMimeType would be also an alternative. |
| 16:27 |
|
pulsar |
and yes, i know, mime types and file extensions are not the same but perhaps it can help solving whatever issue you have to deal with. |
| 16:30 |
|
aditsu |
pulsar: apparently there are many different methods for that, and none of them very reliable: http://stackoverflow.com/questions/51438/getting-a-files-mime-type-in-java |
| 16:30 |
|
aditsu |
file extensions are much simpler |
| 16:33 |
|
aditsu |
anyway, I have my own code to deal with that, I was just wondering why it's not in the standard library |
| 16:36 |
|
pdurbin |
'people who are new to java 9 or 10 or 11 will ask "can java parse json?" and the answer will be "go download this extra thing".' https://javabot.evanchooly.com/logs/%23glassfish/2016-02-24 |
| 16:42 |
|
aditsu |
by the time java supports json, they'll be asking about yaml or msgpack or something new :p |
| 16:51 |
|
pdurbin |
"they" :) |
| 17:36 |
|
sfisque |
what does this mean: "java 8 still doesn't have a method to get the file extension" |
| 17:37 |
|
sfisque |
you know "file extensions" are merely a naming convention and have nothing to actually do with the file. you can have a jpeg and name it "myimage" |
| 17:38 |
|
sfisque |
this problem is partially solved on *nix by using "magic numbers" and leader byte sniffing, but even that is frought with peril because random binary files can "look" like anything |
| 18:44 |
|
* pdurbin |
sniffs some files |
| 19:42 |
|
|
sfisque1 joined ##friendlyjava |
| 23:04 |
|
aditsu |
sfisque1: I mean just that - it doesn't provide a convenience method to split the file name by the last dot; of course they are a convention, and that's why they are useful |
| 23:04 |
|
sfisque1 |
String.split( _delimiter ); |
| 23:05 |
|
aditsu |
not quite that straightforward, but yes it's fairly simple |
| 23:06 |
|
sfisque |
how more straighforward than that. you either get a list of tokens and the last one is your extension, or you get the filename because it doesnt have an extension |
| 23:08 |
|
aditsu |
no, I mean your code is too simple and doesn't do the full job |
| 23:09 |
|
sfisque |
oh, we've slid into pedantic land… gotcha…. s[] = _string.split( _delim ); if( s[].length > 1 ) { _ext = s[ s.length - 1 ]; } |
| 23:10 |
|
aditsu |
also, I'm not sure why you're trying to implement it and give me the code |
| 23:11 |
|
sfisque |
i'm just indicating how trivial it is |
| 23:11 |
|
* sfisque |
hands aditsu a skinned cat |
| 23:11 |
|
* xb |
hands aditsu the cranberry-jam to go with the cat |
| 23:12 |
|
aditsu |
I already knew that, and I said I already have my own code for it; that still doesn't explain why it's not in the standard library |
| 23:12 |
|
sfisque |
trival != universal |
| 23:12 |
|
sfisque |
file extensions are not universal, they are contextual conventions |
| 23:13 |
|
sfisque |
File doesnt care what the underlying os is. if you make it exension aware, it becomes os-dependent |
| 23:13 |
|
aditsu |
afaik, they are universal - nobody uses e.g. jpg or pdf files without the corresponding extension (except maybe a few weirdos) |
| 23:13 |
|
sfisque |
now if there was an ISO or Ansi standard for file exensions, that would probably change |
| 23:13 |
|
sfisque |
jpeg |
| 23:13 |
|
sfisque |
jpg |
| 23:13 |
|
sfisque |
JPEG |
| 23:14 |
|
sfisque |
jpg |
| 23:14 |
|
sfisque |
JPG |
| 23:14 |
|
sfisque |
which one wins |
| 23:14 |
|
sfisque |
jpg2000 |
| 23:14 |
|
aditsu |
they all win, everybody gets a car :) |
| 23:14 |
|
sfisque |
.img |
| 23:14 |
|
sfisque |
the truth is, i can have a jpeg that has no extension and it's still a jpeg |
| 23:15 |
|
sfisque |
bob-car can be a jpeg |
| 23:15 |
|
aditsu |
sure |
| 23:15 |
|
sfisque |
or a tiff |
| 23:15 |
|
sfisque |
or an audio file |
| 23:15 |
|
sfisque |
what generally "goes into" the jdk libs is universal stuff. a List is a List, regardless of OS |
| 23:16 |
|
aditsu |
and a file extension is a file extension, regardless of OS :) |
| 23:16 |
|
sfisque |
there will probably never be a call to File that indicates if it is a Unix File Socket because that's not universal |
| 23:16 |
|
sfisque |
how about Locale? |
| 23:17 |
|
sfisque |
what qualifies a file extension in Kanji? |
| 23:17 |
|
aditsu |
a .jpg is a .jpg in kanji too |
| 23:18 |
|
sfisque |
on what os? |
| 23:18 |
|
aditsu |
on every OS in the world |
| 23:18 |
|
sfisque |
even ToasterOS? or RefrigeratorOS? |
| 23:18 |
|
aditsu |
I haven't heard of those, but if they have file names, then the answer is yes |
| 23:19 |
|
sfisque |
you're assuming. that is not an apriori statement |
| 23:19 |
|
aditsu |
anyway, I'm tired of arguing this |
| 23:20 |
|
aditsu |
another thing that's annoyingly missing is support for a generic observer pattern - with java 8's ObservableList and stuff, I thought they added it, and I found a java.util.Observable but then I noticed it's "Since JDK1.0", and nobody seems to be using it :p |
| 23:21 |
|
aditsu |
that one is (obviously) not generic, it uses Object |
| 23:21 |
|
aditsu |
Swing and AWT have their own listener mechanisms |
| 23:22 |
|
aditsu |
and now JavaFX adds some more, still highly specific |
| 23:23 |
|
xb |
"even ToasterOS? or RefrigeratorOS?" IoTOS ? |
| 23:24 |
|
pdurbin |
aditsu: who are you callin' a weirdo? ;) |
| 23:24 |
|
aditsu |
pdurbin: you use lots of files without extensions? |
| 23:25 |
|
pdurbin |
meh. not really. I guess I'm not enough of a hipster |
| 23:25 |
|
xb |
hipsters name the files with custom extensions |
| 23:25 |
|
xb |
main.hipster-js |
| 23:25 |
|
xb |
main.callme |
| 23:26 |
|
xb |
main.trojan.exe.not-trojan |
| 23:26 |
|
aditsu |
mountain.vintage-framed-photo |
| 23:26 |
|
xb |
^^^ |
| 23:26 |
|
xb |
main.sanfrancisco |
| 23:26 |
|
xb |
main.aditsuscript |
| 23:27 |
|
xb |
main.cjam |
| 23:27 |
|
xb |
;P |
| 23:27 |
|
aditsu |
last one is not hipster :p |
| 23:27 |
|
xb |
mhm |
| 23:27 |
|
xb |
RIP CJam101 |
| 23:29 |
|
xb |
aditsu: Are you going to move from SourceForge any time soon? |
| 23:30 |
|
aditsu |
nope, SF is good; they even got rid of all the adware |
| 23:30 |
|
xb |
Really |
| 23:30 |
|
xb |
Can I host the code on Github then? |
| 23:30 |
|
xb |
I'll give you credit and everything |
| 23:31 |
|
aditsu |
sure, it's free software, do what you want |
| 23:31 |
|
xb |
:D |
| 23:32 |
|
aditsu |
just don't try to claim it's the official version if you make changes :p |
| 23:32 |
|
xb |
Ofc |
| 23:32 |
|
xb |
Still going to give you credit though |
| 23:33 |
|
xb |
Just seems right |
| 23:39 |
|
aditsu |
hmm, the problem with generic observers is you can't have a flexible number of arguments |
| 23:40 |
|
aditsu |
probably have to wrap them into one |
| 23:43 |
|
xb |
aditsu: https://github.com/usandfriends/cjam-mirror |
| 23:44 |
|
aditsu |
alright :) |
| 23:45 |
|
xb |
I'll have to research on how to keep updating this repo |
| 23:45 |
|
aditsu |
I think there's a way to use git to access an hg repo |
| 23:46 |
|
aditsu |
then you could push changes |