Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Dijkstracula
Mar 18, 2003

You can't spell 'vector field' without me, Professor!

coldfire07 posted:

Regarding a memory leak, the only thing I can spot is the fact that although the SPNode is freed from memory, the actual Point object isn't -- which is intentional since we're wanting to save it in ret, right? Of course, I could be missing something else altogether.

Heh, it's a subtle thing that you might have missed, but no, you're making a copy of what head->data points to, not just overwriting the pointers. So, p1 back in the main function just gets assigned new values in its fields (because it's a Point structure living on the stack, not a pointer to a Point structure that you've malloc()ed), so sp->head.data is a pointer to data that is only referenced in one place - the node that you've just freed the memory of!

Adbot
ADBOT LOVES YOU

ndrz
Oct 31, 2003

Oh wow, I never would have caught that, I didn't realize the distinction you described about p1, great to know. Thanks for your help :)

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

PDP-1 posted:

The problem here is that when you try to reconstruct your input function from the inverse transform the result you get is going to be a new function that is periodic in T. For example if you sample x(t) for one second (T=1) and do the transform/inverse-transform to try to calculate what the system will be doing at t=1.1 seconds, what is really going to happen is that your function will 'loop around' and give you x(0.1) and not some extrapolation to x(1.1).
I chewed on that awhile and am sure you are right. Can you imagine an alternatives that might work? Wavelets?

BigRedDot
Mar 6, 2008

Rocko Bonaparte posted:

I chewed on that awhile and am sure you are right. Can you imagine an alternatives that might work? Wavelets?

If you want to extrapolate you really need some kind of model that actually tells you something about the meaning of your data to guide you. Just picking some random curve fitting algorithm may give you a value, but it won't have anything to do with anything.

monsterland
Nov 11, 2003

Is Direct3D's d3dxsprite interface incompatible with pixel shaders ? I use clean pixel shader code samples from tutorials and get garbage.

The rudimentary/useless examples such as "fill the screen with RED" work, but anything involving modification of existing screen data creates horrific results.

monsterland fucked around with this message at 01:39 on Feb 2, 2010

pr0k
Jan 16, 2001

"Well if it's gonna be
that kind of party..."
Ok, I'm an experienced coder, but I know gently caress all about making programs for windows.

I want to write a tiny app that has a system tray icon and more or less works like a screensaver. What's the quickest/dirtiest/cheapest platform for making lil' windows apps?

thanks!

PDP-1
Oct 12, 2004

It's a beautiful day in the neighborhood.
Microsoft gives away a pretty nice development environment for several languages that makes producing Windows .NET programs nearly trivial. You can download them here for whatever language you like best. The Express Editions are the free versions.

After that, just Google for '.NET screensaver' and '.NET system tray' and you should find plenty of examples/tutorials.

pr0k
Jan 16, 2001

"Well if it's gonna be
that kind of party..."
Excellent, thanks!

Jose Cuervo
Aug 25, 2004
I have a bunch of pdf files that I want to put online for someone to be able to access, but I do not want to have to manually type in the names of all the files as:

<a href="filename.pdf">Filename</a>

since the names of the files are pretty long and involved and there are 45 or so of them.
The way I was thinking of doing this is to write some sort of script(?) that will look in a particular folder and generate a text file that has an entry like the one above for each pdf file in the folder. Then all I have to do is copy that information and paste it in my .html file.

Is this even feasible? And if so, where can I look to get some basic info on how to accomplish this?

ShoulderDaemon
Oct 9, 2003
support goon fund
Taco Defender
code:
#!/bin/sh

