Open Side Menu Go to the Top

07-29-2011 , 02:33 AM
I swear, I attempt to use the mouse as little as possible. It is nice to have a run option (f5 in IDLE or C-t in DrRacket), but in emacs it is C-x C-e, which is like why?

fine, here's a cool video in support of vim:

http://www.youtube.com/watch?v=pCiVCiku3cM
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
$25m Guaranteed WPM on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
07-29-2011 , 02:34 AM
While thinking about the reasons why I still use the mouse (I'm mostly a keyboarder but use the mouse occasionally while programming), I realized that I didn't know the keyboard shortcut for looking up symbols in the IDE extension I use and just figured it out what it is, which will surely lead to much increased productivity down the line. Thanks, thread!

One reason I use the mouse that I can't think of a good replacement for, though: using the mouse wheel to scroll through code looking for a particular snippet. imo it's easier to keep your eyes in the same place and scroll the code through it, rather than using page up/page down and having to scan up and down each page, or holding ctrl+down which doesn't have variable speed like the mouse wheel does.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-29-2011 , 04:55 AM
ctrl+f, type in snippet word
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-29-2011 , 05:11 AM
Am I the only one who likes using a mouse? Am I a noob for this?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-29-2011 , 09:09 AM
Quote:
Originally Posted by goofyballer
One reason I use the mouse that I can't think of a good replacement for, though: using the mouse wheel to scroll through code looking for a particular snippet. imo it's easier to keep your eyes in the same place and scroll the code through it, rather than using page up/page down and having to scan up and down each page, or holding ctrl+down which doesn't have variable speed like the mouse wheel does.
In Vim,

"Ljjjjj"

That is: "L" moves cursor to bottom of screen
Then tap "j" to move down one line at a time.
and if you hold down "j" it will scroll.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-29-2011 , 05:36 PM
Suppose you have a code snippet:

Code:
.....
....
....
....
...
...
...
.....
....
and you want to put it in a function now, so you have

Code:
def myFun():
....
....
....
....
....
....
....
....
I would normally highlight the body and then C-] (in Pyhon, obv).

It seems like this is pretty darn fast, but I am sure there is a great non-mouse answer for this.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-29-2011 , 06:49 PM
I assume you are asking about indenting?

In vim, you'd hit "V" to highlight in visual block mode, then use the ordinary movement functions to bring bring the cursor down to the last line you want indented (might be something like L or M and a couple j or k), then you tap ">>" and you're done. Indenting imo is quite a bit nicer in vim than with a mouse.

EDIT: also if you are just indenting a few lines, say 5, you can do "5>>" on the first line and it's done, no need for visual mode
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-29-2011 , 08:50 PM
Quote:
Originally Posted by kyleb
1) become proficient at using CTRL, HOME, END, DEL, SHIFT, arrow keys
2) ?
3) never use the mouse again
4) ?
5) increase coding speed by about 1.4% but gain the ability to laugh at everyone who uses the mouse
Editing code - particularly large blocks of code - is so much faster in Emacs than a Windows style IDE. The speed boost is significant. A few great features that just don't exist in Windows without moving off the home row:

Page up/down
Forward/back by word or paragraph
Highlight/copy blocks of text

Quote:
Originally Posted by daveT
Suppose you have a code snippet:

Code:
.....
....
....
....
...
...
...
.....
....
and you want to put it in a function now, so you have

Code:
def myFun():
....
....
....
....
....
....
....
....
I would normally highlight the body and then C-] (in Pyhon, obv).

