|
So I finally sorted out my hashing problems. After getting a proper hash function down it was still running 5x slower. It turned out my hash of a hash was causing a copy constructor to get kicked off. Basically when I did: inner_hash_type var = *(outer_hash[key]) It was copying the whole thing. It went from taking 125 seconds to 6 seconds when I fixed that. Now the underlaying operations are much faster than similar Java code, but oddly enough the mysql connector code is much slower. That's the code doing actual queries and such. Very odd.
|
# ? Apr 19, 2010 05:58 |
|
|
# ? May 29, 2024 20:17 |
|
mr_jim posted:CoC doesn't help your ego, but it does help your programming. Have a thicker skin, you're getting some good advice here. See I laugh at attitudes like this, because while maybe I am getting good advice ('go program more' isn't hard to type out) I shouldn't have to deal with elitist stand-offish attitudes to get an answer, no matter the quality of advice. I have plenty thick skin, more than most people but having thick skin doesn't mean you're immune to being annoyed at people being dicks just because they can. For some reason, for most people on SA the concept of acting civil while maintaining a high level of posting quality doesn't exist. It seems I have to trade posting quality for good attitudes which is a drat shame, but preferable.
|
# ? Apr 19, 2010 06:45 |
|
ShoulderDaemon posted:Yep. Declare node set A to be the set of all the points you have, and set B to be the empty set. Yeah im pretty brain dead Pretty much im trying to implement some weird obscure way of using multi cores + GA to solve the TSP (by weird / obscure i mean like its a completely stupid idea but hey i didn't choose). For example: We generate 64 different populations, or possible solutions to the TSP problem. Normally each population holds its own bitstring or datablob. So instead we were thinking of basically Breaking them into n smaller problems, when once we find optimal we combine them. Now since we pretty much want to group smaller groups, i was thinking of picking a starting node, and slowly growing the pop bubbles. Basically we generate Where you have an initial population and you group them into N clusters,
|
# ? Apr 19, 2010 07:45 |
|
TheGopher you don't seem to "get" SA, you should have lurked more in CoC before making your posts. You've seriously gotten a lot a help and attention from some of the most experienced software developers on this board. Why did you come here expecting everyone to play nice with you? Here is another valid answer to your questions. Teach Yourself Programming in Ten Years
|
# ? Apr 19, 2010 07:47 |
|
TheGopher posted:See I laugh at attitudes like this, because while maybe I am getting good advice ('go program more' isn't hard to type out) I shouldn't have to deal with elitist stand-offish attitudes to get an answer, no matter the quality of advice. I have plenty thick skin, more than most people but having thick skin doesn't mean you're immune to being annoyed at people being dicks just because they can. Nobody here is being elitist. There is nothing elitist about being mediocre at programming, which is how most people here view themselves. Everybody here got okay, or decent, or good, or however they rate themselves at programming, by doing it a lot. (One exception might be me, I got good at programming by playing with decks of cards when I was three years old.) If you want elitist, go read the articles on the double hump theory or some other educational tripe. You can't get good at programming quickly or without doing it a lot. That's just the most important thing for you to do. Many of the people here learned programming with nothing more than the TI-83 manual and trial and error. I did my first programming with only the first MS Works help file to help me. And then the QBasic help file. And then the TI-83 manual. And then the TI-85 manual. And then the TI-89 manual. And then the HP-49G manual. And then Programming Perl, 3rd Edition, and then I didn't have a computer to run my Perl programs on. And then I had a lovely C++ book that my older sibling used in college. And here you are, with all the resources the internet has to offer, and you're talking to people who built up text adventures and tetris games on top of the knowledge acquired in one small chapter in the back of the calculator manual that the internet is not holding your hand enough. And what's even more amazing is that when somebody who cares a lot about helping people with their problems gives you a description of their reactions when reading your post, you think it's offensive! And it's that kind of behavior which makes people assume that you have the attitude that the world should just revolve around you. And I suspect that's an accurate assumption. And moving on... TheGopher posted:For some reason, for most people on SA the concept of acting civil while maintaining a high level of posting quality doesn't exist. It seems I have to trade posting quality for good attitudes which is a drat shame, but preferable. You're the one who asked a question badly, and even then people were repressing their inner flameswords to help you out. Look back in time at your posting and ask yourself how you might have asked a smarter question. You began your post with "So ".
|
# ? Apr 19, 2010 07:50 |
|
shrughes posted:Many of the people here learned programming with nothing more than the TI-83 manual and trial and error. How many of us are out there...
|
# ? Apr 19, 2010 11:14 |
|
KARMA! posted:How many of us are out there... Reporting in. It wasn't my first language (that was either html or GameMaker), but drat did I waste so many hours in school making stupid little number guessing programs and screensavers. e: Also it seems to me like he just needs some direction, in that maybe he understands practice will help immensely but doesn't know what to do. I've always wondered, and it would help here, if there are any sites that are basically like the problems in a textbook, that present challenges based on a user's skill level and offer the solutions and/or step-by-step methods or tutorials on how to do them. It sounds like a pretty great idea that I'll file away in the "cool stuff I though of that I'll never expound upon" file cabinet if it doesn't exist already. Mr.Hotkeys fucked around with this message at 11:19 on Apr 19, 2010 |
# ? Apr 19, 2010 11:16 |
|
TI-89 here (you plebs).
|
# ? Apr 19, 2010 11:19 |
|
It was QBasic on a 286 about 20 years ago for me. TheGopher, you're right that it isn't hard to type out "go program more". But it's really the best advice there is. Start a project that seems interesting to you and work on it. The result will be a pile of terrible code that you'll be embarrassed by in a few years, but that doesn't matter. Then start another project and keep working on that. Code yourself into a corner and rewrite the whole thing again. Repeat that process over and over again. After a few years of that, the code you write will stop being so embarrassing. That's not to say you shouldn't do any reading as well. You've been learning about C, right? If you don't already own K&R's "The C Programming Language", get it and read it. Do some of the exercises. Then maybe pick up Kernighan and Pike's "The Practice of Programming" to learn about good style. Take a look at the Coding Horrors thread here in CoC to learn what not to do. You're interested in game development, so check out that megathread as well. Oh yeah, don't forget about data structures and algorithms. I don't have any specific book suggestions in that area, unfortunately.
|
# ? Apr 19, 2010 12:35 |
|
Mr.Hotkeys posted:I've always wondered, and it would help here, if there are any sites that are basically like the problems in a textbook, that present challenges based on a user's skill level and offer the solutions and/or step-by-step methods or tutorials on how to do them. Not exactly what you're talking about (which sounds like a great idea), but JavaBat (now CodingBat: http://codingbat.com/) is a good timewaster. It won't teach you how to do things properly, but it lets you do some trial/error. It looks like they've added a whole Python section now, too.
|
# ? Apr 19, 2010 13:23 |
|
TheGopher posted:I know basic C concepts. Stuff like pointers, arrays, defining classes, typecasting, etc. Basic stuff. I have no idea where to go from here. To be clear, C is the only language I'm familiar with. I could probably get to the same point with another language with minimal effort because I really understand what I've been taught. TheGopher posted:CarlH (the author of those tutorials) wrote some pretty comprehensive information about programming. If you're about 8 hours into "learning C in 24 hours", you can't really make that call.
|
# ? Apr 19, 2010 13:42 |
|
KARMA! posted:How many of us are out there... QBASIC and the help index, and then later a TI-83 and the manual. I once got in trouble for writing a program to solve a bunch of busy work in geography class that was supposed to take all class to finish, but I finished it in about 10 minutes and then slept for the rest of class. Learn by doing. The harder it is what you try to do, the more you can potentially learn.
|
# ? Apr 19, 2010 16:50 |
|
I never programmed a calculator. Started with LOGO on a TRaSh-80, then Commodore BASIC.
|
# ? Apr 19, 2010 17:01 |
|
I didn't start programming a calculator, but did once do mandelbrot on one. I think I only had the patience to wait for it to finish once, it took absolutely ages. Eventually had to wipe it before going into an exam once
|
# ? Apr 19, 2010 17:10 |
|
Commodore BASIC then TI-BASIC leading directly to Z-80 asm
|
# ? Apr 19, 2010 18:14 |
|
Apple and TI computer BASIC in early grade school, then Commodore 64 BASIC, then C64 assembly, then AmigaBASIC, various random Amiga programming languages (AMOS, and I remember one called E fairly well), then Amiga 680x0 assembly, then I FINALLY got a Windows machine and started C++ (Turbo, then Visual). I would have loved to learn C on the Amiga, but the only compilers I had access to were gimped commercial trials that wouldn't compile more than 4 functions. But the assembler I got was fully functional, so you make do with what you've got
|
# ? Apr 19, 2010 21:39 |
|
Atari Basic is where it's at bitches.
|
# ? Apr 19, 2010 21:47 |
|
My dad tried to teach me C when I was 8 or something. I eventually settled on this, lots and lots of years ago: http://www.libertybasic.com/. The experience put me off programming till I was 13. Whoops!
|
# ? Apr 20, 2010 00:14 |
|
XML/DTD question: Can you link to a DTD within another DTD? If so, how do you do it? I haven't been able to find anything reliable on google and the W3C site is way too technical. Thanks. edit: More specifically, I have 2 DTDs that I want to use for an "html" doctype. One of them is a W3C standard, and another one is a custom proprietary DTD. Chocolate America fucked around with this message at 01:00 on Apr 20, 2010 |
# ? Apr 20, 2010 00:46 |
|
mr_jim posted:It was QBasic on a 286 about 20 years ago for me.
|
# ? Apr 20, 2010 01:07 |
|
I have a question about boolean search languages or anything that's generally suited for searching. I am working on something for screening stocks and I want to be able to write out something that knows to take an incoming pile of stocks, apply the rules, and leave me with just the ones that satisfy the rules. Initially I imagine I could just code something to do all that but I like the idea of being able to flexibly apply criteria and watch them plop out. Before I go about writing up some BNF or something for this I wondered if there wasn't a robust grammar out there already to follow that might include some things I wouldn't have originally thought about. All I have in my mind right now are basically things with AND, OR, and NOT with maybe parentheses. I have a separate question about FLTK. It sure seems easy to crank out something with it, but I wonder how well it handles layout and resizing. From what I can tell you just set groups as resizable and hope for the best. Is there anything like layout management?
|
# ? Apr 20, 2010 05:53 |
|
Rocko Bonaparte posted:Before I go about writing up some BNF or something for this I wondered if there wasn't a robust grammar out there already to follow that might include some things I wouldn't have originally thought about. All I have in my mind right now are basically things with AND, OR, and NOT with maybe parentheses. I would just pick a language that lets you run stuff from the command prompt (and pick one that lets you define your own operators or override them). I would use Haskell and end up saying things like code:
code:
|
# ? Apr 20, 2010 06:08 |
|
Edit: I found a better thread for my question.
KingEup fucked around with this message at 09:03 on Apr 20, 2010 |
# ? Apr 20, 2010 09:00 |
|
What's the purpose of offsetting a UDP packet by a certain number of bytes? I see this function in http://java.sun.com/j2se/1.4.2/docs/api/java/net/DatagramPacket.html , but I'm not sure why anyone would use it?
|
# ? Apr 20, 2010 10:42 |
|
yatagan posted:What's the purpose of offsetting a UDP packet by a certain number of bytes? I see this function in http://java.sun.com/j2se/1.4.2/docs/api/java/net/DatagramPacket.html , but I'm not sure why anyone would use it?
|
# ? Apr 20, 2010 10:45 |
|
I guess I don't really get what the offset even means here, google's not being too helpful.
|
# ? Apr 20, 2010 11:11 |
|
It's just giving offset and length into the byte[] array, isn't it? This is pretty standard when dealing with arrays. For example, String(byte[] bytes, int offset, int length)
|
# ? Apr 20, 2010 11:46 |
|
shrughes posted:It's just giving offset and length into the byte[] array, isn't it? This is pretty standard when dealing with arrays. For example, String(byte[] bytes, int offset, int length) Oh duh, it's marking where to start reading the byte array from. Thanks.
|
# ? Apr 20, 2010 11:48 |
|
In MATLAB, how would I check that a string doesn't contain any characters other than ones from a set list (the list isn't a variable or anything like that.) I have a program where the user enters an equation and MATLAB evaluates it, but first it has to check that the user only inputed numbers, or mathematical symbols. So I have to find a way for MATLAB to look it over and if it has anything other than 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, +, -, *, or /, give an error message (yeah, it's just a simple integer calculator with four functions right now.)
|
# ? Apr 20, 2010 21:59 |
|
DrBouvenstein posted:In MATLAB, how would I check that a string doesn't contain any characters other than ones from a set list (the list isn't a variable or anything like that.) You can use code:
|
# ? Apr 20, 2010 22:07 |
|
I have a database table with 155,000 names. We want to do some clean-up and find names which are not spelled exactly the same, but may be duplicates. Example: "Johnson & Johnson incorporated" and "Johnson and Johnson inc." would return a very high score. How should I go towards solving this problem ? I did some research and found an algorithm that would fit my needs. I used it in a Ruby script, but the problem is speed. Comparing one name against 155,000 others to find those with a score of > 0.8 took 70 seconds on my laptop. It would take 4 months to compare all 155,000 at that rate.
|
# ? Apr 20, 2010 23:21 |
|
Secx posted:I did some research and found an algorithm that would fit my needs. I used it in a Ruby script, but the problem is speed. Comparing one name against 155,000 others to find those with a score of > 0.8 took 70 seconds on my laptop. It would take 4 months to compare all 155,000 at that rate. If the function is symmetric, it's 2 months, not four. And why would you do this in Ruby instead of a language suited for numeric processing (e.g. C)? Ruby is slow, and depending on the problem being solved (and the quality of the code), C can be up to 1000 times as fast: http://shootout.alioth.debian.org/u32/benchmark.php?test=all&lang=ruby&lang2=gcc
|
# ? Apr 20, 2010 23:28 |
|
Secx posted:I have a database table with 155,000 names. We want to do some clean-up and find names which are not spelled exactly the same, but may be duplicates. Welp, it turns out that I was reinventing the wheel. MS SQL Server 2005 and up offer an integration service called Fuzzy Lookup Transform and it does exactly what I wanted to do. http://www.sqlteam.com/article/using-fuzzy-lookup-transformations-in-sql-server-integration-services
|
# ? Apr 21, 2010 01:14 |
|
Nippashish posted:You can use Thanks! But now I got a new problem... same scenario, but now I have to check and make sure that even if they only entered the right characters, they still wrote a valid equation...ie, I have to check to make sure they didn't do something like: "5+7--6" or "/6+3" etc...
|
# ? Apr 21, 2010 02:52 |
|
How do you extract "data" from audio files? I'd like to mess around with a music visualizer of sorts, and the first step is actually reading the music file. I've read this but it really only talks about transforming the data once you already possess it: http://stackoverflow.com/questions/153712/creating-music-visualizer I assume (not an audio person) that "data" refers to the pitch of the song?
|
# ? Apr 21, 2010 04:32 |
|
Oisin posted:How do you extract "data" from audio files? Your audio will be encoded to a particular specification. Here's the WAVE specification (uncompressed audio): http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/WAVE.html Edit: I want to add that, depending on your language, there are probably pre-existing libraries that will do the grunt work. yatagan fucked around with this message at 05:05 on Apr 21, 2010 |
# ? Apr 21, 2010 04:58 |
|
Oisin posted:How do you extract "data" from audio files? Check out libsndfile. The data is usually "amplitude," sometimes as 8-, 16-, 24- or 32-byte integers, and also possibly in floating point. You can imagine the amplitude as representing some voltage, or displacement of a speaker cone, or compression/rarefaction of air. The audio is at some sampling rate, like 48 Kilohertz, which means that 48000 samples in that file correspond to a single second, and they are uniformly spaced at 1/48000 of a second apart. The audio file can represent frequencies between 0 Hz (DC), and half the sampling rate, also known as Nyquist frequency, i.e. for 48k, the highest frequency is going to be 24k. You can extract audio spectrum data using the Discrete Fourier Transform (DFT), if that's what you want to do. You dont' want to do a DFT directly (like, using the formula for it), you want to use a Fast Fourier Transform (FFT), which is a nlogn algorithm for computing the DFT. FFTW has some really great FFT implementations. For something like this, you'd do a Short-Time Fourier Transform (STFT), which means that rather than taking the DFT of the entire sequence of audio data, you apply a windowing function (i.e. Hann, Hamming, etc) to some short portion of the data (on the order of a few ms), and take the DFT of that. Then generally these windows will overlap a bit, i.e. the windows will be 20 ms long and the stride from window to window is 10 ms. You're probably going to want to learn some DSP. You can wiki a lot of this stuff if you don't know it. There's also some stuff at http://www.dspguide.com/ and https://ccrma.stanford.edu/~jos/ . You can also check out the music-dsp mailing list.
|
# ? Apr 21, 2010 06:17 |
|
In my .NET programs I've been increasingly using "helpers" to handle part of the code that goes into code behind. For example, our WPF application supports a "flick", such as that you find in the iPhone. To do a "flick" requires some code on mouse down, mose mouve, mouse up. Instead of storing that code inside the control itself, I create a "FlickHelper". The difference between "helpers" and a standard business layer, is that "helpers" are allowed to take UI controls as parameters and operate on them, whereas a business layer should not have any knowledge of the UI. Is there an official pattern or name for this? I want to push my coworkers (and the new interns we have for the summer) to use this more often. The advantages I see to using "helpers":
At the same time, any references/resources on patterns in the past few years? I'm currently working on desktop/WPF applications. In school we studied PoEA and most of the GoF patterns.
|
# ? Apr 21, 2010 16:33 |
|
schnarf posted:Yatagan and Schnarf Thanks guys, that helped a lot. I found JLayer and I will be using that since I am a bit more comfortable with JAVA.
|
# ? Apr 21, 2010 23:49 |
|
|
# ? May 29, 2024 20:17 |
|
I'll try to ask this question I crammed into the end of an earlier post again: does anybody here understand FLTK layout and how resizing affects components? I see something about a resizable bit that affects thing, but that only one component in a group can do it. So how does one cause, say, two text fields to both resize when a window is made larger? Does each field need a group to itself?
|
# ? Apr 22, 2010 07:49 |