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
Slanderer
May 6, 2007

Edison was a dick posted:

Another data point here. I started with NetBeans and eclipse then transitioned to the command line for everything but web browsing.
I'll claim that it's because all the tools I need have command line versions and I can more easily automate something as a shell script, but I probably started using vim for nerd cred.

I suspect that Eclipse has scared so many people away from IDEs. It was poo poo when I first was introduced to it in high school, and it's poo poo now.

Adbot
ADBOT LOVES YOU

pseudorandom name
May 6, 2007

JawnV6 posted:

My current IDE literally does not have options to move around in the code like vim provides by default. It's not a matter of I can't get used to it, it's that the IDE offers no support for the thing I wanted to do and I have to go without.

As a trivial example, in vim * will search for the current word in the same file. Shift-F12 does something similar and comes up with every instance of that variable across the project, a half step up even. But vim also has %, which finds the matching brace for the one under the cursor, and VS simply doesn't have an equivalent.

Ctrl+]

COUNTIN THE BILLIES
Jan 8, 2006

by Ion Helmet
Vim's great and worth learning IMO.

Workaday Wizard
Oct 23, 2009

by Pragmatica
Oh hey editor char!

I tried learning Vim for nerd cred but couldn't find anything that it can do that those ""inefficient"" mouse driven editor couldn't do better.

Also: Windows style navigation and selection (Arrow keys+Modifiers+Home+End+PgUp+PgDn) > Your bespoke navigation system every single time (same for Emacs and whatever else is there).


It's OK to love vim just don't claim it's superior.

hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av
SciTE for life. vim is for quickie commit messages

Thermopyle
Jul 1, 2003

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

Here's something really weird. I like vim and I like the IDE I'm using most nowadays (PyCharm). I'm a loving maniac.

astr0man
Feb 21, 2007

hollyeo deuroga
I made a vim thread so I guess you guys can continue this derail in there or something!

edit: http://forums.somethingawful.com/showthread.php?threadid=3552945

Zhentar
Sep 28, 2003

Brilliant Master Genius

JawnV6 posted:

As a trivial example, in vim * will search for the current word in the same file.

Ctrl+F

JawnV6 posted:

But vim also has %, which finds the matching brace for the one under the cursor, and VS simply doesn't have an equivalent.

Ctrl+]

edit: oh, I was beaten to Ctrl+] :(

JawnV6
Jul 4, 2004

So hot ...
Ugh, second time I've been corrected like this. Thanks! There's more esoteric vim hooks that I'd like, but it's not worth drilling down on that.

Shinku ABOOKEN posted:

Also: Windows style navigation and selection (Arrow keys+Modifiers+Home+End+PgUp+PgDn) > Your bespoke navigation system every single time (same for Emacs and whatever else is there).
Easy navigation from the home row common to countless other unix utilities is now "bespoke"? I learned it from nethack of all things. Nevermind that arrow keys etc. work just fine in gvim.

Shinku ABOOKEN posted:

It's OK to love vim just don't claim it's superior.
Yeah, declaring that something's better or worse from a position of abject ignorance would just be daft.

And that same paragraph had a better version of what I used * for :)

Volte
Oct 4, 2004

woosh woosh
It's okay to use the mouse and arrow keys in Vim, it's not shameful despite what other people might try to tell you. You also get many other useful things like text objects, the f/t keys for jumping to a character on the line, 'cc' for replacing the current line, 'ciw' for erasing and changing the current word, 'ci(' for erasing the contents of the current set of parens, and other such things. Vim's good at navigation, but editing and transformation are its real strong suit. It takes a bit of time to learn but if you do a lot of coding you will become proficient before very long.

Zhentar
Sep 28, 2003

Brilliant Master Genius

JawnV6 posted:

And that same paragraph had a better version of what I used * for :)

Oh, I misunderstood what you meant there.


Although I can offer one even better - thanks to Productivity Power Tools, I don't have to type anything at all to get other instances of the identifier under the cursor highlighted.

MononcQc
May 29, 2007

I ended up going with vim because any non-modal editor or IDE has keyboard shortcuts that require using 2-3 fingers each for plenty of tasks, and after a while, I ended up having severe wrist pain every week or so, which would require ice and rest for hours.

