Coding: Fleeting Thoughts

A place to discuss the implementation and style of computer programs.

Moderators: phlip, Moderators General, Prelates

User avatar
Steax
SecondTalon's Goon Squad
Posts: 3038
Joined: Sat Jan 12, 2008 12:18 pm UTC

Re: Coding: Fleeting Thoughts

Postby Steax » Wed May 04, 2011 3:30 pm UTC

Relying on autocomplete is perfectly fine. After a while you'll get the hang of it anyway. I wonder why some people persist on memorizing every single tool name and member function argument sequence before even starting to code. Yes you'll need them, but use them well and suddenly they'll start rolling off your fingers effortlessly.

Confession: I don't even know if it's alert() or Alert() in Javascript. console.log is much more reliable anyway.
In Minecraft, I use the username Rirez.

User avatar
Rippy
Posts: 2101
Joined: Sun Jul 22, 2007 11:27 pm UTC
Location: Ontario, Can o' Duh

Re: Coding: Fleeting Thoughts

Postby Rippy » Thu May 05, 2011 1:36 pm UTC

Do you think ghc would convert something like "x `xor` 0" to "x" when optimizing? It would allow me to write one function in terms of another and make things very marginally cleaner :P.

User avatar
headprogrammingczar
Posts: 3072
Joined: Mon Oct 22, 2007 5:28 pm UTC
Location: Beaming you up

Re: Coding: Fleeting Thoughts

Postby headprogrammingczar » Thu May 05, 2011 5:28 pm UTC

<quintopia> You're not crazy. you're the goddamn headprogrammingspock!
<Weeks> You're the goddamn headprogrammingspock!
<Cheese> I love you

User avatar
levicc00123
Posts: 165
Joined: Thu Jan 03, 2008 5:33 pm UTC
Location: Sterling, CO
Contact:

Re: Coding: Fleeting Thoughts

Postby levicc00123 » Fri May 06, 2011 6:35 pm UTC

I've been playing around with Windows Azure and I can't say I'm impressed.
Image

User avatar
Berengal
Superabacus Mystic of the First Rank
Posts: 2707
Joined: Thu May 24, 2007 5:51 am UTC
Location: Bergen, Norway
Contact:

Re: Coding: Fleeting Thoughts

Postby Berengal » Fri May 06, 2011 9:12 pm UTC

Rippy wrote:Do you think ghc would convert something like "x `xor` 0" to "x" when optimizing? It would allow me to write one function in terms of another and make things very marginally cleaner :P.

Doubtful, but the only way to be sure is to inspect the assembly. There are several things that could stop this optimization, e.g. the type being polymorphic (xor is a class member), x not being constant, the method not being inlined etc. Judicious application of rewrite rules (as Mr. Spock pointed out), inline pragmas and type signatures could solve all of these I think. The only way to be sure is to inspect the produced assembly.

That being said, if you don't have information saying that this would be too slow if not optimized this way (which you wording leads me to believe you don't), this is a typical case of premature optimization.
It is practically impossible to teach good programming to students who are motivated by money: As potential programmers they are mentally mutilated beyond hope of regeneration.

User avatar
Xeio
Friends, Faidites, Countrymen
Posts: 5101
Joined: Wed Jul 25, 2007 11:12 am UTC
Location: C:\Users\Xeio\
Contact:

Re: Coding: Fleeting Thoughts

Postby Xeio » Sat May 07, 2011 4:35 am UTC

Un-fun things: Tracking down a bug caused by obfuscation run on a release build for the installers.

This is literally impossible to replicate in a dev environment (oh, and I tried goddamnit, built 2 versions, the QA build, a build using the release flags, tested using 3 different database backups). I basically ended up working off an obfuscated stack trace just to figure out which line was causing it (with a rough date window to match changesets to). I didn't even realize this could happen until I brought it to the attention of a more senior developer (they committed the change that caused it, though the change itself was added in the designer file automatically by visual studio, so they didn't even know about it, and obviously it wouldn't have shown up till a production build anyway...) and they said that's probably what happened.

*stabs things*

User avatar
Dason
Posts: 1311
Joined: Wed Dec 02, 2009 7:06 am UTC
Location: ~/

Re: Coding: Fleeting Thoughts

Postby Dason » Sat May 07, 2011 5:58 pm UTC

Relearning html and css so that I can make my university provided website better than a white background with my name in black is probably the last thing I need to be doing about now. But for some reason I really want to.

Probably because there's been stuff I've wanted to provide online for a while but couldn't bear to just post it on an essentially blank page and tell people to go there.
double epsilon = -.0000001;

User avatar
phlip
Restorer of Worlds
Posts: 7572
Joined: Sat Sep 23, 2006 3:56 am UTC
Location: Australia
Contact:

Re: Coding: Fleeting Thoughts

Postby phlip » Sun May 08, 2011 11:28 am UTC

Guh... I was wondering why this checkout was taking forever to run... then I realised:
Spoiler:
phlip@boris:~/d2x-xl/dle-xp$ find . -name 'v*.*.*'
./tags/v1.8.5
./tags/v1.8.64
./tags/v1.8.64/tags/v1.8.5
./tags/v1.8.64/tags/v1.8.35
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.5
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.21
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.21/tags/v1.8.5
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.21/tags/v1.8.10
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.21/tags/v1.8.10/tags/v1.8.5
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.21/tags/v1.8.18
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.21/tags/v1.8.18/tags/v1.8.5
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.21/tags/v1.8.18/tags/v1.8.10
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.21/tags/v1.8.18/tags/v1.8.10/tags/v1.8.5
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.10
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.10/tags/v1.8.5
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.22
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.22/tags/v1.8.5
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.22/tags/v1.8.21
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.22/tags/v1.8.21/tags/v1.8.5
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.22/tags/v1.8.21/tags/v1.8.10
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.22/tags/v1.8.21/tags/v1.8.10/tags/v1.8.5
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.22/tags/v1.8.21/tags/v1.8.18
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.22/tags/v1.8.21/tags/v1.8.18/tags/v1.8.5
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.22/tags/v1.8.21/tags/v1.8.18/tags/v1.8.10
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.22/tags/v1.8.21/tags/v1.8.18/tags/v1.8.10/tags/v1.8.5
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.22/tags/v1.8.10
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.22/tags/v1.8.10/tags/v1.8.5
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.22/tags/v1.8.18
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.22/tags/v1.8.18/tags/v1.8.5
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.22/tags/v1.8.18/tags/v1.8.10
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.22/tags/v1.8.18/tags/v1.8.10/tags/v1.8.5
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.31
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.31/tags/v1.8.5
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.31/tags/v1.8.21
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.31/tags/v1.8.21/tags/v1.8.5
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.31/tags/v1.8.21/tags/v1.8.10
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.31/tags/v1.8.21/tags/v1.8.10/tags/v1.8.5
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.31/tags/v1.8.21/tags/v1.8.18
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.31/tags/v1.8.21/tags/v1.8.18/tags/v1.8.5
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.31/tags/v1.8.21/tags/v1.8.18/tags/v1.8.10
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.31/tags/v1.8.21/tags/v1.8.18/tags/v1.8.10/tags/v1.8.5
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.31/tags/v1.8.10
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.31/tags/v1.8.10/tags/v1.8.5
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.31/tags/v1.8.22
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.31/tags/v1.8.22/tags/v1.8.5
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.31/tags/v1.8.22/tags/v1.8.21
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.31/tags/v1.8.22/tags/v1.8.21/tags/v1.8.5
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.31/tags/v1.8.22/tags/v1.8.21/tags/v1.8.10
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.31/tags/v1.8.22/tags/v1.8.21/tags/v1.8.10/tags/v1.8.5
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.31/tags/v1.8.22/tags/v1.8.21/tags/v1.8.18
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.31/tags/v1.8.22/tags/v1.8.21/tags/v1.8.18/tags/v1.8.5
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.31/tags/v1.8.22/tags/v1.8.21/tags/v1.8.18/tags/v1.8.10
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.31/tags/v1.8.22/tags/v1.8.21/tags/v1.8.18/tags/v1.8.10/tags/v1.8.5
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.31/tags/v1.8.22/tags/v1.8.10
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.31/tags/v1.8.22/tags/v1.8.10/tags/v1.8.5
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.31/tags/v1.8.22/tags/v1.8.18
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.31/tags/v1.8.22/tags/v1.8.18/tags/v1.8.5
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.31/tags/v1.8.22/tags/v1.8.18/tags/v1.8.10
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.31/tags/v1.8.22/tags/v1.8.18/tags/v1.8.10/tags/v1.8.5
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.31/tags/v1.8.18
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.31/tags/v1.8.18/tags/v1.8.5
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.31/tags/v1.8.18/tags/v1.8.10
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.31/tags/v1.8.18/tags/v1.8.10/tags/v1.8.5
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.18
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.18/tags/v1.8.5
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.18/tags/v1.8.10
./tags/v1.8.64/tags/v1.8.35/tags/v1.8.18/tags/v1.8.10/tags/v1.8.5
./tags/v1.8.35
./tags/v1.8.35/tags/v1.8.5
./tags/v1.8.35/tags/v1.8.21
./tags/v1.8.35/tags/v1.8.21/tags/v1.8.5
./tags/v1.8.35/tags/v1.8.21/tags/v1.8.10
./tags/v1.8.35/tags/v1.8.21/tags/v1.8.10/tags/v1.8.5
./tags/v1.8.35/tags/v1.8.21/tags/v1.8.18
./tags/v1.8.35/tags/v1.8.21/tags/v1.8.18/tags/v1.8.5
./tags/v1.8.35/tags/v1.8.21/tags/v1.8.18/tags/v1.8.10
./tags/v1.8.35/tags/v1.8.21/tags/v1.8.18/tags/v1.8.10/tags/v1.8.5
./tags/v1.8.35/tags/v1.8.10
./tags/v1.8.35/tags/v1.8.10/tags/v1.8.5
./tags/v1.8.35/tags/v1.8.22
./tags/v1.8.35/tags/v1.8.22/tags/v1.8.5
./tags/v1.8.35/tags/v1.8.22/tags/v1.8.21
./tags/v1.8.35/tags/v1.8.22/tags/v1.8.21/tags/v1.8.5
./tags/v1.8.35/tags/v1.8.22/tags/v1.8.21/tags/v1.8.10
./tags/v1.8.35/tags/v1.8.22/tags/v1.8.21/tags/v1.8.10/tags/v1.8.5
./tags/v1.8.35/tags/v1.8.22/tags/v1.8.21/tags/v1.8.18
./tags/v1.8.35/tags/v1.8.22/tags/v1.8.21/tags/v1.8.18/tags/v1.8.5
./tags/v1.8.35/tags/v1.8.22/tags/v1.8.21/tags/v1.8.18/tags/v1.8.10
./tags/v1.8.35/tags/v1.8.22/tags/v1.8.21/tags/v1.8.18/tags/v1.8.10/tags/v1.8.5
./tags/v1.8.35/tags/v1.8.22/tags/v1.8.10
./tags/v1.8.35/tags/v1.8.22/tags/v1.8.10/tags/v1.8.5
./tags/v1.8.35/tags/v1.8.22/tags/v1.8.18
./tags/v1.8.35/tags/v1.8.22/tags/v1.8.18/tags/v1.8.5
./tags/v1.8.35/tags/v1.8.22/tags/v1.8.18/tags/v1.8.10
./tags/v1.8.35/tags/v1.8.22/tags/v1.8.18/tags/v1.8.10/tags/v1.8.5
./tags/v1.8.35/tags/v1.8.31
./tags/v1.8.35/tags/v1.8.31/tags/v1.8.5
./tags/v1.8.35/tags/v1.8.31/tags/v1.8.21
./tags/v1.8.35/tags/v1.8.31/tags/v1.8.21/tags/v1.8.5
./tags/v1.8.35/tags/v1.8.31/tags/v1.8.21/tags/v1.8.10
./tags/v1.8.35/tags/v1.8.31/tags/v1.8.21/tags/v1.8.10/tags/v1.8.5
./tags/v1.8.35/tags/v1.8.31/tags/v1.8.21/tags/v1.8.18
./tags/v1.8.35/tags/v1.8.31/tags/v1.8.21/tags/v1.8.18/tags/v1.8.5
./tags/v1.8.35/tags/v1.8.31/tags/v1.8.21/tags/v1.8.18/tags/v1.8.10
./tags/v1.8.35/tags/v1.8.31/tags/v1.8.21/tags/v1.8.18/tags/v1.8.10/tags/v1.8.5
./tags/v1.8.35/tags/v1.8.31/tags/v1.8.10
./tags/v1.8.35/tags/v1.8.31/tags/v1.8.10/tags/v1.8.5
./tags/v1.8.35/tags/v1.8.31/tags/v1.8.22
./tags/v1.8.35/tags/v1.8.31/tags/v1.8.22/tags/v1.8.5
./tags/v1.8.35/tags/v1.8.31/tags/v1.8.22/tags/v1.8.21
./tags/v1.8.35/tags/v1.8.31/tags/v1.8.22/tags/v1.8.21/tags/v1.8.5
./tags/v1.8.35/tags/v1.8.31/tags/v1.8.22/tags/v1.8.21/tags/v1.8.10
./tags/v1.8.35/tags/v1.8.31/tags/v1.8.22/tags/v1.8.21/tags/v1.8.10/tags/v1.8.5
./tags/v1.8.35/tags/v1.8.31/tags/v1.8.22/tags/v1.8.21/tags/v1.8.18
./tags/v1.8.35/tags/v1.8.31/tags/v1.8.22/tags/v1.8.21/tags/v1.8.18/tags/v1.8.5
./tags/v1.8.35/tags/v1.8.31/tags/v1.8.22/tags/v1.8.21/tags/v1.8.18/tags/v1.8.10
./tags/v1.8.35/tags/v1.8.31/tags/v1.8.22/tags/v1.8.21/tags/v1.8.18/tags/v1.8.10/tags/v1.8.5
./tags/v1.8.35/tags/v1.8.31/tags/v1.8.22/tags/v1.8.10
./tags/v1.8.35/tags/v1.8.31/tags/v1.8.22/tags/v1.8.10/tags/v1.8.5
./tags/v1.8.35/tags/v1.8.31/tags/v1.8.22/tags/v1.8.18
./tags/v1.8.35/tags/v1.8.31/tags/v1.8.22/tags/v1.8.18/tags/v1.8.5
... and it's still going. How do you let something like that happen?

