HN user

briancarper

159 karma

http://carper.ca

Posts0
Comments28
View on HN
No posts found.

Interesting. A similar feature built into Vim is `cursorcolumn`, which will highlight the background of whatever column the cursor is in. If you set `cursorline` as well, you get a kind of cross-hairs around the cursor. See e.g. http://briancarper.net/vim/cursorcol.png

I find that feature useful enough that I've never needed indent guides. If you jump the cursor to the beginning of a line, you can easily see which other lines are indented equally with that line.

A new version of oyako is coming soon-ish (within a week or two) with possible mysql support, but it will always focus primarily on postgresql. The next version will also feature an SQL DSL similar to ClojureQL but less fancy / magical. (ClojureQL looks pretty cool itself though.)

In my brief experience, the idea of a cross-database SQL DSL is a lost cause unless you want to limit yourself to a very small subset of SQL. Funny, for a language that supposedly has a standard.

> I often have to navigate the project folder structure to look for stuff, I need to compare files, work with the source control and so on.. all of this I feel I can do pretty efficiently from within Eclipse.

For Vim, there are a lot of plugins to deal with source trees, but I get along fine with Vim's built-in wildmenu and tab completion. Both options are nicely configurable. For emacs, I like ido-mode. I find it much faster to browse a directory and open a file with the keyboard and tab-completed filenames than to use a mouse.

There are also commands to jump to other files to find the definitions of functions and such. It depends which programming language you're using. Vim has `gd` and friends to do the same. And then there's ctags, which integrates with Vim wonderfully. Editing Lisp code in Emacs with SLIME (for example), `M-.` will jump you to a function definition in another file.

For comparing files, it'd be hard to beat vimdiff, which provides built-in, cross-platform colored diffs of buffers. Emacs has a diff mode as well.

For source control, Vim and Emacs both integrate well with Git and others. You can stage and commit files and such via a keystroke or two. But personally I use the command line for git. (Of course you can embed a shell right in Emacs too.)

Vim and Emacs let you use "windows" (panes) instead of tabs for editing multiple files; don't overlook how awesome this is. You can view files side-by-side without having to close or hide one to open another. It frees short-term memory for other things. Once you set up keybindings for opening, closing, resizing and moving between windows, you're set. I haven't found anything faster or easier to use. Finding and viewing a buffer that isn't currently visible again uses tab-completion and is very fast.

So yes, a lot of typing. But typing is more efficient than mousing, I find. That's part of the point of Vim and Emacs to begin with.

I often work on Ruby on Rails projects in Vim with 2 dozen files open, or more, and have a very easy time.

Vim 7.3 released 16 years ago

Thank you thank you thank you for linking to this. I also use both editors (daily), and Emacs' undo system is easily among its worst and most annoying features, while Vim's undo system is among its best. The documentation at the top of undo-tree.el spells out exactly why this is the case. This library makes it all better.

Many huge Java frameworks are painfully over-complex, but personally I make good use of a lot of "tiny" Java libraries. e.g. if I want to calculate an MD5 checksum or pluralize a word, there's usually a bit of Java out there for that already. Joda-Time is a good example of a clean Java library that's fairly painless to use from Clojure.

And then sometimes people have written Clojure wrappers around Java frameworks. Ring/Compojure as a thin layer over Java servlets is a good example. clojure.contrib.sql is a thin wrapper around JDBC, so that Clojure can already talk to a wide variety of databases.

In that case you get the benefit of a solid codebase as well as the benefit of a clean Lispy interface. Not sure how much more you could ask for. It would likely take years to reproduce all of that work in pure Clojure.

You can always exit via (System/exit 0), 0 being the return code.

`java -cp clojure.jar clojure.main` is the preferred method of starting Clojure rather than using -jar, I think.

People cheat because they're immoral when no one's looking. I don't see that we need to try to justify it any further than that. Someone can get something valuable without working for it by lying/stealing, and they can probably get away with it, so they do it.

Sure, academic institutions reward cheating. What institution doesn't? Shoplifting has lots of rewards too. There are rewards to cheating at almost everything. The only things keeping people from doing it are conscience and integrity, and it's not news that many people (intelligent or not) have small supplies of both.

Cheating was rampant in my "honors" classes in high school and all through college as well, and more novel forms of cheating appear to be no less rampant in the business world. It bothers me, but I don't think we need to hunt for justifications for it. It seems easy to understand from where I'm sitting. Just be thankful we don't all have Rings of Gyges.

"If you feel that parenthesis stacking actually improves the readability of your code, by all means, feel free to do so! However, "everyone else is doing it" is not a good reason to sacrifice the readability of your code."

I think it is a good reason. The community benefits when everyone uses a consistent style. Readability isn't just about being able to read your own code, it's about helping other people read your code.