I tried vim because modal editing meant I had fewer keys to hit at once for any shortcut, and the pain went away almost instantly, and never came back. An editor that doesn't support modal editing is a no-go for me, because I'm not willing to get hurt just to type code :argh:

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug
http://blog.scrt.ch/2013/06/04/mongodb-rce-by-databasespraying/

quote:

> db.eval('Mongo.prototype.find("a",{"b":"c"},"d","e","f","g","h")');
Fri May 31 13:34:07.514 DBClientCursor::init call() failed
Fri May 31 13:34:07.515 JavaScript execution failed: Error: error doing query: failed at src/mongo/shell/query.js:L78
Fri May 31 13:34:07.525 trying reconnect to 127.0.0.1:27017
Fri May 31 13:34:07.526 reconnect 127.0.0.1:27017 failed couldn't connect to server 127.0.0.1:27017
Already ? And on the server side ?

Fri May 31 13:34:07.387 Invalid access at address: 0x5000000 from thread: conn3
Fri May 31 13:34:07.387 Got signal: 11 (Segmentation fault).

[…]

> use databaseMapped
switched to db databaseMapped
> sizechunk=0x1338; chunk=""; for(i=0;i<sizechunk;i++){ chunk+="\x01\x02\x03\x04\x05\x06\x07\x08"; } for(i=0;i<30000;i++){ db.my_collection.insert({my_chunk:chunk}) }
can't map file memory - mongo requires 64 bit build for larger datasets
04048000-08048000 rw-s 00000000 08:01 4448283 /data/db/databaseMapped.2
A native code bug in mongo's javascript interpreter causes a segfault by hitting a predictable address; forcing mongo to mmap database contents there allows you to write basically unlimited shellcode into the database and execute it.

Wiggly Wayne DDS
Sep 11, 2010



Cocoa Crispies posted:

http://blog.scrt.ch/2013/06/04/mongodb-rce-by-databasespraying/

A native code bug in mongo's javascript interpreter causes a segfault by hitting a predictable address; forcing mongo to mmap database contents there allows you to write basically unlimited shellcode into the database and execute it.
You missed the best part, he disclosed it to the developers who told him it was patched in 2.4.3. The example works in 2.4.4.

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

JawnV6 posted:

My current IDE literally does not have options to move around in the code like vim provides by default. It's not a matter of I can't get used to it, it's that the IDE offers no support for the thing I wanted to do and I have to go without.

As a trivial example, in vim * will search for the current word in the same file. Shift-F12 does something similar and comes up with every instance of that variable across the project, a half step up even. But vim also has %, which finds the matching brace for the one under the cursor, and VS simply doesn't have an equivalent.

But VS automatically highlights the matching brace, so there's no need. :confused:

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

Ithaqua posted:

But VS automatically highlights the matching brace, so there's no need. :confused:

Vim and VS (and most other editors) both automatically highlight the matching brace; % moves your cursor there. Highlighting has no effect on the utility of moving there, especially given it can be used as a command quantifier.

JawnV6
Jul 4, 2004

So hot ...

Ithaqua posted:

But VS automatically highlights the matching brace, so there's no need. :confused:

Which is entirely unhelpful when that matching brace is offscreen, or I want to use a regex to replace text in this function alone, or...

e: it also only highlights when the cursor is 'outside' the brace

ephphatha
Dec 18, 2009




Someone in irc linked this amazing piece of code.

PHP code:
<?php
#####################################################################################
### termcolored() by Joel De Gan, joeldg 
### [url]http://www.tenshimedia.com[/url]
### this function only useful for terminal run scripts.. I am not sure what this
### this would do run from a web based script.
### usage termcolored(text to output, color code);
### colors as follows for terminals..
###     default = 31(red)
###     1 boldish
###     4 = underline
###     7 = highlight
###     31 = red
###     32 = green
###     33 = yellow
###     34 = blue
###     35 = purple
###     36 = light blue
###     37 = pure white
###     41 - 47 reverse 31 - 37  so 41 is red background white text
#####################################################################################
function termcolored($text, $color=31){
    echo exec("perl -e "print chr(27).'[01;$color m$text'.chr(27).'[00m';"");
}// end function
?>
Possibly the best PHP code I've ever seen.


VVVV "We've found 53,442 code results" :smith:

ephphatha fucked around with this message at 12:06 on Jun 5, 2013