[edit] OK, so this checkout folder is already 7GB, and growing. I think I'm doing it wrong.

Code: Select all

enum ಠ_ಠ {°□°╰=1, °Д°╰, ಠ益ಠ╰};
void ┻━┻︵​╰(ಠ_ಠ ⚠) {exit((int)⚠);}
[he/him/his]

Pepve
Posts: 57
Joined: Wed Jul 28, 2010 9:47 am UTC

Re: Coding: Fleeting Thoughts

Postby Pepve » Sun May 08, 2011 3:43 pm UTC

First of all, check out the trunk, not the project root:

Code: Select all

svn co http://server/svn/project/trunk
Instead of:

Code: Select all

svn co http://server/svn/project

And the same goes for tagging:

Code: Select all

svn copy http://server/svn/project/trunk http://server/svn/project/tags/v1.0
Instead of:

Code: Select all

svn copy http://server/svn/project http://server/svn/project/tags/v1.0

You could also clean up the repository (remove the nested branches and tags dirs, en move the nested trunk dir one level up), i think even without checking it out.

User avatar
phlip
Restorer of Worlds
Posts: 7572
Joined: Sat Sep 23, 2006 3:56 am UTC
Location: Australia
Contact:

Re: Coding: Fleeting Thoughts

Postby phlip » Sun May 08, 2011 11:32 pm UTC