The accepted style of the community will make sense up to a point; no one wants to make things really hard on themselves, and people gravitate toward things that are comfortable. But it'll also be partly arbitrary and probably not optimal in every way. Part of learning a programming language is learning the idioms and dialects of other programmers.

Using a style no one else in the community uses is like making up your own words in spoken language. People will be able to understand you given some effort, but are they going to bother? If they do bother, they're probably going to be annoyed. Even if your new words are "better".

If you're the only one reading your code, knock yourself out. Otherwise you should probably suck it up and adapt, in my opinion.

"No other language that I'm aware of stacks scope delimiters or has a community where the standard indentation width is two spaces wide, and where sometimes even a single space is considered acceptable."

Idiomatic Ruby uses two space indentation. Maybe because Ruby is often so deeply nested, like Lisp.

My opinion today is largely the same, yes. I love Clojure and in my spare time I use it for everything. If I tried to do a web app in Common Lisp again, I'd probably have an easier time of it today than in 2008, because I know a bit more.

But I couldn't justify using either for a project for work. I generally choose Ruby instead nowadays. In Clojure I still end up rolling my own libraries for a lot of things, which is really quite fun in my spare time, but not justifiable if I'm billing by the hour and there are a dozen Ruby gems already written to do it.

We have seemingly constant threads on HN saying "I can't hire a good programmer!" What are the chances of my non-programmer boss hiring a good Lisp programmer? At the small non-profit at which I work? Good freaking luck.

I'm still using some PHP scripts at work today, and I still cringe to see the code, and I whine a little (to myself) whenever I have to edit it, and my boss still loves the end result, and it's done its job well for 2 years. What else matters? I believe in "Worse is Better" in this case.

I do sneakily use Clojure at work for small data-munging tasks. But not for code anyone else ever needs to see.

(I do also wonder why this blog post from 2008 made it to HN.)

I ran on MySQL for a few months without issues, but my code was disgusting. My choice was clean code + slow, or ugly code + fast. Today I have clean code + fast, thanks partly to better library support in Clojure, so I'm happier. I'll be the first to admit that I didn't have much of a clue a year and a half ago. I think I have a bit more of one today, but I could be wrong.

Again, not sure why any of this is important enough to talk about on HN. I'm hoping this thread dies before my server bursts into flames.

Why? Because it's a fun project to play with and a good way to learn. SQLite3 probably would work, yes.

I agree, this post shouldn't influence anyone. Not sure why it was submitted to HN.

I have a (bit of a) clue how to use a relational DB. But not from Clojure two years ago, when the only interface was a very thin layer over JDBC.

As for why it's on the homepage, I don't think it belongs here either. The intended audience was rather more narrow than HN.

I linked to other posts in that post, in which you can see some of the things I struggled with (written while I was struggling). For example:

1. Windows opening and closing seemingly at random when using SLIME 2. Horrible default fonts 3. Unfamiliar keybindings, some of which are awfully long keystrokes to do very common actions, e.g. C-x C-f to visit a file, C-x C-s to save a file. 4. Struggling with Emacs jargon and navigating the help system

There was a lot more. Part of the problem is that none of these things bother me any more, because I've drilled them into my brain over the past two years. So I don't remember everything I struggled with. I just remember being extremely frustrated.

For the most part I never found solutions other than getting used to the Emacs way of doing things, and changing my habits.

On a low level, Clojure exposes the underlying JVM, so you can instantiate and bang on Java objects all you want. It's "hybrid" in that sense, and always has been. That isn't changing. But dipping into Java in Clojure is used mostly for interop with Java libraries or to get better performance for critical sections of code.

On a higher level, in Clojure itself, there's not much OO going on (depending how you define OO), and that's not changing much either. In the new defrecords: 1) Everything is immutable, 2) There's no encapsulation of methods inside objects, 3) There's no inheritance of method implementations from "parent classes", 4) There's no data-hiding, and all fields are public. Uncontrolled thread-unsafe mutation of "objects" is still not kosher. Defrecords are kind-of-OO in the sense that there are named types that you can instantiate, the resulting things have named fields, and there's some polymorphism going on when you use protocols. But it's not really very OO in my opinion.

http://clojure.org/datatypes and http://clojure.org/protocols are the official docs, if you want to know exactly what you're getting.

"Object oriented" and "functional" are so loosely-defined that it's almost best to avoid using the terms entirely, in my opinion. See http://clojure-log.n01se.net/date/2010-04-21.html for some of Rich Hickey's opinions on how OO Clojure is nowadays. Rich uses the term "abstraction-oriented" to describe Clojure.

I second this. If your shyness is bad enough that it seriously, negatively affects your life, consider talking to a psychologist. Speaking from personal experience, it can help. There's no shame in it. A psychologist offers a non-judgmental, safe atmosphere to talk to someone well-versed in the kinds of problems you're facing. Social anxiety is a much more common problem than most people would guess, and there are ways of thinking and habits you can form that can help you overcome it.

Some people can overcome these things without help, of course, and more power to them. Just another option to consider.

No, I wrote it this way because I do feel strongly about it. I used the word "devastated" as a play on the title of the other article. I'm not "devastated", but I do feel strongly enough about this issue to alter my lifestyle, for example (e.g. avoiding TV and radio, which I very much wish I was able to enjoy).

I expect some people will agree and some disagree with what I wrote. I enjoy the discussion, but I don't get anything else out of it. I didn't have any notion that I'd convince anyone of anything. It was not an attempt to manipulate anyone. Not a conscious attempt anyways. Certainly not an attempt to manipulate people into giving me money, so I think the analogy doesn't hold.

However I may be wrong about this, it may be that my language is overboard in the way you say. Thanks for some food for thought.

I use hyperbole to emphasize a point. I don't cry myself to sleep when I see an ad, no. Sometimes I become mildly annoyed. Life is generally OK.

Likewise, ad-blocking isn't really "devastating" the internet, is it?

I am emotional about advertising in general, not those ads in particular. I am not frothing at the mouth over a single ad, no.

Are you OK with a bunch of marketing guys sitting in an office thinking "How can we manipulate people's sex drives to maximize profit this week?" Razor commercials: Hunky guy shaves; heavily-airbrushed, scantily-clad woman looks on longingly. Implication: Buy our razors, get laid. Flashing lights and "power words". Repeat over and over until you can't forget it. What's the difference between commercials and any other form of propaganda? Commercials are more mundane, but use the same principles.

Sorry, but I feel mildly insulted by this. I feel like I'm being treated like an animal. After the ten thousandth attempt to have such a thing drilled into my brain, I start to become annoyed. I'm amazed so many people happily imbibe and internalize these things without any complaint.

I have no problem with a site denying content to people using ad-blockers. That's their right. If ad-viewing is mandatory to view their content, I'll abide (by not going back, or paying real money if I think it's worth it). If it's not mandatory, why should I abide?

I have no problem with sites that have subscription models. I have no problem with sites making money.

Yes, it's my blog post. (I would hesitate to call it an article.) Advertising is unethical insofar as it's manipulative and dishonest and invasive. Even if not unethical, it's highly annoying and aesthetically displeasing. Most people probably are OK with ads, but I'm not, so I wouldn't run ads on my own site.

I looked at the ads on Ars briefly, both animated Flash ads, one for razor blades and the other I couldn't even tell what it was selling. I admit to being very emotional about this, and I can understand how some people can tolerate these, but I can't.

I'm uncertain I see your point about books. Are you asking why I can ignore the ads in the back of books, but not ignore the ones on websites? Because it's possible to read the book start to finish without any knowledge whatsoever that the ads exist. It's trivial to ignore them. If the ads on websites were all relegated to some page I had to deliberately navigate to, that'd be similar.

The article starts off saying that ad-blocking is not unethical, but then goes on to strongly imply that it is. e.g.

I think in some ways the Internet and its vast anonymity feeds into a culture where many people do not think about the people, the families, the careers that go into producing a website.

And:

And anyway, my point still stands: if you like this site you shouldn't block ads.

These sound like ethical statements to me. I may be reading more into the language of the article than is warranted, but that's how I read it: "Don't block ads because it hurts people, hurts businesses, and is therefore wrong to do."

Indeed. Putting a scantily-clad lady up on the TV screen isn't giving me any information. It's treating me like an animal, hoping my sex drive overrides the part of my brain that says "You don't really need to buy this crap".

Loud noises, cute kittens, catchy songs, scary consequences, status symbols, repetition until you can't forget the company's name if you tried. That's not any information I need.

I doubt it's possible to fix. Advertising is by its nature an attempt to manipulate people, by grabbing their attention, bombarding them with information, and eliciting emotional responses in them. Unsolicited advertisement is inherently disrespectful to the people being advertised at. There's no way to do it nicely, you can only hope people are too apathetic to complain about it.

After living with a nice s-exp language, C-like syntax seems like it brings a lot of problems with very few benefits. However I wouldn't dismiss a language based only on the syntax.

I don't know about super-programs, but I use Clojure at work (doing things no one else would ever care about) and I use it at home to solve fun problems. I previously did the same things in PHP and Perl and Ruby and Python and such, and the Clojure versions are easier to write and maintain, easier to use, less code, more fun etc. Same for Common Lisp, generally.

I wouldn't extrapolate beyond that. I don't know what languages are good for writing super-programs since I never wrote one. Super-programs are a small subset of all programs.