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
Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Superschaf posted:

This is a really important part. Writing out the What and (more importantly) the Why, forces you to sanity-check your own changes. That helped me a lot to improve as a programmer.
Also as I write out the Why I often notice "Oh poo poo this isn't really as obvious as I thought" and add some more comments.

And sometimes while trying to explain Why I realize that the change I just made is completely loving retarded and I should be doing something different.

Lurchington posted:

I find it surprising that JavaScript has a syntax error for 'butts' ++ 'dongs', and has a coercion in 'butts' + + 'dongs'
I found it especially surprising that this was the root cause of this weird extra text in my rendered web page

Perhaps everyone else in the world is an expert at this js eccentricity, but I personally would have expected a syntax error for both of those things.

i ++ and i + + being parsed differently is true in a very large number of languages.

Adbot
ADBOT LOVES YOU

Opinion Haver
Apr 9, 2007

Lurchington posted:

I find it surprising that JavaScript has a syntax error for 'butts' ++ 'dongs', and has a coercion in 'butts' + + 'dongs'
I found it especially surprising that this was the root cause of this weird extra text in my rendered web page

Perhaps everyone else in the world is an expert at this js eccentricity, but I personally would have expected a syntax error for both of those things.

C gives you an error for 2 ++ 3 (in this case, saying you can't increment a non-lvalue) and succeeds on 2 + + 3.

Crosscontaminant
Jan 18, 2007

The point being made is that the way basically every other language parses "2" + + "3" is as "2" + (+"3") whereupon it does the right thing (most likely complain that unary + can't take a string) whereas JavaScript apparently parses it as "2" + (null + "3") - null + "3" equals null, then "2" + null coerces null into a string and appends it to "2". It's the PHP "given the choice between failing and doing something nonsensical, do something nonsensical" mentality.

Sedro
Dec 31, 2008

Crosscontaminant posted:

The point being made is that the way basically every other language parses "2" + + "3" is as "2" + (+"3") whereupon it does the right thing (most likely complain that unary + can't take a string) whereas JavaScript apparently parses it as "2" + (null + "3") - null + "3" equals null, then "2" + null coerces null into a string and appends it to "2". It's the PHP "given the choice between failing and doing something nonsensical, do something nonsensical" mentality.
I'm no JavaScript expert but I think it's parsed the same as other C-style languages. The difference is that all numeric operators also implicitly convert from string, resulting in NaN when the number fails to parse. And NaN is toxic ie. X op NaN = NaN for any numeric op
code:
'2' + (+ '3') =
'2' + 3 =
'23'

2 + (+ '3') =
2 + 3 =
5

3 + (+ 'butts') =
3 + NaN =
NaN

'farts' + (+ 'butts') =
'farts' + NaN =
fartsNaN

Sedro fucked around with this message at 01:37 on Sep 10, 2013

Opinion Haver
Apr 9, 2007

Crosscontaminant posted:

The point being made is that the way basically every other language parses "2" + + "3" is as "2" + (+"3") whereupon it does the right thing (most likely complain that unary + can't take a string) whereas JavaScript apparently parses it as "2" + (null + "3") - null + "3" equals null, then "2" + null coerces null into a string and appends it to "2". It's the PHP "given the choice between failing and doing something nonsensical, do something nonsensical" mentality.

What? No, nothing in this post is correct.

code:
> "a" ++ "b"
SyntaxError: Unexpected string
> "a" + (+ "b")
"aNaN"
> "a" + (null + "b")
"anullb"

MrMoo
Sep 14, 2000

Strong Sauce posted:

Please do not just clump all your changes into one commit.

I find this occasionally a problem. If one is working on a large new functional addition which has major collateral damage I prefer simply hitting the big commit rather than reversing the entire patch set and pushing smaller incremental patches.

etcetera08
Sep 11, 2008

Started a new job today, did `git log` on my project. Last commit message was 'f this g earth.'

Sort of mundane but lol way to start.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
Regarding the Pilsner dogpile, if they're doing this as responded to me:

Ithaqua posted:

TFS doesn't lock anything except binary files by default, although it's configurable and anyone who configures "full lock on checkout" is wrong and horrible.

The best way to have easily traceable changesets in TFS is to leverage work items properly -- if you have PBIs/user story work items with a bunch of child tasks, it's easy to enforce "Each checkin must be tied to a work item", and then you just tie each changeset to a task when you perform your checkin. Then you can look at that PBI and see all of the changesets done for each of the tasks.

Of course, you can still see the entire change history for any particular file or folder in TFS, regardless of whether it's tied to a work item or not.

...and the work items are small chunks, then their changes are indeed small. Actually to some extent they can have annoyingly terse commit messages then too. It would come down to maybe an honorable mention of the work item/story, and the justification for the nature of the solution used to close it.

I had to stop my own biases because I haven't really worked in a place that has adopted the whole TFS flow. At best I've seen it used for source control, and even that was a bit rough. After a bunch of smashing around I was able to see the changeset kind of thing that TFS does. I've found it much quicker and easier to thumb through changes in git though, even in Visual Studio with Git Extensions, but that is probably mostly because the repository is a local clone. When I was looking at TFS changes, I'd have to sit on my rear end every time I wanted to look at a new one.

kitten smoothie
Dec 29, 2001

HFX posted:

I use little commits and lots of topic branches for the following reasons:

  • It makes bisections easier.



I forgot about this. If you just make one big rear end commit at the end of the day labeled "new feature lol" that touches a dozen files, then god help you when you need to find the one line that hosed up something completely unrelated.

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde
It's not so easy to make a case for small commits late Sunday night after a week that had very little coding due to planning overhead. But I'll give my experience today as an example.

I have a task to develop a wrapper around some computations running in AWS. So I start with an abstract interface and commit that into my local repository. Then I need to make the project build in all of its dependencies for testing, so that's another change I make and commit. Then an implementation class. Make a stub and stage it for commit. Add a big AWS call. The service call works, so I stage it again. Oh snap, AWS doesn't provide something I thought it would! So my interface design needs reworking. Commit the implementation, check out the interface change and fix it, then rebase the other changes on top of it. Now the whole commit history reflects a correct understanding of AWS functionality from the start. Fill in some methods to monitor the service call, test them and stage them. Look it over, make scattered improvements, test and stage those. The kick-off and monitoring methods are pretty interdependent so I commit the monitoring methods and then combine those two commits into one. Some of the methods are too long, so I break them up and make that a separate commit. Time to go home.

Working this way I can keep up a steady pace even in the presence of risk factors. Working the old way, with centralized VC and all-inclusive commits, I'd probably bog down around the time I noticed the feature missing from AWS because instead of just running some commands to go back in time, I'd have to start up the diff tool and do it all in my head.

Gazpacho fucked around with this message at 10:27 on Sep 10, 2013

QuarkJets
Sep 8, 2008

Innocent Bystander posted:

MATLAB is the siren song of the scientific community.

No; any language that can't even do basic arithmetic with 64-bit integers is not a real scientific language. gently caress MATLAB. People need to stop using this piece of garbage. MATLAB is the PHP of science and engineering; it just barely works once you figure out several dozen workarounds to make it do what you want it to do

QuarkJets fucked around with this message at 12:20 on Sep 10, 2013

evensevenone
May 12, 2001
Glass is a solid.

QuarkJets posted:

No; any language that can't even do basic arithmetic with 64-bit integers is not a real scientific language. gently caress MATLAB. People need to stop using this piece of garbage. MATLAB is the PHP of science and engineering; it just barely works once you figure out several dozen workarounds to make it do what you want it to do

The Sirens were mythological creatures that appeared as beautiful young women living on an island and who with their irresistible singing lured passing sailors to their deaths on the rocky cliffs surrounding them. So the idiom "siren song" describes MATLAB pretty well.

quiggy
Aug 7, 2010

[in Russian] Oof.


QuarkJets posted:

No; any language that can't even do basic arithmetic with 64-bit integers is not a real scientific language. gently caress MATLAB. People need to stop using this piece of garbage. MATLAB is the PHP of science and engineering; it just barely works once you figure out several dozen workarounds to make it do what you want it to do

Unfortunately I don't know of any better alternatives except maybe R. I'd be more than happy to learn about others, though.

fritz
Jul 26, 2003

quiggy posted:

Unfortunately I don't know of any better alternatives except maybe R. I'd be more than happy to learn about others, though.

It depends on what you want to do, but numpy/scipy is pretty good, except it gets in your way a little more than matlab does.

QuarkJets posted:

No; any language that can't even do basic arithmetic with 64-bit integers is not a real scientific language.

matlab's for floating point calculations.

TheresaJayne
Jul 1, 2011
Before I ever saw SVN and CVS I had only ever used Microsoft Source(un)safe

So when I started on Java/C projects at home i used UC2 compressor as it had functions like


UC2 E !DTT=YYYY-MM-DD/HH:MM:SS Dynamic Time Travel (extract archive as it was at that date)

Yes a Zip file utility had built in Version Control.....

QuarkJets
Sep 8, 2008

quiggy posted:

Unfortunately I don't know of any better alternatives except maybe R. I'd be more than happy to learn about others, though.

Python, R, Octave, and a dozen others. Python combines the interactivity of MATLAB with the power of a real programming language and is generally a pleasure to use. R is pretty great, too. Most importantly, both accomplish the same tasks in less time and with less code written. Octave is basically MATLAB lite and isn't that good

MATLAB needs to die, I don't know what the gently caress Mathworks does with all of their licensing money but it's definitely not "release good math/science software"

quiggy
Aug 7, 2010

[in Russian] Oof.


Ha ha ha ha Python as a Matlab replacement ha ha ha ha

I like Python but it does not do what Matlab does.

Strong Sauce
Jul 2, 2003

You know I am not really your father.





Look at Julia http://julialang.org

quiggy
Aug 7, 2010

[in Russian] Oof.



Now this is what I'm talking about. Gonna spend all night playing with this :allears:

fritz
Jul 26, 2003

quiggy posted:

Ha ha ha ha Python as a Matlab replacement ha ha ha ha

I like Python but it does not do what Matlab does.

OK, fine, 'octave replacement.'

QuarkJets
Sep 8, 2008

quiggy posted:

Ha ha ha ha Python as a Matlab replacement ha ha ha ha

I like Python but it does not do what Matlab does.

You're right, Python does it much better

quiggy
Aug 7, 2010

[in Russian] Oof.


QuarkJets posted:

You're right, Python does it much better

Yeah Python really is the industry leader as a matrix computation language who's with me.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

quiggy posted:

Yeah Python really is the industry leader as a matrix computation language who's with me.

I barely know what matrix computation is, but being an industry leader is a different argument from Python being better or worse than MATLAB at doing it.

quiggy
Aug 7, 2010

[in Russian] Oof.


Thermopyle posted:

I barely know what matrix computation is, but being an industry leader is a different argument from Python being better or worse than MATLAB at doing it.

Fair enough. Python has no native support for matrices and is thus a laughable replacement for Matlab, poo poo though Matlab may be. Is that better?

Meat Beat Agent
Aug 5, 2007

felonious assault with a sproinging boner
Come on man, setting up numpy takes about two seconds.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

quiggy posted:

Fair enough. Python has no native support for matrices and is thus a laughable replacement for Matlab, poo poo though Matlab may be. Is that better?

Better in one way, and worse in another.

Assuming scipy/numpy don't suck in comparison to Matlab, what difference does it make if it's native support?

quiggy
Aug 7, 2010

[in Russian] Oof.


I didn't know about scipy/numpy :blush:

I'll check them out.

fritz
Jul 26, 2003

daft punk railroad posted:

Come on man, setting up numpy takes about two seconds.

Oh jeez I wish.

Arcsech
Aug 5, 2008

fritz posted:

Oh jeez I wish.

If you're on Linux, it's sudo apt-get install python-numpy (or similar with whatever package manager), and if you're on Windows there's a GUI installer. They might take a while to run but it's basically no effort.

QuarkJets
Sep 8, 2008

quiggy posted:

I didn't know about scipy/numpy :blush:

I'll check them out.

They're based on the same Fortran libraries as MATLAB, so it's remarkable how easy it is to switch from one system to the other. Python is row major whereas MATLAB is column major, but fundamentally they have the same capabilities. Python has advantages in that it's a well-designed language first and a scientific tool second.

MATLAB is still great if you're just prototyping something small and already have a license and already know how to use it, but it's a dinosaur.

BigRedDot
Mar 6, 2008

http://wiki.scipy.org/NumPy_for_Matlab_Users

IT BEGINS
Jan 15, 2009

I don't know how to make analogies
Just one more piece that I have the work with. Showcases everything that is wrong with my coworkers. :wtc:

php:
<?

    function checkPgStatus($db, $r, $msg) {
        global $DEBUG;

        if ($r) return 1;

        if (ini_get("display_errors")) echo "<br><B><I><font color=red>\n";
        if (strstr($msg, "NOERRORS:")) return 0;

        if (strstr($msg, "DONTEXIT:")) {
            if (ini_get("display_errors")) {
                echo str_replace("DONTEXIT:", "", $msg);
                //echo "</B></I><br></font>\n";
                echo(pg_ErrorMessage($db));
            }
            return 0;
        }

        if (1 || ini_get("display_errors")) {
            print_backtrace(debug_backtrace());
            echo "<br>$msg";
            echo(pg_ErrorMessage($db));
        }

        $footer=getenv("FT_FOOTER");
        if (strlen(@$footer)) include $footer;
        echo "SQL error occured, exitting.\n";
        exit(1);
    }
?>

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

Vasja posted:

Just one more piece that I have the work with. Showcases everything that is wrong with my coworkers. :wtc:

php:
<?

    function checkPgStatus($db, $r, $msg) {
        global $DEBUG;

        if ($r) return 1;

        if (ini_get("display_errors")) echo "<br><B><I><font color=red>\n";
        if (strstr($msg, "NOERRORS:")) return 0;

        if (strstr($msg, "DONTEXIT:")) {
            if (ini_get("display_errors")) {
                echo str_replace("DONTEXIT:", "", $msg);
                //echo "</B></I><br></font>\n";
                echo(pg_ErrorMessage($db));
            }
            return 0;
        }

        if (1 || ini_get("display_errors")) {
            print_backtrace(debug_backtrace());
            echo "<br>$msg";
            echo(pg_ErrorMessage($db));
        }

        $footer=getenv("FT_FOOTER");
        if (strlen(@$footer)) include $footer;
        echo "SQL error occured, exitting.\n";
        exit(1);
    }
?>

In my head I just kept screaming "NO NO NO NO NO NO NO"

bucketmouse
Aug 16, 2004

we con-trol the ho-ri-zon-tal
we con-trol the verrr-ti-cal

:aaa:

I wish I'd known about this last year. It is not fun to do analysis on the netflix prize dataset in python.

poopgiggle
Feb 7, 2006

it isn't easy being a cross dominate shooter.


quiggy posted:

Fair enough. Python has no native support for matrices and is thus a laughable replacement for Matlab, poo poo though Matlab may be. Is that better?

numpy/scipy binds to the same hyper-optimized Fortran libraries that everyone else uses for scientific computing

I work with a lot of people who want to write code but are not computer scientists (primarily mechanical engineers) and I would much rather handhold them through Python than MATLAB.

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug
I'd never make it in sales. :(

Microsoft sales guy: I need you to do a demonstration on how Foo integrates with Bar
Me: Foo doesn't integrate with bar at all right now.
MSG: But they need it to.
Me: But it doesn't.
MSG: But it's a critical business requirement!
Me: Then maybe Foo isn't the correct tool for them to be using.

QuarkJets
Sep 8, 2008


This looks interesting and easy to use. And those benchmarks are outstanding. How's the library support? If I need to use a bunch of one-liner Python/MATLAB functions, will Julia code be similar or will I probably have to roll my own for a lot of the less common features?

e: I answered my own question by discovering that Julia can call Python and has a lot of cross-compatibility, so anything that Python has Julia also has.
http://conference.scipy.org/scipy2013/presentation_detail.php?id=203
Julia with Python libraries for whatever Julia might not have yet sounds like an interesting combination, especially for those of us who must use some looping (such as when your data array would normally exceed your memory capacity)

QuarkJets fucked around with this message at 21:19 on Sep 12, 2013

Bonfire Lit
Jul 9, 2008

If you're one of the sinners who caused this please unfriend me now.

Ithaqua posted:

I'd never make it in sales. :(

Microsoft sales guy: I need you to do a demonstration on how Foo integrates with Bar
Me: Foo doesn't integrate with bar at all right now.
MSG: But they need it to.
Me: But it doesn't.
MSG: But it's a critical business requirement!
Me: Then maybe Foo isn't the correct tool for them to be using.
Clearly the problem here is that you aren't a team player.

Dren
Jan 5, 2001

Pillbug
I'd like the yum developers to feel really bad about themselves for this (though the one guy died recently, right?):
Python code:
yb = yum.YumBase()
yb.doConfigSetup()
if not yb.setCacheDir():
    exit(1)
yb.pkgSack     # bollocks
pkgSack is not a normal member, it is a property and the first time you call it a ton of behind the scenes stuff gets initialized. If you don't call it like this, pretty much anything you try to do thereafter will explode. But it certainly doesn't look that way based on that rather innocuous line that doesn't even look like a function call.

Yum is an undocumented horror to begin with so I guess this is sort of a cheap shot but hell, this behavior really bothers me.

Adbot
ADBOT LOVES YOU

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

Dren posted:

Python code:
yb.pkgSack     # bollocks

According to the comment, this is a ballsack?

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