Pepve wrote:First of all, check out the trunk, not the project root:

Code: Select all

svn co http://server/svn/project/trunk
Instead of:

Code: Select all

svn co http://server/svn/project

Yeah... it would be nice if it had one... Which is probably the cause of the 2n-ness, too... each time they tag a version, they're tagging the whole thing, including the already-existing tags dir, 'cause they don't have a separate trunk dir...

Oh well, I just gave up on it eventually. It's not an essential part of the main project I was trying to check out.

Code: Select all

enum ಠ_ಠ {°□°╰=1, °Д°╰, ಠ益ಠ╰};
void ┻━┻︵​╰(ಠ_ಠ ⚠) {exit((int)⚠);}
[he/him/his]

User avatar
MHD
Posts: 630
Joined: Fri Mar 20, 2009 8:21 pm UTC
Location: Denmark

Re: Coding: Fleeting Thoughts

Postby MHD » Mon May 09, 2011 12:14 am UTC

Ada's generics are interesting.
EvanED wrote:be aware that when most people say "regular expression" they really mean "something that is almost, but not quite, entirely unlike a regular expression"

User avatar
Steax
SecondTalon's Goon Squad
Posts: 3038
Joined: Sat Jan 12, 2008 12:18 pm UTC

Re: Coding: Fleeting Thoughts

Postby Steax » Mon May 09, 2011 1:26 pm UTC

FT: I wish newly graduated IT students didn't consider themselves programmers until they actually program. And I wish universities updated their curriculum, or at least give students well-informed choices.

No, 4 years of doing math in C++ does not mean you can write PHP for my web application project. No, it's not C++, even if it looks like it. No, you can't "learn as you go". No, I can't give you a week to learn it. No, GET OUT
In Minecraft, I use the username Rirez.

Pepve
Posts: 57
Joined: Wed Jul 28, 2010 9:47 am UTC

Re: Coding: Fleeting Thoughts

Postby Pepve » Mon May 09, 2011 9:31 pm UTC

phlip wrote:
Pepve wrote:First of all, check out the trunk, not the project root:

Code: Select all

svn co http://server/svn/project/trunk
Instead of:

Code: Select all

svn co http://server/svn/project

Yeah... it would be nice if it had one... Which is probably the cause of the 2n-ness, too... each time they tag a version, they're tagging the whole thing, including the already-existing tags dir, 'cause they don't have a separate trunk dir...

Oh well, I just gave up on it eventually. It's not an essential part of the main project I was trying to check out.

I sent some ninjas, but in the meantime:

Code: Select all

