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
ohgodwhat
Aug 6, 2005

But THREE is more descriptive....

Adbot
ADBOT LOVES YOU

ohgodwhat
Aug 6, 2005

duz posted:

$_REQUEST wouldn't work for this because it goes $_GET -> overwritten by $_POST -> overwritten by $_COOKIE. That code is $_POST -> overwritten by $_GET.

http://us2.php.net/manual/en/ini.core.php#ini.variables-order :mmmhmm:

ohgodwhat
Aug 6, 2005

duz posted:

Yes, the default is GPC which is what I used. I figured anyone who writes code like that doesn't know how to edit the php.ini (or isn't allowed to).

I think you put too much faith into idiots not putting too much effort into finding the wrong solutions for their own problems. :v:

ohgodwhat
Aug 6, 2005

Scaevolus posted:

I bet he means an APL keyboard.

Additional characters:

\ _ ¨ ¯ × ÷ ← ↑ → ↓ ∆ ∇ ∘ ∣ ∧ ∨
∩ ∪ ∼ ≠ ≤ ≥ ≬ ⊂ ⊃ ⌈ ⌊ ⊤ ⊥ ⋆ ⌶ ⌷
⌸ ⌹ ⌺ ⌻ ⌼ ⌽ ⌾ ⌿ ⍀ ⍁ ⍂ ⍃ ⍄ ⍅ ⍆ ⍇
⍈ ⍉ ⍊ ⍋ ⍌ ⍍ ⍎ ⍏ ⍐ ⍑ ⍒ ⍓ ⍔ ⍕ ⍖ ⍗
⍘ ⍙ ⍚ ⍛ ⍜ ⍝ ⍞ ⍟ ⍠ ⍡ ⍢ ⍣ ⍤ ⍥ ⍦ ⍧
⍨ ⍩ ⍪ ⍫ ⍬ ⍭ ⍮ ⍯ ⍰ ⍱ ⍲ ⍳ ⍴ ⍵ ⍶ ⍷
⍸ ⍹ ⍺ ⎕ ○

Let's stick to ASCII.

And I have to learn APL. Wish me luck. :(

ohgodwhat
Aug 6, 2005

schnarf posted:

If this is in the FFT where I think it is, then this isn't uncommon. It's probably being used for doing an inverse FFT if necessary. This is because the inverse FFT is almost exactly the same as the forward FFT, you just flip the sign of the imaginary part, I believe.

Except:
cos(-sign*2*pi/(4.0)) = 0
sin(-sign*2*pi/(4.0)) = -sign

when sign = -1,1

ohgodwhat
Aug 6, 2005

Incoherence posted:

Programming contest solutions tend not to be known for their elegance.

I've seen some elegant solutions at programming competitions:

code:
for(int i=1; i<1000; i++)
if(i==1){ printf("One");}
if(i==2){ printf("Two");}
if(i==3){ printf("Three");}
....
if(i==999){ printf("Nine Hundred And Ninety Nine");}
}
Took a team the entire length of the competition to write (6 hours), and it didn't even pass.

ohgodwhat
Aug 6, 2005

OneEightHundred posted:

One of my earliest programs was Tic-Tac-Toe. I never finished it because it was taking too long to code all of the possibilities.

I was actually in a competition and we did that problem the right way. A team which did it the brute-force way won because ours was the only other one that actually worked, but we spelled "forty" wrong so we lost. They told us that it was incorrect and if we were programmers at, say, Microsoft, they wouldn't have allowed that to ship because of it. :suicide:

That's actually pretty funny because I misspelled "forty" as well which led to the same problem. We didn't get that stupid bullshit about MS though. Those competitions were so pathetic. We beat the second place team by 50% the first year. One retarded group gave up an hour into it and played a flash based version of DDR.

quote:

Programming competitions should be viewed as nerd social events and really not much else, for exactly the reasons outlined here.

Minus the social part, yeah. I didn't go to them to meet people. It was a lot more fun crushing their hopes and dreams....

ohgodwhat
Aug 6, 2005

rotor posted:

Demented and sad, but social.

Oh please, they all played WoW, so they thought they were good at computers with the associated egos. The one team gave up 30 minutes into it to play some flash version of DDR. :v:

ohgodwhat
Aug 6, 2005

rotor posted:

I missed u too. protip: never go on vacation with small children, it sucks.

But what would you do if you need to feast?

ohgodwhat
Aug 6, 2005

zergstain posted:

Oh, and hexadecimal, if the client computes the hash, and you get to the hashes, you can just send the hash and login. If it's too sensitive to send the password as plaintext, use SSL.

Wouldn't something like this work? I remember doing it like this a long time ago. In case it's not obvious I don't code much in PHP or JS.

php:
<?php
$key rand(); //probably use something better
$_SESSION["key"] = $key;
echo '...<input type="password" name="password"><input type="hidden" name="key" value="'+$key+'">...';
?>
code:
<script>
function onLoginSubmit(form){
$hash = md5( md5(form.password.value) + form.key.value);
//send
}
</script>
php:
<?php
$password_hash //get from database
$key $_SESSION["key"];
if(md5($password_hash+$key) == $_POST["password_hash"])
{
echo "Yay, yuou're logged in!";
}
?>
Obviously SSL would be better and easier, this is just kind of academic.

