The Joys Of Programming

Vim is God, and like with most gods, you must radically alter yourself before you are worthy.

juv3nal wrote:

The one thing I use that I haven't seen in a decent text editor is the inline diff (select two files and "compare with -> each other" in the context menu) which I really like.

What you are describing is called "vimdiff"

One of the best parts of vimdiff mode is the Fugitive plugin's use of it for resolving Git merge conflicts.

*Legion* wrote:

Vim is God, and like with most gods, you must radically alter yourself before you are worthy.

How about you just hook me up with a solid Ruby plugin for it? Because I think it needs some altering.

Syntax highlighting and omnifunc already comes with Vim. You can enable the Ruby omnicompletion with the requisite .vimrc settings.

For Rails specifically, there is Tim Pope's vim-rails.

Current non-joy: trying to figure out Apple's series of hoops to jump through to get an app submitted for the App Store.

One of us.

If no one's linked it yet, repl.it is pretty neat.

*Legion* wrote:

Current non-joy: trying to figure out Apple's series of hoops to jump through to get an app submitted for the App Store.

..pay their ransom? Thank you folks, I'll be here all week.

One of the more amusing things I've ever run into in the software development world was a dev I know, a complete moron who thought he was god, complaining about the iPhone SDK:

"It's so limiting on what you can do."
"Uh, don't you use objective c?"
"Yeah, so?"
...

I need a book. A very specific kind of book.
I need a Python(3) equivalent of the Camel Book for Perl.

Those of you the know the Camel Book know what I mean.
Ebooks or online reference is not the same, and I'm having trouble finding a bible for python.

Oh. Also, repl.it is cooler than cool.

The closest I'm aware of is Dive into Python 3.

duckilama wrote:

I need a book. A very specific kind of book.
I need a Python(3) equivalent of the Camel Book for Perl.

Those of you the know the Camel Book know what I mean.
Ebooks or online reference is not the same, and I'm having trouble finding a bible for python.

Oh. Also, repl.it is cooler than cool.

Programming Python, 4th ed. I have the second edition, it is very similar to the Camel book. Fourth edition is Python 3.

I never pulled the trigger on Programming Python when I still bought physical books, simply because its ridiculous 1600 page girth made it less than comfortable to hold and read, and far from convenient to carry around.

I've always meant to circle back around to it for reading on my iPad or Kindle, as that issue would no longer apply.

My new challenge: giving an estimate for a new web app but in the understanding of building it on RoR instead of PHP. Also, learning the Rails part of RoR. Oh, and learning more Ruby than my I do currently.

Sounds like 2 weeks, tops. Not counting BR, QA, and server config, of course.

Define "web app". What's it do? Is it a giant n-tier buzzard, or a simple information presentation system or something in-between?

Thanks guys. Thanks alot. I spent my entire day f*$#ing around with Vim, and now I have to figure out how to surreptitiously pad my time card.

I'm seeing incredible potential on the horizon, but between me and that horizon is a vast wasteland of learning.

The one thing that is really hanging me up is code hinting/completion. My absolute favorite thing about Visual Studio, is intellisense. It's essentially an in-line reference manual. If I set up my Netbeans projects correctly, I get a passable facsimile.

Vim on the other hand, has me running down a rabbit hole of omnicomplete, ctags, exuberant ctags, , blargh.

It works well enough (sort of) with my in-file classes/methods/functions, but I want auto-complete for PHP itself.

So,
A) I need to figure out how to make auto-complete work satisfactorily
B) I need to learn to work without it
C) I'm approaching this the wrong way

Do you guys use auto-complete/code hinting?

For the web app, I'll think over how to phrase it without revealing more info than my job would appreciate.

Lex Cayman wrote:

Do you guys use auto-complete/code hinting?

Oh, yes.considering how big of a codebase I have to work within, proper auto-completion with custom class/method/function completion is huge. I've never had the idea that Vim could come close to what my preferred IDE offers. I've been using Zend Studio 5.5 since 2006, and am using the most recent version now with plans to integrate it with Zend server in our production product.

On a related note, I NEED eclipse to have embedded vim. My day job is java, and eclipse types half of my code, but I have to conform to it's whims to get that treat. It's somewhat abusive.

Help me come back to vim.

Old quote

Hypatian wrote:

All I'll say about vi is that grokking the beauty of the following key sequence is a step on the path to enlightenment:
{!}fmt

Help.

WHAT is that doing? I thought I knew vim, you've reduced me to an [insert lame editor here] user...

taer wrote:

On a related note, I NEED eclipse to have embedded vim. My day job is java, and eclipse types half of my code, but I have to conform to it's whims to get that treat. It's somewhat abusive.

Help me come back to vim.

Be like a leaf on the wind. And learn the myriad uses for Ctrl+Shift+L, Ctrl+3, and Ctrl+1.

taer wrote:

On a related note, I NEED eclipse to have embedded vim. My day job is java, and eclipse types half of my code, but I have to conform to it's whims to get that treat. It's somewhat abusive.

Help me come back to vim.

http://eclim.org

Haven't tried it myself, but it's crazy enough to work.

taer wrote:

Old quote

Hypatian wrote:

All I'll say about vi is that grokking the beauty of the following key sequence is a step on the path to enlightenment:
{!}fmt

Help.

WHAT is that doing? I thought I knew vim, you've reduced me to an [insert lame editor here] user... :)

{: move backward to the next start of paragraph

!: (movement command) -> replace text moved over with result of piping that text into an external program

}: move forward to the next end of paragraph

fmt: UNIX utility to re-flow text (i.e. word wrap it)

Paragraphs are, by default, delimited by blank lines. So "{!}fmt" re-flows the current paragraph.

When I was working with Visual C++ and MFC, I wrote a handy utility class that I put up on a website. Just today, I got a bug report:

Function vary from dialog to dialog ,means not proper working..

- With Regards
Girish

There have been multiple major revisions of Windows in the meantime. My last modified date on the code is 1998/08/23; I'm almost surprised it still works at all.

I'd take my email address off the page, but the infrequent contacts amuse me.

You know, I've been using vim as a system administration tool for the next closest thing to forever, and I had no freaking idea you could do that. Awesome.

My secrets site suddenly got a lot more popular early this morning. Got hit by a CP spam botnet. Deleted the 343 posts (twice as many as the actual number of secrets in 4 years), kept the IPs and logs, and I guess I should turn those over to someone.

Since they were all from different IPs, rate throttling wouldn't work. How do you stop something like this? In the past, I've used jQuery to insert a hidden field into the form to make sure it was a JS-enabled browser, but I'm sure they can get around that by now.

Is there a decent Ruby/Rack gem for IP banning, or a decent blacklist I could use? Any other ideas?

EDIT: still ongoing, it seems. Thank God for Nokogiri.

Bonus_Eruptus wrote:

My secrets site suddenly got a lot more popular early this morning. Got hit by a CP spam botnet. Deleted the 343 posts (twice as many as the actual number of secrets in 4 years), kept the IPs and logs, and I guess I should turn those over to someone.

Since they were all from different IPs, rate throttling wouldn't work. How do you stop something like this? In the past, I've used jQuery to insert a hidden field into the form to make sure it was a JS-enabled browser, but I'm sure they can get around that by now.

Is there a decent Ruby/Rack gem for IP banning, or a decent blacklist I could use? Any other ideas?

EDIT: still ongoing, it seems. Thank God for Nokogiri.

A fun technique I've seen is having a hidden text field and reject any form that's submitted with the field filled in. A lot of bots will blindly fill in the entire form, including hidden fields, while humans obviously will not.

LupusUmbrus wrote:
Bonus_Eruptus wrote:

My secrets site suddenly got a lot more popular early this morning. Got hit by a CP spam botnet. Deleted the 343 posts (twice as many as the actual number of secrets in 4 years), kept the IPs and logs, and I guess I should turn those over to someone.

Since they were all from different IPs, rate throttling wouldn't work. How do you stop something like this? In the past, I've used jQuery to insert a hidden field into the form to make sure it was a JS-enabled browser, but I'm sure they can get around that by now.

Is there a decent Ruby/Rack gem for IP banning, or a decent blacklist I could use? Any other ideas?

EDIT: still ongoing, it seems. Thank God for Nokogiri.

A fun technique I've seen is having a hidden text field and reject any form that's submitted with the field filled in. A lot of bots will blindly fill in the entire form, including hidden fields, while humans obviously will not.

Or use a captcha. Or both.

That's sort of the reverse of what I did. I had jQuery add the hidden field with a key to the form, and matched the value of the key behind the scenes, rejecting it if it wasn't correct. Having interviewed with a guy over the summer that makes tools to find web app vulnerabilities, I know that they can and do have JS-enabled bots.

Thought about using reCAPTCHA, too, but I know CAPTCHA in general is broken, or they'll just farm it out to a third-world country to solve. Microsoft has a JS-based thing similar to CAPTCHA where you select all the cats out of a series of animal pictures.

For now, I'm just disabling adding posts, since it's not like anyone uses the site anyway. When I get time, I'll put in a real fix, and hopefully the spammers will have given up after a few days of 301 responses.

Do submissions get posted live instantly? If so, I would change that. Make a handy little moderation queue with a simple admin panel with Yes/No buttons.

At the least, write one and give yourself the ability to switch it on and off, and you can just flip it on when you have an issue like this.

You know what would be funny?
Start another site, SpamOrNot.com where user vote on whether a given piece of text is ... spam or not. Use that as the approval process for your site. Provide an API and when it gets really popular, sell it to Microsoft for a jillion dollars.