for pdf in /directory/to/search/*.pdf; do
  echo "<a href=\"$pdf\">`basename "$pdf" .pdf`</a>"
done
Won't do the right thing if there are "s or <s in the filenames, but otherwise it should work.

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh
Why not just upload them all to a directory and allow the directory itself to be viewed?

Mustach
Mar 2, 2003

In this long line, there's been some real strange genes. You've got 'em all, with some extras thrown in.

Avenging Dentist posted:

Why not just upload them all to a directory and allow the directory itself to be viewed?
And before anybody says that nobody does this, here's a great example:

http://www.coenbrothers.net/scripts/

Jose Cuervo
Aug 25, 2004

Avenging Dentist posted:

Why not just upload them all to a directory and allow the directory itself to be viewed?

That would be the easiest way, but I do not know how to do this. I am using the personal webpage given to me by my university. If you could point me in the right direction I would appreciate it.

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh
http://www.javascriptkit.com/howto/htaccess11.shtml

Jose Cuervo
Aug 25, 2004

Thanks for the link. Although I was not able to get it to work I did manage to write a script to accomplish what I need.

ShinAli
May 2, 2003

The Kid better watch his step.
I'm trying to pass in a long long int into printf in 32-bit x86 assembly.

Well, I can do it, but I'm not sure I'm pushing the argument values in the right order, specifically for the long long int (push lower or upper 4 bytes first?).

Assume count is the location of the 64 bit long and count_string is "%llu\n":

code:
movl count,%eax
pushl %eax
movl count+4,%eax
pushl %eax
pushl $.count_string
call printf
I've done a similar operation in C and output the assembly, but it's a little confusing. From what I gather, it's "pushing" (not necessarily pushing, using lots of movs) in the upper bytes first, then lower, then the address of format string. Which suggest my code should look like this:

code:
movl count+4,%eax
pushl %eax
movl count,%eax
pushl %eax
pushl $.count_string
call printf
I am not sure if I understand the output assembly correctly, so I just need confirmation (and possibly an explanation why I need to push the upper bytes first? Because it doesn't necessarily read in 8 bytes, but rather 4 bytes at a time?).

EDIT: here is GCC's "correct" assembly for reference:

code:
main:
        ...
        leal    -8(%ebp), %eax
        addl    $1, (%eax)       # did an add to confirm which was the lower bytes
        adcl    $0, 4(%eax)
        movl    -8(%ebp), %eax
        movl    -4(%ebp), %edx
        movl    %eax, 4(%esp)
        movl    %edx, 8(%esp)
        movl    $.LC0, (%esp)
        call    printf
        ...

ShinAli fucked around with this message at 04:07 on Feb 5, 2010

spiritual bypass
Feb 19, 2008

Grimey Drawer
I want to set up my Subversion repository to automatically copy its files out to another directory on commit.

I understand the commit hook mechanism, but what I don't understand is the location of the files in my repository. What I want out of this is to auto-deploy a web app to /var/www whenever it gets a commit. How do I get at my files?

ndrz
Oct 31, 2003

I did this for a project last year, and I seem to remember having to check out the code into /var/www/whatever. So I had Subversion installed on the server, and it was checked out on my laptop and on /var/www/whatever. Then with auto-commit hooks, I would force it to be re-checked out on /var/www/whatever whenever I checked it in from my laptop.

I think I followed this guide when I was setting it up: http://alextreppass.co.uk/getting-django-working-on-bluehost

spiritual bypass
Feb 19, 2008

Grimey Drawer
Thanks! I was looking at svn export, which looked like a terrible way to do it.

This seems much better.

HondaCivet
Oct 16, 2005

And then it falls
And then I fall
And then I know


Augh, does anyone know/use R? I have a couple of quick questions:

1) I have some data that's already organized into 3 sets. My homework wants me to lay another "factor" over it that has 2 sides. (Sort of like if you organized cars by size and color). I did y = c(data) then x = c(rep(1,7) . . . ) or whatever. How do I overlay the second factor?

2) How do I create side-by-side box plots that are organized via the new factor?

Also if anyone knows of an R help file or guide that is particularly good that'd be nice to have.

Edit: Never mind, got the answer in class today. If anyone's curious I can post the answer.

HondaCivet fucked around with this message at 21:19 on Feb 8, 2010

Niacin
Mar 8, 2005
not so much
Kind of meta, but is there a forum/website that has data on which tech recruiters in a given area are recommended or suck?

Coasterphreak
May 29, 2007
I like cookies.
Okay, I've got a small question. I have a filename that seems to be a hash value, in hex. Is there any way I can "decrypt", if you will, the hash and recover the original filename?

Ferg
May 6, 2007

Lipstick Apathy
So I'm teaching myself Haskell and running through Project Euler. I'm getting hung up on compiling my code, even though I've tested it (formatted differently) in GHCi:
code:
let list = [1 .. 1000]

let eval n = do if n `mod` 3 == 0 
                    then True 
                else if n `mod` 5 == 0 
                    then True 
                else False

let result = filter eval list
This throws the compiler error:
code:
project_euler1.hs:3:0: parse error (possibly incorrect indentation)
Any ideas? As far as I can tell my indentation is correct...

ToxicFrog
Apr 26, 2008


^^^ You might want to look at this. Short form, you're using let improperly; it's meant to be used as 'let <definitions> in <expression>', for creating local bindings. If you're just defining globals, drop 'let' entirely:
code:
list = [1 .. 1000]
The "incorrect indentation" error it gives you is misleading; the underlying problem is that it sees "let name = value" and then hits another "let" while waiting for you to say "in" and gets confused. (I think fixing this may prompt indentation errors that are actual indentation errors, though).

I'm guessing that you did it this way because you have to use let when declaring functions in ghci; ghci, however, works somewhat differently from ghc, in ways that can be surprising.

Unrelated to your question, but as a matter of style, your use of a do block for what should be pure-functional code (and if-else for a short expression) drove me kind of bonkers until I rewrote it as:
code:
eval n | n `mod` 3 == 0 = True
       | n `mod` 5 == 0 = True
       | otherwise      = False
And then again as:
code:
eval n = (n `mod` 3 == 0) || (n `mod` 5 == 0)
I though there was a Haskell thread around here somewhere, but I can't find it. #haskell on freenode is usually pretty helpful if you run into something bigger than this thread, though.

Coasterphreak posted:

Okay, I've got a small question. I have a filename that seems to be a hash value, in hex. Is there any way I can "decrypt", if you will, the hash and recover the original filename?

No. Hashes are not encryption; they can't be reversed to get the original cleartext.

If it's a bad hashing algorithm you may be able to get a collision in less-than-fuckyou time, ie, some string that generates the same hash, but you have no guarantees it's the same one used originally (hint: it probably isn't).

shrughes
Oct 11, 2008

(call/cc call/cc)

ToxicFrog posted:

No. Hashes are not encryption; they can't be reversed to get the original cleartext.

If it's a hash of a filename you could probably reverse it, unless it's a weirdly long and peculiar filename.

quote:

If it's a bad hashing algorithm you may be able to get a collision in less-than-fuckyou time, ie, some string that generates the same hash, but you have no guarantees it's the same one used originally (hint: it probably isn't).

You're blabbing irrelevantly because you like the sight of your own sentence structure. Not even md5 has a workable preimage attack.

Ferg
May 6, 2007

Lipstick Apathy

ToxicFrog posted:

^^^ You might want to look at this. Short form, you're using let improperly; it's meant to be used as 'let <definitions> in <expression>', for creating local bindings. If you're just defining globals, drop 'let' entirely:
code:
list = [1 .. 1000]
The "incorrect indentation" error it gives you is misleading; the underlying problem is that it sees "let name = value" and then hits another "let" while waiting for you to say "in" and gets confused. (I think fixing this may prompt indentation errors that are actual indentation errors, though).

I'm guessing that you did it this way because you have to use let when declaring functions in ghci; ghci, however, works somewhat differently from ghc, in ways that can be surprising.

Unrelated to your question, but as a matter of style, your use of a do block for what should be pure-functional code (and if-else for a short expression) drove me kind of bonkers until I rewrote it as:
code:
eval n | n `mod` 3 == 0 = True
       | n `mod` 5 == 0 = True
       | otherwise      = False
And then again as:
code:
eval n = (n `mod` 3 == 0) || (n `mod` 5 == 0)
I though there was a Haskell thread around here somewhere, but I can't find it. #haskell on freenode is usually pretty helpful if you run into something bigger than this thread, though.


No. Hashes are not encryption; they can't be reversed to get the original cleartext.

If it's a bad hashing algorithm you may be able to get a collision in less-than-fuckyou time, ie, some string that generates the same hash, but you have no guarantees it's the same one used originally (hint: it probably isn't).

Ahhh excellent. Thanks for this!

Jonnty
Aug 2, 2007

The enemy has become a flaming star!

Coasterphreak posted:

Okay, I've got a small question. I have a filename that seems to be a hash value, in hex. Is there any way I can "decrypt", if you will, the hash and recover the original filename?

Firstly, are you sure it's a hash of the filename, and if so, why? Do you know how it's hashed? Why do you need to know what the filename is?

With no further knowledge of your situation, I'd suggest that it's actually a hash of the file contents. That's what places like Waffleimages and do for storing images, and it's what I do at gbs.fm. You might want to check that possibility.

Otherwise, try md5.rednoize.com for both md5 and sha1.

covener
Jan 10, 2004

You know, for kids!

shrughes posted:

If it's a hash of a filename you could probably reverse it, unless it's a weirdly long and peculiar filename.

Can you elaborate on what you mean here? Do you just mean by guessing hash algorithms and cycling through filenames to see if you can generate a match?

Jonnty
Aug 2, 2007

The enemy has become a flaming star!

covener posted:

Can you elaborate on what you mean here? Do you just mean by guessing hash algorithms and cycling through filenames to see if you can generate a match?

There are sites, like the one I mentioned earlier, that have (presumably) big tables of hashes and strings they correspond to. While a hash can theoretically correspond to any number of strings, in reality they tend to only correspond to one short/meaningful one.

yatagan
Aug 31, 2009

by Ozma

Jonnty posted:

There are sites, like the one I mentioned earlier, that have (presumably) big tables of hashes and strings they correspond to. While a hash can theoretically correspond to any number of strings, in reality they tend to only correspond to one short/meaningful one.

Rainbow tables!

ToxicFrog
Apr 26, 2008


shrughes posted:

You're blabbing irrelevantly because you like the sight of your own sentence structure. Not even md5 has a workable preimage attack.

This may come as a surprise, but md5 is not the only cryptographic hash in existence, although it or sha1 is probably the most common. md4 has had a feasable preimage attack for years, and back in 2004 Kelsey & Schneier were doing some interesting work on conducting preimage attacks on a certain class of n-bit hashes (to which sha1 belongs) in much less than 2^n time. (It's still not fast enough to be useful in general, though).

Yeah, if the hash is md5 or sha1 - and it's probably one of those two - you aren't going to be able to do a first-preimage attack yet. But blathering on about how preimage attacks are impossible is patent nonsense.

Jonnty
Aug 2, 2007

The enemy has become a flaming star!

yatagan posted:

Rainbow tables!

I knew there was a proper name for them! Thanks.

almostkorean
Jul 9, 2001
eeeeeeeee
Does anyone have suggestions on what's the easiest way to make a small Windows application that can enumerate a list of running programs, then you select that program from a list and take a screenshot of that app's window? Right now I'm trying to do this using Qt and some Windows API functions (EnumWindows but I'm having a lot of trouble. The main problem is that it's not enumerating all windows...

Drizzle 34
Jul 16, 2007
Are there any good programming blogs/sites/forums that everyone pretty commonly agrees are worth visiting regularly?

I've been thinking about replacing the time I burn on videogame websites with an attempt to learn to program, (I have a teenytiny bit of experience with c++ and visualbasic, thinking of getting into 'processing') and am interested in some sites to get ideas/get me thinking about it in general.

Scaevolus
Apr 16, 2007

Drizzle 34 posted:

Are there any good programming blogs/sites/forums that everyone pretty commonly agrees are worth visiting regularly?

I've been thinking about replacing the time I burn on videogame websites with an attempt to learn to program, (I have a teenytiny bit of experience with c++ and visualbasic, thinking of getting into 'processing') and am interested in some sites to get ideas/get me thinking about it in general.

Aggregators are your best bet.

http://news.ycombinator.com/
http://www.reddit.com/r/programming/

Avoid anything written by Atwood or Spolsky.

schnarf
Jun 1, 2002
I WIN.

Rocko Bonaparte posted:

I chewed on that awhile and am sure you are right. Can you imagine an alternatives that might work? Wavelets?
Think about what sort of data you're looking at, and maybe more importantly, come up with some test cases, and use your intuition about what you would do to extrapolate to inform your choice.

The reason the Fourier Transform approach does this is just because an assumption is that the signal is periodic.

If, for example, you had a tonal sound, you could estimate the fundamental frequency, and extrapolate by repeating pitch periods. If you had exponentially decaying noise, it would be a different story.

Communist Q
Jul 13, 2009

Anyone familiar with SAS? I'm currently working on a homework assignment and can't seem to figure out the last step. It requires renaming a character variable column a into a numeric value.

Currently, the labels for the second and third columns are CDF1 and CDF2. I need to change them to 0.00 and 0.05. Since SAS variable names cannot start with a number or contain a special characters like ., I've reached a dead end. I've tried various ways to format them to be read as character values, but haven't had any luck. An explanation of what to do or a hint to put me on the right track would be greatly appreciated.

UZR IS BULLSHIT
Jan 25, 2004
As far as I know there isn't a Fortran thread so I'm posting here.

I have a piece of code in a numerical computing program that looks like:

code:
b(1) = -(5/2)*f(1) + 2*f(2) + (1/2)*f(3)
Is there something I don't understand about intrinsic math functions in Fortran that causes this:

code:
b(1) = -(5/2)*f(1) + 2*f(2) + f(3)/2
to produce a significantly different result? With everything else being literally, exactly the same, when I run the code with the former, that particular expression computes to ~0.765, while if I run it with the latter, it computes to ~1.119.

e: 1.119 is the correct value, I reconstructed what I was doing in Matlab, and that gives 1.119 no matter which way it's written.

UZR IS BULLSHIT fucked around with this message at 03:51 on Feb 11, 2010

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh
b(1) = -(5/2)*f(1) + 2*f(2) + (1/2)*f(3)

simplifies to

b(1) = -(2)*f(1) + 2*f(2) + (0)*f(3)

Adbot
ADBOT LOVES YOU

UZR IS BULLSHIT
Jan 25, 2004

Avenging Dentist posted:

b(1) = -(5/2)*f(1) + 2*f(2) + (1/2)*f(3)

simplifies to

b(1) = -(2)*f(1) + 2*f(2) + (0)*f(3)

I definitely don't see why that would be the case.

edit: although after I check in MATLAB I see that you are correct. Can you explain why it behaves like that? It makes no sense to me.

UZR IS BULLSHIT fucked around with this message at 04:00 on Feb 11, 2010

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply