|
Now that I think about it, doing it with fractals seems obvious! That page will help me a lot!
|
# ? Jan 6, 2009 23:05 |
|
|
# ? May 14, 2024 19:33 |
|
Is there a good book for intermediate/hobby developers on Windows Mobile 6 programming? I won't have an opportunity to check out the SDK until tomorrow so there's a chance that the code samples there will have what I need. But if anyone knows of a good/worthwhile book then that'd be great!
|
# ? Jan 7, 2009 00:50 |
|
Mata posted:Alright, bear with me on this one.. I'm trying to generate an infinitely large height-map. I want it to resemble a landscape/map of some sort, so I don't want there to be any obviously recognizable patterns, but it can't be "too" random: Hills and mountains have slopes, not random jagged spikes, same with continents and oceans... So I figured, overlapping sine functions with random periods might look good: A huge sine curve would form continents, smaller ones would be mountain ranges, smaller still might make hills, etc: Plus, it "loops" so it doesn't matter wether you're looking at a region at (100000,70000) or at (0,0). Perlin noise sounds perfect for what you want to do. It's basically your like your idea of layering multiple sine functions. Here's a good tutorial on it. It's quite efficient as well. You can tweak the parameters to get various effects: (from here) e: simplex noise (also invented by Perlin) might be better quote:The advantages of simplex noise over Perlin noise: Perlin/simplex noise is much easier to generate in realtime than fractal noise. Scaevolus fucked around with this message at 07:51 on Jan 7, 2009 |
# ? Jan 7, 2009 07:21 |
|
edited out
Hammerite fucked around with this message at 20:22 on Jan 7, 2009 |
# ? Jan 7, 2009 19:46 |
|
Just FYI, I know you already moved it once, but the list of links in the OP of this thread includes the Web Development Megathread.
|
# ? Jan 7, 2009 20:03 |
|
Fly posted:There have got to be older editions for sale at a quarter of that price.
|
# ? Jan 7, 2009 21:10 |
|
I need to see how long a piece of C code needs to run. What's the most reliable way to time it? I found this method:code:
EDIT: I can't use the unix time program because I have to time my program at 4 different sections (three of which take a really short time and one takes quite a long time) and I also have to disregard the time it takes to do some preliminary I/O (loading up a file into memory) hey mom its 420 fucked around with this message at 23:26 on Jan 7, 2009 |
# ? Jan 7, 2009 23:02 |
|
Quick question regarding web crawling. Is perl still the best language out there for scripting web crawling stuff? I know the choice of language is a religious debate, but I was wondering if there was any consensus in this small sphere. I'm going to end up doing a lot of scripting trying to pull and parse information from the web and I'd rather not go down roads I don't need to.
|
# ? Jan 8, 2009 01:11 |
|
It is less about the language and more about the libraries - it depends what level you will have to be parsing the html (text only/html only/ with javascript?). Most dynamic languages make excellent choices - Perl has LWP::Simple and a few html parsing modules. Python has beautifulsoup (slow) or lxml to parse html, and urllib2 or pycurl to grab pages. I'm not sure about ruby, but I'm pretty sure it has similar libraries. Really, Perl, Ruby or Python are perfectly capable of web crawling.
|
# ? Jan 8, 2009 02:02 |
|
WildGunman posted:Quick question regarding web crawling. Is perl still the best language out there for scripting web crawling stuff? I know the choice of language is a religious debate, but I was wondering if there was any consensus in this small sphere. I'm going to end up doing a lot of scripting trying to pull and parse information from the web and I'd rather not go down roads I don't need to. Lex/Yacc + Libcurl (C/C++) is what I would use. Depending on how complex your parsing needs to be for the webpage, you may or may not need Yacc, but lexer is a pretty nice tool. Also fast as gently caress. hexadecimal fucked around with this message at 02:16 on Jan 8, 2009 |
# ? Jan 8, 2009 02:13 |
|
hexadecimal posted:Lex/Yacc + Libcurl (C/C++) is what I would use. Depending on how complex your parsing needs to be for the webpage, you may or may not need Yacc, but lexer is a pretty nice tool. Also fast as gently caress. You seriously give the worst programming advice.
|
# ? Jan 8, 2009 02:47 |
|
What. Why would you write a parser for HTML when you could just, you know, use any implementation of DOM you want?
|
# ? Jan 8, 2009 02:52 |
|
Man, you shoulda told him to implement his own HTTP library. Fast as gently caress
|
# ? Jan 8, 2009 03:03 |
|
But on a serious note, using lexer itself is not that complicated and is enough to pull out links and other tags from a given webpage or something. Also he asked for what is the fastest, and I don't think you can beat lexer / DFAs.
hexadecimal fucked around with this message at 03:12 on Jan 8, 2009 |
# ? Jan 8, 2009 03:09 |
|
Heh, and last time someone asked how to read XML he told them to use lex/yacc... http://forums.somethingawful.com/showthread.php?threadid=2779598&userid=143791#post353463540 I think someone needs a new custom title.
|
# ? Jan 8, 2009 03:24 |
|
You know what else is equivilent to a DFA? A regular expression.hexadecimal posted:Also he asked for what is the fastest
|
# ? Jan 8, 2009 03:47 |
|
Dijkstracula posted:You know what else is equivilent to a DFA? A regular expression. In theory yes, but who knows how some random library implements it. With lexer you know! quote:where?
|
# ? Jan 8, 2009 03:48 |
|
hexadecimal posted:You're all just mad you cant manually resolve ambiguous BNF grammar! edit: also, I'm preeeetty sure a ton of work has gone into optimizing the poo poo out of perl/python/$LANGUAGE_OF_THE_WEEK's regex library anyway.
|
# ? Jan 8, 2009 03:52 |
|
Dijkstracula posted:We're mad because it's not at all the right choice for what he's trying to do. Also, yacc will not resolve an ambiguous grammar (unlike us, who can resolve ambiguous grammars of natural languages, unlike LALR parsers), either: it'll bitch about shift/reduce and/or reduce/reduce errors and make a set choice. That's why I said "manually"
|
# ? Jan 8, 2009 03:54 |
|
DLCinferno posted:I think someone needs a new custom title. [big-red-text] IGNORE ANYTHING I HAVE TO SAY REGARDING PROGRAMMING [/big-red-text]
|
# ? Jan 8, 2009 04:00 |
|
You know, hex, when normal people are criticized for their bad advice, they stop to think about why they are being criticized and sometimes even work to improve themselves so they can give good advice, rather than just vomiting up a bunch of dumb words to justify the bad advice they initially supplied.
|
# ? Jan 8, 2009 04:01 |
|
Avenging Dentist posted:You know, hex, when normal people are criticized for their bad advice, they stop to think about why they are being criticized and sometimes even work to improve themselves so they can give good advice, rather than just vomiting up a bunch of dumb words to justify the bad advice they initially supplied. Ok I agree. Sorry I sort of trolled in this thread. I will not do it again.
|
# ? Jan 8, 2009 04:14 |
|
Whoops, I left my posting knob on teh "troll" setting
|
# ? Jan 8, 2009 04:43 |
|
ahhh spiders posted:Whoops, I left my posting knob on teh "troll" setting Looks more like the GBS setting to me.
|
# ? Jan 8, 2009 05:08 |
|
Thanks everyone, I went with the Perlin method for my heightmaps! Looking much better now:
|
# ? Jan 8, 2009 09:14 |
|
hexadecimal posted:Depending on how complex your parsing needs to be for the webpage, you may or may not need Yacc, but lexer is a pretty nice tool. Also fast as gently caress. Althugh everyone else has already called you out for this, the reason why I recommended things like beautifulsoup or lxml is that although parsing well formed htm lis easy, html is never well formed. An HTML parser that supports xpath is a fantastic invention, I think some even support css selectors too.
|
# ? Jan 8, 2009 09:37 |
|
Bonus posted:I need to see how long a piece of C code needs to run. What's the most reliable way to time it? I found this method: But yeah you're right, the time delta should be t2-t1. Also the casting and pseudo-optimisation of turning one divide into two multiplies is a bit dumb. For quick and dirty, I generally use something like: code:
|
# ? Jan 8, 2009 12:45 |
|
Ok not programming specific but CoC specific and I figure it will get read here. I'm seeing a few threads specifically for job offers (there's a sudden increase in demand after the holidays?). There's also been a few posters mentioning they're looking for jobs, and I'm pretty sure that there are a fair amount of students on this forum like myself that will be looking for a summer internship. Any thoughts on there being a single thread specifically for job seekers/job offers?
|
# ? Jan 8, 2009 15:24 |
|
chocojosh posted:Any thoughts on there being a single thread specifically for job seekers/job offers? Cidrick or one of the other mods should weigh in on this. I'm not sure how well it'd work. With the single thread per job offer model, jobs that aren't open anymore or aren't interesting will just go away eventually, or could be closed. If they were all in a single thread, offers that aren't good anymore will either have to be edited out or we'll get a lot of "I saw this back on page 2 and I know it's page 48 and three years later, but..."
|
# ? Jan 8, 2009 15:53 |
|
tef posted:I'm not sure about ruby, but I'm pretty sure it has similar libraries. There's a ruby port of Beautiful Soup called rubyful soup but I've never used it. I have used Hpricot and liked it.
|
# ? Jan 8, 2009 17:49 |
|
So, how 'bout that IPv6, eh? I'm trying to update some code at work so that when someone someday decides that we need to make the switch to IPv6 I can slack off. I have code similar to this: code:
The server- and client-side sockets are set up in exactly the same way for both, except the address family for one is AF_INET and the other is AF_INET6. This is on Linux if it makes a difference. I can work around this, but it's kind of a wart. Is this the intended behavior? Is it because my IPv6 address really a fake being tunneled back to the IPv4 address? Or what?
|
# ? Jan 8, 2009 23:30 |
|
TSDK posted:The only reason I can think for it apprearing to work, is that you're timing from very near the start of the program, when t1 is near to zero. Thanks, that works great! I don't even care for the exact timing, I'm just trying to see if the running time increases according to the algorithm time complexity.
|
# ? Jan 8, 2009 23:39 |
|
TSDK posted:Also the casting and pseudo-optimisation of turning one divide into two multiplies is a bit dumb. For quick and dirty, I generally use something like: The division-to-multiplication optimization is not a bad one, although it would obviously be better to turn one division into one multiplication instead of two. If CLOCKS_PER_SEC is a compile-time constant (likely), your compiler should turn this into the optimal thing, but it probably wouldn't if it isn't.
|
# ? Jan 9, 2009 02:10 |
|
Can someone talk about free pool data structure? I saw some Microsoft research guy talk about it today on research channel, and it seemed interesting, but I didn't understand much from his short explanation.
|
# ? Jan 9, 2009 07:06 |
|
This is kind of dumb, but anyone know about writing to the command line without spitting out a new line? I need to do a progress counter and don't want just spit out new lines. This is in Groovy (which uses Java's output mechanisms).
|
# ? Jan 9, 2009 17:51 |
|
Randomosity posted:This is kind of dumb, but anyone know about writing to the command line without spitting out a new line? I need to do a progress counter and don't want just spit out new lines. I don't know anything about Groovy, but I know that Java has two separate printing functions: System.out.println (which prints a newline at the end) and System.out.print (which doesn't).
|
# ? Jan 9, 2009 18:09 |
|
Well, I understand that stuff perfectly fine. I want to change to print new information without writing new lines to the buffer. For example, code:
code:
code:
code:
It's just a stupid stylistic thing, but I'm curious how it's done.
|
# ? Jan 9, 2009 18:18 |
|
Randomosity posted:It's just a stupid stylistic thing, but I'm curious how it's done. Edit: One-liner to show it in Ruby: code:
zootm fucked around with this message at 18:25 on Jan 9, 2009 |
# ? Jan 9, 2009 18:21 |
|
Randomosity posted:I do this in python by accessing the stdout stream directly and sending it '\b' characters.
|
# ? Jan 9, 2009 18:23 |
|
|
# ? May 14, 2024 19:33 |
|
sund posted:I do this in python by accessing the stdout stream directly and sending it '\b' characters.
|
# ? Jan 9, 2009 18:26 |