It seems like this is pretty darn fast, but I am sure there is a great non-mouse answer for this.
In emacs, you type the function name at the start, Ctrl+Space to create a mark, scroll to the end of the block, enter your close point and do M-x indent-region (I think that's the command; I have a shortcut for this)
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-30-2011 , 09:59 AM
Dave,
Part of the thing I think most people who are not sold on keyboard editors yet miss is the time it takes to move your hand to the mouse and back again. It doesn't seem like it takes that much time, but it adds up.

Think of it like GPS directions. Some times the fastest route has lots of extra turns and seems more complicated. It is up to you to decide if you want to get there the fastest way possible or the way that is conceptually easy.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-30-2011 , 07:15 PM
Meh. There are probably dozens of ways to increase your productivity more effectively than becoming a keyboard only typist. It's like being 50 pounds over weight and spending an extra 2 grand on a road bike because it weighs half a kilo less.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-31-2011 , 12:53 AM
True. I'm just trying to explain to Dave why it can make a difference. I grew up in a Windows, GUI only world and know where he's coming from. Even now I'm in a hybrid zone where I use the mouse for some things but not others. I like having the option to use whatever I want to do things quickly. This is why I have an ahk script that lets me copy and paste with just my mouse.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-31-2011 , 01:38 AM
The prospect of learning how to turn my keyboard into a 100-function gamepad sounds exciting, but I think I should concern myself with other things first.

I'm hitting an ugly wall because my math is not up to par with some of the problem sets. I'm not feeling up to the challenge to do the requisite calculus courses, which there are two of. Then on to mathematics for computer scientists (which is really a bunch of proofs), then intro algorithms. After that, I think it's all book reading then a few other courses.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-31-2011 , 03:28 AM
Quote:
Originally Posted by Gullanian
I find Paypals IPN OK to work with but yeah docs are massively out of date and unhelpful.
Yeah, it was hell implementing a paypal express checkout solution.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-31-2011 , 10:40 AM
Quote:
Originally Posted by nextgenneo
Yeah, it was hell implementing a paypal express checkout solution.
Yeah, it's much harder than it seems like it should be. OTOH, the sample code is pretty plug and play
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-31-2011 , 02:31 PM
Quote:
Originally Posted by Zurvan
Yeah, it's much harder than it seems like it should be. OTOH, the sample code is pretty plug and play
I've found that google checkout was just as annoying.

Amazon Checkout was probably the best out of the big payment solutions.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-31-2011 , 06:56 PM
Where is "too much (x)?"

On one extreme, we have:



and the other:



The first, we put in well... nothing of substance; the other appears to be the entire text of your favorite book on one sheet of paper.

Somewhere in between all of this lies a wonderful balance of legibility, usability, and sense of completion, contrasted between over-complete and under-complete.

Regardless of the actual solution, which I fear translates loosely to 'it depends,' it is a fun exercise to abstract things down at every little element of the main code block.

So start up with this:

Code:
(define blowUp
  (lambda (x y z)
    (cond 
      ((and (< x y) (< x z))
       (+ (* y y) (* z z)))
      ((and (< y x) (< y z))
       (+ (* x x) (* z z)))
      ((+ (* x x) (* y y))))))
Where did this go too far?

Code:
(define square
  (lambda (x)
    (* x x)))

(define addSquare
  (lambda (x y)
    (+ (square x) (square y))))
    
(define cmpr
  (lambda (x y)
    (if (< x y)
        #t
        #f)))

(define andCmpr
  (lambda (a b c)
    (if (and (cmpr a b) (cmpr  a c))
        #t
        #f)))

(define addUp 
  (lambda (x y z)
    (cond 
      ((andCmpr x y z) 
       (addSquare y z))
      ((andCmpr y x z)
       (addSquare x z))
      ((addSquare x y)))))
I mean, disregarding syntactic sugar and stuff.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-31-2011 , 07:09 PM
"Where did this go too far?"

The 3 functions that are not "square" are all pointless and diminish clarity.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-31-2011 , 07:15 PM
You can make it a little cleaner by dropping the lambda.
Code:
(define (square x)
  (* x x))
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-31-2011 , 08:12 PM
for giggles, in Python:

Code:
def compare(a, b):
    if a < b:
        return True
    return False

def andCompare(a, b, c):
    if compare(a, b) and compare(a, c):
        return b, c
    elif compare(b, c) and compare(b, a):
        return c, a
    return a, b
    
def square(x):
    return x*x

def addSquare(x, y):
    return square(x) + square(y)

def blowUp(x, y, z):
    a, b = andCompare(x, y, z)
    sol = addSquare(a, b)
    print sol
Amateur stuff, I know, but the contrast is pretty cool to me.

I think I need to go to sleep.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-01-2011 , 08:41 AM
Code:
def compare(a, b):
    if a < b:
        return True
    return False

def andCompare(a, b, c):
    if compare(a, b) and compare(a, c):
        return b, c
    elif compare(b, c) and compare(b, a):
        return c, a
    return a, b
I would instantly not hire anyone that would write these methods.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-01-2011 , 09:52 AM
Code:
def compare(a, b):
    if a < b:
        return True
    return False


I don't know Python but wouldn't a better function definition be:

Code:
def(compare(a,b):
    return a < b;
But then you might as well not have it at all
Code:
if compare(a, b)
turns to
Code:
if a < b
Seems wholly uneccserary unless I'm missing something
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-01-2011 , 10:34 AM
If I wanted to make a small app that was an "addon" to meetup.com and i called it meetup______ (where underscores == my app name), there aren't any trademark legality issues here are there? It's possible that I would charge a small fee for usage since the app doesn't currently exist.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-01-2011 , 11:28 AM
Quote:
Originally Posted by Gullanian

Seems wholly uneccserary unless I'm missing something
you're not missing anything
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-02-2011 , 12:27 AM
Quote:
Originally Posted by jjshabado
Code:
def compare(a, b):
    if a < b:
        return True
    return False

def andCompare(a, b, c):
    if compare(a, b) and compare(a, c):
        return b, c
    elif compare(b, c) and compare(b, a):
        return c, a
    return a, b
I would instantly not hire anyone that would write these methods.
At best, I would be applying at a tech company to mop floors and refill the coffee. I would be highly ashamed to do anything like this for an interview even if I did apply for the janitor job.

Quote:
Originally Posted by Gullanian

Seems wholly uneccserary unless I'm missing something
Not missing anything. It is a mundane practice for me to see how much I can abstract stuff, and then compare what it would look like in Python and Scheme.

I know, it's probably pointless and stupid, but I was thinking I might discover something. I'm not trying to solve 42 or anything spectacular, just sating my curiosity.

The book then goes off in another direction, talking about nesting the functions and using lexical scoping because, you know, in very large programs it may not be a good idea to use global abstractions since you risk using the names somewhere else and that would be bad, which makes one ponder why abstract in the first place, or more specifically, makes one ponder the value of using a thought-of abstraction. Mind you that the course uses over-kill abstractions and I suspect this is done for the purpose making me think of this stuff.

Nesting and lexical scope is something else that I would have to try in Python, since I haven't been exposed to this concept yet. Well, lexical scoping occurs in classes, but it should be interesting to see what happens with nested functions; I haven't been exposed to nested functions yet. I won't worry about closures yet.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-02-2011 , 12:32 AM
dave,

the playing around stuff you are doing now is not worthless. i think its a great way to learn.

also, you have way too much respect for the mythical "company," "interview," and average working programmer.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
$25m Guaranteed WPM on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

      
m