[QUOTE=Richy19;34479001]If I want to check if all elements of a string array in java can be converted to integers, do I have to make my own method or is there a simple method in java?[/QUOTE]Uhm
[code]
try {
Integer.parseInt(StringHere);
//working code here
} catch (Exception e) {
//not working code here
}
[/code]
[QUOTE=dije;34480398]Uhm
[code]
try {
Integer.parseInt(StringHere);
//working code here
} catch (Exception e) {
//not working code here
}
[/code][/QUOTE]
Pretty sure he knows how to do it manually, but he's wondering if there's a built in/nicer way.
For example, in C#:
[code]
//words is a filled List<string>
int i;
bool allInts = words.All<string>(item => Int32.TryParse(item, out i));
[/code]
[QUOTE=esalaka;34479276]or V10jd17jp?[/QUOTE]
I've never got into the habit of doing that. I've always just selected the text in visual mode with the mouse, then clicked where I wanted it to go. When I can't be bothered to go for the mouse, I just hold down the movement keys until it comes out right. Terrible, but hey.
[QUOTE=dije;34480398]Uhm
[code]
try {
Integer.parseInt(StringHere);
//working code here
} catch (Exception e) {
//not working code here
}
[/code][/QUOTE]
Yea thats the way I have gone for but as novembrDobby says I wanted to know if there is a more efficient way(given that its an array of strings and I need to check that all of them are ints)
What's the best place to learn how to interact with web resources? My knowledge is spotty and useless, and I'd like some (preferably) language-agnostic tutorials to run me through it.
[editline]31st January 2012[/editline]
plus I want to make a java porn scraper obvs
[QUOTE=Nigey Nige;34480954]What's the best place to learn how to interact with web resources? My knowledge is spotty and useless, and I'd like some (preferably) language-agnostic tutorials to run me through it.
[editline]31st January 2012[/editline]
plus I want to make a java porn scraper obvs[/QUOTE]
I would use Perl for scraping HTML, there's a library called 'pQuery' that lets you extract bits from the HTML
[QUOTE=Richy19;34480799]Yea thats the way I have gone for but as novembrDobby says I wanted to know if there is a more efficient way(given that its an array of strings and I need to check that all of them are ints)[/QUOTE]
What you could do is concat them all and then check if the big one is an int.
That might cause an overflow but you probably know if it will or wont.
[QUOTE=Darwin226;34481133]What you could do is concat them all and then check if the big one is an int.
That might cause an overflow but you probably know if it will or wont.[/QUOTE]
Checking each entry by itself is probably faster.
SimpleHTMLDOM is fucking FANTASTIC if you want to use PHP.
I'm currently starting out work with NodeJS. It's very interresting what you can do with javascript!
The current project I'm trying my hand at is a database transfer system, which can be extended to use any type of forum/whatevs. Development is kind of slow, though, as I have to resort to using the computer at most from 15:40 / 3:40PM UTC+1, which is somewhat annoying.
[QUOTE=Darwin226;34481133]What you could do is concat them all and then check if the big one is an int.
That might cause an overflow but you probably know if it will or wont.[/QUOTE]
Also, I'd just like to add that this is obviously an unnecessary optimization thing and you should definitely prefer readability and shortness over how well it performs.
And don't forget, even if it's a long piece of code you can still put it in a function and it instantly turns into 1 line of code.
By any chance is there a way across various routers to keep them from rewriting the source address of packets...?
[QUOTE=amcfaggot;34483163]By any chance is there a way across various routers to keep them from rewriting the source address of packets...?[/QUOTE]
Tell the routers to act as bridges?
[QUOTE=amcfaggot;34483163]By any chance is there a way across various routers to keep them from rewriting the source address of packets...?[/QUOTE]
Are you trying to fake your IP you silly dog you?
Yes, and I figure I can get away with it if I just connect directly to my modem rather than the router, but I haven't tried that. If there was a way to get around it other than that approach, that would be neat.
Some ISPs set the source packet at the ISP level. Tell me if you have success, I might see if I can use PCap to set the source address on my side too, to see if it works
[QUOTE=Map in a box;34483515]Some ISPs set the source packet at the ISP level. Tell me if you have success, I might see if I can use PCap to set the source address on my side too, to see if it works[/QUOTE]
I've heard of this as well.
[editline]31st January 2012[/editline]
what a bummer, my source is being overwritten even on the modem
Quick question, I want to make a graphical equalizer from what's being played through my speakers(spotify etc). Is there a library that would let me access the buffer in an easy way?
[QUOTE=AtomiCasd;34483760]Quick question, I want to make a graphical equalizer from what's being played through my speakers(spotify etc). Is there a library that would let me access the buffer in an easy way?[/QUOTE]
I haven't tried this myself, but I believe BASS could take care of that. I do recall seeing someone here take speaker output and use that in BASS to colorize their background based on frequency response. I've only used it for analyzing input, but since I've seen that aforementioned project, I guess it's possible.
You'd be looking for [url]http://www.un4seen.com/[/url] and the C function involved is BASS_GetChannelData() which you can pass FFT enums through.
[img]http://27.media.tumblr.com/tumblr_lyo7rnbIK51qd3p2to1_500.png[/img]
I programmed this image
Okay time for me to leave my computer
[editline]31st January 2012[/editline]
Forever
[QUOTE=supersnail11;34484113]Anyone doing [url=https://codequest.spotify.com/]this?[/url][/QUOTE]
[quote]Residents of the USA.[/quote]
I guess not. ( Even though.. Spotify was in Europe before USA. Fucking bullshit. )
I have about half a school years worth of experience with java, where we learned the basics, and how to make simple programs. Well, the class is over now, and I would like to know how to make 2d games with java. Does anyone know a good tutorial for it? Any help would be appreciated.
[QUOTE=@@;34484504]I guess not. ( Even though.. Spotify was in Europe before USA. Fucking bullshit. )[/QUOTE]
[quote]At Spotify, we're always looking for top-notch talent to [b]join our NYC team[/b]. We figured throwing a contest would be a great way to go about it! [/quote]
Is it a good idea to make everything a class? I don't see the need for making classes of say a map because there is only going to be one and it's a pain to add the pointer as a variable to everything that uses it.
[QUOTE=WTF Nuke;34485596]Is it a good idea to make everything a class? I don't see the need for making classes of say a map because there is only going to be one and it's a pain to add the pointer as a variable to everything that uses it.[/QUOTE]
Well, you need a variable to [i]something[/i] that holds the data of the map, so could just as well be an instance of a class that also includes methods to do stuff with the map, so it doesn't clutter all your other code.
That's true, and global variables are bad. Guess I shouldn't take shortcuts on this project.
[img]http://puu.sh/fhed[/img]
Setup my first quad tree. Everything went better than expected.
[img]http://puu.sh/fhfE[/img]
Much better than expected.
Sorry, you need to Log In to post a reply to this thread.