svn co --depth immediates http://d2x-xl.svn.sourceforge.net/svnroot/d2x-xl/dle-xp
find dle-xp/* -prune -type d -not -name tags -exec svn up --set-depth infinity {} \;

User avatar
Steax
SecondTalon's Goon Squad
Posts: 3038
Joined: Sat Jan 12, 2008 12:18 pm UTC

Re: Coding: Fleeting Thoughts

Postby Steax » Thu May 12, 2011 12:11 pm UTC

FT: I need sanity checks for stuff I sort of learned on my own. So.

Sanity check time. Question: Is it somehow remotely possible* for someone to change a session variable?

I.e.

Something.php

Code: Select all


session_start
();

$_SESSION['foo'] = 'bar';
 


Is it somehow possible for that person to change the contents of that variable?

Asking this because I:
- have never actually been taught about PHP
- grasped my knowledge on sessions based on other people's code
- am making the assumption that they're safe in a bunch of applications

*) I'm aware of stuff like session fixation, which I can mitigate by forcing cookie-based sessions and regenerating session IDs at certain points. I'm just seeing if it's somehow possible to change a specific variable. It might be common knowledge that I've never seen before, but in my stuff the difference between an admin and non-admin is usually just one $_SESSION['is_admin'] variable.
In Minecraft, I use the username Rirez.

User avatar
phlip
Restorer of Worlds
Posts: 7572
Joined: Sat Sep 23, 2006 3:56 am UTC
Location: Australia
Contact:

Re: Coding: Fleeting Thoughts

Postby phlip » Thu May 12, 2011 1:01 pm UTC

Assuming PHP, and your script, are secure and bug-free (which they probably aren't, in both cases, but work with me here)... then it's not possible to directly alter a session variable. All that stored at the client side is a magic ID (the session id, by default stored in the PHPSESSID cookie). Everything else is stored server-side... a mapping between that magic ID and the values. And when you change a session var, nothing changes client-side, just that mapping on the server. So since the client only has the session id, they can't see or edit what's in $_SESSION.

What they can do is change that magic ID. Now, most things they could change it to would be meaningless, since they aren't in that mapping... they'd behave like a new user who hadn't seen your site before (or, more accurately, one who hadn't been to your site in a while, so the session had been deleted serverside, but they still had their cookie). They'd be logged out, if you're using sessions for login/logout purposes. But if they knew a session ID that was real, but for someone else, by any means (eg at an unsecured wifi, say at an Internet cafe, listening in on other customers' Internets and pulling the session ID out of the requests) then they can use that themselves. This isn't changing the session values, though... it's more wholesale replacing them with someone else's values... hijacking someone else's session. There really isn't a way around this short of going HTTPS... anyone can imitate anyone else, if they have a full log of the communication.

Code: Select all

enum ಠ_ಠ {°□°╰=1, °Д°╰, ಠ益ಠ╰};
void ┻━┻︵​╰(ಠ_ಠ ⚠) {exit((int)⚠);}
[he/him/his]

User avatar
Steax
SecondTalon's Goon Squad
Posts: 3038
Joined: Sat Jan 12, 2008 12:18 pm UTC

Re: Coding: Fleeting Thoughts

Postby Steax » Thu May 12, 2011 1:10 pm UTC

Thank you. At least that keeps me relieved. I was just worried for a second that there might be some magic way to change a session variable, somehow. I suspected there wasn't, but this is the sort of thing I'd rather not take chances on.

What you're describing is session hijacking, no? I'm aware of that, so I'm defaulting https on for my application admins (or anyone else with significant power). I'm just worried a normal user can magically change their session variable somehow.
In Minecraft, I use the username Rirez.

User avatar
Quantum Potatoid
Posts: 141
Joined: Mon Aug 06, 2007 1:15 am UTC
Location: May only be known if velocity isn't. Same rules apply with taste and texture.

Re: Coding: Fleeting Thoughts

Postby Quantum Potatoid » Sat May 14, 2011 4:35 am UTC

So, out of curiosity, how do you guys pronounce GUI?
My professor pronounces it 'gooey', and my GTF just calls out the letters. I'm leaning towards the latter myself.

We're studying GUIs right now, so I've had my bit of fun making Java say silly, silly things in pop-up windows.
"There's nothing wrong with having voices in your head, it's when they leave you out of the conversation you have to worry"
Spoiler:
iThis Cheese is Burning Me!

User avatar
Sc4Freak
Posts: 673
Joined: Thu Jul 12, 2007 4:50 am UTC
Location: Redmond, Washington

Re: Coding: Fleeting Thoughts

Postby Sc4Freak » Sat May 14, 2011 4:50 am UTC

"gooey"

EvanED
Posts: 4331
Joined: Mon Aug 07, 2006 6:28 am UTC
Location: Madison, WI
Contact:

Re: Coding: Fleeting Thoughts

Postby EvanED » Sat May 14, 2011 5:14 am UTC

"Gooey" here, too.

In other news, I've been playing with BuildBot; with one possible fairly significant (for us) exception, that's a pretty damn slick piece of software. Me likes.

User avatar
Steax
SecondTalon's Goon Squad
Posts: 3038
Joined: Sat Jan 12, 2008 12:18 pm UTC

Re: Coding: Fleeting Thoughts

Postby Steax » Sat May 14, 2011 5:24 am UTC

"Gooey" here as well.

And it lets me say cool stuff like "I make gooey user interfaces".

(It's actually "I make gooey — UI". But that's what they hear.)

(And yes, yes, yes, I don't call them ATM Machines. I just like hearing the responses. You make WHAT?)
In Minecraft, I use the username Rirez.

User avatar
e^iπ+1=0
Much, much better than Gooder
Posts: 2065
Joined: Sun Feb 15, 2009 9:41 am UTC
Location: Lancaster

Re: Coding: Fleeting Thoughts

Postby e^iπ+1=0 » Sat May 14, 2011 6:52 am UTC

Never said it out loud, but I have been pronouncing it in my head as G-U-I. Then again, I often pronounce things wrong that I've only read. For instance, I thought archive was pronounced with the ch being the same as in cheese.
poxic wrote:You, sir, have heroic hair.
poxic wrote:I note that the hair is not slowing down. It appears to have progressed from heroic to rocking.

(Avatar by Sungura)

User avatar
Steax
SecondTalon's Goon Squad
Posts: 3038
Joined: Sat Jan 12, 2008 12:18 pm UTC

Re: Coding: Fleeting Thoughts

Postby Steax » Sat May 14, 2011 7:53 am UTC

I used to call that "ar-cheeve". Like "achieve" with an r at the front.

Overall a whole lot of programming terms are impossible to effectively pronounce, so I usually take whatever sounds easy to understand.
In Minecraft, I use the username Rirez.

User avatar
phlip
Restorer of Worlds
Posts: 7572
Joined: Sat Sep 23, 2006 3:56 am UTC
Location: Australia
Contact:

Re: Coding: Fleeting Thoughts

Postby phlip » Sat May 14, 2011 8:13 am UTC

There's a thread in Religious Wars for that sort of thing... I don't think "GUI" has come up there yet, though...

Code: Select all

enum ಠ_ಠ {°□°╰=1, °Д°╰, ಠ益ಠ╰};
void ┻━┻︵​╰(ಠ_ಠ ⚠) {exit((int)⚠);}
[he/him/his]

User avatar
Steax
SecondTalon's Goon Squad
Posts: 3038
Joined: Sat Jan 12, 2008 12:18 pm UTC

Re: Coding: Fleeting Thoughts

Postby Steax » Sat May 14, 2011 8:49 am UTC

We programmers are a bunch of stressed individuals.

Code: Select all

if($you->give($aMouse, $aCookie))
{
    $he->going_to('ask');
    foreach($aGlass as $Milk){
        // stuff
    }
}


Actual code from my client's old backend which I'm supposed to work with. This is going to be interesting.

Technically...
$you is the server instance. $you->give attempts to set a configuration variable, here held by the variable $aMouse, setting it to a random unique ID, contained in $aCookie. If it succeeds, the user is told to expect a confirmation before proceeding (set by the 'ask' string), at which point it starts modifying a bunch of other configuration objects.
In Minecraft, I use the username Rirez.

User avatar
e^iπ+1=0
Much, much better than Gooder
Posts: 2065
Joined: Sun Feb 15, 2009 9:41 am UTC
Location: Lancaster

Re: Coding: Fleeting Thoughts

Postby e^iπ+1=0 » Sat May 14, 2011 9:22 am UTC

Steax wrote:I used to call that "ar-cheeve". Like "achieve" with an r at the front.

Right, that's what I meant. I was going to do the IPA, but then couldn't be arsed looking through WP:IPA. And apparently my plain language transcription wasn't complete enough.
poxic wrote:You, sir, have heroic hair.
poxic wrote:I note that the hair is not slowing down. It appears to have progressed from heroic to rocking.

(Avatar by Sungura)

User avatar
levicc00123
Posts: 165
Joined: Thu Jan 03, 2008 5:33 pm UTC
Location: Sterling, CO
Contact:

Re: Coding: Fleeting Thoughts

Postby levicc00123 » Sun May 15, 2011 2:39 am UTC

Quick question, does anyone know of a good tutorial for google app engine? I'm specifically walks you through configuring django and setting up a project. I've found one [urhttp://thomas.broxrost.com/2008/04/08/django-on-google-app-engine/]here[/url], but it's about three years old.
Image

User avatar
Steax
SecondTalon's Goon Squad
Posts: 3038
Joined: Sat Jan 12, 2008 12:18 pm UTC

Re: Coding: Fleeting Thoughts

Postby Steax » Sun May 15, 2011 9:57 am UTC

Is there something fundamentally wrong with using long random strings as salts for one-way hash algorithms? I'd imagine they give a lot of defense against rainbow table attacks, but do they actually cause some other cryptographic weakness?

/at the stage of picking salts, and tempted to use 64-character random strings

Also, what are your favorite hashing algorithms, for security?

I'm looking at whirlpool for now. Hmm.
In Minecraft, I use the username Rirez.

User avatar
headprogrammingczar
Posts: 3072
Joined: Mon Oct 22, 2007 5:28 pm UTC
Location: Beaming you up

Re: Coding: Fleeting Thoughts

Postby headprogrammingczar » Sun May 15, 2011 12:03 pm UTC

I don't see what cryptographic weaknesses can be caused by large salts. You don't lose bits of entropy because the original data you wanted to hash is still intact, just concatenated with the salt. I personally use SHA1 because it is cryptographically "good enough" and every language has libraries for it.
<quintopia> You're not crazy. you're the goddamn headprogrammingspock!
<Weeks> You're the goddamn headprogrammingspock!
<Cheese> I love you

User avatar
TheChewanater
Posts: 1279
Joined: Sat Aug 08, 2009 5:24 am UTC
Location: lol why am I still wearing a Santa suit?

Re: Coding: Fleeting Thoughts

Postby TheChewanater » Mon May 16, 2011 1:00 am UTC

FT: *facepalm*

Code: Select all

printf ("%d", sizeof (Header) + header->num_vertices << '\n'); 
ImageImage
http://internetometer.com/give/4279
No one can agree how to count how many types of people there are. You could ask two people and get 10 different answers.

User avatar
phlip
Restorer of Worlds
Posts: 7572
Joined: Sat Sep 23, 2006 3:56 am UTC
Location: Australia
Contact:

Re: Coding: Fleeting Thoughts

Postby phlip » Mon May 16, 2011 1:40 am UTC

... wow.

Code: Select all

enum ಠ_ಠ {°□°╰=1, °Д°╰, ಠ益ಠ╰};
void ┻━┻︵​╰(ಠ_ಠ ⚠) {exit((int)⚠);}
[he/him/his]

User avatar
TheChewanater
Posts: 1279
Joined: Sat Aug 08, 2009 5:24 am UTC
Location: lol why am I still wearing a Santa suit?

Re: Coding: Fleeting Thoughts

Postby TheChewanater » Mon May 16, 2011 2:59 am UTC

...yeah.

I'm used to using ostreams. I suppose I forgot that I was using C-style output while I was in the middle of typing that line.
Last edited by TheChewanater on Mon May 16, 2011 3:01 am UTC, edited 1 time in total.
ImageImage
http://internetometer.com/give/4279
No one can agree how to count how many types of people there are. You could ask two people and get 10 different answers.

User avatar
Xeio
Friends, Faidites, Countrymen
Posts: 5101
Joined: Wed Jul 25, 2007 11:12 am UTC
Location: C:\Users\Xeio\
Contact:

Re: Coding: Fleeting Thoughts

Postby Xeio » Mon May 16, 2011 2:59 am UTC

Wait.... what?

User avatar
Robert'); DROP TABLE *;
Posts: 730
Joined: Mon Sep 08, 2008 6:46 pm UTC
Location: in ur fieldz

Re: Coding: Fleeting Thoughts

Postby Robert'); DROP TABLE *; » Mon May 16, 2011 5:41 pm UTC

Did you catch that before it produced confusing messages?
...And that is how we know the Earth to be banana-shaped.

mcvoid
Posts: 24
Joined: Tue Jan 18, 2011 1:35 pm UTC

Re: Coding: Fleeting Thoughts

Postby mcvoid » Mon May 16, 2011 6:18 pm UTC

I like that it came out to be perfectly legal. I also like seeing that I might not have the shortest attention span around.

User avatar
TheChewanater
Posts: 1279
Joined: Sat Aug 08, 2009 5:24 am UTC
Location: lol why am I still wearing a Santa suit?

Re: Coding: Fleeting Thoughts

Postby TheChewanater » Mon May 16, 2011 6:35 pm UTC

Robert'); DROP TABLE *; wrote:Did you catch that before it produced confusing messages?

No, I didn't catch it until I was about to rewrite the entire function, because the files it was producing were way smaller than it said they "should" be.
ImageImage
http://internetometer.com/give/4279
No one can agree how to count how many types of people there are. You could ask two people and get 10 different answers.

Posi
Posts: 111
Joined: Mon Jul 16, 2007 6:08 am UTC

Re: Coding: Fleeting Thoughts

Postby Posi » Wed May 18, 2011 6:09 am UTC

I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate Perl.

As you may have guessed, I just inherited a codebase in Perl. Needless to say the old developer wasn't very kind to me. The code was 'self documenting' (read no comments) and he liked to abuse 'more than one way to do it'. For the most part he had good variable and function names, but it did take me a while to figure out things like how foo_id was different than foo_id_num. Most of this isn't Perl's fault, but I do believe if he had used something else I would have something more readable in my hands.

However one thing is Perl's fault: sometimes my arrays get nested in an array and I have no clue why. I was getting all these silly errors, then I decided to poke around with the debugger. Assuming code like this:

Code: Select all

sub A
{
    my $foo = 1;
    my $bar = 2;
    return ($foo, $bar);
}

sub B
{
    my $oof = 3;
    my $rab = 4;
    return ($oof, $rab);
}

my @a = A();
my @b = B();


My debugger would report....

Code: Select all

x \@a
ARRAY
    ARRAY
        1
        2

x \@b
ARRAY
    3
    4


WHY AREN'T THESE THE SAME!!!!!!!!!!!!!!!!!!
I know this isn't as useful as real code, but I can't go around posting that now can I?

User avatar
phlip
Restorer of Worlds
Posts: 7572
Joined: Sat Sep 23, 2006 3:56 am UTC
Location: Australia
Contact:

Re: Coding: Fleeting Thoughts

Postby phlip » Wed May 18, 2011 7:35 am UTC

Posi wrote:I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate perl. I hate Perl.

All perl and no play makes Posi a dull boy.

Also: your code snippet works as expected for me... no nested arrays of any sort. Something weird is probably going on with your environment.

Code: Select all

enum ಠ_ಠ {°□°╰=1, °Д°╰, ಠ益ಠ╰};
void ┻━┻︵​╰(ಠ_ಠ ⚠) {exit((int)⚠);}
[he/him/his]

elminster
Posts: 1560
Joined: Mon Feb 26, 2007 1:56 pm UTC
Location: London, UK, Dimensions 1 to 42.
Contact:

Re: Coding: Fleeting Thoughts

Postby elminster » Wed May 18, 2011 7:48 pm UTC

This is probably a stupid question, but when you do (purely for example):

Code: Select all

template<int N>
void funct()
{
   for(int i = 10; i != 0; --i)
   {
      switch(N)
      {
      case 1:
         //stuff
         break;
      case 2:
         //stuff
         break;
      }
   }
}
Would the compiler (via optimisation) completely remove calls to it if N wasn't 1 or 2?; and if it were 1 or 2, does it remove the switch case, since it can determine result at compile time?
Image

User avatar
You, sir, name?
Posts: 6983
Joined: Sun Apr 22, 2007 10:07 am UTC
Location: Chako Paul City
Contact:

Re: Coding: Fleeting Thoughts

Postby You, sir, name? » Wed May 18, 2011 7:54 pm UTC

elminster wrote:This is probably a stupid question, but when you do (purely for example):

Code: Select all

template<int N>
void funct()
{
   for(int i = 10; i != 0; --i)
   {
      switch(N)
      {
      case 1:
         //stuff
         break;
      case 2:
         //stuff
         break;
      }
   }
}
Would the compiler (via optimisation) completely remove calls to it if N wasn't 1 or 2?; and if it were 1 or 2, does it remove the switch case, since it can determine result at compile time?


Compile and examine generated the code?
I edit my posts a lot and sometimes the words wrong order words appear in sentences get messed up.

User avatar
TNorthover
Posts: 191
Joined: Wed May 06, 2009 7:11 am UTC
Location: Cambridge, UK

Re: Coding: Fleeting Thoughts

Postby TNorthover » Wed May 18, 2011 8:11 pm UTC

elminster wrote:Would the compiler (via optimisation) completely remove calls to it if N wasn't 1 or 2?; and if it were 1 or 2, does it remove the switch case, since it can determine result at compile time?

It obviously depends entirely on the compiler. I think the key step would be deciding to inline the function; after that dead code elimination (with some other steps) should be able to reduce it to nothing.

Certainly any reasonable compiler should be able to reduce it at least to a call to funct which has just the necessary code in it. Once the template is instantiated, it's a fairly simple function to optimize. Some fiddling suggests gcc (4.5) does optimize the call away if funct ends up empty too.


Return to “Coding”

Who is online

Users browsing this forum: No registered users and 6 guests