seiken
Feb 7, 2005

hah ha ha

https://github.com/search?q=extension%3Aphp+exec+%24_GET&type=Code&ref=searchresults

Bonfire Lit
Jul 9, 2008

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

Ephphatha posted:

Possibly the best PHP code I've ever seen.
I like how they just pasted that piece of code without ever testing it (unless exec is somehow specially handled inside the PHP parser so that you don't need to escape quotes inside strings)

Zombywuf
Mar 29, 2008

JawnV6 posted:

Ugh, second time I've been corrected like this. Thanks! There's more esoteric vim hooks that I'd like, but it's not worth drilling down on that.

Did you not realise that this is what text editor wars are for?

Pilsner
Nov 23, 2002

Sagacity posted:

I had a coworker for a while who would refuse to use a regular text editor and instead was continually loving around with vim. Whenever he wanted to ask me something he would spend minutes just mashing keys just to open the right file, trying to get a window open, trying to get syntax highlighting to work. He wanted to be a real code hacker so bad!
Maybe he was in the learning stage. I sometimes force myself to use keyboard shortcuts instead of fiddling around with the mouse, or spend ages making a good Regex to do what I want instead of doing it manually. It takes time to learn, and is certainly worth doing during office time. Who looks over a developer's shoulder at that level anyway?

What you're saying reminds me though, of an old co-worker who did some Emacs magic on a text file. It was kinda like you described, he was pressing key combinations that did nothing for like 10 seconds, then at the end, boom, the file was fixed as he wanted it.

JawnV6 posted:

My current IDE literally does not have options to move around in the code like vim provides by default. It's not a matter of I can't get used to it, it's that the IDE offers no support for the thing I wanted to do and I have to go without.

As a trivial example, in vim * will search for the current word in the same file. Shift-F12 does something similar and comes up with every instance of that variable across the project, a half step up even. But vim also has %, which finds the matching brace for the one under the cursor, and VS simply doesn't have an equivalent.
Actually Shift+F12 in VS analyzes the code tree, which is more than just searching for a variable by name. Pretty invaluable.

If I were to post one Visual Studio horror though, it's that I simply cannot find a hotkey to bind to the "Publish Web" (one click publish) button/action on the menu bar. Argh.

Ochowie
Nov 9, 2007

Pilsner posted:

If I were to post one Visual Studio horror though, it's that I simply cannot find a hotkey to bind to the "Publish Web" (one click publish) button/action on the menu bar. Argh.

I've had the same issue. I can't seem to find a place to bind my own hotkey to that either.

zergstain
Dec 15, 2005

Is there ever a good reason to have a return inside a macro? It seems to me all that's good for is creating leaks.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

zergstain posted:

Is there ever a good reason to have a return inside a macro? It seems to me all that's good for is creating leaks.

It depends, is the macro named RETURN_<something>?

JawnV6
Jul 4, 2004

So hot ...
ASSERT()

zergstain
Dec 15, 2005

Jabor posted:

It depends, is the macro named RETURN_<something>?

ERR_CHECK(err) Expands to
code:
if (err != NULL) {
        return (err);
}
ASSERT() should call abort().

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
Seems a reasonable idea to me. Sometimes you just want to say "if something goes wrong I can't handle it, punt it to the caller instead", and it's good to have a common way of doing that. (I'm assuming your codebase can't deal with exceptions for whatever reason. Maybe it's straight C.)

It probably needs to be documented better, maybe given a better name, and remember things like the line number and other passed-in information in case you want to debug the root cause of something. It also probably needs a way to specify "clean this poo poo up if you do decide to return", though there are ways to work around that if it's missing.

E: also comparing an error code to null instead of to 0 is a bit of a horror I guess.

zergstain
Dec 15, 2005

