Open Side Menu Go to the Top
Register
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

10-23-2013 , 02:00 PM
Just for developing and testing stuff

http://www.vagrantbox.es/

-> find Ubuntu, install, done
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-23-2013 , 02:10 PM
Vagrant and chef make a very powerful combo.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-23-2013 , 06:27 PM
For anyone looking to learn JavaScript, super neat idea http://codecombat.com/
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-24-2013 , 09:08 AM
vim adventures was super helpful to get me used to a lot of the vim commands. Really cool.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-24-2013 , 10:32 AM
Also, does anyone else use vintage mode (vim commands) with sublime? It really is the best of both worlds... modern editor, vim commands.

Soo nice.

edit: just looking at the comment above re: tools
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-24-2013 , 11:00 AM
Does it work well? I've tried other tools 'vim support' and I find it usually blows. Even if it it supports like 95% of vim commands the missing 5% can be really annoying.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-24-2013 , 11:17 AM
Quote:
Originally Posted by jjshabado
Does it work well? I've tried other tools 'vim support' and I find it usually blows. Even if it it supports like 95% of vim commands the missing 5% can be really annoying.
I'm pretty new to vim, but it does what I want.

A quick google reveals that whatever shortcomings it might have are easily solved via installing or writing python plugins (and that article was from 18 months ago). Sublime has amazing community support imo.

I can also use the mouse when in movement mode, which is nice from time to time.

In general, sublime is awesome.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-24-2013 , 11:19 AM
My vimrc in case anyone is interested in a starting point https://github.com/guyht/vimrc

Whatever you do, use pathogen to install plugins. It makes your life 100 times easier.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-24-2013 , 11:29 AM
Quote:
Originally Posted by MrWooster
For anyone looking to learn JavaScript, super neat idea http://codecombat.com/
Tried it a bit last night. Too much copy / paste mode for my tastes.

Although admittedly, the concept, graphics and music, for web-based, is very good.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-24-2013 , 11:53 AM
They just got into Ycombinator so I would expect to see a lot of improvement over the next year.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-24-2013 , 12:10 PM
http://energycommerce.house.gov/hear...0%99t-disclose

Hilarious for anyone with any knowledge of technology.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-24-2013 , 01:00 PM
Quote:
Originally Posted by MrWooster
For anyone looking to learn JavaScript, super neat idea http://codecombat.com/
That seems cool. Something I bookemarked recently in case I want to pick up Scala:
http://scalatron.github.io/
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-24-2013 , 01:15 PM
i'd like to see one for bash/unix
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-25-2013 , 06:53 AM
C# isn't that bad at all. I just finished up making a little 5 card draw poker game as my first project to learn the language.

Really glad I did this as I totally didn't realize how rusty my OOP skills were.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-25-2013 , 02:39 PM
Quote:
Originally Posted by derada4
C# isn't that bad at all. I just finished up making a little 5 card draw poker game as my first project to learn the language.

Really glad I did this as I totally didn't realize how rusty my OOP skills were.
Yeah, C# with LINQ/Generics/Async feels pretty nice, much better than Java and close enough to Scala for a lot of things.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-25-2013 , 10:05 PM
Amateur hour!

So, I never really seen binary, hex, or any of that stuff until the other day, and the question calls for converting integer to binary and binary to integer. This code feels wrong on so many levels:

Code:
def intToBinary(x):
    ans = ''
    while x > 0:
        ans += str(x % 2)
        x //= 2
    return int(ans[::-1])

def binaryToInt(x):
    sx = str(x)[::-1]
    power = 0
    ans = 0
    for i in sx:
        ans += int(i) * 2**power
        power += 1
    return ans
To confirm this somewhat works (yes, it fails for zero):

Code:
print(intToBinary(9))
print(intToBinary(1))
print(intToBinary(10))
print(intToBinary(100))
print(intToBinary(15))
print(intToBinary(89))

print(binaryToInt(intToBinary(9)))
print(binaryToInt(intToBinary(1)))
print(binaryToInt(intToBinary(10)))
print(binaryToInt(intToBinary(100)))
print(binaryToInt(intToBinary(15)))
print(binaryToInt(intToBinary(89)))

>>> 1001
1
1010
1100100
1111
1011001
9
1
10
100
15
89
Is that really the best that can be done without actually pushing bits?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-25-2013 , 11:27 PM
Hey guys can anyone help me with the following assignment (java)?

Given a class Point2D which creates a point at (x,y) coordinates
I'm to implement a class Line2D whos constructor takes in two Point2D variables a,b and creates a line x so that x is the line that goes through points a and b.

public Line2D(Point2D a, Point2D b) {
...
}

I can't get my head around how this should be done, any help would be appreciated
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-25-2013 , 11:35 PM
I'll give this a go as a hello to the programming forum.
imo
Code:
def int2b(x):
    #cant see how to do much better but
    #why call int on the return value?
    #1010 doesnt have much to do with 0b1010
    return str(intToBinary(x))

def b2i(x):
    ans = 0
    for i in x:
        ans = ans * 2 + int(i)
    return ans
Or if you want to look cool and 'push bits' you can:
ans * 2 --> ans << 1,
x % 2 --> x & 1
x /= 2 --> x >>= 1

Last edited by Allen C; 10-25-2013 at 11:42 PM. Reason: silly
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-25-2013 , 11:52 PM
Quote:
Originally Posted by Allen C
I'll give this a go as a hello to the programming forum.
imo
Code:
def int2b(x):
    #cant see how to do much better but
    #why call int on the return value?
    #1010 doesnt have much to do with 0b1010
    return str(intToBinary(x))

def b2i(x):
    ans = 0
    for i in x:
        ans = ans * 2 + int(i)
    return ans
Or if you want to look cool and 'push bits' you can:
ans * 2 --> ans << 1,
x % 2 --> x & 1
x /= 2 --> x >>= 1
Why coerce to int? It's a good question and I guess a semantic issue. I know that 0b1010 isn't an int, but it feels more filthy to call it a string. Not exactly trying to push bits in Python, the question was "Write a program that converts int to binary in a high level language of your choice" with the specification that you can't use the built-in stuff.

If it matters -- after reading the question again -- they did call for the intToBinary to return as a string and the binaryToInt to take a string. It wouldn't change the code outside a few characters. It is the coercion that bothers me.

edit to add: welcome to the forum.

edit to add more: Wait? How are you able convert without using base ^ power?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2013 , 02:04 AM
Well Python's bin() returns a string. I thing the main point of intToBinary is just to print out something for the user to see what the answer is. Your integer is already represented in binary internally of course.
And conversely in Python you can do a string in binary to int.
>>> int("111", 2)
7
So everything seems to be on the up and up.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2013 , 09:02 AM
Quote:
Originally Posted by daveT
edit to add more: Wait? How are you able convert without using base ^ power?
Multiplying or dividing by 2 is effectively a bit shift.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2013 , 12:28 PM
Quote:
Originally Posted by Xhad
Multiplying or dividing by 2 is effectively a bit shift.
i use trinary hardware you insensitive clod!
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2013 , 12:59 PM
I didn't know you were a triny
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
10-26-2013 , 01:04 PM
Quote:
Originally Posted by tyler_cracker
i use trinary hardware you insensitive clod!
Would trinary hardware still have bits? Or would it be trits?

Last edited by Xhad; 10-26-2013 at 01:06 PM. Reason: answer: yes, but I was kidding and only looked it up after I made this post
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote

      
m