ohgodwhat
Aug 6, 2005

zergstain posted:

That doesn't really look like it could help much, I think it would be possible to edit the html and js so you could just paste the stolen hash and click login, and keep it so the session cookie would be valid.

$_SESSION["key"] would be changed each time the login form is generated. I'm sorry if that wasn't clear. You don't even have to use sessions, I was just doing it as an example.

And yes, MD5 is weak, SHA-1 or SHA-2 would be better, I just recall seeing a JS implementation of MD5 years ago. Would it be possible to break it in this instance? Possibly, if you could intercept the hash as it was being transmitted to the client.

ohgodwhat fucked around with this message at 08:21 on Jan 10, 2009

ohgodwhat
Aug 6, 2005

zergstain posted:

I have some web developer extension at work, and it looked like I could edit the html in RAM with it. But actually, I'm not sure what's stopping the hacker from saving the relevant stuff to disk since I believe when you submit the form and the browser requests the action url, the cookies for that domain would be sent. As long as the form wasn't reloaded from the server, the key would still be valid.

Edit: Oh wait, a referrer check could stop that saving it to disk and editing it method. Probably wouldn't do anything for the use a Firefox extension and edit it in RAM method though.

It doesn't matter how much they edit it, the $key is only good for one request, so if they have the password hashed with that key, they can't use it again.

quote:

If I need to login again, I can reload the page from the server, then copy and paste the new challenge value in the proper place in my saved page.

Do you type in the password again too?

ohgodwhat fucked around with this message at 05:25 on Jan 11, 2009

ohgodwhat
Aug 6, 2005

That wouldn't even work in Python, although I don't know about Perl.

ohgodwhat
Aug 6, 2005

Zombywuf posted:

Now just got to hope the book doesn't suggest email regexes like '[a-zA-Z0-9_]+@[a-z]+\.(com|org)'.

What would be the correct email regex?

ohgodwhat
Aug 6, 2005

I was thinking more along these lines:
http://www.ex-parrot.com/~pdw/Mail-RFC822-Address.html :v:

ohgodwhat
Aug 6, 2005

Am I just a bad programmer or is something like this bad:

code:
//Read the value of the analog input from a data acquisition device
output(i) = device_read(i);
I know it works but that, and the fact that inputs are outputs and outputs are inputs keeps throwing me off constantly. I won't say I'm good or anything but really?

ohgodwhat
Aug 6, 2005

Zakalwe posted:

output(i) returns a reference to the i'th element of an internal array I'd guess. If so I'd personally overload[] and use output[j] = device_read(j) myself; It's a stylistic choice.

Yep, that's what it does. It just looks wrong. This whole project is kind of a pain, I'm trying to write a plugin for an obscure OSS scientific computing program which has no documentation. I got it working after flailing about for a bit, but that was only the beginning!

ohgodwhat
Aug 6, 2005

Is that a programming competition or something? High schoolers trying to program produces some real horrors, like the team that had to print "One Two Three ... Nine Hundred And Ninety Nine" and decided a massive for-switch loop would be appropriate, for every single number. It took them all day and it still didn't pass. That year, as the only person actually programming on my team, we came in first place against other teams of three, beating second place by 50% on score. I suck at programming now and I sucked more then, too.

ohgodwhat
Aug 6, 2005

Mustach posted:

http://root.cern.ch/drupal/content/cint

I have no idea how good or bad it is.

I had to use it for a brief period of time. It was interesting...

ohgodwhat
Aug 6, 2005

Otto Skorzeny posted:

The getuid one took me a couple minutes to see

Is it because of the geteuid == 0?

I really know nothing about this kind of stuff...

ohgodwhat
Aug 6, 2005

Bozart posted:


I'm not quite sure you realize this yet, but Zombywuf of course knows more about the domain you're working in than you ever will. You should be thankful for his condescension.

ohgodwhat
Aug 6, 2005

GrumpyDoctor posted:

While I certainly share your concerns about the quality of the work, I'm curious to know if you've ever taught introductory programming, and if you have, what your experience was, because in my opinion, the particular way that some people just don't "get" it is, quite frankly, bizarre.

That's pretty much the case in any introductory course though, it isn't just programming, and it's still funny.

ohgodwhat
Aug 6, 2005

Zombywuf posted:

Well yes, profit is the most important thing in the world. Oh wait, that's only if you're a sociopath.

Who said anything about profit? A technically perfect game that is never released is nothing compared to an imperfect game that millions can enjoy. Certainly Minecraft can be improved, but for the work of one man, I'm not going to complain.

ohgodwhat
Aug 6, 2005

Hey, not really defending poo poo coding, just arguing that poo poo coding isn't always about profit. It sucks that your netbook can't play 3D games but neither can mine, suck it up.