I feel like by the time you wrote the macros to take as many things and cleanup functions as you need (I'm not sure all the compilers we use support variadic macros), then you'd be better off just checking for an error manually. And the majority of the code doesn't use this thing anyway.

err isn't just an integer, it's a pointer to a struct that contains a error code and a message string, and possibly other poo poo.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
If err is a complex object, then having a macro allows you to extend it later on to convey other information that shouldn't necessarily be treated as a failure, without having to change everywhere its used.

Though in that case it's probably better to use an IS_ERROR macro or something instead, rather than something that automatically returns if it is an error.

zergstain
Dec 15, 2005

We actually do have some macros like you describe. Mainly to check if the operation can just be retried, like an RPC call didn't go through. Most of the time an error means failure of course. But they don't have a return inside them, so you have a chance to do your free()s before the function returns.

Malloc Voidstar
May 7, 2007

Fuck the cowboys. Unf. Fuck em hard.
MSDN blog gives advice on password hashes: http://blogs.msdn.com/b/lixiong/archive/2011/12/25/md5-sha1-salt-and-bcrypt.aspx

quote:

With Bcrypt, you are always safe if you do not use simple password. However, the cost of using Bcrypt is that you need to buy more web servers to do authentication. As it is 10000 times slower, to get into the same level of performance, you need to increases the capacity of your hardware 10000 times. If you have 2 authentication servers now, you need to buy 20000 servers!

You can make tradeoff to help Bcrypt’s performance. You can configure the factor of Bcrypt to make it faster, but the security goes weak too. Or, you can cache the plain text password and the calculated hash in memory, but if the memory dump leaks, all the plain text passwords leak.

In such a condition, my suggestion is that using hash+salt is still ok, if you take care of the following:

1) Store the hash and salt separately.
2) Always enforce the user to use a strong password.
3) Design your hash function by yourself. Don’t just copy and paste the common open source.

Volmarias
Dec 31, 2002

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

:cripes:

I'd say I really hope someone gets that taken down, but it's from 2011 so I think that ship has sailed.

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

If you have 2 authentication servers that run at 100% load just authenticatin' your service probably isn't running too well anyway.

And Jesus Christ, "Design your hash function by yourself". That is literally the worst thing you can do except for saving plain-text passwords.

bucketmouse
Aug 16, 2004

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

Jabor posted:

The problem is that every IDE seems to use their own special snowflake keyboard shortcuts, and you have to pick up the mouse every three seconds, and ultimately I prefer smooth text editing and half-assed integration over smooth integration but half-assed editing.

If we're complaining about ides I just want to comment there is a special place in hell where you get kicked in the dick over and over again forever and whoever was responsible for VS' bizarre implementation of regex is going there. :argh:

KaneTW
Dec 2, 2011

Wheany posted:

If you have 2 authentication servers that run at 100% load just authenticatin' your service probably isn't running too well anyway.

And Jesus Christ, "Design your hash function by yourself". That is literally the worst thing you can do except for saving plain-text passwords.

It's worse than saving plain-text passwords because you have a false sense of security.

facepalmolive
Jan 29, 2009
I like how 3 of his sources are wikipedia and the last one is some other random website. It kind of explains everything. Does the MSDN blog mean that he is/was a Microsoft employee, or just some random MSDN dev? Because if it's the former, that's pretty embarrassing.

Because knowing the implementation of a hash function means knowing how to crack it, right? It just shows how he completely misses the "point" of security and cryptography research. This isn't a matter of just not knowing about a technology -- it's being completely unaware of the fundamentals.

vvvv Um, yeah. That was my point. I guess the sarcasm didn't come across well. I was referring to his advice "3) Design your hash function by yourself. Don’t just copy and paste the common open source."

facepalmolive fucked around with this message at 12:41 on Jun 7, 2013

Volmarias
Dec 31, 2002

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

facepalmolive posted:

Because knowing the implementation of a hash function means knowing how to crack it, right?

I can know how SHA works without knowing how to effectively crack it.

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

KaneTW posted:

It's worse than saving plain-text passwords because you have a false sense of security.

You're right, and I actually immediately invented a terrible hashing algorithm that satiesfies "being worse than plain-text":

code:
hash = 0;

for each character in password:
	hash = hash xor (character shifted right by 32)

See, you can't derive the original password from the hash.

Adbot
ADBOT LOVES YOU

Jonnty
Aug 2, 2007

The enemy has become a flaming star!

Wheany posted:

You're right, and I actually immediately invented a terrible hashing algorithm that satiesfies "being worse than plain-text":

code:
hash = 0;

for each character in password:
	hash = hash xor (character shifted right by 32)

See, you can't derive the original password from the hash.

This algorithm is great if you're using flat text files to store your hashes as my profiling suggests this makes them very favourable to compression!

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