ohgodwhat
Aug 6, 2005

Aleksei Vasiliev posted:

Notch is literally de-improving the game when he releases patches. He adds bugs that are bad enough to make the game Not Fun.

He can code fast, was inspired by a good idea, and has legions of autistic fans. That's all he has going for him.

What is it about Minecraft that makes you so angry? I don't think I've seen someone argue with such fervor against how a game is developed. Could we get back to Coding Horrors instead of For/Against Minecraft 'spergin?

ohgodwhat
Aug 6, 2005

http://sourcesale.com/projects/2357-Encryption-Static-Library

I haven't seen the source code for it, but the description is bad enough. This is supposed to be a form of encryption?

quote:

The library gets a password from an array and uses it to create a much bigger array. Then it gets a byte from the data to be encrypted and adds that with a value within the larger array. To use this for file encryption I recommend using the while loop and loop through the file sending data to the library one byte at a time until the file ends.

ohgodwhat
Aug 6, 2005

Well what else would you return!

ohgodwhat
Aug 6, 2005

Factor Mystic posted:

From reddit

Ok, javascript post. More laffeaux javascript nonsense?


Nope, just floating point. And this is pointed out:


But then,


Uhhh...

I feel like this has to be a subtle troll since 64.99*100 is equal to 6499 which is equal to 6498.9... arguments around which usually lead to huge amounts of drama anyway.

ohgodwhat
Aug 6, 2005

"Hey guys, I'm not very good at C, but you're doing it all wrong, could you change it to be more like what I learned about in my introductory programming class?"

These people :psyduck:

ohgodwhat
Aug 6, 2005

Carthag posted:

There's a proposed genealogy data exchange format being developed by FamilySearch, a mormon company, and (surprisingly?) it will support gay marriages :allears:

The old standard (Gedcom) has hardcoded HUSB/WIFE fields; GedcomX Couple relationship types will allow any two persons.

https://github.com/FamilySearch/gedcomx/blob/master/specifications/conceptual-model-specification.md

You'd think they'd generalize it to handle polygamy?

ohgodwhat
Aug 6, 2005

ymgve posted:

Personally, I'd use 4999-01-01 instead. So even if someone for some reason tries to add dates together, it still won't overflow.

But what if they try to add three or more of them together??? :v:

ohgodwhat
Aug 6, 2005

Munkeymon posted:

Lucky bastard. Have you used Parallels to run a Windows program on a Mac or tunneled an X session over ssh? It's like that but on a different machine you don't control and it's Enterprise Grade Software so you can be assured it's terrible (or was back when I had to use it).

Ah, but what about X tunneling over SSH to Windows, where you then have to copy and paste text into gedit if you wanted to transfer something to the server? Oh and then you need to transfer binary files this way because SCP and its ilk are a security risk?

ohgodwhat
Aug 6, 2005

ToxicFrog posted:

As in, you can ssh into the system, and X forwarding is enabled, but sftp is disabled? :psyduck:

On the plus side, you can still transfer stuff with tar cv <paths> | ssh user@host tar x -C <destination>

I was connecting from Windows, there was no tar, and I don't know if putty can be used like that.

Steve French posted:

Or maybe just rsync or scp

Yeah, if they were available. It's not like this isn't a solved problem as long as IT isn't paranoid.

ohgodwhat
Aug 6, 2005

What's city.population rescue 0? I don't know Ruby, but it sounds like a divide by zero waiting to happen.

ohgodwhat
Aug 6, 2005

Jewel posted:

Really?? How? Doesn't "A Very Big Number", no matter how big, even if indefinitely big, multiplied by 0 give 0? 0 multiplied by anything is zero, I don't see why that should be undefined?

What's 0/0? What's 0*1/0?

ohgodwhat
Aug 6, 2005

I have stared into the code of non technical interns, and the code has stared back into me.

Why have functions that can take parameters when you can just make a class called "input" which takes a bunch of user input from the console when it's initialized, and then derive classes from that which then implement functions that use the instance variables to figure out what to do? That's helpful.

ohgodwhat
Aug 6, 2005

I had to install Node.js at work today, because ipython for some reason needs it to turn its files into static html. It was either that or a documentation generator that required pywin32, because spitting out html files really needs specific parts of the Windows API.
I have to hope there's a better way, or at least some reason why this is necessary.

ohgodwhat
Aug 6, 2005

HardDisk posted:

Can't you hook up something like Jinja2?

Yeah, let me go rewrite ipython nbconvert, instead of just installing node.js.

ohgodwhat
Aug 6, 2005

SurgicalOntologist posted:

For me, it has a backup implementation it used when I didn't have node. But then I installed node so I don't remember what it was. The output looked the same though.

Yeah, pandoc I think, which wouldn't work without pywin32 either, and which for *reasons* I can't install. It just seems so asinine to me that ipython, which is otherwise a pretty decent project, would go about this bit in probably the most inconvenient way.

Adbot
ADBOT LOVES YOU

ohgodwhat
Aug 6, 2005

And no one ever found out about it!

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